public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 8/9] gma500: frame buffer locking
Date: Fri, 26 Aug 2011 10:45:47 -0700	[thread overview]
Message-ID: <20110826174547.GA9937@kroah.com> (raw)
In-Reply-To: <20110826101945.16760.8598.stgit@localhost.localdomain>

On Fri, Aug 26, 2011 at 11:19:58AM +0100, Alan Cox wrote:
> 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()) ||

Are you sure you want this in the tree?  I don't feel comfortable making
this fix just for one staging driver right now, do you?

greg k-h

  reply	other threads:[~2011-08-26 17:47 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 ` [PATCH 8/9] gma500: frame buffer locking Alan Cox
2011-08-26 17:45   ` Greg KH [this message]
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=20110826174547.GA9937@kroah.com \
    --to=greg@kroah.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --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