From patchwork Sun Feb 4 08:26:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tong Tiangen X-Patchwork-Id: 196456 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp252006dyb; Sun, 4 Feb 2024 00:27:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtWsA/x67/u3x6ECpPqW89qVCK2bQd0pikCkvIMZHGzR6z2j4gXNIXQkMKPcHwdNfhjvkk X-Received: by 2002:a0c:a9da:0:b0:68c:96c3:ef5a with SMTP id c26-20020a0ca9da000000b0068c96c3ef5amr2435055qvb.58.1707035240016; Sun, 04 Feb 2024 00:27:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707035240; cv=pass; d=google.com; s=arc-20160816; b=EOQSXVaL8yMwiXQPcL9XLxBdFvFFhxOZ5J4+gW3DDXjYFNgyE5Z8wOijF1AFSHV7Xz Ce+bx6MIfpTSx12xQGKbe+QjLuhooeJw9k9WxzNc/Y35D84Ihq6oMyGf0BZHYq6o25r3 6kzjxeEzSyc5mRJZFaPyGPaOaJ0EkdmQL32KT4nJ054jQ4KqexohXmJ+1R89dPeD66x1 hsUax8Img3HGEKT4NRn5As2r80pAnPUqTEQpO340+vfC/FlcYclkmQrkRacamG4+NdEH ZgstPFm7cF6YeLKIjDXAloRPL1ILPqPggE16ZE8MDo4SzLMhSgzuKCT3rEAMyo0XgDMY b34w== 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=1/hfG/AoTUNScs9lTyBC3Hj5z+BtwGolZlOronaGEbY=; fh=IU1uRr9ezyaSOy/y0Gnh105aLcbOtEhypsgRLiX/y2Q=; b=OY1EUYl10LGhXTzyOb0k/EkPC4zLwnv5KgqN0VGmTOUjDORrEoD6o8R2eQtxw7Qexg s6jLdaJsphOFHJlOVaqKL+/rFG4bds8vZfOMnonp053Jw1wUrK1ESGMqxhn7tTdaY59N oPDoJTxoa65OeNaE3ZLt09/kM/leLHx4Yj4xF3lSF/uxYhw9Xs+LPrGvyNySup3L96al DZT+bK4h86pCh/aoSj0xtmnXloFrMGd6GjlQRhbpuA+NfSGWfinlJaFwDPH9eByKWWGP FbTqr1bqVXDke0Qtz7dt47J8q0ZWoMFBDTBFz0b2rCmZ8bqteiS5rY/eHsTZq1I/Jjtt xhuA==; 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-51521-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51521-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com X-Forwarded-Encrypted: i=1; AJvYcCXXdP/jTHvzZeGrFd+DzWqfI7sDNgRqYnxjjWa6yLayAl7LF1wJCbpJKL7v7r3Q9oAq/jXtIo10kFRakYy0MdDLQQvfPg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q2-20020a05621419e200b0068c452b7d9esi6796151qvc.356.2024.02.04.00.27.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Feb 2024 00:27:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51521-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::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-51521-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51521-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CAE261C22597 for ; Sun, 4 Feb 2024 08:27:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37E8A134BF; Sun, 4 Feb 2024 08:26:42 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 75F1C12B6C; Sun, 4 Feb 2024 08:26:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707035200; cv=none; b=LchtFqPj9NwU9A3AHese6ms0DY+GSBff6e22B3G4xXlf5Vak6gbsm21aXT3cUxey7x8SpftC51NH3+PuxztQsjlIuOXHmOw/svm+G5rZ2YdNd0OqgOhRcEeaRm/SWp4cgR6ftpIKgMYn6DxB1t8AC/PlUbin7eeOmupAsM0mPzI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707035200; c=relaxed/simple; bh=4zXDJkLQztiGlvBIDP7y8d8iYlaOAyzhpsC76GSWYcE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Le25qlFP+rPIsm0yypZKpC762HD3w3ElZxYmlvXQ4HOvFD6FU+LkrGAZGiENeuOP/8FbxR8SClKdjMhvcc48yHCdcUM4eTtcr4AifUqVywkAxNxkYEoC043kinBjint0mf2mjSFdji31HEo78ZAvG0ExkMSXr6DEudMyr4DmjG4= 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.187 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.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4TSMyQ0lJtzsWrZ; Sun, 4 Feb 2024 16:25:18 +0800 (CST) Received: from kwepemm600017.china.huawei.com (unknown [7.193.23.234]) by mail.maildlp.com (Postfix) with ESMTPS id 3DF7618001A; Sun, 4 Feb 2024 16:26:35 +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:33 +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 2/3] x86/mce: set MCE_IN_KERNEL_COPYIN for DEFAULT_MCE_SAFE exception Date: Sun, 4 Feb 2024 16:26:26 +0800 Message-ID: <20240204082627.3892816-3-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: 1789956184115303085 X-GMAIL-MSGID: 1789956184115303085 From: Kefeng Wang Currently, some kernel memory copy scenarios[1][2][3] which use copy_mc_{user_}highpage() to safely abort copy and report 'bytes not copied' when accessing the poisoned source page, a recoverable synchronous exception generated in the processing and the fixup type EX_TYPE_DEFAULT_MCE_SAFE is used to distinguish from other exceptions, and an asynchronous memory_failure_queue() is called to handle memory failure of the source page , but scheduling someone else to handle it at some future point is unpredictable and risky. The better way is immediately deal with it during current context, fortunately, there is already a framework to synchronously call memory_failure(), see kill_me_never() in do_machine_check(), a task work is triggered once MCE_IN_KERNEL_COPYIN is set, in order to fix above issue, setting MCE_IN_KERNEL_COPYIN for EX_TYPE_DEFAULT_MCE_SAFE case too. [1] commit d302c2398ba2 ("mm, hwpoison: when copy-on-write hits poison, take page offline") [2] commit 1cb9dc4b475c ("mm: hwpoison: support recovery from HugePage copy-on-write faults") [3] commit 6b970599e807 ("mm: hwpoison: support recovery from ksm_might_need_to_copy()") Reviewed-by: Naoya Horiguchi Reviewed-by: Tony Luck Signed-off-by: Kefeng Wang Signed-off-by: Tong Tiangen --- arch/x86/kernel/cpu/mce/severity.c | 4 ++-- mm/ksm.c | 1 - mm/memory.c | 13 ++++--------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c index bca780fa5e57..b2cce1b6c96d 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -292,11 +292,11 @@ static noinstr int error_context(struct mce *m, struct pt_regs *regs) case EX_TYPE_UACCESS: if (!copy_user) return IN_KERNEL; + fallthrough; + case EX_TYPE_DEFAULT_MCE_SAFE: m->kflags |= MCE_IN_KERNEL_COPYIN; fallthrough; - case EX_TYPE_FAULT_MCE_SAFE: - case EX_TYPE_DEFAULT_MCE_SAFE: m->kflags |= MCE_IN_KERNEL_RECOV; return IN_KERNEL_RECOV; diff --git a/mm/ksm.c b/mm/ksm.c index 8c001819cf10..ba9d324ea1c6 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -3084,7 +3084,6 @@ struct folio *ksm_might_need_to_copy(struct folio *folio, if (copy_mc_user_highpage(folio_page(new_folio, 0), page, addr, vma)) { folio_put(new_folio); - memory_failure_queue(folio_pfn(folio), 0); return ERR_PTR(-EHWPOISON); } folio_set_dirty(new_folio); diff --git a/mm/memory.c b/mm/memory.c index 8d14ba440929..ee06a8f766ab 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2846,10 +2846,8 @@ static inline int __wp_page_copy_user(struct page *dst, struct page *src, unsigned long addr = vmf->address; if (likely(src)) { - if (copy_mc_user_highpage(dst, src, addr, vma)) { - memory_failure_queue(page_to_pfn(src), 0); + if (copy_mc_user_highpage(dst, src, addr, vma)) return -EHWPOISON; - } return 0; } @@ -6179,10 +6177,8 @@ static int copy_user_gigantic_page(struct folio *dst, struct folio *src, cond_resched(); if (copy_mc_user_highpage(dst_page, src_page, - addr + i*PAGE_SIZE, vma)) { - memory_failure_queue(page_to_pfn(src_page), 0); + addr + i*PAGE_SIZE, vma)) return -EHWPOISON; - } } return 0; } @@ -6199,10 +6195,9 @@ static int copy_subpage(unsigned long addr, int idx, void *arg) struct page *dst = nth_page(copy_arg->dst, idx); struct page *src = nth_page(copy_arg->src, idx); - if (copy_mc_user_highpage(dst, src, addr, copy_arg->vma)) { - memory_failure_queue(page_to_pfn(src), 0); + if (copy_mc_user_highpage(dst, src, addr, copy_arg->vma)) return -EHWPOISON; - } + return 0; } 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;