lkml.org 
[lkml]   [2022]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/4] drivers/clocksource/hyper-v: Use TSC PFN getter to map vvar page
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.

\
 
 \ /
  Last update: 2022-11-02 21:04    [W:0.114 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site