mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Steve Wahl <steve.wahl@hpe.com>,
	Justin Ernst <justin.ernst@hpe.com>,
	Kyle Meyer <kyle.meyer@hpe.com>,
	Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Russ Anderson <russ.anderson@hpe.com>,
	Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Justin Stitt <justinstitt@google.com>
Subject: Re: [PATCH v2] x86/platform/uv: Rework NMI "action" modparam handling
Date: Sat, 16 Sep 2023 14:57:30 +0200	[thread overview]
Message-ID: <aa108d68-cf89-9909-2574-5c748a218a77@redhat.com> (raw)
In-Reply-To: <CAHp75VdTO2=2a_7tqH72tji=UWhmjNpaO+tE8sq+ufdjY6+Low@mail.gmail.com>

Hi,

On 9/14/23 10:42, Andy Shevchenko wrote:
> On Wed, Sep 13, 2023 at 9:01 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Rework NMI "action" modparam handling:
>>
>> 1. Replace the uv_nmi_action string with an enum; and
>> 2. Use sysfs_match_string() for string parsing in param_set_action()
> 
> ...
> 
> Don't you need to include string.h?

Yes (pre-existing problem really, but still). Will fix for v3.

> 
> ...
> 
>> +enum action_t {
>> +       nmi_act_kdump,
>> +       nmi_act_dump,
>> +       nmi_act_ips,
>> +       nmi_act_kdb,
>> +       nmi_act_kgdb,
>> +       nmi_act_health,
>>  };
> 
>> +
>> +static_assert(ARRAY_SIZE(actions) == ARRAY_SIZE(actions_desc));
> 
> I believe with enum in place you don't need this, just add a terminator to it
> 
> enum action_t {
>    ...
>    nmi_act_max
> };
> 
> and use as an array size both arrays.
> 
> ...
> 
>> -       int i;
>> -       int n = ARRAY_SIZE(valid_acts);
> 
>> +       int i, n = ARRAY_SIZE(actions);
> 
> Since you are changing them, why not make them unsigned?

i is used to store the result of sysfs_match_string() which
returns a negative errno.

> 
> ...
> 
>> -       pr_err("UV: Invalid NMI action:%s, valid actions are:\n", arg);
>> +       pr_err("UV: Invalid NMI action:%s, valid actions are:\n", val);
> 
> As mentioned previously the val may or may not have a new line in it.
> I dunno about comma removal, but a new line presence can be easily checked.
> 
> Either way it's not so critical, hence removing comma. or replacing it
> by '-' (dash) may be enough.

I'll fix this for v3 by not printing the wrong val at all as suggested
by Steve Wahl.

Regards,

Hans


      parent reply	other threads:[~2023-09-16 12:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 18:01 Hans de Goede
2023-09-13 19:30 ` Justin Stitt
2023-09-13 21:06 ` Steve Wahl
2023-09-13 21:11   ` Steve Wahl
2023-09-14 15:15   ` Steve Wahl
2023-09-14  8:42 ` Andy Shevchenko
2023-09-14  8:44   ` Andy Shevchenko
2023-09-16 12:57   ` Hans de Goede [this message]

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=aa108d68-cf89-9909-2574-5c748a218a77@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=dimitri.sivanich@hpe.com \
    --cc=dvhart@infradead.org \
    --cc=hpa@zytor.com \
    --cc=justin.ernst@hpe.com \
    --cc=justinstitt@google.com \
    --cc=kyle.meyer@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=russ.anderson@hpe.com \
    --cc=steve.wahl@hpe.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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®