[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAywjhTDE8+LQHKtjU5u2Wuq898f8SSgchA2DgjSauNjo6_NUw@mail.gmail.com>
Date: Thu, 4 Dec 2025 09:48:21 -0800
From: Samiullah Khawaja <skhawaja@...gle.com>
To: Baolu Lu <baolu.lu@...ux.intel.com>
Cc: David Woodhouse <dwmw2@...radead.org>, Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Pasha Tatashin <pasha.tatashin@...een.com>, Jason Gunthorpe <jgg@...pe.ca>, iommu@...ts.linux.dev,
Robin Murphy <robin.murphy@....com>, Pratyush Yadav <pratyush@...nel.org>,
Kevin Tian <kevin.tian@...el.com>, Alex Williamson <alex@...zbot.org>, linux-kernel@...r.kernel.org,
Saeed Mahameed <saeedm@...dia.com>, Adithya Jayachandran <ajayachandra@...dia.com>,
Parav Pandit <parav@...dia.com>, Leon Romanovsky <leonro@...dia.com>, William Tu <witu@...dia.com>,
Vipin Sharma <vipinsh@...gle.com>, dmatlack@...gle.com, YiFei Zhu <zhuyifei@...gle.com>,
Chris Li <chrisl@...nel.org>, praan@...gle.com
Subject: Re: [RFC PATCH v2 20/32] iommu: Add APIs to get preserved state of a device
On Wed, Dec 3, 2025 at 10:24 PM Baolu Lu <baolu.lu@...ux.intel.com> wrote:
>
> On 12/3/25 07:02, Samiullah Khawaja wrote:
> > The preserved state of the device needs to be fetched at various places
> > during liveupdate. The added API can also be used to check if a device
> > is preserved or not. The API is only used during shutdown and after
> > liveupdate so no locking needed.
> >
> > Signed-off-by: Samiullah Khawaja<skhawaja@...gle.com>
> > ---
> > include/linux/iommu-lu.h | 67 ++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 67 insertions(+)
> >
> > diff --git a/include/linux/iommu-lu.h b/include/linux/iommu-lu.h
> > index 95375530b7be..08a659de8553 100644
> > --- a/include/linux/iommu-lu.h
> > +++ b/include/linux/iommu-lu.h
> > @@ -8,9 +8,76 @@
> > #ifndef _LINUX_IOMMU_LU_H
> > #define _LINUX_IOMMU_LU_H
> >
> > +#include <linux/device.h>
> > +#include <linux/iommu.h>
> > #include <linux/liveupdate.h>
> > #include <linux/kho/abi/iommu.h>
> >
> > +#ifdef CONFIG_LIVEUPDATE
> > +static inline void *dev_iommu_preserved_state(struct device *dev)
> > +{
> > + struct device_ser *ser;
> > +
> > + ser = dev->iommu->device_ser;
>
> This might cause "NULL pointer dereference" issue if the device is not
> iommu probed.
>
> if (!dev->iommu)
> return NULL;
> ser = dev->iommu->device_ser;
>
Thanks for this.
I will fix it in the next iteration.
> > + if (ser && !ser->obj.incoming)
> > + return ser;
> > +
> > + return NULL;
> > +}
>
> Thanks,
> baolu
>
Powered by blists - more mailing lists