-----Original Message-----
On Fri 2021-07-16 07:32 +0000, HAGIO KAZUHITO(萩尾 一仁) wrote:
Kazu,
> Thanks for the update.
No problem.
> > + for (i = 0; i < kt->cpus; i++)
> > + if (NUM_IN_BITMAP(cpus, i) && check_offline_cpu(i))
> > + error(INFO, "CPU %d is OFFLINE.\n", i);
>
> With the offline hide option, "CPU xx [OFFLINE]" is shown as follows and
> this error message is not needed.
>
> crash> set offline hide
> offline: hide
> crash> kmem -S=15 TCP
> kmem: CPU 15 is OFFLINE.
> CACHE OBJSIZE ALLOCATED TOTAL SLABS SSIZE NAME
> ffff916f6798b2c0 2440 17 208 16 32k TCP
> CPU 15 [OFFLINE]
> ...
The above was indeed intentional (to be more verbose) since the CPU(s)
is/are explicitly specified by the user.
I see. I think that it's good to have a way to know which CPUs are
offline without the offline hide option by another patch, as crash
shows only the number of offline CPUs when startup.
display_sys_stats() might be a good place to do something about it,
a simple example:
# crash
...
DUMPFILE: /proc/kcore
CPUS: 16 [OFFLINE: 2 (CPU: 14,15)]
--- a/kernel.c
+++ b/kernel.c
@@ -5627,9 +5627,22 @@ display_sys_stats(void)
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());
+ if (kt->cpus - get_cpus_to_display()) {
+ int i;
+ char *p = buf;
+ BZERO(buf, BUFSIZE);
+ for (i = 0; i < kt->cpus; i++) {
+ if (check_offline_cpu(i)) {
+ if (p == buf)
+ sprintf(p, "%d", i);
+ else
+ sprintf(p, ",%d", i);
+ p += strlen(p);
+ }
+ }
+ fprintf(fp, " [OFFLINE: %d (CPU: %s)]",
+ kt->cpus - get_cpus_to_display(), buf);
+ }
fprintf(fp, "\n");
}
Thanks,
Kazu
> And the other commands do not say anything by default (offline show),
> it should be the same behavior with them.
Fair enough. Better to remain consistent.
> So with removing the for block above, (but you don't need to repost)
> Acked-by: Kazuhito Hagio <k-hagio-ab(a)nec.com>
Understood and thank you.
Kind regards,
--
Aaron Tomlin