Re: 2.6.28-rc2 hates my e1000e

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Friday, October 31, 2008 - 9:24 am

On Fri, 31 Oct 2008, Jonathan Corbet wrote:

Ahahhh! My bad. I think this was actually discussed back when the whole 
reserved-memory-handling thing was being worked on, but it got ignored 
because none of the developers actually ever had any machines with this 
issue, and the whole (and only) reason for the change was some odd sound 
card initialization issue if I recall correctly.

The problem (I think) is that the e820 resource handling doesn't insert 
the resources as some kind of magic PCI resource, but it inserts them as a 
"I am a driver, and I actively _use_ this resource".

Which means that it all ends up being very busy, and then when a PCI 
driver says "I now want to use this", you get EBUSY.

Does this patch work for you?

A resource doesn't have to be busy for the resource allocator to try to 
avoid it, so the only thing that BUSY bit does is to not allow people who 
_do_ want to use the resources they know about from using them.

So we should mark the resources busy only if we _really_ use them (like 
the kernel *RAM* resources).

Oh, and this time the patch even compiles. It includes the previous 
change, obviously.

Btw, this shows another (unrelated) issue: the BUSY bit (along with 
various other resource flags) doesn't show up in /proc/iomem, so these 
kinds of issues end up being debugged totally "blind". Not good.

		Linus

---
 arch/x86/kernel/e820.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index ce97bf3..7aafeb5 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1290,15 +1290,17 @@ void __init e820_reserve_resources(void)
 		res->start = e820.map[i].addr;
 		res->end = end;
 
-		res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
+		res->flags = IORESOURCE_MEM;
 
 		/*
 		 * don't register the region that could be conflicted with
 		 * pci device BAR resource and insert them later in
 		 * pcibios_resource_survey()
 		 */
-		if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20))
+		if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20)) {
+			res->flags |= IORESOURCE_BUSY;
 			insert_resource(&iomem_resource, res);
+		}
 		res++;
 	}
 
@@ -1318,7 +1320,7 @@ void __init e820_reserve_resources_late(void)
 	res = e820_res;
 	for (i = 0; i < e820.nr_map; i++) {
 		if (!res->parent && res->end)
-			reserve_region_with_split(&iomem_resource, res->start, res->end, res->name);
+			insert_resource_expand_to_fit(&iomem_resource, res);
 		res++;
 	}
 }
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: 2.6.28-rc2 hates my e1000e, Robert Hancock, (Thu Oct 30, 5:45 pm)
Re: 2.6.28-rc2 hates my e1000e, Jonathan Corbet, (Thu Oct 30, 7:58 pm)
Re: 2.6.28-rc2 hates my e1000e, Yinghai Lu, (Thu Oct 30, 9:08 pm)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Fri Oct 31, 8:07 am)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Fri Oct 31, 8:44 am)
Re: 2.6.28-rc2 hates my e1000e, Jonathan Corbet, (Fri Oct 31, 9:00 am)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Fri Oct 31, 9:24 am)
Re: 2.6.28-rc2 hates my e1000e, Yinghai Lu, (Fri Oct 31, 9:35 am)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Fri Oct 31, 9:46 am)
Re: 2.6.28-rc2 hates my e1000e, Jonathan Corbet, (Fri Oct 31, 9:51 am)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Fri Oct 31, 9:58 am)
Re: 2.6.28-rc2 hates my e1000e, Yinghai Lu, (Fri Oct 31, 1:20 pm)
Re: 2.6.28-rc2 hates my e1000e, Jonathan Corbet, (Sat Nov 1, 8:01 am)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Sat Nov 1, 10:16 am)
Re: 2.6.28-rc2 hates my e1000e, Steven Rostedt, (Sat Nov 1, 10:35 am)
Re: 2.6.28-rc2 hates my e1000e, Yinghai Lu, (Sat Nov 1, 12:50 pm)
Re: 2.6.28-rc2 hates my e1000e, Jonathan Corbet, (Sat Nov 1, 3:45 pm)
Re: 2.6.28-rc2 hates my e1000e, Yinghai Lu, (Sat Nov 1, 3:47 pm)
Re: 2.6.28-rc2 hates my e1000e, Linus Torvalds, (Sat Nov 1, 4:18 pm)
Re: 2.6.28-rc2 hates my e1000e, Robert Hancock, (Sat Nov 1, 6:26 pm)