[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v1 15/19] xen/sysctl: wrap around XEN_SYSCTL_physinfo
On Wed, 12 Mar 2025, Penny Zheng wrote: > The following functions are only used to deal with XEN_SYSCTL_physinfo, > then they shall be wrapped: > - arch_do_physinfo > - get_outstanding_claims > > Signed-off-by: Penny Zheng <Penny.Zheng@xxxxxxx> > --- > xen/arch/arm/sysctl.c | 2 ++ > xen/arch/riscv/stubs.c | 2 ++ > xen/arch/x86/sysctl.c | 2 ++ > xen/common/page_alloc.c | 5 +++++ > xen/include/xen/mm.h | 5 +++++ > xen/include/xen/sched.h | 4 ++++ > 6 files changed, 20 insertions(+) > > diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c > index 32cab4feff..2d350b700a 100644 > --- a/xen/arch/arm/sysctl.c > +++ b/xen/arch/arm/sysctl.c > @@ -15,6 +15,7 @@ > #include <asm/arm64/sve.h> > #include <public/sysctl.h> > > +#ifdef CONFIG_SYSCTL > void arch_do_physinfo(struct xen_sysctl_physinfo *pi) > { > pi->capabilities |= XEN_SYSCTL_PHYSCAP_hvm | XEN_SYSCTL_PHYSCAP_hap; > @@ -22,6 +23,7 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi) > pi->arch_capabilities |= MASK_INSR(sve_encode_vl(get_sys_vl_len()), > XEN_SYSCTL_PHYSCAP_ARM_SVE_MASK); > } > +#endif > > long arch_do_sysctl(struct xen_sysctl *sysctl, > XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) > diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c > index 5951b0ce91..0321ad57f0 100644 > --- a/xen/arch/riscv/stubs.c > +++ b/xen/arch/riscv/stubs.c > @@ -328,10 +328,12 @@ long arch_do_sysctl(struct xen_sysctl *sysctl, > BUG_ON("unimplemented"); > } > > +#ifdef CONFIG_SYSCTL > void arch_do_physinfo(struct xen_sysctl_physinfo *pi) > { > BUG_ON("unimplemented"); > } > +#endif > > /* p2m.c */ > > diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c > index 1b04947516..d7da476379 100644 > --- a/xen/arch/x86/sysctl.c > +++ b/xen/arch/x86/sysctl.c > @@ -91,6 +91,7 @@ static long cf_check smt_up_down_helper(void *data) > return ret; > } > > +#ifdef CONFIG_SYSCTL > void arch_do_physinfo(struct xen_sysctl_physinfo *pi) > { > memcpy(pi->hw_cap, boot_cpu_data.x86_capability, > @@ -104,6 +105,7 @@ void arch_do_physinfo(struct xen_sysctl_physinfo *pi) > if ( IS_ENABLED(CONFIG_SHADOW_PAGING) ) > pi->capabilities |= XEN_SYSCTL_PHYSCAP_shadow; > } > +#endif > > long arch_do_sysctl( > struct xen_sysctl *sysctl, XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) > diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c > index 5e710cc9a1..d1c4db57a5 100644 > --- a/xen/common/page_alloc.c > +++ b/xen/common/page_alloc.c > @@ -581,6 +581,8 @@ out: > return ret; > } > > +#ifdef CONFIG_SYSCTL > +static unsigned long avail_domheap_pages(void); This part here should be in the previous patch. I would add it at the top of the page_alloc.c file, ideally without the #ifdef, I am guessing it is not required for a forward declaration. > void get_outstanding_claims(uint64_t *free_pages, uint64_t > *outstanding_pages) > { > spin_lock(&heap_lock); > @@ -588,6 +590,7 @@ void get_outstanding_claims(uint64_t *free_pages, > uint64_t *outstanding_pages) > *free_pages = avail_domheap_pages(); > spin_unlock(&heap_lock); > } > +#endif > > static bool __read_mostly first_node_initialised; > #ifndef CONFIG_SEPARATE_XENHEAP > @@ -2796,12 +2799,14 @@ unsigned long avail_domheap_pages_region( > return avail_heap_pages(zone_lo, zone_hi, node); > } > > +#ifdef CONFIG_SYSCTL > static unsigned long avail_domheap_pages(void) > { > return avail_heap_pages(MEMZONE_XEN + 1, > NR_ZONES - 1, > -1); > } > +#endif > > unsigned long avail_node_heap_pages(unsigned int nodeid) > { > diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h > index cbb9f2dfdb..a63e063a46 100644 > --- a/xen/include/xen/mm.h > +++ b/xen/include/xen/mm.h > @@ -131,7 +131,12 @@ int populate_pt_range(unsigned long virt, unsigned long > nr_mfns); > unsigned long __must_check domain_adjust_tot_pages(struct domain *d, > long pages); > int domain_set_outstanding_pages(struct domain *d, unsigned long pages); > +#ifdef CONFIG_SYSCTL > void get_outstanding_claims(uint64_t *free_pages, uint64_t > *outstanding_pages); > +#else > +static inline void get_outstanding_claims(uint64_t *free_pages, > + uint64_t *outstanding_pages) {} > +#endif /* CONFIG_SYSCTL */ > > /* Domain suballocator. These functions are *not* interrupt-safe.*/ > void init_domheap_pages(paddr_t ps, paddr_t pe); > diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h > index 5a065b3624..df39c0465a 100644 > --- a/xen/include/xen/sched.h > +++ b/xen/include/xen/sched.h > @@ -1291,7 +1291,11 @@ struct cpupool *cpupool_create_pool(unsigned int > pool_id, int sched_id); > > extern void cf_check dump_runq(unsigned char key); > > +#ifdef CONFIG_SYSCTL > void arch_do_physinfo(struct xen_sysctl_physinfo *pi); > +#else > +static inline void arch_do_physinfo(struct xen_sysctl_physinfo *pi) {}; > +#endif /* CONFIG_SYSCTL */ > > #ifdef CONFIG_BOOT_TIME_CPUPOOLS > void btcpupools_allocate_pools(void); > -- > 2.34.1 >
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |