On 11/26/2015 05:43 PM, Paolo Bonzini wrote:

On 26/11/2015 10:06, Andrey Smetanin wrote:

On 11/25/2015 08:14 PM, Paolo Bonzini wrote:

On 25/11/2015 17:55, Andrey Smetanin wrote:

+    gpa = synic->msg_page & PAGE_MASK;
+    page = kvm_vcpu_gfn_to_page(vcpu, gpa >> PAGE_SHIFT);
+    if (is_error_page(page)) {
+        vcpu_err(vcpu, "Hyper-V SynIC can't get msg page, gpa
+             gpa);
+        return;
+    }
+    msg_page = kmap_atomic(page);

But the message page is not being pinned, is it?

Actually I don't know anything about pinning.
Is it pinning against page swapping ?

Yes.  Unless the page is pinned, kmap_atomic can fail.
kmap_atomic() can't fail for a valid page struct. Does
kvm_vcpu_gfn_to_page() can provide invalid page(swapped page) struct
which may pass is_error_page(page) check but can leads to incorrect
behavior inside kmap_atomic()?

No, you're right.  Nevermind, I was confused because I thought you
needed kmap_atomic rather than kmap.  Here using kmap_atomic is just an
optimization, so it's okay.  (If you needed kmap_atomic, the problem
would have been that kvm_vcpu_gfn_to_page() can sleep).

In patch 7/7 you're also not in atomic context, so kvm_vcpu_gfn_to_page
is okay.

Shouldn't have reviewed the patch when tired. :)

Then the patches look good, I think.  With a testcase I can try them out
and hopefully merge them for Linux 4.5 / QEMU 2.6.
Thank you!

We already have a working Hyper-V SynIC timers kvm-unit-tests test case.
We are going to send appropriate patches seria into kvm-unit-tests git.

But  kvm-unit-tests master now broken:
> make
objcopy -O elf32-i386 x86/memory.elf x86/memory.flat
make: *** No rule to make target 'x86/pku.o', needed by 'x86/pku.elf'. Stop.

The problem is in latest commit 3da70799dd3cf1169c4668b4a3fd6f598528b8b9.

The commit adds 'pku' test case building, but not added any pku.c implementation file.

[root@asm-pc kvm-unit-tests]# ls -al x86/pku.c
ls: cannot access x86/pku.c: No such file or directory

Could you please fix it ?


To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to