From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936057AbdIZDTK (ORCPT ); Mon, 25 Sep 2017 23:19:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60660 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935811AbdIZDTI (ORCPT ); Mon, 25 Sep 2017 23:19:08 -0400 Date: Mon, 25 Sep 2017 20:19:02 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Linus Torvalds , Linux Kernel Mailing List , Ingo Molnar , Andrew Morton , stable Subject: Re: [PATCH 1/4] rcu: Allow for page faults in NMI handlers Reply-To: paulmck@linux.vnet.ibm.com References: <20170923205621.811805556@goodmis.org> <20170923205804.098759069@goodmis.org> <20170925000303.GJ3521@linux.vnet.ibm.com> <20170925002653.GL3521@linux.vnet.ibm.com> <20170925003456.GA13412@linux.vnet.ibm.com> <20170925045632.GM3521@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170925045632.GM3521@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17092603-0052-0000-0000-0000026778E5 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007793; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000231; SDB=6.00922433; UDB=6.00463632; IPR=6.00702575; BA=6.00005606; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017276; XFM=3.00000015; UTC=2017-09-26 03:19:05 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17092603-0053-0000-0000-000052200AD0 Message-Id: <20170926031902.GA2074@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-26_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709260051 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Sep 24, 2017 at 09:56:32PM -0700, Paul E. McKenney wrote: > On Mon, Sep 25, 2017 at 06:41:30AM +0200, Steven Rostedt wrote: > > Sorry for the top post, currently on a train to Paris. > > > > This series already went through all my testing, and I would hate to rebase it for this reason. Can you just add a patch to remove the READ_ONCE()s? > > If Linus accepts the original series, easy enough. And he did, so here is the READ_ONCE()-removal commit that I have queued for the next merge window. If anyone feels it is needed sooner, please let me know. (Can't see why it is urgent myself, but who knows...) Thanx, Paul ------------------------------------------------------------------------ commit 79e6337d3f3a629be48cd45d5075d058788ce90f Author: Paul E. McKenney Date: Mon Sep 25 20:07:49 2017 -0700 rcu: Remove extraneous READ_ONCE()s from rcu_irq_{enter,exit}() The read of ->dynticks_nmi_nesting in rcu_irq_enter() and rcu_irq_exit() is currently protected with READ_ONCE(). However, this protection is unnecessary because (1) ->dynticks_nmi_nesting is updated only by the current CPU, (2) Although NMI handlers can update this field, they reset it back to its old value before return, and (3) Interrupts are disabled, so nothing else can modify it. The value of ->dynticks_nmi_nesting is thus effectively constant, and so no protection is required. This commit therefore removes the READ_ONCE() protection from these two accesses. Reported-by: Linus Torvalds Signed-off-by: Paul E. McKenney diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 872d20cee00a..e4fe06d42385 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -893,7 +893,7 @@ void rcu_irq_exit(void) rdtp = this_cpu_ptr(&rcu_dynticks); /* Page faults can happen in NMI handlers, so check... */ - if (READ_ONCE(rdtp->dynticks_nmi_nesting)) + if (rdtp->dynticks_nmi_nesting) return; WARN_ON_ONCE(IS_ENABLED(CONFIG_RCU_EQS_DEBUG) && @@ -1043,7 +1043,7 @@ void rcu_irq_enter(void) rdtp = this_cpu_ptr(&rcu_dynticks); /* Page faults can happen in NMI handlers, so check... */ - if (READ_ONCE(rdtp->dynticks_nmi_nesting)) + if (rdtp->dynticks_nmi_nesting) return; oldval = rdtp->dynticks_nesting;