From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJ1fr-0007ek-7O for qemu-devel@nongnu.org; Tue, 12 Jan 2016 11:20:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJ1fm-0002aY-LQ for qemu-devel@nongnu.org; Tue, 12 Jan 2016 11:19:59 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJ1fm-0002aC-DU for qemu-devel@nongnu.org; Tue, 12 Jan 2016 11:19:54 -0500 References: <87r3hx6040.fsf@linaro.org> <5695081C.1070101@greensocs.com> <87vb6yde8g.fsf@linaro.org> <5695196E.70902@redhat.com> <87twmidbdb.fsf@linaro.org> From: Paolo Bonzini Message-ID: <569527A0.5080502@redhat.com> Date: Tue, 12 Jan 2016 17:19:44 +0100 MIME-Version: 1.0 In-Reply-To: <87twmidbdb.fsf@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] MTTCG sync-up call today? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Alex_Benn=c3=a9e?= Cc: mttcg@greensocs.com, Mark Burton , Paolo Bonzini , alvise rigo , QEMU Developers , KONRAD Frederic On 12/01/2016 17:13, Alex Benn=E9e wrote: > #4 0x00005555556e5b06 in tb_invalidate_phys_range (start=3Dstart@entry= =3D0, end=3Dend@entry=3D4096) at /home/alex/lsrc/qemu/qemu.git/translate-= all.c:1303 > #5 0x00005555556dbe42 in invalidate_and_set_dirty (mr=3Dmr@entry=3D0x5= 55556571800, addr=3D0, length=3Dlength@entry=3D4096) at /home/alex/lsrc/q= emu/qemu.git/exec.c:2420 > #6 0x00005555556e1890 in address_space_unmap (as=3Das@entry=3D0x555555= ff7000 , buffer=3D, len=3D, > is_write=3Dis_write@entry=3D1, access_len=3Daccess_len@entry=3D4096= ) at /home/alex/lsrc/qemu/qemu.git/exec.c:2933 > #7 0x00005555556e19bf in cpu_physical_memory_unmap (buffer=3D, len=3D, is_write=3Dis_write@entry=3D1, access_len=3D= access_len@entry=3D4096) > at /home/alex/lsrc/qemu/qemu.git/exec.c:2962 > #8 0x000055555578219c in virtqueue_unmap_sg (elem=3Delem@entry=3D0x7ff= e782c7cf0, len=3Dlen@entry=3D4097, vq=3D0x555556e6f020) > at /home/alex/lsrc/qemu/qemu.git/hw/virtio/virtio.c:257 > #9 0x0000555555782ac0 in virtqueue_fill (vq=3Dvq@entry=3D0x555556e6f02= 0, elem=3Delem@entry=3D0x7ffe782c7cf0, len=3D4097, idx=3Didx@entry=3D0) > at /home/alex/lsrc/qemu/qemu.git/hw/virtio/virtio.c:282 > #10 0x0000555555782ccf in virtqueue_push (vq=3D0x555556e6f020, elem=3De= lem@entry=3D0x7ffe782c7cf0, len=3D) > at /home/alex/lsrc/qemu/qemu.git/hw/virtio/virtio.c:308 > #11 0x000055555573451a in virtio_blk_complete_request (req=3D0x7ffe782c= 7ce0, status=3D) at /home/alex/lsrc/qemu/qemu.git/hw/block= /virtio-blk.c:58 > #12 0x0000555555734a13 in virtio_blk_req_complete (status=3D0 '\000', r= eq=3D0x7ffe782c7ce0) at /home/alex/lsrc/qemu/qemu.git/hw/block/virtio-blk= .c:64 > #13 virtio_blk_rw_complete (opaque=3D, ret=3D0) at /home= /alex/lsrc/qemu/qemu.git/hw/block/virtio-blk.c:122 > ---Type to continue, or q to quit--- > #14 0x0000555555a2d822 in bdrv_co_complete (acb=3D0x7ffe780189c0) at bl= ock/io.c:2122 > #15 0x0000555555a87a7a in coroutine_trampoline (i0=3D, i= 1=3D) at util/coroutine-ucontext.c:80 > #16 0x00007ffff0afc8b0 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > #17 0x00007fff8f5aa6e0 in ?? () > #18 0x0000000000000000 in ?? () >=20 > I guess the tb_lock could just be grabbed but there is stuff in that > path that assumes current_cpu is valid so I thought the thing to do was > defer the operation until a "real" vCPU can deal with it. I need to look at the branch... The latest version I have here does not require tb_lock taken in tb_invalidate_phys_range. /* * Invalidate all TBs which intersect with the target physical address ra= nge * [start;end[. NOTE: start and end may refer to *different* physical pag= es. * 'is_cpu_write_access' should be true if called from a real cpu write * access: the virtual CPU will exit the current TB if code is modified i= nside * this TB. * * Called with mmap_lock held for user-mode emulation */ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) { while (start < end) { tb_invalidate_phys_page_range(start, end, 0); start &=3D TARGET_PAGE_MASK; start +=3D TARGET_PAGE_SIZE; } } /* * Invalidate all TBs which intersect with the target physical address ra= nge * [start;end[. NOTE: start and end must refer to the *same* physical pag= e. * 'is_cpu_write_access' should be true if called from a real cpu write * access: the virtual CPU will exit the current TB if code is modified i= nside * this TB. * * Called with mmap_lock held for user-mode emulation * If called from generated code, iothread mutex must not be held. */ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t e= nd, int is_cpu_write_access) Paolo