Page 1 of 1

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

Posted: Wed Feb 23, 2011 7:03 pm
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.

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

Posted: Fri Feb 25, 2011 6:52 am
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...

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

Posted: Fri Feb 25, 2011 10:25 am
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

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

Posted: Fri Feb 25, 2011 6:09 pm
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...

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

Posted: Mon Feb 28, 2011 10:56 am
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/

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

Posted: Mon Feb 28, 2011 11:20 am
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

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

Posted: Tue Mar 01, 2011 9:15 am
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.

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

Posted: Tue Mar 01, 2011 12:24 pm
by Combuster
It's a sticky thread, but nobody posted a core-i machine in there.

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

Posted: Tue Mar 01, 2011 1:14 pm
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.

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

Posted: Tue Mar 15, 2011 6:27 pm
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).

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

Posted: Fri Apr 29, 2011 9:13 am
by RayeR
Please could somebody test it?

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

Posted: Fri Apr 29, 2011 5:12 pm
by Yargh
If you provided the source, I might test it on my i7 (740qm) laptop if I have time.

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

Posted: Tue May 03, 2011 8:10 am
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).

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

Posted: Thu May 12, 2011 5:17 am
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 :)