Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp120869pja; Fri, 22 Nov 2019 04:19:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzValiqZb3jUMNJwdN4zj7Un8rzBHgvWGRI5LkaZc5o+6c7bsByrtr9r1SmpGm/cnDrgjHS X-Received: by 2002:a50:a9e3:: with SMTP id n90mr677990edc.52.1574425161194; Fri, 22 Nov 2019 04:19:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574425161; cv=none; d=google.com; s=arc-20160816; b=kBiE25y2B3ELkYIQPvxxM5XzRUh/PXNi53FFBoIPaH+AsC66AcI57gS5ENzrQFs5bV KzWTM4GfTZP9aw1WuCcje6y50uoRI+GDW0iU86mgqrnF0tR2QgnKSpE48yPPa/eiqSH4 xmM0RPrsor00x958JO+p84HeywIkIet0pyP8CinyzPJpFxoK3A/C6AhC99VlPOP79dkZ tlQ8B116uYZHkt8SUIAwUSawDp1kUuLDHHobti7RmXZHWveNfGTsCUX/vJ6NhDt7FLf1 cCTcW9m1iAx/5LhBIlNBHcuRzT3mVn1KxpmrSAYEnWVxjgK4oMjj+s5lQY7NN22rl2Qd RjVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=fCxivhaLi6BspInhBwD9NQyXMMt4ywRkORkqFyUzD4g=; b=Zc2mHX63VxwXjnCW23orvIA4LkGVSmCNCLMQ29ztTiGBD2Lncv/7bV13li6Tk9eGw1 GmbEdLj93LIdHIYEkG5P+lSGPS0itRLlvnYaP1DVzkTUSuaz/FGFBk7srEAHnp4wRBsV EW5fvhQKGRwsMjAYLbiTMVCQ+oZMxrGo8d+ZbV/kpLnXm3h4h0kwytFx8wfULAnSu1QQ cTrQhibHX7r8bDuxaKTLikSrln4YcaaCusrniPjh2+MmEUfF+at5q3DFGd+twBwA4txL YiI2RyJZdIFXBMy+fgtMeHk49SNpEpcsNznzKjwTiWkEVV0ToFS+5UBoz2ZXH/xT2NNP d2zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c36si1156551edb.58.2019.11.22.04.18.57; Fri, 22 Nov 2019 04:19:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbfKVMPi (ORCPT + 99 others); Fri, 22 Nov 2019 07:15:38 -0500 Received: from mga04.intel.com ([192.55.52.120]:55767 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbfKVMPi (ORCPT ); Fri, 22 Nov 2019 07:15:38 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Nov 2019 04:15:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,229,1571727600"; d="scan'208";a="216354528" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.70]) ([10.237.72.70]) by fmsmga001.fm.intel.com with ESMTP; 22 Nov 2019 04:15:33 -0800 Subject: Re: [PATCH v7 3/4] mmc: host: sdhci: Add a variable to defer to complete requests if needed To: Baolin Wang , ulf.hansson@linaro.org, asutoshd@codeaurora.org Cc: orsonzhai@gmail.com, zhang.lyra@gmail.com, arnd@arndb.de, linus.walleij@linaro.org, vincent.guittot@linaro.org, baolin.wang@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <0199b93bad45b7f1dc7751844ac8031b316b2fed.1574073572.git.baolin.wang7@gmail.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <983cb2b7-7887-af86-5029-120ff6d2b839@intel.com> Date: Fri, 22 Nov 2019 14:14:38 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <0199b93bad45b7f1dc7751844ac8031b316b2fed.1574073572.git.baolin.wang7@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/11/19 12:43 PM, Baolin Wang wrote: > From: Baolin Wang > > When using the host software queue, it will trigger the next request in > irq handler without a context switch. But the sdhci_request() can not be > called in interrupt context when using host software queue for some host > drivers, due to the get_cd() ops can be sleepable. > > But for some host drivers, such as Spreadtrum host driver, the card is > nonremovable, so the get_cd() ops is not sleepable, which means we can > complete the data request and trigger the next request in irq handler > to remove the context switch for the Spreadtrum host driver. > > As suggested by Adrian, we should introduce a request_atomic() API to > indicate that a request can be called in interrupt context to remove > the context switch when using mmc host software queue. But this should > be done in another thread to convert the users of mmc host software queue. > Thus we can introduce a variable in struct sdhci_host to indicate that > we will always to defer to complete requests when using the host software > queue. > > Suggested-by: Adrian Hunter > Signed-off-by: Baolin Wang > Signed-off-by: Baolin Wang Acked-by: Adrian Hunter > --- > drivers/mmc/host/sdhci.c | 2 +- > drivers/mmc/host/sdhci.h | 1 + > 2 files changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 850241f..4bef066 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -3035,7 +3035,7 @@ static inline bool sdhci_defer_done(struct sdhci_host *host, > { > struct mmc_data *data = mrq->data; > > - return host->pending_reset || > + return host->pending_reset || host->always_defer_done || > ((host->flags & SDHCI_REQ_USE_DMA) && data && > data->host_cookie == COOKIE_MAPPED); > } > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index d89cdb9..a73ce89 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -533,6 +533,7 @@ struct sdhci_host { > bool pending_reset; /* Cmd/data reset is pending */ > bool irq_wake_enabled; /* IRQ wakeup is enabled */ > bool v4_mode; /* Host Version 4 Enable */ > + bool always_defer_done; /* Always defer to complete requests */ > > struct mmc_request *mrqs_done[SDHCI_MAX_MRQS]; /* Requests done */ > struct mmc_command *cmd; /* Current command */ >