From patchwork Fri Nov 10 10:01:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10052733 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 F33A660631 for ; Fri, 10 Nov 2017 10:01:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE44B2B241 for ; Fri, 10 Nov 2017 10:01:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDF2E2B252; Fri, 10 Nov 2017 10:01:57 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 7F5002B241 for ; Fri, 10 Nov 2017 10:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751410AbdKJKBz (ORCPT ); Fri, 10 Nov 2017 05:01:55 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:49350 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751683AbdKJKBx (ORCPT ); Fri, 10 Nov 2017 05:01:53 -0500 Received: by mail-lf0-f67.google.com with SMTP id w21so10371677lfc.6 for ; Fri, 10 Nov 2017 02:01:53 -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=eLY5CthlX10SDAKbYnppkdu75vU0SFr1NoPLjvOzlgk=; b=OTWGP+SfmdorcnalwnBjqFovdF3eR9Qr9o27n3pFhCwZIbY77CWQoV5MWNyYuTRNfZ rlDw19myeg1bSy91dNbi2WQLvcTJgWTfg6sPlYdBMRhrfKn+7v+6IeAIElOsO31gQizg Ih/q4rgEoJHxyrgmSTCRzujGGBED3mBjoau/4= 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=eLY5CthlX10SDAKbYnppkdu75vU0SFr1NoPLjvOzlgk=; b=XWw12onDMjHMSXq2SCXRfXPhUG9E+3ZD9NkGHiuHYSmvGkKZ1aTKjHS71HqrSqZBA/ /SyMxXYxHgwPpxhLyljkAvz6wwXcGGhj7QxJsFex13YLQZLOuEOjdXfk2Py/PXj1PQ1k +tg1gHpF2K0gL8dlXq3Yc4kN1RrgRY4J40FJNjOvmVq7HYcCAkTTnk6SBtS1Xqdvh4bU Qm2JSdoUuXVcOnhpNFB6z9ESQBlXfCrG3yDWFFLErGTHgTLSJtXEbL3Ut2MlWwah2gOS r7dMZEG/MH0t01WqobBl1taLP96YeIRjrmGDfO3t+gBaY1FXrqqvNT9oOtbPdPg2tQQW AoxA== X-Gm-Message-State: AJaThX6Xob5QIDyZz8q65NTkycoJCArMtz4Rm9gRAbwehj+zhhfMOfZQ Zn5j1SHPDo23RnMaFcLLwY3cLEpCBR8= X-Google-Smtp-Source: AGs4zMaGGh3W+ewqoeOS3zVEeAEtMXR2/e3kBV/bHJ64UzZ/nqCrOeHurFBmsCNQHr5IXJ8vp/49Gw== X-Received: by 10.46.85.69 with SMTP id j66mr1377729ljb.137.1510308112010; Fri, 10 Nov 2017 02:01:52 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Nov 2017 02:01:51 -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 01/12 v5] mmc: core: move the asynchronous post-processing Date: Fri, 10 Nov 2017 11:01:32 +0100 Message-Id: <20171110100143.12256-2-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 X-Virus-Scanned: ClamAV using ClamSMTP This moves the asynchronous post-processing of a request over to the finalization function. The patch has a slight semantic change: Both places will be in the code path for if (host->areq) and in the same sequence, but before this patch, the next request was started before performing post-processing. The effect is that whereas before, the post- and preprocessing happened after starting the next request, now the preprocessing will happen after the request is done and before the next has started which would cut half of the pre/post optimizations out. In the later patch named "mmc: core: replace waitqueue with worker" we move the finalization to a worker started by mmc_request_done() and in the patch named "mmc: block: issue requests in massive parallel" we introduce a forked success/failure path that can quickly complete requests when they come back from the hardware. These two later patches together restore the same optimization but in a more elegant manner that avoids the need to flush the two-stage pipleline with NULL, something we remove between these two patches in the commit named "mmc: queue: stop flushing the pipeline with NULL". Signed-off-by: Linus Walleij --- ChangeLog v1->v5: - Rebasing on the "next" branch in the MMC tree. --- drivers/mmc/core/core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 1f0f44f4dd5f..e2366a82eebe 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -746,6 +746,9 @@ static enum mmc_blk_status mmc_finalize_areq(struct mmc_host *host) mmc_start_bkops(host->card, true); } + /* Successfully postprocess the old request at this point */ + mmc_post_req(host, host->areq->mrq, 0); + return status; } @@ -790,10 +793,6 @@ struct mmc_async_req *mmc_start_areq(struct mmc_host *host, if (status == MMC_BLK_SUCCESS && areq) start_err = __mmc_start_data_req(host, areq->mrq); - /* Postprocess the old request at this point */ - if (host->areq) - mmc_post_req(host, host->areq->mrq, 0); - /* Cancel a prepared request if it was not started. */ if ((status != MMC_BLK_SUCCESS || start_err) && areq) mmc_post_req(host, areq->mrq, -EINVAL);