From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by sourceware.org (Postfix) with ESMTPS id 47D3E3888C45 for ; Mon, 5 Jun 2023 17:15:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47D3E3888C45 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-19f45faedfbso4311607fac.0 for ; Mon, 05 Jun 2023 10:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685985300; x=1688577300; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hoUL9yhadn19t+MWxQI5gRxuywqihyQYlZlRp9ZQy+A=; b=ig8FbzKAUBuxbcbBrQ0oNek8lQxKqvUwhyaW7oRVfy/5BaLjUZ5ijBglFGlBZNeTve qz9HR9q8xK/js/cjHOEENpENs4XvT0zAEe5Rd8/OQwt9Yfsn3XrD2MIYPOxPIzVjL3JB SmSHGGy7xwrZvXiyzC88CXJpS7EAvS4uTWAoCp+VWHdiG7kshUsDSI4pGswwSmBB44wS EXJ2MdveituhJOAHqGbtBKDJQrMZ36Fa3eXSZim3nB5x2ZgQH3GruEicT6lSnGB+BAwN TjGjhpsTzB2PwkF94MdBOLSDMQ5GmtTOBxY0pYegERJS0o8dJsPHYdD78tZnCqZvmWxf gcvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685985300; x=1688577300; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hoUL9yhadn19t+MWxQI5gRxuywqihyQYlZlRp9ZQy+A=; b=KIeYqFmsgUuGfqYnz74thxXZKrfQmiZ5CGSfFvow+Q7Fj4S4Ic/ArPSEKYFq6eezJx t2cYS0bPjQycAhfXdxQrdel4wexcAi5k9z/Ak/IJmDkz2f2jxHmjSAOXa6Jl39IUp3HG wHnDpIcDpecl7Rx46aYAmDkbU1qt8sojKBAAm3tWbdrv44jgLCf1uAMKMNCbsv3/9INF iOkDoaHWk6MDGD33k5w6pd/O6bqKEJTOI/4TZjN+VoHZTWqkBeZ4XytmdwwEEKsjM6Fi u9/JSzcqdcAPw8LJdDy+7Qq0oiHN3jftlwN1dVtX8R09k1H2DxLq8w2UiV9Xw8VKnx2X XpQQ== X-Gm-Message-State: AC+VfDxw8JZmL8gS6ROXrD74Ty5zc04ixU/M3UORqhizXxKx0wtkS0Xe kiCQ+QUCLSqbjlNVkUXJ76vETrWK4lfkuQByKI24dTIu X-Google-Smtp-Source: ACHHUZ5cgbFW1rs4SmANrUbvfnkTJqf1v68Hzf0GHLcTK/uv7txKn4RVdWm5rmFzDZfKjikeD/zdpjxlaSos+dKO0HU= X-Received: by 2002:a05:6870:a341:b0:19e:ade4:92ee with SMTP id y1-20020a056870a34100b0019eade492eemr362477oak.8.1685985300170; Mon, 05 Jun 2023 10:15:00 -0700 (PDT) MIME-Version: 1.0 References: <20230509031020.3496291-1-goldstein.w.n@gmail.com> In-Reply-To: <20230509031020.3496291-1-goldstein.w.n@gmail.com> From: Noah Goldstein Date: Mon, 5 Jun 2023 12:14:47 -0500 Message-ID: Subject: Re: [PATCH v1] x86: Use 64MB as nt-store threshold if no cacheinfo [BZ #30429] To: libc-alpha@sourceware.org Cc: hjl.tools@gmail.com, carlos@systemhalted.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.8 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,RCVD_IN_SBL_CSS,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 List-Id: On Mon, May 8, 2023 at 10:10=E2=80=AFPM Noah Goldstein wrote: > > If `non_temporal_threshold` is below `minimum_non_temporal_threshold`, > it almost certainly means we failed to read the systems cache info. > > In this case, rather than defaulting the minimum correct value, we > should default to a value that gets at least reasonable > performance. 64MB is chosen conservatively to be at the very high > end. This should never cause non-temporal stores when, if we had read > cache info, we wouldn't have otherwise. > --- > sysdeps/x86/dl-cacheinfo.h | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h > index 864b00a521..6225c852f6 100644 > --- a/sysdeps/x86/dl-cacheinfo.h > +++ b/sysdeps/x86/dl-cacheinfo.h > @@ -771,8 +771,16 @@ dl_init_cacheinfo (struct cpu_features *cpu_features= ) > reflected in the manual. */ > unsigned long int maximum_non_temporal_threshold =3D SIZE_MAX >> 4; > unsigned long int minimum_non_temporal_threshold =3D 0x4040; > + > + /* If `non_temporal_threshold` less than `minimum_non_temporal_thresho= ld` > + it most likely means we failed to detect the cache info. We don't w= ant > + to default to `minimum_non_temporal_threshold` as such a small valu= e, > + while correct, has bad performance. We default to 64MB as reasonabl= e > + default bound. 64MB is likely conservative in that most/all systems= would > + choose a lower value so it should never forcing non-temporal stores= when > + they otherwise wouldn't be used. */ > if (non_temporal_threshold < minimum_non_temporal_threshold) > - non_temporal_threshold =3D minimum_non_temporal_threshold; > + non_temporal_threshold =3D 64 * 1024 * 1024; > else if (non_temporal_threshold > maximum_non_temporal_threshold) > non_temporal_threshold =3D maximum_non_temporal_threshold; > > -- > 2.34.1 > I want to backport down to 2.28. Thoughts?