RE: Revision 297176 - hyperv/evttimer: Use an independent message slot so that it can work

2016-04-12 Thread Dexuan Cui
Hi smokehydration,
Sephe has committed a few patches into 11-CURRENT to address the issue
and the details of the patches can be found at
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208238

Can you please try today's Head branch?
We believe the issue should be fixed, and it would be great to have your 
confirmation.

Thanks,
-- Dexuan


> -Original Message-
> From: Dexuan Cui
> Sent: Friday, April 8, 2016 19:04
> To: 'Sepherosa Ziehau' <se...@freebsd.org>; smokehydrat...@tutanota.com
> Cc: freebsd-current@freebsd.org
> Subject: RE: Revision 297176 - hyperv/evttimer: Use an independent message
> slot so that it can work
> 
> Hi smokehydration,
> I guess your VM config file has something like "viridian = 1" or
> "viridian_enlightenment=xxx".
> 
> With this, Xen tries to pretend to be Hyper-V, but obviously Xen can't be 100%
> Hyper-V.
> BTW, I know at least KVM can have the same behavior.
> 
> We have to find a reliable way to distinguish Hyper-V from other hypervisors
> that
> try to pretend to be Hyper-V...
> 
> Thanks,
> -- Dexuan
> 
> 
> > -Original Message-
> > From: owner-freebsd-curr...@freebsd.org [mailto:owner-freebsd-
> > curr...@freebsd.org] On Behalf Of Sepherosa Ziehau
> > Sent: Friday, April 8, 2016 17:29
> > To: smokehydrat...@tutanota.com
> > Cc: freebsd-current@freebsd.org
> > Subject: Re: Revision 297176 - hyperv/evttimer: Use an independent message
> > slot so that it can work
> >
> > I have reverted this change.  It will be brought back, after some code
> > refactoring.
> >
> > On Fri, Apr 8, 2016 at 4:22 PM,  <smokehydrat...@tutanota.com> wrote:
> > >
> > > Hello
> > >
> > > I recently update one of my many vms from an older CURRENT revision
> > r297196
> > > to r297659 and on reboot it just panics with the following:
> > >
> > > FreeBSD clang version 3.8.0 (tags/RELEHSE_380/final 262564) (based on
> LLVM
> > > 3.8.0
> > > )
> > > VT(vga): text 80x25
> > > Timecounter "Hyper-V" frequency 1000 Hz quality 1000
> > > Kernel trap 9 with interrupts disabled
> > >
> > >
> > > Fatal trap 9: general protection fault while in kernel mode
> > > cpuid = 0: apic id = 00
> > > instruction pointer = 0x20:0x8100d6?9
> > > stack pointer   = 0x28:ox820d5c30
> > > frame pointer   = 0x28:ox820d5c40
> > > code segment= base 0x0, limit 0xf, type 0x1b
> > > = DPL 0, pres 1, long 1, def32 0, gran 1
> > > processor eflags= IOPL = 0
> > > current process = 0 ()
> > > [ thread pid 0 tid 0 ]
> > > stopped at  hv_get_timecount+0x9:   rdmsr
> > > db) wh
> > > Tracing pid 0 tid 0 td 0x81d0eff0
> > > hv_get_timecount() at hv_get_timecount+0x9/frame 0x820d5c40
> > > tc_init() at tc_init+0x251/frame 0x820d5c90
> > > mi_startup() at mi_startup+0x118/frame 0x820d5cb0
> > > btext() at btext+ox2c   =
> > > db>
> > >
> > > I changed hv_hv.c back to the previous revision (297176) and no panics 
> > > under
> > > Xen VM.
> > >
> > > Thanks!
> > >
> > > p.s. not sure why Xen gets detected as HyperV
> > >
> >
> >
> >
> > --
> > Tomorrow Will Never Die
> > ___
> > freebsd-current@freebsd.org mailing list
> >
> https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2flists.freebs
> > d.org%2fmailman%2flistinfo%2ffreebsd-
> >
> current=01%7c01%7cdecui%40microsoft.com%7c3a2924929b7b4158aa4f
> >
> 08d35f9043e2%7c72f988bf86f141af91ab2d7cd011db47%7c1=omVqiBrK
> > 9sWAd10koNsZkG72nSoXnjFdXKUsXhGFK6k%3d
> > To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


RE: Revision 297176 - hyperv/evttimer: Use an independent message slot so that it can work

