Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752202AbdI2KBi (ORCPT ); Fri, 29 Sep 2017 06:01:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbdI2KBh (ORCPT ); Fri, 29 Sep 2017 06:01:37 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 496773B9 Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.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: Boqun Feng , "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 , "dhowells@redhat.com" , Eric Dumazet , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Oleg Nesterov , "bobby.prani@gmail.com" , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , 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> From: Paolo Bonzini Message-ID: Date: Fri, 29 Sep 2017 12:01:24 +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: <20170929093010.w56nawdoz23mkzio@tardis> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gPmpBlPddBDD4kCxbNEunVtJqhjIe4UQK" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 29 Sep 2017 10:01:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5031 Lines: 130 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gPmpBlPddBDD4kCxbNEunVtJqhjIe4UQK Content-Type: multipart/mixed; boundary="n3B0EllvoikBxOo7ssbGmE3uv7xoIJlDa"; protected-headers="v1" From: Paolo Bonzini To: Boqun Feng , "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 , "dhowells@redhat.com" , Eric Dumazet , =?UTF-8?B?RnLDqWTDqXJpYyBXZWlzYmVja2Vy?= , Oleg Nesterov , "bobby.prani@gmail.com" , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm@vger.kernel.org Message-ID: Subject: Re: [PATCH v3 tip/core/rcu 40/40] rcu: Make non-preemptive schedule be Tasks RCU quiescent state 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> In-Reply-To: <20170929093010.w56nawdoz23mkzio@tardis> --n3B0EllvoikBxOo7ssbGmE3uv7xoIJlDa Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 29/09/2017 11:30, Boqun Feng wrote: > 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 >> >> It is kvm_async_pf_task_wait() that calls schedule(), but it carefully= >> sets state to make that legal. Except... >> >>> 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 >> >> We took a page fault in vsnprintf() while doing link_path_walk(), >> which looks to be within an RCU read-side critical section. >> >> Maybe the page fault confused lockdep? >> >> 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? >=20 > 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? >=20 > 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_pree= mpt_depth(); > init_swait_queue_head(&n.wq); > hlist_add_head(&n.link, &b->list); > raw_spin_unlock(&b->lock); >=20 > (Add KVM folks and list Cced) Yes, that would work. Mind to send it as a proper patch? Thanks, Paolo > Regards, > Boqun >=20 >> Thanx, Paul > [...] >=20 --n3B0EllvoikBxOo7ssbGmE3uv7xoIJlDa-- --gPmpBlPddBDD4kCxbNEunVtJqhjIe4UQK Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAlnOGfQACgkQv/vSX3jH roPqygf/ak5o1pfPbf1MYw2cXKKE2H4FMklzZJv/L7p6fvFjEEY7dxNO5ID6dRfB U6hT1NHbgrstH1eSdSXhNfKrCJqHWhq6JsgqypQTNwBkzlsdlx03w8CKkRGCLCcF gJg6F1fMXjT1mbOEfates8sJaD5YqKy4z0ufE3LtGCN4V0zUB6+HKIb9yxyDodwI y4j6Ud08+14zYvPnn/qpuQPFOQ8rvw0MydadyqSm+qG03Ej5wkSiK6Uav1ZEqVls yr12peohscI7fOhz9js+t9dAXXhJwh6BlJtMkvQ9sQKieGEMIkV70TfcZOGOCjZh 5LmWk6LfjOiuh2IKZ1J3W18GXjemAw== =8pOA -----END PGP SIGNATURE----- --gPmpBlPddBDD4kCxbNEunVtJqhjIe4UQK--