From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2907FC74A5B for ; Fri, 17 Mar 2023 15:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=k35ur1AX9Ku26Tnq67XuCYCZp855vEXna/qZVihbvHY=; b=1T33KcKz6cvl6i jRiPqTuuGFVQrPcCXpwF4xeHy/h3C4LoFw9BtiKHKQ1Q79xocvMvbPWppteIzbr7gBbWm6Z0mduqY qUFUHxup4DwM70pzqUOtnYhTQ91PvTaMKFGHImKshSvGT+frZK9yr2DGn4l3qTB9aaE2CV6cht6v7 NghKFtdofkxHD8WugOJzNugbrXxtboaXOCkeZBFqmKjKQLrrYp9BX9e8JNeOspNVtx/VNU4JL4vlW es+b6LnxB4Km7dcYDQTdyAioWlq2ku1xjFUJ0VriqyaLNOH+9dDF61gEsPhHD+IoXkzHVZe1/RW8Y czlhZb0bmJRXxN/cL0pQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pdBlt-002acJ-0b; Fri, 17 Mar 2023 15:13:33 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pdBlp-002aaP-2Z for linux-arm-kernel@lists.infradead.org; Fri, 17 Mar 2023 15:13:32 +0000 Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4PdSKh1zSkz6J6pL; Fri, 17 Mar 2023 23:12:24 +0800 (CST) Received: from localhost (10.48.148.142) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 17 Mar 2023 15:13:23 +0000 Date: Fri, 17 Mar 2023 15:13:22 +0000 From: Jonathan Cameron To: Jie Zhan CC: , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [RFC PATCH v1 3/4] perf tool: Add HiSilicon PMCU data recording support Message-ID: <20230317151322.000034eb@Huawei.com> In-Reply-To: <20230206065146.645505-4-zhanjie9@hisilicon.com> References: <20230206065146.645505-1-zhanjie9@hisilicon.com> <20230206065146.645505-4-zhanjie9@hisilicon.com> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.48.148.142] X-ClientProxiedBy: lhrpeml500006.china.huawei.com (7.191.161.198) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230317_081330_125397_681062FB X-CRM114-Status: GOOD ( 17.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 6 Feb 2023 14:51:45 +0800 Jie Zhan wrote: > Support for HiSilicon PMCU data recording using 'perf-record'. > > Users can start PMCU profiling through 'perf-record'. Event numbers are > passed by a sysfs interface. The following optional parameters can be > passed through 'perf-record': > - nr_sample: number of samples to take > - sample_period_ms: time in ms for PMU counters to stay on for an event > - pmccfiltr: bits[31-24] of system register PMCCFILTR_EL0 > > Example usage: > > 1. Enter event numbers in the 'user_events' file: > > echo "0x10 0x11" > /sys/devices/hisi_pmcu_sccl3/user_events > > 2. Start the sampling with 'perf-record': > > perf record -e hisi_pmcu_sccl3/nr_sample=1000,sample_period_ms=1/ > > In this example, the PMCU takes 1000 samples of event 0x0010 and 0x0011 > with a sampling period of 1ms. Data will be written to a 'perf.data' file. > > Co-developed-by: Yang Shen > Signed-off-by: Yang Shen > Signed-off-by: Jie Zhan I'm not particularly knowledgeable about perf tool so just some superficial comments from me. > --- > diff --git a/tools/perf/arch/arm64/util/hisi-pmcu.c b/tools/perf/arch/arm64/util/hisi-pmcu.c > new file mode 100644 > index 000000000000..7c33abf1182d > --- /dev/null > +++ b/tools/perf/arch/arm64/util/hisi-pmcu.c > +struct hisi_pmcu_record { > + struct auxtrace_record itr; > + struct perf_pmu *hisi_pmcu_pmu; > + struct evlist *evlist; > +}; ... > +struct auxtrace_record *hisi_pmcu_recording_init(int *err, > + struct perf_pmu *hisi_pmcu_pmu) > +{ ... > + pmcu_record->hisi_pmcu_pmu = hisi_pmcu_pmu; > + pmcu_record->itr.recording_options = hisi_pmcu_recording_options; > + pmcu_record->itr.info_priv_size = hisi_pmcu_info_priv_size; > + pmcu_record->itr.info_fill = hisi_pmcu_info_fill; > + pmcu_record->itr.free = hisi_pmcu_record_free; > + pmcu_record->itr.reference = hisi_pmcu_reference; > + pmcu_record->itr.read_finish = auxtrace_record__read_finish; > + pmcu_record->itr.alignment = HISI_PMCU_DATA_ALIGNMENT; > + pmcu_record->itr.pmu = hisi_pmcu_pmu; Maybe a local variable for itr - or if you can rely on c99 in perf tool a compound literal to use structure field names etc. pmcu_record->itr = (struct xxx){ .recording_options = , etc > + > + *err = 0; > + return &pmcu_record->itr; > +} > diff --git a/tools/perf/util/hisi-pmcu.h b/tools/perf/util/hisi-pmcu.h > new file mode 100644 > index 000000000000..d46d523a3aee > --- /dev/null > +++ b/tools/perf/util/hisi-pmcu.h > @@ -0,0 +1,17 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * HiSilicon Performance Monitor Control Unit (PMCU) support > + * > + * Copyright (C) 2022 HiSilicon Limited Probably want to update the dates if any substantial changes for v2. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel