Linux-HyperV List
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu@kernel.org>
To: Stanislav Kinsburskiy <stanislav.kinsburskiy@gmail.com>
Cc: Wei Liu <wei.liu@kernel.org>,
	Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Dexuan Cui <decui@microsoft.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org
Subject: Re: [PATCH 3/4] drivers/clocksource/hyper-v: Use TSC PFN getter to map vvar page
Date: Wed, 2 Nov 2022 20:03:49 +0000	[thread overview]
Message-ID: <Y2LNJRj/NSZlYz8o@liuwe-devbox-debian-v2> (raw)
In-Reply-To: <CA+DrgLzxmjWg0-Zvg6gf+vm2EisPYJozC64Y8aZAqkvvn-c7Zw@mail.gmail.com>

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.

  parent reply	other threads:[~2022-11-02 20:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 17:30 [PATCH 0/4] hyper-v: Introduce TSC page for root partition Stanislav Kinsburskii
2022-11-01 17:31 ` [PATCH 1/4] drivers/clocksource/hyper-v: Introduce a pointer to TSC page Stanislav Kinsburskii
2022-11-02 18:56   ` Michael Kelley (LINUX)
     [not found]     ` <CA+DrgLxD8X3cjFNAXYjxr-1opJG_uzU-Ajvz_poMccaiANtQ3g@mail.gmail.com>
2022-11-02 20:44       ` Michael Kelley (LINUX)
2022-11-01 17:31 ` [PATCH 2/4] drivers/clocksource/hyper-v: Introduce TSC MSR register structure Stanislav Kinsburskii
2022-11-02 13:16   ` Anirudh Rayabharam
2022-11-02 18:57   ` Michael Kelley (LINUX)
2022-11-02 19:06   ` Michael Kelley (LINUX)
     [not found]     ` <CA+DrgLzYpFHUzYmvP_qhTMkaYhjRsgW3eaQfMYYpGiE2AHzjLw@mail.gmail.com>
2022-11-02 20:30       ` Michael Kelley (LINUX)
     [not found]         ` <CA+DrgLzLATDPvO-Ngi5O5kMx-zqBVYtx+GmM=8E5y3P1X0fMsw@mail.gmail.com>
2022-11-02 21:27           ` Michael Kelley (LINUX)
2022-11-02 21:49             ` Stanislav Kinsburskii
2022-11-01 17:31 ` [PATCH 3/4] drivers/clocksource/hyper-v: Use TSC PFN getter to map vvar page Stanislav Kinsburskii
2022-11-02 12:45   ` Wei Liu
     [not found]     ` <CA+DrgLzxmjWg0-Zvg6gf+vm2EisPYJozC64Y8aZAqkvvn-c7Zw@mail.gmail.com>
2022-11-02 20:03       ` Wei Liu [this message]
2022-11-01 17:31 ` [PATCH 4/4] drivers/clocksource/hyper-v: Add TSC page support for root partition Stanislav Kinsburskii
2022-11-02 13:18   ` Anirudh Rayabharam
2022-11-02 19:13   ` Michael Kelley (LINUX)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2LNJRj/NSZlYz8o@liuwe-devbox-debian-v2 \
    --to=wei.liu@kernel.org \
    --cc=bp@alien8.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kys@microsoft.com \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=skinsburskii@linux.microsoft.com \
    --cc=stanislav.kinsburskiy@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox