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 01670C04FFE for ; Wed, 8 May 2024 07:58:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87DE36B00AA; Wed, 8 May 2024 03:58:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82D766B00AB; Wed, 8 May 2024 03:58:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 728036B00AC; Wed, 8 May 2024 03:58:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5390A6B00AA for ; Wed, 8 May 2024 03:58:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 08FF0A1E67 for ; Wed, 8 May 2024 07:58:12 +0000 (UTC) X-FDA: 82094475624.20.5EC69E1 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf08.hostedemail.com (Postfix) with ESMTP id 0B784160007 for ; Wed, 8 May 2024 07:58:08 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715155090; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xh+Dcr0SJGbRhS+EypJz1zf3usZaN+BfoBzFX4IhBCE=; b=Jm//D41Z6fWSVt8Sbdo3acFBp/WkhY0U702oyKF/xgCbh1gDB4POiDkP+tGa3jXqbsI03i z+AdGVFwDO20lAV0MlC8xXxyXlO6Bj+NlPvCM8SMs3KyR034Dgfxc8LO6N1VJjk23cybM1 Ike4q0FikV+FHk+foTGTingGk05lhKw= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf08.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715155090; a=rsa-sha256; cv=none; b=v2VDdp9Ecd+pJsV9dKpY91JNYSBBXntpL6NHmb2jFX2I/tKjL4n/KXzUz3XnP76HL/uFI6 Y1yLP1erhvcUS+twAOpejXMYQ1rfGWDDLxM3IdF90JCWO1ui1fqMV9rOkFiPTzgTsk/28/ JjHba1nkGyY9K0DcCXfpcRj/dctAIzM= Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VZ6qf53pwztT2C; Wed, 8 May 2024 15:54:38 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id A72751800B8; Wed, 8 May 2024 15:58:04 +0800 (CST) Received: from [10.173.135.154] (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 8 May 2024 15:58:04 +0800 Subject: Re: [PATCH 2/3] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON) To: Jane Chu , , , , References: <20240501232458.3919593-1-jane.chu@oracle.com> <20240501232458.3919593-3-jane.chu@oracle.com> <0c7dbf7d-dcb6-f9f2-4a2a-9700ea465a47@huawei.com> From: Miaohe Lin Message-ID: <0268cba2-807c-d7c8-952f-a81f52d45d15@huawei.com> Date: Wed, 8 May 2024 15:58:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.173.135.154] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0B784160007 X-Stat-Signature: w9m6nknwtwkhdaktod9grqf8urma8j3z X-Rspam-User: X-HE-Tag: 1715155088-345974 X-HE-Meta: U2FsdGVkX18gsc27uub4OaHb4XGLrkPgLLg8jEwMP0I+OX55qpxYBEtcNhepiT0t5GXVDVe9Kflr5DX45vMeE6V59Qr3gsyVM0MWXabmUUycMGQApyUr6F5UEMvBK+RR7N6vqEg4szJs3PWg5bO/3p7XFISOVb7BhQvECSKaoPujU6SPlnMD0/nyHZikHXEKn5HD1UJ4da3abqbkv+XBRO9rvgiNZCxus+0KCuhse/QmUKmqRV4zi5AMSYxtYQc4Z4PBW7uhhbDHDVPAiACiO5JsMQ747ghByDFndQ4qG+Ja86EAuyukOgGYK6dS+Yra9ialN4nByDBjqDg3SOk1RO1t/LTCqY7QOMrkywEb/IvfAvgo4HVPNkttVz7q8snOpR6Aa2zA6Zy78qbn0SuC3FRbyBWI3kQXLVbeqa5yZ4wta9hxxBMYSHV8HKsVzRvWAHazsrSA2mOZ/TNfNUBBdqh3s9APJ/rpCUy4irYfxO1EXazMTTnDbV7opPlEPVFNv25FUDOn++t7G9ixdDwyGM2KZwKxDq+Lu1mETdRHIi/ZYGUAWjhzXgT8z/cXwbZKbOvN+cbZZm3M20Sr8rA6ZPzD0bPQLHcpkXSYbA7XGxExYuvztE5SeASxuGRQZbTMwBuzT3vIcN0lB58Hv1GdsCjNzuuK9EQaAy/rRacraC8q+9nBytyS0hFMj3xAXFA4hQlbJ4bVEz6+/LtdgUQz+Q/OHYF3q5OpMFrSU8t80mZtYJX2JxST1HzPaRlI8UNP8BuUjZ8elhWFalNGlZTkaI0CzOJglnvn9cMcQ6ojlP2lQYRCMMI/HYQu3X4afMSK/pGsauYnEYFMNc1BJSZ2XoCZXY3wH4K3a9cgvhP1eTp4Bj0asPPhplkcXvNCvHNDs/BAtWHY73gNN/7JO/8Ck7jS36ZftnwUVPzacxUSimuFE4VKOkWO++nATjW7xaZbFBUFBDVH3QPoYCc/H/A 5TsIwQDB tj/XUyqOrLLCfIhJHUtL8tEtaJLoCC2v/Q+fDIjLxBCv15f+vzIwjCuhJxt9z13ZFxwSTkH3lZ/nGWkwJH4a8axWwAwdXI1Oh8w1s0BDyxGmbsHknSD+sW2VXLwNJAvDtl9wRbwk8KFKig9KgpZW0iP2xLvviOs6UyjlsIm0LRLun1RCTz8WMz1n3TLsFLj3g9Qwp6N/xQ9xymMtvw8vf0AAxQ03Iw1jt46X2GeipdpGVQPUeRteWXbQ3WVc7n1u5JK+0yP3EugF8aFt3MkxFO9+sIg== 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: On 2024/5/7 3:54, Jane Chu wrote: > On 5/5/2024 12:02 AM, Miaohe Lin wrote: > >> On 2024/5/2 7:24, Jane Chu wrote: >>> The soft hwpoison injector via madvise(MADV_HWPOISON) operates in >>> a synchrous way in a sense, the injector is also a process under >>> test, and should it have the poisoned page mapped in its address >>> space, it should legitimately get killed as much as in a real UE >>> situation. >> Will it be better to add a method to set MF_ACTION_REQUIRED explicitly when inject soft hwpoison? >> Thanks. > > So the first question is: Is there a need to preserve the existing behavior of  madvise(MADV_HWPOISON)? > > The madvise(2) man page says - > >        *MADV_HWPOISON *(since Linux 2.6.32) >               Poison the pages in the range specified by/addr/  and/length/ >               and handle subsequent references to those pages like a >               hardware memory corruption.  This operation is available >               only for privileged (*CAP_SYS_ADMIN*) processes.  This >               operation may result in the calling process receiving a >               *SIGBUS *and the page being unmapped. > >               This feature is intended for testing of memory error- >               handling code; it is available only if the kernel was >               configured with*CONFIG_MEMORY_FAILURE*. > > And the impression from my reading is that: there doesn't seem to be a need. > > A couple observations - > - The man page states that the calling process may receive a SIGBUS and the page being unmapped. > But the existing behavior is no SIGBUS unless MCE early kill is elected, so it doesn't quite match > the man page. > - There is 'hwpoison-inject' which behaves similar to the existing madvise(MADV_HWPOISON), that is, > soft inject without MF_ACTION_REQUIRED flag. > I tend to agree with you. It might be a good idea to add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON). Thanks. .