Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Tom Lane
Andres Freund writes: > On 2024-07-29 12:45:19 -0400, Tom Lane wrote: >> Hmm, but how? > ... > I.e. the version using 2 as the locked state uses a three byte instruction vs > a two byte instruction before. > *If* we are worried about this, we could > a) Change the representation only for assert e

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Andres Freund
On 2024-07-29 12:45:19 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2024-07-29 12:33:13 -0400, Tom Lane wrote: > >> I dunno, is that the only extra check that the --disable-spinlocks > >> implementation is providing? > > > I think it also provides the (valuable!) check that spinlocks were

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Robert Haas
On Mon, Jul 29, 2024 at 12:40 PM Andres Freund wrote: > I think it also provides the (valuable!) check that spinlocks were actually > initialized. But that again seems like something we'd be better off adding > more general infrastructure for - nobody runs --disable-spinlocks locally, we > shouldn

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Tom Lane
Andres Freund writes: > On 2024-07-29 12:33:13 -0400, Tom Lane wrote: >> I dunno, is that the only extra check that the --disable-spinlocks >> implementation is providing? > I think it also provides the (valuable!) check that spinlocks were actually > initialized. But that again seems like someth

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Andres Freund
Hi, On 2024-07-29 12:33:13 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2024-07-29 11:31:56 -0400, Tom Lane wrote: > >> There was some recent discussion about getting rid of > >> --disable-spinlocks on the grounds that nobody would use > >> hardware that lacked native spinlocks. But now

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Tom Lane
Andres Freund writes: > On 2024-07-29 11:31:56 -0400, Tom Lane wrote: >> There was some recent discussion about getting rid of >> --disable-spinlocks on the grounds that nobody would use >> hardware that lacked native spinlocks. But now I wonder >> if there is a testing/debugging reason to keep i

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Andres Freund
Hi, On 2024-07-29 11:31:56 -0400, Tom Lane wrote: > Heikki Linnakangas writes: > > Commit 9d9b9d46f3 added spinlocks to protect the fields in ProcSignal > > flags, but in EmitProcSignalBarrier(), the spinlock was released > > twice. With most spinlock implementations, releasing a lock that's not

Re: pgsql: Fix double-release of spinlock

2024-07-29 Thread Tom Lane
Heikki Linnakangas writes: > Commit 9d9b9d46f3 added spinlocks to protect the fields in ProcSignal > flags, but in EmitProcSignalBarrier(), the spinlock was released > twice. With most spinlock implementations, releasing a lock that's not > held is not easy to notice, because most of the time it d

pgsql: Fix double-release of spinlock

2024-07-29 Thread Heikki Linnakangas
Fix double-release of spinlock Commit 9d9b9d46f3 added spinlocks to protect the fields in ProcSignal flags, but in EmitProcSignalBarrier(), the spinlock was released twice. With most spinlock implementations, releasing a lock that's not held is not easy to notice, because most of the time it does