Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753648AbbG3HV6 (ORCPT ); Thu, 30 Jul 2015 03:21:58 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:36830 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775AbbG3HV5 (ORCPT ); Thu, 30 Jul 2015 03:21:57 -0400 Subject: Re: [edk2] [PATCH 2/3] KVM: MTRR: simplify kvm_mtrr_get_guest_memory_type To: Alex Williamson , Xiao Guangrong References: <1436988356-4565-1-git-send-email-guangrong.xiao@linux.intel.com> <1436988356-4565-2-git-send-email-guangrong.xiao@linux.intel.com> <1438196833.13460.63.camel@redhat.com> Cc: edk2-devel@lists.sourceforge.net, Xiao Guangrong , kvm@vger.kernel.org, gleb@kernel.org, mtosatti@redhat.com, linux-kernel@vger.kernel.org, bsd@redhat.com From: Paolo Bonzini Message-ID: <55B9D091.8050906@redhat.com> Date: Thu, 30 Jul 2015 09:21:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1438196833.13460.63.camel@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1530 Lines: 48 On 29/07/2015 21:07, Alex Williamson wrote: > diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c > index e275013..dc0a84a 100644 > --- a/arch/x86/kvm/mtrr.c > +++ b/arch/x86/kvm/mtrr.c > @@ -672,15 +672,16 @@ u8 kvm_mtrr_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) > if (iter.mtrr_disabled) > return mtrr_disabled_type(); > > - /* It is not covered by MTRRs. */ > - if (iter.partial_map) { > - /* > - * We just check one page, partially covered by MTRRs is > - * impossible. > - */ > - WARN_ON(type != -1); > - type = mtrr_default_type(mtrr_state); > - } > + /* > + * We just check one page, partially covered by MTRRs is > + * impossible. > + */ > + WARN_ON(iter.partial_map); > + > + /* not contained in any MTRRs. */ > + if (type == -1) > + return mtrr_default_type(mtrr_state); > + > return type; > } > EXPORT_SYMBOL_GPL(kvm_mtrr_get_guest_memory_type); > > The WARN_ON() now comes before the type == -1 test and I hit that at > *very* high frequency when trying to test device assignment. Restoring > the ordering to what Xiao originally proposed resolves the problem. > Thanks, And I remember testing the change and seeing the warning. So, in short, I screwed up. Probably I tested on one machine and pushed from another. :/ Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/