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] [day] [month] [year] [list]
Date:   Mon, 27 Feb 2023 18:14:26 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Keith Busch <kbusch@...a.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, Keith Busch <kbusch@...nel.org>,
        Bryan O'Donoghue <bryan.odonoghue@...aro.org>
Subject: Re: [PATCH] dmapool: push new blocks in ascending order

On Tue, Feb 21, 2023 at 08:54:00AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@...nel.org>
> 
> Some users of the dmapool need their allocations to happen in ascending
> order. The recent optimizations pushed the blocks in reverse order, so
> restore the previous behavior by linking the next available block from
> low-to-high.
> 
> Fixes: ced6d06a81fb69 ("dmapool: link blocks across pages")
> Reported-by: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
> Signed-off-by: Keith Busch <kbusch@...nel.org>

This patch fixes the problem I had observed when trying to boot from
the megasas SCSI controller on powernv.

Tested-by: Guenter Roeck <linux@...ck-us.net>

Thanks,
Guenter

> ---
>  mm/dmapool.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/dmapool.c b/mm/dmapool.c
> index 1920890ff8d3d..a151a21e571b7 100644
> --- a/mm/dmapool.c
> +++ b/mm/dmapool.c
> @@ -300,7 +300,7 @@ EXPORT_SYMBOL(dma_pool_create);
>  static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
>  {
>  	unsigned int next_boundary = pool->boundary, offset = 0;
> -	struct dma_block *block;
> +	struct dma_block *block, *first = NULL, *last = NULL;
>  
>  	pool_init_page(pool, page);
>  	while (offset + pool->size <= pool->allocation) {
> @@ -311,11 +311,22 @@ static void pool_initialise_page(struct dma_pool *pool, struct dma_page *page)
>  		}
>  
>  		block = page->vaddr + offset;
> -		pool_block_push(pool, block, page->dma + offset);
> +		block->dma = page->dma + offset;
> +		block->next_block = NULL;
> +
> +		if (last)
> +			last->next_block = block;
> +		else
> +			first = block;
> +		last = block;
> +
>  		offset += pool->size;
>  		pool->nr_blocks++;
>  	}
>  
> +	last->next_block = pool->next_block;
> +	pool->next_block = first;
> +
>  	list_add(&page->page_list, &pool->page_list);
>  	pool->nr_pages++;
>  }
> -- 
> 2.30.2
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