From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428043; cv=none; d=zohomail.com; s=zohoarc; b=PuO4KZEMVjbN6nX5tZJ/rrWcwiqZ0F8LUlleEvy4Lbynt2zum1SLlDVZ+Vr5v/BNveJGZj8M9kwIsYrv/Fz7F/gLa90YKtE8dExY5lP2LGsEcvQJ5Yf62UT47Hm9SBF+vXs8WIFMI+ddxz3gNQl3KSUaoSueTOv/2t4EzIej6fE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428043; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=wdBJyG9pvdbY/tWrWdbknFMnMMlRkyr0IIdSlApvTpw=; b=mpwUugpI9R2Q6Z7d+qU9R3Oj40FjTVYFEtIirwuFHFaxWhmpaqFrIe7/xMJf2iZKv3m/NryTs64cqCZp7Mr9JRkkFiN3pOvpDAjcswhh1VW2qqTmMfhsH4LTL4GPLvChKWNaKn2TzoOklfF40aQiWAvrmEsatKL+DOw1huHqGTQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428043363174.21857486843373; Sat, 23 Jan 2021 10:54:03 -0800 (PST) Received: from localhost ([::1]:33386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O2s-0000g6-A0 for importer@patchew.org; Sat, 23 Jan 2021 13:54:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49746) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3NzT-0005Ag-BL for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:31 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]:40827) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzP-0008E3-7F for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:31 -0500 Received: by mail-pl1-x633.google.com with SMTP id j21so547445pls.7 for ; Sat, 23 Jan 2021 10:50:26 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wdBJyG9pvdbY/tWrWdbknFMnMMlRkyr0IIdSlApvTpw=; b=ymwZOQfHld7DCBVukldRcdmdz9p7bX9JMNNYxbCglSEhb+BcI4dgf10ud6SrBA5StU 8zfvAMcuY9UTz0ieOm0vBRxwlak282Om6Aa25XizmeEqmlRY7c/115qmJoPUv4DlJAOD CvzamhDgJOl/o1XK2/Qe5mnDa28zFiAi8U34d3CSXl+Ru1E+FNIWW2Ko8DC8FBdOb+Ye P/+7dRfpcpkI6EQPkDsFWgYeH3WS5QhpDoLBcTfwSfN5RSRCRor9qOv3t0RyGY8kMoY/ T3oLzNW5C5nEOb9/OOwvXNuyWSHvTfe7CkgXPOR0Z73Own5DPfjzfbrO6c1vvRpFcS76 XjMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wdBJyG9pvdbY/tWrWdbknFMnMMlRkyr0IIdSlApvTpw=; b=FfWe71XCZuKOrZCUFH4m43+SW+L8C+ldnJArAyTviibMsd+AwF12yd3F0+EfUpiapj 3xFGbENesJbHtydUJ4vQfqxKdVFt4k5zj33U0U48PhjUZMQCDQB/mx50vbbYqa/79Jfs pLXHGaVUwB9EHQKicPdqt+5AWHlWx7XZaVKKMrfd+wB0//PeRcDDi7ygs7XLEgpK9LiZ AHeNk26mJibpQpaWKw6x1lFtcb+lPUVDy/q6NrJpVVc4v5OqC7xdAObgiGSps2CFAH7E K1e8ZmKm1YbekJvHjfnhfdaG9tXuuXMbv44evtLjVx43TFAVp3OqklSgxxmS0kt+b1D5 wSlg== X-Gm-Message-State: AOAM530wP5JgHeqZp9FiWhfTll5340oNrYJAgz4X2ZfXvwRNYqDAgv0e yJ6+x7WvBpFMn/JxMl2bX8DhpOkPFYwQDg== X-Google-Smtp-Source: ABdhPJytriIY6fH/s2P2xo4QIZKiRkjtRS7CAse6VrJQ3uF5Lg5WnNIlE0IW4cS3nvwxwE2tJ/ME9A== X-Received: by 2002:a17:90a:db50:: with SMTP id u16mr12958389pjx.39.1611427825225; Sat, 23 Jan 2021 10:50:25 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 01/10] tcg: update the cpu running flag in cpu_exec_step_atomic Date: Sat, 23 Jan 2021 08:50:11 -1000 Message-Id: <20210123185020.1766324-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Douglas Crosher Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Douglas Crosher The cpu_exec_step_atomic() function is called with the cpu->running clear and proceeds to run target code without setting this flag. If this target code generates an exception then handle_cpu_signal() will unnecessarily abort. For example if atomic code generates a memory protection fault. This patch at least sets and clears this running flag, and adds some assertions to help detect other cases. Signed-off-by: Douglas Crosher Message-Id: Signed-off-by: Richard Henderson --- accel/tcg/cpu-exec.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e0df9b6a1d..8053aa3f11 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -285,6 +285,9 @@ void cpu_exec_step_atomic(CPUState *cpu) =20 if (sigsetjmp(cpu->jmp_env, 0) =3D=3D 0) { start_exclusive(); + g_assert(cpu =3D=3D current_cpu); + g_assert(!cpu->running); + cpu->running =3D true; =20 tb =3D tb_lookup__cpu_state(cpu, &pc, &cs_base, &flags, cf_mask); if (tb =3D=3D NULL) { @@ -323,6 +326,7 @@ void cpu_exec_step_atomic(CPUState *cpu) */ g_assert(cpu_in_exclusive_context(cpu)); parallel_cpus =3D true; + cpu->running =3D false; end_exclusive(); } =20 --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428184; cv=none; d=zohomail.com; s=zohoarc; b=C7lkuWt5mLpQvoIsKPI+c0MqKGbN0vng7g8KUHtYNQpVmpX2xQqz329Z5kwn84Tfg3TmWVj/u33WohvvQb3B7NG+QgbjE5FmKgdXO21mTtUTmShGWOLksmVN2hajeTXk1ZozockWZ5iJUhijVPPNwfSJYufJwSV13T4uv5d/Rn0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428184; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=+XTAgpbLP+ZIDnz+giRotvFVeNq2GJ4eMelxbBgp91w=; b=mtzsSqqUEMg1t5+cVTm6RFm2abIE4iO2P9MZ8CI6tqXfVVoEEan8l6WMjrxt8aN4ETHGVCYGY+SqLUJRd5qShvSUmlsnqH62PbN8g1gtSyHjFe/kAf6kGSj2BQnxMK3eJxaw1rNkAG2tQnbqeqB5LPH48ZbhqnRJNzGM/srbK+k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428184807933.1251664652392; Sat, 23 Jan 2021 10:56:24 -0800 (PST) Received: from localhost ([::1]:38978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O59-000327-Ol for importer@patchew.org; Sat, 23 Jan 2021 13:56:23 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3NzU-0005C3-Uk for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:32 -0500 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]:40828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzQ-0008Eg-LL for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:32 -0500 Received: by mail-pl1-x634.google.com with SMTP id j21so547470pls.7 for ; Sat, 23 Jan 2021 10:50:27 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+XTAgpbLP+ZIDnz+giRotvFVeNq2GJ4eMelxbBgp91w=; b=ZpL8O6jKFBCXsgdOQeuNAMYhkiFqPT107HSoYPvbU2HgWcY+uZg5BHHMh7EhTCAUCc HWRh34E7kkcHkaoJCYAWGNONVXUN44lFOPOp3SBw5eb2isE8JNdM9DU8K0BNQhgGG5h3 f6G391lyQB8sNjpzw1BG8UJ97Sy1JhiYeWRo8ltdK96ixSRRMjQ4Ejxq5t6A4JPxNiuK EZ9Ccpi+aV4XTdIOt/eonudFgNLwCYPNnHutd3olZ33UN3nPlI3li1fNyi0AGdepO82D 9bnjJzJwW/qdx1V3RJT8fW6htbQ9+67RmiMz1yU5UyBOD5kIlwtSC0Euxbf0+O5HhduB Lsfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+XTAgpbLP+ZIDnz+giRotvFVeNq2GJ4eMelxbBgp91w=; b=PF1fsxXzD0Gp5sAsacv3CIXqEHbA83z0LlvUzIj3x5KDlkQE3HDG68wQmqS4IVDG/S P8le2GtDLJFFnSViV6BkywsuDbJhaTa/XvYHAZkWyf3NbMStth5UOsMItWCVuYVNT89X DGqp5Gb/hvmUFbw/7YH1koV0wU61RAgBlGQrNdx8fNFrbo5HPyF8zKwqrnZT28lgEGA6 2pY68lgetJiPZVljAaIPQT+jlHUpZK3C44kigzAepYPyP+oUVGcJiIOPyre7DKgVKw3h bIZaZXwudLuzcyQGBmxcwHpW4RjtYKoX9xfsuOFkqKvdg7pQMEOeuyCgGgTdI0ANJ/il eLeA== X-Gm-Message-State: AOAM53069qWs63f4mdLSR8ZWWgkCxCvIrPW/6aaGzvHgzUypVDGAzPj4 qpyheBpIGeOhxqJ42SyXhiCCE9f657K7Bg== X-Google-Smtp-Source: ABdhPJwxM+fy01R7HYqrHpir2E1orSvc5ABkmA/SxPwlWvYhNIfhRBkLX5KI8/RgcgZR2dB9xcPueQ== X-Received: by 2002:a17:90b:3786:: with SMTP id mz6mr12925603pjb.19.1611427826983; Sat, 23 Jan 2021 10:50:26 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 02/10] qemu/compiler: Split out qemu_build_not_reached_always Date: Sat, 23 Jan 2021 08:50:12 -1000 Message-Id: <20210123185020.1766324-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::634; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Provide a symbol that can always be used to signal an error, regardless of optimization. Usage of this should be protected by e.g. __builtin_constant_p, which guards for optimization. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/qemu/compiler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index d620a841e4..cf28bb2bcd 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -215,9 +215,10 @@ * supports QEMU_ERROR, this will be reported at compile time; otherwise * this will be reported at link time due to the missing symbol. */ -#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__) extern void QEMU_NORETURN QEMU_ERROR("code path is reachable") - qemu_build_not_reached(void); + qemu_build_not_reached_always(void); +#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__) +#define qemu_build_not_reached() qemu_build_not_reached_always() #else #define qemu_build_not_reached() g_assert_not_reached() #endif --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611427914; cv=none; d=zohomail.com; s=zohoarc; b=XZ09/BN8JS7w1RyGwh5uvbaYCoMRX9bsMKHjrPL7Z3Df3sP4xejmXnsu6ooszIcINJbvGJIWKHH5wCWw5aL3l+s+J3eP5SG0B+/bbt42oj8RXv1gyqII4bRG9VUy7lCS7oeyYkE8hdGMjyD1zkiQ1vMDvudS2ZigfseQV4/6kp4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611427914; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AwbeW203h18CH5C6eZxAsKhYtBKVyHAGifKiBt07tZk=; b=hTLBTxQC8Ht4gEcKh/SU937lkkFvsY8nmsM6v7gmW2rArw14XEmjF5H6HiQUXn169RpoudKWDhxvAuM9yK8TzvBAa5zCmWBWKmURey1OO949xOIeqQOlsIkwrsGfLT1vnjB9P5v6gwuPxc0XdxYacY4uceQcRWgHqjUXM5/WdPY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611427914565109.40959362776266; Sat, 23 Jan 2021 10:51:54 -0800 (PST) Received: from localhost ([::1]:55582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O0n-0006a4-GQ for importer@patchew.org; Sat, 23 Jan 2021 13:51:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3NzW-0005Cv-Rx for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:34 -0500 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:53662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzS-0008Es-JN for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:34 -0500 Received: by mail-pj1-x102f.google.com with SMTP id p15so5850431pjv.3 for ; Sat, 23 Jan 2021 10:50:29 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AwbeW203h18CH5C6eZxAsKhYtBKVyHAGifKiBt07tZk=; b=j+MfltymXxIYJDGwPCOntg78SHZw+sPd48mplNPzEBRExGB6tj9y6Vk0kg5v8bjCyP ItsikzL7Wd9P9hyu1pt41eblF/lqybkYgvWGENMwMBSt9CAGYU9auHB0wesXFkbiyPSg Ag47PlP598g/SvcVrvmxQDbWzmS565WG9zC2BwS81NpItOKMbP8zmmq+CItpDZCBwL0x /JiAXb7dWD5qOj4RwNIVcKVsjfbveaWcc7+TiCpZO/oErf5/Ey2E4DkD9W2NE8tkBjfT yowWusLAl4LIFEMg55vEtcBDAZ0fhVIrtCPFzpfXyKzsyf9G8EbJbfTBr0rghvITHloF /URQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AwbeW203h18CH5C6eZxAsKhYtBKVyHAGifKiBt07tZk=; b=Nf3epzmrvMa7yrnTAEa0zDfjJRhR9JbcF5vF1QcxT3MvZ1q1VY35P9gsiQID8if4OT XZusxbJNgOhUtvFxg6SRGNov2S/fcwsjC0KSWfM/3OVhH5OhZq2ARu27gemZ7v/vPZfi 7vtrLWbPHP5uCzVMkTP5/UBVCr5roxBipYGoippZhFoeiCO2YKthplFltfYEsLx9zexJ fH9aabDV9cdhM1T3/QZibBkdEV/Ji9uNkiIcpbBLmV/ndwNCeekoDWQQrYldFNVR6+bl FkwG7RkXb/GoeOSHHxhEjWeTBsdgfMIBvrSK8LPE+jCSh0kBGwSomlM1VDBQJHBQ9pJB NJbA== X-Gm-Message-State: AOAM53013wSjbI73B7m7ULqFIZnUgcZnDvBJzDc0eZr6xyPBVRsJFRvl xqEv5uJ1tRRnp3LAofrLZjjIL4mwd77dHQ== X-Google-Smtp-Source: ABdhPJyy2n0ZSztMDKPAbRbFRM3jQ+1QgVjjTyNMCQq/0aqUVwOrk7jfd0SeKZeUoxRtO5nwfSbwQw== X-Received: by 2002:a17:90a:f2cf:: with SMTP id gt15mr12328096pjb.166.1611427828754; Sat, 23 Jan 2021 10:50:28 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 03/10] tcg: Optimize inline dup_const for MO_64 Date: Sat, 23 Jan 2021 08:50:13 -1000 Message-Id: <20210123185020.1766324-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" Avoid the out-of-line function call for immediate MO_64. In addition, diagnose all invalid constants at compile-time. Reviewed-by: David Hildenbrand Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 504c5e9bb0..c5a9d65d5f 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -1325,7 +1325,8 @@ uint64_t dup_const(unsigned vece, uint64_t c); ? ( (VECE) =3D=3D MO_8 ? 0x0101010101010101ull * (uint8_t)(C) \ : (VECE) =3D=3D MO_16 ? 0x0001000100010001ull * (uint16_t)(C) \ : (VECE) =3D=3D MO_32 ? 0x0000000100000001ull * (uint32_t)(C) \ - : dup_const(VECE, C)) \ + : (VECE) =3D=3D MO_64 ? (uint64_t)(C) \ + : (qemu_build_not_reached_always(), 0)) \ : dup_const(VECE, C)) =20 =20 --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428046; cv=none; d=zohomail.com; s=zohoarc; b=HRnBSaKp4g4TPc+hHiZQvZLGAUfsyP2tMLzRrb29L6bBKJzbetf2+TfjuL7zoSyCKB0bObb/6aI4YhKyPTGu2y6VHCRLUE+nGMOiD+GFOXn7zqjbTZ2CwDlfrV452HyZHC2hfmIidqoscxvFjd6hzVkHy+kF7ULZDkMm03zYwio= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428046; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=W7GA19BzjsaVlb4cNdmGQMkPm1CutshKMo07MTWHTyQ=; b=c8hfWoh5gafRYvO3mXP/EO4g3/5rGlhzRH7rMqlIv9JH52mAVZiFON6+sJYRPDabw/lB+TMasg6yxb/gBsBIHX6C6hypfq7acy3rR94vhXJCnbVq9ELSFjZJFhOX1Pw5oZwUk//AKJqFPFW+f21EU7xsQJ5qG0dAPxCkfpjl3Tk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428046488366.41376228581214; Sat, 23 Jan 2021 10:54:06 -0800 (PST) Received: from localhost ([::1]:33646 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O2v-0000ma-GY for importer@patchew.org; Sat, 23 Jan 2021 13:54:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nzc-0005FE-15 for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:40 -0500 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:52524) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzU-0008FZ-1T for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:39 -0500 Received: by mail-pj1-x102b.google.com with SMTP id kx7so5856091pjb.2 for ; Sat, 23 Jan 2021 10:50:31 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=W7GA19BzjsaVlb4cNdmGQMkPm1CutshKMo07MTWHTyQ=; b=Wy4HJVZ8A5QabipftgesTjaJoNOAdfuD7fGQdPqKg0pSu9Y75W6mtFQ+984z3DXHlA CN0gidKTNwVn/5zxgtrzEbueZgWEnJwHke0WCRjhfmpW1H+xM0zK1OywsLw6IZKxv9zA Hj1bhca/EsXYR4BZg8NxATlq4bZss6ecv9dP4BPxl0mCVQRmeocFUGm1BD6O2alcD2WG zr1pWKjWji67fkCH4kk4Y238O1hu4hwMmFLFQB7w5U5t9PiatV9ykL67BsumWJXn6eAM PHAqTceOCoQAyjjeK/NOrMz/pbeIfN8yXaoNSHwYxSR6q1i/bpn15eeC3lq7pn24Ifbw axuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=W7GA19BzjsaVlb4cNdmGQMkPm1CutshKMo07MTWHTyQ=; b=SY6gODMERAlnTlz7uL56plj8oSdK+W73NiDYzG4PPFTAlSY0hAgfZWfqQXjM3tmuuf cKdNOTweryJxnbyq66fpqyeywwtL8N60O0ax5YT2y0j/hkjDvo4soXbOuUhr0EOT4g7Q foCZON16bYLtU7sseQT+y4DWXpCZMX4Xt+J94ME1H/6E1s4AGlSbHLjBoDqUcP3CSXQn GAomQD5451Y2ZBteVRqOGKvPmrWA81hUaCSHaUecdRvtACt0Q+l1zbw+AYIwVzQnnzGC bNn9NtLBid06bC773w66Qhjgk/IFLK9AFC+l5zecNb3LAxklL50Qi3HNXM4yWt8zx3IT Al9Q== X-Gm-Message-State: AOAM533AQACCVKYDrlsW7tJBvwCL2RsgXX9oLDZPtMWSJxnsi0jDQiu7 ZQjvEpyQ7yaNLlnOKy0t94N7Oxs2f8j5Rw== X-Google-Smtp-Source: ABdhPJxl5JlSIrzt71lIAXDnKbylnJcLBEHJO3o1mvfubdBeQpaksjG8usBEQsOj9+mQObJKTv7L/A== X-Received: by 2002:a17:90a:17a5:: with SMTP id q34mr6039866pja.47.1611427830567; Sat, 23 Jan 2021 10:50:30 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 04/10] tcg: Increase the static number of temporaries Date: Sat, 23 Jan 2021 08:50:14 -1000 Message-Id: <20210123185020.1766324-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) This isn't a total or permanent solution to the problem of running out of temporaries, but it puts off the issue for a bit. Make the assert in tcg_temp_alloc unconditional. If we do run out of temps, this can fail much later as a weird SIGSEGV, due to the buffer overrun of the temp array. Remove the inlines from tcg_temp_alloc and tcg_global_alloc. Buglink: https://bugs.launchpad.net/bugs/1912065 Reviewed-by: Alex Benn=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 +- tcg/tcg.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index c5a9d65d5f..0187de1352 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -275,7 +275,7 @@ typedef struct TCGPool { =20 #define TCG_POOL_CHUNK_SIZE 32768 =20 -#define TCG_MAX_TEMPS 512 +#define TCG_MAX_TEMPS 1024 #define TCG_MAX_INSNS 512 =20 /* when the size of the arguments of a called function is smaller than diff --git a/tcg/tcg.c b/tcg/tcg.c index 8f8badb61c..5110f6f39c 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1204,14 +1204,14 @@ void tcg_func_start(TCGContext *s) QSIMPLEQ_INIT(&s->labels); } =20 -static inline TCGTemp *tcg_temp_alloc(TCGContext *s) +static TCGTemp *tcg_temp_alloc(TCGContext *s) { int n =3D s->nb_temps++; - tcg_debug_assert(n < TCG_MAX_TEMPS); + g_assert(n < TCG_MAX_TEMPS); return memset(&s->temps[n], 0, sizeof(TCGTemp)); } =20 -static inline TCGTemp *tcg_global_alloc(TCGContext *s) +static TCGTemp *tcg_global_alloc(TCGContext *s) { TCGTemp *ts; =20 --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428286; cv=none; d=zohomail.com; s=zohoarc; b=jozZzqKCWeOwp7HKuyXyNKp/m/43wBpCNCGjpZTTR0eo3mA4IYQEMq7YMxEbFDn7sk9YKaH5guJSPvOOsmQBEdlIuLozxhEjg6ZSvJ1vFE/78rdo2T/HNoP9ptmWrHklvVgUCoNry5KQHEpiO+fMbah4MdgMSCNlNXV0YSIc3ck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428286; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xbLvVOyBGJCgR+9BKQ86TGBEl8Sy1NrA6kmq+fGB0H4=; b=j32m5iP4U7cIHYQvZhZ0m/K/qvVe0Jy4tpZecp73gMLHe5qL7AbLP9jIr4Sb+eFm8rD6wo7mCoUKoelLmWWGds+oQDuoheALnlt+Aoui3q7GZeygJY2gb/Zq0WcD7Lid6d5F9pooGic51x1gVbJ11fOiSCXvOp3icB22f4WsU60= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428286822265.0817039038508; Sat, 23 Jan 2021 10:58:06 -0800 (PST) Received: from localhost ([::1]:43846 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O6n-0005AF-MO for importer@patchew.org; Sat, 23 Jan 2021 13:58:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nzb-0005EM-Hl for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:39 -0500 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]:36588) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzW-0008Gu-3K for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:39 -0500 Received: by mail-pg1-x52e.google.com with SMTP id c132so6149643pga.3 for ; Sat, 23 Jan 2021 10:50:33 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xbLvVOyBGJCgR+9BKQ86TGBEl8Sy1NrA6kmq+fGB0H4=; b=yT9zLh3gAuz/1TdGh9RkLWHr2FhmHzPGbzYEsVT49Ls/CkcksNhWt4Dj2mF2aA5pVa +jRaTI3FRPSQ9jW39WclGDpRh7zgv2f5EJSv0TYtMxmcRTcjcqOWeSn3Oi/TWLAP6w1K 9S1Dv00bQMku/4X2HBzfi80oOhRJIUeAhoNX8sWkzU04EzoDmsIrLQuLpPOU0lzVKRaS O9q7YY27JiModOI5XpJmjDE9UasIXUN1EBoK+VTAOfP2Xx0s4EJX+RHfLMp8U94htgey NyaVAQBeVSU2FfoUuA8M4wK7n3u+Ta5IdBY027BUBG1AXlODIF/iLNqxacaVNndg1fqs TaxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xbLvVOyBGJCgR+9BKQ86TGBEl8Sy1NrA6kmq+fGB0H4=; b=Nr63nnZyCMwCKrr5I52xncesboEgvk5zYwOa7E5yZ6hC7tsWailPS/MfsLHHNkTzkS Cib0D27vJQGzsRLsdQpuwi9UYCJ8OqcrIh2z9T2YtGZK95/DoDq8LcCJzyE28tFekQMo 2StKoiKh3eWts/5KJGJx5DgMmlI3eZ+WjGLotMWC0ANebKMGZa5/w+HDN8ssFzRMMpnn 5LR/eazvg4qcN4mTyseJtAI/OADYom8PwsXaV2lwNBqICnAwEKJv4+7pkztwcgvKuIg9 LpVQEu2RZjLtsT4aGZZC2WPf56vysg5usEXuub3lXPdm6actyT3YmpkAebi9YT2j0SjF uyHQ== X-Gm-Message-State: AOAM531hutzuG7hkxsaNjiYAgq8cC00YTleUam51JxKr01B3Qm9zbTeN LX7SdwL+oUS1K1M4aDyyWLzn2Sigv22zQw== X-Google-Smtp-Source: ABdhPJxtFxforCEA7Zpo0PiBRIkOBAArwPA3+Hnn0hm5JLlc1oJK7HLvDYDH6n0RcOcsmMEEWF1CAA== X-Received: by 2002:a63:b4a:: with SMTP id a10mr10398524pgl.112.1611427832336; Sat, 23 Jan 2021 10:50:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 05/10] accel/tcg: Make cpu_gen_init() static Date: Sat, 23 Jan 2021 08:50:15 -1000 Message-Id: <20210123185020.1766324-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Claudio Fontana Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 cpu_gen_init() is TCG specific, only used in tcg/translate-all.c. No need to export it to other accelerators, declare it statically. Reviewed-by: Claudio Fontana Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210117164813.4101761-2-f4bug@amsat.org> Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 2 -- accel/tcg/translate-all.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 2e5b4bba48..516013e735 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -47,8 +47,6 @@ void gen_intermediate_code(CPUState *cpu, TranslationBloc= k *tb, int max_insns); void restore_state_to_opc(CPUArchState *env, TranslationBlock *tb, target_ulong *data); =20 -void cpu_gen_init(void); - /** * cpu_restore_state: * @cpu: the vCPU state is to be restore to diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index e9de6ff9dd..ca7ef6aa17 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -243,7 +243,7 @@ static void page_table_config_init(void) assert(v_l2_levels >=3D 0); } =20 -void cpu_gen_init(void) +static void cpu_gen_init(void) { tcg_context_init(&tcg_init_ctx); } --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428025; cv=none; d=zohomail.com; s=zohoarc; b=fSMkMR3z9lS22jFxpHdJN2vXCv1HvAu4VM8W81CRfda21RfVSy/6u76is4bVEpWzPnESSzgnvpRHP7lxO8xZBikqGKJDAtfGnLJfnLWyJb1Ylv0BZeNmfIEu6Oao1hZkzA11ydoS4wnY4H1kI6Fw2PLF6YoPesx41ObJfgzogyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428025; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UqHrCB4kNK0rhQOAfSyXF5GRntYhHhyAfqhZg0V8bdY=; b=TKFKs67BnyrdTcUcQfAbWKIWotZfBAx/mm3C8yL+kjEfyQgmY7OOCCE45oGWKj9BFCq06spUAyxJ1mXbfzmene/WAWkRa5agCO6RZ5hdqaj3ZNs9LEJN3stcJ9m4lpeWmQ9XencaHU0CWOnpgt++Us1f9qA4Xckv9Z2R9YjNJAI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428025717344.10985759045434; Sat, 23 Jan 2021 10:53:45 -0800 (PST) Received: from localhost ([::1]:60778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O2a-0000Ic-E4 for importer@patchew.org; Sat, 23 Jan 2021 13:53:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49866) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nze-0005Kq-B4 for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:42 -0500 Received: from mail-pf1-x42a.google.com ([2607:f8b0:4864:20::42a]:35946) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3NzX-0008H1-LX for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:42 -0500 Received: by mail-pf1-x42a.google.com with SMTP id u67so5963317pfb.3 for ; Sat, 23 Jan 2021 10:50:34 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UqHrCB4kNK0rhQOAfSyXF5GRntYhHhyAfqhZg0V8bdY=; b=jMNXWj6T7cZseMzBnOPaEaltvnEvQwRlYI6uoqAqmjMEmJ7SLx4I+QiHcDB3fVO47N 8JioZzw/phU31w0owSLSPUtppOXLeiQ+qJ6yuMoKTsLoyTBPxzvyEtMFVVNuK8x0efTp S3tMyM9XWnjy3xrLjlnIB1QiiZn5D8sbDSM86RjCt2gHsxuoh4DjlcCu9o02AesnVmSe MQ+6KJztbBRJIFVk5KicYTLqcDV/yctx+yPwOHqkjzShVvJjkZOTvy1oX4fk4DvSZ+ip CUFTDt4fQjrvVVg65p6oKfHqIvaOFnD4Samr7pGOU1ys0BQuR3hf7oqamDRcDDfoQqaY pLjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UqHrCB4kNK0rhQOAfSyXF5GRntYhHhyAfqhZg0V8bdY=; b=sUvMe3Tx4WaUCQpoyeQBaaudOhT+zuadc1kuCE9LV0l2W2Pvcgyn3rM02WribuJFDL 4P5GRgDJ8i3W23L1tlqRROi+F6KewqOiybYKFztRJ42aq5CLf3o0phlYMBTgmHaNZegv yM4qxyGv41epk4N6ZzvOPf2KKJIZ3CQ53kE7EzjkvcODNsa61Ncy7CKPToKCenTsZjel N7XBF8kwq7e4ATC8kPjRGER31iYo4M9xrnVtdunUpODr/hchHwYI04Olo24j/r3foiRh DrK8D2U1RFWpuNV4sI5x6J6SFw3Ruyu3JmVMZh/k0YD+xZzOwaXxe9m7Szw2/w+5qZWF Z5iA== X-Gm-Message-State: AOAM531LItkzdP48jlAu7uxO3aFu6yoCKal44tHCruu4dv7o3V9P7Z2r uwV/gdIG5puvehXs68z3nSmsm+w27vR7zQ== X-Google-Smtp-Source: ABdhPJzEdakmKZXAmWc2j7tIAX0o+KV3b85Z8wUJdixSj6ZhgRCTv8TtnjgqyL6wkOLpAzRErS2pOg== X-Received: by 2002:a63:1602:: with SMTP id w2mr11035870pgl.128.1611427834009; Sat, 23 Jan 2021 10:50:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 06/10] accel/tcg: Move tb_flush_jmp_cache() to cputlb.c Date: Sat, 23 Jan 2021 08:50:16 -1000 Message-Id: <20210123185020.1766324-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42a; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Move and make the function static, as the only users are here in cputlb.c. Suggested-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 3 --- accel/tcg/cputlb.c | 18 ++++++++++++++++++ accel/tcg/translate-all.c | 17 ----------------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 516013e735..1e3e7cf8e7 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -663,9 +663,6 @@ tb_page_addr_t get_page_addr_code_hostp(CPUArchState *e= nv, target_ulong addr, void tlb_reset_dirty(CPUState *cpu, ram_addr_t start1, ram_addr_t length); void tlb_set_dirty(CPUState *cpu, target_ulong vaddr); =20 -/* exec.c */ -void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr); - MemoryRegionSection * address_space_translate_for_iotlb(CPUState *cpu, int asidx, hwaddr addr, hwaddr *xlat, hwaddr *plen, diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index ced3dc077e..0fa1643ed3 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -25,6 +25,7 @@ #include "exec/address-spaces.h" #include "exec/cpu_ldst.h" #include "exec/cputlb.h" +#include "exec/tb-hash.h" #include "exec/memory-internal.h" #include "exec/ram_addr.h" #include "tcg/tcg.h" @@ -97,6 +98,23 @@ static void tlb_window_reset(CPUTLBDesc *desc, int64_t n= s, desc->window_max_entries =3D max_entries; } =20 +static void tb_jmp_cache_clear_page(CPUState *cpu, target_ulong page_addr) +{ + unsigned int i, i0 =3D tb_jmp_cache_hash_page(page_addr); + + for (i =3D 0; i < TB_JMP_PAGE_SIZE; i++) { + qatomic_set(&cpu->tb_jmp_cache[i0 + i], NULL); + } +} + +static void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr) +{ + /* Discard jump cache entries for any tb which might potentially + overlap the flushed page. */ + tb_jmp_cache_clear_page(cpu, addr - TARGET_PAGE_SIZE); + tb_jmp_cache_clear_page(cpu, addr); +} + /** * tlb_mmu_resize_locked() - perform TLB resize bookkeeping; resize if nec= essary * @desc: The CPUTLBDesc portion of the TLB diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index ca7ef6aa17..5bd0e267c8 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -2461,23 +2461,6 @@ void cpu_io_recompile(CPUState *cpu, uintptr_t retad= dr) cpu_loop_exit_noexc(cpu); } =20 -static void tb_jmp_cache_clear_page(CPUState *cpu, target_ulong page_addr) -{ - unsigned int i, i0 =3D tb_jmp_cache_hash_page(page_addr); - - for (i =3D 0; i < TB_JMP_PAGE_SIZE; i++) { - qatomic_set(&cpu->tb_jmp_cache[i0 + i], NULL); - } -} - -void tb_flush_jmp_cache(CPUState *cpu, target_ulong addr) -{ - /* Discard jump cache entries for any tb which might potentially - overlap the flushed page. */ - tb_jmp_cache_clear_page(cpu, addr - TARGET_PAGE_SIZE); - tb_jmp_cache_clear_page(cpu, addr); -} - static void print_qht_statistics(struct qht_stats hst) { uint32_t hgram_opts; --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428374; cv=none; d=zohomail.com; s=zohoarc; b=JC5+sbzgv+uyOg/JaknzpdP+gtJmy6wjlEoirGglD9sc1DeFxi46gelc8d3Hk9Ulr69v33gqgAS6Yjq9x8FTqJ9xYmdJIPzlY6PqwGMmtAkCxzAYb58qwxPR9C8sFCM5YHvYPJgQjWjp2wd/oQIaO1WmUWll5yUxhAmxEjo7mFk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428374; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=w2ogJZM2za2je2RMQYG7Dr+ReH/Y4veEnOKOQS9UGe4=; b=Z9H2M69Z/frQuGCcMFAfy4yp4XtOtNzuMJ5l+QJ6B9kVepwEIF9wyNMpO9GGvMkLFtVnJ9VUz5ExEh+fe3gu2UpNq98DuyQPRuZT/GgAyHzIWY6+1CzSSP8buLOtYNVqlstIQ6q2KDyh4FziOgz4z8xZddZK7ziWkx+ncersV+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428374229505.3057939281232; Sat, 23 Jan 2021 10:59:34 -0800 (PST) Received: from localhost ([::1]:48662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O8D-0007Dv-1N for importer@patchew.org; Sat, 23 Jan 2021 13:59:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nzd-0005IW-9i for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:41 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:34576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3Nzb-0008HK-9k for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:41 -0500 Received: by mail-pl1-x62b.google.com with SMTP id t6so5178814plq.1 for ; Sat, 23 Jan 2021 10:50:36 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w2ogJZM2za2je2RMQYG7Dr+ReH/Y4veEnOKOQS9UGe4=; b=m+EOdmZoPA3eICWYfZm1TMpZm/KfhM6x5cUIsxv82lNzKtam6uy405M1rWo6Ts82mb 1zmdG43W+DB/H8tlp5xUL8JQxeuSv+u91HsE2mf5aFJ1jic8xd0adusRHYpa8TJNetUD IjL6KpDsKajMG8LwcK3wrqfK0MjlPtPk9y9HILnpKPGDuVMRnm8dNihn8tC2ZY1Su8w1 NMNnIOHtYJhgGDk9EaALnDpk0XptFgfXB0IVFXWtwPgtCYpGO4cG4xjfYlQzOeV5NjfN VuCTlOVN9TX3kEERHosmv899S7eakF6CmMeGqHoWfm/qGV/Z9kImmN6PN/Y/yNRSG9GK gQJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w2ogJZM2za2je2RMQYG7Dr+ReH/Y4veEnOKOQS9UGe4=; b=sx0jIUIlb6of6tCicF0mu5NabNSfOmoFSaBS3sMymXezlnCWdFQt/xA8WBf3fFfcjV KJrTab+d7eBwDVIEbuWsVDBPR/ikZs38+9+WMOtzpGr2jx+IBoC5wNphkRg/vBJ3oFfT P9cYg+lPF0dyHPyvkrDou+EkTww9Cmd/WLZbC7krmcJnKWXThH2MrByX0RsGRMJWKJvc MpZHtVwcKjafjoXdxFdsZ7G/0UvSgbrHlYI798Fk3yZGwDHXc6lvkw1t1rHq6IB2hEE0 CoFX0z2aN7HALl6guuDM2QuCIiimlVGAbtDjsJ4SGV+WKT89Yd/geYEHCchd7HApOkWS 2xiA== X-Gm-Message-State: AOAM531oE/midlPmHXQj9MrxXsGtF8X9Kfau5/TloZap0NOIAEhvql8/ MbyRAbgswId/m1VX+kzPqj/jzSLID5TIyg== X-Google-Smtp-Source: ABdhPJzwJtjA+HsyAaDuTnfLRczKSpssHKVf16t8mHesdgEZM59VVM0k+qPcJ6+04lZQI9UC740Big== X-Received: by 2002:a17:902:8503:b029:dc:44f:62d8 with SMTP id bj3-20020a1709028503b02900dc044f62d8mr987366plb.34.1611427835769; Sat, 23 Jan 2021 10:50:35 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 07/10] accel/tcg: Restrict tb_gen_code() from other accelerators Date: Sat, 23 Jan 2021 08:50:17 -1000 Message-Id: <20210123185020.1766324-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 tb_gen_code() is only called within TCG accelerator, declare it locally. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210117164813.4101761-4-f4bug@amsat.org> [rth: Adjust vs changed tb_flush_jmp_cache patch.] Signed-off-by: Richard Henderson --- accel/tcg/internal.h | 18 ++++++++++++++++++ include/exec/exec-all.h | 5 ----- accel/tcg/cpu-exec.c | 1 + accel/tcg/translate-all.c | 1 + 4 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 accel/tcg/internal.h diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h new file mode 100644 index 0000000000..06b341fceb --- /dev/null +++ b/accel/tcg/internal.h @@ -0,0 +1,18 @@ +/* + * Internal execution defines for qemu + * + * Copyright (c) 2003 Fabrice Bellard + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef ACCEL_TCG_INTERNAL_H +#define ACCEL_TCG_INTERNAL_H + +#include "exec/exec-all.h" + +TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, + target_ulong cs_base, uint32_t flags, + int cflags); + +#endif /* ACCEL_TCG_INTERNAL_H */ diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 1e3e7cf8e7..3acc7c2943 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -64,11 +64,6 @@ bool cpu_restore_state(CPUState *cpu, uintptr_t searched= _pc, bool will_exit); =20 void QEMU_NORETURN cpu_loop_exit_noexc(CPUState *cpu); void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); -TranslationBlock *tb_gen_code(CPUState *cpu, - target_ulong pc, target_ulong cs_base, - uint32_t flags, - int cflags); - void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); void QEMU_NORETURN cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 8053aa3f11..37d17c8e88 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -41,6 +41,7 @@ #include "exec/cpu-all.h" #include "sysemu/cpu-timers.h" #include "sysemu/replay.h" +#include "internal.h" =20 /* -icount align implementation. */ =20 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 5bd0e267c8..73fef47148 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -60,6 +60,7 @@ #include "sysemu/cpu-timers.h" #include "sysemu/tcg.h" #include "qapi/error.h" +#include "internal.h" =20 /* #define DEBUG_TB_INVALIDATE */ /* #define DEBUG_TB_FLUSH */ --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428189; cv=none; d=zohomail.com; s=zohoarc; b=Bsye35UFDT9zVnT7BPPL4EayPOrKdJW8iW0r6YGC+S3apSzHZbigsG2QfM2bZjqqpOKG0EbAFsmq1rTqr2pgwWgzT70kGnbEG5v/53il+iOSLsx+svbeVeYeXmHnKJEOhhAfTFLcA8RQqrETx8Aa/u5cQlsjyRi88WWkNRdGOGI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428189; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JMOpMnB2EIi71uPv++zJqhVu0CRBzaOh+TyvyTqEpP4=; b=oH8crIs+DCFwC94gJSNxjMzVs75yGnXC8wwFY+6Ki34ptjwCcHsZ0MPHm19TcQD0SmSy5JXueU9wQscWEddS1i28SEq2t2WiBCgCtRz08iam6X5tfQ9f7XnbXDf1yVmKvTfK3BOzb0Hit1lZLXLjlyQ0WHRg5m4QnjIc3LFd8Rk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428189402836.2903420991421; Sat, 23 Jan 2021 10:56:29 -0800 (PST) Received: from localhost ([::1]:39150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O5C-00036X-Br for importer@patchew.org; Sat, 23 Jan 2021 13:56:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nzd-0005Hn-2e for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:41 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:32960) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3Nzb-0008Hx-9H for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:40 -0500 Received: by mail-pl1-x631.google.com with SMTP id b8so5180547plx.0 for ; Sat, 23 Jan 2021 10:50:38 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JMOpMnB2EIi71uPv++zJqhVu0CRBzaOh+TyvyTqEpP4=; b=Qpe+hYsDUnN7hD8gUuwcBxbSZmd3H8KlL6lX5WxrSee1LohaeWZzuXCyzhomdzHBYG n+3XO4XpFh61DWI0rwNuf3W3STTt5jGhHT0cWGa/jMsXSHfvNXu7BxXF6Q9jOWT/sd/2 Ks8weu1RGsejYnQoCfuDweVlRugS17TgdIQmBipPLgrYFHn2Zcyz3gGKbisphrIYd5ce B7yzm6b593oYc8NSdI8p+NkJUW2y1FgBVYz6fRe5LXbkk3vy/4AGZEFszf6lcont4Rwf qltt+dB9e7eeQYizHbKllVIWKIZ7KtLPt0bphrItweqHHDU0O0IyhPrYNj4caFuLtdO6 S5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JMOpMnB2EIi71uPv++zJqhVu0CRBzaOh+TyvyTqEpP4=; b=eTHNKYaJEPKcRfmMFHWuubiUba/U/zq+C0wb53gZeFPAT5efiASiKZLgsQrdIvz65G hGaM9zlYEYAxXvs820gaoif0dD287C78W1UUsOCk1GvlfF2ytleqM88vYUQqHevvrEd8 cAL9wTUdlJI7gjBe3tS+AVNSqh9RNTTjRvez3XG5l6+AJgqOJASJlJ22B2lNyPBaRZ+G vd+XePGdXqAj5vSdzNmdD0UPa6KWvmKlRQfQN0adgSIOsnsynVgWAz2xAo1lq1TC6+VQ shu7ee8qL8BMNi5WPKMLuYWj1sgXpwLUFZVQt62WBfKuT2d1Wa4YN4YUoEiXkUZ5QEsx 2dbQ== X-Gm-Message-State: AOAM530n6j0WX0J5oXONCziO/e7NfziYpCoPEb6Fc8Jzp/vFZ7JobH5i aQxa8K4gSx256y2nVtiQDHbYWuEwJ7/oWg== X-Google-Smtp-Source: ABdhPJx6GMr2+Q9F1KyEIdclaamEv4R8R/+Kw6WpB6SUqpJR5MMO9FDU9MLq3S4gDoRS9OLycQiCFw== X-Received: by 2002:a17:902:bd03:b029:df:cfe6:3444 with SMTP id p3-20020a170902bd03b02900dfcfe63444mr1677681pls.24.1611427837456; Sat, 23 Jan 2021 10:50:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 08/10] accel/tcg: Declare missing cpu_loop_exit*() stubs Date: Sat, 23 Jan 2021 08:50:18 -1000 Message-Id: <20210123185020.1766324-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 cpu_loop_exit*() functions are declared in accel/tcg/cpu-exec-common.c, and are not available when TCG accelerator is not built. Add stubs so linking without TCG succeed. Problematic files: - hw/semihosting/console.c in qemu_semihosting_console_inc() - hw/ppc/spapr_hcall.c in h_confer() - hw/s390x/ipl.c in s390_ipl_reset_request() - hw/misc/mips_itu.c Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210117164813.4101761-5-f4bug@amsat.org> Signed-off-by: Richard Henderson --- accel/stubs/tcg-stub.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c index 8c18d3eabd..2304606f8e 100644 --- a/accel/stubs/tcg-stub.c +++ b/accel/stubs/tcg-stub.c @@ -28,3 +28,13 @@ void *probe_access(CPUArchState *env, target_ulong addr,= int size, /* Handled by hardware accelerator. */ g_assert_not_reached(); } + +void QEMU_NORETURN cpu_loop_exit(CPUState *cpu) +{ + g_assert_not_reached(); +} + +void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc) +{ + g_assert_not_reached(); +} --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428564; cv=none; d=zohomail.com; s=zohoarc; b=KPs7UEhG5IlxX5LC8gajMRdlJDPYNicxxeuBCa4tFZFMLYCHSOziW5tJgwN3ziouyrKjdsWp5Bl5AIDnA28/iS9uKnBvmQNLNLk2zvzwLA1VwWSdecicaiTss+cELH0q+rYXB0QDEk4vIcDs9JEQQql70IgR1FEKk24aW3ooK4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428564; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1GmBs5ay9uV9kxOX2oWB2tt33ICLoNCCnlqJiSZlo34=; b=ljjOy7FaOQkiovOQVJigxCS139Xp/E9xBHN2Z5TdIMjbsFzkw4otKVffwJrNBvWwpLoPevMA7e1OoCNnWLpjaL4FwxiF9jyepFNhOrgBBA1YZeO8SJWRBNiQb/1JCbdh7NpRy46WZNy+nqcjYE2ocqfA1TFrKMb996oPbb8T4gU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428564256705.0202019896773; Sat, 23 Jan 2021 11:02:44 -0800 (PST) Received: from localhost ([::1]:51334 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3OBH-0000CS-4N for importer@patchew.org; Sat, 23 Jan 2021 14:02:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nze-0005KA-3g for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:42 -0500 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:51249) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3Nzc-0008IA-8i for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:41 -0500 Received: by mail-pj1-x102e.google.com with SMTP id a20so2881401pjs.1 for ; Sat, 23 Jan 2021 10:50:39 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1GmBs5ay9uV9kxOX2oWB2tt33ICLoNCCnlqJiSZlo34=; b=mAKrbA0sM/NSZqoO9kIpDgE1DeEX0VdikjFGeHu0Q5vu7IGU1UUvMNm3bPf3K96t/2 d3Y+1VZpiupRtOJBWkLplblP1PbSGDq5QX8iLcjACF2+NQi5kxYqKOQ/ZIuE9uvnog0/ lwurlEne4wOZrtJK3KqHqQJ0L42y05lghOvDDRCAbUFEIGJDwfCo0FlD1VjMRRBk2ays 22wOcBT2qx4dKBPT+JwnWYz890GLz3Qsv2J4Qw32cRBi/LyqxteUP6LOLAabitEQGaeX 2cV0DxOAXwi5V7nxP8OW/myuKPTPMO7+S1eBgoCc2gq4YZZM8oPl249YN/dqUN4lbwn6 voRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1GmBs5ay9uV9kxOX2oWB2tt33ICLoNCCnlqJiSZlo34=; b=hgaGgx7LC9M8Y7gs2g3guKNWPN8LQ9mqFT8lXQT5UP2ElZAtqf1ucPJp+prhpSZyj0 hMY4gUjsQCujGh9f/ZL7SgPBhLezdw2Dh/FgkM7eiUWKcveGfLiufcVWzDkPAhe9gAO+ RnadhMl5t6MDU6k/KDU9CFXa68mYEsb515eoOWv72yV+mlX7y7vqYuVqD90I6ucr5dhX oVotbwEXGn8RTocp54Y6syGHv7gVOQQQj/JTHCpP8BIEj8Nkln/f8PfERSQyA3fVElXu uYV2CC7cxd1Yv9LGRfT5Y27DO8kKRxQfuXeVXaMiJWiAKEh9uTwLJ1kaiVcTe4YwV/zD nLvw== X-Gm-Message-State: AOAM533ZkmdvlgFGqdJDrLiy01IV1CZaRymjOdTwG489+fr0ZfWk3ElY IFj4bGyii2co8NpgwITFdCsEcUsfFnLNKA== X-Google-Smtp-Source: ABdhPJy5Fl/hKbJtt5833x5DTjkcuq9ZJnW4lHLqmxhIv5b/txBUgknxgNfcr+7We5IVCGu3VFd6fg== X-Received: by 2002:a17:90a:8b8a:: with SMTP id z10mr12690085pjn.67.1611427839006; Sat, 23 Jan 2021 10:50:39 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 09/10] accel/tcg: Restrict cpu_io_recompile() from other accelerators Date: Sat, 23 Jan 2021 08:50:19 -1000 Message-Id: <20210123185020.1766324-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Philippe Mathieu-Daud=C3=A9 As cpu_io_recompile() is only called within TCG accelerator in cputlb.c, declare it locally. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210117164813.4101761-6-f4bug@amsat.org> [rth: Adjust vs changed tb_flush_jmp_cache patch.] Signed-off-by: Richard Henderson --- accel/tcg/internal.h | 2 ++ include/exec/exec-all.h | 1 - accel/tcg/cputlb.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index 06b341fceb..e9c145e0fb 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -15,4 +15,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong= pc, target_ulong cs_base, uint32_t flags, int cflags); =20 +void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); + #endif /* ACCEL_TCG_INTERNAL_H */ diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 3acc7c2943..125000bcf7 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -63,7 +63,6 @@ void restore_state_to_opc(CPUArchState *env, TranslationB= lock *tb, bool cpu_restore_state(CPUState *cpu, uintptr_t searched_pc, bool will_exi= t); =20 void QEMU_NORETURN cpu_loop_exit_noexc(CPUState *cpu); -void QEMU_NORETURN cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); void QEMU_NORETURN cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 0fa1643ed3..7a69726ba4 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -37,6 +37,7 @@ #include "exec/translate-all.h" #include "trace/trace-root.h" #include "trace/mem.h" +#include "internal.h" #ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" #endif --=20 2.25.1 From nobody Tue Feb 10 02:01:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1611428337; cv=none; d=zohomail.com; s=zohoarc; b=GdUaoRT4CkrZfPjjCt/7zc3U01hfhq57ih0JOakvVi2A61ttqY2xoRKKh+DJeKY3K9UbGk0z0A4MXoMkADKandgA0xhhcnKgq/SQ7nouvxDpWYKnyIokPrs0rXpRyoZ4x3hokjKJ8CgaZo82CTQX+rIWbymVQN4/ziWWYTlOfk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611428337; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BKBpY0AI8UiujeeaSOJWvVpTSr3Ee4SaVnbe/ePIKI4=; b=eamEsyvLVXhYdAHVFy2Zl61NhGlsuLamFVjGajTzZN+it5+fykXG0BOB7/N+Wb8q1NnEs9Wd5VmSp3nXdlwim5FosXKYpWq2dQFn0tGcQC2l8juXOdfQxW/8oIHE9FQ2XYb0f3EQykViQ9DxAnqTaEUz6OVVCxp+L2DGQx926/4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611428337250574.0539826116059; Sat, 23 Jan 2021 10:58:57 -0800 (PST) Received: from localhost ([::1]:45816 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l3O7a-00062I-7L for importer@patchew.org; Sat, 23 Jan 2021 13:58:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l3Nzg-0005Oa-2X for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:44 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:32809) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l3Nze-0008Jg-1s for qemu-devel@nongnu.org; Sat, 23 Jan 2021 13:50:43 -0500 Received: by mail-pg1-x52c.google.com with SMTP id n25so6170319pgb.0 for ; Sat, 23 Jan 2021 10:50:41 -0800 (PST) Received: from localhost.localdomain (cpe-66-75-72-126.hawaii.res.rr.com. [66.75.72.126]) by smtp.gmail.com with ESMTPSA id j19sm5018614pfn.14.2021.01.23.10.50.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Jan 2021 10:50:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BKBpY0AI8UiujeeaSOJWvVpTSr3Ee4SaVnbe/ePIKI4=; b=GHOeh8UVkzyqaLwaYnEgPQUPmK+G5UwNzESewekrloWP5CraMnmixRR1LQP6QqPWAy tN3YdPySUb1iamstfQGvBRgp7lrgB6ED2hm6FUCx14uAT2zuuYrWFuvRynEsdhOL5h04 tKt5iqgzitHWpbIiBso4uUHwd2a4Xk9NfZix3Ub2JZJW2guWEEM7dZ3mbae8qoqqu/Kn M4LkNGspNta6tcH4dqV1dhm/3Y81yGC4JNJs0jER1nMlMvz09W/GoUp0pjCuATBg/ucQ ZPxTRwOPMZEPmTTEBO8vRznCviH12jfAJ+aoymuetf6rC1sYK5+4EWZ4LOtSKR4IHYaf MIRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BKBpY0AI8UiujeeaSOJWvVpTSr3Ee4SaVnbe/ePIKI4=; b=o3oTg+W2G9tHsTWKW59XN75lByuR401vKLP1gkDiIox07OZR9CSj5nj/SCA70qfuv/ 3TpQPslcuwA56jPN4PL+3iEOwQF670IQKAv89OvDHoFbybAO6SLC+MXklgGKkwm+i3fa Kx6F8f6FLAnbbLicc6BLm2Obd094mrnijoAB35fiUTL6YUKr9LWapLwMYzxIkZs8OCbA dFZRTSWijXEF5z9zDukbYVfhrwCrJsYlAf97nlFYdLvZ13qtL83QAEwX4SpdQBroHiar UPFt3C6y0FVXX30/d8uOrSwY/wBn41HxaokpVV18Zf4uy1yBhUByw6EPj407q44J//S8 skzg== X-Gm-Message-State: AOAM532HojyTvnfwam+w4vGw7VynT5JpAD4AQWsXq+yn1Nd+1UXH+MDT 35ZBb6kqXAJi2Nf+28SarRzmEoeGbozCMg== X-Google-Smtp-Source: ABdhPJzo5a1hZJyAi9z93HcDYQ9OsQ6FUsC7sStZLQCxlc8W8kRH2AtWxL7PuJR3qSImj1UOMGtJGA== X-Received: by 2002:a63:3549:: with SMTP id c70mr10655403pga.361.1611427840722; Sat, 23 Jan 2021 10:50:40 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 10/10] tcg: Toggle page execution for Apple Silicon Date: Sat, 23 Jan 2021 08:50:20 -1000 Message-Id: <20210123185020.1766324-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210123185020.1766324-1-richard.henderson@linaro.org> References: <20210123185020.1766324-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Roman Bolshakov , Alexander Graf Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Roman Bolshakov Pages can't be both write and executable at the same time on Apple Silicon. macOS provides public API to switch write protection [1] for JIT applications, like TCG. 1. https://developer.apple.com/documentation/apple_silicon/porting_just-in-= time_compilers_to_apple_silicon Tested-by: Alexander Graf Signed-off-by: Roman Bolshakov Message-Id: <20210113032806.18220-1-r.bolshakov@yadro.com> [rth: Inline the qemu_thread_jit_* functions; drop the MAP_JIT change for a follow-on patch.] Signed-off-by: Richard Henderson --- include/qemu/osdep.h | 28 ++++++++++++++++++++++++++++ accel/tcg/cpu-exec.c | 2 ++ accel/tcg/translate-all.c | 3 +++ tcg/tcg.c | 1 + 4 files changed, 34 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index a434382c58..b6ffdc15bf 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -119,6 +119,10 @@ extern int daemon(int, int); #include "sysemu/os-posix.h" #endif =20 +#ifdef __APPLE__ +#include +#endif + #include "glib-compat.h" #include "qemu/typedefs.h" =20 @@ -682,4 +686,28 @@ char *qemu_get_host_name(Error **errp); */ size_t qemu_get_host_physmem(void); =20 +/* + * Toggle write/execute on the pages marked MAP_JIT + * for the current thread. + */ +#if defined(MAC_OS_VERSION_11_0) && \ + MAC_OS_X_VERSION_MAX_ALLOWED >=3D MAC_OS_VERSION_11_0 +static inline void qemu_thread_jit_execute(void) +{ + if (__builtin_available(macOS 11.0, *)) { + pthread_jit_write_protect_np(true); + } +} + +static inline void qemu_thread_jit_write(void) +{ + if (__builtin_available(macOS 11.0, *)) { + pthread_jit_write_protect_np(false); + } +} +#else +static inline void qemu_thread_jit_write(void) {} +static inline void qemu_thread_jit_execute(void) {} +#endif + #endif diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 37d17c8e88..6d017e46dd 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -186,6 +186,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *= tb_exit) } #endif /* DEBUG_DISAS */ =20 + qemu_thread_jit_execute(); ret =3D tcg_qemu_tb_exec(env, tb_ptr); cpu->can_do_io =3D 1; /* @@ -410,6 +411,7 @@ static inline void tb_add_jump(TranslationBlock *tb, in= t n, { uintptr_t old; =20 + qemu_thread_jit_write(); assert(n < ARRAY_SIZE(tb->jmp_list_next)); qemu_spin_lock(&tb_next->jmp_lock); =20 diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 73fef47148..d09c187e0f 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1670,7 +1670,9 @@ static void do_tb_phys_invalidate(TranslationBlock *t= b, bool rm_from_page_list) =20 static void tb_phys_invalidate__locked(TranslationBlock *tb) { + qemu_thread_jit_write(); do_tb_phys_invalidate(tb, true); + qemu_thread_jit_execute(); } =20 /* invalidate one TB @@ -1872,6 +1874,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, #endif =20 assert_memory_lock(); + qemu_thread_jit_write(); =20 phys_pc =3D get_page_addr_code(env, pc); =20 diff --git a/tcg/tcg.c b/tcg/tcg.c index 5110f6f39c..4d734130df 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1112,6 +1112,7 @@ void tcg_prologue_init(TCGContext *s) s->pool_labels =3D NULL; #endif =20 + qemu_thread_jit_write(); /* Generate the prologue. */ tcg_target_qemu_prologue(s); =20 --=20 2.25.1