Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756716AbcCCKuc (ORCPT ); Thu, 3 Mar 2016 05:50:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55922 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753360AbcCCKua (ORCPT ); Thu, 3 Mar 2016 05:50:30 -0500 Subject: Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC To: Suravee Suthikulpanit , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= 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> <56D8150E.1070408@amd.com> Cc: joro@8bytes.org, alex.williamson@redhat.com, gleb@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com, "Wu, Feng" From: Paolo Bonzini Message-ID: <56D816F0.2040403@redhat.com> Date: Thu, 3 Mar 2016 11:50:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56D8150E.1070408@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 883 Lines: 24 On 03/03/2016 11:42, Suravee Suthikulpanit wrote: > In facts, instead of setting up the vAPIC backing page address when > calling kvm_arch_vcpu_load(), we should be able to do it when calling > kvm_arch_vcpu_sched_in(). This seems more appropriate since the > kvm_arch_vcpu_load() is also called in many unnecessary occasions via > vcpu_load() (in the arch/x86/kvm/x86.c). The same goes for the > kvm_arch_vcpu_put(). > > However, there is no kvm_arch_vcpu_sched_out(). But that can be added > easily. > > What do you think? How much code is involved? It seems an unnecessary complication... Unless you can profile a difference, I would leave it in kvm_arch_vcpu_load()/kvm_arch_vcpu_put(). Note that sched_in and sched_out are not called once per invocation of KVM_RUN---only through the preempt notifiers. So I'm not sure it is enough to use sched_in and sched_out. Paolo