All of lore.kernel.org
 help / color / mirror / Atom feed
* character driver - poll() timeout
@ 2015-10-27  6:54 Muni Sekhar
  2015-10-27  8:11 ` Clemens Ladisch
  0 siblings, 1 reply; 8+ messages in thread
From: Muni Sekhar @ 2015-10-27  6:54 UTC (permalink / raw)
  To: linux-kernel

[ Please keep me in CC as I'm not subscribed to the list]

Hello,

Is it possible to print the timeout value in character driver poll() API?


User mode call: int poll(struct pollfd *fds, nfds_t nfds, int timeout)

Kernel mode call: unsigned int driver_poll(struct file *filp, poll_table *wait)


-- 
Thanks,
Sekhar

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

* Re: character driver - poll() timeout
  2015-10-27  6:54 character driver - poll() timeout Muni Sekhar
@ 2015-10-27  8:11 ` Clemens Ladisch
  2015-10-27 14:56   ` Muni Sekhar
  0 siblings, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2015-10-27  8:11 UTC (permalink / raw)
  To: Muni Sekhar, linux-kernel

Muni Sekhar wrote:
> Is it possible to print the timeout value in character driver poll() API?

No.  Your driver's poll callback never waits.

Why do you think you need this value?


Regards,
Clemens

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

* Re: character driver - poll() timeout
  2015-10-27  8:11 ` Clemens Ladisch
@ 2015-10-27 14:56   ` Muni Sekhar
  2015-10-27 15:18     ` Clemens Ladisch
  2015-10-27 15:20     ` Richard Weinberger
  0 siblings, 2 replies; 8+ messages in thread
From: Muni Sekhar @ 2015-10-27 14:56 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: linux-kernel

On Tue, Oct 27, 2015 at 1:41 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
> Muni Sekhar wrote:
>> Is it possible to print the timeout value in character driver poll() API?
>
> No.  Your driver's poll callback never waits.
>
> Why do you think you need this value?

I need to find out when exactly driver's poll callback returned timeout.

>
>
> Regards,
> Clemens



--
Thanks,
Sekhar

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

* Re: character driver - poll() timeout
  2015-10-27 14:56   ` Muni Sekhar
@ 2015-10-27 15:18     ` Clemens Ladisch
  2015-10-28  6:41       ` Muni Sekhar
  2015-10-27 15:20     ` Richard Weinberger
  1 sibling, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2015-10-27 15:18 UTC (permalink / raw)
  To: Muni Sekhar; +Cc: linux-kernel

Muni Sekhar wrote:
> On Tue, Oct 27, 2015 at 1:41 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
>> Muni Sekhar wrote:
>>> Is it possible to print the timeout value in character driver poll() API?
>>
>> No.  Your driver's poll callback never waits.
>>
>> Why do you think you need this value?
>
> I need to find out when exactly driver's poll callback returned timeout.

Your poll callback _cannot_ return a timeout.

Why do you think you need this information for?


Regards,
Clemens

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

* Re: character driver - poll() timeout
  2015-10-27 14:56   ` Muni Sekhar
  2015-10-27 15:18     ` Clemens Ladisch
@ 2015-10-27 15:20     ` Richard Weinberger
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Weinberger @ 2015-10-27 15:20 UTC (permalink / raw)
  To: Muni Sekhar; +Cc: Clemens Ladisch, LKML

On Tue, Oct 27, 2015 at 3:56 PM, Muni Sekhar <munisekharrms@gmail.com> wrote:
> On Tue, Oct 27, 2015 at 1:41 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
>> Muni Sekhar wrote:
>>> Is it possible to print the timeout value in character driver poll() API?
>>
>> No.  Your driver's poll callback never waits.
>>
>> Why do you think you need this value?
>
> I need to find out when exactly driver's poll callback returned timeout.

Kernel's poll() is just the generic backend for any kind of polling
API. Like select(), epoll or poll().
If your driver needs to know the timeout, it is broken by design.


-- 
Thanks,
//richard

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

* Re: character driver - poll() timeout
  2015-10-27 15:18     ` Clemens Ladisch
@ 2015-10-28  6:41       ` Muni Sekhar
  2015-10-28  7:24         ` Clemens Ladisch
  0 siblings, 1 reply; 8+ messages in thread
From: Muni Sekhar @ 2015-10-28  6:41 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: linux-kernel

On Tue, Oct 27, 2015 at 8:48 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
> Muni Sekhar wrote:
>> On Tue, Oct 27, 2015 at 1:41 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
>>> Muni Sekhar wrote:
>>>> Is it possible to print the timeout value in character driver poll() API?
>>>
>>> No.  Your driver's poll callback never waits.
>>>
>>> Why do you think you need this value?
>>
>> I need to find out when exactly driver's poll callback returned timeout.
>
> Your poll callback _cannot_ return a timeout.
>
> Why do you think you need this information for?

During stress test, my test application fails and throws poll() timeout error.

I need to debug what is the state of my driver during that time. I
added prints in driver poll(), but I gets lots of debug prints if
poll() timeout is more.

So I am wonder if it is possible to get a single debug print for this scenario?


>
>
> Regards,
> Clemens



--
Thanks,
Sekhar

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

* Re: character driver - poll() timeout
  2015-10-28  6:41       ` Muni Sekhar
@ 2015-10-28  7:24         ` Clemens Ladisch
  2015-10-28 10:15           ` Muni Sekhar
  0 siblings, 1 reply; 8+ messages in thread
From: Clemens Ladisch @ 2015-10-28  7:24 UTC (permalink / raw)
  To: Muni Sekhar; +Cc: linux-kernel

Muni Sekhar wrote:
> On Tue, Oct 27, 2015 at 8:48 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
>> Muni Sekhar wrote:
>>> I need to find out when exactly driver's poll callback returned timeout.
>>
>> Your poll callback _cannot_ return a timeout.
>>
>> Why do you think you need this information for?
>
> During stress test, my test application fails and throws poll() timeout error.
>
> I need to debug what is the state of my driver during that time. I
> added prints in driver poll(), but I gets lots of debug prints if
> poll() timeout is more.

Your poll() callback does not really change the state of the driver.
It just returns the wait queue and the current state of the device.
(Which means it is likely to get called _twice_, before poll() goes
to sleep, and just before it returns.)

Your driver's state changes only when
1) you start some operation (such as read() or write()), or when
2) you finish some operation (which wakes up anyone waiting on
   that wait queue).

If you time out, it means that some wake_up() happens too late or
not at all, or that you do not return the correct state.


Regards,
Clemens

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

* Re: character driver - poll() timeout
  2015-10-28  7:24         ` Clemens Ladisch
@ 2015-10-28 10:15           ` Muni Sekhar
  0 siblings, 0 replies; 8+ messages in thread
From: Muni Sekhar @ 2015-10-28 10:15 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: linux-kernel

On Wed, Oct 28, 2015 at 12:54 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
> Muni Sekhar wrote:
>> On Tue, Oct 27, 2015 at 8:48 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
>>> Muni Sekhar wrote:
>>>> I need to find out when exactly driver's poll callback returned timeout.
>>>
>>> Your poll callback _cannot_ return a timeout.
>>>
>>> Why do you think you need this information for?
>>
>> During stress test, my test application fails and throws poll() timeout error.
>>
>> I need to debug what is the state of my driver during that time. I
>> added prints in driver poll(), but I gets lots of debug prints if
>> poll() timeout is more.
>
> Your poll() callback does not really change the state of the driver.
> It just returns the wait queue and the current state of the device.
> (Which means it is likely to get called _twice_, before poll() goes
> to sleep, and just before it returns.)
>
> Your driver's state changes only when
> 1) you start some operation (such as read() or write()), or when
> 2) you finish some operation (which wakes up anyone waiting on
>    that wait queue).
>
> If you time out, it means that some wake_up() happens too late or
> not at all, or that you do not return the correct state.
Thanks Clemens for the clarification.

>
>
> Regards,
> Clemens



--
Thanks,
Sekhar

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

end of thread, other threads:[~2015-10-28 10:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-27  6:54 character driver - poll() timeout Muni Sekhar
2015-10-27  8:11 ` Clemens Ladisch
2015-10-27 14:56   ` Muni Sekhar
2015-10-27 15:18     ` Clemens Ladisch
2015-10-28  6:41       ` Muni Sekhar
2015-10-28  7:24         ` Clemens Ladisch
2015-10-28 10:15           ` Muni Sekhar
2015-10-27 15:20     ` Richard Weinberger

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.