lkml.org 
[lkml]   [2012]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 03/16] KVM: MMU: properly assert spte on rmap walking path
On 04/14/2012 10:15 AM, Takuya Yoshikawa wrote:

> On Fri, 13 Apr 2012 18:10:45 +0800
> Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> wrote:
>
>> static u64 *rmap_get_next(struct rmap_iterator *iter)
>> {
>> + u64 *sptep = NULL;
>> +
>> if (iter->desc) {
>> if (iter->pos < PTE_LIST_EXT - 1) {
>> - u64 *sptep;
>> -
>> ++iter->pos;
>> sptep = iter->desc->sptes[iter->pos];
>> if (sptep)
>> - return sptep;
>> + goto exit;
>> }
>>
>> iter->desc = iter->desc->more;
>> @@ -1028,11 +1036,14 @@ static u64 *rmap_get_next(struct rmap_iterator *iter)
>> if (iter->desc) {
>> iter->pos = 0;
>> /* desc->sptes[0] cannot be NULL */
>> - return iter->desc->sptes[iter->pos];
>> + sptep = iter->desc->sptes[iter->pos];
>> + goto exit;
>> }
>> }
>>
>> - return NULL;
>> +exit:
>> + WARN_ON(sptep && !is_shadow_present_pte(*sptep));
>> + return sptep;
>> }
>
> This will, probably, again force rmap_get_next function-call even with EPT/NPT:
> CPU cannot skip it by branch prediction.
>

No, EPT/NPT also needs it.



\
 
 \ /
  Last update: 2012-04-16 05:29    [from the cache]
©2003-2011 Jasper Spaans