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 11:24:09 +0300 Message-ID: <4ABB2CA9.1020403@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> <4ABB2597.7090107@redhat.com> <20090924080312.GB9832@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Jan Kiszka , kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:21273 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155AbZIXIYJ (ORCPT ); Thu, 24 Sep 2009 04:24:09 -0400 In-Reply-To: <20090924080312.GB9832@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/24/2009 11:03 AM, Gleb Natapov wrote: >> >>> 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. >> >> > So should we stick cpu_synchronize_state() before each register > accesses? I think it is reasonable to omit it if all callers do it > already. > If the callee is static we can and should avoid it. If the function is exported then we shouldn't rely on callers. IOW, it's fine to depend on local details (which a reader can easily gain), but better to avoid depending on global details. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.