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

[Xen-changelog] [qemu-xen master] accel/tcg/cputlb: avoid recursive BQL (fixes #1706296)



commit 4d824886c84cd88dd2f3ce9061835689152c25f8
Author:     Alex Bennée <alex.bennee@xxxxxxxxxx>
AuthorDate: Thu Sep 21 12:06:25 2017 +0100
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Thu Sep 28 16:52:09 2017 -0500

    accel/tcg/cputlb: avoid recursive BQL (fixes #1706296)
    
    The mmio path (see exec.c:prepare_mmio_access) already protects itself
    against recursive locking and it makes sense to do the same for
    io_readx/writex. Otherwise any helper running in the BQL context will
    assert when it attempts to write to device memory as in the case of
    the bug report.
    
    Reviewed-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
    Signed-off-by: Alex Bennée <alex.bennee@xxxxxxxxxx>
    CC: Richard Jones <rjones@xxxxxxxxxx>
    CC: Paolo Bonzini <bonzini@xxxxxxx>
    CC: qemu-stable@xxxxxxxxxx
    Message-Id: <20170921110625.9500-1-alex.bennee@xxxxxxxxxx>
    Signed-off-by: Richard Henderson <richard.henderson@xxxxxxxxxx>
    (cherry picked from commit 8b81253332b5a3f3c67b6462f39caef47a00dd29)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 accel/tcg/cputlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 85635ae..140d73a 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -763,7 +763,7 @@ static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry 
*iotlbentry,
 
     cpu->mem_io_vaddr = addr;
 
-    if (mr->global_locking) {
+    if (mr->global_locking && !qemu_mutex_iothread_locked()) {
         qemu_mutex_lock_iothread();
         locked = true;
     }
@@ -791,7 +791,7 @@ static void io_writex(CPUArchState *env, CPUIOTLBEntry 
*iotlbentry,
     cpu->mem_io_vaddr = addr;
     cpu->mem_io_pc = retaddr;
 
-    if (mr->global_locking) {
+    if (mr->global_locking && !qemu_mutex_iothread_locked()) {
         qemu_mutex_lock_iothread();
         locked = true;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.