On Friday, 12 June 2026 01:49:25 CEST Stefano Stabellini wrote:
> On Wed, 27 May 2026, Christian Schoenebeck wrote:
> > Add and implement the msize_limit callback for the Xen transport.
> > 
> > The limit is calculated using XEN_FLEX_RING_SIZE() based on the
> > negotiated ring_order. For the theoretical maximum ring_order of 9,
> > this results in a maximum 'msize' of 1048576 bytes (1 MiB).
> > 
> > Signed-off-by: Christian Schoenebeck <[email protected]>
> > ---
[...]
> > +static size_t xen_9p_msize_limit(V9fsState *s)
> > +{
> > +    Xen9pfsDev *xen_9pfs = container_of(s, Xen9pfsDev, state);
> > +    return XEN_FLEX_RING_SIZE(xen_9pfs->rings[0].ring_order);
> > +}
> 
> This is correct as a computation. But there are multiple rings with
> potentially different ring_orders (although I have never seen it in
> practice.)
> 
> So I think something like this would be better:
> 
> ---
> size_t limit = XEN_FLEX_RING_SIZE(xen_9pfs->rings[0].ring_order);
> for (i = 1; i < xen_9pfs->num_rings; i++) {
>     limit = MIN(limit, XEN_FLEX_RING_SIZE(xen_9pfs->rings[i].ring_order));
> }
> return limit;

Agreed, I'll take your solution and just precede it with:

  if (!xen_9pfs->num_rings) {
      return 0;
  }

I understand it is not really needed as min. one Xen ring is guaranteed, but 
it's still a separate subsystem and it doesn't cost much.

/Christian 



Reply via email to