Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp412306imm; Fri, 3 Aug 2018 05:40:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbqIjvWlv3LWt4AiS/Pp21hdGlkSjWGOTDvqHxDcTXxaEVML4TiAhbTXhRFkqUw/zKq2XV X-Received: by 2002:a62:a6db:: with SMTP id r88-v6mr4369381pfl.60.1533300005667; Fri, 03 Aug 2018 05:40:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533300005; cv=none; d=google.com; s=arc-20160816; b=gGozv7Uc74i4fnQCP3voU/jtcIKtJjfiRkI1HdKNszQJT9/GYA9Tz6rwW+hLqF2hge mFUoPuALha76+95tB6NGnUillToIIJn0d4bcoHeDPWnYzTdOn51re8c9cTPGeiQqi5d4 LZ9bObLObF9cfxeDhkzqyc4YLJFNXd4IHlbA/R0/Ik9ZXXYz4lDc5gOTfy0Y0OPuPf2z AyCfI5yBQCLCMxyFYSEyzAmNTFLXl8ZWBtUKEJ/1Ul1WIGkVJzXhV367TquDuhYJ7MV9 lCDOuwiwjzv0UKu4chZgw2891RHHBPMFRlgnIaWAMnscxGbr7DUVJVJbk32ELxlQnR7A JwHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version: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=zmUU/r5MamgPJRbzRdVMTd9MT5ZZNtdbHSn2tIRrBOY=; b=PQwNYVOTiDWIcbW4LBW462ZRR7QRPdWZaoDVbpQ4ITD4+FU9JtcqbTct165Ep5f169 hPDtO9/uU63OFiU9yKkwBMOq0kBx0eAeQ46fyX3iu+WxF2MDxCyuEme14Q8IVI71AsQc tv6hKPLRBsmedF2yjxe5lGFZm9n7v0P3j4T6z8g1OVIAvTj7H13cf6wcNwKIluyMgoGr jR0m6AyPTYOIGGz52TpXziPiCQ/qT4CoyVCu4cxyzOEeiY/g4XDkCEAOyQvoC0orMcbH UVCqPUKcO7JB+dGvvLuqvpZCe/kr+4rDb6Yze8+kv2u+ZI11FJr9UG0DLbiSz496ZRWX HMfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cnexlabs.onmicrosoft.com header.s=selector1-cnexlabs-com header.b=FfO2UpFM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13-v6si4930100pgk.344.2018.08.03.05.39.50; Fri, 03 Aug 2018 05:40:05 -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=@cnexlabs.onmicrosoft.com header.s=selector1-cnexlabs-com header.b=FfO2UpFM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731192AbeHCOeB (ORCPT + 99 others); Fri, 3 Aug 2018 10:34:01 -0400 Received: from mail-by2nam01on0072.outbound.protection.outlook.com ([104.47.34.72]:31744 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730129AbeHCOeA (ORCPT ); Fri, 3 Aug 2018 10:34:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cnexlabs.onmicrosoft.com; s=selector1-cnexlabs-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zmUU/r5MamgPJRbzRdVMTd9MT5ZZNtdbHSn2tIRrBOY=; b=FfO2UpFM558A9Cy3Kv35IZhI/1f+F8qEs/cBM0wZiHRWuIE6he5r/xEyqkI60Dlm2rHcbmS+piYtrKjhc3u2U4Dr3Pky/mQht7dWc0GNcD1okM45YUIA2YPIyFSn5qxSw3NGGT6N9RxdzX6nAE+4m8Y2oGPCFaBu2K14XKNBhP8= Received: from CO2PR06MB538.namprd06.prod.outlook.com (10.141.199.23) by CO2PR06MB602.namprd06.prod.outlook.com (10.141.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1017.15; Fri, 3 Aug 2018 12:37:46 +0000 Received: from CO2PR06MB538.namprd06.prod.outlook.com ([fe80::311c:7e3f:3043:5287]) by CO2PR06MB538.namprd06.prod.outlook.com ([fe80::311c:7e3f:3043:5287%8]) with mapi id 15.20.1017.010; Fri, 3 Aug 2018 12:37:45 +0000 From: Javier Gonzalez To: =?utf-8?B?TWF0aWFzIEJqw7hybGluZw==?= CC: Hans Holmberg , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] lightnvm: pblk: recover chunk state on 1.2 devices Thread-Topic: [PATCH] lightnvm: pblk: recover chunk state on 1.2 devices Thread-Index: AQHUDsAqECp4D0lQUUKx9mO19FFp2KR1YqSAgAG0kwCAAAIjgIAAAc0AgCcOdICAD/s1gIAAAWiAgAAH7gCAAAHkAA== Date: Fri, 3 Aug 2018 12:37:45 +0000 Message-ID: References: <1530177121-24908-1-git-send-email-javier@cnexlabs.com> <1530177121-24908-2-git-send-email-javier@cnexlabs.com> <43D7E3C4-765F-46AB-9B84-27E37FCAE016@cnexlabs.com> <19b2f125-d373-cf2b-43c7-140b3872cd64@lightnvm.io> <8c2fc1ff-e2ea-499e-3699-39622d00be9e@lightnvm.io> <88659F4F-8105-41CA-B0B8-849E707F18CD@cnexlabs.com> <423c5d4b-6d9a-d233-d3da-f2cb8b10f880@lightnvm.io> In-Reply-To: <423c5d4b-6d9a-d233-d3da-f2cb8b10f880@lightnvm.io> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=javier@cnexlabs.com; x-originating-ip: [193.106.164.211] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CO2PR06MB602;6:Xa1cV9oNGSjwTr2zNlMb+EwiXzo0lowzNGietWnevOKjmMUNs9To6BnrAkC9Qsky4jGpyazOMwNLhHoGdTJxB937E+XZZx4xS3CwRGHYHOdlFx51XsunIMl5m3nMiWtv2Tb1V9N5z8iYBnY/mAyGJBaxhjtAo/NQZVlvMp0hoDVZv/0+FdgIL+2VtsnRlKBT1Dat5k0EMUJU3BngovpXvhZF+MkzpiSFAVhL+I7UQxwIF9Ni2iNYrNuNQ0sDiTsXp3B3QNdSF7aa+bQ4wfdwzzorIfoKvtSwRSppLDVg9v9dgDlBNLrBiM3vRprCvCOz7tXQXH8902ZVLVMSX0xR1nP+kp069ngupC18cN7cG44V+lfUbX2GZdTFw2ESwoId0JTFn8W0GSZscdvfckZPrJa2l/7e+ThBVR0RX+uR4rr9G+oqW1YyC1HlW0Q9YhflRbHFg5miz1mGixs0Cc25sA==;5:LXk+N4TB0fLNkYtF8xNFVDmYzs56Gp4WvOZji5j0BiYCwg5cZ7jicCTSUow4GAdDZEwo5fiuIWRxYjmcyxVBLpzRcshvXQptnkXccUJ3r+Qi92BSJs/ItZqN3FJBvCenrToG0Q2e04vrDuzP+bYfJm4FZqEXLUNyksy5acFs2FA=;7:EyM71BVqQ2d82/F4lZFxlnZa0MGrOliDobBLVWQtQgBM11Z5Sf3RAu/iHu30RnXsnjBBhDKRw53JyU1uaud6gtI8w9Px0sQmZyaMDheVFv7td6ZfhZ6C+0gjUOEPHvfvClir6vPA5lZNKBPHxMKT33ZP/lseeJGBvVO33vDzz3QJDm3++LwvhnYP9bu3zKpAknc2iFDcVymc5wBTV3X4Fy0X/OpLp58GlTHPPVKd5Ns0kC9NymwB65GW3Tkyine3 x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(366004)(376002)(346002)(396003)(39840400004)(136003)(199004)(189003)(81166006)(8676002)(5660300001)(99936001)(446003)(14444005)(33656002)(316002)(478600001)(86362001)(83716003)(105586002)(6916009)(106356001)(5250100002)(8936002)(36756003)(3846002)(6116002)(11346002)(54906003)(14454004)(476003)(2616005)(256004)(7736002)(81156014)(26005)(486006)(305945005)(93886005)(6512007)(53936002)(2900100001)(25786009)(6246003)(229853002)(82746002)(4326008)(53546011)(97736004)(6436002)(6486002)(2906002)(99286004)(66066001)(76176011)(6506007)(102836004)(68736007)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR06MB602;H:CO2PR06MB538.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; x-ms-office365-filtering-correlation-id: 1f6e75c3-2860-4b1e-b16a-08d5f93dea1c x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(49563074)(7193020);SRVR:CO2PR06MB602; x-ms-traffictypediagnostic: CO2PR06MB602: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(102415395)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231311)(944501410)(52105095)(10201501046)(93006095)(93001095)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:CO2PR06MB602;BCL:0;PCL:0;RULEID:;SRVR:CO2PR06MB602; x-forefront-prvs: 0753EA505A received-spf: None (protection.outlook.com: cnexlabs.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 2m9nFtzS3Wu5CjLk4dVtqNGyNX8TPk0diRCzXulAzFOtJgXGjFMYwr5Q+3fAs8cM0/EGToW7KTHxuldDyc1nHNd7ppSo7dQuPMcn050LJyWlqHI0vc+uNP8b/H5v9UQp7+imF8/A9hYh64zEiqLZNFcVblXLYh4QOAi3Bn2EKM+wSVkOhfn459g5Y7e6GX7280S8rZ1k0Kch5s+TLkICuCTlsIX8cT3hM2jeSe2DKEDh0tnywRWS1QqQ4uBxtDlZkScchyuN0Lt4ZXEuugI8ZPjJjyk+SCOuUQ/LlI790MtS6N8kt0ruKbR7Xv+T60BBUmAoIrVIjc3R4IfDe5TS5LmoCSMz4spIkc7JBrFSz1E= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/signed; boundary="Apple-Mail=_B920FB36-7AAF-4147-AE97-EAFBF9B7B5BB"; protocol="application/pgp-signature"; micalg=pgp-sha512 MIME-Version: 1.0 X-OriginatorOrg: cnexlabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f6e75c3-2860-4b1e-b16a-08d5f93dea1c X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Aug 2018 12:37:45.6471 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: e40dfc2e-c6c1-463a-a598-38602b2c3cff X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR06MB602 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Apple-Mail=_B920FB36-7AAF-4147-AE97-EAFBF9B7B5BB Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 3 Aug 2018, at 14.30, Matias Bj=C3=B8rling wrote: >=20 > On 08/03/2018 02:02 PM, Javier Gonzalez wrote: >>> On 3 Aug 2018, at 13.57, Matias Bj=C3=B8rling = wrote: >>>=20 >>> On 07/24/2018 09:54 AM, Javier Gonzalez wrote: >>>>> On 29 Jun 2018, at 13.28, Matias Bj=C3=B8rling = wrote: >>>>>=20 >>>>> On 06/29/2018 01:22 PM, Javier Gonzalez wrote: >>>>>>> On 29 Jun 2018, at 13.14, Matias Bj=C3=B8rling = wrote: >>>>>>>=20 >>>>>>> On 06/28/2018 11:12 AM, Javier Gonz=C3=A1lez wrote: >>>>>>>> The Open-Channel 1.2 spec does not define a mechanism for the = host to >>>>>>>> recover the block (chunk) state. As a consequence, a newly = format device >>>>>>>> will need to reconstruct the state. Currently, pblk assumes = that blocks >>>>>>>> are not erased, which might cause double-erases in case that = the device >>>>>>>> does not protect itself against them (which is not specified in = the spec >>>>>>>> either). >>>>>>>=20 >>>>>>> It should not be specified in the spec. It is up to the device = to handle >>>>>>> double erases and not do it. >>>>>>>=20 >>>>>>>> This patch, reconstructs the state based on read errors. If the = first >>>>>>>> sector of a block returns and empty page = (NVM_RSP_ERR_EMPTYPAGE), then >>>>>>>> the block s marked free, i.e., erased and ready to be used >>>>>>>> (NVM_CHK_ST_FREE). Otherwise, the block is marked as closed >>>>>>>> (NVM_CHK_ST_CLOSED). Note that even if a block is open and not = fully >>>>>>>> written, it has to be erased in order to be used again. >>>>>>>=20 >>>>>>> Should we extend it to do the scan, and update the write pointer = as >>>>>>> well? I think this kind of feature already is baked into pblk? >>>>>> This is already in place: we scan until empty page and take it = from >>>>>> there. This patch is only for the case in which we start a pblk = instance >>>>>> form scratch. On a device already owned by pblk, we would not = have the >>>>>> problem we are trying to solve here because we know the state. >>>>>=20 >>>>> Agree. What I meant was that when we anyway are recovering the = state, >>>>> we could just as well update ->wp and set to NVM_CHK_ST_OPEN and = so >>>>> forth for the initialization phase. >>>> In 1.2 the use of chunk metadata is purely fictional. We respect = the >>>> chunk state machine as we transition lines, but all the write = pointers >>>> are ignored. Instead, we use the line bitmap to point to the next >>>> writable entry. This is BTW the same way we it in open lines on 2.0 = too. >>>=20 >>> Now I understand where you are coming from. I had the understanding >>> that we where using the write pointer now that we moved to 2.0, >>> looking through the code, that wasn't the case. :) Which means that >>> pblk doesn't work with a devices that implements 2.0. Yikes... I = knew >>> I had forgot a detail when support was added into pblk. >> I think you misunderstood; pblk does support 2.0 devices. What = happens >> is that we transform the per chunk WP in 2.0 into the line bitmap to >> simplify the lookup. The point being that we do not need to create a >> fictional chunk for 1.2 devices since we do the translation to the >> bitmap directly. Does this make sense? >=20 > The chunk->wp isn't used anywhere. So it can't take wp into account. > It uses the EMPTYPAGE marker from 1.2 instead. See pblk-core and > pblk-recovery. >=20 I see that the patches for this are still internal. Will post for 4.20 >>> There are no empty sector marker in the 2.0 spec, since it uses the >>> write pointer to know where it is in the chunk. So there is a bit of >>> work to do there. >> Yes. And for 2.0 devices we go and look at the WP, but for 1.2 = devices we >> need to scan. >>> Since this properly is a bit more work to do, I'll look into it = after FMS. >> Look the comments above. All we need for 2.0 support is in place. We = can >> talk about it f2f. >>> I'm also moving the explicit coding of 1.2/2.0 chunk / bad block >>> fixing into core, so pblk can be simplfied, and doesn't have to = think >>> to manage each version separately. >> Good. I have a patch I was expecting to send after FMS for moving = chunk >> / bad block out of pblk for the same reason. If you're doing the same >> thing I can stop looking into it... >=20 > I am, will post when done. Cool! Javier --Apple-Mail=_B920FB36-7AAF-4147-AE97-EAFBF9B7B5BB Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE+ws7Qq+qZPG1bJoyIX4xUKFRnnQFAltkTJcACgkQIX4xUKFR nnTNHw/9G4WDVFkwkzZr44wYAscR6zPnq5j1OcB/+t85381hPUITrse08da1dePq KZ8SuD0tAjathPfSLsuf31NqvCqXqWDA24EkNdxWSoakIUM2/8cjg+5myXKKTZM/ 8jxQ0430haJNShRJBm1UkKYT7Mboigh+qWjiA4xhHmia9OX3VYOX6umVJaW+gg9l pMxSPUzr9T2nFCGgjL1Is3IJAa8cDOTZfPUX9De59Q2D/iTxSndTh8H2Uod1AX8+ DpzLE7Ix73hSS23gh/P+PkRv10oISSgqx4tZWIXmKkS9IRwXWtSCUus/wZWtWh6q X3bCWl3w/y5PEqptahyjWqS2LDmpJpLAw1FZJdloNXnZFuM/HeVMFuONaZN7AALs CLsPbbKgwcZixPVIksFP+RdyH0TfDuFmKqmu7rs405Ja2wu0c1R5KjwkGPBBk0PV OX3Ri60IyFna9Y0lxio0WJ0jaijumo+7IODM4jOEJaY5GbV429mz+pF2fkQtYhB3 B83JAhtrtbyefWo9U4TPAswoOv8Bsl8PY/rGhFhdoLBP4QnZu9YtuQF+7qndw3IJ uzMLANhns/6bzaPUlKD0Y6NmsH4BKLtjeT3ESl8IRg30g5UxaxT7tVbAD9JPhsHH 1z8+KycRaWhTniKJomkduvVz7hmgnbfx+Pny0h2MQt5pyYXa8T0= =ml0d -----END PGP SIGNATURE----- --Apple-Mail=_B920FB36-7AAF-4147-AE97-EAFBF9B7B5BB--