From: Dan Williams <dan.j.williams@intel.com>
To: Vikram Sethi <vsethi@nvidia.com>,
Dan Williams <dan.j.williams@intel.com>,
Vishal Aslot <os.vaslot@gmail.com>,
"dave.jiang@intel.com" <dave.jiang@intel.com>
Cc: "Jonathan.Cameron@huawei.com" <Jonathan.Cameron@huawei.com>,
"alison.schofield@intel.com" <alison.schofield@intel.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"dave@stgolabs.net" <dave@stgolabs.net>,
"ira.weiny@intel.com" <ira.weiny@intel.com>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"lukas@wunner.de" <lukas@wunner.de>,
"vishal.l.verma@intel.com" <vishal.l.verma@intel.com>,
Vikram Sethi <vikramsethi@gmail.com>
Subject: RE: [PATCH v2 2/3] PCI: Create new reset method to force SBR for CXL
Date: Tue, 21 May 2024 14:23:56 -0700 [thread overview]
Message-ID: <664d10ebeb537_e8be29494@dwillia2-mobl3.amr.corp.intel.com.notmuch> (raw)
In-Reply-To: <CY5PR12MB60607B123B05AF10568ED5EDBDEA2@CY5PR12MB6060.namprd12.prod.outlook.com>
Vikram Sethi wrote:
> Hi Dan,
>
> > Vishal Aslot wrote:
> > > Hi,
> > >
> > > For T2 and T3 persistent memory devices, wouldn’t we also need a way
> > > to trigger device cache flush and then disable out of
> > > cxl_reest_bus_function()?
> > >
> > > CXL Spec 3.1 (Aug ’23), Section 9.3 which refers to system reset flow
> > > has RESETPREP VDMs to trigger device cache flush, put memory in safe
> > > state, etc. These devices would benefit from this in case of SBR as
> > > well, but it is root port specific so may be an ACPI method could be
> > > involved out of cxl_reset_bus_function()?
> >
> > In short, no, OS initiated device-cache-flush is not indicated, nor possible (GPF
> > has no mechanism for system-software trigger) for this case.
> >
> > Specifically that section states:
> >
> > "...it is expected that the CXL devices are already in an Inactive State with their
> > contexts flushed to the system memory or CXL-attached memory before the
> > platform reset flow is triggered"
> >
> > ...so if reset is triggered while the device is mapped and active then the
> > administrator gets to keep all the pieces. This SBR enabling is all about making
> > sure the kernel log reflects when the administrator messed up and triggered
> > reset while the device had active decoders.
>
> For a .cache capable device, shouldn't the kernel be writing to the
> device CXL Control2 register " Initiate cache writeback and
> Invalidation", as part of the "OS orchestrated reset flow"?
For a CXL.cache capable initiator, since there is no generic driver
model for that I would expect that responsibility to fall to endpoint
drivers to implement in their reset_prepare callbacks. Otherwise I would
expect the device to be already "Inactive" prior to reset.
> CXL reset, the link is going down in SBR case, so the device has no
> chance of doing the writeback of dirty system memory lines it holds.
For suprise reset, sure, but drivers can always trap reset_prepare.
> Hence OS must do it prior to the SBR issuance.
"OS" is one of userspace device idling, accelerator driver, or PCI core.
I think if userspace fails to idle the device, then it is up to the
accelerator driver to handle reset while the device is not idle, the PCI
core should likely not be burdended with this per-device / optional
CXL-ism around reset.
> that the only 'supported'/workable SBR for such a device would include
> previously offlining its memory and unloading its driver, and part of
> that step would be driver code doing the device cache WB+invalidate?
That certainly is the expectation for CXL-memory-expanders, so when
accelerator drivers arrive they need to consider that this will not be
done automatically on their behalf.
> I think that additionally, kernel should also be doing a host cache
> flush here to WB+invalidate dirty Device owned/homed lines cached in
> the host CPU, to handle the previously discussed scenario of device
> snoop filter being reset as part of reset, but not expecting future
> WBs from host, and raising errors if that were to happen.
Again that is an accelerator specific responsibility in my mind, and
ideally the device handles this with its own back-invalidate given the
difficulties of wielding instructions like wbinvd (on x86 at least).
next prev parent reply other threads:[~2024-05-21 21:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 17:34 [PATCH v2 2/3] PCI: Create new reset method to force SBR for CXL Vishal Aslot
2024-05-21 18:11 ` Dan Williams
2024-05-21 21:04 ` Vikram Sethi
2024-05-21 21:23 ` Dan Williams [this message]
2024-05-22 2:51 ` Vikram Sethi
2024-05-29 4:10 ` Dan Williams
-- strict thread matches above, loose matches on Subject: below --
2024-03-25 23:58 [PATCH 0/3 v2] PCI: Add Secondary Bus Reset (SBR) support " Dave Jiang
2024-03-25 23:58 ` [PATCH v2 2/3] PCI: Create new reset method to force SBR " Dave Jiang
2024-03-28 1:53 ` Dan Williams
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=664d10ebeb537_e8be29494@dwillia2-mobl3.amr.corp.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alison.schofield@intel.com \
--cc=bhelgaas@google.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=os.vaslot@gmail.com \
--cc=vikramsethi@gmail.com \
--cc=vishal.l.verma@intel.com \
--cc=vsethi@nvidia.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