[PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef

Pierrick Bouvier posted 3 patches 1 year, 1 month ago
Failed in applying to current master (apply log)
docs/system/arm/cpu-features.rst |  7 ++++--
docs/system/arm/virt.rst         | 14 +++++++++---
docs/system/introduction.rst     |  2 +-
target/arm/cpu.h                 |  4 ++++
hw/core/machine.c                |  4 +++-
target/arm/arm-qmp-cmds.c        |  2 +-
target/arm/cpu.c                 |  2 ++
target/arm/cpu64.c               | 38 +++++++++++++++++++++++---------
tests/qtest/arm-cpu-features.c   | 15 +++++++++----
9 files changed, 66 insertions(+), 22 deletions(-)
[PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Pierrick Bouvier 1 year, 1 month ago
qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
spent up to 50% of the emulation time running it (when using TCG).

Switching to pauth-impdef=on is often given as a solution to speed up execution.
Thus we talked about making it the new default.

The first patch introduce a new property (pauth-qarma5) to allow to select
current default algorithm.
The second one change the default.
The third one updates documentation.

v2:
- ensure we don't break migration compatibility, by using a specific backward
  compatible property.
- added some documentation about migration for arm virt machine model.

Pierrick Bouvier (3):
  target/arm: add new property to select pauth-qarma5
  target/arm: change default pauth algorithm to impdef
  docs/system/arm/virt: mention specific migration information

 docs/system/arm/cpu-features.rst |  7 ++++--
 docs/system/arm/virt.rst         | 14 +++++++++---
 docs/system/introduction.rst     |  2 +-
 target/arm/cpu.h                 |  4 ++++
 hw/core/machine.c                |  4 +++-
 target/arm/arm-qmp-cmds.c        |  2 +-
 target/arm/cpu.c                 |  2 ++
 target/arm/cpu64.c               | 38 +++++++++++++++++++++++---------
 tests/qtest/arm-cpu-features.c   | 15 +++++++++----
 9 files changed, 66 insertions(+), 22 deletions(-)

-- 
2.39.5
Re: [PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Peter Maydell 1 year ago
On Thu, 19 Dec 2024 at 18:32, Pierrick Bouvier
<pierrick.bouvier@linaro.org> wrote:
>
> qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
> spent up to 50% of the emulation time running it (when using TCG).
>
> Switching to pauth-impdef=on is often given as a solution to speed up execution.
> Thus we talked about making it the new default.
>
> The first patch introduce a new property (pauth-qarma5) to allow to select
> current default algorithm.
> The second one change the default.
> The third one updates documentation.
>
> v2:
> - ensure we don't break migration compatibility, by using a specific backward
>   compatible property.
> - added some documentation about migration for arm virt machine model.

Other than a minor change to the 3rd docs patch which I'll note there:
applied to target-arm.next, thanks.

-- PMM
Re: [PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Peter Maydell 1 year ago
On Fri, 10 Jan 2025 at 16:28, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Thu, 19 Dec 2024 at 18:32, Pierrick Bouvier
> <pierrick.bouvier@linaro.org> wrote:
> >
> > qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
> > spent up to 50% of the emulation time running it (when using TCG).
> >
> > Switching to pauth-impdef=on is often given as a solution to speed up execution.
> > Thus we talked about making it the new default.
> >
> > The first patch introduce a new property (pauth-qarma5) to allow to select
> > current default algorithm.
> > The second one change the default.
> > The third one updates documentation.
> >
> > v2:
> > - ensure we don't break migration compatibility, by using a specific backward
> >   compatible property.
> > - added some documentation about migration for arm virt machine model.
>
> Other than a minor change to the 3rd docs patch which I'll note there:
> applied to target-arm.next, thanks.

I just noticed that this series breaks 'make check-tcg', because
the pauth-3 test is explicitly checking the output of the
pointer-auth operation. I'm going to add in this patch, which
goes between patches 1 and 2 of this series:

Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Mon Jan 13 11:42:57 2025 +0000

    tests/tcg/aarch64: force qarma5 for pauth-3 test

    The pauth-3 test explicitly tests that a computation of the
    pointer-authentication produces the expected result.  This means that
    it must be run with the QARMA5 algorithm.

    Explicitly set the pauth algorithm when running this test, so that it
    doesn't break when we change the default algorithm the 'max' CPU
    uses.

    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

diff --git a/tests/tcg/aarch64/Makefile.softmmu-target
b/tests/tcg/aarch64/Makefile.softmmu-target
index d08d9b01ded..9c52475b7ae 100644
--- a/tests/tcg/aarch64/Makefile.softmmu-target
+++ b/tests/tcg/aarch64/Makefile.softmmu-target
@@ -91,6 +91,9 @@ EXTRA_RUNS+=run-memory-replay

 ifneq ($(CROSS_CC_HAS_ARMV8_3),)
 pauth-3: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
+# This test explicitly checks the output of the pauth operation so we
+# must force the use of the QARMA5 algorithm for it.
+run-pauth-3: QEMU_BASE_MACHINE=-M virt -cpu max,pauth-qarma5=on -display none
 else
 pauth-3:
        $(call skip-test, "BUILD of $@", "missing compiler support")


thanks
-- PMM
Re: [PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Alex Bennée 1 year ago
Peter Maydell <peter.maydell@linaro.org> writes:

> On Fri, 10 Jan 2025 at 16:28, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Thu, 19 Dec 2024 at 18:32, Pierrick Bouvier
>> <pierrick.bouvier@linaro.org> wrote:
>> >
>> > qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
>> > spent up to 50% of the emulation time running it (when using TCG).
>> >
>> > Switching to pauth-impdef=on is often given as a solution to speed up execution.
>> > Thus we talked about making it the new default.
>> >
>> > The first patch introduce a new property (pauth-qarma5) to allow to select
>> > current default algorithm.
>> > The second one change the default.
>> > The third one updates documentation.
>> >
>> > v2:
>> > - ensure we don't break migration compatibility, by using a specific backward
>> >   compatible property.
>> > - added some documentation about migration for arm virt machine model.
>>
>> Other than a minor change to the 3rd docs patch which I'll note there:
>> applied to target-arm.next, thanks.
>
> I just noticed that this series breaks 'make check-tcg', because
> the pauth-3 test is explicitly checking the output of the
> pointer-auth operation. I'm going to add in this patch, which
> goes between patches 1 and 2 of this series:
>
> Author: Peter Maydell <peter.maydell@linaro.org>
> Date:   Mon Jan 13 11:42:57 2025 +0000
>
>     tests/tcg/aarch64: force qarma5 for pauth-3 test
>
>     The pauth-3 test explicitly tests that a computation of the
>     pointer-authentication produces the expected result.  This means that
>     it must be run with the QARMA5 algorithm.
>
>     Explicitly set the pauth algorithm when running this test, so that it
>     doesn't break when we change the default algorithm the 'max' CPU
>     uses.
>
>     Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>
> diff --git a/tests/tcg/aarch64/Makefile.softmmu-target
> b/tests/tcg/aarch64/Makefile.softmmu-target
> index d08d9b01ded..9c52475b7ae 100644
> --- a/tests/tcg/aarch64/Makefile.softmmu-target
> +++ b/tests/tcg/aarch64/Makefile.softmmu-target
> @@ -91,6 +91,9 @@ EXTRA_RUNS+=run-memory-replay
>
>  ifneq ($(CROSS_CC_HAS_ARMV8_3),)
>  pauth-3: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
> +# This test explicitly checks the output of the pauth operation so we
> +# must force the use of the QARMA5 algorithm for it.
> +run-pauth-3: QEMU_BASE_MACHINE=-M virt -cpu max,pauth-qarma5=on -display none
>  else
>  pauth-3:
>         $(call skip-test, "BUILD of $@", "missing compiler support")
<snip>

Acked-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro
Re: [PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Pierrick Bouvier 1 year ago
On 1/13/25 04:34, Peter Maydell wrote:
> On Fri, 10 Jan 2025 at 16:28, Peter Maydell <peter.maydell@linaro.org> wrote:
>>
>> On Thu, 19 Dec 2024 at 18:32, Pierrick Bouvier
>> <pierrick.bouvier@linaro.org> wrote:
>>>
>>> qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
>>> spent up to 50% of the emulation time running it (when using TCG).
>>>
>>> Switching to pauth-impdef=on is often given as a solution to speed up execution.
>>> Thus we talked about making it the new default.
>>>
>>> The first patch introduce a new property (pauth-qarma5) to allow to select
>>> current default algorithm.
>>> The second one change the default.
>>> The third one updates documentation.
>>>
>>> v2:
>>> - ensure we don't break migration compatibility, by using a specific backward
>>>    compatible property.
>>> - added some documentation about migration for arm virt machine model.
>>
>> Other than a minor change to the 3rd docs patch which I'll note there:
>> applied to target-arm.next, thanks.
> 
> I just noticed that this series breaks 'make check-tcg', because
> the pauth-3 test is explicitly checking the output of the
> pointer-auth operation. I'm going to add in this patch, which
> goes between patches 1 and 2 of this series:
> 
> Author: Peter Maydell <peter.maydell@linaro.org>
> Date:   Mon Jan 13 11:42:57 2025 +0000
> 
>      tests/tcg/aarch64: force qarma5 for pauth-3 test
> 
>      The pauth-3 test explicitly tests that a computation of the
>      pointer-authentication produces the expected result.  This means that
>      it must be run with the QARMA5 algorithm.
> 
>      Explicitly set the pauth algorithm when running this test, so that it
>      doesn't break when we change the default algorithm the 'max' CPU
>      uses.
> 
>      Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> 
> diff --git a/tests/tcg/aarch64/Makefile.softmmu-target
> b/tests/tcg/aarch64/Makefile.softmmu-target
> index d08d9b01ded..9c52475b7ae 100644
> --- a/tests/tcg/aarch64/Makefile.softmmu-target
> +++ b/tests/tcg/aarch64/Makefile.softmmu-target
> @@ -91,6 +91,9 @@ EXTRA_RUNS+=run-memory-replay
> 
>   ifneq ($(CROSS_CC_HAS_ARMV8_3),)
>   pauth-3: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
> +# This test explicitly checks the output of the pauth operation so we
> +# must force the use of the QARMA5 algorithm for it.
> +run-pauth-3: QEMU_BASE_MACHINE=-M virt -cpu max,pauth-qarma5=on -display none
>   else
>   pauth-3:
>          $(call skip-test, "BUILD of $@", "missing compiler support")
> 
> 
> thanks
> -- PMM

Thanks Peter.

I'm a bit surprised because I ran all tests , and didn't find any failure.

I use container 'debian-all-test-cross' and ran 'make check-tcg'. Is the 
container missing something that doesn't trigger this test?
Re: [PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Pierrick Bouvier 1 year ago
On 1/13/25 11:32, Pierrick Bouvier wrote:
> On 1/13/25 04:34, Peter Maydell wrote:
>> On Fri, 10 Jan 2025 at 16:28, Peter Maydell <peter.maydell@linaro.org> wrote:
>>>
>>> On Thu, 19 Dec 2024 at 18:32, Pierrick Bouvier
>>> <pierrick.bouvier@linaro.org> wrote:
>>>>
>>>> qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
>>>> spent up to 50% of the emulation time running it (when using TCG).
>>>>
>>>> Switching to pauth-impdef=on is often given as a solution to speed up execution.
>>>> Thus we talked about making it the new default.
>>>>
>>>> The first patch introduce a new property (pauth-qarma5) to allow to select
>>>> current default algorithm.
>>>> The second one change the default.
>>>> The third one updates documentation.
>>>>
>>>> v2:
>>>> - ensure we don't break migration compatibility, by using a specific backward
>>>>     compatible property.
>>>> - added some documentation about migration for arm virt machine model.
>>>
>>> Other than a minor change to the 3rd docs patch which I'll note there:
>>> applied to target-arm.next, thanks.
>>
>> I just noticed that this series breaks 'make check-tcg', because
>> the pauth-3 test is explicitly checking the output of the
>> pointer-auth operation. I'm going to add in this patch, which
>> goes between patches 1 and 2 of this series:
>>
>> Author: Peter Maydell <peter.maydell@linaro.org>
>> Date:   Mon Jan 13 11:42:57 2025 +0000
>>
>>       tests/tcg/aarch64: force qarma5 for pauth-3 test
>>
>>       The pauth-3 test explicitly tests that a computation of the
>>       pointer-authentication produces the expected result.  This means that
>>       it must be run with the QARMA5 algorithm.
>>
>>       Explicitly set the pauth algorithm when running this test, so that it
>>       doesn't break when we change the default algorithm the 'max' CPU
>>       uses.
>>
>>       Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>>
>> diff --git a/tests/tcg/aarch64/Makefile.softmmu-target
>> b/tests/tcg/aarch64/Makefile.softmmu-target
>> index d08d9b01ded..9c52475b7ae 100644
>> --- a/tests/tcg/aarch64/Makefile.softmmu-target
>> +++ b/tests/tcg/aarch64/Makefile.softmmu-target
>> @@ -91,6 +91,9 @@ EXTRA_RUNS+=run-memory-replay
>>
>>    ifneq ($(CROSS_CC_HAS_ARMV8_3),)
>>    pauth-3: CFLAGS += $(CROSS_CC_HAS_ARMV8_3)
>> +# This test explicitly checks the output of the pauth operation so we
>> +# must force the use of the QARMA5 algorithm for it.
>> +run-pauth-3: QEMU_BASE_MACHINE=-M virt -cpu max,pauth-qarma5=on -display none
>>    else
>>    pauth-3:
>>           $(call skip-test, "BUILD of $@", "missing compiler support")
>>
>>
>> thanks
>> -- PMM
> 
> Thanks Peter.
> 
> I'm a bit surprised because I ran all tests , and didn't find any failure.
> 
> I use container 'debian-all-test-cross' and ran 'make check-tcg'. Is the
> container missing something that doesn't trigger this test?

I found that the build step I was using:
- ./configure $QEMU_CONFIGURE_OPTS
only builds user targets in this container.
But failing test is related to a system target.

I updated this on my side, to make sure I won't miss that next time.

Thanks again for the fix.

Regards,
Pierrick
Re: [PATCH v2 0/3] Change default pointer authentication algorithm on aarch64 to impdef
Posted by Pierrick Bouvier 1 year ago
On 1/10/25 08:28, Peter Maydell wrote:
> On Thu, 19 Dec 2024 at 18:32, Pierrick Bouvier
> <pierrick.bouvier@linaro.org> wrote:
>>
>> qemu-system-aarch64 default pointer authentication (QARMA5) is expensive, we
>> spent up to 50% of the emulation time running it (when using TCG).
>>
>> Switching to pauth-impdef=on is often given as a solution to speed up execution.
>> Thus we talked about making it the new default.
>>
>> The first patch introduce a new property (pauth-qarma5) to allow to select
>> current default algorithm.
>> The second one change the default.
>> The third one updates documentation.
>>
>> v2:
>> - ensure we don't break migration compatibility, by using a specific backward
>>    compatible property.
>> - added some documentation about migration for arm virt machine model.
> 
> Other than a minor change to the 3rd docs patch which I'll note there:
> applied to target-arm.next, thanks.
> 
> -- PMM

Thank you Peter.

Regards,
Pierrick