From patchwork Fri Nov 10 10:01:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10052735 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 CEA9D6035D for ; Fri, 10 Nov 2017 10:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0242B23F for ; Fri, 10 Nov 2017 10:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEBAC2B252; Fri, 10 Nov 2017 10:01:59 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham 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 53E372B244 for ; Fri, 10 Nov 2017 10:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751683AbdKJKB6 (ORCPT ); Fri, 10 Nov 2017 05:01:58 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:43986 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752093AbdKJKBz (ORCPT ); Fri, 10 Nov 2017 05:01:55 -0500 Received: by mail-lf0-f65.google.com with SMTP id o66so2199824lfg.0 for ; Fri, 10 Nov 2017 02:01:54 -0800 (PST) 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=+8pUl9LvVHLvQAsP9ADlzbb3egQjfgPvBVOhWdZTL7I=; b=Tq8eap0/eLzV9if3s/KDpwtVK30o4LangB8SVjJOBOriKBdboiki6qv8T+ih3zMJ0h 3TxVNrFyQbC8hE09v3sNZt6ngpYgaI9/hnineROADV70FeXgaoO7nmNa38jVHt8UhzjK c0euC376C7SEZAtAGBWSOlXgtpu07a27VhOgg= 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=+8pUl9LvVHLvQAsP9ADlzbb3egQjfgPvBVOhWdZTL7I=; b=RUlcpDj5ZEVci+KKj+zHBZmwOiLOr21hna/ilFBiim80O1dcBIMWzI6U/z/iSOrAg1 hlUD/GG+kfl69B1PPLxPe9FLkOjrWdp/Av/hnDNGJvzFH6QxoXruSIhluNZGSIB+mVpB iTJ5rYl8GGmuJpvPPLilaxCc2iT9Y3+fKzA3CXOnLw+maKbk8VB/SDESsUgnYN/VHvHb hzwWmBMXSQZLcpDt40LeBNUvZFRBoTmcb/gEe/ZxTOQr8xO4PpIIOSQkqWpepDxML1vN 4GYxvz2pmlM2F6V6Egh0jPMn2x8hLCDtimxoKRAVP9FRjvDvQYq5SW7uovk21U8kNPpo tPPA== X-Gm-Message-State: AJaThX5tXiMDcG80iuSBemOvS6DdfDmEp+aXXst6NuFnH/fIurDjs536 DjHl+wDv5eKf8uGTeKzZbEoONg== X-Google-Smtp-Source: AGs4zMak202GHo2iew2gGtztxLpsGblPT6dE2hxLzaq5YkoxTD40WXzrh9xptoAceSeeBioEVzJ7SQ== X-Received: by 10.46.99.203 with SMTP id s72mr1396121lje.7.1510308114133; Fri, 10 Nov 2017 02:01:54 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n36sm310843lfi.78.2017.11.10.02.01.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2017 02:01:53 -0800 (PST) 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 v5] mmc: core: add a workqueue for completing requests Date: Fri, 10 Nov 2017 11:01:33 +0100 Message-Id: <20171110100143.12256-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171110100143.12256-1-linus.walleij@linaro.org> References: <20171110100143.12256-1-linus.walleij@linaro.org> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@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 --- ChangeLog v1->v5: - Rebasing on the "next" branch in the MMC tree. --- 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 e2366a82eebe..73ebee12e67b 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2838,6 +2838,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); @@ -2859,6 +2867,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 35a9e4fd1a9f..88033294832f 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -390,7 +390,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 e7743eca1021..e4fa7058c288 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -425,6 +426,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;