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

Re: [PATCH v6 3/5] arm/sysctl: Implement cpu hotplug ops


  • To: Mykyta Poturai <Mykyta_Poturai@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 27 Mar 2026 12:40:14 +0100
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 27 Mar 2026 11:40:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27.03.2026 11:39, Mykyta Poturai wrote:
> On 3/23/26 13:09, Jan Beulich wrote:
>> On 12.03.2026 10:39, Mykyta Poturai wrote:
>>> --- a/xen/arch/x86/platform_hypercall.c
>>> +++ b/xen/arch/x86/platform_hypercall.c
>>> @@ -735,6 +735,12 @@ ret_t do_platform_op(
>>>       {
>>>           int cpu = op->u.cpu_ol.cpuid;
>>>   
>>> +        if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
>>> +        {
>>> +            ret = -EOPNOTSUPP;
>>> +            break;
>>> +        }
>>> +
>>>           ret = xsm_resource_plug_core(XSM_HOOK);
>>>           if ( ret )
>>>               break;
>>> @@ -761,6 +767,12 @@ ret_t do_platform_op(
>>>       {
>>>           int cpu = op->u.cpu_ol.cpuid;
>>>   
>>> +        if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
>>> +        {
>>> +            ret = -EOPNOTSUPP;
>>> +            break;
>>> +        }
>>> +
>>>           ret = xsm_resource_unplug_core(XSM_HOOK);
>>>           if ( ret )
>>>               break;
>>
>> I wonder whether on x86 this really should become an optional thing (and
>> if so, whether that wouldn't better be a separate change with proper
>> justification). See also the comment on common/Kconfig further down - by
>> the name of the option, and given the support status the change above may
>> be legitimate, but not some of the similar restrictions added elsewhere.
> 
> Maybe force it to be always on like x86 then? I don't really have a 
> justification for making it optional on x86, it just happened as side 
> effect of creating a config option.

Well, I would have asked for that if there wasn't a (presumed) use case for
making it optional - certification, where as much unused code as possible
(apparently) wants compiling out. You'll need to ask those doing prep work
for certification whether they'd be interested in it becoming optional.

>>> --- a/xen/common/sysctl.c
>>> +++ b/xen/common/sysctl.c
>>> @@ -483,6 +483,52 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) 
>>> u_sysctl)
>>>               copyback = 1;
>>>           break;
>>>   
>>> +    case XEN_SYSCTL_cpu_hotplug:
>>> +    {
>>> +        unsigned int cpu = op->u.cpu_hotplug.cpu;
>>
>> I don't think this variable is very useful to keep. Instead use ...
>>
>>> +        unsigned int hp_op = op->u.cpu_hotplug.op;
>>> +        bool plug;
>>> +        long (*fn)(void *data);
>>> +        void *hcpu;
>>
>>          void *hcpu = _p(op->u.cpu_hotplug.op);
>>
>> right here, dropping the assignments further down.
>>
>>> +        ret = -EOPNOTSUPP;
>>> +        if ( !IS_ENABLED(CONFIG_CPU_HOTPLUG) )
>>> +            break;
>>> +
>>> +        switch ( hp_op )
>>> +        {
>>> +        case XEN_SYSCTL_CPU_HOTPLUG_ONLINE:
>>> +            plug = true;
>>> +            fn = cpu_up_helper;
>>> +            hcpu = _p(cpu);
>>> +            break;
>>> +
>>> +        case XEN_SYSCTL_CPU_HOTPLUG_OFFLINE:
>>> +            plug = false;
>>> +            fn = cpu_down_helper;
>>> +            hcpu = _p(cpu);
>>> +            break;
>>> +
>>> +        default:
>>> +            fn = NULL;
>>> +            break;
>>> +        }
>>> +
>>> +        if ( fn )
>>> +        {
>>> +            ret = plug ? xsm_resource_plug_core(XSM_HOOK)
>>> +                       : xsm_resource_unplug_core(XSM_HOOK);
>>> +
>>> +            if ( !ret )
>>> +                ret = continue_hypercall_on_cpu(0, fn, hcpu);
>>> +
>>> +            break;
>>> +        }
>>> +
>>> +        /* Use the arch handler for cases not handled here */
>>> +        fallthrough;
>>> +    }
>>> +
>>>       default:
>>>           ret = arch_do_sysctl(op, u_sysctl);
>>>           copyback = 0;
>>
>> This form of falling through may be a little risky, towards someone not
>> looking closely enough and inserting another case label immediately ahead
>> of the default one. While I don't think there's a really good solution to
>> this, please consider
>>
>>      }
>>          /* Use the arch handler for cases not handled above */
>>          fallthrough;
>>      default:
>>
>> instead.
>>
> 
> Just want to clarirfy if I got the idea. Is this what you meant?
> 
>      switch ( op->cmd )
>      {
>      ....
>      case XEN_SYSCTL_cpu_hotplug:
>      {
>      ....
>      }
> 
>          /* Use the arch handler for cases not handled here */
>          fallthrough;
>      default:
>          ret = arch_do_sysctl(op, u_sysctl);
>          copyback = 0;
>          break;
>      }

I can't spot anything different from what I wrote, so (presumably) yes.

Jan



 


Rackspace

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