linux-sgx.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	reinette.chatre@intel.com, tony.luck@intel.com,
	linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org
Subject: Re: [PATCH v8 2/2] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node
Date: Sat, 23 Oct 2021 08:33:43 +0200	[thread overview]
Message-ID: <YXOsx8SvFJV5R7lU@kroah.com> (raw)
In-Reply-To: <4050b7723f6f205c9afc3bdfa3888a6e8befa12a.camel@kernel.org>

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

  reply	other threads:[~2021-10-23  6:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 13:57 [PATCH v8 1/2] x86/sgx: Rename fallback labels in sgx_init() Jarkko Sakkinen
2021-10-18 13:57 ` [PATCH v8 2/2] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node Jarkko Sakkinen
2021-10-18 14:35   ` Greg Kroah-Hartman
2021-10-23  1:02     ` Jarkko Sakkinen
2021-10-23  6:33       ` Greg Kroah-Hartman [this message]
2021-10-24 14:24         ` Jarkko Sakkinen
2021-10-25  5:15           ` Greg Kroah-Hartman
2021-10-25 23:46             ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YXOsx8SvFJV5R7lU@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH v8 2/2] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).