Skip to contentSkip to conversation

modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW-IOMMU.

PATCH Superseded Wang Xiaoming 2 participants 9 messages Feb 17, 2015 – Feb 18, 2015

Subsystems (6)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW-IOMMU.

The maximum of SW-IOMMU is limited to 2^11*128 = 256K.
And the size of IO_TLB_DEFAULT_SIZE is limited to (64UL<<20) 64M. While in different platform and different requirement this seems improper. So modifing the IO_TLB_SEGSIZE to io_tlb_segsize and IO_TLB_DEFAULT_SIZE to io_tlb_default_size which can configure by kernel cmdline. This can meet different requirement.

---
patch v1 make this change at Kconfig
which needs to edit the .config manually.
https://lkml.org/lkml/2015/1/25/571

patch v2 only change IO_TLB_SEGSIZE configurable
https://lkml.org/lkml/2015/2/5/812

patch v3 parsing io_tlb_segsize and
io_tlb_default_size independently
https://lkml.org/lkml/2015/2/15/217

 Documentation/kernel-parameters.txt  |    4 ++-
 arch/mips/cavium-octeon/dma-octeon.c |    2 +-
 arch/mips/netlogic/common/nlm-dma.c  |    2 +-
 drivers/xen/swiotlb-xen.c            |    6 ++--
 include/linux/swiotlb.h              |    8 +----
 lib/swiotlb.c                        |   57 ++++++++++++++++++++++++----------
 6 files changed, 49 insertions(+), 30 deletions(-)
Documentation/kernel-parameters.txt +3 -1
index 4df73da..dd03ff0 100644
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			it if 0 is given (See Documentation/cgroups/memory.txt)
 
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous slabs to map
+			<int> -- The size of SW-MMU mapped.
 
 	switches=	[HW,M68k]
 
arch/mips/cavium-octeon/dma-octeon.c +1 -1
index 3778655..a521af6 100644
@@ -312,7 +312,7 @@ void __init plat_swiotlb_setup(void)
 		swiotlbsize = 64 * (1<<20);
 #endif
 	swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
-	swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
+	swiotlb_nslabs = ALIGN(swiotlb_nslabs, io_tlb_segsize);
 	swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
 
 	octeon_swiotlb = alloc_bootmem_low_pages(swiotlbsize);
arch/mips/netlogic/common/nlm-dma.c +1 -1
index f3d4ae8..eeffa8f 100644
@@ -99,7 +99,7 @@ void __init plat_swiotlb_setup(void)
 
 	swiotlbsize = 1 << 20; /* 1 MB for now */
 	swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
-	swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
+	swiotlb_nslabs = ALIGN(swiotlb_nslabs, io_tlb_segsize);
 	swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
 
 	nlm_swiotlb = alloc_bootmem_low_pages(swiotlbsize);
drivers/xen/swiotlb-xen.c +3 -3
index 810ad41..3b3e9fe 100644
@@ -164,11 +164,11 @@ xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
 	dma_addr_t dma_handle;
 	phys_addr_t p = virt_to_phys(buf);
 
-	dma_bits = get_order(IO_TLB_SEGSIZE << IO_TLB_SHIFT) + PAGE_SHIFT;
+	dma_bits = get_order(io_tlb_segsize << IO_TLB_SHIFT) + PAGE_SHIFT;
 
 	i = 0;
 	do {
-		int slabs = min(nslabs - i, (unsigned long)IO_TLB_SEGSIZE);
+		int slabs = min(nslabs - i, (unsigned long)io_tlb_segsize);
 
 		do {
 			rc = xen_create_contiguous_region(
@@ -187,7 +187,7 @@ static unsigned long xen_set_nslabs(unsigned long nr_tbl)
 {
 	if (!nr_tbl) {
 		xen_io_tlb_nslabs = (64 * 1024 * 1024 >> IO_TLB_SHIFT);
-		xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, IO_TLB_SEGSIZE);
+		xen_io_tlb_nslabs = ALIGN(xen_io_tlb_nslabs, io_tlb_segsize);
 	} else
 		xen_io_tlb_nslabs = nr_tbl;
 
include/linux/swiotlb.h +1 -7
index e7a018e..13506db 100644
@@ -8,13 +8,7 @@ struct dma_attrs;
 struct scatterlist;
 
 extern int swiotlb_force;
-
-/*
- * Maximum allowable number of contiguous slabs to map,
- * must be a power of 2.  What is the appropriate value ?
- * The complexity of {map,unmap}_single is linearly dependent on this value.
- */
-#define IO_TLB_SEGSIZE	128
+extern int io_tlb_segsize;
 
 /*
  * log of the size of each IO TLB slab.  The number of slabs is command line
lib/swiotlb.c +40 -17

143 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can also be 

entirely omitted.

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 10 lines
Documentation/kernel-parameters.txt +3 -1
 			it if 0 is given (See Documentation/cgroups/memory.txt)
 
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous slabs to map
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their validity?

Jan

#8 lore raw
In reply to Wang Xiaoming
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can also be 

entirely omitted.

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 10 lines
Documentation/kernel-parameters.txt +3 -1
 			it if 0 is given (See Documentation/cgroups/memory.txt)
 
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous slabs to map
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their validity?

Jan

#2 lore raw
In reply to Jan Beulich

Dear Jan

Quoted 31 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 17, 2015 6:09 PM
To: Wang, Xiaoming
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Liu, Chuansheng; Zhang, Dongxing; [email protected]; [email protected]; [email protected]; ralf@linux- mips.org; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v4] modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW- IOMMU.

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can

also be entirely omitted.
it if 0 is given (See

Documentation/cgroups/memory.txt)

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted.

Quoted 8 lines
Documentation/kernel-parameters.txt +2 -1
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous

slabs to map

Quoted 5 lines

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 1 line
Documentation/kernel-parameters.txt +1 -0
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Use "," can separate them one by one. We do it at lib/swiotlb.c

Quoted 3 lines

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

I have change all uses of IO_TLB_DEFAULT_SIZE to io_tlb_default_size in lib/swiotlb.c

Quoted 3 lines

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their validity?

I have validity these code is OK.
Example:
BOARD_KERNEL_CMDLINE += swiotlb=, ,512,268435456 Io_tlb_segsize has been changed from 128 to 512 Io_tlb_default_size has been changed from 64M to 268435456 (256M)

Quoted 1 line

Jan

Xiaoming.

#7 lore raw
In reply to Jan Beulich

Dear Jan

Quoted 31 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 17, 2015 6:09 PM
To: Wang, Xiaoming
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Liu, Chuansheng; Zhang, Dongxing; [email protected]; [email protected]; [email protected]; ralf@linux- mips.org; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH v4] modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW- IOMMU.

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can

also be entirely omitted.
it if 0 is given (See

Documentation/cgroups/memory.txt)

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted.

Quoted 8 lines
Documentation/kernel-parameters.txt +2 -1
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous

slabs to map

Quoted 5 lines

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 1 line
Documentation/kernel-parameters.txt +1 -0
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Use "," can separate them one by one. We do it at lib/swiotlb.c

Quoted 3 lines

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

I have change all uses of IO_TLB_DEFAULT_SIZE to io_tlb_default_size in lib/swiotlb.c

Quoted 3 lines

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their validity?

I have validity these code is OK.
Example:
BOARD_KERNEL_CMDLINE += swiotlb=, ,512,268435456 Io_tlb_segsize has been changed from 128 to 512 Io_tlb_default_size has been changed from 64M to 268435456 (256M)

Quoted 1 line

Jan

Xiaoming.

#3 lore raw
In reply to Wang, Xiaoming
Quoted 19 lines
Quoted 19 lines
Quoted 1 line · On 18.02.15 at 10:09, <[email protected]> wrote:

From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 17, 2015 6:09 PM

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can

also be entirely omitted.
it if 0 is given (See

Documentation/cgroups/memory.txt)

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted.

Quoted 8 lines
Documentation/kernel-parameters.txt +2 -1
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous

slabs to map

Quoted 7 lines
Quoted 5 lines

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 1 line
Documentation/kernel-parameters.txt +1 -0
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Use "," can separate them one by one. We do it at lib/swiotlb.c

Right, but the documentation above doesn't say so.

Quoted 5 lines
Quoted 3 lines

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

I have change all uses of IO_TLB_DEFAULT_SIZE to io_tlb_default_size in lib/swiotlb.c

Then are there any left elsewhere? If not, again - why don't you remove the definition of IO_TLB_DEFAULT_SIZE?

Quoted 8 lines
Quoted 3 lines

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their validity?

I have validity these code is OK.
Example:
BOARD_KERNEL_CMDLINE += swiotlb=, ,512,268435456 Io_tlb_segsize has been changed from 128 to 512 Io_tlb_default_size has been changed from 64M to 268435456 (256M)

I specifically said "arbitrary numbers", which in particular includes zero and non-power-of-2 values. If there are any restrictions on which numbers can validly be passed here (and it very much looks like there are), such restrictions should be enforced imo.

Jan

#6 lore raw
In reply to Wang, Xiaoming
Quoted 19 lines
Quoted 19 lines
Quoted 1 line · On 18.02.15 at 10:09, <[email protected]> wrote:

From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 17, 2015 6:09 PM

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes can

also be entirely omitted.
it if 0 is given (See

Documentation/cgroups/memory.txt)

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted.

Quoted 8 lines
Documentation/kernel-parameters.txt +2 -1
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous

slabs to map

Quoted 7 lines
Quoted 5 lines

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 1 line
Documentation/kernel-parameters.txt +1 -0
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Use "," can separate them one by one. We do it at lib/swiotlb.c

Right, but the documentation above doesn't say so.

Quoted 5 lines
Quoted 3 lines

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

I have change all uses of IO_TLB_DEFAULT_SIZE to io_tlb_default_size in lib/swiotlb.c

Then are there any left elsewhere? If not, again - why don't you remove the definition of IO_TLB_DEFAULT_SIZE?

Quoted 8 lines
Quoted 3 lines

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their validity?

I have validity these code is OK.
Example:
BOARD_KERNEL_CMDLINE += swiotlb=, ,512,268435456 Io_tlb_segsize has been changed from 128 to 512 Io_tlb_default_size has been changed from 64M to 268435456 (256M)

I specifically said "arbitrary numbers", which in particular includes zero and non-power-of-2 values. If there are any restrictions on which numbers can validly be passed here (and it very much looks like there are), such restrictions should be enforced imo.

Jan

#4 lore raw
In reply to Jan Beulich

Dear Jan

Quoted 39 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Wednesday, February 18, 2015 5:35 PM
To: Wang, Xiaoming
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Liu, Chuansheng; Zhang, Dongxing; [email protected]; [email protected]; [email protected]; ralf@linux- mips.org; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH v4] modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW- IOMMU.

Quoted 24 lines
Quoted 24 lines
Quoted 1 line · On 18.02.15 at 10:09, <[email protected]> wrote:

From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 17, 2015 6:09 PM

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes

can also be entirely omitted.
it if 0 is given (See

Documentation/cgroups/memory.txt)

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted.

Quoted 8 lines
Documentation/kernel-parameters.txt +2 -1
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous

slabs to map

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 1 line
Documentation/kernel-parameters.txt +1 -0
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Quoted 5 lines
Quoted 2 lines

Use "," can separate them one by one.
We do it at lib/swiotlb.c

Right, but the documentation above doesn't say so.

OK, I will add some comments on next patch version.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

I have change all uses of IO_TLB_DEFAULT_SIZE to io_tlb_default_size in lib/swiotlb.c

Then are there any left elsewhere? If not, again - why don't you remove the definition of IO_TLB_DEFAULT_SIZE?

There hasn't any IO_TLB_DEFAULT_SIZE left.
I check the code IO_TLB_DEFAULT_SIZE only used in lib/swiotlb.c. And I have removed the definition of IO_TLB_DEFAULT_SIZE, in my patch

@@ -120,15 +146,13 @@ unsigned long swiotlb_nr_tbl(void) } EXPORT_SYMBOL_GPL(swiotlb_nr_tbl);

-/* default to 64MB */
-#define IO_TLB_DEFAULT_SIZE (64UL<<20)

Quoted 10 lines
Quoted 2 lines
Quoted 2 lines

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their

validity?

Quoted 6 lines
Quoted 1 line

I have validity these code is OK.
Example:
BOARD_KERNEL_CMDLINE += swiotlb=, ,512,268435456 Io_tlb_segsize has been changed from 128 to 512 Io_tlb_default_size has been changed from 64M to 268435456 (256M)

Quoted 5 lines

I specifically said "arbitrary numbers", which in particular includes zero and non-power-of-2 values. If there are any restrictions on which numbers can validly be passed here (and it very much looks like there are), such restrictions should be enforced imo.

OK, we will validate for these variables' value in next patch version.

Quoted 1 line

Jan

Xiaoming

#5 lore raw
In reply to Jan Beulich

Dear Jan

Quoted 39 lines

-----Original Message-----
From: Jan Beulich [mailto:[email protected]]
Sent: Wednesday, February 18, 2015 5:35 PM
To: Wang, Xiaoming
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Liu, Chuansheng; Zhang, Dongxing; [email protected]; [email protected]; [email protected]; ralf@linux- mips.org; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [Xen-devel] [PATCH v4] modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW- IOMMU.

Quoted 24 lines
Quoted 24 lines
Quoted 1 line · On 18.02.15 at 10:09, <[email protected]> wrote:

From: Jan Beulich [mailto:[email protected]]
Sent: Tuesday, February 17, 2015 6:09 PM

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 17.02.15 at 07:51, <[email protected]> wrote:
Documentation/kernel-parameters.txt +0 -0
@@ -3438,10 +3438,12 @@ bytes respectively. Such letter suffixes

can also be entirely omitted.
it if 0 is given (See

Documentation/cgroups/memory.txt)

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted.

Quoted 8 lines
Documentation/kernel-parameters.txt +2 -1
 	swiotlb=	[ARM,IA-64,PPC,MIPS,X86]
-			Format: { <int> | force }
+			Format: { <int> | force | <int> | <int>}
 			<int> -- Number of I/O TLB slabs
 			force -- force using of bounce buffers even if they
 			         wouldn't be automatically used by the kernel
+			<int> -- Maximum allowable number of contiguous

slabs to map

Documentation/kernel-parameters.txt bytes respectively. Such letter suffixes can also be entirely omitted. · line 3446

Quoted 1 line
Documentation/kernel-parameters.txt +1 -0
+			<int> -- The size of SW-MMU mapped.

This makes no sense - the new numbers added aren't position independent (nor were the previous <int> and "force").

Quoted 5 lines
Quoted 2 lines

Use "," can separate them one by one.
We do it at lib/swiotlb.c

Right, but the documentation above doesn't say so.

OK, I will add some comments on next patch version.

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

Also you are (supposedly) removing all uses of IO_TLB_DEFAULT_SIZE, yet you don't seem to remove the definition itself.

I have change all uses of IO_TLB_DEFAULT_SIZE to io_tlb_default_size in lib/swiotlb.c

Then are there any left elsewhere? If not, again - why don't you remove the definition of IO_TLB_DEFAULT_SIZE?

There hasn't any IO_TLB_DEFAULT_SIZE left.
I check the code IO_TLB_DEFAULT_SIZE only used in lib/swiotlb.c. And I have removed the definition of IO_TLB_DEFAULT_SIZE, in my patch

@@ -120,15 +146,13 @@ unsigned long swiotlb_nr_tbl(void) } EXPORT_SYMBOL_GPL(swiotlb_nr_tbl);

-/* default to 64MB */
-#define IO_TLB_DEFAULT_SIZE (64UL<<20)

Quoted 10 lines
Quoted 2 lines
Quoted 2 lines

Finally - are arbitrary numbers really okay for the newly added command line options? I.e. shouldn't you add some checking of their

validity?

Quoted 6 lines
Quoted 1 line

I have validity these code is OK.
Example:
BOARD_KERNEL_CMDLINE += swiotlb=, ,512,268435456 Io_tlb_segsize has been changed from 128 to 512 Io_tlb_default_size has been changed from 64M to 268435456 (256M)

Quoted 5 lines

I specifically said "arbitrary numbers", which in particular includes zero and non-power-of-2 values. If there are any restrictions on which numbers can validly be passed here (and it very much looks like there are), such restrictions should be enforced imo.

OK, we will validate for these variables' value in next patch version.

Quoted 1 line

Jan

Xiaoming