lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <FA47D36D6EC9FE4CB463299737C09B9901D061EB@shsmsx102.ccr.corp.intel.com>
Date:	Fri, 6 Mar 2015 01:12:48 +0000
From:	"Wang, Xiaoming" <xiaoming.wang@...el.com>
To:	Jan Beulich <JBeulich@...e.com>
CC:	"Liu@...rp2030.oracle.com" <Liu@...rp2030.oracle.com>,
	"Zhang@...rp2030.oracle.com" <Zhang@...rp2030.oracle.com>,
	"chris@...is-wilson.co.uk" <chris@...is-wilson.co.uk>,
	"david.vrabel@...rix.com" <david.vrabel@...rix.com>,
	"lauraa@...eaurora.org" <lauraa@...eaurora.org>,
	"heiko.carstens@...ibm.com" <heiko.carstens@...ibm.com>,
	"linux@...izon.com" <linux@...izon.com>,
	"Liu, Chuansheng" <chuansheng.liu@...el.com>,
	"Zhang, Dongxing" <dongxing.zhang@...el.com>,
	"takahiro.akashi@...aro.org" <takahiro.akashi@...aro.org>,
	"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
	"linux-mips@...ux-mips.org" <linux-mips@...ux-mips.org>,
	"ralf@...ux-mips.org" <ralf@...ux-mips.org>,
	"xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
	"boris.ostrovsky@...cle.com" <boris.ostrovsky@...cle.com>,
	"Konrad RzeszutekWilk" <konrad.wilk@...cle.com>,
	"d.kasatkin@...sung.com" <d.kasatkin@...sung.com>,
	"pebolle@...cali.nl" <pebolle@...cali.nl>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"jkosina@...e.cz" <jkosina@...e.cz>
Subject: RE: [PATCH v5] modify the IO_TLB_SEGSIZE and IO_TLB_DEFAULT_SIZE
 configurable as flexible requirement about SW-IOMMU.

Dear Jan

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@...e.com]
> Sent: Thursday, March 5, 2015 5:00 PM
> To: Wang, Xiaoming
> Cc: Liu@...rp2030.oracle.com; Zhang@...rp2030.oracle.com; chris@...is-
> wilson.co.uk; david.vrabel@...rix.com; lauraa@...eaurora.org;
> heiko.carstens@...ibm.com; linux@...izon.com; Liu, Chuansheng; Zhang,
> Dongxing; takahiro.akashi@...aro.org; akpm@...ux-foundation.org; linux-
> mips@...ux-mips.org; ralf@...ux-mips.org; xen-devel@...ts.xenproject.org;
> boris.ostrovsky@...cle.com; Konrad RzeszutekWilk;
> d.kasatkin@...sung.com; pebolle@...cali.nl; linux-kernel@...r.kernel.org
> Subject: RE: [PATCH v5] modify the IO_TLB_SEGSIZE and
> IO_TLB_DEFAULT_SIZE configurable as flexible requirement about SW-
> IOMMU.
> 
> >>> On 05.03.15 at 09:52, <xiaoming.wang@...el.com> wrote:
> >> From: Jan Beulich [mailto:JBeulich@...e.com]
> >> Sent: Thursday, March 5, 2015 4:40 PM
> >> >>> On 05.03.15 at 04:53, <xiaoming.wang@...el.com> wrote:
> >> >> From: Konrad Rzeszutek Wilk [mailto:konrad.wilk@...cle.com]
> >> >> Sent: Thursday, March 5, 2015 3:43 AM On Tue, Mar 03, 2015 at
> >> >> 04:11:09PM +0800, Wang Xiaoming wrote:
> >> >> > @@ -101,13 +119,32 @@ setup_io_tlb_npages(char *str)  {
> >> >> >  	if (isdigit(*str)) {
> >> >> >  		io_tlb_nslabs = simple_strtoul(str, &str, 0);
> >> >> > -		/* avoid tail segment of size < IO_TLB_SEGSIZE */
> >> >> > -		io_tlb_nslabs = ALIGN(io_tlb_nslabs,
> IO_TLB_SEGSIZE);
> >> >> >  	}
> >> >> >  	if (*str == ',')
> >> >> >  		++str;
> >> >> > -	if (!strcmp(str, "force"))
> >> >> > +	if (!strncmp(str, "force", 5)) {
> >> >> >  		swiotlb_force = 1;
> >> >> > +		str += 5;
> >> >> > +	}
> >> >>
> >> >> So the format is now:
> >> >>
> >> >> 	Format: { <int> | force | <int> | <int>}
> >> >>
> >> >> which means I can do
> >> >> 	32,22323,force
> >> >>
> >> >> Or
> >> >> 	force,32
> >> >>
> >> >> Or
> >> >> 	32,force
> >> >>
> >> > If I use Format: { <int>,force,<int>,<int>} 32,22323,force can't
> >> > acceptable.
> >> > There are three  <int>  here, if there are out of order, that will
> >> > cause confuse.
> >> > Only 	32,force,32323
> >> > Or	32,,32323,2322
> >> > Or	,,323222,3232
> >> > Are available.
> >>
> >> You need to make sure that all previously valid variants are still
> >> usable,
> > i.e.
> >> force alone, a number alone, force,<number> and <number>,force. How
> >> many variants you want to support with your additions is mostly up to
> >> you; I'd recommend permitting force in any position.
> >>
> > I don't think it's suitable to accept that "force" in any position.
> > If we defined Format: { <int>,force,<int>,<int>} "force" must be
> > located in second position.
> > And we add comment for each <int> also.
> > Every position may be defined specifically.
> 
> As said, with the old format allowing force in either first or second position,
> you have to at least accept that in the new version too.
> Accepting force in any position would be a (desirable) courtesy to the user.
> 
I have checked the code and do some test.

First "|" in Format  means *or*  in Documentation/kernel-parameters.txt
For example:
        acpi=           [HW,ACPI,X86]
                        Advanced Configuration and Power Interface
                        Format: { force | off | strict | noirq | rsdt }

        acpi_sci=       [HW,ACPI] ACPI System Control Interrupt trigger mode
                        Format: { level | edge | high | low }

Second the code in lib/swiotlb.c can't realize the function that
"force" in either first or second position with the Format
       swiotlb=        [ARM,IA-64,PPC,MIPS,X86]
                       Format: { <int> | force }
                       <int> -- Number of I/O TLB slabs

I test with parameter
BOARD_KERNEL_CMDLINE += swiotlb=force,500
The result is io_tlb_nslabs=32768, swiotlb_force=0x0,
io_tlb_nslabs=32768 because that if io_tlb_nslabs can't get from 
early_param("swiotlb", setup_io_tlb_npages);
It will be valued at swiotlb_init with default.
So both  "<int>"  and "force" can't recognized with original code below.

static int __init
setup_io_tlb_npages(char *str)
{
        if (isdigit(*str)) {
                io_tlb_nslabs = simple_strtoul(str, &str, 0);
                /* avoid tail segment of size < IO_TLB_SEGSIZE */
                io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
        }
        if (*str == ',')
                ++str;
        if (!strcmp(str, "force"))
                swiotlb_force = 1;

        return 0;
}
early_param("swiotlb", setup_io_tlb_npages);

So we can't use Format: { <int> | force | <int> | <int>} any more
as there are four parameters.
Format: { <int>,force,<int>,<int>} is suitable I think.
And fixing  "force" is follow the code design previously in setup_io_tlb_npages.

> Jan

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