2016-04-08 Thread Dexuan Cui
> From: Konstantin Belousov [mailto:kostik...@gmail.com]
> Sent: Friday, April 8, 2016 22:02
> To: Dexuan Cui <de...@microsoft.com>
> Cc: Sepherosa Ziehau <se...@freebsd.org>; smokehydrat...@tutanota.com;
> freebsd-current@freebsd.org
> Subject: Re: Revision 297176 - hyperv/evttimer: Use an independent message
> slot so that it can work
> 
> On Fri, Apr 08, 2016 at 11:03:46AM +, Dexuan Cui wrote:
> > Hi smokehydration,
> > I guess your VM config file has something like "viridian = 1" or
> > "viridian_enlightenment=xxx".
> >
> > With this, Xen tries to pretend to be Hyper-V, but obviously Xen can't be 
> > 100%
> Hyper-V.
> > BTW, I know at least KVM can have the same behavior.
> >
> > We have to find a reliable way to distinguish Hyper-V from other hypervisors
> that
> > try to pretend to be Hyper-V...
> 
> At the time when the probe is done, the IDT entries for exceptions are
> already set. You can use rdmsr_safe() instead of rdmsr() to read Hyper-V
> timecounter register. Then, a fault definitely indicates that the kernel
> is not executing on the compatible Hyper-V emulator. Hopefully, a
> non-fault read is not impossible for undesired cases.

Hi Konstantin,
Thanks for the suggestion!

We're trying to solve the issue with "hv_features/hv_recommendations" of
some Hyper-V specific CPUIDs -- the other hypervisors are unlikely to touch
these CPUIDs; even if they do touch the CPUIDs, I think they should
respect the meanings of the CPUIDs and shouldn't incorrectly report
capabilities they doesn't really have.

A drafted patch is here:
https://github.com/howard0su/freebsd/commit/d1d031e0d8991ab1f94de00325705d266829c647
We'll clean up & post it

-- Dexuan
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Revision 297176 - hyperv/evttimer: Use an independent message slot so that it can work

2016-04-08 Thread Konstantin Belousov
On Fri, Apr 08, 2016 at 11:03:46AM +, Dexuan Cui wrote:
> Hi smokehydration,
> I guess your VM config file has something like "viridian = 1" or
> "viridian_enlightenment=xxx".
> 
> With this, Xen tries to pretend to be Hyper-V, but obviously Xen can't be 
> 100% Hyper-V.
> BTW, I know at least KVM can have the same behavior.
> 
> We have to find a reliable way to distinguish Hyper-V from other hypervisors 
> that
> try to pretend to be Hyper-V...

At the time when the probe is done, the IDT entries for exceptions are
already set. You can use rdmsr_safe() instead of rdmsr() to read Hyper-V
timecounter register. Then, a fault definitely indicates that the kernel
is not executing on the compatible Hyper-V emulator. Hopefully, a
non-fault read is not impossible for undesired cases.
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


RE: Revision 297176 - hyperv/evttimer: Use an independent message slot so that it can work

2016-04-08 Thread Dexuan Cui
Hi smokehydration,
I guess your VM config file has something like "viridian = 1" or
"viridian_enlightenment=xxx".

With this, Xen tries to pretend to be Hyper-V, but obviously Xen can't be 100% 
Hyper-V.
BTW, I know at least KVM can have the same behavior.

We have to find a reliable way to distinguish Hyper-V from other hypervisors 
that
try to pretend to be Hyper-V...

Thanks,
-- Dexuan


> -Original Message-
> From: owner-freebsd-curr...@freebsd.org [mailto:owner-freebsd-
> curr...@freebsd.org] On Behalf Of Sepherosa Ziehau
> Sent: Friday, April 8, 2016 17:29
> To: smokehydrat...@tutanota.com
> Cc: freebsd-current@freebsd.org
> Subject: Re: Revision 297176 - hyperv/evttimer: Use an independent message
> slot so that it can work
> 
> I have reverted this change.  It will be brought back, after some code
> refactoring.
> 
> On Fri, Apr 8, 2016 at 4:22 PM,  <smokehydrat...@tutanota.com> wrote:
> >
> > Hello
> >
> > I recently update one of my many vms from an older CURRENT revision
> r297196
> > to r297659 and on reboot it just panics with the following:
> >
> > FreeBSD clang version 3.8.0 (tags/RELEHSE_380/final 262564) (based on LLVM
> > 3.8.0
> > )
> > VT(vga): text 80x25
> > Timecounter "Hyper-V" frequency 1000 Hz quality 1000
> > Kernel trap 9 with interrupts disabled
> >
> >
> > Fatal trap 9: general protection fault while in kernel mode
> > cpuid = 0: apic id = 00
> > instruction pointer = 0x20:0x8100d6?9
> > stack pointer   = 0x28:ox820d5c30
> > frame pointer   = 0x28:ox820d5c40
> > code segment= base 0x0, limit 0xf, type 0x1b
> > = DPL 0, pres 1, long 1, def32 0, gran 1
> > processor eflags= IOPL = 0
> > current process = 0 ()
> > [ thread pid 0 tid 0 ]
> > stopped at  hv_get_timecount+0x9:   rdmsr
> > db) wh
> > Tracing pid 0 tid 0 td 0x81d0eff0
> > hv_get_timecount() at hv_get_timecount+0x9/frame 0x820d5c40
> > tc_init() at tc_init+0x251/frame 0x820d5c90
> > mi_startup() at mi_startup+0x118/frame 0x820d5cb0
> > btext() at btext+ox2c   =
> > db>
> >
> > I changed hv_hv.c back to the previous revision (297176) and no panics under
> > Xen VM.
> >
> > Thanks!
> >
> > p.s. not sure why Xen gets detected as HyperV
> >
> 
> 
> 
> --
> Tomorrow Will Never Die
> ___
> freebsd-current@freebsd.org mailing list
> https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2flists.freebs
> d.org%2fmailman%2flistinfo%2ffreebsd-
> current=01%7c01%7cdecui%40microsoft.com%7c3a2924929b7b4158aa4f
> 08d35f9043e2%7c72f988bf86f141af91ab2d7cd011db47%7c1=omVqiBrK
> 9sWAd10koNsZkG72nSoXnjFdXKUsXhGFK6k%3d
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Revision 297176 - hyperv/evttimer: Use an independent message slot so that it can work

