lkml.org 
[lkml]   [2021]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 2/2] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node
On Sat, Oct 23, 2021 at 04:02:48AM +0300, Jarkko Sakkinen wrote:
> On Mon, 2021-10-18 at 16:35 +0200, Greg Kroah-Hartman wrote:
> > > +               ret = sysfs_create_group(&dev->kobj, &sgx_node_attr_group);
> >
> > A huge hint, if a driver has to call a sysfs_* call, something is wrong.
> >
> > Something is wrong here.
> >
> > Why are you messing around with a kobject?  This is a device, that you
> > control, you can just set the default attribute group for it and then
> > the driver core will add and remove the sysfs group at the proper time,
> > in the proper way.  Right now you are racing userspace and loosing.
> >
> > Use the default group list, that is what it is there for.
>
> I used sysfs_create_group() because node_devices is not owned by SGX
> code. It is managed in drivers/base/node.c, and also initialized before
> SGX.

Then that is broken, please do not use that device as your code does not
"own" it. Or fix the logic to be initialized earlier.

thanks,

greg k-h

\
 
 \ /
  Last update: 2021-10-23 08:34    [W:0.069 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site