All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Tiejun Chen <tiejun.chen@intel.com>
Cc: kvm@vger.kernel.org
Subject: Re: [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits()
Date: Fri, 14 Nov 2014 11:06:36 +0100	[thread overview]
Message-ID: <5465D42C.6080900@redhat.com> (raw)
In-Reply-To: <1415957488-27490-1-git-send-email-tiejun.chen@intel.com>



On 14/11/2014 10:31, Tiejun Chen wrote:
> In some real scenarios 'start' may not be less than 'end' like
> maxphyaddr = 52.
> 
> Signed-off-by: Tiejun Chen <tiejun.chen@intel.com>
> ---
>  arch/x86/kvm/mmu.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
> index bde8ee7..0e98b5e 100644
> --- a/arch/x86/kvm/mmu.h
> +++ b/arch/x86/kvm/mmu.h
> @@ -58,6 +58,8 @@
>  
>  static inline u64 rsvd_bits(int s, int e)
>  {
> +	if (unlikely(s > e))
> +		return 0;
>  	return ((1ULL << (e - s + 1)) - 1) << s;
>  }
>  
> 

s == e + 1 is supported:

   (1ULL << (e - (e + 1) + 1)) - 1) << s ==
   (1ULL << 0) << s ==
   0

Is there any case where s is even bigger?

Paolo

  parent reply	other threads:[~2014-11-14 10:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-14  9:31 [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits() Tiejun Chen
2014-11-14  9:31 ` [RFC][PATCH 2/2] kvm: x86: mmio: fix setting the present bit of mmio spte Tiejun Chen
2014-11-14 10:11   ` Paolo Bonzini
2014-11-17  1:55     ` Chen, Tiejun
2014-11-14 10:06 ` Paolo Bonzini [this message]
2014-11-17  1:34   ` [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits() Chen, Tiejun
2014-11-17  9:22     ` Paolo Bonzini
2014-11-17  9:27       ` Chen, Tiejun

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=5465D42C.6080900@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=tiejun.chen@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.