On Tue, Jan 14, 2025 at 11:52 AM <devel-request(a)lists.crash-utility.osci.io>
wrote:
 Date: Thu, 9 Jan 2025 15:59:20 +1300
 From: Tao Liu <ltao(a)redhat.com>
 Subject: [Crash-utility] Re: [PATCH] Fix misleading CPU count in
         display_sys_stats()
 To: soakley(a)redhat.com
 Cc: devel(a)lists.crash-utility.osci.io
 Message-ID:
         <
 CAO7dBbXO5q4ad049R4Qtj14hoi97xy_13-Nja-1VMUwGGgem5A(a)mail.gmail.com>
 Content-Type: text/plain; charset="UTF-8"
 Hi Lucas,
 Thanks for the fix, LGTM, so ack.
 
Applied(with slight changes):
https://github.com/crash-utility/crash/commit/88453095a3dd54b0950f7d9011f...
Thanks
Lianbo
 Thanks,
 Tao Liu
 On Sat, Jan 4, 2025 at 10:54 AM <soakley(a)redhat.com> wrote:
 >
 > From: Lucas Oakley <soakley(a)redhat.com>
 >
 > This simplication fixes the total CPU count being reported
 > incorrectly in ppc64le and s390x systems when some number of
 > CPUs have been offlined, as the kt->cpus value is adjusted.
 > This adds the word "OFFLINE" to the 'sys' output for s390x
 > and ppc64le, like exists for x86_64 and aarch64 when examining
 > systems with offlined CPUs.
 >
 > Without patch:
 >
 >   KERNEL: /debug/4.18.0-477.10.1.el8_8.s390x/vmlinux
 > DUMPFILE: /proc/kcore
 >     CPUS: 1
 >
 > With patch:
 >
 >   KERNEL: /debug/4.18.0-477.10.1.el8_8.s390x/vmlinux
 > DUMPFILE: /proc/kcore
 >     CPUS: 2 [OFFLINE: 1]
 >
 > Signed-off-by: Lucas Oakley <soakley(a)redhat.com>
 > ---
 >  kernel.c | 16 +++++++---------
 >  1 file changed, 7 insertions(+), 9 deletions(-)
 >
 > diff --git a/kernel.c b/kernel.c
 > index 8c2e0ca..3e190f1 100644
 > --- a/kernel.c
 > +++ b/kernel.c
 > @@ -5816,15 +5816,13 @@ display_sys_stats(void)
 >                                 pc->kvmdump_mapfile);
 >         }
 >
 > -       if (machine_type("PPC64"))
 > -               fprintf(fp, "        CPUS: %d\n", get_cpus_to_display());
 > -       else {
 > -               fprintf(fp, "        CPUS: %d", kt->cpus);
 > -               if (kt->cpus - get_cpus_to_display())
 > -                       fprintf(fp, " [OFFLINE: %d]",
 > -                               kt->cpus - get_cpus_to_display());
 > -               fprintf(fp, "\n");
 > -       }
 > +        int number_cpus_to_display = get_cpus_to_display();
 > +        int number_cpus_present = get_cpus_present();
 > +        fprintf(fp, "        CPUS: %d", number_cpus_present);
 > +        if (number_cpus_present != number_cpus_to_display)
 > +                fprintf(fp, " [OFFLINE: %d]",
 > +                    number_cpus_present - number_cpus_to_display);
 > +        fprintf(fp, "\n");
 >
 >         if (ACTIVE())
 >                 get_xtime(&kt->date);
 > --
 > 2.47.1