Received: by 10.223.176.5 with SMTP id f5csp3086663wra; Mon, 29 Jan 2018 08:33:51 -0800 (PST) X-Google-Smtp-Source: AH8x2244i1ZnT7sl1iQEWbnqSS52rjFz6JdweyBuvP9AEImvIB8XGWvH8ffCDvBaX5APi/AZxySk X-Received: by 2002:a17:902:8498:: with SMTP id c24-v6mr22301790plo.450.1517243631289; Mon, 29 Jan 2018 08:33:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517243631; cv=none; d=google.com; s=arc-20160816; b=yuMEKmXeb6T88faW16RpbTiFRpQy4uOQGJ+K9b885/UBi4E6cuMe8YcC4wRXUpzhU+ h7gXrcXcOzwKi+gekYLWNMMzgwRMoUP+89gZggf1j982oo7+jYY3Lug0ADNZvydnr0nE WcsWIfP8Iu4W2ArGdu76UPYliz9lcJ7Zy6IJtA2codjUi9VRS2snjUc5w/UQvQmi1oPQ E1PAnIe7fxFAlRpWJEuoJlTEYpriXb5UNKBYN/tnzVJKbPbMJnx4t5dfFtkBOvWq0kwG LOh66sFgwbzjPZXI+Vuna1T2s0Jys0kRvs2iSiyWCikfMYPqF2f/JMpmkYy7w0yPQMkN tvvw== 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=8s5CrYaisR5bgu9v8fTN8uDOhCdJ/a1O5SHFZV6muPs=; b=saU6qljLCao6CMG1yskwlyyTPtoO0etTQFfiT8jnJkowgH1pvEyicuMJVL9ZQGXsUw VAJ9ycdJZicp0NQMvHM1YxTzbq/Pdu21PRGCESAGW6nQsTJncL8LqGoS7D4BhYXsHiCQ pjXg3w7F65J1X/5UwxDlk9BdS9jUbfgiFy2SC43ML6rVP+PqQGgb8mn55TTJ5CdJhiKV jApX2hs9QtwgtnFWzDJCi8f7YaSscfpp24f8p/3L+kkMOp+47lsrFE1rqoasB9ufCCQp o14hb+mh/sXSwMLRnWzJJ90ltOT1/R89UiQuX2w9HC3BdhejLYREkHc/XRiCpDbftkTv qB9w== 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 z96-v6si3037909plh.100.2018.01.29.08.33.36; Mon, 29 Jan 2018 08:33:51 -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 S1751629AbeA2Qbj (ORCPT + 99 others); Mon, 29 Jan 2018 11:31:39 -0500 Received: from mga09.intel.com ([134.134.136.24]:11472 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751322AbeA2Qal (ORCPT ); Mon, 29 Jan 2018 11:30:41 -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 orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2018 08:30:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,431,1511856000"; d="scan'208";a="25629349" Received: from otc-lr-04.jf.intel.com ([10.54.39.128]) by fmsmga004.fm.intel.com with ESMTP; 29 Jan 2018 08:30:40 -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 V3 4/5] perf/x86/intel: fix pmu read for large PEBS Date: Mon, 29 Jan 2018 08:29:32 -0800 Message-Id: <1517243373-355481-5-git-send-email-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517243373-355481-1-git-send-email-kan.liang@linux.intel.com> References: <1517243373-355481-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 Large PEBS needs to be specially handled in event count read. It is only available for intel_pmu. Only need to specially handle the large PEBS. For the threshold is one, even auto-reload is enabled, it doesn't need to be specially handled. Because, - auto-reload is only effect when event overflow. Once there is an overflow, the NMI handler will automatically drain_pebs(). - For other cases, x86_perf_event_update() is good enough. Fixes: b8241d20699e ("perf/x86/intel: Implement batched PEBS interrupt handling (large PEBS interrupt threshold)") Signed-off-by: Kan Liang --- arch/x86/events/intel/core.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 731153a..1610a9d 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c @@ -2060,6 +2060,14 @@ static void intel_pmu_del_event(struct perf_event *event) intel_pmu_pebs_del(event); } +static void intel_pmu_read_event(struct perf_event *event) +{ + if (intel_pmu_large_pebs_read(event)) + return; + + x86_perf_event_update(event); +} + static void intel_pmu_enable_fixed(struct hw_perf_event *hwc) { int idx = hwc->idx - INTEL_PMC_IDX_FIXED; @@ -3495,6 +3503,7 @@ static __initconst const struct x86_pmu intel_pmu = { .disable = intel_pmu_disable_event, .add = intel_pmu_add_event, .del = intel_pmu_del_event, + .read = intel_pmu_read_event, .hw_config = intel_pmu_hw_config, .schedule_events = x86_schedule_events, .eventsel = MSR_ARCH_PERFMON_EVENTSEL0, -- 2.7.4