Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2546170rdb; Mon, 25 Dec 2023 17:03:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6AzwNQliq6KjJ7Bo8b7VAq9uQ+tLK9Fv+rl7UXXPUKMHVBR9jEKRUoHgQxgLJ12I3V2wz X-Received: by 2002:a05:6a00:38c5:b0:6d9:af7a:98dc with SMTP id ey5-20020a056a0038c500b006d9af7a98dcmr702425pfb.17.1703552623261; Mon, 25 Dec 2023 17:03:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703552623; cv=none; d=google.com; s=arc-20160816; b=kx1NJhduBhQM1dfLcBURBYs9mUJcrTPezPlbR07NO+FfgWCW5SuXzGErmzZahvqvHv X7OOSdInTJ9/yKiWPu0cDyi90olMuBoq8gWTPPr6XvX4FIUr1QFgsrZlaasDyGBvv+0M ZgyIT9BYl6t/wuJ9E1VWJGaQKG+GXBu1PmWlxrb3zkanHZP4qmEg+ye87d9eIVBAgi0n p0MKCY7vVCTxxdbbh5s7Jr+/z7rFGeFWTkwpfPSaZv1oogzfJ9qfTwfdaCCPmIfxmmEi 9mqzGc1V4vqMrrfMHcQfGPmHT+tyQFutTrDWLsJGe/vEcjkhsw4x+cqcsoi+0B5FxdYG PYdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=Ads83kWbprDMz/2cWzOH3LpVY4xOo1NDU5ESFPUvkQI=; fh=XjbPFQV1q33pSyHU0DJViPof6LxQPkAWDXnCrlkcrhg=; b=qO5m0HC4kRK7fyeWBL3/h/JegXRdPRdL8bw11+xrTsfmi663vPG/+vZ7N2H3tj/0KS L6C0LXZPlreENsSAl2KL3xkm5V26bhPIEBsVmOGmkc895QoC3s/pR+CJ6bsN3lqo8wlc CwgiHzs2fb2BZQ+oCuN5WtPnxCaUz9j5yKgYGb3cU5EqVs0Mn5+XXwLhAMgW8BfruJXw UEdNxhM7CbMjDeLLDpG4V97UO+q3Lneo1BMEB9NV0WibYUJuqlgTWWcLi0f1Duf1KKnC 35MOwGQMUAwBBCAYc0/9ELXeJO3pZ/DWqYTVi+KhZeW3j8eNJRkS+JZFfrG29MOcaDWp Ko5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11303-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11303-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fa35-20020a056a002d2300b006d9a617d2ecsi4396338pfb.80.2023.12.25.17.03.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 17:03:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11303-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11303-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11303-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E1D4528163E for ; Tue, 26 Dec 2023 01:03:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7E345A2A; Tue, 26 Dec 2023 01:03:35 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35B26A29 for ; Tue, 26 Dec 2023 01:03:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4Szc2h2RvfzMp8D; Tue, 26 Dec 2023 09:03:08 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id 6D3FE18005E; Tue, 26 Dec 2023 09:03:29 +0800 (CST) Received: from huawei.com (10.175.104.67) by dggpemd200001.china.huawei.com (7.185.36.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Tue, 26 Dec 2023 09:03:28 +0800 From: ZhaoLong Wang To: , , CC: , , , , , Subject: [PATCH v6 0/5] ubi: Enhanced fault injection capability for the UBI driver Date: Tue, 26 Dec 2023 09:01:08 +0800 Message-ID: <20231226010113.742079-1-wangzhaolong1@huawei.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemd200001.china.huawei.com (7.185.36.224) The existing fault injection capability of UBI is too simple. It uses hard-coded fault probability values and lacks other configurable options. As a result, these interfaces are difficult to use when digging defects in the abnormal path of code and reproducing some problems. The kernel provides a powerful fault injection framework, which provides rich configurable fault injection attributes during runtime. So it can be used to improve the fault injection capability of the UBI driver. This series of patches refactors the existing fault injection interface and add some fault injection types to help testers and developers find potential problems in the code. This series of patches enhance the existing fault injection interface and retain the old debugfs interface, and add some fault injection types to help testers and developers look for potential problems in the code. v2: - Retain the old fault injection interface. v3: 1. Corrects the initialization of the error mask, which should start at 1. 2. Change the read format of the mask value to readable hexadecimal. 3. The interface definition style is consistent when when adding the new interface. 4. Redundant macros are removed. 5. Correct the fault injection hook position error: ubi_io_read_data -> ubi_io_write_data. 6. UBI_IO_BITFLIPS is returned in ubi_io_read() in advance to prevent the return value from being overwritten. 7. In the last commit, an example of the use of fail_function is given. v4: - Delete redundant space characters. v5: - Delete the redundant semicolon of the first patch. v6: - Check the patch completely and fix English syntax errors. ZhaoLong Wang (5): ubi: Use the fault injection framework to enhance the fault injection capability ubi: Split io_failures into write_failure and erase_failure ubi: Add six fault injection type for testing ubi: Reserve sufficient buffer length for the input mask mtd: Add several functions to the fail_function list drivers/mtd/mtdcore.c | 5 + drivers/mtd/ubi/Kconfig | 9 ++ drivers/mtd/ubi/debug.c | 108 ++++++++++++-- drivers/mtd/ubi/debug.h | 304 +++++++++++++++++++++++++++++++++++++--- drivers/mtd/ubi/io.c | 86 +++++++++++- drivers/mtd/ubi/ubi.h | 45 +++--- 6 files changed, 498 insertions(+), 59 deletions(-) -- 2.39.2