From: lantianyu1986@xxxxxxxxx <lantianyu1986@xxxxxxxxx> Sent: Monday, July 29, 2019 12:53 AM > > This is to prepare to add Hyper-V sched clock callback and move > Hyper-V reference TSC initialization much earlier in the boot > process when timestamp is 0. So no discontinuity is observed > when pv_ops.time.sched_clock to calculate its offset. This earlier > initialization requires that the Hyper-V TSC page be allocated > statically instead of with vmalloc(), so fixup the references > to the TSC page and the method of getting its physical address. I'd suggest tweaking the commit message wording a bit: Prepare to add Hyper-V sched clock callback and move Hyper-V Reference TSC initialization much earlier in the boot process. Earlier initialization is needed so that it happens while the timestamp value is still 0 and no discontinuity in the timestamp will occur when pv_ops.time.sched_clock calculates its offset. The earlier initialization requires that the Hyper-V TSC page be allocated statically instead of with vmalloc(), so fixup the references to the TSC page and the method of getting its physical address. > > Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx> > --- > arch/x86/entry/vdso/vma.c | 2 +- > drivers/clocksource/hyperv_timer.c | 12 ++++-------- > 2 files changed, 5 insertions(+), 9 deletions(-) > > @@ -280,12 +280,8 @@ static bool __init hv_init_tsc_clocksource(void) > if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE)) > return false; > > - tsc_pg = vmalloc(PAGE_SIZE); > - if (!tsc_pg) > - return false; > - > hyperv_cs = &hyperv_cs_tsc; > - phys_addr = page_to_phys(vmalloc_to_page(tsc_pg)); > + phys_addr = virt_to_phys(&tsc_pg) & PAGE_MASK; The and'ing with PAGE_MASK isn't needed. You've set up tsc_pg to ensure it is page aligned, so there's no need to mask out any low order bits. That's why the previous code didn't do the masking either. > > /* > * The Hyper-V TLFS specifies to preserve the value of reserved > -- > 2.14.5