From patchwork Sun Feb 4 08:26:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tong Tiangen X-Patchwork-Id: 196457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp252293dyb; Sun, 4 Feb 2024 00:28:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbphUorfJQH+FcRcdqYQSLtHa5tm/F+2B6+zcsWYg8sK+SjkqI9HVbDGrKaF2OgmhDviu1 X-Received: by 2002:a05:6870:218b:b0:218:5f59:2a84 with SMTP id l11-20020a056870218b00b002185f592a84mr5755503oae.53.1707035300521; Sun, 04 Feb 2024 00:28:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707035300; cv=pass; d=google.com; s=arc-20160816; b=b2/3KcDUlwfRl9CMunwx+RaBEjsTHfkvFS0qlmONA5AAALLXzqVmYh5M8exsVMDCGN dZ7/IVQmnxsdDKk4ZdWvq09s8WnopvdLByW8YJUG6PmP6ki8nBBYnYgD0JFob+Mr39Jc gJCUogGWH/XfNe3scyP14ay1wd6eTXisCqCzwOox7pr4RJWcB+HWBYx85KRyWKMJYVb7 cFDPGuldBM6W71+64rF8xBz14rI656wpVdt1sAn2orxU0s0fYMtASUEJ6mTfntuMzLV6 gYcoB0F8d7WWaSYpAQN+ZLONkOvFAiiELoodW8DeseLL+8R9jdxYry75KxbS5ky3p+11 rKgQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=JIhTmCKp1JPvrDf4Nft0zYZgK3+6jgIK0+TowYYY4xU=; fh=IpKbbu+GSUV2YbYL+sKN2DTJZC+476frNeXso54rS80=; b=HS5hVVfY0PAv4VyPSrpWlpPKdCacsvUmyG8FHCEltPzhcoD5UzZ9aBTYJ2U/VqcUZJ apIFi9YAxsY4wnMo5Gp+Gzvie8QGlr0Ug3Op0COSwAAxuBXY1UKC+N+0T6RNOMenQD3R 6URMBZkarnO6qjaiBE/917cpibFsX9HffsOrNoEr5NjjZIMQF76OagjWRWzolH3f8G+2 coxkOY/dq+370wvvDtHMHXWA/U9ydXpePJW6YLk5MyMamgFjEn7sbwJcxPlniOJeef7G 6oqtYmLHAG5gps9Lwuq8lj51wcLJPgqX80hWo5R84XSspvgPU8dbZ759URmcDDN+y7Pz 7P0w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-51522-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51522-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCV3HYTDocoDVWnmk1Br8L1XDBuXty5CIO0s4oPaN96rh33ojh2502AM6lASue0GXJVn8GCFv+Q05m1Qd8rUuoDZU8A1Xw== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p14-20020a63c14e000000b005cdf89f64ffsi4294612pgi.482.2024.02.04.00.28.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 00:28:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51522-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-51522-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51522-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C927C28256D for ; Sun, 4 Feb 2024 08:27:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0B98134DB; Sun, 4 Feb 2024 08:26:42 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 B068A12B69; Sun, 4 Feb 2024 08:26:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707035200; cv=none; b=skJEYcVmLABtAd2JoZ47L+yNweRmJ9/hMzWjlIXJ1O7RmA2gIhVPeYnJidDcHWbyMV8Kyx5dBup/qRyqZaBnaWI+hRTGIZ2m7Kh1p/nzOfx6laAE1LTHgqSBBXN27zBmOT1lgrBipPBeBuilhCvNUCnukIx0S+JHDkfRCpOpkds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707035200; c=relaxed/simple; bh=p/f7riMkZxcC6ClGf9vpDtgKU0i1cmddSajVqTGwbYI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=a6MclFVXZl6Y48bPFk/rQIs8x5X2GypSjbIGaW4POs4733tl6tK3JxG+Z1dFMarNG/TEl1el/GrhXYmk6xjjDtv0WGL7lNTHRJbaUrpXURK9Qi3czlVHs33QIIvvUXiJzkI/3umwE+dPTPoLVQFPuHrPKvg+xPvlRCWbSavJ3Xg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TSMyh23QKz1xnCm; Sun, 4 Feb 2024 16:25:32 +0800 (CST) Received: from kwepemm600017.china.huawei.com (unknown [7.193.23.234]) by mail.maildlp.com (Postfix) with ESMTPS id 71B6814013B; Sun, 4 Feb 2024 16:26:36 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600017.china.huawei.com (7.193.23.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sun, 4 Feb 2024 16:26:35 +0800 From: Tong Tiangen To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , , Dave Hansen , , "H. Peter Anvin" , Tony Luck , Andy Lutomirski , Peter Zijlstra , Andrew Morton , Naoya Horiguchi CC: , , , Tong Tiangen , Guohanjun Subject: [PATCH -next v5 3/3] x86/mce: rename MCE_IN_KERNEL_COPYIN to MCE_IN_KERNEL_COPY_MC Date: Sun, 4 Feb 2024 16:26:27 +0800 Message-ID: <20240204082627.3892816-4-tongtiangen@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240204082627.3892816-1-tongtiangen@huawei.com> References: <20240204082627.3892816-1-tongtiangen@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600017.china.huawei.com (7.193.23.234) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789956247104437048 X-GMAIL-MSGID: 1789956247104437048 In the x86 mce processing, error_context() use MCE_IN_KERNEL_COPYIN for user-to-kernel copy(EX_TYPE_UACCESS) and kernel-to-kernel copy (EX_TYPE_DEFAULT_MCE_SAFE). "COPYIN" only stands for user-to-kernel copy and can't stands for kernel-to-kernel copy, this can cause some misunderstandings. So rename MCE_IN_KERNEL_COPYIN to MCE_IN_KERNEL_COPY_MC. Signed-off-by: Tong Tiangen --- arch/x86/include/asm/mce.h | 8 ++++---- arch/x86/kernel/cpu/mce/core.c | 2 +- arch/x86/kernel/cpu/mce/severity.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h index de3118305838..cb628ab2f32f 100644 --- a/arch/x86/include/asm/mce.h +++ b/arch/x86/include/asm/mce.h @@ -151,11 +151,11 @@ /* * Indicates an MCE that happened in kernel space while copying data - * from user. In this case fixup_exception() gets the kernel to the - * error exit for the copy function. Machine check handler can then - * treat it like a fault taken in user mode. + * from user or kernel. In this case fixup_exception() gets the kernel + * to the error exit for the copy function. Machine check handler can + * then treat it like a fault taken in user or kernel mode. */ -#define MCE_IN_KERNEL_COPYIN BIT_ULL(7) +#define MCE_IN_KERNEL_COPY_MC BIT_ULL(7) /* * This structure contains all data related to the MCE log. Also diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 04acdc3534c8..644748a5d98e 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1608,7 +1608,7 @@ noinstr void do_machine_check(struct pt_regs *regs) mce_panic("Failed kernel mode recovery", &m, msg); } - if (m.kflags & MCE_IN_KERNEL_COPYIN) + if (m.kflags & MCE_IN_KERNEL_COPY_MC) queue_task_work(&m, msg, kill_me_never); } diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c index b2cce1b6c96d..b4b1d028cbb3 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -294,7 +294,7 @@ static noinstr int error_context(struct mce *m, struct pt_regs *regs) return IN_KERNEL; fallthrough; case EX_TYPE_DEFAULT_MCE_SAFE: - m->kflags |= MCE_IN_KERNEL_COPYIN; + m->kflags |= MCE_IN_KERNEL_COPY_MC; fallthrough; case EX_TYPE_FAULT_MCE_SAFE: m->kflags |= MCE_IN_KERNEL_RECOV;