From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nadav Amit Subject: Re: [PATCH v2] KVM: VMX: Cache IA32_DEBUGCTL in memory Date: Tue, 5 Dec 2017 16:15:23 -0800 Message-ID: References: <1511947880-21643-1-git-send-email-wanpeng.li@hotmail.com> <20171205215450.GD17273@flask> Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Wanpeng Li , LKML , kvm list , Paolo Bonzini , Wanpeng Li , Jim Mattson To: =?utf-8?B?UmFkaW0gS3LEjW3DocWZ?= Return-path: In-Reply-To: <20171205215450.GD17273@flask> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > 2017-11-29 01:31-0800, Wanpeng Li: >> From: Wanpeng Li >>=20 >> MSR_IA32_DEBUGCTLMSR is zeroed on VMEXIT, so it is saved/restored=20 >> each time during world switch. Jim from Google pointed out that=20 >> when running schbench in L2, vmx_vcpu_run will occupy 4% cpu time,=20 >> and the 25% of vmx_vcpu_run cpu time is occupied by = get_debugctlmsr().=20 >> This patch caches the host IA32_DEBUGCTL MSR and saves/restores=20 >> the host IA32_DEBUGCTL msr when guest/host switches to avoid to=20 >> save/restore each time during world switch. >>=20 >> Suggested-by: Jim Mattson >> Cc: Paolo Bonzini >> Cc: Radim Kr=C4=8Dm=C3=A1=C5=99 >> Cc: Jim Mattson >> Signed-off-by: Wanpeng Li >> --- >=20 > Queued, thanks. >=20 > 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 =E2=80=9Cdebug=E2=80=9D = mode if the cached value is not identical to the real one? Thanks, Nadav=