All of lore.kernel.org
 help / color / mirror / Atom feed
From: pankaj chauhan <pankaj.chauhan@freescale.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Goyal Akhil-B35197 <B35197@freescale.com>,
	Arnd Bergmann <arnd@arndb.de>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Chauhan Pankaj-B32944 <B32944@freescale.com>
Subject: Re: [PATCH 1/5] drivers/misc: Support for RF interface device framework
Date: Thu, 20 Jun 2013 16:17:58 +0530	[thread overview]
Message-ID: <51C2DDDE.2080402@freescale.com> (raw)
In-Reply-To: <51C19682.2070304@metafoo.de>

On 6/19/2013 5:01 PM, Lars-Peter Clausen wrote:
> On 06/18/2013 09:44 AM, Akhil Goyal wrote:
> [...]
>>>> +    /*
>>>> +     * Spin_locks are changed to mutexes if PREEMPT_RT is enabled,
>>>> +     * i.e they can sleep. This fact is problem for us because
>>>> +     * add_wait_queue()/wake_up_all() takes wait queue spin lock.
>>>> +     * Since spin lock can sleep with PREEMPT_RT, wake_up_all() can not be
>>>> +     * called from rf_notify_dl_tti (which is called in interrupt context).
>>>> +     * As a workaround, wait_q_lock is used for protecting the wait_q and
>>>> +     * add_wait_queue_locked()/ wake_up_locked() functions of wait queues
>>>> +     * are used.
>>>> +     */
>>>> +    raw_spin_lock_irqsave(&rf_dev->wait_q_lock, flags);
>>>> +    __add_wait_queue_tail_exclusive(&rf_dev->wait_q,&wait);
>>>> +    raw_spin_unlock_irqrestore(&rf_dev->wait_q_lock, flags);
>>>> +    set_current_state(TASK_INTERRUPTIBLE);
>>>> +    /*Now wait here, tti notificaion will wake us up*/
>>>> +    schedule();
>>>> +    set_current_state(TASK_RUNNING);
>>>> +    raw_spin_lock_irqsave(&rf_dev->wait_q_lock, flags);
>>>> +    __remove_wait_queue(&rf_dev->wait_q,&wait);
>>>> +    raw_spin_unlock_irqrestore(&rf_dev->wait_q_lock, flags);
>>>
>>> This is not a proper method of waiting for an event. Why can't you
>>> use wait_event() here?
>> wait_event() is internally calling spin_lock_irqsave() and this function
>> will be called in hard IRQ context with PREEMPT_RT enabled(IRQF_NODELAY
>> set). So wait_event cannot be used.
>> This problem can be solved if we can get the following patch applied on the
>> tree.
>> https://patchwork.kernel.org/patch/2161261/
>>
>>>
>>> The explanation about the interrupt handler seems incorrect, since PREEMPT_RT
>>> also turns interrupt handlers into threads.
>> The interrupt handler has real time requirement and thus running in HARDIRQ
>> context with flag IRQF_NODELAY. We get this interrupt in every millisecond.
>
> But if you are running in HARDIRQ context the whole sequence doesn't make
> much sense at all, since you won't be able to sleep and wait for the event.
>

This function for adding process to rf_dev->wait_q runs in process 
context, but the function (dl_notify_tti())which wakes process up from 
this queue runs in HARDIRQ context, that's why we could not use 
wait_event() or spin_lock() here.

thanks,
pankaj




      reply	other threads:[~2013-06-20 10:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17  8:09 [PATCH 0/5] Radio device framework akhil.goyal
2013-06-17  8:09 ` [PATCH 1/5] drivers/misc: Support for RF interface " akhil.goyal
2013-06-17  8:09   ` [PATCH 2/5] drivers/misc/rf: AIC: Freescale Antenna Interface controller driver akhil.goyal
2013-06-17  8:09     ` [PATCH 3/5] drivers/misc: rf/ad9361: AD9361 device driver for Radio phy akhil.goyal
2013-06-17  8:09       ` [PATCH 4/5] binding: Add device tree bindings for freescale AIC and AD phy akhil.goyal
2013-06-17  8:09         ` [PATCH 5/5] BSC9131rdb/dts: Add nodes for supporting AIC and AD PHY akhil.goyal
2013-06-19 12:57       ` [PATCH 3/5] drivers/misc: rf/ad9361: AD9361 device driver for Radio phy Lars-Peter Clausen
2013-06-19 14:30         ` Greg KH
2013-06-19 14:58           ` Arnd Bergmann
2013-06-20 10:35         ` pankaj chauhan
2013-06-21 23:46           ` pankaj chauhan
2013-06-24  8:19           ` Getz, Robin
2013-06-24 12:05             ` pankaj chauhan
2013-07-03 19:36           ` Mark Brown
2013-07-05  6:14             ` pankaj chauhan
2013-06-17 21:28   ` [PATCH 1/5] drivers/misc: Support for RF interface device framework Arnd Bergmann
2013-06-18  7:44     ` Akhil Goyal
2013-06-18 13:40       ` Arnd Bergmann
2013-06-19  6:00         ` Akhil Goyal
2013-06-19 11:31       ` Lars-Peter Clausen
2013-06-20 10:47         ` pankaj chauhan [this message]

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=51C2DDDE.2080402@freescale.com \
    --to=pankaj.chauhan@freescale.com \
    --cc=B32944@freescale.com \
    --cc=B35197@freescale.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@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.