From: Shinas Rasheed <srasheed@marvell.com>
To: "jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>
Cc: "Ravis.OpenSrc@micron.com" <Ravis.OpenSrc@micron.com>,
"ajayjoshi@micron.com" <ajayjoshi@micron.com>,
"emirakhur@micron.com" <emirakhur@micron.com>,
"john@jagalactic.com" <john@jagalactic.com>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"sthanneeru.opensrc@micron.com" <sthanneeru.opensrc@micron.com>,
"sthanneeru@micron.com" <sthanneeru@micron.com>,
Haseeb Gani <hgani@marvell.com>,
Sathesh B Edara <sedara@marvell.com>,
Srinivasa Rao Jampala <sjampala@marvell.com>,
Shariful Alam <sharifula@marvell.com>,
Vimlesh Kumar <vimleshk@marvell.com>,
Dharmesh Pitroda <dpitroda@marvell.com>
Subject: Re: [RFC PATCH] cxl/pci: Set default timeout for background operations
Date: Mon, 2 Sep 2024 06:42:34 +0000 [thread overview]
Message-ID: <PH0PR18MB47345DDF79DB8970D40D3BC5C7922@PH0PR18MB4734.namprd18.prod.outlook.com> (raw)
Hi,
Trying to revive this discussion about background commands. I'm sorry if more on the topic has been discussed elsewhere,
but this is a patch that I could find which related to the same topic.
The requirement for default timeouts (or atleast a mechanism to provide timeouts to the command structure) seems to be needed
since the CXL spec doesn't seem to explicitly deny userspace access to background commands. This seems to constrain a lot of
functionality with respect to Vendor Defined commands as well, if a command needs to be implemented as background.
>> sthanneeru.opensrc@ wrote:
>> > From: Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>
>> >
>> > The CXL 3.0 specification outlines background operations,
>> > and support for handling these operations was added in following patch.
>> >
>> > Link: https://lore.kernel.org/all/20230523170927.20685-5-dave@stgolabs.net/
>> >
>> > Mailbox commands like ‘Log Populate’ use background operations
>> > to complete the execution of the command.
>> > This can lead to a timeout, since there is currently no option
>> > in the ioctl cxl_send_command structure to specify
>> > a timeout value. The default values being zero can lead
>> > to the driver reporting false negatives to the application.
>> >
>> > This patch aims to establish default values, enabling mailbox commands
>> > that operate in the background to continue functioning even
>> > if a timeout is not set in the userspace application.
>>
>> The reason there are no defaults is because userspace is not allowed to
>> issue background commands. The CXL background command definition is
>> awkward in that it allows a single command to monopolize the mailbox for
>> an indefinite amount of time.
I understand this is a design adopted by the kernel, and not actually by the CXL spec (at least I don't see it
specifying explicitly that background commands are not allowed in band).
>>
>> Instead, the approach taken with Firmware Update and Sanitize is that a
>> kernel sysfs ABI mediates access to the mailbox and facilitates bounded
>> timeslices between command submissions. It effectively allows the kernel
>> to manage fairness and more importantly preempt userspace if it needs to
>> issue its own commands.
>>
>> I assume you are only seeing this lack of a default due to building with
>> CONFIG_CXL_MEM_RAW_COMMANDS=y? If yes, "raw" means "raw" and the kernel
>> is mostly taken out of the loop of saving userspace from itself.
This seems to imply that no vendor defined command can be background commands. Please correct me if
I'm wrong, since Vendor defined commands have to be sent as raw commands, and the absence of default timeouts
indicate that the command will be immediately timed out.
Also, I understand the point that background commands (since there can only be one) monopolizes the
mailbox, and hence cannot be exposed to userspace and as I see the background command handling goes synchronously
with the usual command handling in the kernel (ie; foreground command has to wait for the background command to complete or timeout)
but doesn't this defeat the purpose of the spec defined ability to run a foreground command while a background command is
underway?
>>
>> All that said, ugh, "Log Populate" has no facility to time bound the
>> population of the log. I do not think it is tenable for Linux to
>> surrender mailbox access for an indefinite uninterruptible amount of
>> time... unless you want to handle "Log Populate" like Sanitize where the
>> unbounded background operation is tolerated because the device is taken
>> offline?
>
>It may be pointless to do a component state dump only on an offline device.
>My assumption is this one is hardware debug only. Patches out of
>tree or behind a really scary sounding config variable perhaps?
>Other than vendor log I don't think populate log applies to the other
>log types yet (they don't mention it anyway!)
>
>Jonathan
Am I wrong to understand that this design decision is still in the open right now?
Another concern was that right now, a WARN_ONCE is issued when a raw command is ensued. Maybe this belongs
on a different thread, but are raw commands to be depreciated (if then how can Vendor Defined commands be sent?)
next reply other threads:[~2024-09-02 6:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-02 6:42 Shinas Rasheed [this message]
2024-09-13 11:52 ` Jonathan Cameron
-- strict thread matches above, loose matches on Subject: below --
2024-02-07 10:53 sthanneeru.opensrc
2024-02-15 3:31 ` Dan Williams
2024-02-15 12:34 ` 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=PH0PR18MB47345DDF79DB8970D40D3BC5C7922@PH0PR18MB4734.namprd18.prod.outlook.com \
--to=srasheed@marvell.com \
--cc=Ravis.OpenSrc@micron.com \
--cc=ajayjoshi@micron.com \
--cc=dan.j.williams@intel.com \
--cc=dpitroda@marvell.com \
--cc=emirakhur@micron.com \
--cc=hgani@marvell.com \
--cc=john@jagalactic.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sedara@marvell.com \
--cc=sharifula@marvell.com \
--cc=sjampala@marvell.com \
--cc=sthanneeru.opensrc@micron.com \
--cc=sthanneeru@micron.com \
--cc=vimleshk@marvell.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