From: Feng Tang <feng.tang@linux.alibaba.com>
To: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Nathan Chancellor <nathan@kernel.org>
Subject: Re: [PATCH 3/5] panic: add 'panic_sys_info' sysctl to take human readable string parameter
Date: Wed, 9 Jul 2025 11:58:17 +0800 [thread overview]
Message-ID: <aG3o2RFHc5iXnJef@U-2FWC9VHC-2323.local> (raw)
In-Reply-To: <vksfx7stglvc7dvdsbu6b6eflmacg5eexnmzu47tdkak4uwscm@rm2ilr5ntriy>
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;
next prev parent reply other threads:[~2025-07-09 3:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 2:29 Sergey Senozhatsky
2025-07-09 3:27 ` Feng Tang
2025-07-09 3:35 ` Sergey Senozhatsky
2025-07-09 3:58 ` Feng Tang [this message]
2025-07-10 3:27 ` Sergey Senozhatsky
-- strict thread matches above, loose matches on Subject: below --
2025-07-03 2:09 [PATCH v3 0/5] generalize panic_print's dump function to be used by other kernel parts Feng Tang
2025-07-03 2:10 ` [PATCH 3/5] panic: add 'panic_sys_info' sysctl to take human readable string parameter Feng Tang
2025-07-03 2:56 ` Lance Yang
2025-07-03 3:18 ` Feng Tang
2025-08-12 10:23 ` Petr Mladek
2025-08-13 0:39 ` Feng Tang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aG3o2RFHc5iXnJef@U-2FWC9VHC-2323.local \
--to=feng.tang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®