From: Peter Xu <peterx@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Ming Lei <ming.lei@redhat.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [PATCH] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters
Date: Thu, 2 Apr 2020 09:14:14 -0400 [thread overview]
Message-ID: <20200402131414.GH7174@xz-x1> (raw)
In-Reply-To: <87pncqnuum.fsf@nanos.tec.linutronix.de>
On Thu, Apr 02, 2020 at 10:40:49AM +0200, Thomas Gleixner wrote:
> Peter Xu <peterx@redhat.com> writes:
> > On Thu, Apr 02, 2020 at 01:29:14AM +0200, Thomas Gleixner wrote:
> >> Peter Xu <peterx@redhat.com> writes:
> >> >> + /*
> >> >> + * Skip unknown sub-parameter and validate that it is not
> >> >> + * containing an invalid character.
> >> >> + */
> >> >> + for (par = str, len = 0; isalpha(*str); str++, len++);
> >> >> + if (*str != ',') {
> >> >> + pr_warn("isolcpus: Invalid flag %*s\n", len, par);
> >> >
> >> > ... this will dump "isolcpus: Invalid flag domain1,3,5", is this what
> >> > we wanted? Maybe only dumps "domain1"?
> >>
> >> No, it will dump: "domain1" at least if my understanding of is_alpha()
> >> and the '%*s' format option is halfways correct
> >
> > It will dump "isolcpus: Invalid flag domain1,3,5". Do you mean "%.*s"
> > instead?
>
> Obviously.
>
> > Another issue is even if to use "%.*s" it'll only dump "domain". How
> > about something like (declare "illegal" as bool):
> >
> > /*
> > * Skip unknown sub-parameter and validate that it is not
> > * containing an invalid character.
> > */
> > for (par = str, len = 0; *str && *str != ','; str++, len++)
> > if (!isalpha(*str))
> > illegal = true;
> >
> > if (illegal) {
> > pr_warn("isolcpus: Invalid flag %.*s\n", len, par);
>
> You can achieve the same thing without the illegal indirection with
>
> pr_warn("....", len + 1, par);
I think it will stop working with "isolcpus=nohz,domain11,12,13".
I'll repost soon. Thanks,
--
Peter Xu
prev parent reply other threads:[~2020-04-02 13:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-04 16:16 [PATCH] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters Peter Xu
2020-02-05 12:27 ` Ming Lei
2020-02-05 13:34 ` Peter Xu
2020-02-14 19:40 ` Peter Xu
2020-02-14 20:28 ` Thomas Gleixner
2020-03-09 15:19 ` Peter Xu
2020-03-31 20:57 ` Peter Xu
2020-04-01 20:30 ` Thomas Gleixner
2020-04-01 23:01 ` Peter Xu
2020-04-01 23:29 ` Thomas Gleixner
2020-04-02 0:50 ` Peter Xu
2020-04-02 8:40 ` Thomas Gleixner
2020-04-02 13:14 ` Peter Xu [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=20200402131414.GH7174@xz-x1 \
--to=peterx@redhat.com \
--cc=juri.lelli@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).