From patchwork Tue May 16 10:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 94607 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp321619vqo; Tue, 16 May 2023 03:33:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ53+mFd41WN0modhJQoLIgX2SRt5ULrXmB7/4/uMtNlMp7h9y0YBsTpdVbqhzHWkabAlnfT X-Received: by 2002:a17:903:32cc:b0:1ad:cba5:5505 with SMTP id i12-20020a17090332cc00b001adcba55505mr24766944plr.14.1684233180244; Tue, 16 May 2023 03:33:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684233180; cv=none; d=google.com; s=arc-20160816; b=vH5q5Bt3FIX0YJmti0sFQseGj62X7TPVIOnpDWnR9L6CEULC6+Rkhmsz7fQ9B4PI1C 3L+YCrxO1la9v6Zg3cvi9uXbhr1NQKEyws+nB7RBzyGsuoa/+BRFmPHshOAr7tPaT4AM Kpgl6f3sbcASZNfiPZ5ivtgeoG2MmlBout4OVb8tCo+R9K3FH3vh6p/8CUUHWrUXh039 RSM7d8LKUwnHdrgCjnfQ0eZO9ghCNbFvwrSUsyPh3bK8kRhU9n4UvEtM+I7NfL3AfSs9 q8NR+5v27gQWPzoDM1SwtyfOj2ZHGkREi1g9PzFr0RUWxC1jD5rR8u91eZF+4SCd2Su4 L8BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=Hr5bExCKZxqebJdRuLy60M/3NBxhUajsShV67vDRyu0=; b=jyJYeaHOJcvwIFWLH4R3ksGg6GUXMLE3g5Io6on3svA3qYztQF47hBdCebC2BzJDAR 5Hn80YzDO+bnd2ieGbwjDP4UVrD6//6eQf2OkRmb61tpMTQvk5CNfiBdzn3MvrgPuj+8 mh4Ok8O7pm3ThhRGgbWcLBaFvRrm75RIFj9ySbP2AYsbaXPF61eW+eGsgNx4cTm0f/ck IatYql4oFLjDNHy01U2vRy6AnEOo+G8k/FFrV/hZ1CbtwjCu0MT62paNisp5lHFS9D2E 5CfPHEkfKZV/G823i2jaX8lOu9nmzL+knEY2h0j5cBjH432skMnmcbBtDghcKWCKSExC 0d5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gERDV1ao; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hNMAta5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15-20020a17090a514f00b0024c1ddfa1bfsi1528113pjm.92.2023.05.16.03.32.45; Tue, 16 May 2023 03:33:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gERDV1ao; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=hNMAta5H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232307AbjEPK3H (ORCPT + 99 others); Tue, 16 May 2023 06:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232129AbjEPK25 (ORCPT ); Tue, 16 May 2023 06:28:57 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 702525261; Tue, 16 May 2023 03:28:50 -0700 (PDT) Date: Tue, 16 May 2023 10:28:48 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684232929; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hr5bExCKZxqebJdRuLy60M/3NBxhUajsShV67vDRyu0=; b=gERDV1aove6Qn14UaJfZ9AOBFlHXwkapZoPBlJOOvev+r8xSttLjhBQHXJQCGPguE6v28O v6YPh6ZPigTcsnYlFOunmtrrTypCda9hf6CJ0ydPn5DHXEKA4s0JLEJqIjIE+iC+/9VWuT 60KajN9AQulup2yfVIn+WkcZi4uW819UZKfW03fXVQnZDHVOio1xkAHtnqe+nq/eW4kcJn Iq+rtb0z9X6xrUCX5Dzk7rxg5NpYKZ1UqKWrM/9bREgwiXkpSLLcg7ihz/2rT14FruYDkS XCqsXYZKZdM3n14FwNaGg3DuXKIeXm6YuFiIdY5IvuRCtxWJ4vDI14ggNwIl6Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684232929; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hr5bExCKZxqebJdRuLy60M/3NBxhUajsShV67vDRyu0=; b=hNMAta5HiFICdruoPlVPVB+3uP/fnCPOD3Z3etG/zpQuNNPfUKy810X1DA2EuYwTZg/Z8N g4w3V7Lj4TEKhABQ== From: "tip-bot2 for Yazen Ghannam" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: ras/core] x86/MCE: Check a hw error's address to determine proper recovery action Cc: Yazen Ghannam , "Borislav Petkov (AMD)" , Tony Luck , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230322005131.174499-1-tony.luck@intel.com> References: <20230322005131.174499-1-tony.luck@intel.com> MIME-Version: 1.0 Message-ID: <168423292833.404.13379284574944485895.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766046491426476323?= X-GMAIL-MSGID: =?utf-8?q?1766046491426476323?= The following commit has been merged into the ras/core branch of tip: Commit-ID: e40879b6d7d858b03813cd53c17dfef9c297f525 Gitweb: https://git.kernel.org/tip/e40879b6d7d858b03813cd53c17dfef9c297f525 Author: Yazen Ghannam AuthorDate: Fri, 08 Jan 2021 04:00:35 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 16 May 2023 12:16:22 +02:00 x86/MCE: Check a hw error's address to determine proper recovery action Make sure that machine check errors with a usable address are properly marked as poison. This is needed for errors that occur on memory which have MCG_STATUS[RIPV] clear - i.e., the interrupted process cannot be restarted reliably. One example is data poison consumption through the instruction fetch units on AMD Zen-based systems. The MF_MUST_KILL flag is passed to memory_failure() when MCG_STATUS[RIPV] is not set. So the associated process will still be killed. What this does, practically, is get rid of one more check to kill_current_task with the eventual goal to remove it completely. Also, make the handling identical to what is done on the notifier path (uc_decode_notifier() does that address usability check too). The scenario described above occurs when hardware can precisely identify the address of poisoned memory, but execution cannot reliably continue for the interrupted hardware thread. [ bp: Massage commit message. ] Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Tony Luck Link: https://lore.kernel.org/r/20230322005131.174499-1-tony.luck@intel.com --- arch/x86/kernel/cpu/mce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 2eec60f..22dfcb2 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1533,7 +1533,7 @@ noinstr void do_machine_check(struct pt_regs *regs) /* If this triggers there is no way to recover. Die hard. */ BUG_ON(!on_thread_stack() || !user_mode(regs)); - if (kill_current_task) + if (!mce_usable_address(&m)) queue_task_work(&m, msg, kill_me_now); else queue_task_work(&m, msg, kill_me_maybe);