All of lore.kernel.org
 help / color / mirror / Atom feed
* Avoid needless loop in sdhci_irq() for Card Interrupt
@ 2013-11-04 18:43 Alexey Neyman
  2013-11-05  6:39 ` Dong Aisheng
  0 siblings, 1 reply; 15+ messages in thread
From: Alexey Neyman @ 2013-11-04 18:43 UTC (permalink / raw)
  To: Chris Ball, linux-mmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

[Patch ping #3: anyone interested in making sdhci_irq a bit faster?]

Hi all,

I've discovered that the sdhci_irq() function needlessly iterates re-reading 
the interrupt status and doing nothing (until it runs out of max_loops) when 
it handles the "Card Interrupt" status in the interrupt status register.

The reason is that the "Card Interrupt" bit is not cleared until the 
sdhci_irq() calls mmc_signal_sdio_irq(), so if Card Interrupt was asserted, 
re-reading the interrupt status will find this bit set over and over, even if 
no other bits are reported.

The fix: ignore Card Interrupt bits in the interrupt status if we already know 
that mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq().

Signed-off-by: Alexey Neyman <stilor@att.net>

[-- Attachment #2: sdhci.c.diff --]
[-- Type: text/x-patch, Size: 688 bytes --]

commit 7f23315b344ca51ddf22a78f326f88404fa8c81d
Author: Alexey Neyman <stilor@att.net>
Date:   Wed Oct 9 22:23:54 2013 -0700

    Avoid a loop in sdhci.c.

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: Avoid needless loop in sdhci_irq() for Card Interrupt
  2013-11-04 18:43 Avoid needless loop in sdhci_irq() for Card Interrupt Alexey Neyman
@ 2013-11-05  6:39 ` Dong Aisheng
  2013-11-05 19:58     ` Alexey Neyman
  0 siblings, 1 reply; 15+ messages in thread
From: Dong Aisheng @ 2013-11-05  6:39 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Chris Ball, linux-mmc, linux-kernel

Hi Alexey,

On Tue, Nov 5, 2013 at 2:43 AM, Alexey Neyman <stilor@att.net> wrote:
> [Patch ping #3: anyone interested in making sdhci_irq a bit faster?]
>
> Hi all,
>
> I've discovered that the sdhci_irq() function needlessly iterates re-reading
> the interrupt status and doing nothing (until it runs out of max_loops) when
> it handles the "Card Interrupt" status in the interrupt status register.
>
> The reason is that the "Card Interrupt" bit is not cleared until the
> sdhci_irq() calls mmc_signal_sdio_irq(), so if Card Interrupt was asserted,
> re-reading the interrupt status will find this bit set over and over, even if
> no other bits are reported.
>
> The fix: ignore Card Interrupt bits in the interrupt status if we already know
> that mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq().
>
> Signed-off-by: Alexey Neyman <stilor@att.net>

I also noticed this issue.
Your fix looks correct to me.
But as following community working way, you need send out patches formerly,
not attach a diff file.
You can refer to 'git send-email' or try with gmail.

BTW, please enrich your patch commit message.

Regards
Dong Aisheng

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] Avoid needless loop in sdhci_irq()
  2013-11-05  6:39 ` Dong Aisheng
@ 2013-11-05 19:58     ` Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-11-05 19:58 UTC (permalink / raw)
  To: Chris Ball, open list:SECURE DIGITAL HO..., open list; +Cc: Alexey Neyman

Ignore Card Interrupt bit in the interrupt status if we already know that
mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
and doing nothing.

Signed-off-by: Alexey Neyman <stilor@att.net>
---
 drivers/mmc/host/sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:
-- 
1.8.4.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] Avoid needless loop in sdhci_irq()
@ 2013-11-05 19:58     ` Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-11-05 19:58 UTC (permalink / raw)
  To: Chris Ball, open list:SECURE DIGITAL HO..., open list; +Cc: Alexey Neyman

Ignore Card Interrupt bit in the interrupt status if we already know that
mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
and doing nothing.

Signed-off-by: Alexey Neyman <stilor@att.net>
---
 drivers/mmc/host/sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:
