All of lore.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Frank Rowand <frowand.list@gmail.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	Devicetree List <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] dt-bindings: mailbox: add doorbell support to ARM MHU
Date: Wed, 10 Jun 2020 15:03:34 +0530	[thread overview]
Message-ID: <20200610093334.yznxl2esv5ht27ns@vireshk-i7> (raw)
In-Reply-To: <CABb+yY2TR7tuMx6u8yah6mO2GwZ5SWYOO80EQRL-i=ybgn=Wog@mail.gmail.com>

On 05-06-20, 10:42, Jassi Brar wrote:
> Since origin upto scmi_xfer, there can be many forms of sleep like
> schedule/mutexlock etc.... think of some userspace triggering sensor
> or dvfs operation. Linux does not provide real-time guarantees. Even
> if remote (scmi) firmware guarantee RT response, it makes sense to
> timeout a response only after the _request is on the bus_  and not
> when you submit a request to the api (unless you serialise it).
> IOW, start the timeout from  mbox_client.tx_prepare()  when the
> message actually gets on the bus.

There are multiple purposes of the timeout IMO:

- Returning early if the other side is dead/hung, in such a case the
  timeout can be put when the request is put on the bus as we don't
  care of the time it takes to complete the request until the time the
  request can be fulfilled. This can be a example of i2c/spi memory
  read.

- Ensuring maximum time in which the request needs to be serviced.
  There may be hard requirements, like in case for DVFS from
  scheduler's hot path (which is essential for better working of the
  overall system). And for such a case the timeout is placed at the
  right place IMO, i.e. right after a request is submitted to mailbox.

And some more points I wanted to share..

- I am not sure I understood the *serializing* part you guys were
  talking about. I believe mailbox framework is already serializing
  the requests it is receiving on a single channel with a spin lock,
  right ? Why does the client need to serialize them as well? Is that
  for avoiding timeouts ?

- For me, and Sudeep as well IIUC, the bigger problem isn't that
  timeouts are happening and requests are failing (and so changing the
  timeout to a bigger value isn't going to fix anything), but the
  problem is that it is taking too long (because of the queue of
  requests on a channel) for a request to finish after being
  submitted. Scheduler doesn't care of the underneath logistics for
  example, all it cares for is the time it takes to change the
  frequency of a CPU. If you can do it fast enough in a guaranteed
  manner, then you can use fast switching, otherwise not.

- The hardware can very well support the case today where this can be
  done in parallel and (almost) in a guaranteed time-frame. While the
  software wants to add a limit to that and so wants to serialize
  requests.

- As many people have already suggested it (like me, Sudeep, Rob,
  maybe Bjorn as well), it seems silly to not allow driving the h/w in
  the most efficient way possible (and allow fast cpu switching in
  this case).
 
> Interesting logs !  The time taken to complete _successful_ requests
> are arguably better in bad_trace ... there are many <10usec responses
> in bad_trace, while the fastest response in good_trace is  53usec.

Indeed this is interesting. It may be worth looking (separately) into
why don't we see those 3 us long requests anymore, or maybe they were
just not there in the logs.

> And the requests that 'fail/timeout' are purely the result of not
> serialising them or checkout for timeout at wrong place as explained
> above.

We can't allow for the requests to go on for ever in some cases, while
in other cases it may be absolutely fine.

-- 
viresh

WARNING: multiple messages have this Message-ID (diff)
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Devicetree List <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Frank Rowand <frowand.list@gmail.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [RFC] dt-bindings: mailbox: add doorbell support to ARM MHU
Date: Wed, 10 Jun 2020 15:03:34 +0530	[thread overview]
Message-ID: <20200610093334.yznxl2esv5ht27ns@vireshk-i7> (raw)
In-Reply-To: <CABb+yY2TR7tuMx6u8yah6mO2GwZ5SWYOO80EQRL-i=ybgn=Wog@mail.gmail.com>

On 05-06-20, 10:42, Jassi Brar wrote:
> Since origin upto scmi_xfer, there can be many forms of sleep like
> schedule/mutexlock etc.... think of some userspace triggering sensor
> or dvfs operation. Linux does not provide real-time guarantees. Even
> if remote (scmi) firmware guarantee RT response, it makes sense to
> timeout a response only after the _request is on the bus_  and not
> when you submit a request to the api (unless you serialise it).
> IOW, start the timeout from  mbox_client.tx_prepare()  when the
> message actually gets on the bus.

There are multiple purposes of the timeout IMO:

- Returning early if the other side is dead/hung, in such a case the
  timeout can be put when the request is put on the bus as we don't
  care of the time it takes to complete the request until the time the
  request can be fulfilled. This can be a example of i2c/spi memory
  read.

- Ensuring maximum time in which the request needs to be serviced.
  There may be hard requirements, like in case for DVFS from
  scheduler's hot path (which is essential for better working of the
  overall system). And for such a case the timeout is placed at the
  right place IMO, i.e. right after a request is submitted to mailbox.

And some more points I wanted to share..

- I am not sure I understood the *serializing* part you guys were
  talking about. I believe mailbox framework is already serializing
  the requests it is receiving on a single channel with a spin lock,
  right ? Why does the client need to serialize them as well? Is that
  for avoiding timeouts ?

