From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752138AbdK2SU4 (ORCPT ); Wed, 29 Nov 2017 13:20:56 -0500 Received: from mga03.intel.com ([134.134.136.65]:20917 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751111AbdK2SUx (ORCPT ); Wed, 29 Nov 2017 13:20:53 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,338,1508828400"; d="scan'208";a="7619969" From: Andi Kleen To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Wanpeng Li , Jim Mattson Subject: Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory References: <1511935673-7371-1-git-send-email-wanpeng.li@hotmail.com> Date: Wed, 29 Nov 2017 10:20:51 -0800 In-Reply-To: <1511935673-7371-1-git-send-email-wanpeng.li@hotmail.com> (Wanpeng Li's message of "Tue, 28 Nov 2017 22:07:53 -0800") Message-ID: <87fu8xj69o.fsf@linux.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Wanpeng Li writes: > From: Wanpeng Li > > MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored > each time during world switch. Jim from Google pointed out that > when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time, > and the 25% of vmx_vcpu_run cpu time is occupied by get_debugctlmsr(). > This patch caches the host IA32_DEBUGCTL MSR and saves/restores > the host IA32_DEBUGCTL msr when guest/host switches to avoid to > save/restore each time during world switch. FWIW i've seen this too on L2 profiles. But I haven't looked too closely, but I suspect you'll clobber global kernel debugger state this way. You would at least need some interface for KDB etc. to invalidate your cache. -Andi