From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 48CC0230D0A; Fri, 14 Feb 2025 09:29:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739525369; cv=none; b=RSUH8pH7oihU91NtwNnozOj5w9e+5r6Q9S7b25xhJupi9GsUnhnxCeeKaOxzpVXo1ZVTjsbY1n5OoD6e+PIplWUkFAaWqFH3VS6JHFPBcLV7bIDzz1U5Kol6yN5bCP/Xk85bnBO0XuKmEJPg/r+4rstAIxxwZIAzrlfc9ZPqbmc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739525369; c=relaxed/simple; bh=Unj9+KUmPhmjiIcXv9PQ38TPGgztU1T0Q8tpkwODRf0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qANlYOZmzAec+TBKuWnmJyVKO2U7Rv15bEI03SrAdFdeUkZIFlSOkZtG+02PLfjGAWEW1lfpvYRBP1B/gPb4BVzapUtq8hQiu+yGGYuwXkWsCn8xY4COLh5Z3+wXNdZm4B/i258HrHxIBof8GmWHJtKR3obcJqrLpX5zKSqWbsk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=pdaduCTi; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="pdaduCTi" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739525363; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=b6mdXYOfZ9pTQzmmFy++yT48ZTyBGn00CrwkhOAHtZ4=; b=pdaduCTio49Caiuk75ArWg9RcMmH7nrE1dk1qdwuQDqeEd1/NOT2ST1kjUoOsxYA+tI4L/r6m2DO/fCUEhZFN4BJbuXJkYag+cxPXKxLlPTJeuEglbBvoeQagceR3wX27Te880oj+keTnoIpIEwJFnPYiTYTn5wu8PcQTjyCDAc= Received: from 30.246.161.128(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WPQRTw-_1739525360 cluster:ay36) by smtp.aliyun-inc.com; Fri, 14 Feb 2025 17:29:21 +0800 Message-ID: Date: Fri, 14 Feb 2025 17:29:19 +0800 Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 2/4] x86/mce: dump error msg from severities To: "Luck, Tony" , "bp@alien8.de" , "nao.horiguchi@gmail.com" Cc: "tglx@linutronix.de" , "mingo@redhat.com" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "linmiaohe@huawei.com" , "akpm@linux-foundation.org" , "linux-edac@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "baolin.wang@linux.alibaba.com" , "tianruidong@linux.alibaba.com" References: <20250211060200.33845-1-xueshuai@linux.alibaba.com> <20250211060200.33845-3-xueshuai@linux.alibaba.com> From: Shuai Xue In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 在 2025/2/12 00:44, Luck, Tony 写道: >> The message in severities is useful for identifying the type of MCE that >> has occurred; dump it if it is valid. >> >> Signed-off-by: Shuai Xue >> --- >> arch/x86/kernel/cpu/mce/core.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c >> index 2919a077cd66..c1319db45b0a 100644 >> --- a/arch/x86/kernel/cpu/mce/core.c >> +++ b/arch/x86/kernel/cpu/mce/core.c >> @@ -1456,6 +1456,8 @@ static void queue_task_work(struct mce_hw_err *err, char *msg, void (*func)(stru >> if (count > 1) >> return; >> >> + if (msg) >> + pr_err("%s\n", msg); >> task_work_add(current, ¤t->mce_kill_me, TWA_RESUME); >> } > > This is called from the #MC handler. Is that a safe context to print a console > message? It wasn't in the past, but maybe changes to how console messages > are handled have changed this. > > -Tony #MC is a kind of NMI context, as far as I know, since commit 42a0bb3f71383b457a7db362f1c69e7afb96732b printk/nmi: generic solution for safe printk in NMI print a console message is safe. Please correct me if I missed anything. Thanks. Shuai