From nobody Sat Nov 23 22:17:30 2024 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=1728079369; cv=none; d=zohomail.com; s=zohoarc; b=Rt6gBJhTX0fedwKtWm6EEWFsLSMdfxMxwVuhHqobX1HLELc8Q2wRsbkMLAJE5xjsbxv6/5zbnBMwpBZUmkOmz39OVzgUpPVI7Wvnj+MAchaSoLmU8cFkCT0ML9IIRkC8KVg/TIPGhzvbRgyqNTNzVZxQWE47cLex3qqGhl5DvUM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728079369; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=B9aeWbyilAxD5P5/MJ59HQbUx4/6MyklNnTK3nyBp6g=; b=OJ8uQQOOvrr582ql4OsXsv5QWc2LZdkVQTL6CwSjKu535Ov+/qXllHNwbRkI0QqY6knaiMYcEijaX20OEhmZLpTF3djCmTxujmo2CfRwrESwljzXOsBYrnxHm8ng0LRHCdOf+yuqdJzPFpXpalvnNN49xoL7zgjN53jVoBOx6dE= 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) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1728079368966825.6290991128668; Fri, 4 Oct 2024 15:02:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swqMn-000501-KR; Fri, 04 Oct 2024 18:01:41 -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 1swqMj-0004z1-Ge for qemu-devel@nongnu.org; Fri, 04 Oct 2024 18:01:37 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swqMh-0000f3-S3 for qemu-devel@nongnu.org; Fri, 04 Oct 2024 18:01:37 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-20ba8d92af9so20390485ad.3 for ; Fri, 04 Oct 2024 15:01:34 -0700 (PDT) Received: from linaro.. (216-180-64-156.dyn.novuscom.net. [216.180.64.156]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20c13968ca8sm3054375ad.210.2024.10.04.15.01.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 15:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1728079294; x=1728684094; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B9aeWbyilAxD5P5/MJ59HQbUx4/6MyklNnTK3nyBp6g=; b=NIhZjziwqJSP3jHvZ9PvgZSRCf15qWrgnqBFMZljQX6QZIx3lMizBFEiiQQ7ifDl8V pUUAVgcWbRhISr9GvMt6ZHeGp1qQqX4FoV61ah2tUDACO441lEB4PZJg1b3/zsea3GyK 1QVvkUqewT0mJWVZxj2O5oN65401jJzLR92QJZeoA/G+UOi4lWVTEnSJcCDIQG7T3yy+ cHNb0EN4bktUHdLaKr6Y7lhT1zTPaGn1RRkzwYeoX+g/PqhRyXzyMwi69UwNw7mjUTb0 usajmkEyUGwxKU0BseEf8HRYSy8Kbp1Ulzny1npR6X78naGsf+4OG95fo6HDJ0XDOPQD I0tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728079294; x=1728684094; 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=B9aeWbyilAxD5P5/MJ59HQbUx4/6MyklNnTK3nyBp6g=; b=ApVNKr7CF0YkXetKrrac/9pAKZm/zrdjsknjKXSQQAro/Hj1I8zI3Y/RPnF0OjjjpY a6qyUD1L22I6xIGOlF8W+NR0mi0ISVklBkSTAFgPs+J5fa5IGFJWqzVZgtADPpTSGKs3 3bc6DAL51GU1McIce3nHn+Om/tqnmgDO0sJxaqdbz6IE0/uINrH+O5sPM7deTjnljZJH A+IO7UQ02ez4YlfQ+7U5fuhMPqCQEty5c2J2q0GpBxDVqZeg9lbI0PoGO8JF0s6LDeWd EBjKnaJPF0pyawaqA2sGkGJIvqtqqsOCttvPit4hnsrRTRJAeMYCvMM08124FW0L+yeh GfWg== X-Gm-Message-State: AOJu0YyYRq6Af0cdhrV6lew09myxTKQZSqN/qnFHD+pWaQ1zDAmJIYqC dv4dS1jtWp9/sqKkWEfGl8lPbWnOlKmvW1T+BzUN9IxY2HmGdpHfO6xVQdctXvOUR4yW+OoNnx7 h4pU= X-Google-Smtp-Source: AGHT+IE+NgML1OLUemowJJzI0gj42h4mW35RAJS5ldlXMkiO/5bLsLZzlR77enrqcI3DDeHF0jgtTg== X-Received: by 2002:a17:902:d491:b0:20c:15d:c328 with SMTP id d9443c01a7336-20c015dc480mr43687355ad.56.1728079293787; Fri, 04 Oct 2024 15:01:33 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, Paolo Bonzini , richard.henderson@linaro.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Pierrick Bouvier Subject: [PATCH] meson: ensure we enable CMPXCHG128 on x86_64 Date: Fri, 4 Oct 2024 15:01:23 -0700 Message-Id: <20241004220123.978938-1-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.5 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::62d; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1728079370520116600 Content-Type: text/plain; charset="utf-8" Alex discovered that CMPXCHG128 was not enabled when building for x86_64, resulting in slow execution for wide atomic instructions, creating a huge contention when combined with a high number of cpus (found while booting android aarch64 guest on x86_64 host). The problem is that even though we enable -mcx16 option for x86_64, this is not used when testing for CMPXCHG128. Thus, we silently turn it off. x86_64 is the only architecture adding machine flags for now, so the problem is limited to this host architecture. Meson compiler tests are supposed to be independent of environment flags (https://mesonbuild.com/Reference-manual_returned_compiler.html#returned-by= ). However, CFLAGS are used anyway, thus masking the problem when using something like CFLAGS=3D'-march=3Dnative'. This is a meson bug and was repo= rted: https://github.com/mesonbuild/meson/issues/13757 Signed-off-by: Pierrick Bouvier --- meson.build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b18c2a54ab5..af2ce595dcc 100644 --- a/meson.build +++ b/meson.build @@ -2867,6 +2867,13 @@ if has_int128_type config_host_data.set('CONFIG_ATOMIC128_OPT', has_atomic128_opt) =20 if not has_atomic128_opt + + host_flags =3D [] + if host_arch =3D=3D 'x86_64' + # for x86_64, x86_version must be >=3D 1, and we always enable cmp= xchg16 + # in this case. + host_flags +=3D ['-mcx16'] + endif config_host_data.set('CONFIG_CMPXCHG128', cc.links(''' int main(void) { @@ -2874,7 +2881,8 @@ if has_int128_type __sync_val_compare_and_swap_16(&x, y, x); return 0; } - ''')) + ''', + args: host_flags)) endif endif endif --=20 2.39.5