- For me, and Sudeep as well IIUC, the bigger problem isn't that
  timeouts are happening and requests are failing (and so changing the
  timeout to a bigger value isn't going to fix anything), but the
  problem is that it is taking too long (because of the queue of
  requests on a channel) for a request to finish after being
  submitted. Scheduler doesn't care of the underneath logistics for
  example, all it cares for is the time it takes to change the
  frequency of a CPU. If you can do it fast enough in a guaranteed
  manner, then you can use fast switching, otherwise not.

- The hardware can very well support the case today where this can be
  done in parallel and (almost) in a guaranteed time-frame. While the
  software wants to add a limit to that and so wants to serialize
  requests.

- As many people have already suggested it (like me, Sudeep, Rob,
  maybe Bjorn as well), it seems silly to not allow driving the h/w in
  the most efficient way possible (and allow fast cpu switching in
  this case).
 
> Interesting logs !  The time taken to complete _successful_ requests
> are arguably better in bad_trace ... there are many <10usec responses
> in bad_trace, while the fastest response in good_trace is  53usec.

Indeed this is interesting. It may be worth looking (separately) into
why don't we see those 3 us long requests anymore, or maybe they were
just not there in the logs.

> And the requests that 'fail/timeout' are purely the result of not
> serialising them or checkout for timeout at wrong place as explained
> above.

We can't allow for the requests to go on for ever in some cases, while
in other cases it may be absolutely fine.

-- 
viresh

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-06-10  9:33 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15  5:17 [RFC] dt-bindings: mailbox: add doorbell support to ARM MHU Viresh Kumar
2020-05-15  5:17 ` Viresh Kumar
2020-05-15 16:46 ` Jassi Brar
2020-05-15 16:46   ` Jassi Brar
2020-05-18  7:35   ` Viresh Kumar
2020-05-18  7:35     ` Viresh Kumar
2020-05-19  0:53     ` Jassi Brar
2020-05-19  0:53       ` Jassi Brar
2020-05-19  4:39       ` Viresh Kumar
2020-05-19  4:39         ` Viresh Kumar
2020-05-19  1:29 ` Bjorn Andersson
2020-05-19  1:29   ` Bjorn Andersson
2020-05-19  3:40   ` Viresh Kumar
2020-05-19  3:40     ` Viresh Kumar
2020-05-19  4:05     ` Jassi Brar
2020-05-19  4:05       ` Jassi Brar
2020-06-03 18:31       ` Sudeep Holla
2020-06-03 18:31         ` Sudeep Holla
2020-06-03 18:42         ` Jassi Brar
2020-06-03 18:42           ` Jassi Brar
2020-06-03 18:28   ` Sudeep Holla
2020-06-03 18:28     ` Sudeep Holla
2020-05-28 19:20 ` Rob Herring
2020-05-28 19:20   ` Rob Herring
2020-05-29  4:07   ` Viresh Kumar
2020-05-29  4:07     ` Viresh Kumar
2020-06-03 18:04     ` Sudeep Holla
2020-06-03 18:04       ` Sudeep Holla
2020-06-03 18:17       ` Sudeep Holla
2020-06-03 18:17         ` Sudeep Holla
2020-06-04  5:59         ` Viresh Kumar
2020-06-04  5:59           ` Viresh Kumar
2020-06-04  8:28           ` Sudeep Holla
2020-06-04  8:28             ` Sudeep Holla
2020-06-03 18:32       ` Jassi Brar
2020-06-03 18:32         ` Jassi Brar
2020-06-04  9:20         ` Sudeep Holla
2020-06-04  9:20           ` Sudeep Holla
2020-06-04 15:15           ` Jassi Brar
2020-06-04 15:15             ` Jassi Brar
2020-06-05  4:56             ` Sudeep Holla
2020-06-05  4:56               ` Sudeep Holla
2020-06-05  6:30               ` Jassi Brar
2020-06-05  6:30                 ` Jassi Brar
2020-06-05  8:58                 ` Sudeep Holla
2020-06-05 15:42                   ` Jassi Brar
2020-06-05 15:42                     ` Jassi Brar
2020-06-10  9:33                     ` Viresh Kumar [this message]
2020-06-10  9:33                       ` Viresh Kumar
2020-06-11 10:00                       ` Sudeep Holla
2020-06-11 10:00                         ` Sudeep Holla
2020-06-12  0:34                         ` Jassi Brar
2020-06-12  0:34                           ` Jassi Brar
2020-06-12  5:28                           ` Viresh Kumar
2020-06-12  5:28                             ` Viresh Kumar
2020-09-08  9:14                             ` Arnd Bergmann
2020-09-08  9:14                               ` Arnd Bergmann
2020-09-08  9:27                               ` Viresh Kumar
2020-09-08  9:27                                 ` Viresh Kumar
2020-09-08 13:26                               ` Sudeep Holla
2020-09-08 13:26                                 ` Sudeep Holla
2020-09-09  3:23                               ` Jassi Brar
2020-09-09  3:23                                 ` Jassi Brar
2020-09-09  4:46                                 ` Viresh Kumar
2020-09-09  4:46                                   ` Viresh Kumar
2020-09-09  9:31                                 ` Sudeep Holla
2020-09-09  9:31                                   ` Sudeep Holla
2020-05-29  5:20   ` Jassi Brar
2020-05-29  5:20     ` Jassi Brar
2020-05-29  6:27     ` Viresh Kumar
2020-05-29  6:27       ` Viresh Kumar

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=20200610093334.yznxl2esv5ht27ns@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=vincent.guittot@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.