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: 118517 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp7722405qgn; Fri, 10 Nov 2017 02:02:00 -0800 (PST) X-Google-Smtp-Source: ABhQp+TEBVgJOoG0A90M6xhapnAKDUMJmBpEt2cJQy/Y99ActGo7bZSHll/YmUF3WQJM8799n3TI X-Received: by 10.159.194.18 with SMTP id x18mr3659570pln.273.1510308120674; Fri, 10 Nov 2017 02:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510308120; cv=none; d=google.com; s=arc-20160816; b=zuh9Of2FiDMw2CE/bPBtsv3jJ1o2Hnt8K+3gzgJ1gn+/b3trHqgjsO5BK+MFnwaE9W sumU5D7W5dFoSROb6ahEf3BDkzySFHnvhKoAoClBc1X1rM+mT2mEOeEodpauWLSFcYGe Vr1XNPxx/VjtHo4laWM/5fp5G4xrQce9cD5mjfNqMKFEdY5T+k4tZcLA4jEUB8vRX4LU f2OYnxkVjS8dUkUxym52+Gd6ZrpdXI+adMgv0kwfMH8ZxjAr/nKe+7jQzy+a+SlKAUtl hjBElD9nTMHDifjfQV+kGT2mFqFjPSM0Vk7H1pywU9EvcOrj3BjpLG8eJ2RoJVaHccZm /8uQ== 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=HM/9Jtd4NTN138WvciVBxCxRSMhNKZtgBVNnXihgXM4=; b=nTFlkmiFSVNabvnwLmE5nmDJqGdqOoeWiduZpawqzWR97Q3cwrbvC0NFsVZ23OT19d WitmZXD1nyRNjCaQbvpFRSBw7zXwNz0tsHWzoksqxPSV5JrOa7f4975nMWUFW+nES67u pt+f00XMG9KWAm2EekEd/NmwnMnXK8Eep3SKKBTwvSc+jhXg6IkcZ6wUWb2hBSg4q3V1 mpspeNpKWznoZTyPQQBYsiY4sGAyBMXOmqPgUvhXeZmMG8nMl0D/A2mxzdjhaC7Pllge xZAvz3x3zbgtE6RrnhgUJjEIdWX+wEEJwhBdtINZHvbn6MT0hdMDgThv1AlmIJdBCG50 IYQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Tq8eap0/; 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 z14si8801659plh.282.2017.11.10.02.02.00; Fri, 10 Nov 2017 02:02:00 -0800 (PST) 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=Tq8eap0/; 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 S1752127AbdKJKB6 (ORCPT + 6 others); Fri, 10 Nov 2017 05:01:58 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:52324 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752168AbdKJKBz (ORCPT ); Fri, 10 Nov 2017 05:01:55 -0500 Received: by mail-lf0-f68.google.com with SMTP id b190so10439574lfg.9 for ; Fri, 10 Nov 2017 02:01:55 -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=PVH15FUw+UNOCscYsDxTVcaPidxvEq6/06xrs9aKVdNoTCeIWiYLOJm+TZiKej2Lz3 HnTDhU6FvxXWbjOjMV/PkDMSJ3dMACeLMbz00QlYX8CWSaQFXjgsfi6+YMw+qaEv0kX6 oVy+DiMtUktPkq5xOSpN3nJ9sXN0/YIRZY8SbdrZhJdWv/2dGgztzhFLj6yJG7FGD0zK 0Ow+TQ5owjUb342c+h310XyPqyn8/OEXJFxSxJaCD+Zame9TCqJ7/hUO7YQhp+3oUgs4 2N08IPEilqQFM9ClGbkVQbBmsWuQIldQy/glfvtWM3+jwH00FcXVD07nXi4eoKt3DWQi B8jg== X-Gm-Message-State: AJaThX6a4qRj9C5t4KepFZvnaGyMg1S8xyctcBBxA1/Ti23WdzAqXQng lHQqQHC4FiEocN3V1HmcZONU8CiuFgo= 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-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 --- 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(-) -- 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 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;