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 E15FACD3447 for ; Fri, 8 May 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:CC:To:Subject:From:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xlsoaH6+s33yDtojmUKNfhTfqJon+lLn5/GAmxf7QuI=; b=bMN10lztgMc7VEMn3Wlv92D5Lj xu56dRZrX+IRQvtlOLxF0d6I7J6tNep7w291k0DuCeR245JKzztwbJfo8oA04aKRDuwQdofUGdiZs evOIP5NVpMLtL4j3Rp/hMHde5rdTUNqFSebyE3vws2gAAA81ZKD+yYMbo3Ek0P2dx4PIcBnpFq2hL NPENcMWjtDHuPpD5UaPao7KVWEpMAx5e7UnjOMER+Jf+TKlzhbh97zieeTLFX0H4LIi64/UDvcifh imhxKSVdwz8gJ7bNDCtvsc2f3Kxbe8KRV1m3FXh8xB4ncu8kVklURx11a/PBZo5WysNxKp1f/Rv31 OH8LVdOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wLIZP-00000006FOe-2fC4; Fri, 08 May 2026 10:36:35 +0000 Received: from canpmsgout01.his.huawei.com ([113.46.200.216]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wLIZM-00000006FN4-31DY for linux-arm-kernel@lists.infradead.org; Fri, 08 May 2026 10:36:34 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=xlsoaH6+s33yDtojmUKNfhTfqJon+lLn5/GAmxf7QuI=; b=H+aBSlKOqOQlrWGMkYZ3TZ3CsT+bQE1WIQSvMGnuTwiMEA0zp3pNRtpOlRG97Qfy8cnvQL1M1 jeQBSsf+lPNuqOMKiks66wnvuDZh2wktwFvRQtNifhNRbeel+zAurXGllsB8Xqbp/dyWRPGUiVH DUYrwr5CirMVXHILmgGCGgw= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4gBlhj4kzTz1T4M2; Fri, 8 May 2026 18:28:53 +0800 (CST) Received: from dggemv705-chm.china.huawei.com (unknown [10.3.19.32]) by mail.maildlp.com (Postfix) with ESMTPS id 08B3A40569; Fri, 8 May 2026 18:36:28 +0800 (CST) Received: from kwepemn100008.china.huawei.com (7.202.194.111) by dggemv705-chm.china.huawei.com (10.3.19.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 8 May 2026 18:36:27 +0800 Received: from [10.67.120.139] (10.67.120.139) by kwepemn100008.china.huawei.com (7.202.194.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.36; Fri, 8 May 2026 18:36:26 +0800 Message-ID: <6d4a668d-b659-460b-89f9-c9ae39120646@huawei.com> Date: Fri, 8 May 2026 18:36:26 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Yushan Wang Subject: Re: [RFT PATCH v2 6/7] perf-iostat: Make x86 iostat compatible with new iostat framework To: Ian Rogers CC: , , , , , , , , , , , , , , , , , , , , , , References: <20260507063737.3542950-1-wangyushan12@huawei.com> <20260507063737.3542950-7-wangyushan12@huawei.com> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.120.139] X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To kwepemn100008.china.huawei.com (7.202.194.111) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260508_033633_077983_51D17791 X-CRM114-Status: GOOD ( 22.66 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 5/8/2026 12:17 AM, Ian Rogers wrote: > On Wed, May 6, 2026 at 11:37 PM Yushan Wang wrote: >> >> From: Shiju Jose >> >> Change the original x86 iio iostat supporter to be compatible with the >> set of iostat frameworks. >> >> The matching function of x86 iio may not be correct. >> >> Signed-off-by: Shiju Jose  >> Co-developed-by: Yushan Wang >> Signed-off-by: Yushan Wang >> --- >>  tools/perf/util/iostat.c     | 26 +++++++-------- >>  tools/perf/util/x86-iostat.c | 62 ++++++++++++++++++++++++++---------- >>  2 files changed, 59 insertions(+), 29 deletions(-) >> >> diff --git a/tools/perf/util/x86-iostat.c b/tools/perf/util/x86-iostat.c >> index f8d4c9718594..778655cbc2a0 100644 >> --- a/tools/perf/util/x86-iostat.c >> +++ b/tools/perf/util/x86-iostat.c >> @@ -332,9 +332,9 @@ static int iostat_event_group(struct evlist *evl, >>         return ret; >>  } >> [...] >> + >> +/* >> + * FIXME: pmu name prefix match might not work for x86 iio. >> + */ >> +static bool iio_iostat_probe(struct iostat_pmu *iostat_pmu) >> +{ >> +       return perf_pmus__scan_matching_wildcard(NULL, iostat_pmu->pmu_name_wildcard); > > It feels more readable to me as: > ``` >   return perf_pmus__scan_matching_wildcard(NULL, "uncore_iio") != NULL; > ``` Yes, I can do that refactor. > > >> +} >> + >> +static struct iostat_pmu x86_iio_iostat_pmu_list[]  = { >> +       { >> +               .pmu_name_wildcard = "uncore_iio*", >> +               .match = iio_iostat_probe, >> +               .prepare = iio_iostat_prepare, >> +               .parse = iio_iostat_parse, >> +               .list = iio_iostat_list, >> +               .print_header_prefix = iio_iostat_print_header_prefix, >> +               .print_metric = iio_iostat_print_metric, > > Is there scope to push the metric printing into json? For example, you > can have PMUs with json: > tools/perf/pmu-events/arch/x86/alderlake/adl-metrics.json > ``` >     { >        "BriefDescription": "Uncore frequency per die [GHZ]", >        "MetricExpr": "tma_info_system_socket_clks / #num_dies / > duration_time / 1e9", >        "MetricGroup": "SoC", >        "MetricName": "UNCORE_FREQ", >        "Unit": "cpu_core" >    }, > ``` > and do uncore type things: > tools/perf/pmu-events/arch/x86/amdzen6/recommended.json > ``` >   { >    "MetricName": "umc_activate_cmd_rate", >    "BriefDescription": "Memory controller ACTIVATE command rate.", >    "MetricExpr": "d_ratio(umc_act_cmd.all * 1000, umc_mem_clk)", >    "MetricGroup": "memory_controller", >    "PerPkg": "1", >    "ScaleUnit": "1per_memclk" >  }, > ``` Currently it's a bit far to reach json configurable PMU iostat structural display, since the PMUs are vendor specific and may have different meaningful combinations of events, and they may be hard to be handled with generalized handler. Taking currently availble uncore_iio* and hisi_pcie* pmu as example, they have different sets of events to display, different ways of calculation, and different PMU to PCIe root port mapping topology, which requires dedicated handler. But admittedly there are a lot of redundant code that can be optimized, I can see if those iostat_* callbacks can be merged or generalized so that variated functions can be minimized. Thanks, Yushan > >> +               .print_counters = iio_iostat_print_counters, >> +               .release = iio_iostat_release, >> +       }, >> +}; >> + >> +static void __attribute__((constructor)) x86_iio_iostat_pmu_init(void) > > I don't believe these attributes are what we normally do. > > Thanks, > Ian > > >> +{ >> +       unsigned int i; >> + >> +       for (i = 0; i < ARRAY_SIZE(x86_iio_iostat_pmu_list); i++) >> +               register_iostat_pmu(&x86_iio_iostat_pmu_list[i]); >> +} >> -- >> 2.33.0 >>