Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1256511 > unrolled thread

character driver - poll() timeout

Started byMuni Sekhar <munisekharrms@gmail.com>
First post2015-10-27 08:00 +0100
Last post2015-10-27 16:30 +0100
Articles 8 — 3 participants

Back to article view | Back to linux.kernel


Contents

  character driver - poll() timeout Muni Sekhar <munisekharrms@gmail.com> - 2015-10-27 08:00 +0100
    Re: character driver - poll() timeout Clemens Ladisch <clemens@ladisch.de> - 2015-10-27 09:20 +0100
      Re: character driver - poll() timeout Muni Sekhar <munisekharrms@gmail.com> - 2015-10-27 16:00 +0100
        Re: character driver - poll() timeout Clemens Ladisch <clemens@ladisch.de> - 2015-10-27 16:20 +0100
          Re: character driver - poll() timeout Muni Sekhar <munisekharrms@gmail.com> - 2015-10-28 07:50 +0100
            Re: character driver - poll() timeout Clemens Ladisch <clemens@ladisch.de> - 2015-10-28 08:30 +0100
              Re: character driver - poll() timeout Muni Sekhar <munisekharrms@gmail.com> - 2015-10-28 11:20 +0100
        Re: character driver - poll() timeout Richard Weinberger <richard.weinberger@gmail.com> - 2015-10-27 16:30 +0100

#1256511 — character driver - poll() timeout

FromMuni Sekhar <munisekharrms@gmail.com>
Date2015-10-27 08:00 +0100
Subjectcharacter driver - poll() timeout
Message-ID<qo6oG-1Wi-11@gated-at.bofh.it>
[ 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
--
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/

[toc] | [next] | [standalone]


#1256555

FromClemens Ladisch <clemens@ladisch.de>
Date2015-10-27 09:20 +0100
Message-ID<qo7E7-2QQ-17@gated-at.bofh.it>
In reply to#1256511
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
--
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/

[toc] | [prev] | [next] | [standalone]


#1256824

FromMuni Sekhar <munisekharrms@gmail.com>
Date2015-10-27 16:00 +0100
Message-ID<qodTd-6r2-29@gated-at.bofh.it>
In reply to#1256555
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
--
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/

[toc] | [prev] | [next] | [standalone]


#1256847

FromClemens Ladisch <clemens@ladisch.de>
Date2015-10-27 16:20 +0100
Message-ID<qoecy-6N1-19@gated-at.bofh.it>
In reply to#1256824
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
--
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/

[toc] | [prev] | [next] | [standalone]


#1257709

FromMuni Sekhar <munisekharrms@gmail.com>
Date2015-10-28 07:50 +0100
Message-ID<qosIx-7ys-1@gated-at.bofh.it>
In reply to#1256847
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
--
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/

[toc] | [prev] | [next] | [standalone]


#1257739

FromClemens Ladisch <clemens@ladisch.de>
Date2015-10-28 08:30 +0100
Message-ID<qotlg-82d-5@gated-at.bofh.it>
In reply to#1257709
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
--
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/

[toc] | [prev] | [next] | [standalone]


#1257882

FromMuni Sekhar <munisekharrms@gmail.com>
Date2015-10-28 11:20 +0100
Message-ID<qovZM-1i2-11@gated-at.bofh.it>
In reply to#1257739
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
--
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/

[toc] | [prev] | [next] | [standalone]


#1256852

FromRichard Weinberger <richard.weinberger@gmail.com>
Date2015-10-27 16:30 +0100
Message-ID<qoeme-6Qp-9@gated-at.bofh.it>
In reply to#1256824
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
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web