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 X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HK_RANDOM_FROM,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43A1DC433B4 for ; Sat, 17 Apr 2021 05:48:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E35DE611C2 for ; Sat, 17 Apr 2021 05:48:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E35DE611C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kingsoft.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3EBAA6B006C; Sat, 17 Apr 2021 01:48:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 39D4F6B006E; Sat, 17 Apr 2021 01:48:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2173C6B0070; Sat, 17 Apr 2021 01:48:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by kanga.kvack.org (Postfix) with ESMTP id F0CB06B006C for ; Sat, 17 Apr 2021 01:47:59 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 8B2D88248047 for ; Sat, 17 Apr 2021 05:47:59 +0000 (UTC) X-FDA: 78040777878.12.E1ED963 Received: from mail.kingsoft.com (mail.kingsoft.com [114.255.44.145]) by imf07.hostedemail.com (Postfix) with ESMTP id BB963A000381 for ; Sat, 17 Apr 2021 05:47:56 +0000 (UTC) X-AuditID: 0a580157-f07ff700000551c1-47-607a76884173 Received: from mail.kingsoft.com (localhost [10.88.1.79]) (using TLS with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.kingsoft.com (SMG-1-NODE-87) with SMTP id 5D.90.20929.8867A706; Sat, 17 Apr 2021 13:47:52 +0800 (HKT) Received: from alex-virtual-machine (10.88.1.103) by KSBJMAIL4.kingsoft.cn (10.88.1.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Sat, 17 Apr 2021 13:47:51 +0800 Date: Sat, 17 Apr 2021 13:47:51 +0800 From: Aili Yao To: Naoya Horiguchi CC: , Tony Luck , Andrew Morton , Oscar Salvador , "David Hildenbrand" , Borislav Petkov , "Andy Lutomirski" , Naoya Horiguchi , , Subject: Re: [PATCH v1 0/3] mm,hwpoison: fix sending SIGBUS for Action Required MCE Message-ID: <20210417134751.0bee9e73@alex-virtual-machine> In-Reply-To: <20210412224320.1747638-1-nao.horiguchi@gmail.com> References: <20210412224320.1747638-1-nao.horiguchi@gmail.com> Organization: kingsoft X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.88.1.103] X-ClientProxiedBy: KSBJMAIL1.kingsoft.cn (10.88.1.31) To KSBJMAIL4.kingsoft.cn (10.88.1.79) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42LhimD01+0oq0owePCUy2LO+jVsFp83/GOz +Lr+F7PF5V1z2CzurfnPanF+11pWi1Xz7jBbXGw8wGhxZlqRxZsL91gcuDy+t/axeOycdZfd Y/Gel0wem1Z1snls+jSJ3ePEjN8sHi+ubmTxeL/vKpvH5tPVHp83yQVwRXHZpKTmZJalFunb JXBlHG2+xliwS6yifelhtgbGc4JdjJwcEgImEj8WvmDsYuTiEBKYziQx4+psNgjnOaPE38UL mUCqWARUJbYsnMoMYrMB2bvuzWIFsUUEdCUmbOsF62YWeMAkMf/0TjaQhLBAqMTl7ktgNq+A lcS+NTvBBnEK2Euc2XaIEcQWErCT2Nm4CszmFxCT6L3yH6iGA+gke4nH6xUhWgUlTs58wgJi MwvoSJxYdYwZwpaX2P52DjPEGEWJw0t+sUN8Iy9x9/d0Rgg7VqLpwC22CYzCs5CMmoVk1Cwk oxYwMq9iZCnOTTfcxAiJrPAdjPOaPuodYmTiYDzEKMHBrCTCa9xZkSDEm5JYWZValB9fVJqT WnyIUZqDRUmcVzu9LEFIID2xJDU7NbUgtQgmy8TBKdXAFMWbW/R5fvr9jKmPD7JpBOZP0Zo7 yaksxclpJ6vFM16zmj7n6tXm/CI1jbUrFHWjd0+bOvffi/mrBB7d0Gi6+jaPcdVUpnr3St/K Pr62A7s8t3c8mGp7x1mSp9ORZcvJnwcN9W6+2nB4zSrxZV0cZ5ifXtw0rYxl1v9UiwmNRtPY OJpn/zhhMOndhCTWoP0Z7bw19xjna/zoX2/5LZGNj6erujDyfWyX8/bfxjfvfWrOnbq0ene+ 7H7HDa+YujnmGLRmrAksTfzQLHeVW9Jwukb88k7jcPHjPA+fLm0XEZ1zfMaqy+WiIr2MCiku Dfs73m9a+bt6nVO16AolBq8rd3MUSjeLO6qLb6ji2hGoxFKckWioxVxUnAgARF3BthsDAAA= X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BB963A000381 X-Stat-Signature: wgwfgzshpp9dcrodufqq8tszxaxaujwf Received-SPF: none (kingsoft.com>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mail.kingsoft.com; client-ip=114.255.44.145 X-HE-DKIM-Result: none/none X-HE-Tag: 1618638476-694983 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: On Tue, 13 Apr 2021 07:43:17 +0900 Naoya Horiguchi wrote: > Hi, > > I wrote this patchset to materialize what I think is the current > allowable solution mentioned by the previous discussion [1]. > I simply borrowed Tony's mutex patch and Aili's return code patch, > then I queued another one to find error virtual address in the best > effort manner. I know that this is not a perfect solution, but > should work for some typical case. > > My simple testing showed this patchset seems to work as intended, > but if you have the related testcases, could you please test and > let me have some feedback? > > Thanks, > Naoya Horiguchi > > [1]: https://lore.kernel.org/linux-mm/20210331192540.2141052f@alex-virtual-machine/ > --- > Summary: > > Aili Yao (1): > mm,hwpoison: return -EHWPOISON when page already > > Naoya Horiguchi (1): > mm,hwpoison: add kill_accessing_process() to find error virtual address > > Tony Luck (1): > mm/memory-failure: Use a mutex to avoid memory_failure() races > > arch/x86/kernel/cpu/mce/core.c | 13 +++- > include/linux/swapops.h | 5 ++ > mm/memory-failure.c | 166 ++++++++++++++++++++++++++++++++++++++++- > 3 files changed, 178 insertions(+), 6 deletions(-) Hi Naoya, Thanks for your patch and complete fix for this race issue. I test your patches, mainly it worked as expected, but in some cases it failed, I checked it and find some doubt places, could you help confirm it? 1. there is a compile warning: static int hwpoison_pte_range(pmd_t *pmdp, unsigned long addr, unsigned long end, struct mm_walk *walk) { struct hwp_walk *hwp = (struct hwp_walk *)walk->private; int ret; ---- here It seems this ret may not be initialized, and some time ret may be error retruned? and for this: static int check_hwpoisoned_entry(pte_t pte, unsigned long addr, short shift, unsigned long poisoned_pfn, struct to_kill *tk) { unsigned long pfn; I think it better to be initialized too. 2. In the function hwpoison_pte_range(): if (pfn <= hwp->pfn && hwp->pfn < pfn + PMD_SIZE) this check seem we should use PMD_SIZE/PAGE_SIZE or some macro like this? 3. unsigned long hwpoison_vaddr = addr + (hwp->pfn << PAGE_SHIFT & ~PMD_MASK); this seems not exact accurate? 4. static int set_to_kill(struct to_kill *tk, unsigned long addr, short shift) { if (tk->addr) { --- I am not sure about this check and if it will lead failure. return 1; } In my test, it seems sometimes it will hit this branch, I don't know it's multi entry issue or multi posion issue. when i get to this fail, there is not enough log for this, but i can't reproduce it after that. wolud you help confirm this and if any changes, please post again and I will do the test again. Thansk Aili Yao