Received: by 10.192.165.148 with SMTP id m20csp930596imm; Fri, 27 Apr 2018 09:44:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZzU4EfK0P3dDHgVcbwYdJtUE5HI/Cc2vbyuoQCj33I4PyLD11ccvS6Y4Qz1/zSCfC2NNy X-Received: by 2002:a63:6f0f:: with SMTP id k15-v6mr2699604pgc.91.1524847482958; Fri, 27 Apr 2018 09:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524847482; cv=none; d=google.com; s=arc-20160816; b=Epj5JFbZMBVLjD002bvlk5BgTDLNNiSG8d79zpq65dRIxsUz3qrrnAnaT4XMZNNtnI xlMzt2sM+BSgSu9PispeVyVL0CeIAwLW4Om4+xTuHT0L+gdbaNVSm1y3whqS7GRY96LA 2bolzflI/Oi5HCB35D3sqFtHEBwFmeyGihqFUmOPvxHGssKZ+LgsGzCbKqKHQNDhZc// VdL1ZbiFKPRxbrf3nNagg8Y1tpT3qIOT4YYQngwhqdfrCQ+V6IBBnspbZqGUllFQ6T7O wytKiKS7dG9voXkh1KlWaaXXgomy7cPey5ivAKaSqbl1ip7LKvDCUT65crJI0wfEKR0b gM6w== 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=UmqTBekoIaLYj7HdCzyay7Es3a9MLH8otUmEBVC9iGw=; b=ICRP9eXmq6G13C5Rnx17kAKPvbHz1OZFdByB0v3cCV4RUFhT1vvzNyZ2/mlhiiCsRp WZuOLSO1xUy6aOAZ3+asYowQd7ZKLuVneVvhjlZXbKvF/iesHJM4lO0BvyVnR5DkkHJw Ca50i2F9U+dPZic6shQoOJrHft/aAOSgKE9DlLrM2AKTejIoC7mMZ+W6GXpa6mEvRnMQ 4pVVHoxAbFvvPTSI3gcu/RpagTVteNpW1xceAQFWSRbbHkpAqpPMdDc9eaoVNAvnehfb ymMfpD4cVfOtXM9ioWCicb54YjtvmUft6orut1rI7YeFyI2EPkcwrV5eVmi1E9ljKiPH C2jQ== 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 q14-v6si1471014pll.542.2018.04.27.09.44.28; Fri, 27 Apr 2018 09:44:42 -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 S1758774AbeD0QnJ (ORCPT + 99 others); Fri, 27 Apr 2018 12:43:09 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45654 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1758562AbeD0QnG (ORCPT ); Fri, 27 Apr 2018 12:43:06 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3RGen1R142083 for ; Fri, 27 Apr 2018 12:43:06 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hm7gjga80-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 27 Apr 2018 12:43:05 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Apr 2018 12:43:05 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 27 Apr 2018 12:42:59 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3RGgxAn57606216; Fri, 27 Apr 2018 16:42:59 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07513B2046; Fri, 27 Apr 2018 13:45:01 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.108]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id C32A2B2056; Fri, 27 Apr 2018 13:45:00 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 8B89C16C196D; Fri, 27 Apr 2018 09:44:16 -0700 (PDT) Date: Fri, 27 Apr 2018 09:44:16 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: Joel Fernandes , linux-kernel@vger.kernel.org, Peter Zilstra , Ingo Molnar , Mathieu Desnoyers , Tom Zanussi , Namhyung Kim , Thomas Glexiner , Boqun Feng , Frederic Weisbecker , Randy Dunlap , Masami Hiramatsu , Fenguang Wu , Baohong Liu , Vedang Patel , kernel-team@android.com Subject: Re: [PATCH RFC] tracepoint: Introduce tracepoint callbacks executing with preempt on Reply-To: paulmck@linux.vnet.ibm.com References: <20180427042656.190746-1-joelaf@google.com> <20180427155701.GL26088@linux.vnet.ibm.com> <20180427121330.40b7ef15@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180427121330.40b7ef15@gandalf.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18042716-0040-0000-0000-000004233FF9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008932; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000257; SDB=6.01024091; UDB=6.00522853; IPR=6.00803321; MB=3.00020809; MTD=3.00000008; XFM=3.00000015; UTC=2018-04-27 16:43:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18042716-0041-0000-0000-000008294210 Message-Id: <20180427164416.GN26088@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-27_05:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804270160 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 27, 2018 at 12:13:30PM -0400, Steven Rostedt wrote: > On Fri, 27 Apr 2018 08:57:01 -0700 > "Paul E. McKenney" wrote: > > > > + if (preempt_on) { \ > > > + WARN_ON_ONCE(in_nmi()); /* no srcu from nmi */ \ > > > > Very good on this check, thank you! > > I think you need to return and not call the read lock. Works for me either way, at least assuming that the splat actually gets printed. ;-) > if (WARN_ON_ONCE(in_nmi())) > return; > > > > > > + idx = srcu_read_lock(&tracepoint_srcu); \ > > > > Hmmm... Do I need to create a _notrace variant of srcu_read_lock() > > and srcu_read_unlock()? > > I think so. OK, please see the (untested) patch below. Of course, srcu_read_lock_notrace() invokes __srcu_read_lock(), which looks as follows: int __srcu_read_lock(struct srcu_struct *sp) { int idx; idx = READ_ONCE(sp->srcu_idx) & 0x1; this_cpu_inc(sp->sda->srcu_lock_count[idx]); smp_mb(); /* B */ /* Avoid leaking the critical section. */ return idx; } Do I also need to make a notrace version of __srcu_read_lock()? Same question for __srcu_read_unlock(), which is similar. If so, assuming that there is no need for a notrace variant of this_cpu_inc() and smp_mb(), I suppose I could simply macro-ize the internals in both cases, but perhaps you have a better approach. Thanx, Paul ------------------------------------------------------------------------ diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 91494d7e8e41..e2e2cf05a6eb 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h @@ -195,6 +195,16 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) return retval; } +/* Used by tracing, cannot be traced and cannot invoke lockdep. */ +static inline notrace int +srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp) +{ + int retval; + + retval = __srcu_read_lock(sp); + return retval; +} + /** * srcu_read_unlock - unregister a old reader from an SRCU-protected structure. * @sp: srcu_struct in which to unregister the old reader. @@ -205,6 +215,13 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp) static inline void srcu_read_unlock(struct srcu_struct *sp, int idx) __releases(sp) { + __srcu_read_unlock(sp, idx); +} + +/* Used by tracing, cannot be traced and cannot call lockdep. */ +static inline notrace void +srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp) +{ rcu_lock_release(&(sp)->dep_map); __srcu_read_unlock(sp, idx); }