public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] per-cpu areas
@ 2002-03-05  7:54 Rusty Russell
  2002-03-05 10:51 ` [PATCH] 2.5.6-pre2 IDE cleanup 16 Martin Dalecki
  0 siblings, 1 reply; 43+ messages in thread
From: Rusty Russell @ 2002-03-05  7:54 UTC (permalink / raw)
  To: torvalds; +Cc: linux-kernel

Linus, please apply (retransmit, neatened a little).

Thanks,
Rusty.

diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3/include/linux/smp.h working-2.5.3-percpu/include/linux/smp.h
--- linux-2.5.3/include/linux/smp.h	Fri Feb  1 19:21:37 2002
+++ working-2.5.3-percpu/include/linux/smp.h	Fri Feb  1 19:17:09 2002
@@ -11,6 +11,7 @@
 #ifdef CONFIG_SMP
 
 #include <linux/kernel.h>
+#include <linux/compiler.h>
 #include <asm/smp.h>
 
 /*
@@ -71,7 +72,17 @@
 #define MSG_RESCHEDULE		0x0003	/* Reschedule request from master CPU*/
 #define MSG_CALL_FUNCTION       0x0004  /* Call function on all other CPUs */
 
-#else
+#define __per_cpu_data	__attribute__((section(".data.percpu")))
+
+#ifndef __HAVE_ARCH_PER_CPU
+extern unsigned long __per_cpu_offset[NR_CPUS];
+
+/* var is in discarded region: offset to particular copy we want */
+#define per_cpu(var, cpu) RELOC_HIDE(var, per_cpu_offset(cpu))
+
+#define this_cpu(var) per_cpu(var, smp_processor_id())
+#endif /* !__HAVE_ARCH_PER_CPU */
+#else /* !SMP */
 
 /*
  *	These macros fold the SMP functionality into a single CPU system
@@ -88,6 +99,9 @@
 #define cpu_online_map				1
 static inline void smp_send_reschedule(int cpu) { }
 static inline void smp_send_reschedule_all(void) { }
+#define __per_cpu_data
+#define per_cpu(var, cpu)			var
+#define this_cpu(var)				var
 
 #endif
 #endif
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3/init/main.c working-2.5.3-percpu/init/main.c
--- linux-2.5.3/init/main.c	Thu Jan 31 08:59:17 2002
+++ working-2.5.3-percpu/init/main.c	Fri Feb  1 19:13:52 2002
@@ -272,8 +272,32 @@
 #define smp_init()	do { } while (0)
 #endif
 
+static inline void setup_per_cpu_areas(void)
+{
+}
 #else
 
+#ifndef __HAVE_ARCH_PER_CPU
+unsigned long __per_cpu_offset[NR_CPUS];
+
+static void __init setup_per_cpu_areas(void)
+{
+	unsigned long size, i;
+	char *ptr;
+	/* Created by linker magic */
+	extern char __per_cpu_start[], __per_cpu_end[];
+
+	/* Copy section for each CPU (we discard the original) */
+	size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
+	ptr = alloc_bootmem(size * NR_CPUS);
+
+	for (i = 0; i < NR_CPUS; i++, ptr += size) {
+		__per_cpu_offset[i] = ptr - __per_cpu_start;
+		memcpy(ptr, __per_cpu_start, size);
+	}
+}
+#endif /* !__HAVE_ARCH_PER_CPU */
+
 /* Called by boot processor to activate the rest. */
 static void __init smp_init(void)
 {
@@ -316,6 +340,7 @@
 	lock_kernel();
 	printk(linux_banner);
 	setup_arch(&command_line);
+	setup_per_cpu_areas();
 	printk("Kernel command line: %s\n", saved_command_line);
 	parse_options(command_line);
 	trap_init();
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3/include/linux/compiler.h working-2.5.3-percpu/include/linux/compiler.h
--- linux-2.5.3/include/linux/compiler.h	Wed Sep 19 07:12:45 2001
+++ working-2.5.3-percpu/include/linux/compiler.h	Fri Feb  1 09:46:02 2002
@@ -13,4 +13,11 @@
 #define likely(x)	__builtin_expect((x),1)
 #define unlikely(x)	__builtin_expect((x),0)
 
+/* This macro obfuscates arithmetic on a variable address so that gcc
+   shouldn't recognize the original var, and make assumptions about it */
+	strcpy(s, "xxx"+X) => memcpy(s, "xxx"+X, 4-X) */
+#define RELOC_HIDE(var, off)						\
+  ({ __typeof__(&(var)) __ptr;					\
+    __asm__ ("" : "=g"(__ptr) : "0"((void *)&(var) + (off)));	\
+    *__ptr; })
 #endif /* __LINUX_COMPILER_H */
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3/include/linux/cache.h working-2.5.3-percpu/include/linux/cache.h
--- linux-2.5.3/include/linux/cache.h	Fri Feb  1 19:21:37 2002
+++ working-2.5.3-percpu/include/linux/cache.h	Fri Feb  1 19:17:09 2002
@@ -4,8 +4,10 @@
 #include <linux/config.h>
 #include <asm/cache.h>
 
+#define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
+
 #ifndef L1_CACHE_ALIGN
-#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
+#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
 #endif
 
 #ifndef SMP_CACHE_BYTES
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3/arch/i386/vmlinux.lds working-2.5.3-percpu/arch/i386/vmlinux.lds
--- linux-2.5.3/arch/i386/vmlinux.lds	Thu Jan 31 08:58:52 2002
+++ working-2.5.3-percpu/arch/i386/vmlinux.lds	Fri Feb  1 09:11:18 2002
@@ -58,6 +58,10 @@
 	*(.initcall7.init)
   }
   __initcall_end = .;
+  . = ALIGN(32);
+  __per_cpu_start = .;
+  .data.percpu  : { *(.data.percpu) }
+  __per_cpu_end = .;
   . = ALIGN(4096);
   __init_end = .;
 
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3/arch/ppc/vmlinux.lds working-2.5.3-percpu/arch/ppc/vmlinux.lds
--- linux-2.5.3/arch/ppc/vmlinux.lds	Thu Jan 31 08:58:55 2002
+++ working-2.5.3-percpu/arch/ppc/vmlinux.lds	Fri Feb  1 09:11:18 2002
@@ -104,6 +104,10 @@
 	*(.initcall7.init)
   }
   __initcall_end = .;
+  . = ALIGN(32);
+  __per_cpu_start = .;
+  .data.percpu  : { *(.data.percpu) }
+  __per_cpu_end = .;
   . = ALIGN(4096);
   __init_end = .;
 

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 43+ messages in thread
* [PATCH] 2.5.6-pre2 IDE cleanup 16
@ 2002-03-06 13:46 Ronnie Sahlberg
  0 siblings, 0 replies; 43+ messages in thread
From: Ronnie Sahlberg @ 2002-03-06 13:46 UTC (permalink / raw)
  To: linux-kernel

>MD> 2. It convinced me that the current task-file interface in linux
>MD> is inadequate. So Alan please bear with me if your CF format
>MD> microdrive will have to not wakeup properly for some time...
>MD> The current mess will just have to go before something more
>MD> adequate can go in.
>
>Why not keep the existing taskfile implementation in until you complete the
>elegant implementation?

seriously, ide has always been a joke for anyone serious in storage capacity
or robustness. so what.

if you were serious in using ide drives you would have been using external
patches for quite a while anyway. nothings changed.
Well, nothing, except that now, that there will be a much higher percentage
of users that relies on external patches for ide to be useful
or work at all

time for someone actually has a clue on how modern ide drives works to have
a say for a change...?



^ permalink raw reply	[flat|nested] 43+ messages in thread
* [PATCH] 2.5.6-pre2 IDE cleanup 16
@ 2002-03-13 15:55 Rick A. Hohensee
  0 siblings, 0 replies; 43+ messages in thread
From: Rick A. Hohensee @ 2002-03-13 15:55 UTC (permalink / raw)
  To: linux-kernel

In the credit where due department...

New note in osimplay....

                              [ Wrote 5164 lines ]

:; cLIeNUX /dev/tty3  11:14:52   /Ha3sm/colorgOS/tool
:;. osimplay
x86
libo
:; cLIeNUX /dev/tty3  11:14:55   /Ha3sm/colorgOS/tool
:;clump h


 clump creates a set of related offset names.  This sort of thing is
popular for associating arbitrary data items into groups. The data
associations can themseves be useful information. Data items in a clump
are defined by thier spacing, and thus have implied sizes.

        clump clumptypename item0 <size> item1 <size> ...

will make $clumptypename_item0 $clumptypename_item1 and so on be the
appropriate offsets from $clumptypename in the assembler state.
$clumptypename itself has a value of zero. A clumptypename_size is also
created that records the overall size of this type of clump. Sizes are in
bytes. Those offset values can then be used during assembly to instantiate
and perhaps initialize clumps of that type, or as address offsets at
runtime, including offsets on the return stack. For fancy initializations,
keep in mind that in this implementation of osimplay you have the full
power of the shell available for extending osimplay, and that if you need
to you can rewind the osimplay assembly pointer, H.

Linus Torvalds said he'd love to have C structs that could initialize the
values of particular fields (I think that's what he meant :o). As is often
the case versus C, osimplay doesn't provide that, but as is always the
case, osimplay doesn't prevent it either.


:; cLIeNUX /dev/tty3  11:14:57   /Ha3sm/colorgOS/tool
:;


Rick Hohensee


^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2002-03-13 15:56 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-03-05  7:54 [PATCH] per-cpu areas Rusty Russell
2002-03-05 10:51 ` [PATCH] 2.5.6-pre2 IDE cleanup 16 Martin Dalecki
2002-03-05 11:07   ` Zwane Mwaikambo
2002-03-05 11:28     ` Jens Axboe
2002-03-05 11:54       ` Martin Dalecki
2002-03-05 12:04         ` Jens Axboe
2002-03-05 12:09           ` Martin Dalecki
2002-03-06  0:33         ` Alan Cox
2002-03-06  9:51           ` Martin Dalecki
2002-03-05 11:48     ` Martin Dalecki
2002-03-06  0:34       ` Alan Cox
2002-03-05 12:36     ` Anton Altaparmakov
2002-03-05 12:36       ` Martin Dalecki
2002-03-05 12:35         ` Zwane Mwaikambo
2002-03-06  0:28         ` Alan Cox
2002-03-05 12:47       ` Anton Altaparmakov
2002-03-05 12:52         ` Martin Dalecki
2002-03-06  1:40           ` Alan Cox
2002-03-06  8:56             ` Zwane Mwaikambo
2002-03-06  9:43             ` Martin Dalecki
2002-03-06  0:27       ` Alan Cox
2002-03-06 10:15         ` Martin Dalecki
2002-03-05 11:37   ` Arjan van de Ven
2002-03-05 11:51     ` Martin Dalecki
2002-03-05 21:19     ` Vojtech Pavlik
2002-03-05 21:42       ` Jeff Garzik
2002-03-05 21:46         ` Vojtech Pavlik
2002-03-06  9:19           ` Martin Dalecki
2002-03-06  1:08       ` Alan Cox
2002-03-06  9:45         ` Martin Dalecki
2002-03-06  0:41   ` Alan Cox
2002-03-06  9:15     ` benh
2002-03-06 11:07       ` Martin Dalecki
2002-03-06 11:12         ` Zwane Mwaikambo
2002-03-06 11:59           ` Martin Dalecki
2002-03-06 12:02         ` Meelis Roos
2002-03-06 12:11           ` Martin Dalecki
2002-03-06 16:01         ` Bill Davidsen
2002-03-06 20:36           ` Linus Torvalds
2002-03-06 17:00         ` benh
2002-03-06  9:49     ` Martin Dalecki
  -- strict thread matches above, loose matches on Subject: below --
2002-03-06 13:46 Ronnie Sahlberg
2002-03-13 15:55 Rick A. Hohensee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox