From patchwork Fri May 13 00:13:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9087041 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 09ED3BF29F for ; Fri, 13 May 2016 00:21:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 603C720204 for ; Fri, 13 May 2016 00:21:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B60E6200D0 for ; Fri, 13 May 2016 00:21:23 +0000 (UTC) Received: from localhost ([::1]:60358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10r4-0003jX-Ow for patchwork-qemu-devel@patchwork.kernel.org; Thu, 12 May 2016 20:21:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38416) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10kf-0000XZ-TI for qemu-devel@nongnu.org; Thu, 12 May 2016 20:14:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b10ke-0002kg-Jg for qemu-devel@nongnu.org; Thu, 12 May 2016 20:14:45 -0400 Received: from mail-qk0-x244.google.com ([2607:f8b0:400d:c09::244]:33560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10ke-0002ka-GE for qemu-devel@nongnu.org; Thu, 12 May 2016 20:14:44 -0400 Received: by mail-qk0-x244.google.com with SMTP id q184so7152591qkf.0 for ; Thu, 12 May 2016 17:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6CdQs7cXXX/2D7q1qjU6RCcgFd0un7ule8hFItJusaI=; b=szlOjNFd7kc8drYGw3jF/orcDc4djtN/5a+t+0fdceWeyVI/ss1RsxLYYUTXSDD5wG Msx2496ryMFt7/VTc7KXF26+AyiIABjBcMXCTSxVUPYDFBQSVyMuspEx4jcINYEMElQq f43Y1md8UramQ9ezplrpAwicPmXjPiswHDHVQpFV6J+qns+G+Hyld3wRnI7HIhMjKl6i qVDZvI6L12I4CxAnXfTo56MDov76cDzUdD9yUxP5ZQiroYAvuUVU12MQc3OGq5mBsMf7 WmZ5tJR2yhcdhvEwLn2jcguzNXuZqU4PqQh6KF8c7SeWgsiVIEkR4kegGTcCUe4UioXW db1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6CdQs7cXXX/2D7q1qjU6RCcgFd0un7ule8hFItJusaI=; b=ZGPfHDXL5u3VwZ8BVMaUe4+gseZCk3ti1MOT6qcXjBOlQppwGo2ArKXKG0+flL9gC1 S4+CZGAqQCwAboYPYl0sISpPh89a0EmyPGzZiyrmg4GGeksJuBkU4BACt7zKmLPGhMV9 tQaD9jpEwWnhnf+FnwEeafDwhABW4IFXKjuDf7VI8idpJKcC0AOoNttRDTzLlZvfrlqn pAABDxOibBVNzgQX0B24pdgQIamjPY/ifJW2r/qbMyD9ypkGSOjM6yIl+RJ75TSp73+N YJoa4Iz58BTETl8rYHFeHdvrAVlwtoFZDmsKw/mZ/KoAyU2uI8tCYkK8TSLLfY/J8ej3 B7BA== X-Gm-Message-State: AOPr4FUtNGnlIWaZJT8h8AaQbDZ+FG8D06ctDema+0lg4ovOt/UBZc/VfSzU4xpD3lR00Q== X-Received: by 10.55.201.68 with SMTP id q65mr4183907qki.34.1463098484204; Thu, 12 May 2016 17:14:44 -0700 (PDT) Received: from bigtime.com ([172.56.44.137]) by smtp.gmail.com with ESMTPSA id w16sm7171321qka.35.2016.05.12.17.14.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 May 2016 17:14:43 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 12 May 2016 14:13:11 -1000 Message-Id: <1463098420-29113-11-git-send-email-rth@twiddle.net> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1463098420-29113-1-git-send-email-rth@twiddle.net> References: <1463098420-29113-1-git-send-email-rth@twiddle.net> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::244 Subject: [Qemu-devel] [PULL 10/39] tcg/sparc: Make direct jump patching thread-safe X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Sergey Fedorov , Sergey Fedorov Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sergey Fedorov Ensure direct jump patching in SPARC is atomic by using atomic_read()/atomic_set() for code patching. Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov Reviewed-by: Alex Bennée Message-Id: <1461341333-19646-10-git-send-email-sergey.fedorov@linaro.org> Signed-off-by: Richard Henderson --- tcg/sparc/tcg-target.inc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/sparc/tcg-target.inc.c b/tcg/sparc/tcg-target.inc.c index d641cfd..c6479e2 100644 --- a/tcg/sparc/tcg-target.inc.c +++ b/tcg/sparc/tcg-target.inc.c @@ -1647,6 +1647,6 @@ void tb_set_jmp_target1(uintptr_t jmp_addr, uintptr_t addr) the code_gen_buffer can't be larger than 2GB. */ tcg_debug_assert(disp == (int32_t)disp); - *ptr = CALL | (uint32_t)disp >> 2; + atomic_set(ptr, deposit32(CALL, 0, 30, disp >> 2)); flush_icache_range(jmp_addr, jmp_addr + 4); }