[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aQM_nrp4gQzxGixr@U-2FWC9VHC-2323.local>
Date: Thu, 30 Oct 2025 18:36:14 +0800
From: Feng Tang <feng.tang@...ux.alibaba.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, Andrew Morton <akpm@...ux-foundation.org>,
Petr Mladek <pmladek@...e.com>
Subject: Re: [PATCH v2 3/6] panic: sys_info: Replace struct sys_info_name
with plain array of strings
On Thu, Oct 30, 2025 at 11:05:59AM +0200, Andy Shevchenko wrote:
> On Thu, Oct 30, 2025 at 04:45:24PM +0800, Feng Tang wrote:
> > On Thu, Oct 30, 2025 at 09:36:42AM +0200, Andy Shevchenko wrote:
> > > On Thu, Oct 30, 2025 at 10:01:49AM +0800, Feng Tang wrote:
> > > > On Wed, Oct 29, 2025 at 12:07:38PM +0100, Andy Shevchenko wrote:
> > > > > There is no need to keep a custom structure just for the need of
> > > > > a plain array of strings. Replace struct sys_info_name with plain
> > > > > array of strings.
> > > > >
> > > > > With that done, simplify the code, in particular, naturally use
> > > > > for_each_set_bit() when iterating over si_bits_global bitmap.
>
> ...
>
> > > > > names[0] = '\0';
> > > > > - for (i = 0; i < ARRAY_SIZE(si_names); i++) {
> > > > > - if (si_bits & si_names[i].bit) {
> > > > > - len += scnprintf(names + len, sizeof(names) - len,
> > > > > - "%s%s", delim, si_names[i].name);
> > > > > - delim = ",";
> > > > > - }
> > > > > + for_each_set_bit(i, &si_bits, ARRAY_SIZE(si_names)) {
> > > > > + len += scnprintf(names + len, sizeof(names) - len,
> > > > > + "%s%s", delim, si_names[i]);
> > > > > + delim = ",";
> > > >
> > > > For SYS_INFO_PANIC_CONSOLE_REPLAY bit, it is a NULL string, no need for
> > > > an extra ','?
> > >
> > > If you look closer to the original code, the behaviour is the same. Feel free
> > > to update behaviour separately as I tried to keep the functionality to be not
> > > changed with my series (with the exceptions of the fetching issue).
> >
> > I gave the comment by code-reading.
> >
> > And to double check it, I just run a simple test by adding "panic_print=0xff"
> > to cmdline, with the current kernel, by running "sysctl kernel.panic_sys_info"
> > on current kernel, it will get:
> >
> > 'kernel.panic_sys_info = tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks'
> >
> > And after applying your first 3 patches, it will show:
> >
> > 'kernel.panic_sys_info = tasks,mem,timers,locks,ftrace,,all_bt,blocked_task'
>
> Thanks for the test, now I see the issue! Before si_names has no entry for that bit.
> I will address this in next version. Sorry for the confusion.
No problem. Thanks for helping to improve the code!
- Feng
Powered by blists - more mailing lists