From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>,
Ben Widawsky <ben.widawsky@intel.com>,
Vishal L Verma <vishal.l.verma@intel.com>,
"Schofield, Alison" <alison.schofield@intel.com>
Subject: Re: [PATCH v3 5/6] cxl/pci: Introduce cdevm_file_operations
Date: Mon, 2 Aug 2021 17:30:13 +0100 [thread overview]
Message-ID: <20210802173013.00002a40@Huawei.com> (raw)
In-Reply-To: <CAPcyv4jyNGrTDG=XGyqYtaCr+gLDjqUnmySD3zTiiTrNfwc51g@mail.gmail.com>
On Mon, 2 Aug 2021 09:15:10 -0700
Dan Williams <dan.j.williams@intel.com> wrote:
> On Mon, Aug 2, 2021 at 8:05 AM Jonathan Cameron
> <Jonathan.Cameron@huawei.com> wrote:
> >
> > On Fri, 30 Jul 2021 13:07:22 -0700
> > Dan Williams <dan.j.williams@intel.com> wrote:
> >
> > > In preparation for moving cxl_memdev allocation to the core, introduce
> > > cdevm_file_operations to coordinate file operations shutdown relative to
> > > driver data release.
> > >
> > > The motivation for moving cxl_memdev allocation to the core (beyond
> > > better file organization of sysfs attributes in core/ and drivers in
> > > cxl/), is that device lifetime is longer than module lifetime. The cxl_pci
> > > module should be free to come and go without needing to coordinate with
> > > devices that need the text associated with cxl_memdev_release() to stay
> > > resident. The move will fix a use after free bug when looping driver
> > > load / unload with CONFIG_DEBUG_KOBJECT_RELEASE=y.
> > >
> > > Another motivation for passing in file_operations to the core cxl_memdev
> > > creation flow is to allow for alternate drivers, like unit test code, to
> > > define their own ioctl backends.
> > >
> > > Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
> > > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> >
> > Hi Dan / Ben,
> >
> > One utterly trivial question inline, otherwise looks good.
> >
> > > ---
> > > drivers/cxl/mem.h | 15 ++++++++++++
> > > drivers/cxl/pci.c | 65 +++++++++++++++++++++++++++++++----------------------
> > > 2 files changed, 53 insertions(+), 27 deletions(-)
> > >
> > > diff --git a/drivers/cxl/mem.h b/drivers/cxl/mem.h
> > > index 8f02d02b26b4..77f4411c7c6a 100644
> > > --- a/drivers/cxl/mem.h
> > > +++ b/drivers/cxl/mem.h
> > > @@ -34,6 +34,21 @@
> > > */
> > > #define CXL_MEM_MAX_DEVS 65536
> > >
> > > +/**
> > > + * struct cdevm_file_operations - devm coordinated cdev file operations
> > > + * @fops: typical file operations
> >
> > Why typical? Seems that simply saying "file operations" conveys the same
> > information. What is atypical here?
>
> Hmm, I was thinking the need for an extra shutdown operation is
> "atypical", but you're right this description does not add anything.
> I'll change it too:
>
> @fops: file operations that are synchronized against @shutdown
Indeed, much better.
Jonathan
next prev parent reply other threads:[~2021-08-02 16:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-30 20:06 [PATCH v3 0/6] CXL core reorganization Dan Williams
2021-07-30 20:07 ` [PATCH v3 1/6] cxl: Move cxl_core to new directory Dan Williams
2021-07-31 16:35 ` [PATCH v4 " Dan Williams
2021-07-30 20:07 ` [PATCH v3 2/6] cxl/core: Improve CXL core kernel docs Dan Williams
2021-07-30 20:07 ` [PATCH v3 3/6] cxl/core: Move pmem functionality Dan Williams
2021-07-30 20:07 ` [PATCH v3 4/6] cxl/core: Move register mapping infrastructure Dan Williams
2021-07-30 20:07 ` [PATCH v3 5/6] cxl/pci: Introduce cdevm_file_operations Dan Williams
2021-08-02 15:04 ` Jonathan Cameron
2021-08-02 16:15 ` Dan Williams
2021-08-02 16:30 ` Jonathan Cameron [this message]
2021-07-30 20:07 ` [PATCH v3 6/6] cxl/core: Move memdev management to core Dan Williams
2021-08-02 15:13 ` [PATCH v3 0/6] CXL core reorganization Jonathan Cameron
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=20210802173013.00002a40@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=ben.widawsky@intel.com \
--cc=dan.j.williams@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/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