From patchwork Thu Oct 26 12:57:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 117223 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp733184qgn; Thu, 26 Oct 2017 05:58:22 -0700 (PDT) X-Google-Smtp-Source: ABhQp+RT3nKiS+JWTcuZlR4mdUkvTQjqXL/oGTK8R+9BqIoSBKBWKQzEu/w78ZyusIBiDLLnQ9Df X-Received: by 10.99.95.86 with SMTP id t83mr4872776pgb.34.1509022701936; Thu, 26 Oct 2017 05:58:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509022701; cv=none; d=google.com; s=arc-20160816; b=yIEwQgZUxgd4l4jBmKRcDWejmWJc58/FbaMdY3q1blrh6iJkHdeUg6JMd76dLTD7oR 1PNo2U8z1yIZPyiMdN0QM2e29R9xp3Skt3p2BKGDm5Xc0r/yAzBMOiuWN9bfSE29qkBt UzF6zDemluaR5GHB8X9ukJXGuZfSol1W0+6sr7spgO4edhZbYYU81pJw0D1mjsQW34ux o42933YbkEtDsWskWbX8o69Sv5BWRQ+yBgYeSQ/ZRoK35rcTlpCBvIGu8eHCG68yTkiC our07XQvmJWsl0bi00XMaSbpetOizKMoLgdpnCG1f3AwWL3Ou9N4VJHWbFhwk8ZQZpL6 6DyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=AaL0ph4fpb97u1NDRjypRNTo486cOfU5eYt980KVLBk=; b=FNUJysNMAxCGqzXbApuD8lsnfFQGr3f4zdpzijrI6M6Vk8Oyq4U0/XDxL+ev15s00l Tb/yA9qGYD+CqFlEVeN7k2xm0QNHh2vIp3370MBJzWT6i7NrWdnGwFSbcwp8LhahwTno wVYTbzctgTXSY+87AVhXIt3jpuejRRkZ7fLJ2Ck3/B7MXgEeCMfM06aCtGashtxwZOKK qJFriyqo6OV7h03QU+bSq3IniLD5UdQ/2dT6K2dLWPXlsM+AAJo6BZ6KccGUk0HWkF7X pcxpfcuR7fMLo9/c2krcj4BskSy9qBV1ydB+zcJ6BxLDo97V7V6P8pexHapIJQP4OEqY p9sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FPNXrzwh; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i7si3348008pgc.634.2017.10.26.05.58.21; Thu, 26 Oct 2017 05:58:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=FPNXrzwh; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932299AbdJZM6U (ORCPT + 6 others); Thu, 26 Oct 2017 08:58:20 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:55807 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932376AbdJZM6T (ORCPT ); Thu, 26 Oct 2017 08:58:19 -0400 Received: by mail-lf0-f67.google.com with SMTP id p184so3613880lfe.12 for ; Thu, 26 Oct 2017 05:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BDcrgv4gwsJHSVqVAVJ0oWJDT3zLa6oxVxbcy5KJioM=; b=FPNXrzwhDgd32E9GmuxGo03g5Bdvg0dmf3pnvgSHedX9IZzeRBIpbm9noZU1hs9Uol ai4hXX7zibRXWX1+IjLLsdHgz7eagamHp0bjQg/0z0TkMJHsNS7Ca2n7XE16UbaQHSsg DSn88rLGw8K7R8iCgBiomnbIj/CmSxHOsnSQE= 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:in-reply-to :references; bh=BDcrgv4gwsJHSVqVAVJ0oWJDT3zLa6oxVxbcy5KJioM=; b=tFAaeiNkif3J8SOO8D4/0zZXW7OxZ/52kwKSSHKX9ZoeDI4+RfHAMKdDpqcWHy08rX lu+AAr+71Jhx81j216L0kRFWoafiEsd6vpGVXFb0X9QvWyREideX4h81+gkCHEITPR8a Zbnh5SL/CcjGZVdoILhx9v+OU+0k+FqwCewJQukfiiTqiovixKBE8QSG844PlQY1sXkn ZH3cNcXTYX/v0Y8bnkOu9JtWRqstIgm2mwu7V9Y8hNewNrhNF2szdzfRwjunj7FTSmuX oDolrYT2cDT8zcwvmvblVfTV1sDSMSdgflvmLplPJwuY2dKs1PCGvY86UVyVRSABOErM cFAA== X-Gm-Message-State: AMCzsaW9uEsHrkiv6X+Eof9NlGju70MkqicWq7B0s7xFB6Pn/AA6xAj+ 0R+zot/d3OArb6wFyupVum/z0kC/lLg= X-Received: by 10.46.25.87 with SMTP id p84mr10580460lje.67.1509022698116; Thu, 26 Oct 2017 05:58:18 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 34sm1165600lfr.25.2017.10.26.05.58.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Oct 2017 05:58:17 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig , Arnd Bergmann , Bartlomiej Zolnierkiewicz , Paolo Valente , Avri Altman , Adrian Hunter , Linus Walleij Subject: [PATCH 02/12 v4] mmc: core: add a workqueue for completing requests Date: Thu, 26 Oct 2017 14:57:47 +0200 Message-Id: <20171026125757.10200-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171026125757.10200-1-linus.walleij@linaro.org> References: <20171026125757.10200-1-linus.walleij@linaro.org> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org As we want to complete requests autonomously from feeding the host with new requests, we create a workqueue to deal with this specifically in response to the callback from a host driver. This is necessary to exploit parallelism properly. This patch just adds the workqueu, later patches will make use of it. Signed-off-by: Linus Walleij --- drivers/mmc/core/core.c | 9 +++++++++ drivers/mmc/core/host.c | 1 - include/linux/mmc/host.h | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) -- 2.13.6 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 3d1270b9aec4..9c3baaddb1bd 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2828,6 +2828,14 @@ void mmc_start_host(struct mmc_host *host) host->f_init = max(freqs[0], host->f_min); host->rescan_disable = 0; host->ios.power_mode = MMC_POWER_UNDEFINED; + /* Workqueue for completing requests */ + host->req_done_wq = alloc_workqueue("mmc%d-reqdone", + WQ_FREEZABLE | WQ_HIGHPRI | WQ_MEM_RECLAIM, + 0, host->index); + if (!host->req_done_wq) { + dev_err(mmc_dev(host), "could not allocate workqueue\n"); + return; + } if (!(host->caps2 & MMC_CAP2_NO_PRESCAN_POWERUP)) { mmc_claim_host(host); @@ -2849,6 +2857,7 @@ void mmc_stop_host(struct mmc_host *host) host->rescan_disable = 1; cancel_delayed_work_sync(&host->detect); + destroy_workqueue(host->req_done_wq); /* clear pm flags now and let card drivers set them as needed */ host->pm_flags = 0; diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index e58be39b1568..8193363a5a46 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -381,7 +381,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) INIT_DELAYED_WORK(&host->detect, mmc_rescan); INIT_DELAYED_WORK(&host->sdio_irq_work, sdio_irq_work); setup_timer(&host->retune_timer, mmc_retune_timer, (unsigned long)host); - /* * By default, hosts do not support SGIO or large requests. * They have to set these according to their abilities. diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index c296f4351c1d..94a646eebf05 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -423,6 +424,9 @@ struct mmc_host { struct mmc_async_req *areq; /* active async req */ struct mmc_context_info context_info; /* async synchronization info */ + /* finalization workqueue, handles finalizing requests */ + struct workqueue_struct *req_done_wq; + /* Ongoing data transfer that allows commands during transfer */ struct mmc_request *ongoing_mrq;