[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250207135259.GA3633558@nvidia.com>
Date: Fri, 7 Feb 2025 09:52:59 -0400
From: Jason Gunthorpe <jgg@...dia.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Andy Gospodarek <andrew.gospodarek@...adcom.com>,
Aron Silverton <aron.silverton@...cle.com>,
Dan Williams <dan.j.williams@...el.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Dave Jiang <dave.jiang@...el.com>, David Ahern <dsahern@...nel.org>,
Andy Gospodarek <gospo@...adcom.com>,
Christoph Hellwig <hch@...radead.org>,
Itay Avraham <itayavr@...dia.com>, Jiri Pirko <jiri@...dia.com>,
Jakub Kicinski <kuba@...nel.org>, Leonid Bloch <lbloch@...dia.com>,
Leon Romanovsky <leonro@...dia.com>, linux-cxl@...r.kernel.org,
linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
Saeed Mahameed <saeedm@...dia.com>,
"Nelson, Shannon" <shannon.nelson@....com>
Subject: Re: [PATCH v4 02/10] fwctl: Basic ioctl dispatch for the character
device
On Fri, Feb 07, 2025 at 12:59:15PM +0000, Jonathan Cameron wrote:
> > static int fwctl_fops_release(struct inode *inode, struct file *filp)
> > {
> > - struct fwctl_device *fwctl = filp->private_data;
> > + struct fwctl_uctx *uctx = filp->private_data;
> > + struct fwctl_device *fwctl = uctx->fwctl;
> >
> > + scoped_guard(rwsem_read, &fwctl->registration_lock) {
> > + /*
> > + * fwctl_unregister() has already removed the driver and
> > + * destroyed the uctx.
>
> Comment is a little odd given it is I think referring to why
> the code that follows wouldn't run. Perhaps just add a 'may'
It is intended to describe the if:
> > + if (fwctl->ops) {
> > + guard(mutex)(&fwctl->uctx_list_lock);
> > + fwctl_destroy_uctx(uctx);
> > + }
So let's do:
/*
* NULL ops means fwctl_unregister() has already removed the
* driver and destroyed the uctx.
*/
if (fwctl->ops) {
> > + fwctl->dev.class = &fwctl_class;
> > + fwctl->dev.parent = parent;
>
> Shunt this move back to previous patch?
Yes
> > +/**
> > + * struct fwctl_ops - Driver provided operations
> > + *
> > + * fwctl_unregister() will wait until all excuting ops are completed before it
> > + * returns. Drivers should be mindful to not let their ops run for too long as
> > + * it will block device hot unplug and module unloading.
>
> A passing comment on this. Seems likely that at somepoint we'll want an
> abort op to enable cancelling if the particular driver supports it
> (abort background command in CXL). Anyhow, problem for another day.
Hum, that will be an interesting thing to fit in. abort from userspace
as an ioctl would make sense. auto-abort to hotunplug seems a bit
tricky
Thanks,
Jason
Powered by blists - more mailing lists