Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Darwin guest kernel panics #181

Open
yjftsjthsd-g opened this issue Feb 20, 2019 · 6 comments
Open

Darwin guest kernel panics #181

yjftsjthsd-g opened this issue Feb 20, 2019 · 6 comments
Labels

Comments

@yjftsjthsd-g
Copy link

TLDR: Darwin guest "panic(cpu 0 caller 0xC017DF16): timeRDTSC() calibation failed with 2 attempts"

Host Environment

Host is NetBSD 8.0, HAXM built from latest cvs checkout of /usr/pkgsrc/emulators/haxm (3bdfd1a39021df9b4dfe69e05a277e4e6456494anb2) and using wip/qemu-haxm 3.0.0 with sdl and gtk3 enabled.

Hardware is Dell Latitude E6510 with cpu0: "Intel(R) Core(TM) i7 CPU M 640 @ 2.80GHz" and 8 GB RAM.

To Reproduce

What I ran:
qemu-system-x86_64 --accel hax -cdrom darwinx86-801.iso

What I expected:

  • VM booting to installer

What actually happened:

  • VM started bootloader
  • VM loaded kernel, kexts
  • Guest kernel panic, with error "panic(cpu 0 caller 0xC017DF16): timeRDTSC() calibation failed with 2 attempts"

I reproduced this in 7 of 7 attempts. Notably, if I remove the --accel hax option, then it works.
The only message from qemu is "HAX is working and emulator runs in fast virt mode."

Note: that ISO is from https://sourceforge.net/projects/darwinsource/ - https://sourceforge.net/projects/darwinsource/files/Darwin/8.0.1/darwinx86-801.iso.gz/download

HAXM log:
Only line that's added to dmesg when I rerun is this:

haxm_warning: hax_alloc_pages: HAX_MEM_LOW_4G is ignored
@raphaelning
Copy link
Contributor

Thanks for the report. Darwin is an untested/unsupported guest for HAXM. If you are familiar with its code and want to see it boot on HAXM (which will also benefit #149), maybe you can look into timeRDTSC() and figure out why the calibration fails.

@yjftsjthsd-g
Copy link
Author

Unfortunately, I am not qualified; I'm a mediocre programmer and certainly no kernel dev. I completely understand if you prefer to view this as out of scope for the project.

@krytarowski
Copy link
Contributor

I can boot this Darwin image... http://netbsd.org/~kamil/haxm/darwinx86-801-in-haxm-2019-02-18.png

But indeed this timeRDTSC() sometimes breaks on boot. It seems to be related to timing issues with apic in some guests.

@krytarowski
Copy link
Contributor

OK, this is hardware issue. No hypervisor can precisely emulate TSC.

This bug has to be handled in the darwin guest kernel. Please close this report.

@sskras
Copy link

sskras commented May 25, 2019

@krytarowski ,

No hypervisor can precisely emulate TSC.

Do you mean it impossible at fundmental level (such as stretching from Popek-Goldberg theorem) or that it is just very hard to implement?

Judging by the opposing comments about faking the TSC:
http://theinvisiblethings.blogspot.com/2006/06/introducing-blue-pill.html
... and two "Simple Anti-VMM detection" measures mentioned by Joanna a year later:
https://web.archive.org/web/20100109031241/http://bluepillproject.org/

... I guess it's possible to do so with a reasonable precission (only if complex, challenging, yes).

@krytarowski
Copy link
Contributor

My source of this statement is from @m00nbsd.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants