public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Erich Focht <focht@ess.nec.de>
To: linux-ia64@vger.kernel.org
Subject: Re: [Linux-ia64] Help with Ingo scheduler on IA64
Date: Mon, 14 Jan 2002 18:23:31 +0000	[thread overview]
Message-ID: <marc-linux-ia64-105590698805819@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590698805816@msgid-missing>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1715 bytes --]

Hi,

I don't think that runqueues(cpu)->idle is set when you try to access it
from head.S. It is much easier to reintroduce init_tasks and leave head.S
as it is. Then no changes are needed in Ingo's patch for sched.h and
sched.c. Ingo, could you please comment?

Please find attached an ia64 patch which should be applied over
2.4.17 + ia64 + sched-O1-2.4.17-H7.patch


It doesn't boot yet, the system (2CPU BigSur) crashes in
  schedule() <- cpu_idle() <- rest_init() <- start_kernel()
Maybe somebody has an idea?

Thanks,

Erich

---
Erich Focht                                    <efocht@ess.nec.de>
NEC European Supercomputer Systems, European HPC Technology Center


On Fri, 11 Jan 2002, Nick Pollitt wrote:

> I'm trying to get Ingo's scheduler working on IA64 but I've hit a 
> dead-end with the head.S code.  Ingo's patch removes init_tasks,
> so I've modified the assembly in head.S to point at 
> runqueues(cpu)->idle, I think - it dies very early in the boot, 
> and I'm not familiar with ia64 assembly.
> 
> Other issues, I had to build offsets.h by hand, and I moved some
> stuff from sched.c to sched.h.  Other than that, it's H6 + ia64.
> 
> Anyone have any feedback on getting this booting?
> 
> Thanks
> Nick
> 
> 
> On Fri, Jan 11, 2002 at 06:49:28PM +0100, Ingo Molnar wrote:
> > 
> > the -H6 patch is available:
> > 
> >     http://redhat.com/~mingo/O(1)-scheduler/sched-O1-2.5.2-pre11-H6.patch
> >     http://redhat.com/~mingo/O(1)-scheduler/sched-O1-2.4.17-H6.patch
> > 
> 
> -- 
> Nick Pollitt                                   phone: 650.933.7406
> Scalable Linux Project                           fax: 650.932.0317
> Silicon Graphics, Inc.                       npollitt@engr.sgi.com
> 




