dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH 6/7] igb_uio: pci_block_user_cfg_access is unsafe, remove it
Date: Thu, 30 May 2013 10:12:40 -0700	[thread overview]
Message-ID: <20130530171627.073469876@vyatta.com> (raw)
In-Reply-To: 20130530171234.301927271@vyatta.com

[-- Attachment #1: igb-remove-pci-lock.patch --]
[-- Type: text/plain, Size: 1983 bytes --]

Using pci_block_user_cfg_access in IRQ context is unsafe. In fact if kernel
is compiled with option to check for might_sleep() it causes a warning
and a backtrace. The problem Intel was trying to solve here can not be
solved with these functions; better to just remove them.

Signed-off-by: Stephen Hemminger <shemminger-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>


--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c	2013-03-28 08:50:50.234413869 -0700
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c	2013-05-29 16:41:30.974514849 -0700
@@ -28,15 +28,6 @@
 #include <linux/msi.h>
 #include <linux/version.h>
 
-/* Some function names changes between 3.2.0 and 3.3.0... */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
-#define PCI_LOCK pci_block_user_cfg_access
-#define PCI_UNLOCK pci_unblock_user_cfg_access
-#else
-#define PCI_LOCK pci_cfg_access_lock
-#define PCI_UNLOCK pci_cfg_access_unlock
-#endif
-
 /**
  * MSI-X related macros, copy from linux/pci_regs.h in kernel 2.6.39,
  * but none of them in kernel 2.6.35.
@@ -170,14 +161,9 @@ igbuio_pci_irqcontrol(struct uio_info *i
 {
 	unsigned long flags;
 	struct rte_uio_pci_dev *udev = igbuio_get_uio_pci_dev(info);
-	struct pci_dev *pdev = udev->pdev;
 
 	spin_lock_irqsave(&udev->lock, flags);
-	PCI_LOCK(pdev);
-
 	igbuio_set_interrupt_mask(udev, irq_state);
-
-	PCI_UNLOCK(pdev);
 	spin_unlock_irqrestore(&udev->lock, flags);
 
 	return 0;
@@ -198,8 +184,6 @@ igbuio_pci_irqhandler(int irq, struct ui
 	uint16_t status;
 
 	spin_lock_irqsave(&udev->lock, flags);
-	/* block userspace PCI config reads/writes */
-	PCI_LOCK(pdev);
 
 	/* for legacy mode, interrupt maybe shared */
 	if (udev->mode == IGBUIO_LEGACY_INTR_MODE) {
@@ -214,7 +198,6 @@ igbuio_pci_irqhandler(int irq, struct ui
 	ret = IRQ_HANDLED;
 done:
 	/* unblock userspace PCI config reads/writes */
-	PCI_UNLOCK(pdev);
 	spin_unlock_irqrestore(&udev->lock, flags);
 	printk(KERN_INFO "irq 0x%x %s\n", irq, (ret == IRQ_HANDLED) ? "handled" : "not handled");
 

  parent reply	other threads:[~2013-05-30 17:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 17:12 [PATCH 0/7] Vyatta patches Stephen Hemminger
2013-05-30 17:12 ` [PATCH 1/7] [PATCH 4/8] igb: workaround errata with wthresh on 82576 Stephen Hemminger
     [not found]   ` <20130530171626.764056062-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-06-05 14:22     ` Vincent JARDIN
     [not found]       ` <51AF499B.8020903-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-12 10:06         ` [PATCH 1/7] " Thomas Monjalon
2013-05-30 17:12 ` [PATCH 2/7] rte_timer: optimize for empty case Stephen Hemminger
     [not found]   ` <20130530171626.825256039-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-06-05 14:25     ` Vincent JARDIN
     [not found]       ` <51AF4A42.4000005-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-12 10:07         ` Thomas Monjalon
2013-05-30 17:12 ` [PATCH 3/7] optimize log/panic Stephen Hemminger
     [not found]   ` <20130530171626.884622340-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-06-05 14:34     ` Vincent JARDIN
     [not found]       ` <51AF4C82.2010603-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-12 10:09         ` Thomas Monjalon
2013-05-30 17:12 ` [PATCH 4/7] eal: support different modules Stephen Hemminger
     [not found]   ` <20130530171626.948387515-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-06-03  8:58     ` Damien Millescamps
     [not found]       ` <51AC5A99.1050207-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-03 15:41         ` Stephen Hemminger
     [not found]           ` <20130603084154.70219c8f-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2013-06-03 16:36             ` Thomas Monjalon
     [not found]               ` <201306031836.52362.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-03 17:26                 ` Stephen Hemminger
     [not found]                   ` <20130603102629.713d917c-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2013-06-04  9:17                     ` Damien Millescamps
2013-06-03 16:08         ` Antti Kantee
     [not found]           ` <51ACBF95.1030109-X3B1VOXEql0@public.gmane.org>
2013-06-03 16:29             ` Thomas Monjalon
     [not found]               ` <201306031829.02984.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-03 17:25                 ` Stephen Hemminger
2013-06-03 18:40                 ` Antti Kantee
2013-05-30 17:12 ` [PATCH 5/7] pci: support multiple PCI regions per device Stephen Hemminger
     [not found]   ` <20130530171627.005239011-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-06-03 16:41     ` Thomas Monjalon
2013-06-05 14:50     ` Damien Millescamps
     [not found]       ` <51AF501B.5060306-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-05 15:49         ` Stephen Hemminger
     [not found]           ` <20130605084927.34f138c1-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2013-06-05 18:05             ` Damien Millescamps
     [not found]               ` <51AF7DDB.1070005-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-05 21:33                 ` Stephen Hemminger
     [not found]                   ` <20130605143337.76af91ff-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2013-06-18  1:28                     ` somnath kotur
     [not found]                       ` <CAMXF-eXYRFfSvA_RhHa6tz27_JaLnkAvDN=hBZYEJB=9xg3NrQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-07-16  8:53                         ` Thomas Monjalon
     [not found]                           ` <201307161053.19175.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-07-19 16:44                             ` Stephen Hemminger
2013-05-30 17:12 ` Stephen Hemminger [this message]
2013-05-30 17:12 ` [PATCH 7/7] eal: add ability to override DPDK syslog parameters Stephen Hemminger
     [not found]   ` <20130530171627.135792331-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-06-05 14:36     ` Vincent JARDIN
     [not found]       ` <51AF4CFF.80906-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-06-12 10:18         ` Thomas Monjalon
     [not found] ` <20130530171234.301927271-ZtmgI6mnKB3QT0dZR+AlfA@public.gmane.org>
2013-05-30 22:20   ` [PATCH 0/7] Vyatta patches Thomas Monjalon
2013-05-31  9:29   ` Damien Millescamps
     [not found]     ` <51A86D65.2090003-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-05-31 15:45       ` Stephen Hemminger
     [not found]         ` <20130531084529.5c63d4c0-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org>
2013-05-31 16:44           ` Damien Millescamps
     [not found]             ` <51A8D353.50101-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-05-31 17:00               ` Stephen Hemminger
2013-06-03 15:22   ` Thomas Monjalon

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=20130530171627.073469876@vyatta.com \
    --to=shemminger-ztmgi6mnkb3qt0dzr+alfa@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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;
as well as URLs for NNTP newsgroup(s).