Re: [PATCH v3 00/21] KVM: arm64: Rewrite page-table code and fault handling

Marc Zyngier
2020-09-04T10:09:06Z

On 2020-09-04 01:51, Gavin Shan wrote:
> Hi Will,
>
> On 9/3/20 10:16 PM, Will Deacon wrote:
>> On Thu, Sep 03, 2020 at 09:48:18PM +1000, Gavin Shan wrote:
>>> On 9/3/20 9:13 PM, Gavin Shan wrote:
>>>> On 9/3/20 5:34 PM, Gavin Shan wrote:
>>>>> On 8/25/20 7:39 PM, Will Deacon wrote:
>>>>>> Hello folks,
>>>>>>
>>>>>> This is version three of the KVM page-table rework that I
>>>>>> previously posted
>>>>>> here:
>>>>>>
>>>>>>    v1:
>>>>>> https://lore.kernel.org/r/20200730153406.25136-1-will@kernel.org
>>>>>>    v2:
>>>>>> https://lore.kernel.org/r/20200818132818.16065-1-will@kernel.org
>>>>>>
>>>>>> Changes since v2 include:
>>>>>>
>>>>>>    * Rebased onto -rc2, which includes the conflicting OOM
>>>>>> blocking fixes
>>>>>>    * Dropped the patch trying to "fix" the memcache in
>>>>>> kvm_phys_addr_ioremap()
>>>>>>
>>>>>
>>>>> It's really nice work, making the code unified/simplified greatly.
>>>>> However, it seems it doesn't work well with HugeTLBfs. Please refer
>>>>> to the following test result and see if you have quick idea, or I
>>>>> can debug it a bit :)
>>
>> Nice testing matrix, and thanks for reporting the problem!
>>
>>>>> Machine         Host                     Guest              Result
>>>>> ===============================================================
>>>>> ThunderX2    VA_BITS:   42           PAGE_SIZE:  4KB     Passed
>>>>>               PAGE_SIZE: 64KB                    64KB     passed
>>>>>               THP:       disabled
>>>>>               HugeTLB:   disabled
>>>>> ---------------------------------------------------------------
>>>>> ThunderX2    VA_BITS:   42           PAGE_SIZE:  4KB     Passed
>>>>>               PAGE_SIZE: 64KB                    64KB     passed
>>>>>               THP:       enabled
>>>>>               HugeTLB:   disabled
>>>>> ----------------------------------------------------------------
>>>>> ThunderX2    VA_BITS:   42           PAGE_SIZE:  4KB     Fail[1]
>>>>>               PAGE_SIZE: 64KB                    64KB     Fail[1]
>>>>>               THP:       disabled
>>>>>               HugeTLB:   enabled
>>>>> ---------------------------------------------------------------
>>>>> ThunderX2    VA_BITS:   39           PAGE_SIZE:  4KB     Passed
>>>>>               PAGE_SIZE: 4KB                     64KB     Passed
>>>>>               THP:       disabled
>>>>>               HugeTLB:   disabled
>>>>> ---------------------------------------------------------------
>>>>> ThunderX2    VA_BITS:   39           PAGE_SIZE:  4KB     Passed
>>>>>               PAGE_SIZE: 4KB                     64KB     Passed
>>>>>               THP:       enabled
>>>>>               HugeTLB:   disabled
>>>>> --------------------------------------------------------------
>>>>> ThunderX2    VA_BITS:   39           PAGE_SIZE: 4KB     Fail[2]
>>>>>               PAGE_SIZE: 4KB                    64KB     Fail[2]
>>>>>               THP:       disabled
>>>>>               HugeTLB:   enabled
>>>>>
>>>>
>>>> I debugged the code and found the issue is caused by the following
>>>> patch.
>>>>
>>>> [PATCH v3 06/21] KVM: arm64: Add support for stage-2 map()/unmap()
>>>> in generic page-table
>>
>> (I think this is just a symptom of the page-table being out of whack)
>>
>>> Sorry that the guest could hang sometimes with above changes. I have
>>> no idea what
>>> has been happening before I'm going to debug for more.. I'm pasting
>>> the used command
>>> and output from guest.
>>
>> Can you try the diff below, please? I think we can end up sticking
>> down a
>> huge-page-sized mapping at an unaligned address, which causes us both
>> to
>> overmap and also to fail to use the huge granule for a block mapping.
>>
>
> Since the the following changes have been folded to v4, I reran the
> test cases
> on v4 and everything works fine.

Thanks a lot for the great testing and reviewing effort!

<shameless ask>
Since you obviously have a test rig setup for this: does your TX2
support 16kB
pages? If so, could you please do another run with this page size on the
host?
</shameless ask>

Thanks again,

M.
--
Jazz is not dead. It just smells funny...