[-- Attachment #2: Type: TEXT/PLAIN, Size: 8047 bytes --]

diff -urN 2.4.17-O1/arch/ia64/kernel/process.c 2.4.17-O1-H7/arch/ia64/kernel/process.c
--- 2.4.17-O1/arch/ia64/kernel/process.c	Mon Jan  7 11:35:08 2002
+++ 2.4.17-O1-H7/arch/ia64/kernel/process.c	Mon Jan 14 17:48:18 2002
@@ -125,9 +125,6 @@
 cpu_idle (void *unused)
 {
 	/* endless idle loop with no priority at all */
-	init_idle();
-	current->nice = 20;
-	current->counter = -100;
 
 
 	while (1) {
@@ -136,11 +133,10 @@
 			min_xtp();
 #endif
 
-		while (!current->need_resched) {
+		if (!current->need_resched) {
 #ifdef CONFIG_IA64_SGI_SN
 			snidle();
 #endif
-			continue;
 		}
 
 #ifdef CONFIG_IA64_SGI_SN
diff -urN 2.4.17-O1/arch/ia64/kernel/setup.c 2.4.17-O1-H7/arch/ia64/kernel/setup.c
--- 2.4.17-O1/arch/ia64/kernel/setup.c	Mon Jan  7 11:35:08 2002
+++ 2.4.17-O1-H7/arch/ia64/kernel/setup.c	Mon Jan 14 16:12:16 2002
@@ -375,10 +375,10 @@
 {
 #ifdef CONFIG_SMP
 #	define lpj	c->loops_per_jiffy
-#	define cpu	c->processor
+#	define cpum	c->processor
 #else
 #	define lpj	loops_per_jiffy
-#	define cpu	0
+#	define cpum	0
 #endif
 	char family[32], features[128], *cp;
 	struct cpuinfo_ia64 *c = v;
@@ -417,7 +417,7 @@
 		   "cpu MHz    : %lu.%06lu\n"
 		   "itc MHz    : %lu.%06lu\n"
 		   "BogoMIPS   : %lu.%02lu\n\n",
-		   cpu, c->vendor, family, c->model, c->revision, c->archrev,
+		   cpum, c->vendor, family, c->model, c->revision, c->archrev,
 		   features, c->ppn, c->number,
 		   c->proc_freq / 1000000, c->proc_freq % 1000000,
 		   c->itc_freq / 1000000, c->itc_freq % 1000000,
diff -urN 2.4.17-O1/arch/ia64/kernel/smp.c 2.4.17-O1-H7/arch/ia64/kernel/smp.c
--- 2.4.17-O1/arch/ia64/kernel/smp.c	Fri Dec 21 18:41:53 2001
+++ 2.4.17-O1-H7/arch/ia64/kernel/smp.c	Mon Jan 14 10:59:33 2002
@@ -186,6 +186,12 @@
 }
 
 void
+smp_send_reschedule_all(void)
+{
+	send_IPI_all(IA64_IPI_RESCHEDULE);
+}
+
+void
 smp_flush_tlb_all (void)
 {
 	smp_call_function ((void (*)(void *))__flush_tlb_all,0,1,1);
diff -urN 2.4.17-O1/arch/ia64/kernel/smpboot.c 2.4.17-O1-H7/arch/ia64/kernel/smpboot.c
--- 2.4.17-O1/arch/ia64/kernel/smpboot.c	Mon Jan  7 11:35:08 2002
+++ 2.4.17-O1-H7/arch/ia64/kernel/smpboot.c	Mon Jan 14 18:25:44 2002
@@ -23,6 +23,7 @@
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/spinlock.h>
+#include <linux/sched.h>
 
 #include <asm/atomic.h>
 #include <asm/bitops.h>
@@ -323,7 +324,7 @@
 	extern void perfmon_init_percpu(void);
 #endif
 
-	cpuid = smp_processor_id();
+	cpuid = cpu();
 	phys_id = hard_smp_processor_id();
 
 	if (test_and_set_bit(cpuid, &cpu_online_map)) {
@@ -380,6 +381,7 @@
 	while (!atomic_read(&smp_commenced))
 		;
 
+	init_idle();
 	Dprintk("CPU %d is starting idle.\n", smp_processor_id());
 	return cpu_idle();
 }
@@ -416,11 +418,10 @@
 	if (!idle)
 		panic("No idle process for CPU %d", cpu);
 
-	task_set_cpu(idle, cpu);	/* we schedule the first task manually */
+	idle->cpu = cpu;
 
 	ia64_cpu_to_sapicid[cpu] = sapicid;
 
-	del_from_runqueue(idle);
 	unhash_process(idle);
 	init_tasks[cpu] = idle;
 
@@ -481,8 +482,7 @@
 	printk("Boot processor id 0x%x/0x%x\n", 0, boot_cpu_id);
 
 	global_irq_holder = 0;
-	current->processor = 0;
-	init_idle();
+	current->cpu = 0;
 
 	/*
 	 * If SMP should be disabled, then really disable it!
diff -urN 2.4.17-O1/arch/ia64/mm/fault.c 2.4.17-O1-H7/arch/ia64/mm/fault.c
--- 2.4.17-O1/arch/ia64/mm/fault.c	Fri Nov  9 23:26:17 2001
+++ 2.4.17-O1-H7/arch/ia64/mm/fault.c	Mon Jan 14 10:59:33 2002
@@ -194,8 +194,7 @@
   out_of_memory:
 	up_read(&mm->mmap_sem);
 	if (current->pid == 1) {
-		current->policy |= SCHED_YIELD;
-		schedule();
+		yield();
 		down_read(&mm->mmap_sem);
 		goto survive;
 	}
diff -urN 2.4.17-O1/arch/ia64/tools/print_offsets.c 2.4.17-O1-H7/arch/ia64/tools/print_offsets.c
--- 2.4.17-O1/arch/ia64/tools/print_offsets.c	Fri Nov  9 23:26:17 2001
+++ 2.4.17-O1-H7/arch/ia64/tools/print_offsets.c	Mon Jan 14 16:36:54 2002
@@ -54,7 +54,7 @@
     { "IA64_TASK_PTRACE_OFFSET",	offsetof (struct task_struct, ptrace) },
     { "IA64_TASK_SIGPENDING_OFFSET",	offsetof (struct task_struct, sigpending) },
     { "IA64_TASK_NEED_RESCHED_OFFSET",	offsetof (struct task_struct, need_resched) },
-    { "IA64_TASK_PROCESSOR_OFFSET",	offsetof (struct task_struct, processor) },
+    { "IA64_TASK_PROCESSOR_OFFSET",	offsetof (struct task_struct, cpu) },
     { "IA64_TASK_THREAD_OFFSET",	offsetof (struct task_struct, thread) },
     { "IA64_TASK_THREAD_KSP_OFFSET",	offsetof (struct task_struct, thread.ksp) },
 #ifdef CONFIG_PERFMON
diff -urN 2.4.17-O1/include/asm-ia64/bitops.h 2.4.17-O1-H7/include/asm-ia64/bitops.h
--- 2.4.17-O1/include/asm-ia64/bitops.h	Fri Jan 11 17:20:42 2002
+++ 2.4.17-O1-H7/include/asm-ia64/bitops.h	Mon Jan 14 11:15:17 2002
@@ -368,6 +368,7 @@
 
 #ifdef __KERNEL__
 
+#define __clear_bit(nr, addr)        clear_bit(nr, addr)
 #define ext2_set_bit                 test_and_set_bit
 #define ext2_clear_bit               test_and_clear_bit
 #define ext2_test_bit                test_bit
diff -urN 2.4.17-O1/include/asm-ia64/mmu_context.h 2.4.17-O1-H7/include/asm-ia64/mmu_context.h
--- 2.4.17-O1/include/asm-ia64/mmu_context.h	Fri Jan 11 17:23:51 2002
+++ 2.4.17-O1-H7/include/asm-ia64/mmu_context.h	Mon Jan 14 17:01:46 2002
@@ -118,6 +118,7 @@
 	reload_context(next);
 }
 
+#define sched_find_first_zero_bit(bitmap)      ffz(bitmap)
 #define switch_mm(prev_mm,next_mm,next_task,cpu)	activate_mm(prev_mm, next_mm)
 
 # endif /* ! __ASSEMBLY__ */
diff -urN 2.4.17-O1/include/asm-ia64/smp.h 2.4.17-O1-H7/include/asm-ia64/smp.h
--- 2.4.17-O1/include/asm-ia64/smp.h	Fri Jan 11 17:20:42 2002
+++ 2.4.17-O1-H7/include/asm-ia64/smp.h	Mon Jan 14 11:15:17 2002
@@ -27,7 +27,7 @@
 #define SMP_IRQ_REDIRECTION	(1 << 0)
 #define SMP_IPI_REDIRECTION	(1 << 1)
 
-#define smp_processor_id()	(current->processor)
+#define smp_processor_id()	(current->cpu)
 
 extern struct smp_boot_data {
 	int cpu_count;
@@ -110,12 +110,6 @@
 
 #define NO_PROC_ID		0xffffffff	/* no processor magic marker */
 
-/*
- * Extra overhead to move a task from one cpu to another (due to TLB and cache misses).
- * Expressed in "negative nice value" units (larger number means higher priority/penalty).
- */
-#define PROC_CHANGE_PENALTY	20
-
 extern void __init init_smp_config (void);
 extern void smp_do_timer (struct pt_regs *regs);
 
diff -urN 2.4.17-O1/kernel/printk.c 2.4.17-O1-H7/kernel/printk.c
--- 2.4.17-O1/kernel/printk.c	Mon Jan 14 16:33:04 2002
+++ 2.4.17-O1-H7/kernel/printk.c	Mon Jan 14 10:11:07 2002
@@ -25,6 +25,8 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>			/* For in_interrupt() */
+#include <linux/config.h>
+#include <linux/delay.h>
 
 #include <asm/uaccess.h>
 
diff -urN 2.4.17-O1/kernel/sched.c 2.4.17-O1-H7/kernel/sched.c
--- 2.4.17-O1/kernel/sched.c	Mon Jan 14 16:33:04 2002
+++ 2.4.17-O1-H7/kernel/sched.c	Mon Jan 14 17:00:55 2002
@@ -75,6 +75,8 @@
 #define unlock_task_rq(rq,p,flags)				\
 	spin_unlock_irqrestore(&rq->lock, flags)
 
+struct task_struct * init_tasks[NR_CPUS] = {&init_task, };
+
 /*
  * Adding/removing a task to/from a priority array:
  */
diff -urN 2.4.17-O1/kernel/timer.c 2.4.17-O1-H7/kernel/timer.c
--- 2.4.17-O1/kernel/timer.c	Mon Jan 14 16:33:04 2002
+++ 2.4.17-O1-H7/kernel/timer.c	Mon Jan 14 10:07:43 2002
@@ -585,17 +585,16 @@
 
 	update_one_process(p, user_tick, system, cpu);
 	if (p->pid) {
-		if (--p->counter <= 0) {
-			p->counter = 0;
-			p->need_resched = 1;
-		}
-		if (p->nice > 0)
+		if (p->__nice > 0)
 			kstat.per_cpu_nice[cpu] += user_tick;
 		else
 			kstat.per_cpu_user[cpu] += user_tick;
 		kstat.per_cpu_system[cpu] += system;
-	} else if (really_local_bh_count() || really_local_irq_count() > 1)
-		kstat.per_cpu_system[cpu] += system;
+	} else {
+		if (really_local_bh_count() || really_local_irq_count() > 1)
+			kstat.per_cpu_system[cpu] += system;
+	}
+	scheduler_tick(p);
 }
 
 /*

  parent reply	other threads:[~2002-01-14 18:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-12  2:23 [Linux-ia64] Help with Ingo scheduler on IA64 Nick Pollitt
2002-01-12  3:13 ` David Mosberger
2002-01-14 18:23 ` Erich Focht [this message]
2002-01-15  1:07 ` Nick Pollitt
2002-01-15  9:28 ` Erich Focht
2002-01-15 17:53 ` Erich Focht
2002-01-15 17:58 ` Erich Focht
2002-01-15 18:59 ` Erich Focht
2002-01-15 19:52 ` Ingo Molnar
2002-01-15 19:57 ` Ingo Molnar
2002-01-15 20:12 ` Ingo Molnar
2002-01-16  5:30 ` Nick Pollitt
2002-01-16 21:04 ` Erich Focht
2002-01-17  1:42 ` David Mosberger
2002-01-17  5:39 ` Nick Pollitt
2002-01-17  8:06 ` David Mosberger
2002-01-17  9:43 ` Ingo Molnar
2002-01-17  9:45 ` Ingo Molnar
2002-01-17 18:25 ` Erich Focht
2002-01-17 21:17 ` Ingo Molnar
2002-01-19 17:17 ` Erich Focht
2002-01-19 20:10 ` David Mosberger
2002-01-21 16:23 ` Erich Focht
2002-01-21 18:24 ` Erich Focht
2002-01-21 18:45 ` Erich Focht
2002-01-21 20:10 ` David Mosberger
2002-01-21 20:23 ` David Mosberger
2002-01-21 20:32 ` Ingo Molnar
2002-01-21 20:41 ` David Mosberger
2002-01-21 21:11 ` Ingo Molnar
2002-01-21 22:11 ` Ingo Molnar
2002-01-21 22:27 ` Ingo Molnar
2002-01-21 22:30 ` Ingo Molnar
2002-01-21 22:41 ` 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=marc-linux-ia64-105590698805819@msgid-missing \
    --to=focht@ess.nec.de \
    --cc=linux-ia64@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox