From patchwork Tue Oct 10 18:01:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 77435 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED633388459C for ; Tue, 10 Oct 2023 18:02:53 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 165E53853D36 for ; Tue, 10 Oct 2023 18:01:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 165E53853D36 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1c5ff5f858dso40634295ad.2 for ; Tue, 10 Oct 2023 11:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696960899; x=1697565699; 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=VoCK1LAADQnt8DI3M3Qwv7Oygt25rzGLf4EPWcuDe8I=; b=zDdq6bICqrrHxlUSmJ789j3p6wl8+9q01gzkx9aasmlvEqxoLWCjiwqNbUIhXfL2CR l2yxgt6y8wJf6OLYM/3tAWonqHBPq8mWxhx6aTDH2he/lTeyNB45e+UoVygLCfMpUqV8 OUM8Q6KqVMEgEuN4I5y7TLEO0UtfKitg5aNWwSfUccqCT8GHCZRQT66Das+BWOs5zutK 1f+S53oHdNOhCBfLiPwmE2x43TrSBO/enwZp+EPPiWUVgC3tyOFMCiEmaKIiK+wOUZx8 dJcXu1qcqvBNn9VUpaEukO1YBRrUXLd6rAGBJwhqlIYMpH716sD8h2MUNv7kWrsDf+Au tFlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696960899; x=1697565699; 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=VoCK1LAADQnt8DI3M3Qwv7Oygt25rzGLf4EPWcuDe8I=; b=CQXJsR4ojtvCl/8/KgeMAXiB0nY0Ega18eI20O/1Ht9BXm/Q3X/QQSBOyTFv8K2c0T 3OGgh5u9Kuxh72CJVnN/OYuV6hCGPRtqEhrzBd0btRQ+LhLC3/aYh70iEQRH/LBSNm/a iaxv7gPmRT50o9hLaLGxj3Iv6wbTfhyrzKUvTNTU2LRH4kfEg/YaRM+G1sOo1G3ukajK ZMQtViPaGDxE6j2qoijh/eGSPmj1wMRdnlkxXl5nFbzGvVfRoWXk6KlqHd8uuEhPiz8Y aQUshUqhBh86v7G4eNGxDbIgKoZCgsxYQFhucY/0eGT13JLT6UnNvIH3+SaWLpHyvdg6 fUCw== X-Gm-Message-State: AOJu0Yw6y+EdewBEcKli+8sG3UTfVveiUtzGJTgNoJ+1KgMySmt9PEr2 vIHztxKJJbqpe4/VImiXLwEuM5M/OV67JlMFvucB1Q== X-Google-Smtp-Source: AGHT+IHrqnwgnsckouW6EkSt1E9O66pigOSq8QVn+BwMb4b9blWOEo+sx3CDza9x71Fe96LdaGqKpA== X-Received: by 2002:a17:902:ec85:b0:1c4:749e:e725 with SMTP id x5-20020a170902ec8500b001c4749ee725mr18604669plg.0.1696960899558; Tue, 10 Oct 2023 11:01:39 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:d09b:ef2e:7c42:5ecf:a4ef]) by smtp.gmail.com with ESMTPSA id 5-20020a170902c24500b001bb9d6b1baasm12088022plg.198.2023.10.10.11.01.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 11:01:37 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org, Siddhesh Poyarekar Subject: [PATCH 10/11] s390: Use dl-symbol-redir-ifunc.h on cpu-tunables Date: Tue, 10 Oct 2023 15:01:10 -0300 Message-Id: <20231010180111.561793-11-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010180111.561793-1-adhemerval.zanella@linaro.org> References: <20231010180111.561793-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.9 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 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+patchwork=sourceware.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). --- 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