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]
Date:	Tue, 13 Oct 2009 23:29:05 +0200
From:	Thomas Schlichter <thomas.schlichter@....de>
To:	"Jan Beulich" <JBeulich@...ell.com>
Cc:	"Jeremy Fitzhardinge" <jeremy.fitzhardinge@...rix.com>,
	"Robert Hancock" <hancockrwd@...il.com>,
	"Henrique de Moraes Holschuh" <hmh@....eng.br>,
	"Suresh Siddha" <suresh.b.siddha@...el.com>,
	"Venkatesh Pallipadi" <venkatesh.pallipadi@...el.com>,
	"Tejun Heo" <tj@...nel.org>, x86@...nel.org,
	"Yinghai Lu" <yinghai@...nel.org>,
	"Thomas Gleixner" <tglx@...utronix.de>,
	"Arjan van de Ven" <arjan@...ux.intel.com>,
	dri-devel@...ts.sourceforge.net, "Ingo Molnar" <mingo@...hat.com>,
	linux-kernel@...r.kernel.org, jbarnes@...tuousgeek.org,
	"Thomas Hellstrom" <thellstrom@...are.com>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [RFC Patch] use MTRR for write combining if PAT is not available

Jan Beulich wrote:
> >>> Thomas Schlichter <thomas.schlichter@....de> 12.10.09 20:32 >>>
> >+	if (!pat_enabled) {
> >+		void __iomem *ret = ioremap_nocache(phys_addr, size);
> >+		if (ret)
> >+			mtrr_add(phys_addr, size, MTRR_TYPE_WRCOMB, false);
> 
> This won't work if phys_addr or size aren't page aligned, or if size isn't
> a power of two.

No, at least the comments in mtrr_add and mtrr_check state that it is just 
required that phys_addr and size are multiple of PAGE_SIZE. And I'm not sure 
if it is always safe to round these up/down to the next PAGE boundary. If it 
is not, maybe it is better to fail...

> >+	if (!pat_enabled) {
> >+		ret = set_memory_uc(addr, numpages);
> >+		if (!ret)
> >+			mtrr_add(__pa(addr), numpages * PAGE_SIZE,
> >+				 MTRR_TYPE_WRCOMB, false);
> 
> Similarly, this requires numpages to be a power of two.

Same as above.

> I think user mode code handles this by splitting the request and trying to
> establish as many entries as possible (and those as big as possible).

Seems not required here...

> Also, in all cases you pass 'false' for the 'increment' parameter, in order
> to avoid having to tear down the established entries. While this may be
> reasonable for kernel initiated mappings, I don't think that's acceptable
> for such originating from user mode.

Well, therefore I would have to remember which mmap successfully set up which 
MTRR entries. And it must be ensured that for each mmap there always is a 
munmap. If this is indeed always ensured, and if it's worth to maintain the 
required data, I'd be happy to add a corresponding mtrr_del there.

Kind regards,
  Thomas
--
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