[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/MCE: adjust x86_mc_get_cpu_info()
commit d28e6e4478e283b3a1801f552a77bc4935d9b5f9 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Jul 17 08:54:46 2025 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Jul 17 08:54:46 2025 +0200 x86/MCE: adjust x86_mc_get_cpu_info() Move logic independent of c->apicid's initialization status out of the if/else, leveraging that cpu_data[] now doesn't start out zero- initialized. Constify c and have it have an initializer. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/cpu/mcheck/mce.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c index 79214ce56b..bbc0d24732 100644 --- a/xen/arch/x86/cpu/mcheck/mce.c +++ b/xen/arch/x86/cpu/mcheck/mce.c @@ -1005,21 +1005,14 @@ void x86_mc_get_cpu_info(unsigned cpu, uint32_t *chipid, uint16_t *coreid, unsigned *ncores, unsigned *ncores_active, unsigned *nthreads) { - struct cpuinfo_x86 *c; + const struct cpuinfo_x86 *c = &cpu_data[cpu]; *apicid = cpu_physical_id(cpu); - c = &cpu_data[cpu]; if ( c->apicid == BAD_APICID ) { *chipid = cpu; *coreid = 0; *threadid = 0; - if ( ncores != NULL ) - *ncores = 1; - if ( ncores_active != NULL ) - *ncores_active = 1; - if ( nthreads != NULL ) - *nthreads = 1; } else { @@ -1029,13 +1022,16 @@ void x86_mc_get_cpu_info(unsigned cpu, uint32_t *chipid, uint16_t *coreid, else *coreid = 0; *threadid = c->apicid & ((1 << (c->x86_num_siblings - 1)) - 1); - if ( ncores != NULL ) - *ncores = c->x86_max_cores; - if ( ncores_active != NULL ) - *ncores_active = c->booted_cores; - if ( nthreads != NULL ) - *nthreads = c->x86_num_siblings; } + + if ( ncores ) + *ncores = c->x86_max_cores ?: 1; + + if ( ncores_active ) + *ncores_active = c->booted_cores ?: 1; + + if ( nthreads ) + *nthreads = c->x86_num_siblings ?: 1; } #define INTPOSE_NENT 50 -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |