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

Re: [PATCH v3 0/4] x86/mm: miscellaneous fixes


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 15 Nov 2024 09:55:49 +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: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 15 Nov 2024 08:56:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.11.2024 01:55, Andrew Cooper wrote:
> On 14/11/2024 2:57 pm, Roger Pau Monne wrote:
>> Hello,
>>
>> The attempt to fix destroy_xen_mappings() so that L2 tables are
>> consistently freed uncovered some errors in the memory management code.
>> The following series attempts to fix them.
>>
>> All patches except for 4/4 are new in v2, and 4/4 has no change from v1,
>> hence kept Jan's Reviewed-by tag in 4/4.
>>
>> Thanks, Roger.
>>
>> Roger Pau Monne (4):
>>   x86/mm: introduce helpers to detect super page alignment
>>   x86/mm: skip super-page alignment checks for non-present entries
>>   x86/setup: remove bootstrap_map_addr() usage of destroy_xen_mappings()
>>   x86/mm: ensure L2 is always freed if empty
> 
> Still broken.  This happened to be a Cascade Lake:
> 
> (XEN) 3... 2... 1...
> (XEN) Xen is relinquishing VGA console.
> (XEN) ----[ Xen-4.20.0-4-d  x86_64  debug=y  Not tainted ]----
> (XEN) CPU:    0
> (XEN) RIP:    e008:[<ffff82d04022cdc8>]
> common/page_alloc.c#free_heap_pages+0x52/0x753
> <snip>
> (XEN) Xen call trace:
> (XEN)    [<ffff82d04022cdc8>] R
> common/page_alloc.c#free_heap_pages+0x52/0x753
> (XEN)    [<ffff82d04022e98f>] F free_domheap_pages+0x445/0x447
> (XEN)    [<ffff82d040320f88>] F free_xen_pagetable+0x2f/0x31
> (XEN)    [<ffff82d04032193d>] F map_pages_to_xen+0x5df/0x1028
> (XEN)    [<ffff82d040238ab1>] F vunmap+0x27/0xde
> (XEN)    [<ffff82d040624b61>] F vesa_endboot+0x86/0xb3
> (XEN)    [<ffff82d0406244c1>] F video_endboot+0x93/0x261
> (XEN)    [<ffff82d040616e3d>] F console_endboot+0x92/0x120
> (XEN)    [<ffff82d0406407e2>] F __start_xen+0x2139/0x2307
> (XEN)    [<ffff82d0402033ae>] F __high_start+0x8e/0x90
> (XEN)
> (XEN) Pagetable walk from ffff82c000205001:
> (XEN)  L4[0x105] = 0000000060431063 ffffffffffffffff
> (XEN)  L3[0x100] = 000000006fffd063 ffffffffffffffff
> (XEN)  L2[0x001] = fffffffffffff000 ffffffffffffffff
> (XEN)
> (XEN) ****************************************
> (XEN) Panic on CPU 0:
> (XEN) FATAL PAGE FAULT
> (XEN) [error_code=0000]
> (XEN) Faulting linear address: ffff82c000205001
> (XEN) ****************************************
> 
> Note the definitely bogus L2e, which I'm guessing is an issue with the
> use of INVALID_MFN.

Why bogus? That's precisely what vunmap() requests:

    map_pages_to_xen(addr, INVALID_MFN, pages, _PAGE_NONE);

What I agree with is that INVALID_MFN better wouldn't spill into the
upper non-address part of the PTE, but that doesn't look to be important
here.

I can't, however, explain why free_heap_pages() would access VMAP space.
It's all page / MFN based and shouldn't even have a notion of the VA
space underlying vmap(). Is that address in CR2 inside the range that
was mapping the frame buffer (i.e. part of what vunmap() is in the
process of removing)?

What I also don't understand: How did this pass CI then? Are all tests
there perhaps done without vga= designating a VESA mode to use?

Jan



 


Rackspace

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