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 C43B6C36014 for ; Thu, 3 Apr 2025 02:37:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 99224280003; Wed, 2 Apr 2025 22:36:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93E70280001; Wed, 2 Apr 2025 22:36:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B8BF280003; Wed, 2 Apr 2025 22:36:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 5DE31280001 for ; Wed, 2 Apr 2025 22:36:59 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 36F47140B91 for ; Thu, 3 Apr 2025 02:37:00 +0000 (UTC) X-FDA: 83291170200.14.A58C99F Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf03.hostedemail.com (Postfix) with ESMTP id E4C902000B for ; Thu, 3 Apr 2025 02:36:56 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of tongtiangen@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=tongtiangen@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743647818; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XZv1gSCoqPkSvuRo5CdsTOUa2UhovNSLORAb5XIYnJ4=; b=rKJ+qkeB9Qx8nOy7WeR5469eawnmlIjomimZiYZ+yBBdJeyRF+9POXyrqBm1aqHkaKWw2f vg3kCtXwik+ydW/nz/aYw3a0U0wbsdy4DooNJdrRrVO15VZWv1Ccsi5ulAnI323G+1t22v ml0OUthIQV39pXPCDYME5ddcbGx1BDw= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf03.hostedemail.com: domain of tongtiangen@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=tongtiangen@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743647818; a=rsa-sha256; cv=none; b=muMKjq+b2YF+9WXwIleDWO48pYheSkMHv/AjMqTOxhhvHoby+yOqn7AABK9Dr7xcz3L0G1 IGU+bIybedvGF+T/TAGTuvlw25/8Qips75zZIxXnnCxWXccc5GOzStwsHwxPEYsSzBfiSI 4kO00cwzvu/BqNeg2ePhNcv8GCTT/hw= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4ZSm842dzTz1d0rb; Thu, 3 Apr 2025 10:36:20 +0800 (CST) Received: from kwepemk500005.china.huawei.com (unknown [7.202.194.90]) by mail.maildlp.com (Postfix) with ESMTPS id D73ED140383; Thu, 3 Apr 2025 10:36:52 +0800 (CST) Received: from [10.174.179.234] (10.174.179.234) by kwepemk500005.china.huawei.com (7.202.194.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 3 Apr 2025 10:36:50 +0800 Message-ID: <78f82bf6-ec47-6b10-7c05-2189cc262f13@huawei.com> Date: Thu, 3 Apr 2025 10:36:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v13 2/5] arm64: add support for ARCH_HAS_COPY_MC To: Yeoreum Yun CC: Catalin Marinas , Mark Rutland , Jonathan Cameron , Mauro Carvalho Chehab , Will Deacon , Andrew Morton , James Morse , Robin Murphy , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Michael Ellerman , Nicholas Piggin , Andrey Ryabinin , Alexander Potapenko , Christophe Leroy , Aneesh Kumar K.V , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , , "H. Peter Anvin" , Madhavan Srinivasan , , , , , , , Guohanjun References: <20241209024257.3618492-1-tongtiangen@huawei.com> <20241209024257.3618492-3-tongtiangen@huawei.com> From: Tong Tiangen In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.234] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemk500005.china.huawei.com (7.202.194.90) X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: E4C902000B X-Stat-Signature: o661a5rt7ajeoce78887keayu8m3dwdx X-HE-Tag: 1743647816-117925 X-HE-Meta: U2FsdGVkX19cm/h9MeRfub0N77f7IiRZUTdghwdhSgrDnSNxy3SVdm3EyK551cwwWSnCgrWiV6m0bt6KonXPP4l9S9e/HlZcK7uUD741MIBRpk1vPwgbPvQx2eE7iH6Q3snd2+ig/3uQaMrTJt2KW0MbdlnpYILaBY3bCqytsSC73nCKbzjFSlfwuRs8GxZ+LwDv1CAhTRaBFIi2RNou9vTGxE5QXq9jv29YCr03UMHLfRT0Bu/sC4kqrQqokC42Uivzl8JJeqeRmic+7gdcq4bLMYaaDNH3Sb2ryCvUUTaUyyWKDDfJC5fjxW0yc1cXWAigC8r0Q3j6bfuRdkLJDeUe+x0AqKPCC8yqLD+gAzLiWTIrK5xxzx2a/y1zGPmdr9D48cUD6y+RtpLYwOZ5fRCNTEnXlrbqMDOiLYoEk4xHQVHzwLyEnOE2cUnPp7j1ieLWNTw/NhgrAI+lq0ul4KOsXOXUzntqbDO6+suJ4JiWg3Sz6tJ9bfzGpJAFWsf6w07ALKMsv5U/AX1U+6noVmv/iwTuLr+dzfu+qrDQR5M0kSLVpb3st1VEbJEoR2xvRjH/EhdMwV8b9kzuheFlk7E32VSZisOpTZbiUmd0+/xqJIcI1FdudgQWndlEFyfrC5989cvyuGpSHv10gX7hVEzAiR9oQaWEKVT8RxirN8ellK7ZyIaDxOSxVyEvQJlE6VCWFDSllYCsdu+tE2VLIoROx1x5QVZWnqMPYKafST0mYxE2VsnRt90FNXCkmT8M17JpPWEIxzDye7vnJejOViPrJjNPTMYLHVZfP7DhjEJ1tnPLXZtY1HEWP2nF4WRX0ZA+jD/1XgTNYDU3gR32jLMYbcKTT3J/3dEpbwyOuDLmDxFBOvHpma1+LLGx0W/RRO695vUTD85AXHb0iDc3XcfOwCcbU+NaNxdGZCmkOIvaXLqA/m/5IzyQgNaItO3WyAbhzh0h+QR5Skg3Bgg DjRoYvwv Rhl/nzbT91DxbRXILUeI3VGjApWtmGBCgglxuF99NkEmP0VBw9qyqCsGRLGUK+iGGTZGFF51aKiXBHIYgHmxdmOfZ8+O1Sbth7W0ekY0piQ9IYnpiKMxIOk+VBZaQYmenJJqgtwCXdB5AvUQHUO0nUdtnssLzZaWSUZmWgAZn2b5RIiCv855mhq6VT3Lk6E8gHz13hlQFDJObZ22Y0pMuLMHspy6iftR6wDBtkTd2dq03rBSMuL+HgHqwpeAKCIKrWgWH0SwlAI+ZyroP004+up/UwWvMUJfo2rIY+ipA49k+T634Eh4yfiFai6a8O3rMRkwZxYWN8Iks0no= 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: List-Subscribe: List-Unsubscribe: 在 2025/3/29 1:06, Yeoreum Yun 写道: > Hi, > >> >> >> 在 2025/2/13 0:21, Catalin Marinas 写道: >>> (catching up with old threads) >>> >>> On Mon, Dec 09, 2024 at 10:42:54AM +0800, Tong Tiangen wrote: >>>> For the arm64 kernel, when it processes hardware memory errors for >>>> synchronize notifications(do_sea()), if the errors is consumed within the >>>> kernel, the current processing is panic. However, it is not optimal. >>>> >>>> Take copy_from/to_user for example, If ld* triggers a memory error, even in >>>> kernel mode, only the associated process is affected. Killing the user >>>> process and isolating the corrupt page is a better choice. >>> >>> I agree that killing the user process and isolating the page is a better >>> choice but I don't see how the latter happens after this patch. Which >>> page would be isolated? >> >> The SEA is triggered when the page with hardware error is read. After >> that, the page is isolated in memory_failure() (mf). The processing of >> mf is mentioned in the comments of do_sea(). >> >> /* >> * APEI claimed this as a firmware-first notification. >> * Some processing deferred to task_work before ret_to_user(). >> */ >> >> Some processing include mf. >> >>> >>>> Add new fixup type EX_TYPE_KACCESS_ERR_ZERO_MEM_ERR to identify insn >>>> that can recover from memory errors triggered by access to kernel memory, >>>> and this fixup type is used in __arch_copy_to_user(), This make the regular >>>> copy_to_user() will handle kernel memory errors. >>> >>> Is the assumption that the error on accessing kernel memory is >>> transient? There's no way to isolate the kernel page and also no point >>> in isolating the destination page either. >> >> Yes, it's transient, the kernel page in mf can't be isolated, the >> transient access (ld) of this kernel page is currently expected to kill >> the user-mode process to avoid error spread. > > I'm not sure about how this works. > IIUC, the memory_failure() wouldn't kill any process if page which > raises sea is kernel page (because this wasn't mapped). right. > > But, to mark the kernel page as posision, I think it also need to call > apei_claim_sea() in !user_mode(). > What about calling the apei_claim_sea() when fix_exception_me() > successed only in !user_mode() case? This was discussed with Mark in V12: https://lore.kernel.org/lkml/20240528085915.1955987-3-tongtiangen@huawei.com/ Sorry for didn't catch your reply in time:) Thanks, Tong. > > Thanks. >> >> The SEA processes synchronization errors. Only hardware errors on the >> source page can be detected (Through synchronous ld insn) and processed. >> The destination page cannot be processed. >> >>> >> > .