qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Helge Deller" <deller@gmx.de>,
	qemu-devel@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH] target/hppa: Optimize ldcw/ldcd instruction translation
Date: Wed, 13 Sep 2023 13:30:30 -0700	[thread overview]
Message-ID: <f824fa25-0d7f-b417-11a4-e3c84efe1b7a@linaro.org> (raw)
In-Reply-To: <acc0b3f5-959c-ac8d-89e1-5c862b39a721@gmx.de>

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	other threads:[~2023-09-13 20:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-13 14:47 [PATCH] target/hppa: Optimize ldcw/ldcd instruction translation Helge Deller
2023-09-13 16:55 ` Richard Henderson
2023-09-13 17:19   ` Helge Deller
2023-09-13 20:30     ` Richard Henderson [this message]
2023-09-14 21:19       ` Helge Deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f824fa25-0d7f-b417-11a4-e3c84efe1b7a@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=deller@gmx.de \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).