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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9172AC433B4 for ; Thu, 22 Apr 2021 12:54:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 48A6161435 for ; Thu, 22 Apr 2021 12:54:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236175AbhDVMzc (ORCPT ); Thu, 22 Apr 2021 08:55:32 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:16615 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbhDVMzb (ORCPT ); Thu, 22 Apr 2021 08:55:31 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FQy4b3TXCz16Lgg; Thu, 22 Apr 2021 20:52:31 +0800 (CST) Received: from [127.0.0.1] (10.69.38.196) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 20:54:47 +0800 Subject: Re: [PATCH RESEND 0/4] Add support for HiSilicon PCIe Tune and Trace device To: Leo Yan CC: Alexander Shishkin , , , , , , , , , , , , , , , , , , , References: <1618654631-42454-1-git-send-email-yangyicong@hisilicon.com> <8735vpf20c.fsf@ashishki-desk.ger.corp.intel.com> <628f2f4a-03ce-a646-bf27-d6836baca425@hisilicon.com> <20210422034929.GA13004@leoy-ThinkPad-X240s> From: Yicong Yang Message-ID: <955f89c6-a330-fd64-f530-43435f5cafcb@hisilicon.com> Date: Thu, 22 Apr 2021 20:54:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210422034929.GA13004@leoy-ThinkPad-X240s> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.38.196] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/4/22 11:49, Leo Yan wrote: > On Mon, Apr 19, 2021 at 09:03:18PM +0800, Yicong Yang wrote: >> On 2021/4/17 21:56, Alexander Shishkin wrote: >>> Yicong Yang writes: >>> >>>> The reason for not using perf is because there is no current support >>>> for uncore tracing in the perf facilities. >>> >>> Not unless you count >>> >>> $ perf list|grep -ic uncore >>> 77 >>> >> >> these are uncore events probably do not support sampling. >> >> I tried on x86: >> >> # ./perf record -e uncore_imc_0/cas_count_read/ >> Error: >> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc_0/cas_count_read/). >> /bin/dmesg | grep -i perf may provide additional information. >> >> For HiSilicon uncore PMUs, we don't support uncore sampling: >> >> 'The current driver does not support sampling. So "perf record" is unsupported. ' [1] >> >> and also in another PMU: >> >> 'PMU doesn't support process specific events and cannot be used in sampling mode.' [2] >> >> [1] Documentation/admin-guide/perf/hisi-pmu.rst >> [2] Documentation/admin-guide/perf/arm_dsu_pmu.rst > > I did some debugging for this, and yes, it's related with the event > doesn't support sampling for these x86 uncore events. > > So I can use below commands for the uncore event > 'uncore_imc/data_reads/' in my experiment: > > # perf record -e 'uncore_imc/data_reads/' --no-samples -- ls > # perf stat -e 'uncore_imc/data_reads/' -- ls > > For your case, I think you need to write the callback > pmu::event_init(), it should not forbid any tracing even if set > sampling, just like other perf event drive for support AUX tracing. > thanks for the hint! I didn't know much about perf so I only do the basic test. will further investigate on this. >>>> We have our own format >>>> of data and don't need perf doing the parsing. >>> >>> Perf has AUX buffers, which are used for all kinds of own formats. >>> >> >> ok. we thought perf will break the data format but AUX buffers seems won't. >> do we need to add full support for tracing as well as parsing or it's ok for >> not parsing it through perf? > > IMHO, this could divide into two parts. The first part is to enable > perf drive with support AUX tracing, and perf tool can capture the trace > data. The second part is to add the decoder in the perf tool so that > the developers can *consume* the trace data; for the decoder, you > could refer the codes: > > tools/perf/util/intel-pt-decoder/ > tools/perf/util/cs-etm-decoder/ > > Or Arm SPE case: > > tools/perf/util/arm-spe-decoder/ > will refer to these implementation to see how to add the decoder for our traced data. very detailed guidance! >>>> A similar approach for implementing this function is ETM, which use >>>> sysfs for configuring and a character device for dumping data. >>> >>> And also perf. One reason ETM has a sysfs interface is because the >>> driver predates perf's AUX buffers. Can't say if it's the only >>> reason. I'm assuming you're talking about Coresight ETM. > > I am not the best person to give background for this. Mathieu or Mike > could give more info for this. From my undersanding, Sysfs nodes can > be used as knobs for configuration, but it's difficult for profiling. > as explained by the maintainers that there are some historical reasons for having sysfs interfaces for ETM as there is no perf AUX buffers at beginning. I thought sysfs interface as an option but perf AUX buffer is better as suggested. > Let's think about for the profiling, if one developer uses the Sysfs > for the setting and read out the trace data, these informations are > discrete. If another developer wants to review the profiling result, > then all these info need to be shared together. > ok. make sense to me. > So we can benefit much from the perf tool for the usage, since all the > profiling context will be gathered (DSOs, hardware configuration which > can be saved into metadata), so the final profiling file can be easily > shared and more friendly for reviewing. > ok. it will be beneficial if we use perf for both tracing and decoding, as we'll also get addition information attached to the trace data. Considering we have two functions: tracing and tuning. For tracing we can make use of perf AUX buffer but for tuning, I still cannot see how to make use of perf. So probably we can make tuning go through sysfs? And Daniel suggested so. Appreciate for the suggestion and guidance! Regards, Yicong > Thanks, > Leo > > . > 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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03BA9C433B4 for ; Thu, 22 Apr 2021 12:56:55 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5F589613DC for ; Thu, 22 Apr 2021 12:56:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F589613DC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:CC:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rE+fdbz7JBvSOgeYVoZM9if1tpxM7BSCVq+gc8w8Dhs=; b=PSYJKPdQH3OSu+yJ78ZALBNZQ MZiR8S4giHQjETxirwWyF2lRgGDEy3v6LKiy9p3qPHijLPiDOcO9oqnhEx6GKJcXsArWuz+ZtMr+y OQ/M5FQAmPA+P/Qb3s2kYjm8jsV6raDTlLFMZRmlEzhPodu3Ek1bM/tanbspi02G0sHkmqZx9LOlh hqZMQPos0YAmQ4zA+8a7yhCvDCXDvMB+o9ycvTVd93Y8QPlG4r4UsLhv6lhYvsxREo69Yhz988sz3 DkSoaYlPFkHi1VFBS8Mi5d/lWR0uyIRR7oNNxiowSSRou/qQHZ7d8Pgkwcq3amEvGLLw1VFsJ/0N2 j3DMOT7yg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lZYrS-00GkUL-Co; Thu, 22 Apr 2021 12:55:14 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZYrO-00GkU2-I7 for linux-arm-kernel@desiato.infradead.org; Thu, 22 Apr 2021 12:55:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:CC:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=qtFx4jZHYKziDso81pp/4wKg+neo5sXQ83xnrpwU1JA=; b=nKSkb7xzjehnkSS47RnnOTmNfO ouRO5+SXKIn5+m9aHJGeXSovGG2dr8duutK2Kio24/LHeJhMJq/FWOinWApJHQ0tp2XfKeTzPqdNT tiiTSMNhzmwPAW0KJnuXQHqLYz8tgWGt940fEVYPJUJ20tHmmUaVVjxWh3idc5JxF1a3hKBkWgoIY 4h8xfrEqXuBXGy8rX3RBW2vce+3xr8qB/XySYjr8IEqkqVTkLOjOB0QCWfUpNFHsjC1Z9eXWlWq4o 1Z74DZ4CbkMYFw3FlneIiUi1rAjnrMG6NGYU3na7wW1Dzbh1F8Nc+Sti6qOQDKIMOjNxgAUPwDoMx OceLw3og==; Received: from szxga04-in.huawei.com ([45.249.212.190]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lZYrK-00Dh1I-4f for linux-arm-kernel@lists.infradead.org; Thu, 22 Apr 2021 12:55:09 +0000 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FQy4b3TXCz16Lgg; Thu, 22 Apr 2021 20:52:31 +0800 (CST) Received: from [127.0.0.1] (10.69.38.196) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Thu, 22 Apr 2021 20:54:47 +0800 Subject: Re: [PATCH RESEND 0/4] Add support for HiSilicon PCIe Tune and Trace device To: Leo Yan CC: Alexander Shishkin , , , , , , , , , , , , , , , , , , , References: <1618654631-42454-1-git-send-email-yangyicong@hisilicon.com> <8735vpf20c.fsf@ashishki-desk.ger.corp.intel.com> <628f2f4a-03ce-a646-bf27-d6836baca425@hisilicon.com> <20210422034929.GA13004@leoy-ThinkPad-X240s> From: Yicong Yang Message-ID: <955f89c6-a330-fd64-f530-43435f5cafcb@hisilicon.com> Date: Thu, 22 Apr 2021 20:54:47 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210422034929.GA13004@leoy-ThinkPad-X240s> X-Originating-IP: [10.69.38.196] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210422_055507_392569_BD1D2BED X-CRM114-Status: GOOD ( 34.22 ) 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 2021/4/22 11:49, Leo Yan wrote: > On Mon, Apr 19, 2021 at 09:03:18PM +0800, Yicong Yang wrote: >> On 2021/4/17 21:56, Alexander Shishkin wrote: >>> Yicong Yang writes: >>> >>>> The reason for not using perf is because there is no current support >>>> for uncore tracing in the perf facilities. >>> >>> Not unless you count >>> >>> $ perf list|grep -ic uncore >>> 77 >>> >> >> these are uncore events probably do not support sampling. >> >> I tried on x86: >> >> # ./perf record -e uncore_imc_0/cas_count_read/ >> Error: >> The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (uncore_imc_0/cas_count_read/). >> /bin/dmesg | grep -i perf may provide additional information. >> >> For HiSilicon uncore PMUs, we don't support uncore sampling: >> >> 'The current driver does not support sampling. So "perf record" is unsupported. ' [1] >> >> and also in another PMU: >> >> 'PMU doesn't support process specific events and cannot be used in sampling mode.' [2] >> >> [1] Documentation/admin-guide/perf/hisi-pmu.rst >> [2] Documentation/admin-guide/perf/arm_dsu_pmu.rst > > I did some debugging for this, and yes, it's related with the event > doesn't support sampling for these x86 uncore events. > > So I can use below commands for the uncore event > 'uncore_imc/data_reads/' in my experiment: > > # perf record -e 'uncore_imc/data_reads/' --no-samples -- ls > # perf stat -e 'uncore_imc/data_reads/' -- ls > > For your case, I think you need to write the callback > pmu::event_init(), it should not forbid any tracing even if set > sampling, just like other perf event drive for support AUX tracing. > thanks for the hint! I didn't know much about perf so I only do the basic test. will further investigate on this. >>>> We have our own format >>>> of data and don't need perf doing the parsing. >>> >>> Perf has AUX buffers, which are used for all kinds of own formats. >>> >> >> ok. we thought perf will break the data format but AUX buffers seems won't. >> do we need to add full support for tracing as well as parsing or it's ok for >> not parsing it through perf? > > IMHO, this could divide into two parts. The first part is to enable > perf drive with support AUX tracing, and perf tool can capture the trace > data. The second part is to add the decoder in the perf tool so that > the developers can *consume* the trace data; for the decoder, you > could refer the codes: > > tools/perf/util/intel-pt-decoder/ > tools/perf/util/cs-etm-decoder/ > > Or Arm SPE case: > > tools/perf/util/arm-spe-decoder/ > will refer to these implementation to see how to add the decoder for our traced data. very detailed guidance! >>>> A similar approach for implementing this function is ETM, which use >>>> sysfs for configuring and a character device for dumping data. >>> >>> And also perf. One reason ETM has a sysfs interface is because the >>> driver predates perf's AUX buffers. Can't say if it's the only >>> reason. I'm assuming you're talking about Coresight ETM. > > I am not the best person to give background for this. Mathieu or Mike > could give more info for this. From my undersanding, Sysfs nodes can > be used as knobs for configuration, but it's difficult for profiling. > as explained by the maintainers that there are some historical reasons for having sysfs interfaces for ETM as there is no perf AUX buffers at beginning. I thought sysfs interface as an option but perf AUX buffer is better as suggested. > Let's think about for the profiling, if one developer uses the Sysfs > for the setting and read out the trace data, these informations are > discrete. If another developer wants to review the profiling result, > then all these info need to be shared together. > ok. make sense to me. > So we can benefit much from the perf tool for the usage, since all the > profiling context will be gathered (DSOs, hardware configuration which > can be saved into metadata), so the final profiling file can be easily > shared and more friendly for reviewing. > ok. it will be beneficial if we use perf for both tracing and decoding, as we'll also get addition information attached to the trace data. Considering we have two functions: tracing and tuning. For tracing we can make use of perf AUX buffer but for tuning, I still cannot see how to make use of perf. So probably we can make tuning go through sysfs? And Daniel suggested so. Appreciate for the suggestion and guidance! Regards, Yicong > Thanks, > Leo > > . > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel