Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752554AbdI2Jcz (ORCPT ); Fri, 29 Sep 2017 05:32:55 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35123 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbdI2Jct (ORCPT ); Fri, 29 Sep 2017 05:32:49 -0400 X-Google-Smtp-Source: AOwi7QCQ4HcHT1YHjULoiPRWOFd/thwMc6nK/ib5pA/ISqLSnLdBySfIrF5digavFGFA/RcxzaUSzQ== Date: Fri, 29 Sep 2017 17:30:10 +0800 From: Boqun Feng To: "Paul E. McKenney" Cc: "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 , Peter Zijlstra , Steven Rostedt , "dhowells@redhat.com" , Eric Dumazet , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Oleg Nesterov , "bobby.prani@gmail.com" , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , kvm@vger.kernel.org Subject: Re: [PATCH v3 tip/core/rcu 40/40] rcu: Make non-preemptive schedule be Tasks RCU quiescent state Message-ID: <20170929093010.w56nawdoz23mkzio@tardis> 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> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="snyb7lzfjbnx7ayf" Content-Disposition: inline In-Reply-To: <20170928160514.GM3521@linux.vnet.ibm.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2902 Lines: 81 --snyb7lzfjbnx7ayf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 28, 2017 at 04:05:14PM +0000, Paul E. McKenney wrote: [...] > > __schedule+0x201/0x2240 kernel/sched/core.c:3292 > > schedule+0x113/0x460 kernel/sched/core.c:3421 > > kvm_async_pf_task_wait+0x43f/0x940 arch/x86/kernel/kvm.c:158 >=20 > It is kvm_async_pf_task_wait() that calls schedule(), but it carefully > sets state to make that legal. Except... >=20 > > do_async_page_fault+0x72/0x90 arch/x86/kernel/kvm.c:271 > > async_page_fault+0x22/0x30 arch/x86/entry/entry_64.S:1069 > > RIP: 0010:format_decode+0x240/0x830 lib/vsprintf.c:1996 > > RSP: 0018:ffff88003b2df520 EFLAGS: 00010283 > > RAX: 000000000000003f RBX: ffffffffb5d1e141 RCX: ffff88003b2df670 > > RDX: 0000000000000001 RSI: dffffc0000000000 RDI: ffffffffb5d1e140 > > RBP: ffff88003b2df560 R08: dffffc0000000000 R09: 0000000000000000 > > R10: ffff88003b2df718 R11: 0000000000000000 R12: ffff88003b2df5d8 > > R13: 0000000000000064 R14: ffffffffb5d1e140 R15: 0000000000000000 > > vsnprintf+0x173/0x1700 lib/vsprintf.c:2136 >=20 > We took a page fault in vsnprintf() while doing link_path_walk(), > which looks to be within an RCU read-side critical section. >=20 > Maybe the page fault confused lockdep? >=20 > Sigh. It is going to be a real pain if all printk()s need to be > outside of RCU read-side critical sections due to the possibility of > page faults... >=20 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) =20 n.token =3D token; n.cpu =3D smp_processor_id(); - n.halted =3D is_idle_task(current) || preempt_count() > 1; + n.halted =3D 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) Regards, Boqun > Thanx, Paul [...] --snyb7lzfjbnx7ayf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEj5IosQTPz8XU1wRHSXnow7UH+rgFAlnOEpwACgkQSXnow7UH +rg3Ywf8CtLu4RpJqwP10e9h4ReTrzViFT+RiQX/CaLuCMecjnbRVXn1hbMYI7E0 303kRUMws7U23xyXTYJdL3GI2nYogN1JUEvi22JsUWjq0koTTGzhax2Q61Hn2aZU dKev5b1TKsHFGA66kz2ZSMUSj8OmRAN+VDlXeedqFpWKuXfNtmTpwkiQyomTyZpA 8JtH1+D4zD5MoVOT2gZbUaxmkJi16biD8thDEIIVPNcp/Q9CnhdnGWqEWkeChovL /uevjUGxPfvmRPRLALsUnccuKps5uD4jjzG7qQGBL/okWbFVPxCGo7Gj8kDVGhmy LyCGpNC/vv69n1BNbaMJxtYQkCJDZw== =qjOQ -----END PGP SIGNATURE----- --snyb7lzfjbnx7ayf--