Re: [PATCH 3/4] drivers/clocksource/hyper-v: Use TSC PFN getter to map vvar page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 02, 2022 at 09:48:47AM -0700, Stanislav Kinsburskiy wrote:
> > > diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
> > > index 311eae30e089..6976416b2c9f 100644
> > > --- a/arch/x86/entry/vdso/vma.c
> > > +++ b/arch/x86/entry/vdso/vma.c
> > > @@ -210,11 +210,10 @@ static vm_fault_t vvar_fault(const struct
> > vm_special_mapping *sm,
> > >
> >  pgprot_decrypted(vma->vm_page_prot));
> > >               }
> > >       } else if (sym_offset == image->sym_hvclock_page) {
> > > -             struct ms_hyperv_tsc_page *tsc_pg = hv_get_tsc_page();
> > > +             pfn = hv_get_tsc_pfn();
> > >
> > > -             if (tsc_pg && vclock_was_used(VDSO_CLOCKMODE_HVCLOCK))
> > > -                     return vmf_insert_pfn(vma, vmf->address,
> > > -                                     virt_to_phys(tsc_pg) >>
> > PAGE_SHIFT);
> > > +             if (pfn && vclock_was_used(VDSO_CLOCKMODE_HVCLOCK))
> > > +                     return vmf_insert_pfn(vma, vmf->address, pfn);
> >
> > hv_get_tsc_pfn() can return 0. You will insert PFN 0 into the page
> > table. I think you should check if the PFN is valid.
> >
> >
> I'm confused. Isn't "if (pfn &&" checks for non-zero value?

I misread. The code is fine.

Wei.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux