From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: David Gibson <david@gibson.dropbear.id.au>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 7/7] address_space_rw: address_space_to_flatview needs RCU lock
Date: Mon, 5 Mar 2018 09:36:55 +0100 [thread overview]
Message-ID: <20180305083655.6186-8-pbonzini@redhat.com> (raw)
In-Reply-To: <20180305083655.6186-1-pbonzini@redhat.com>
address_space_rw is calling address_space_to_flatview but it can
be called outside the RCU lock. To fix it, transform flatview_rw
into address_space_rw, since flatview_rw is otherwise unused.
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
exec.c | 28 ++++++++++------------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/exec.c b/exec.c
index 070eaff3e7..8a99114c69 100644
--- a/exec.c
+++ b/exec.c
@@ -3177,24 +3177,6 @@ static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
addr1, l, mr);
}
-static MemTxResult flatview_rw(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
- uint8_t *buf, int len, bool is_write)
-{
- if (is_write) {
- return flatview_write(fv, addr, attrs, (uint8_t *)buf, len);
- } else {
- return flatview_read(fv, addr, attrs, (uint8_t *)buf, len);
- }
-}
-
-MemTxResult address_space_rw(AddressSpace *as, hwaddr addr,
- MemTxAttrs attrs, uint8_t *buf,
- int len, bool is_write)
-{
- return flatview_rw(address_space_to_flatview(as),
- addr, attrs, buf, len, is_write);
-}
-
MemTxResult address_space_read_full(AddressSpace *as, hwaddr addr,
MemTxAttrs attrs, uint8_t *buf, int len)
{
@@ -3228,6 +3210,16 @@ MemTxResult address_space_write(AddressSpace *as, hwaddr addr,
return result;
}
+MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs,
+ uint8_t *buf, int len, bool is_write)
+{
+ if (is_write) {
+ return address_space_write(as, addr, attrs, buf, len);
+ } else {
+ return address_space_read_full(as, addr, attrs, buf, len);
+ }
+}
+
void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf,
int len, int is_write)
{
--
2.14.3
next prev parent reply other threads:[~2018-03-05 8:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-05 8:36 [Qemu-devel] [PATCH 0/7] memory: address_space_to_flatview needs RCU lock Paolo Bonzini
2018-03-05 8:36 ` [Qemu-devel] [PATCH 1/7] openpic_kvm: drop address_space_to_flatview call Paolo Bonzini
2018-03-06 0:10 ` David Gibson
2018-03-06 12:25 ` Paolo Bonzini
2018-03-06 7:46 ` Alexey Kardashevskiy
2018-03-05 8:36 ` [Qemu-devel] [PATCH 2/7] memory: inline some performance-sensitive accessors Paolo Bonzini
2018-03-06 7:46 ` Alexey Kardashevskiy
2018-03-05 8:36 ` [Qemu-devel] [PATCH 3/7] address_space_write: address_space_to_flatview needs RCU lock Paolo Bonzini
2018-03-06 7:46 ` Alexey Kardashevskiy
2018-03-05 8:36 ` [Qemu-devel] [PATCH 4/7] address_space_read: " Paolo Bonzini
2018-03-06 7:46 ` Alexey Kardashevskiy
2018-03-05 8:36 ` [Qemu-devel] [PATCH 5/7] address_space_access_valid: " Paolo Bonzini
2018-03-06 7:46 ` Alexey Kardashevskiy
2018-03-05 8:36 ` [Qemu-devel] [PATCH 6/7] address_space_map: " Paolo Bonzini
2018-03-06 7:46 ` Alexey Kardashevskiy
2018-03-05 8:36 ` Paolo Bonzini [this message]
2018-03-06 7:47 ` [Qemu-devel] [PATCH 7/7] address_space_rw: " Alexey Kardashevskiy
2018-03-06 7:47 ` [Qemu-devel] [PATCH 0/7] memory: " Alexey Kardashevskiy
2018-03-06 8:16 ` Paolo Bonzini
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=20180305083655.6186-8-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=aik@ozlabs.ru \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@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).