All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Ashwin Chaugule <ashwin.chaugule@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Alexey Klimov <alexey.klimov@arm.com>,
	Prashanth Prakash <pprakash@codeaurora.org>,
	linux acpi <linux-acpi@vger.kernel.org>,
	Linaro ACPI Mailman List <linaro-acpi@lists.linaro.org>,
	Timur Tabi <timur@codeaurora.org>
Subject: Re: [PATCH V3 1/4] ACPI / CPPC: Optimize PCC Read Write operations
Date: Tue, 16 Feb 2016 20:39:27 +0100	[thread overview]
Message-ID: <13141226.tTSRZNDOBm@vostro.rjw.lan> (raw)
In-Reply-To: <CAJ5Y-eZMWDrZfPJW07fgcMQ0n3K6Vybik3ArKzM2vJqEW147Uw@mail.gmail.com>

On Tuesday, February 16, 2016 02:33:00 PM Ashwin Chaugule wrote:
> Hi Rafael,
> 
> On 16 February 2016 at 14:10, Rafael J. Wysocki <rafael@kernel.org> wrote:
> > On Tue, Feb 16, 2016 at 7:47 PM, Ashwin Chaugule
> > <ashwin.chaugule@linaro.org> wrote:
> >> Hi Alexey,
> >>
> >> On 15 February 2016 at 11:37, Alexey Klimov <alexey.klimov@arm.com> wrote:
> >>> Hi Prashanth and Ashwin,
> >>>
> >>> On Wed, Feb 10, 2016 at 01:05:59PM -0700, Prashanth Prakash wrote:
> >>>> From: Ashwin Chaugule <ashwin.chaugule@linaro.org>
> >>>>
> >>>> Previously the send_pcc_cmd() code checked if the
> >>>> PCC operation had completed before returning from
> >>>> the function. This check was performed regardless
> >>>> of the PCC op type (i.e. Read/Write). Knowing
> >>>> the type of cmd can be used to optimize the check
> >>>> and avoid needless waiting. e.g. with Write ops,
> >>>> the actual Writing is done before calling send_pcc_cmd().
> >>>> And the subsequent Writes will check if the channel is
> >>>> free at the entry of send_pcc_cmd() anyway.
> >>>>
> >>>> However, for Read cmds, we need to wait for the cmd
> >>>> completion bit to be flipped, since the actual Read
> >>>> ops follow after returning from the send_pcc_cmd(). So,
> >>>> only do the looping check at the end for Read ops.
> >>>>
> >>>> Also, instead of using udelay() calls, use ktime as a
> >>>> means to check for deadlines. The current deadline
> >>>> in which the Remote should flip the cmd completion bit
> >>>> is defined as N * Nominal latency. Where N is arbitrary
> >>>> and large enough to work on slow emulators and Nominal
> >>>> latency comes from the ACPI table (PCCT). This helps
> >>>> in working around the CONFIG_HZ effects on udelay()
> >>>> and also avoids needing different ACPI tables for Silicon
> >>>> and Emulation platforms.
> >>>>
> >>>> Signed-off-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
> >>>> Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org>
> >>>> ---
> >>>>  drivers/acpi/cppc_acpi.c | 99 ++++++++++++++++++++++++++++++++++--------------
> >>>>  1 file changed, 71 insertions(+), 28 deletions(-)
> >>
> >> [..]
> >>
> >>>> -     u32 cmd_latency = pcct_ss->latency;
> >>>>
> >>>> -     /* Min time OS should wait before sending next command. */
> >>>> -     udelay(pcc_cmd_delay);
> >>>
> >>> Ouch.
> >>> This delay is Minimum Request Turnaround Time and specification is strict about this:
> >>> The minimum amount of time that OSPM must wait after the
> >>> completion of a command before issuing the next command, in microseconds.
> >>>
> >>> And you're going to completely remove delay that described as "must wait" regardless if it's
> >>> write or read command. In my view completion of a command is when CMD complete bit is set to 1.
> >>> This field in table is not optional.
> >>
> >> The spec has a whole bunch of delays which are highly questionable.
> >
> > Why does your opinion matter here if I may ask?
> >
> 
> We asked the folks who added those delays to the spec before making
> this change. So this is not unfounded.

That's fine, but then the authors of the firmware your code has to deal
with may not have that conversation and may expect certain type of behavior
from it (as indicated by the spec).

> > If everybody follows this line of reasoning, there's no point in
> > having any specifications in the first place.
> >
> > If you don't like the spec, please submit requests to modify it.  Or
> > follow it otherwise.
> 
> But I agree that for the sake of spec correctness we should include
> this delay and let firmware choose what value to put in it and deal
> with the latencies for each request.
> 
> >
> >> e.g. the Min Request Turnaround time and the Max periodic access rate.
> >> Both seem quite useless since their original intention was to avoid
> >> the OS from flooding the BMC. But one can argue that the firmware can
> >> throttle the OS requests via the Command Completion bit anyway.
> >
> > Yes, they can.  What does that have to do with the other fields?
> 
> If the intention was only to control the OS request rate, then why
> isnt Command Completion sufficient for that purpose? The firmware can
> flip the command complete bit only when it is ready to receive the
> next request.
> 
> >
> >> I also didnt like the usage of udelays and prefer the ktime math, but that
> >> seems overkill given the questionable value of these fields.
> >>
> >>>
> >>> Even worse, what if platform report latency = 0 (or very close to zero) and turnaround time as very large number?
> >>>
> >>
> >> Such a firmware would need serious rework. Besides, if for whatever
> >> reason they choose to have it, the command complete bit can be used to
> >> throttle the OS requests.
> >
> > Yes, it can.  Is that a good enough argument for not respecting the
> > spec on the OS side?  I don't think so.
> 
> In principle I agree, but with CPPC, these fields seemed redundant,
> hence the patch. But I'm not strongly opposed either way, so we'll add
> the latency field back and leave it up to the platform and vendors.

Sounds good.

Thanks,
Rafael


  reply	other threads:[~2016-02-16 19:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-10 20:05 [PATCH V3 0/4] acpi: cppc optimization patches Prashanth Prakash
2016-02-10 20:05 ` [PATCH V3 1/4] ACPI / CPPC: Optimize PCC Read Write operations Prashanth Prakash
2016-02-10 20:42   ` Timur Tabi
2016-02-10 21:15     ` Ashwin Chaugule
2016-02-10 21:57       ` Timur Tabi
2016-02-10 22:17         ` Ashwin Chaugule
2016-02-15 16:37   ` Alexey Klimov
2016-02-16 18:47     ` Ashwin Chaugule
2016-02-16 19:10       ` Rafael J. Wysocki
2016-02-16 19:33         ` Ashwin Chaugule
2016-02-16 19:39           ` Rafael J. Wysocki [this message]
2016-02-29 17:39       ` Alexey Klimov
2016-02-29 19:20         ` Prakash, Prashanth
2016-02-10 20:06 ` [PATCH V3 2/4] acpi: cppc: optimized cpc_read and cpc_write Prashanth Prakash
2016-02-10 20:06 ` [PATCH V3 3/4] mailbox: pcc: optimized pcc_send_data Prashanth Prakash
2016-02-10 20:06 ` [PATCH V3 4/4] acpi: cppc: replace writeX/readX to PCC with relaxed version Prashanth Prakash

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=13141226.tTSRZNDOBm@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=alexey.klimov@arm.com \
    --cc=ashwin.chaugule@linaro.org \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=pprakash@codeaurora.org \
    --cc=rafael@kernel.org \
    --cc=timur@codeaurora.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.