On Wed, Aug 21, 2019 at 06:29:04PM +0200, Paul Durrant wrote: > > -----Original Message----- > > From: Roger Pau Monne <roger....@citrix.com> > > Sent: 21 August 2019 15:59 > > To: xen-devel@lists.xenproject.org > > Cc: Roger Pau Monne <roger....@citrix.com>; Paul Durrant > > <paul.durr...@citrix.com>; Jan Beulich > > <jbeul...@suse.com>; Andrew Cooper <andrew.coop...@citrix.com>; Wei Liu > > <w...@xen.org> > > 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. 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. Thanks, Roger. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel