lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 10 Aug 2011 11:40:12 +0300
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	"Hans J. Koch" <hjk@...sjkoch.de>
Cc:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Chris Wright <chrisw@...hat.com>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Anthony Foiani <anthony.foiani@...il.com>,
	linux-kernel@...r.kernel.org, stable@...nel.org
Subject: Re: [PATCH] uio/gen-pci: don't enable interrupts in ISR

On Tue, Aug 09, 2011 at 08:53:41PM +0200, Hans J. Koch wrote:
> On Tue, Aug 09, 2011 at 02:37:43PM +0300, Michael S. Tsirkin wrote:
> > > 
> > > Should I hack up a patch to remove the lock, or do you have anything in your
> > > pipeline?
> > 
> > 
> > Please do.
> > 
> 
> Here it is:
> 
> Greg (and anyone else...), you can also pull this from branch "uio-for-greg" from
> 
> git://hansjkoch.de/git/linux-hjk
> 
> 
> >From ff74627ade002d40fe1f902b7aadab8b1f15f889 Mon Sep 17 00:00:00 2001
> From: "Hans J. Koch" <hjk@...sjkoch.de>
> Date: Tue, 9 Aug 2011 20:34:31 +0200
> Subject: [PATCH] uio: uio_pci_generic: Remove useless spin_lock
> 
> The spin_lock in uio_pci_generic.c is only used in the interrupt
> handler, which cannot be executed twice at the same time.
> That makes the lock rather pointless. This patch removes it.
> 
> Cc: "Michael S. Tsirkin" <mst@...hat.com>
> Cc: Chris Wright <chrisw@...hat.com>
> Cc: Jesse Barnes <jbarnes@...tuousgeek.org>
> Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Cc: Anthony Foiani <anthony.foiani@...il.com>
> Reported-by: Anthony Foiani <anthony.foiani@...il.com>
> Reported-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> Signed-off-by: Hans J. Koch <hjk@...sjkoch.de>


Acked-by: Michael S. Tsirkin <mst@...hat.com>

I also suggest this for the stable trees.

> ---
>  drivers/uio/uio_pci_generic.c |    5 -----
>  1 files changed, 0 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/uio/uio_pci_generic.c b/drivers/uio/uio_pci_generic.c
> index fc22e1e..02bd47b 100644
> --- a/drivers/uio/uio_pci_generic.c
> +++ b/drivers/uio/uio_pci_generic.c
> @@ -24,7 +24,6 @@
>  #include <linux/pci.h>
>  #include <linux/slab.h>
>  #include <linux/uio_driver.h>
> -#include <linux/spinlock.h>
>  
>  #define DRIVER_VERSION	"0.01.0"
>  #define DRIVER_AUTHOR	"Michael S. Tsirkin <mst@...hat.com>"
> @@ -33,7 +32,6 @@
>  struct uio_pci_generic_dev {
>  	struct uio_info info;
>  	struct pci_dev *pdev;
> -	spinlock_t lock; /* guards command register accesses */
>  };
>  
>  static inline struct uio_pci_generic_dev *
> @@ -57,7 +55,6 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)
>  	BUILD_BUG_ON(PCI_COMMAND % 4);
>  	BUILD_BUG_ON(PCI_COMMAND + 2 != PCI_STATUS);
>  
> -	spin_lock_irq(&gdev->lock);
>  	pci_block_user_cfg_access(pdev);
>  
>  	/* Read both command and status registers in a single 32-bit operation.
> @@ -83,7 +80,6 @@ static irqreturn_t irqhandler(int irq, struct uio_info *info)
>  done:
>  
>  	pci_unblock_user_cfg_access(pdev);
> -	spin_unlock_irq(&gdev->lock);
>  	return ret;
>  }
>  
> @@ -158,7 +154,6 @@ static int __devinit probe(struct pci_dev *pdev,
>  	gdev->info.irq_flags = IRQF_SHARED;
>  	gdev->info.handler = irqhandler;
>  	gdev->pdev = pdev;
> -	spin_lock_init(&gdev->lock);
>  
>  	if (uio_register_device(&pdev->dev, &gdev->info))
>  		goto err_register;
> -- 
> 1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