1. 17 May, 2024 2 commits
    • Roger Pau Monne's avatar
      xen/x86: add extra pages to unpopulated-alloc if available · a6aa4eb9
      Roger Pau Monne authored
      Commit 262fc47a ('xen/balloon: don't use PV mode extra memory for zone
      device allocations') removed the addition of the extra memory ranges to the
      unpopulated range allocator, using those only for the balloon driver.
      
      This forces the unpopulated allocator to attach hotplug ranges even when spare
      memory (as part of the extra memory ranges) is available.  Furthermore, on PVH
      domains it defeats the purpose of commit 38620fc4 ('x86/xen: attempt to
      inflate the memory balloon on PVH'), as extra memory ranges would only be
      used to map foreign memory if the kernel is built without XEN_UNPOPULATED_ALLOC
      support.
      
      Fix this by adding a helpers that adds the extra memory ranges to the list of
      unpopulated pages, and zeroes the ranges so they are not also consumed by the
      balloon driver.
      
      This should have been part of 38620fc4, hence the fixes tag.
      
      Note the current logic relies on unpopulated_init() (and hence
      arch_xen_unpopulated_init()) always being called ahead of balloon_init(), so
      that the extra memory regions are consumed by arch_xen_unpopulated_init().
      
      Fixes: 38620fc4 ('x86/xen: attempt to inflate the memory balloon on PVH')
      Signed-off-by: default avatarRoger Pau Monné <roger.pau@citrix.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Link: https://lore.kernel.org/r/20240429155053.72509-1-roger.pau@citrix.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      a6aa4eb9
    • Uros Bizjak's avatar
      locking/x86/xen: Use try_cmpxchg() in xen_alloc_p2m_entry() · cdf9df02
      Uros Bizjak authored
      Use try_cmpxchg() instead of cmpxchg(*ptr, old, new) == old.
      
      The x86 CMPXCHG instruction returns success in the ZF flag,
      so this change saves a compare after CMPXCHG.
      
      Also, try_cmpxchg() implicitly assigns old *ptr value to "old"
      when CMPXCHG fails. There is no need to explicitly assign
      old *ptr value to the temporary, which can simplify the
      surrounding source code.
      
      No functional change intended.
      Signed-off-by: default avatarUros Bizjak <ubizjak@gmail.com>
      Reviewed-by: default avatarJuergen Gross <jgross@suse.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Link: https://lore.kernel.org/r/20240405083335.507471-1-ubizjak@gmail.comSigned-off-by: default avatarJuergen Gross <jgross@suse.com>
      cdf9df02
  2. 12 May, 2024 5 commits
  3. 11 May, 2024 10 commits
  4. 10 May, 2024 20 commits
  5. 09 May, 2024 3 commits