linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] omap: mailbox: cleanup & simplify
@ 2010-05-02 15:44 Ohad Ben-Cohen
  2010-05-02 15:44 ` [PATCH v2 1/4] omap: mailbox: convert rwlocks to spinlock Ohad Ben-Cohen
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Ohad Ben-Cohen @ 2010-05-02 15:44 UTC (permalink / raw)
  To: linux-omap; +Cc: Kanigeri Hari, Hiroshi Doyu, Ohad Ben-Cohen

This series include comments from Hiroshi and Hari (thanks!).

Changes since v1:
- add mbox_kfifo_size module parameter
- WARN_ON kfifo anomalies
- remove redundant blkdev.h file
- fix rwlocks->spinlock conversion

Thanks,
Ohad.

---
If you want, you can also reach me at < ohadb at ti dot com >.

Ohad Ben-Cohen (4):
  omap: mailbox: convert rwlocks to spinlock
  omap: mailbox cleanup: split MODULE_AUTHOR line
  omap: mailbox: fix reverse likeliness
  omap: mailbox: convert block api to kfifo

 arch/arm/mach-omap2/mailbox.c             |    3 +-
 arch/arm/plat-omap/Kconfig                |    9 ++
 arch/arm/plat-omap/include/plat/mailbox.h |    4 +-
 arch/arm/plat-omap/mailbox.c              |  144 +++++++++++++----------------
 4 files changed, 79 insertions(+), 81 deletions(-)


^ permalink raw reply	[flat|nested] 25+ messages in thread
* [PATCH 1/4] omap: mailbox: convert rwlocks to spinlock
@ 2010-05-10  9:16 Hiroshi DOYU
  2010-05-10  9:16 ` [PATCH 4/4] omap: mailbox: convert block api to kfifo Hiroshi DOYU
  0 siblings, 1 reply; 25+ messages in thread
From: Hiroshi DOYU @ 2010-05-10  9:16 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: linux-omap, Ohad Ben-Cohen, Kanigeri Hari, Hiroshi DOYU

From: Ohad Ben-Cohen <ohad@wizery.com>

rwlocks are slower and have potential starvation issues
therefore spinlocks are generally preferred.

see also: http://lwn.net/Articles/364583/

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: Kanigeri Hari <h-kanigeri2@ti.com>
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
---
 arch/arm/plat-omap/mailbox.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 08a2df7..af3a6ac 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -31,7 +31,7 @@
 
 static struct workqueue_struct *mboxd;
 static struct omap_mbox *mboxes;
-static DEFINE_RWLOCK(mboxes_lock);
+static DEFINE_SPINLOCK(mboxes_lock);
 
 static int mbox_configured;
 
@@ -249,16 +249,16 @@ static int omap_mbox_startup(struct omap_mbox *mbox)
 	struct omap_mbox_queue *mq;
 
 	if (likely(mbox->ops->startup)) {
-		write_lock(&mboxes_lock);
+		spin_lock(&mboxes_lock);
 		if (!mbox_configured)
 			ret = mbox->ops->startup(mbox);
 
 		if (unlikely(ret)) {
-			write_unlock(&mboxes_lock);
+			spin_unlock(&mboxes_lock);
 			return ret;
 		}
 		mbox_configured++;
-		write_unlock(&mboxes_lock);
+		spin_unlock(&mboxes_lock);
 	}
 
 	ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED,
@@ -304,12 +304,12 @@ static void omap_mbox_fini(struct omap_mbox *mbox)
 	free_irq(mbox->irq, mbox);
 
 	if (unlikely(mbox->ops->shutdown)) {
-		write_lock(&mboxes_lock);
+		spin_lock(&mboxes_lock);
 		if (mbox_configured > 0)
 			mbox_configured--;
 		if (!mbox_configured)
 			mbox->ops->shutdown(mbox);
-		write_unlock(&mboxes_lock);
+		spin_unlock(&mboxes_lock);
 	}
 }
 
@@ -330,14 +330,14 @@ struct omap_mbox *omap_mbox_get(const char *name)
 	struct omap_mbox *mbox;
 	int ret;
 
-	read_lock(&mboxes_lock);
+	spin_lock(&mboxes_lock);
 	mbox = *(find_mboxes(name));
 	if (mbox == NULL) {
-		read_unlock(&mboxes_lock);
+		spin_unlock(&mboxes_lock);
 		return ERR_PTR(-ENOENT);
 	}
 
-	read_unlock(&mboxes_lock);
+	spin_unlock(&mboxes_lock);
 
 	ret = omap_mbox_startup(mbox);
 	if (ret)
@@ -363,15 +363,15 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
 	if (mbox->next)
 		return -EBUSY;
 
-	write_lock(&mboxes_lock);
+	spin_lock(&mboxes_lock);
 	tmp = find_mboxes(mbox->name);
 	if (*tmp) {
 		ret = -EBUSY;
-		write_unlock(&mboxes_lock);
+		spin_unlock(&mboxes_lock);
 		goto err_find;
 	}
 	*tmp = mbox;
