|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH V2 09/10] xen/arm: io: Use binary search for mmio handler lookup
Hi Shanker, On 27/06/16 15:50, Shanker Donthineni wrote: On 06/27/2016 08:31 AM, Julien Grall wrote:On 26/06/16 18:48, Shanker Donthineni wrote:As the number of I/O handlers increase, the overhead associated with linear lookup also increases. The system might have maximum of 144 (assuming CONFIG_NR_CPUS=128) mmio handlers. In worst case scenario, it would require 144 iterations for finding a matching handler. Now it is time for us to change from linear (complexity O(n)) to a binary search (complexity O(log n) for reducing mmio handler lookup overhead. Signed-off-by: Shanker Donthineni <shankerd@xxxxxxxxxxxxxx> --- xen/arch/arm/io.c | 50+++++++++++++++++++++++++++++++++++++++-----------1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c index a5b2c2d..abf49fb 100644 --- a/xen/arch/arm/io.c +++ b/xen/arch/arm/io.c @@ -20,6 +20,7 @@ #include <xen/lib.h> #include <xen/spinlock.h> #include <xen/sched.h> +#include <xen/sort.h> #include <asm/current.h> #include <asm/mmio.h> @@ -70,23 +71,38 @@ static int handle_write(const struct mmio_handler*handler, struct vcpu *v,handler->priv); } -int handle_mmio(mmio_info_t *info) +const struct mmio_handler *find_mmio_handler(struct vcpu *v, paddr_taddr) Please don't try to re-invent your own binary search implementation and use a known one such as the one implemented by Linux (see bsearch).
The current implementation of I/O handler is thread-safe because of the spin_lock and lock-less. We may have people building product on top of Xen using register_mmio_handler when the domain is running. So I will nack any patch that cause a regression on the behavior. Regards, -- Julien Grall _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |