From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 418FCC433F5 for ; Wed, 13 Apr 2022 07:30:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9AD106B0072; Wed, 13 Apr 2022 03:30:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95C606B0073; Wed, 13 Apr 2022 03:30:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84C146B0074; Wed, 13 Apr 2022 03:30:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 75B2E6B0072 for ; Wed, 13 Apr 2022 03:30:45 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3E6E621BD6 for ; Wed, 13 Apr 2022 07:30:45 +0000 (UTC) X-FDA: 79351033650.05.9042AA6 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf05.hostedemail.com (Postfix) with ESMTP id 4D8E510000C for ; Wed, 13 Apr 2022 07:30:44 +0000 (UTC) Received: from kwepemi100019.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KdZ281BQCzFpnZ; Wed, 13 Apr 2022 15:28:16 +0800 (CST) Received: from kwepemm600017.china.huawei.com (7.193.23.234) by kwepemi100019.china.huawei.com (7.221.188.189) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 13 Apr 2022 15:30:40 +0800 Received: from [10.174.179.234] (10.174.179.234) 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.2375.24; Wed, 13 Apr 2022 15:30:39 +0800 Message-ID: <976b642a-4085-ac8f-1377-cc8f295203a2@huawei.com> Date: Wed, 13 Apr 2022 15:30:38 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [RFC PATCH -next V3 4/6] arm64: add copy_{to, from}_user to machine check safe To: Robin Murphy , Mark Rutland , James Morse , Andrew Morton , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Catalin Marinas , Will Deacon , Alexander Viro , , "H . Peter Anvin" CC: , , , Kefeng Wang , Xie XiuQi References: <20220412072552.2526871-1-tongtiangen@huawei.com> <20220412072552.2526871-5-tongtiangen@huawei.com> <38c6d4b5-a3db-5c3e-02e7-39875edb3476@arm.com> From: Tong Tiangen In-Reply-To: <38c6d4b5-a3db-5c3e-02e7-39875edb3476@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.234] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600017.china.huawei.com (7.193.23.234) X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: 8nde99azok6cgc1ct8zfnzasmm5unxe4 Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of tongtiangen@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=tongtiangen@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 4D8E510000C X-HE-Tag: 1649835044-632504 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 在 2022/4/13 1:08, Robin Murphy 写道: > On 12/04/2022 8:25 am, Tong Tiangen wrote: > [...] >> diff --git a/arch/arm64/include/asm/asm-uaccess.h >> b/arch/arm64/include/asm/asm-uaccess.h >> index 0557af834e03..bb17f0829042 100644 >> --- a/arch/arm64/include/asm/asm-uaccess.h >> +++ b/arch/arm64/include/asm/asm-uaccess.h >> @@ -92,4 +92,20 @@ alternative_else_nop_endif >>           _asm_extable    8888b,\l; >>       .endm >> + >> +    .macro user_ldp_mc l, reg1, reg2, addr, post_inc >> +8888:        ldtr    \reg1, [\addr]; >> +8889:        ldtr    \reg2, [\addr, #8]; >> +        add    \addr, \addr, \post_inc; >> + >> +        _asm_extable_uaccess_mc    8888b, \l; >> +        _asm_extable_uaccess_mc    8889b, \l; >> +    .endm > > You're replacing the only user of this, so please just > s/_asm_extable/_asm_extable_uaccess_mc/ in the existing macro and save > the rest of the churn. > > Furthermore, how come you're not similarly updating user_stp, given that > you *are* updating the other stores in copy_to_user? I think all load/store instructions should be handled. Generally speaking, the load operation will receive a sea when consuming a hardware memory error, and the store operation will not receive a sea when consuming a hardware error. Depends on chip behavior. So add store class instructions to processed is no harm. If there is any problem with my understanding, correct me. Thanks, Tong. > >> + >> +    .macro user_ldst_mc l, inst, reg, addr, post_inc >> +8888:        \inst        \reg, [\addr]; >> +        add        \addr, \addr, \post_inc; >> + >> +        _asm_extable_uaccess_mc    8888b, \l; >> +    .endm > [...]