Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1972846ybl; Sun, 18 Aug 2019 15:14:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxA9deaH2NFZbqrgeVlG/OuZ7+7684G2jXtBpexM9RDh3UMvUulnxmoqhyy8ecpaJQo0b44 X-Received: by 2002:a17:90b:8e:: with SMTP id bb14mr17366844pjb.35.1566166470213; Sun, 18 Aug 2019 15:14:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566166470; cv=none; d=google.com; s=arc-20160816; b=z7jvsAUXbOydEEDBj5mBN4X4MostocUHNvzaSkSu1FEnqAgdV6lZyHl+OIO95FwWCl N0j+1Tn4dMU1jwjwmvHOwnVBkswWaR/eUZX1Gw+EcHk1v9z0RsE2AqqlCgDo8n4HOAqE Os6fjgGgaZVoivFp5SahXGc/qyHH2xk+nL2UrdMHHP3O8y9qCL3ZbAAeMZOVhPk5ry/R UFqU8HHxQv0aAy4BTSxPnHQAMTsxqEc33TEg3MRas4NDkA9pcd3fBs5kho6fHU4XlbCf qf2npaR8YyU0po4OmRUw4k0fftmr8LNYBqTh+Guhe/d1LLbYVvJJxzXGpVeg0fQZqVsY 11Zg== 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; bh=V7S0mZkP+lo3zyZVpqP2LW/tsGhZwy8JkRChLiRN67I=; b=RGd72MYkuT14iaOd1bQ+9CbIaNnL46VQtPQmICdeR4NCJnXu9B3YoFXENe0FgQcR86 L0tolMJn4i+9cgMl7sIlhLXI2tOlD2nZH1Y6/tL8e9GXENot4XOA8/xsLCFvP2UTKtw/ ze595Mhfh5ycgmM0/lKM7L8paPDVT1FkxcqD05p8K1TeqYkTlDuEwv28IKR6rfpzkQWP 2UzwIgjy9pFYv3ttpHL22iNpsFhYbdFrnpN8v50MLhwRP5QHMPxMA1aVWAveap00pCGt O0D/nHYYBd7LHkVN6FJG1GkfFqBxf29YccCF7emz+KATrsiILkjwBhuVnj9IB4nt1wog ZVPQ== 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 x7si8621602plv.130.2019.08.18.15.14.14; Sun, 18 Aug 2019 15:14:30 -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 S1726242AbfHRWMP (ORCPT + 99 others); Sun, 18 Aug 2019 18:12:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:18910 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726141AbfHRWMP (ORCPT ); Sun, 18 Aug 2019 18:12:15 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7IMC9qo130885 for ; Sun, 18 Aug 2019 18:12:13 -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 2ufbth55b1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 18 Aug 2019 18:12:13 -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, 18 Aug 2019 23:12:12 +0100 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; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 18 Aug 2019 23:12:08 +0100 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 x7IMC8Yp55050550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 18 Aug 2019 22:12:08 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A0F0B2090; Sun, 18 Aug 2019 22:12:08 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DD092B208D; Sun, 18 Aug 2019 22:12:07 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.201.199]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Sun, 18 Aug 2019 22:12:07 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 54DCA16C11AE; Sun, 18 Aug 2019 15:12:10 -0700 (PDT) Date: Sun, 18 Aug 2019 15:12:10 -0700 From: "Paul E. McKenney" To: "Joel Fernandes (Google)" Cc: linux-kernel@vger.kernel.org, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , rcu@vger.kernel.org, Steven Rostedt Subject: Re: [RFC v2] rcu/tree: Try to invoke_rcu_core() if in_irq() during unlock Reply-To: paulmck@linux.ibm.com References: <20190818214948.GA134430@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190818214948.GA134430@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 19081822-0060-0000-0000-0000036D6FE8 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011613; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000287; SDB=6.01248783; UDB=6.00659172; IPR=6.01030300; MB=3.00028225; MTD=3.00000008; XFM=3.00000015; UTC=2019-08-18 22:12:10 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19081822-0061-0000-0000-00004A9950DD Message-Id: <20190818221210.GP28441@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-18_10:,, 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908180245 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 18, 2019 at 05:49:48PM -0400, Joel Fernandes (Google) wrote: > When we're in hard interrupt context in rcu_read_unlock_special(), we > can still benefit from invoke_rcu_core() doing wake ups of rcuc > threads when the !use_softirq parameter is passed. This is safe > to do so because: > > 1. We avoid the scheduler deadlock issues thanks to the deferred_qs bit > introduced in commit 23634ebc1d94 ("rcu: Check for wakeup-safe > conditions in rcu_read_unlock_special()") by checking for the same in > this patch. > > 2. in_irq() implies in_interrupt() which implies raising softirq will > not do any wake ups. > > The rcuc thread which is awakened will run when the interrupt returns. > > We also honor 25102de ("rcu: Only do rcu_read_unlock_special() wakeups > if expedited") thus doing the rcuc awakening only when none of the > following are true: > 1. Critical section is blocking an expedited GP. > 2. A nohz_full CPU. > If neither of these cases are true (exp == false), then the "else" block > will run to do the irq_work stuff. > > This commit is based on a partial revert of d143b3d1cd89 ("rcu: Simplify > rcu_read_unlock_special() deferred wakeups") with an additional in_irq() > check added. > > Signed-off-by: Joel Fernandes (Google) OK, I will bite... If it is safe to wake up an rcuc kthread, why is it not safe to do raise_softirq()? And from the nit department, looks like some whitespace damage on the comments. Thanx, Paul > --- > v1->v2: Some minor character encoding issues in changelog corrected. > > Note that I am still testing this patch, but I sent an early RFC for your > feedback. Thanks! > > kernel/rcu/tree_plugin.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h > index 2defc7fe74c3..f4b3055026dc 100644 > --- a/kernel/rcu/tree_plugin.h > +++ b/kernel/rcu/tree_plugin.h > @@ -621,6 +621,11 @@ static void rcu_read_unlock_special(struct task_struct *t) > // Using softirq, safe to awaken, and we get > // no help from enabling irqs, unlike bh/preempt. > raise_softirq_irqoff(RCU_SOFTIRQ); > + } else if (exp && in_irq() && !use_softirq && > + !t->rcu_read_unlock_special.b.deferred_qs) { > + // Safe to awaken rcuc kthread which will be > + // scheduled in from the interrupt return path. > + invoke_rcu_core(); > } else { > // Enabling BH or preempt does reschedule, so... > // Also if no expediting or NO_HZ_FULL, slow is OK. > -- > 2.23.0.rc1.153.gdeed80330f-goog >