Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp314599pxa; Wed, 19 Aug 2020 01:57:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPQML/BvJ+FYh/7frJLY8CxtChrHIqzcbJr/XtbRk4DiCUsABZHEw/wOWZ5WAao5kzy+pf X-Received: by 2002:aa7:da8c:: with SMTP id q12mr24230782eds.126.1597827459960; Wed, 19 Aug 2020 01:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597827459; cv=none; d=google.com; s=arc-20160816; b=Iji0z9H7kYpJzpDw7r4es5Q1lPGr+YF6eX+m9/663E9CUztTGstVzz6MxO8D/73Uk/ EAWvZk5QEe9sqtWTM84CYPQilEe1vHiMv9grNvIgzwJ+vWnqTerwZSGyDUElu/Qiezrb knDmZn2DcDU8rtfwqpKAWaRLOJy9IOus0/g7QWq6K7ZbpLIh6ERklOQq6i9sz0ZWNQtI xWTiNhpo145Ggm3DSA2jVaRKuHWj8XfgqI6ISMl2efcTq99nqj+Ba7x1wQAk60K2+1Ot KWWdHlRRNGHSenidxd+p9t0rk5I5BVMWPTHZf+jYTEKs4VqdVCMiC4ptQEuZ/OEueJi7 yQgA== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=LPnU8pyPddQW19gBJ+YOIgmFLzT1mk9Ey7bGquTkdic=; b=YzVBBIpDBKu1xfau3ObKyDbt++nWf+gNzeR5/0J/ESnGyvwTFYAbw06yTR/uBgXds+ 1URu3O9deviOREfPquQ7Jm9GhHoIKotNQCMD3C/XbMl26hmOIjZvVPs8Q+SUJ7VHBWsh /CSwhSaNlFVoJnD6ySIDlTnR/qI0DjARIps3Ex+9+LXDg7SGmkPa9PxH2Ej23cFfZy+C 3VumbM0lueraZoDdv6OretDQrfqJeTwZERSnGH8i3/OpH1mV6d/Tz6cYeGBARMZm1c25 wYH0UJHnJs97C6ZO4yJR7b0cqR3ZoGnKKyi1fDJTl9nrvS+zb3fTJmR89E/I+OghK69O evaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=YzcEbgAD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si14985267edy.92.2020.08.19.01.57.16; Wed, 19 Aug 2020 01:57:39 -0700 (PDT) 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; dkim=fail header.i=@linutronix.de header.s=2020 header.b=YzcEbgAD; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727034AbgHSI4m (ORCPT + 99 others); Wed, 19 Aug 2020 04:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726923AbgHSIyJ (ORCPT ); Wed, 19 Aug 2020 04:54:09 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA8D3C061348; Wed, 19 Aug 2020 01:52:13 -0700 (PDT) Date: Wed, 19 Aug 2020 08:52:11 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1597827132; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LPnU8pyPddQW19gBJ+YOIgmFLzT1mk9Ey7bGquTkdic=; b=YzcEbgADRPpimgEa+z4D7MTQ9pGCKuWnwVbKpBTuKzlPiknk+NNXEkpKFQWnUswpDaxYZ0 +mimsHvDyJ7ClStC2wm6pcdAFduq3a7qgvWSFWZNh2JkyGAhUiIXRduv6ujV0/lwO+3xtL iccp/plZw00yvf4Gdi3JPNhPOwmlQJ0mGnHFFXQHtOGG9pXtHG2gaYKzS0gnHuU9gXqr3R XiG9L5dEXe9XHaoF3zvuHSSgNalKiq/m1AzsoXRi4OwiCldgvbWNDo0Ia165A2HWiVK0zK +/oeGhcQ6KCj4dsUL3wOQiwrmzDN4Lj/vu7Vz2tyq1kwZZg7Fh3H9bfwyxQs4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1597827132; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LPnU8pyPddQW19gBJ+YOIgmFLzT1mk9Ey7bGquTkdic=; b=MhUitKgByxj53KSjiUovfzgTJpl0DSRFcAbM4uvfM8yYLb1YkQ8KcvkRHzvlGnkZy0WAZb kDIqWqd7pZ+o86AA== From: "tip-bot2 for Kan Liang" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] perf/x86: Use event_base_rdpmc for the RDPMC userspace support Cc: Peter Zijlstra , Kan Liang , x86 , LKML In-Reply-To: <20200723171117.9918-2-kan.liang@linux.intel.com> References: <20200723171117.9918-2-kan.liang@linux.intel.com> MIME-Version: 1.0 Message-ID: <159782713157.3192.4240252060821627383.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 75608cb02ea5dd997990e2998eca3670cb71a18c Gitweb: https://git.kernel.org/tip/75608cb02ea5dd997990e2998eca3670cb71a18c Author: Kan Liang AuthorDate: Thu, 23 Jul 2020 10:11:04 -07:00 Committer: Peter Zijlstra CommitterDate: Tue, 18 Aug 2020 16:34:34 +02:00 perf/x86: Use event_base_rdpmc for the RDPMC userspace support The RDPMC index is always re-calculated for the RDPMC userspace support, which is unnecessary. The RDPMC index value is stored in the variable event_base_rdpmc for the kernel usage, which can be used for RDPMC userspace support as well. Suggested-by: Peter Zijlstra Signed-off-by: Kan Liang Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200723171117.9918-2-kan.liang@linux.intel.com --- arch/x86/events/core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 1cbf57d..8e108ea 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2208,17 +2208,12 @@ static void x86_pmu_event_unmapped(struct perf_event *event, struct mm_struct *m static int x86_pmu_event_idx(struct perf_event *event) { - int idx = event->hw.idx; + struct hw_perf_event *hwc = &event->hw; - if (!(event->hw.flags & PERF_X86_EVENT_RDPMC_ALLOWED)) + if (!(hwc->flags & PERF_X86_EVENT_RDPMC_ALLOWED)) return 0; - if (x86_pmu.num_counters_fixed && idx >= INTEL_PMC_IDX_FIXED) { - idx -= INTEL_PMC_IDX_FIXED; - idx |= 1 << 30; - } - - return idx + 1; + return hwc->event_base_rdpmc + 1; } static ssize_t get_attr_rdpmc(struct device *cdev,