[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 06/18] x86/spec-ctrl: introduce Address Space Isolation command line option



On Thu, Oct 8, 2026 at 9:24 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 07.10.2026 12:40, George Dunlap wrote:
> > --- a/xen/arch/x86/spec_ctrl.c
> > +++ b/xen/arch/x86/spec_ctrl.c
> > @@ -86,6 +86,13 @@ bool __ro_after_init opt_bp_spec_reduce = true;
> >
> >  static bool __initdata opt_ibpb_alt;
> >
> > +/*
> > + * Give each vCPU of an HVM domain its own per-domain area (vCPU-PT).  Off 
> > by
> > + * default until the feature is complete.
> > + */
> > +bool __ro_after_init opt_vcpu_pt_hvm;
> > +bool __ro_after_init opt_vcpu_pt_hwdom;
>
> I'm a little worried of this name, which doesn't distinguish PV and PVH. Yes,
> the variable name is already long-ish, yet I think inserting "pvh" is going
> to help.

Ack

>
> > @@ -487,6 +494,62 @@ static int __init cf_check parse_pv_l1tf(const char *s)
> >  }
> >  custom_param("pv-l1tf", parse_pv_l1tf);
> >
> > +static int __init cf_check parse_asi(const char *s)
> > +{
> > +    const char *ss;
> > +    int val, rc = 0;
> > +
> > +    /* Interpret 'asi' alone in its positive boolean form. */
> > +    if ( *s == '\0' )
> > +        opt_vcpu_pt_hwdom = opt_vcpu_pt_hvm = true;
> > +
> > +    do {
> > +        ss = strchr(s, ',');
> > +        if ( !ss )
> > +            ss = strchr(s, '\0');
> > +
> > +        val = parse_bool(s, ss);
> > +        switch ( val )
> > +        {
> > +        case 0:
> > +        case 1:
> > +            opt_vcpu_pt_hwdom = opt_vcpu_pt_hvm = val;
> > +            break;
> > +
> > +        default:
> > +            if ( (val = parse_boolean("hvm", s, ss)) >= 0 )
> > +                opt_vcpu_pt_hvm = val;
> > +            else if ( (val = parse_boolean("vcpu-pt", s, ss)) != -1 )
> > +            {
> > +                switch ( val )
> > +                {
> > +                case 1:
> > +                case 0:
> > +                    opt_vcpu_pt_hwdom = opt_vcpu_pt_hvm = val;
> > +                    break;
> > +
> > +                case -2:
> > +                    s += strlen("vcpu-pt=");
> > +                    if ( (val = parse_boolean("hvm", s, ss)) >= 0 )
> > +                        opt_vcpu_pt_hvm = val;
> > +                    else
> > +                default:
> > +                        rc = -EINVAL;
> > +                    break;
>
> While personally I like the reduced redundancy from placing case labels
> like the default: one here, Misra rule 16.2 wants us to not use such.
> Note that as written there's no violation, yet iirc Andrew keeps asking
> for figure braces in such constructs. I think we're better off not
> introducing new instances (the rule is marked clean, so with the braces
> added we simply can't, unless the file is excluded from scanning).

OK.

Thanks,
 -George



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.