From patchwork Tue May 21 23:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jane Chu X-Patchwork-Id: 13669815 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 C410EC25B74 for ; Tue, 21 May 2024 23:55:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 547C76B0093; Tue, 21 May 2024 19:55:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CDB06B0095; Tue, 21 May 2024 19:55:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 370186B0096; Tue, 21 May 2024 19:55:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 14ACE6B0093 for ; Tue, 21 May 2024 19:55:14 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BDDF712103D for ; Tue, 21 May 2024 23:55:13 +0000 (UTC) X-FDA: 82144061706.15.3435076 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf12.hostedemail.com (Postfix) with ESMTP id C4C6D40018 for ; Tue, 21 May 2024 23:55:11 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=g6cUrmqR; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf12.hostedemail.com: domain of jane.chu@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=jane.chu@oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716335712; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uGf2vROyvg6ZwMJ/Hw9eQH29lzC7eJMyJb27dxpCla8=; b=L07g9nwSEoep9MnR0sLLpyDjvF2DOiKDB7iHpZiXc9dNDtojvWfxDT6QkBdYBOtQLmscpx R3Iuf0wGY5Y6HNko9/MsiA7CuMAn995XOklR5w6an2x2bKFgO77GMIpbhMZE4ZQXArsglt Ta0+Rqp4oyU0gW4jnSe4dIUBv20OoEc= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=g6cUrmqR; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf12.hostedemail.com: domain of jane.chu@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=jane.chu@oracle.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716335712; a=rsa-sha256; cv=none; b=Cfi3GaRvm3BBfeR9/KQImSnSAK6YKbWcz/EeuEQJnpoa4q008Cbi79W1LsQ6cdinwk9ocv 4f91uFW0HjOQIuJZrBuxG1n+ZJ16RpE02IYT3t6GlTa5A77y/kES4TKjMqTzgsrN9zGMbF QQFEjFTXFYl3MAxSqQ1DyznAHr3AaCg= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44LJkCvG016732; Tue, 21 May 2024 23:55:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-11-20; bh=uGf2vROyvg6ZwMJ/Hw9eQH29lzC7eJMyJb27dxpCla8=; b=g6cUrmqR0x6RsZLklZW3C4yPOprOOlqOabivyLBi5K34GjPi1uBH4gEk33FmgbZijwgo yL5DHU5SbsvaTOe2Mpsin+IDSQyt3m5kix9y2mHjY1GsheO09ZlAvUT0wTGZ9q4ZHMc4 SCMHgSJDmicGy1fnDevChzwRdfStdVdgExvqtnuDDeR7s24DtvJkXfIXJIQ7VbklfuGo xNvCuTtvOXVZvoPsFT1Xdb0PH4SfStl41HmzY0K/Rov+ETG5RUKOTOL4kt/WiPD1pzaG ktn4cwsBAGqOdsUapynVBGGDWyfDHn8rYty9cHDU5+MHNSFB930W16IhsUwIeoflVuCx bQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6jx2efc5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 May 2024 23:55:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44LMZkKT002667; Tue, 21 May 2024 23:55:05 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3y6js8erce-3; Tue, 21 May 2024 23:55:05 +0000 From: Jane Chu To: linmiaohe@huawei.com, nao.horiguchi@gmail.com, akpm@linux-foundation.org, osalvador@suse.de, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/5] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON) Date: Tue, 21 May 2024 17:54:26 -0600 Message-Id: <20240521235429.2368017-3-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240521235429.2368017-1-jane.chu@oracle.com> References: <20240521235429.2368017-1-jane.chu@oracle.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-21_14,2024-05-21_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxscore=0 adultscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405210181 X-Proofpoint-GUID: s8TZqutMV_sNhtOaqmw9r6gFiSZXwMpt X-Proofpoint-ORIG-GUID: s8TZqutMV_sNhtOaqmw9r6gFiSZXwMpt X-Rspamd-Queue-Id: C4C6D40018 X-Stat-Signature: i7mbi8fbhgicmj9qyczf673obeobzs7y X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1716335711-349898 X-HE-Meta: U2FsdGVkX18Fz+KgQFo35TRsb6PsWrEsWB04WK4SN01+DVxUks/E7xa0XzBITvNaKdvagcmLQ4dp2KCBGnF9tpfZUaoXhZRqC5I43LdP5nu1hOLs3JRt737EWGtu0wYAmFrcIRY9CRxyk8vB8lJOAGbKNcwfbmwWGtqFZpveBWF/LXsfDo/eqIsIczUL9+M3Z3cufCmjRjdnDZgxFbJxuXah0+cVoc94WGgiJr0A41cxSv1PAswJW1MPhCucmQazcs5TFYvYZlDKVweO36Fp99OKalxvIRl/I99dMZdAz2AoYCjZck+H61Wx6cKjQYd/oxcEZ5SyklvmKdsyOem/DTXZvrQLui+PPmflcvl7NuXC2WHgzh4GAvQ1lg0tckOCBl7u+uQprOR+0eOCiWYqzFepMXDHFK2GKmv8S5mSkMD1fcjG9GOPeKDdvLFM0tImJoJGveOW6T16HZySfWElnZ6TyfH5IGFTF2BvtKa9i6XEm+pXiVmlZSqrirT72yOZ7Lhlwiq0R3mB5OrcqnPEVFzBMoLvAL7FTju9WNq92nKgqyMZvAvWJ77bNhKVwyXeIZSwoAx3tEr5B62ko2xmBGLejK9KYxuJui7BCXl9Iq0AbfDNH0+JvkJTy6RRFI9YTdlhZar+Y9DM4y/uJyzpqPIeidF/ieYYuLKVejqjWxt4Q0Fd2uA9Ka6MXwNg3ClChEmHsFe2I/HxKEqL+KH1m1sijT2LO7E+S3o5uwXe6gd+/UHCigh/v2oSMrCiGGAB1kHFWD0kDhVQFTlnJ5mN8CN1QyIFnONkgVA4Kgw2MRGrEKLdFd5/LEI5rZ/rhlOftPTGEzoRDK/X4dV743f1LW9Jt+LZ+ymZCutlIvuj3ZTSu2vjGQHS+eVsrVqDgzKzlFLwZVFbxjP9pNwoKQWhQxnJtiQ7x8aG/u8NDs/4vnnB0V0BVJ4bCKadyQHoZoWVAFW+a+CyEsiS1ezUybf axlL8bDq l58Qy1oxRn4R3AUDQuMzGeHVZmhI1oUEfahgWrERX3r7NfYFynRVCUTeg64EIFAgk6BnfkjE1zXviDPXbQ4SLOXvQJDBJ5VdhrI0oHOk2pedKasRFFwz3sHmd/1Tt1YPJZ5tSKz7OhL4vm41pE7lL/ya0ewzsmZgX2g1AqfDgKovIQLxqIYnyDaJDoBT64IEyMbUzAUDQT3e5LQVGLDcsFe5pec2PsHomKsDr72GftMWhoAP83DZ51oXnfVskPSMdM0zK0S4lAmGUrIuA6dR1KteHlZh+4WS8yb+ncwcvMrwEJljfHJ8crW2mtN902+4wLGFkDnlfk6/29cc= 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: 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 get killed as much as in a real UE situation. Doing so align with what the madvise(2) man page says: " "This operation may result in the calling process receiving a SIGBUS and the page being unmapped." Signed-off-by: Jane Chu Reviewed-by: Oscar Salvador Acked-by: Miaohe Lin --- mm/madvise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/madvise.c b/mm/madvise.c index c8ba3f3eb54d..d8a01d7b2860 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1147,7 +1147,7 @@ static int madvise_inject_error(int behavior, } else { pr_info("Injecting memory failure for pfn %#lx at process virtual address %#lx\n", pfn, start); - ret = memory_failure(pfn, MF_COUNT_INCREASED | MF_SW_SIMULATED); + ret = memory_failure(pfn, MF_ACTION_REQUIRED | MF_COUNT_INCREASED | MF_SW_SIMULATED); if (ret == -EOPNOTSUPP) ret = 0; }