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

Re: [PATCH 2/2] x86/mm: correct PG_log_dirty definition


  • To: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Wed, 6 Aug 2025 17:24:05 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=39EmAH5FAicSc8YRclDIl5SElJIogV7JY0cYKX8W230=; b=RSzmtYso2OYnH42pyzDZJMiRlknhWczWip9UxjqmGUcK62itBMz/pLcNt0gnpkJG3Bl2hnca8vdVBmRzCAiGtnlFfTxXHsvImk5gEXwT7F7IqXxZUSUm80ao9FfhLisvpVNcZW8VbRYiFaLhV1DY1BcoWpfBh9dpojs35Ucx+ngKieLToDtnSYWmKA5KzIOO6swr5gnIJGUdJZ3x10wpS1+BWdROKWLGQjLyKvbs7wwLbBszTHf26uhyfjxoJnwe3N/B1H0NLoA2s1BoTnFiHs13H8Lg3ewgxyM0iwJDVUv/KKhqUVytrLHu9Ca/M8GjPtizb8JJqQKbdgmT907/DA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZATdNZaHjT1fTZvxqTot48iPjdglfKrBo3fyi7Qa3egnfI9iRhEpUoAy8/+yJy3jjUBzeREsqwOo3MZw9xL6q99KGNvr4/jGjvMFslk+DDM8e/9p3BeQ6DPVHDV9mvnUKZ7csvfi92syc1VMwTG+F0kW7yKW/WJMsEv12F+sMVWERfTGr39ync997zVPNgmuFmgUDRXvUjoBrVm+0ftGigUEmhHuIczt3zu5YyfwEulVjO/wZP1TRV53x57RD2rYUoGddyggoK+Eg0hjROmplynjHUal1c5XtoJGQ4CoUolNfAht6pQ5mbRmrMN4ZTnX9b3+PCQ5LjBqK3xqK0/mdw==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>
  • Delivery-date: Wed, 06 Aug 2025 21:24:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-08-05 03:59, Jan Beulich wrote:
While it is correct that in shim-exclusive mode log-dirty handling is
all unreachable code, the present conditional still isn't correct: In a
HVM=n and SHADOW_PAGING=n configuration log-dirty code also is all
unreachable (and hence violating Misra rule 2.1).

As we're aiming at moving away from special casing PV_SHIM_EXCLUSIVE=y,
don't retain that part of the conditional.

Because of hypercall-defs.c we need to carry out the dependency by
introducing a new auxiliary PAGING control.

Since compiling out mm/paging.c altogether would entail further changes,
merely conditionalize the one function in there (paging_enable()) which
would otherwise remain unreachable (Misra rule 2.1 again) when PAGING=n.

Fixes: 23d4e0d17b76 ("x86/shim: fix build with PV_SHIM_EXCLUSIVE and 
SHADOW_PAGING")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Of course PAGING is at risk of being confused with MEM_PAGING. It not
having a prompt, I hope that's tolerable, as I can't really think of a
better name.

Other PG_log_dirty pre-processor conditionals then likely also want
replacing. mm/paging.c and mm/p2m-basic.c could also be compiled out
altogether when PAGING=n, at the expense of introducing a few more
stubs.

FTAOD, the Fixes: tag being referenced does not mean this patch corrects
the far more recently introduced build issue with the combination of the
two features. That's still work that I expect Penny to carry out (with
there still being the option of reverting the final part of the earlier
series).


--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -864,6 +864,7 @@ void paging_final_teardown(struct domain
      p2m_final_teardown(d);
  }
+#ifdef CONFIG_PAGING

The file already has a lot of uses of #if PG_log_dirty with similar meaning, if I am not mistaken, so using that would make it more consistent. But CONFIG_PAGING is directly tied to the Kconfig, so maybe it is better? Just something I noticed.

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Regards,
Jason

  /* Enable an arbitrary paging-assistance mode.  Call once at domain
   * creation. */
  int paging_enable(struct domain *d, u32 mode)
@@ -889,6 +890,7 @@ int paging_enable(struct domain *d, u32
      else
          return shadow_enable(d, mode);
  }
+#endif
#ifdef CONFIG_HVM
  /* Called from the guest to indicate that a process is being torn down



 


Rackspace

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