Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2652210iof; Wed, 8 Jun 2022 09:14:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9E1DUHQBT1UWkbmdPD903s8cQYfNsg5+ZAw4UfZD/fkuOENRkGvsyyHMUDXP34UrTOFn+ X-Received: by 2002:a63:6947:0:b0:3fe:22d6:dfae with SMTP id e68-20020a636947000000b003fe22d6dfaemr5188813pgc.185.1654704851379; Wed, 08 Jun 2022 09:14:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654704851; cv=pass; d=google.com; s=arc-20160816; b=lh42r62GxGZctfJpye3MhHaDGF5EX5YaSIlIG26T1EgaWFk/02qjApmoJ8B9oJWHzD hAO5GFAsAuGxAX8oqlpOlRTK5LwcF3JFxEihVT/C9FCn9xnz2rcKk8YBtLI4b59xj/xr GdVsqBqz1Yep4LucKAtEbw61RnQKAmMSTWJGt2QsBWkBqWAxRpPt7ceFOFSYpjHDvGLC 2GNhU+//KtdxquGn+INc4pyj6Y5qgjqpVhoUdHx7UUZGTr3uZvULwdCdfWfEzXG/6kYS escERcoPbAAgCJCMif6brxvIHk3d1QEAhcqfGvBaeVfqMdu0AHgIDQSMrOlWZ+tacnB2 L2IA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=1fXUxezkwutjfyGBXdbS/G8Rv4tBgxYMM05X5AVGCuo=; b=NmuomMF7BFd7++fHcmbXvkg2pnGROlIc/nCXLiBJN2ApQJvWfuWRG/ndJhd2w9+y6v 9cLLr2npoVusBCsTlQ/kuNYMJiyWnmcB5GaT+OiEK+o6HXbjBANDPf1OqHIDPvX/+aEy 2fiePC1JhFmAd9gex6lSI4M3HoRtfI+obL1axoU19izfy1GPRwRNmBVN+aqJIjfJCwbi oqA3YvTDIt7Q0WCWvJR8uYGQCunMaVrGAtuCNturaGyIoVCcsdPbz+ZYhEmo1pPv+EcE imtbd+8gFgjPme0ySmh6AOuhe7WJ3oeC+LLo2sw16xZCwQuqhUiwJBdoBY5r5neu4FcX p4kQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=nPIPn8v0; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b7-20020a056a000a8700b005183f5deeebsi30742787pfl.302.2022.06.08.09.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 09:14:11 -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=@intel.com header.s=Intel header.b=nPIPn8v0; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 883C04132E; Wed, 8 Jun 2022 08:47:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244805AbiFHPrB (ORCPT + 99 others); Wed, 8 Jun 2022 11:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244786AbiFHPq7 (ORCPT ); Wed, 8 Jun 2022 11:46:59 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 914C8265E; Wed, 8 Jun 2022 08:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654703217; x=1686239217; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=jj5dzTAom3ELyf3uQImb8gy8RTzzmoMO/ZpfuAA82Vw=; b=nPIPn8v0halloFBMGljvwtvfyRFN63mJwszxqf2f44h6PddSHOuI6aJJ WN8qbmtVchCPthzBYMJr2ykNT+/ju9Qe31Ok4xtMFs+GjPvGFhSqPR/hh 5IVunePI3+npgfSj7DvnQVkXKT/pgDQH4S/O/cGzq9bKcFaJ2j2h2v4ZI YFFYSrEtDL4fO7iTfsfMhdvQXh7STSnHgujijUeAJe7l7slRPpYec4sYV KY1689pFTtFki+0oiIDuusPCn+bRNcnBt+yyWUkqCT8QADUoASqnTLDLF 1+jlJ7SKvgmjBDYeH2Gau0zQ5Yk8G7Fnc+furdNYLriw5FRgk1t5tLZvO Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10372"; a="278111222" X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="278111222" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2022 08:46:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,286,1647327600"; d="scan'208";a="670626063" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jun 2022 08:46:55 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 8 Jun 2022 08:46:55 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 8 Jun 2022 08:46:52 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.47) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Wed, 8 Jun 2022 08:46:50 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMB3dIjOSltP2sAf21NPZ7X/pKN3FkCXAtpttU2JDIywsfD10fYwjGR4liQZz20wQFQOhOx5pFzJ2rEegw+6HjINzTAoeeBGWrsHUkPGW9uREKA8oqvVpu9/32c4nnAP6h9sQ4xgltYH1mOS0jHQSvLJgxv0uCMtKcx8/OI3vOcW13EjjL0t9t/j3COIFjaSBic9+3jnEDmdT8KznW3JXwYd2EF9JML/ke5oV8GVv9LbMbaaKuNYVVaBF/9LkvonlV2efmklI3qJ6pP259p4bIFTQT7p6W9qJZcJg4I3ZhvG0MEpJY7u2Ljt1xu5tqZHsOIpsh0JgJrvkKpAQgGtJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1fXUxezkwutjfyGBXdbS/G8Rv4tBgxYMM05X5AVGCuo=; b=OT+4guYF3Cn72j2o6ngDC69lsK9UpolBMejEPlxg9bMk3ma+09HwL58bVW1T0NqmaG9PwuRS3oVyDuckHIwu1EDb6HoLt+Zirhpq51nou7k1EiQvqFXjU7dU696Q/2b/SiqCdFgT+2HDQ/H6Z1CIsH+bO8UhK5eOoLBrrWRlPZZQ7UoRBSGRBO3bq4nUYRSSaDiwEpTmA+9228R80yqr4F//ZUKk/U6yy8g+Jgq/IvayRqajnruU7fm/kyTPHnkt1mPC5Z0QM0ftuIqQZ+OS8X2MQxsx0c/LDhGYmLfm8dc7+blKmo02cVPBIHTx9nELJGeUDf0oJ5GxhJGkTWqVeQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from DM6PR11MB4138.namprd11.prod.outlook.com (2603:10b6:5:19a::31) by DM4PR11MB5375.namprd11.prod.outlook.com (2603:10b6:5:396::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5314.13; Wed, 8 Jun 2022 15:46:49 +0000 Received: from DM6PR11MB4138.namprd11.prod.outlook.com ([fe80::e9d2:8b69:bb48:b305]) by DM6PR11MB4138.namprd11.prod.outlook.com ([fe80::e9d2:8b69:bb48:b305%7]) with mapi id 15.20.5314.019; Wed, 8 Jun 2022 15:46:49 +0000 From: "Xu, Yanfei" To: Peter Zijlstra 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() Thread-Topic: [PATCH] perf/core: remove a meaningless pair of rcu_read_{,un}lock() Thread-Index: AQHYexxJIp65vUVEWkqJ1eHLcUUC761FpFMw Date: Wed, 8 Jun 2022 15:46:49 +0000 Message-ID: References: <20220608090938.2178624-1-yanfei.xu@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 68eb997c-f97d-4743-4e81-08da49661996 x-ms-traffictypediagnostic: DM4PR11MB5375:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZN1BZmHrfxLi2zq8Pa2LkltNjTPIyiVac+OG7+Io+z1FBzUhEcVJ/BIroaXHcI19HdEygW+zO5zbCrm4zuRf97ttISYAyOV1Gv4uG1pqPJPXd2WpaFqychlU1QmFMCYDds+tseyZZ0J6onJwh2hO//k7xJB9gPyxGIDN6AVkhKPr/sRoza6uNHF/mG8t0VNbbiqZ0SggPt8qzky900CcGJmddb8NnHZQaVyECGg0D+a75snv2X8236XE8TkdA9UFiAUDjN4icAuNSHTf0tsIpft7pomxO6Id8115DjvqAxZXf3s5iXqeVKAUeU0oDYV2kNOW+7OL/mRNwfI1Bp0nhmLMU7xddA2hnJcqvov3I9UZAHF5mhS54BTdNjcDyHaaMl3pj35Vu2DtAILw8KZBoAbLALAd1N7VcEeUHKRipnOqWufNbmvbuP429oMBE7opuVRix8m8LSRinHE9/5+8o22+g9JrZSMGCLhaZIR6LcHKgyM33I1RjbepcUoFCmv3677OUetpghhfifl1RiM8BrEfHkDmjiAJYshQ/o8sdd2xwT4FAJ1OSGvA4bnnGgCkDRXRuXgaRVsi8zd2p400yVLZ8NGjZg5ZpbcXjR/Th1QQU2ZpBB1vE58WF8OdnaI7VGwrN/toj5/phn5FpHo851X+mZLofoNBM8VShnIr3DlFonr/sGCB8lSZHLiXKgCN9d//rZSxG5cZKugq+dyXdw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4138.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(52536014)(86362001)(508600001)(83380400001)(55016003)(38100700002)(33656002)(6916009)(186003)(53546011)(54906003)(7696005)(9686003)(26005)(71200400001)(6506007)(316002)(122000001)(5660300002)(2906002)(4326008)(8676002)(8936002)(82960400001)(66476007)(64756008)(66446008)(66946007)(76116006)(66556008)(38070700005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?aUSUZp337FLgq70jZr2uR5mCx4SYXa1xZJUxOJkXCg1y9uTUEhJHDu7XFMvk?= =?us-ascii?Q?47SCJqJ06mK9xcVPeZd23loC46yrPCuCW+KXs1I2LMIeMTRPDUpc3tJGLYn4?= =?us-ascii?Q?aOfywzdcUZ5To41zAmU/JIS1+mx1jLyGmcMSuJw5S7h3TMT26qOLE+Lezqte?= =?us-ascii?Q?tTSh8Qy1gxzpg5OsGJa7Rb4aXTmB34y2J+Mxtk55YiKgp3eHBZDFCqoy8Z5m?= =?us-ascii?Q?Sxl0SFMYeddE4Lvta0YUxHZL/gXLjnIkyOHamryQk/g+nICOZJboskObPX2h?= =?us-ascii?Q?4SLX5tl8gjRrO1loRRULDXwuGB1iXYlk5fd5gct4g6sp0aVH+UgVYb8cotrW?= =?us-ascii?Q?D785qkMphXqFtohl4oRgdQ07JZFOcCCwqjVDavGiwNymNvfF68763EeksMlS?= =?us-ascii?Q?Mc68Ds0rrbGydvm6cOXn0i6qW5CjThIkQWYMbnCKfmnohyDeK5AmV2M4y/wh?= =?us-ascii?Q?f2SBmGmxvK2pVt5nkpSTdm35sZgayyOdVXvM33eVRTxksUcMIjyia65dfEIz?= =?us-ascii?Q?0KR5s//yBQuR/uYaRppFKZKOiRalmlksHEwEL0F0/RR1GyHyBsjZJUf81KCq?= =?us-ascii?Q?DB7rXoklCKzv64v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ZV8MTPO6r9?= =?us-ascii?Q?fPpF6rvUO79+k23BmMb6EfIHjdSN4hNeUMcwRqfgLAqnkuA7wD6eKP/ho1Kz?= =?us-ascii?Q?CVuT0xifIqcfP1ly5y9852hOewt0C7V28cgVaY3/UNd3NKwSQRtPcP22LQhL?= =?us-ascii?Q?nTxQgeW5hgJ1uhHUo3UH2GXbmkgXboGl2EAmmypOa+s3cMZzl2nVx5HsNtl7?= =?us-ascii?Q?y3HWPdviVfzwJHot/mBLZg9MMCU2FS8nmU5a5PL1XloCN+OX38p+eIvw7y0j?= =?us-ascii?Q?A+j7Em2GeA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4138.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 68eb997c-f97d-4743-4e81-08da49661996 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jun 2022 15:46:49.0494 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: h0FllOks/1i5lR9CmqdL0QDZJ6Lsb9coPBRkP6lwmChobkkLRZmKlSDF26bC3zM3KsRvI6d55hITdHQIh20kjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5375 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, 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=unavailable 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 > -----Original Message----- > From: Peter Zijlstra > Sent: Wednesday, June 8, 2022 5:43 PM > To: Xu, Yanfei > 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() >=20 > 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 =3D idr_find(&pmu_idr, type); > > - rcu_read_unlock(); >=20 > You're mistaken, this is required for the radix tree internal nodes. > Without it we can't safely traverse the radix tree without full serializa= tion > against the modifiers. Thanks your reminder! And after digging and learning these commits: f9c46d6= ea5ce ("idr: make idr_find rcu-safe ") and 452a68d0ef34("KVM: hyperv: idr_f= ind needs RCU protection "). Now I understand it. Thanks, Yanfei