From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHTFb-0007vx-IU for qemu-devel@nongnu.org; Tue, 21 Jul 2015 04:50:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHTFV-0007Ti-3t for qemu-devel@nongnu.org; Tue, 21 Jul 2015 04:50:11 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:35003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHTFU-0007SE-UC for qemu-devel@nongnu.org; Tue, 21 Jul 2015 04:50:05 -0400 Received: by wibxm9 with SMTP id xm9so113712493wib.0 for ; Tue, 21 Jul 2015 01:50:04 -0700 (PDT) Sender: Paolo Bonzini References: <1437391637-31576-1-git-send-email-peter.maydell@linaro.org> From: Paolo Bonzini Message-ID: <55AE07B8.6080403@redhat.com> Date: Tue, 21 Jul 2015 10:50:00 +0200 MIME-Version: 1.0 In-Reply-To: <1437391637-31576-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] exec.c: Use atomic_rcu_read() to access dispatch in memory_region_section_get_iotlb() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: patches@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 > --- > 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