[<prev] [next>] [day] [month] [year] [list]
Message-ID: <Y2LNJRj/NSZlYz8o@liuwe-devbox-debian-v2>
Date: Wed, 2 Nov 2022 20:03:49 +0000
From: Wei Liu <wei.liu@...nel.org>
To: Stanislav Kinsburskiy <stanislav.kinsburskiy@...il.com>
Cc: Wei Liu <wei.liu@...nel.org>,
Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Dexuan Cui <decui@...rosoft.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org
Subject: Re: [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.
Powered by blists - more mailing lists