From patchwork Tue Jul 16 03:35:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13734028 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 B5557C3DA49 for ; Tue, 16 Jul 2024 03:39:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31F9D6B0083; Mon, 15 Jul 2024 23:39:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2CF536B0085; Mon, 15 Jul 2024 23:39:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1BF1C6B0088; Mon, 15 Jul 2024 23:39:58 -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 F20026B0083 for ; Mon, 15 Jul 2024 23:39:57 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 756321602B0 for ; Tue, 16 Jul 2024 03:39:57 +0000 (UTC) X-FDA: 82344212034.28.AB7BB41 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf22.hostedemail.com (Postfix) with ESMTP id 2C81FC0011 for ; Tue, 16 Jul 2024 03:39:53 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.191 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=1721101158; 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:content-transfer-encoding:in-reply-to: references; bh=sWK5g9imRWXdd1MjYPaeEA77gOGmMffWjWHLOqSc5OM=; b=Tq2Uqr6x7rEY5eS2LVcOZu/2bml0A/Fs7oZbY/+V8peeRVx6SbhaYnkhyRPUwEfPGHupk0 gB88dbHaN+Ry3srwC4impORoPo4cQtmTJD+8RboVLoBI0foUQAF2m234HLW2u6yUwGkM66 mO4+5Kf8x32Pn/q3ooSe9HIrbmCpTzA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721101158; a=rsa-sha256; cv=none; b=HANE9JTGel7wSMX+Wpma9+tlU1fvbB/ZYU+Za9xkIbY/DxrvmcGOd/evmFqZA/VURbF06m dgUbCJ+GreCYI3NnGnsIOBdBo9rhPjYiGibGZOpGzjLde1nfY7ChT7BpVwQnw5CgPsX4Fz icN+vWV81HsAktMUpDcKsUZNvmpYj7A= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WNPrt2XRKz1HFJr; Tue, 16 Jul 2024 11:37:18 +0800 (CST) Received: from kwepemd200019.china.huawei.com (unknown [7.221.188.193]) by mail.maildlp.com (Postfix) with ESMTPS id 63F7314011B; Tue, 16 Jul 2024 11:39:50 +0800 (CST) Received: from huawei.com (10.173.127.72) by kwepemd200019.china.huawei.com (7.221.188.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 16 Jul 2024 11:39:49 +0800 From: Miaohe Lin To: CC: , , , Subject: [PATCH v2] mm/hwpoison: reset hwpoison filter parameters in pfn_inject_exit() Date: Tue, 16 Jul 2024 11:35:16 +0800 Message-ID: <20240716033516.606582-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-Originating-IP: [10.173.127.72] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemd200019.china.huawei.com (7.221.188.193) X-Rspamd-Queue-Id: 2C81FC0011 X-Stat-Signature: 7xe1fd63cwdnzupafjiticf7r1dti5h5 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1721101193-636838 X-HE-Meta: U2FsdGVkX1+5QEdaJLeRSPczR7b0V6C6UH6kCJQjB63bTu0v1pfgFtU8RTk61JRDEbdZ/sq3DyLYHsBmIuCuIRoO3sMDI7IvqUpEoqbr1yiGdqGarRu9XDUwG4lY037dAxbEgjU99MkvNOxLCCrduUBPZ5YjMJLyK0fMWIaenFJ4Ikub1T0RTztexR3yeJK70eapHQqUcgRAoa505mgpb6P46/enccgPTQLdY8JrX8i2cCeMgPP92KWTtJ2v2MAQx276VaOwRMySzDlBduJOXsn6R3YonP8cZI2SB+4RtL5Z2qEifwMHaQT4uN+WSPgOu0mPMQ9fsiWEpMTSqT/fzrVTnvLrmCGMMeQKeh/w1I0hFF/1gMLi9Q9Y0g7iuJHapEaYqAbpRAyhCv0GesvJequ2+/EfCeENW/gFRAooHyrPfLtXqjVZuHX7EjIFzVgEM9DUAw8Fi1ZZ1dPAkT+NB9f1IGooH6KtsugYl6SUdrKi25KYyYv0eC7jE52rg0ZnOE44GEBTvFFKNfmzJN41UY/Ie4h6G5mTUM0vLX1hIu6O8tzujPZcI+r8/1v/J1SgiD59Yg4NgLdtavbfGS+/xbEszo/0tUnMS978gonbGm4yLElaP6GkerdmS+V3tJDFQSFg3r7m1HX3W27jSPolgFq2QLIYwM2zPZzjwvsYGQcUarR3TzznhyZkeNDn1oMPy8FRflSqNF2eWQC6P/Nw0z+QGxdIKwAYpGMu8bzVKJu5jUpGVnl3RHqVRHR0vI5d6jsAFJPsQ27BXd+DFZ8P16o6AxfATKE+PIZ4cHB69PpUUnWGX+NVZYJUb7BQN0/i91jZWStbVsHAZq8YG4TOkYIZMlM8P4fAPzzMBHRwFAaxaQcDokrhvewxVjRWmfw2BVYSwWPCauFxDp6FC5Swb/cyB5k7hfdCSqTjkLTCv7p3Xuhgdn3iMAKHHqNtf1aufI1HnEtboTFdjGka8Zg Rv2pq0CN 19COgpNf1Q97K/yILQE7fEExjPuhCmh74U6oxxkIiZjm797+3nLKNxt9jsqx8+BWZJPb4i/nqBMJg+mKNjSKi5H7NgZwDDLAx7i+EhjKmGLAhhkSrr5E3i0SlCY17T+HynrTTgLa8J+RwUXS8DOe1/voQZwkjBs7jp7yvQqfJ07w1uG//BSbDUisrfEi0Z8zTp50NLU4GrrEXPmREMrEHm9uutPXZ/EHZmlDW4R3cN3WsEY517I/D2KKLP1yQkWRlXH+s 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: When hwpoison_inject module is removed, hwpoison_filter_* parameters should be reset. Otherwise these parameters will have non-default values at next insmod time. Signed-off-by: Miaohe Lin --- v2: Add missing call to reset_hwpoison_filter() per Andrew. Thanks. --- mm/hwpoison-inject.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index 7ecaa1900137..0b855cd3433a 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c @@ -64,10 +64,22 @@ static int hwpoison_unpoison(void *data, u64 val) DEFINE_DEBUGFS_ATTRIBUTE(hwpoison_fops, NULL, hwpoison_inject, "%lli\n"); DEFINE_DEBUGFS_ATTRIBUTE(unpoison_fops, NULL, hwpoison_unpoison, "%lli\n"); -static void __exit pfn_inject_exit(void) +static inline void reset_hwpoison_filter(void) { hwpoison_filter_enable = 0; + hwpoison_filter_dev_major = ~0U; + hwpoison_filter_dev_minor = ~0U; + hwpoison_filter_flags_mask = 0; + hwpoison_filter_flags_value = 0; +#ifdef CONFIG_MEMCG + hwpoison_filter_memcg = 0; +#endif +} + +static void __exit pfn_inject_exit(void) +{ debugfs_remove_recursive(hwpoison_dir); + reset_hwpoison_filter(); } static int __init pfn_inject_init(void)