From patchwork Fri May 24 21:53:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jane Chu X-Patchwork-Id: 13673757 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 0859FC25B79 for ; Fri, 24 May 2024 21:53:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 760BA6B0085; Fri, 24 May 2024 17:53:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E9C46B0088; Fri, 24 May 2024 17:53:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 589596B008A; Fri, 24 May 2024 17:53:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 35C146B0085 for ; Fri, 24 May 2024 17:53:26 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id DC59D8079E for ; Fri, 24 May 2024 21:53:25 +0000 (UTC) X-FDA: 82154641170.19.54293CE Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id E4ABE1A000F for ; Fri, 24 May 2024 21:53:22 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=BljuSLIh; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf19.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=1716587603; 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=fT0mhbFhuyfEQ6ht8rgkYeHmF9I9tk49P2eL39tTz8s=; b=AQmK2FkySITUsDOmEejKOrYe6tec5RwxKpKgDQTPqueeJKxDexTvjm7b8a7i6Zc9KbSJgk tF4vz4gOvHW32XFbkbD+q/e/QpgomxMas6V2L8S7Hdyj1oZdFxh6DQeSAPO7HJeN5u5n9j g66lH2h6iQOUrctFcD0rQfoVAgaysa8= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=BljuSLIh; dmarc=pass (policy=quarantine) header.from=oracle.com; spf=pass (imf19.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=1716587603; a=rsa-sha256; cv=none; b=eaOwGbC+eFv5Z2fSq+4oXXRX+g7OwDfAJsrS6AT2Jgpx+E3LaviF4UQPoUx1WRkafUABHj iO/wHSl6xBIulzdqxbOE7ZE6K5h3BRtMPqxrCftbILs3jZV+EsuFX93Kf0gm70pohDHBh/ Yde96bv6nGrT8g+scI5rWIrxT6pJkdI= 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 44OIC2G4010959; Fri, 24 May 2024 21:53:16 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=fT0mhbFhuyfEQ6ht8rgkYeHmF9I9tk49P2eL39tTz8s=; b=BljuSLIhlHGj7+LZ9Fli7rwBFZcnSBIe7v8KKY5KV9Egm878l/J+VHH1xWXi8MoITsjp kT67s5ZBWYovpiWSkPQxGbIwGh+5yy25XDlcrS7IqgZ9tN0mFrep4btWoUP617Ak5UwF sTEf1cmEmBTiT8VL57c+SmsN5qxe07nReb5HNVL5rwTPrbgy0wl/Ttqd6Z8n06tl1pVH HdzgUAqITKS24dJjoA79lJp1QDcgdImTdegcU//MdKMPwvcgJP/0B0onuBIUPpJovgzX pz9xGdxlLjYOQDg+Can6zxaztk9PTsD2n/ASTnnqIZl4vJeJO5E5vl1qonSnInCZDOij 6w== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3y6jx2n8wy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 May 2024 21:53:16 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44OLjG1A035956; Fri, 24 May 2024 21:53:15 GMT Received: from brm-x62-16.us.oracle.com (brm-x62-16.us.oracle.com [10.80.150.37]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3y6jscbsu0-3; Fri, 24 May 2024 21:53:15 +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 v4 2/5] mm/madvise: Add MF_ACTION_REQUIRED to madvise(MADV_HWPOISON) Date: Fri, 24 May 2024 15:53:03 -0600 Message-Id: <20240524215306.2705454-3-jane.chu@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240524215306.2705454-1-jane.chu@oracle.com> References: <20240524215306.2705454-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-24_08,2024-05-24_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405240157 X-Proofpoint-GUID: 7grlyNM4N9_MwCVNy18sOMTXeKd1BPaf X-Proofpoint-ORIG-GUID: 7grlyNM4N9_MwCVNy18sOMTXeKd1BPaf X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E4ABE1A000F X-Stat-Signature: nmomtt67mq4xgkzbgcu1xx8f4ur9oosw X-HE-Tag: 1716587602-811809 X-HE-Meta: U2FsdGVkX19iPIne6F0waBIkZGzRYjeJdnZlBJdGIDcFSmBMyV0fCvwIMESRGBRXNqUjD+iEiNmTSHlU9YZhQ0341jzgXsHYuLA1t97PWYzePZ6jAid8Mm/vkoZUfkBbUvlytWEEmeuMTORi4Jj5h7mRrcfA2i1r4DvN7sHU5+Fk3SjKZzOTZh33gXBeo5skMB67h9LPBAD4+pl36DZjNeiP+3x1xZJXCJ/vPfiXEA0nLvYXQAz3ob3QLwAePNyNNF17UyhCDbiRVdNkPt6JBqeFL/7TFRZ4J3GlE7KlpO8bq9CJ4ujrGe0sSX8iEVwr6kIObAN4g1u5Bo2JZUXcVFFkYdbO6+ThnY4ERyG/BPAy8Yc4LQ5sEHrIGqowHPeIM4spBVvUFE0cxObYziesr1sZVjBgRHG+sWTa2RnAuD28zhZvA+34eNp+vNj7UOaVHQ4S6JnghaprMSOPFcuU1oMQsRx17WrrkuPeOziA6UqVLYNVehqLwObw3U6jzSa6s1H8KfW6lqu8phnHMwmmPa8NoiFYIEeZRP6SZkjJVrcWrP9kRSTXCse1wBLsh0YnOa7FFgK2B2wogL+qFl6cJhAJCMyUVBU/4AfCElU/IXFvsEn92RZeG9R7HXF2vB0+YIKWHjUhdAM9AUoqkBfDA3UB99xYxwARMUBwCtjo9AZi+UmRK8LHKsLsXyddX0OTez7hsGPrzFayVRww2l05eRs6QZzyf1sZbBapL8IH/YbGiO+n64GooqDdRotAz2B3qUv90+zqXXD3wfPL5kPcIiomxhFfWNg9OuykBJuRQ7n27lY1QS7qX0KhMcXro+8m/dtrwnfGDxyFV1tklvuU7W0KuGH1tjpK2Yf6Av5pzx/G2f2sUWEOVJ2OXHRwtGaUBF43Y9M4dpIenvC+0Y1H8EGOY9q5elEutfMqugrjsZzk5HhxqcWqz07ICYzd7bAP6eR4rTmhpR4tI9UTcIw rt3+HLgH 9pLQPHkuoQPi5BQncjHURrWudVdnigVCWaesKPYcsg72ID/jD8znQQRKv3/slSwfXgVwfQMIA4cUANNPq6/V1YHPBjYPfkh6dj0WQuHI0h2cxNTyzIsrzJnJXmzhFMvo5XJBp9TfgjEH/23JWbmI085aY/XLVGjt/hyRy7op86q0C/iQmxLKmLflI7jpZ39P9cthEytTb1RIFuVpX3L8Bd+sJlcmA1seNpw4u5noXNMY7huktNOnkORR3PyoVMTBOz2JLgj8cbPNCPabpEo1gkOy9RsqUVVxDyrjnIsY6Q6inIed9lXD0kQHojVv9A6eoMcIuQ6nsqH00UGLV76T0/sthrclLoZOeLgmr 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; }