[PATCH 0/4 v3] Use static buffers to log from driver signal handlers

Daniel Kurtz djkurtz at chromium.org
Fri Aug 5 00:09:57 PDT 2011


For Version 3:
 * 0001: Make cleaner and faster per Guillem Jover review comments.
 * 0002: Make slightly faster and fix some comments.

Back in the bad old days, using xf86Msg() from a signal handler was a
big no-no, as it would deadlock the system on malloc when the prefix is
prepended.  Thus, only X_NONE messages could be used to bypass this.
However, LogVWrite limits to 1024 bytes anyway, so a patch was made to
eliminate malloc in LogVMessageVerb().

However, input driver messages these days go through xf86VIDrvMsgVerb(),
which does its own asprintf()/mallocs() to prefix the driver and device
names, reintroducing the same old no-no.

This patchset fixes this by introducing LogVHdrMessageVerb() and friends,
which allow a caller to specify a custom header as a variable string,
between the verb and the actually message.

In addition, by passing the header to the log layer, the verbosity checks
happen before any string processing, potentially speeding up processing
for production systems.

Daniel Kurtz (4):
  os/log: Pull LogMessageTypeVerbString out of LogVMessageVerb
  os/log: Add LogVHdrMessageVerb and friends
  xf86Helper: use LogHdrMessageVerb in xf86VIDrvMsgVerb
  xf86Helper: use LogHdrMessageVerb in xf86VDrvMsgVerb

 hw/xfree86/common/xf86Helper.c |   50 +++++--------
 include/os.h                   |   13 +++
 os/log.c                       |  160 ++++++++++++++++++++++++++++------------
 3 files changed, 145 insertions(+), 78 deletions(-)

-- 
1.7.3.1



More information about the xorg-devel mailing list