Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5767660imu; Tue, 13 Nov 2018 11:24:18 -0800 (PST) X-Google-Smtp-Source: AJdET5dFJiEAWZWMz0ZqX6YUwj135/iZq29cKefQM0dCrJk6Waq34+gVCbpl7O177kl2XCQZGeSn X-Received: by 2002:a17:902:780c:: with SMTP id p12mr179599pll.197.1542137058521; Tue, 13 Nov 2018 11:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542137058; cv=none; d=google.com; s=arc-20160816; b=U8ejhJP7GATfOPSsoTVQI3Vm3C8HKWkHIlC8CvPLS2IyPno7KYwSh98owj8huhQIf4 5e3Np0KBAs5Im7AI/u64lfRcdja3u3pcoRcmUkjyQGPS4GQHrg7NH62DbMt2ym8ids1H wQm9kDj1siWZeHYnxa7u/5VcIN7YOJTT2aKPBMnBjeR/EKjkY01X/LFfVU66LmdsKzKY UERW/FA3chlNz3lw1yQiLwJErfSahUOLMDdiXAiPla5TslraJnzPnsMdNuZGyiU/oRvk Ub+QhlOfx+QsANjLYL5CWYSgIc1gfweFiOUallxR5BzGMVCMVrfPJSVP+kPEFEpfRo+r mLQg== 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=r+Q7kJRJYmCdS/J3wCU+bdhEzKamYHwnmkn5zC7DBno=; b=vCfTkz9buqG7KDnE1ni1eARHkKEuJPw++RKcbaIEhhA+iMCpoZVhrUzexLZup+4CpI Wj3CTe8C9rDHqOij/7+Lp2+hGDr2w+KN3EeKoNgbO0R5QAuJjauoIcXLwGjE6mMc0G5W KHBzlPKYfxGmm5aSL63u73qYxfOE2HHS0xGKZ8fklrMSTHpCvXVG6NofEqlTE3rAJYWt PJ1EfkxAiEyM6maEADta0ghBhkmWvpEv7WmcSfKm6BYC6Jce7w3FXgFrwOwnm5SiLWrG kr0N3/Pjwh+CWXk58a4t3Soagbb3XOlSgeZxXjMUbS9rp8h7LbOlKv0n35Nz0VJn4mL1 Cqow== 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 c1-v6si22265712pld.11.2018.11.13.11.24.02; Tue, 13 Nov 2018 11:24:18 -0800 (PST) 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 S1728242AbeKNFV4 (ORCPT + 99 others); Wed, 14 Nov 2018 00:21:56 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:37298 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725748AbeKNFV4 (ORCPT ); Wed, 14 Nov 2018 00:21:56 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wADJJ2KQ025543 for ; Tue, 13 Nov 2018 14:22:25 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2nr352c8jr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 13 Nov 2018 14:22:24 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 13 Nov 2018 19:22:23 -0000 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 13 Nov 2018 19:22:19 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wADJMImS23920668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 13 Nov 2018 19:22:18 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07C07B206A; Tue, 13 Nov 2018 19:22:18 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CECC4B2072; Tue, 13 Nov 2018 19:22:17 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.85.172.133]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Tue, 13 Nov 2018 19:22:17 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 8177316C5DBF; Tue, 13 Nov 2018 11:22:17 -0800 (PST) Date: Tue, 13 Nov 2018 11:22:17 -0800 From: "Paul E. McKenney" To: Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org, "Naveen N. Rao" , Anil S Keshavamurthy , "David S. Miller" Subject: Re: [PATCH tip/core/rcu 20/41] kprobes: eplace synchronize_sched() with synchronize_rcu() Reply-To: paulmck@linux.ibm.com References: <20181111194104.GA4787@linux.ibm.com> <20181111194410.6368-20-paulmck@linux.ibm.com> <20181112120048.12b3fb7549f4b292fea1eefd@kernel.org> <20181112031916.GF4170@linux.ibm.com> <20181113100836.567dcbdafa13546928b62d7a@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181113100836.567dcbdafa13546928b62d7a@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18111319-2213-0000-0000-00000316E734 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010043; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01116963; UDB=6.00579304; IPR=6.00897072; MB=3.00024145; MTD=3.00000008; XFM=3.00000015; UTC=2018-11-13 19:22:22 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18111319-2214-0000-0000-00005C3DFA35 Message-Id: <20181113192217.GN4170@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-11-13_12:,, 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-1807170000 definitions=main-1811130175 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 13, 2018 at 10:08:36AM -0800, Masami Hiramatsu wrote: > On Sun, 11 Nov 2018 19:19:16 -0800 > "Paul E. McKenney" wrote: > > > On Mon, Nov 12, 2018 at 12:00:48PM +0900, Masami Hiramatsu wrote: > > > On Sun, 11 Nov 2018 11:43:49 -0800 > > > "Paul E. McKenney" wrote: > > > > > > > Now that synchronize_rcu() waits for preempt-disable regions of code > > > > as well as RCU read-side critical sections, synchronize_sched() can be > > > > replaced by synchronize_rcu(). This commit therefore makes this change. > > > > > > Would you mean synchronize_rcu() can ensure that any interrupt handler > > > (which should run under preempt-disable state) run out (even on non-preemptive > > > kernel)? > > > > Yes, but only as of this merge window. See this commit: > > > > 3e3100989869 ("rcu: Defer reporting RCU-preempt quiescent states when disabled") > > OK, I also found that now those are same. > > 45975c7d21a1 ("rcu: Define RCU-sched API in terms of RCU for Tree RCU PREEMPT builds") > > Acked-by: Masami Hiramatsu Applied, thank you! Thanx, Paul > Thank you! > > > > > Don't try this in v4.19 or earlier, but v4.20 and later is OK. ;-) > > > > Thanx, Paul > > > > > If so, I agree with these changes. > > > > > > Thank you, > > > > > > > > > > > Signed-off-by: Paul E. McKenney > > > > Cc: "Naveen N. Rao" > > > > Cc: Anil S Keshavamurthy > > > > Cc: "David S. Miller" > > > > Cc: Masami Hiramatsu > > > > --- > > > > kernel/kprobes.c | 10 +++++----- > > > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > > > > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > > > > index 90e98e233647..08e31d863191 100644 > > > > --- a/kernel/kprobes.c > > > > +++ b/kernel/kprobes.c > > > > @@ -229,7 +229,7 @@ static int collect_garbage_slots(struct kprobe_insn_cache *c) > > > > struct kprobe_insn_page *kip, *next; > > > > > > > > /* Ensure no-one is interrupted on the garbages */ > > > > - synchronize_sched(); > > > > + synchronize_rcu(); > > > > > > > > list_for_each_entry_safe(kip, next, &c->pages, list) { > > > > int i; > > > > @@ -1382,7 +1382,7 @@ static int register_aggr_kprobe(struct kprobe *orig_p, struct kprobe *p) > > > > if (ret) { > > > > ap->flags |= KPROBE_FLAG_DISABLED; > > > > list_del_rcu(&p->list); > > > > - synchronize_sched(); > > > > + synchronize_rcu(); > > > > } > > > > } > > > > } > > > > @@ -1597,7 +1597,7 @@ int register_kprobe(struct kprobe *p) > > > > ret = arm_kprobe(p); > > > > if (ret) { > > > > hlist_del_rcu(&p->hlist); > > > > - synchronize_sched(); > > > > + synchronize_rcu(); > > > > goto out; > > > > } > > > > } > > > > @@ -1776,7 +1776,7 @@ void unregister_kprobes(struct kprobe **kps, int num) > > > > kps[i]->addr = NULL; > > > > mutex_unlock(&kprobe_mutex); > > > > > > > > - synchronize_sched(); > > > > + synchronize_rcu(); > > > > for (i = 0; i < num; i++) > > > > if (kps[i]->addr) > > > > __unregister_kprobe_bottom(kps[i]); > > > > @@ -1966,7 +1966,7 @@ void unregister_kretprobes(struct kretprobe **rps, int num) > > > > rps[i]->kp.addr = NULL; > > > > mutex_unlock(&kprobe_mutex); > > > > > > > > - synchronize_sched(); > > > > + synchronize_rcu(); > > > > for (i = 0; i < num; i++) { > > > > if (rps[i]->kp.addr) { > > > > __unregister_kprobe_bottom(&rps[i]->kp); > > > > -- > > > > 2.17.1 > > > > > > > > > > > > > -- > > > Masami Hiramatsu > > > > > > > > -- > Masami Hiramatsu >