Message ID | 20250326055053.3313146-16-Penny.Zheng@amd.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | xen: introduce CONFIG_SYSCTL | expand |
On 3/26/25 6:50 AM, 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@amd.com> > --- > v1 -> v2: > - no need to wrap declaration > - add transient #ifdef in sysctl.c for correct compilation > --- > xen/arch/arm/sysctl.c | 2 ++ > xen/arch/riscv/stubs.c | 2 ++ > xen/arch/x86/sysctl.c | 2 ++ > xen/common/page_alloc.c | 2 ++ > xen/common/sysctl.c | 2 +- > 5 files changed, 9 insertions(+), 1 deletion(-) > > 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..7b3f748886 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 /* CONFIG_SYSCTL */ Considering that now we will have CONFIG_SYSCTL, I think it would be better just to drop definition of arch_do_physinfo() from riscv/stubs.c as it was added to make common code build for RISC-V happy. Thanks. ~ Oleksii > > /* 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 5803a1ef4e..36424a9245 100644 > --- a/xen/common/page_alloc.c > +++ b/xen/common/page_alloc.c > @@ -601,6 +601,7 @@ out: > return ret; > } > > +#ifdef CONFIG_SYSCTL > void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pages) > { > spin_lock(&heap_lock); > @@ -608,6 +609,7 @@ void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pages) > *free_pages = avail_heap_pages(MEMZONE_XEN + 1, NR_ZONES - 1, -1); > spin_unlock(&heap_lock); > } > +#endif /* CONFIG_SYSCTL */ > > static bool __read_mostly first_node_initialised; > #ifndef CONFIG_SEPARATE_XENHEAP > diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c > index ccce7fe963..76622503e2 100644 > --- a/xen/common/sysctl.c > +++ b/xen/common/sysctl.c > @@ -258,7 +258,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) > ret = sched_adjust_global(&op->u.scheduler_op); > break; > > -#endif /* CONFIG_SYSCTL */ > case XEN_SYSCTL_physinfo: > { > struct xen_sysctl_physinfo *pi = &op->u.physinfo; > @@ -301,6 +300,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) > } > break; > > +#endif /* CONFIG_SYSCTL */ > case XEN_SYSCTL_numainfo: > { > unsigned int i, j, num_nodes;
On 27.03.2025 10:35, Oleksii Kurochko wrote: > > On 3/26/25 6:50 AM, 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@amd.com> >> --- >> v1 -> v2: >> - no need to wrap declaration >> - add transient #ifdef in sysctl.c for correct compilation >> --- >> xen/arch/arm/sysctl.c | 2 ++ >> xen/arch/riscv/stubs.c | 2 ++ >> xen/arch/x86/sysctl.c | 2 ++ >> xen/common/page_alloc.c | 2 ++ >> xen/common/sysctl.c | 2 +- >> 5 files changed, 9 insertions(+), 1 deletion(-) >> >> 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..7b3f748886 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 /* CONFIG_SYSCTL */ > > Considering that now we will have CONFIG_SYSCTL, I think it would be better just to drop > definition of arch_do_physinfo() from riscv/stubs.c as it was added to make common code build > for RISC-V happy. Wouldn't that require SYSCTL=n then for RISC-V, which better wouldn't be done (as it would need undoing later on)? Jan
On 3/27/25 10:58 AM, Jan Beulich wrote: > On 27.03.2025 10:35, Oleksii Kurochko wrote: >> On 3/26/25 6:50 AM, 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@amd.com> >>> --- >>> v1 -> v2: >>> - no need to wrap declaration >>> - add transient #ifdef in sysctl.c for correct compilation >>> --- >>> xen/arch/arm/sysctl.c | 2 ++ >>> xen/arch/riscv/stubs.c | 2 ++ >>> xen/arch/x86/sysctl.c | 2 ++ >>> xen/common/page_alloc.c | 2 ++ >>> xen/common/sysctl.c | 2 +- >>> 5 files changed, 9 insertions(+), 1 deletion(-) >>> >>> 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..7b3f748886 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 /* CONFIG_SYSCTL */ >> Considering that now we will have CONFIG_SYSCTL, I think it would be better just to drop >> definition of arch_do_physinfo() from riscv/stubs.c as it was added to make common code build >> for RISC-V happy. > Wouldn't that require SYSCTL=n then for RISC-V, which better wouldn't be done > (as it would need undoing later on)? I missed that SYSCTL=y by default. Then it will be really better to have #ifdef CONFIG_SYSCTL instead of removing arch_do_physinfo() from riscv/stub.c. (the same is true then for arch_do_sysctl() in the next patch) ~ Oleksii
On Wed, 26 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@amd.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
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..7b3f748886 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 /* CONFIG_SYSCTL */ /* 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 5803a1ef4e..36424a9245 100644 --- a/xen/common/page_alloc.c +++ b/xen/common/page_alloc.c @@ -601,6 +601,7 @@ out: return ret; } +#ifdef CONFIG_SYSCTL void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pages) { spin_lock(&heap_lock); @@ -608,6 +609,7 @@ void get_outstanding_claims(uint64_t *free_pages, uint64_t *outstanding_pages) *free_pages = avail_heap_pages(MEMZONE_XEN + 1, NR_ZONES - 1, -1); spin_unlock(&heap_lock); } +#endif /* CONFIG_SYSCTL */ static bool __read_mostly first_node_initialised; #ifndef CONFIG_SEPARATE_XENHEAP diff --git a/xen/common/sysctl.c b/xen/common/sysctl.c index ccce7fe963..76622503e2 100644 --- a/xen/common/sysctl.c +++ b/xen/common/sysctl.c @@ -258,7 +258,6 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) ret = sched_adjust_global(&op->u.scheduler_op); break; -#endif /* CONFIG_SYSCTL */ case XEN_SYSCTL_physinfo: { struct xen_sysctl_physinfo *pi = &op->u.physinfo; @@ -301,6 +300,7 @@ long do_sysctl(XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl) } break; +#endif /* CONFIG_SYSCTL */ case XEN_SYSCTL_numainfo: { unsigned int i, j, num_nodes;
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@amd.com> --- v1 -> v2: - no need to wrap declaration - add transient #ifdef in sysctl.c for correct compilation --- xen/arch/arm/sysctl.c | 2 ++ xen/arch/riscv/stubs.c | 2 ++ xen/arch/x86/sysctl.c | 2 ++ xen/common/page_alloc.c | 2 ++ xen/common/sysctl.c | 2 +- 5 files changed, 9 insertions(+), 1 deletion(-)