From patchwork Mon Nov 6 20:25:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 741459 Delivered-To: patch@linaro.org Received: by 2002:adf:fd90:0:b0:32d:baff:b0ca with SMTP id d16csp1294613wrr; Mon, 6 Nov 2023 12:27:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7z4xILncw3DrsnWNBNygfCOCKOPFD5rxzxol/5rjvrAndGs6XdLdsW9nU/O6ChtNTEJlD X-Received: by 2002:ac8:7fd6:0:b0:41e:1ee2:808b with SMTP id b22-20020ac87fd6000000b0041e1ee2808bmr28020955qtk.14.1699302423281; Mon, 06 Nov 2023 12:27:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1699302423; cv=pass; d=google.com; s=arc-20160816; b=YU/XAJ7Uj89jIzrp8x6LsjwOjWLOsli2+XsENFlWW2Te5Z3ZaI8jJeGMIhwYGR1H11 IfZHocYRliy034wE+o79uMf2qGc0zRHooJbU/MUYV+CdzJ/C8nXpYiuetIoUZNYxTMJj 6/cueWa99dsavoZLzDKmjr8lCBa3kplP90xDnqq+BnyrKvavvFR4Mps53hel0iZsQJWC CuP4TrDYUFigpqIlb+0erTyD4DmRn/nhJ/NdnNli0Am8SGRPWRsolo5tUG9E7SDhG6ra NWmmiNi/tEiHvbwR4sliqK0gOz8PqXVGRxx8p9d95YBIdFguBELYXZdvIvJKfX4rzv+p 9KkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=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:to:from :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=2Q3su/XaiyxBBj+ubGkzTsKHv5+xJU7ocP2kJ+ETc0A=; fh=+FUb54tScwW7D3lvWhZcQBi30wyNNn2DusdH7ahfqKk=; b=Kg02qra6M2XxWq+tw8Yamh8HkMYuCMdSW9S9Kr0Q9jmPCVaci03A63GZ6lm4fbyvpt 8/8zeQd7GeiktPuLYbX3kd99DIho7ZSSjiKpOHFDtQH/Um0VB26KYyyQ0BG80PW8uVF6 1WzbyRAx9zks+YdsrXe5gLnGAi5SvPJTuYIUHteTgS92+/zlKCydsfjEvTGgB6MpEy3x 2V1MbgHw+IXCg6scdSY7FwZu9jn4lrlstMMl8JL1uji/C1t5mPTy4MEeTDU5/Wy/5ghK GbhazHKSaW87N12cInzwnFIST7ijKkXJJMgj9dvcOvKjfc3ZKgKHeDW4/M4wdiACgYmm ybIQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SJY262eD; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id m13-20020a05622a054d00b003f4ecb4085bsi6128999qtx.289.2023.11.06.12.27.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:27:03 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SJY262eD; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces+patch=linaro.org@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="libc-alpha-bounces+patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D1C063857717 for ; Mon, 6 Nov 2023 20:27:02 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by sourceware.org (Postfix) with ESMTPS id A5EFF3858035 for ; Mon, 6 Nov 2023 20:26:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5EFF3858035 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A5EFF3858035 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699302380; cv=none; b=Dt5WqZu2fl6eEgyi6wocOlI4PjFyEg83ouIHnKMHMt6uqxpcaoYAQQUarV5cuAa5KysuKlZbnTQfqSXFPhaCHH8ROQ5tdB9RkEP/HSulOq3ARyJCPfWnXCdAHOH3i6ZKFjgyFH5PyQnbWBEQzvvoOJKwltow+7M04sKFJ/g5Abk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699302380; c=relaxed/simple; bh=bmMkq8kJnwnpydge3v6VN/2i1nJFj5rd7p8FLVmQs2k=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=lmPJQJQjlwWAM5AX7CpIKuCcjdkCflMEaff1jLwUA2GAb6dEcSarTL16zIma4jI5bBAppbwqNmysuCdb+A176qdmyo3amk+BTDk/cvv0niNRONoZNEVDYwObV9w7e/I6X6lmJJvn7hf9izyW7abeu6dKp3jopgIa6MvWd0MK/ag= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-5a7af20c488so59257977b3.1 for ; Mon, 06 Nov 2023 12:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699302377; x=1699907177; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=2Q3su/XaiyxBBj+ubGkzTsKHv5+xJU7ocP2kJ+ETc0A=; b=SJY262eDBwKd1IaSt3XCVekyHk7qmtSxUANUbpXcbR+kQfYKrIfHohHKF/AYg4+F86 0QyutOTygo6oDiTJJ7warnWjJYn88A6OI9yO2HIhFI4hpB/h56SPKg2fYCndMNGR3ZEO fePM4pnTUxxXtgLx7d/SW0/xVBRnTvLHVFVSKnT+3YOOk5OfkFIogqX3XspN8JX9glXZ U31Nu06nGze5zphUXCdAqDNDGfoS12tGOTkFMpR4Ku7SI43tCnhqiA9NDVTYRU9kE9uU LgPiuGw1rgfURWZFZi3ynexslqx87kLrMQcuswaaG4iXD4uGQf9JKUirDZy2hRQVk2DU g0Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699302377; x=1699907177; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Q3su/XaiyxBBj+ubGkzTsKHv5+xJU7ocP2kJ+ETc0A=; b=uQWCbCQbNQ1BkJkvxDrVcIdmE1Nno/vtevC0akAnlKYm7oPTtYtJMxnRHZ1lylwYiz IN1nzSnkG9CuiiN+SoGzd/wrMxj/EyCTPazSzLucDrzgg6+X9CZEkih9WmtyDJ1IXF4D cIsS/tSzEJmHGt2DZEJYUxcfE7UsO6yc/LTMXTJA6g16AVXKZp8dcFBHQPHHlpcTwmOV UnXGC4kPrUn3H2FYZ2kt0KTvF/YOfQsc3yxyhfPeBsvDfko5tAv7BPkgmQMR5FUkGTMS FMNAW/8I/eOO7xj5c78DB9vb/uECXgEueJsZQrQsF0OwPI9K4n5Ij/ChWPv7nUc9UpV4 KIug== X-Gm-Message-State: AOJu0YxLjElf1ygk0MAofKKnBXYfioDcgBEa25ZA/e4e7mvemYvSVifA 0GfPb/OGAt1zI4YHeEWrmapM0X+a8n2KbD9NHxmIYw== X-Received: by 2002:a81:9bc5:0:b0:591:8d06:e4e8 with SMTP id s188-20020a819bc5000000b005918d06e4e8mr10763449ywg.38.1699302377313; Mon, 06 Nov 2023 12:26:17 -0800 (PST) Received: from mandiga.. ([2804:1b3:a7c0:a715:c1a0:7281:6384:2ee9]) by smtp.gmail.com with ESMTPSA id ci7-20020a05690c0a8700b005a7b8fddfedsm4707154ywb.41.2023.11.06.12.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 12:26:16 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Siddhesh Poyarekar Subject: [PATCH v3 10/19] s390: Use dl-symbol-redir-ifunc.h on cpu-tunables Date: Mon, 6 Nov 2023 17:25:43 -0300 Message-Id: <20231106202552.3404059-11-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106202552.3404059-1-adhemerval.zanella@linaro.org> References: <20231106202552.3404059-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patch=linaro.org@sourceware.org Using the memcmp symbol directly allows the compile to inline the memcmp calls (especially because _dl_tunable_set_hwcaps uses constants values), generating better code. Checked with tst-tunables on s390x-linux-gnu (qemu system). Reviewed-by: Siddhesh Poyarekar --- sysdeps/s390/cpu-features.c | 30 +++++++++---------- .../s390/multiarch/dl-symbol-redir-ifunc.h | 2 ++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sysdeps/s390/cpu-features.c b/sysdeps/s390/cpu-features.c index 39f8c23a60..55449ba07f 100644 --- a/sysdeps/s390/cpu-features.c +++ b/sysdeps/s390/cpu-features.c @@ -21,7 +21,7 @@ #include #include #include -extern __typeof (memcmp) MEMCMP_DEFAULT; +#include #define S390_COPY_CPU_FEATURES(SRC_PTR, DEST_PTR) \ (DEST_PTR)->hwcap = (SRC_PTR)->hwcap; \ @@ -89,9 +89,9 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) if ((*feature == 'z' || *feature == 'a')) { if ((feature_len == 5 && *feature == 'z' - && MEMCMP_DEFAULT (feature, "zEC12", 5) == 0) + && memcmp (feature, "zEC12", 5) == 0) || (feature_len == 6 && *feature == 'a' - && MEMCMP_DEFAULT (feature, "arch10", 6) == 0)) + && memcmp (feature, "arch10", 6) == 0)) { reset_features = true; disable = true; @@ -100,9 +100,9 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3; } else if ((feature_len == 3 && *feature == 'z' - && MEMCMP_DEFAULT (feature, "z13", 3) == 0) + && memcmp (feature, "z13", 3) == 0) || (feature_len == 6 && *feature == 'a' - && MEMCMP_DEFAULT (feature, "arch11", 6) == 0)) + && memcmp (feature, "arch11", 6) == 0)) { reset_features = true; disable = true; @@ -110,9 +110,9 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3; } else if ((feature_len == 3 && *feature == 'z' - && MEMCMP_DEFAULT (feature, "z14", 3) == 0) + && memcmp (feature, "z14", 3) == 0) || (feature_len == 6 && *feature == 'a' - && MEMCMP_DEFAULT (feature, "arch12", 6) == 0)) + && memcmp (feature, "arch12", 6) == 0)) { reset_features = true; disable = true; @@ -120,11 +120,11 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3; } else if ((feature_len == 3 && *feature == 'z' - && (MEMCMP_DEFAULT (feature, "z15", 3) == 0 - || MEMCMP_DEFAULT (feature, "z16", 3) == 0)) + && (memcmp (feature, "z15", 3) == 0 + || memcmp (feature, "z16", 3) == 0)) || (feature_len == 6 - && (MEMCMP_DEFAULT (feature, "arch13", 6) == 0 - || MEMCMP_DEFAULT (feature, "arch14", 6) == 0))) + && (memcmp (feature, "arch13", 6) == 0 + || memcmp (feature, "arch14", 6) == 0))) { /* For z15 or newer we don't have to disable something, but we have to reset to the original values. */ @@ -134,14 +134,14 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) else if (*feature == 'H') { if (feature_len == 15 - && MEMCMP_DEFAULT (feature, "HWCAP_S390_VXRS", 15) == 0) + && memcmp (feature, "HWCAP_S390_VXRS", 15) == 0) { hwcap_mask = HWCAP_S390_VXRS; if (disable) hwcap_mask |= HWCAP_S390_VXRS_EXT | HWCAP_S390_VXRS_EXT2; } else if (feature_len == 19 - && MEMCMP_DEFAULT (feature, "HWCAP_S390_VXRS_EXT", 19) == 0) + && memcmp (feature, "HWCAP_S390_VXRS_EXT", 19) == 0) { hwcap_mask = HWCAP_S390_VXRS_EXT; if (disable) @@ -150,7 +150,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) hwcap_mask |= HWCAP_S390_VXRS; } else if (feature_len == 20 - && MEMCMP_DEFAULT (feature, "HWCAP_S390_VXRS_EXT2", 20) == 0) + && memcmp (feature, "HWCAP_S390_VXRS_EXT2", 20) == 0) { hwcap_mask = HWCAP_S390_VXRS_EXT2; if (!disable) @@ -160,7 +160,7 @@ TUNABLE_CALLBACK (set_hwcaps) (tunable_val_t *valp) else if (*feature == 'S') { if (feature_len == 10 - && MEMCMP_DEFAULT (feature, "STFLE_MIE3", 10) == 0) + && memcmp (feature, "STFLE_MIE3", 10) == 0) { stfle_bits0_mask = S390_STFLE_MASK_ARCH13_MIE3; } diff --git a/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h b/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h index aa084fdcde..0f58897c48 100644 --- a/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h +++ b/sysdeps/s390/multiarch/dl-symbol-redir-ifunc.h @@ -20,10 +20,12 @@ #define _DL_IFUNC_GENERIC_H #include +#include #define IFUNC_SYMBOL_STR1(s) #s #define IFUNC_SYMBOL_STR(s) IFUNC_SYMBOL_STR1(s) asm ("memset = " IFUNC_SYMBOL_STR(MEMSET_DEFAULT)); +asm ("memcmp = " IFUNC_SYMBOL_STR(MEMCMP_DEFAULT)); #endif