[PATCH v4 1/2] kvm/arm64: Remove the creation time's mapping of MMIO regions
Keqian Zhu
zhukeqian1 at huawei.com
Thu Apr 22 08:41:34 BST 2021
Hi Gavin,
On 2021/4/22 10:12, Gavin Shan wrote:
> Hi Keqian,
>
> On 4/21/21 4:28 PM, Keqian Zhu wrote:
>> On 2021/4/21 14:38, Gavin Shan wrote:
>>> On 4/16/21 12:03 AM, Keqian Zhu wrote:
>>>> The MMIO regions may be unmapped for many reasons and can be remapped
>>>> by stage2 fault path. Map MMIO regions at creation time becomes a
>>>> minor optimization and makes these two mapping path hard to sync.
>>>>
>>>> Remove the mapping code while keep the useful sanity check.
>>>>
>>>> Signed-off-by: Keqian Zhu <zhukeqian1 at huawei.com>
>>>> ---
>>>> arch/arm64/kvm/mmu.c | 38 +++-----------------------------------
>>>> 1 file changed, 3 insertions(+), 35 deletions(-)
>>>>
>>>
>>> After removing the logic to create stage2 mapping for VM_PFNMAP region,
>>> I think the "do { } while" loop becomes unnecessary and can be dropped
>>> completely. It means the only sanity check is to see if the memory slot
>>> overflows IPA space or not. In that case, KVM_MR_FLAGS_ONLY can be
>>> ignored because the memory slot's base address and length aren't changed
>>> when we have KVM_MR_FLAGS_ONLY.
>> Maybe not exactly. Here we do an important sanity check that we shouldn't
>> log dirty for memslots with VM_PFNMAP.
>>
>
> Yeah, Sorry that I missed that part. Something associated with Santosh's
> patch. The flag can be not existing until the page fault happened on
> the vma. In this case, the check could be not working properly.
>
> [PATCH] KVM: arm64: Correctly handle the mmio faulting
Yeah, you are right.
If that happens, we won't try to use block mapping for memslot with VM_PFNMAP.
But it keeps a same logic with old code.
1. When without dirty-logging, we won't try block mapping for it, and we'll
finally know that it's device, so won't try to do adjust THP (Transparent Huge Page)
for it.
2. If userspace wrongly enables dirty logging for this memslot, we'll force_pte for it.
Thanks,
Keqian
More information about the linux-arm-kernel
mailing list