The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Baochen Qiang <quic_bqiang@quicinc.com>
To: Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, <iommu@lists.linux.dev>
Subject: missing clear bdr in check_ram_in_range_map()?
Date: Mon, 9 Dec 2024 18:50:06 +0800	[thread overview]
Message-ID: <64931fac-085b-4ff3-9314-84bac2fa9bdb@quicinc.com> (raw)

Hi,

while checking check_ram_in_range_map() I am confused by the condition set/check on bdr.
If I am reading the code correctly, if bdr is set once, it would never get cleared, hence
that function will always returns 0.

should we clear bdr before each new iteration?

diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index 5b4e6d3bf7bc..1605b956b25e 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -611,6 +611,7 @@ static int check_ram_in_range_map(unsigned long start_pfn,
                        return 1;

                start_pfn = PFN_DOWN(bdr->cpu_start) + PFN_DOWN(bdr->size);
+               bdr = NULL;
        }

        return 0;


             reply	other threads:[~2024-12-09 10:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09 10:50 Baochen Qiang [this message]
2024-12-12  7:14 ` missing clear bdr in check_ram_in_range_map()? Christoph Hellwig
2024-12-20  3:25   ` Baochen Qiang
2025-02-28 13:22     ` Marek Szyprowski
2025-03-04  1:59       ` Baochen Qiang

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=64931fac-085b-4ff3-9314-84bac2fa9bdb@quicinc.com \
    --to=quic_bqiang@quicinc.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox