Received: by 10.223.185.116 with SMTP id b49csp2698746wrg; Mon, 12 Feb 2018 14:23:58 -0800 (PST) X-Google-Smtp-Source: AH8x227t2GvJzGnJD9dr6tJaS9gVikrqDOQlLtA7WZDDLrHV62wQIYSkkchTxtVvDDZQ/6AXDOH2 X-Received: by 2002:a17:902:9686:: with SMTP id n6-v6mr11763027plp.333.1518474238800; Mon, 12 Feb 2018 14:23:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518474238; cv=none; d=google.com; s=arc-20160816; b=UI05HKh1uLCkqaTS08MWz5GfjDHLUHT3Om4IakfgndxY+OTFh4A3pufrcpsLdLIX4b +FCuPpifNV4i/ZmAw4MY8DTXSZzV1Kn96Hco+VtJLnDHsA9VqQYoCtLtSYDJXzqJqCjD 76P1kDn7exgcYPqrytVKB8/6z97bKLbg1PRFS76mfyseHsncs+JrncoZiE/aHbuaPLUV 83xcwe4VR3d71Z/9BTGWXgymoYDHTl2x/gL4Pt5wjZEdcFfiwU5vv7mM61+/ZuktdxZO w/AMzYUK4ApZ22pEQaMMF9/IFmWOBCpa575g6Vr9S3sj+0yEQKNfpJ8k7q3biXAcsStk /k/w== 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=a5z2G+AUte/XJWvxj0OIDc8/Nz+Xyjqsisay357UdAc=; b=zer2oMVWK8uZqcK2VZQ/ueNzw+dl53VJ2gmv5z0FxDGFGEO1T9TYfeZKA+vNHwG1eR xpo8rSTkT8eVoDBd06NA6siiCFkEit9S2CwTvJPXle9Nk/iOvD8dhT4/bMarzKWRKZ/i 54uGej6gOYRnZPoNzOS5ol6TL9uTGHNBvspyf0RfmcKVAyNOIM0Yh6y5O9dsKo3/8k1S JODX1bD24hU0v5vVS6U9ve7rJIAdVdumMmRq40HeGJgBGY/x96DCK/qkfp1txVhX4pL0 e/ijk2H0TpVwa0acjqfMfnGZFnCr92qy6El6TrB+YCO30u9YWijRmiHJnn6Pi4bjdLjP cJBQ== 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 l1-v6si81770plg.56.2018.02.12.14.23.44; Mon, 12 Feb 2018 14:23:58 -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 S932883AbeBLWWW (ORCPT + 99 others); Mon, 12 Feb 2018 17:22:22 -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 S932724AbeBLWVv (ORCPT ); Mon, 12 Feb 2018 17:21:51 -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:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,504,1511856000"; d="scan'208";a="29490598" Received: from otc-lr-04.jf.intel.com ([10.54.39.128]) by fmsmga004.fm.intel.com with ESMTP; 12 Feb 2018 14:21:48 -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 2/5] perf/x86: Introduce read function for x86_pmu Date: Mon, 12 Feb 2018 14:20:32 -0800 Message-Id: <1518474035-21006-3-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 Auto-reload needs to be specially handled in event count read. Signed-off-by: Kan Liang --- arch/x86/events/core.c | 2 ++ arch/x86/events/perf_event.h | 1 + 2 files changed, 3 insertions(+) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 5a3ccd1..00a6251 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -1881,6 +1881,8 @@ early_initcall(init_hw_perf_events); static inline void x86_pmu_read(struct perf_event *event) { + if (x86_pmu.read) + return x86_pmu.read(event); x86_perf_event_update(event); } diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 8e4ea143..805400b 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h @@ -519,6 +519,7 @@ struct x86_pmu { void (*disable)(struct perf_event *); void (*add)(struct perf_event *); void (*del)(struct perf_event *); + void (*read)(struct perf_event *event); int (*hw_config)(struct perf_event *event); int (*schedule_events)(struct cpu_hw_events *cpuc, int n, int *assign); unsigned eventsel; -- 2.7.4