Quoting Michał Winiarski (2020-02-19 15:08:04)
> Attempting to bind / unbind module from devices where we have both
> integrated and discreete GPU handed by i915 may lead to interesting
> results where we're keeping per-device state in per-module globals.
> 
> Fixes: 05488673a4d4 ("drm/i915/pmu: Support multiple GPUs")
> Signed-off-by: Michał Winiarski <michal.winiar...@intel.com>
> Cc: Chris Wilson <ch...@chris-wilson.co.uk>
> Cc: Michal Wajdeczko <michal.wajdec...@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
> ---
> -       i915_pmu_events_attr_group.attrs = create_event_attributes(pmu);
> -       if (!i915_pmu_events_attr_group.attrs)
> +       pmu->events_attr_group.name = "events";
> +       pmu->events_attr_group.attrs = create_event_attributes(pmu);
> +       if (!pmu->events_attr_group.attrs)
>                 goto err_name;
>  
> -       pmu->base.attr_groups   = i915_pmu_attr_groups;
> +       pmu->base.attr_groups = kcalloc(ARRAY_SIZE(attr_groups),
> +                                       sizeof(*attr_groups),
> +                                       GFP_KERNEL);
> +       if (!pmu->base.attr_groups)
> +               goto err_attr;
> +       memcpy(attr_groups, pmu->base.attr_groups,
> +              ARRAY_SIZE(attr_groups) * sizeof(*attr_groups));

kmemdup(attr_groups, sizeof(attr_groups));

> diff --git a/drivers/gpu/drm/i915/i915_pmu.h b/drivers/gpu/drm/i915/i915_pmu.h
> index 6c1647c5daf2..dc1361e8e27a 100644
> --- a/drivers/gpu/drm/i915/i915_pmu.h
> +++ b/drivers/gpu/drm/i915/i915_pmu.h
> @@ -42,6 +42,10 @@ struct i915_pmu {
>          * @node: List node for CPU hotplug handling.
>          */
>         struct hlist_node node;
> +       /**
> +        * @cpuhp_slot: State for CPU hotplug handling.
> +        */
> +       enum cpuhp_state cpuhp_slot;

Perhaps struct {
                struct hlist_node node;
                enum cpuhp_state slot;
        } cpuhp;

Fwiw, separate this into a separate patch, so we have one to deglobal
cpuhp and one for event groups.

Just grimacing over the wasted strings that we could intern for actual
attr.

But the essence of the patch is correct, since the events group is
created at runtime from probing the device, it is not global.

Reviewed-by: Chris Wilson <ch...@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to