public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Alex Williamson <alex.williamson@redhat.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: edk2-devel@lists.sourceforge.net,
	Xiao Guangrong <guangrong.xiao@intel.com>,
	kvm@vger.kernel.org, gleb@kernel.org, mtosatti@redhat.com,
	linux-kernel@vger.kernel.org, bsd@redhat.com
Subject: Re: [edk2] [PATCH 2/3] KVM: MTRR: simplify kvm_mtrr_get_guest_memory_type
Date: Thu, 30 Jul 2015 09:21:53 +0200	[thread overview]
Message-ID: <55B9D091.8050906@redhat.com> (raw)
In-Reply-To: <1438196833.13460.63.camel@redhat.com>



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

  reply	other threads:[~2015-07-30  7:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 19:25 [PATCH 1/3] KVM: MTRR: fix memory type handling if MTRR is completely disabled Xiao Guangrong
2015-07-15 19:25 ` [PATCH 2/3] KVM: MTRR: simplify kvm_mtrr_get_guest_memory_type Xiao Guangrong
2015-07-29 19:07   ` Alex Williamson
2015-07-30  7:21     ` Paolo Bonzini [this message]
2015-07-15 19:25 ` [PATCH 3/3] KVM: x86: quirkily apply WB to all memory if cache is disabled Xiao Guangrong
2015-07-23  5:56   ` Paolo Bonzini
2015-07-23  6:03     ` Xiao Guangrong
2015-07-16  4:10 ` [PATCH 1/3] KVM: MTRR: fix memory type handling if MTRR is completely disabled Alex Williamson
2015-07-23  6:21   ` Paolo Bonzini
2015-07-23  6:29     ` Xiao Guangrong
2015-07-23  7:18       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B9D091.8050906@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=bsd@redhat.com \
    --cc=edk2-devel@lists.sourceforge.net \
    --cc=gleb@kernel.org \
    --cc=guangrong.xiao@intel.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox