From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] exec.c: Use atomic_rcu_read() to access dispatch in memory_region_section_get_iotlb()
Date: Tue, 21 Jul 2015 10:50:00 +0200 [thread overview]
Message-ID: <55AE07B8.6080403@redhat.com> (raw)
In-Reply-To: <1437391637-31576-1-git-send-email-peter.maydell@linaro.org>
On 20/07/2015 13:27, Peter Maydell wrote:
> When accessing the dispatch pointer in an AddressSpace within an RCU
> critical section we should always use atomic_rcu_read(). Fix an
> access within memory_region_section_get_iotlb() which was incorrectly
> doing a direct pointer access.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I discussed this on IRC with Paolo a while back, and IIRC he said
> that although this is a bug it's not one that can currently have
> any ill effects, though I forget why (probably because this code
> path is TCG only and TCG is single-threaded right now).
>
> exec.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/exec.c b/exec.c
> index 7d60e15..0a4a0c5 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -954,7 +954,10 @@ hwaddr memory_region_section_get_iotlb(CPUState *cpu,
> iotlb |= PHYS_SECTION_ROM;
> }
> } else {
> - iotlb = section - section->address_space->dispatch->map.sections;
> + AddressSpaceDispatch *d;
> +
> + d = atomic_rcu_read(§ion->address_space->dispatch);
> + iotlb = section - d->map.sections;
> iotlb += xlat;
> }
>
Thanks, queued for next 2.4 pull request.
Paolo
prev parent reply other threads:[~2015-07-21 8:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 11:27 [Qemu-devel] [PATCH] exec.c: Use atomic_rcu_read() to access dispatch in memory_region_section_get_iotlb() Peter Maydell
2015-07-21 8:50 ` Paolo Bonzini [this message]
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=55AE07B8.6080403@redhat.com \
--to=pbonzini@redhat.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.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).