Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753241AbdLFAP3 (ORCPT ); Tue, 5 Dec 2017 19:15:29 -0500 Received: from mail-pf0-f177.google.com ([209.85.192.177]:40363 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752929AbdLFAP1 (ORCPT ); Tue, 5 Dec 2017 19:15:27 -0500 X-Google-Smtp-Source: AGs4zMZaMvswgJqN/nNxofP7frkERxQ/fRr6mexQrbvxEKYq/BA+fVX49jWhvNW34ZHp1r9ZSCk6Iw== Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH v2] KVM: VMX: Cache IA32_DEBUGCTL in memory From: Nadav Amit In-Reply-To: <20171205215450.GD17273@flask> Date: Tue, 5 Dec 2017 16:15:23 -0800 Cc: Wanpeng Li , LKML , kvm list , Paolo Bonzini , Wanpeng Li , Jim Mattson Message-Id: References: <1511947880-21643-1-git-send-email-wanpeng.li@hotmail.com> <20171205215450.GD17273@flask> To: =?utf-8?B?UmFkaW0gS3LEjW3DocWZ?= X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id vB60FYe0018141 Content-Length: 1195 Lines: 31 Radim Krčmář wrote: > 2017-11-29 01:31-0800, Wanpeng Li: >> 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. >> >> Suggested-by: Jim Mattson >> Cc: Paolo Bonzini >> Cc: Radim Krčmář >> Cc: Jim Mattson >> Signed-off-by: Wanpeng Li >> --- > > Queued, thanks. > > And there is another optimization loosely connected to the "[PATCH v3 > 00/16] Move vcpu_load and vcpu_put calls to arch code" series: > We only need to read the value for the KVM_RUN ioctl. Can you add some warning that would fire in some “debug” mode if the cached value is not identical to the real one? Thanks, Nadav