Re: Timer calculation for hypervisor

<[email protected]> Sun, 17 Jul 2022 07:37:24 +0300
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <[email protected]>
Couple of nanoseconds might be several execution cycles on your host.
Single cache miss with DRAM access is ~10ns.
How much is your "couple"?

In general Bochs is trying to be as reproducible as possible and therefore its time is defined according to x86 instructions execution.
1 tick = 1 instructions.
For rep string flows 1 tick = 1 iteration of the repeat.
This models machine with exactly 1 IPC

-----Original Message-----
From: nick <[email protected]> 
Sent: Sunday, 17 July 2022 2:21
To: [email protected]
Subject: [Bochs-developers] Timer calculation for hypervisor

Greetings,

I am doing a fun project, where I am replacing the cpu emulator of bochs with a hypervisor(intel vmx).

There are virtual devices, like the keyboard controller, that are using a timer for certain events.

The way I am handling it with the hypervisor is to use a vmx timer exit(VMX-preemption timer) every couple nanoseconds and then handle it in bochs by calling `bx_pc_system.tickn(timer)`.

I noticed that there is a significant execution delay based on the value of the timers. I was wondering what is the right way to calculate the timer for the fastest execution(both the VMX and the value in bochs).

My cpu is `i7-6700K CPU @ 4.00GHz` if that somehow helps with the calculation.

Thank you,





_______________________________________________
bochs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers