lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHVXubiHhDgC4=T7xCxK9hoCG7R2KZ46LRPmS8rgYuT7EiQDcg@mail.gmail.com>
Date: Fri, 28 Feb 2025 09:18:54 +0100
From: Alexandre Ghiti <alexghiti@...osinc.com>
To: yunhui cui <cuiyunhui@...edance.com>
Cc: apatel@...tanamicro.com, atishp@...osinc.com, paul.walmsley@...ive.com, 
	palmer@...belt.com, aou@...s.berkeley.edu, samuel.holland@...ive.com, 
	jassisinghbrar@...il.com, takakura@...inux.co.jp, 
	valentina.fernandezalanis@...rochip.com, ruanjinjie@...wei.com, 
	charlie@...osinc.com, conor.dooley@...rochip.com, haibo1.xu@...el.com, 
	andybnac@...il.com, ke.zhao@...ngroup.cn, tglx@...utronix.de, 
	linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [External] Re: [PATCH] riscv: print hartid on bringup

Hi Yunhui,

On Fri, Feb 28, 2025 at 7:41 AM yunhui cui <cuiyunhui@...edance.com> wrote:
>
> Hi Alex,
>
> On Wed, Feb 26, 2025 at 10:58 PM Alexandre Ghiti <alexghiti@...osinc.com> wrote:
> >
> > Hi Yunhui,
> >
> > On Thu, Feb 20, 2025 at 1:54 PM yunhui cui <cuiyunhui@...edance.com> wrote:
> > >
> > > Hi All,
> > >
> > > Gentle ping. Any comments on this patch?
> > >
> > > On Sat, Feb 1, 2025 at 7:06 PM Yunhui Cui <cuiyunhui@...edance.com> wrote:
> > > >
> > > > Firmware randomly releases cores, so CPU numbers don't linearly map
> > > > to hartids. When the system has an exception, we care more about hartids.
> > > >
> > > > Signed-off-by: Yunhui Cui <cuiyunhui@...edance.com>
> > > > ---
> > > >  arch/riscv/kernel/smp.c     | 2 ++
> > > >  arch/riscv/kernel/smpboot.c | 4 ++++
> > > >  2 files changed, 6 insertions(+)
> > > >
> > > > diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c
> > > > index d58b5e751286..e650dec44817 100644
> > > > --- a/arch/riscv/kernel/smp.c
> > > > +++ b/arch/riscv/kernel/smp.c
> > > > @@ -48,6 +48,8 @@ EXPORT_SYMBOL_GPL(__cpuid_to_hartid_map);
> > > >  void __init smp_setup_processor_id(void)
> > > >  {
> > > >         cpuid_to_hartid_map(0) = boot_cpu_hartid;
> > > > +
> > > > +       pr_info("Booting Linux on hartid %lu\n", boot_cpu_hartid);
> > > >  }
> > > >
> > > >  static DEFINE_PER_CPU_READ_MOSTLY(int, ipi_dummy_dev);
> > > > diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
> > > > index e36d20205bd7..beba0efb00b9 100644
> > > > --- a/arch/riscv/kernel/smpboot.c
> > > > +++ b/arch/riscv/kernel/smpboot.c
> > > > @@ -231,6 +231,10 @@ asmlinkage __visible void smp_callin(void)
> > > >         riscv_ipi_enable();
> > > >
> > > >         numa_add_cpu(curr_cpuid);
> > > > +
> > > > +       pr_info("CPU%u: Booted secondary hartid %lu\n", curr_cpuid,
> > > > +               cpuid_to_hartid_map(curr_cpuid));
> > > > +
> > > >         set_cpu_online(curr_cpuid, true);
> > > >
> > > >         /*
> > > > --
> > > > 2.39.2
> > > >
> > >
> > > Thanks,
> > > Yunhui
> >
> > IIRC that's a debug feature when you can't reach userspace and use
> > cpuinfo, so what about using pr_debug() instead?
>
> Using pr_debug needs enabling #define DEBUG in
> arch/riscv/kernel/smpboot.c and adding loglevel=8 to cmdline, not
> convenient.

You can also use a kernel command line parameter to enable a
pr_debug() statement
https://www.kernel.org/doc/html/latest/admin-guide/dynamic-debug-howto.html#debug-messages-during-boot-process

Alex

> Can't always cat /proc/cpuinfo before running in user
> mode.
> It's true that pr_info prints a large amount of information in the
> startup logs, especially when there are many CPU cores.
>
> Do you have a better solution?
>
>
> > Thanks,
> >
> > Alex
>
> Thanks,
> Yunhui

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