Received: by 10.213.65.68 with SMTP id h4csp733949imn; Sun, 25 Mar 2018 11:51:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx490V+lBqR5KsLJqBLp6+BGO5r+601AKIbazBklJLO38zss/LXKgSVt68nMkxP9colXtn9AC X-Received: by 2002:a17:902:b58f:: with SMTP id a15-v6mr1755400pls.326.1522003906602; Sun, 25 Mar 2018 11:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522003906; cv=none; d=google.com; s=arc-20160816; b=vvjk7yI3dz/CBFDe5dx0MFI+nV2GI2qs4lqLpReLywjYvP4qbq+OS1shv3/UblKFIA NJ6srCcksq2QHCxlm527Cz5USrmQU9BultgFjJzrHBEUZwhg5b/WIim3iBXLirq/Otzm PGQiSzzmpWuxILB489YtfmIb0bWymfWtq3wRPdhxvw4kmN6z0cGK938A90fHn3VH43jC 7aRcAqFL6ANuO//jNZ5uzwIHOI+10YdN5ScqQvPgCs9/aTWZqufA7uv9F+So/7Wd+4hf RB6bAXEVBYAdshlGB4YZ1U+r7yyYh+lMLimYU1UnNyG2cjCVe/lmILJ8ZZ/EiHb/cy7R Vblg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=p1pWfFS0flEktmjauhWcgUsFvdjB71mJ6RrgN7noEsw=; b=ayQQHiAgGqDDgPK0q3+aHuhYNO5zl2yXQFl2oWPjhBUesdkpw1eZ8hc4olOhBvQaKB BSWFSQvfjZrBCbVrTBcBFf37j2G/kfNs3VdgnYAzlHBMAzkC4A1bnqI462pCVxFmNPv4 aRmc3eoAbrIKvvUdai3bomRqE2g7JQ5CHYbElnZlJtaa7v8ozZ2z1OFbiuzlRV+eQMw/ nXe42Z8XumvcyqNt+62iXT5nP1MgkrK6efbaE86ybPQEjXI4ULX4JGugKB42L2Yk+MJx NFfGB7dhA7caanAcvwuSBbR33t+L/frTR1Qy6qdQ2/FyK/g4/uCqDkk+hMUG7d8jTYC/ cDlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o18si767600pfa.346.2018.03.25.11.51.29; Sun, 25 Mar 2018 11:51:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753967AbeCYStl (ORCPT + 99 others); Sun, 25 Mar 2018 14:49:41 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38286 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753834AbeCYStj (ORCPT ); Sun, 25 Mar 2018 14:49:39 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w2PImeul107815 for ; Sun, 25 Mar 2018 14:49:39 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0b-001b2d01.pphosted.com with ESMTP id 2gx40q1sar-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Sun, 25 Mar 2018 14:49:38 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 25 Mar 2018 14:49:38 -0400 Received: from b01cxnp22033.gho.pok.ibm.com (9.57.198.23) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 25 Mar 2018 14:49:35 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w2PInZYP45613280; Sun, 25 Mar 2018 18:49:35 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C0A02B204D; Sun, 25 Mar 2018 15:51:45 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.80.206.195]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 97CC8B2046; Sun, 25 Mar 2018 15:51:45 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 859CC16C16BA; Sun, 25 Mar 2018 11:50:26 -0700 (PDT) Date: Sun, 25 Mar 2018 11:50:26 -0700 From: "Paul E. McKenney" To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Joel Fernandes Subject: Re: rcu: Add might_sleep() check to synchronize_rcu() Reply-To: paulmck@linux.vnet.ibm.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18032518-0048-0000-0000-0000024F9A1C X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008742; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000255; SDB=6.01008305; UDB=6.00513545; IPR=6.00787593; MB=3.00020235; MTD=3.00000008; XFM=3.00000015; UTC=2018-03-25 18:49:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18032518-0049-0000-0000-0000448D56E5 Message-Id: <20180325185026.GF3675@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-03-25_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1803250229 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 23, 2018 at 10:12:24PM +0100, Thomas Gleixner wrote: > Subject: rcu: Add might_sleep() check to synchronize_rcu() > From: Thomas Gleixner > Date: Fri, 23 Mar 2018 22:02:18 +0100 > > Joel reported a debugobjects warning which is triggered by a RCU callback > invoking synchronize_rcu(). RCU callbacks run in softirq context, so > calling synchronize_rcu() is a bad idea as it might sleep. > > debugobjects triggers because __wait_rcu_gp() uses on stack objects and > invokes debug_object_init_on_stack(). That function checks the object > address against current's task stack, which fails because the code runs on > the softirq stack. > > synchronize_rcu() lacks a might_sleep() check which would have caught that > issue way earlier because it would trigger with the minimal debug options > enabled. > > Add a might_sleep() check to catch such cases. > > Reported-by: Joel Fernandes > Signed-off-by: Thomas Gleixner > Cc: "Paul E. McKenney" > Cc: Josh Triplett > Cc: Steven Rostedt > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > --- > kernel/rcu/tree_plugin.h | 1 + > 1 file changed, 1 insertion(+) > > --- a/kernel/rcu/tree_plugin.h > +++ b/kernel/rcu/tree_plugin.h > @@ -753,6 +753,7 @@ void synchronize_rcu(void) > "Illegal synchronize_rcu() in RCU read-side critical section"); > if (rcu_scheduler_active == RCU_SCHEDULER_INACTIVE) > return; > + might_sleep(); > if (rcu_gp_is_expedited()) > synchronize_rcu_expedited(); > else I could add this, but synchronize_rcu_expedited() will do either a mutex_lock() or a wait_event(), both of which already have a might_sleep(), and wait_rcu_gp() unconditionally calls wait_for_completion(), which already has a might_sleep(). Unless there is only one CPU in the system either at early boot. Is this possibility common enough to warrant a might_sleep() further up? Thanx, Paul