On 9/9/2024 9:16 PM, Michael Kelley wrote:
From: Naman Jain <namj...@linux.microsoft.com> Sent: Sunday, September 8, 2024 
10:39 PM

read_hv_sched_clock_tsc() assumes that the Hyper-V clock counter is
bigger than the variable hv_sched_clock_offset, which is cached during
early boot, but depending on the timing this assumption may be false

..

+       old_save_sched_clock_state = x86_platform.save_sched_clock_state;
+       x86_platform.save_sched_clock_state = hv_save_sched_clock_state;
+       old_restore_sched_clock_state = x86_platform.restore_sched_clock_state;
+       x86_platform.restore_sched_clock_state = hv_restore_sched_clock_state;

This Hyper-V clocksource/timer driver has intentionally been kept
instruction set architecture independent.  See the comment at the top
of the source code file. We've also avoided any "#ifdef x86" or similar, though
it's OK to have #ifdef's on specific clock-related functionality like
GENERIC_SCHED_CLOCK.

The reference to "x86_platform" violates the intended independence. The
code to save-on-suspend and update-on-resume can probably stay in this
module in generic form, but hooking the functions into the x86_platform
function call mechanism should move to x86-specific code.

Michael


Thanks for the review and guidance Michael. I'll take care of it in v2.


Regards,
Naman


+
        /*
         * TSC page mapping works differently in root compared to guest.
         * - In guest partition the guest PFN has to be passed to the

base-commit: da3ea35007d0af457a0afc87e84fddaebc4e0b63
--
2.25.1



Reply via email to