Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2187149rdb; Sun, 24 Dec 2023 23:13:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrWykZ1YrxEJecbykoR5VZRp4ZOXGrC8GXZvCK4FmiocY699mNbiq3DfxX5AiV8x4H3ytH X-Received: by 2002:a05:622a:2c9:b0:423:b4d1:2cd5 with SMTP id a9-20020a05622a02c900b00423b4d12cd5mr6562394qtx.21.1703488407635; Sun, 24 Dec 2023 23:13:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703488407; cv=none; d=google.com; s=arc-20160816; b=zQuSLq0moNO8XUtaEIZuiMDV19WouIDLyedo44aCkRSm/tXaZiK/zKpcilN3FCTMsY 2TMBRfs96FJZCNVFsTpyFt/oVPpW8t/J1wuSKEL3aa/EPzOSKBFZZvTNio6+AqEthySr jbQ9cVJpM4YTS2CFxnqJkJBnAUS7OaSFamstnNafhsfuFIFIbo1o9N+CBG+EKvOFMztL M6Sz0zP68Wew3x3ceQN200TyPuHLDN+mrl8AULplDXl5sKuWWDkj4M5QNKdyhJzNWErD 9HA4x2miOmHQtDfyDQ9cGbdMx3nZwiTy8DYdb82m3kOQtWhtEPC2QflcT8PY9e5X7sJz RneQ== 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=ja/Uw9tGipl/PZhRTyBuLec65AVlGNv/5M7Q61B7jys=; fh=XjbPFQV1q33pSyHU0DJViPof6LxQPkAWDXnCrlkcrhg=; b=tFVYu344ZAjPyImzJHcczr52kWy7dyRq+p9L9q1rqFTNzcWjvwnElbZhlzxkZm+RSM SgXZQzz+KPXv1jM4ZwyBakmFaiyVj6O9+PHyfNm3RAgBv/0vPKLIgJN+KVhnUWy/veVs mTXW4GH9kYo2l+TnkAqjIyn7rKsm36JdN2H1ypUXccfn7Bz1g9NMwYDP0nLl62nBvk8a 7h7ffKnoWo+42SgX5VGFT50PBw14sg63tUsGXH7CUvQp3xSijBrp+Vrfk8RO1x5m51SN WPLlqOLN4/asvL8r48ekJzKaeoJw/EOhcFjVE1KhFT/XF0bSZO7xCizRfkNvqzU/BhAz SdDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10921-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r4-20020a05622a034400b004261ce4a8c9si10481808qtw.231.2023.12.24.23.13.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 23:13:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-10921-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10921-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 647481C2162D for ; Mon, 25 Dec 2023 07:13:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E560C1847; Mon, 25 Dec 2023 07:13:20 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 AD8DA15A8 for ; Mon, 25 Dec 2023 07:13:17 +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.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Sz8H354KVzvSYb; Mon, 25 Dec 2023 15:12:15 +0800 (CST) Received: from dggpemd200001.china.huawei.com (unknown [7.185.36.224]) by mail.maildlp.com (Postfix) with ESMTPS id 5F0541402E0; Mon, 25 Dec 2023 15:13:15 +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; Mon, 25 Dec 2023 15:13:14 +0800 From: ZhaoLong Wang To: , , CC: , , , , , Subject: [PATCH v5 0/5] ubi: Enhanced fault injection capability for the UBI driver Date: Mon, 25 Dec 2023 15:10:50 +0800 Message-ID: <20231225071055.1721000-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 refactor 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 the new interface is added. 4. Redundant CONFIG_MTD_UBI_FAULT_INJECTION macro 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, example of the use of fail_function is given. v4: - Delete redundant space characters. v5: - Delete the redundant semicolon of the first patch. 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 | 107 ++++++++++++-- drivers/mtd/ubi/debug.h | 304 +++++++++++++++++++++++++++++++++++++--- drivers/mtd/ubi/io.c | 86 +++++++++++- drivers/mtd/ubi/ubi.h | 45 +++--- 6 files changed, 497 insertions(+), 59 deletions(-) -- 2.39.2