-- 
1.8.4.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] Avoid needless loop in sdhci_irq()
  2013-11-05 19:58     ` Alexey Neyman
  (?)
@ 2013-11-06  2:56     ` Dong Aisheng
  2013-11-06  3:40         ` Alexey Neyman
  -1 siblings, 1 reply; 15+ messages in thread
From: Dong Aisheng @ 2013-11-06  2:56 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Chris Ball, open list:SECURE DIGITAL HO..., open list

On Wed, Nov 6, 2013 at 3:58 AM, Alexey Neyman <stilor@att.net> wrote:
> Ignore Card Interrupt bit in the interrupt status if we already know that
> mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
> avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
> and doing nothing.
>
> Signed-off-by: Alexey Neyman <stilor@att.net>

You need improve the patch title a bit, like:
mmc: sdhci: avoid needless loop for handle SDIO interrupts in sdhci_irq

Otherwise,
Acked-by: Dong Aisheng <b29396@freescale.com>

You could resend with my ack.

Regards
Dong Aisheng

> ---
>  drivers/mmc/host/sdhci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7a7fb4f..a83cd1b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2491,6 +2491,14 @@ again:
>         result = IRQ_HANDLED;
>
>         intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +
> +       /*
> +        * If we know we'll call the driver to signal SDIO IRQ, disregard
> +        * further indications of Card Interrupt in the status to avoid a
> +        * needless loop.
> +        */
> +       if (cardint)
> +               intmask &= ~SDHCI_INT_CARD_INT;
>         if (intmask && --max_loops)
>                 goto again;
>  out:
> --
> 1.8.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
  2013-11-06  2:56     ` Dong Aisheng
@ 2013-11-06  3:40         ` Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-11-06  3:40 UTC (permalink / raw)
  To: Dong Aisheng, Chris Ball, open list:SECURE DIGITAL HO..., open list
  Cc: Alexey Neyman

Ignore Card Interrupt bit in the interrupt status if we already know that
mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
and doing nothing.

Signed-off-by: Alexey Neyman <stilor@att.net>
Acked-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:
-- 
1.8.4.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
@ 2013-11-06  3:40         ` Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-11-06  3:40 UTC (permalink / raw)
  To: Dong Aisheng, Chris Ball, open list:SECURE DIGITAL HO..., open list
  Cc: Alexey Neyman

Ignore Card Interrupt bit in the interrupt status if we already know that
mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
and doing nothing.

Signed-off-by: Alexey Neyman <stilor@att.net>
Acked-by: Dong Aisheng <b29396@freescale.com>
---
 drivers/mmc/host/sdhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:
-- 
1.8.4.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
  2013-11-06  3:40         ` Alexey Neyman
@ 2013-11-08 19:14           ` Chris Ball
  -1 siblings, 0 replies; 15+ messages in thread
From: Chris Ball @ 2013-11-08 19:14 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Dong Aisheng, open list:SECURE DIGITAL HO..., open list

Hi Alexey,

On Tue, Nov 05 2013, Alexey Neyman wrote:
> Ignore Card Interrupt bit in the interrupt status if we already know that
> mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
> avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
> and doing nothing.
>
> Signed-off-by: Alexey Neyman <stilor@att.net>
> Acked-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7a7fb4f..a83cd1b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2491,6 +2491,14 @@ again:
>  	result = IRQ_HANDLED;
>  
>  	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +
> +	/*
> +	 * If we know we'll call the driver to signal SDIO IRQ, disregard
> +	 * further indications of Card Interrupt in the status to avoid a
> +	 * needless loop.
> +	 */
> +	if (cardint)
> +		intmask &= ~SDHCI_INT_CARD_INT;
>  	if (intmask && --max_loops)
>  		goto again;
>  out:

Thanks, pushed to mmc-next for 3.13.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
@ 2013-11-08 19:14           ` Chris Ball
  0 siblings, 0 replies; 15+ messages in thread
From: Chris Ball @ 2013-11-08 19:14 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Dong Aisheng, open list:SECURE DIGITAL HO..., open list

Hi Alexey,

On Tue, Nov 05 2013, Alexey Neyman wrote:
> Ignore Card Interrupt bit in the interrupt status if we already know that
> mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
> avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
> and doing nothing.
>
> Signed-off-by: Alexey Neyman <stilor@att.net>
> Acked-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7a7fb4f..a83cd1b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2491,6 +2491,14 @@ again:
>  	result = IRQ_HANDLED;
>  
>  	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +
> +	/*
> +	 * If we know we'll call the driver to signal SDIO IRQ, disregard
> +	 * further indications of Card Interrupt in the status to avoid a
> +	 * needless loop.
> +	 */
> +	if (cardint)
> +		intmask &= ~SDHCI_INT_CARD_INT;
>  	if (intmask && --max_loops)
>  		goto again;
>  out:

Thanks, pushed to mmc-next for 3.13.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
  2013-11-06  3:40         ` Alexey Neyman
  (?)
  (?)
