lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed,  1 Oct 2014 17:13:31 +1000 (EST)
From:	Michael Ellerman <mpe@...erman.id.au>
To:	Michael Neuling <mikey@...ling.org>, greg@...ah.com, arnd@...db.de,
	mpe@...erman.id.au, benh@...nel.crashing.org
Cc:	mikey@...ling.org, anton@...ba.org, linux-kernel@...r.kernel.org,
	linuxppc-dev@...abs.org, jk@...abs.org, imunsie@...ibm.com,
	cbe-oss-dev@...ts.ozlabs.org,
	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Subject: Re: [PATCH v2 04/17] powerpc/msi: Improve IRQ bitmap allocator

On Tue, 2014-30-09 at 10:34:53 UTC, Michael Neuling wrote:
> From: Ian Munsie <imunsie@....ibm.com>
> 
> Currently msi_bitmap_alloc_hwirqs() will round up any IRQ allocation requests
                                                                       request
> to the nearest power of 2.  eg. ask for 5 IRQs and you'll get 8.  This wastes a
                             ^ one space after a period, or die!

> lot of IRQs which can be a scarce resource.
> 
> For cxl we can require multiple IRQs for every contexts that is attached to the
                                                 context
> accelerator.  For AFU directed accelerators, there may be 1000s of contexts

What is an AFU directed accelerator?
                   
> attached, hence we can easily run out of IRQs, especially if we are needlessly
> wasting them.
> 
> This changes the msi_bitmap_alloc_hwirqs() to allocate only the required number
                x
> of IRQs, hence avoiding this wastage.

The crucial detail you failed to mention is that you maintain the behaviour that
allocations are naturally aligned.

Can you add a check in the test code at the bottom of the file to confirm that
please?


> diff --git a/arch/powerpc/sysdev/msi_bitmap.c b/arch/powerpc/sysdev/msi_bitmap.c
> index 2ff6302..961a358 100644
> --- a/arch/powerpc/sysdev/msi_bitmap.c
> +++ b/arch/powerpc/sysdev/msi_bitmap.c
> @@ -20,32 +20,37 @@ int msi_bitmap_alloc_hwirqs(struct msi_bitmap *bmp, int num)
>  	int offset, order = get_count_order(num);
>  
>  	spin_lock_irqsave(&bmp->lock, flags);
> -	/*
> -	 * This is fast, but stricter than we need. We might want to add
> -	 * a fallback routine which does a linear search with no alignment.
> -	 */
> -	offset = bitmap_find_free_region(bmp->bitmap, bmp->irq_count, order);
> +
> +	offset = bitmap_find_next_zero_area(bmp->bitmap, bmp->irq_count, 0,
> +					    num, (1 << order) - 1);
> +	if (offset > bmp->irq_count)
> +		goto err;

Can we get a newline here :)

> +	bitmap_set(bmp->bitmap, offset, num);
>  	spin_unlock_irqrestore(&bmp->lock, flags);
>  
>  	pr_debug("msi_bitmap: allocated 0x%x (2^%d) at offset 0x%x\n",
>  		 num, order, offset);

This print out is a bit confusing now, should probably just drop the order.

cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