How to set MTRR for LFB properly on new core i5 system?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

Hi,
I got a new PC at work. It's some HP model with intel core i5 750, 8GB RAM, intel H57 chipset and nVidia GT230 VGA so I did some tests. Some years ago I made VESA mode testing and benchmarking utility. I found that programming MTRR to WC mode for LFB is essential to get good transfer rate. I wrote utility MTRRLFBE for setting MTRR - it works simple way: determine LFB phys. addr, find unused variable range MTRR and set it to WC mode for specified address and size. This works fine on older machines and my current PC at home (C2D E8400, intel P31 and GF7900GT) where I got about 2600 MB/s - huge performance gain.
But on mentioned core i5 system I didn't get any gain in LFB mode and only ~1,5x in bankswitch mode:
BankSwitch, MTRR unset: 28 MB/s (I got same value under WinXP)
BankSwitch, MTRR set to WC: 41 MB/s
LFB, MTRR unset: 29 MB/s
LFB, MTRR set to WC: 29 MB/s
So I'm disapponted but it may be specific only for this system. I cannot test on different core i* system.

So question is - how to initialize MTRR properly to get reasonable speed according to modern hardware? Maybe intel changed something here that I missed.

ps. it also affect linux VESA FB console, ReactOS and other systems relying on VESA VBE.
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

Please is here somebody else with intel core i3/5/7 who can do test under real DOS (not emulator)? It would be also helpfull to know if the problem is on others machines too...
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by Brendan »

Hi,
RayeR wrote:Please is here somebody else with intel core i3/5/7 who can do test under real DOS (not emulator)? It would be also helpfull to know if the problem is on others machines too...
The number of people with an i3/5/7 who also have DOS is probably about the same as the number of people with a Betamax video machine connected to a HD LCD screen. :D


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

But everyone can boot freedos from a flashdisk/floppy/or live CD...
The problem with VESA and MTRRs is more generic than DOS only so I hoped that there will be more people interested... Hm, maybe I missed that every OS developer here has own superior accelerated driver for his own OS, then sorry for asking you gurus...
octavio
Member
Member
Posts: 94
Joined: Wed Oct 25, 2006 5:12 am
Location: Barcelona España
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by octavio »

RayeR wrote: I hoped that there will be more people interested.....
I hoped i have a core i3/5/7 but i have a 32 bits Atom.Sometimes it happens that you are the first one facing a problem.
did you read the intel documentation about these chips?
if no,read it,else try this forum: http://board.kolibrios.org/
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by Brendan »

Hi,
RayeR wrote:But everyone can boot freedos from a flashdisk/floppy/or live CD...
The problem with VESA and MTRRs is more generic than DOS only so I hoped that there will be more people interested... Hm, maybe I missed that every OS developer here has own superior accelerated driver for his own OS, then sorry for asking you gurus...
It's not that, it's just that most OS developers here would've expected some sort of bootable floppy/CD/USB image, rather than a DOS application.

I don't have a copy of DOS, or a copy of Windows 3.1 or Windows 9x; and last time I had the misfortune to see FreeDOS was about 4 years ago - I was trying to get Etherboot to work (which used FreeDOS as an installer) and got so annoyed with repeated crashes that I wrote my own utility to install Etherboot on my test machines instead.

It'd also be nice to at least see some source code - I can understand how people could be hesitant to execute "unknown" code on the newest/best computers they've got (rather than some dusty old test machine).


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

Well, it's not problem for me to prepare bootable floppy/ISO image. But 1st I'd like to know if somebody have the needed target machine.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by Combuster »

It's a sticky thread, but nobody posted a core-i machine in there.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
AlfaOmega08
Member
Member
Posts: 226
Joined: Wed Nov 07, 2007 12:15 pm
Location: Italy

Re: How to set MTRR for LFB properly on new core i5 system?

Post by AlfaOmega08 »

Combuster wrote:It's a sticky thread, but nobody posted a core-i machine in there.
Ehm... ok. if you assure me that it will not destroy my hard disk, post a link to what I should boot. If you only have ISOs then you should wait some more as I don' have empty CDs actually... and my pc hasn't a floppy reader either. Best option would be to boot with grub..
However I noticed that ubuntu or win in vmware say that there is a core i7 in the system just as on real machine. Is it the same if I run your image on vmware?

Edit: I'm not sure of what I'm going to say. Don't take this for sure and wait for someone more experienced than me or read manuals but on Wikipedia's MTRR page, in the Successor section, talks about PATs, which are present on PentiumIII+ and 64bit CPUs, which might be your solution.
Please, correct my English...
Motherboard: ASUS Rampage II Extreme
CPU: Core i7 950 @ 3.06 GHz OC at 3.6 GHz
RAM: 4 GB 1600 MHz DDR3
Video: nVidia GeForce 210 GTS... it sucks...
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

Hi AlfaOmega08,
here is my test bootable floppy image, plaese test it.
http://rayer.ic.cz/350d/vesatest.zip
Yu can burn it on cd-rw or use grub+memdisk to boot floppy image from disk.
It boots plain freedos. Then run "test.bat" from the shell.
It should display test info about your vesa and then switch to gfx screen.
Write down measured transfer speed in MB/s.
This test will run twice - first with disabled MTRR and second with MTRRs set to Write-Combining mode. I hope you will see a difference (in my case about 190 vs 2600MB/s on my C2D system).
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

Please could somebody test it?
Yargh
Member
Member
Posts: 56
Joined: Sat Jun 12, 2010 9:04 pm
Location: Somewhere else.

Re: How to set MTRR for LFB properly on new core i5 system?

Post by Yargh »

If you provided the source, I might test it on my i7 (740qm) laptop if I have time.
Wait... What?
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

I can provide you source of MTRR setting function if you want to study it but not full source that is part of much bigger project and it has some depencies that doesn't allow compile it separately. All I need is to run the exe from package under DOS or use it as is a bootable floppy image that can be loaded with some bootloader (grub+memdisk etc.) or burned on cd-rw and write down the measured LFB transfer speed with MTRR unset and set (there's batch file with needed arguments).
RayeR
Posts: 22
Joined: Wed Feb 23, 2011 6:36 pm
Location: Czech Republic
Contact:

Re: How to set MTRR for LFB properly on new core i5 system?

Post by RayeR »

I had received an email from Bruno who tested my VESATEST on his core i5 680 with following result exactly I needed:

Code: Select all

640 x 480       Video mode              Transfer rate   
112     Bank switched                   39 MB/s         
4112    Linear frame buffer             35 MB/s
112     Bank switch MTRR WC set         2920 MB/s
4112    Linear frame buffer MTTR WC set 250 MB/s
It's weird that BS mode is such faster than LFB mode but performance is still good compared to my poor core i5 750 system from HP. So it seems that HP BIOS is kinda retarded and didn't fully initialized the CPU/integrated MCH. Thankfully it's not general problem of core ix machines :)
Post Reply