Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp285828rdf; Thu, 2 Nov 2023 23:51:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeK8exgDoQeAUsHfGPYSj9J+14YLdoktgWd8Gt3otl0FPer1Zc/H1/ym4XzLj2evh0hnZE X-Received: by 2002:a17:90a:ca11:b0:27c:f8bd:9a98 with SMTP id x17-20020a17090aca1100b0027cf8bd9a98mr15898237pjt.40.1698994311170; Thu, 02 Nov 2023 23:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698994311; cv=none; d=google.com; s=arc-20160816; b=Rb/komNkaSiEGRAdbxryGi9j7l+SUd4VcbtS0Ak08wzKme/DWFKvPusbterDHWXyfp KXZsT4CmBlX5xXPlncysBjky1QA1Jq6YyVmVLRLwH5v+dw0iN5Bz7Z7OX4DlVkff1wzp Po2m05f4uv2elLtWITJxTvfYROiDU1j+qdFV0kvd8mQtUZNPHXrHvs1cSHr24ByL+vfs iHuteKlNaPJ1ePWSkWTgK5AxFVfaMq0jjEAj7YybpKNCHJ12A8vBe3HhcNTxMWPmm+At rWRu2AgXRl35PC1nIFzmLcsMaK9olAIpc97OTWSuN4MAhKTiiBdqXmJOMaFNtFTMY5yU 3uyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=LgU2B43CiyNXOcV4kXFUf6ErpChjk93cwWieiF3baHA=; fh=HUr9Z4SyidCwxxLdYl3fz1+19Hniu9qscc2AIhp8Db8=; b=VTDDiTLOil9ZK/naHDnULSOOp6v7+mWA/atpZb87eEYEyYQsUCBgN2xqU7WxdX45Ah A+GfoFrLJYbLGSoU7PXd38QmyJp8/AkT9BF7dZeWk1BOpyObFeYVtks43DRZSL3QekxH /UkF68jnRiyoIdN0Gt8lPlEpQCEngwUKC7TEbdwoQ5FaWTpZ6GmSdJXGmcFXoOFh/su2 +frkzuKVA8wD1HhSXlOe/eI3Sq8jrRJww8bkNbgJ+cxNGyBjw3/KSrzyL+kl1o8OgXk1 D9HF63W9Vn0Zrq4lnkVryCfirRgqey/fl4GNQjhQoXwGvf2jexvZBnYUlwkzkZQljAuo GUWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id s12-20020a170903200c00b001c3b4eb2135si974302pla.463.2023.11.02.23.51.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 23:51:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 7979681A5DD8; Thu, 2 Nov 2023 23:51:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231825AbjKCGvZ (ORCPT + 99 others); Fri, 3 Nov 2023 02:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231129AbjKCGvX (ORCPT ); Fri, 3 Nov 2023 02:51:23 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBD2A1B2 for ; Thu, 2 Nov 2023 23:51:17 -0700 (PDT) Received: from dggpemd200001.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SMBB35CX8zPnxc; Fri, 3 Nov 2023 14:47:07 +0800 (CST) Received: from huawei.com (10.175.127.227) 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.23; Fri, 3 Nov 2023 14:51:14 +0800 From: ZhaoLong Wang To: , , CC: , , , , , Subject: [PATCH v4 0/5] ubi: Enhanced fault injection capability for the UBI driver Date: Fri, 3 Nov 2023 14:55:31 +0800 Message-ID: <20231103065536.3778940-1-wangzhaolong1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemd200001.china.huawei.com (7.185.36.224) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 02 Nov 2023 23:51:45 -0700 (PDT) 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. 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.31.1