From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suravee Suthikulpanit Subject: Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Date: Thu, 3 Mar 2016 17:42:22 +0700 Message-ID: <56D8150E.1070408@amd.com> References: <56C2C1BF.7010700@amd.com> <56C312E1.1080902@redhat.com> <20160216141330.GG10555@potion.brq.redhat.com> <56C354A5.4040807@redhat.com> <20160216180618.GA18952@potion.brq.redhat.com> <56C52B80.5050104@amd.com> <20160218141817.GA6289@potion.brq.redhat.com> <56C5DA62.8080204@redhat.com> <20160218154343.GA18904@potion.brq.redhat.com> <56C5E8E1.9060900@redhat.com> <20160218162701.GB6289@potion.brq.redhat.com> <56C5FCCF.5010802@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: , , , , , , , "Wu, Feng" To: Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: Received: from mail-bn1on0089.outbound.protection.outlook.com ([157.56.110.89]:6928 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751658AbcCCKms (ORCPT ); Thu, 3 Mar 2016 05:42:48 -0500 In-Reply-To: <56C5FCCF.5010802@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Hi On 02/19/2016 12:18 AM, Paolo Bonzini wrote: > > > On 18/02/2016 17:27, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >> 2016-02-18 16:53+0100, Paolo Bonzini: >>> Patch 9 is okay, but it is also necessary to clear IsRunning in >>> kvm_arch_vcpu_blocking and set it in kvm_arch_vcpu_unblocking. In >>> addition, vcpu_put/vcpu_load should not modify IsRunning between >>> kvm_arch_vcpu_blocking and kvm_arch_vcpu_unblocking. Do you agree? >> >> Yes. >> >> I think we don't need to clear IsRunning on preemption, which would >> simplify the protection. (I haven't thought much about userspace ex= it, >> so maybe we could skip that one as well, but we don't need to now.) >> >> The reason for that is that KVM knows that the VCPU was scheduled ou= t, >> so it couldn't do much in the AVIC VMEXIT. >> (KVM could force scheduler to pritioritize the VCPU, but our kick >> doesn't do that now and it seems like a bad idea.) >> >> Does it seem reasonable? > > Yes, and in fact it wouldn't need to clear and set IsRunning on > vcpu_put/vcpu_load; only on vcpu_blocking/vcpu_unblocking. > > The IsRunning flag is more of a IsNotHalted flag, in the end. > > Paolo > In facts, instead of setting up the vAPIC backing page address when=20 calling kvm_arch_vcpu_load(), we should be able to do it when calling=20 kvm_arch_vcpu_sched_in(). This seems more appropriate since the=20 kvm_arch_vcpu_load() is also called in many unnecessary occasions via=20 vcpu_load() (in the arch/x86/kvm/x86.c). The same goes for the=20 kvm_arch_vcpu_put(). However, there is no kvm_arch_vcpu_sched_out(). But that can be added=20 easily. What do you think? Suravee