From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atddo-0007s3-Vu for qemu-devel@nongnu.org; Fri, 22 Apr 2016 12:09:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1atddl-0008E9-Kx for qemu-devel@nongnu.org; Fri, 22 Apr 2016 12:09:12 -0400 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:33148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1atddl-0008Dw-1v for qemu-devel@nongnu.org; Fri, 22 Apr 2016 12:09:09 -0400 Received: by mail-lf0-x22b.google.com with SMTP id e190so82098953lfe.0 for ; Fri, 22 Apr 2016 09:09:08 -0700 (PDT) From: Sergey Fedorov Date: Fri, 22 Apr 2016 19:08:42 +0300 Message-Id: <1461341333-19646-1-git-send-email-sergey.fedorov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v2 00/11] tcg: Make direct jump patching thread-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Alex=20Benn=C3=A9e?= , Sergey Fedorov , Paolo Bonzini , Peter Crosthwaite , Richard Henderson From: Sergey Fedorov When patching translated code for direct block chaining/unchaining, modification of concurrently executing code can happen in multi-threaded execution. Currently only user-mode is affected. To make direct block patching safe, some care must be taken to make sure that the code modification is made atomically and concurrently executed code is guaranteed to be consistent. This patch series fixes all supported TCG targets which use direct patching and documents the requirement for direct jump patching be atomic and thread-safe. The series' tree can be found in a public git repository [1]. [1] https://github.com/sergefdrv/qemu/tree/atomic-tb-patching-2 Summary of changes in v2: * Take out mistakingly pulled patches [PATCH 01/11] and [PATCH 02/11] * Two new patches to add some handy macros for alignment [PATCH v2 01/11] and [PATCH v2 02/11] * Use new alignment macros instead of open-coding * Use i386 tcg_out_nopn() implementation suggested by Richard Henderson; rework alignment checking and gap calculation in [PATCH v2 05/11] * Clean up reloc_pc24_atomic() in [PATCH v2 07/11] * Use tcg_debug_assert() instead of assert() * Use deposit32() in [PATCH v2 09/11] * s/atomic_write/atomic_set/ in [PATCH v2 10/11] * Minor rewording in [PATCH v2 11/11] Sergey Fedorov (11): include/qemu/osdep.h: Add a macro to check for alignment include/qemu/osdep.h: Add macros for pointer alignment tci: Make direct jump patching thread-safe tcg/ppc: Make direct jump patching thread-safe tcg/i386: Make direct jump patching thread-safe tcg/s390: Make direct jump patching thread-safe tcg/arm: Make direct jump patching thread-safe tcg/aarch64: Make direct jump patching thread-safe tcg/sparc: Make direct jump patching thread-safe tcg/mips: Make direct jump patching thread-safe tcg: Note requirement on atomic direct jump patching include/exec/exec-all.h | 32 ++++++-------------------------- include/qemu/osdep.h | 14 ++++++++++++++ tcg/aarch64/tcg-target.inc.c | 14 +++++++++++++- tcg/arm/tcg-target.inc.c | 18 ++++++++++++++++++ tcg/i386/tcg-target.inc.c | 23 +++++++++++++++++++++++ tcg/mips/tcg-target.inc.c | 3 ++- tcg/ppc/tcg-target.inc.c | 22 ++++++++++++++++++---- tcg/s390/tcg-target.inc.c | 8 ++++++++ tcg/sparc/tcg-target.inc.c | 2 +- tcg/tci/tcg-target.inc.c | 2 ++ tci.c | 5 ++++- translate-all.c | 2 ++ 12 files changed, 111 insertions(+), 34 deletions(-) -- 2.8.1