pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Make init_spin_delay() C89 compliant and change stuck spinlock r
2+ messages / 1 participants
[nested] [flat]

* pgsql: Make init_spin_delay() C89 compliant and change stuck spinlock r
@ 2016-04-14 00:02 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2016-04-14 00:02 UTC (permalink / raw)
  To: pgsql-committers

Make init_spin_delay() C89 compliant and change stuck spinlock reporting.

The current definition of init_spin_delay (introduced recently in
48354581a) wasn't C89 compliant. It's not legal to refer to refer to
non-constant expressions, and the ptr argument was one.  This, as
reported by Tom, lead to a failure on buildfarm animal pademelon.

The pointer, especially on system systems with ASLR, isn't super helpful
anyway, though. So instead of making init_spin_delay into an inline
function, make s_lock_stuck() report the function name in addition to
file:line and change init_spin_delay() accordingly. While not a direct
replacement, the function name is likely more useful anyway (line
numbers are often hard to interpret in third party reports).

This also fixes what file/line number is reported for waits via
s_lock().

As PG_FUNCNAME_MACRO is now used outside of elog.h, move it to c.h.

Reported-By: Tom Lane
Discussion: 4369.1460435533@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/80abbeba23d466b6541cf95082a9e1f36704424e

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c |  4 ++--
src/backend/storage/lmgr/lwlock.c   |  2 +-
src/backend/storage/lmgr/s_lock.c   | 18 ++++++++++--------
src/include/c.h                     | 11 +++++++++++
src/include/storage/s_lock.h        |  9 +++++----
src/include/utils/elog.h            | 12 ------------
6 files changed, 29 insertions(+), 27 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Make init_spin_delay() C89 compliant #2.
@ 2016-04-15 02:28 Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Andres Freund @ 2016-04-15 02:28 UTC (permalink / raw)
  To: pgsql-committers

Make init_spin_delay() C89 compliant #2.

My previous attempt at doing so, in 80abbeba23, was not sufficient. While that
fixed the problem for bufmgr.c and lwlock.c , s_lock.c still has non-constant
expressions in the struct initializer, because the file/line/function
information comes from the caller of s_lock().

Give up on using a macro, and use a static inline instead.

Discussion: 4369.1460435533@sss.pgh.pa.us

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4b74c6a40e7ac9dad7cdeb4cfd2d51ea60cfdbb5

Modified Files
--------------
src/backend/storage/buffer/bufmgr.c |  8 ++++++--
src/backend/storage/lmgr/lwlock.c   |  4 +++-
src/backend/storage/lmgr/s_lock.c   |  4 +++-
src/include/storage/s_lock.h        | 15 +++++++++++++--
4 files changed, 25 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-04-15 02:28 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14 00:02 pgsql: Make init_spin_delay() C89 compliant and change stuck spinlock r Andres Freund <andres@anarazel.de>
2016-04-15 02:28 pgsql: Make init_spin_delay() C89 compliant #2. Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox