From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752184AbdI2LpG (ORCPT ); Fri, 29 Sep 2017 07:45:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44424 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751906AbdI2LpE (ORCPT ); Fri, 29 Sep 2017 07:45:04 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F9BBC0587C2 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH v3 tip/core/rcu 40/40] rcu: Make non-preemptive schedule be Tasks RCU quiescent state To: Peter Zijlstra Cc: Boqun Feng , "Paul E. McKenney" , "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 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> From: Paolo Bonzini Message-ID: <03e52ee5-b5b6-edd6-c26a-54bc1aaefd63@redhat.com> Date: Fri, 29 Sep 2017 13:44:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170929103424.o4yje6sv4s3c7hmq@hirez.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 29 Sep 2017 11:45:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Paolo