Skip to content

Commit

Permalink
x86/cpu: Move logical package and die IDs into topology info
Browse files Browse the repository at this point in the history
Yet another topology related data pair. Rename logical_proc_id to
logical_pkg_id so it fits the common naming conventions.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Juergen Gross <jgross@suse.com>
Tested-by: Sohil Mehta <sohil.mehta@intel.com>
Tested-by: Michael Kelley <mikelley@microsoft.com>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230814085112.745139505@linutronix.de
  • Loading branch information
KAGA-KOKO committed Oct 10, 2023
1 parent 594957d commit 22dc963
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Documentation/arch/x86/topology.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Package-related topology information in the kernel:
Modern systems use this value for the socket. There may be multiple
packages within a socket. This value may differ from topo.die_id.

- cpuinfo_x86.logical_proc_id:
- cpuinfo_x86.topo.logical_pkg_id:

The logical ID of the package. As we do not trust BIOSes to enumerate the
packages in a consistent way, we introduced the concept of logical package
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/events/intel/uncore.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int uncore_device_to_die(struct pci_dev *dev)
struct cpuinfo_x86 *c = &cpu_data(cpu);

if (c->initialized && cpu_to_node(cpu) == node)
return c->logical_die_id;
return c->topo.logical_die_id;
}

return -1;
Expand Down
8 changes: 4 additions & 4 deletions arch/x86/include/asm/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ struct cpuinfo_topology {

// Core ID relative to the package
u32 core_id;

// Logical ID mappings
u32 logical_pkg_id;
u32 logical_die_id;
};

struct cpuinfo_x86 {
Expand Down Expand Up @@ -145,10 +149,6 @@ struct cpuinfo_x86 {
u16 x86_clflush_size;
/* number of cores as seen by the OS: */
u16 booted_cores;
/* Logical processor id: */
u16 logical_proc_id;
/* Core id: */
u16 logical_die_id;
/* Index into per_cpu list: */
u16 cpu_index;
/* Is SMT active on this core? */
Expand Down
4 changes: 2 additions & 2 deletions arch/x86/include/asm/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ static inline void setup_node_to_cpumask_map(void) { }
extern const struct cpumask *cpu_coregroup_mask(int cpu);
extern const struct cpumask *cpu_clustergroup_mask(int cpu);

#define topology_logical_package_id(cpu) (cpu_data(cpu).logical_proc_id)
#define topology_logical_package_id(cpu) (cpu_data(cpu).topo.logical_pkg_id)
#define topology_physical_package_id(cpu) (cpu_data(cpu).topo.pkg_id)
#define topology_logical_die_id(cpu) (cpu_data(cpu).logical_die_id)
#define topology_logical_die_id(cpu) (cpu_data(cpu).topo.logical_die_id)
#define topology_die_id(cpu) (cpu_data(cpu).topo.die_id)
#define topology_core_id(cpu) (cpu_data(cpu).topo.core_id)
#define topology_ppin(cpu) (cpu_data(cpu).ppin)
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
BUG_ON(topology_update_package_map(c->topo.pkg_id, cpu));
BUG_ON(topology_update_die_map(c->topo.die_id, cpu));
#else
c->logical_proc_id = 0;
c->topo.logical_pkg_id = 0;
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions arch/x86/kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ int topology_phys_to_logical_pkg(unsigned int phys_pkg)
struct cpuinfo_x86 *c = &cpu_data(cpu);

if (c->initialized && c->topo.pkg_id == phys_pkg)
return c->logical_proc_id;
return c->topo.logical_pkg_id;
}
return -1;
}
Expand All @@ -362,7 +362,7 @@ static int topology_phys_to_logical_die(unsigned int die_id, unsigned int cur_cp

if (c->initialized && c->topo.die_id == die_id &&
c->topo.pkg_id == proc_id)
return c->logical_die_id;
return c->topo.logical_die_id;
}
return -1;
}
Expand All @@ -387,7 +387,7 @@ int topology_update_package_map(unsigned int pkg, unsigned int cpu)
cpu, pkg, new);
}
found:
cpu_data(cpu).logical_proc_id = new;
cpu_data(cpu).topo.logical_pkg_id = new;
return 0;
}
/**
Expand All @@ -410,7 +410,7 @@ int topology_update_die_map(unsigned int die, unsigned int cpu)
cpu, die, new);
}
found:
cpu_data(cpu).logical_die_id = new;
cpu_data(cpu).topo.logical_die_id = new;
return 0;
}

Expand Down

0 comments on commit 22dc963

Please sign in to comment.