From: "Chen, Tiejun" <tiejun.chen@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits()
Date: Mon, 17 Nov 2014 17:27:36 +0800 [thread overview]
Message-ID: <5469BF88.8060005@intel.com> (raw)
In-Reply-To: <5469BE50.80502@redhat.com>
On 2014/11/17 17:22, Paolo Bonzini wrote:
>
>
> On 17/11/2014 02:34, Chen, Tiejun wrote:
>> On 2014/11/14 18:06, Paolo Bonzini wrote:
>>>
>>>
>>> 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 << (e - (e + 1) + 1)) - 1) << s
>> = (1ULL << (e - e - 1) + 1)) - 1) << s
>> = (1ULL << (-1) + 1)) - 1) << s
>
> no,
You're right since I'm seeing "()" wrongly.
Sorry to bother you.
Thanks
Tiejun
prev parent reply other threads:[~2014-11-17 9:27 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 ` [RFC][PATCH 1/2] kvm: x86: mmu: return zero if s > e in rsvd_bits() Paolo Bonzini
2014-11-17 1:34 ` Chen, Tiejun
2014-11-17 9:22 ` Paolo Bonzini
2014-11-17 9:27 ` Chen, Tiejun [this message]
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=5469BF88.8060005@intel.com \
--to=tiejun.chen@intel.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@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 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.