@ 2013-11-18 20:01         ` Alexey Neyman
  -1 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-11-18 20:01 UTC (permalink / raw)
  To: Dong Aisheng; +Cc: Chris Ball, open list:SECURE DIGITAL HO..., open list

[yet another patch ping]

On Tuesday, November 05, 2013 07:40:36 PM Alexey Neyman wrote:
> Ignore Card Interrupt bit in the interrupt status if we already know that
> mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
> avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
> and doing nothing.
> 
> Signed-off-by: Alexey Neyman <stilor@att.net>
> Acked-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7a7fb4f..a83cd1b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2491,6 +2491,14 @@ again:
>  	result = IRQ_HANDLED;
> 
>  	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +
> +	/*
> +	 * If we know we'll call the driver to signal SDIO IRQ, disregard
> +	 * further indications of Card Interrupt in the status to avoid a
> +	 * needless loop.
> +	 */
> +	if (cardint)
> +		intmask &= ~SDHCI_INT_CARD_INT;
>  	if (intmask && --max_loops)
>  		goto again;
>  out:


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
  2013-11-06  3:40         ` Alexey Neyman
@ 2013-11-26 22:12           ` Chris Ball
  -1 siblings, 0 replies; 15+ messages in thread
From: Chris Ball @ 2013-11-26 22:12 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Dong Aisheng, open list:SECURE DIGITAL HO..., open list

Hi Alexey,

On Tue, Nov 05 2013, Alexey Neyman wrote:
> Ignore Card Interrupt bit in the interrupt status if we already know that
> mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
> avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
> and doing nothing.
>
> Signed-off-by: Alexey Neyman <stilor@att.net>
> Acked-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7a7fb4f..a83cd1b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2491,6 +2491,14 @@ again:
>  	result = IRQ_HANDLED;
>  
>  	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +
> +	/*
> +	 * If we know we'll call the driver to signal SDIO IRQ, disregard
> +	 * further indications of Card Interrupt in the status to avoid a
> +	 * needless loop.
> +	 */
> +	if (cardint)
> +		intmask &= ~SDHCI_INT_CARD_INT;
>  	if (intmask && --max_loops)
>  		goto again;
>  out:

Thanks, this was included in 3.13-rc1 via mmc-next.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq()
@ 2013-11-26 22:12           ` Chris Ball
  0 siblings, 0 replies; 15+ messages in thread
From: Chris Ball @ 2013-11-26 22:12 UTC (permalink / raw)
  To: Alexey Neyman; +Cc: Dong Aisheng, open list:SECURE DIGITAL HO..., open list

Hi Alexey,

On Tue, Nov 05 2013, Alexey Neyman wrote:
> Ignore Card Interrupt bit in the interrupt status if we already know that
> mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq(). This
> avoids a needless loop in sdhci_irq() repeatedly reading interrupt status
> and doing nothing.
>
> Signed-off-by: Alexey Neyman <stilor@att.net>
> Acked-by: Dong Aisheng <b29396@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 7a7fb4f..a83cd1b 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2491,6 +2491,14 @@ again:
>  	result = IRQ_HANDLED;
>  
>  	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
> +
> +	/*
> +	 * If we know we'll call the driver to signal SDIO IRQ, disregard
> +	 * further indications of Card Interrupt in the status to avoid a
> +	 * needless loop.
> +	 */
> +	if (cardint)
> +		intmask &= ~SDHCI_INT_CARD_INT;
>  	if (intmask && --max_loops)
>  		goto again;
>  out:

Thanks, this was included in 3.13-rc1 via mmc-next.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Avoid needless loop in sdhci_irq() for Card Interrupt
@ 2013-10-22 18:19 Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-10-22 18:19 UTC (permalink / raw)
  To: Chris Ball, linux-mmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 713 bytes --]

