Message ID | e37da57b94fd3bd4f314e6fbd7b6b94aee4b4607.1741687645.git.Sergiy_Kibrik@epam.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | make build of vm_event/mem_access/monitor optional | expand |
On 11.03.2025 11:27, Sergiy Kibrik wrote: > From: Stefano Stabellini <stefano.stabellini@amd.com> > > Extend coverage of CONFIG_VM_EVENT option and make the build of VM events > and monitoring support optional. Also make MEM_PAGING option depend on VM_EVENT > to document that mem_paging is relying on vm_event. > This is to reduce code size on Arm when this option isn't enabled. > > CC: Jan Beulich <jbeulich@suse.com> > CC: Tamas K Lengyel <tamas@tklengyel.com> > Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> > Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com> Please can tags be kept in chronological order? It's impossible to review a patch that wasn't first signed-off on by the author(s). > --- > changes in v3: > - add dependency MEM_PAGING -> VM_EVENT > - monitor_domctl() stub returns -EOPNOTSUPP Seeing this, i.e. ... > --- a/xen/include/xen/monitor.h > +++ b/xen/include/xen/monitor.h > @@ -27,8 +27,17 @@ > struct domain; > struct xen_domctl_monitor_op; > > +#ifdef CONFIG_VM_EVENT > int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop); > void monitor_guest_request(void); > +#else > +static inline int monitor_domctl(struct domain *d, > + struct xen_domctl_monitor_op *mop) > +{ > + return -EOPNOTSUPP; ... this, why ... > @@ -88,7 +85,18 @@ void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved); > void vm_event_put_request(struct domain *d, struct vm_event_domain *ved, > vm_event_request_t *req); > > +#ifdef CONFIG_VM_EVENT > +/* Clean up on domain destruction */ > +void vm_event_cleanup(struct domain *d); > int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec); > +#else > +static inline void vm_event_cleanup(struct domain *d) {} > +static inline int vm_event_domctl(struct domain *d, > + struct xen_domctl_vm_event_op *vec) > +{ > + return -EINVAL; ... is it EINVAL here? Jan
On Tue, Mar 11, 2025 at 7:59 AM Jan Beulich <jbeulich@suse.com> wrote: > > On 11.03.2025 11:27, Sergiy Kibrik wrote: > > From: Stefano Stabellini <stefano.stabellini@amd.com> > > > > Extend coverage of CONFIG_VM_EVENT option and make the build of VM events > > and monitoring support optional. Also make MEM_PAGING option depend on VM_EVENT > > to document that mem_paging is relying on vm_event. > > This is to reduce code size on Arm when this option isn't enabled. > > > > CC: Jan Beulich <jbeulich@suse.com> > > CC: Tamas K Lengyel <tamas@tklengyel.com> > > Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com> > > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> > > Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com> > > Please can tags be kept in chronological order? It's impossible to review > a patch that wasn't first signed-off on by the author(s). > > > --- > > changes in v3: > > - add dependency MEM_PAGING -> VM_EVENT This seems to be largely unnecessary since on x86 selecting HVM already selects it but I guess it also doesn't hurt to explicitly mark it like this either. > > - monitor_domctl() stub returns -EOPNOTSUPP > > Seeing this, i.e. ... > > > --- a/xen/include/xen/monitor.h > > +++ b/xen/include/xen/monitor.h > > @@ -27,8 +27,17 @@ > > struct domain; > > struct xen_domctl_monitor_op; > > > > +#ifdef CONFIG_VM_EVENT > > int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop); > > void monitor_guest_request(void); > > +#else > > +static inline int monitor_domctl(struct domain *d, > > + struct xen_domctl_monitor_op *mop) > > +{ > > + return -EOPNOTSUPP; > > ... this, why ... > > > @@ -88,7 +85,18 @@ void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved); > > void vm_event_put_request(struct domain *d, struct vm_event_domain *ved, > > vm_event_request_t *req); > > > > +#ifdef CONFIG_VM_EVENT > > +/* Clean up on domain destruction */ > > +void vm_event_cleanup(struct domain *d); > > int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec); > > +#else > > +static inline void vm_event_cleanup(struct domain *d) {} > > +static inline int vm_event_domctl(struct domain *d, > > + struct xen_domctl_vm_event_op *vec) > > +{ > > + return -EINVAL; > > ... is it EINVAL here? I would prefer if it was consistent too with -EOPNOTSUPP for both when the subsystems are compiled out. Thanks, Tamas
11.03.25 15:39, Tamas K Lengyel: > On Tue, Mar 11, 2025 at 7:59 AM Jan Beulich<jbeulich@suse.com> wrote: >> On 11.03.2025 11:27, Sergiy Kibrik wrote: >>> From: Stefano Stabellini<stefano.stabellini@amd.com> >>> >>> Extend coverage of CONFIG_VM_EVENT option and make the build of VM events >>> and monitoring support optional. Also make MEM_PAGING option depend on VM_EVENT >>> to document that mem_paging is relying on vm_event. >>> This is to reduce code size on Arm when this option isn't enabled. >>> >>> CC: Jan Beulich<jbeulich@suse.com> >>> CC: Tamas K Lengyel<tamas@tklengyel.com> >>> Reviewed-by: Ayan Kumar Halder<ayan.kumar.halder@amd.com> >>> Signed-off-by: Stefano Stabellini<stefano.stabellini@amd.com> >>> Signed-off-by: Sergiy Kibrik<Sergiy_Kibrik@epam.com> >> Please can tags be kept in chronological order? It's impossible to review >> a patch that wasn't first signed-off on by the author(s). >> >>> --- >>> changes in v3: >>> - add dependency MEM_PAGING -> VM_EVENT > This seems to be largely unnecessary since on x86 selecting HVM > already selects it but I guess it also doesn't hurt to explicitly mark > it like this either. It's done just to highlight this dependency, more like a documentation hint (as Jan suggested in previous discussion). -Sergiy
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile index 3bd5125e64..4837ad467a 100644 --- a/xen/arch/arm/Makefile +++ b/xen/arch/arm/Makefile @@ -40,7 +40,7 @@ obj-$(CONFIG_LIVEPATCH) += livepatch.o obj-$(CONFIG_LLC_COLORING) += llc-coloring.o obj-$(CONFIG_VM_EVENT) += mem_access.o obj-y += mm.o -obj-y += monitor.o +obj-$(CONFIG_VM_EVENT) += monitor.o obj-y += p2m.o obj-y += platform.o obj-y += platform_hypercall.o @@ -66,7 +66,7 @@ obj-$(CONFIG_VGICV2) += vgic-v2.o obj-$(CONFIG_GICV3) += vgic-v3.o obj-$(CONFIG_HAS_ITS) += vgic-v3-its.o endif -obj-y += vm_event.o +obj-$(CONFIG_VM_EVENT) += vm_event.o obj-y += vtimer.o obj-$(CONFIG_SBSA_VUART_CONSOLE) += vpl011.o obj-y += vsmc.o diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c index e253865b6c..6081f14ed0 100644 --- a/xen/arch/arm/vsmc.c +++ b/xen/arch/arm/vsmc.c @@ -330,7 +330,8 @@ void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr) } /* If monitor is enabled, let it handle the call. */ - if ( current->domain->arch.monitor.privileged_call_enabled ) + if ( IS_ENABLED(CONFIG_VM_EVENT) && + current->domain->arch.monitor.privileged_call_enabled ) rc = monitor_smc(); if ( rc == 1 ) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 6e41bc0fb4..f086799594 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -350,7 +350,7 @@ endif config MEM_PAGING bool "Xen memory paging support (UNSUPPORTED)" if UNSUPPORTED - depends on HVM + depends on HVM && VM_EVENT config MEM_SHARING bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED diff --git a/xen/common/Makefile b/xen/common/Makefile index b71d4b3efa..ac23120d7d 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -54,7 +54,7 @@ obj-y += timer.o obj-$(CONFIG_TRACEBUFFER) += trace.o obj-y += version.o obj-y += virtual_region.o -obj-y += vm_event.o +obj-$(CONFIG_VM_EVENT) += vm_event.o obj-$(CONFIG_HAS_VMAP) += vmap.o obj-y += vsprintf.o obj-y += wait.o @@ -68,7 +68,7 @@ obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o memory.o multicall.o xlat.o ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y) obj-y += domctl.o -obj-y += monitor.o +obj-$(CONFIG_VM_EVENT) += monitor.o obj-y += sysctl.o endif diff --git a/xen/include/xen/monitor.h b/xen/include/xen/monitor.h index 713d54f7c1..634b6cd2a1 100644 --- a/xen/include/xen/monitor.h +++ b/xen/include/xen/monitor.h @@ -27,8 +27,17 @@ struct domain; struct xen_domctl_monitor_op; +#ifdef CONFIG_VM_EVENT int monitor_domctl(struct domain *d, struct xen_domctl_monitor_op *mop); void monitor_guest_request(void); +#else +static inline int monitor_domctl(struct domain *d, + struct xen_domctl_monitor_op *mop) +{ + return -EOPNOTSUPP; +} +static inline void monitor_guest_request(void) {} +#endif int monitor_traps(struct vcpu *v, bool sync, vm_event_request_t *req); diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h index 9a86358b42..268c85fc4f 100644 --- a/xen/include/xen/vm_event.h +++ b/xen/include/xen/vm_event.h @@ -50,9 +50,6 @@ struct vm_event_domain unsigned int last_vcpu_wake_up; }; -/* Clean up on domain destruction */ -void vm_event_cleanup(struct domain *d); - /* Returns whether a ring has been set up */ bool vm_event_check_ring(struct vm_event_domain *ved); @@ -88,7 +85,18 @@ void vm_event_cancel_slot(struct domain *d, struct vm_event_domain *ved); void vm_event_put_request(struct domain *d, struct vm_event_domain *ved, vm_event_request_t *req); +#ifdef CONFIG_VM_EVENT +/* Clean up on domain destruction */ +void vm_event_cleanup(struct domain *d); int vm_event_domctl(struct domain *d, struct xen_domctl_vm_event_op *vec); +#else +static inline void vm_event_cleanup(struct domain *d) {} +static inline int vm_event_domctl(struct domain *d, + struct xen_domctl_vm_event_op *vec) +{ + return -EINVAL; +} +#endif void vm_event_vcpu_pause(struct vcpu *v); void vm_event_vcpu_unpause(struct vcpu *v);