[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YH623ULPRbdi1ker@vkoul-mobl.Dlink>
Date: Tue, 20 Apr 2021 16:41:25 +0530
From: Vinod Koul <vkoul@...nel.org>
To: Tom Zanussi <tom.zanussi@...ux.intel.com>
Cc: peterz@...radead.org, acme@...nel.org, mingo@...nel.org,
kan.liang@...ux.intel.com, dave.jiang@...el.com,
tony.luck@...el.com, dan.j.williams@...el.com,
linux-kernel@...r.kernel.org, dmaengine@...r.kernel.org
Subject: Re: [PATCH v2 1/1] dmaengine: idxd: Add IDXD performance monitor
support
On 03-04-21, 11:45, Tom Zanussi wrote:
> +config INTEL_IDXD_PERFMON
> + bool "Intel Data Accelerators performance monitor support"
> + depends on INTEL_IDXD
> + default y
default y..?
> /* IDXD software descriptor */
> @@ -369,4 +399,19 @@ int idxd_cdev_get_major(struct idxd_device *idxd);
> int idxd_wq_add_cdev(struct idxd_wq *wq);
> void idxd_wq_del_cdev(struct idxd_wq *wq);
>
> +/* perfmon */
> +#ifdef CONFIG_INTEL_IDXD_PERFMON
maybe use IS_ENABLED()
> @@ -556,6 +562,8 @@ static int __init idxd_init_module(void)
> for (i = 0; i < IDXD_TYPE_MAX; i++)
> idr_init(&idxd_idrs[i]);
>
> + perfmon_init();
> +
> err = idxd_register_bus_type();
> if (err < 0)
> return err;
> @@ -589,5 +597,6 @@ static void __exit idxd_exit_module(void)
> pci_unregister_driver(&idxd_pci_driver);
> idxd_cdev_remove();
> idxd_unregister_bus_type();
> + perfmon_exit();
Ideally would make sense to add perfmon module first and then add use in
idxd..
> +static ssize_t cpumask_show(struct device *dev, struct device_attribute *attr,
> + char *buf);
> +
> +static cpumask_t perfmon_dsa_cpu_mask;
> +static bool cpuhp_set_up;
> +static enum cpuhp_state cpuhp_slot;
> +
> +static DEVICE_ATTR_RO(cpumask);
Pls document these new attributes added
> +static int perfmon_collect_events(struct idxd_pmu *idxd_pmu,
> + struct perf_event *leader,
> + bool dogrp)
dogrp..?
> +static int perfmon_validate_group(struct idxd_pmu *pmu,
> + struct perf_event *event)
> +{
> + struct perf_event *leader = event->group_leader;
> + struct idxd_pmu *fake_pmu;
> + int i, ret = 0, n;
> +
> + fake_pmu = kzalloc(sizeof(*fake_pmu), GFP_KERNEL);
> + if (!fake_pmu)
> + return -ENOMEM;
> +
> + fake_pmu->pmu.name = pmu->pmu.name;
> + fake_pmu->n_counters = pmu->n_counters;
> +
> + n = perfmon_collect_events(fake_pmu, leader, true);
> + if (n < 0) {
> + ret = n;
> + goto out;
> + }
> +
> + fake_pmu->n_events = n;
> + n = perfmon_collect_events(fake_pmu, event, false);
> + if (n < 0) {
> + ret = n;
> + goto out;
> + }
> +
> + fake_pmu->n_events = n;
> +
> + for (i = 0; i < n; i++) {
> + int idx;
lets move it to top of the function please
> +static inline u64 perfmon_pmu_read_counter(struct perf_event *event)
> +{
> + struct hw_perf_event *hwc = &event->hw;
> + struct idxd_device *idxd;
> + int cntr = hwc->idx;
> + u64 cntrdata;
> +
> + idxd = event_to_idxd(event);
> +
> + cntrdata = ioread64(CNTRDATA_REG(idxd, cntr));
> +
> + return cntrdata;
return ioread64() ?
--
~Vinod
Powered by blists - more mailing lists