Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp5892027ybx; Mon, 11 Nov 2019 00:00:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwXxeJITOlU44XfaQUEMEYAEI/Si5aMYxxrnHy3xqD2T/iiNQO9FePbNw8jxNVBIVp+A95S X-Received: by 2002:a05:6402:168b:: with SMTP id a11mr25051125edv.107.1573459228263; Mon, 11 Nov 2019 00:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573459228; cv=none; d=google.com; s=arc-20160816; b=uqhRvOZl7nW5W6kEztcqVLfHQUkJ7PLKA0MheJ/zXYMGRVsTMViXiDq7bs7fB6anRn fjykzZYn+pTsWVM1wbT8KKlJaBbguB57kMhZ5be80OkB5AAPQcSHivt1/+p58uZB6+mg OZUgR3G9nfc1DDc3w7WF1j/fNtlo6mEeh0ZyRNgSt4lXGdkJdH26ms16j02+ax4RVDAm EA7203VMjI19xvdY9isODLpBSze+AONHzKzZ1pFrzrX0LsZhQuY9FcZvOKSjWmEYr/os CAHc1iim9m6sSih+SOgiyh84JHNpJ0qP77c8Xz7pek6W91AKeWhfx6qk8b2ytEyStaHP 7fpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=N+N5m8FTDI4LC8i+HnAMwL79Bhle6k8rUOunQ/muSsc=; b=KdavgX3U8EOCx6ALk4wiI1H4yfoNEqKaE8tp8z204UTcUNFVJG4Uv/1DEJiSuuJ8af XG6q+oyI+7PFc/5TDdy/uK6e0Sg9BX7rUz5DAlI10UAXZxKQsNc5UPtYLSvLlyG5StpC 6LjU91Bwtb7HHrRBCe8xvTDvmcPgK1+sMiwyA4Rj6w85JsNAIAMQ0+1ZYRFiCJLmZgEp QO16t36oWMWoO2rsnC7eKD91TI+A6ADD1n1BQK6W6l29hcNC0IZGi+tYd0frRCwkOXY1 no6eVcyiVRwXxkj0oK56TVhrD8K3SvNgHLcpejr0Zjf5qBIflX1v4iwhYMRiYaYuddxR OskA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=spGmlapH; 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=pass (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 r9si11392201edc.101.2019.11.11.00.00.05; Mon, 11 Nov 2019 00:00:28 -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; dkim=pass header.i=@linaro.org header.s=google header.b=spGmlapH; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726955AbfKKH6L (ORCPT + 99 others); Mon, 11 Nov 2019 02:58:11 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:40048 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726770AbfKKH6K (ORCPT ); Mon, 11 Nov 2019 02:58:10 -0500 Received: by mail-lj1-f196.google.com with SMTP id q2so12706735ljg.7 for ; Sun, 10 Nov 2019 23:58:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=N+N5m8FTDI4LC8i+HnAMwL79Bhle6k8rUOunQ/muSsc=; b=spGmlapHE1+lGEZL84dffiInKqqQ5vRsE26C+U2Ca1WAyoW5MC4n11IwxZ/LEQ37iX ujtADjNeDMser9ZDTqS/BO1AQ091dOPhG5ZSR/cVNhuPEjcNTxAEJwz3zOoslNFPKj8+ djCAx8dfx2/8Mh7Y3LfQnXxy72FTydxwgzi04u0h0id7yBPWxuIMWAW9wESgQ/jsEKEm GjAUwFvnuTrcahTuiYUpMpIssVIGbrVA6cUknLlpcTmiC0gSvV1o4QedFkG2Ns0ZM4VL q7UY5FtT1vy4CU+SGlf6aQ9PeAhQK2b4+SkMIpeT6Fzf1kjr0Ts+CVhbB4XqhMpGqfuG sOaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=N+N5m8FTDI4LC8i+HnAMwL79Bhle6k8rUOunQ/muSsc=; b=UqqXckavPFxOXTE2cOKRvN5Vf8Nj1/ZpJDw98gPE48/3+lkSBf1d++I9FHQu8EcYBu g2B/o1QIMYPZ8ul2O8CkRZiXO+cK21j6boOAXgkHEKDFkb97wXaBTmMsTSkletI9bkvI Gt3teUjepqILemaSGN5WdPdJiMwIQ/PHl3FuXkqie/UD5q66uIiP2/eBoclofgjbND9R BlCaRGoEuz80Fv8CBlb6yOntxtb6SR1sbRL2v9mLLN/fixgqLWG3Epg6QFzyHya8cANK bkrS+sCko6UXTO3cn9FCuqujFcbw0tkRJmlyaups6jaS3SQuq81U0U9RJvpsJWaSN/WN kSwA== X-Gm-Message-State: APjAAAWxRPw0Z0VYKtF5fs1LuACDYlKa7dCKeqyAxpaaqfUwkGnfXwtD 7h/zMsTlqv268sH1B6LIt20be1omDQcWFFPRawgqNA== X-Received: by 2002:a2e:864f:: with SMTP id i15mr3167166ljj.29.1573459088663; Sun, 10 Nov 2019 23:58:08 -0800 (PST) MIME-Version: 1.0 References: <119d3285ab610967b43f7c822dfdc0ebb8d521cb.1573456284.git.baolin.wang@linaro.org> In-Reply-To: From: Baolin Wang Date: Mon, 11 Nov 2019 15:57:56 +0800 Message-ID: Subject: Re: [PATCH v6 4/4] mmc: host: sdhci: Add a variable to defer to complete requests if needed To: Adrian Hunter Cc: Ulf Hansson , asutoshd@codeaurora.org, Orson Zhai , Chunyan Zhang , Arnd Bergmann , Linus Walleij , Vincent Guittot , baolin.wang7@gmail.com, linux-mmc , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Nov 2019 at 15:45, Adrian Hunter wrote: > > On 11/11/19 9:34 AM, Baolin Wang wrote: > > 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. > > > > Thus we still need introduce a variable in struct sdhci_host to indicate > > that we will always to defer to complete requests if the sdhci_request() > > can not be called in interrupt context for some host drivers, when using > > the host software queue. > > Sorry, I assumed you would set host->always_defer_done in = true for the > Spreadtrum host driver in patch "mmc: host: sdhci-sprd: Add software queue > support" and put this patch before it. Ah, sorry, I misunderstood your point. So you still expect the Spreadtrum host driver should defer to complete requests firstly, then introducing a request_atomic API in next patch set to let our Spreadtrum host driver can call request_atomic() in the interrupt context. OK, will do in next version. Thanks. > > Suggested-by: Adrian Hunter > > Signed-off-by: Baolin Wang > > --- > > 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 */ > > > -- Baolin Wang Best Regards