Received: by 10.213.65.68 with SMTP id h4csp1619142imn; Mon, 19 Mar 2018 08:55:12 -0700 (PDT) X-Google-Smtp-Source: AG47ELv3jXjhrdp1ta/D/6Seu0GMKFyf+Kj+PKq49szSm+a/y2FqIAwOGHGzCFhahUV+Abmu5H9a X-Received: by 10.98.56.131 with SMTP id f125mr10662697pfa.190.1521474912224; Mon, 19 Mar 2018 08:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521474912; cv=none; d=google.com; s=arc-20160816; b=qG/MZPRZzaRshrZPnMLHGmV2/AVDDBOL0Ub8bXCdfB5g69yMe+VKsSllTkrdUvrXni FSGjzbi0UW1rIGMMG/IOFz7WnH1UCTQoTzK3y0wpCaQFKoA8jexWLoLUtbpUIBWPnkbG Z3Tu8Y9/H460tojb8AB+txawrZjcGKVy2P/2imBAzYaH2+qyVAVTVWKMevgyXiHNIFdZ 1DNwaODS8KdK9LvhoZSK4s3x0WEv9MavwTMqDeewAmkek4x5WRYLiOiS1UhPuP4AcyOq qPg7SpMXMjUg3brSHAuam9eBiyKZ77/UIEPITMaCjHQlINoap2kG0jLyl871LVSqM2xz pIVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0qP3Xev7y3RWnwOSUKVrCaK+CUCyYAIxf4+jRQKeUUc=; b=yBUzak7OgcPFX3EuPP7kjPcUBHjAjDMjbIDrrwh7bRGboY0SQGSRVc3vfarh2kyiWc t2QWAeS5Dcn1nGkzjXzU/y8lcqLsAKOMGB27YpX42nHdNfD/u3Nt+vJUMP+usHxKQ7K0 BY9AsELQZX68ABR+O4OUHHZoTR2ymjJxI0Q1qVg7CXEticM1jn6bi9z8TJszSR/uW77B cCmRh1bFrG8Oqm2cMPJIL3VLnGsDaZqqv8MNFZlBHBxhxb9ynRLRgOOyTwtJFgLNsLcm IVasNMi08CKJ0orKJClpnGq0UQjOjUq7D4vYPtJKKUBIR62O0woUbRoNs6tw1lOvnm70 zIAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=C1uM3KKF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 65si173778pfq.250.2018.03.19.08.54.57; Mon, 19 Mar 2018 08:55:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=C1uM3KKF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934238AbeCSPx3 (ORCPT + 99 others); Mon, 19 Mar 2018 11:53:29 -0400 Received: from mail-bl2nam02on0111.outbound.protection.outlook.com ([104.47.38.111]:9280 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934065AbeCSPuO (ORCPT ); Mon, 19 Mar 2018 11:50:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0qP3Xev7y3RWnwOSUKVrCaK+CUCyYAIxf4+jRQKeUUc=; b=C1uM3KKF/QzOMFxE3SG4wTvOta+kxMDQFZVPHImnVL3SOq5UP460HJLWa/qEIwGwkRYaG365eOBMSRCm92CpJXzZ1dUCO4PSHY30SNH3Ris0vVR2k45SX2FdAIixIvkbiW116ZZrpkzJotY/cjHnpYKdMgPk5xROzSgvFTpU998= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1109.namprd21.prod.outlook.com (52.132.130.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.631.0; Mon, 19 Mar 2018 15:50:00 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::3d9b:79e7:94eb:5d62%5]) with mapi id 15.20.0631.004; Mon, 19 Mar 2018 15:50:00 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Miquel Raynal , Boris Brezillon , Sasha Levin Subject: [PATCH AUTOSEL for 4.15 114/124] mtd: mtd_oobtest: Handle bitflips during reads Thread-Topic: [PATCH AUTOSEL for 4.15 114/124] mtd: mtd_oobtest: Handle bitflips during reads Thread-Index: AQHTv5nRZ5xyZs8It0u43n+JL+NAhw== Date: Mon, 19 Mar 2018 15:49:09 +0000 Message-ID: <20180319154645.11350-114-alexander.levin@microsoft.com> References: <20180319154645.11350-1-alexander.levin@microsoft.com> In-Reply-To: <20180319154645.11350-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB1109;7:WobBDMKdQzzIcyWwWthQnaalPl+RtymWeVAguxPbOcKMYfvKx9muwBGEzFircDLlw0JS2s0n5PUhRspswKmGo4oCmk2q2Zxrkh2eZIlhWyF1FctnPKNQAEM3oWrwojwJV26wXmHG9cJQYglSxRIUvpgytIekSc0IwmXZqR5ef5NAlBq13iJUdtCtK8fwKD6L9J+kbcW5ctHoBiKPYFXLQPCwHCNreQVNd9gX6E9CytybhdwynLPrZiM5hYGrrQog;20:bMp0osOENJ6ShA/n2Pa5VI/NPFaAcuT7eXr1p7OKzWDQ7taEblMBb2SIG2//8owitus4LUHoAfxDku6uHS7BjBBW7hPIETqaADAmVhuRnHS20bqDKqksWydZKN4e+astE92xj2cSDRDhCeijfj+4KcKTzUqK7yPmy0TURYJZ/8o= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ad74f29a-ae06-4163-c6b9-08d58db11266 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1109; x-ms-traffictypediagnostic: DM5PR2101MB1109: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501300)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB1109;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1109; x-forefront-prvs: 06167FAD59 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(39380400002)(376002)(346002)(199004)(189003)(81166006)(10290500003)(107886003)(81156014)(106356001)(6506007)(8676002)(3846002)(36756003)(8936002)(97736004)(6116002)(1076002)(102836004)(68736007)(3280700002)(2950100002)(3660700001)(478600001)(72206003)(59450400001)(2906002)(14454004)(76176011)(66066001)(6512007)(5250100002)(10090500001)(2501003)(53936002)(6486002)(6436002)(26005)(316002)(22452003)(305945005)(7736002)(4326008)(25786009)(86362001)(86612001)(5660300001)(2900100001)(99286004)(54906003)(186003)(105586002)(110136005)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1109;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: NIymHPpi9RDUPOqG2lKBtXsVt46NGNQNJyuJdkY4A351qumNFzT5tcuWABGxSe4SQotNw8drTwAN6LCDjwo23Flc12lwoSYQ+vETqYF1DHMg617smzRQGsTviLeBfOTN2mNllh4dXemaRLWJW9+8Q3XMpuchtnThwdlVZS1JGfucmwmsjK5lxVMH7m0hHLo/Bz5arW8Oc3KJEbYelb0XSxxrThdxTYCNW69yv6WSrFSfJHSOmkck8RNZ5LVwAh20pRci4vX2JT4yecSEAVdqbemPqSqTHadAqqjmtJWhO7xCk20LD2c/6niMvdLn4mudRW1xfm6Ka3DsayWF50wdIA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: ad74f29a-ae06-4163-c6b9-08d58db11266 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Mar 2018 15:49:09.2891 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1109 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miquel Raynal [ Upstream commit 12663b442e5ac5aa3d6097cd3f287c71ba46d26e ] Reads from NAND devices usually trigger bitflips, this is an expected behavior. While bitflips are under a given threshold, the MTD core returns 0. However, when the number of corrected bitflips is above this same threshold, -EUCLEAN is returned to inform the upper layer that this block is slightly dying and soon the ECC engine will be overtaken so actions should be taken to move the data out of it. This particular condition should not be treated like an error and the test should continue. Signed-off-by: Miquel Raynal Signed-off-by: Boris Brezillon Signed-off-by: Sasha Levin --- drivers/mtd/tests/oobtest.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/mtd/tests/oobtest.c b/drivers/mtd/tests/oobtest.c index 1cb3f7758fb6..766b2c385682 100644 --- a/drivers/mtd/tests/oobtest.c +++ b/drivers/mtd/tests/oobtest.c @@ -193,6 +193,9 @@ static int verify_eraseblock(int ebnum) ops.datbuf =3D NULL; ops.oobbuf =3D readbuf; err =3D mtd_read_oob(mtd, addr, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err || ops.oobretlen !=3D use_len) { pr_err("error: readoob failed at %#llx\n", (long long)addr); @@ -227,6 +230,9 @@ static int verify_eraseblock(int ebnum) ops.datbuf =3D NULL; ops.oobbuf =3D readbuf; err =3D mtd_read_oob(mtd, addr, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err || ops.oobretlen !=3D mtd->oobavail) { pr_err("error: readoob failed at %#llx\n", (long long)addr); @@ -286,6 +292,9 @@ static int verify_eraseblock_in_one_go(int ebnum) =20 /* read entire block's OOB at one go */ err =3D mtd_read_oob(mtd, addr, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err || ops.oobretlen !=3D len) { pr_err("error: readoob failed at %#llx\n", (long long)addr); @@ -527,6 +536,9 @@ static int __init mtd_oobtest_init(void) pr_info("attempting to start read past end of OOB\n"); pr_info("an error is expected...\n"); err =3D mtd_read_oob(mtd, addr0, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err) { pr_info("error occurred as expected\n"); err =3D 0; @@ -571,6 +583,9 @@ static int __init mtd_oobtest_init(void) pr_info("attempting to read past end of device\n"); pr_info("an error is expected...\n"); err =3D mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err) { pr_info("error occurred as expected\n"); err =3D 0; @@ -615,6 +630,9 @@ static int __init mtd_oobtest_init(void) pr_info("attempting to read past end of device\n"); pr_info("an error is expected...\n"); err =3D mtd_read_oob(mtd, mtd->size - mtd->writesize, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err) { pr_info("error occurred as expected\n"); err =3D 0; @@ -684,6 +702,9 @@ static int __init mtd_oobtest_init(void) ops.datbuf =3D NULL; ops.oobbuf =3D readbuf; err =3D mtd_read_oob(mtd, addr, &ops); + if (mtd_is_bitflip(err)) + err =3D 0; + if (err) goto out; if (memcmpshow(addr, readbuf, writebuf, --=20 2.14.1