From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Peter Zijlstra <peterz@infradead.org>,
Wanpeng Li <wanpeng.li@hotmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org
Subject: Re: [PATCH] kvm/x86: Avoid async PF to end RCU read-side critical section early in PREEMPT=n kernel
Date: Fri, 6 Oct 2017 14:41:49 +0200 [thread overview]
Message-ID: <20171006124148.GA16466@flask> (raw)
In-Reply-To: <20171006013349.bgwpd3djojyxn7al@tardis>
2017-10-06 09:33+0800, Boqun Feng:
> On Tue, Oct 03, 2017 at 02:11:08PM +0000, Paolo Bonzini wrote:
> > I'd prefer a slight change in subject and topic:
> >
> > ------- 8< --------
> > Subject: [PATCH] kvm/x86: Avoid async PF preempting the kernel incorrectly
> >
> > Currently, in PREEMPT_COUNT=n kernel, kvm_async_pf_task_wait() could call
> > schedule() to reschedule in some cases. This could result in
> > accidentally ending the current RCU read-side critical section early,
> > causing random memory corruption in the guest, or otherwise preempting
> > the currently running task inside between preempt_disable and
> > preempt_enable.
> >
> > The difficulty to handle this well is because we don't know whether an
> > async PF delivered in a preemptible section or RCU read-side critical section
> > for PREEMPT_COUNT=n, since preempt_disable()/enable() and rcu_read_lock/unlock()
> > are both no-ops in that case.
> >
> > To cure this, we treat any async PF interrupting a kernel context as one
> > that cannot be preempted, preventing kvm_async_pf_task_wait() from choosing
> > the schedule() path in that case.
> >
> > To do so, a second parameter for kvm_async_pf_task_wait() is introduced,
> > so that we know whether it's called from a context interrupting the
> > kernel, and the parameter is set properly in all the callsites.
> >
> > Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Wanpeng Li <wanpeng.li@hotmail.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
> > ------- 8< --------
> >
>
> It's more concise and accurate now!
>
> Learned a lot from your modification of commit messages, thanks!
Applied with the updated commit message, thanks.
prev parent reply other threads:[~2017-10-06 12:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 13:36 [PATCH] kvm/x86: Avoid async PF to end RCU read-side critical section early in PREEMPT=n kernel Boqun Feng
2017-10-03 14:11 ` Paolo Bonzini
2017-10-06 1:33 ` Boqun Feng
2017-10-06 12:41 ` Radim Krčmář [this message]
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=20171006124148.GA16466@flask \
--to=rkrcmar@redhat.com \
--cc=boqun.feng@gmail.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=wanpeng.li@hotmail.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 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.