[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z7ebqtJUwzgOIeSC@Asurada-Nvidia>
Date: Thu, 20 Feb 2025 13:16:26 -0800
From: Nicolin Chen <nicolinc@...dia.com>
To: Jason Gunthorpe <jgg@...dia.com>, "Tian, Kevin" <kevin.tian@...el.com>
CC: "corbet@....net" <corbet@....net>, "will@...nel.org" <will@...nel.org>,
"joro@...tes.org" <joro@...tes.org>, "suravee.suthikulpanit@....com"
<suravee.suthikulpanit@....com>, "robin.murphy@....com"
<robin.murphy@....com>, "dwmw2@...radead.org" <dwmw2@...radead.org>,
"baolu.lu@...ux.intel.com" <baolu.lu@...ux.intel.com>, "shuah@...nel.org"
<shuah@...nel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "iommu@...ts.linux.dev"
<iommu@...ts.linux.dev>, "linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kselftest@...r.kernel.org"
<linux-kselftest@...r.kernel.org>, "linux-doc@...r.kernel.org"
<linux-doc@...r.kernel.org>, "eric.auger@...hat.com" <eric.auger@...hat.com>,
"jean-philippe@...aro.org" <jean-philippe@...aro.org>, "mdf@...nel.org"
<mdf@...nel.org>, "mshavit@...gle.com" <mshavit@...gle.com>,
"shameerali.kolothum.thodi@...wei.com"
<shameerali.kolothum.thodi@...wei.com>, "smostafa@...gle.com"
<smostafa@...gle.com>, "ddutile@...hat.com" <ddutile@...hat.com>, "Liu, Yi L"
<yi.l.liu@...el.com>, "patches@...ts.linux.dev" <patches@...ts.linux.dev>
Subject: Re: [PATCH v6 07/14] iommufd/viommu: Add iommufd_viommu_report_event
helper
On Wed, Feb 19, 2025 at 06:58:16AM +0000, Tian, Kevin wrote:
> > From: Jason Gunthorpe <jgg@...dia.com>
> > Sent: Tuesday, February 18, 2025 11:36 PM
> >
> > On Fri, Jan 24, 2025 at 04:30:36PM -0800, Nicolin Chen wrote:
> > > +int iommufd_viommu_report_event(struct iommufd_viommu *viommu,
> > > + enum iommu_veventq_type type, void
> > *event_data,
> > > + size_t data_len)
> > > +{
> > > + struct iommufd_veventq *veventq;
> > > + struct iommufd_vevent *vevent;
> > > + int rc = 0;
> > > +
> > > + if (WARN_ON_ONCE(!data_len || !event_data))
> > > + return -EINVAL;
> > > +
> > > + down_read(&viommu->veventqs_rwsem);
> > > +
> > > + veventq = iommufd_viommu_find_veventq(viommu, type);
> > > + if (!veventq) {
> > > + rc = -EOPNOTSUPP;
> > > + goto out_unlock_veventqs;
> > > + }
> > > +
> > > + if (atomic_read(&veventq->num_events) == veventq->depth) {
> > > + vevent = &veventq->overflow;
> > > + goto out_set_header;
> > > + }
> > > +
> > > + vevent = kmalloc(struct_size(vevent, event_data, data_len),
> > GFP_KERNEL);
> > > + if (!vevent) {
> > > + rc = -ENOMEM;
> > > + goto out_unlock_veventqs;
> >
> > This should record an overflow too
> >
>
> In that case probably we want to rename 'overflow' to 'lost_event'
> which counts lost events for whatever reasons (overflow, oom, etc.)
Naming-wise, I think it may sound better to call the overflow node
just an 'exception' that concludes with lost eventsfor different
reasons.
A complication is that this 'exception' would give userspace a very
implicit reason as the node just report the number of lost events
v.s. providing the reason to each lost event.
With this, maybe the IOMMU_VEVENTQ_FLAG_OVERFLOW in the uAPI should
be just IOMMU_VEVENTQ_FLAG_EXCEPTION? Any better idea?
Thanks
Nicolin
Powered by blists - more mailing lists