linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fenghua Yu <fenghua.yu@intel.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	H Peter Anvin <hpa@zytor.com>, Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ashok Raj <ashok.raj@intel.com>, Tony Luck <tony.luck@intel.com>,
	Ravi V Shankar <ravi.v.shankar@intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>, x86 <x86@kernel.org>
Subject: Re: [PATCH v5 2/5] x86/umwait: Initialize umwait control values
Date: Mon, 24 Jun 2019 15:12:24 -0700	[thread overview]
Message-ID: <20190624221224.GA245468@romley-ivt3.sc.intel.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1906232038421.32342@nanos.tec.linutronix.de>

On Mon, Jun 24, 2019 at 12:39:05AM +0200, Thomas Gleixner wrote:
> On Wed, 19 Jun 2019, Fenghua Yu wrote:
> >  
> > +#define MSR_IA32_UMWAIT_CONTROL			0xe1
> > +#define MSR_IA32_UMWAIT_CONTROL_C02_DISABLED	BIT(0)
> > +#define MSR_IA32_UMWAIT_CONTROL_MAX_TIME	0xfffffffc
> 
> Errm, no! That's not maxtime, that's the time field mask in the
> MSR. Throughout the code you use that as a mask, which is not really
> obvious.
> 
> > +	(((max_time) & MSR_IA32_UMWAIT_CONTROL_MAX_TIME) |		\
> 
> and later on:
> 
> 	if (max_time & ~MSR_IA32_UMWAIT_CONTROL_MAX_TIME)
> 
> What? How is anyone supposed to understand that?
> 
> 	if (max_time & ~MSR_IA32_UMWAIT_CONTROL_TIME_MASK)
> 
> makes it entirely clear that the value is not allowed to have any bits
> outside of the mask set.
> 
> > +
> > +#define UMWAIT_C02_ENABLED	(0 & MSR_IA32_UMWAIT_CONTROL_C02_DISABLED)
> 
> The AND is there for maximal confusion of the reader?
> 
> > +/*
> > + * On resume, set up IA32_UMWAIT_CONTROL MSR on BP which is the only active
> > + * CPU at this time. Setting up the MSR on APs when they are re-added later
> > + * using CPU hotplug.
> > + * The MSR on BP is supposed not to be changed during suspend and thus it's
> > + * unnecessary to set it again during resume from suspend. But at this point
> > + * we don't know resume is from suspend or hibernation. To simplify the
> > + * situation, just set up the MSR on resume from suspend.
> 
> We also do not trust any firmware by default whatever it is supposed to do.

Thank you very much for pointing out and fixing all the issues and merging
the patches into the tip tree!

I test the tip tree and everything works fine.

-Fenghua



  reply	other threads:[~2019-06-24 22:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20  1:33 [PATCH v5 0/5] x86/umwait: Enable user wait instructions Fenghua Yu
2019-06-20  1:33 ` [PATCH v5 1/5] x86/cpufeatures: Enumerate " Fenghua Yu
2019-06-24  0:01   ` [tip:x86/cpu] " tip-bot for Fenghua Yu
2019-06-20  1:33 ` [PATCH v5 2/5] x86/umwait: Initialize umwait control values Fenghua Yu
2019-06-23 22:39   ` Thomas Gleixner
2019-06-24 22:12     ` Fenghua Yu [this message]
2019-06-24  0:01   ` [tip:x86/cpu] " tip-bot for Fenghua Yu
2019-06-20  1:33 ` [PATCH v5 3/5] x86/umwait: Add sysfs interface to control umwait C0.2 state Fenghua Yu
2019-06-23 22:40   ` Thomas Gleixner
2019-06-24  0:02   ` [tip:x86/cpu] " tip-bot for Fenghua Yu
2019-06-20  1:33 ` [PATCH v5 4/5] x86/umwait: Add sysfs interface to control umwait maximum time Fenghua Yu
2019-06-23 22:40   ` Thomas Gleixner
2019-06-24  0:03   ` [tip:x86/cpu] " tip-bot for Fenghua Yu
2019-06-20  1:33 ` [PATCH v5 5/5] x86/umwait: Document umwait control sysfs interfaces Fenghua Yu
2019-06-23 22:42   ` Thomas Gleixner
2019-06-23 22:46     ` Thomas Gleixner
2019-06-24  0:03   ` [tip:x86/cpu] Documentation/ABI: " tip-bot for Fenghua Yu
2019-06-20 16:25 ` [PATCH v5 0/5] x86/umwait: Enable user wait instructions Andy Lutomirski
2019-06-20 23:28   ` Fenghua Yu

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=20190624221224.GA245468@romley-ivt3.sc.intel.com \
    --to=fenghua.yu@intel.com \
    --cc=ashok.raj@intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ravi.v.shankar@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.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).