Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3596911imu; Sun, 11 Nov 2018 19:01:29 -0800 (PST) X-Google-Smtp-Source: AJdET5fWTHQsbVfk8p/0K9+KQHyogd7b7vJxNh3MTAFnjTjx1ez/suczb7l89LzLVIuqAH1dquRi X-Received: by 2002:a63:c141:: with SMTP id p1mr15972967pgi.424.1541991689815; Sun, 11 Nov 2018 19:01:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541991689; cv=none; d=google.com; s=arc-20160816; b=Y7pXu8TsrGCfB0iDaSRc8IBT4pqABEltJefbMr53YUTcD7XuzkfwLpWA9vFb1XH97b 3orVXv7KahLBefsKz81wWNExVys5smfKGgcjlBATbTqrUhr2tDzXezqDRBVMfqsmsM2V SSiQmYnR6sVdbNXy3OXbmfRG3deaJC/twdoUJJneLUy2XO/5D0bCf3eUGJ1hS3WB4tix k4xooTrNI5OT+dtcbV8PVomQfGdIpZOmjrXnNHonrJVrkAVhm5bmCTTrhNb5UXrlr7ns 6epcA95jkLkk8WJY7XK400j4v47VCqz69Sb+MsNPzmTMXP+HmJ1P8VMTjEztMnSVgNAu XZEA== 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=EtyA5NOhqa7uFGlevmk8bzasffb7Gq1wdXwnFreWxbk=; b=rQ2kpDUJJ1u098D752frJjlUcKBF1WHJduQphEbyuB2+K39ShvKfA5Z1MQi7U+yIY5 OLmeEtNDqR4N9SnTin8hIFun56m9kE52J5VFKQwiTWByoj8eFgD7DEPF1CUiHTQBeVhc HjyG0q5rqmAigURKqdOIykzwFtw3PSk1qxUm45R12cxLB66rQOXxUcULucyQ4OfyAiBe 9K3jSm9k9G4fKtSs2Pni2Dyui0tQ2F4XdkwAt5vxPZjRXRQZ4GkLPu50CMgdADnsGUxp Er5H1u1ir0L4u5GRdrgtY/PLpjoh1+4CoowrsPrn6yfCYCki3cElHPD60pqzg95tEdzv 74ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PmzyY+j+; 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 d4-v6si16127239pla.203.2018.11.11.19.01.14; Sun, 11 Nov 2018 19:01:29 -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=PmzyY+j+; 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 S1730265AbeKLMv5 (ORCPT + 99 others); Mon, 12 Nov 2018 07:51:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:51078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729882AbeKLMv5 (ORCPT ); Mon, 12 Nov 2018 07:51:57 -0500 Received: from devnote (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (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 0C1CC208A3; Mon, 12 Nov 2018 03:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541991652; bh=VX/wc7asnQUDSmjpNuhkN4UhbmvbrnMP0iacEt1+/zw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PmzyY+j+JmktHnj88DeRP/MkXXd/iU31bR3fyxg7vVsd5G6qiFoUgtavIvFvT9klp t+BMIcBQFPG37B9fnx19x32A5jLzBRbsQ4OKtpB/qgtLNshWm2g5dM1aT85WsvyFvN rnfv/TMRjVb8Nx8gPRVtk5PmAPAvDTpccuSiP5FY= Date: Mon, 12 Nov 2018 12:00:48 +0900 From: Masami Hiramatsu To: "Paul E. McKenney" 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" , Masami Hiramatsu Subject: Re: [PATCH tip/core/rcu 20/41] kprobes: eplace synchronize_sched() with synchronize_rcu() Message-Id: <20181112120048.12b3fb7549f4b292fea1eefd@kernel.org> In-Reply-To: <20181111194410.6368-20-paulmck@linux.ibm.com> References: <20181111194104.GA4787@linux.ibm.com> <20181111194410.6368-20-paulmck@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 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)? 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