mbox series

[kvm-unit-tests,v3,0/2] arm64: Add support for configuring the translation granule

Message ID 20201104130352.17633-1-nikos.nikoleris@arm.com (mailing list archive)
Headers show
Series arm64: Add support for configuring the translation granule | expand

Message

Nikos Nikoleris Nov. 4, 2020, 1:03 p.m. UTC
Hi all,

One more update to the series that allows us to configure the
translation granule in arm64. Again, thanks to Drew and Alex for
their reviews and their suggestions.

v1: 
https://lore.kernel.org/kvm/006a19c0-cdf7-e76c-8335-03034bea9c7e@arm.com/T
v2: 
https://lore.kernel.org/kvm/20201102113444.103536-1-nikos.nikoleris@arm.com/


Changes in v3:
  - Re-ordered the two changes in the series
  - Moved much of the code to check the configured granule from the C
    preprocessor to run time.
  - Avoid block mappings at the PUD level (Thanks Alex!)
  - Formatting changes

Changes in v2:
  - Change the configure option from page-shift to page-size
  - Check and warn if the configured granule is not supported

Thanks,

Nikos


Nikos Nikoleris (2):
  arm64: Check if the configured translation granule is supported
  arm64: Add support for configuring the translation granule

 configure                     | 27 ++++++++++++++
 lib/arm/asm/page.h            |  4 +++
 lib/arm/asm/pgtable-hwdef.h   |  4 +++
 lib/arm/asm/pgtable.h         |  6 ++++
 lib/arm/asm/thread_info.h     |  4 ++-
 lib/arm64/asm/page.h          | 35 ++++++++++++++----
 lib/arm64/asm/pgtable-hwdef.h | 42 +++++++++++++++++-----
 lib/arm64/asm/pgtable.h       | 68 +++++++++++++++++++++++++++++++++--
 lib/arm64/asm/processor.h     | 36 +++++++++++++++++++
 lib/libcflat.h                | 20 ++++++-----
 lib/arm/mmu.c                 | 31 ++++++++++------
 arm/cstart64.S                | 10 +++++-
 12 files changed, 249 insertions(+), 38 deletions(-)

Comments

Andrew Jones Nov. 9, 2020, 3:41 p.m. UTC | #1
On Wed, Nov 04, 2020 at 01:03:50PM +0000, Nikos Nikoleris wrote:
> Hi all,
> 
> One more update to the series that allows us to configure the
> translation granule in arm64. Again, thanks to Drew and Alex for
> their reviews and their suggestions.
> 
> v1: 
> https://lore.kernel.org/kvm/006a19c0-cdf7-e76c-8335-03034bea9c7e@arm.com/T
> v2: 
> https://lore.kernel.org/kvm/20201102113444.103536-1-nikos.nikoleris@arm.com/
> 
> 
> Changes in v3:
>   - Re-ordered the two changes in the series
>   - Moved much of the code to check the configured granule from the C
>     preprocessor to run time.
>   - Avoid block mappings at the PUD level (Thanks Alex!)
>   - Formatting changes
> 
> Changes in v2:
>   - Change the configure option from page-shift to page-size
>   - Check and warn if the configured granule is not supported
> 
> Thanks,
> 
> Nikos
> 
> 
> Nikos Nikoleris (2):
>   arm64: Check if the configured translation granule is supported
>   arm64: Add support for configuring the translation granule
> 
>  configure                     | 27 ++++++++++++++
>  lib/arm/asm/page.h            |  4 +++
>  lib/arm/asm/pgtable-hwdef.h   |  4 +++
>  lib/arm/asm/pgtable.h         |  6 ++++
>  lib/arm/asm/thread_info.h     |  4 ++-
>  lib/arm64/asm/page.h          | 35 ++++++++++++++----
>  lib/arm64/asm/pgtable-hwdef.h | 42 +++++++++++++++++-----
>  lib/arm64/asm/pgtable.h       | 68 +++++++++++++++++++++++++++++++++--
>  lib/arm64/asm/processor.h     | 36 +++++++++++++++++++
>  lib/libcflat.h                | 20 ++++++-----
>  lib/arm/mmu.c                 | 31 ++++++++++------
>  arm/cstart64.S                | 10 +++++-
>  12 files changed, 249 insertions(+), 38 deletions(-)
> 
> -- 
> 2.17.1
>

Looks good to me.

Alex, did you plan to review again?

