lkml.org 
[lkml]   [2021]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 2/2] x86/sgx: Add an attribute for the amount of SGX memory in a NUMA node
From
Date
On Fri, 2021-10-08 at 23:33 +0300, Jarkko Sakkinen wrote:
> +static void sgx_numa_exit(void)
> +{
> +       struct device *dev;
> +       int nid;
> +
> +       for (nid = 0; nid < num_possible_nodes(); nid++) {
> +               dev = &node_devices[nid]->dev;
> +               if (dev)
> +                       sysfs_remove_group(&dev->kobj, &sgx_node_attr_group);
> +       }
> +}
> +
> +static bool sgx_numa_init(void)
> +{
> +       struct sgx_numa_node *node;
> +       int nid;
> +       int ret;
> +
> +       for (nid = 0; nid < num_possible_nodes(); nid++) {
> +               if (!sgx_numa_nodes[nid].size)
> +                       continue;
> +
> +               node = &sgx_numa_nodes[nid];
> +               node->dev = &node_devices[nid]->dev;
> +
> +               ret = sysfs_create_group(&node->dev->kobj, &sgx_node_attr_group);
> +               if (ret) {
> +                       sgx_numa_exit();
> +                       return false;
> +               }
> +       }

Here's a mistake: node->dev should be only set after sysfe_create_group().
Otherwise, sysfs_remove_group() will issue a warning in sgx_numa_exit(), when
sgx_create_group() is unsuccessful, because the group does not exist.

I'll fix this, and send a new version.

/Jarkko

\
 
 \ /
  Last update: 2021-10-18 15:45    [W:0.037 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site