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

[xen staging] Arm: drop assertion from page_is_ram_type()



commit 2d5e91fe654e47b4053ba81112a8d36dd6cd4e1a
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Aug 26 08:36:43 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 26 08:36:43 2025 +0200

    Arm: drop assertion from page_is_ram_type()
    
    Its uses in offline_page() and query_page_offline() make it reachable on
    Arm, as long as XEN_SYSCTL_page_offline_op doesn't have any Arm-specific
    code added. It being reachable was even mentioned in the commit
    introducing it, claiming it "clearly shouldn't be called on ARM just
    yet".
    
    However, dropping the assertion from a function of this name is deemed
    problematic. Rename it to better reflect its sole purpose outside of
    x86-specific code.
    
    Fixes: 214c4cd94a80 ("xen: arm: stub page_is_ram_type")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Oleksii Kurochko<oleksii.kurochko@xxxxxxxxx>
    Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
    Acked-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/mm.c       | 5 ++---
 xen/arch/x86/mm.c       | 5 +++++
 xen/common/page_alloc.c | 6 +++---
 xen/include/xen/mm.h    | 2 ++
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 77e21f5f29..3b05b46ee0 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -64,10 +64,9 @@ int steal_page(
     return -EOPNOTSUPP;
 }
 
-int page_is_ram_type(unsigned long mfn, unsigned long mem_type)
+bool page_is_offlinable(mfn_t mfn)
 {
-    ASSERT_UNREACHABLE();
-    return 0;
+    return false;
 }
 
 unsigned long domain_get_maximum_gpfn(struct domain *d)
diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5682f600bb..dd48835d56 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -418,6 +418,11 @@ int page_is_ram_type(unsigned long mfn, unsigned long 
mem_type)
     return 0;
 }
 
+bool page_is_offlinable(mfn_t mfn)
+{
+    return page_is_ram_type(mfn_x(mfn), RAM_TYPE_CONVENTIONAL);
+}
+
 unsigned int page_get_ram_type(mfn_t mfn)
 {
     uint64_t last = 0, maddr = mfn_to_maddr(mfn);
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index ec9dec365e..1f67b88a89 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1635,7 +1635,7 @@ static unsigned long mark_page_offline(struct page_info 
*pg, int broken)
 {
     unsigned long nx, x, y = pg->count_info;
 
-    ASSERT(page_is_ram_type(mfn_x(page_to_mfn(pg)), RAM_TYPE_CONVENTIONAL));
+    ASSERT(page_is_offlinable(page_to_mfn(pg)));
     ASSERT(spin_is_locked(&heap_lock));
 
     do {
@@ -1711,7 +1711,7 @@ int offline_page(mfn_t mfn, int broken, uint32_t *status)
      * N.B. xen's txt in x86_64 is marked reserved and handled already.
      * Also kexec range is reserved.
      */
-    if ( !page_is_ram_type(mfn_x(mfn), RAM_TYPE_CONVENTIONAL) )
+    if ( !page_is_offlinable(mfn) )
     {
         *status = PG_OFFLINE_FAILED | PG_OFFLINE_NOT_CONV_RAM;
         return -EINVAL;
@@ -1851,7 +1851,7 @@ int query_page_offline(mfn_t mfn, uint32_t *status)
 {
     struct page_info *pg;
 
-    if ( !mfn_valid(mfn) || !page_is_ram_type(mfn_x(mfn), 
RAM_TYPE_CONVENTIONAL) )
+    if ( !mfn_valid(mfn) || !page_is_offlinable(mfn) )
     {
         dprintk(XENLOG_WARNING, "call expand_pages() first\n");
         return -EINVAL;
diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h
index 93c037d618..3def57abf6 100644
--- a/xen/include/xen/mm.h
+++ b/xen/include/xen/mm.h
@@ -144,9 +144,11 @@ unsigned long avail_domheap_pages_region(
 unsigned long avail_node_heap_pages(unsigned int nodeid);
 #define alloc_domheap_page(d,f) (alloc_domheap_pages(d,0,f))
 #define free_domheap_page(p)  (free_domheap_pages(p,0))
+
 int online_page(mfn_t mfn, uint32_t *status);
 int offline_page(mfn_t mfn, int broken, uint32_t *status);
 int query_page_offline(mfn_t mfn, uint32_t *status);
+bool page_is_offlinable(mfn_t mfn);
 
 void heap_init_late(void);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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