-	write_unlock(&mboxes_lock);
+	spin_unlock(&mboxes_lock);
 
 	return 0;
 
@@ -384,18 +384,18 @@ int omap_mbox_unregister(struct omap_mbox *mbox)
 {
 	struct omap_mbox **tmp;
 
-	write_lock(&mboxes_lock);
+	spin_lock(&mboxes_lock);
 	tmp = &mboxes;
 	while (*tmp) {
 		if (mbox == *tmp) {
 			*tmp = mbox->next;
 			mbox->next = NULL;
-			write_unlock(&mboxes_lock);
+			spin_unlock(&mboxes_lock);
 			return 0;
 		}
 		tmp = &(*tmp)->next;
 	}
-	write_unlock(&mboxes_lock);
+	spin_unlock(&mboxes_lock);
 
 	return -EINVAL;
 }
-- 
1.7.1.rc1


^ permalink raw reply related	[flat|nested] 25+ messages in thread
* [PATCH 0/4] omap: mailbox: cleanup & simplify
@ 2010-04-27 17:56 Ohad Ben-Cohen
  2010-04-27 17:56 ` [PATCH 4/4] omap: mailbox: convert block api to kfifo Ohad Ben-Cohen
  0 siblings, 1 reply; 25+ messages in thread
From: Ohad Ben-Cohen @ 2010-04-27 17:56 UTC (permalink / raw)
  To: linux-omap; +Cc: Kanigeri Hari, Hiroshi Doyu, Ohad Ben-Cohen

A few simple patches that cleanup and simplifies mailbox.
The last patch is the most interesting -
It converts mailbox to use kfifo as the underlying
queueing implementation instead of using the block API.
There're also additional performance patches on the way, we
are internally testing them now.

Please review and let me know your comments.

Thanks,

Ohad Ben-Cohen (4):
  omap: mailbox cleanup: convert rwlocks to spinlock
  omap: mailbox cleanup: split MODULE_AUTHOR line
  omap: mailbox: fix reverse likeliness
  omap: mailbox: convert block api to kfifo

 arch/arm/mach-omap2/mailbox.c             |    3 +-
 arch/arm/plat-omap/include/plat/mailbox.h |    5 +-
 arch/arm/plat-omap/mailbox.c              |  135 +++++++++++++----------------
 3 files changed, 68 insertions(+), 75 deletions(-)


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

end of thread, other threads:[~2010-05-10  9:17 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02 15:44 [PATCH v2 0/4] omap: mailbox: cleanup & simplify Ohad Ben-Cohen
2010-05-02 15:44 ` [PATCH v2 1/4] omap: mailbox: convert rwlocks to spinlock Ohad Ben-Cohen
2010-05-02 15:44 ` [PATCH v2 2/4] omap: mailbox cleanup: split MODULE_AUTHOR line Ohad Ben-Cohen
2010-05-02 15:44 ` [PATCH v2 3/4] omap: mailbox: fix reverse likeliness Ohad Ben-Cohen
2010-05-03 18:02   ` Tony Lindgren
2010-05-04 11:47     ` Ohad Ben-Cohen
2010-05-05 15:21       ` Tony Lindgren
2010-05-05 15:24         ` Ohad Ben-Cohen
2010-05-06  5:19         ` Hiroshi DOYU
2010-05-02 15:44 ` [PATCH v2 4/4] omap: mailbox: convert block api to kfifo Ohad Ben-Cohen
2010-05-03  5:30   ` Hiroshi DOYU
2010-05-03  6:07     ` Hiroshi DOYU
2010-05-03  9:41       ` Ohad Ben-Cohen
2010-05-03 10:27         ` [PATCH " Ohad Ben-Cohen
2010-05-03  6:35     ` [PATCH v2 " Ohad Ben-Cohen
  -- strict thread matches above, loose matches on Subject: below --
2010-05-10  9:16 [PATCH 1/4] omap: mailbox: convert rwlocks to spinlock Hiroshi DOYU
2010-05-10  9:16 ` [PATCH 4/4] omap: mailbox: convert block api to kfifo Hiroshi DOYU
2010-04-27 17:56 [PATCH 0/4] omap: mailbox: cleanup & simplify Ohad Ben-Cohen
2010-04-27 17:56 ` [PATCH 4/4] omap: mailbox: convert block api to kfifo Ohad Ben-Cohen
2010-04-28  5:52   ` Hiroshi DOYU
2010-04-28 11:02     ` Ohad Ben-Cohen
2010-04-28 11:16       ` Hiroshi DOYU
2010-04-28 11:25         ` Ohad Ben-Cohen
2010-04-28 11:52           ` Hiroshi DOYU
2010-04-28 12:03             ` Ohad Ben-Cohen
2010-04-28  5:56   ` Hiroshi DOYU
2010-04-28 11:02     ` Ohad Ben-Cohen

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).