Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07E12C433EF for ; Mon, 29 Nov 2021 15:43:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D78E882FAB; Mon, 29 Nov 2021 16:43:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="pO4eVOdo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A5D283022; Mon, 29 Nov 2021 16:43:10 +0100 (CET) Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CE1E482F9D for ; Mon, 29 Nov 2021 16:43:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf33.google.com with SMTP id jo22so14889425qvb.13 for ; Mon, 29 Nov 2021 07:43:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=60nCWRXoJSxcatAlZLuwjOw/kNc1dbQUU7PnWxOOICU=; b=pO4eVOdoevfGDConOtedt3nhRbaNUPSepskenGOYtt/YYq7qekWmg0Msjxp4Mlr4Fs OidSUUL2KNwYDUn8kUE/LmnIvMMa7VZNSA42P5une2SltSv0phAYpw2CekA7Q2ggDj1+ egJiRZAlw6vU6/UCTR9s+wtGvs56KbqDAiKAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=60nCWRXoJSxcatAlZLuwjOw/kNc1dbQUU7PnWxOOICU=; b=CIvoJAl03TXNdNVPXbLFKBPbOrZXpyYEnNnnhf1MEOLFMtyOX2ocX4YDRoM08az+PK ktZHBSQWxfsYG7mx+hLq1gAJNCOMlQz8L53XhNuxsCs63Tu9/funs/CTxBUm7HeB5Ulf Qa0lyajMTDbVqdtNNqN1oT2wpzs2Vv1qBK+aOLj9VTb54eE7dWvQbrZ0/fdiOsqQlgeO 582S41R/pzo7m+KyA02LeZNt+53Z2KIMG3+G0xAM4g3bCTENP3SoJTIOw6A2GDKV14g6 zHjCVhjveWldo/HrdQa9Y3MrEPeujfWL2slygWGToT5XAmDkjuzy4xXft0dhyd5xtd9J Nu9Q== X-Gm-Message-State: AOAM533lYsudL5E+7rlgMeOQ25a9UHPTIDmyxt+57MxFll96c38xu9YX KgbxsiQOO9n/QgTPpPW2+RuIbQ== X-Google-Smtp-Source: ABdhPJyXw364vfPP8JO3rv7sfyZWM2CqTp8t5aqegBgN4rsbJ72t7KqsCziwJCaK5AYgXXlJjnzJpA== X-Received: by 2002:a05:6214:c6e:: with SMTP id t14mr31985356qvj.112.1638200585531; Mon, 29 Nov 2021 07:43:05 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-edec-aa90-ebd5-017a.res6.spectrum.com. [2603:6081:7b01:cbda:edec:aa90:ebd5:17a]) by smtp.gmail.com with ESMTPSA id q6sm8682205qkl.106.2021.11.29.07.43.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 07:43:04 -0800 (PST) Date: Mon, 29 Nov 2021 10:43:03 -0500 From: Tom Rini To: Francesco Dolcini Cc: u-boot@lists.denx.de Subject: Re: [BUG] emmc `env erase` erase unrelated data Message-ID: <20211129154303.GJ24579@bill-the-cat> References: <20211129132123.GA306087@francesco-nb.int.toradex.com> <20211129152530.GI24579@bill-the-cat> <20211129153834.GB306087@francesco-nb.int.toradex.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2qkyu1R6kqeK19z+" Content-Disposition: inline In-Reply-To: <20211129153834.GB306087@francesco-nb.int.toradex.com> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --2qkyu1R6kqeK19z+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 29, 2021 at 04:38:34PM +0100, Francesco Dolcini wrote: > Hello Tom, >=20 > On Mon, Nov 29, 2021 at 10:25:30AM -0500, Tom Rini wrote: > > On Mon, Nov 29, 2021 at 02:21:23PM +0100, Francesco Dolcini wrote: > > > I noticed an issue with env erase command when environment is stored = in a > > > emmc device, in case start/end are not aligned to the emmc erase grou= ps > > > size additional data is erased with just a warning. > ... > > > I do not think that this is the correct behavior, I think that in case > > > the env is not aligned to the erase block size the erase should either > > > fail or fall back to just writing 0xff. Not sure if just changing > > > `mmc_berase()` is going to affect any other use case in which is valid > > > to have a non-aligned start/size and just erase around it after a > > > warning. > >=20 > > Largely intentional behavior. Perhaps the help text at least should be > > updated to note that environment size for MMC needs to be a multiple of > > erase block size? And further that when using redundant environment > > it's strongly encouraged to make sure each environment is on its own > > erase block. >=20 > I'm not really convinced, but let's move forward from this point. Alright. I'll also agree that it was designed when erase blocks were probably smaller and that yes, it's a lot more wasteful these days. > Are you aware of any other issues in case the emmc environment is not a > multiple/aligned to the erase size? I believe that the rest of the code > just read/write to it, so once it is aligned to the read/write block > size (512 bytes, usually) there should be no problem. I believe you're correct. --=20 Tom --2qkyu1R6kqeK19z+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmGk9QMACgkQFHw5/5Y0 tyyragv9HDSjAMdadvLi08Bh0riS+zwxrGk10v2C32uyuvkwqCSxh1v2YQnuATDu 5u4Rkl6is+aWWQQr3E9hQnRSPzHqk5Cet05gaLSF1zZ3igQEckct+DdlI35oASga OwyeO/amXj+X+KEKON7ineRpAo0tDg0wjoUz4/uqvA0x+VPIlgCVSldQC42zALFs ajWHA3ceFOgw87b6AbVMyYFDvcCef4BAaZTNR7MlBSJM38vLu9xLP8ASQiTCrBXH j67VookmfYa9VYurVAt8dSjHKy2qATVQdp8Urw29DIuPXz6Poq0fdx4sO7NdrKGS 62X5ecMQgBUUE5vuvFf1c6rOKsOinvznOQNW5qDBK28yPCSptN+2w6yoq2j19Klp 3A0EOA561fzC2H1LocGM+MC99dki1Qe1ZS6SkouKw4BBJ+OR8s6AEW7YMJbpLhQx VWYNmqz7kleR3xlCBx1BUkergprR7pcDjqwceFLRcX8YGV4BykNVfvWgRC9bmQx3 GmFrtICf =oWQv -----END PGP SIGNATURE----- --2qkyu1R6kqeK19z+--