public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Jason Baron <jbaron@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	boris.ostrovsky@oracle.com, david.vrabel@citrix.com
Subject: Re: Regression :-) Re: [GIT PULL RESEND] x86/jumpmplabel changes for v3.12-rc1
Date: Wed, 11 Sep 2013 11:21:49 -0400	[thread overview]
Message-ID: <20130911152149.GA22076@phenom.dumpdata.com> (raw)
In-Reply-To: <20130911105633.1c029147@gandalf.local.home>

On Wed, Sep 11, 2013 at 10:56:33AM -0400, Steven Rostedt wrote:
> On Wed, 11 Sep 2013 10:25:45 -0400
> Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> 
> > > It seems to imply line 53 is the originating bug, so that would be:
> > > 
> > >  47         if (type == JUMP_LABEL_ENABLE) {
> > >  48                 /*
> > >  49                  * We are enabling this jump label. If it is not a nop
> > >  50                  * then something must have gone wrong.
> > >  51                  */
> > >  52                 if (unlikely(memcmp((void *)entry->code, ideal_nop, 5) != 0))
> > >  53                         bug_at((void *)entry->code, __LINE__);
> > > 
> > > But it is a NOP isn't it? The code is
> > > 
> > > Unexpected op at trace_clock_global+0x6b/0x120 [ffffffff8113a21b] (0f 1f 44 00 00) 53
> > > 
> > > Perhaps the ideal_nop has not been set yet?
> > > 
> > 
> > And this looks to fix it for me.
> 
> I'm trying to understand how this will fix it for you. Are you sure you
> removed 'xen_nopvspin'?

Yes.
> 
> If you are calling static_key_slow_inc() before jump_label_init(), then
> it should still fail. The static_key_slow_inc() eventually calls
> arch_jump_label_transform(), which calls __jump_label_transform() with
> init == 0.

Perhaps I am misreading the code, but I believe init is set to one.
That is due to us calling:

arch_jump_label_transform (.., JUMP_LABEL_ENABLE)

which calls __jump_label_transform(.., 1)
?

Perhaps the 'init' and 'enable' parameters have different meanings?

> 
> The below code looks to me that it would still compare the contents
> with the ideal_nop, which hasn't been set yet.

In the !init case - sure. 

In the init case - just with default_nop.

> 
> -- Steve
> 
> > 
> > diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
> > index ee11b7d..d688348 100644
> > --- a/arch/x86/kernel/jump_label.c
> > +++ b/arch/x86/kernel/jump_label.c
> > @@ -44,13 +44,20 @@ static void __jump_label_transform(struct jump_entry *entry,
> >  	union jump_code_union code;
> >  	const unsigned char *ideal_nop = ideal_nops[NOP_ATOMIC5];
> >  
> > +	if (init) {
> > +		const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
> > +		if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0))
> > +			bug_at((void *)entry->code, __LINE__);
> > +	}
> >  	if (type == JUMP_LABEL_ENABLE) {
> >  		/*
> >  		 * We are enabling this jump label. If it is not a nop
> >  		 * then something must have gone wrong.
> >  		 */
> > -		if (unlikely(memcmp((void *)entry->code, ideal_nop, 5) != 0))
> > -			bug_at((void *)entry->code, __LINE__);
> > +		if (!init) {
> > +			if (unlikely(memcmp((void *)entry->code, ideal_nop, 5) != 0))
> > +				bug_at((void *)entry->code, __LINE__);
> > +		}
> >  
> >  		code.jump = 0xe9;
> >  		code.offset = entry->target -
> > @@ -62,11 +69,7 @@ static void __jump_label_transform(struct jump_entry *entry,
> >  		 * If this is the first initialization call, then we
> >  		 * are converting the default nop to the ideal nop.
> >  		 */
> > -		if (init) {
> > -			const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
> > -			if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0))
> > -				bug_at((void *)entry->code, __LINE__);
> > -		} else {
> > +		if (!init) {
> >  			code.jump = 0xe9;
> >  			code.offset = entry->target -
> >  				(entry->code + JUMP_LABEL_NOP_SIZE);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

  reply	other threads:[~2013-09-11 15:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-11  2:48 [GIT PULL RESEND] x86/jumpmplabel changes for v3.12-rc1 H. Peter Anvin
2013-09-11 13:47 ` Regression :-) " Konrad Rzeszutek Wilk
2013-09-11 13:57   ` Steven Rostedt
2013-09-11 13:57   ` Konrad Rzeszutek Wilk
2013-09-11 14:25     ` Konrad Rzeszutek Wilk
2013-09-11 14:56       ` Steven Rostedt
2013-09-11 15:21         ` Konrad Rzeszutek Wilk [this message]
2013-09-11 15:47           ` Steven Rostedt
2013-09-11 16:17             ` Konrad Rzeszutek Wilk
2013-09-11 17:05               ` Steven Rostedt
2013-09-11 17:25                 ` Konrad Rzeszutek Wilk
2013-09-11 17:52                   ` Steven Rostedt
2013-09-11 18:01                     ` Konrad Rzeszutek Wilk
2013-09-11 18:26                       ` Steven Rostedt
2013-09-11 18:56                         ` Konrad Rzeszutek Wilk
2013-09-11 19:14                           ` Steven Rostedt
2013-09-11 19:55                             ` Konrad Rzeszutek Wilk
2013-09-12 16:13                               ` Steven Rostedt
2013-09-11 14:38   ` 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=20130911152149.GA22076@phenom.dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox