All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Frederic Weisbecker <frederic@kernel.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Wanpeng Li" <wanpengli@tencent.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	kvm@vger.kernel.org
Subject: Re: Async page fault delivered while irq are disabled?
Date: Thu, 19 Dec 2019 11:00:28 -0800	[thread overview]
Message-ID: <20191219190028.GB6439@linux.intel.com> (raw)
In-Reply-To: <20191219161524.GB24080@lenoir>

On Thu, Dec 19, 2019 at 05:15:25PM +0100, Frederic Weisbecker wrote:
> On Thu, Dec 19, 2019 at 07:57:46AM -0800, Sean Christopherson wrote:
> > On Thu, Dec 19, 2019 at 04:28:15PM +0100, Frederic Weisbecker wrote:
> > > Hi,
> > > 
> > > While checking the x86 async page fault code, I can't
> > > find anything that prevents KVM_PV_REASON_PAGE_READY to be injected
> > > while the guest has interrupts disabled. If that page fault happens
> > > to trap in an interrupt disabled section, there may be a deadlock due to the
> > > call to wake_up_process() which locks the rq->lock (among others).
> > > 
> > > Given how long that code is there, I guess such an issue would
> > > have been reported for a while already. But I just would like to
> > > be sure we are checking that.
> > > 
> > > Can someone enlighten me?
> > 
> > The check is triggered from the caller of kvm_async_page_present().
> > 
> > kvm_check_async_pf_completion()
> > |
> > |-> kvm_arch_can_inject_async_page_present()
> >     |
> >     |-> kvm_can_do_async_pf()
> >         |
> >         |-> kvm_x86_ops->interrupt_allowed()
> 
> Ah thanks, I missed that one. And what about
> kvm_async_page_present_sync()? I don't see a similar check
> there.

CONFIG_KVM_ASYNC_PF_SYNC is selected only by s390, it can't be turned on
for x86.

> And one last silly question, what about that line in
> kvm_arch_can_inject_async_page_present:
> 
> 	if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED))
> 		return true;
> 
> That looks weird, also it shortcuts the irqs_allowed() check.

I wondered about that code as well :-).  Definitely odd, but it would
require the guest to disable async #PF after an async #PF is queued.  Best
guess is the idea is that it's the guest's problem if it disables async #PF
on the fly.

  reply	other threads:[~2019-12-19 19:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-19 15:28 Async page fault delivered while irq are disabled? Frederic Weisbecker
2019-12-19 15:57 ` Sean Christopherson
2019-12-19 16:15   ` Frederic Weisbecker
2019-12-19 19:00     ` Sean Christopherson [this message]
2019-12-20  9:34       ` Paolo Bonzini
2019-12-23  2:17         ` Frederic Weisbecker
2019-12-23  8:38           ` Paolo Bonzini
2019-12-26 17:28             ` Frederic Weisbecker

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=20191219190028.GB6439@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=frederic@kernel.org \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /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.