> -----Original Message-----
> From: Roger Pau Monne <[email protected]>
> Sent: 22 August 2019 08:41
> To: Paul Durrant <[email protected]>
> Cc: [email protected]; Jan Beulich <[email protected]>; Andrew 
> Cooper
> <[email protected]>; Wei Liu <[email protected]>
> Subject: Re: [PATCH 3/7] ioreq: allow dispatching ioreqs to internal servers
> 
> On Wed, Aug 21, 2019 at 06:29:04PM +0200, Paul Durrant wrote:
> > > -----Original Message-----
> > > From: Roger Pau Monne <[email protected]>
> > > Sent: 21 August 2019 15:59
> > > To: [email protected]
> > > Cc: Roger Pau Monne <[email protected]>; Paul Durrant 
> > > <[email protected]>; Jan Beulich
> > > <[email protected]>; Andrew Cooper <[email protected]>; Wei Liu 
> > > <[email protected]>
> > > Subject: [PATCH 3/7] ioreq: allow dispatching ioreqs to internal servers
> > >
> > > Internal ioreq servers are always processed first, and ioreqs are
> > > dispatched by calling the handler function. If no internal servers have
> > > registered for an ioreq it's then forwarded to external callers.
> >
> > Distinct id ranges would help here... Internal ids could be walked first, 
> > then external. If there's
> no possibility of interleaving then you don't need the retry.
> 
> So if internal vs external is keyed on the ID then we would end up
> with two different arrays in hvm_domain, one for internal and one for
> external ioreq servers.
> 
> Maybe instead of my previous suggestion it would be better to just
> define consecutive ranges for external and internal servers, like:
> 
> #define MAX_NR_EXTERNAL_IOREQ_SERVERS 8
> #define MAX_NR_INTERNAL_IOREQ_SERVERS 1
> #define MAX_NR_IOREQ_SERVERS \
>     (MAX_NR_EXTERNAL_IOREQ_SERVERS + MAX_NR_INTERNAL_IOREQ_SERVERS)
> 
> #define FOR_EACH_IOREQ_SERVER(d, id, s) \
>     for ( (id) = MAX_NR_IOREQ_SERVERS * 2; (id) != 0; ) \
>         if ( !(s = GET_IOREQ_SERVER(d, --(id))) ) \
>             continue; \
>         else
> 
> #define FOR_EACH_INTERNAL_IOREQ_SERVER(d, id, s) \
>     for ( (id) = MAX_NR_IOREQ_SERVERS; (id) > MAX_NR_INTERNAL_IOREQ_SERVERS 
> && (id) != 0; ) \
>         if ( !(s = GET_IOREQ_SERVER(d, --(id))) ) \
>             continue; \
>         else
> 
> #define FOR_EACH_EXTERNAL_IOREQ_SERVER(d, id, s) \
>     for ( (id) = MAX_NR_INTERNAL_IOREQ_SERVERS; (id) != 0; ) \
>         if ( !(s = GET_IOREQ_SERVER(d, --(id))) ) \
>             continue; \
>         else
> 
> That would also force FOR_EACH_IOREQ_SERVER to always process internal
> ioreq servers first.

Exactly what I was thinking.

> 
> We could even have something like:
> 
> union {
>     struct {
>         struct hvm_ioreq_server 
> *external_server[MAX_NR_EXTERNAL_IOREQ_SERVERS];
>         struct hvm_ioreq_server 
> *internal_server[MAX_NR_INTERNAL_IOREQ_SERVERS];
>     }
>     struct hvm_ioreq_server *server[MAX_NR_IOREQ_SERVERS];
> }
> 
> In order to split the arrays if required.
> 

I'd not considered a union, but it makes sense :-)

  Paul

> Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to