* [PATCH] x86: topology_update_package_map function doesn't use the return value
@ 2022-06-06 12:23 Li kunyu
2022-06-07 17:44 ` Tim Chen
0 siblings, 1 reply; 2+ messages in thread
From: Li kunyu @ 2022-06-06 12:23 UTC (permalink / raw)
To: tglx, mingo, bp, dave.hansen, hpa, rafael.j.wysocki, tony.luck,
tim.c.chen, tim.gardner, boris.ostrovsky
Cc: peterz, ray.huang, paulmck, ionela.voinescu, linux-kernel, Li kunyu
topology_update_package_map function could remove the return value, and
it could remove the BUG_ON check.
Signed-off-by: Li kunyu <kunyu@nfschina.com>
---
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 458c891a8273..eabfb44b63ed 100644
--- a/arch/x86/include/asm/topology.h
+++ b/arch/x86/include/asm/topology.h
@@ -136,7 +136,7 @@ static inline int topology_max_smt_threads(void)
return __max_smt_threads;
}
-int topology_update_package_map(unsigned int apicid, unsigned int cpu);
+void topology_update_package_map(unsigned int apicid, unsigned int cpu);
int 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);
@@ -144,8 +144,8 @@ bool topology_is_primary_thread(unsigned int cpu);
bool topology_smt_supported(void);
#else
#define topology_max_packages() (1)
-static inline int
-topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; }
+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 int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c296cb1c0113..22d19a1feafd 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1673,7 +1673,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",
cpu, apicid, c->initial_apicid);
}
- BUG_ON(topology_update_package_map(c->phys_proc_id, cpu));
+ topology_update_package_map(c->phys_proc_id, cpu);
BUG_ON(topology_update_die_map(c->cpu_die_id, cpu));
#else
c->logical_proc_id = 0;
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 5e7f9532a10d..20c67cca245b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -327,7 +327,7 @@ EXPORT_SYMBOL(topology_phys_to_logical_die);
* @pkg: The physical package id as retrieved via CPUID
* @cpu: The cpu for which this is updated
*/
-int topology_update_package_map(unsigned int pkg, unsigned int cpu)
+void topology_update_package_map(unsigned int pkg, unsigned int cpu)
{
int new;
@@ -343,7 +343,6 @@ int topology_update_package_map(unsigned int pkg, unsigned int cpu)
}
found:
cpu_data(cpu).logical_proc_id = new;
- return 0;
}
/**
* topology_update_die_map - Update the physical to logical die map
--
2.18.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: topology_update_package_map function doesn't use the return value
2022-06-06 12:23 [PATCH] x86: topology_update_package_map function doesn't use the return value Li kunyu
@ 2022-06-07 17:44 ` Tim Chen
0 siblings, 0 replies; 2+ messages in thread
From: Tim Chen @ 2022-06-07 17:44 UTC (permalink / raw)
To: Li kunyu, tglx, mingo, bp, dave.hansen, hpa, rafael.j.wysocki,
tony.luck, tim.gardner, boris.ostrovsky
Cc: peterz, ray.huang, paulmck, ionela.voinescu, linux-kernel
On Mon, 2022-06-06 at 20:23 +0800, Li kunyu wrote:
> topology_update_package_map function could remove the return value, and
> it could remove the BUG_ON check.
>
> Signed-off-by: Li kunyu <kunyu@nfschina.com>
As far as I can tell, topology_update_package_map() should always succeed and return 0.
Either there is an existing mapping of the physical package to a logical
package id and we don't have to do anything, or we assign a new logical package id to this
physical package id that doesn't have a mapping.
So I agree that checking for the failure and non-zero return of topology_update_package_map()
is useless.
Likewise, I think topology_update_die_map() should always succeed and we can remove
checking of its return value.
Reviewed-by: Tim Chen <tim.c.chen@linux.intel.com>
> ---
> 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 458c891a8273..eabfb44b63ed 100644
> --- a/arch/x86/include/asm/topology.h
> +++ b/arch/x86/include/asm/topology.h
> @@ -136,7 +136,7 @@ static inline int topology_max_smt_threads(void)
> return __max_smt_threads;
> }
>
> -int topology_update_package_map(unsigned int apicid, unsigned int cpu);
> +void topology_update_package_map(unsigned int apicid, unsigned int cpu);
> int 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);
> @@ -144,8 +144,8 @@ bool topology_is_primary_thread(unsigned int cpu);
> bool topology_smt_supported(void);
> #else
> #define topology_max_packages() (1)
> -static inline int
> -topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; }
> +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 int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; }
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index c296cb1c0113..22d19a1feafd 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1673,7 +1673,7 @@ static void validate_apic_and_package_id(struct cpuinfo_x86 *c)
> pr_err(FW_BUG "CPU%u: APIC id mismatch. Firmware: %x APIC: %x\n",
> cpu, apicid, c->initial_apicid);
> }
> - BUG_ON(topology_update_package_map(c->phys_proc_id, cpu));
> + topology_update_package_map(c->phys_proc_id, cpu);
> BUG_ON(topology_update_die_map(c->cpu_die_id, cpu));
> #else
> c->logical_proc_id = 0;
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 5e7f9532a10d..20c67cca245b 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -327,7 +327,7 @@ EXPORT_SYMBOL(topology_phys_to_logical_die);
> * @pkg: The physical package id as retrieved via CPUID
> * @cpu: The cpu for which this is updated
> */
> -int topology_update_package_map(unsigned int pkg, unsigned int cpu)
> +void topology_update_package_map(unsigned int pkg, unsigned int cpu)
> {
> int new;
>
> @@ -343,7 +343,6 @@ int topology_update_package_map(unsigned int pkg, unsigned int cpu)
> }
> found:
> cpu_data(cpu).logical_proc_id = new;
> - return 0;
> }
> /**
> * topology_update_die_map - Update the physical to logical die map
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-07 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 12:23 [PATCH] x86: topology_update_package_map function doesn't use the return value Li kunyu
2022-06-07 17:44 ` Tim Chen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.