From patchwork Wed Sep 2 23:00:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 1356204 X-Patchwork-Delegate: vigneshr@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=Vf8XKpQW; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ZHQCfge9; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Bhfb11NRfz9sRK for ; Thu, 3 Sep 2020 09:02:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=ns3NHOCI9BDmszPvDnRfalKl5y9/CdyB4gczvcXfOGA=; b=Vf8XKpQWAtGpruAKdet6qVUzu7 oKmF/PE15z/3RFk5dUdglhLpU3KZZW+/Jcd5GP0byMsnGb8xjfnsXO8g9RfffYaodz+bMINdDUN4q BIClqKJfzWx9P3tvgx9P4OoahV4dH080HvvOfUXq7Thw/TvLEEvRc7ebqIsnFnnt51dAzaqejGdlZ pWmchPRkqLl9mf6+ANZGIy7C34SIHlcuF/X9q3lL9LFhJ72ZKSE7KfGCiqszqiu2uxaKHi1N+PF8d rP2bgaHsC3aXT8XCsnGuhgf/WHCEUPJF4GOem3KKiIU/912z2/1RPrCmjZYVry5OQyBJSgBTkB6/I /GPUKUVA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDbkg-0000QE-19; Wed, 02 Sep 2020 23:01:14 +0000 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kDbkd-0000PG-Rk for linux-mtd@lists.infradead.org; Wed, 02 Sep 2020 23:01:12 +0000 Received: by mail-pj1-x1042.google.com with SMTP id k15so515861pji.3 for ; Wed, 02 Sep 2020 16:01:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rckbD9u1Jvs+TO4H1QTBgAqxZmJHaw52NI12SCf1ONE=; b=ZHQCfge9W0rq1an4zjkDijL2d94hOEcsp54D7D1XkAj+MpNlBj3TQqpLnSitIdXXv1 hdS7rRtTpLagXWGJvssRy511yVf2YiGxvh3k6UnOGOr72OCURZmG9PDAxHiOkc3L/FaV cYE+BvmQntdfWGfxc3njqOhjaxw4yxOaPLZIQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rckbD9u1Jvs+TO4H1QTBgAqxZmJHaw52NI12SCf1ONE=; b=AFmCQHGfcf+bXAaEn6U2oJ7/apB/Jct8HKLdfACeSEpASTQLp8v6XU8HltWP/DlQOm EGE0prUJ6SXf/2y5XQ2/43AyRMSBtlsaM6gHiEeWvqxaqT9FslX+k0CRw6wxrl9kW3cZ 2zdbOiX/FLOIPFrttmtA2rqZqccr4Az1eKWTBD6qwPgED328NbKgIImiE0to17lKRCYS LgMhWkpI8NCzpK1qSmIkGDvL4AP49jNYEBWLObDa+mEikAfCCwYCEhMmpBf/AqXzyQVt 3JpByPYIRKN88nEvRp066Fzv49CkH1n07FCLHotgmZ4zR7PTPfUCH1iyr8us79SQ8D+U w3Zg== X-Gm-Message-State: AOAM530h3p0/IECy1NmOlybkkRnRFcw0eYRdOXSXHP8GZbMyo0enUJ6v /Qp2f7rVf93SmH5LESJO96kG3g== X-Google-Smtp-Source: ABdhPJyszZg/1OfgGHuppP5KPcJIiYoOULZVJ8PzQ7DlaVyEphP0+9pGBgoilk2OjPsVI+o7GUdnrA== X-Received: by 2002:a17:90b:360a:: with SMTP id ml10mr44063pjb.198.1599087667564; Wed, 02 Sep 2020 16:01:07 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:42b0:34ff:fe3d:58e6]) by smtp.gmail.com with ESMTPSA id z1sm419825pjn.34.2020.09.02.16.01.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Sep 2020 16:01:06 -0700 (PDT) From: Douglas Anderson To: Tudor Ambarus Subject: [PATCH] mtd: spi-nor: Prefer asynchronous probe Date: Wed, 2 Sep 2020 16:00:40 -0700 Message-Id: <20200902160002.1.I658d1c0db9adfeb9a59bc55e96a19e192c959e55@changeid> X-Mailer: git-send-email 2.28.0.402.g5ffc5be6b7-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200902_190111_907468_746B1728 X-CRM114-Status: GOOD ( 16.22 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1042 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vignesh Raghavendra , Richard Weinberger , Douglas Anderson , linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, Miquel Raynal Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org On my system the spi_nor_probe() took ~6 ms at bootup. That's not a lot, but every little bit adds up to a slow bootup. While we can get this out of the boot path by making it a module, there are times where it is convenient (or even required) for this to be builtin the kernel. Let's set that we prefer async probe so that we don't block other drivers from probing while we are probing. This is a tiny little change that is almost guaranteed to be safe for anything that is able to run as a module, which SPI_NOR is. Specifically modules are already probed asynchronously. Also: since other things in the system may have enabled asynchronous probe the system may already be doing other things during our probe. There is a small possibility that some other driver that was a client of SPI_NOR didn't handle -EPROBE_DEFER and was relying on probe ordering and only worked when the SPI_NOR and the SPI bus were builtin. In that case the other driver has a bug that's waiting to hit and the other driver should be fixed. Signed-off-by: Douglas Anderson --- drivers/mtd/spi-nor/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 65eff4ce6ab1..756da93f0f16 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -3470,6 +3470,7 @@ static struct spi_mem_driver spi_nor_driver = { .driver = { .name = "spi-nor", .of_match_table = spi_nor_of_table, + .probe_type = PROBE_PREFER_ASYNCHRONOUS, }, .id_table = spi_nor_dev_ids, },