Thanks,
drew
Alexandru Elisei Nov. 9, 2020, 4:16 p.m. UTC | #2
Hi Andrew,

On 11/9/20 3:41 PM, Andrew Jones wrote:
> On Wed, Nov 04, 2020 at 01:03:50PM +0000, Nikos Nikoleris wrote:
>> Hi all,
>>
>> One more update to the series that allows us to configure the
>> translation granule in arm64. Again, thanks to Drew and Alex for
>> their reviews and their suggestions.
>>
>> v1: 
>> https://lore.kernel.org/kvm/006a19c0-cdf7-e76c-8335-03034bea9c7e@arm.com/T
>> v2: 
>> https://lore.kernel.org/kvm/20201102113444.103536-1-nikos.nikoleris@arm.com/
>>
>>
>> Changes in v3:
>>   - Re-ordered the two changes in the series
>>   - Moved much of the code to check the configured granule from the C
>>     preprocessor to run time.
>>   - Avoid block mappings at the PUD level (Thanks Alex!)
>>   - Formatting changes
>>
>> Changes in v2:
>>   - Change the configure option from page-shift to page-size
>>   - Check and warn if the configured granule is not supported
>>
>> Thanks,
>>
>> Nikos
>>
>>
>> Nikos Nikoleris (2):
>>   arm64: Check if the configured translation granule is supported
>>   arm64: Add support for configuring the translation granule
>>
>>  configure                     | 27 ++++++++++++++
>>  lib/arm/asm/page.h            |  4 +++
>>  lib/arm/asm/pgtable-hwdef.h   |  4 +++
>>  lib/arm/asm/pgtable.h         |  6 ++++
>>  lib/arm/asm/thread_info.h     |  4 ++-
>>  lib/arm64/asm/page.h          | 35 ++++++++++++++----
>>  lib/arm64/asm/pgtable-hwdef.h | 42 +++++++++++++++++-----
>>  lib/arm64/asm/pgtable.h       | 68 +++++++++++++++++++++++++++++++++--
>>  lib/arm64/asm/processor.h     | 36 +++++++++++++++++++
>>  lib/libcflat.h                | 20 ++++++-----
>>  lib/arm/mmu.c                 | 31 ++++++++++------
>>  arm/cstart64.S                | 10 +++++-
>>  12 files changed, 249 insertions(+), 38 deletions(-)
>>
>> -- 
>> 2.17.1
>>
> Looks good to me.
>
> Alex, did you plan to review again?

Yes, I forgot about it, sorry. I'll review them as soon as possible (tomorrow most
likely).

Thanks,
Alex
Alexandru Elisei Nov. 10, 2020, 4:04 p.m. UTC | #3
Hi,

On 11/9/20 4:16 PM, Alexandru Elisei wrote:
> Hi Andrew,
>
> On 11/9/20 3:41 PM, Andrew Jones wrote:
>> On Wed, Nov 04, 2020 at 01:03:50PM +0000, Nikos Nikoleris wrote:
>>> Hi all,
>>>
>>> One more update to the series that allows us to configure the
>>> translation granule in arm64. Again, thanks to Drew and Alex for
>>> their reviews and their suggestions.
>>>
>>> v1: 
>>> https://lore.kernel.org/kvm/006a19c0-cdf7-e76c-8335-03034bea9c7e@arm.com/T
>>> v2: 
>>> https://lore.kernel.org/kvm/20201102113444.103536-1-nikos.nikoleris@arm.com/
>>>
>>>
>>> Changes in v3:
>>>   - Re-ordered the two changes in the series
>>>   - Moved much of the code to check the configured granule from the C
>>>     preprocessor to run time.
>>>   - Avoid block mappings at the PUD level (Thanks Alex!)
>>>   - Formatting changes
>>>
>>> Changes in v2:
>>>   - Change the configure option from page-shift to page-size
>>>   - Check and warn if the configured granule is not supported
>>>
>>> Thanks,
>>>
>>> Nikos
>>>
>>>
>>> Nikos Nikoleris (2):
>>>   arm64: Check if the configured translation granule is supported
>>>   arm64: Add support for configuring the translation granule
>>>
>>>  configure                     | 27 ++++++++++++++
>>>  lib/arm/asm/page.h            |  4 +++
>>>  lib/arm/asm/pgtable-hwdef.h   |  4 +++
>>>  lib/arm/asm/pgtable.h         |  6 ++++
>>>  lib/arm/asm/thread_info.h     |  4 ++-
>>>  lib/arm64/asm/page.h          | 35 ++++++++++++++----
>>>  lib/arm64/asm/pgtable-hwdef.h | 42 +++++++++++++++++-----
>>>  lib/arm64/asm/pgtable.h       | 68 +++++++++++++++++++++++++++++++++--
>>>  lib/arm64/asm/processor.h     | 36 +++++++++++++++++++
>>>  lib/libcflat.h                | 20 ++++++-----
>>>  lib/arm/mmu.c                 | 31 ++++++++++------
>>>  arm/cstart64.S                | 10 +++++-
>>>  12 files changed, 249 insertions(+), 38 deletions(-)
>>>
>>> -- 
>>> 2.17.1
>>>
>> Looks good to me.
>>
>> Alex, did you plan to review again?
> Yes, I forgot about it, sorry. I'll review them as soon as possible (tomorrow most
> likely).

