lkml.org 
[lkml]   [2020]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters
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

\
 
 \ /
  Last update: 2020-04-02 15:15    [W:0.083 / U:1.864 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site