Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2381040iof; Wed, 8 Jun 2022 03:52:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIhoNfXzcqognUppPIWU+D40Z3psoKY3SbmpgCAFTsYwMjtpfI4l68JmJyuGMIGQK6hp+v X-Received: by 2002:a17:90b:4c0f:b0:1e6:9e44:edcb with SMTP id na15-20020a17090b4c0f00b001e69e44edcbmr33585885pjb.2.1654685566478; Wed, 08 Jun 2022 03:52:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654685566; cv=none; d=google.com; s=arc-20160816; b=vh2bTGjaZo3QQ0IB7zp8dUIAtJtL1VcXs2lSjKYQXcXpPPJXJtE5eFm9X/9zbadDvu IjRLcJxVjtWHXytE3x+e9cCjkA26OqFP5/XJZkGeSwiHXsXb3EgXBVxhPaudNGuOWarF 2r2ue0FDDi/ErNk/xEjcnxP1MKrh7m0Apd/m/TcDMCdkmcgoaXRrulqmzFBWxY4/6ypr VMfeO9zf2kl2XF4GyjX2pj6rvWfP4xezU/zdny2tUClu6brYlsuYNHh+qhjH4HQJTshs W+Gx1agaQkdE+OtYSLOQ9q6Rcmp+E1lc2WnvlFlI4qNnBu9QtVjIjpkzXgMd3UCCOjLt ioKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=A+CyjXVi+KYsagLnxynLgPapKZafI2doGh1EpEXW+4I=; b=kxKhDxAonql4UT5Xkr8QOvJLlOof9T9VHKs9cMcNwAkLgfqH9jRrOspIjNslQbT4vC FsMMusj7ZKPpbeJvg+XIwmBYakvi3mWY3Gfv/4QMWTESrDFMyRCQe7dZUd/WHtH+9sko ZKL7CB6aAGoVHrpkVSgM4QJY+6DQK2YvJvfMfPkJhdt+riOeq1sBoZx6Tpiwylklpp+4 Nl5/U0F/VSpQ2yffixk0AbnlYwoO5L1KR/sOvinvtex8l/64En+MgbSnV0KmU0/FBMpv zvtwZ7up4AuX8l6JtEhEHgg332UJWJLeijgYiEpjoarlmGtXJcocFIcKEOh7lau8+b8+ TYTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=TpYct5GI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id nb9-20020a17090b35c900b001e012a01ddcsi23792087pjb.28.2022.06.08.03.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 03:52:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=TpYct5GI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A92BFED8F5; Wed, 8 Jun 2022 03:17:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235902AbiFHKDI (ORCPT + 99 others); Wed, 8 Jun 2022 06:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235965AbiFHKCv (ORCPT ); Wed, 8 Jun 2022 06:02:51 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F7381451CF; Wed, 8 Jun 2022 02:43:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=A+CyjXVi+KYsagLnxynLgPapKZafI2doGh1EpEXW+4I=; b=TpYct5GI0487LzQAlTdrSE007A Sa5jAYgO/UNmcTh8AyD0Z86ax39efkq0QC0bGMOOwswFnooLZ9ePviOj1F1EXNpbbg/LevKDMxUMg cJoctLg2AKYrmd1dkC9lo/rGo42fq++QVYxb+oT/Dg9eBzqKS5+PUcCk8dDSY+8zHL4nmNR7rhigb fhwj/f7n3NDigPX/Spdm1kmlg52GG/Jnd8P2wkRl49Na/85fAMDtG17ZErtT/2Q5JuiPuXa4vsU6n HrkTF53KHft8nDem3bVFnp9QjYRO5D9NZ3fVkxg4EuAN+W6sLAIAurJaa+oHdlDgG1itc5X7jHTCs J/zq9nhw==; Received: from dhcp-077-249-017-003.chello.nl ([77.249.17.3] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nysDb-005zfL-LV; Wed, 08 Jun 2022 09:43:16 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 6596C30017D; Wed, 8 Jun 2022 11:43:13 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2A9E620250966; Wed, 8 Jun 2022 11:43:13 +0200 (CEST) Date: Wed, 8 Jun 2022 11:43:13 +0200 From: Peter Zijlstra To: Yanfei Xu Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH] perf/core: remove a meaningless pair of rcu_read_{,un}lock() Message-ID: References: <20220608090938.2178624-1-yanfei.xu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220608090938.2178624-1-yanfei.xu@intel.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 08, 2022 at 05:09:38PM +0800, Yanfei Xu wrote: > Per the codes, this pair of rcu_read_{,un}lock() protects nothing. > Let's remove it. > > Further, the variable "pmu" is safe as it is in the SRCU read-side > critical scope of "pmus_srcu" and perf_pmu_unregister() delete it > after calling synchronize_srcu. > > Signed-off-by: Yanfei Xu > --- > kernel/events/core.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 950b25c3f210..36b0df6feab4 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -11296,9 +11296,7 @@ static struct pmu *perf_init_event(struct perf_event *event) > } > > again: > - rcu_read_lock(); > pmu = idr_find(&pmu_idr, type); > - rcu_read_unlock(); You're mistaken, this is required for the radix tree internal nodes. Without it we can't safely traverse the radix tree without full serialization against the modifiers.