linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] msm:rpm-smd:change msm_rpm_smd_work method
@ 2014-09-17  2:05 Wang, Yalin
  2014-09-17 16:49 ` Bjorn Andersson
  0 siblings, 1 reply; 3+ messages in thread
From: Wang, Yalin @ 2014-09-17  2:05 UTC (permalink / raw)
  To: 'linux-arm-msm-owner@vger.kernel.org',
	Lee Jones, linux-arm-msm, linux-kernel, Srinivas Kandagatla,
	'Srinivas Kandagatla',
	David Brown, 'dwalker@fifo99.com',
	'bryanh@codeaurora.org', 'linux@arm.linux.org.uk'

this change msm_rpm_smd_work method to let it
run not as a forever loop, this can improve some
performance, because if the work_struct callback run
forever, it will hold the work thread forever, and other
work_struct can use it, it is not suitable for performance.

Change-Id: Ic99b36f8a3720b2bdfe45e4263a69f3d58c47cd1
Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com>
---
 arch/arm/mach-msm/rpm-smd.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c
index 2a01a36..243463d 100644
--- a/arch/arm/mach-msm/rpm-smd.c
+++ b/arch/arm/mach-msm/rpm-smd.c
@@ -464,8 +464,6 @@ struct msm_rpm_ack_msg {
 
 LIST_HEAD(msm_rpm_ack_list);
 
-static DECLARE_COMPLETION(data_ready);
-
 static void msm_rpm_notify_sleep_chain(struct rpm_message_header *hdr,
 		struct msm_rpm_kvp_data *kvp)
 {
@@ -654,7 +652,7 @@ static void msm_rpm_notify(void *data, unsigned event)
 
 	switch (event) {
 	case SMD_EVENT_DATA:
-		complete(&data_ready);
+		queue_work(msm_rpm_smd_wq, &msm_rpm_data.work);
 		break;
 	case SMD_EVENT_OPEN:
 		complete(&pdata->smd_open);
@@ -849,19 +847,15 @@ static void msm_rpm_smd_work(struct work_struct *work)
 	int errno;
 	char buf[MAX_ERR_BUFFER_SIZE] = {0};
 
-	while (1) {
-		wait_for_completion(&data_ready);
-
-		spin_lock(&msm_rpm_data.smd_lock_read);
-		while (smd_is_pkt_avail(msm_rpm_data.ch_info)) {
-			if (msm_rpm_read_smd_data(buf))
-				break;
-			msg_id = msm_rpm_get_msg_id_from_ack(buf);
-			errno = msm_rpm_get_error_from_ack(buf);
-			msm_rpm_process_ack(msg_id, errno);
-		}
-		spin_unlock(&msm_rpm_data.smd_lock_read);
+	spin_lock(&msm_rpm_data.smd_lock_read);
+	while (smd_is_pkt_avail(msm_rpm_data.ch_info)) {
+		if (msm_rpm_read_smd_data(buf))
+			break;
+		msg_id = msm_rpm_get_msg_id_from_ack(buf);
+		errno = msm_rpm_get_error_from_ack(buf);
+		msm_rpm_process_ack(msg_id, errno);
 	}
+	spin_unlock(&msm_rpm_data.smd_lock_read);
 }
 
 static void msm_rpm_log_request(struct msm_rpm_request *cdata)
@@ -1237,7 +1231,7 @@ wait_ack_cleanup:
 	spin_unlock_irqrestore(&msm_rpm_data.smd_lock_read, flags);
 
 	if (smd_is_pkt_avail(msm_rpm_data.ch_info))
-		complete(&data_ready);
+		queue_work(msm_rpm_smd_wq, &msm_rpm_data.work);
 	return rc;
 }
 EXPORT_SYMBOL(msm_rpm_wait_for_ack_noirq);
@@ -1385,10 +1379,10 @@ static int __devinit msm_rpm_dev_probe(struct platform_device *pdev)
 
 	if (!standalone) {
 		msm_rpm_smd_wq = alloc_workqueue("rpm-smd",
-				WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI, 1);
+				WQ_UNBOUND | WQ_MEM_RECLAIM |
+				WQ_HIGHPRI | WQ_NON_REENTRANT, 1);
 		if (!msm_rpm_smd_wq)
 			return -EINVAL;
-		queue_work(msm_rpm_smd_wq, &msm_rpm_data.work);
 	}
 
 	of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC] msm:rpm-smd:change msm_rpm_smd_work method
  2014-09-17  2:05 [RFC] msm:rpm-smd:change msm_rpm_smd_work method Wang, Yalin
@ 2014-09-17 16:49 ` Bjorn Andersson
  2014-09-18  1:48   ` Wang, Yalin
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Andersson @ 2014-09-17 16:49 UTC (permalink / raw)
  To: Wang, Yalin
  Cc: linux-arm-msm-owner, Lee Jones, linux-arm-msm, linux-kernel,
	Srinivas Kandagatla, David Brown, dwalker, bryanh, linux

On Tue, Sep 16, 2014 at 7:05 PM, Wang, Yalin <Yalin.Wang@sonymobile.com> wrote:
[..]
> diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c

Hi Yalin,

This file does not exist in mainline and this is not the forum for
sending patches to codeaurora.
Also note that your commit messages may not include "Change-id" when
sending to LKML.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [RFC] msm:rpm-smd:change msm_rpm_smd_work method
  2014-09-17 16:49 ` Bjorn Andersson
@ 2014-09-18  1:48   ` Wang, Yalin
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Yalin @ 2014-09-18  1:48 UTC (permalink / raw)
  To: 'Bjorn Andersson'
  Cc: linux-arm-msm-owner, Lee Jones, linux-arm-msm, linux-kernel,
	Srinivas Kandagatla, David Brown, dwalker, bryanh, linux

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 607 bytes --]

Hi Bjorn,

I see,
Thanks for your kind remind :)

-----Original Message-----
On Tue, Sep 16, 2014 at 7:05 PM, Wang, Yalin <Yalin.Wang@sonymobile.com> wrote:
[..]
> diff --git a/arch/arm/mach-msm/rpm-smd.c b/arch/arm/mach-msm/rpm-smd.c

Hi Yalin,

This file does not exist in mainline and this is not the forum for sending patches to codeaurora.
Also note that your commit messages may not include "Change-id" when sending to LKML.

Regards,
Bjorn
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-18  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-17  2:05 [RFC] msm:rpm-smd:change msm_rpm_smd_work method Wang, Yalin
2014-09-17 16:49 ` Bjorn Andersson
2014-09-18  1:48   ` Wang, Yalin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).