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

Re: [PATCH 05/16] xen/percpu: don't initialize percpu on resume


  • To: Mykola Kvach <xakep.amatop@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 21 Mar 2025 14:54:29 +0100
  • 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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Mykyta Poturai <mykyta_poturai@xxxxxxxx>, Mykola Kvach <mykola_kvach@xxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Jürgen Groß <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>
  • Delivery-date: Fri, 21 Mar 2025 13:54:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 21.03.2025 10:48, Mykola Kvach wrote:
> Hi,
> 
> On Thu, Mar 13, 2025 at 6:20 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>>
>> On 13.03.2025 17:05, Jürgen Groß wrote:
>>> On 13.03.25 16:54, Jan Beulich wrote:
>>>> On 11.03.2025 21:59, Julien Grall wrote:
>>>>> On 05/03/2025 09:11, Mykola Kvach wrote:
>>>>>> Invocation of the CPU_UP_PREPARE notification
>>>>>> on ARM64 during resume causes a crash:
>>>>>>
>>>>>> (XEN) [  315.807606] Error bringing CPU1 up: -16
>>>>>> (XEN) [  315.811926] Xen BUG at common/cpu.c:258
>>>>>> [...]
>>>>>> (XEN) [  316.142765] Xen call trace:
>>>>>> (XEN) [  316.146048]    [<00000a0000202264>] 
>>>>>> enable_nonboot_cpus+0x128/0x1ac (PC)
>>>>>> (XEN) [  316.153219]    [<00000a000020225c>] 
>>>>>> enable_nonboot_cpus+0x120/0x1ac (LR)
>>>>>> (XEN) [  316.160391]    [<00000a0000278180>] 
>>>>>> suspend.c#system_suspend+0x4c/0x1a0
>>>>>> (XEN) [  316.167476]    [<00000a0000206b70>] 
>>>>>> domain.c#continue_hypercall_tasklet_handler+0x54/0xd0
>>>>>> (XEN) [  316.176117]    [<00000a0000226538>] 
>>>>>> tasklet.c#do_tasklet_work+0xb8/0x100
>>>>>> (XEN) [  316.183288]    [<00000a0000226920>] do_tasklet+0x68/0xb0
>>>>>> (XEN) [  316.189077]    [<00000a000026e120>] 
>>>>>> domain.c#idle_loop+0x7c/0x194
>>>>>> (XEN) [  316.195644]    [<00000a0000277638>] 
>>>>>> shutdown.c#halt_this_cpu+0/0x14
>>>>>> (XEN) [  316.202383]    [<0000000000000008>] 0000000000000008
>>>>>>
>>>>>> Freeing per-CPU areas and setting __per_cpu_offset to INVALID_PERCPU_AREA
>>>>>> only occur when !park_offline_cpus and system_state is not 
>>>>>> SYS_STATE_suspend.
>>>>>> On ARM64, park_offline_cpus is always false, so setting __per_cpu_offset 
>>>>>> to
>>>>>> INVALID_PERCPU_AREA depends solely on the system state.
>>>>>>
>>>>>> If the system is suspended, this area is not freed, and during resume, 
>>>>>> an error
>>>>>> occurs in init_percpu_area, causing a crash because INVALID_PERCPU_AREA 
>>>>>> is not
>>>>>> set and park_offline_cpus remains 0:
>>>>>>
>>>>>>       if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
>>>>>>           return park_offline_cpus ? 0 : -EBUSY;
>>>>>>
>>>>>> It appears that the same crash can occur on x86 if park_offline_cpus is 
>>>>>> set
>>>>>> to 0 during Xen suspend.
>>>>>
>>>>> I am rather confused. Looking at the x86 code, it seems
>>>>> park_offline_cpus is cleared for AMD platforms. So are you saying the
>>>>> suspend/resume doesn't work on AMD?
>>>>
>>>> Right now I can't see how it would work there. I've asked Marek for 
>>>> clarification
>>>> as to their users using S3 only on Intel hardware.
>>>
>>> Seems as if this issue has been introduced with commit f75780d26b2f
>>> ("xen: move per-cpu area management into common code"). Before that
>>> on x86 there was just:
>>>
>>>      if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
>>>          return 0;
>>>
>>> in init_percpu_area().
>>
>> Ah yes. Mykola, can you then please address this by adjusting 
>> init_percpu_area(),
> 
> Do I understand correctly that I should move the system_state check
> inside init_percpu_area?

Well, I can only say as much as: To me this looks like it's the best thing you
can do, given how the code is structured right now.

>> adding a Fixes: tag to reference the commit above?
> 
> Sure! Should I send it as a separate patch to speed up its merging?

Doing so may indeed help.

Jan



 


Rackspace

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