Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433414

Re: [PATCH 1/5] mmu: mark spte present if the x bit is set

From Xiao Guangrong <guangrong.xiao@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/5] mmu: mark spte present if the x bit is set
Date 2016-06-29 05:10 +0200
Message-ID <rPe2Z-7cs-3@gated-at.bofh.it> (permalink)
References (2 earlier) <rOWSt-4vW-9@gated-at.bofh.it> <rP59o-1Ba-15@gated-at.bofh.it> <rP7Ee-3d8-37@gated-at.bofh.it> <rP7Xz-3k5-23@gated-at.bofh.it> <rP87f-3nq-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 06/29/2016 04:49 AM, Paolo Bonzini wrote:
>
>
> On 28/06/2016 22:37, Bandan Das wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>>
>>> On 28/06/2016 19:33, Bandan Das wrote:
>>>>>>>>   static int is_shadow_present_pte(u64 pte)
>>>>>>>>   {
>>>>>>>> -	return pte & PT_PRESENT_MASK && !is_mmio_spte(pte);
>>>>>>>> +	return pte & (PT_PRESENT_MASK | shadow_x_mask) &&
>>>>>>>> +		!is_mmio_spte(pte);
>>>>>>
>>>>>> This should really be pte & 7 when using EPT.  But this is okay as an
>>>>>> alternative to a new shadow_present_mask.
>>>> I could revive shadow_xonly_valid probably... Anyway, for now I will
>>>> add a TODO comment here.
>>>
>>> It's okay to it like this, because the only invalid PTEs reaching this
>>> point are those that is_mmio_spte filters away.  Hence you'll never get
>>> -W- PTEs here, and pte & 7 is really the same as how you wrote it.  It's
>>> pretty clever, and doesn't need a TODO at all. :)
>>
>> Thanks, understood. So, the way it is written now covers all cases for
>> pte & 7. Let's still add a comment - clever things are usually
>> confusing to many!
>
> I think another way to write it is "(pte & 0xFFFFFFFFull) &&
> !is_mmio_spte(pte)", since non-present/non-MMIO SPTEs never use bits
> 1..31 (they can have non-zero bits 32..63 on 32-bit CPUs where we don't
> update the PTEs atomically).  Guangrong, what do you prefer?

I think the way you innovated is better. :)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/5] mmu: mark spte present if the x bit is set Bandan Das <bsd@redhat.com> - 2016-06-28 06:40 +0200
  Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Paolo Bonzini <pbonzini@redhat.com> - 2016-06-28 10:50 +0200
    Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Bandan Das <bsd@redhat.com> - 2016-06-28 19:40 +0200
      Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Paolo Bonzini <pbonzini@redhat.com> - 2016-06-28 22:20 +0200
        Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Bandan Das <bsd@redhat.com> - 2016-06-28 22:40 +0200
          Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Paolo Bonzini <pbonzini@redhat.com> - 2016-06-28 22:50 +0200
            Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Bandan Das <bsd@redhat.com> - 2016-06-28 23:10 +0200
            Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-06-29 05:10 +0200
            Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Wanpeng Li <kernellwp@gmail.com> - 2016-07-05 05:10 +0200
              Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Paolo Bonzini <pbonzini@redhat.com> - 2016-07-05 13:00 +0200
                Re: [PATCH 1/5] mmu: mark spte present if the x bit is set Wanpeng Li <kernellwp@gmail.com> - 2016-07-05 13:40 +0200

csiph-web