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: 10028081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3492E6022E for ; Thu, 26 Oct 2017 12:58:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2667F28DCD for ; Thu, 26 Oct 2017 12:58:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19FF228DF3; Thu, 26 Oct 2017 12:58:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C14A228DCD for ; Thu, 26 Oct 2017 12:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932299AbdJZM6U (ORCPT ); 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-Google-Smtp-Source: ABhQp+QlZfz4rJU9Dc9lbKcL9u5jo33PVdqGSxd783A06ajyd0trW6rbi6ICF03YF8fu98Sc1y5ofA== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;