Hi Austin,

On Tue, Apr 1, 2025 at 3:07 PM Austin Kim <austindh....@gmail.com> wrote:
>
> Currently, 'mach' command displays only basic system properties for
> RISC-V-based vmcores. This commit enhances the mach command by adding
> additional system details, including virtual memory addresses, IRQ stacks,
> and overflow stacks.
>
> (before)
> crash> mach
>                 MACHINE TYPE: riscv64
>                  MEMORY SIZE: 4 GB
>                         CPUS: 4
>              PROCESSOR SPEED: (unknown)
>                           HZ: 100
>                    PAGE SIZE: 4096
>            KERNEL STACK SIZE: 16384
>
> (after)
> crash> mach
>                 MACHINE TYPE: riscv64
>                  MEMORY SIZE: 4 GB
>                         CPUS: 4
>              PROCESSOR SPEED: (unknown)
>                           HZ: 100
>                    PAGE SIZE: 4096
> KERNEL VIRTUAL BASE: ffffffd800000000
> KERNEL MODULES BASE: ffffffff01d08000
> KERNEL VMALLOC BASE: ffffffc800000000
> KERNEL VMEMMAP BASE: ffffffc700000000
>            KERNEL STACK SIZE: 16384
>      IRQ STACK SIZE: 16384
>          IRQ STACKS:
>               CPU 0: ffffffc800000000
>               CPU 1: ffffffc800008000
>               CPU 2: ffffffc800010000
>               CPU 3: ffffffc800018000
> OVERFLOW STACK SIZE: 4096
>     OVERFLOW STACKS:
>               CPU 0: ffffffd8fc7433c0
>               CPU 1: ffffffd8fc75f3c0
>               CPU 2: ffffffd8fc77b3c0
>               CPU 3: ffffffd8fc7973c0
>
> Signed-off-by: Austin Kim <austindh....@gmail.com>

The patch LGTM, so ack.

Thanks,
Tao Liu

> ---
>  riscv64.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
>
> diff --git a/riscv64.c b/riscv64.c
> index 98bf02a..d934b22 100644
> --- a/riscv64.c
> +++ b/riscv64.c
> @@ -135,6 +135,7 @@ static void riscv64_get_struct_page_size(struct 
> machine_specific *ms)
>  static void
>  riscv64_display_machine_stats(void)
>  {
> +       int i, pad;
>         struct new_utsname *uts;
>         char buf[BUFSIZE];
>         ulong mhz;
> @@ -151,7 +152,31 @@ riscv64_display_machine_stats(void)
>                 fprintf(fp, "(unknown)\n");
>         fprintf(fp, "                     HZ: %d\n", machdep->hz);
>         fprintf(fp, "              PAGE SIZE: %d\n", PAGESIZE());
> +       fprintf(fp, "KERNEL VIRTUAL BASE: %lx\n", 
> machdep->machspec->page_offset);
> +       fprintf(fp, "KERNEL MODULES BASE: %lx\n", 
> machdep->machspec->modules_vaddr);
> +       fprintf(fp, "KERNEL VMALLOC BASE: %lx\n", 
> machdep->machspec->vmalloc_start_addr);
> +       fprintf(fp, "KERNEL VMEMMAP BASE: %lx\n", 
> machdep->machspec->vmemmap_vaddr);
>         fprintf(fp, "      KERNEL STACK SIZE: %ld\n", STACKSIZE());
> +       if (machdep->machspec->irq_stack_size) {
> +               fprintf(fp, "     IRQ STACK SIZE: %ld\n",
> +                       machdep->machspec->irq_stack_size);
> +               fprintf(fp, "         IRQ STACKS:\n");
> +               for (i = 0; i < kt->cpus; i++) {
> +                       pad = (i < 10) ? 3 : (i < 100) ? 2 : (i < 1000) ? 1 : 
> 0;
> +                       fprintf(fp, "%s           CPU %d: %lx\n", space(pad), 
> i,
> +                               machdep->machspec->irq_stacks[i]);
> +               }
> +       }
> +       if (machdep->machspec->overflow_stack_size) {
> +               fprintf(fp, "OVERFLOW STACK SIZE: %ld\n",
> +                       machdep->machspec->overflow_stack_size);
> +               fprintf(fp, "    OVERFLOW STACKS:\n");
> +               for (i = 0; i < kt->cpus; i++) {
> +                       pad = (i < 10) ? 3 : (i < 100) ? 2 : (i < 1000) ? 1 : 
> 0;
> +                       fprintf(fp, "%s           CPU %d: %lx\n", space(pad), 
> i,
> +                               machdep->machspec->overflow_stacks[i]);
> +               }
> +       }
>  }
>
>  static void
> --
> 2.34.1
> --
> Crash-utility mailing list -- devel@lists.crash-utility.osci.io
> To unsubscribe send an email to devel-le...@lists.crash-utility.osci.io
> https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
> Contribution Guidelines: https://github.com/crash-utility/crash/wiki
--
Crash-utility mailing list -- devel@lists.crash-utility.osci.io
To unsubscribe send an email to devel-le...@lists.crash-utility.osci.io
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines: https://github.com/crash-utility/crash/wiki

Reply via email to