netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 04/26] net/ixgb_osdep: replace schedule_timeout() with msleep()
@ 2005-03-06 10:32 domen
  2005-03-08 13:24 ` Ganesh Venkatesan
  0 siblings, 1 reply; 3+ messages in thread
From: domen @ 2005-03-06 10:32 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev, domen, nacc, janitor





Use msleep() instead of schedule_timeout()
to guarantee the task delays as expected. I was told earlier that the
in_interrupt() check is not necessary. It would be nice to get some
verification of this (i.e. the driver functions the same without it).

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/drivers/net/ixgb/ixgb_osdep.h |    8 +-------
 1 files changed, 1 insertion(+), 7 deletions(-)

diff -puN drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep drivers/net/ixgb/ixgb_osdep.h
--- kj/drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep	2005-03-05 16:09:27.000000000 +0100
+++ kj-domen/drivers/net/ixgb/ixgb_osdep.h	2005-03-05 16:09:27.000000000 +0100
@@ -41,13 +41,7 @@
 #include <linux/sched.h>
 
 #ifndef msec_delay
-#define msec_delay(x)	do { if(in_interrupt()) { \
-				/* Don't mdelay in interrupt context! */ \
-	                	BUG(); \
-			} else { \
-				set_current_state(TASK_UNINTERRUPTIBLE); \
-				schedule_timeout((x * HZ)/1000 + 2); \
-			} } while(0)
+#define msec_delay(x)	msleep(x)
 #endif
 
 #define PCI_COMMAND_REGISTER   PCI_COMMAND
_

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

* Re: [patch 04/26] net/ixgb_osdep: replace schedule_timeout() with msleep()
  2005-03-06 10:32 [patch 04/26] net/ixgb_osdep: replace schedule_timeout() with msleep() domen
@ 2005-03-08 13:24 ` Ganesh Venkatesan
  2005-03-09  8:16   ` Domen Puncer
  0 siblings, 1 reply; 3+ messages in thread
From: Ganesh Venkatesan @ 2005-03-08 13:24 UTC (permalink / raw)
  To: domen@coderock.org; +Cc: jgarzik, netdev, nacc, janitor

No. This would not work. You cannot replace msec_delay with msleep.
You probably could replace the set_current_task/schedule_timeout with
msleep. msleep does not check for the correct context, and if one were
to call msec_delay from interrupt context, the kernel would panic.

ganesh.


On Sun, 06 Mar 2005 11:32:48 +0100, domen@coderock.org
<domen@coderock.org> wrote:
> 
> 
> Use msleep() instead of schedule_timeout()
> to guarantee the task delays as expected. I was told earlier that the
> in_interrupt() check is not necessary. It would be nice to get some
> verification of this (i.e. the driver functions the same without it).
> 
> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> Signed-off-by: Domen Puncer <domen@coderock.org>
> ---
> 
> kj-domen/drivers/net/ixgb/ixgb_osdep.h |    8 +-------
> 1 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff -puN drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep drivers/net/ixgb/ixgb_osdep.h
> --- kj/drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep 2005-03-05 16:09:27.000000000 +0100
> +++ kj-domen/drivers/net/ixgb/ixgb_osdep.h      2005-03-05 16:09:27.000000000 +0100
> @@ -41,13 +41,7 @@
> #include <linux/sched.h>
> 
> #ifndef msec_delay
> -#define msec_delay(x)  do { if(in_interrupt()) { \
> -                               /* Don't mdelay in interrupt context! */ \
> -                               BUG(); \
> -                       } else { \
> -                               set_current_state(TASK_UNINTERRUPTIBLE); \
> -                               schedule_timeout((x * HZ)/1000 + 2); \
> -                       } } while(0)
> +#define msec_delay(x)  msleep(x)
> #endif
> 
> #define PCI_COMMAND_REGISTER   PCI_COMMAND
> _
> 
>

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

* Re: [patch 04/26] net/ixgb_osdep: replace schedule_timeout() with msleep()
  2005-03-08 13:24 ` Ganesh Venkatesan
@ 2005-03-09  8:16   ` Domen Puncer
  0 siblings, 0 replies; 3+ messages in thread
From: Domen Puncer @ 2005-03-09  8:16 UTC (permalink / raw)
  To: Ganesh Venkatesan; +Cc: jgarzik, netdev, nacc, janitor

On 08/03/05 05:24 -0800, Ganesh Venkatesan wrote:
> No. This would not work. You cannot replace msec_delay with msleep.
> You probably could replace the set_current_task/schedule_timeout with
> msleep. msleep does not check for the correct context, and if one were
> to call msec_delay from interrupt context, the kernel would panic.

And that would be wrong? Guess what BUG() does.

> 
> ganesh.
> 
> 
> On Sun, 06 Mar 2005 11:32:48 +0100, domen@coderock.org
> <domen@coderock.org> wrote:
> > 
> > 
> > Use msleep() instead of schedule_timeout()
> > to guarantee the task delays as expected. I was told earlier that the
> > in_interrupt() check is not necessary. It would be nice to get some
> > verification of this (i.e. the driver functions the same without it).
> > 
> > Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
> > Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> > Signed-off-by: Domen Puncer <domen@coderock.org>
> > ---
> > 
> > kj-domen/drivers/net/ixgb/ixgb_osdep.h |    8 +-------
> > 1 files changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff -puN drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep drivers/net/ixgb/ixgb_osdep.h
> > --- kj/drivers/net/ixgb/ixgb_osdep.h~msleep-drivers_net_ixgb_ixgb_osdep 2005-03-05 16:09:27.000000000 +0100
> > +++ kj-domen/drivers/net/ixgb/ixgb_osdep.h      2005-03-05 16:09:27.000000000 +0100
> > @@ -41,13 +41,7 @@
> > #include <linux/sched.h>
> > 
> > #ifndef msec_delay
> > -#define msec_delay(x)  do { if(in_interrupt()) { \
> > -                               /* Don't mdelay in interrupt context! */ \
> > -                               BUG(); \
> > -                       } else { \
> > -                               set_current_state(TASK_UNINTERRUPTIBLE); \
> > -                               schedule_timeout((x * HZ)/1000 + 2); \
> > -                       } } while(0)
> > +#define msec_delay(x)  msleep(x)
> > #endif
> > 
> > #define PCI_COMMAND_REGISTER   PCI_COMMAND
> > _
> > 
> >

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

end of thread, other threads:[~2005-03-09  8:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-06 10:32 [patch 04/26] net/ixgb_osdep: replace schedule_timeout() with msleep() domen
2005-03-08 13:24 ` Ganesh Venkatesan
2005-03-09  8:16   ` Domen Puncer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).