Linux CXL
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>,
	Dan Williams <dan.j.williams@intel.com>
Cc: <jonathan.cameron@huawei.com>, <ira.weiny@intel.com>,
	<fan.ni@samsung.com>, <a.manzanares@samsung.com>,
	<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH 4/7] cxl/mem: Support Sanitation
Date: Wed, 5 Apr 2023 15:24:41 -0700	[thread overview]
Message-ID: <642df529cffcb_21a8294ed@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20230405210622.cxujzoaceuxpfopm@offworld>

Davidlohr Bueso wrote:
> On Mon, 27 Mar 2023, Dan Williams wrote:
> 
> >Per the feedback on 1 this changes to be a facility that returns
> >immediately and signals completion via sysfs_notify_dirent() because if
> >it takes seconds and is hardware uninterruptible then that warrants
> >userspace being able to poll for completion if it wants.
> 
> Perhaps I'm missing something here, but how can we signal completion
> for sanitation if we return immediately (after timing out) and loose
> context of the background command? Or are you referring to use the
> Background Operation Status command (0002h), which afaict would be
> the only way to do this, as nvdimm's overwrite_query. But as we've
> discussed in the past, this also means that another bg command could
> occur in between when the command finished and the query is done.

The observation is that sanitation is special compared to other
background commands. It's so special that it gets to skip the normal
rules that background commands are parceled into tiny pieces to prevent
monopolization of the background command slot. Sanitization monopolizes
the device by definition.

Given that sanitation is going to take on the order of seconds, don't
trap the submitter in uninterruptible sleep. Instead, put the mailbox
into "santizing" mode, and return immediately after sanitation is
started.

In "sanitizing" mode. New background command submissions fail
immediately with EBUSY (as opposed to queuing because sanitization
destoys the device's context). The end of sanitization mode occurs when
the completion interrupt fires, or a kernel polling thread notices the
completion (in case the device does not implement background command
completion interrupts). When that happens the mailbox exits "sanitizing"
mode and reflects the completion status in the sysfs file that was used
trigger sanitization. When that state changes sysfs_notify_dirent()
tells userspace that the sysfs status has changed in case userspace
actually wanted to go to sleep while awaiting the completion rather than
live polling (but that sleep is interruptible and resumable if userspace
wants).

This is similar to what happens with address range scrubs in the ACPI
NFIT driver. See drivers/acpi/nfit/core.c::notify_ars_done().

Think of this like O_ASYNC semantics for sysfs files that trigger long
running operations.

  reply	other threads:[~2023-04-05 22:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 19:46 [PATCH v3 0/7] cxl: Background cmds and device sanitation Davidlohr Bueso
2023-02-24 19:25 ` Davidlohr Bueso
2023-02-24 19:46 ` [PATCH 1/7] cxl/mbox: Add background cmd handling machinery Davidlohr Bueso
2023-02-28 16:27   ` Dave Jiang
2023-02-28 20:18     ` Davidlohr Bueso
2023-02-28 23:35       ` Dave Jiang
2023-03-27 21:57   ` Dan Williams
2023-02-24 19:46 ` [PATCH 2/7] cxl/security: Add security state sysfs ABI Davidlohr Bueso
2023-02-28 16:47   ` Dave Jiang
2023-03-28  1:11   ` Dan Williams
2023-02-24 19:46 ` [PATCH 3/7] cxl/region: Add cxl_memdev_active_region() Davidlohr Bueso
2023-02-27  3:46   ` Alison Schofield
2023-02-28 20:26     ` Davidlohr Bueso
2023-02-28 23:20       ` Fan Ni
2023-03-28  1:15       ` Dan Williams
2023-02-24 19:46 ` [PATCH 4/7] cxl/mem: Support Sanitation Davidlohr Bueso
2023-02-28 17:28   ` Dave Jiang
2023-02-28 20:22     ` Davidlohr Bueso
2023-03-28  6:26   ` Dan Williams
2023-04-05 21:06     ` Davidlohr Bueso
2023-04-05 22:24       ` Dan Williams [this message]
2023-02-24 19:46 ` [PATCH 5/7] cxl/test: Add "Sanitize" opcode support Davidlohr Bueso
2023-02-28 18:03   ` Dave Jiang
2023-02-24 19:46 ` [PATCH 6/7] cxl/mem: Support Secure Erase Davidlohr Bueso
2023-02-28 18:31   ` Dave Jiang
2023-02-24 19:46 ` [PATCH 7/7] cxl/test: Add "Secure Erase" opcode support Davidlohr Bueso
2023-02-28 18:36   ` Dave Jiang
2023-03-22  0:05 ` [PATCH v3 0/7] cxl: Background cmds and device sanitation 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=642df529cffcb_21a8294ed@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=a.manzanares@samsung.com \
    --cc=dave@stgolabs.net \
    --cc=fan.ni@samsung.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.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