Received: by 10.223.185.116 with SMTP id b49csp2698388wrg; Mon, 12 Feb 2018 14:23:30 -0800 (PST) X-Google-Smtp-Source: AH8x225+M+MS/VSx3eoTgUzS7Fp7hdubPcumhuLYgimHpFEexPXcNkoXu9clCytq75UwECX2hib3 X-Received: by 10.99.167.14 with SMTP id d14mr10517683pgf.150.1518474210009; Mon, 12 Feb 2018 14:23:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518474209; cv=none; d=google.com; s=arc-20160816; b=j3uEPe4/v5wqAJteHqDzCcU1QusSUVtpsO9SSQQ0HQqW4RQ67RnkUiD9ex5E4Ha6G8 15b2XivYjjBDpos6gwg2zIUwyde5MNufkqPBx8y3VXbIdVlrmtrvgro2SYVAlKhA85bn sQgcTwib6TAYnRtcmC1ekvvX2SDjdCzofSyy9Bp9T+HJV14vWlf+7r50Rfy/WxBAWItq zKnRdPNhKcLtItD/op1fzr/O8NodwVOtvOGP+SN01mWB6r+O1Co3bmkjtqdK+wxRpcdB tN53V6BbIMGD++7WU2MJZToEm+yMwyqqRNuixbVMVELlqBGUPotHNzlEMPDHZf26DcjU 5UfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=n+CeJ0aapKYWtsD0vUFfnieHjp0mPZvumvj8CHi1Qh4=; b=NzvYi9ILG8uybvv/fva9qARkWtDmZp+KwdVd0Mcou/CYgqhgSCQckI2bSZLh9WykbF 0GUOJi88mBe/9zG9pYXdC1pxN2lCcMw/zOBxoFVJcf/+S+MWhhG/pjUO1pjkcXPpPqPE 2EXVi91K3zrUGTgg0wqtPnn/XJMhaoxceV9Zlw6ZxmAiu7e/uuJsn/XP6kQEP6TSBAdP sUZBGGZyK7Eggv4fRgtGnx7223/2pBeO7JoE5HBks4R5pCRxnP5mwVKCSA28NHe2hFOc pZjXKm3KOlg5Wk73L1qg3nT5VkrpzWVjSVPBHkbG+cA7PYVLxpWt1Feur0m1Ltl2KOcf ZnMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si581843pfa.168.2018.02.12.14.23.15; Mon, 12 Feb 2018 14:23: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932777AbeBLWWD (ORCPT + 99 others); Mon, 12 Feb 2018 17:22:03 -0500 Received: from mga07.intel.com ([134.134.136.100]:64295 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932738AbeBLWVw (ORCPT ); Mon, 12 Feb 2018 17:21:52 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Feb 2018 14:21:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,504,1511856000"; d="scan'208";a="29490605" Received: from otc-lr-04.jf.intel.com ([10.54.39.128]) by fmsmga004.fm.intel.com with ESMTP; 12 Feb 2018 14:21:49 -0800 From: kan.liang@linux.intel.com To: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: acme@kernel.org, tglx@linutronix.de, jolsa@redhat.com, eranian@google.com, ak@linux.intel.com, Kan Liang Subject: [PATCH V4 5/5] perf/x86: Fix: disable userspace RDPMC usage for large PEBS Date: Mon, 12 Feb 2018 14:20:35 -0800 Message-Id: <1518474035-21006-6-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518474035-21006-1-git-send-email-kan.liang@linux.intel.com> References: <1518474035-21006-1-git-send-email-kan.liang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kan Liang The userspace RDPMC usage never works for large PEBS since the large PEBS is introduced by commit b8241d20699e ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS interrupt threshold)") When the PEBS interrupt threshold is larger than one, there is no way to get exact auto-reload times and value for userspace RDPMC. Disable the userspace RDPMC usage when large PEBS is enabled. For the PEBS interrupt threshold equals to one, even it's auto-reload event, it doesn't need to disable the userspace RDPMC. It works well. Fixes: b8241d20699e ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS interrupt threshold)") Signed-off-by: Kan Liang --- arch/x86/events/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 00a6251..9c86e10 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2117,7 +2117,8 @@ static int x86_pmu_event_init(struct perf_event *event) event->destroy(event); } - if (READ_ONCE(x86_pmu.attr_rdpmc)) + if (READ_ONCE(x86_pmu.attr_rdpmc) && + !(event->hw.flags & PERF_X86_EVENT_FREERUNNING)) event->hw.flags |= PERF_X86_EVENT_RDPMC_ALLOWED; return err; -- 2.7.4