Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2233383/?format=api
{ "id": 2233383, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2233383/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/patch/20260506053801.3433002-1-zombie12139@gmail.com/", "project": { "id": 41, "url": "http://patchwork.ozlabs.org/api/1.1/projects/41/?format=api", "name": "GNU C Library", "link_name": "glibc", "list_id": "libc-alpha.sourceware.org", "list_email": "libc-alpha@sourceware.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260506053801.3433002-1-zombie12139@gmail.com>", "date": "2026-05-06T05:38:01", "name": "x86: Fix non-temporal memset unreachable on AMD Zen 3/4/5", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "efd71329f66952136a4cc019d3a92e5df43dea81", "submitter": { "id": 93341, "url": "http://patchwork.ozlabs.org/api/1.1/people/93341/?format=api", "name": "zombie12138", "email": "zombie12139@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/glibc/patch/20260506053801.3433002-1-zombie12139@gmail.com/mbox/", "series": [ { "id": 502958, "url": "http://patchwork.ozlabs.org/api/1.1/series/502958/?format=api", "web_url": "http://patchwork.ozlabs.org/project/glibc/list/?series=502958", "date": "2026-05-06T05:38:01", "name": "x86: Fix non-temporal memset unreachable on AMD Zen 3/4/5", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/502958/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2233383/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2233383/checks/", "tags": {}, "headers": { "Return-Path": "<libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "libc-alpha@sourceware.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "libc-alpha@sourceware.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Ds0/ILgV;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=Ds0/ILgV", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "sourceware.org;\n arc=none smtp.remote-ip=2607:f8b0:4864:20::529" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g9WvB2f86z1y04\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 06 May 2026 20:33:42 +1000 (AEST)", "from vm01.sourceware.org (localhost [IPv6:::1])\n\tby sourceware.org (Postfix) with ESMTP id 4EF594BA799F\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 6 May 2026 10:33:40 +0000 (GMT)", "from mail-pg1-x529.google.com (mail-pg1-x529.google.com\n [IPv6:2607:f8b0:4864:20::529])\n by sourceware.org (Postfix) with ESMTPS id 26DA74BA2E06\n for <libc-alpha@sourceware.org>; Wed, 6 May 2026 05:38:21 +0000 (GMT)", "by mail-pg1-x529.google.com with SMTP id\n 41be03b00d2f7-c795f441ff7so4051240a12.2\n for <libc-alpha@sourceware.org>; Tue, 05 May 2026 22:38:21 -0700 (PDT)", "from Beoluska.lan ([183.195.111.48])\n by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2ba7ca3bff3sm10815325ad.84.2026.05.05.22.38.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 05 May 2026 22:38:18 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 4EF594BA799F", "OpenDKIM Filter v2.11.0 sourceware.org 26DA74BA2E06" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 26DA74BA2E06", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 26DA74BA2E06", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1778045901; cv=none;\n b=nU5q6vZJdAgJn5P10LdLvshRXuHGyNJ0QkA1rRovGQH+l2Xg07cnx/sNJXuPVv5TcE+9FrE2G4S2WDw9DGOZ27vnd50rQnYmn3Wj/1TW2n0UVlitX4r035JZYtelMhkDnNkd3QP+o7rLlpWVUHo/PghGBtD0sBp1OeFUQdQA9OI=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1778045901; c=relaxed/simple;\n bh=0pPnA6X2Qlbmyqtf3pq7urucH/8P1ikXmcOlFXgVTRU=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=Yrr2idjORf+O946jCTX4KZ5jFfBOPveSIaHayXcL2GI/cG5sg3rLZHlo7qB/7kZT/Jfya/3A5k1uV6Sm+s59Fn2+Oqmo6c4V6ds9sQjYlCj28Sz8OTch/D8VQ9wE0ndUN1sLHdOe3gRJq4vl+45wLH5RAq5Aq7T1oQqJaCe8KaE=", "ARC-Authentication-Results": "i=1; sourceware.org;\n dkim=pass (2048-bit key, unprotected)\n header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104\n header.b=Ds0/ILgV", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1778045900; x=1778650700; darn=sourceware.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=b5Ghapv8KLpjnhIJs4wlN7AD9jIrksVsvde/F0N2bio=;\n b=Ds0/ILgV5Dw9yANm4s4PJ3uIrsT5m3k2gTjstSG4xO0bYbVOFibfBj4EJUrFOTX1e2\n eHBovj0Ub9oISy48nNyzXt7Y7S3vhUQB0H30llMHqco0ZKkVlIZb2ih9El9JmjajXU+d\n i8aPXDBX7x5Sk6jbKF7QvItSoTtsZT6vm/bhO0qIoLUlohbMTsi84LIEaQm4kplLYp+R\n DPo3OMvfa5YAVdp3WdAfHZHhfuTgNPFL1M4ZN96Ptz8ySaXhrv8v/2XM9QrYgbL+Ljp+\n RxXU+Bgee9b/G+7vLoHf/ai60iOMHX5vSU4M3vaULuYJzpg4VJ58m4HvBatjJz4JX6Az\n muBA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1778045900; x=1778650700;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=b5Ghapv8KLpjnhIJs4wlN7AD9jIrksVsvde/F0N2bio=;\n b=Drd3t8pnRYlOab2rELUzZvqbf32n37DoOboSccohke3aS1QBvpxDpJlLTGbc/1lY9n\n j5Ht4lvTAHkd/ldnwrLGudiUaVEAQfMa5E21JZ6kGBYSIvhZhi5rJt+vVfpnQQvCCprl\n guxVSD/EGn0rKX630s6cBb/jzvEkaUNWmvuvNB3UW0Vo0VesuHUhmjUcY9Ay2n01/yGy\n kzLwE4Mwdxl7DWolVLVBKQdsMYWTS2diR0rM9TvlyYQYJGFpYYiuN8JC+zbAWnq/yo4g\n MsyiJcRDER3wDn2Awf86a1bIbK4uLG3GnvP5cF7SBfwRfN+ZP0qgGDqHn3Vu/RMIv8iZ\n Bw5Q==", "X-Gm-Message-State": "AOJu0Yyxc89biotA1iDWze3njUEctvmsw/UCnTzr5NhOUu020A3vgxeW\n WlWf6FDP4eQzZLzbJjSgEvN69jmRgi/sz0Sl2FTmrI938hbaocWKuMvaljsmRUmzXA2VOg==", "X-Gm-Gg": "AeBDieupRzzFcDe/fd+18Z+VMz3fMDqsF/4dWPM3fAN1cqhUlY5nLwR6Hdd2wWhJ85r\n FcEUJsNBCl95Ohggazs666WqdzpoS+/Y9Nsap5l3vGBMrgwdfsAf4RGgAGXuRUPaRQratFJo1s9\n p+2kqUJDBjnPJR3UnOaAOki9u3s4kTlK2Si63mUqzFBbIIPf8fMvxv9QTW9t1en/NnjOd8ghxrw\n pQXJuEqWO7KDPwwfxrnnfshFoCJbHridROAhgJ/xaNCa3IeY7hsKjZ4poH9MYq6Ze87mVwWehme\n G+Bx0ptK1wOkNUPuHgbCOxhiiVzsA51/0NKT5UPYS10hSp4NosC7RmeTwY1zcJ1d0htjrodE25W\n IDWwFEo7/HirAaTu3H2cx4+30A02sCqLpUd53vBC9Nw51fJiIpYDJxsHIUC26joGMSzhDz4znpT\n AiRozTv9z5pK+DOEztwUGMfksFb45TotShoiNHzQ==", "X-Received": "by 2002:a17:902:c112:b0:2ba:11e2:6c1e with SMTP id\n d9443c01a7336-2ba7a3771eemr12964955ad.40.1778045899540;\n Tue, 05 May 2026 22:38:19 -0700 (PDT)", "From": "zombie12138 <zombie12139@gmail.com>", "To": "libc-alpha@sourceware.org", "Cc": "goldstein.w.n@gmail.com, hjl.tools@gmail.com,\n zombie12138 <zombie12139@gmail.com>", "Subject": "[PATCH] x86: Fix non-temporal memset unreachable on AMD Zen 3/4/5", "Date": "Tue, 5 May 2026 22:38:01 -0700", "Message-ID": "<20260506053801.3433002-1-zombie12139@gmail.com>", "X-Mailer": "git-send-email 2.47.3", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libc-alpha@sourceware.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Libc-alpha mailing list <libc-alpha.sourceware.org>", "List-Unsubscribe": "<https://sourceware.org/mailman/options/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe>", "List-Archive": "<https://sourceware.org/pipermail/libc-alpha/>", "List-Post": "<mailto:libc-alpha@sourceware.org>", "List-Help": "<mailto:libc-alpha-request@sourceware.org?subject=help>", "List-Subscribe": "<https://sourceware.org/mailman/listinfo/libc-alpha>,\n <mailto:libc-alpha-request@sourceware.org?subject=subscribe>", "Errors-To": "libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org" }, "content": "On AMD Zen 3/4/5 with ERMS, the non-temporal memset path is unreachable\nbecause rep_stosb_threshold is set to SIZE_MAX (vectorized loop is faster\nthan ERMS on these CPUs), but the non-temporal code path is nested inside\nthe rep_stosb branch.\n\nThe existing rescue logic at the Avoid_STOSB check only covers the case\nwhere the CPU lacks ERMS hardware support. It does not cover AMD Zen 3+\nwhere ERMS is supported but deliberately unused for performance reasons.\n\nExtend the condition to also lower rep_stosb_threshold when:\n- The user has not explicitly set x86_rep_stosb_threshold (respect tunables)\n- rep_stosb_threshold is higher than memset_non_temporal_threshold (NT gated)\n\nThis makes the non-temporal path reachable for large memset operations,\nproviding ~2x speedup on pre-faulted buffers larger than L3 cache.\n\nTested on AMD Ryzen 7 8745HS (Zen 4):\n- Pre-faulted 64MB memset: 2.02 ms -> 0.94 ms (2.15x faster)\n- First-touch 64MB memset: 19.3 ms -> 21.3 ms (11% regression, expected:\n kernel clear_page cache warming bypassed by NT stores)\n\n\t* sysdeps/x86/dl-cacheinfo.h (dl_init_cacheinfo): Extend\n\trep_stosb_threshold lowering condition to cover AMD Zen 3/4/5\n\twhere ERMS is supported but stosb is disabled via threshold.\n\nSigned-off-by: zombie12138 <zombie12139@gmail.com>\nBug: https://sourceware.org/bugzilla/show_bug.cgi?id=34129\n---\n sysdeps/x86/dl-cacheinfo.h | 4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)", "diff": "diff --git a/sysdeps/x86/dl-cacheinfo.h b/sysdeps/x86/dl-cacheinfo.h\nindex b6e17b0e32..78929d1f2d 100644\n--- a/sysdeps/x86/dl-cacheinfo.h\n+++ b/sysdeps/x86/dl-cacheinfo.h\n@@ -1293,7 +1293,9 @@ dl_init_cacheinfo (struct cpu_features *cpu_features)\n /* Do `rep_stosb_thresh = non_temporal_thresh` after setting/getting the\n final value of `x86_memset_non_temporal_threshold`. In some cases this can\n be a matter of correctness. */\n- if (CPU_FEATURES_ARCH_P (cpu_features, Avoid_STOSB))\n+ if (CPU_FEATURES_ARCH_P (cpu_features, Avoid_STOSB)\n+ || (!TUNABLE_IS_INITIALIZED (x86_rep_stosb_threshold)\n+\t && rep_stosb_threshold > memset_non_temporal_threshold))\n rep_stosb_threshold\n \t= TUNABLE_GET (x86_memset_non_temporal_threshold, long int, NULL);\n TUNABLE_SET_WITH_BOUNDS (x86_rep_stosb_threshold, rep_stosb_threshold, 1,\n", "prefixes": [] }