Re: [PATCH] Display online cpus value in preference to kt->cpus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- "Luciano Chavez" <lnx1138@xxxxxxxxxxxxxxxxxx> wrote:

> > So if you want to do something specifically for ppc64, please
> > re-post a patch for just that architecture. 
> > 
> > Dave
> > 
> 
> Dave,
> 
> Thanks for taking a good look at all the many cases that would make a
> general solution of using online cpu count messy. I originally did want
> to make this change only applicable to ppc64. The thing was, only
> ppc64_display_machine_stats() was possible to affect and to make the
> value displayed consistent, changing display_sys_stats() and
> dump_kernel_table() was necessary.
> 
> So, re-thinking this to be a ppc64 specific change to CPUS to be
> displayed as the online count when possible and having everyone else do
> what they do now, which is to display kt->cpus, I suggest the following:
> 
> 1. Add a get_cpus_to_display as a machdep function
> 2. For ppc64, initialize machdep->get_cpus_to_display to ppc64_get_cpus_to_display()
>    which will attempt to use get_cpus_online() or fallback to using kt->cpus
> 3. For all other architectures, have them initialize machdep->get_cpus_to_display
>    to generic_get_cpus_to_display() which returns kt->cpus to maintain the status
>    quo of the code as it is now
> 4. Replace kt->cpus in display_sys_stats() and dump_kernel_table() in kernel.c to
>    invoke machdep->get_cpus_to_display() when displaying CPUS

Well, we certainly don't want to change the "cpus:" output of dump_kernel_table()
because its purpose there *is* specifically to dump the kt->cpus value.
 
> 
> Let me know what you think. I think this solution allows for future
> flexibility for other architectures if in the future they individually
> need to change what they display for the cpu count.

The fact of the matter is that it's really not machine-specific in the
sense that your function is just parsing the architecture-neutral cpu maps.
And even the "online-oddities" that I mentioned were not machine-specific,
but rather virtual-vs-baremetal issues.

For now, all I was thinking would be to simply change display_sys_stats()
to something like:

        if (machine_type("PPC64"))
                your_function();       
        else
                fprintf(fp, "        CPUS: %d\n", kt->cpus);

and since your_function() does not need to be in a machine-specific
file, just put in kernel.c.  And you can also call it from the
ppc64_display_machine_stats() function.

Dave



--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux