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 DB5BEC433EF for ; Mon, 27 Jun 2022 10:53:37 +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:In-Reply-To:MIME-Version:References: 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=CVoRopxGARzmuqGvX3AKTkQ48IbfJEhNfOR6FDeo+4Y=; b=lIRdwcx9sDoD1g F/esojunx9ZV6FeFLuLsO+ei7mwzjaxcdC8U5QzzTH1l9kCCnF/2BvpTvIeMM1+kjzVnZONG+n1ss o4WEoMj44228r64Io+DwQt8WXLn6qO3kOLYb0Jt3h9bNPamp4WEobiTyKir98lECnbqvzXT+RMRwo nknD8zcRTADKG//djR4//Ok9gzGTXldDEcsVXR12YDGEqPWezECtEKVQFdIsa66kb/1/CT1weLeqU KOWKFEvg99UozECKUkbNi6+QcaZbrCq6qqMIu9kjlO/Ftf/yeO8vD+1eQ0jBhOgjDKH2+RP68J97I kgjPrXYuCMmdb8bDEEyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o5mLy-000HDF-Ir; Mon, 27 Jun 2022 10:52:26 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o5mLv-000HAR-33 for linux-arm-kernel@lists.infradead.org; Mon, 27 Jun 2022 10:52:24 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 55FADB810A5; Mon, 27 Jun 2022 10:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0052BC3411D; Mon, 27 Jun 2022 10:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656327138; bh=gswl8VXoSaynFC5hVjucevy2klG2JzBobBOLT+yU1BY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MwgGtUpbNJiP6ZRVdVnG9fyiBv+cXXkr60sIvEc+pRvGu1Lo/b73vWC2FDvd4joOI EdLqYn+SKuMn9bbp5YhKLe8Byi2JlOtuSrUgGDXytLHiXXax60VXbgRybJ2FV254c4 Wl3a15MKrqDNUtH4rfmknJn1JQzHWpkpvq6U/BhaEp46tp8bq5LQ/m0zjMVfgsYJAc o25/eERdI4TkkLF3iyEyjVf6Wb0TqMYM04B47xVfWM6t2qe5SateKA0mMsFnC7txef xBveRnw/srJWZz9kjSTQEIfYYBrvwUiR6oRimuENWxulJzTZBJMX23IyRvH+nfOOLh O+OrQAFi5BBgw== Date: Mon, 27 Jun 2022 11:52:12 +0100 From: Will Deacon To: Guangbin Huang Cc: john.garry@huawei.com, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com, liuqi115@huawei.com, zhangshaokun@hisilicon.com, f.fangjian@huawei.com, lipeng321@huawei.com, shenjian15@huawei.com Subject: Re: [RESEND PATCH V7 2/2] drivers/perf: hisi: add driver for HNS3 PMU Message-ID: <20220627105211.GD22095@willie-the-truck> References: <20220525005211.57059-1-huangguangbin2@huawei.com> <20220525005211.57059-3-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220525005211.57059-3-huangguangbin2@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220627_035223_440180_1963A5EB X-CRM114-Status: GOOD ( 19.91 ) 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 Wed, May 25, 2022 at 08:52:11AM +0800, Guangbin Huang wrote: > HNS3(HiSilicon Network System 3) PMU is RCiEP device in HiSilicon SoC NIC, > supports collection of performance statistics such as bandwidth, latency, > packet rate and interrupt rate. > > NIC of each SICL has one PMU device for it. Driver registers each PMU > device to perf, and exports information of supported events, filter mode of > each event, bdf range, hardware clock frequency, identifier and so on via > sysfs. > > Each PMU device has its own registers of control, counters and interrupt, > and it supports 8 hardware events, each hardward event has its own > registers for configuration, counters and interrupt. > > Filter options contains: > event - select event > port - select physical port of nic > tc - select tc(must be used with port) > func - select PF/VF > queue - select queue of PF/VF(must be used with func) > intr - select interrupt number(must be used with func) > global - select all functions of IO DIE > > Signed-off-by: Guangbin Huang > Reviewed-by: John Garry > Reviewed-by: Shaokun Zhang > --- > MAINTAINERS | 6 + > drivers/perf/hisilicon/Kconfig | 10 + > drivers/perf/hisilicon/Makefile | 1 + > drivers/perf/hisilicon/hns3_pmu.c | 1662 +++++++++++++++++++++++++++++ > include/linux/cpuhotplug.h | 1 + > 5 files changed, 1680 insertions(+) > create mode 100644 drivers/perf/hisilicon/hns3_pmu.c This mostly looks good to me, but I have one niggling concern with the ABI: > +#define HNS3_PMU_FILTER_ATTR(_name, _config, _start, _end) \ > + static inline u64 hns3_pmu_get_##_name(struct perf_event *event) \ > + { \ > + return FIELD_GET(GENMASK_ULL(_end, _start), \ > + event->attr._config); \ > + } > + > +HNS3_PMU_FILTER_ATTR(event, config, 0, 16); > +HNS3_PMU_FILTER_ATTR(subevent, config, 0, 7); > +HNS3_PMU_FILTER_ATTR(event_type, config, 8, 15); > +HNS3_PMU_FILTER_ATTR(ext_counter_used, config, 16, 16); > +HNS3_PMU_FILTER_ATTR(real_event, config, 0, 15); How does perf tool deal with overlapping fields like this? It seems like quite a bad idea to allow things like "event=0xffff,subevent=0" when they are no longer distinct and I don't _think_ any other drivers do this. Can you remove 'event' and 'real_event' for now, or are they needed? Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel