Re: BUG #16990: Random PANIC in qemu user context

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Paul Guyot <pguyot(at)kallisys(dot)net>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16990: Random PANIC in qemu user context
Date: 2021-05-04 07:00:10
Message-ID: 20210504070010.qopwlhomkyzvq6tu@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2021-05-02 18:19:58 -0400, Tom Lane wrote:
> Paul Guyot <pguyot(at)kallisys(dot)net> writes:
> > QEMU user emulation documentation mentions something specific to threading on ARM.
> > https://qemu.readthedocs.io/en/latest/user/main.html
> >> Threading:
> >> On Linux, QEMU can emulate the clone syscall and create a real host thread (with a separate virtual CPU) for each emulated thread. Note that not all targets currently emulate atomic operations correctly. x86 and Arm use a global lock in order to preserve their semantics.
>
> Oooh, that's pretty suggestive. I wonder just when that "global lock" is
> taken or released. Maybe the timing of it is such that it interferes
> with ever seeing our lock as free?

The way it talks about threads makes me wonder if possibly cross-process
shared memory wasn't fully taken into account when using the emulated
atomics?

It's also not hard to imagine problems that exist for ll/sc style atomic
operations but not for cmpxchg/xadd/... - just acquiring a lock when ll
or sc are executing isn't sufficient, as it needs to fail if there are
any *non-atomic* writes to the relevant memory too. Which won't know to
acquire the lock...

Greetings,

Andres Freund

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-05-04 10:53:56 BUG #16991: regclass is not case sensitive causing "relation does not exist" error
Previous Message Alvaro Herrera 2021-05-04 00:21:16 Re: ALTER CONSTRAINT on a partitioned FK isn't working