[Crash-utility] [PATCH] Display online cpus value in preference to kt->cpus
Dave Anderson
anderson at redhat.com
Tue Mar 9 13:36:44 UTC 2010
----- "Luciano Chavez" <lnx1138 at linux.vnet.ibm.com> wrote:
> Hi Dave,
> >
> > I like this particular solution best! Simple and straightforward. I'll
> > work on a patch that does exactly as suggested. I'll post it for review
> > once I have it done this afternoon. Thanks for the help!
>
> Below is the simpler revised patch. It applies and compiles to the
> latest crash 5.0.1 source cleanly.
>
> I still need to verify it still fixes the original problem. I am
> confident it will but just wanted to post the patch up first.
>
> BTW, I was able to briefly access a POWER7 box this morning and
> confirmed that at least the CPU count displayed would be worse on one of
> those systems if indeed SMT was disabled and when using the current code
> minus the patch.
Queued for the next release.
Thanks,
Dave
>
> ~ # cat /sys/devices/system/cpu/online
> 0-23
> ~ # ppc64_cpu --smt=off
> ~ # cat /sys/devices/system/cpu/online
> 0,4,8,12,16,20
>
> The current 5.0.1 code would display CPUS: 21 rather than CPUS: 6
>
> Once I confirm the patch fixes this problem, I will post a followup.
>
> --
> Luciano Chavez <lnx1138 at linux.vnet.ibm.com>
> IBM Linux Technology Center
>
> diff -up crash-5.0.1/defs.h.old crash-5.0.1/defs.h
> --- crash-5.0.1/defs.h.old 2010-03-08 14:23:57.000000000 -0600
> +++ crash-5.0.1/defs.h 2010-03-08 14:34:29.000000000 -0600
> @@ -3717,6 +3717,7 @@ int get_cpus_online(void);
> int get_cpus_present(void);
> int get_cpus_possible(void);
> int get_highest_cpu_online(void);
> +int get_cpus_to_display(void);
> int in_cpu_map(int, int);
> void paravirt_init(void);
> void print_stack_text_syms(struct bt_info *, ulong, ulong);
> diff -up crash-5.0.1/kernel.c.old crash-5.0.1/kernel.c
> --- crash-5.0.1/kernel.c.old 2010-03-08 14:23:45.000000000 -0600
> +++ crash-5.0.1/kernel.c 2010-03-08 15:09:05.000000000 -0600
> @@ -3871,7 +3871,8 @@ display_sys_stats(void)
> }
>
>
> - fprintf(fp, " CPUS: %d\n", kt->cpus);
> + fprintf(fp, " CPUS: %d\n",
> + machine_type("PPC64") ? get_cpus_to_display() : kt->cpus);
> if (ACTIVE())
> get_symbol_data("xtime", sizeof(struct timespec),
> &kt->date);
> fprintf(fp, " DATE: %s\n",
> @@ -6256,6 +6257,18 @@ get_cpus_possible()
> return possible;
> }
>
> +
> +/*
> + * For when displaying cpus, return the number of cpus online if
> possible, otherwise kt->cpus.
> + */
> +int
> +get_cpus_to_display(void)
> +{
> + int online = get_cpus_online();
> +
> + return (online ? online : kt->cpus);
> +}
> +
> /*
> * Xen machine-address to pseudo-physical-page translator.
> */
> diff -up crash-5.0.1/ppc64.c.old crash-5.0.1/ppc64.c
> --- crash-5.0.1/ppc64.c.old 2010-03-08 14:24:07.000000000 -0600
> +++ crash-5.0.1/ppc64.c 2010-03-08 14:38:10.000000000 -0600
> @@ -2215,7 +2215,7 @@ ppc64_display_machine_stats(void)
>
> fprintf(fp, " MACHINE TYPE: %s\n", uts->machine);
> fprintf(fp, " MEMORY SIZE: %s\n",
> get_memory_size(buf));
> - fprintf(fp, " CPUS: %d\n", kt->cpus);
> + fprintf(fp, " CPUS: %d\n",
> get_cpus_to_display());
> fprintf(fp, " PROCESSOR SPEED: ");
> if ((mhz = machdep->processor_speed()))
> fprintf(fp, "%ld Mhz\n", mhz);
>
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
More information about the Crash-utility
mailing list