Re: global barrier & atomics in signal handlers (Re: Atomic operations within spinlocks)
Robert Haas <robertmhaas@gmail.com>
From: Robert Haas <robertmhaas@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2020-06-18T15:42:16Z
Lists: pgsql-hackers
On Wed, Jun 17, 2020 at 5:29 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > See the "Default Definitions", down near the end. Oh, yeah. I didn't realize you meant just inside this file itself. That is slightly awkward. I initially thought there was no problem because there seem to be no remaining non-default definitions of S_LOCK, but I now see that the other macros still do have some non-default definitions. Hmm. > > Really? Multiple layers of macros seem like they pretty clearly make > > the source code harder to understand. There are plenty of places where > > such devices are necessary for one reason or another, but it doesn't > > seem like something we ought to keep around for no reason. > > I wouldn't object to making the outer-layer macros in spin.h into static > inlines; as mentioned, that might have some debugging benefits. But I > think messing with s_lock.h for marginal cosmetic reasons is a foolish > idea. For one thing, there's no way whoever does it can verify all the > architecture-specific stanzas. (I don't think we even have all of them > covered in the buildfarm.) It would be a pretty mechanical change to use a separate preprocessor symbol for the conditional and just define the static inline functions on the spot. There might be one or two goofs, but if those platforms are not in the buildfarm, they're either dead and they don't matter, or someone will tell us what we did wrong. I don't know. I don't have a huge desire to spend time cleaning up s_lock.h and I do think it's better not to churn stuff around just for the heck of it, but I'm also sympathetic to Andres's point that using macros everywhere is debugger-unfriendly. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Convert SpinLock* macros to static inline functions.
- bfc321b4723e 19 (unreleased) landed
-
Clean up includes of s_lock.h.
- f219167910ad 14.0 landed
-
Fix deadlock danger when atomic ops are done under spinlock.
- 5fffa8fce37b 13.0 landed
- 6cc2866c4cdf 12.4 landed
- 825d89dda5ad 11.9 landed
- c2a84bee1228 10.14 landed
- 8bc13287ed3e 9.6.19 landed
- 3e69bf3b142b 9.5.23 landed
- cf1234a10e50 14.0 landed
-
Add basic spinlock tests to regression tests.
- 3f66e1c5a576 10.14 landed
- e027219f2131 11.9 landed
- 008c119928a3 12.4 landed
- 59225dcefef2 13.0 landed
- 3b37a6de027c 14.0 landed
- e8302f107af9 9.6.19 landed
- 7e91f90a8ed4 9.5.23 landed
-
spinlock emulation: Fix bug when more than INT_MAX spinlocks are initialized.
- dcf3cb60cbef 9.5.23 landed
- 660622053419 9.6.19 landed
- b295f666b7f0 10.14 landed
- 34d29222a0bb 11.9 landed
- b91cfaa34f44 12.4 landed
- 276bdc93924a 13.0 landed
- 4d4ca24efe8e 14.0 landed
-
Avoid potential spinlock in a signal handler as part of global barriers.
- 09bff91b316e 13.0 landed
- fd49d5380757 14.0 landed
-
Make pg_stat_wal_receiver consistent with the WAL receiver's shmem info
- 2c8dd05d6cbc 13.0 cited
-
Improve 64bit atomics support.
- e8fdbd58fe56 10.0 cited