Thread (1 message) 1 message, 1 author, 2022-11-02

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

From: Wei Liu <wei.liu@kernel.org>
Date: 2022-11-02 20:04:05
Also in: lkml

Possibly related (same subject, not in this thread)

On Wed, Nov 02, 2022 at 09:48:47AM -0700, Stanislav Kinsburskiy wrote:
quoted
quoted
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,
quoted
 pgprot_decrypted(vma->vm_page_prot));
quoted
              }
      } 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);
quoted
+             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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help