Bug report - Windows XP guest failure
Just wanted to note that for the i386 target, Windows XP as a guest fails to boot. When it safe mode, loading always stops at Windows\System32\Drivers\Mup.sys. The guest boots in QEMU 2.2.0, so this seems to indicate a bug with the May 5th or earlier patch set.
06.05.2015 08:41, Programmingkid wrote
Quoted 1 line
Just wanted to note that for the i386 target, Windows XP as a guest fails to boot. When it safe mode, loading always stops at Windows\System32\Drivers\Mup.sys. The guest boots in QEMU 2.2.0, so this seems to indicate a bug with the May 5th or earlier patch set.
Please be a bit more specific, what do you run,
with which options etc. Current git master works
just fine with winXP guest, be it i386 or x86_64.
Thanks,
/mjt
A message that is not in the archive (sent off-list or not yet received): [email protected]
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"
Quoted 18 lines · Programmingkid
On May 6, 2015, at 3:35 AM, Michael Tokarev wrote:
06.05.2015 08:41, Programmingkid wrote
Just wanted to note that for the i386 target, Windows XP as a guest fails to boot. When it safe mode, loading always stops at
Windows\System32\Drivers\Mup.sys. The guest boots in QEMU 2.2.0, so this
seems to indicate a bug with the May 5th or earlier patch set.Please be a bit more specific, what do you run,
with which options etc. Current git master works
just fine with winXP guest, be it i386 orx86_64.Really? Maybe it is because of my Mac OS 10.6 host.
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"
Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
P.S. Please don't top-post.
/mjt
Quoted 11 lines · Michael Tokarev
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit 23820dbfc79d1c9dce090b4c555994f2bb6a69b3
Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700
exec: Respect as_translate_internal length clamp
address_space_translate_internal will clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic in addresss_space_translate was ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable.
This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions.
Message-Id: <[email protected]>
Cc'ing relevant people.
/mjt
Quoted 28 lines · Michael Tokarev
Quoted 11 lines · Michael Tokarev
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clamp
address_space_translate_internalwill clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic inaddresss_space_translatewas ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable.
Quoted 6 lines
This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions.
Signed-off-by Peter Crosthwaite <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
This winXP BSOD happens on x86_64 target too. Reverting the above commit from git master fixes the BSOD.
Thanks,
/mjt
Quoted 36 lines · Michael Tokarev
Quoted 28 lines · Michael Tokarev
Quoted 11 lines · Michael Tokarev
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clamp
address_space_translate_internalwill clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic inaddresss_space_translatewas ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable.Quoted 6 lines
This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions.
Signed-off-by Peter Crosthwaite <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
Quoted 7 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Thanks,
/mjt
After reverting this patch, I was able to boot Windows XP again. Good work finding this patch.
Quoted 32 lines · Michael Tokarev
Quoted 31 lines · Michael Tokarev
Quoted 11 lines · Michael Tokarev
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clamp
address_space_translate_internalwill clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic inaddresss_space_translatewas ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable.This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions.
Quoted 7 lines
Quoted 3 lines
Signed-off-by Peter Crosthwaite <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.
Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Regards,
Peter
Quoted 5 lines
Thanks,
/mjt
Quoted 1 line · Peter Crosthwaite
On Thu, May 7, 2015 at 2:34 AM, Michael Tokarev <[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clamp
Quoted 7 lines
Quoted 2 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Oh. I didn't know this patch has been reverted before. Anyway, I disabled auto-reboot on BSOD on my winXP (what a "useful" feature!) and here's what I see.
IRQ_NOT_LESS_OR_EQUAL
STOP: 0x0A (0x16, 0x02, 0x00, 0x80500EFC)
(with some amount of leading zeros stripped).
When this happens, win does something for quite some time, the BSOD comes after quite significant delay.
Is there anything else I can look at, maybe some crash dump or something? I haven't done any windows debugging before.
Thanks,
/mjt
Quoted 32 lines · Michael Tokarev
Quoted 1 line · Peter Crosthwaite
On Thu, May 7, 2015 at 2:34 AM, Michael Tokarev <[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clampQuoted 7 lines
Quoted 2 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Oh. I didn't know this patch has been reverted before. Anyway, I disabled auto-reboot on BSOD on my winXP (what a "useful" feature!) and here's what I see.
IRQ_NOT_LESS_OR_EQUAL
STOP:0x0A(0x16,0x02,0x00,0x80500EFC)(with some amount of leading zeros stripped).
When this happens, win does something for quite some time, the BSOD comes after quite significant delay.
Quoted 7 lines
Is there anything else I can look at, maybe some crash dump or something? I haven't done any windows debugging before.
Thanks,
/mjt
https://support.microsoft.com/en-us/kb/315263
You can configure the type of dump it saves, then use various MS utilities described here (briefly) to perform some basic analysis on the dumps, which sometimes gives extra goodies.
I haven't done too much advanced windows debugging myself, but I do generally try to run the !analyze command on any minidumps I create, at least.
--js
Quoted 27 lines · Michael Tokarev
Quoted 1 line · Peter Crosthwaite
On Thu, May 7, 2015 at 2:34 AM, Michael Tokarev <[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clampQuoted 7 lines
Quoted 2 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Oh. I didn't know this patch has been reverted before. Anyway, I disabled auto-reboot on BSOD on my winXP (what a "useful" feature!) and here's what I see.
IRQ_NOT_LESS_OR_EQUAL
STOP:0x0A(0x16,0x02,0x00,0x80500EFC)
Quoted 7 lines
(with some amount of leading zeros stripped).
When this happens, win does something for quite some time, the BSOD comes after quite significant delay.
Is there anything else I can look at, maybe some crash dump or something? I haven't done any windows debugging before.
I would just put a breakpoint on the new condition introduced by the commit, and see what causes the breakage.
Paolo
Quoted 30 lines · Paolo Bonzini
Quoted 29 lines · Michael Tokarev
Quoted 1 line · Peter Crosthwaite
On Thu, May 7, 2015 at 2:34 AM, Michael Tokarev <[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clampQuoted 7 lines
Quoted 2 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Oh. I didn't know this patch has been reverted before. Anyway, I disabled auto-reboot on BSOD on my winXP (what a "useful" feature!) and here's what I see.
IRQ_NOT_LESS_OR_EQUAL
STOP:0x0A(0x16,0x02,0x00,0x80500EFC)(with some amount of leading zeros stripped).
Quoted 8 lines
Quoted 5 lines
When this happens, win does something for quite some time, the BSOD comes after quite significant delay.
Is there anything else I can look at, maybe some crash dump or something? I haven't done any windows debugging before.
I would just put a breakpoint on the new condition introduced by the commit, and see what causes the breakage.
I tried this approach and came up with the following backtrace:
Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff1bfc700 (LWP 30219)] 0x00007ffff5ccf107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007ffff5ccf107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff5cd04e8 in __GI_abort () at abort.c:89 #2 0x00007ffff5cc8226 in __assert_fail_base (fmt=0x7ffff5dfece8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7993e2 "xplen == *plen",
file=file@entry=0x799370 "/home/build/src/qemu/git/qemu/exec.c",
line=line@entry=362, function=function@entry=0x799be0 <__PRETTY_FUNCTION__.34759> "address_space_translate_internal") at assert.c:92
#3 0x00007ffff5cc82d2 in __GI___assert_fail (assertion=0x7993e2 "xplen == *plen", file=0x799370 "/home/build/src/qemu/git/qemu/exec.c", line=362,
function=0x799be0 <__PRETTY_FUNCTION__.34759>
"address_space_translate_internal") at assert.c:101
#4 0x000000000040b54b in address_space_translate_internal (d=0x7fffdc127150, addr=0, xlat=0x7ffff1bfb470, plen=0x7ffff1bfb530, resolve_subpage=true) at /home/build/src/qemu/git/qemu/exec.c:362 #5 0x000000000040b643 in address_space_translate (as=0xc1b8c0 <address_space_io>, addr=0, xlat=0x7ffff1bfb540, plen=0x7ffff1bfb530, is_write=true) at /home/build/src/qemu/git/qemu/exec.c:390 #6 0x000000000040fa54 in address_space_rw (as=0xc1b8c0 <address_space_io>, addr=126, attrs=..., buf=0x7ffff1bfb5c0 "\001", len=4, is_write=true) at /home/build/src/qemu/git/qemu/exec.c:2339 #7 0x000000000040fe19 in address_space_write (as=0xc1b8c0 <address_space_io>, addr=126, attrs=..., buf=0x7ffff1bfb5c0 "\001", len=4) at /home/build/src/qemu/git/qemu/exec.c:2431
#8 0x000000000044ef97 in cpu_outl (addr=126, val=1) at /home/build/src/qemu/git/qemu/ioport.c:89
#9 0x0000000000517104 in helper_outl (port=126, data=1) at /home/build/src/qemu/git/qemu/target-i386/misc_helper.c:47 #10 0x0000000040557d03 in code_gen_buffer ()
#11 0x0000000000414916 in cpu_tb_exec (cpu=0x111cc30, tb_ptr=0x40557ce0 <code_gen_buffer+5602528> "A\213n\374\205\355\017\205\067") at /home/build/src/qemu/git/qemu/cpu-exec.c:199
#12 0x0000000000415351 in cpu_x86_exec (env=0x1124e80) at /home/build/src/qemu/git/qemu/cpu-exec.c:519
#13 0x00000000004404e4 in tcg_cpu_exec (env=0x1124e80) at /home/build/src/qemu/git/qemu/cpus.c:1354
#14 0x00000000004405cb in tcg_exec_all () at /home/build/src/qemu/git/qemu/cpus.c:1387
#15 0x000000000043fb7c in qemu_tcg_cpu_thread_fn (arg=0x111cc30) at /home/build/src/qemu/git/qemu/cpus.c:1032
#16 0x00007ffff604b0a4 in start_thread (arg=0x7ffff1bfc700) at pthread_create.c:309
#17 0x00007ffff5d8004d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) p/x 126
$1 = 0x7e
It looks like we're trying to do a 32-bit write to the kvmvapic device which appears as below in "info mtree":
address-space: I/O
0000000000000000-000000000000ffff (prio 0, RW): io
0000000000000000-0000000000000007 (prio 0, RW): dma-chan
0000000000000008-000000000000000f (prio 0, RW): dma-cont
0000000000000020-0000000000000021 (prio 0, RW): pic
0000000000000040-0000000000000043 (prio 0, RW): pit
0000000000000060-0000000000000060 (prio 0, RW): i8042-data
0000000000000061-0000000000000061 (prio 0, RW): pcspk
0000000000000064-0000000000000064 (prio 0, RW): i8042-cmd
0000000000000070-0000000000000071 (prio 0, RW): rtc
000000000000007e-000000000000007f (prio 0, RW): kvmvapic
0000000000000080-0000000000000080 (prio 0, RW): ioport80According to the comments in kvmvapic.c's vapic_write(), a 32-bit write is used to poll for pending IRQs. However with the address clamping enabled, these writes never make it to the kvmvapic which is what causes the breakage in WinXP.
ATB,
Mark.
Quoted 120 lines · Mark Cave-Ayland
Quoted 30 lines · Paolo Bonzini
Quoted 29 lines · Michael Tokarev
Quoted 1 line · Peter Crosthwaite
On Thu, May 7, 2015 at 2:34 AM, Michael Tokarev <[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clampQuoted 7 lines
Quoted 2 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Oh. I didn't know this patch has been reverted before. Anyway, I disabled auto-reboot on BSOD on my winXP (what a "useful" feature!) and here's what I see.
IRQ_NOT_LESS_OR_EQUAL
STOP:0x0A(0x16,0x02,0x00,0x80500EFC)(with some amount of leading zeros stripped).
Quoted 8 lines
Quoted 5 lines
When this happens, win does something for quite some time, the BSOD comes after quite significant delay.
Is there anything else I can look at, maybe some crash dump or something? I haven't done any windows debugging before.
I would just put a breakpoint on the new condition introduced by the commit, and see what causes the breakage.
I tried this approach and came up with the following backtrace:
Program received signal SIGABRT, Aborted.
[Switching to Thread0x7ffff1bfc700(LWP 30219)]0x00007ffff5ccf107in__GI_raise(sig=sig@entry=6) at../nptl/sysdeps/unix/sysv/linux/raise.c:56
56../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#00x00007ffff5ccf107in__GI_raise(sig=sig@entry=6) at../nptl/sysdeps/unix/sysv/linux/raise.c:56
#10x00007ffff5cd04e8in__GI_abort() at abort.c:89
#20x00007ffff5cc8226in__assert_fail_base(fmt=0x7ffff5dfece8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7993e2 "xplen == *plen",
file=file@entry=0x799370 "/home/build/src/qemu/git/qemu/exec.c",
line=line@entry=362, function=function@entry=0x799be0 <__PRETTY_FUNCTION__.34759> "address_space_translate_internal") at assert.c:92
#30x00007ffff5cc82d2in__GI___assert_fail(assertion=0x7993e2 "xplen == *plen", file=0x799370 "/home/build/src/qemu/git/qemu/exec.c", line=362,
function=0x799be0 <__PRETTY_FUNCTION__.34759>
"address_space_translate_internal") at assert.c:101
#40x000000000040b54binaddress_space_translate_internal(d=0x7fffdc127150, addr=0, xlat=0x7ffff1bfb470, plen=0x7ffff1bfb530, resolve_subpage=true) at/home/build/src/qemu/git/qemu/exec.c:362#50x000000000040b643inaddress_space_translate(as=0xc1b8c0 <address_space_io>, addr=0, xlat=0x7ffff1bfb540, plen=0x7ffff1bfb530, is_write=true) at/home/build/src/qemu/git/qemu/exec.c:390
#60x000000000040fa54inaddress_space_rw(as=0xc1b8c0 <address_space_io>, addr=126, attrs=..., buf=0x7ffff1bfb5c0 "\001", len=4, is_write=true) at/home/build/src/qemu/git/qemu/exec.c:2339#70x000000000040fe19inaddress_space_write(as=0xc1b8c0 <address_space_io>, addr=126, attrs=..., buf=0x7ffff1bfb5c0 "\001", len=4) at/home/build/src/qemu/git/qemu/exec.c:2431
#80x000000000044ef97incpu_outl(addr=126, val=1) at/home/build/src/qemu/git/qemu/ioport.c:89
#90x0000000000517104inhelper_outl(port=126, data=1) at/home/build/src/qemu/git/qemu/target-i386/misc_helper.c:47
#100x0000000040557d03incode_gen_buffer()
#110x0000000000414916incpu_tb_exec(cpu=0x111cc30, tb_ptr=0x40557ce0 <code_gen_buffer+5602528> "A\213n\374\205\355\017\205\067") at/home/build/src/qemu/git/qemu/cpu-exec.c:199
#120x0000000000415351incpu_x86_exec(env=0x1124e80) at/home/build/src/qemu/git/qemu/cpu-exec.c:519
#130x00000000004404e4intcg_cpu_exec(env=0x1124e80) at/home/build/src/qemu/git/qemu/cpus.c:1354
#140x00000000004405cbintcg_exec_all() at/home/build/src/qemu/git/qemu/cpus.c:1387
#150x000000000043fb7cinqemu_tcg_cpu_thread_fn(arg=0x111cc30) at/home/build/src/qemu/git/qemu/cpus.c:1032
#160x00007ffff604b0a4instart_thread(arg=0x7ffff1bfc700) at pthread_create.c:309
#170x00007ffff5d8004din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) p/x 126
$1 =0x7eIt looks like we're trying to do a 32-bit write to the kvmvapic device which appears as below in "info mtree":
address-space: I/O
0000000000000000-000000000000ffff (prio 0, RW): io
0000000000000000-0000000000000007 (prio 0, RW): dma-chan 0000000000000008-000000000000000f (prio 0, RW): dma-cont 0000000000000020-0000000000000021 (prio 0, RW): pic 0000000000000040-0000000000000043 (prio 0, RW): pit 0000000000000060-0000000000000060 (prio 0, RW): i8042-data 0000000000000061-0000000000000061 (prio 0, RW): pcspk 0000000000000064-0000000000000064 (prio 0, RW): i8042-cmd 0000000000000070-0000000000000071 (prio 0, RW): rtc 000000000000007e-000000000000007f (prio 0, RW): kvmvapic 0000000000000080-0000000000000080 (prio 0, RW): ioport80According to the comments in kvmvapic.c's
vapic_write(), a 32-bit write is used to poll for pending IRQs. However with the address clamping enabled, these writes never make it to the kvmvapic which is what causes the breakage in WinXP.
Quoted 3 lines
ATB,
Mark.
Good job figuring this out.
Quoted 114 lines · Mark Cave-Ayland
Quoted 30 lines · Paolo Bonzini
Quoted 29 lines · Michael Tokarev
Quoted 1 line · Peter Crosthwaite
On Thu, May 7, 2015 at 2:34 AM, Michael Tokarev <[email protected]> wrote:
...
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clampQuoted 7 lines
Quoted 2 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Oh. I didn't know this patch has been reverted before. Anyway, I disabled auto-reboot on BSOD on my winXP (what a "useful" feature!) and here's what I see.
IRQ_NOT_LESS_OR_EQUAL
STOP:0x0A(0x16,0x02,0x00,0x80500EFC)(with some amount of leading zeros stripped).
Quoted 8 lines
Quoted 5 lines
When this happens, win does something for quite some time, the BSOD comes after quite significant delay.
Is there anything else I can look at, maybe some crash dump or something? I haven't done any windows debugging before.
I would just put a breakpoint on the new condition introduced by the commit, and see what causes the breakage.
I tried this approach and came up with the following backtrace:
Program received signal SIGABRT, Aborted.
[Switching to Thread0x7ffff1bfc700(LWP 30219)]0x00007ffff5ccf107in__GI_raise(sig=sig@entry=6) at../nptl/sysdeps/unix/sysv/linux/raise.c:56
56../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#00x00007ffff5ccf107in__GI_raise(sig=sig@entry=6) at../nptl/sysdeps/unix/sysv/linux/raise.c:56
#10x00007ffff5cd04e8in__GI_abort() at abort.c:89 #20x00007ffff5cc8226in__assert_fail_base(fmt=0x7ffff5dfece8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7993e2 "xplen == *plen",file=file@entry=0x799370 "/home/build/src/qemu/git/qemu/exec.c",line=line@entry=362, function=function@entry=0x799be0 <__PRETTY_FUNCTION__.34759> "
address_space_translate_internal") at assert.c:92
#30x00007ffff5cc82d2in__GI___assert_fail(assertion=0x7993e2 "xplen == *plen", file=0x799370 "/home/build/src/qemu/git/qemu/exec.c", line=362,function=0x799be0 <__PRETTY_FUNCTION__.34759>"
address_space_translate_internal") at assert.c:101
#40x000000000040b54binaddress_space_translate_internal(d=0x7fffdc127150, addr=0, xlat=0x7ffff1bfb470, plen=0x7ffff1bfb530, resolve_subpage=true) at/home/build/src/qemu/git/qemu/exec.c:362#50x000000000040b643inaddress_space_translate(as=0xc1b8c0 <address_space_io>, addr=0, xlat=0x7ffff1bfb540, plen=0x7ffff1bfb530, is_write=true) at/home/build/src/qemu/git/qemu/exec.c:390#60x000000000040fa54inaddress_space_rw(as=0xc1b8c0 <address_space_io>, addr=126, attrs=..., buf=0x7ffff1bfb5c0 "\001", len=4, is_write=true) at/home/build/src/qemu/git/qemu/exec.c:2339#70x000000000040fe19inaddress_space_write(as=0xc1b8c0 <address_space_io>, addr=126, attrs=..., buf=0x7ffff1bfb5c0 "\001", len=4) at/home/build/src/qemu/git/qemu/exec.c:2431
#80x000000000044ef97incpu_outl(addr=126, val=1) at/home/build/src/qemu/git/qemu/ioport.c:89
#90x0000000000517104inhelper_outl(port=126, data=1) at/home/build/src/qemu/git/qemu/target-i386/misc_helper.c:47#100x0000000040557d03incode_gen_buffer()
#110x0000000000414916incpu_tb_exec(cpu=0x111cc30, tb_ptr=0x40557ce0 <code_gen_buffer+5602528> "A\213n\374\205\355\017\205\067") at/home/build/src/qemu/git/qemu/cpu-exec.c:199
#120x0000000000415351incpu_x86_exec(env=0x1124e80) at/home/build/src/qemu/git/qemu/cpu-exec.c:519
#130x00000000004404e4intcg_cpu_exec(env=0x1124e80) at/home/build/src/qemu/git/qemu/cpus.c:1354
#140x00000000004405cbintcg_exec_all() at/home/build/src/qemu/git/qemu/cpus.c:1387
#150x000000000043fb7cinqemu_tcg_cpu_thread_fn(arg=0x111cc30) at/home/build/src/qemu/git/qemu/cpus.c:1032
#160x00007ffff604b0a4instart_thread(arg=0x7ffff1bfc700) at pthread_create.c:309
#170x00007ffff5d8004din clone () at../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) p/x 126
$1 =0x7eIt looks like we're trying to do a 32-bit write to the kvmvapic device which appears as below in "info mtree":
address-space: I/O
0000000000000000-000000000000ffff (prio 0, RW): io0000000000000000-0000000000000007 (prio 0, RW): dma-chan 0000000000000008-000000000000000f (prio 0, RW): dma-cont 0000000000000020-0000000000000021 (prio 0, RW): pic 0000000000000040-0000000000000043 (prio 0, RW): pit 0000000000000060-0000000000000060 (prio 0, RW): i8042-data 0000000000000061-0000000000000061 (prio 0, RW): pcspk 0000000000000064-0000000000000064 (prio 0, RW): i8042-cmd 0000000000000070-0000000000000071 (prio 0, RW): rtc 000000000000007e-000000000000007f (prio 0, RW): kvmvapic 0000000000000080-0000000000000080 (prio 0, RW): ioport80
Quoted 4 lines
According to the comments in kvmvapic.c's
vapic_write(), a 32-bit write is used to poll for pending IRQs. However with the address clamping enabled, these writes never make it to the kvmvapic which is what causes the breakage in WinXP.
Thanks Mark. At the very least kvmvapic.c should set .impl.unaligned to true (like ioport.c does), but also the clamping should be disabled based on .impl.unaligned. I'll test this and report back.
Thanks,
Paolo
Quoted 37 lines · Peter Crosthwaite
Quoted 36 lines · Michael Tokarev
Quoted 34 lines · Michael Tokarev
Quoted 11 lines · Michael Tokarev
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clamp
address_space_translate_internalwill clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic inaddresss_space_translatewas ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable.This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions.
Signed-off-by Peter Crosthwaite <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>
Quoted 8 lines
Quoted 3 lines
This winXP BSOD happens on
x86_64target too. Reverting the above commit from git master fixes the BSOD.Any useful info about IO addresses on that BSOD? The last issue with this patch was IOPort code relying on the bug that this patch fixed. This could be similar and if we can track the failure to a particular address we can fix properly rather than another revert of that patch.
Yes, it's on my todo list.
Paolo
Quoted 31 lines · Michael Tokarev
Quoted 11 lines · Michael Tokarev
Quoted 1 line · 07.05.2015 04:11, G 3 wrote:
Did you boot Windows XP to the desktop? I have tested Windows 95, Windows 2000, and Windows XP. All of them fail to boot to the desktop.
Yes, booted to desktop and did some minimal work in there, installnig one update or two.
Quoted 2 lines
Command used:
./i386-softmmu/qemu-system-i386 -boot c -hda "Windows XP Hard Drive.img"Aha. You run without kvm, in tcg mode. I don't usually do that, lemme try...
Ok, I can reproduce this, winXP BSODs on boot in tcg mode. Git bisect points to this:
commit
23820dbfc79d1c9dce090b4c555994f2bb6a69b3Author: Peter Crosthwaite <[email protected]> Date: Mon Mar 16 22:35:54 2015 -0700exec: Respect
as_translate_internallength clamp
address_space_translate_internalwill clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic inaddresss_space_translatewas ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable.This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions.
Quoted 7 lines
Signed-off-by Peter Crosthwaite <[email protected]>Message-Id: <[email protected]>
Signed-off-by Paolo Bonzini <[email protected]>Cc'ing relevant people.
/mjt
Thank you very much for solving this issue.