From: Ravis OpenSrc <Ravis.OpenSrc@micron.com>
To: Davidlohr Bueso <dave@stgolabs.net>
Cc: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"dave.jiang@intel.com" <dave.jiang@intel.com>,
"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"alison.schofield@intel.com" <alison.schofield@intel.com>,
"vishal.l.verma@intel.com" <vishal.l.verma@intel.com>,
"ira.weiny@intel.com" <ira.weiny@intel.com>,
"fan.ni@samsung.com" <fan.ni@samsung.com>,
"a.manzanares@samsung.com" <a.manzanares@samsung.com>,
Srinivasulu Opensrc <sthanneeru.opensrc@micron.com>,
Eishan Mirakhur <emirakhur@micron.com>,
"Ajay Joshi" <ajayjoshi@micron.com>,
Srinivasulu Thanneeru <sthanneeru@micron.com>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/3] cxl/mbox: support background operation abort requests
Date: Thu, 24 Oct 2024 06:30:12 +0000 [thread overview]
Message-ID: <750047084f2e456bb639fabfa7189b20@micron.com> (raw)
In-Reply-To: <vtj5cp6brmyvqut6xaxo3vfgnidvzwxr4kv6ofuiimcga5dyke@ts32khqtmexa>
>On Wed, 23 Oct 2024, Davidlohr Bueso wrote:
>>The one major functionality in our original proposal apart from implementing abort is
>>
>>Allowing background commands to be invoked from user space through the primary mailbox
>>by ensuring only those background commands are enabled which also support request abort operation
>>by checking their individual CEL details.
>
>Is vendor-specific logs not something that can be done OoB?
>
>If we are strictly talking about CEL details, yes this series could use that, and was
>planning on adding it for an eventual v2 -- ie: why send the abort cmd at all if we
>know the current one doesn't support it. But that is minutiae, for kernel bg commands.
>
>But yeah, for your needs, the enabled cmds would need that filter.
Ok. we can merge changes related to CEL checking and filtering of enabled commands.
>
>Then with that, would adding something like the below address your needs and below
>questions? Basically, if userspace is running a command, then the kernel comes in
>and wants to run its own bg command, it will simply abort *anything* ongoing as a
>last resort. And since we have no kernel-context about whatever is running at that
>point, is *think* it is safe to assume it was user-initiated.
Yes, this seems a reasonable assumption.
Currently user space doesn't have a way to initiate background commands
through primary mailbox as there is no provision to provide timeout value.
By filtering out user-initiated background commands which do not support abort,
we can potentially have a default timeout or allow user space to provide a custom timeout value.
Overall, the approach to cancel current background operation when new bg operation
is initiated seems elegant.
>
>diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
>index 7b0fad7f6c4d..bf0742546ea8 100644
>--- a/drivers/cxl/pci.c
>+++ b/drivers/cxl/pci.c
>@@ -374,7 +374,7 @@ static bool cxl_try_to_cancel_background(struct cxl_mailbox *cxl_mbox)
> mds->security.sanitize_active = false;
>
> dev_dbg(cxlds->dev, "Sanitization operation aborted\n");
>- } else {
>+ } else if (atomic_read_acquire(&cxl_mbox->poll_bgop)){
> /*
> * Kick the poller and wait for it to be done - no one else
> * can touch mbox regs. rcuwait_wake_up() provides full
>@@ -403,7 +403,9 @@ static int cxl_pci_mbox_send(struct cxl_mailbox *cxl_mbox,
> */
> if (cxl_is_background_cmd(cmd->opcode)) {
> if (mds->security.sanitize_active ||
>- atomic_read_acquire(&cxl_mbox->poll_bgop)) {
>+ atomic_read_acquire(&cxl_mbox->poll_bgop) ||
>+ /* userspace-initiated ? */
>+ !cxl_mbox_background_done(cxlds)) {
> if (!cxl_try_to_cancel_background(cxl_mbox)) {
> mutex_unlock(&cxl_mbox->mbox_mutex);
>
--Ravi.
prev parent reply other threads:[~2024-10-24 6:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-22 3:18 [PATCH 0/3] cxl/mbox: support background operation abort requests Davidlohr Bueso
2024-10-22 3:18 ` [PATCH 1/3] cxl/pci: lockless background synchronous polling Davidlohr Bueso
2025-01-14 16:12 ` Dave Jiang
2025-01-14 18:40 ` Jonathan Cameron
2025-01-14 19:30 ` Davidlohr Bueso
2024-10-22 3:18 ` [PATCH 2/3] cxl/mbox: support aborting the current background operation Davidlohr Bueso
2025-01-14 17:00 ` Dave Jiang
2025-01-14 19:33 ` Davidlohr Bueso
2025-01-14 20:25 ` Dave Jiang
2024-10-22 3:18 ` [PATCH 3/3] cxl/pci: rename cxl_mbox_background_complete() Davidlohr Bueso
2025-01-14 17:26 ` Dave Jiang
2024-10-23 5:32 ` [PATCH 0/3] cxl/mbox: support background operation abort requests Ravis OpenSrc
2024-10-23 14:29 ` Davidlohr Bueso
2024-10-23 21:17 ` Ravis OpenSrc
2024-10-23 23:35 ` Davidlohr Bueso
2024-10-24 6:30 ` Ravis OpenSrc [this message]
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=750047084f2e456bb639fabfa7189b20@micron.com \
--to=ravis.opensrc@micron.com \
--cc=a.manzanares@samsung.com \
--cc=ajayjoshi@micron.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=emirakhur@micron.com \
--cc=fan.ni@samsung.com \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sthanneeru.opensrc@micron.com \
--cc=sthanneeru@micron.com \
--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