Skip to contentSkip to conversation

Alpha update for 2.5.3

DISCUSSION Richard Henderson 5 participants 6 messages Feb 8, 2002 1 message not in the archive

Subsystems (5)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

I guess I should have posted my incomplete patches instead of making you duplicate effort.

Quoted 5 lines · Ivan Kokshaysky

- new block layer
minor changes here - new BIO_VMERGE_BOUNDARY macro, which hints to BIO that we're able to merge segments on the page boundary;
max_pfn = max_low_pfn indicates that we don't need bounce buffers;

This isn't complete. I suspect either (1) I'm missing something fundamental or (2) this code is. It appears to make fundamental assumptions about "isa" and "low memory" that are not necessarily correct on non-peecees.

In addition to your bits, I needed to hack ll_rw_blk in order to boot from an aic7xxx.

Quoted 2 lines

- new scheduler
[as usual, untested on SMP - anybody willing to give it a try? Peter?]

The following does *not* work on SMP. CPU1 segfaults because context_switch is called with next=NULL. I've not yet figured out what I'm missing in the smp setup. Ingo, is there anything obvious?

Quoted 1 line

new smp_migrate_task IPI; more or less obvious compile fixes.

Given the nature of the ipi, I prefer to streamline this particular cross-call like so.

Quoted 4 lines

- syscall "optimization"
several fields of task_struct have been squeezed to bytes, so this required byte xchg' - fortunately my old patch for 8 and 16 bit atomic xchg' came in handy. :-)

Nope. The xchg thing no longer works. Look at the x86 code.

Your xchg hack is still cool, and should go in, but it is not needed here.

r~

arch/alpha/Makefile +3 -1
diff -ruNp linux/arch/alpha/Makefile 2.5.3/arch/alpha/Makefile
@@ -117,11 +117,13 @@ srmboot:
 archclean:
 	@$(MAKE) -C arch/alpha/kernel clean
 	@$(MAKEBOOT) clean
-	rm -f arch/alpha/vmlinux.lds
 
 archmrproper:
+	rm -f arch/alpha/vmlinux.lds
+	rm -f include/asm-alpha/asm_offsets.h
 
 archdep:
+	$(MAKE) -C arch/alpha/kernel asm_offsets
 	@$(MAKEBOOT) dep
 
 vmlinux: arch/alpha/vmlinux.lds
arch/alpha/kernel/Makefile +11 -7
diff -ruNp linux/arch/alpha/kernel/Makefile 2.5.3/arch/alpha/kernel/Makefile
@@ -8,9 +8,9 @@
 # Note 2! The CFLAGS definitions are now in the main makefile...
 
 .S.s:
-	$(CPP) $(AFLAGS) -o $*.s $<
+	$(CPP) $(CFLAGS) $(AFLAGS) -o $*.s $<
 .S.o:
-	$(CC) $(AFLAGS) -c -o $*.o $<
+	$(CC) $(CFLAGS) $(AFLAGS) -c -o $*.o $<
 
 O_TARGET := kernel.o
 
@@ -102,11 +102,15 @@ endif # GENERIC
 
 all: kernel.o head.o
 
-asm_offsets: check_asm
-	./check_asm > $(TOPDIR)/include/asm-alpha/asm_offsets.h
-
-check_asm: check_asm.c
-	$(HOSTCC) -o $@ $< $(CPPFLAGS) -ffixed-8
+ASM_OFFSETS_H = $(TOPDIR)/include/asm-alpha/asm_offsets.h
+asm_offsets:
+	$(CC) $(CFLAGS) -S -o - check_asm.c | \
+	sed -e '/xyzzy/ { s/xyzzy //; p; }; d;' > asm_offsets.tmp
+	@if cmp -s asm_offsets.tmp $(ASM_OFFSETS_H); then \
+	  set -x; rm asm_offsets.tmp; \
+	else \
+	  set -x; mv asm_offsets.tmp $(ASM_OFFSETS_H); \
+	fi
 
 clean::
 	rm -f check_asm
arch/alpha/kernel/check_asm.c +30 -22

