From: "Prakash, Prashanth" <pprakash@codeaurora.org>
To: linux-acpi@vger.kernel.org
Cc: rjw@rjwysocki.net, alexey.klimov@arm.com, hotran@apm.com,
cov@codeaurora.org
Subject: Re: [PATCH V2 3/5] ACPI/CPPC: support for batching CPPC requests
Date: Mon, 8 Aug 2016 18:09:56 -0600 [thread overview]
Message-ID: <bf9134cd-3055-d4e3-652a-a8dee0aa9e26@codeaurora.org> (raw)
In-Reply-To: <1469562328-10201-4-git-send-email-pprakash@codeaurora.org>
Hi Alexey,
On 7/26/2016 1:45 PM, Prashanth Prakash wrote:
> CPPC defined in section 8.4.7 of ACPI 6.0 specification suggests
> "To amortize the cost of PCC transactions, OSPM should read or write
> all PCC registers via a single read or write command when possible"
> This patch enables opportunistic batching of frequency transition
> requests whenever the request happen to overlap in time.
>
> Currently the access to pcc is serialized by a spin lock which does
> not scale well as we increase the number of cores in the system. This
> patch improves the scalability by allowing the differnt CPU cores to
> update PCC subspace in parallel and by batching requests which will
> reduce the certain types of operation(checking command completion bit,
> ringing doorbell) by a significant margin.
>
> Profiling shows significant improvement in the overall effeciency
> to service freq. transition requests. With this patch we observe close
> to 30% of the frequency transition requests being batched with other
> requests while running apache bench on a ARM platform with 6
> independent domains(or sets of related cpus).
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org>
> ---
> drivers/acpi/cppc_acpi.c | 176 +++++++++++++++++++++++++++++++++++++++--------
> 1 file changed, 147 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
> index 93826c7..4a887d4 100644
> --- a/drivers/acpi/cppc_acpi.c
> +++ b/drivers/acpi/cppc_acpi.c
> @@ -40,15 +40,35 @@
> #include <linux/cpufreq.h>
> #include <linux/delay.h>
> #include <linux/ktime.h>
> +#include <linux/rwsem.h>
> +#include <linux/wait.h>
>
> #include <acpi/cppc_acpi.h>
> +
> /*
> - * Lock to provide mutually exclusive access to the PCC
> - * channel. e.g. When the remote updates the shared region
> - * with new data, the reader needs to be protected from
> - * other CPUs activity on the same channel.
> + * Lock to provide controlled access to the PCC channel.
> + *
> + * For performance critical usecases(currently cppc_set_perf)
> + * We need to take read_lock and check if channel belongs to OSPM before
> + * reading or writing to PCC subspace
> + * We need to take write_lock before transferring the channel ownership to
> + * the platform via a Doorbell
> + * This allows us to batch a number of CPPC requests if they happen to
> + * originate in about the same time
> + *
> + * For non-performance critical usecases(init)
> + * Take write_lock for all purposes which gives exclusive access
> */
> -static DEFINE_SPINLOCK(pcc_lock);
> +static DECLARE_RWSEM(pcc_lock);
> +
> +/* Indicates if there are any pending/batched PCC write commands */
> +static bool pending_pcc_write_cmd;
> +
> +/* Wait queue for CPUs whose requests were batched */
> +static DECLARE_WAIT_QUEUE_HEAD(pcc_write_wait_q);
> +
> +/* Used to identify if a batched request is delivered to platform */
> +static unsigned int pcc_write_cnt;
>
I haven't found a use-case(that would be used with CPPC) for POSTCHANGE
notification, that require us to be very accurate. Given that cpufreq_stats will not
be supported with CPPC and moreover CPPC protocol itself doesn't guarantee any
time bounds on when the actual request will be executed by the platform, I am
leaning towards getting rid of the wait queue that made sure delivery of request
to the platform before calling cpufreq_freq_transition_end, in the interest of better
performance and simpler code.
Thoughts?
Thanks,
Prashanth
next prev parent reply other threads:[~2016-08-09 0:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 19:45 [PATCH V2 0/5] CPPC enhancements Prashanth Prakash
2016-07-26 19:45 ` [PATCH V2 1/5] ACPI/CPPC: restructure read/writes for efficient sys mapped reg ops Prashanth Prakash
2016-07-26 19:45 ` [PATCH V2 2/5] ACPI/CPPC: acquire pcc_lock only while accessing PCC subspace Prashanth Prakash
2016-07-26 19:45 ` [PATCH V2 3/5] ACPI/CPPC: support for batching CPPC requests Prashanth Prakash
2016-08-09 0:09 ` Prakash, Prashanth [this message]
2016-08-12 12:40 ` Alexey Klimov
2016-08-12 16:27 ` Prakash, Prashanth
2016-08-12 16:32 ` Prakash, Prashanth
2016-08-12 17:42 ` Alexey Klimov
2016-08-12 21:30 ` Prakash, Prashanth
2016-08-15 13:46 ` Alexey Klimov
2016-07-26 19:45 ` [PATCH V2 4/5] ACPI/CPPC: set a non-zero value for transition_latency Prashanth Prakash
2016-08-08 11:01 ` Alexey Klimov
2016-07-26 19:45 ` [PATCH V2 5/5] ACPI/CPPC: add sysfs support to compute delivered performance 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=bf9134cd-3055-d4e3-652a-a8dee0aa9e26@codeaurora.org \
--to=pprakash@codeaurora.org \
--cc=alexey.klimov@arm.com \
--cc=cov@codeaurora.org \
--cc=hotran@apm.com \
--cc=linux-acpi@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/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