From patchwork Mon Mar 6 01:57:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 659225 Delivered-To: patch@linaro.org Received: by 2002:adf:a3c6:0:0:0:0:0 with SMTP id m6csp1593980wrb; Sun, 5 Mar 2023 17:58:49 -0800 (PST) X-Google-Smtp-Source: AK7set+JnAwEMf4hWj1KK+nzZlxQtkn0Zu7AyOBP8d9CjTUQpwHdgXIMJZ5gnT+cUEyHwJvEwcwt X-Received: by 2002:a05:622a:488:b0:3b8:6bab:1e4d with SMTP id p8-20020a05622a048800b003b86bab1e4dmr15845431qtx.51.1678067929759; Sun, 05 Mar 2023 17:58:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678067929; cv=none; d=google.com; s=arc-20160816; b=fKnG2h8B7lLuZUIToeWw7uoF03frP45KmnnlINHWaJIKMT2gD/vHDkNSasSdOd9O5h iAqzv0k9nBYR9bRvjfzVD86198q61lKymXcqxxyVTe5tqhnhMpEzCsDzPYNPKDpDNgQN 7MNFvBVH+mwKWx6yorPbcGzQ9qDHfYPHMgeZPIuZ5aGHME2XzJ7gKNwFDw08Ipu6imPj h0HFD4+Yuq3eH14T+ueV5lOv27jCNY9ZbiobGGZQNVrAqSc1eyQBF9Jke9kgHRTpmf2l 5kNWXLY0Qje30bOdCsQwj3HDQO5RJYFezR85QFaD3KW+qwkc7p1MENEft4XrIzOLMSfR 9HcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=E6K0A7+gP/89i/KNPQ80KDpl9+S1ffSQBzdgEVtW8JI=; b=llk/EqIjb6zzhU2uqO/ltRUenbzmoFtJ1Co23CxJ2fUPmZ/2FLaOKs433t9xaHvvRR uWbvXqifFO8SiWvb3NnQEx5n8rXHG3Ku3k13HO2vYqh4G7cmKMpoj0fEKZrl0/22AA2j tEHZ3m8SVqYNKjLGxDsmKr6OeJ1ESPDG3Q4/A2af7vKbGZlHdNACYcTZxiwtmr9W1Zsy nkETeouHRu/EdGaaGZwWWp8uKM1z0/L8AAeXO73cj0VwY/olRcrQnSPLPbzvJ0oijGMc iX40SCf6BoUqf8lHOHLscEUluJxQFBrbTtHXp2V04NVC1MVQS9dI3Qdsi4uLmrrrhANX a7lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e6RWv3Nq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o9-20020ac87c49000000b003b344fc80cdsi6815005qtv.269.2023.03.05.17.58.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 05 Mar 2023 17:58:49 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e6RWv3Nq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pZ06M-00049E-8s; Sun, 05 Mar 2023 20:57:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pZ06I-00048E-Qd for qemu-devel@nongnu.org; Sun, 05 Mar 2023 20:57:21 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pZ06H-0003J0-6V for qemu-devel@nongnu.org; Sun, 05 Mar 2023 20:57:18 -0500 Received: by mail-pj1-x1034.google.com with SMTP id m20-20020a17090ab79400b00239d8e182efso11666698pjr.5 for ; Sun, 05 Mar 2023 17:57:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678067835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E6K0A7+gP/89i/KNPQ80KDpl9+S1ffSQBzdgEVtW8JI=; b=e6RWv3NqSAhyAeDfi8dKnE7WtFnz1kS9U2xxHD8ZATNBf1piM8vfdR9dJ7ptdK9fMT TTxdke6cdlqhZZExygK0gg+Y4p+Qbi5YY4Ml6UcX1fooREdpGlYPjL6GjgZ2IQYfmkot +4DAb0BzskOsID+fm7vJv3qyqg6/llK83BnKFLHAuMwU0ZzKVmH0nlBawc/dPqfyglWf 6KxgLDLAzvAoioJC06hQ8wjBZJAoPUZPhkmR3R/c/0kUjv/BrqQZ6R6BLjRVNlkYZlCP zPXagO1gq11es5j80Q5E1wE0Z7G0h30Pp+I5JWuvvUAMcI8AAFWUn+jpJZRowBBp0Bvy cMow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678067835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E6K0A7+gP/89i/KNPQ80KDpl9+S1ffSQBzdgEVtW8JI=; b=dj33N4sJhaSIwIKaddOs/x9O+1qgz72WIoCfmmJ7VJHuPQqxfSOCZ4zDB0Wz4X+vvR 1BhiwHn3oNmpX/4u9ygWUAu1sUy1OFq1IjycFzySGjm1H12w7W0/d6p1DClcvmFcH17b 2gkv8F9RAXPUwvdoYtsU9N07tTLgqfYg+ai9CNdPNDVjWhyHJWUeDoD6TMBUIhIMcVzq DT3Hv+sgLLsZCH0XWOLq1s7XqixQPcfmfsWPUxXllBohUg/YU1eQfz3AyGWuGivmxjxm FVxr25gSA7dyc3xxXyWfjomjp+6y6eI2uSq1IVMOKNZxySJdWmymHW6JoB066YjeJNHo E6iA== X-Gm-Message-State: AO0yUKUrK9uayfhAddZRNlFRjUF7MfjbgPpcMrUFdTGsJTI2LzyH0/HR StfloFiPTj6EgUlVbucfP09vyXah/KYex5YIY9zQLw== X-Received: by 2002:a05:6a20:12d4:b0:cc:beae:c2c2 with SMTP id v20-20020a056a2012d400b000ccbeaec2c2mr10998055pzg.1.1678067835676; Sun, 05 Mar 2023 17:57:15 -0800 (PST) Received: from stoup.. ([2602:ae:154a:9f01:87cc:49bb:2900:c08b]) by smtp.gmail.com with ESMTPSA id g23-20020aa78197000000b0061949fe3beasm2921056pfi.22.2023.03.05.17.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Mar 2023 17:57:15 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Subject: [PATCH v2 5/5] accel/tcg: Remove check_tcg_memory_orders_compatible Date: Sun, 5 Mar 2023 17:57:10 -0800 Message-Id: <20230306015710.1868853-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230306015710.1868853-1-richard.henderson@linaro.org> References: <20230306015710.1868853-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We now issue host memory barriers to match the guest memory order. Continue to disable MTTCG only if the guest has not been ported. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/tcg-all.c | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 604efd1b18..f6b44548cc 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -61,33 +61,20 @@ DECLARE_INSTANCE_CHECKER(TCGState, TCG_STATE, * they can set the appropriate CONFIG flags in ${target}-softmmu.mak * * Once a guest architecture has been converted to the new primitives - * there are two remaining limitations to check. - * - * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) - * - The host must have a stronger memory order than the guest - * - * It may be possible in future to support strong guests on weak hosts - * but that will require tagging all load/stores in a guest with their - * implicit memory order requirements which would likely slow things - * down a lot. + * there is one remaining limitation to check: + * - The guest can't be oversized (e.g. 64 bit guest on 32 bit host) */ -static bool check_tcg_memory_orders_compatible(void) -{ - return tcg_req_mo(TCG_MO_ALL) == 0; -} - static bool default_mttcg_enabled(void) { if (icount_enabled() || TCG_OVERSIZED_GUEST) { return false; - } else { -#ifdef TARGET_SUPPORTS_MTTCG - return check_tcg_memory_orders_compatible(); -#else - return false; -#endif } +#if defined(TARGET_SUPPORTS_MTTCG) && defined(TCG_GUEST_DEFAULT_MO) + return true; +#else + return false; +#endif } static void tcg_accel_instance_init(Object *obj) @@ -150,15 +137,10 @@ static void tcg_set_thread(Object *obj, const char *value, Error **errp) } else if (icount_enabled()) { error_setg(errp, "No MTTCG when icount is enabled"); } else { -#ifndef TARGET_SUPPORTS_MTTCG +#if !(defined(TARGET_SUPPORTS_MTTCG) && defined(TCG_GUEST_DEFAULT_MO)) warn_report("Guest not yet converted to MTTCG - " "you may get unexpected results"); #endif - if (!check_tcg_memory_orders_compatible()) { - warn_report("Guest expects a stronger memory ordering " - "than the host provides"); - error_printf("This may cause strange/hard to debug errors\n"); - } s->mttcg_enabled = true; } } else if (strcmp(value, "single") == 0) {