Skip to content

Commit

Permalink
Merge tag 'driver-core-5.18-rc5' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/gregkh/driver-core

Pull driver core fixes from Greg KH:
 "Here are some small driver core and kernfs fixes for some reported
  problems. They include:

   - kernfs regression that is causing oopses in 5.17 and newer releases

   - topology sysfs fixes for a few small reported problems.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'driver-core-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  kernfs: fix NULL dereferencing in kernfs_remove
  topology: Fix up build warning in topology_is_visible()
  arch_topology: Do not set llc_sibling if llc_id is invalid
  topology: make core_mask include at least cluster_siblings
  topology/sysfs: Hide PPIN on systems that do not support it.
  • Loading branch information
torvalds committed Apr 30, 2022
2 parents e2e5ebe + ad8d869 commit 57ae8a4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
11 changes: 10 additions & 1 deletion drivers/base/arch_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,15 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
core_mask = &cpu_topology[cpu].llc_sibling;
}

/*
* For systems with no shared cpu-side LLC but with clusters defined,
* extend core_mask to cluster_siblings. The sched domain builder will
* then remove MC as redundant with CLS if SCHED_CLUSTER is enabled.
*/
if (IS_ENABLED(CONFIG_SCHED_CLUSTER) &&
cpumask_subset(core_mask, &cpu_topology[cpu].cluster_sibling))
core_mask = &cpu_topology[cpu].cluster_sibling;

return core_mask;
}

Expand All @@ -684,7 +693,7 @@ void update_siblings_masks(unsigned int cpuid)
for_each_online_cpu(cpu) {
cpu_topo = &cpu_topology[cpu];

if (cpuid_topo->llc_id == cpu_topo->llc_id) {
if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) {
cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
}
Expand Down
10 changes: 10 additions & 0 deletions drivers/base/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,19 @@ static struct attribute *default_attrs[] = {
NULL
};

static umode_t topology_is_visible(struct kobject *kobj,
struct attribute *attr, int unused)
{
if (attr == &dev_attr_ppin.attr && !topology_ppin(kobj_to_dev(kobj)->id))
return 0;

return attr->mode;
}

static const struct attribute_group topology_attr_group = {
.attrs = default_attrs,
.bin_attrs = bin_attrs,
.is_visible = topology_is_visible,
.name = "topology"
};

Expand Down
7 changes: 6 additions & 1 deletion fs/kernfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,12 @@ static void __kernfs_remove(struct kernfs_node *kn)
*/
void kernfs_remove(struct kernfs_node *kn)
{
struct kernfs_root *root = kernfs_root(kn);
struct kernfs_root *root;

if (!kn)
return;

root = kernfs_root(kn);

down_write(&root->kernfs_rwsem);
__kernfs_remove(kn);
Expand Down

0 comments on commit 57ae8a4

Please sign in to comment.