Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Andres Freund
Hi, On 2018-04-07 14:23:38 -0400, Tom Lane wrote: > I think I'd just drop those asserts altogether. The hardware is in charge > of complaining about misaligned pointers. I came around to that view. The problem with "natural" and atomic alignment differing is only relevant for 64bit integers (4 b

Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Andres Freund
Hi, On 2018-04-07 14:23:38 -0400, Tom Lane wrote: > I think I'd just drop those asserts altogether. The hardware is in charge > of complaining about misaligned pointers. Well, the problem is that some atomics operations on some platforms do not fail for unaligned pointers, they just loose their

Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Tom Lane
Andres Freund writes: > On 2018-04-07 14:07:05 -0400, Tom Lane wrote: >> TRAP: UnalignedPointer("(((uintptr_t) ((uintptr_t)(ptr)) + ((sizeof(*ptr)) - >> 1)) & ~((uintptr_t) ((sizeof(*ptr)) - 1))) != (uintptr_t)(ptr)", File: >> "../../../src/include/port/atomics.h", Line: 177) > Yea, I just saw

Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Andres Freund
On 2018-04-07 14:07:05 -0400, Tom Lane wrote: > Andres Freund writes: > > As Daniel pointed out in: > > https://postgr.es/m/fb948276-7b32-4b77-83e6-d00167f8e...@yesql.se the > > pg_atomic_flag fallback implementation is broken. That has gone > > unnoticed because the fallback implementation wasn'

Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Tom Lane
Andres Freund writes: > As Daniel pointed out in: > https://postgr.es/m/fb948276-7b32-4b77-83e6-d00167f8e...@yesql.se the > pg_atomic_flag fallback implementation is broken. That has gone > unnoticed because the fallback implementation wasn't testable until now: > ... > The attached fixes the bug

Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Andres Freund
Hi, On 2018-04-07 12:57:53 +, Magnus Hagander wrote: > This is the same one you already committed right? Not a further one on top > of that? Yes, I pushed a few hours later. > That said,+1 for not bothering to back patch it. I did ;). I was more wondering about whether to backpatch the AB

Re: Bring atomic flag fallback up to snuff

2018-04-07 Thread Magnus Hagander
This is the same one you already committed right? Not a further one on top of that? That said,+1 for not bothering to back patch it. /Magnus On Sat, Apr 7, 2018, 00:39 Andres Freund wrote: > Hi, > > As Daniel pointed out in: > https://postgr.es/m/fb948276-7b32-4b77-83e6-d00167f8e...@yesql.se

Bring atomic flag fallback up to snuff

2018-04-06 Thread Andres Freund
Hi, As Daniel pointed out in: https://postgr.es/m/fb948276-7b32-4b77-83e6-d00167f8e...@yesql.se the pg_atomic_flag fallback implementation is broken. That has gone unnoticed because the fallback implementation wasn't testable until now: - /* --- -* Can't run the test under the semaphore emu