[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v4 16/18] xen/riscv: implement mfn_valid() and page reference, ownership handling helpers
On 17.09.2025 23:55, Oleksii Kurochko wrote: > Implement the mfn_valid() macro to verify whether a given MFN is valid by > checking that it falls within the range [start_page, max_page). > These bounds are initialized based on the start and end addresses of RAM. > > As part of this patch, start_page is introduced and initialized with the > PFN of the first RAM page. > Also, initialize pdx_group_valid() by calling set_pdx_range() when > memory banks are being mapped. > > Also, after providing a non-stub implementation of the mfn_valid() macro, > the following compilation errors started to occur: > riscv64-linux-gnu-ld: prelink.o: in function `alloc_heap_pages': > /build/xen/common/page_alloc.c:1054: undefined reference to > `page_is_offlinable' > riscv64-linux-gnu-ld: /build/xen/common/page_alloc.c:1035: undefined > reference to `page_is_offlinable' > riscv64-linux-gnu-ld: prelink.o: in function `reserve_offlined_page': > /build/xen/common/page_alloc.c:1151: undefined reference to > `page_is_offlinable' > riscv64-linux-gnu-ld: ./.xen-syms.0: hidden symbol `page_is_offlinable' > isn't defined > riscv64-linux-gnu-ld: final link failed: bad value > make[2]: *** [arch/riscv/Makefile:28: xen-syms] Error 1 > > To resolve these errors, the following functions have also been introduced, > based on their Arm counterparts: > - page_get_owner_and_reference() and its variant to safely acquire a > reference to a page and retrieve its owner. > - Implement page_is_offlinable() to return false for RISC-V. > > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> with two cosmetic adjustments: > @@ -642,3 +648,30 @@ void put_page(struct page_info *page) > free_domheap_page(page); > } > } > + > +bool page_is_offlinable(mfn_t mfn) > +{ > + return false; > +} I think this wants to move elsewhere, or ... > +struct domain *page_get_owner_and_reference(struct page_info *page) ... this wants to move up, such that the "get" and "put" logic are next to each other. > +{ > + unsigned long x, y = page->count_info; > + struct domain *owner; > + > + do { > + x = y; > + /* > + * Count == 0: Page is not allocated, so we cannot take a reference. > + * Count == -1: Reference count would wrap, which is invalid. > + */ > + if ( unlikely(((x + 1) & PGC_count_mask) <= 1) ) > + return NULL; > + } > + while ( (y = cmpxchg(&page->count_info, x, x + 1)) != x ); This again wants the figure brace placement corrected. Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |