Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2342555ybf; Mon, 2 Mar 2020 06:49:10 -0800 (PST) X-Google-Smtp-Source: APXvYqx8KvoxvdU3k8YProPkkmW05mRQ8FVUjCj+HIbm31qknxpDUIVIcIajHbbkeS/kbuz9qxZY X-Received: by 2002:a9d:5a92:: with SMTP id w18mr9692722oth.292.1583160549952; Mon, 02 Mar 2020 06:49:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583160549; cv=none; d=google.com; s=arc-20160816; b=ahfdCIfUhkee8zvBQ66iTw1H7gCWy16GWsQuLueGERd/Kn46YGR9jQ1c2Xl51/Yin5 xMZqhT8jGOXLy4hkKY91ElqeDNHxWM91VYHYWsLOchrfDnWRSvODJVrhcW9sZExCGlod m8hgu0NgkFwrKvzyjNPDMicRNzLrdRTAx3RV4yWIB20E7bkby9c49qx2Mbgb/xGjTrzR fSawJnjb+qGT0TGWHkd6Er8JfSJvTug+8sOrAb5CaaSXbIf8w2HQgs0ZK5p/U/AnLkEv fKX2k1dIahGGCgJIZnp/BhJJIngEymzq42/3h8hVEfNll4pJ4JDpqBSENO/ovICsJJhd N/qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=nPZAeHM8ILTdOLpeQLnQdusUT3NH2GEIEoyjekXRJqQ=; b=KRNFXtSevfSZjJQYViYt/S8yivWSBGM3pit541d0tt7saRVAM1Wan7WIpadvJKpuWH zvogzfM9CHxHeo83/8xVRAwwbLeEsEZiZCBwsSgNrXziXNqID0dDUHSruXYXbyr1Bks3 10yc5FK0bqtsyiLVZUbq2a5zjGeOy3BsneQFuRzR/5kQhrfMY7fGP03/wyAH23KgE6vk jbg7pVAoMgXEn+e+vOOSN7kFCxUiP57ZdJxBpkqNV9hmg9jJBh7PFRf60iNS8jFlCSSN tvnmI/h0cq1Ijv5mLRkWsd9OYGfI4LORMynZGV8RL2kgJmWGSuVUA5OEuwUdpACpBxbH quxw== 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 s6si6642087otq.115.2020.03.02.06.48.57; Mon, 02 Mar 2020 06:49:09 -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 S1727175AbgCBOst (ORCPT + 99 others); Mon, 2 Mar 2020 09:48:49 -0500 Received: from foss.arm.com ([217.140.110.172]:33684 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727075AbgCBOst (ORCPT ); Mon, 2 Mar 2020 09:48:49 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0DDBF2F; Mon, 2 Mar 2020 06:48:48 -0800 (PST) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 807FB3F534; Mon, 2 Mar 2020 06:48:45 -0800 (PST) Date: Mon, 2 Mar 2020 14:48:43 +0000 From: Mark Rutland To: Ravi Bangoria Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, eranian@google.com, peterz@infradead.org, mpe@ellerman.id.au, paulus@samba.org, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@redhat.com, namhyung@kernel.org, adrian.hunter@intel.com, ak@linux.intel.com, kan.liang@linux.intel.com, alexey.budankov@linux.intel.com, yao.jin@linux.intel.com, robert.richter@amd.com, kim.phillips@amd.com, maddy@linux.ibm.com, Madhavan Srinivasan Subject: Re: [RFC 02/11] perf/core: Data structure to present hazard data Message-ID: <20200302144842.GD56497@lakrids.cambridge.arm.com> References: <20200302052355.36365-1-ravi.bangoria@linux.ibm.com> <20200302052355.36365-3-ravi.bangoria@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200302052355.36365-3-ravi.bangoria@linux.ibm.com> User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 02, 2020 at 10:53:46AM +0530, Ravi Bangoria wrote: > From: Madhavan Srinivasan > > Introduce new perf sample_type PERF_SAMPLE_PIPELINE_HAZ to request kernel > to provide cpu pipeline hazard data. Also, introduce arch independent > structure 'perf_pipeline_haz_data' to pass hazard data to userspace. This > is generic structure and arch specific data needs to be converted to this > format. > > Signed-off-by: Madhavan Srinivasan > Signed-off-by: Ravi Bangoria > --- > include/linux/perf_event.h | 7 ++++++ > include/uapi/linux/perf_event.h | 32 ++++++++++++++++++++++++++- > kernel/events/core.c | 6 +++++ > tools/include/uapi/linux/perf_event.h | 32 ++++++++++++++++++++++++++- > 4 files changed, 75 insertions(+), 2 deletions(-) > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index 547773f5894e..d5b606e3c57d 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -1001,6 +1001,7 @@ struct perf_sample_data { > u64 stack_user_size; > > u64 phys_addr; > + struct perf_pipeline_haz_data pipeline_haz; > } ____cacheline_aligned; > > /* default value for data source */ > @@ -1021,6 +1022,12 @@ static inline void perf_sample_data_init(struct perf_sample_data *data, > data->weight = 0; > data->data_src.val = PERF_MEM_NA; > data->txn = 0; > + data->pipeline_haz.itype = PERF_HAZ__ITYPE_NA; > + data->pipeline_haz.icache = PERF_HAZ__ICACHE_NA; > + data->pipeline_haz.hazard_stage = PERF_HAZ__PIPE_STAGE_NA; > + data->pipeline_haz.hazard_reason = PERF_HAZ__HREASON_NA; > + data->pipeline_haz.stall_stage = PERF_HAZ__PIPE_STAGE_NA; > + data->pipeline_haz.stall_reason = PERF_HAZ__SREASON_NA; > } > > extern void perf_output_sample(struct perf_output_handle *handle, > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > index 377d794d3105..ff252618ca93 100644 > --- a/include/uapi/linux/perf_event.h > +++ b/include/uapi/linux/perf_event.h > @@ -142,8 +142,9 @@ enum perf_event_sample_format { > PERF_SAMPLE_REGS_INTR = 1U << 18, > PERF_SAMPLE_PHYS_ADDR = 1U << 19, > PERF_SAMPLE_AUX = 1U << 20, > + PERF_SAMPLE_PIPELINE_HAZ = 1U << 21, Can we please have perf_event_open() reject this sample flag for PMUs without the new callback (introduced in the next patch)? That way it'll be possible to detect whether the PMU exposes this. Thanks, Mark.