qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/arm: Use cpu_env in cpu_untagged_addr
@ 2024-07-02 15:49 Richard Henderson
  2024-07-02 15:51 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Richard Henderson @ 2024-07-02 15:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-arm

In a completely artifical memset benchmark object_dynamic_cast_assert
dominates the profile, even above guest address resolution and
the underlying host memset.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/cpu.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index d8eb986a04..ccfb9349a3 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -3309,8 +3309,8 @@ extern const uint64_t pred_esz_masks[5];
  */
 static inline target_ulong cpu_untagged_addr(CPUState *cs, target_ulong x)
 {
-    ARMCPU *cpu = ARM_CPU(cs);
-    if (cpu->env.tagged_addr_enable) {
+    CPUARMState *env = cpu_env(cs);
+    if (env->tagged_addr_enable) {
         /*
          * TBI is enabled for userspace but not kernelspace addresses.
          * Only clear the tag if bit 55 is clear.
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr
  2024-07-02 15:49 [PATCH] target/arm: Use cpu_env in cpu_untagged_addr Richard Henderson
@ 2024-07-02 15:51 ` Philippe Mathieu-Daudé
  2024-07-02 15:58 ` Alex Bennée
  2024-07-04 15:14 ` Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-02 15:51 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: qemu-arm

On 2/7/24 17:49, Richard Henderson wrote:
> In a completely artifical memset benchmark object_dynamic_cast_assert
> dominates the profile, even above guest address resolution and
> the underlying host memset.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/cpu.h | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr
  2024-07-02 15:49 [PATCH] target/arm: Use cpu_env in cpu_untagged_addr Richard Henderson
  2024-07-02 15:51 ` Philippe Mathieu-Daudé
@ 2024-07-02 15:58 ` Alex Bennée
  2024-07-02 16:48   ` Richard Henderson
  2024-07-04 15:14 ` Peter Maydell
  2 siblings, 1 reply; 5+ messages in thread
From: Alex Bennée @ 2024-07-02 15:58 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, qemu-arm

Richard Henderson <richard.henderson@linaro.org> writes:

> In a completely artifical memset benchmark object_dynamic_cast_assert
> dominates the profile, even above guest address resolution and
> the underlying host memset.

We seem to use ARM_CPU() quite liberally for a number of helpers so I
wonder if its worth codifying this anywhere? At least all the direct TCG
op helpers take CPUARMState *env directly.

>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  target/arm/cpu.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target/arm/cpu.h b/target/arm/cpu.h
> index d8eb986a04..ccfb9349a3 100644
> --- a/target/arm/cpu.h
> +++ b/target/arm/cpu.h
> @@ -3309,8 +3309,8 @@ extern const uint64_t pred_esz_masks[5];
>   */
>  static inline target_ulong cpu_untagged_addr(CPUState *cs, target_ulong x)
>  {
> -    ARMCPU *cpu = ARM_CPU(cs);
> -    if (cpu->env.tagged_addr_enable) {
> +    CPUARMState *env = cpu_env(cs);
> +    if (env->tagged_addr_enable) {
>          /*
>           * TBI is enabled for userspace but not kernelspace addresses.
>           * Only clear the tag if bit 55 is clear.

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr
  2024-07-02 15:58 ` Alex Bennée
@ 2024-07-02 16:48   ` Richard Henderson
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2024-07-02 16:48 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, qemu-arm

On 7/2/24 08:58, Alex Bennée wrote:
> Richard Henderson <richard.henderson@linaro.org> writes:
> 
>> In a completely artifical memset benchmark object_dynamic_cast_assert
>> dominates the profile, even above guest address resolution and
>> the underlying host memset.
> 
> We seem to use ARM_CPU() quite liberally for a number of helpers so I
> wonder if its worth codifying this anywhere? At least all the direct TCG
> op helpers take CPUARMState *env directly.

For things that are akin to virtual method calls, i.e. the function pointer comes from a 
table within the object or class, I think we can trust the lookup.  Therefore no dynamic 
check required on entry to those functions.

That said, cpu_env() is relatively new and we haven't made a concerted effort to use it 
everywhere that it might make sense.


r~


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] target/arm: Use cpu_env in cpu_untagged_addr
  2024-07-02 15:49 [PATCH] target/arm: Use cpu_env in cpu_untagged_addr Richard Henderson
  2024-07-02 15:51 ` Philippe Mathieu-Daudé
  2024-07-02 15:58 ` Alex Bennée
@ 2024-07-04 15:14 ` Peter Maydell
  2 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2024-07-04 15:14 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, qemu-arm

On Tue, 2 Jul 2024 at 16:49, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> In a completely artifical memset benchmark object_dynamic_cast_assert
> dominates the profile, even above guest address resolution and
> the underlying host memset.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>



Applied to target-arm.next, thanks.

-- PMM


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-04 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02 15:49 [PATCH] target/arm: Use cpu_env in cpu_untagged_addr Richard Henderson
2024-07-02 15:51 ` Philippe Mathieu-Daudé
2024-07-02 15:58 ` Alex Bennée
2024-07-02 16:48   ` Richard Henderson
2024-07-04 15:14 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).