* [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
@ 2004-09-01 21:06 janitor
0 siblings, 0 replies; 10+ messages in thread
From: janitor @ 2004-09-01 21:06 UTC (permalink / raw)
To: netdev; +Cc: jgarzik, jt, janitor
I would appreciate any comments from the janitor@sternweltens list.
Description: Use msleep() instead of schedule_timeout() to guarantee
the task delays for the desired time.
Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
---
linux-2.6.9-rc1-bk7-max/drivers/net/wireless/prism54/islpci_dev.c | 3 +--
1 files changed, 1 insertion(+), 2 deletions(-)
diff -puN drivers/net/wireless/prism54/islpci_dev.c~msleep-drivers_net_wireless_prism54_islpci_dev drivers/net/wireless/prism54/islpci_dev.c
--- linux-2.6.9-rc1-bk7/drivers/net/wireless/prism54/islpci_dev.c~msleep-drivers_net_wireless_prism54_islpci_dev 2004-09-01 19:35:41.000000000 +0200
+++ linux-2.6.9-rc1-bk7-max/drivers/net/wireless/prism54/islpci_dev.c 2004-09-01 19:35:41.000000000 +0200
@@ -436,8 +436,7 @@ prism54_bring_down(islpci_private *priv)
wmb();
/* wait a while for the device to reset */
- set_current_state(TASK_UNINTERRUPTIBLE);
- schedule_timeout(50*HZ/1000);
+ msleep(50);
return 0;
}
_
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
@ 2004-09-02 6:50 Margit Schubert-While
2004-09-02 8:24 ` [Kernel-janitors] " maximilian attems
0 siblings, 1 reply; 10+ messages in thread
From: Margit Schubert-While @ 2004-09-02 6:50 UTC (permalink / raw)
To: netdev; +Cc: janitor
I agree with Jean and add the following :
You are assuming HZ = 1000.
In 2.4, HZ = 100 (And in 2.6, HZ is not necessarily = 1000).
The prism54 code base is identical between 2.4/2.6 and is
maintained as such in the project.
Therefore, I look forward to your implementation of msleep()
in 2.4 ;-)
Margit
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Kernel-janitors] Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
2004-09-02 6:50 [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep() Margit Schubert-While
@ 2004-09-02 8:24 ` maximilian attems
2004-09-02 16:09 ` Nishanth Aravamudan
0 siblings, 1 reply; 10+ messages in thread
From: maximilian attems @ 2004-09-02 8:24 UTC (permalink / raw)
To: Margit Schubert-While; +Cc: netdev, kj
[-- Attachment #1: Type: text/plain, Size: 724 bytes --]
On Thu, 02 Sep 2004, Margit Schubert-While wrote:
> I agree with Jean and add the following :
> You are assuming HZ = 1000.
> In 2.4, HZ = 100 (And in 2.6, HZ is not necessarily = 1000).
shure,
but this is an argument for msleep as it uses msecs as unit,
which don't depend on your arch.
(well physics says different for arch/relativistic :)
> The prism54 code base is identical between 2.4/2.6 and is
> maintained as such in the project.
> Therefore, I look forward to your implementation of msleep()
> in 2.4 ;-)
2.4 is closed for such stuff, you'll know that better than me,
it shouldn't hinder 2.6 in it's progression.
one day you will need to branch.
--
maks
kernel janitor http://janitor.kernelnewbies.org/
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
@ 2004-09-02 9:35 Margit Schubert-While
2004-09-02 10:03 ` maximilian attems
0 siblings, 1 reply; 10+ messages in thread
From: Margit Schubert-While @ 2004-09-02 9:35 UTC (permalink / raw)
To: netdev; +Cc: janitor
On Thu, 02 Sep 2004, Maximilian scribeth:
> it shouldn't hinder 2.6 in it's progression.
I consider this a regression.
As schedule_timeout is used elesewhere in the prism54 code,
we are using a consistent and documented method.
Margit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
2004-09-02 9:35 Margit Schubert-While
@ 2004-09-02 10:03 ` maximilian attems
0 siblings, 0 replies; 10+ messages in thread
From: maximilian attems @ 2004-09-02 10:03 UTC (permalink / raw)
To: Margit Schubert-While; +Cc: netdev, kj
On Thu, 02 Sep 2004, Margit Schubert-While wrote:
> On Thu, 02 Sep 2004, Maximilian scribeth:
> > it shouldn't hinder 2.6 in it's progression.
> I consider this a regression.
> As schedule_timeout is used elesewhere in the prism54 code,
> we are using a consistent and documented method.
you didn't answer to the unit argument in favour of msleep.
shure msleep is also consistent and documented.
--
maks
kernel janitor http://janitor.kernelnewbies.org/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
@ 2004-09-02 10:21 Margit Schubert-While
0 siblings, 0 replies; 10+ messages in thread
From: Margit Schubert-While @ 2004-09-02 10:21 UTC (permalink / raw)
To: netdev; +Cc: janitor
On Thu, 02 Sep 2004, Maximilian scribeth:
> you didn't answer to the unit argument in favour of msleep.
Don't need to, here's msleep -
void msleep(unsigned int msecs)
{
unsigned long timeout = msecs_to_jiffies(msecs);
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
}
}
In other words, with the subtle exception of the while loop,
it reconstitutes the original code.
(Although m_to_j doesn't even exactly do that)
(And note because of the while loop, this may not be
what the author intended)
> shure msleep is also consistent and documented.
grep -r Documentation = Nix
Margit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
2004-09-02 8:24 ` [Kernel-janitors] " maximilian attems
@ 2004-09-02 16:09 ` Nishanth Aravamudan
0 siblings, 0 replies; 10+ messages in thread
From: Nishanth Aravamudan @ 2004-09-02 16:09 UTC (permalink / raw)
To: Margit Schubert-While, netdev, kj
On Thu, Sep 02, 2004 at 10:24:33AM +0200, maximilian attems wrote:
> On Thu, 02 Sep 2004, Margit Schubert-While wrote:
>
> > I agree with Jean and add the following :
> > You are assuming HZ = 1000.
> > In 2.4, HZ = 100 (And in 2.6, HZ is not necessarily = 1000).
As the original author of the patches, I feel I should interject . . .
Why/Where do you see an assumption about the value of HZ? The conversion
of the parameter to schedule_timeout() from jiffies to msecs is the only
place I can see where that might appear to be the case. But, upon closer
examination, there is no such assumption:
1000 = the number of milliseconds in a second.
HZ = the number of jiffies in a second (regardless of architecture)
In the original code for prism54/islpci_dev.c:
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout(50*HZ/1000);
Thus, to convert (50*HZ/1000) from jiffies to msecs, multiply by 1000
and divide by HZ, or:
50*HZ/1000 jiffies * 1000/HZ msecs/jiffie = 50 msecs.
And thus, in the patched code, the above becomes:
msleep(50);
Does that clear things up?
-Nish
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
@ 2004-09-02 17:30 Margit Schubert-While
0 siblings, 0 replies; 10+ messages in thread
From: Margit Schubert-While @ 2004-09-02 17:30 UTC (permalink / raw)
To: netdev; +Cc: janitor
On Thu, 02 Sep 2004, Nishanth scribeth:
> A grep of drivers/net/wireless/prism54 for schedule_timeout showed three
> occurrences (in 2.6.9-rc1-bk7):
> islpci_dev.c: schedule_timeout(50*HZ/1000);
> islpci_dev.c: remaining = schedule_timeout(HZ);
> islpci_mgt.c: timeleft = schedule_timeout(wait_cycle_jiffies);
> The first is removed by my patch.
> The second & third are potentially bugs as there is no
> set_current_state() preceding the call to schedule_timeout(). As per the
> source:
Nope, look a few lines above:
DEFINE_WAIT() and prepare_to_wait().
Margit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
@ 2004-09-02 17:52 Margit Schubert-While
2004-09-02 18:27 ` Nishanth Aravamudan
0 siblings, 1 reply; 10+ messages in thread
From: Margit Schubert-While @ 2004-09-02 17:52 UTC (permalink / raw)
To: netdev; +Cc: janitor, nacc
On Thu, 02 Sep 2004, Nishanth scribeth:
> Keep in mind that msleep_interruptible() is also
> (hopefully) being pushed to the kernel soon
I think you need this for your current patch set ;-)
eg. In e100, where you replace an interruptible timeout:
> @@ -2020,8 +2016,7 @@
I don't think that's correct.
Margit
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep()
2004-09-02 17:52 Margit Schubert-While
@ 2004-09-02 18:27 ` Nishanth Aravamudan
0 siblings, 0 replies; 10+ messages in thread
From: Nishanth Aravamudan @ 2004-09-02 18:27 UTC (permalink / raw)
To: Margit Schubert-While; +Cc: netdev, janitor
On Thu, Sep 02, 2004 at 07:52:18PM +0200, Margit Schubert-While wrote:
> On Thu, 02 Sep 2004, Nishanth scribeth:
> > Keep in mind that msleep_interruptible() is also
> > (hopefully) being pushed to the kernel soon
>
> I think you need this for your current patch set ;-)
> eg. In e100, where you replace an interruptible timeout:
> > @@ -2020,8 +2016,7 @@
>
> I don't think that's correct.
The reasoning for me behind changing some of the TASK_INTERRUPTIBLE'd
schedule_timeout()s to msleep()s was that LDD somewhat incorrectly
advised device driver authors to use an INTERRUPTIBLE timeout for longer
delays, when, in fact, they should probably use an UNINTERRUPTIBLE one.
Only if signals are explicitly expected to occur is INTERRUPTIBLE
necessary (in general). [By long delays, I mean those measurable in
msecs]
I am not an expert on the E100, so perhaps this was an error on my part.
But this is also why I have a header on my patch submission regarding
exactly this issue.
If someone could verify (none of the maintainers I sent the original
patch to did not reply with any problems for this patch) that there is
or is not an issue, I'd appreciate it.
-Nish
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-09-02 18:27 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-02 6:50 [patch 8/8] prism54/islpci_dev: replace schedule_timeout() with msleep() Margit Schubert-While
2004-09-02 8:24 ` [Kernel-janitors] " maximilian attems
2004-09-02 16:09 ` Nishanth Aravamudan
-- strict thread matches above, loose matches on Subject: below --
2004-09-02 17:52 Margit Schubert-While
2004-09-02 18:27 ` Nishanth Aravamudan
2004-09-02 17:30 Margit Schubert-While
2004-09-02 10:21 Margit Schubert-While
2004-09-02 9:35 Margit Schubert-While
2004-09-02 10:03 ` maximilian attems
2004-09-01 21:06 janitor
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).