Skip to contentSkip to conversation

Optional ZONE_DMA for x86_64

PATCH In review Christoph Lameter 3 participants 5 messages Sep 11, 2006 – Sep 12, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 5/6 Optional ZONE_DMA for x86_64

x86_64: optional ZONE_DMA/ZONE_DMA32

Allow the use to specify CONFIG_ZONE_DMA32 and CONFIG_ZONE_DMA (via CONFIG_GENERIC_ISA_DMA).

If CONFIG_ZONE_DMA is off then devices requiring ISA DMA can no longer be selected.

There are no drivers depending on CONFIG_ZONE_DMA32. If CONFIG_ZONE_DMA32 is not set then the system assumes that DMA devices are capable of doing DMA to all of memory (which is mostly the case since most x86_64 motherboards only allow a max of 4GB of memory and advanced systems have DMA subsystems that handle I/O properly).

Index: linux-2.6.18-rc6-mm1/arch/x86_64/mm/init.c
=================================--- linux-2.6.18-rc6-mm1.orig/arch/x86_64/mm/init.c 2006-09-11 16:06:41.705747849 -0500
+++ linux-2.6.18-rc6-mm1/arch/x86_64/mm/init.c 2006-09-11 16:08:13.190088058 -0500
@@ -406,9 +406,15 @@
#ifndef CONFIG_NUMA
void __init paging_init(void)
{
- unsigned long max_zone_pfns[MAX_NR_ZONES] = {MAX_DMA_PFN,
- MAX_DMA32_PFN,
- end_pfn};
+ unsigned long max_zone_pfns[MAX_NR_ZONES] = {
+#ifdef CONFIG_ZONE_DMA
+ MAX_DMA_PFN,
+#endif
+#ifdef CONFIG_ZONE_DMA32
+ MAX_DMA32_PFN,
+#endif
+ end_pfn
+ };
memory_present(0, 0, end_pfn);
sparse_init();
free_area_init_nodes(max_zone_pfns);
Index: linux-2.6.18-rc6-mm1/arch/x86_64/Kconfig
=================================--- linux-2.6.18-rc6-mm1.orig/arch/x86_64/Kconfig 2006-09-11 16:06:41.713561013 -0500
+++ linux-2.6.18-rc6-mm1/arch/x86_64/Kconfig 2006-09-11 16:10:45.369039566 -0500
@@ -24,10 +24,6 @@
bool
default y

-config ZONE_DMA32
- bool
- default y
-
config LOCKDEP_SUPPORT
bool
default y
@@ -73,10 +69,6 @@
bool
default y

-config GENERIC_ISA_DMA
- bool
- default y
-
config GENERIC_IOMAP
bool
default y
@@ -251,6 +243,24 @@

See <file:Documentation/mtrr.txt> for more information.

+config ZONE_DMA32
+ bool "32 Bit DMA Zone (only needed if memory >4GB)"
+ default y
+ help

+	  Some x64 configurations have 32 bit DMA controllers that cannot
+	  write to all of memory. If you have one of these and you have RAM
+	  beyond the 4GB boundary then enable this option.

+
+config GENERIC_ISA_DMA
+ bool "ISA DMA zone (to support ISA legacy DMA)"
+ default y
+ help

+	  If DMA for ISA boards needs to be supported then this option
+	  needs to be enabled. An additional DMA zone for <16MB memory
+	  will be created and memory below 16MB will be used for those
+	  devices. If this is deselected then devices that use ISA
+	  DMA will not be selectable.

+
config SMP
bool "Symmetric multi-processing support"
---help---
@@ -611,6 +621,7 @@

 # we have no ISA slots, but we do have ISA-style DMA.
 config ISA_DMA_API
 	bool
+	depends on GENERIC_ISA_DMA
 	default y

config GENERIC_PENDING_IRQ
Index: linux-2.6.18-rc6-mm1/arch/x86_64/kernel/Makefile
=================================--- linux-2.6.18-rc6-mm1.orig/arch/x86_64/kernel/Makefile 2006-09-11 16:06:41.726257405 -0500
+++ linux-2.6.18-rc6-mm1/arch/x86_64/kernel/Makefile 2006-09-11 16:08:13.214504197 -0500
@@ -7,9 +7,10 @@
obj-y := process.o signal.o entry.o traps.o irq.o \
ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
x8664_ksyms.o i387.o syscall.o vsyscall.o \
- setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
+ setup64.o bootflag.o e820.o reboot.o quirks.o \
pci-dma.o pci-nommu.o alternative.o early-quirks.o

+obj-$(CONFIG_GENERIC_ISA_DMA) += i8237.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_X86_MCE) += mce.o
obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o

