Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbdLEVy4 (ORCPT ); Tue, 5 Dec 2017 16:54:56 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59518 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751958AbdLEVyz (ORCPT ); Tue, 5 Dec 2017 16:54:55 -0500 Date: Tue, 5 Dec 2017 22:54:51 +0100 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li , Jim Mattson Subject: Re: [PATCH v2] KVM: VMX: Cache IA32_DEBUGCTL in memory Message-ID: <20171205215450.GD17273@flask> References: <1511947880-21643-1-git-send-email-wanpeng.li@hotmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1511947880-21643-1-git-send-email-wanpeng.li@hotmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Dec 2017 21:54:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 984 Lines: 23 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.