Skip to contentSkip to conversation

guest MSR access in the realmode emulation

PATCH In review Nitin A Kamble 3 participants 9 messages Jan 31, 2008 – Feb 4, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 guest MSR access in the realmode emulation

Hi Keir,
Our QA guys found out that SMP windows guest was not booting with the
new realmode code. I looked into it and found out the realmode msr access is missing from the new realmode code.
Attached is the patch to implement the MSR access in the new realmode
emulation code.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open
xen/arch/x86/hvm/vmx/realmode.c +40 -0
diff -r 01e178f7ec6d xen/arch/x86/hvm/vmx/realmode.c
@@ -410,6 +410,44 @@ realmode_write_cr(
     return X86EMUL_OKAY;
 }
 
+static int
+realmode_read_msr(
+    unsigned long reg,
+    uint64_t *val,
+    struct x86_emulate_ctxt *ctxt)
+{
+    switch ( reg )
+    {
+    case 0xc0000080L: /* IA32_EFER */
+        rdmsrl(reg, *val);
+        break;
+    default:
+        gdprintk(XENLOG_ERR, "reading of msr 0x%lx by guest not allowed\n", reg);
+        return X86EMUL_UNHANDLEABLE;
+    }
+
+    return X86EMUL_OKAY;
+}
+
+static int
+realmode_write_msr(
+    unsigned long reg,
+    uint64_t val,
+    struct x86_emulate_ctxt *ctxt)
+{
+    switch ( reg )
+    {
+    case 0xc0000080L: /* IA32_EFER */
+        wrmsrl(reg, val);
+        break;
+    default:
+        gdprintk(XENLOG_ERR, "writing of msr 0x%lx by guest not allowed\n", reg);
+        return X86EMUL_UNHANDLEABLE;
+    }
+
+    return X86EMUL_OKAY;
+}
+
 static int realmode_write_rflags(
     unsigned long val,
     struct x86_emulate_ctxt *ctxt)
@@ -495,6 +533,8 @@ static struct x86_emulate_ops realmode_e
     .write_io      = realmode_write_io,
     .read_cr       = realmode_read_cr,
     .write_cr      = realmode_write_cr,
+    .read_msr      = realmode_read_msr,
+    .write_msr     = realmode_write_msr,
     .write_rflags  = realmode_write_rflags,
     .wbinvd        = realmode_wbinvd,
     .cpuid         = realmode_cpuid,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

You can't directly access the physical EFER. I've modified the patch to go via the intercept routines in vmx.c and checked it in.

Thanks,
Keir

Quoted 8 lines · Nitin A Kamble

Hi Keir,
Our QA guys found out that SMP windows guest was not booting with the
new realmode code. I looked into it and found out the realmode msr access is missing from the new realmode code.
Attached is the patch to implement the MSR access in the new realmode
emulation code.

#2 lore raw

That's right, I realized it later on. I was planning to change it the same way.

Thanks & Regards,

Nitin

Linux Open Source Technology Center, Intel Corporation

------------------------------------------------------------------------
--------

The Mind is like a parachute; it works much better when it's open.

Quoted 8 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Thursday, January 31, 2008 1:34 AM
To: Kamble, Nitin A
Cc: [email protected]
Subject: Re: [PATCH] guest MSR access in the realmode emulation

You can't directly access the physical EFER. I've modified the patch to

go

Quoted 9 lines

via the intercept routines in vmx.c and checked it in.

Thanks,
Keir

Quoted 2 lines · Nitin A Kamble

Hi Keir,
Our QA guys found out that SMP windows guest was not booting with

the

Quoted 3 lines
Quoted 3 lines

new realmode code. I looked into it and found out the realmode msr access is missing from the new realmode code.
Attached is the patch to implement the MSR access in the new

realmode

Quoted 4 lines
Quoted 3 lines

emulation code.

#3 lore raw

PATCH 1/1 FP instruction in realmode emulation

In reply to Keir Fraser

