From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1ys9-0000K8-Au for qemu-devel@nongnu.org; Thu, 26 Nov 2015 10:54:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a1ys5-00020C-RM for qemu-devel@nongnu.org; Thu, 26 Nov 2015 10:54:13 -0500 Received: from relay.parallels.com ([195.214.232.42]:37654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a1ys5-0001z7-JX for qemu-devel@nongnu.org; Thu, 26 Nov 2015 10:54:09 -0500 References: <1448464821-8199-1-git-send-email-asmetanin@virtuozzo.com> <1448464821-8199-7-git-send-email-asmetanin@virtuozzo.com> <5655E748.4080503@redhat.com> <5655E800.5030309@virtuozzo.com> <5655EC83.4090201@redhat.com> <5656CBAA.3050803@virtuozzo.com> <56571A7F.6080504@redhat.com> From: Andrey Smetanin Message-ID: <56572B00.6070208@virtuozzo.com> Date: Thu, 26 Nov 2015 18:53:36 +0300 MIME-Version: 1.0 In-Reply-To: <56571A7F.6080504@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1 6/7] kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack Reply-To: asmetanin@virtuozzo.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , kvm@vger.kernel.org Cc: Gleb Natapov , Haiyang Zhang , qemu-devel@nongnu.org, Roman Kagan , "Denis V. Lunev" , Vitaly Kuznetsov , "K. Y. Srinivasan" 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 >>>>> 0x%llx\n", >>>>> + 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 ? > > Paolo >