From: Ingo Molnar <mingo@elte.hu>
To: Mateusz.Blaszczyk@nask.pl
Cc: rml@tech9.net, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@osdl.org>,
William Lee Irwin III <wli@holomorphy.com>,
Linus Torvalds <torvalds@osdl.org>
Subject: [patch, 2.6.9-rc4-mm1] fix oops in sched_setscheduler
Date: Fri, 15 Oct 2004 11:03:36 +0200 [thread overview]
Message-ID: <20041015090336.GA14362@elte.hu> (raw)
In-Reply-To: <Pine.GSO.4.58.0410150833330.9897@boromir>
* Mateusz.Blaszczyk@nask.pl <Mateusz.Blaszczyk@nask.pl> wrote:
> Running cdrecord caused oops in sched_setscheduler syscall (i think)
> so i tested with my little setp.c program that follows. It seems that
> it always oops - no matter what policy I request. It runs ok on
> 2.6.9-rc2-mm1, same config. Rc3 not tested. I run setp. 3 times. The
> first I decoded using ksymoops. My .config follows at the end.
the crash happens if 1) someone doesnt have profiling enabled 2) uses an
UP kernel and 3) does setscheduler. The patch below fixes 3 problems:
finishes and fixes the consolidation and fixes the profile=schedule
feature. Against 2.6.9-rc4-mm1. Tested.
also it seems that some serious mismerge happened of the
profile=schedule feature. Wli or akpm merge damage?
in the next mail i will send a patch against 2.6.9-rc4 too (which
luckily doesnt have the crash bug, but has the feature mismerge).
Ingo
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -2744,6 +2744,7 @@ asmlinkage void __sched schedule(void)
dump_stack();
}
}
+ profile_hit(SCHED_PROFILING, __builtin_return_address(0));
need_resched:
preempt_disable();
@@ -3342,7 +3343,6 @@ static int setscheduler(pid_t pid, int p
policy != SCHED_NORMAL)
goto out_unlock;
}
- profile_hit(SCHED_PROFILING, __builtin_return_address(0));
/*
* Valid priorities for SCHED_FIFO and SCHED_RR are
--- linux/kernel/profile.c.orig
+++ linux/kernel/profile.c
@@ -49,14 +49,14 @@ static int __init profile_setup(char * s
int par;
if (!strncmp(str, "schedule", 8)) {
- prof_on = 2;
+ prof_on = SCHED_PROFILING;
printk(KERN_INFO "kernel schedule profiling enabled\n");
if (str[7] == ',')
str += 8;
}
if (get_option(&str,&par)) {
prof_shift = par;
- prof_on = 1;
+ prof_on = CPU_PROFILING;
printk(KERN_INFO "kernel profiling enabled (shift: %ld)\n",
prof_shift);
}
@@ -385,6 +385,8 @@ inline void profile_hit(int type, void *
{
unsigned long pc;
+ if (prof_on != type || !prof_buffer)
+ return;
pc = ((unsigned long)__pc - (unsigned long)_stext) >> prof_shift;
atomic_inc(&prof_buffer[min(pc, prof_len - 1)]);
}
@@ -394,8 +396,6 @@ void profile_tick(int type, struct pt_re
{
if (type == CPU_PROFILING)
profile_hook(regs);
- if (prof_on != type || !prof_buffer)
- return;
if (!user_mode(regs) && cpu_isset(smp_processor_id(), prof_cpu_mask))
profile_hit(type, (void *)profile_pc(regs));
}
next prev parent reply other threads:[~2004-10-15 9:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-15 7:13 Oops sched_setscheduler in 2.6.9-rc4-mm1 Mateusz.Blaszczyk
2004-10-15 9:03 ` Ingo Molnar [this message]
2004-10-15 9:07 ` [patch, 2.6.9-rc4-mm1] fix oops in sched_setscheduler Andrew Morton
2004-10-15 9:20 ` [patch, 2.6.9-rc4-mm1, 2.6.9-rc4] fix the prof=schedule feature Ingo Molnar
2004-10-15 10:52 ` [patch, 2.6.9-rc4-mm1] fix oops in sched_setscheduler Mateusz.Blaszczyk
2004-10-15 10:56 ` William Lee Irwin III
2004-10-15 11:49 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041015090336.GA14362@elte.hu \
--to=mingo@elte.hu \
--cc=Mateusz.Blaszczyk@nask.pl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
--cc=torvalds@osdl.org \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.