[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200211171836.GB1933705@kroah.com>
Date: Tue, 11 Feb 2020 09:18:36 -0800
From: Greg KH <gregkh@...uxfoundation.org>
To: roman.sudarikov@...ux.intel.com
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
mark.rutland@....com, alexander.shishkin@...ux.intel.com,
jolsa@...hat.com, namhyung@...nel.org,
linux-kernel@...r.kernel.org, eranian@...gle.com,
bgregg@...flix.com, ak@...ux.intel.com, kan.liang@...ux.intel.com,
alexander.antonov@...el.com
Subject: Re: [PATCH v5 3/3] perf x86: Exposing an Uncore unit to PMON for Intel Xeon® server platform
On Tue, Feb 11, 2020 at 07:15:49PM +0300, roman.sudarikov@...ux.intel.com wrote:
> +static struct attribute *uncore_empry_attr;
What is this for?
> +static struct attribute_group skx_iio_mapping_group = {
> + .attrs = &uncore_empry_attr,
Again, what for?
You just overwrite this value so why have it at all?
> + .is_visible = skx_iio_mapping_visible,
> +};
> +
> +const static struct attribute_group *skx_iio_attr_update[] = {
> + &skx_iio_mapping_group,
> + NULL,
> +};
> +
> +static int skx_iio_set_mapping(struct intel_uncore_type *type)
> +{
> + char buf[64];
> + int ret = 0;
> + long die;
> + struct attribute **attrs;
> + struct dev_ext_attribute *eas;
> +
> + ret = skx_iio_get_topology(type);
> + if (ret)
> + return ret;
> +
> + // One more for NULL.
> + attrs = kzalloc((uncore_max_dies() + 1) * sizeof(*attrs), GFP_KERNEL);
> + if (!attrs) {
> + kfree(type->topology);
> + return -ENOMEM;
> + }
> +
> + eas = kzalloc(sizeof(*eas) * uncore_max_dies(), GFP_KERNEL);
> + if (!eas) {
> + kfree(attrs);
> + kfree(type->topology);
> + return -ENOMEM;
> + }
> + for (die = 0; die < uncore_max_dies(); die++) {
> + sprintf(buf, "node%ld", die);
> + eas[die].attr.attr.name = kstrdup(buf, GFP_KERNEL);
> + if (!eas[die].attr.attr.name) {
> + ret = -ENOMEM;
> + goto err;
> + }
> + eas[die].attr.attr.mode = 0444;
> + eas[die].attr.show = skx_iio_mapping_show;
> + eas[die].attr.store = NULL;
> + eas[die].var = (void *)die;
> + attrs[die] = &eas[die].attr.attr;
You HAVE to call sysfs_attr_init() on any dynamically created
attributes. I am guessing you never ran this code with lockdep enabled?
{sigh}
greg k-h
Powered by blists - more mailing lists