All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Kees Cook <keescook@chromium.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	tcharding <me@tobin.cc>
Subject: Re: [PATCH] vsprintf: Fix memory barriers of ptr_key to have_filed_random_ptr_key
Date: Tue, 15 May 2018 18:41:17 -0400	[thread overview]
Message-ID: <20180515184117.5fb0b7fa@gandalf.local.home> (raw)
In-Reply-To: <CA+55aFztxY-w=0tPZ8KAenENA7NCYSWUcCPV4Nzs0ffwrh3G4Q@mail.gmail.com>

On Tue, 15 May 2018 15:31:37 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> > we could always do this:  
> 
> Ugh. I think I prefer the barriers.

But the ugliness is only at boot up, where the early printing is
important. The benefit of this is here:

@@ -1709,7 +1717,7 @@ static char *ptr_to_id(char *buf, char *end, void *ptr, struct printf_spec spec)
        unsigned long hashval;
        const int default_width = 2 * sizeof(ptr);
 
-       if (unlikely(!have_filled_random_ptr_key)) {
+       if (static_branch_unlikely(&not_filled_random_ptr_key)) {
                spec.field_width = default_width;
                /* string length must be less than default_width */
                return string(buf, end, "(ptrval)", spec);

Because not only do we not add any barriers, this code basically
becomes a nop once the ptr_key is filled, and this should have a small
speed up in execution (although I have not done any benchmarks).

-- Steve

  reply	other threads:[~2018-05-15 22:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 14:05 [PATCH] vsprintf: Fix memory barriers of ptr_key to have_filed_random_ptr_key Steven Rostedt
2018-05-15 16:55 ` Linus Torvalds
2018-05-15 18:57   ` Steven Rostedt
2018-05-15 19:03     ` Linus Torvalds
2018-05-15 20:10       ` Steven Rostedt
2018-05-15 22:31         ` Linus Torvalds
2018-05-15 22:41           ` Steven Rostedt [this message]
2018-05-15 23:00             ` Steven Rostedt
2018-05-15 23:10               ` Linus Torvalds
2018-05-23 10:40     ` Pavel Machek
2018-05-24 18:44       ` Steven Rostedt

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=20180515184117.5fb0b7fa@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@tobin.cc \
    --cc=peterz@infradead.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.