Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5687816imu; Tue, 13 Nov 2018 10:09:44 -0800 (PST) X-Google-Smtp-Source: AJdET5f5I+bnywDXQ+givsuf9z0mSohG6U69hn0CkwnI7Kloyjnx+uFvSThue9L84qonN9JO/M8q X-Received: by 2002:a17:902:6b87:: with SMTP id p7-v6mr6171913plk.282.1542132584501; Tue, 13 Nov 2018 10:09:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542132584; cv=none; d=google.com; s=arc-20160816; b=mXTgEzIIFA6q5pp00Lv3Qy8RzylG3yU/fexSroYaf6YE4bnpPJrEQuqD2dhikdDNgn BDhoUBVv+dxnAG4u+Rq0pa7HREiE3pbuyeMuYyJvwP5GVV+m3ZLsGw1neGJWXPNJaCuI E+8UlofRKa+BVOZPZu9UBdcPBlpDP35luvVyoXEJtabQtcWk9y6k/BvI6wLfWVBe5TY4 D9sa1i9tXO5vL1MGhcqXEyIlank24xiMTIK/c5gz5Z32dwNBJw/4bajpXNd8b8CsY4z5 vyuK21rZN71FJNY7V5hdT6QzUT1zs2TiRPihTnmVANbHO6lyrx91acIQAm8VG/yl2nP2 UmYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VMqfZL/v6E0b4sv8ez8JPMwMs55GKZ4bc6INQ4D+1E8=; b=i65TL0GmgooFCMDW9sS7W8JDbYTloVoXogBGlaKbsIXjsTDk1n+ufgTjXoi0Tq+NlM 5GTZBlki9iSSzuAYgp25xtRABF/gorTWUvqvMTwKSxSpqy2/SoPXcenK+Rmds6RzJv8q sAib7jcI5ZGJ6bc71qI3I1DV03fKIWS+te43X+0zo/1eeKYw/BwTGsGKISF80hv2Jgxn vuqCED4SBBe04+KS5En2nWnhTBJASwQp2lWlQZlZp9ZOqQc/vmhCRTbJ0bIwa0AP3kiV KLkah8K7yKg5/9CnQuKzu6lPUElqH2BTmN7oKXNoo5zaoV2B8rWJf9vuglc+3ajgevTf b7jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=p8cokIbJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si20196985pgg.463.2018.11.13.10.09.10; Tue, 13 Nov 2018 10:09:44 -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; dkim=pass header.i=@kernel.org header.s=default header.b=p8cokIbJ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732451AbeKNEHw (ORCPT + 99 others); Tue, 13 Nov 2018 23:07:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:35062 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732124AbeKNEHw (ORCPT ); Tue, 13 Nov 2018 23:07:52 -0500 Received: from devnote (unknown [64.114.255.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 82C01208A3; Tue, 13 Nov 2018 18:08:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542132518; bh=xQP50kAjy7ARw8RyNNAdepQ8FvQgeYQCTvzx9owIpuk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=p8cokIbJeH5/IReIrE4En7S1dVYNGKIM9En8KW3rKIoMsalB9vVJ27OFm+93CjaGB tuxbLjwuFqdr+BuE/DLmmBeoUAGWRQyMitiL3h+N6lj525ugBbak62NwsN4f37jRWi L4Uh6959kBoRn3jRtvGqsdp7tXuZZ8wT9C8AyfLM= Date: Tue, 13 Nov 2018 10:08:36 -0800 From: Masami Hiramatsu To: paulmck@linux.ibm.com 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() Message-Id: <20181113100836.567dcbdafa13546928b62d7a@kernel.org> In-Reply-To: <20181112031916.GF4170@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> X-Mailer: Sylpheed 3.5.0 (GTK+ 2.24.30; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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