Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4197347pxb; Mon, 8 Feb 2021 10:09:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqpnpDIme2aBqra7NEd1oGBAOIh4VNNMx6r2CpVjurFrfjbaZrEKAUhvu5XQb97zVfGVLc X-Received: by 2002:a17:906:f156:: with SMTP id gw22mr11741261ejb.406.1612807760944; Mon, 08 Feb 2021 10:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612807760; cv=none; d=google.com; s=arc-20160816; b=S2UIdcvirpCaT+VTzInYAdAQNy0CJ51VG8uTmDL34UG+S/qZZjrk9Pmax7HBLTv17I USSOkOi8Ogyx++EQnUesbDpSticaYChRz5gEZiJH6sUM6Y8Fmul/1QGzpG6UiAaslGo1 trndjWaXAdyInhoDPMw1JYlLaxOI8fR/JcEKXp6mVCa3CQNwH4De7BKjQ6qxSrNtgBZZ ZEc4EfxQQR3DPoy0admF0Zoj89wVMx8xATmuABDCqnYir/496mjaQeSKazcAHwjP1LVn 4iKTPypZGNS+4r7hcb0mdJMyt4k2sW2ziPh76A/SoGoSiWK9T6+Oym4yGaYlxd8uAtNX RwWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=imVq9ycSC7bCZ1ONIBhB0kLS4poVc7bGxi947GMcRUo=; b=ohSNlNVLP/1KqV47T/CURJzFRfEskggRv6LfzbdDR4owQdXdddnlUYJuEDFF+TnWwx Uc+CvDd3lMUbTaqHkITx9Hai2ilVwn90T+tOXaifisGq5oyy3Nwh2KcxtVzpdnS+p3cS YhHO2Sp3MO5A2qX3flphtAb0wSpmP7EzqN9OA25OXP/ratXAQZxe+1jp4I+YeApNDPjY GsOwdnf6mXTGEERR3BGwlI3Rd+MxaLbFnuXXIekk2ENrrJOJxxfZVT2UrvXO2P1GPGnU 1B3JtprUN7FX8Ac1RQSaG9/YynWMTPfTr2MsF8id/aWrbNgozUe5ZUgywNVs9GfrIxbc Rf2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si11408594ejm.462.2021.02.08.10.08.56; Mon, 08 Feb 2021 10:09:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235325AbhBHSH4 (ORCPT + 99 others); Mon, 8 Feb 2021 13:07:56 -0500 Received: from mga14.intel.com ([192.55.52.115]:62838 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234111AbhBHPiZ (ORCPT ); Mon, 8 Feb 2021 10:38:25 -0500 IronPort-SDR: tDX+TUNIuKPbELxeQRIhr0Er3IdZZRomdHaToP9MzdRmdGQ2Y8Fx3iQttn5+/wGpnriv4rZ228 r7JpoRdY90kQ== X-IronPort-AV: E=McAfee;i="6000,8403,9889"; a="180951953" X-IronPort-AV: E=Sophos;i="5.81,162,1610438400"; d="scan'208";a="180951953" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2021 07:30:15 -0800 IronPort-SDR: 1ENtMY45kw+ATOjzeD/lbVbPHy+e56Jpnxufx9RpC4epiFQ5U0eM7v7aj04ELZWUvC9YFKSbOU RMiaHZN3V6IQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,162,1610438400"; d="scan'208";a="358820657" Received: from otc-lr-04.jf.intel.com ([10.54.39.41]) by orsmga003.jf.intel.com with ESMTP; 08 Feb 2021 07:30:14 -0800 From: kan.liang@linux.intel.com To: peterz@infradead.org, acme@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, bp@alien8.de, namhyung@kernel.org, jolsa@redhat.com, ak@linux.intel.com, yao.jin@linux.intel.com, alexander.shishkin@linux.intel.com, adrian.hunter@intel.com, Kan Liang Subject: [PATCH 14/49] perf/x86: Remove temporary pmu assignment in event_init Date: Mon, 8 Feb 2021 07:25:11 -0800 Message-Id: <1612797946-18784-15-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612797946-18784-1-git-send-email-kan.liang@linux.intel.com> References: <1612797946-18784-1-git-send-email-kan.liang@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang The temporary pmu assignment in event_init is unnecessary. The assignment was introduced by commit 8113070d6639 ("perf_events: Add fast-path to the rescheduling code"). At that time, event->pmu is not assigned yet when initializing an event. The assignment is required. However, from commit 7e5b2a01d2ca ("perf: provide PMU when initing events"), the event->pmu is provided before event_init is invoked. The temporary pmu assignment in event_init should be removed. Reviewed-by: Andi Kleen Signed-off-by: Kan Liang --- arch/x86/events/core.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 29dee3f..bdcd3ad 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2294,7 +2294,6 @@ static int validate_group(struct perf_event *event) static int x86_pmu_event_init(struct perf_event *event) { - struct pmu *tmp; int err; switch (event->attr.type) { @@ -2309,20 +2308,10 @@ static int x86_pmu_event_init(struct perf_event *event) err = __x86_pmu_event_init(event); if (!err) { - /* - * we temporarily connect event to its pmu - * such that validate_group() can classify - * it as an x86 event using is_x86_event() - */ - tmp = event->pmu; - event->pmu = &pmu; - if (event->group_leader != event) err = validate_group(event); else err = validate_event(event); - - event->pmu = tmp; } if (err) { if (event->destroy) -- 2.7.4