Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4091446pxb; Tue, 2 Nov 2021 04:03:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCUMIu1F15mZRAbatPgx7+re3ZEKPrZPvkllKy6aavCF/idrHPE22ndxypt1xJQQcIlNsj X-Received: by 2002:a05:6e02:1b08:: with SMTP id i8mr13881436ilv.130.1635851021423; Tue, 02 Nov 2021 04:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635851021; cv=none; d=google.com; s=arc-20160816; b=1BsG7QpRu2z4jtJcuFfMupueZCSPBosMGM/zlVAV+ZEywdtHhHB6JVX0rOmPNCpf8O PBFHdt8iT0MtSfL2d5+QacrYYF6foGNhlyRbK7Dy+SzT7As78MeITetiN/Ozw6ZX5GxQ 0YLsqlN3BiZMhnDcea5cN53RqELeUpJrd3U3GAPaEWu+sGy4TSXRuGc1ozw1xBugWb4+ 0cFmcF/HeXl+vrj1jcPZdgVH8FWjMDN7iRzysmQgY46jhhXq15FkYkKIwppEqHdZ8gec FLScE9dM2Le0WjdB9HU8jqCyEn7Th+Y0Zcor5bJsu4KTyWDQUnzFbOhTyJt9l96O9DYU FMjg== 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:dkim-signature; bh=RJ9UROEfj3SCnc/LEmt1OfhWChZHAOtYKQv85DSOXiw=; b=OrwjgZ2u7s0i1NM6xYyFVybkk4kdKzTPIf/+BM5XMWSS9tgzfjSEr51pwjiTy/fy4E 2xI9l5TTHyM7tijaNNCz/M9p8cISiPCVcH9P1cALqbgRznZ2dOdfPfP1xWcmifucA4eq ILJTxH3JnSeiFyJLrV8Qgai+LXh5ZNcA5rAojzCPhhOEK6NAOR1098gUEG4DfQtY2ISM O5sL/3jXQj/SCs+4yoOAeW4lARSVU3DjLPLnJCqv3rQJjNd1n7Oso1lnf0rNn5RIPyhU aaBfxWuDk2aa756zjS+NHNYva0c647nciuOyeXtQAweDY4ZWibeOh0Y5LaK8C7GX9+Ec C1Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=mEm9AL5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n3si26338215jat.113.2021.11.02.04.03.21; Tue, 02 Nov 2021 04:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@geanix.com header.s=first header.b=mEm9AL5p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=geanix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231232AbhKBLEx (ORCPT + 99 others); Tue, 2 Nov 2021 07:04:53 -0400 Received: from first.geanix.com ([116.203.34.67]:37536 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbhKBLEu (ORCPT ); Tue, 2 Nov 2021 07:04:50 -0400 Received: from zen.. (unknown [185.17.218.86]) by first.geanix.com (Postfix) with ESMTPSA id D1CE3D746D; Tue, 2 Nov 2021 11:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1635850929; bh=WfKdVcgX6AGTMY936VHnBpAoH4wgP3qvp6CWej1BIvg=; h=From:To:Cc:Subject:Date; b=mEm9AL5pdSrJTTch7iJacDrm+YLTiO5K6iKxGxNaYm/vtvfmuvhx/PxGFfJ1g/DNK iIoeEWXLVQ9+tAch2MChSJDVclOYP1hHVg2vOgtgmBbVQv3wUT+jbKqW577B9Y89Nq Vj+dsDlwmBZj0XApksD4xjLIlEbTTmdNuHWKhcUqLo5nMvdnW5X1pN7LKlcKWJvJqt NGcaUa1wkfPS/JIuscoinUfpl3+jFQdxHYLsRdCy3ChaFfpIXcwU0McE7PR9qsogbQ S/8EqpJ+ag9gr4MTaaG9AFu1PxyHkQngqCSkfyHRi3E9DoHiCWb08FX5uaLz0LJZNn z9Ss4KNJirPGw== From: Sean Nyekjaer To: Boris Brezillon Cc: Sean Nyekjaer , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Boris Brezillon , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 0/4] mtd: core: protect access to mtd devices while in suspend Date: Tue, 2 Nov 2021 12:02:00 +0100 Message-Id: <20211102110204.3334609-1-sean@geanix.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=4.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,URIBL_BLOCKED autolearn=disabled version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on 13e2a5895688 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changes since v4: - removed protection around _panic_write() - removed all fixes tag, as a simpler solution is needed for backporting. Follow-up on discussion in: https://lkml.org/lkml/2021/10/4/41 https://lkml.org/lkml/2021/10/11/435 Changes since v3: - edited commit msg and author for mtdconcat patch Changes since v2: - added signoff's to patch from Boris - removed accidential line break - kept tests consistent: master->master.suspended == 0 -> !master->master.suspended - added comments to mtdconcat patch - moved mtdconcat before ('mtd: core: protect access to MTD devices while in suspend') Changes since v1: - removed __mtd_suspend/__mtd_resume functions as they are not used by mtdconcat anymore. - only master mtd_info is used for mtd_{start,end}_access(). Warn if we got mtd's. - added Boris patch for using uninitialized _suspend/_resume hooks when bbt scanning - mtdconcat uses device _suspend/_resume hooks - I don't really like the macro proposal from Boris mtd_no_suspend_void_call()/mtd_no_suspend_ret_call() I think they make the code complex to read and the macro's doesn't fit every where anyway... Changes since from rfc v1/v2: - added access protection for all device access hooks in mtd_info. - added Suggested-by to [1/3] patch. - removed refereces to commit ef347c0cfd61 ("mtd: rawnand: gpmi: Implement exec_op") from commit msg as commit 013e6292aaf5 ("mtd: rawnand: Simplify the locking") is to be blamed. - tested on a kernel with LOCKDEP enabled. Boris Brezillon (2): mtd: rawnand: nand_bbt: hide suspend/resume hooks while scanning bbt mtd: mtdconcat: don't use mtd_{suspend,resume}() Sean Nyekjaer (2): mtd: core: protect access to MTD devices while in suspend mtd: rawnand: remove suspended check drivers/mtd/mtdconcat.c | 15 +++- drivers/mtd/mtdcore.c | 124 +++++++++++++++++++++++++++---- drivers/mtd/nand/raw/nand_base.c | 52 ++++--------- drivers/mtd/nand/raw/nand_bbt.c | 28 ++++++- include/linux/mtd/mtd.h | 81 ++++++++++++++++---- include/linux/mtd/rawnand.h | 5 +- 6 files changed, 230 insertions(+), 75 deletions(-) -- 2.33.0