Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbdI2Qy4 (ORCPT ); Fri, 29 Sep 2017 12:54:56 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:46192 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752157AbdI2QyR (ORCPT ); Fri, 29 Sep 2017 12:54:17 -0400 Date: Fri, 29 Sep 2017 09:38:48 -0700 From: "Paul E. McKenney" To: Paolo Bonzini Cc: Peter Zijlstra , Boqun Feng , "Levin, Alexander (Sasha Levin)" , Sasha Levin , "linux-kernel@vger.kernel.org List" , Ingo Molnar , "jiangshanlai@gmail.com" , "dipankar@in.ibm.com" , Andrew Morton , Mathieu Desnoyers , Josh Triplett , Thomas Gleixner , "dhowells@redhat.com" , Eric Dumazet , Fr??d??ric Weisbecker , Oleg Nesterov , "bobby.prani@gmail.com" , Radim Kr??m???? , kvm@vger.kernel.org Subject: Re: [PATCH v3 tip/core/rcu 40/40] rcu: Make non-preemptive schedule be Tasks RCU quiescent state Reply-To: paulmck@linux.vnet.ibm.com References: <20170419165805.GB10874@linux.vnet.ibm.com> <1492621117-13939-40-git-send-email-paulmck@linux.vnet.ibm.com> <20170928123055.GI3521@linux.vnet.ibm.com> <20170928153813.7cernglt2d7umhpe@sasha-lappy> <20170928160514.GM3521@linux.vnet.ibm.com> <20170929093010.w56nawdoz23mkzio@tardis> <20170929103424.o4yje6sv4s3c7hmq@hirez.programming.kicks-ass.net> <03e52ee5-b5b6-edd6-c26a-54bc1aaefd63@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03e52ee5-b5b6-edd6-c26a-54bc1aaefd63@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17092916-0008-0000-0000-0000028892D6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007812; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000233; SDB=6.00924144; UDB=6.00464658; IPR=6.00704283; BA=6.00005613; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017327; XFM=3.00000015; UTC=2017-09-29 16:54:16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092916-0009-0000-0000-000036DBB5D3 Message-Id: <20170929163848.GA3521@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-29_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709290243 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1813 Lines: 41 On Fri, Sep 29, 2017 at 01:44:56PM +0200, Paolo Bonzini wrote: > On 29/09/2017 12:34, Peter Zijlstra wrote: > > On Fri, Sep 29, 2017 at 12:01:24PM +0200, Paolo Bonzini wrote: > >>> Does this mean whenever we get a page fault in a RCU read-side critical > >>> section, we may hit this? > >>> > >>> Could we simply avoid to schedule() in kvm_async_pf_task_wait() if the > >>> fault process is in a RCU read-side critical section as follow? > >>> > >>> diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > >>> index aa60a08b65b1..291ea13b23d2 100644 > >>> --- a/arch/x86/kernel/kvm.c > >>> +++ b/arch/x86/kernel/kvm.c > >>> @@ -140,7 +140,7 @@ void kvm_async_pf_task_wait(u32 token) > >>> > >>> n.token = token; > >>> n.cpu = smp_processor_id(); > >>> - n.halted = is_idle_task(current) || preempt_count() > 1; > >>> + n.halted = is_idle_task(current) || preempt_count() > 1 || rcu_preempt_depth(); > >>> init_swait_queue_head(&n.wq); > >>> hlist_add_head(&n.link, &b->list); > >>> raw_spin_unlock(&b->lock); > >>> > >>> (Add KVM folks and list Cced) > >> > >> Yes, that would work. Mind to send it as a proper patch? > > > > I'm confused, why would we do an ASYNC PF at all here? Thing is, a > > printk() shouldn't trigger a major fault _ever_. At worst it triggers > > something like a vmalloc minor fault. And I'm thinking we should not do > > the whole ASYNC machinery for minor faults. > > Async page faults are page faults _on the host_ side, and you cannot > control what the host pages out. Of course the hypervisor filters out > some cases itself (e.g. IF=0) but in general you could get one at any time. Just to make sure I am understanding this... You take a page fault on the host, and this causes a schedule() on the guest? Or did I lose the thread here? Thanx, Paul