From: Keith Busch <kbusch@kernel.org>
To: Leon Romanovsky <leon@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, Gal Pressman <gal@nvidia.com>
Subject: Re: [PATCH 2/2] nvme-pci: use dma_alloc_noncontigous if possible
Date: Mon, 2 Dec 2024 12:15:49 -0700 [thread overview]
Message-ID: <Z04HZZVLJN8NBiW7@kbusch-mbp> (raw)
In-Reply-To: <20241202190541.GA2434798@unreal>
On Mon, Dec 02, 2024 at 09:05:41PM +0200, Leon Romanovsky wrote:
> I see at least two possible solutions, add GFP_NOWARN in nvme_alloc_host_mem_single()
> or the following patch:
>
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 4c644bb7f069..baed4059d8a5 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -2172,7 +2172,8 @@ static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred,
>
> static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
> {
> - u64 min_chunk = min_t(u64, preferred, PAGE_SIZE * MAX_ORDER_NR_PAGES);
> + u64 max_chunk = PAGE_SIZE * MAX_ORDER_NR_PAGES;
> + u64 min_chunk = min_t(u64, preferred, max_chunk);
> u64 hmminds = max_t(u32, dev->ctrl.hmminds * 4096, PAGE_SIZE * 2);
> u64 chunk_size;
>
> @@ -2180,7 +2181,7 @@ static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
> * If there is an IOMMU that can merge pages, try a virtually
> * non-contiguous allocation for a single segment first.
> */
> - if (!(PAGE_SIZE & dma_get_merge_boundary(dev->dev))) {
> + if (!(PAGE_SIZE & dma_get_merge_boundary(dev->dev)) && preferred < max_chunk) {
> if (!nvme_alloc_host_mem_single(dev, preferred))
> return 0;
> }
> (END)
>
> What is the preferred way to overcome the warning?
I think your max_chunk check suggestion looks pretty good.
next prev parent reply other threads:[~2024-12-02 19:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-01 4:40 create single-segment HMBs when using IOMMU Christoph Hellwig
2024-11-01 4:40 ` [PATCH 1/2] nvme-pci: fix freeing of the HMB descriptor table Christoph Hellwig
2024-11-01 4:40 ` [PATCH 2/2] nvme-pci: use dma_alloc_noncontigous if possible Christoph Hellwig
2024-12-02 19:05 ` Leon Romanovsky
2024-12-02 19:15 ` Keith Busch [this message]
2024-12-02 19:20 ` Leon Romanovsky
2024-12-03 0:33 ` Christoph Hellwig
2024-11-05 15:59 ` create single-segment HMBs when using IOMMU Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z04HZZVLJN8NBiW7@kbusch-mbp \
--to=kbusch@kernel.org \
--cc=gal@nvidia.com \
--cc=hch@lst.de \
--cc=leon@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.