public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: [PATCH 8/9] gma500: frame buffer locking
Date: Fri, 26 Aug 2011 11:19:58 +0100	[thread overview]
Message-ID: <20110826101945.16760.8598.stgit@localhost.localdomain> (raw)
In-Reply-To: <20110826101734.16760.64364.stgit@localhost.localdomain>

From: Alan Cox <alan@linux.intel.com>

If we are the console then a printk can hit us with a spin lock held (and
in fact the kernel will do its best to take printing lock).

In that case we cannot politely sleep when synching after an accelerated op
but must behave obnixously to be sure of getting the bits out.

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/gma500/accel_2d.c |   10 ++++++----
 drivers/staging/gma500/psb_drv.c  |    2 +-
 drivers/staging/gma500/psb_drv.h  |    2 +-
 kernel/printk.c                   |    2 +-
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/gma500/accel_2d.c b/drivers/staging/gma500/accel_2d.c
index be92371..114b99a 100644
--- a/drivers/staging/gma500/accel_2d.c
+++ b/drivers/staging/gma500/accel_2d.c
@@ -111,8 +111,9 @@ static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
 	int ret = 0;
 	int i;
 	unsigned submit_size;
+	unsigned long flags;
 
-	mutex_lock(&dev_priv->mutex_2d);
+	spin_lock_irqsave(&dev_priv->lock_2d, flags);
 	while (size > 0) {
 		submit_size = (size < 0x60) ? size : 0x60;
 		size -= submit_size;
@@ -127,7 +128,7 @@ static int psbfb_2d_submit(struct drm_psb_private *dev_priv, uint32_t *cmdbuf,
 
 		(void)PSB_RSGX32(PSB_SGX_2D_SLAVE_PORT + i - 4);
 	}
-	mutex_unlock(&dev_priv->mutex_2d);
+	spin_unlock_irqrestore(&dev_priv->lock_2d, flags);
 	return ret;
 }
 
@@ -327,8 +328,9 @@ int psbfb_sync(struct fb_info *info)
 	struct drm_psb_private *dev_priv = dev->dev_private;
 	unsigned long _end = jiffies + DRM_HZ;
 	int busy = 0;
+	unsigned long flags;
 
-	mutex_lock(&dev_priv->mutex_2d);
+	spin_lock_irqsave(&dev_priv->lock_2d, flags);
 	/*
 	 * First idle the 2D engine.
 	 */
@@ -357,7 +359,7 @@ int psbfb_sync(struct fb_info *info)
 					_PSB_C2B_STATUS_BUSY) != 0);
 
 out:
-	mutex_unlock(&dev_priv->mutex_2d);
+	spin_unlock_irqrestore(&dev_priv->lock_2d, flags);
 	return (busy) ? -EBUSY : 0;
 }
 
diff --git a/drivers/staging/gma500/psb_drv.c b/drivers/staging/gma500/psb_drv.c
index 34cf24a..9470af9 100644
--- a/drivers/staging/gma500/psb_drv.c
+++ b/drivers/staging/gma500/psb_drv.c
@@ -228,7 +228,7 @@ static int psb_do_init(struct drm_device *dev)
 
 
 	spin_lock_init(&dev_priv->irqmask_lock);
-	mutex_init(&dev_priv->mutex_2d);
+	spin_lock_init(&dev_priv->lock_2d);
 
 	PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK0);
 	PSB_WSGX32(0x00000000, PSB_CR_BIF_BANK1);
diff --git a/drivers/staging/gma500/psb_drv.h b/drivers/staging/gma500/psb_drv.h
index 9cbb494..11d963a 100644
--- a/drivers/staging/gma500/psb_drv.h
+++ b/drivers/staging/gma500/psb_drv.h
@@ -612,7 +612,7 @@ struct drm_psb_private {
 	void (*exit_idle)(struct drm_device *dev, u32 update_src);
 
 	/* 2D acceleration */
-	struct mutex mutex_2d;
+	spinlock_t lock_2d;
 
 	/* FIXME: Arrays anyone ? */
 	struct mdfld_dsi_encoder *encoder0;	
diff --git a/kernel/printk.c b/kernel/printk.c
index e861488..af2eec8 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -512,7 +512,7 @@ static void __call_console_drivers(unsigned start, unsigned end)
 	struct console *con;
 
 	for_each_console(con) {
-		if (exclusive_console && con != exclusive_console)
+		if (0 && exclusive_console && con != exclusive_console)
 			continue;
 		if ((con->flags & CON_ENABLED) && con->write &&
 				(cpu_online(smp_processor_id()) ||


  parent reply	other threads:[~2011-08-26 10:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 10:17 [PATCH 1/9] gma500: Only register interrupt handler for poulsbo hardware Alan Cox
2011-08-26 10:17 ` [PATCH 2/9] gma500: Don't enable MSI on Poulsbo Alan Cox
2011-08-26 10:18 ` [PATCH 3/9] gma500: Add VBLANK support for Poulsbo hardware Alan Cox
2011-08-26 10:18 ` [PATCH 4/9] gma500: do a pass over the FIXME tags Alan Cox
2011-08-26 10:18 ` [PATCH 5/9] gma500: Convert spaces to tabs in accel_2d.c Alan Cox
2011-08-26 10:19 ` [PATCH 6/9] gma500: kill bogus code Alan Cox
2011-08-26 10:19 ` [PATCH 7/9] gma500: Fix backlight crash Alan Cox
2011-08-26 10:19 ` Alan Cox [this message]
2011-08-26 17:45   ` [PATCH 8/9] gma500: frame buffer locking Greg KH
2011-08-26 17:48     ` Greg KH
2011-08-26 18:33     ` Alan Cox
2011-08-26 10:20 ` [PATCH 9/9] gma500: Fix up suspend/resume Alan Cox

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=20110826101945.16760.8598.stgit@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox