From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from legacy.ddn.com ([64.47.133.206]:35553 "EHLO legacy.ddn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755756AbcKVVAI (ORCPT ); Tue, 22 Nov 2016 16:00:08 -0500 Date: Tue, 22 Nov 2016 13:54:58 -0700 From: Greg Edwards To: Paolo Bonzini CC: , , Subject: Re: [PATCH] KVM: VMX: Fix commit which broke PML Message-ID: <20161122205458.GA6919@psuche> References: <20161122154352.25784-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20161122154352.25784-1-pbonzini@redhat.com> Sender: stable-owner@vger.kernel.org List-ID: On Tue, Nov 22, 2016 at 04:43:51PM +0100, Paolo Bonzini wrote: > From: Kai Huang > > [ upstream commit feda805fe7c4ed9cf78158e73b1218752e3b4314, for 4.1.y only. > The symptoms are not as bad as they were when the upstream patch went > in, but it still fixes an ugly call trace on VM shutdown and prepares > for the next patch. ] > > I found PML was broken since below commit: > > commit feda805fe7c4ed9cf78158e73b1218752e3b4314 > Author: Xiao Guangrong > Date: Wed Sep 9 14:05:55 2015 +0800 > > KVM: VMX: unify SECONDARY_VM_EXEC_CONTROL update > > Unify the update in vmx_cpuid_update() > > Signed-off-by: Xiao Guangrong > [Rewrite to use vmcs_set_secondary_exec_control. - Paolo] > Signed-off-by: Paolo Bonzini > > The reason is in above commit vmx_cpuid_update calls vmx_secondary_exec_control, > in which currently SECONDARY_EXEC_ENABLE_PML bit is cleared unconditionally (as > PML is enabled in creating vcpu). Therefore if vcpu_cpuid_update is called after > vcpu is created, PML will be disabled unexpectedly while log-dirty code still > thinks PML is used. > > Fix this by clearing SECONDARY_EXEC_ENABLE_PML in vmx_secondary_exec_control > only when PML is not supported or not enabled (!enable_pml). This is more > reasonable as PML is currently either always enabled or disabled. With this > explicit updating SECONDARY_EXEC_ENABLE_PML in vmx_enable{disable}_pml is not > needed so also rename vmx_enable{disable}_pml to vmx_create{destroy}_pml_buffer. > > Fixes: feda805fe7c4ed9cf78158e73b1218752e3b4314 > Signed-off-by: Kai Huang > [While at it, change a wrong ASSERT to an "if". The condition can happen > if creating the VCPU fails with ENOMEM. - Paolo] > Signed-off-by: Paolo Bonzini Tested-by: Greg Edwards