Tested on a rockpro64, on the little (A53) and the big (A72) cores, 4k and 64k
pages. Results are similar, with a few peculiarities:

- If you change the page size and compile without doing make clean, the
assert(pgd_valid(*pgd)) from mmu_clear_user() fails. If the function is modified
to use mmu_idmap instead of the pgtable argument (which should be the same thing)
everything works as expected. My guess is that something doesn't get recompiled
properly, but that doesn't affect the correctness of this series. I don't think
that kvm-unit-tests supports changing the configuration and not cleaning previous
build artifacts (changing --arch without make clean definitely breaks compilation).

- Some of the PMU tests are failing on the big cores. I remember running into the
same issue some time ago, I believe it was because KVM doesn't really support
big.little configurations. Did some digging at that time and if memory serves me
right it had to do with the fact that there are 2 PMUs in the system and KVM was
creating the events on the little cores (on the pmu pmu_a53 from the DTB) and an
error was returned when trying to install it on a big cores (pmu pmu_a72).

Also tested on my x86 machine using qemu TCG (still only 4k and 64k pages).

Regardless of the observations above, I believe the series works as expected. For
the entire series:

Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Tested-by: Alexandru Elisei <alexandru.elisei@arm.com>

Thanks,
Alex
Andrew Jones Nov. 11, 2020, 11:39 a.m. UTC | #4
On Wed, Nov 04, 2020 at 01:03:50PM +0000, Nikos Nikoleris wrote:
> Hi all,
> 
> One more update to the series that allows us to configure the
> translation granule in arm64. Again, thanks to Drew and Alex for
> their reviews and their suggestions.
> 
> v1: 
> https://lore.kernel.org/kvm/006a19c0-cdf7-e76c-8335-03034bea9c7e@arm.com/T
> v2: 
> https://lore.kernel.org/kvm/20201102113444.103536-1-nikos.nikoleris@arm.com/
> 
> 
> Changes in v3:
>   - Re-ordered the two changes in the series
>   - Moved much of the code to check the configured granule from the C
>     preprocessor to run time.
>   - Avoid block mappings at the PUD level (Thanks Alex!)
>   - Formatting changes
> 
> Changes in v2:
>   - Change the configure option from page-shift to page-size
>   - Check and warn if the configured granule is not supported
> 
> Thanks,
> 
> Nikos
> 
> 
> Nikos Nikoleris (2):
>   arm64: Check if the configured translation granule is supported
>   arm64: Add support for configuring the translation granule
> 
>  configure                     | 27 ++++++++++++++
>  lib/arm/asm/page.h            |  4 +++
>  lib/arm/asm/pgtable-hwdef.h   |  4 +++
>  lib/arm/asm/pgtable.h         |  6 ++++
>  lib/arm/asm/thread_info.h     |  4 ++-
>  lib/arm64/asm/page.h          | 35 ++++++++++++++----
>  lib/arm64/asm/pgtable-hwdef.h | 42 +++++++++++++++++-----
>  lib/arm64/asm/pgtable.h       | 68 +++++++++++++++++++++++++++++++++--
>  lib/arm64/asm/processor.h     | 36 +++++++++++++++++++
>  lib/libcflat.h                | 20 ++++++-----
>  lib/arm/mmu.c                 | 31 ++++++++++------
>  arm/cstart64.S                | 10 +++++-
>  12 files changed, 249 insertions(+), 38 deletions(-)
> 
> -- 
> 2.17.1
>

Applied, thanks.