x86/mm: Alter is_xen_fixed_mfn() to use mfn_t
PATCH 1/1 x86/mm: Alter is_xen_fixed_mfn() to use mfn_t
The predicate is common between x86 and ARM, and is unlikley to be different on other architectures. Drop the arch declarations and introduce a common static inline in xen/mm.h instead.
---
CC: Jan Beulich <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Tim Deegan <[email protected]>
CC: George Dunlap <[email protected]>
--- xen/common/page_alloc.c | 2 +- xen/include/asm-arm/mm.h | 4 ---- xen/include/asm-x86/mm.h | 3 --- xen/include/xen/mm.h | 6 ++++++ 4 files changed, 7 insertions(+), 8 deletions(-)
xen/common/page_alloc.c +1 -1
@@ -1093,7 +1093,7 @@ int offline_page(unsigned long mfn, int broken, uint32_t *status) *status =0 ; pg =mfn_to_page (mfn); -if (is_xen_fixed_mfn (mfn) ) +if (is_xen_fixed_mfn (_mfn (mfn)) ) { *status =PG_OFFLINE_XENPAGE |PG_OFFLINE_FAILED | (DOMID_XEN <<PG_OFFLINE_OWNER_SHIFT );
xen/include/asm-arm/mm.h +0 -4
@@ -132,10 +132,6 @@ extern vaddr_t xenheap_virt_start; (mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(mfn)))#endif -#define is_xen_fixed_mfn (mfn) \ - ((pfn_to_paddr(mfn) >= virt_to_maddr(&_start)) && \ - (pfn_to_paddr(mfn) <= virt_to_maddr(&_end))) -#define page_get_owner (_p) (_p)->v.inuse.domain#define page_set_owner (_p,_d) ((_p)->v.inuse.domain = (_d))
xen/include/asm-x86/mm.h +0 -3
@@ -252,9 +252,6 @@ struct spage_info#define is_xen_heap_page (page) ((page)->count_info & PGC_xen_heap)#define is_xen_heap_mfn (mfn) \ (__mfn_valid(mfn) && is_xen_heap_page(__mfn_to_page(mfn))) -#define is_xen_fixed_mfn (mfn) \ - ((((mfn) << PAGE_SHIFT) >= __pa(&_start)) && \ - (((mfn) << PAGE_SHIFT) <= __pa(&_end)))#define PRtype_info "016lx"/* should only be used for printk's */
xen/include/xen/mm.h +6 -0
@@ -599,4 +599,10 @@ static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) } } +static inline bool is_xen_fixed_mfn (mfn_t mfn) +{ +return (pfn_to_paddr (mfn_x (mfn)) >=__pa (&_start) && +pfn_to_paddr (mfn_x (mfn)) <=__pa (&_end)); +} +#endif /* __XEN_MM_H__ */
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
xen/include/xen/mm.h static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) · line 606
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 07.02.17 at 19:57, <[email protected]> wrote:
xen/include/xen/mm.h +5
-0@@ -599,4 +599,10 @@ static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) } } +static inline bool is_xen_fixed_mfn (mfn_t mfn) +{ +return (pfn_to_paddr (mfn_x (mfn)) >=__pa (&_start) && +pfn_to_paddr (mfn_x (mfn)) <=__pa (&_end)); +}
Even if you only morph what's been there before, I do think the latter wants to be < instead of <= . With that adjusted
but I'm also unconvinced it wouldn't be better to compare PFNs instead of physical addresses here.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
George Dunlap
Acked-byQuoted 15 lines · Jan Beulich
xen/include/xen/mm.h static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) · line 606
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 07.02.17 at 19:57, <[email protected]> wrote:
xen/include/xen/mm.h +5
-0@@ -599,4 +599,10 @@ static inline void filtered_flush_tlb_mask(uint32_t tlbflush_timestamp) } } +static inline bool is_xen_fixed_mfn (mfn_t mfn) +{ +return (pfn_to_paddr (mfn_x (mfn)) >=__pa (&_start) && +pfn_to_paddr (mfn_x (mfn)) <=__pa (&_end)); +}Even if you only morph what's been there before, I do think the latter wants to be < instead of <= . With that adjusted
Quoted 3 lines
Reviewed-by Jan Beulich <[email protected]>but I'm also unconvinced it wouldn't be better to compare PFNs instead of physical addresses here.
Not positive this falls under my remit but just in case:
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Andrew,
Quoted 1 line · Andrew Cooper
The predicate is common between x86 and ARM, and is unlikley to be different/
NIT: s/unlikley/unlikely/
Quoted 4 lines
on other architectures. Drop the arch declarations and introduce a common static inline in
xen/mm.hinstead.Signed-off-by Andrew Cooper <[email protected]>
Regards,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel