Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7469597ybp; Wed, 16 Oct 2019 09:06:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxA/P7eYENZJXYVhIVTVtxA4/j1ouheOIqWXfVAbtAs1xnMqwcshxRum8fMHD4PM+VXghD+ X-Received: by 2002:a17:906:7202:: with SMTP id m2mr39936664ejk.138.1571242019745; Wed, 16 Oct 2019 09:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571242019; cv=none; d=google.com; s=arc-20160816; b=ah7WiqVJhgF3wJiBQ4CIz2ilkq//8TASlgE+m7nukR4PkyIC6zCGKLtgl+//SCqpue zAXbD06l5RYZ+528wn3Dzo5fM9TcRTuHEmVRIjLCz72AiUScj59hs8ZQ2nlAmOf2JAJg wW7ZbIx5AVQyah1aOplMGonOGrX+ZvAd5rdYxxIkzpRXVDjHsgjJ9t2NSEIcDXTtASdv ZxeMRcoB3mwy6UfSKSGPEL14VZVdf9qfVYWpsONQBqx2IXnkexyPxuvU69v6p9tlaBYY GtxqLRBB54TJlhYJr2XMpm569k16J1Se4p5H/t0QPm62ZCVt7V8Q/+vUvgMs9+nUqcZl kY3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=FdEyQOm2SMDMFEaRB4Tjghgxc29aT4Wd30CT+rFPsMo=; b=aHsV9MGUFU2XNLRjJvo+7XJcHcWztXFQ+00lkcPHnVNvcrMuATBz9EFgQBwunH33Vg svBMKUjvPM3oEEzyrN5q37sbHvQZw7yxMe4nfD00wnGBxGKCQxtv5tZUDKWBSaC6eSfG uhguxxiOKLRE9L9dExlzc9NlsoLs7pNESo+Xv75Qz5Oq8T66IvQpULxhU/u4QEFR0T5u L1BG2x4N4o2jkVy3DM9xgn1ZR/yoP/XqYDf3qHOBqW5uVJa7J1TCm7QZD2l/sy5ZtH57 fBIyQaTTNA4ibHuPueRNI5znfEqNsNHvVrZAvv6WfxdKjTAO/h/ab00UFBL18xZrd2wM bKMA== 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 w43si18508542edd.332.2019.10.16.09.06.36; Wed, 16 Oct 2019 09:06:59 -0700 (PDT) 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 S2405349AbfJPNav (ORCPT + 99 others); Wed, 16 Oct 2019 09:30:51 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:4219 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388342AbfJPNau (ORCPT ); Wed, 16 Oct 2019 09:30:50 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1ED8C5D4AE5A087F7F66; Wed, 16 Oct 2019 21:30:47 +0800 (CST) Received: from [127.0.0.1] (10.202.227.179) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Wed, 16 Oct 2019 21:30:37 +0800 Subject: Re: [PATCH v6 2/2] drivers/perf: Add CCPI2 PMU support in ThunderX2 UNCORE driver. To: Ganapatrao Prabhakerrao Kulkarni , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" References: <1571218608-15933-1-git-send-email-gkulkarni@marvell.com> <1571218608-15933-3-git-send-email-gkulkarni@marvell.com> CC: "mark.rutland@arm.com" , "corbet@lwn.net" , Jan Glauber , "Jayachandran Chandrasekharan Nair" , "gklkml16@gmail.com" , Robert Richter , "will@kernel.org" , Zhangshaokun From: John Garry Message-ID: Date: Wed, 16 Oct 2019 14:30:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1571218608-15933-3-git-send-email-gkulkarni@marvell.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.179] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +TX2_EVENT_ATTR(req_pktsent, CCPI2_EVENT_REQ_PKT_SENT); > +TX2_EVENT_ATTR(snoop_pktsent, CCPI2_EVENT_SNOOP_PKT_SENT); > +TX2_EVENT_ATTR(data_pktsent, CCPI2_EVENT_DATA_PKT_SENT); > +TX2_EVENT_ATTR(gic_pktsent, CCPI2_EVENT_GIC_PKT_SENT); > + > +static struct attribute *ccpi2_pmu_events_attrs[] = { > + &tx2_pmu_event_attr_req_pktsent.attr.attr, > + &tx2_pmu_event_attr_snoop_pktsent.attr.attr, > + &tx2_pmu_event_attr_data_pktsent.attr.attr, > + &tx2_pmu_event_attr_gic_pktsent.attr.attr, > + NULL, > +}; Hi Ganapatrao, Have you considered adding these as uncore pmu-events in the perf tool? Some advantages I see: - perf list is not swamped with all these uncore events per PMU For the Hisi uncore events, we get 100s of events (>600 on the board I just tested, which is crazy) - can add more description in the JSON files - less stuff in the kernel > + > static const struct attribute_group l3c_pmu_events_attr_group = { > .name = "events", > .attrs = l3c_pmu_events_attrs, > @@ -174,6 +240,11 @@ static const struct attribute_group dmc_pmu_events_attr_group = { > .attrs = dmc_pmu_events_attrs, > }; [...] > tx2_pmu->attr_groups = l3c_pmu_attr_groups; > tx2_pmu->name = devm_kasprintf(dev, GFP_KERNEL, > "uncore_l3c_%d", tx2_pmu->node); > @@ -665,10 +846,13 @@ static struct tx2_uncore_pmu *tx2_uncore_pmu_init_dev(struct device *dev, > tx2_pmu->stop_event = uncore_stop_event_l3c; > break; > case PMU_TYPE_DMC: > - tx2_pmu->max_counters = TX2_PMU_MAX_COUNTERS; > + tx2_pmu->max_counters = TX2_PMU_DMC_L3C_MAX_COUNTERS; > + tx2_pmu->counters_mask = 0x3; > tx2_pmu->prorate_factor = TX2_PMU_DMC_CHANNELS; > tx2_pmu->max_events = DMC_EVENT_MAX; > + tx2_pmu->events_mask = 0x1f; > tx2_pmu->hrtimer_interval = TX2_PMU_HRTIMER_INTERVAL; > + tx2_pmu->hrtimer_callback = tx2_hrtimer_callback; > tx2_pmu->attr_groups = dmc_pmu_attr_groups; > tx2_pmu->name = devm_kasprintf(dev, GFP_KERNEL, > "uncore_dmc_%d", tx2_pmu->node); > @@ -676,6 +860,21 @@ static struct tx2_uncore_pmu *tx2_uncore_pmu_init_dev(struct device *dev, > tx2_pmu->start_event = uncore_start_event_dmc; > tx2_pmu->stop_event = uncore_stop_event_dmc; > break; > + case PMU_TYPE_CCPI2: > + /* CCPI2 has 8 counters */ > + tx2_pmu->max_counters = TX2_PMU_CCPI2_MAX_COUNTERS; > + tx2_pmu->counters_mask = 0x7; > + tx2_pmu->prorate_factor = 1; > + tx2_pmu->max_events = CCPI2_EVENT_MAX; > + tx2_pmu->events_mask = 0x1ff; > + tx2_pmu->attr_groups = ccpi2_pmu_attr_groups; > + tx2_pmu->name = devm_kasprintf(dev, GFP_KERNEL, > + "uncore_ccpi2_%d", tx2_pmu->node); Do you need to check this for name == NULL? > + tx2_pmu->init_cntr_base = init_cntr_base_ccpi2; > + tx2_pmu->start_event = uncore_start_event_ccpi2; > + tx2_pmu->stop_event = uncore_stop_event_ccpi2; > + tx2_pmu->hrtimer_callback = NULL; > + break; > case PMU_TYPE_INVALID: > devm_kfree(dev, tx2_pmu); > return NULL; > @@ -744,7 +943,9 @@ static int tx2_uncore_pmu_offline_cpu(unsigned int cpu, > if (cpu != tx2_pmu->cpu) > return 0; > > - hrtimer_cancel(&tx2_pmu->hrtimer); > + if (tx2_pmu->hrtimer_callback) > + hrtimer_cancel(&tx2_pmu->hrtimer); > + > cpumask_copy(&cpu_online_mask_temp, cpu_online_mask); > cpumask_clear_cpu(cpu, &cpu_online_mask_temp); > new_cpu = cpumask_any_and( > Thanks, John