mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-04 23:24:56 +00:00
hv: debug: Add hv console callback to VM-exit event
In some scenarios (e.g., nested) where lapic-pt is enabled for a vcpu running on a pcpu hosting console timer, the hv console will be inaccessible. This patch adds the console callback to every VM-exit event so that the console can still be somewhat functional under such circumstance. Since this is VM-exit driven, the VM-exit/second can be low in certain cases (e.g., idle or running stress workload). In extreme cases where the guest panics/hangs, there will be no VM-exits at all. In most cases, the shell is laggy but functional (probably enough for debugging purpose). Tracked-On: #6312 Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
This commit is contained in:
@@ -172,6 +172,28 @@ void console_setup_timer(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* When lapic-pt is enabled for a vcpu working on the pcpu hosting
|
||||
* console timer (currently BSP), we utilize vm-exits to drive the console.
|
||||
*
|
||||
* Note that currently this approach will result in a laggy shell when
|
||||
* the number of VM-exits/second is low (which is mostly true when lapic-pt is
|
||||
* enabled).
|
||||
*/
|
||||
void console_vmexit_callback(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
static uint64_t prev_tsc = 0;
|
||||
uint64_t tsc;
|
||||
|
||||
/* console_setup_timer is called on BSP only. */
|
||||
if ((pcpuid_from_vcpu(vcpu) == BSP_CPU_ID) && (is_lapic_pt_enabled(vcpu))) {
|
||||
tsc = cpu_ticks();
|
||||
if (tsc - prev_tsc > (TICKS_PER_MS * CONSOLE_KICK_TIMER_TIMEOUT)) {
|
||||
console_timer_callback(NULL);
|
||||
prev_tsc = tsc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void suspend_console(void)
|
||||
{
|
||||
del_timer(&console_timer);
|
||||
|
||||
Reference in New Issue
Block a user