From: Cyril Bur <cyrilbur@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Cc: "stewart@linux.vnet.ibm.com" <stewart@linux.vnet.ibm.com>,
"alistair@popple.id.au" <alistair@popple.id.au>,
"dwmw2@infradead.org" <dwmw2@infradead.org>,
"rlippert@google.com" <rlippert@google.com>
Subject: Re: [PATCH v2 08/10] powerpc/opal: Add opal_async_wait_response_interruptible() to opal-async
Date: Tue, 11 Jul 2017 10:48:49 +1000 [thread overview]
Message-ID: <1499734129.14464.3.camel@gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD0036C52@AcuExch.aculab.com>
On Mon, 2017-07-10 at 14:05 +0000, David Laight wrote:
> From: Cyril Bur
> > Sent: 10 July 2017 02:31
> > This patch adds an _interruptible version of opal_async_wait_response().
> > This is useful when a long running OPAL call is performed on behalf of a
> > userspace thread, for example, the opal_flash_{read,write,erase}
> > functions performed by the powernv-flash MTD driver.
> >
> > It is foreseeable that these functions would take upwards of two minutes
> > causing the wait_event() to block long enough to cause hung task
> > warnings. Furthermore, wait_event_interruptible() is preferable as
> > otherwise there is no way for signals to stop the process which is going
> > to be confusing in userspace.
>
> ISTM that if you are doing (something like) a flash full device erase
> (that really can take minutes) it isn't actually an interruptible
> operation - the flash chip will still be busy.
> So allowing the user process be interrupted just leaves a big mess.
>
Agreed.
> OTOH the 'hung task' warning isn't the only problem with uninterruptible
> sleeps - the processes also count towards the 'load average'.
> Some software believes the 'load average' is a meaningful value.
>
Yes, and because the read write and erase ops are actually calls into
firmware which in some cases completely emulates flash we can mitigate
the mess of allowing the process to be interrupted that you mention
above.
> It would be more generally useful for tasks to be able to sleep
> uninterruptibly without counting towards the 'load average' or triggering
> the 'task stuck' warning.
> (I've code somewhere that sleeps interruptibly unless there is a signal
> pending when it sleeps uninterruptibly.)
>
I'm not sure what you mean here, if I understand correctly, this is
what I'm doing. In the patch to the powernv_flash driver which uses
opal_async_wait_response_interruptible() I essentially do the
interruptible and if it breaks early the driver determines if it is
safe to return to userspace otherwise it sleeps uninterruptibly
(hopefully not for long). I was hesitant to put that logic here and
prefered to leave it up to the caller to make the decision as to what
to do.
> WRT flash erases, 'whole device' erases aren't significantly quicker
> than sector by sector erases.
Yes, I'm rewriting some of the userspace tools we have to do everything
sector by sector. MTD interfaces allow big reads/writes and erases so
we should still handle it as best we can.
> The latter can be interrupted between sectors.
> I'm not sure you'd want to do writes than lock down enough kernel
> memory to take even a second to complete.
>
The MTD core actually chunks them up before passing them to the to
backing driver so I don't think holding too much memory is a problem.
Because the time spent in OPAL servicing flash calls is hard to
determine and might not even be that related to the size of the
operation, even smaller ops might still spend 'time' in OPAL.
Cyril
> David
>
next prev parent reply other threads:[~2017-07-11 0:48 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 1:30 [PATCH v2 00/10] Allow opal-async waiters to get interrupted Cyril Bur
2017-07-10 1:30 ` [PATCH v2 01/10] mtd: powernv_flash: Use WARN_ON_ONCE() rather than BUG_ON() Cyril Bur
2017-07-10 1:30 ` [PATCH v2 02/10] mtd: powernv_flash: Lock around concurrent access to OPAL Cyril Bur
2017-07-10 1:30 ` [PATCH v2 03/10] mtd: powernv_flash: Don't treat OPAL_SUCCESS as an error Cyril Bur
2017-07-10 1:31 ` [PATCH v2 04/10] mtd: powernv_flash: Remove pointless goto in driver init Cyril Bur
2017-07-10 1:31 ` [PATCH v2 05/10] powerpc/opal: Make __opal_async_{get, release}_token() static Cyril Bur
2017-07-10 1:31 ` [PATCH v2 06/10] powerpc/opal: Rework the opal-async interface Cyril Bur
2017-07-10 1:31 ` [PATCH v2 07/10] powernv/opal-sensor: remove not needed lock Cyril Bur
2017-07-10 1:31 ` [PATCH v2 08/10] powerpc/opal: Add opal_async_wait_response_interruptible() to opal-async Cyril Bur
2017-07-10 14:05 ` David Laight
2017-07-11 0:48 ` Cyril Bur [this message]
2017-07-10 1:31 ` [PATCH v2 09/10] powerpc/powernv: Add OPAL_BUSY to opal_error_code() Cyril Bur
2017-07-10 1:31 ` [PATCH v2 10/10] mtd: powernv_flash: Use opal_async_wait_response_interruptible() Cyril Bur
2017-07-11 4:19 ` kbuild test robot
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=1499734129.14464.3.camel@gmail.com \
--to=cyrilbur@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=alistair@popple.id.au \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=rlippert@google.com \
--cc=stewart@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).