[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d1acd809-48d0-5889-0eb1-e52b68445dfe@arm.com>
Date: Mon, 19 Feb 2018 11:50:42 +0000
From: Sudeep Holla <sudeep.holla@....com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Sudeep Holla <sudeep.holla@....com>,
ALKML <linux-arm-kernel@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>,
DTML <devicetree@...r.kernel.org>,
Roy Franz <roy.franz@...ium.com>,
Harb Abdulhamid <harba@...eaurora.org>,
Nishanth Menon <nm@...com>, Loc Ho <lho@....com>,
Alexey Klimov <klimov.linux@...il.com>,
Ryan Harkin <Ryan.Harkin@....com>,
Jassi Brar <jassisinghbrar@...il.com>
Subject: Re: [PATCH v5 11/20] firmware: arm_scmi: add support for polling
based SCMI transfers
On 19/02/18 11:32, Arnd Bergmann wrote:
> On Tue, Jan 2, 2018 at 3:42 PM, Sudeep Holla <sudeep.holla@....com> wrote:
>
>> +#define SCMI_MAX_POLLING_TIMEOUT_NS (100 * NSEC_PER_USEC)
>> /**
>> * scmi_do_xfer() - Do one transfer
>> *
>> @@ -389,14 +406,30 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
>
>> + if (xfer->hdr.poll_completion) {
>> + ktime_t stop, cur;
>> +
>> + stop = ktime_add_ns(ktime_get(), SCMI_MAX_POLLING_TIMEOUT_NS);
>> + do {
>> + udelay(5);
>> + cur = ktime_get();
>> + } while (!scmi_xfer_poll_done(info, xfer) &&
>> + ktime_before(cur, stop));
>
> The 5 microsecond back-off isn't that much smaller than the 100 microsecond
> timeout, given that udelay() often waits much longer than the specified time.
>
> How did you come up with those two numbers? Are you sure this is better
> than just using a cpu_relax() instead of the udelay()?
>
Somehow I assumed that cpu_relax will schedule out and since this is
called in the fast switching path, I can't do that. But now I see that
it's just an hint and so I can use it. Sorry for missing it earlier, you
did point this out in previous version and I retained it based on my
wrong assumption. Thanks.
--
Regards,
Sudeep
Powered by blists - more mailing lists