2016-04-08 Thread Sepherosa Ziehau
I have reverted this change.  It will be brought back, after some code
refactoring.

On Fri, Apr 8, 2016 at 4:22 PM,   wrote:
>
> Hello
>
> I recently update one of my many vms from an older CURRENT revision r297196
> to r297659 and on reboot it just panics with the following:
>
> FreeBSD clang version 3.8.0 (tags/RELEHSE_380/final 262564) (based on LLVM
> 3.8.0
> )
> VT(vga): text 80x25
> Timecounter "Hyper-V" frequency 1000 Hz quality 1000
> Kernel trap 9 with interrupts disabled
>
>
> Fatal trap 9: general protection fault while in kernel mode
> cpuid = 0: apic id = 00
> instruction pointer = 0x20:0x8100d6?9
> stack pointer   = 0x28:ox820d5c30
> frame pointer   = 0x28:ox820d5c40
> code segment= base 0x0, limit 0xf, type 0x1b
> = DPL 0, pres 1, long 1, def32 0, gran 1
> processor eflags= IOPL = 0
> current process = 0 ()
> [ thread pid 0 tid 0 ]
> stopped at  hv_get_timecount+0x9:   rdmsr
> db) wh
> Tracing pid 0 tid 0 td 0x81d0eff0
> hv_get_timecount() at hv_get_timecount+0x9/frame 0x820d5c40
> tc_init() at tc_init+0x251/frame 0x820d5c90
> mi_startup() at mi_startup+0x118/frame 0x820d5cb0
> btext() at btext+ox2c   =
> db>
>
> I changed hv_hv.c back to the previous revision (297176) and no panics under
> Xen VM.
>
> Thanks!
>
> p.s. not sure why Xen gets detected as HyperV
>



-- 
Tomorrow Will Never Die
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


RE: Revision 297176 - hyperv/evttimer: Use an independent message slot so that it can work

2016-04-08 Thread smokehydration

Hello

I recently update one of my many vms from an older CURRENT revision r297196 
to r297659 and on reboot it just panics with the following:

FreeBSD clang version 3.8.0 (tags/RELEHSE_380/final 262564) (based on LLVM 
3.8.0
)
VT(vga): text 80x25
Timecounter "Hyper-V" frequency 1000 Hz quality 1000
Kernel trap 9 with interrupts disabled


Fatal trap 9: general protection fault while in kernel mode
cpuid = 0: apic id = 00
instruction pointer = 0x20:0x8100d6?9
stack pointer   = 0x28:ox820d5c30
frame pointer   = 0x28:ox820d5c40
code segment    = base 0x0, limit 0xf, type 0x1b
    = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags    = IOPL = 0
current process = 0 ()
[ thread pid 0 tid 0 ]
stopped at  hv_get_timecount+0x9:   rdmsr
db) wh
Tracing pid 0 tid 0 td 0x81d0eff0
hv_get_timecount() at hv_get_timecount+0x9/frame 0x820d5c40
tc_init() at tc_init+0x251/frame 0x820d5c90
mi_startup() at mi_startup+0x118/frame 0x820d5cb0
btext() at btext+ox2c   =
db>

I changed hv_hv.c back to the previous revision (297176) and no panics under 
Xen VM.

Thanks!

p.s. not sure why Xen gets detected as HyperV

___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"