public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: PAT support for i386 and x86_64
@ 2007-08-07 12:34 Daniel J Blueman
  2007-08-07 14:10 ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel J Blueman @ 2007-08-07 12:34 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Cédric Augonnet, Linux Kernel

On 7 Aug, 09:40, Andi Kleen <a...@firstfloor.org> wrote:
> On Mon, Aug 06, 2007 at 10:03:15PM -0400, Cédric Augonnet wrote:
> > Hi all,
>
> > For quite a while now, there as been numerous attempt to introduce support for
> > Page Attribute Table (PAT) in the Linux kernel, whereas most other OS already
> > have some support for this feature. Such a proposition popping up periodically,
> > perhaps it would be an opportunity to fix that lack for once.
>
> The trouble is you need to avoid conflicting attributes, otherwise
> you risk cache corruption. This means the direct mapping needs to be fixed
> up and the kernel needs to keep track of the ranges to prevent conflicts.

The general case of drivers setting up mappings to PCI memory space is
usually done consistently, thus no virtual pages with different PAT
indexes referring to the same physical page would exist here.

What cases did you have in mind?

> Also when there is already a MTRR it might not work due to the complicated
> rules of MTRR<->PAT interaction.

Not so complicated - stronger ordering always takes precedence (for safety).

>From current Intel 64 and IA-32 Architectures Software Developer's Manual
Volume 3A: System Programming Guide, section 10.5.2:

"[...] If there is an overlap of page-level and MTRR caching controls,
the mechanism that prevents caching has precedence. In cases where
there is a overlap in the assignment of the write-back and
write-through caching policies to a page and a region of memory, the
write-through policy takes precedence. The write-combining policy
(which can only be assigned through an MTRR or the PAT) takes
precedence over either write-through or write-back."

If (eg) a broken BIOS marks PCI memory space as UC, we gain nothing
like today. Most modern systems (in the server domain) I've seen don't
do this, as Windows' use of PAT would be broken too.

> Then there are old CPU errata that need to be handled etc.

I don't see a problem with having CONFIG_PAT depend on P4/Athlon or
newer to avoid such workarounds for now. Better to have something
there which works in (only) 80% of the cases, than nothing at all.

> There are also some other issues.

What like?

> You didn't solve all that at all. If it was as simple as your patch
> we would have long done it already.

Perhaps this feature can be marked as WIP to allow this to move
forward while corner-cases are worked out. Adding such a go/no-go
barrier will hamper progress we do see, as it has done already for
years.

The PCI ordering config option years ago was a similar case, since
various drivers didn't issue wmb()s until they were fixed up.

Daniel
--
Daniel J Blueman

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 0/2] PAT support for i386 and x86_64
@ 2007-08-07  2:03 Cédric Augonnet
  2007-08-07  8:30 ` Andi Kleen
  0 siblings, 1 reply; 8+ messages in thread
From: Cédric Augonnet @ 2007-08-07  2:03 UTC (permalink / raw)
  To: Linux Kernel Mailing List, Andrew Morton, Andi Kleen
  Cc: loic, brice, cedric.augonnet

Hi all,

For quite a while now, there as been numerous attempt to introduce support for
Page Attribute Table (PAT) in the Linux kernel, whereas most other OS already
have some support for this feature. Such a proposition popping up periodically,
perhaps it would be an opportunity to fix that lack for once.

  PAT actually makes life much easier for people needing to use write-combining
(WC) attribute. Indeed the only solution yet available is MTRRs, which are not
as flexible as PAT is.
  Indeed, even if they both allow to set memory types on memory regions, MTRRs
are intended to be used on a physical memory range, while PAT makes possible
to set such memory type based on a linear address mapping. The actual problem
with MTRR is that the BIOS usually covers physical RAM with write-back (WB),
and that MTRRs should not be overlapped.
  Using write-combining feature is sometimes crucial for performance of driver
for which writes operation on the bus are critical. High-speed networking
drivers such as myri10ge would take benefit of using PAT instead of MTRRs.
Video drivers using frame-buffers could also avoid using MTRRs that way.

  PAT6 can be a candidate for that purpose. Not only for backward compatibility
reasons, but also as various errata concerning PAT would end up by having the
PAT bit ignored, therefore if we use PAT6, when such an error occurs we would
have an uncached area, which means it would at worst not be effective, thus
resolving the issues raised in http://lkml.org/lkml/2004/4/13/102 .

 *******

 Back to 2.4.20, Terence Ripperda already submitted such a proposal for PAT
 support in
   - http://lkml.org/lkml/2003/5/20/131
 himself refering to
   - http://www.ussg.iu.edu/hypermail/linux/kernel/0303.1/0606.html

 In 2005, Eric W. Biederman submitted another similar patch :
   - http://lkml.org/lkml/2005/8/29/226

 More recently, there have been numerous threads dealing with MTRR issues,
 some of them suggesting that there should actually be some support for PAT.
 See for instance :
   - http://lkml.org/lkml/2007/6/6/333

 *******

 I therefore propose here a set of 2 patches to add some support for
 write-combining using PAT :

 [PATCH 1/2] - [PAT] Setting write combining on PAT6 at boot time
 [PATCH 2/2] - [PAT] Support for write combining in pci_mmap_page_range

Kind regards,
Cedric

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-08-08 16:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-07 12:34 PAT support for i386 and x86_64 Daniel J Blueman
2007-08-07 14:10 ` Andi Kleen
2007-08-07 15:26   ` Daniel J Blueman
2007-08-07 15:33     ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2007-08-07  2:03 [PATCH 0/2] " Cédric Augonnet
2007-08-07  8:30 ` Andi Kleen
2007-08-08  8:26   ` Loic Prylli
2007-08-08 10:14     ` Andi Kleen
2007-08-08 15:52       ` Cédric Augonnet
     [not found]       ` <f56c1ba00708080842i1eaa00kef5071d9a1f01f04@mail.gmail.com>
2007-08-08 16:00         ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox