From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 01/15] KVM: PPC: Make register read/write wrappers always work Date: Mon, 08 Mar 2010 15:40:17 +0200 Message-ID: <4B94FE41.1040904@redhat.com> References: <1267807842-3751-1-git-send-email-agraf@suse.de> <1267807842-3751-2-git-send-email-agraf@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Alexander Graf Return-path: In-Reply-To: <1267807842-3751-2-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org> Sender: kvm-ppc-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: kvm.vger.kernel.org On 03/05/2010 06:50 PM, Alexander Graf wrote: > We have wrappers to do for example gpr read/write accesses with, > because the contents of registers could be either in the PACA > or in the VCPU struct. > > There's nothing that says we have to have the guest vcpu loaded > when using these wrappers though, so let's introduce a flag that > tells us whether we're inside a vcpu_load context. > > On x86 we always access registers within vcpu_load() context. That simplifies things. Does this not apply here? Even so, sometimes guest registers are present on the cpu, and sometimes in shadow variables (for example, msrs might be loaded or not). The approach here is to always unload and access the variable data. See for example vmx_set_msr() calling vmx_load_host_state() before accessing msrs. Seems like this could reduce the if () tree? -- error compiling committee.c: too many arguments to function