kjliew / qemu-3dfx

MESA GL/3Dfx Glide pass-through for QEMU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

windows 98 doesn't seems to like when things go fast (missing DLL errors...)

TiBeN opened this issue · comments

Hi,

As a fan of Windows gaming ERA 97 -> 2002 i stumb upon your project and can't resist to take a look.

Unfortunatelly, on my Dell XPS 13 laptop with archlinux (11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz), Win98 is completely broken with accel=kvm:

Screenshot from 2022-05-26 14-32-59
Screenshot from 2022-05-26 14-33-10

(Sorry for screenshot dials langage, i'm french).

This seems to be more related to qemu than your 3Dfx patches but i suspect my host CPU is too fast. What are your thoughts about this?

I tried without KVM and OS works correctly but it is not really usable. Half life is barely playable.

If the host CPU speed involved i fear your project will not last.. Is there a way to limit things a little without completely disabling KVM ?

Hello, you brought up a very good discussion. I do acknowledge the issue since I have Acer Swift 3 with Core i7-1165G7. All I can say is Intel had probably let-go certain compatibility properties in their CPU designs to catch up with AMD. This is an unfortunate issue in Win98 OS MMU TLB invalidation on modern CPUs with speculative MMU. AFAICT from Google Search, the issue only shows up on 11th Gen Intel Core and very likely anything after that. The older Gen are probably still fine. On the 4th (Haswell) and 6th (Skylake) Gen laptops that I was testing, QEMU Win98 VM is perfect.

I do understand that keeping with Known & Good older Gen Intel CPUs for QEMU Win98 VMs isn't a very good long-term solution. On the Linux kernel mailing list, there was a patch for strict MMU which made KVM MMU non-speculative and could very likely be the exact solution to this problem. It could be a HUGE performance hammer though. I myself haven't experimented with it.

So here's my suggestion:

  • If the game can be made to run on Win2K/XP, then use Win2K/XP VMs.
  • Use LSI SCSI as the VM storage controller without IDE. Run Win98 SCANDSKW several times when DLL errors pop-up.
  • Use WinME VM. It is not completely free of DLL errors as in Win2k/XP VMs, but the frequency of DLL errors is less than Win98 VMs. When DLL errors pop-up, the same SCANDSKW trick can be used.

When all things failed, then QEMU TCG would be the last resort. Yes, we lost the virtualization advantage but TCG isn't slow for games that do not need high CPU requirements. The Rule of 10X applies and 2GHz CPU would roughly deliver the performance of 200MHz CPU. I think the Core i7-1185G7 would deliver 30 FPS at 1024x768 for Half-Life 1 gameplay with MESAGL pass-through on Win98 VMs. I don't think it is fair to call 1024x768 30 FPS as "barely playable". Compared to "the other" camp and using Half-Life 1 as an example, they are no-match for what QEMU delivers even with only TCG. Their promise of NO GPU acceleration is the BIGGEST JOKE of all time.🤣 QEMU even with only TCG, the MESAGL/Glide pass-through leverage true modern GPU acceleration.

After all, QEMU is a professionally developed FOSS emulation/virtualization solution in the same league as VMware/VirtualBox/Parallel. Its threaded workloads lean well to stutter-free audio playback and near real-time input latency, the issues that continue to haunt "the other" camp till this day.

Hi @kjliew,

Thanks for your insightful answer. I'll take a look at your tips to mitigate this issue. Especially this one:
Use LSI SCSI as the VM storage controller without IDE. Run Win98 SCANDSKW several times when DLL errors pop-up.

I tried pcem and other "full emulation" projects and you are right, theses are great projects but not ready for win 97/2003 games because of 'real world' resources limits.

On an other side, i played a lot with WINE (i'm a long term linux guy) and theses speed issues are not a concern. Half life, despite you have to deal with fullscreen modelines and compositing issues is simply at full speed with perfect 'scrolling'. So a 30Hz rate with an i7 is a kind of a concern. But is playable you're right. But Wine has their own pitfalls that's why i'm always aware of alternative solutions to make theses games working on hardware of today.

i'll let you know as soon as i'll try your tips :)

Thanks man

On the Linux kernel mailing list, there was a patch for strict MMU which made KVM MMU non-speculative and could very likely be the exact solution to this problem

i'm curious, could you give a link ?

From the link you shared:
It is also useful for some legacy guest OSes which don't flush TLBs correctly, and thus don't work on modern CPUs which have speculative MMUs.

Seems pretty clear. I'll monitor this and hope it will be merged. I love Linux just for that ^^

At least, I brought GOOD NEWS for those who still hang on the older Gen of Intel CPUs in contrast to "the other" camp rhetoric of "Your CPU sucks, mine is 12900KF". The older Gen Intel CPUs are absolutely great for QEMU Win98 VMs for retro games on both modern Linux KVM and Windows WHPX, so much better that the 9-year old Core i3-4010U 15W TDP or 7-year old Core m3-6Y30 8W TDP fan-less would literally "LAUGH IT OUT LOUD" for the kind of performance they got from 125W 12900KF -- "Your PC emulator REALLY, REALLY sucks, just use QEMU".

Ironically, offering the suggestion for VOGONS-er who already owned Core i7-4700k + GTX770 to use Win98 VMs for games had me banned from the forums. Not to mention that sourcing an old, yesteryears, used GPU with performance similar to QEMU WineD3D/Glide/MESAGL pass-through on GTX770 would cost an arm and a leg in today's used PC parts market. Even if one would have to make a small donation to get the full custom QEMU binary package that supports all goodies (3Dfx Glide, OpenGL, Direct3D), it is still the best in value and hassle-free compared to anything else existed. Of course, there is nothing stopping anyone with the know-how, time and determination to have everything without costing a penny. Everything about QEMU and everything that comes with it, is FOSS and such is the beauty of FOSS.

I tried the SCSI drive tip but the issue remains:

  ./build/qemu-system-i386 -L pc-bios \
    -rtc base=localtime \
    -no-hpet -no-reboot \
    -device VGA \
    -device lsi53c895a,id=scsi0 \
    -device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0 \
    -drive file=vmimgs/w98.qcw,if=none,id=drive0 \
    -M pc,accel=kvm \
    -device ac97 \
    -cdrom /dev/sr0 \
    -display sdl

I followed instruction from this article for the qemu with SCSI:
https://blogs.oracle.com/linux/post/how-to-emulate-block-devices-with-qemu

Then i found the driver for the controller here:
https://www.helpdrivers.com/disks/LSI/LSI53C895A/

To be precise, DLL errors disappeared if the drivers are not installed. But the system freeze completely:
BSOD just after cancelling the plug'n'play install driver dialog or the system locks completely when i try to open or launch something. When drivers are installed, the same DLL error behavior occurs like with a IDE disk.

Maybe i misconfigured something ? (i'm not really expert in SCSI hardware stuff).

The older Gen Intel CPUs are absolutely great for QEMU Win98 VMs for retro games on both modern Linux KVM and Windows WHPX, so much better that the 9-year old Core i3-4010U 15W TDP or 7-year old Core m3-6Y30 8W TDP fan-less would literally "LAUGH IT OUT LOUD" for the kind of performance they got from 125W 12900KF -- "Your PC emulator REALLY, REALLY sucks, just use QEMU".

Looks like the kvm module strict_mmu option from the patch you mentionned will reconciliate everyone :)

Ironically, offering the suggestion for VOGONS-er who already owned Core i7-4700k + GTX770 to use Win98 VMs for games had me banned from the forums

That's unfortunate. I know the vogons forum (i found some informations to build qemu-3dfx) but i'm not really involved in this community so i can't give any advise about it.

I am not as optimistic about strict MMU. Even if that really works for ALL including AMD Ryzen CPUs, the performance hit by forcing legacy paging without NPT/EPT with KVM is significant. I would rather have the games working on QEMU WinXP VM.

Checking out VOGONS post https://www.vogons.org/viewtopic.php?f=9&t=87729, it seemed that 10th Gen Intel Core is still fine. I have the impression that Intel knew the tricks to make KVM great on Intel CPUs without the big hammer of enforcing strict MMU and giving up NPT/EPT. I was indeed rather disappointed to figure out Core i7-1165G7 regressed in x86 virtualization for legacy Windows VMs. That made it no difference from AMD Ryzen 2500U in that respect. A big let-down on Intel CPUs stellar track record in x86 virtualization implementation.

My Win98 VM image is able to boot all the way into Win98 desktop without any DLL errors pop-up, both on AMD Ryzen 2500U and Core i7-1165G7. The DLL errors pop-up when trying to run program or game, for instance 7-zip or 3DMarks. And the SCANDSKW trick would eventually have them load & run properly. The Win98 image was updated with essential official MSKB updates for critical OS components such as Internet Explorer, Window Media, DirectX, WDM audio, SCSI port, USB and ACPI/PM/Shutdown etc. I don't use any unofficial Win98 SPs. Basically that is good enough to use Win98 VM for games, only for games and nothing else.

This is an unfortunate reality of both Intel and AMD modern CPUs for Win98/ME virtualization that nobody cares.

@TiBeN @sedme
We finally have the BEST solution to Win98/ME virtualization!!
It's here at https://github.com/JHRobotics/patcher9x

I confirmed that it works for Win98SE VM disk image on Core i7-1165G7 and AMD Ryzen 2500U on both Windows 10/11 WHPX and Arch Linux x86_64 KVM. Absolutely no restriction what so ever, NPT/EPT remains functional and enabled for SLAT exit-less VM guest paging. At last, Virtualization brings superb performance for an Ultimate Win98 VM and with QEMU Windows guests pass-through 3D acceleration, the golden age of late 90's era till the turn of Millenia Windows games are preserved at full playability and highest quality permissible by CPU/GPU on modern systems.

After all, someone else do care about Win98/ME virtualization😁. Kudos to @JHRobotics!!
VOGONS post https://www.vogons.org/viewtopic.php?f=24&t=88284

That's really great news !! I'll try this ASAP and i'll give a feedback here.

Thanks @kjllew for the information.

Archived md5sum of patched QEMU Windows 98 SE VM disk image.

92bd22d3c106dd479a474bf59b6f50d6 */c/WINDOWS/SYSTEM/VMM32.VXD
52287552c7637691e6161aba0a0c808f */c/WINDOWS/SYSTEM/VMM32/VMM.VXD

Comparison between pristine VMM.VXD extracted and patched VMM.VXD shows the difference of exactly 29 bytes.
This is the most significant patch for Windows 98 in 20 years since its EOL!!

Incredible. You and @JHRobotics are really truly mad code gurus. Congrats and many thanks for your respective work on this.
I'm pretty busy with my professional work now but can't wait to try this. i'll take a look at this patch early next week.