Message ID | 55a9cc8fa53e57f898d05463746cbabda821ce25.1712840924.git.matthew.barnes@cloud.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Enumerate all allocated evtchns in lsevtchn | expand |
On 11.04.2024 17:24, Matthew Barnes wrote: > --- a/xen/common/domctl.c > +++ b/xen/common/domctl.c > @@ -73,6 +73,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info) > > info->domain = d->domain_id; > info->max_vcpu_id = XEN_INVALID_MAX_VCPU_ID; > + info->highest_evtchn_port = read_atomic(&d->valid_evtchns); > > /* > * - domain is marked as blocked only if all its vcpus are blocked > --- a/xen/include/public/domctl.h > +++ b/xen/include/public/domctl.h > @@ -145,7 +145,8 @@ struct xen_domctl_getdomaininfo { > xen_domain_handle_t handle; > uint32_t cpupool; > uint8_t gpaddr_bits; /* Guest physical address space size. */ > - uint8_t pad2[7]; > + uint8_t pad2[3]; > + evtchn_port_t highest_evtchn_port; /* Highest allocated event channel port. Used for enumeration */ While, as per my reply to patch 2, I don't think this is a viable route, I'd still like to mention that the name of the new field is wrong, leading to an off-by-1 in the consumer in patch 2. d->valid_evtchns is a count, not the "maximum valid" port number. Jan
diff --git a/xen/common/domctl.c b/xen/common/domctl.c index 43b0b074c3a6..1d1ee17f6f91 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -73,6 +73,7 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info) info->domain = d->domain_id; info->max_vcpu_id = XEN_INVALID_MAX_VCPU_ID; + info->highest_evtchn_port = read_atomic(&d->valid_evtchns); /* * - domain is marked as blocked only if all its vcpus are blocked diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a33f9ec32b08..d28d29180c75 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -145,7 +145,8 @@ struct xen_domctl_getdomaininfo { xen_domain_handle_t handle; uint32_t cpupool; uint8_t gpaddr_bits; /* Guest physical address space size. */ - uint8_t pad2[7]; + uint8_t pad2[3]; + evtchn_port_t highest_evtchn_port; /* Highest allocated event channel port. Used for enumeration */ struct xen_arch_domainconfig arch_config; }; typedef struct xen_domctl_getdomaininfo xen_domctl_getdomaininfo_t;
For tools such as lsevtchn to enumerate through event channels, they need an upper bound on the port number. Add the highest allocated event channel port number for a domain in the xen_domctl_getdomaininfo struct, and populate it. The field is added above the padding to avoid implicit padding. Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com> --- xen/common/domctl.c | 1 + xen/include/public/domctl.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)