Message ID | 20230528113545.650533-1-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp737940vqr; Sat, 27 May 2023 21:21:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yba3Jl/9pdPwr/zKVzZZZYF6vpdp5E/PqClQtwBqVKPl2vFXhR36K3IUVjYQWeSCI1W9N X-Received: by 2002:a17:902:ec82:b0:1ae:3991:e4f9 with SMTP id x2-20020a170902ec8200b001ae3991e4f9mr8391925plg.61.1685247662651; Sat, 27 May 2023 21:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685247662; cv=none; d=google.com; s=arc-20160816; b=INb7qeyfIdHI9XJeca4Z4E+Nr08zgLaYvn7TIbU36XJl4i52GcZoG9lO2GHK3yybYC uw5o8Uy7TWLQXYIEZp6XQ/JPXb4swmGJbKwb7K+XMIemtSt7qDx2pOYFHZAuwYkQ2HRZ IVL5CTR+4sjbNbsdHnwleqM+8Uksf8AbypKWdvIwf6FTsJBS+1srJ25F3qFmdPt/5yHq bBTHDUNj2kMi+/9grbav/9l/O2+d/6D+PgBzHePS999gYPpgAFkG734o7u82kjvVY8Ui NzvbTdNTuXIwB2cSZdMDMNmUttwsYm+SW0aXFMS9SkhjGGBbVdnsXzlqS5DRZRvPiw61 T/VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=u6Kr6xJINd5Kh+PbaiE/XNIegtSxWIYEmbMruqRNxeY=; b=HK302wx8Nb6Jme8yNlyHoqsT+9CoERNUyHiK/EK0ZFurkJddj46RionEEVAkbfKZUm RHRKPRoP55DQPuoKLYZpvYrRW7OzBzyYyQtHmedHEUU9SvhlsoV1WTWPsHcBF+qaQ2ax u6upRx9rlkfZV+LBYSyrxotFisX50KYCYXFxUKEtxOUgo6NyLgQ1lQdl7yxZUeHgLyPl sGjZkeofNTH6CtRKbwSMd5FT+JkwKHnGEmPtZy4/GDYz0JAzR70Q7x/6AeD3rBH2QGcH 9qFl/ZGKI6PZU52JyXFS1lEakaVt+4hH8l32lA+YvE1uBg+o+HTxmVvkXS86QXgQKuN6 7tDg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a170902b60300b001ac937171d7si2913854pls.278.2023.05.27.21.20.39; Sat, 27 May 2023 21:21:02 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229468AbjE1Doh (ORCPT <rfc822;zhanglyra.2023@gmail.com> + 99 others); Sat, 27 May 2023 23:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjE1Dof (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 27 May 2023 23:44:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A74AC9; Sat, 27 May 2023 20:44:33 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QTPfd0B9WzTkbb; Sun, 28 May 2023 11:44:25 +0800 (CST) Received: from huawei.com (10.175.104.170) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sun, 28 May 2023 11:44:29 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <tony.luck@intel.com>, <bp@alien8.de>, <tglx@linutronix.de>, <mingo@redhat.com>, <dave.hansen@linux.intel.com> CC: <hpa@zytor.com>, <x86@kernel.org>, <linux-edac@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH] x86/mce: remove unused mce_vaddr Date: Sun, 28 May 2023 19:35:45 +0800 Message-ID: <20230528113545.650533-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767110253334592372?= X-GMAIL-MSGID: =?utf-8?q?1767110253334592372?= |
Series |
x86/mce: remove unused mce_vaddr
|
|
Commit Message
Miaohe Lin
May 28, 2023, 11:35 a.m. UTC
Since commit a6e3cf70b772 ("x86/mce: Change to not send SIGBUS error during
copy from user"), mce_vaddr is not used anymore. Remove it and clean up the
relevant code.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
arch/x86/kernel/cpu/mce/severity.c | 7 +------
include/linux/sched.h | 1 -
2 files changed, 1 insertion(+), 7 deletions(-)
Comments
On Sun, May 28, 2023 at 07:35:45PM +0800, Miaohe Lin wrote: > Since commit a6e3cf70b772 ("x86/mce: Change to not send SIGBUS error during > copy from user"), mce_vaddr is not used anymore. Remove it and clean up the > relevant code. Hi Miaohe, Not so sure that the 'clean up' part is useful. See below. > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> > --- > arch/x86/kernel/cpu/mce/severity.c | 7 +------ > include/linux/sched.h | 1 - > 2 files changed, 1 insertion(+), 7 deletions(-) > > diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c > index c4477162c07d..0acc0039de81 100644 > --- a/arch/x86/kernel/cpu/mce/severity.c > +++ b/arch/x86/kernel/cpu/mce/severity.c > @@ -252,12 +252,7 @@ static bool is_copy_from_user(struct pt_regs *regs) > return false; > } > > - if (fault_in_kernel_space(addr)) > - return false; > - > - current->mce_vaddr = (void __user *)addr; > - > - return true; > + return !fault_in_kernel_space(addr); > } Refactoring the return is unnecessary and seems less readable. How about removing the assignment, and leaving the rest, as is: diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c index c4477162c07d..1c03221ddcb1 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -255,8 +255,6 @@ static bool is_copy_from_user(struct pt_regs *regs) if (fault_in_kernel_space(addr)) return false; - current->mce_vaddr = (void __user *)addr; - return true; } Alison > > /* > diff --git a/include/linux/sched.h b/include/linux/sched.h > index eed5d65b8d1f..3054a7087230 100644 > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -1493,7 +1493,6 @@ struct task_struct { > #endif > > #ifdef CONFIG_X86_MCE > - void __user *mce_vaddr; > __u64 mce_kflags; > u64 mce_addr; > __u64 mce_ripv : 1, > -- > 2.27.0 >
On 2023/5/31 3:16, Alison Schofield wrote: > On Sun, May 28, 2023 at 07:35:45PM +0800, Miaohe Lin wrote: >> Since commit a6e3cf70b772 ("x86/mce: Change to not send SIGBUS error during >> copy from user"), mce_vaddr is not used anymore. Remove it and clean up the >> relevant code. > > Hi Miaohe, > > Not so sure that the 'clean up' part is useful. See below. > > >> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> >> --- >> arch/x86/kernel/cpu/mce/severity.c | 7 +------ >> include/linux/sched.h | 1 - >> 2 files changed, 1 insertion(+), 7 deletions(-) >> >> diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c >> index c4477162c07d..0acc0039de81 100644 >> --- a/arch/x86/kernel/cpu/mce/severity.c >> +++ b/arch/x86/kernel/cpu/mce/severity.c >> @@ -252,12 +252,7 @@ static bool is_copy_from_user(struct pt_regs *regs) >> return false; >> } >> >> - if (fault_in_kernel_space(addr)) >> - return false; >> - >> - current->mce_vaddr = (void __user *)addr; >> - >> - return true; >> + return !fault_in_kernel_space(addr); >> } > > > Refactoring the return is unnecessary and seems less readable. > How about removing the assignment, and leaving the rest, as is: > > diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c > index c4477162c07d..1c03221ddcb1 100644 > --- a/arch/x86/kernel/cpu/mce/severity.c > +++ b/arch/x86/kernel/cpu/mce/severity.c > @@ -255,8 +255,6 @@ static bool is_copy_from_user(struct pt_regs *regs) > if (fault_in_kernel_space(addr)) > return false; > > - current->mce_vaddr = (void __user *)addr; > - > return true; > } > Sounds good to me. Will do it in v2. Thanks for your advice.
diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c index c4477162c07d..0acc0039de81 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -252,12 +252,7 @@ static bool is_copy_from_user(struct pt_regs *regs) return false; } - if (fault_in_kernel_space(addr)) - return false; - - current->mce_vaddr = (void __user *)addr; - - return true; + return !fault_in_kernel_space(addr); } /* diff --git a/include/linux/sched.h b/include/linux/sched.h index eed5d65b8d1f..3054a7087230 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1493,7 +1493,6 @@ struct task_struct { #endif #ifdef CONFIG_X86_MCE - void __user *mce_vaddr; __u64 mce_kflags; u64 mce_addr; __u64 mce_ripv : 1,