From patchwork Thu Jul 13 20:23:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 702226 Delivered-To: patch@linaro.org Received: by 2002:adf:db4e:0:b0:314:25da:8dc4 with SMTP id f14csp720363wrj; Thu, 13 Jul 2023 13:24:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlHyzK9NQl61SRsgEER2jpMGNjN8AHulscXCN0HBuYvZJkyr4SwFfwJPd7Fuhc9iWzRXVBg+ X-Received: by 2002:a67:ffc7:0:b0:445:bcd:2a05 with SMTP id w7-20020a67ffc7000000b004450bcd2a05mr1839293vsq.34.1689279887953; Thu, 13 Jul 2023 13:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689279887; cv=none; d=google.com; s=arc-20160816; b=arziQltSx3fqp7odgM3I9QeLb8KXOdHi6gmGNrMoErgkr54AEVqSLXuva9MijWluYM w+o4u9XAVpF5FC0EIdU/uwwtMzPSFSrzlSweu0qCONl3V9mzPozwDwt2dYqLqro+EwDQ NSoRgimpTHJZ5JYsbg8742dGdJ2rEcjFSaR5qBwEZZYKIyouTV1pZXKSZ0wyo0UrIPs5 Mf/EJ5nulLgrA3+Xe8jafV6JpmVlYZQ6vbfikzvp1le7P4UnDoW0RU1O+4r6knzOeYqb guFOfDq2dcvcidej9uGWyi3E7OsHsHLcPxyPUm/7suW+CGpLJCvV5M1pJZPAz9F/ivgg NABA== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=ESU/jseMQ0JI7/+Izfwhp1xSSJZvw2rvtkO0jzEFJTY=; fh=exhpOcIcC0vGFDagsg3ldbYWYFKMrGchVSllK9BlNPw=; b=qVwAQ0+uwR2R0FMnw2/GJVTdj27i4wR1q3WsAInPZ7Nu/QJ1mtQ6jdfntbnLBn0lt1 QTFrO/2/py11llgFnb8T17AhdCFUdB1QZ9w3b8UifOKqdV8TAr+ix15yeXygv+a9GwLn 2+hfo6bjKP0AHnvOa8e8UYhHELkDJ36GYPpVwBlFnu8b3rKEi/thcFPHTDwP9b+RmeV3 sIOflKplxFO3CQ02UujZxt8ffFwD6OxDAoiz6YaZqHcYuJLq7maZ7BnU0WfNXQByK3+w N5cWD9hzLpUaxardDmDddI9y4XybxCBuV0pcSHCQ3GjmF4cMDvt04N+saE18FUwLOS8w nkCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zrfiwx7V; 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 n1-20020a0c9d41000000b00635edc7414bsi2536270qvf.387.2023.07.13.13.24.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jul 2023 13:24:47 -0700 (PDT) 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=Zrfiwx7V; 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 1qK2qm-0000HC-IH; Thu, 13 Jul 2023 16:23:45 -0400 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 1qK2qf-0000GZ-1Y for qemu-devel@nongnu.org; Thu, 13 Jul 2023 16:23:37 -0400 Received: from mail-ot1-x333.google.com ([2607:f8b0:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qK2qd-0000B8-AP for qemu-devel@nongnu.org; Thu, 13 Jul 2023 16:23:36 -0400 Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-6b8decf09e1so994030a34.0 for ; Thu, 13 Jul 2023 13:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689279812; x=1691871812; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ESU/jseMQ0JI7/+Izfwhp1xSSJZvw2rvtkO0jzEFJTY=; b=Zrfiwx7VDTxHWgEtU1gXT9yfYTjBnzHozaO5T8nK1GSmITNN1X4bAdVYDchlfIuEgA qJIwR0OZ2IMbsipeXkbgqsyk/O+tJVu52oWzhF4FSWCEcKMF+CIM7Uy2KpWAf1DZHDvU 2NqeTXJXJuvXVM9puZjoKfuFm9KX7tdYvAX9KufsWTt8gtBPH0Y3GHcAiLgVJMW7ym2M E4H8bknUJGbej2vd8vGSKlU7r5inyrHzlf1cscyK04P1gurSY+FCVowxMsS/alJwB4j5 lENLSPMktEyB0KY30oY5TSPqZj9Y0c35zi2Ej6tZQYLOZTkIHvXl9nIrW2F/QGvn9ggS 8c/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689279812; x=1691871812; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ESU/jseMQ0JI7/+Izfwhp1xSSJZvw2rvtkO0jzEFJTY=; b=jwiNEctdjIltsPN0RYvAFqfFY8e88cpM9M5ghapk4j+Hobn6SAtRNacBApqj8MzHAd cucAG9+Dk0lko4C06GWeT1HrGCkLbD7e8Ai49/C7V5UKRd7YbBevmG4TuVpOuLCOCMU2 fnj5qZFmp3TK6j3JirDdg5CcFe74huGpham7hkdKfGzDem4kVwxNQ/rwWo9ZLJhjHsn9 z591qNRMXCeYY151yQubHJ2wxZUI5FuGKOn5o3dgHniioHxAhSz+glkS2DYS0vPjpkOO Lc0f32heiSu2qu283fzjjMwEs0Jzh/jwBL/NshVPyeM1Nr91bTJI98KeOSArKYMJJ2b7 uQZA== X-Gm-Message-State: ABy/qLZ6XXRb8HRtQDD8473jQSnYEDgKOpCoLMsqu50l1HnMcOXCX89h fxksBHag9Il4EqTvCzcaTMXvP/QXI+vp7Pr7km/aBw== X-Received: by 2002:a05:6830:1384:b0:6b9:3bfd:1477 with SMTP id d4-20020a056830138400b006b93bfd1477mr2657672otq.38.1689279812566; Thu, 13 Jul 2023 13:23:32 -0700 (PDT) Received: from stoup.. ([172.58.109.82]) by smtp.gmail.com with ESMTPSA id r16-20020a9d7cd0000000b006b9a98b9659sm1117918otn.19.2023.07.13.13.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 13:23:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Thomas Huth Subject: [PATCH for-8.1] tcg: Use HAVE_CMPXCHG128 instead of CONFIG_CMPXCHG128 Date: Thu, 13 Jul 2023 21:23:27 +0100 Message-Id: <20230713202327.12662-1-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::333; envelope-from=richard.henderson@linaro.org; helo=mail-ot1-x333.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, T_SCC_BODY_TEXT_LINE=-0.01 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 adjust CONFIG_ATOMIC128 and CONFIG_CMPXCHG128 with CONFIG_ATOMIC128_OPT in atomic128.h. It is difficult to tell when those changes have been applied with the ifdef we must use with CONFIG_CMPXCHG128. So instead use HAVE_CMPXCHG128, which triggers -Werror-undef when the proper header has not been included. Improves tcg_gen_atomic_cmpxchg_i128 for s390x host, which requires CONFIG_ATOMIC128_OPT. Without this we fall back to EXCP_ATOMIC to single-step 128-bit atomics, which is slow enough to cause some tests to time out. Reported-by: Thomas Huth Signed-off-by: Richard Henderson Tested-by: Thomas Huth --- Thomas, this issue does not quite match the one you bisected, but other than the cmpxchg, I don't see any see any qemu_{ld,st}_i128 being used in BootLinuxS390X.test_s390_ccw_virtio_tcg. As far as I can see, this wasn't broken by the addition of CONFIG_ATOMIC128_OPT, rather that fix didn't go far enough. Anyway, test_s390_ccw_virtio_tcg now passes in 159s on our host. r~ --- accel/tcg/tcg-runtime.h | 2 +- include/exec/helper-proto-common.h | 2 ++ accel/tcg/cputlb.c | 2 +- accel/tcg/user-exec.c | 2 +- tcg/tcg-op-ldst.c | 2 +- accel/tcg/atomic_common.c.inc | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h index 39e68007f9..186899a2c7 100644 --- a/accel/tcg/tcg-runtime.h +++ b/accel/tcg/tcg-runtime.h @@ -58,7 +58,7 @@ DEF_HELPER_FLAGS_5(atomic_cmpxchgq_be, TCG_CALL_NO_WG, DEF_HELPER_FLAGS_5(atomic_cmpxchgq_le, TCG_CALL_NO_WG, i64, env, i64, i64, i64, i32) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 DEF_HELPER_FLAGS_5(atomic_cmpxchgo_be, TCG_CALL_NO_WG, i128, env, i64, i128, i128, i32) DEF_HELPER_FLAGS_5(atomic_cmpxchgo_le, TCG_CALL_NO_WG, diff --git a/include/exec/helper-proto-common.h b/include/exec/helper-proto-common.h index 4d4b022668..8b67170a22 100644 --- a/include/exec/helper-proto-common.h +++ b/include/exec/helper-proto-common.h @@ -7,6 +7,8 @@ #ifndef HELPER_PROTO_COMMON_H #define HELPER_PROTO_COMMON_H +#include "qemu/atomic128.h" /* for HAVE_CMPXCHG128 */ + #define HELPER_H "accel/tcg/tcg-runtime.h" #include "exec/helper-proto.h.inc" #undef HELPER_H diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index c2b81ec569..e0079c9a9d 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -3105,7 +3105,7 @@ void cpu_st16_mmu(CPUArchState *env, target_ulong addr, Int128 val, #include "atomic_template.h" #endif -#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) +#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128 #define DATA_SIZE 16 #include "atomic_template.h" #endif diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index d95b875a6a..e7225e10e9 100644 --- a/accel/tcg/user-exec.c +++ b/accel/tcg/user-exec.c @@ -1385,7 +1385,7 @@ static void *atomic_mmu_lookup(CPUArchState *env, vaddr addr, MemOpIdx oi, #include "atomic_template.h" #endif -#if defined(CONFIG_ATOMIC128) || defined(CONFIG_CMPXCHG128) +#if defined(CONFIG_ATOMIC128) || HAVE_CMPXCHG128 #define DATA_SIZE 16 #include "atomic_template.h" #endif diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 0fcc1618e5..d54c305598 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -778,7 +778,7 @@ typedef void (*gen_atomic_op_i64)(TCGv_i64, TCGv_env, TCGv_i64, #else # define WITH_ATOMIC64(X) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 # define WITH_ATOMIC128(X) X, #else # define WITH_ATOMIC128(X) diff --git a/accel/tcg/atomic_common.c.inc b/accel/tcg/atomic_common.c.inc index ee222fd7e7..95a5c5ff12 100644 --- a/accel/tcg/atomic_common.c.inc +++ b/accel/tcg/atomic_common.c.inc @@ -41,7 +41,7 @@ CMPXCHG_HELPER(cmpxchgq_be, uint64_t) CMPXCHG_HELPER(cmpxchgq_le, uint64_t) #endif -#ifdef CONFIG_CMPXCHG128 +#if HAVE_CMPXCHG128 CMPXCHG_HELPER(cmpxchgo_be, Int128) CMPXCHG_HELPER(cmpxchgo_le, Int128) #endif