Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp827584rdb; Thu, 19 Oct 2023 23:43:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUkmyApOmYQDVCPJY/Or60xOl/ayOewPIap7r3kCCtmBPu7fkQxdQkwSQrYWt3IKwujvIy X-Received: by 2002:a05:6a20:e125:b0:f0:50c4:4c43 with SMTP id kr37-20020a056a20e12500b000f050c44c43mr1521135pzb.5.1697784228070; Thu, 19 Oct 2023 23:43:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697784228; cv=none; d=google.com; s=arc-20160816; b=ZBLCGyTV42v+CzGaXvhT+dwv7COKSC+jr31IJHI+3VCd92nPWFts0T7u47RXg6pAzT QpdEeihYXToC75F9moKKetd5cHLH3CXfPi3ek5mWaneMk1/wt6mjG4PiujD4ZelnkfVW f7Rgx6gS92FCKMwXiACZRC8DJf8AAuhpdjUjz9UuuD7Boi0A41UjZWx81Vv6yv6ydyU1 uX2czPZCIHg9F392D9bThYYz1QMwyeAzgyPK2nQSQKbXk1YHFLvaH5Z0Tee5lIKcSIQg 5Z6jhQll6zPqrntdKRhVlbxbcDTik/tpuqtSrX+wspzOaArdrciMYDQu4/Ijsp7pck2q zTrA== 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=n669AbEWoERcrcRHDL1A3mM9PPqjcAgu10T2ZCxmi2w=; fh=HUr9Z4SyidCwxxLdYl3fz1+19Hniu9qscc2AIhp8Db8=; b=c7BT8E20wbJBQ+3SIPxzhyhod8pyYobVUdfTCJKgdUQqVRL8RtpneMnDAB1DF1gHkC F51cVgXo/aOaFX0cUeWrmlGAuWz1CvXk8XEYxMKZz9gniWeaK9VIs/mdYNy/vlCzBAxa MLwZyhggeY27scpyfmA7XEXZxJCPvSOzlgmjIWLEoB/4pWaxcu0arcYQdk2MzY2If67E tAMwDAEo+vkZJ2EHx+A176Y3b3tQs/tdroN2LN/4HMkAKZj5TALRc2o3nPCRiEDOzJYT xjtUO/tiAy+MzMxwxURFno/n9lv/YBZ51TFwn2Ie6hi8mR+L7kd+Nz38hborXPQMRLwP dFWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id f26-20020a63381a000000b005ae776b8619si1211960pga.460.2023.10.19.23.43.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Oct 2023 23:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id C3CC582A45F7; Thu, 19 Oct 2023 23:43:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346919AbjJTGn0 (ORCPT + 99 others); Fri, 20 Oct 2023 02:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229644AbjJTGnZ (ORCPT ); Fri, 20 Oct 2023 02:43:25 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39D29D49 for ; Thu, 19 Oct 2023 23:43:22 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SBZfc4g5RzcdDh; Fri, 20 Oct 2023 14:38:32 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 20 Oct 2023 14:43:18 +0800 From: ZhaoLong Wang To: , , CC: , , , , , Subject: [PATCH v3 0/5] ubi: Enhanced fault injection capability for the UBI driver Date: Fri, 20 Oct 2023 14:47:58 +0800 Message-ID: <20231020064803.643399-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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500009.china.huawei.com (7.185.36.225) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 19 Oct 2023 23:43:46 -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. 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