Re: Linux 2.6.27-rc5: System boot regression caused by commit a2bd7274b47124d2fc4dfdb8c0591f545ba749dd

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Friday, August 29, 2008 - 11:11 pm

On Fri, 29 Aug 2008, Yinghai Lu wrote:

Ok, this is actually when the driver wants to reserve the BAR, and then it 
norices that there is an existing "reservation" there.

So yes, drivers will care - they literally will think that somebody else 
owns their resource if they have a BUSY resource inside of them. So this 
is a driver protecting against another driver.

The sad part is that it looks like it's entirely due to the PCI code 
trying to emulate an ISA driver model, and use a flat resource space - so 
it hits the upper resources first.

Does this patch make a difference? It actually removes a fair chunk of 
code, by just saying "we really don't care if the resource is IO or MEM, 
we just want to reserve space inside of it, regardless of type".

Untested - obviously.

		Linus

---
 drivers/pci/pci.c |   26 +++++++++-----------------
 1 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c9884bb..a3de4fe 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1304,15 +1304,11 @@ pci_get_interrupt_pin(struct pci_dev *dev, struct pci_dev **bridge)
 void pci_release_region(struct pci_dev *pdev, int bar)
 {
 	struct pci_devres *dr;
+	struct resource *res = pdev->resource + bar;
 
 	if (pci_resource_len(pdev, bar) == 0)
 		return;
-	if (pci_resource_flags(pdev, bar) & IORESOURCE_IO)
-		release_region(pci_resource_start(pdev, bar),
-				pci_resource_len(pdev, bar));
-	else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM)
-		release_mem_region(pci_resource_start(pdev, bar),
-				pci_resource_len(pdev, bar));
+	__release_region(res, pci_resource_start(pdev, bar), pci_resource_len(pdev, bar));
 
 	dr = find_pci_dr(pdev);
 	if (dr)
@@ -1336,20 +1332,16 @@ void pci_release_region(struct pci_dev *pdev, int bar)
 int pci_request_region(struct pci_dev *pdev, int bar, const char *res_name)
 {
 	struct pci_devres *dr;
+	struct resource *res = pdev->resource + bar;
 
 	if (pci_resource_len(pdev, bar) == 0)
 		return 0;
-		
-	if (pci_resource_flags(pdev, bar) & IORESOURCE_IO) {
-		if (!request_region(pci_resource_start(pdev, bar),
-			    pci_resource_len(pdev, bar), res_name))
-			goto err_out;
-	}
-	else if (pci_resource_flags(pdev, bar) & IORESOURCE_MEM) {
-		if (!request_mem_region(pci_resource_start(pdev, bar),
-				        pci_resource_len(pdev, bar), res_name))
-			goto err_out;
-	}
+
+	if (!res->parent)
+		goto err_out;
+
+	if (!__request_region(res, pci_resource_start(pdev, bar), pci_resource_len(pdev, bar), res_name))
+		goto err_out;
 
 	dr = find_pci_dr(pdev);
 	if (dr)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Linux 2.6.27-rc5, Linus Torvalds, (Thu Aug 28, 4:26 pm)
cpu time oddity (was Re: Linux 2.6.27-rc5), Alistair John Strachan, (Fri Aug 29, 8:42 am)
Re: cpu time oddity (was Re: Linux 2.6.27-rc5), Alistair John Strachan, (Fri Aug 29, 8:56 am)
Re: Linux 2.6.27-rc5, Rafael J. Wysocki, (Fri Aug 29, 10:13 am)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Fri Aug 29, 12:57 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Fri Aug 29, 3:30 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Fri Aug 29, 3:31 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Fri Aug 29, 3:32 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Fri Aug 29, 3:47 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Linus Torvalds, (Fri Aug 29, 11:11 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 6:32 am)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 10:14 am)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 12:20 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 12:29 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 12:51 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 1:46 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sat Aug 30, 2:34 pm)
Re: Linux 2.6.27-rc5: System boot regression caused by com ..., Rafael J. Wysocki, (Sun Aug 31, 5:27 am)
Re: Linux 2.6.27-rc5, J.A. , (Sun Aug 31, 4:27 pm)