#1 lore raw
Quoted 5 lines · Christoph Lameter

x86_64: optional ZONE_DMA/ZONE_DMA32

Allow the use to specify CONFIG_ZONE_DMA32 and CONFIG_ZONE_DMA (via CONFIG_GENERIC_ISA_DMA).

Quoted 8 lines

If CONFIG_ZONE_DMA is off then devices requiring ISA DMA can no longer be selected.

There are no drivers depending on CONFIG_ZONE_DMA32. If CONFIG_ZONE_DMA32 is not set then the system assumes that DMA devices are capable of doing DMA to all of memory (which is mostly the case since most x86_64 motherboards only allow a max of 4GB of memory and advanced systems have DMA subsystems that handle I/O properly).

Pretty much all have this problem (or do you know of a system with no USB controller?)

I think I would prefer to not make GFP_DMA32 optional. Adding a 4GB limit CONFIG to a 64bit kernel just seems somewhat dumb.

Also what happens when someone still sets GFP_DMA? iirc the SCSI stack tended to do that for some structures. Will it fail?

Making GFP_DMA optional would be an interesting experiment (I think it will break the floppies but other than that a modern system might be fine). But it would be better to warn the user stronger against it (most likely it will still break a lot of older addin cards) and tell them about the floppy.

BTW we still call it x86-64, not x64.

-Andi

#2 lore raw
In reply to Christoph Lameter
Quoted 6 lines · Matthew Wilcox
Quoted 3 lines · Andi Kleen

I think I would prefer to not make GFP_DMA32 optional. Adding a 4GB limit CONFIG to a 64bit kernel just seems somewhat dumb.

Hmm? I would think that the majority of x86-64 users have <4GB.

Yes still it feels dumb, especially for something which you're unlikely to benchmark a difference of.

Quoted 6 lines

I bought an ASUS P5RD1-VM motherboard a few months ago which has 2 DIMM slots. Look at their list of 'hot' motherboards:
http://usa.asus.com/products2.aspx?l1=3&l2 I don't see a single one with more than 4 slots. 2GB DIMMs are hovering around the $400 mark; I'm not convinced that your average user is spending $1200 on RAM at this point.

4GB of RAM already gives you memory above the 32bit mark because the PCI hole needs some below 4GB. The RAM below it is moved up. So you need >4GB support even on the lowend boards when you plug in 2x 2GB.

-Andi

#3 lore raw
In reply to Christoph Lameter
Quoted 3 lines · Andi Kleen

I think I would prefer to not make GFP_DMA32 optional. Adding a 4GB limit CONFIG to a 64bit kernel just seems somewhat dumb.

Hmm? I would think that the majority of x86-64 users have <4GB. I bought an ASUS P5RD1-VM motherboard a few months ago which has 2 DIMM slots. Look at their list of 'hot' motherboards:
http://usa.asus.com/products2.aspx?l1=3&l2 I don't see a single one with more than 4 slots. 2GB DIMMs are hovering around the $400 mark; I'm not convinced that your average user is spending $1200 on RAM at this point.

#4 lore raw
In reply to Christoph Lameter
Quoted 8 lines · Andi Kleen
Quoted 5 lines

There are no drivers depending on CONFIG_ZONE_DMA32. If CONFIG_ZONE_DMA32 is not set then the system assumes that DMA devices are capable of doing DMA to all of memory (which is mostly the case since most x86_64 motherboards only allow a max of 4GB of memory and advanced systems have DMA subsystems that handle I/O properly).

Pretty much all have this problem (or do you know of a system with no USB controller?)

Most motherboards do not support more than 4GB ram.

Quoted 3 lines

I think I would prefer to not make GFP_DMA32 optional. Adding a 4GB limit CONFIG to a 64bit kernel just seems somewhat dumb.

So is delivering motherboards for 64 bit with 4GB Ram.

Quoted 3 lines

Also what happens when someone still sets GFP_DMA? iirc the SCSI stack tended to do that for some structures. Will it fail?

No it will be ignored.

Quoted 3 lines

Making GFP_DMA optional would be an interesting experiment (I think it will break the floppies but other than that a modern system might be fine). But it would be better

Right some drivers are not available anymore that includes the floppy driver.

Quoted 3 lines

to warn the user stronger against it (most likely it will still break a lot of older addin cards) and tell them about the floppy.

I still have some dusty set of floppies in my attic. Tried to use floppy a year to boot but it was such a hassle that I fell back to a usb stick.

You can still have your floppies. Just do not disable support for ZONE_DMA. Its enabled by default.