From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] Don't call cpu_synchronize_state() in apic_init_reset() Date: Thu, 24 Sep 2009 10:53:59 +0300 Message-ID: <4ABB2597.7090107@redhat.com> References: <1253631112-26124-1-git-send-email-gleb@redhat.com> <1253631112-26124-3-git-send-email-gleb@redhat.com> <4AB9E3BC.7060304@redhat.com> <4ABA399F.6030003@web.de> <4ABA3C14.7080803@redhat.com> <4ABA42A1.4010904@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , kvm@vger.kernel.org To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:20109 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751534AbZIXHx7 (ORCPT ); Thu, 24 Sep 2009 03:53:59 -0400 In-Reply-To: <4ABA42A1.4010904@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On 09/23/2009 06:45 PM, Jan Kiszka wrote: >> Functions calling each other in the same subsystem can rely on callers >> calling cpu_synchronize_state(). Across subsystems, that's another >> matter, exported functions should try not to rely on implementation >> details of their callers. >> >> (You might argue that the apic is not separate subsystem wrt an x86 cpu, >> and I'm not sure I have a counterargument) >> >> > I do accept this argument. It's just that my feeling is that we are > lacking proper review of the required call sites of cpu_sychronize_state > and rather put it where some regression popped up (and that only in > qemu-kvm...). > That's life... > The new rule is: Synchronize the states before accessing registers (or > in-kernel devices) the first time after a vmexit to user space. No, the rule is: synchronize state before accessing registers. Extra synchronization is cheap, while missing synchronization is very expensive. > But, > e.g., I do not see where we do this on CPU reset. > That's a bug. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.