All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Luciano Coelho <coelho@ti.com>
Cc: <linux-wireless@vger.kernel.org>, <ido@wizery.com>,
	<balbi@ti.com>, <gregoire@alwaysinnovating.com>
Subject: Re: [PATCH] wlcore: move handling from hardirq to the irq thread function
Date: Mon, 25 Mar 2013 13:11:01 +0200	[thread overview]
Message-ID: <20130325111101.GD25656@arwen.pp.htv.fi> (raw)
In-Reply-To: <1364208824-18751-1-git-send-email-coelho@ti.com>

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

On Mon, Mar 25, 2013 at 12:53:44PM +0200, Luciano Coelho wrote:
> Spin locks and completions are expensive in hard IRQ context and cause
> problems with RT kernels.  In RT kernels, both spin locks and
> completions can schedule(), so we can't use them in hard irq context.
> 
> Move handling code into the irq thread function to avoid that.
> 
> Reported-by: Gregoire Gentil <gregoire@alwaysinnovating.com>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---
>  drivers/net/wireless/ti/wlcore/main.c |   53 +++++++++++++--------------------
>  1 file changed, 21 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
> index 248daa9..c2730a7 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -651,6 +651,25 @@ static irqreturn_t wlcore_irq(int irq, void *cookie)
>  	unsigned long flags;
>  	struct wl1271 *wl = cookie;
>  
> +	/* complete the ELP completion */
> +	spin_lock_irqsave(&wl->wl_lock, flags);
> +	set_bit(WL1271_FLAG_IRQ_RUNNING, &wl->flags);
> +	if (wl->elp_compl) {
> +		complete(wl->elp_compl);
> +		wl->elp_compl = NULL;
> +	}
> +
> +	if (test_bit(WL1271_FLAG_SUSPENDED, &wl->flags)) {
> +		/* don't enqueue a work right now. mark it as pending */
> +		set_bit(WL1271_FLAG_PENDING_WORK, &wl->flags);
> +		wl1271_debug(DEBUG_IRQ, "should not enqueue work");
> +		disable_irq_nosync(wl->irq);
> +		pm_wakeup_event(wl->dev, 0);
> +		spin_unlock_irqrestore(&wl->wl_lock, flags);
> +		return IRQ_HANDLED;
> +	}
> +	spin_unlock_irqrestore(&wl->wl_lock, flags);

I still think _irqrestore() here is wrong, since it will reenable the
IRQ line... other than that, it looks alright.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-03-25 11:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-25 10:53 [PATCH] wlcore: move handling from hardirq to the irq thread function Luciano Coelho
2013-03-25 11:11 ` Felipe Balbi [this message]
2013-03-25 11:33   ` Luciano Coelho
2013-03-25 11:38     ` Felipe Balbi
2013-03-25 15:08 ` Luciano Coelho

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=20130325111101.GD25656@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=coelho@ti.com \
    --cc=gregoire@alwaysinnovating.com \
    --cc=ido@wizery.com \
    --cc=linux-wireless@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 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.