From patchwork Mon Jul 15 10:28:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13733277 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 11D06C3DA59 for ; Mon, 15 Jul 2024 10:32:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B8626B009C; Mon, 15 Jul 2024 06:32:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 969AB6B00A0; Mon, 15 Jul 2024 06:32:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 831E86B00A2; Mon, 15 Jul 2024 06:32:44 -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 663BD6B009C for ; Mon, 15 Jul 2024 06:32:44 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 166E6C121D for ; Mon, 15 Jul 2024 10:32:44 +0000 (UTC) X-FDA: 82341623448.29.EC62737 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 6486010001C for ; Mon, 15 Jul 2024 10:32:41 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721039544; 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=wkKQ1qFUcmzWU6g4vKha0ODLdCWOwgn2nqfLaB5QwO4=; b=h7c3LEKlVOczaZHZ6UtfxG+5vBSdSTlt/Ch3u2ye/fUZFHENbOY7IPUH+2j8kKUyeLOsKv Nzr0mfp9VV/N3viHEa1p5IL0WCp5MwAHsbsVlORKzCw4rrsXEzxCCe9ZZt7txClH2cEfHo sShK+5BCceAtY+DhKGxbKDmlhE25GAM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; spf=pass (imf14.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721039544; a=rsa-sha256; cv=none; b=7jkIndJdLP9W0kkedovBy8cSJ5Ow2/qGMvtot9t9t3P6t1H7YZ1ILkzPZlARULtdpduppY 9IXp74boLm7ayv76I8cbW286EbaItIMDg1l/d44t83U2jqshep2wcXFGOL4uyqFWRt1gPS 5THNUqv2ZqFJvczUC0i7XXnnnB9XScc= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WMz102pwRzxSsd; Mon, 15 Jul 2024 18:27:48 +0800 (CST) Received: from kwepemd200019.china.huawei.com (unknown [7.221.188.193]) by mail.maildlp.com (Postfix) with ESMTPS id A5D2318006C; Mon, 15 Jul 2024 18:32:37 +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; Mon, 15 Jul 2024 18:32:36 +0800 From: Miaohe Lin To: CC: , , , Subject: [PATCH] mm/hwpoison: reset hwpoison filter parameters in pfn_inject_exit() Date: Mon, 15 Jul 2024 18:28:06 +0800 Message-ID: <20240715102806.2638849-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: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd200019.china.huawei.com (7.221.188.193) X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 6486010001C X-Stat-Signature: 1eqd9c88sc5z9ogx7ee3a5zb9snr7q5s X-HE-Tag: 1721039561-112676 X-HE-Meta: U2FsdGVkX1+OTXbaRqfgWUhy89lIWlXW9IdPeRtsh0enwCOq1BbDgbcU3aitVcyLWczGHC9g3vD/P7jHTAuKWHcE6fGKXm1N5Ilj4UcznHVLlW5E0LhNsIzsRlvKtKFZGLh0bf3m3faCdc2jugwn2AxnAsB+b4xefAu7o1LOGmysDZw7Q+jlwzzZxeCpax/faa5ELmacE5VNmRzY9enzSKS02dRrlgDMn4osZ3X9wvp51AeZhCy+raZluAcn8pQcvkF++kSGq7PmRgj3F5PIyHLiynjSjooaJw+77rKGY37eruMr1tpxf3JupmKbznfEoBD5yU7joVbQZLwjMHSponFrSFF+nAOLlvT5Bi3Ebd7PAbJvBmiuNdM8VqJojgD4R9GQ0g3EVJLf4Vbzrq2VeR1BgEbSaa8aJ1te3Pk5YWjXYeuHXP1rF6HYZ1Oz5HaYtqYlzQYZ0vBmi324D8AmT6ZWv5JhAb1/Jke79ZPRZRLMwJs1sHhpWw4xj/KGfobPwiFZTTVZgr9+WZGsD/00A0pjUSV1vxDF0EFQE/TCI82ZfivLlX7VbW5WnX1Wo2HXx10dVC7/dYQPTDpxXl8Fjp3OnIoWIYIm6Xj/Of3/Nv/Jvtx/7x5oeKmjopnfq2oPCA/AVJGDc3jnvMmREzYgFQqmYFsIPoxUuLx4oSooJ2g6ui8KsLEPrwNyXAfyTGsz0Qnzgx7hO8Qc/Y5KUI5+4l7Fh2hHvDUJ0KV0axLtXAZDbRFV8lHZcfrxQYA4lwh4h+/8XcPIvaStQGO1daJ2E8GmZ6ImyJ5jf05HyWKpLtkiLSp7TLozN5bemZaDbAIyMFRYWP8I+dTRhnAVv309yHLBOjrArTqFE6figqsPIVwjkpvox2eIAQ3g1zqVxDmrWpoZFwJm3eja7wx9MN2iliTQkJS/BVJewcc/4acJuDCi6ZfM5Hs1KCYS6XED4AtyYLSjWdpuH+Z1r+lQ6U/ tRUwXzXQ cf1lfKpF6FxiIv0fHqz1YpiDaqkN0dJyvFi4iwdz3lXck7JcEjm1gG9QvoR2yDEjE7B/Y1BbW7EK/Ik+VrA0+ancmfudfy0FGK15Y7cVZOMHvlNbDrd0XSJSACfVUIM0sVMDQ3LNknGg2jPyA+vn+7t4RlYiAMEyGPHWlIR4RmFl33UE6TUz4NEw/+6hNguQmMhGi7K8F81IrXcAqFEpFCy8SYT2eLVwu5ZVvG8jxTIpp9WXC+BrdJw8bvFXNJgeT+SLWZIrRvsBJniQ= 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 --- mm/hwpoison-inject.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c index 7ecaa1900137..b0bd11133a1d 100644 --- a/mm/hwpoison-inject.c +++ b/mm/hwpoison-inject.c @@ -64,9 +64,20 @@ 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); }