[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+G9fYv9K3FqR6D9=2jvQ3s_eSTL=K-x4QW4-P7=AgfjjHCBwA@mail.gmail.com>
Date: Tue, 21 Jul 2020 00:49:23 +0530
From: Naresh Kamboju <naresh.kamboju@...aro.org>
To: Rob Clark <robdclark@...il.com>
Cc: Robin Murphy <robin.murphy@....com>, Arnd Bergmann <arnd@...db.de>,
Sean Paul <sean@...rly.run>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Joerg Roedel <jroedel@...e.de>,
Vinod Koul <vinod.koul@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
freedreno <freedreno@...ts.freedesktop.org>,
linux-arm-msm <linux-arm-msm@...r.kernel.org>,
Sudeep Holla <sudeep.holla@....com>,
Andy Gross <agross@...nel.org>, lkft-triage@...ts.linaro.org,
open list <linux-kernel@...r.kernel.org>,
Eric Anholt <eric@...olt.net>,
"open list:IOMMU DRIVERS" <iommu@...ts.linux-foundation.org>,
Thierry Reding <thierry.reding@...il.com>,
John Stultz <john.stultz@...aro.org>,
"Guohanjun (Hanjun Guo)" <guohanjun@...wei.com>,
Matthias Brugger <matthias.bgg@...il.com>,
"moderated list:ARM/Mediatek SoC..."
<linux-mediatek@...ts.infradead.org>, Will Deacon <will@...nel.org>
Subject: Re: [Freedreno] arm64: Internal error: Oops: qcom_iommu_tlb_inv_context
free_io_pgtable_ops on db410c
On Mon, 20 Jul 2020 at 21:27, Rob Clark <robdclark@...il.com> wrote:
>
> On Mon, Jul 20, 2020 at 4:28 AM Robin Murphy <robin.murphy@....com> wrote:
> >
> > On 2020-07-20 08:17, Arnd Bergmann wrote:
> > > On Mon, Jul 20, 2020 at 8:36 AM Naresh Kamboju
> > > <naresh.kamboju@...aro.org> wrote:
<>
> > >> [ 5.444121] Unable to handle kernel NULL pointer dereference at
> > >> virtual address 0000000000000018
> > >> [ 5.456615] ESR = 0x96000004
> > >> [ 5.464471] SET = 0, FnV = 0
> > >> [ 5.464487] EA = 0, S1PTW = 0
> > >> [ 5.466521] Data abort info:
> > >> [ 5.469971] ISV = 0, ISS = 0x00000004
> > >> [ 5.472768] CM = 0, WnR = 0
> > >> [ 5.476172] user pgtable: 4k pages, 48-bit VAs, pgdp=00000000bacba000
> > >> [ 5.479349] [0000000000000018] pgd=0000000000000000, p4d=0000000000000000
> > >> [ 5.485820] Internal error: Oops: 96000004 [#1] PREEMPT SMP
> > >> [ 5.492448] Modules linked in: crct10dif_ce adv7511(+)
> > >> qcom_spmi_temp_alarm cec msm(+) mdt_loader qcom_camss videobuf2_dma_sg
> > >> drm_kms_helper v4l2_fwnode videobuf2_memops videobuf2_v4l2 qcom_rng
> > >> videobuf2_common i2c_qcom_cci display_connector socinfo drm qrtr ns
> > >> rmtfs_mem fuse
> > >> [ 5.500256] CPU: 0 PID: 286 Comm: systemd-udevd Not tainted 5.8.0-rc5 #1
> > >> [ 5.522484] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
> > >> [ 5.529170] pstate: 20000005 (nzCv daif -PAN -UAO BTYPE=--)
> > >> [ 5.535856] pc : qcom_iommu_tlb_inv_context+0x18/0xa8
> > >> [ 5.541148] lr : free_io_pgtable_ops+0x28/0x58
<>
> > >> [ 5.628297] Call trace:
> > >> [ 5.633592] qcom_iommu_tlb_inv_context+0x18/0xa8
> > >
> > > This means that dev_iommu_fwspec_get() has returned NULL
> > > in qcom_iommu_tlb_inv_context(), either because dev->iommu
> > > is NULL, or because dev->iommu->fwspec is NULL.
> > >
> > > qcom_iommu_tlb_inv_context() does not check for a NULL
> > > pointer before using the returned object.
> > >
> > > The bug is either in the lack of error handling, or the fact
> > > that it's possible to get into this function for a device
> > > that has not been fully set up.
> >
> > Not quite - the device *was* properly set up, but has already been
> > properly torn down again in the removal path by iommu_release_device().
> > The problem is that qcom-iommu kept the device pointer as its TLB cookie
> > for the domain, but the domain has a longer lifespan than the validity
> > of that device - that's a fundamental design flaw in the driver.
>
> fwiw, I just sent "iommu/qcom: Use domain rather than dev as tlb
> cookie".. untested but looks like a straightforward enough change to
> switch over to using the domain rather than dev as cookie
The proposed patch tested and confirmed the reported problem fixed.
ref:
https://lore.kernel.org/linux-iommu/CA+G9fYtj1RBYcPhXZRm-qm5ygtdLj1jD8vFZSqQvwi_DNJLBwQ@mail.gmail.com/T/#m36a1fca18098f6c34275d928f9ba9c40c6d7fd63
https://lkft.validation.linaro.org/scheduler/job/1593950#L3392
>
> BR,
> -R
- Naresh
Powered by blists - more mailing lists