From: Jason Gunthorpe <jgg@ziepe.ca>
To: Baolu Lu <baolu.lu@linux.intel.com>
Cc: Guanghui Feng <guanghuifeng@linux.alibaba.com>,
dwmw2@infradead.org, joro@8bytes.org, will@kernel.org,
robin.murphy@arm.com, iommu@lists.linux.dev,
linux-kernel@vger.kernel.org,
alikernel-developer@linux.alibaba.com
Subject: Re: [PATCH] iommu/vt-d: fix iommu pasid memory alloc & max pasid err
Date: Tue, 2 Sep 2025 13:28:59 -0300 [thread overview]
Message-ID: <20250902162859.GE184112@ziepe.ca> (raw)
In-Reply-To: <cdd1c8ff-6bb5-4665-a55a-9d86cd81a8ef@linux.intel.com>
On Mon, Sep 01, 2025 at 03:28:29PM +0800, Baolu Lu wrote:
> On 8/30/25 21:07, Guanghui Feng wrote:
> > When intel_pasid_alloc_table allocates memory for Scalable Mode PASID
> > directories, the specified memory page order is incorrect, and an
> > additional PAGE_SHIFT is added. There is also an error in calculating
> > the maximum number of supported PASID directories. In the revised
> > implementation, 1 << (order + PASID_PDE_SHIFT - 3) represents the memory
> > occupied by the Scalable Mode PASID directory, divided by 8 to represent
> > the number of PASID directories, and then multiplied by the number of (1
> > << PASID_PDE_SHIFT) entries in each PASID directory.
>
> Do you see any specific issues if the changes described in this patch
> are lacking?
>
> >
> > Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com>
> > ---
> > drivers/iommu/intel/pasid.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c
> > index 52f678975da7..9969913b600b 100644
> > --- a/drivers/iommu/intel/pasid.c
> > +++ b/drivers/iommu/intel/pasid.c
> > @@ -61,14 +61,14 @@ int intel_pasid_alloc_table(struct device *dev)
> > size = max_pasid >> (PASID_PDE_SHIFT - 3);
> > order = size ? get_order(size) : 0;
> > dir = iommu_alloc_pages_node_sz(info->iommu->node, GFP_KERNEL,
> > - 1 << (order + PAGE_SHIFT));
> > + 1 << order);
>
> This converts the order to the allocation size.
Yeah, I don't understand this patch at all,
iommu_alloc_pages_node_sz() takes bytes and get_order(size) returns
order.
bytes == 1 << (get_order(size) + PAGE_SHIFT)
Is correct
So why is this being changed?
Jason
prev parent reply other threads:[~2025-09-02 16:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 13:07 Guanghui Feng
2025-09-01 7:28 ` Baolu Lu
2025-09-02 16:28 ` Jason Gunthorpe [this message]
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=20250902162859.GE184112@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=alikernel-developer@linux.alibaba.com \
--cc=baolu.lu@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=guanghuifeng@linux.alibaba.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=will@kernel.org \
/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
all inboxes | Powered by JetHome®