Hi Keir,
Our QA team also found that the latest base kernel was failing on the
new real mode emulation code. I looked into it, and found out the culprit to be guest_mode() call in the do_device_not_available handler.
This guest_mode() check over there is no more correct as the guest may
run in hypervisor context in the form of emulation. The attached patch fixes this issue by removing the check. Another fix would be modifying the guest_mode() macro. What do you think, Is this check is needed there now ?

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open
xen/arch/x86/traps.c +0 -2
diff -r 5f997b5b8a58 xen/arch/x86/traps.c
@@ -2621,8 +2621,6 @@ asmlinkage void do_device_not_available(
 {
     struct vcpu *curr = current;
 
-    BUG_ON(!guest_mode(regs));
-
     setup_fpu(curr);
 
     if ( curr->arch.guest_context.ctrlreg[0] & X86_CR0_TS )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

Re: [PATCH] FP instruction in realmode emulation

I am surprised we get there: when emulating FPU instructions we first call the ->load_fpu_ctxt hook, which calls vmx_do_no_device_fault() -> setup_fpu() -> clts(). Obviously there is something going wrong though... can you provide a backtrace?

Whatever the problem is, bear in mind that we should never take a FPU fault from within Xen and if we do that is a bug in itself.

-- Keir

Quoted 12 lines · Nitin A Kamble

Hi Keir,
Our QA team also found that the latest base kernel was failing on the
new real mode emulation code. I looked into it, and found out the culprit to be guest_mode() call in the do_device_not_available handler.
This guest_mode() check over there is no more correct as the guest may
run in hypervisor context in the form of emulation. The attached patch fixes this issue by removing the check. Another fix would be modifying the guest_mode() macro. What do you think, Is this check is needed there now ?

#5 lore raw

RE: [PATCH] FP instruction in realmode emulation

Hi Keir,

Here is the call trace.

(XEN) HVM2: Press F10 to select boot device.

(XEN) HVM2: Booting from Hard Disk...

(XEN) HVM2: int13_harddisk: function 41, unmapped device for ELDL=81

(XEN) HVM2: int13_harddisk: function 08, unmapped device for ELDL=81

(XEN) HVM2: *** int 15h function AX=00C0, BX=0000 not yet supported!

(XEN) Xen BUG at traps.c:2624

(XEN) ----[ Xen-3.3-unstable x86_32p debug=n Not tainted ]----

(XEN) CPU: 1

(XEN) EIP: e008:[<ff138be2>] do_device_not_available+0x22/0xc0

(XEN) EFLAGS: 00010202 CONTEXT: hypervisor

(XEN) eax: ff1e3fb4 ebx: ff238080 ecx: 0000e010 edx: ff1e3b44

(XEN) esi: ff1e3b44 edi: 0000e010 ebp: 00000002 esp: ff1e3b20

(XEN) cr0: 8005003b cr4: 000026f0 cr3: 2bed3000 cr2: 00000000

(XEN) ds: e010 es: e010 fs: 0000 gs: 0000 ss: e010 cs: e008

(XEN) Xen stack trace from esp=ff1e3b20:

(XEN) 00000000 00000002 00000002 ff1674f1 00000002 ff238080 0000e010
ff1874b3

(XEN) ff1e3b44 000000db 00000002 ff1678e0 00000000 ff1e3ed0 00000002
ff238000

(XEN) 00070000 ff14090c 0000e008 00010246 ff1e3ed0 ff1e3d34 00000000
00000001

(XEN) ff1e3ed0 ff1e3ed0 00000000 00011e32 ff1cd080 ffbf8080 ffe38000
ff1505a2

(XEN) ff1e3fb4 ff1e3fb4 05117067 ff1e3fb4 ff1e3fb4 ff1e3fb4 ff1e3fb4
ff1e3fb4

(XEN) 05117067 80000000 00000004 ff1e3de0 ff1e3edc 00000000 00000004
00000002

(XEN) 00000000 00000000 00000044 00000001 ff1e3e04 00000000 ff1e3edc
00000086

(XEN) 00000020 ff1c4080 00000000 00000000 00000020 00000002 9000f000
00053493

(XEN) 00000001 00004477 d0567b2d ff1e3fb4 ff12b711 00000001 00000001
4200442e

(XEN) 00000000 ff1cd080 00000002 00000286 00000000 00000000 00000400
e3000000

(XEN) 00000003 00000000 00000286 00000000 00000004 00000000 00000004
ff1cd080

(XEN) ffbf8003 00000002 ff238d40 00000000 ff1cd080 00000000 ff238080
00000002

(XEN) 00000000 00000000 ffffffff ff12cff2 ff238080 0002baf6 00000000
00000001

(XEN) 00000000 fed40f00 00000000 fffffffe 00000001 00000000 000000db
00000001

(XEN) 0000ac01 00000000 00009038 00000000 00008f98 00000000 00001fd6
ff1676a0

(XEN) ff1676a0 ff1676a0 ff1676a0 ff1676a0 00000001 00000002 ffffffff
00009fc0

(XEN) f6c18710 fe0004f8 ff23e080 00000002 f6c18710 00009000 00000000
00000246

(XEN) 0041fbf8 00002948 00008fd8 00000010 00b80002 0000075d 00000000
00000246

(XEN) 00008f98 00000000 00000000 00000000 00000000 00000000 00939000
0000ffff

(XEN) 00090000 00000000 ff1e3d34 ff1e3d3c ff1e3d38 ff1e3d4c 00000001
00000002

(XEN) Xen call trace:

(XEN) [<ff138be2>] do_device_not_available+0x22/0xc0

(XEN) [<ff1674f1>] realmode_emulate_write+0x41/0xd0

(XEN) [<ff1874b3>] handle_exception+0x73/0xa7

(XEN) [<ff1678e0>] realmode_load_fpu_ctxt+0x0/0x30

(XEN) [<ff14090c>] x86_emulate+0x421c/0x9280

(XEN) [<ff1505a2>] hvm_mmio_intercept+0xe2/0x420

(XEN) [<ff12b711>] get_page+0x41/0x100

(XEN) [<ff12cff2>] get_page_type+0x6e2/0x890

(XEN) [<ff1676a0>] realmode_emulate_read+0x0/0x30

(XEN) [<ff1676a0>] realmode_emulate_read+0x0/0x30

(XEN) [<ff1676a0>] realmode_emulate_read+0x0/0x30

(XEN) [<ff1676a0>] realmode_emulate_read+0x0/0x30

(XEN) [<ff1676a0>] realmode_emulate_read+0x0/0x30

(XEN) [<ff120a2e>] __find_next_zero_bit+0x7e/0x90

(XEN) [<ff186c97>] map_domain_page+0x97/0x200

(XEN) [<ff1ae000>] bogus_saved_magic+0x246/0x1016

(XEN) [<ff14c6a8>] __hvm_copy+0x88/0x290

(XEN) [<ff151416>] hvm_io_assist+0xb6/0x12b0

Thanks & Regards,

Nitin

Linux Open Source Technology Center, Intel Corporation

------------------------------------------------------------------------
--------

The Mind is like a parachute; it works much better when it's open.

Quoted 8 lines

-----Original Message-----

From: Keir Fraser [mailto:[email protected]]

Sent: Friday, February 01, 2008 12:48 AM

To: Kamble, Nitin A

Quoted 7 lines

Subject: Re: [PATCH] FP instruction in realmode emulation

I am surprised we get there: when emulating FPU instructions we first

call

Quoted 3 lines

the ->load_fpu_ctxt hook, which calls vmx_do_no_device_fault() ->

setup_fpu() -> clts(). Obviously there is something going wrong

though...

Quoted 5 lines

can you provide a backtrace?

Whatever the problem is, bear in mind that we should never take a FPU

fault

Quoted 4 lines

from within Xen and if we do that is a bug in itself.

Quoted 11 lines

-- Keir

Quoted 3 lines · Nitin A Kamble

Hi Keir,

Our QA team also found that the latest base kernel was failing on

the

Quoted 3 lines
Quoted 3 lines

new real mode emulation code. I looked into it, and found out the

culprit to be guest_mode() call in the do_device_not_available

handler.

Quoted 1 line
Quoted 1 line

This guest_mode() check over there is no more correct as the guest

may

Quoted 1 line
Quoted 1 line

run in hypervisor context in the form of emulation. The attached

patch

Quoted 1 line
Quoted 1 line

fixes this issue by removing the check. Another fix would be

modifying

Quoted 1 line
Quoted 1 line

the guest_mode() macro. What do you think, Is this check is needed

there

Quoted 9 lines
Quoted 7 lines

now ?

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#6 lore raw

Re: [PATCH] FP instruction in realmode emulation

Can you get a backtrace from a debug build? It looks like realmode_load_fpu_ctxt() is taking a fault, but it¹s hard to be certain because there¹s a lot of chaff in the backtrace.

-- Keir

Quoted 80 lines · Nitin A

Hi Keir,

Here is the call trace.

(XEN) HVM2: Press F10 to select boot device.
(XEN) HVM2: Booting from Hard Disk...
(XEN) HVM2: int13_harddisk: function 41, unmapped device for ELDL=81 (XEN) HVM2: int13_harddisk: function 08, unmapped device for ELDL=81 (XEN) HVM2: *** int 15h function AX=00C0, BX=0000 not yet supported! (XEN) Xen BUG at traps.c:2624
(XEN) ----[ Xen-3.3-unstable x86_32p debug=n Not tainted ]----
(XEN) CPU: 1
(XEN) EIP: e008:[<ff138be2>] do_device_not_available+0x22/0xc0
(XEN) EFLAGS: 00010202 CONTEXT: hypervisor

(XEN) eax: ff1e3fb4   ebx: ff238080  ecx: 0000e010   edx: ff1e3b44
(XEN) esi: ff1e3b44   edi: 0000e010  ebp: 00000002   esp: ff1e3b20
(XEN) cr0: 8005003b   cr4: 000026f0  cr3: 2bed3000   cr2: 00000000

(XEN) ds: e010 es: e010 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen stack trace from esp=ff1e3b20:
(XEN) 00000000 00000002 00000002 ff1674f1 00000002 ff238080 0000e010
ff1874b3
(XEN) ff1e3b44 000000db 00000002 ff1678e0 00000000 ff1e3ed0 00000002
ff238000
(XEN) 00070000 ff14090c 0000e008 00010246 ff1e3ed0 ff1e3d34 00000000
00000001
(XEN) ff1e3ed0 ff1e3ed0 00000000 00011e32 ff1cd080 ffbf8080 ffe38000
ff1505a2
(XEN) ff1e3fb4 ff1e3fb4 05117067 ff1e3fb4 ff1e3fb4 ff1e3fb4 ff1e3fb4
ff1e3fb4
(XEN) 05117067 80000000 00000004 ff1e3de0 ff1e3edc 00000000 00000004
00000002
(XEN) 00000000 00000000 00000044 00000001 ff1e3e04 00000000 ff1e3edc
00000086
(XEN) 00000020 ff1c4080 00000000 00000000 00000020 00000002 9000f000
00053493
(XEN) 00000001 00004477 d0567b2d ff1e3fb4 ff12b711 00000001 00000001
4200442e
(XEN) 00000000 ff1cd080 00000002 00000286 00000000 00000000 00000400
e3000000
(XEN) 00000003 00000000 00000286 00000000 00000004 00000000 00000004
ff1cd080
(XEN) ffbf8003 00000002 ff238d40 00000000 ff1cd080 00000000 ff238080
00000002
(XEN) 00000000 00000000 ffffffff ff12cff2 ff238080 0002baf6 00000000
00000001
(XEN) 00000000 fed40f00 00000000 fffffffe 00000001 00000000 000000db
00000001
(XEN) 0000ac01 00000000 00009038 00000000 00008f98 00000000 00001fd6
ff1676a0
(XEN) ff1676a0 ff1676a0 ff1676a0 ff1676a0 00000001 00000002 ffffffff
00009fc0
(XEN) f6c18710 fe0004f8 ff23e080 00000002 f6c18710 00009000 00000000
00000246
(XEN) 0041fbf8 00002948 00008fd8 00000010 00b80002 0000075d 00000000
00000246
(XEN) 00008f98 00000000 00000000 00000000 00000000 00000000 00939000
0000ffff
(XEN) 00090000 00000000 ff1e3d34 ff1e3d3c ff1e3d38 ff1e3d4c 00000001
00000002
(XEN) Xen call trace:

(XEN)    [<ff138be2>] do_device_not_available+0x22/0xc0
(XEN)    [<ff1674f1>] realmode_emulate_write+0x41/0xd0
(XEN)    [<ff1874b3>] handle_exception+0x73/0xa7
(XEN)    [<ff1678e0>] realmode_load_fpu_ctxt+0x0/0x30
(XEN)    [<ff14090c>] x86_emulate+0x421c/0x9280
(XEN)    [<ff1505a2>] hvm_mmio_intercept+0xe2/0x420
(XEN)    [<ff12b711>] get_page+0x41/0x100
(XEN)    [<ff12cff2>] get_page_type+0x6e2/0x890
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff120a2e>] __find_next_zero_bit+0x7e/0x90
(XEN)    [<ff186c97>] map_domain_page+0x97/0x200
(XEN)    [<ff1ae000>] bogus_saved_magic+0x246/0x1016
(XEN)    [<ff14c6a8>] __hvm_copy+0x88/0x290
(XEN)    [<ff151416>] hvm_io_assist+0xb6/0x12b0
Quoted 42 lines

Thanks & Regards,
Nitin
Linux Open Source Technology Center, Intel Corporation
------------------------------------------------------------------------------
--

The Mind is like a parachute; it works much better when it's open.

Quoted 32 lines
Quoted 32 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Friday, February 01, 2008 12:48 AM
To: Kamble, Nitin A
Cc: [email protected]
Subject: Re: [PATCH] FP instruction in realmode emulation

I am surprised we get there: when emulating FPU instructions we first call the ->load_fpu_ctxt hook, which calls vmx_do_no_device_fault() -> setup_fpu() -> clts(). Obviously there is something going wrong though... can you provide a backtrace?

Whatever the problem is, bear in mind that we should never take a FPU fault from within Xen and if we do that is a bug in itself.

-- Keir

Quoted 12 lines · Nitin A Kamble
Quoted 12 lines

Hi Keir,
Our QA team also found that the latest base kernel was failing on the
new real mode emulation code. I looked into it, and found out the culprit to be guest_mode() call in the do_device_not_available handler.
This guest_mode() check over there is no more correct as the guest may
run in hypervisor context in the form of emulation. The attached patch fixes this issue by removing the check. Another fix would be modifying the guest_mode() macro. What do you think, Is this check is needed there now ?

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#7 lore raw

Re: [PATCH] FP instruction in realmode emulation

In reply to Kamble, Nitin A

I eyeballed the problem. Please try c/s 16971.

Thanks,
Keir

Quoted 80 lines · Nitin A

Hi Keir,

Here is the call trace.

(XEN) HVM2: Press F10 to select boot device.
(XEN) HVM2: Booting from Hard Disk...
(XEN) HVM2: int13_harddisk: function 41, unmapped device for ELDL=81 (XEN) HVM2: int13_harddisk: function 08, unmapped device for ELDL=81 (XEN) HVM2: *** int 15h function AX=00C0, BX=0000 not yet supported! (XEN) Xen BUG at traps.c:2624
(XEN) ----[ Xen-3.3-unstable x86_32p debug=n Not tainted ]----
(XEN) CPU: 1
(XEN) EIP: e008:[<ff138be2>] do_device_not_available+0x22/0xc0
(XEN) EFLAGS: 00010202 CONTEXT: hypervisor

(XEN) eax: ff1e3fb4   ebx: ff238080  ecx: 0000e010   edx: ff1e3b44
(XEN) esi: ff1e3b44   edi: 0000e010  ebp: 00000002   esp: ff1e3b20
(XEN) cr0: 8005003b   cr4: 000026f0  cr3: 2bed3000   cr2: 00000000

(XEN) ds: e010 es: e010 fs: 0000 gs: 0000 ss: e010 cs: e008
(XEN) Xen stack trace from esp=ff1e3b20:
(XEN) 00000000 00000002 00000002 ff1674f1 00000002 ff238080 0000e010
ff1874b3
(XEN) ff1e3b44 000000db 00000002 ff1678e0 00000000 ff1e3ed0 00000002
ff238000
(XEN) 00070000 ff14090c 0000e008 00010246 ff1e3ed0 ff1e3d34 00000000
00000001
(XEN) ff1e3ed0 ff1e3ed0 00000000 00011e32 ff1cd080 ffbf8080 ffe38000
ff1505a2
(XEN) ff1e3fb4 ff1e3fb4 05117067 ff1e3fb4 ff1e3fb4 ff1e3fb4 ff1e3fb4
ff1e3fb4
(XEN) 05117067 80000000 00000004 ff1e3de0 ff1e3edc 00000000 00000004
00000002
(XEN) 00000000 00000000 00000044 00000001 ff1e3e04 00000000 ff1e3edc
00000086
(XEN) 00000020 ff1c4080 00000000 00000000 00000020 00000002 9000f000
00053493
(XEN) 00000001 00004477 d0567b2d ff1e3fb4 ff12b711 00000001 00000001
4200442e
(XEN) 00000000 ff1cd080 00000002 00000286 00000000 00000000 00000400
e3000000
(XEN) 00000003 00000000 00000286 00000000 00000004 00000000 00000004
ff1cd080
(XEN) ffbf8003 00000002 ff238d40 00000000 ff1cd080 00000000 ff238080
00000002
(XEN) 00000000 00000000 ffffffff ff12cff2 ff238080 0002baf6 00000000
00000001
(XEN) 00000000 fed40f00 00000000 fffffffe 00000001 00000000 000000db
00000001
(XEN) 0000ac01 00000000 00009038 00000000 00008f98 00000000 00001fd6
ff1676a0
(XEN) ff1676a0 ff1676a0 ff1676a0 ff1676a0 00000001 00000002 ffffffff
00009fc0
(XEN) f6c18710 fe0004f8 ff23e080 00000002 f6c18710 00009000 00000000
00000246
(XEN) 0041fbf8 00002948 00008fd8 00000010 00b80002 0000075d 00000000
00000246
(XEN) 00008f98 00000000 00000000 00000000 00000000 00000000 00939000
0000ffff
(XEN) 00090000 00000000 ff1e3d34 ff1e3d3c ff1e3d38 ff1e3d4c 00000001
00000002
(XEN) Xen call trace:

(XEN)    [<ff138be2>] do_device_not_available+0x22/0xc0
(XEN)    [<ff1674f1>] realmode_emulate_write+0x41/0xd0
(XEN)    [<ff1874b3>] handle_exception+0x73/0xa7
(XEN)    [<ff1678e0>] realmode_load_fpu_ctxt+0x0/0x30
(XEN)    [<ff14090c>] x86_emulate+0x421c/0x9280
(XEN)    [<ff1505a2>] hvm_mmio_intercept+0xe2/0x420
(XEN)    [<ff12b711>] get_page+0x41/0x100
(XEN)    [<ff12cff2>] get_page_type+0x6e2/0x890
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
(XEN)    [<ff120a2e>] __find_next_zero_bit+0x7e/0x90
(XEN)    [<ff186c97>] map_domain_page+0x97/0x200
(XEN)    [<ff1ae000>] bogus_saved_magic+0x246/0x1016
(XEN)    [<ff14c6a8>] __hvm_copy+0x88/0x290
(XEN)    [<ff151416>] hvm_io_assist+0xb6/0x12b0
Quoted 42 lines

Thanks & Regards,
Nitin
Linux Open Source Technology Center, Intel Corporation
------------------------------------------------------------------------------
--

The Mind is like a parachute; it works much better when it's open.

Quoted 32 lines
Quoted 32 lines

-----Original Message-----
From: Keir Fraser [mailto:[email protected]]
Sent: Friday, February 01, 2008 12:48 AM
To: Kamble, Nitin A
Cc: [email protected]
Subject: Re: [PATCH] FP instruction in realmode emulation

I am surprised we get there: when emulating FPU instructions we first call the ->load_fpu_ctxt hook, which calls vmx_do_no_device_fault() -> setup_fpu() -> clts(). Obviously there is something going wrong though... can you provide a backtrace?

Whatever the problem is, bear in mind that we should never take a FPU fault from within Xen and if we do that is a bug in itself.

-- Keir

Quoted 12 lines · Nitin A Kamble
Quoted 12 lines

Hi Keir,
Our QA team also found that the latest base kernel was failing on the
new real mode emulation code. I looked into it, and found out the culprit to be guest_mode() call in the do_device_not_available handler.
This guest_mode() check over there is no more correct as the guest may
run in hypervisor context in the form of emulation. The attached patch fixes this issue by removing the check. Another fix would be modifying the guest_mode() macro. What do you think, Is this check is needed there now ?

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw

RE: Re: [PATCH] FP instruction in realmode emulation

Hi Keir and Nitin,

We have tried the HVM booting with base kernel on #16971. There isn't problem.

Best Regards,
Yongkang You

________________________________

From: [email protected] [mailto:[email protected]] On Behalf Of Keir Fraser
Sent: Sunday, February 03, 2008 6:32 PM
To: Kamble, Nitin A
Cc: [email protected]
Subject: [Xen-devel] Re: [PATCH] FP instruction in realmode emulation

I eyeballed the problem. Please try c/s 16971.

Thanks,
Keir

On 1/2/08 19:14, "Kamble, Nitin A" <[email protected]> wrote:

	Hi Keir,
	 
	Here is the call trace.
	 
	(XEN) HVM2: Press F10 to select boot device.
	(XEN) HVM2: Booting from Hard Disk...
	(XEN) HVM2: int13_harddisk: function 41, unmapped device for ELDL=81
	(XEN) HVM2: int13_harddisk: function 08, unmapped device for ELDL=81
	(XEN) HVM2: *** int 15h function AX=00C0, BX=0000 not yet supported!
	(XEN) Xen BUG at traps.c:2624
	(XEN) ----[ Xen-3.3-unstable  x86_32p debug=n  Not tainted ]----
	(XEN) CPU:    1
	(XEN) EIP:    e008:[<ff138be2>] do_device_not_available+0x22/0xc0
	(XEN) EFLAGS: 00010202   CONTEXT: hypervisor
	(XEN) eax: ff1e3fb4   ebx: ff238080  ecx: 0000e010   edx: ff1e3b44
	(XEN) esi: ff1e3b44   edi: 0000e010  ebp: 00000002   esp: ff1e3b20
	(XEN) cr0: 8005003b   cr4: 000026f0  cr3: 2bed3000   cr2: 00000000
	(XEN) ds: e010   es: e010   fs: 0000   gs: 0000   ss: e010   cs: e008
	(XEN) Xen stack trace from esp=ff1e3b20:
	(XEN)    00000000 00000002 00000002 ff1674f1 00000002 ff238080 0000e010 ff1874b3
	(XEN)    ff1e3b44 000000db 00000002 ff1678e0 00000000 ff1e3ed0 00000002 ff238000
	(XEN)    00070000 ff14090c 0000e008 00010246 ff1e3ed0 ff1e3d34 00000000 00000001
	(XEN)    ff1e3ed0 ff1e3ed0 00000000 00011e32 ff1cd080 ffbf8080 ffe38000 ff1505a2
	(XEN)    ff1e3fb4 ff1e3fb4 05117067 ff1e3fb4 ff1e3fb4 ff1e3fb4 ff1e3fb4 ff1e3fb4
	(XEN)    05117067 80000000 00000004 ff1e3de0 ff1e3edc 00000000 00000004 00000002
	(XEN)    00000000 00000000 00000044 00000001 ff1e3e04 00000000 ff1e3edc 00000086
	(XEN)    00000020 ff1c4080 00000000 00000000 00000020 00000002 9000f000 00053493
	(XEN)    00000001 00004477 d0567b2d ff1e3fb4 ff12b711 00000001 00000001 4200442e
	(XEN)    00000000 ff1cd080 00000002 00000286 00000000 00000000 00000400 e3000000
	(XEN)    00000003 00000000 00000286 00000000 00000004 00000000 00000004 ff1cd080
	(XEN)    ffbf8003 00000002 ff238d40 00000000 ff1cd080 00000000 ff238080 00000002
	(XEN)    00000000 00000000 ffffffff ff12cff2 ff238080 0002baf6 00000000 00000001
	(XEN)    00000000 fed40f00 00000000 fffffffe 00000001 00000000 000000db 00000001
	(XEN)    0000ac01 00000000 00009038 00000000 00008f98 00000000 00001fd6 ff1676a0
	(XEN)    ff1676a0 ff1676a0 ff1676a0 ff1676a0 00000001 00000002 ffffffff 00009fc0
	(XEN)    f6c18710 fe0004f8 ff23e080 00000002 f6c18710 00009000 00000000 00000246
	(XEN)    0041fbf8 00002948 00008fd8 00000010 00b80002 0000075d 00000000 00000246
	(XEN)    00008f98 00000000 00000000 00000000 00000000 00000000 00939000 0000ffff
	(XEN)    00090000 00000000 ff1e3d34 ff1e3d3c ff1e3d38 ff1e3d4c 00000001 00000002
	(XEN) Xen call trace:
	(XEN)    [<ff138be2>] do_device_not_available+0x22/0xc0
	(XEN)    [<ff1674f1>] realmode_emulate_write+0x41/0xd0
	(XEN)    [<ff1874b3>] handle_exception+0x73/0xa7
	(XEN)    [<ff1678e0>] realmode_load_fpu_ctxt+0x0/0x30
	(XEN)    [<ff14090c>] x86_emulate+0x421c/0x9280
	(XEN)    [<ff1505a2>] hvm_mmio_intercept+0xe2/0x420
	(XEN)    [<ff12b711>] get_page+0x41/0x100
	(XEN)    [<ff12cff2>] get_page_type+0x6e2/0x890
	(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
	(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
	(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
	(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
	(XEN)    [<ff1676a0>] realmode_emulate_read+0x0/0x30
	(XEN)    [<ff120a2e>] __find_next_zero_bit+0x7e/0x90
	(XEN)    [<ff186c97>] map_domain_page+0x97/0x200
	(XEN)    [<ff1ae000>] bogus_saved_magic+0x246/0x1016
	(XEN)    [<ff14c6a8>] __hvm_copy+0x88/0x290
	(XEN)    [<ff151416>] hvm_io_assist+0xb6/0x12b0
	
	 
	Thanks & Regards,
	Nitin
	Linux Open Source Technology Center, Intel Corporation
	--------------------------------------------------------------------------------
	 
	The Mind is like a parachute; it works much better when it's open.
	 
	>-----Original Message-----
	>From: Keir Fraser [mailto:[email protected]]
	>Sent: Friday, February 01, 2008 12:48 AM
	>To: Kamble, Nitin A
	>Cc: [email protected]
	>Subject: Re: [PATCH] FP instruction in realmode emulation
	> 
	>I am surprised we get there: when emulating FPU instructions we first call
	>the ->load_fpu_ctxt hook, which calls vmx_do_no_device_fault() ->
	>setup_fpu() -> clts(). Obviously there is something going wrong though...
	>can you provide a backtrace?
	> 
	>Whatever the problem is, bear in mind that we should never take a FPU fault
	>from within Xen and if we do that is a bug in itself.
	> 
	> -- Keir
	> 
	>On 1/2/08 00:12, "Nitin A Kamble" <[email protected]> wrote:
	> 
	>> Hi Keir,
	>>   Our QA team also found that the latest base kernel was failing on the
	>> new real mode emulation code. I looked into it, and found out the
	>> culprit to be guest_mode() call in the do_device_not_available handler.
	>>   This guest_mode() check over there is no more correct as the guest may
	>> run in hypervisor context in the form of emulation. The attached patch
	>> fixes this issue by removing the check. Another fix would be modifying
	>> the guest_mode() macro. What do you think, Is this check is needed there
	>> now ?
	>> 
	>> Signed-off-By: Nitin A Kamble <[email protected]>
	>> 
	> 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel