From: Russell King <rmk+kernel@arm.linux.org.uk>
To: linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org
Cc: Chris Ball <chris@printf.net>
Subject: [PATCH RFC 03/31] mmc: sdio_irq: rework sdio irq handling
Date: Tue, 18 Feb 2014 15:09:17 +0000 [thread overview]
Message-ID: <E1WFmIP-0006li-SO@rmk-PC.arm.linux.org.uk> (raw)
In-Reply-To: <20140218150801.GD21483@n2100.arm.linux.org.uk>
Rather than the SDIO support spawning it's own thread for handling card
interrupts, use the generic IRQ infrastructure for this, triggering it
from the host interface's interrupt handling directly.
This avoids a race between the parent thread waiting to receive an
interrupt response from the card, and the slow startup from the sdio
irq thread, which can occur as a result of high system load (eg, while
udev is running.)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
=-DO NOT APPLY-=
drivers/mmc/core/sdio_irq.c | 41 +++++++++++++++++++++++++++++++----------
include/linux/mmc/host.h | 3 +++
2 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
index aaa90460ed23..f23d73993dc6 100644
=-DO NOT APPLY-= a/drivers/mmc/core/sdio_irq.c
=+DO NOT APPLY+= b/drivers/mmc/core/sdio_irq.c
@@ -90,6 +90,15 @@ static int process_sdio_pending_irqs(struct mmc_host *host)
return ret;
}
=+DO NOT APPLY+=void sdio_run_irqs(struct mmc_host *host)
=+DO NOT APPLY+={
=+DO NOT APPLY+= mmc_claim_host(host);
=+DO NOT APPLY+= host->sdio_irq_pending = true;
=+DO NOT APPLY+= process_sdio_pending_irqs(host);
=+DO NOT APPLY+= mmc_release_host(host);
=+DO NOT APPLY+=}
=+DO NOT APPLY+=EXPORT_SYMBOL_GPL(sdio_run_irqs);
=+DO NOT APPLY+=
static int sdio_irq_thread(void *_host)
{
struct mmc_host *host = _host;
@@ -189,14 +198,20 @@ static int sdio_card_irq_get(struct mmc_card *card)
WARN_ON(!host->claimed);
if (!host->sdio_irqs++) {
- atomic_set(&host->sdio_irq_thread_abort, 0);
- host->sdio_irq_thread =
- kthread_run(sdio_irq_thread, host, "ksdioirqd/%s",
- mmc_hostname(host));
- if (IS_ERR(host->sdio_irq_thread)) {
- int err = PTR_ERR(host->sdio_irq_thread);
- host->sdio_irqs--;
- return err;
=+DO NOT APPLY+= if (!(host->caps2 & MMC_CAP2_SDIO_NOTHREAD)) {
=+DO NOT APPLY+= atomic_set(&host->sdio_irq_thread_abort, 0);
=+DO NOT APPLY+= host->sdio_irq_thread =
=+DO NOT APPLY+= kthread_run(sdio_irq_thread, host,
=+DO NOT APPLY+= "ksdioirqd/%s", mmc_hostname(host));
=+DO NOT APPLY+= if (IS_ERR(host->sdio_irq_thread)) {
=+DO NOT APPLY+= int err = PTR_ERR(host->sdio_irq_thread);
=+DO NOT APPLY+= host->sdio_irqs--;
=+DO NOT APPLY+= return err;
=+DO NOT APPLY+= }
=+DO NOT APPLY+= } else {
=+DO NOT APPLY+= mmc_host_clk_hold(host);
=+DO NOT APPLY+= host->ops->enable_sdio_irq(host, 1);
=+DO NOT APPLY+= mmc_host_clk_release(host);
}
}
@@ -211,8 +226,14 @@ static int sdio_card_irq_put(struct mmc_card *card)
BUG_ON(host->sdio_irqs < 1);
if (!--host->sdio_irqs) {
- atomic_set(&host->sdio_irq_thread_abort, 1);
- kthread_stop(host->sdio_irq_thread);
=+DO NOT APPLY+= if (!(host->caps2 & MMC_CAP2_SDIO_NOTHREAD)) {
=+DO NOT APPLY+= atomic_set(&host->sdio_irq_thread_abort, 1);
=+DO NOT APPLY+= kthread_stop(host->sdio_irq_thread);
=+DO NOT APPLY+= } else {
=+DO NOT APPLY+= mmc_host_clk_hold(host);
=+DO NOT APPLY+= host->ops->enable_sdio_irq(host, 0);
=+DO NOT APPLY+= mmc_host_clk_release(host);
=+DO NOT APPLY+= }
}
return 0;
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index 99f5709ac343..52bcfd4233e7 100644
=-DO NOT APPLY-= a/include/linux/mmc/host.h
=+DO NOT APPLY+= b/include/linux/mmc/host.h
@@ -282,6 +282,7 @@ struct mmc_host {
MMC_CAP2_PACKED_WR)
#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
#define MMC_CAP2_SANITIZE (1 << 15) /* Support Sanitize */
=+DO NOT APPLY+=#define MMC_CAP2_SDIO_NOTHREAD (1 << 16) /* don't have separate thread */
mmc_pm_flag_t pm_caps; /* supported pm features */
@@ -397,6 +398,8 @@ static inline void mmc_signal_sdio_irq(struct mmc_host *host)
wake_up_process(host->sdio_irq_thread);
}
=+DO NOT APPLY+=void sdio_run_irqs(struct mmc_host *host);
=+DO NOT APPLY+=
#ifdef CONFIG_REGULATOR
int mmc_regulator_get_ocrmask(struct regulator *supply);
int mmc_regulator_set_ocr(struct mmc_host *mmc,
--
1.8.3.1
next prev parent reply other threads:[~2014-02-18 15:09 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-18 15:08 [PATCH RFC 00/31] SDHCI and SDIO IRQ improvements Russell King - ARM Linux
2014-02-18 15:09 ` [PATCH RFC 01/31] genirq: Provide synchronize_hardirq() Russell King
2014-02-18 15:09 ` [PATCH RFC 02/31] genirq: Provide irq_wake_thread() Russell King
2014-02-18 15:09 ` Russell King [this message]
2014-02-19 3:40 ` [PATCH RFC 03/31] mmc: sdio_irq: rework sdio irq handling Nicolas Pitre
2014-02-19 9:44 ` Russell King - ARM Linux
2014-02-18 15:09 ` [PATCH RFC 04/31] mmc: sdhci: clean up interrupt handling Russell King
2014-02-18 15:09 ` [PATCH RFC 05/31] mmc: sdhci: clean up sdio interrupt enable handling Russell King
2014-02-18 15:09 ` [PATCH RFC 06/31] mmc: sdhci: convert to new SDIO IRQ handling Russell King
2014-02-18 15:09 ` [PATCH RFC 07/31] mmc: sdhci: push card_tasklet into threaded irq handler Russell King
2014-02-18 17:57 ` Russell King - ARM Linux
2014-02-19 6:13 ` Viresh Kumar
2014-02-19 9:43 ` Russell King - ARM Linux
2014-02-19 9:48 ` Viresh Kumar
2014-02-19 9:52 ` Russell King - ARM Linux
2014-02-19 10:09 ` Viresh Kumar
2014-02-19 10:50 ` Russell King - ARM Linux
2014-02-19 10:55 ` Viresh Kumar
2014-02-20 10:59 ` Russell King - ARM Linux
2014-02-20 11:18 ` Viresh Kumar
2014-02-21 10:37 ` Russell King - ARM Linux
2014-02-21 10:41 ` [PATCH 1/5] mmc: sdhci-spear: fix error handling paths for DT Russell King
2014-02-24 5:59 ` Viresh Kumar
2014-02-21 10:41 ` [PATCH 2/5] mmc: sdhci-spear: fix platform_data usage Russell King
2014-02-21 10:41 ` [PATCH 3/5] mmc: sdhci-spear: simplify resource handling Russell King
2014-02-21 10:41 ` [PATCH 4/5] mmc: sdhci-spear: remove support for power gpio Russell King
2014-02-21 10:41 ` [PATCH 5/5] mmc: sdhci-spear: use generic card detection gpio support Russell King
2014-02-24 6:11 ` Pratyush Anand
2014-02-22 18:27 ` [PATCH RFC 07/31] mmc: sdhci: push card_tasklet into threaded irq handler Chris Ball
2014-02-22 19:05 ` Russell King - ARM Linux
2014-02-22 19:11 ` Chris Ball
2014-02-18 15:09 ` [PATCH RFC 08/31] mmc: sdhci: allow sdio interrupts while sdhci runtime suspended Russell King
2014-02-18 15:09 ` [PATCH RFC 09/31] mmc: sdhci: more efficient interrupt enable register handling Russell King
2014-02-18 15:09 ` [PATCH RFC 10/31] mmc: sdhci: plug hole in disabling card detection interrupts Russell King
2014-02-18 15:09 ` [PATCH RFC 11/31] mmc: sdhci: convert generic bus width setup to library function Russell King
2014-02-18 15:10 ` [PATCH RFC 12/31] mmc: sdhci: convert reset into a " Russell King
2014-02-18 15:10 ` [PATCH RFC 13/31] mmc: sdhci: move FSL ESDHC reset handling quirk into esdhc code Russell King
2014-02-18 15:10 ` [PATCH RFC 14/31] mmc: sdhci: avoid sync'ing the SG if there's no misalignment Russell King
2014-02-18 15:10 ` [PATCH RFC 15/31] mmc: sdhci: convert ADMA descriptors to a coherent allocation Russell King
2014-02-18 15:10 ` [PATCH RFC 16/31] mmc: sdhci: clean up sdhci_update_clock()/sdhci_set_clock() Russell King
2014-02-18 15:10 ` [PATCH RFC 17/31] mmc: sdhci: move setting host->clock into sdhci_do_set_ios() Russell King
2014-02-18 15:10 ` [PATCH RFC 18/31] mmc: sdhci: move setting mmc->actual_clock into set_clock handlers Russell King
2014-02-18 15:10 ` [PATCH RFC 19/31] mmc: sdhci: convert sdhci_set_clock() into a library function Russell King
2014-02-18 15:10 ` [PATCH RFC 20/31] mmc: sdhci-esdhc-imx: avoid DMA to kernel stack Russell King
2014-02-18 15:10 ` [PATCH RFC 21/31] mmc: sdhci-esdhc-imx: avoid runtime_pm_get_sync() in esdhc_prepare_tuning() Russell King
2014-02-18 15:10 ` [PATCH RFC 22/31] mmc: sdhci-esdhc-imx: fix lockdep splat upon tuning Russell King
2014-02-18 15:11 ` [PATCH RFC 23/31] mmc: sdhci: hack up driver to make it more compliant with UHS-1 Russell King
2014-02-18 15:11 ` [PATCH RFC 24/31] mmc: sdhci: set_uhs_signaling() need not return a value Russell King
2014-02-18 15:11 ` [PATCH RFC 25/31] mmc: sdhci: convert sdhci_set_uhs_signaling() into a library function Russell King
2014-02-18 15:11 ` [PATCH RFC 26/31] mmc: sdhci: cache timing information locally Russell King
2014-02-18 15:11 ` [PATCH RFC 27/31] mmc: sdhci: clean up sdhci_execute_tuning() decision Russell King
2014-02-18 15:11 ` [PATCH RFC 28/31] mmc: sdhci-esdhc-imx: remove emulation of uhs_mode Russell King
2014-02-18 15:11 ` [PATCH RFC 29/31] mmc: sdhci-of-esdhc: remove platform_suspend/platform_resume callbacks Russell King
2014-02-18 15:11 ` [PATCH RFC 30/31] mmc: sdhci: " Russell King
2014-02-18 15:11 ` [PATCH RFC 31/31] mmc: sdhci-tegra: get rid of special PRESENT_STATE register handling Russell King
2014-02-19 20:04 ` Stephen Warren
2014-02-19 23:22 ` Russell King - ARM Linux
[not found] ` <20140219232253.GW21483-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-02-19 23:28 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1WFmIP-0006li-SO@rmk-PC.arm.linux.org.uk \
--to=rmk+kernel@arm.linux.org.uk \
--cc=chris@printf.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mmc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).