xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Keir Fraser <keir@xen.org>,
	Ian Campbell <ian.campbell@citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: [PATCH 0/5] Printk symbol specifier
Date: Mon, 4 Nov 2013 10:55:34 +0000	[thread overview]
Message-ID: <1383562539-16085-1-git-send-email-andrew.cooper3@citrix.com> (raw)

This series implements %ps and %pS, in the same way as Linux.

The first patch adds support to vsnprintf().  I audited all current uses of %p
and none would trigger the new codepath.

I was a little unsure about the best way of adding in support, so the patch is
a little RFC.

I used a switch statement to make it easier to add in further custom %p
support in the future (print hex buffer looks interesting), but forwent the
default case to reduce code motion.

The 128 byte namebuf on the stack is a tad unsavoury, but less so than a static
buffer with spinlock (which should have been included in the set of spinlocks
busted by console_force_unlock(), as printing symbols is very common on a
crash path).

The recursive call to snprintf is the least bad option available.  For the
basic string, I have copied the loop from the %s handler to save the
recursion.  Finally, all of the width specifier are ignored; I cant see a
reasonable usecase for them.


The second and third patches replace all uses of print_symbol() with %ps/%pS,
for x86 and arm respectively.  Most replacements are straight replacements,
but I have taken the opportunity to slightly cleanup the stack tracing code.
When two CPUs are racing at printing a stack, they contend on the console
spinlock, resulting in interleaving across end of the partial strings.  Now,
each full line of the stack trace is printed from a single printk(), so the
interleaving will occur at the line boundaries rather than mid-line
boundaries.

The fourth patch removes print_symbol() and friends, now that the
functionality has been completely replaced.

The fifth patch is not intended for committing, but for people wishing to test
and verify some of the boundary conditions.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Ian Campbell <ian.campbell@citrix.com>
CC: Stefano Stabellini <stefano.stabellini@citrix.com>
CC: Tim Deegan <tim@xen.org>

-- 
1.7.10.4

             reply	other threads:[~2013-11-04 10:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 10:55 Andrew Cooper [this message]
2013-11-04 10:55 ` [PATCH 1/5] common/vsprintf: Add %ps and %pS format specifier support Andrew Cooper
2013-11-04 14:51   ` Jan Beulich
2013-11-04 14:54   ` Jan Beulich
2013-11-04 18:39   ` Tim Deegan
2013-11-04 10:55 ` [PATCH 2/5] x86: Replace print_symbol() with new %ps/%pS format Andrew Cooper
2013-11-04 10:55 ` [PATCH 3/5] arm: " Andrew Cooper
2013-11-04 15:20   ` Ian Campbell
2013-11-04 10:55 ` [PATCH 4/5] common/symbols: Remove print_symbol() and associated infrastructure Andrew Cooper
2013-11-04 10:55 ` [PATCH 5/5] Test harness for new printk formatting Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383562539-16085-1-git-send-email-andrew.cooper3@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).