[Public]

> -----Original Message-----
> From: Jan Beulich <jbeul...@suse.com>
> Sent: Wednesday, September 10, 2025 10:57 PM
> To: Penny, Zheng <penny.zh...@amd.com>; Tamas K Lengyel
> <ta...@tklengyel.com>
> Cc: Huang, Ray <ray.hu...@amd.com>; Andrew Cooper
> <andrew.coop...@citrix.com>; Roger Pau Monné <roger....@citrix.com>;
> Alexandru Isaila <aisa...@bitdefender.com>; Petre Pircalabu
> <ppircal...@bitdefender.com>; Daniel P. Smith <dpsm...@apertussolutions.com>;
> xen-devel@lists.xenproject.org
> Subject: Re: [PATCH v2 04/26] xen: consolidate CONFIG_VM_EVENT
>
> On 10.09.2025 09:38, Penny Zheng wrote:
>
> > --- a/xen/include/xen/vm_event.h
> > +++ b/xen/include/xen/vm_event.h
> > @@ -50,6 +50,7 @@ struct vm_event_domain
> >      unsigned int last_vcpu_wake_up;
> >  };
> >
> > +#ifdef CONFIG_VM_EVENT
> >  /* Returns whether a ring has been set up */  bool
> > vm_event_check_ring(struct vm_event_domain *ved);
> >
> > @@ -68,6 +69,20 @@ bool vm_event_check_ring(struct vm_event_domain
> *ved);
> >   */
> >  int __vm_event_claim_slot(struct domain *d, struct vm_event_domain *ved,
> >                            bool allow_sleep);
> > +#else
> > +static inline bool vm_event_check_ring(struct vm_event_domain *ved) {
> > +    return false;
> > +}
>
> Which call site is in need of this stub? I was first considering
> mem_paging_enabled(), but MEM_PAGING already now depends on VM_EVENT.
>

It is used in hvm.c to check whether vm_event_share ring is empty. And it has 
the same problem as the below: whether we support the configuration: VM_EVENT=n 
and MEM_SHARING=y. I'm not very familiar with it and may need help on it.
If the combination is not supported, I suggest to make MEM_SHARING depend on 
VM_EVENT, most of the below stubs could be removed.

> > +static inline int __vm_event_claim_slot(struct domain *d,
> > +                                        struct vm_event_domain *ved,
> > +                                        bool allow_sleep) {
> > +    return -EOPNOTSUPP;
> > +}
>
> Sadly this looks to be needed when MEM_SHARING=y and VM_EVENT=n.
>
> > @@ -82,23 +97,28 @@ static inline int
> > vm_event_claim_slot_nosleep(struct domain *d,
> >
> >  void vm_event_cancel_slot(struct domain *d, struct vm_event_domain
> > *ved);
> >
> > +#ifdef CONFIG_VM_EVENT
> >  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);
> > +
> > +void vm_event_vcpu_pause(struct vcpu *v);
> >  #else /* !CONFIG_VM_EVENT */
> > +static inline void vm_event_put_request(struct domain *d,
> > +                                        struct vm_event_domain *ved,
> > +                                        vm_event_request_t *req) {}
>
> Same here and ...
>
> >  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 -EOPNOTSUPP;
> >  }
> > +static inline void vm_event_vcpu_pause(struct vcpu *v) {};
>
> ... here.
>
> >  #endif /* !CONFIG_VM_EVENT */
> >
> Jan

Reply via email to