lkml.org 
[lkml]   [2015]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/15] KVM: MTRR: improve kvm_mtrr_get_guest_memory_type


On 03/06/2015 04:12, Xiao Guangrong wrote:
>>
>> Perhaps just use type = MIN(type, curr_type), which also happens to get
>> WT vs. WB right? You can also add a
>>
>> BUILD_BUG_ON(MTRR_TYPE_WRTHROUGH > MTRR_TYPE_WRBACK);
>>
>> to ensure that the WT vs. WB precedence is correct.
>
> Only WT and WB are allowed to be overlapped here otherwise is
> "undefined behavior". For example if the types are MTRR_TYPE_WRPROT
> and MTRR_TYPE_WRTHROUGH, min() will get MTRR_TYPE_WRTHROUGH rather than
> "undefined behavior".

Choosing MTRR_TYPE_WRTHROUGH is one example of achieve undefined
behavior. Picking one type arbitrarily is just a different kind of
undefined behavior.

Paolo


\
 
 \ /
  Last update: 2015-06-03 10:01    [W:0.066 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site