[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190801214413.GA2332@hirez.programming.kicks-ass.net>
Date: Thu, 1 Aug 2019 23:44:13 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Oleg Nesterov <oleg@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, x86@...nel.org,
Ingo Molnar <mingo@...nel.org>,
Sebastian Siewior <bigeasy@...utronix.de>,
Anna-Maria Gleixner <anna-maria@...utronix.de>,
Steven Rostedt <rostedt@...dmis.org>,
Julia Cartwright <julia@...com>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@...il.com>, kvm@...r.kernel.org,
Radim Krcmar <rkrcmar@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
John Stultz <john.stultz@...aro.org>,
Andy Lutomirski <luto@...nel.org>,
"Paul E. McKenney" <paulmck@...ux.ibm.com>
Subject: Re: [patch 2/5] x86/kvm: Handle task_work on VMENTER/EXIT
On Thu, Aug 01, 2019 at 02:35:50PM -0700, Sean Christopherson wrote:
> On Thu, Aug 01, 2019 at 08:34:53PM +0200, Thomas Gleixner wrote:
> > On Thu, 1 Aug 2019, Oleg Nesterov wrote:
> > > On 08/01, Thomas Gleixner wrote:
> > > >
> > > > @@ -8172,6 +8174,10 @@ static int vcpu_run(struct kvm_vcpu *vcp
> > > > ++vcpu->stat.signal_exits;
> > > > break;
> > > > }
> > > > +
> > > > + if (notify_resume_pending())
> > > > + tracehook_handle_notify_resume();
> > >
> > > shouldn't you drop kvm->srcu before tracehook_handle_notify_resume() ?
> > >
> > > I don't understand this code at all, but vcpu_run() does this even before
> > > cond_resched().
> >
> > Yeah, I noticed that it's dropped around cond_resched().
> >
> > My understanding is that for voluntary giving up the CPU via cond_resched()
> > it needs to be dropped.
> >
> > For involuntary preemption (CONFIG_PREEMPT=y) it's not required as the
> > whole code section after preempt_enable() is fully preemptible.
> >
> > Now the 1Mio$ question is whether any of the notify functions invokes
> > cond_resched() and whether that really matters. Paolo?
>
> cond_resched() is called via tracehook_notify_resume()->task_work_run(),
> and "kernel code can only call cond_resched() in places where it ...
> cannot hold references to any RCU-protected data structures" according to
> https://lwn.net/Articles/603252/.
This is SRCU, you can reschedule while holding that just fine. It will
just delay some kvm operations, like the memslot stuff. I don't think it
is terrible to keep it, but people more versed in KVM might know of a
good reason to drop it anyway.
Powered by blists - more mailing lists