From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753613AbdK2JNi (ORCPT ); Wed, 29 Nov 2017 04:13:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55174 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbdK2JNf (ORCPT ); Wed, 29 Nov 2017 04:13:35 -0500 Subject: Re: [PATCH] KVM: VMX: Cache IA32_DEBUGCTL in memory To: Wanpeng Li Cc: "linux-kernel@vger.kernel.org" , kvm , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li , Jim Mattson References: <1511935673-7371-1-git-send-email-wanpeng.li@hotmail.com> <5ce1fb8a-05e1-3122-9194-73194a851da4@redhat.com> From: Paolo Bonzini Message-ID: Date: Wed, 29 Nov 2017 10:13:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 29 Nov 2017 09:13:35 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/11/2017 09:51, Wanpeng Li wrote: > 2017-11-29 16:48 GMT+08:00 Paolo Bonzini : >> On 29/11/2017 07:07, Wanpeng Li wrote: >>> 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: Jim Mattson >>> Cc: Paolo Bonzini >>> Cc: Radim Krčmář >>> Signed-off-by: Wanpeng Li >> >> The update_debugctlmsr should stay in vmx_vcpu_run so that tracing >> features work correctly. However, the get_debugctlmsr indeed can be > > The tracing can't run except vCPU is schedule out, so why > update_debugctlmsr should stay in vmx_vcpu_run? For example your patch is disabling BTS (branch trace store) after the first vmexit, isn't it? Thanks, Paolo