Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/proc/mtrr all are uncacheable
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
jhon987
Guru
Guru


Joined: 18 Nov 2013
Posts: 302

PostPosted: Thu Nov 15, 2018 12:19 am    Post subject: /proc/mtrr all are uncacheable Reply with quote

Code:
# cat /proc/mtrr
reg00: base=0x0c0000000 ( 3072MB), size= 1024MB, count=1: uncachable
reg01: base=0x0a0000000 ( 2560MB), size=  512MB, count=1: uncachable
reg02: base=0x4000000000 (262144MB), size=262144MB, count=1: uncachable


kernel settings:
CONFIG_MTRR=y
CONFIG_MTRR_SANITIZER=y
CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=1
CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=5

As I understand, making the regs (reg00, ...01, ...) write-combining would help increase performance.
But how can i get them into that mode?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9891
Location: almost Mile High in the USA

PostPosted: Thu Nov 15, 2018 12:46 am    Post subject: Reply with quote

What hardware are you working on?
What happens if you don't have the sanitizer turned on, is it worse?

Code:
$ cat /proc/mtrr
reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
$

(BTW, that's my VM server, the bare metal machine does not look like this...)
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
jhon987
Guru
Guru


Joined: 18 Nov 2013
Posts: 302

PostPosted: Thu Nov 15, 2018 6:16 am    Post subject: Reply with quote

eccerr0r wrote:
What hardware are you working on?
What happens if you don't have the sanitizer turned on, is it worse?

Code:
$ cat /proc/mtrr
reg00: base=0x080000000 ( 2048MB), size= 2048MB, count=1: uncachable
$

(BTW, that's my VM server, the bare metal machine does not look like this...)


I haven't tried it with the sanitizer off completely as all guides say it should be on in order to utilize the GPU memory, however initially, I had

CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=0
CONFIG_MTRR_SANITIZER_SPARE_REG_NR_DEFAULT=1

which according to online guides should have outcome in reg uncacheable, however all guides suggests that turning
CONFIG_MTRR_SANITIZER_ENABLE_DEFAULT=1
should result in, I think, "write-combining":
Quote:

On Intel P6 family processors (Pentium Pro, Pentium II and later)
the Memory Type Range Registers (MTRRs) may be used to control
processor access to memory ranges. This is most useful when you have
a video (VGA) card on a PCI or AGP bus. Enabling write-combining
allows bus write transfers to be combined into a larger transfer
before bursting over the PCI/AGP bus. This can increase performance
of image write operations 2.5 times or more.


check out:
https://www.kernel.org/doc/Documentation/x86/mtrr.txt
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9891
Location: almost Mile High in the USA

PostPosted: Thu Nov 15, 2018 9:05 am    Post subject: Reply with quote

BIOS should be setting up the MTRRs with PNP, before getting into Linux. /proc/mtrr allows post BIOS (i.e. OS) changes, and the sanitizer is only useful if the BIOS does a poor job using them like overlapping regions like my server:

reg00: base=0x000000000 ( 0MB), size= 8192MB, count=1: write-back
reg01: base=0x200000000 ( 8192MB), size= 1024MB, count=1: write-back
reg02: base=0x0cc000000 ( 3264MB), size= 64MB, count=1: uncachable
reg03: base=0x0d0000000 ( 3328MB), size= 256MB, count=1: uncachable
reg04: base=0x0e0000000 ( 3584MB), size= 512MB, count=1: uncachable
reg05: base=0x22c000000 ( 8896MB), size= 64MB, count=1: uncachable
reg06: base=0x230000000 ( 8960MB), size= 256MB, count=1: uncachable

As seen here I don't have the sanitizer on, and BIOS has overlapping regions.

You can always manually set them as said in the documentation, though I thought there's a hint in the PCI PNP data to indicate whether a piece of memory is safe to cache/combine.

With /proc/mtrr, individual video drivers can change them at will. I recall playing with this over a decade ago with dumb video cards (like the S3) that don't run code like modern GPUs, and even these usually ended up with hangs...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
jhon987
Guru
Guru


Joined: 18 Nov 2013
Posts: 302

PostPosted: Thu Nov 15, 2018 9:40 am    Post subject: Reply with quote

Yeah I'm not sure whether it's a good idea for me to set manually (I don't know the implications of simply having all the regs' memory write-back), I'd much rather the OS would handle that for me.
And also,
Quote:
MTRR use is replaced on modern x86 hardware with PAT. Direct MTRR use by
drivers on Linux is now completely phased out


So I really don't know if I should mess with that at all.
That said,
Quote:
This can increase performance
of image write operations 2.5 times or more

sounds really attractive and so I'm simply not sure how to deal with this situation...
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9891
Location: almost Mile High in the USA

PostPosted: Thu Nov 15, 2018 9:56 am    Post subject: Reply with quote

If you're not comfortable overwriting them manually I'd say just don't muck with it and let the individual video drivers change them as needed. I am especially concerned about GPUs where the GPU actually has processing power, and the potential for possible ordering issues if you change to write combining or writeback caching.

The other thing is that GPUs will handle its own memory, and basically the only thing that gets passed over PCI/AGP are textures, and those are done in big blocks anyway which caching/combining doesn't help. In the old graphics cards that aren't completely accelerated, the CPU needs to do graphics operations and minimizing the number of transactions over the bus will speed things along.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum