From patchwork Fri Jun 23 16:40:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13290809 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 990D1C0015E for ; Fri, 23 Jun 2023 16:40:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 147748D0005; Fri, 23 Jun 2023 12:40:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0822F8D0001; Fri, 23 Jun 2023 12:40:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3D1B8D0005; Fri, 23 Jun 2023 12:40:23 -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 D6EC38D0001 for ; Fri, 23 Jun 2023 12:40:23 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id ACAC8A0C95 for ; Fri, 23 Jun 2023 16:40:23 +0000 (UTC) X-FDA: 80934575526.05.BD7086A Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) by imf07.hostedemail.com (Postfix) with ESMTP id AC7294000D for ; Fri, 23 Jun 2023 16:40:21 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=34QbFsFB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of 39MqVZAgKCA0wvn3vBn0t11tyr.p1zyv07A-zzx8npx.14t@flex--jiaqiyan.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=39MqVZAgKCA0wvn3vBn0t11tyr.p1zyv07A-zzx8npx.14t@flex--jiaqiyan.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687538421; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Awz9MouaWvhYEsa6uGhopM2ZzPpu93glS/WPXSA5BTo=; b=fpa0C5k0laeyx//K5LP0f0BUAFruu4VuptKjpnOnYSIo5ZUraBCTDVLsKWWA3lhQmwVEaO UoMztWf+Aq52FKyl+2/Cua5MgwdnB4sTu9OIoOeanUWIS8bu6k3RkQzaE+SeH00rQ+whbU tQiQQ7IWXDglMg2Pkb4M3FPKhSzAvQs= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=34QbFsFB; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of 39MqVZAgKCA0wvn3vBn0t11tyr.p1zyv07A-zzx8npx.14t@flex--jiaqiyan.bounces.google.com designates 209.85.215.202 as permitted sender) smtp.mailfrom=39MqVZAgKCA0wvn3vBn0t11tyr.p1zyv07A-zzx8npx.14t@flex--jiaqiyan.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687538421; a=rsa-sha256; cv=none; b=WAxYwAqSfj5vBK6G3So0nJc/nbx9sZ2apPZProSicjP2ISwYt9rHDHqroSrFye1RcGQIdV NQQCrUY5vWzETWlxvmS+m9zwyVQI8ehD53I2352LMfNVXGoIac62GZTLDkDnxyAkLOfhuV H+vFwVEVHvemq42vBBOzqtEASPgSofs= Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-53fa2d0c2ebso503886a12.1 for ; Fri, 23 Jun 2023 09:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687538420; x=1690130420; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Awz9MouaWvhYEsa6uGhopM2ZzPpu93glS/WPXSA5BTo=; b=34QbFsFBy9aHUrBbbyPZvNf2E6cREYDEJ3OjWNnfkIABbwc6TGNrC1vrgVO6MW9NbF eqg/aLoYmKTPEpf/V4fsvvxZE2OH/jKO4vFZZEDXI9Fw9rFIdjqAghj7mM553FLclePO KLLFRlkp1ktiExq7SI5uSKhq1wmLqwGDDEZNOLOElvL4lS0kRfXPXgsWyOuJxhzdyMqv nNxyqnDxgcoLV/l2B8Oh7QU4LpW04N+ipd0x+tjGDQNo7DnIZ+46hlrSdKqHVfqSfpu2 IMvjSxyQLqGS45aGc7DQuYRsR+7dKrGsp2eRYXyTB07mxB+Es4MLo7hX+4zKOg4KauQE RrNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687538420; x=1690130420; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Awz9MouaWvhYEsa6uGhopM2ZzPpu93glS/WPXSA5BTo=; b=AS8+myiPeyEqrp6g9Du7S0Hae7GLD3QTdVl1p/KIgMBl0TwB/s8iBsX4NYZlZR3wl8 23mvPewfA6wq9pdSXVXarAHaRkjQ8M+aMurmSWWmfodYcIzmrU1gyz5v1wsW3K8GpWm7 tT+QOeTDRxUXFU6cIowrBazIEfzCIyjzcnir5xYEBpZWhjB8Ir7yzToxJiYIrohIX3eB oGrNFZumZXgd4/8TRqsBDdGDO64pIaGrt2etPjskA+d2ohTXBs62rTA05tvFpan+PwUv sa+mJfN4zSGIn1HqS9xG24LBODHQ38sfznSymO+eXH9A3iYGDHluQ6KjaROnTWc4yY19 osLw== X-Gm-Message-State: AC+VfDwvbjZMxz3DhHHBQMo9R33spJ600BbadOGXpzb3V2nQFFQtxqpp 8WboErWu7DJNetGXue/VDcf3yI+6IO+9HQ== X-Google-Smtp-Source: ACHHUZ5jab1Tbf6QleE2xBkm4fTrRupoObLUsNIdT3ISEaHPrxP1Xi1eIjnLCw3mlAhfFGWA7aDdu24vu/Y4Uw== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a65:6793:0:b0:553:9251:558b with SMTP id e19-20020a656793000000b005539251558bmr2555744pgr.8.1687538420513; Fri, 23 Jun 2023 09:40:20 -0700 (PDT) Date: Fri, 23 Jun 2023 16:40:12 +0000 In-Reply-To: <20230623164015.3431990-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20230623164015.3431990-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230623164015.3431990-2-jiaqiyan@google.com> Subject: [PATCH v2 1/4] mm/hwpoison: delete all entries before traversal in __folio_free_raw_hwp From: Jiaqi Yan To: mike.kravetz@oracle.com, naoya.horiguchi@nec.com Cc: songmuchun@bytedance.com, shy828301@gmail.com, linmiaohe@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, duenwen@google.com, axelrasmussen@google.com, jthoughton@google.com, Jiaqi Yan X-Rspam-User: X-Stat-Signature: mxwu84w8sgypea7x55chkg1o3h6tapr1 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: AC7294000D X-HE-Tag: 1687538421-817825 X-HE-Meta: U2FsdGVkX18ag9t/trC6d8WNysQDuMFQRCtB5sqfV1tj/pEWEyCFDTQfTbYMcOLhye2dJ7kImmDkjlsrKwK01vB4Stjukvy1eysoYqJmRwzsj45MRHsL7opkDlRxfXO92PxhwlWelpcO3lMvrJUyngVvwV0dyXWFFwCY8HI2VWr8qTF83BVcesGXEAiRdibIWFut/CgZNqrvm3MOM0NlNCfdoqeUiEll/gOagzxfJd53o1VmdVkL95qxzmoj8Z68bLXllSeSnRyDGemAkQbKCr3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IBUHpR4k5dR5ksIV/zMS2sbAeWZ58eK0+tXmw7DFKLNyvDzIE9ftPPHZ4Fo0kugR8QygXrXbVLzyJXLGuFmWiatqwkwLWo+MRMJp6G+jx3zh1RgtFtHg65Op+GSz2gsyICdohidf1ZEVTtwYGTKB3DuF3TVBMwKQw47odaLoBKtQ3ApsSepFnx/U9Cwrf6WQncCcV1PVOsRMohvFT2n3PVML8JKKIus6JE3d/I27dzJHHYi0AxZie2Q7JmrcGc5Jlctj36zpBMOrQIjDifPajYfMJSBBoKoAb+uzRAhV+lJohywqvrVpckvxUtuh3EIO+/X60eMlLA= 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: Traversal on llist (e.g. llist_for_each_safe) is only safe AFTER entries are deleted from the llist. llist_del_all are lock free with itself. folio_clear_hugetlb_hwpoison()s from __update_and_free_hugetlb_folio and memory_failure won't need explicit locking when freeing the raw_hwp_list. Signed-off-by: Jiaqi Yan Acked-by: Naoya Horiguchi Acked-by: Mike Kravetz --- mm/memory-failure.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 004a02f44271..c415c3c462a3 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1825,12 +1825,11 @@ static inline struct llist_head *raw_hwp_list_head(struct folio *folio) static unsigned long __folio_free_raw_hwp(struct folio *folio, bool move_flag) { - struct llist_head *head; - struct llist_node *t, *tnode; + struct llist_node *t, *tnode, *head; unsigned long count = 0; - head = raw_hwp_list_head(folio); - llist_for_each_safe(tnode, t, head->first) { + head = llist_del_all(raw_hwp_list_head(folio)); + llist_for_each_safe(tnode, t, head) { struct raw_hwp_page *p = container_of(tnode, struct raw_hwp_page, node); if (move_flag) @@ -1840,7 +1839,6 @@ static unsigned long __folio_free_raw_hwp(struct folio *folio, bool move_flag) kfree(p); count++; } - llist_del_all(head); return count; } From patchwork Fri Jun 23 16:40:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13290810 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 B60E6EB64D7 for ; Fri, 23 Jun 2023 16:40:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 035FF8D0007; Fri, 23 Jun 2023 12:40:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 00C778D0001; Fri, 23 Jun 2023 12:40:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E16108D0007; Fri, 23 Jun 2023 12:40:25 -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 CE7BC8D0001 for ; Fri, 23 Jun 2023 12:40:25 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9068D160C20 for ; Fri, 23 Jun 2023 16:40:25 +0000 (UTC) X-FDA: 80934575610.19.6F57B31 Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) by imf26.hostedemail.com (Postfix) with ESMTP id 37EF214000E for ; Fri, 23 Jun 2023 16:40:22 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="G/oR7IPV"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of 39cqVZAgKCA4xwo4wCo1u22uzs.q20zw18B-00y9oqy.25u@flex--jiaqiyan.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=39cqVZAgKCA4xwo4wCo1u22uzs.q20zw18B-00y9oqy.25u@flex--jiaqiyan.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687538423; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Im1IN1ikrfOM9Z5Ok/IoUeSFmmXZyMPCiNwLLRYtHmQ=; b=MQszuvYPo4M4xSumzt4boy6OveLuoJHf3eI2koCm2DKhT9cnxO01s2vM6k06MoUkukJQ3h 5AixC3AE9VNxwTqKlkeSE624n3PqqRuqtxodP04Q4NmXJ/vbkpqET7rCFo8lF8OvGgFDZe 8xyd9pI5TXJcQWmezXYnB4C4y05J3zY= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="G/oR7IPV"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of 39cqVZAgKCA4xwo4wCo1u22uzs.q20zw18B-00y9oqy.25u@flex--jiaqiyan.bounces.google.com designates 209.85.216.73 as permitted sender) smtp.mailfrom=39cqVZAgKCA4xwo4wCo1u22uzs.q20zw18B-00y9oqy.25u@flex--jiaqiyan.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687538423; a=rsa-sha256; cv=none; b=FrSou8HaaKDAyAfxCGSZKiFmj/ibJaUUylExA6jdGIIdOb92wsi4y+2u8o1fMWl8ukRALu 2k60E2RXIR8rQ7ldkiEyyzg6LYsbIQxsQp7vu6iBEEFDKKdLcYR7tEbHRek91Sjy1hnZuF ANFHIC3H3uAS4hHd1ohiW6VZGNz7cdM= Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-260a18f1b43so403714a91.0 for ; Fri, 23 Jun 2023 09:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687538422; x=1690130422; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Im1IN1ikrfOM9Z5Ok/IoUeSFmmXZyMPCiNwLLRYtHmQ=; b=G/oR7IPVEFTa1GT55h/HZHzutGu3XFeJ0x7CMVx0sQ3+iu4UkSa6QKG8Axe8YoI6ut f73cf7IUkzK073BhTuK3KODwM+XdHg/4/r/ugKvr2NDUxM1pyepVAp2riS8MYC6p3ycL A2dFBf9Sto7NcNpOUMSK12m/QRbu0JbpEfwyv6/fMSIQ4op5bwAMFK4VNKbcf1YjRgCy bsnc7/zKLPO4xteCLLsHZLJ9ZqQdRAZ//cIsnb9+r6XJ40mlk9+1lH8fixAisniBj3qi u3V4W4Qj6vOZ7nmsGBXnq6l/L9udH1IJeP0i8d2d/6/8vmobg24T5d8qWWXJVpt8zltv ipQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687538422; x=1690130422; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Im1IN1ikrfOM9Z5Ok/IoUeSFmmXZyMPCiNwLLRYtHmQ=; b=BLFl0k87dG76WLuKNAN3pOzSM246wyR6gtrP5VR6x8MWng/va2qbQCAEra0zItd0x9 UgFHxLd3VRJJVRDXXqHUR2OQE8u04xdrUUuHDalpTDiPIulIpCCEGBubv6XdfVTnugTU dNYERZtuooryhDyf23ufq6VLrRut1NtGnWTqD6JW1KqBgsK/eP05ySTutRMelGxnr9Kp TZldlC1XzBnBIyXwIxuOMiDi8gO0Vd68VDVQj5wSXMHXk+YjRzrQUbCG7KVMYV69Ph4m 1AA3jUOQbRgTz01F7gGrbrAQFkKRU5lt5JQtbnN2ExibX+AxXsakilzr5paNJsmZ9X/j jPrg== X-Gm-Message-State: AC+VfDyW+DSniH/BlWBHkY+OpAyRV+k0mMFDz5LzvFyo6ZX4YI3LdeD4 Ju051NXioxXLYh9aalSokDVCO+v+lexmkg== X-Google-Smtp-Source: ACHHUZ7C66BEaKbQBmvL2pZjnqc3R82KIAB0G9Tt/kvXK5rICRDXs/YcwnK1MlTu5X6j4+3CatJBx/dm8KHUHQ== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a17:90a:bc8e:b0:25b:d596:fd30 with SMTP id x14-20020a17090abc8e00b0025bd596fd30mr3104900pjr.1.1687538421988; Fri, 23 Jun 2023 09:40:21 -0700 (PDT) Date: Fri, 23 Jun 2023 16:40:13 +0000 In-Reply-To: <20230623164015.3431990-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20230623164015.3431990-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230623164015.3431990-3-jiaqiyan@google.com> Subject: [PATCH v2 2/4] mm/hwpoison: check if a subpage of a hugetlb folio is raw HWPOISON From: Jiaqi Yan To: mike.kravetz@oracle.com, naoya.horiguchi@nec.com Cc: songmuchun@bytedance.com, shy828301@gmail.com, linmiaohe@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, duenwen@google.com, axelrasmussen@google.com, jthoughton@google.com, Jiaqi Yan X-Rspamd-Queue-Id: 37EF214000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: oujz4y3bdh4w3bp9jmq6u19wjncin89b X-HE-Tag: 1687538422-115567 X-HE-Meta: U2FsdGVkX1/v8YQZpIzBF+z4h8VnYppxct+p0kvkS+nsyN+MFWi7mri0gTKNp+sRsve95FeQzHnNn7UPKNV1hAnTvesi+ATzibCBnPQ9Mg3NaOaRylwpAsLaplu6NMYHk3XkUYESItMPGcq0bbNr0Jm63DuhIashvzrw9AxSbt8QqnwbfXxp4XmEHinQh6uAUMb/JI/86ivYo0iyV1FAGu9qHcTI8ySutcx95LFYQ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Sj2YRfTJAiwrYEL1Hv0OnMtxhX+ILcy55lkg9j5iMkRizYLgJE/405AIdYWU8tPUHqaK+yTl+AJQYI2bGUcM8/7Zz1MMKR1PcNk+kaiyClr6RmJ5Fw0ABhMWy8pZ2uyDEP51O1n1IIPFbbXq0MlE9wkkEYp0qqC+6Rbr40U0Zz3LjJz9HYyVeLxOblJkBtUSD3wMnu4h4rrNpu1TQwCKEpnX8i24BS5DWunSiRDXqiEcUvuAnXEEf/Oa8G+5VtW+7xz49cFYQZMbgmZtNXd8OmPyX3gLuGhVkUXBRo2Xdhw== 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: Adds the functionality to tell if a subpage of a hugetlb folio is a raw HWPOISON page. This functionality relies on RawHwpUnreliable to be not set; otherwise hugepage's HWPOISON list becomes meaningless. Exports this functionality to be immediately used in the read operation for hugetlbfs. Signed-off-by: Jiaqi Yan Reviewed-by: Mike Kravetz Acked-by: Naoya Horiguchi --- include/linux/hugetlb.h | 19 +++++++++++++++++++ include/linux/mm.h | 7 +++++++ mm/hugetlb.c | 10 ++++++++++ mm/memory-failure.c | 34 ++++++++++++++++++++++++---------- 4 files changed, 60 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 21f942025fec..8b73a12b7b38 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -1013,6 +1013,25 @@ void hugetlb_register_node(struct node *node); void hugetlb_unregister_node(struct node *node); #endif +/* + * Struct raw_hwp_page represents information about "raw error page", + * constructing singly linked list from ->_hugetlb_hwpoison field of folio. + */ +struct raw_hwp_page { + struct llist_node node; + struct page *page; +}; + +static inline struct llist_head *raw_hwp_list_head(struct folio *folio) +{ + return (struct llist_head *)&folio->_hugetlb_hwpoison; +} + +/* + * Check if a given raw @subpage in a hugepage @folio is HWPOISON. + */ +bool is_raw_hwp_subpage(struct folio *folio, struct page *subpage); + #else /* CONFIG_HUGETLB_PAGE */ struct hstate {}; diff --git a/include/linux/mm.h b/include/linux/mm.h index 66032f0d515c..41a283bd41a7 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3671,6 +3671,7 @@ extern const struct attribute_group memory_failure_attr_group; extern void memory_failure_queue(unsigned long pfn, int flags); extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); +extern bool __is_raw_hwp_subpage(struct folio *folio, struct page *subpage); void num_poisoned_pages_inc(unsigned long pfn); void num_poisoned_pages_sub(unsigned long pfn, long i); struct task_struct *task_early_kill(struct task_struct *tsk, int force_early); @@ -3685,6 +3686,12 @@ static inline int __get_huge_page_for_hwpoison(unsigned long pfn, int flags, return 0; } +static inline bool __is_raw_hwp_subpage(struct folio *folio, + struct page *subpage) +{ + return false; +} + static inline void num_poisoned_pages_inc(unsigned long pfn) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ea24718db4af..6b860de87590 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7377,6 +7377,16 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return ret; } +bool is_raw_hwp_subpage(struct folio *folio, struct page *subpage) +{ + bool ret; + + spin_lock_irq(&hugetlb_lock); + ret = __is_raw_hwp_subpage(folio, subpage); + spin_unlock_irq(&hugetlb_lock); + return ret; +} + void folio_putback_active_hugetlb(struct folio *folio) { spin_lock_irq(&hugetlb_lock); diff --git a/mm/memory-failure.c b/mm/memory-failure.c index c415c3c462a3..891248e2930e 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1809,18 +1809,32 @@ EXPORT_SYMBOL_GPL(mf_dax_kill_procs); #endif /* CONFIG_FS_DAX */ #ifdef CONFIG_HUGETLB_PAGE -/* - * Struct raw_hwp_page represents information about "raw error page", - * constructing singly linked list from ->_hugetlb_hwpoison field of folio. - */ -struct raw_hwp_page { - struct llist_node node; - struct page *page; -}; -static inline struct llist_head *raw_hwp_list_head(struct folio *folio) +bool __is_raw_hwp_subpage(struct folio *folio, struct page *subpage) { - return (struct llist_head *)&folio->_hugetlb_hwpoison; + struct llist_head *raw_hwp_head; + struct raw_hwp_page *p, *tmp; + bool ret = false; + + if (!folio_test_hwpoison(folio)) + return false; + + /* + * When RawHwpUnreliable is set, kernel lost track of which subpages + * are HWPOISON. So return as if ALL subpages are HWPOISONed. + */ + if (folio_test_hugetlb_raw_hwp_unreliable(folio)) + return true; + + raw_hwp_head = raw_hwp_list_head(folio); + llist_for_each_entry_safe(p, tmp, raw_hwp_head->first, node) { + if (subpage == p->page) { + ret = true; + break; + } + } + + return ret; } static unsigned long __folio_free_raw_hwp(struct folio *folio, bool move_flag) From patchwork Fri Jun 23 16:40:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13290811 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 7487AC0015E for ; Fri, 23 Jun 2023 16:40:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA2508D0008; Fri, 23 Jun 2023 12:40:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D054F8D0001; Fri, 23 Jun 2023 12:40:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA5128D0008; Fri, 23 Jun 2023 12:40:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id AB2048D0001 for ; Fri, 23 Jun 2023 12:40:26 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 73A5A1A02C0 for ; Fri, 23 Jun 2023 16:40:26 +0000 (UTC) X-FDA: 80934575652.03.03E7BA2 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf16.hostedemail.com (Postfix) with ESMTP id 7D09D180013 for ; Fri, 23 Jun 2023 16:40:24 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=5jLczQMp; spf=pass (imf16.hostedemail.com: domain of 398qVZAgKCBAzyq6yEq3w44w1u.s421y3AD-220Bqs0.47w@flex--jiaqiyan.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=398qVZAgKCBAzyq6yEq3w44w1u.s421y3AD-220Bqs0.47w@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687538424; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bgkvS77jKBasQJ+d6+AqQuQkcASYxscDuOzFX9WAgds=; b=TD3xR/ZBeqraiHHaTEkeqry4VYqwAwMTTB//9HgjZBQlbtejTJvG5QN5EEmScLYn8Y3k6k rjNrUyAIS1IH6JOutiPBNMeTq0hTf2RsKvUFBMJdZiMvXNBFtsFHqBFExrxeO5ldPAvq9B nc8IYcSsY39b827JW1jXN4skUr0qoaQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687538424; a=rsa-sha256; cv=none; b=nLPOd3wd/Kmc0GhDBJ2CR/OTXwfj6ktyIxLaNBQZIsrDTeRCZhv9lmUXo1Beyh0m+clwzb zdibMPDmHeKSW8LwHUMSmtDuNiVB9F5eI1ueRCnaCNqYGRaVxcaZUdTMYsMj0XICRwMe0d UcLkTv70LImQwCCV0oiRHYmjmNs3VAs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=5jLczQMp; spf=pass (imf16.hostedemail.com: domain of 398qVZAgKCBAzyq6yEq3w44w1u.s421y3AD-220Bqs0.47w@flex--jiaqiyan.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=398qVZAgKCBAzyq6yEq3w44w1u.s421y3AD-220Bqs0.47w@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-5428d1915acso556818a12.0 for ; Fri, 23 Jun 2023 09:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687538423; x=1690130423; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bgkvS77jKBasQJ+d6+AqQuQkcASYxscDuOzFX9WAgds=; b=5jLczQMp0KSTUIagObRwmH0mr7CUCxFkzN7ENpojhmLHZ5GyofnMb+Nwwg0KbCrGdj 3WAW+iB30hh1CIP2jXtjzzqMP6aQHq0SumA8ktu4p1yPKHIcW5cNVVYSJhPCOejXnvPu nKl3TIA+Sl6yCFYzA+PCG++nBBaxmuxCyqVDC21b2OKlQOdzRKNglDYsR9F3RTTJRMYl AAMVjrlGjICuPd2odT2iHSoPtCqMZtxg6+MlTsPgioLvqTryZxWthG+Vh2bh22MjQDaQ 9B3I8J2H+/UZPeZ9NSrWwZ6tFvGN95BBwimNdsppJUqYqfC4usU/76Fm0JacOMdSXTse zXfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687538423; x=1690130423; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bgkvS77jKBasQJ+d6+AqQuQkcASYxscDuOzFX9WAgds=; b=dBhdpdxL7PZOYHQK3wxdc/uiamM9s8dEq8sQu9k3ru6F2hTEltRq9nRUlGQqF6fhrQ CWtuqyq4mCjJxD9A17P3/S9MFmIB9Q6mxG+Yu4yji2rwKHKk9gMwCvmvX5jhTinVODgF YpZx8NgQ3AoNtjhTbyndBNyY/t3aLGdl6dAZfklEpgoEt1HdXOQK/kwbX1ysZTqeOOpb FPwolaAq33MmSJTEw04pCrh9PH+7mla/W81UaPdcl6I35m05+fgOv28cSxpO4ut/HrvB ia1C6ieSmdTfy/ImOwDQ1ETf6xqzw4Gx0fUq/jE2bvGTsWNjjQ2SBQktAvItTvFKyyFv NF3g== X-Gm-Message-State: AC+VfDzOykcEdkMKSInYn5yaf25kourovZBa/QGLm6l7eQdxaI07JzdD W3RWU5Y1eddvcXoyj9qkXuwRW5HR9DZMkA== X-Google-Smtp-Source: ACHHUZ7SVzvvZkW36k+iXmGUMtIymkIH4w+s1GAMmdhSj7Lx2MUYP2jnFMjcbaXPnGb5kaXvodFcOEtl1lhEHg== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a63:fc01:0:b0:557:2a54:cf08 with SMTP id j1-20020a63fc01000000b005572a54cf08mr1060696pgi.6.1687538423324; Fri, 23 Jun 2023 09:40:23 -0700 (PDT) Date: Fri, 23 Jun 2023 16:40:14 +0000 In-Reply-To: <20230623164015.3431990-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20230623164015.3431990-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230623164015.3431990-4-jiaqiyan@google.com> Subject: [PATCH v2 3/4] hugetlbfs: improve read HWPOISON hugepage From: Jiaqi Yan To: mike.kravetz@oracle.com, naoya.horiguchi@nec.com Cc: songmuchun@bytedance.com, shy828301@gmail.com, linmiaohe@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, duenwen@google.com, axelrasmussen@google.com, jthoughton@google.com, Jiaqi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nSolipQGOjjCSxqiXR5FGBgu PSbSuk7v 66eP0K3pYKXLAepbp1Nyry+fL7rcqNNNFYgE6tv+BZW6qwhZf5R8pSvoD2EkAaHtXV7OjPXDTLLL4YNjPxAgyx9DOKkCHQmr7CgZmzkl+0kPTiqZx0lPNWgWac3HWLvSCWKWXxvDy+Fxx3lEsvAfVr35PzS8kedxouktwOhF3GYEFL5v+hbgchpx+LDJR/fW9ll3wDdo4f/3KERhmdhQ428EpEU84bzOL2jQTDsJO2b9Hfh/oqHq+rKZ7EDPBz+SxMsjKRVo50fMpLFunv4/xQGvj2U8A8P5t6H2QkGgLN3m12fFm4l5cAlO0HjLdyLcpX3BsJ22Gc4UHosTzEBPx5CsTe4umoBV4dn0rP/bruWjIkopiVHrP6llLtoGlq6WEu5kVKbYND66rIOF2ZflNWa0bS40MMAMKlZsL1Uau0fiUGrOjLZ1zSGLh0N1XTaPZEaitbpLavX9I5ZYK+5C9zl0EaykaMlo9kTnmev1C9sTgYBzISxgj34JZ017jBbJsbYh+prGPKXQzT5a4QOH6Nkiv9oTlQ7RPmfRmJAZXhJkT5FzQN6UUEVCKCW7sifILQWI0AAy/NVe519m1vzxStoAqEpb/pg1EKDTr1MEM4KB9Nt2hFevVRrrSvQ== 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: When a hugepage contains HWPOISON pages, read() fails to read any byte of the hugepage and returns -EIO, although many bytes in the HWPOISON hugepage are readable. Improve this by allowing hugetlbfs_read_iter returns as many bytes as possible. For a requested range [offset, offset + len) that contains HWPOISON page, return [offset, first HWPOISON page addr); the next read attempt will fail and return -EIO. Signed-off-by: Jiaqi Yan Reviewed-by: Mike Kravetz Reviewed-by: Naoya Horiguchi --- fs/hugetlbfs/inode.c | 58 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 90361a922cec..86879ca3ff1e 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -282,6 +282,42 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr, } #endif +/* + * Someone wants to read @bytes from a HWPOISON hugetlb @page from @offset. + * Returns the maximum number of bytes one can read without touching the 1st raw + * HWPOISON subpage. + * + * The implementation borrows the iteration logic from copy_page_to_iter*. + */ +static size_t adjust_range_hwpoison(struct page *page, size_t offset, size_t bytes) +{ + size_t n = 0; + size_t res = 0; + struct folio *folio = page_folio(page); + + /* First subpage to start the loop. */ + page += offset / PAGE_SIZE; + offset %= PAGE_SIZE; + while (1) { + if (is_raw_hwp_subpage(folio, page)) + break; + + /* Safe to read n bytes without touching HWPOISON subpage. */ + n = min(bytes, (size_t)PAGE_SIZE - offset); + res += n; + bytes -= n; + if (!bytes || !n) + break; + offset += n; + if (offset == PAGE_SIZE) { + page++; + offset = 0; + } + } + + return res; +} + /* * Support for read() - Find the page attached to f_mapping and copy out the * data. This provides functionality similar to filemap_read(). @@ -300,7 +336,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to) while (iov_iter_count(to)) { struct page *page; - size_t nr, copied; + size_t nr, copied, want; /* nr is the maximum number of bytes to copy from this page */ nr = huge_page_size(h); @@ -328,16 +364,26 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to) } else { unlock_page(page); - if (PageHWPoison(page)) { - put_page(page); - retval = -EIO; - break; + if (!PageHWPoison(page)) + want = nr; + else { + /* + * Adjust how many bytes safe to read without + * touching the 1st raw HWPOISON subpage after + * offset. + */ + want = adjust_range_hwpoison(page, offset, nr); + if (want == 0) { + put_page(page); + retval = -EIO; + break; + } } /* * We have the page, copy it to user space buffer. */ - copied = copy_page_to_iter(page, offset, nr, to); + copied = copy_page_to_iter(page, offset, want, to); put_page(page); } offset += copied; From patchwork Fri Jun 23 16:40:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13290812 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 0B24BEB64D7 for ; Fri, 23 Jun 2023 16:40:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 258038D0009; Fri, 23 Jun 2023 12:40:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E1C98D0001; Fri, 23 Jun 2023 12:40:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 05B1D8D0009; Fri, 23 Jun 2023 12:40:29 -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 ECB648D0001 for ; Fri, 23 Jun 2023 12:40:28 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B9E211202C1 for ; Fri, 23 Jun 2023 16:40:28 +0000 (UTC) X-FDA: 80934575736.10.283DAF5 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf21.hostedemail.com (Postfix) with ESMTP id 998CC1C0016 for ; Fri, 23 Jun 2023 16:40:26 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=Qcx52ve9; spf=pass (imf21.hostedemail.com: domain of 3-cqVZAgKCBI10s80Gs5y66y3w.u64305CF-442Dsu2.69y@flex--jiaqiyan.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3-cqVZAgKCBI10s80Gs5y66y3w.u64305CF-442Dsu2.69y@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687538426; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YIyoXn+1WkJIHdk0UP5PwbMUr6M5AyBU7f22CzTi81I=; b=5P7Aq0TH9LmkYPkGL4+9JDM2onXH6fkfFRjeZ8jWTSG/aURKwHbXSlxnkvCj4ysL0DAfOC HdRP0rttjGSw7mx/4isoF8VamBmiHz9D5OR+ZoDya/dIlLOiRMuEtGZD+rvOHwbKVojljH oHazyZJRwJ2ipveN32Cwkj065WgJdqQ= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=Qcx52ve9; spf=pass (imf21.hostedemail.com: domain of 3-cqVZAgKCBI10s80Gs5y66y3w.u64305CF-442Dsu2.69y@flex--jiaqiyan.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3-cqVZAgKCBI10s80Gs5y66y3w.u64305CF-442Dsu2.69y@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687538426; a=rsa-sha256; cv=none; b=UiepRWXOXXodEy1YTOG6Q/iPoCvt6Q2R/gZOR6gORtposNxyywzR855o41NFX++kueefuP cRkZnVaSTTFSSMwQVAlGur/DmTUvCUe5lczfCC5FyG0GBlb7i7WneiF/7I+2QyNQabWgXw GdaSYIdPZDrcZJ0EKwVOjBnUn5RVJKw= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-bf179fcc200so1194430276.0 for ; Fri, 23 Jun 2023 09:40:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687538425; x=1690130425; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=YIyoXn+1WkJIHdk0UP5PwbMUr6M5AyBU7f22CzTi81I=; b=Qcx52ve9KgnXSTCkr0swZ2WTRjlDvDcsTWcwzblh7tcWx6rHnkyrDMr08/A05+ATOe IA56VxpPNT4kOPlnQyBmMq4uwH5E01E1zJj3irtYUFzCwkTgTjgj/miAX+7YfOdXiaIG FoNf3ahcKhTXUjgjjszmudDkx0Opu+tRA2YOhKowD3T1Z19zz2Gdoa4f0lkkGsPiiokE kaVIPt8Bkw+1+XNTrEoN4uwjtVzikw5oQRYfBZy+WD0cnNsxcyqL/Cd9mapd8EUSMpMH 9q8Yug4/qANGyBOhnT2VJXRFRlG2PBI3piIArguO6lpdO6lpCxW45PSZg9IBGGNrPrq0 X45Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687538425; x=1690130425; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YIyoXn+1WkJIHdk0UP5PwbMUr6M5AyBU7f22CzTi81I=; b=Okcf7abc9Yxjsg3/SvaKhDZr2AqhgWIITjnv9Ua55Sq+ndwhoiGMvkulvLD5Z7Xsn0 DfBc8V8jkNuV5eEriGRxjdChPwxJp4gbULzYZQbjcJH0UAr1TgzHpj9Jnm3PVj27yFb/ s5nBLKm34PESsXYCGxEQ+zxxNTi1o6dG6CSKVDYn0jktz6/qFvm0czyE6qsRNDyI+5e9 WzP2f0P8/bBpgsbLmsvdOuYieSNanLxfhtB+S0wXk+NXefLFRK/aUsjbR8GU85rhoxwD vjcBrF5r5DM886qdMMkG59zFa5Owt/Mx7g4aSGny1tBXmhe8RX3pQ/3AvlxGDe0H7vOG uYXA== X-Gm-Message-State: AC+VfDxZWDhhKJGJTFr6o1/FEbWkIUzIKjjQQpvQJ8AHXXKl+kf6KyDm lPZR2HU/smSzBy8gK00amkzh+D4/3w3mYA== X-Google-Smtp-Source: ACHHUZ4ZR54fVwuIAJMMF1saAYALIlGVpfUcualmuGLE51PKcjNTNVVMGPaP9n2mhGuS+ww/528Oud+RHoTUsA== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a25:e78a:0:b0:bc4:ef98:681c with SMTP id e132-20020a25e78a000000b00bc4ef98681cmr3885496ybh.13.1687538425732; Fri, 23 Jun 2023 09:40:25 -0700 (PDT) Date: Fri, 23 Jun 2023 16:40:15 +0000 In-Reply-To: <20230623164015.3431990-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20230623164015.3431990-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.41.0.162.gfafddb0af9-goog Message-ID: <20230623164015.3431990-5-jiaqiyan@google.com> Subject: [PATCH v2 4/4] selftests/mm: add tests for HWPOISON hugetlbfs read From: Jiaqi Yan To: mike.kravetz@oracle.com, naoya.horiguchi@nec.com Cc: songmuchun@bytedance.com, shy828301@gmail.com, linmiaohe@huawei.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, duenwen@google.com, axelrasmussen@google.com, jthoughton@google.com, Jiaqi Yan X-Rspamd-Queue-Id: 998CC1C0016 X-Rspam-User: X-Stat-Signature: aegzm86e9hnx9qg5sjxdhizonawngqu1 X-Rspamd-Server: rspam01 X-HE-Tag: 1687538426-770943 X-HE-Meta: U2FsdGVkX18buLX3MI7YaFDSR9/ZURBpllFUHkm6ro9OeCAGR6TD4u+k92vyoA8sI8IBP9Ey4S7OynImuzlY5xJilAgPhTO50C53zGvpMeMgJvL9WeGsxOdZpIrs4hdlXdxlZ9UYachQGwL1RKQTGqHVXihBklSyJJo6in2RQ/qL34vaOpcaCYqNY7C3Ki9uit5Prw0xYO1c9dPSVpCKs5b/8ZOanZSn6L6gHF8Lsc/UqP6uocqXH38jX6QpQoQ4XAG54o7OLI+raIHuVNp1BFie9uYaATE5moVHQ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0ti8KGvSn92HBFj+he1ZAxgwuj4+Em9H+t9vYBeZW7yHScfC80+UX0DB4MH74G38M0aLDlDTkyzrBm3o4OMpdyTJheqB6YhTSZ6KnkMSyuo+XKubmjPGZDSOLSlJ7Gb+Ry36V/gn5tSWXARw7PXBYv9TgQ+TCCuLShtQe7w5lgYCfkeht5IhJe0WTxNEYRYc6nn9VNXUHLgCOEddQbhOZ01TWwwqGngebCLZSvSjIs4vULEWVZ2eK0GRzXC5o45g== 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: Add tests for the improvement made to read operation on HWPOISON hugetlb page with different read granularities. For each chunk size, three read scenarios are tested: 1. Simple regression test on read without HWPOISON. 2. Sequential read page by page should succeed until encounters the 1st raw HWPOISON subpage. 3. After skip raw HWPOISON subpage by lseek, read()s always succeed. Signed-off-by: Jiaqi Yan Acked-by: Mike Kravetz Reviewed-by: Naoya Horiguchi --- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/hugetlb-read-hwpoison.c | 322 ++++++++++++++++++ 3 files changed, 324 insertions(+) create mode 100644 tools/testing/selftests/mm/hugetlb-read-hwpoison.c diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index 5599cf287694..37419296bf79 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -5,6 +5,7 @@ hugepage-mremap hugepage-shm hugepage-vmemmap hugetlb-madvise +hugetlb-read-hwpoison khugepaged map_hugetlb map_populate diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 95acb099315e..63fcc7e3e9f0 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -38,6 +38,7 @@ TEST_GEN_PROGS += gup_longterm TEST_GEN_PROGS += gup_test TEST_GEN_PROGS += hmm-tests TEST_GEN_PROGS += hugetlb-madvise +TEST_GEN_PROGS += hugetlb-read-hwpoison TEST_GEN_PROGS += hugepage-mmap TEST_GEN_PROGS += hugepage-mremap TEST_GEN_PROGS += hugepage-shm diff --git a/tools/testing/selftests/mm/hugetlb-read-hwpoison.c b/tools/testing/selftests/mm/hugetlb-read-hwpoison.c new file mode 100644 index 000000000000..ba6cc6f9cabc --- /dev/null +++ b/tools/testing/selftests/mm/hugetlb-read-hwpoison.c @@ -0,0 +1,322 @@ +// SPDX-License-Identifier: GPL-2.0 + +#define _GNU_SOURCE +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "../kselftest.h" + +#define PREFIX " ... " +#define ERROR_PREFIX " !!! " + +#define MAX_WRITE_READ_CHUNK_SIZE (getpagesize() * 16) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + +enum test_status { + TEST_PASSED = 0, + TEST_FAILED = 1, + TEST_SKIPPED = 2, +}; + +static char *status_to_str(enum test_status status) +{ + switch (status) { + case TEST_PASSED: + return "TEST_PASSED"; + case TEST_FAILED: + return "TEST_FAILED"; + case TEST_SKIPPED: + return "TEST_SKIPPED"; + default: + return "TEST_???"; + } +} + +static int setup_filemap(char *filemap, size_t len, size_t wr_chunk_size) +{ + char iter = 0; + + for (size_t offset = 0; offset < len; + offset += wr_chunk_size) { + iter++; + memset(filemap + offset, iter, wr_chunk_size); + } + + return 0; +} + +static bool verify_chunk(char *buf, size_t len, char val) +{ + size_t i; + + for (i = 0; i < len; ++i) { + if (buf[i] != val) { + printf(PREFIX ERROR_PREFIX "check fail: buf[%lu] = %u != %u\n", + i, buf[i], val); + return false; + } + } + + return true; +} + +static bool seek_read_hugepage_filemap(int fd, size_t len, size_t wr_chunk_size, + off_t offset, size_t expected) +{ + char buf[MAX_WRITE_READ_CHUNK_SIZE]; + ssize_t ret_count = 0; + ssize_t total_ret_count = 0; + char val = offset / wr_chunk_size + offset % wr_chunk_size; + + printf(PREFIX PREFIX "init val=%u with offset=0x%lx\n", val, offset); + printf(PREFIX PREFIX "expect to read 0x%lx bytes of data in total\n", + expected); + if (lseek(fd, offset, SEEK_SET) < 0) { + perror(PREFIX ERROR_PREFIX "seek failed"); + return false; + } + + while (offset + total_ret_count < len) { + ret_count = read(fd, buf, wr_chunk_size); + if (ret_count == 0) { + printf(PREFIX PREFIX "read reach end of the file\n"); + break; + } else if (ret_count < 0) { + perror(PREFIX ERROR_PREFIX "read failed"); + break; + } + ++val; + if (!verify_chunk(buf, ret_count, val)) + return false; + + total_ret_count += ret_count; + } + printf(PREFIX PREFIX "actually read 0x%lx bytes of data in total\n", + total_ret_count); + + return total_ret_count == expected; +} + +static bool read_hugepage_filemap(int fd, size_t len, + size_t wr_chunk_size, size_t expected) +{ + char buf[MAX_WRITE_READ_CHUNK_SIZE]; + ssize_t ret_count = 0; + ssize_t total_ret_count = 0; + char val = 0; + + printf(PREFIX PREFIX "expect to read 0x%lx bytes of data in total\n", + expected); + while (total_ret_count < len) { + ret_count = read(fd, buf, wr_chunk_size); + if (ret_count == 0) { + printf(PREFIX PREFIX "read reach end of the file\n"); + break; + } else if (ret_count < 0) { + perror(PREFIX ERROR_PREFIX "read failed"); + break; + } + ++val; + if (!verify_chunk(buf, ret_count, val)) + return false; + + total_ret_count += ret_count; + } + printf(PREFIX PREFIX "actually read 0x%lx bytes of data in total\n", + total_ret_count); + + return total_ret_count == expected; +} + +static enum test_status +test_hugetlb_read(int fd, size_t len, size_t wr_chunk_size) +{ + enum test_status status = TEST_SKIPPED; + char *filemap = NULL; + + if (ftruncate(fd, len) < 0) { + perror(PREFIX ERROR_PREFIX "ftruncate failed"); + return status; + } + + filemap = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_POPULATE, fd, 0); + if (filemap == MAP_FAILED) { + perror(PREFIX ERROR_PREFIX "mmap for primary mapping failed"); + goto done; + } + + setup_filemap(filemap, len, wr_chunk_size); + status = TEST_FAILED; + + if (read_hugepage_filemap(fd, len, wr_chunk_size, len)) + status = TEST_PASSED; + + munmap(filemap, len); +done: + if (ftruncate(fd, 0) < 0) { + perror(PREFIX ERROR_PREFIX "ftruncate back to 0 failed"); + status = TEST_FAILED; + } + + return status; +} + +static enum test_status +test_hugetlb_read_hwpoison(int fd, size_t len, size_t wr_chunk_size, + bool skip_hwpoison_page) +{ + enum test_status status = TEST_SKIPPED; + char *filemap = NULL; + char *hwp_addr = NULL; + const unsigned long pagesize = getpagesize(); + + if (ftruncate(fd, len) < 0) { + perror(PREFIX ERROR_PREFIX "ftruncate failed"); + return status; + } + + filemap = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_POPULATE, fd, 0); + if (filemap == MAP_FAILED) { + perror(PREFIX ERROR_PREFIX "mmap for primary mapping failed"); + goto done; + } + + setup_filemap(filemap, len, wr_chunk_size); + status = TEST_FAILED; + + /* + * Poisoned hugetlb page layout (assume hugepagesize=2MB): + * |<---------------------- 1MB ---------------------->| + * |<---- healthy page ---->|<---- HWPOISON page ----->| + * |<------------------- (1MB - 8KB) ----------------->| + */ + hwp_addr = filemap + len / 2 + pagesize; + if (madvise(hwp_addr, pagesize, MADV_HWPOISON) < 0) { + perror(PREFIX ERROR_PREFIX "MADV_HWPOISON failed"); + goto unmap; + } + + if (!skip_hwpoison_page) { + /* + * Userspace should be able to read (1MB + 1 page) from + * the beginning of the HWPOISONed hugepage. + */ + if (read_hugepage_filemap(fd, len, wr_chunk_size, + len / 2 + pagesize)) + status = TEST_PASSED; + } else { + /* + * Userspace should be able to read (1MB - 2 pages) from + * HWPOISONed hugepage. + */ + if (seek_read_hugepage_filemap(fd, len, wr_chunk_size, + len / 2 + MAX(2 * pagesize, wr_chunk_size), + len / 2 - MAX(2 * pagesize, wr_chunk_size))) + status = TEST_PASSED; + } + +unmap: + munmap(filemap, len); +done: + if (ftruncate(fd, 0) < 0) { + perror(PREFIX ERROR_PREFIX "ftruncate back to 0 failed"); + status = TEST_FAILED; + } + + return status; +} + +static int create_hugetlbfs_file(struct statfs *file_stat) +{ + int fd; + + fd = memfd_create("hugetlb_tmp", MFD_HUGETLB); + if (fd < 0) { + perror(PREFIX ERROR_PREFIX "could not open hugetlbfs file"); + return -1; + } + + memset(file_stat, 0, sizeof(*file_stat)); + if (fstatfs(fd, file_stat)) { + perror(PREFIX ERROR_PREFIX "fstatfs failed"); + goto close; + } + if (file_stat->f_type != HUGETLBFS_MAGIC) { + printf(PREFIX ERROR_PREFIX "not hugetlbfs file\n"); + goto close; + } + + return fd; +close: + close(fd); + return -1; +} + +int main(void) +{ + int fd; + struct statfs file_stat; + enum test_status status; + /* Test read() in different granularity. */ + size_t wr_chunk_sizes[] = { + getpagesize() / 2, getpagesize(), + getpagesize() * 2, getpagesize() * 4 + }; + size_t i; + + for (i = 0; i < ARRAY_SIZE(wr_chunk_sizes); ++i) { + printf("Write/read chunk size=0x%lx\n", + wr_chunk_sizes[i]); + + fd = create_hugetlbfs_file(&file_stat); + if (fd < 0) + goto create_failure; + printf(PREFIX "HugeTLB read regression test...\n"); + status = test_hugetlb_read(fd, file_stat.f_bsize, + wr_chunk_sizes[i]); + printf(PREFIX "HugeTLB read regression test...%s\n", + status_to_str(status)); + close(fd); + if (status == TEST_FAILED) + return -1; + + fd = create_hugetlbfs_file(&file_stat); + if (fd < 0) + goto create_failure; + printf(PREFIX "HugeTLB read HWPOISON test...\n"); + status = test_hugetlb_read_hwpoison(fd, file_stat.f_bsize, + wr_chunk_sizes[i], false); + printf(PREFIX "HugeTLB read HWPOISON test...%s\n", + status_to_str(status)); + close(fd); + if (status == TEST_FAILED) + return -1; + + fd = create_hugetlbfs_file(&file_stat); + if (fd < 0) + goto create_failure; + printf(PREFIX "HugeTLB seek then read HWPOISON test...\n"); + status = test_hugetlb_read_hwpoison(fd, file_stat.f_bsize, + wr_chunk_sizes[i], true); + printf(PREFIX "HugeTLB seek then read HWPOISON test...%s\n", + status_to_str(status)); + close(fd); + if (status == TEST_FAILED) + return -1; + } + + return 0; + +create_failure: + printf(ERROR_PREFIX "Abort test: failed to create hugetlbfs file\n"); + return -1; +}