From: Dan Williams <dan.j.williams@intel.com>
To: Davidlohr Bueso <dave@stgolabs.net>,
Dan Williams <dan.j.williams@intel.com>
Cc: <dave.jiang@intel.com>, <alison.schofield@intel.com>,
<vishal.l.verma@intel.com>, <Jonathan.Cameron@huawei.com>,
<fan.ni@samsung.com>, <a.manzanares@samsung.com>,
<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH v2] cxl/mbox: Add background cmd handling machinery
Date: Mon, 22 May 2023 14:21:42 -0700 [thread overview]
Message-ID: <646bdce675b59_35a4829434@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <dbz7qo7rsbyc7r4vtcwc5lkpzpy2uz3q3cfd7qekhghp3amn3x@264xhf4swkda>
Davidlohr Bueso wrote:
> On Mon, 22 May 2023, Dan Williams wrote:
>
> >Davidlohr Bueso wrote:
> >> It at least removes one point of potential disambiguity. This out of sync
> >> issue with timeouts was one of the reasons I originally proposed dealing
> >> with all bg commands asynchronously (which doesn't prevent users from still
> >> time-slicing). This approach is supposed to make the code simpler, but leaves
> >> this mess. Currently we state:
> >>
> >> * In the event of timeout, the mailbox state is
> >> * indeterminate until the next successful command submission and the
> >> * driver can get back in sync with the hardware state.
> >
> >Right, but my struggle is how to explain to userspace what to do next.
> >Does userspace keep submitting until it gets a successful acceptance?
>
> Yes. It would be the users' responsibility to deal with timeouts.
>
> >How does userspace know that its failure is induced by background
> >command collision?
>
> Knowing about the apriori timeout, would the user care?
It's not just timeouts its also SIGTERM. If the user is allowed to say
"I do not care about the previous completion" then the driver should have
some way to get back in sync. Either the next submission needs to wait,
or there needs to be a facility to flush previous commands.
> >That's why I think it is ok to block and wait on the previous background
> >command completion when the next command is submitted. That seems to satisfy
> >least surprise. The submitter asked for the last command to end in
> >failure and is asking for the next one to queue up and complete.
> >
> >I think this means that cxl_mbox_background_complete() needs to be called
> >before every submission and needs to check for "background operation"
> >(mailbox status bit0) being cleared to manage potential collisions.
>
> All this really defeats the "simpler" angle. Without accepting that it's
> the user who needs to resubmit until in sync, it seems doing synchronously
> is sw shooting itself in the foot.
Make it as simple as possible, but no simpler. The driver saying "you
are on your own after first cancellation or timeout" is too simple.
Especially when the driver designed with an eye towards not allowing
long running background commands be submitted (outside of the special
sanitization consideration).
So the choices are either allow the background command wait to be
interruptible and then do an implied sync on the next submission, or
make it uninterruptible where timeouts are either a real device problem
or a driver issue that needs to reduce the size of the background
operation to fit the timeout.
This middle ground of allowing SIGTERM and then userspace is on its own
to repair the connection violates least surprise.
next prev parent reply other threads:[~2023-05-22 21:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-02 17:18 [PATCH 0/3] cxl: Handle background commands Davidlohr Bueso
2023-05-02 17:18 ` [PATCH 1/3] rcuwait: Support timeouts Davidlohr Bueso
2023-05-19 21:38 ` Dan Williams
2023-05-19 22:55 ` Davidlohr Bueso
2023-05-20 11:03 ` Peter Zijlstra
2023-05-02 17:18 ` [PATCH 2/3] cxl/pci: Allocate irq vectors earlier in pci probe Davidlohr Bueso
2023-05-15 10:08 ` Jonathan Cameron
2023-05-02 17:18 ` [PATCH 3/3] cxl/mbox: Add background cmd handling machinery Davidlohr Bueso
2023-05-02 17:55 ` Davidlohr Bueso
2023-05-03 14:57 ` [PATCH v2] " Davidlohr Bueso
2023-05-15 10:30 ` Jonathan Cameron
2023-05-15 15:40 ` Davidlohr Bueso
2023-05-15 16:19 ` Jonathan Cameron
2023-05-16 7:58 ` Li, Ming
2023-05-16 17:02 ` Davidlohr Bueso
2023-05-19 23:13 ` Dan Williams
2023-05-22 16:58 ` Davidlohr Bueso
2023-05-22 18:19 ` Dan Williams
2023-05-22 18:57 ` Davidlohr Bueso
2023-05-22 20:16 ` Dan Williams
2023-05-22 20:28 ` Davidlohr Bueso
2023-05-22 21:21 ` Dan Williams [this message]
2023-05-22 21:26 ` Davidlohr Bueso
2023-05-22 22:48 ` 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=646bdce675b59_35a4829434@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=a.manzanares@samsung.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fan.ni@samsung.com \
--cc=linux-cxl@vger.kernel.org \
--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