All of lore.kernel.org
 help / color / mirror / Atom feed
From: Prashanth Prakash <pprakash@codeaurora.org>
To: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org, linaro-acpi@lists.linaro.org,
	ashwin.chaugule@linaro.org, alexey.klimov@arm.com,
	timur@codeaurora.org, Prashanth Prakash <pprakash@codeaurora.org>
Subject: [PATCH V3 4/4] acpi: cppc: replace writeX/readX to PCC with relaxed version
Date: Wed, 10 Feb 2016 13:06:02 -0700	[thread overview]
Message-ID: <1455134762-31400-5-git-send-email-pprakash@codeaurora.org> (raw)
In-Reply-To: <1455134762-31400-1-git-send-email-pprakash@codeaurora.org>

We do not have a strict read/write order requirement while accessing
PCC subspace. The only requirement is all access should be committed
before triggering the PCC doorbell to transfer the ownership of PCC
to the platform and this requirement is enforced by the PCC driver.

Profiling on a many core system shows improvement of about 1.8us on
average per freq change request(about 10% improvement on average).
Since these operations are executed while holding the pcc_lock,
reducing this time helps the CPPC implementation to scale much
better as the number of cores increases.

Signed-off-by: Prashanth Prakash <pprakash@codeaurora.org>
Acked-by: Ashwin Chaugule <ashwin.chaugule@linaro.org>
---
 drivers/acpi/cppc_acpi.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index b7d92a4..2f144dd 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -116,10 +116,10 @@ static int send_pcc_cmd(u16 cmd)
 	}
 
 	/* Write to the shared comm region. */
-	writew(cmd, &generic_comm_base->command);
+	writew_relaxed(cmd, &generic_comm_base->command);
 
 	/* Flip CMD COMPLETE bit */
-	writew(0, &generic_comm_base->status);
+	writew_relaxed(0, &generic_comm_base->status);
 
 	/* Ring doorbell */
 	ret = mbox_send_message(pcc_channel, &cmd);
@@ -601,16 +601,16 @@ static int cpc_read(struct cpc_reg *reg, u64 *val)
 
 		switch (reg->bit_width) {
 		case 8:
-			*val = readb(vaddr);
+			*val = readb_relaxed(vaddr);
 			break;
 		case 16:
-			*val = readw(vaddr);
+			*val = readw_relaxed(vaddr);
 			break;
 		case 32:
-			*val = readl(vaddr);
+			*val = readl_relaxed(vaddr);
 			break;
 		case 64:
-			*val = readq(vaddr);
+			*val = readq_relaxed(vaddr);
 			break;
 		default:
 			pr_debug("Error: Cannot read %u bit width from PCC\n",
@@ -632,16 +632,16 @@ static int cpc_write(struct cpc_reg *reg, u64 val)
 
 		switch (reg->bit_width) {
 		case 8:
-			writeb(val, vaddr);
+			writeb_relaxed(val, vaddr);
 			break;
 		case 16:
-			writew(val, vaddr);
+			writew_relaxed(val, vaddr);
 			break;
 		case 32:
-			writel(val, vaddr);
+			writel_relaxed(val, vaddr);
 			break;
 		case 64:
-			writeq(val, vaddr);
+			writeq_relaxed(val, vaddr);
 			break;
 		default:
 			pr_debug("Error: Cannot write %u bit width to PCC\n",
-- 
Qualcomm Technologies, Inc. on behalf
of the Qualcomm Innovation Center, Inc.  The Qualcomm Innovation Center, Inc. 
is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.


      parent reply	other threads:[~2016-02-10 20:06 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
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 ` Prashanth Prakash [this message]

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=1455134762-31400-5-git-send-email-pprakash@codeaurora.org \
    --to=pprakash@codeaurora.org \
    --cc=alexey.klimov@arm.com \
    --cc=ashwin.chaugule@linaro.org \
    --cc=linaro-acpi@lists.linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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.