60 lines not on this page · raw message

arch/alpha/kernel/entry.S +46 -66

160 lines not on this page · raw message

arch/alpha/kernel/process.c +3 -7
diff -ruNp linux/arch/alpha/kernel/process.c 2.5.3/arch/alpha/kernel/process.c
@@ -30,6 +30,7 @@
 #include <linux/reboot.h>
 #include <linux/tty.h>
 #include <linux/console.h>
+#include <linux/init_task.h>
 
 #include <asm/reg.h>
 #include <asm/uaccess.h>
@@ -74,17 +75,12 @@ void
 cpu_idle(void)
 {
 	/* An endless idle loop with no priority at all.  */
-	current->nice = 20;
-
 	while (1) {
 		/* FIXME -- EV6 and LCA45 know how to power down
 		   the CPU.  */
 
-		/* Although we are an idle CPU, we do not want to 
-		   get into the scheduler unnecessarily.  */
-		long oldval = xchg(&current->work.need_resched, -1UL);
-		if (!oldval)
-			while (current->work.need_resched < 0);
+		while (! need_resched())
+			barrier();
 		schedule();
 		check_pgt_cache();
 	}
arch/alpha/kernel/ptrace.c +17 -7
diff -ruNp linux/arch/alpha/kernel/ptrace.c 2.5.3/arch/alpha/kernel/ptrace.c
@@ -334,10 +334,17 @@ sys_ptrace(long request, long pid, long 
 		ret = -EIO;
 		if ((unsigned long) data > _NSIG)
 			goto out;
-		if (request == PTRACE_SYSCALL)
-			child->ptrace |= PT_TRACESYS;
-		else
-			child->ptrace &= ~PT_TRACESYS;
+		if (request == PTRACE_SYSCALL) {
+			if (!(child->ptrace & PT_SYSCALLTRACE)) {
+				child->ptrace |= PT_SYSCALLTRACE;
+				child->work.syscall_trace++;
+			}
+		} else {
+			if (child->ptrace & PT_SYSCALLTRACE) {
+				child->ptrace &= ~PT_SYSCALLTRACE;
+				child->work.syscall_trace--;
+			}
+		}
 		child->exit_code = data;
 		wake_up_process(child);
 		/* make sure single-step breakpoint is gone. */
@@ -365,7 +372,10 @@ sys_ptrace(long request, long pid, long 
 		if ((unsigned long) data > _NSIG)
 			goto out;
 		child->thread.bpt_nsaved = -1;	/* mark single-stepping */
-		child->ptrace &= ~PT_TRACESYS;
+		if (child->ptrace & PT_SYSCALLTRACE) {
+			child->ptrace &= ~PT_SYSCALLTRACE;
+			child->work.syscall_trace--;
+		}
 		wake_up_process(child);
 		child->exit_code = data;
 		/* give it a chance to run. */
@@ -390,8 +400,8 @@ sys_ptrace(long request, long pid, long 
 asmlinkage void
 syscall_trace(void)
 {
-	if ((current->ptrace & (PT_PTRACED|PT_TRACESYS))
-	    != (PT_PTRACED|PT_TRACESYS))
+	if ((current->ptrace & (PT_PTRACED|PT_SYSCALLTRACE))
+	    != (PT_PTRACED|PT_SYSCALLTRACE))
 		return;
 	current->exit_code = SIGTRAP;
 	current->state = TASK_STOPPED;
arch/alpha/kernel/setup.c +3 -3
diff -ruNp linux/arch/alpha/kernel/setup.c 2.5.3/arch/alpha/kernel/setup.c
@@ -68,7 +68,7 @@ int boot_cpuid;
  * Using SRM callbacks for initial console output. This works from
  * setup_arch() time through the end of time_init(), as those places
  * are under our (Alpha) control.
-
+ *
  * "srmcons" specified in the boot command arguments allows us to
  * see kernel messages during the period of time before the true
  * console device is "registered" during console_init(). As of this
@@ -436,8 +436,8 @@ static void srm_console_write(struct con
 
 static kdev_t srm_console_device(struct console *c)
 {
-  /* Huh? */
-        return MKDEV(TTY_MAJOR, 64 + c->index);
+	/* Huh? */
+        return mk_kdev(TTY_MAJOR, 64 + c->index);
 }
 
 static int __init srm_console_setup(struct console *co, char *options)
arch/alpha/kernel/smp.c +129 -135

467 lines not on this page · raw message

arch/alpha/mm/fault.c +1 -2
diff -ruNp linux/arch/alpha/mm/fault.c 2.5.3/arch/alpha/mm/fault.c
@@ -196,8 +196,7 @@ no_context:
  */
 out_of_memory:
 	if (current->pid == 1) {
-		current->policy |= SCHED_YIELD;
-		schedule();
+		yield();
 		down_read(&mm->mmap_sem);
 		goto survive;
 	}
arch/alpha/vmlinux.lds.in +3 -1
diff -ruNp linux/arch/alpha/vmlinux.lds.in 2.5.3/arch/alpha/vmlinux.lds.in
@@ -32,6 +32,8 @@ SECTIONS
   . = ALIGN(8192);
   __init_begin = .;
   .text.init : { *(.text.init) }
+  /* Don't discard .text.exit yet -- too many problems remaining.  */
+  .text.exit : { *(.text.exit) }
   .data.init : { *(.data.init) }
 
   . = ALIGN(16);
@@ -100,5 +102,5 @@ SECTIONS
   .debug_typenames 0 : { *(.debug_typenames) }
   .debug_varnames  0 : { *(.debug_varnames) }
 
-  /DISCARD/ : { *(.text.exit) *(.data.exit) *(.exitcall.exit) }
+  /DISCARD/ : { *(.data.exit) *(.exitcall.exit) }
 }
drivers/base/core.c +2 -1
diff -ruNp linux/drivers/base/core.c 2.5.3/drivers/base/core.c
@@ -7,7 +7,8 @@
 
 #include <linux/device.h>
 #include <linux/module.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
+#include <linux/init.h>
 
 #undef DEBUG
 
drivers/base/fs.c +1 -1
diff -ruNp linux/drivers/base/fs.c 2.5.3/drivers/base/fs.c
@@ -8,7 +8,7 @@
 #include <linux/device.h>
 #include <linux/module.h>
 #include <linux/string.h>
-#include <linux/malloc.h>
+#include <linux/slab.h>
 
 extern struct driver_file_entry * device_default_files[];
 
drivers/block/ll_rw_blk.c +4 -2
diff -ruNp linux/drivers/block/ll_rw_blk.c 2.5.3/drivers/block/ll_rw_blk.c
@@ -182,12 +182,14 @@ void blk_queue_bounce_limit(request_queu
 	static request_queue_t *last_q;
 
 	/*
-	 * set appropriate bounce gfp mask -- unfortunately we don't have a
+	 * Set appropriate bounce gfp mask -- unfortunately we don't have a
 	 * full 4GB zone, so we have to resort to low memory for any bounces.
 	 * ISA has its own < 16MB zone.
 	 */
 	if (bounce_pfn < blk_max_low_pfn) {
-		BUG_ON(dma_addr < BLK_BOUNCE_ISA);
+		/* Note that some systems have an ISA bridge that frobs
+		   addresses, so there may be no 16MB limit.  */
+		BUG_ON(dma_addr < BLK_BOUNCE_ISA && BLK_BOUNCE_ISA < ~0UL);
 		init_emergency_isa_pool();
 		q->bounce_gfp = GFP_NOIO | GFP_DMA;
 	} else
include/asm-alpha/asm_offsets.h +0 -13
diff -ruNp linux/include/asm-alpha/asm_offsets.h 2.5.3/include/asm-alpha/asm_offsets.h
@@ -1,13 +0,0 @@
-#ifndef __ASM_OFFSETS_H__
-#define __ASM_OFFSETS_H__
-#define TASK_STATE 0
-#define TASK_FLAGS 8
-#define TASK_SIGPENDING 16
-#define TASK_ADDR_LIMIT 24
-#define TASK_EXEC_DOMAIN 32
-#define TASK_NEED_RESCHED 40
-#define TASK_SIZE 1096
-#define STACK_SIZE 16384
-#define HAE_CACHE 0
-#define HAE_REG 8
-#endif /* __ASM_OFFSETS_H__ */
include/asm-alpha/bitops.h +95 -19

165 lines not on this page · raw message

include/asm-alpha/io.h +5 -1
diff -ruNp linux/include/asm-alpha/io.h 2.5.3/include/asm-alpha/io.h
@@ -18,6 +18,7 @@
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <asm/system.h>
+#include <asm/pgtable.h>
 #include <asm/machvec.h>
 
 /*
@@ -60,7 +61,10 @@ static inline void * phys_to_virt(unsign
 	return (void *) (address + IDENT_ADDR);
 }
 
-#define page_to_phys(page)	(((page) - (page)->zone->zone_mem_map) << PAGE_SHIFT)
+#define page_to_phys(page)	PAGE_TO_PA(page)
+
+/* This depends on working iommu.  */
+#define BIO_VMERGE_BOUNDARY	(alpha_mv.mv_pci_tbi ? PAGE_SIZE : 0)
 
 /*
  * Change addresses as seen by the kernel (virtual) to addresses as
include/asm-alpha/mmu_context.h +26 -0
diff -ruNp linux/include/asm-alpha/mmu_context.h 2.5.3/include/asm-alpha/mmu_context.h
@@ -21,6 +21,32 @@
 #include <asm/io.h>
 #endif
 
+/* ??? This does not belong here.  */
+/*
+ * Every architecture must define this function. It's the fastest
+ * way of searching a 168-bit bitmap where the first 128 bits are
+ * unlikely to be set. It's guaranteed that at least one of the 168
+ * bits is set.
+ */
+#if MAX_RT_PRIO != 128 || MAX_PRIO > 192
+# error update this function.
+#endif
+
+static inline int
+sched_find_first_bit(unsigned long *b)
+{
+	unsigned long b0 = b[0], b1 = b[1], b2 = b[2];
+	unsigned long offset = 128;
+
+	if (unlikely(b0 | b1)) {
+		b2 = (b0 ? b0 : b1);
+		offset = (b0 ? 0 : 64);
+	}
+
+	return __ffs(b2) + offset;
+}
+
+
 extern inline unsigned long
 __reload_thread(struct thread_struct *pcb)
 {
include/asm-alpha/smp.h +1 -1
diff -ruNp linux/include/asm-alpha/smp.h 2.5.3/include/asm-alpha/smp.h
@@ -55,7 +55,7 @@ extern int __cpu_logical_map[NR_CPUS];
 #define cpu_logical_map(cpu)  __cpu_logical_map[cpu]
 
 #define hard_smp_processor_id()	__hard_smp_processor_id()
-#define smp_processor_id()	(current->processor)
+#define smp_processor_id()	(current->cpu)
 
 extern unsigned long cpu_present_mask;
 #define cpu_online_map cpu_present_mask
include/asm-alpha/unistd.h +3 -0
diff -ruNp linux/include/asm-alpha/unistd.h 2.5.3/include/asm-alpha/unistd.h
@@ -575,6 +575,9 @@ static inline long sync(void)
 	return sys_sync();
 }
 
+struct rusage;
+extern asmlinkage long sys_wait4(pid_t pid,unsigned int * stat_addr,
+				 int options, struct rusage * ru);
 static inline pid_t waitpid(int pid, int * wait_stat, int flags)
 {
 	return sys_wait4(pid, wait_stat, flags, NULL);
include/linux/dcache.h +2 -0
diff -ruNp linux/include/linux/dcache.h 2.5.3/include/linux/dcache.h
@@ -5,6 +5,8 @@
 
 #include <asm/atomic.h>
 #include <linux/mount.h>
+#include <asm/page.h>           /* BUG */
+
 
 /*
  * linux/include/linux/dcache.h
include/linux/nfs_fs.h +2 -0
diff -ruNp linux/include/linux/nfs_fs.h 2.5.3/include/linux/nfs_fs.h
@@ -22,6 +22,8 @@
 #include <linux/nfs3.h>
 #include <linux/nfs_xdr.h>
 
+#include <asm/page.h>		/* BUG */
+
 /*
  * Enable debugging support for nfs client.
  * Requires RPC_DEBUG.
#2 lore raw
In reply to a message not in the archive

First comment, the below is what Ingo suggested for sched_find_first_zero_bit. Note that this version is -before- the bit array changed from [I believe] 140 to 100 bits.

Second comment, some of the bits in your patch are in 2.5.3-pre3. [but drivers/ide/ide-dma.c does not compile for me, unrelated to alpha...]

Quoted 10 lines

static inline int sched_find_first_zero_bit(unsigned long *b)

{
        unsigned long rt;

        rt = b[0] & b[1];
        if (unlikely(rt != -1UL))
                return find_first_zero_bit(b, MAX_RT_PRIO);

        return ffz(b[2]) + MAX_RT_PRIO;
}
Signature · 3 lines
Jeff Garzik      | "I went through my candy like hot oatmeal
Building 1024    |  through an internally-buttered weasel."
MandrakeSoft     |             - goats.com
#3 lore raw
In reply to a message not in the archive
Quoted 3 lines · Jeff Garzik

Second comment, some of the bits in your patch are in 2.5.3-pre3. [but drivers/ide/ide-dma.c does not compile for me, unrelated to alpha...]

This patch Jens posted seems to fix it.

Signature · 1 line
Skip
drivers/ide/ide-dma.c +4 -2
diff -Nru a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
@@ -266,14 +266,16 @@
 #if 1	
 	if (sector_count > 128) {
 		memset(&sg[nents], 0, sizeof(*sg));
-		sg[nents].address = virt_addr;
+		sg[nents].page = virt_to_page(virt_addr);
+		sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
 		sg[nents].length = 128  * SECTOR_SIZE;
 		nents++;
 		virt_addr = virt_addr + (128 * SECTOR_SIZE);
 		sector_count -= 128;
 	}
 	memset(&sg[nents], 0, sizeof(*sg));
-	sg[nents].address = virt_addr;
+	sg[nents].page = virt_to_page(virt_addr);
+	sg[nents].offset = (unsigned long) virt_addr & ~PAGE_MASK;
 	sg[nents].length =  sector_count  * SECTOR_SIZE;
 	nents++;
  #endif
#4 lore raw

That code path will go away!
That is a diagnostic path only.

Quoted 10 lines · Skip Ford
Quoted 3 lines · Jeff Garzik

Second comment, some of the bits in your patch are in 2.5.3-pre3. [but drivers/ide/ide-dma.c does not compile for me, unrelated to alpha...]

This patch Jens posted seems to fix it.

Signature · 1 line
Skip

Andre Hedrick
Linux Disk Certification Project Linux ATA Development

#5 lore raw
In reply to Skip Ford
Quoted 3 lines · Andre Hedrick

That code path will go away!
That is a diagnostic path only.

Sorry Jeff, and others, if that's the wrong patch. It fixed the compile error for ide-dma so I used it. I still haven't been able to test it due to link errors with bus_to_virt.

So if Andre is saying don't use it, then don't. My apologies.

Signature · 1 line
Skip
#6 lore raw
In reply to Skip Ford
Quoted 8 lines · Skip Ford
Quoted 3 lines · Andre Hedrick

That code path will go away!
That is a diagnostic path only.

Sorry Jeff, and others, if that's the wrong patch. It fixed the compile error for ide-dma so I used it. I still haven't been able to test it due to link errors with bus_to_virt.

The patch is correct, I'm the one to blame for forgetting to push that. And as I stated in my original mail, in the future it will be gone. However, it still needs to compile right now :-)

Quoted 1 line

So if Andre is saying don't use it, then don't. My apologies.

No need to apologise, the patch does the right thing.

Signature · 1 line
Jens Axboe