[Patch ping #2]

Hi all,

I've discovered that the sdhci_irq() function needlessly iterates re-reading 
the interrupt status and doing nothing (until it runs out of max_loops) when 
it handles the "Card Interrupt" status in the interrupt status register.

The reason is that the "Card Interrupt" bit is not cleared until the 
sdhci_irq() calls mmc_signal_sdio_irq(), so if Card Interrupt was asserted, 
re-reading the interrupt status will find this bit set over and over, even if 
no other bits are reported.

The fix: ignore Card Interrupt bits in the interrupt status if we already know 
that mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq().

Signed-off-by: Alexey Neyman <stilor@att.net>

[-- Attachment #2: sdhci.c.diff --]
[-- Type: text/x-patch, Size: 688 bytes --]

commit 7f23315b344ca51ddf22a78f326f88404fa8c81d
Author: Alexey Neyman <stilor@att.net>
Date:   Wed Oct 9 22:23:54 2013 -0700

    Avoid a loop in sdhci.c.

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Avoid needless loop in sdhci_irq() for Card Interrupt
@ 2013-10-16 17:51 Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-10-16 17:51 UTC (permalink / raw)
  To: Chris Ball, linux-mmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 710 bytes --]

[Patch ping]

Hi all,

I've discovered that the sdhci_irq() function needlessly iterates re-reading 
the interrupt status and doing nothing (until it runs out of max_loops) when 
it handles the "Card Interrupt" status in the interrupt status register.

The reason is that the "Card Interrupt" bit is not cleared until the 
sdhci_irq() calls mmc_signal_sdio_irq(), so if Card Interrupt was asserted, 
re-reading the interrupt status will find this bit set over and over, even if 
no other bits are reported.

The fix: ignore Card Interrupt bits in the interrupt status if we already know 
that mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq().

Signed-off-by: Alexey Neyman <stilor@att.net>

[-- Attachment #2: sdhci.c.diff --]
[-- Type: text/x-patch, Size: 688 bytes --]

commit 7f23315b344ca51ddf22a78f326f88404fa8c81d
Author: Alexey Neyman <stilor@att.net>
Date:   Wed Oct 9 22:23:54 2013 -0700

    Avoid a loop in sdhci.c.

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Avoid needless loop in sdhci_irq() for Card Interrupt
@ 2013-10-10  5:26 Alexey Neyman
  0 siblings, 0 replies; 15+ messages in thread
From: Alexey Neyman @ 2013-10-10  5:26 UTC (permalink / raw)
  To: Chris Ball, linux-mmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

Hi all,

I've discovered that the sdhci_irq() function needlessly iterates re-reading 
the interrupt status and doing nothing (until it runs out of max_loops) when 
it handles the "Card Interrupt" status in the interrupt status register.

The reason is that the "Card Interrupt" bit is not cleared until the 
sdhci_irq() calls mmc_signal_sdio_irq(), so if Card Interrupt was asserted, 
re-reading the interrupt status will find this bit set over and over, even if 
no other bits are reported.

The fix: ignore Card Interrupt bits in the interrupt status if we already know 
that mmc_signal_sdio_irq() is going to be called at the end of sdhci_irq().

Signed-off-by: Alexey Neyman <stilor@att.net>

[-- Attachment #2: sdhci.c.diff --]
[-- Type: text/x-patch, Size: 688 bytes --]

commit 7f23315b344ca51ddf22a78f326f88404fa8c81d
Author: Alexey Neyman <stilor@att.net>
Date:   Wed Oct 9 22:23:54 2013 -0700

    Avoid a loop in sdhci.c.

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 7a7fb4f..a83cd1b 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2491,6 +2491,14 @@ again:
 	result = IRQ_HANDLED;
 
 	intmask = sdhci_readl(host, SDHCI_INT_STATUS);
+
+	/*
+	 * If we know we'll call the driver to signal SDIO IRQ, disregard
+	 * further indications of Card Interrupt in the status to avoid a
+	 * needless loop.
+	 */
+	if (cardint)
+		intmask &= ~SDHCI_INT_CARD_INT;
 	if (intmask && --max_loops)
 		goto again;
 out:

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-11-26 22:12 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-04 18:43 Avoid needless loop in sdhci_irq() for Card Interrupt Alexey Neyman
2013-11-05  6:39 ` Dong Aisheng
2013-11-05 19:58   ` [PATCH] Avoid needless loop in sdhci_irq() Alexey Neyman
2013-11-05 19:58     ` Alexey Neyman
2013-11-06  2:56     ` Dong Aisheng
2013-11-06  3:40       ` [PATCH] mmc: sdhci: Avoid needless loop while handling SDIO interrupts " Alexey Neyman
2013-11-06  3:40         ` Alexey Neyman
2013-11-08 19:14         ` Chris Ball
2013-11-08 19:14           ` Chris Ball
2013-11-18 20:01         ` Alexey Neyman
2013-11-26 22:12         ` Chris Ball
2013-11-26 22:12           ` Chris Ball
  -- strict thread matches above, loose matches on Subject: below --
2013-10-22 18:19 Avoid needless loop in sdhci_irq() for Card Interrupt Alexey Neyman
2013-10-16 17:51 Alexey Neyman
2013-10-10  5:26 Alexey Neyman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.