From patchwork Tue Jan 18 21:29:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 50194 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 2B4F53864835 for ; Tue, 18 Jan 2022 21:30:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B4F53864835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1642541406; bh=T7yhY8G8MpPmIV8AwbAzvzy1vRz2Qqp+Q8Rr7q+oopI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=L9pMlx1poWyFy7dfPiVzoaYUa7R7SZ3CUJ7UKhL96c/nZsBM9FqAXXR+USW/szpEh UfmIL43XtOtfAYY/payBBlGTETght6CsmNtFQzXXW571zyS4XgOeqKV+EhznxtjwY1 SeJTn7YXbEGIqOdTwNHPdzp7IaiPNbXD9TxVFU+8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id 76582385BF92 for ; Tue, 18 Jan 2022 21:29:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 76582385BF92 Received: by mail-pj1-x102f.google.com with SMTP id i8-20020a17090a138800b001b3936fb375so4050323pja.1 for ; Tue, 18 Jan 2022 13:29:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=T7yhY8G8MpPmIV8AwbAzvzy1vRz2Qqp+Q8Rr7q+oopI=; b=7ViWzajGZfWde/pJ+Lk8hWwb6kvokW91kNT6Uuog3O/PHd6JuoSETNM3Q4NUpq8u93 WZQYgKe44g+8tTkIBBXu6JWuDFw6e6t9dNodXcJ+FJrAzbPFGTZ04eGMvHrYZfKS3PFv xKE9MtjYCdmV3HoGzT+my38zs/au20NL3ip6MFdzv8+N/tCBSeA2L/qBT5+540w85iUj 7qRkUo5xLDNSoE4OIreRaflDNENBz75UjCH44sREf73bY5AFuD76WRidPC8X8nwdf/ct ecnB3MAGZXQo2YSNNyNVyPzI35jIt/4EL6aucbKwInaJwv8vzgbBPolL7gNsvYcH09SF j9Zg== X-Gm-Message-State: AOAM5328P4sijtIgxt16kZP0KNAJi8uScD1IJp04W7NUECi3IRQ+x5dy 8zmHZBFChUb3K5VXwxwXAq8= X-Google-Smtp-Source: ABdhPJxuMGu9D6YJlCu51wuMH41Gy4JE8BvFk2OCY9HF2uKxsfrd5WlaU9AWOhRBcEURUl0/wlkhHw== X-Received: by 2002:a17:902:bd87:b0:14a:adaa:87ea with SMTP id q7-20020a170902bd8700b0014aadaa87eamr14845364pls.171.1642541383282; Tue, 18 Jan 2022 13:29:43 -0800 (PST) Received: from gnu-tgl-3.localdomain ([172.58.35.133]) by smtp.gmail.com with ESMTPSA id ob12sm4370522pjb.17.2022.01.18.13.29.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 13:29:42 -0800 (PST) Received: from gnu-tgl-2.localdomain (gnu-tgl-2 [192.168.1.42]) by gnu-tgl-3.localdomain (Postfix) with ESMTPS id 9E2D7C01EC; Tue, 18 Jan 2022 13:29:41 -0800 (PST) Received: from gnu-tgl-2.. (localhost [IPv6:::1]) by gnu-tgl-2.localdomain (Postfix) with ESMTP id 73B2330035A; Tue, 18 Jan 2022 13:29:40 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH v2] x86: Black list more Intel CPUs for TSX [BZ #27398] Date: Tue, 18 Jan 2022 13:29:40 -0800 Message-Id: <20220118212940.2051376-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3028.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Disable TSX and enable RTM_ALWAYS_ABORT for Intel CPUs listed in: https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html This fixes BZ #27398. --- sysdeps/x86/cpu-features.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c index 772ccf8e91..514226b378 100644 --- a/sysdeps/x86/cpu-features.c +++ b/sysdeps/x86/cpu-features.c @@ -507,11 +507,39 @@ init_cpu_features (struct cpu_features *cpu_features) break; } - /* Disable TSX on some Haswell processors to avoid TSX on kernels that - weren't updated with the latest microcode package (which disables - broken feature by default). */ + /* Disable TSX on some processors to avoid TSX on kernels that + weren't updated with the latest microcode package (which + disables broken feature by default). */ switch (model) { + case 0x55: + if (stepping <= 5) + goto disable_tsx; + break; + case 0x8e: + /* NB: Although the errata documents that for model == 0x8e, + only 0xb stepping or lower are impacted, the intention of + the errata was to disable TSX on all client processors on + all steppings. Include 0xc stepping which is an Intel + Core i7-8665U, a client mobile processor. */ + case 0x9e: + if (stepping > 0xc) + break; + /* Fall through. */ + case 0x4e: + case 0x5e: + { + /* Disable Intel TSX and enable RTM_ALWAYS_ABORT for + processors listed in: + +https://www.intel.com/content/www/us/en/support/articles/000059422/processors.html + */ +disable_tsx: + CPU_FEATURE_UNSET (cpu_features, HLE); + CPU_FEATURE_UNSET (cpu_features, RTM); + CPU_FEATURE_SET (cpu_features, RTM_ALWAYS_ABORT); + } + break; case 0x3f: /* Xeon E7 v3 with stepping >= 4 has working TSX. */ if (stepping >= 4)