[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aG3o2RFHc5iXnJef@U-2FWC9VHC-2323.local>
Date: Wed, 9 Jul 2025 11:58:17 +0800
From: Feng Tang <feng.tang@...ux.alibaba.com>
To: Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
Nathan Chancellor <nathan@...nel.org>
Subject: Re: [PATCH 3/5] panic: add 'panic_sys_info' sysctl to take human
readable string parameter
On Wed, Jul 09, 2025 at 12:35:40PM +0900, Sergey Senozhatsky wrote:
[...]
> >
> > > Moving sys_info_avail[] inside sysctl_sys_info_handler() seems to help.
> >
> > Sorry for the trouble. I assume this is clang? I locally used gcc v10.2.1
>
> No worries. Yes, clang.
>
> > Nathan Chancellor has helped to post a fix here https://lore.kernel.org/lkml/20250708-fix-clang-sys_info_avail-warning-v1-1-60d239eacd64@kernel.org/
>
> Great.
> Would __maybe_unused be better than something simpler:
I'm fine with both solutions :).
One thought is, as Petr also reminded, that user may extend the needed
sys info in future, and we added some explicit note in sys_info.c:
/*
* When 'si_names' gets updated, please make sure the 'sys_info_avail'
* below is updated accordingly.
*/
static const struct sys_info_name si_names[] = {
{ SYS_INFO_TASKS, "tasks" },
{ SYS_INFO_MEM, "mem" },
{ SYS_INFO_TIMERS, "timers" },
then standing-alone sys_info_avail[] may make it more obvious.
Thanks,
Feng
> ---
>
> diff --git a/lib/sys_info.c b/lib/sys_info.c
> index 46d6f4f1ad2a..3bd789fe29d2 100644
> --- a/lib/sys_info.c
> +++ b/lib/sys_info.c
> @@ -48,13 +48,11 @@ unsigned long sys_info_parse_param(char *str)
> }
>
> #ifdef CONFIG_SYSCTL
> -
> -static const char sys_info_avail[] = "tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks";
> -
> int sysctl_sys_info_handler(const struct ctl_table *ro_table, int write,
> void *buffer, size_t *lenp,
> loff_t *ppos)
> {
> + static const char sys_info_avail[] = "tasks,mem,timers,locks,ftrace,all_bt,blocked_tasks";
> char names[sizeof(sys_info_avail) + 1];
> struct ctl_table table;
> unsigned long *si_bits_global;
Powered by blists - more mailing lists