qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/hppa: Optimize ldcw/ldcd instruction translation


From: Richard Henderson
Subject: Re: [PATCH] target/hppa: Optimize ldcw/ldcd instruction translation
Date: Wed, 13 Sep 2023 13:30:30 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

On 9/13/23 10:19, Helge Deller wrote:
On 9/13/23 18:55, Richard Henderson wrote:
On 9/13/23 07:47, Helge Deller wrote:
+        haddr = (uint32_t *)((uintptr_t)vaddr);
+        old = *haddr;

This is horribly incorrect, both for user-only and system mode.

Richard, thank you for the review!
But would you mind explaining why this is incorrect?
I thought the "vaddr = probe_access()" calculates the host address, so
shouldn't it be the right address?

The vaddr name is confusing (since it implies virtual address, which the return from probe_access is not) as are the casts, which are unnecessary.




+        /* if already zero, do not write 0 again to reduce memory presssure */
+        if (old == 0) {
+            return 0;
+        }
+        old = qatomic_xchg(haddr, (uint32_t) 0);

You're also dropping the required host memory barrier.

?

The path through the read+test+return, without the qatomic_xchg, has no host memory barrier to provide sequential consistency of the entire operation.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]