On 06/03/2016 09:01, Xiao Guangrong wrote: > > > On 03/05/2016 07:27 PM, Huaitong Han wrote: >> This patch adds pkeys support for gva_to_gpa funcions. > > It is not needed if you follow the approach i raised in the previous patch. It's not needed anyway, I think. PFERR_PK_MASK is set to CR4.PKE. However, patch 3 sets pku to false if CR4.PKE is clear, and then the corresponding bit is always clear in mmu->permissions[byte]. Thus I think permission_fault() operates in just the same way even if PFERR_PK_MASK is always set; CR4.PKE=0 is caught through the permissions bitmask (as it's meant to be). Instead of setting PFERR_PK_MASK, we can instead handle it in permission_fault like: pkru = is_long_mode(vcpu) ? read_pkru() : 0; if (unlikely(pkru)) { ... /* Set PK bit of pfec if pkru_bits is non-zero */ pfec |= pkru_bits ? PFERR_PK_MASK : 0; } I'll get to the topic of branches in another message. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html