From: Dan Williams <dan.j.williams@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>,
Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>, <ira.weiny@intel.com>
Subject: Re: [PATCH v2 3/4] cxl/pci: Fix sanitize notifier setup
Date: Tue, 3 Oct 2023 18:09:40 -0700 [thread overview]
Message-ID: <651cbb54d1ebd_ae7e7294f1@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <zs7jliubdhd6e7eabzukvale7bfoltk7ja5lwvvue2df2n2vol@4nhsl2gzdcfw>
Davidlohr Bueso wrote:
> On Fri, 29 Sep 2023, Dan Williams wrote:
>
> >+static int cxl_sanitize_setup_notifier(struct cxl_memdev *cxlmd)
> >+{
> >+ struct cxl_dev_state *cxlds = cxlmd->cxlds;
> >+ struct cxl_memdev_state *mds = to_cxl_memdev_state(cxlds);
> >+ struct device *dev = cxlds->dev;
>
> This wants to be dev = &cxlmd->dev;
No, the notifier needs to be torn down in the cxl_pci teardown path. If
cxlmd->dev was the devm operations host then this notifier would need to
be setup from the cxl_mem driver, not cxl_pci. The teardown order of
cxl_pci ends with @cxlds->dev as the devm host ends up as:
cxl_sanitize_teardown_notifier()
cxl_memdev_unregister()
...otherwise if the @cxlmd->dev is used then the devm callback may not
fire until device_release() time since it is possible that the cxl_mem
driver never attaches to trigger the typical devm action around
->remove() time.
> >+ struct kernfs_node *sec;
> >+
> >+ if (!test_bit(CXL_SEC_ENABLED_SANITIZE, mds->security.enabled_cmds))
> >+ return 0;
> >+
> >+ sec = sysfs_get_dirent(dev->kobj.sd, "security");
> >+ if (!sec) {
> >+ dev_err(dev, "sanitize notification setup failure\n");
>
> Nit: Should the error message differ from the next one? Maybe s/sanitize/security?
Maybe, but these things will likely never fire, as devm_cxl_add_memdev()
would have failed before getting here. Maybe just delete them?
next prev parent reply other threads:[~2023-10-04 1:09 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 23:09 [PATCH v2 0/4] cxl/mem: Fix shutdown order Dan Williams
2023-09-29 23:09 ` [PATCH v2 1/4] cxl/pci: Remove unnecessary device reference management in sanitize work Dan Williams
2023-09-29 23:41 ` Ira Weiny
2023-10-02 9:55 ` Jonathan Cameron
2023-10-02 15:27 ` Davidlohr Bueso
2023-10-02 16:48 ` Dave Jiang
2023-09-29 23:09 ` [PATCH v2 2/4] cxl/pci: Cleanup 'sanitize' to always poll Dan Williams
2023-09-29 23:49 ` Ira Weiny
2023-09-29 23:51 ` Ira Weiny
2023-10-02 10:02 ` Jonathan Cameron
2023-10-04 0:55 ` Dan Williams
2023-10-02 15:49 ` Davidlohr Bueso
2023-10-04 1:01 ` Dan Williams
2023-10-04 1:13 ` Davidlohr Bueso
2023-10-02 16:57 ` Dave Jiang
2023-09-29 23:09 ` [PATCH v2 3/4] cxl/pci: Fix sanitize notifier setup Dan Williams
2023-09-30 2:42 ` Ira Weiny
2023-10-02 10:10 ` Jonathan Cameron
2023-10-04 0:59 ` Dan Williams
2023-10-04 10:12 ` Jonathan Cameron
2023-10-04 18:47 ` Dan Williams
2023-10-02 16:59 ` Dave Jiang
2023-10-04 0:52 ` Davidlohr Bueso
2023-10-04 1:09 ` Dan Williams [this message]
2023-10-04 16:21 ` Davidlohr Bueso
2023-10-04 18:48 ` Dan Williams
2023-10-04 18:50 ` Dan Williams
2023-10-04 18:54 ` Dan Williams
2023-10-04 19:23 ` Davidlohr Bueso
2023-09-29 23:09 ` [PATCH v2 4/4] cxl/mem: Fix shutdown order Dan Williams
2023-09-29 23:52 ` Ira Weiny
2023-10-02 10:11 ` Jonathan Cameron
2023-10-02 16:59 ` Dave Jiang
2023-10-03 17:40 ` Davidlohr Bueso
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=651cbb54d1ebd_ae7e7294f1@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
/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