From: Jason Gunthorpe <jgg@ziepe.ca>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>,
thierry.reding@gmail.com, vdumpa@nvidia.com, joro@8bytes.org,
will@kernel.org, jonathanh@nvidia.com, baolu.lu@linux.intel.com,
jsnitsel@redhat.com, jroedel@suse.de,
regressions@lists.linux.dev, linux-tegra@vger.kernel.org,
iommu@lists.linux.dev
Subject: Re: [REGRESSION] EMEM address decode error when using Tegra210 media engines
Date: Tue, 3 Jun 2025 16:04:11 -0300 [thread overview]
Message-ID: <20250603190411.GC407166@ziepe.ca> (raw)
In-Reply-To: <ef7c8bf7-d6b1-4486-bb8c-04d24488ecdc@arm.com>
On Tue, Jun 03, 2025 at 06:43:49PM +0100, Robin Murphy wrote:
> On 2025-06-03 5:52 pm, Diogo Ivo wrote:
> >
> > On 6/3/25 4:32 PM, Jason Gunthorpe wrote:
> > > On Tue, Jun 03, 2025 at 04:06:47PM +0100, Diogo Ivo wrote:
> > > > Hello,
> > > >
> > > > Commit 50568f87d1e233e introduced a regression when trying to
> > > > use the media
> > > > accelerators present on the Tegra X1 SoC.
> > > >
> > > > I came across this regression when testing the branch [1] that leverages
> > > > the NVJPG engine in the Tegra X1 for decoding a JPEG file. After commit
> > > > 50568f87d1e233e we see the following error messages after
> > > > submitting a job
> > > > through the TEGRA_CHANNEL_SUBMIT IOCTL:
> > >
> > > Maybe this?
> > >
> > > @@ -567,7 +567,7 @@ static void tegra_smmu_set_pde(struct
> > > tegra_smmu_as *as, unsigned long iova,
> > > /* The flush the page directory entry from caches */
> > > dma_sync_single_range_for_device(smmu->dev, as->pd_dma, offset,
> > > - sizeof(*pd), DMA_TO_DEVICE);
> > > + sizeof(pd->val[0]),
> > > DMA_TO_DEVICE);
> > > /* And flush the iommu */
> > > smmu_flush_ptc(smmu, as->pd_dma, offset);
> > >
> > > It is the only mistake I was able to notice.
> > >
> > > But I'd be puzzled - I'd expect bigger sizeof would make it slower not
> > > broken.. Though your crash sure looks like either missing cache
> > > coherency or a bad PTE construction.
>
> I reckon the "unsigned long offset = pd_index * sizeof(*pd);" a few lines
> above is probably more impactful ;)
Oh yes, almost certainly. Very good of you to notice it!
Diogo how about this:
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c
index 61897d50162dd7..72a400f7ae0c20 100644
--- a/drivers/iommu/tegra-smmu.c
+++ b/drivers/iommu/tegra-smmu.c
@@ -560,14 +560,14 @@ static void tegra_smmu_set_pde(struct tegra_smmu_as *as, unsigned long iova,
unsigned int pd_index = iova_pd_index(iova);
struct tegra_smmu *smmu = as->smmu;
struct tegra_pd *pd = as->pd;
- unsigned long offset = pd_index * sizeof(*pd);
+ unsigned long offset = pd_index * sizeof(pd->val[0]);
/* Set the page directory entry first */
pd->val[pd_index] = value;
/* The flush the page directory entry from caches */
dma_sync_single_range_for_device(smmu->dev, as->pd_dma, offset,
- sizeof(*pd), DMA_TO_DEVICE);
+ sizeof(pd->val[0]), DMA_TO_DEVICE);
/* And flush the iommu */
smmu_flush_ptc(smmu, as->pd_dma, offset);
prev parent reply other threads:[~2025-06-03 19:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-03 15:06 [REGRESSION] EMEM address decode error when using Tegra210 media engines Diogo Ivo
2025-06-03 15:32 ` Jason Gunthorpe
2025-06-03 16:52 ` Diogo Ivo
2025-06-03 17:43 ` Robin Murphy
2025-06-03 18:14 ` Diogo Ivo
2025-06-03 19:04 ` 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=20250603190411.GC407166@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=baolu.lu@linux.intel.com \
--cc=diogo.ivo@tecnico.ulisboa.pt \
--cc=iommu@lists.linux.dev \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=jroedel@suse.de \
--cc=jsnitsel@redhat.com \
--cc=linux-tegra@vger.kernel.org \
--cc=regressions@lists.linux.dev \
--cc=robin.murphy@arm.com \
--cc=thierry.reding@gmail.com \
--cc=vdumpa@nvidia.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