* divide error trying to set rt_period to zero
@ 2008-06-25 22:17 Dario Faggioli
2008-06-26 13:39 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Dario Faggioli @ 2008-06-25 22:17 UTC (permalink / raw)
To: Michael Trimarchi, PeterZijlstra, Ingo Molnar, Daniel K.,
Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 3603 bytes --]
Hi all again,
Here it is another little Oops we found:
echo 0 > /dev/cgroups/0/cpu.rt_period_us
or
echo 4294967296 > /dev/cgroups/0/cpu.rt_period_us
[ 205.509825] divide error: 0000 [#1]
[ 205.510151] Modules linked in:
[ 205.510151]
[ 205.510151] Pid: 2339, comm: bash Not tainted (2.6.26-rc8 #33)
[ 205.510151] EIP: 0060:[<c030c6ef>] EFLAGS: 00000293 CPU: 0
[ 205.510151] EIP is at div64_u64+0x5f/0x70
[ 205.510151] EAX: 0000389f EBX: 00000000 ECX: 00000000 EDX: 00000000
[ 205.510151] ESI: d9800000 EDI: 00000000 EBP: c6cede60 ESP: c6cede50
[ 205.510151] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
[ 205.510151] Process bash (pid: 2339, ti=c6cec000 task=c79be370 task.ti=c6cec000)
[ 205.510151] Stack: d9800000 0000389f c05971a0 d9800000 c6cedeb4 c0214dbd 00000000 00000000
[ 205.510151] c6cede88 c0242bd8 c05377c0 c7a41b40 00000000 00000000 00000000 c05971a0
[ 205.510151] c780ed20 c7508494 c7a41b40 00000000 00000002 c6cedebc c05971a0 ffffffea
[ 205.510151] Call Trace:
[ 205.510151] [<c0214dbd>] ? __rt_schedulable+0x1cd/0x240
[ 205.510151] [<c0242bd8>] ? cgroup_file_open+0x18/0xe0
[ 205.510151] [<c0214fe4>] ? tg_set_bandwidth+0xa4/0xf0
[ 205.510151] [<c0215066>] ? sched_group_set_rt_period+0x36/0x50
[ 205.510151] [<c021508e>] ? cpu_rt_period_write_uint+0xe/0x10
[ 205.510151] [<c0242dc5>] ? cgroup_file_write+0x125/0x160
[ 205.510151] [<c0232c15>] ? hrtimer_interrupt+0x155/0x190
[ 205.510151] [<c02f047f>] ? security_file_permission+0xf/0x20
[ 205.510151] [<c0277ad8>] ? rw_verify_area+0x48/0xc0
[ 205.510151] [<c0283744>] ? dupfd+0x104/0x130
[ 205.510151] [<c027838c>] ? vfs_write+0x9c/0x160
[ 205.510151] [<c0242ca0>] ? cgroup_file_write+0x0/0x160
[ 205.510151] [<c027850d>] ? sys_write+0x3d/0x70
[ 205.510151] [<c0203019>] ? sysenter_past_esp+0x6a/0x91
[ 205.510151] =======================
[ 205.510151] Code: 0f 45 de 31 f6 0f ad d0 d3 ea f6 c1 20 0f 45 c2 0f 45 d6 89 45 f0 89 55 f4 8b 55 f4 31 c9 8b 45 f0 39 d3 89 c6 77 08 89 d0 31 d2 <f7> f3 89 c1 83 c4 08 89 f0 f7 f3 89 ca 5b 5e 5d c3 55 89 e5 56
[ 205.510151] EIP: [<c030c6ef>] div64_u64+0x5f/0x70 SS:ESP 0068:c6cede50
The attached patch solves the issue for me.
I'm checking as soon as possible for the period not being zero since, if
it is, going ahead is useless. This way we also save a mutex_lock() and
a read_lock() wrt doing it inside tg_set_bandwidth() or
__rt_schedulable().
Regards,
Dario Faggioli
Signed-off-by: Dario Faggioli <raistlin@linux.it>
Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
---
diff --git a/kernel/sched.c b/kernel/sched.c
index 3aaa5c8..9c3df51 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
*tg, long rt_period_us)
rt_period = (u64)rt_period_us * NSEC_PER_USEC;
rt_runtime = tg->rt_bandwidth.rt_runtime;
+ if (period == 0)
+ return -EINVAL;
+
return tg_set_bandwidth(tg, rt_period, rt_runtime);
}
--
<<This happens because I choose it to happen!>>
(Raistlin Majere, DragonLance Chronicles -Dragons of Spring Drawning-)
----------------------------------------------------------------------
Dario Faggioli
GNU/Linux Registered User: #340657
Web: http://www.linux.it/~raistlin
Blog: http://blog.linux.it/raistlin
SIP Account: dario.faggioli@sipproxy.wengo.fr or
raistlin@ekiga.net
Jabber Account: dario.faggioli@jabber.org/WengoPhone
GnuPG Key ID: 4DC83AC4
GnuPG Key Fingerprint: 2A78 AD5D B9CF A082 0836 08AD 9385 DA04 4DC8 3AC4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: divide error trying to set rt_period to zero
2008-06-25 22:17 divide error trying to set rt_period to zero Dario Faggioli
@ 2008-06-26 13:39 ` Ingo Molnar
2008-06-26 16:54 ` Raistlin
0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2008-06-26 13:39 UTC (permalink / raw)
To: Dario Faggioli
Cc: Michael Trimarchi, PeterZijlstra, Daniel K., Linux Kernel Mailing List
* Dario Faggioli <raistlin@linux.it> wrote:
> Hi all again,
>
> Here it is another little Oops we found:
>
> echo 0 > /dev/cgroups/0/cpu.rt_period_us
> or
> echo 4294967296 > /dev/cgroups/0/cpu.rt_period_us
>
> [ 205.509825] divide error: 0000 [#1]
> [ 205.510151] Modules linked in:
> [ 205.510151]
> [ 205.510151] Pid: 2339, comm: bash Not tainted (2.6.26-rc8 #33)
> [ 205.510151] EIP: 0060:[<c030c6ef>] EFLAGS: 00000293 CPU: 0
> [ 205.510151] EIP is at div64_u64+0x5f/0x70
> [ 205.510151] EAX: 0000389f EBX: 00000000 ECX: 00000000 EDX: 00000000
> [ 205.510151] ESI: d9800000 EDI: 00000000 EBP: c6cede60 ESP: c6cede50
> [ 205.510151] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
> [ 205.510151] Process bash (pid: 2339, ti=c6cec000 task=c79be370 task.ti=c6cec000)
> [ 205.510151] Stack: d9800000 0000389f c05971a0 d9800000 c6cedeb4 c0214dbd 00000000 00000000
> [ 205.510151] c6cede88 c0242bd8 c05377c0 c7a41b40 00000000 00000000 00000000 c05971a0
> [ 205.510151] c780ed20 c7508494 c7a41b40 00000000 00000002 c6cedebc c05971a0 ffffffea
> [ 205.510151] Call Trace:
> [ 205.510151] [<c0214dbd>] ? __rt_schedulable+0x1cd/0x240
> [ 205.510151] [<c0242bd8>] ? cgroup_file_open+0x18/0xe0
> [ 205.510151] [<c0214fe4>] ? tg_set_bandwidth+0xa4/0xf0
> [ 205.510151] [<c0215066>] ? sched_group_set_rt_period+0x36/0x50
> [ 205.510151] [<c021508e>] ? cpu_rt_period_write_uint+0xe/0x10
> [ 205.510151] [<c0242dc5>] ? cgroup_file_write+0x125/0x160
> [ 205.510151] [<c0232c15>] ? hrtimer_interrupt+0x155/0x190
> [ 205.510151] [<c02f047f>] ? security_file_permission+0xf/0x20
> [ 205.510151] [<c0277ad8>] ? rw_verify_area+0x48/0xc0
> [ 205.510151] [<c0283744>] ? dupfd+0x104/0x130
> [ 205.510151] [<c027838c>] ? vfs_write+0x9c/0x160
> [ 205.510151] [<c0242ca0>] ? cgroup_file_write+0x0/0x160
> [ 205.510151] [<c027850d>] ? sys_write+0x3d/0x70
> [ 205.510151] [<c0203019>] ? sysenter_past_esp+0x6a/0x91
> [ 205.510151] =======================
> [ 205.510151] Code: 0f 45 de 31 f6 0f ad d0 d3 ea f6 c1 20 0f 45 c2 0f 45 d6 89 45 f0 89 55 f4 8b 55 f4 31 c9 8b 45 f0 39 d3 89 c6 77 08 89 d0 31 d2 <f7> f3 89 c1 83 c4 08 89 f0 f7 f3 89 ca 5b 5e 5d c3 55 89 e5 56
> [ 205.510151] EIP: [<c030c6ef>] div64_u64+0x5f/0x70 SS:ESP 0068:c6cede50
>
> The attached patch solves the issue for me.
> @@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
> *tg, long rt_period_us)
> rt_period = (u64)rt_period_us * NSEC_PER_USEC;
> rt_runtime = tg->rt_bandwidth.rt_runtime;
>
> + if (period == 0)
> + return -EINVAL;
this patch doesnt even build, because there's no "period" variable.
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: divide error trying to set rt_period to zero
2008-06-26 13:39 ` Ingo Molnar
@ 2008-06-26 16:54 ` Raistlin
2008-07-01 6:26 ` Ingo Molnar
0 siblings, 1 reply; 4+ messages in thread
From: Raistlin @ 2008-06-26 16:54 UTC (permalink / raw)
To: Ingo Molnar
Cc: Michael Trimarchi, PeterZijlstra, Daniel K., Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 1949 bytes --]
On Thu, 2008-06-26 at 15:39 +0200, Ingo Molnar wrote:
> > @@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
> > *tg, long rt_period_us)
> > rt_period = (u64)rt_period_us * NSEC_PER_USEC;
> > rt_runtime = tg->rt_bandwidth.rt_runtime;
> >
> > + if (period == 0)
> > + return -EINVAL;
>
> this patch doesnt even build, because there's no "period" variable.
Ops! :-O
My fault, moving the 'if' back and forth from one function to another I
finally sent the wrong (and broken!) version of the patch... Very sorry
about it!
I know, I would have noticed just looking at the code... But I missed
it. :-(
Anyway, if still interested in, the following one build and work... I've
just tried it and I'm quite sure this time. :-P
Sorry again and Regards,
Dario Faggioli
Signed-off-by: Dario Faggioli <raistlin@linux.it>
Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it>
---
diff --git a/kernel/sched.c b/kernel/sched.c
index 3aaa5c8..696758f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
*tg, long rt_period_us)
rt_period = (u64)rt_period_us * NSEC_PER_USEC;
rt_runtime = tg->rt_bandwidth.rt_runtime;
+ if (rt_period == 0)
+ return -EINVAL;
+
return tg_set_bandwidth(tg, rt_period, rt_runtime);
}
--
<<This happens because I choose it to happen!>>
(Raistlin Majere, DragonLance Chronicles -Dragons of Spring Drawning-)
----------------------------------------------------------------------
Dario Faggioli
GNU/Linux Registered User: #340657
Web: http://www.linux.it/~raistlin
Blog: http://blog.linux.it/raistlin
SIP Account: dario.faggioli@sipproxy.wengo.fr or
raistlin@ekiga.net
Jabber Account: dario.faggioli@jabber.org/WengoPhone
GnuPG Key ID: 4DC83AC4
GnuPG Key Fingerprint: 2A78 AD5D B9CF A082 0836 08AD 9385 DA04 4DC8 3AC4
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: divide error trying to set rt_period to zero
2008-06-26 16:54 ` Raistlin
@ 2008-07-01 6:26 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2008-07-01 6:26 UTC (permalink / raw)
To: Raistlin
Cc: Michael Trimarchi, PeterZijlstra, Daniel K., Linux Kernel Mailing List
* Raistlin <raistlin@linux.it> wrote:
> Ops! :-O
>
> My fault, moving the 'if' back and forth from one function to another
> I finally sent the wrong (and broken!) version of the patch... Very
> sorry about it!
>
> I know, I would have noticed just looking at the code... But I missed
> it. :-(
hey, no problem.
> Anyway, if still interested in, the following one build and work...
> I've just tried it and I'm quite sure this time. :-P
applied to tip/sched/urgent - thanks Dario. We are interested in it of
course, you fixed a real bug in the scheduler :-)
small sidenote:
> +++ b/kernel/sched.c
> @@ -8501,6 +8501,9 @@ int sched_group_set_rt_period(struct task_group
> *tg, long rt_period_us)
> rt_period = (u64)rt_period_us * NSEC_PER_USEC;
> rt_runtime = tg->rt_bandwidth.rt_runtime;
>
> + if (rt_period == 0)
> + return -EINVAL;
> +
> return tg_set_bandwidth(tg, rt_period, rt_runtime);
> }
that patch was whitespace damaged (lines wrapped and tabs converted to
spaces). I fixed it up by hand - you can avoid such problems with future
patches by sending patches a'la Documentation/email-clients.txt.
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-07-01 6:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-25 22:17 divide error trying to set rt_period to zero Dario Faggioli
2008-06-26 13:39 ` Ingo Molnar
2008-06-26 16:54 ` Raistlin
2008-07-01 6:26 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®