From patchwork Fri Jun 14 18:01:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1948107 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=WjjdbisU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W16Z21wFtz20X9 for ; Sat, 15 Jun 2024 04:02:34 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 85B1B388211C for ; Fri, 14 Jun 2024 18:02:32 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id 38C50388217C for ; Fri, 14 Jun 2024 18:02:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 38C50388217C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 38C50388217C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::f2a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718388127; cv=none; b=U1Q9EzyKLORG7rZ7DixOuf/l04eFoSMe5J9rryC8z6TQe8k3zLdFP+S8yKwmYXWjYOzg35fW1X8IY8NzRgzR0UWwPCglzWsybb6HNkTaGjhdXCgKDnDUd/XQmSfOwYWTWYMZHT44ruccKtlx0vq8+iS+uJLCdtjBcXNeLELcaj0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718388127; c=relaxed/simple; bh=q/V9ZgWtYd+vPT+vy7taE1s2fkwGLtb4VF1+6EWsi8k=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ds+2P6RBO0OHAMGVt9ABXxPQrKEjzRRuRuEQlWtcg6R2DlkBcmYuKkG257/FsdHl45ASg8zoSi151MYDPScLb0xn/Cd/QsDQEr6rC2Y+6qc9/N2M63IMcXS85ZoBxym5Z8WvtQ8hsjwiPVM9HaQfT7BMzUyGZJms/pOvCpbplpw= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-qv1-xf2a.google.com with SMTP id 6a1803df08f44-6ad8243dba8so11712306d6.3 for ; Fri, 14 Jun 2024 11:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718388124; x=1718992924; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=DoHFRcvgaHFkvjDUtJH75FCh4v1UeVJo1PwHNyB7r/8=; b=WjjdbisUjvwhVqNy9kyJgt+tnxXb/3tXSz7jfE8CJMNzjf2ItXpFpSgvbAZJTL+rs/ sAWUM3YH/Vz8ttveAmkr7+ce7WHq+uwPG2nVc+BvCnhuQdLcBPZjq95fiFKdhtJH/Dgx 3/3ovFRje8DpFkEk71r5d04JK4AjyWKL6QTHIvfYSsfjlfBvfhlKsswlgwQ4wXIGW95y 9PGtvDdDndbxO8NhjQNdjNrBA4RTlY9O6cTITy3Z166q/tXg0MfL41dJdzWPh3GpzDml RpdAjI1IoBBsCq2nQ9yNNLLviYf/15aKlZkZhy9ZTVz5OQX0dMR1ihp+1+oBWa28nlaU odbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718388124; x=1718992924; 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=DoHFRcvgaHFkvjDUtJH75FCh4v1UeVJo1PwHNyB7r/8=; b=OY64Imw7Y3ChJFWNcLWuAD/fKOuazsPZ47ezyE9jPoX+sb3G7oh4oRoYlyeQFbkODe IeNFVSnaTvoAkmUpudkfb/SB6AEZuJUe35SQe454WJFICpW9a4JA1mHnOE3Xr2I1thap yvHoHuyC4CnGLQZvmQlDB3NHrJqfE9X+clS9iEvBWM/+OyFbFQcFl1J4Au0i+jsUarr+ XRSPVyH3cMLkNLb6bskRi15RN04nfI9RMxaPfIxSyZeMFQGP8wyNTEGz9KH/guZJOKTc M6tqkSCYdXzZssy1PSfgCHP2L/ptzL0JnCsYPAWPvY+wfb+tcVxHdUGudfcjvMyVMtKt C0qg== X-Gm-Message-State: AOJu0YxQvJBLfUJTjqc93EKwQJZZGKO92WC+V/RvBezyQzFynM4WK5FY schVuds6yTG5rXeTetNwAGZfpBF6Z7d/FZMC6BlkYe5P4rqncZJzz3KieQ== X-Google-Smtp-Source: AGHT+IElVVFGN3OcQoqV1tKVmGyWpQigRocYzS8h8aXIwGG+AetvzfEp2gzM9BsoOsB1aUHgP+EzRQ== X-Received: by 2002:ad4:5190:0:b0:6b0:63fa:c42 with SMTP id 6a1803df08f44-6b2afca624cmr32299866d6.26.1718388124211; Fri, 14 Jun 2024 11:02:04 -0700 (PDT) Received: from noahgold-desk.sc.intel.com ([192.55.55.44]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b2a5c10e56sm20851206d6.35.2024.06.14.11.02.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 11:02:03 -0700 (PDT) From: Noah Goldstein To: libc-alpha@sourceware.org Cc: bp@alien8.de, goldstein.w.n@gmail.com, hjl.tools@gmail.com Subject: [PATCH v1] x86: Fix value for `x86_memset_non_temporal_threshold` when it is undesirable Date: Fri, 14 Jun 2024 13:01:58 -0500 Message-Id: <20240614180158.4084300-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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+incoming=patchwork.ozlabs.org@sourceware.org When we don't want to use non-temporal stores for memset, we set `x86_memset_non_temporal_threshold` to SIZE_MAX. The current code, however, we using `maximum_non_temporal_threshold` as the upper bound which is `SIZE_MAX >> 4` so we ended up with a value of `0`. Fix is to just use `SIZE_MAX` as the upper bound for when setting the tunable. Tested-by: Borislav Petkov (AMD) Reviewed-by: H.J. Lu --- sysdeps/x86/dl-cacheinfo.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h index d2fe61b997..3a6ec4ef9f 100644 --- a/sysdeps/x86/dl-cacheinfo.h +++ b/sysdeps/x86/dl-cacheinfo.h @@ -1044,9 +1044,9 @@ dl_init_cacheinfo (struct cpu_features *cpu_features) TUNABLE_SET_WITH_BOUNDS (x86_non_temporal_threshold, non_temporal_threshold, minimum_non_temporal_threshold, maximum_non_temporal_threshold); - TUNABLE_SET_WITH_BOUNDS ( - x86_memset_non_temporal_threshold, memset_non_temporal_threshold, - minimum_non_temporal_threshold, maximum_non_temporal_threshold); + TUNABLE_SET_WITH_BOUNDS (x86_memset_non_temporal_threshold, + memset_non_temporal_threshold, + minimum_non_temporal_threshold, SIZE_MAX); TUNABLE_SET_WITH_BOUNDS (x86_rep_movsb_threshold, rep_movsb_threshold, minimum_rep_movsb_threshold, SIZE_MAX); TUNABLE_SET_WITH_BOUNDS (x86_rep_stosb_threshold, rep_stosb_threshold, 1,