[PATCH] x86: topology_update_die_map function removes unused return values

From: Li kunyu
Date: Tue Jun 07 2022 - 05:16:45 EST


Change the return value of the topology_update_die_map function to
void to remove the BUG_ON check and reduce eAX register calls.

Signed-off-by: Li kunyu <kunyu@xxxxxxxxxxxx>
---
arch/x86/include/asm/topology.h | 6 +++---
arch/x86/kernel/cpu/common.c | 2 +-
arch/x86/kernel/smpboot.c | 3 +--
3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h
index eabfb44b63ed..b641f81cb61f 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -137,7 +137,7 @@ static inline int topology_max_smt_threads(void)
}

void topology_update_package_map(unsigned int apicid, unsigned int cpu);
-int topology_update_die_map(unsigned int dieid, unsigned int cpu);
+void topology_update_die_map(unsigned int dieid, unsigned int cpu);
int topology_phys_to_logical_pkg(unsigned int pkg);
int topology_phys_to_logical_die(unsigned int die, unsigned int cpu);
bool topology_is_primary_thread(unsigned int cpu);
@@ -146,8 +146,8 @@ bool topology_smt_supported(void);
#define topology_max_packages() (1)
static inline void
topology_update_package_map(unsigned int apicid, unsigned int cpu) { }
-static inline int
-topology_update_die_map(unsigned int dieid, unsigned int cpu) { return 0; }
+static inline void
+topology_update_die_map(unsigned int dieid, unsigned int cpu) { }
static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
static inline int topology_phys_to_logical_die(unsigned int die,
unsigned int cpu) { return 0; }
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 22d19a1feafd..6850df297dfd 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1674,7 +1674,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
cpu, apicid, c->initial_apicid);
}
topology_update_package_map(c->phys_proc_id, cpu);
- BUG_ON(topology_update_die_map(c->cpu_die_id, cpu));
+ topology_update_die_map(c->cpu_die_id, cpu);
#else
c->logical_proc_id = 0;
#endif
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 20c67cca245b..febec77252e8 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -349,7 +349,7 @@ void topology_update_package_map(unsigned int pkg, unsigned int cpu)
* @die: The die id as retrieved via CPUID
* @cpu: The cpu for which this is updated
*/
-int topology_update_die_map(unsigned int die, unsigned int cpu)
+void topology_update_die_map(unsigned int die, unsigned int cpu)
{
int new;

@@ -365,7 +365,6 @@ int topology_update_die_map(unsigned int die, unsigned int cpu)
}
found:
cpu_data(cpu).logical_die_id = new;
- return 0;
}

void __init smp_store_boot_cpu_info(void)
--
2.18.2