[RFC, powerpc] perf/hv-24x7 set the attr group to NULL if events failed to be initialized

Michael Ellerman mpe at ellerman.id.au
Wed Mar 25 20:51:20 AEDT 2015


On Sun, 2015-15-02 at 09:42:57 UTC, Li Zhong wrote:
> sysfs_create_groups() creates groups one by one in the attr_groups array
> before a NULL entry is encountered. But if an error is seen, it stops
> and removes all the groups already created:
>         for (i = 0; groups[i]; i++) {
>                 error = sysfs_create_group(kobj, groups[i]);
>                 if (error) {
>                         while (--i >= 0)
>                                 sysfs_remove_group(kobj, groups[i]);
>                         break;
>                 }
>         }
> 
> And for the three event groups of 24x7, if it is not supported,
> according to the above logic, it causes format and interface group to be
> removed because of the error.
> 
> This patch moves the three events groups to the end of the attr groups,
> and if create_events_from_catalog() fails to set their attributes, we
> set them to NULL in attr_groups.

But why are we continuing at all if create_events_from_catalog() fails?

Shouldn't that just be a fatal error and we bail?

cheers


More information about the Linuxppc-dev mailing list