public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yi Sun <yi.y.sun@linux.intel.com>
To: Juergen Gross <jgross@suse.com>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	mingo@kernel.org, sthemmin@microsoft.com, mikelley@microsoft.com,
	kys@microsoft.com, haiyangz@microsoft.com, hpa@zytor.com
Subject: Re: [tip:x86/hyperv] x86/hyperv: Enable PV qspinlock for Hyper-V
Date: Mon, 8 Oct 2018 16:12:23 +0800	[thread overview]
Message-ID: <20181008081223.GG11769@yi.y.sun> (raw)
In-Reply-To: <0005fc50-4415-87a0-1954-fb15a1f8bd0b@suse.com>

On 18-10-02 13:38:55, Juergen Gross wrote:
> > +static void hv_qlock_wait(u8 *byte, u8 val)
> > +{
> > +	unsigned long msr_val;
> > +
> > +	if (READ_ONCE(*byte) != val)
> > +		return;
> > +
> > +	/*
> > +	 * Read HV_X64_MSR_GUEST_IDLE MSR can trigger the guest's
> > +	 * transition to the idle power state which can be exited
> > +	 * by an IPI even if IF flag is disabled.
> > +	 */
> 
> What if interrupts are enabled? Won't a kick happening here just
> interrupt and then the following rdmsr result in a hang?
> 
> I believe the correct way would be to:
> 
> - disable interrupts before above READ_ONCE() and restore them
>   after the rdmsrl()
> 
> - return early if in_nmi()
> 
> similar as the kvm specific variant is doing it.
> 
> 
> Juergen

Thank you for the suggestion! That is a possible case. I will submit
a new version in soon.

BRs,
Yi Sun

  parent reply	other threads:[~2018-10-08  8:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-27  6:01 [PATCH v3 0/2] Enable PV qspinlock for Hyper-V Yi Sun
2018-09-27  6:01 ` [PATCH v3 1/2] X86/Hyper-V: Add Guest IDLE MSR support Yi Sun
2018-10-02 11:27   ` [tip:x86/hyperv] x86/hyperv: Add GUEST_IDLE_MSR support tip-bot for Yi Sun
2018-10-09 12:27   ` [tip:x86/paravirt] " tip-bot for Yi Sun
2018-09-27  6:01 ` [PATCH v3 2/2] locking/pvqspinlock, hv: Enable PV qspinlock for Hyper-V Yi Sun
2018-09-28 22:09   ` Michael Kelley (EOSG)
2018-10-02 11:28   ` [tip:x86/hyperv] x86/hyperv: " tip-bot for Yi Sun
2018-10-02 11:38     ` Juergen Gross
2018-10-02 12:13       ` Thomas Gleixner
2018-10-08  8:12       ` Yi Sun [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-10-08  8:29 [PATCH v4 2/2] locking/pvqspinlock, hv: " Yi Sun
2018-10-09  9:30 ` [tip:x86/hyperv] x86/hyperv: " tip-bot for Yi Sun

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=20181008081223.GG11769@yi.y.sun \
    --to=yi.y.sun@linux.intel.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=mingo@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=tglx@linutronix.de \
    /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