Skip to contentSkip to conversation

cpu-2.5.69-bk14-1

DISCUSSION William Lee Irwin III 4 participants 7 messages May 20, 2003 – May 25, 2003

lore
Share & tools
lore
#0 lore raw

Extended cpumasks for larger systems. Now featuring bigsmp, Summit, and Voyager updates in addition to PC-compatible, NUMA-Q, and SN2 bits from SGI.

Several minor bugfixes with improper checks of bits and some new API pieces: cpumask_of_cpu() and cpus_promote() for replacing 1 << cpu and promoting "narrow" cpumasks (i.e. unsigned long) to full-width, respectively.

Successfully runs on 32x NUMA-Q. Successfully compiletested on Voyager, Summit, bigsmp, and flat logical SMP, all with typechecking. UP also successfully compiletested with and without local APIC and IO-APIC. Hopefully I can get my hands on another NUMA-Q quad or two soon.

vs. 2.5.69-bk14. The patch (too large to post) can be found at ftp://ftp.kernel.org/pub/linux/kernel/people/wli/cpu/cpu-2.5.69-bk14-1.bz2

I'd be much obliged if (sub)arch maintainers could comment.

Tomita, I didn't have a way of building PC98; if you are negatively affected somehow I'm interested in hearing of how to fix things up or any other special handling PC98 might need here.

David & Martin, I'm not 100% sure wrt. what's going on with the IA64 pieces of the puzzle. The more I find out about what you want, the better.

Thanks.

-- wli

#1 lore raw
Quoted 3 lines · William Lee Irwin III

Extended cpumasks for larger systems. Now featuring bigsmp, Summit, and Voyager updates in addition to PC-compatible, NUMA-Q, and SN2 bits from SGI.

Here's the PPC32 UP bits. I'll look into SMP once it starts to actually compile again.

arch/ppc/kernel/irq.c +49 -22
@@ -44,6 +44,7 @@
 #include <linux/proc_fs.h>
 #include <linux/random.h>
 #include <linux/seq_file.h>
+#include <linux/cpumask.h>
 
 #include <asm/uaccess.h>
 #include <asm/bitops.h>
@@ -567,24 +568,35 @@
 #define DEFAULT_CPU_AFFINITY 0x00000001
 #endif
 
-unsigned int irq_affinity [NR_IRQS] =
-	{ [0 ... NR_IRQS-1] = DEFAULT_CPU_AFFINITY };
+#define HEX_DIGITS (2*sizeof(cpumask_t))
 
-#define HEX_DIGITS 8
+cpumask_t irq_affinity[NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
 
-static int irq_affinity_read_proc (char *page, char **start, off_t off,
+static int irq_affinity_read_proc(char *page, char **start, off_t off,
 			int count, int *eof, void *data)
 {
+	cpumask_t tmp = irq_affinity[(long)data];
+	int k, len = 0;
+
 	if (count < HEX_DIGITS+1)
 		return -EINVAL;
-	return sprintf (page, "%08x\n", irq_affinity[(int)data]);
+
+	for (k = 0; k < sizeof(cpumask_t)/sizeof(unsigned long); ++k) {
+		int j = sprintf(page, "%04hx", (u16)cpus_coerce(tmp));
+		len += j;
+		page += j;
+		cpus_shift_right(tmp, tmp, 16);
+	}
+	
+	len += sprintf(page, "\n");
+	return len;
 }
 
-static unsigned int parse_hex_value (const char *buffer,
+static unsigned int parse_hex_value(const char *buffer,
 		unsigned long count, unsigned long *ret)
 {
-	unsigned char hexnum [HEX_DIGITS];
-	unsigned long value;
+	unsigned char hexnum[HEX_DIGITS];
+	cpumask_t value = CPU_MASK_NONE;
 	int i;
 
 	if (!count)
@@ -598,10 +610,9 @@
 	 * Parse the first 8 characters as a hex string, any non-hex char
 	 * is end-of-string. '00e1', 'e1', '00E1', 'E1' are all the same.
 	 */
-	value = 0;
-
 	for (i = 0; i < count; i++) {
 		unsigned int c = hexnum[i];
+		int k;
 
 		switch (c) {
 			case '0' ... '9': c -= '0'; break;
@@ -610,18 +621,21 @@
 		default:
 			goto out;
 		}
-		value = (value << 4) | c;
+		cpus_shift_left(value, value, 4);
+		for (k = 0; k < 4; ++k)
+			if (test_bit(k, (unsigned long *)&c))
+				cpu_set(k, value);
 	}
 out:
 	*ret = value;
 	return 0;
 }
 
-static int irq_affinity_write_proc (struct file *file, const char *buffer,
+static int irq_affinity_write_proc(struct file *file, const char *buffer,
 					unsigned long count, void *data)
 {
-	int irq = (int) data, full_count = count, err;
-	unsigned long new_value;
+	int irq = (long)data, full_count = count, err;
+	cpumask_t new_value, tmp;
 
 	if (!irq_desc[irq].handler->set_affinity)
 		return -EIO;
@@ -638,29 +652,42 @@
 	 * are actually logical cpu #'s then we have no problem.
 	 *  -- Cort <[email protected]>
 	 */
-	if (!(new_value & cpu_online_map))
+	cpus_and(tmp, new_value, cpu_online_map);
+	if (cpus_empty(tmp))
 		return -EINVAL;
 
 	irq_affinity[irq] = new_value;
-	irq_desc[irq].handler->set_affinity(irq, new_value);
-
+	irq_desc[irq].handler->set_affinity(irq,
+			cpumask_of_cpu(first_cpu(new_value)));
 	return full_count;
 }
 
-static int prof_cpu_mask_read_proc (char *page, char **start, off_t off,
+static int prof_cpu_mask_read_proc(char *page, char **start, off_t off,
 			int count, int *eof, void *data)
 {
-	unsigned long *mask = (unsigned long *) data;
+	cpumask_t *tmp = (cpumask_t *)data;
+	int k, len = 0;
+	
 	if (count < HEX_DIGITS+1)
 		return -EINVAL;
-	return sprintf (page, "%08lx\n", *mask);
+
+	for (k = 0; k < sizeof(cpumask_t)/sizeof(unsigned long); ++k) {
+		int j = sprintf(page, "%04hx", (u16)cpus_coerce(*tmp));
+		len += j;
+		page += j;
+		cpus_shift_right(*tmp, *tmp, 16);
+	}
+
+	len += sprintf(page, "\n");
+	return len;
 }
 
 static int prof_cpu_mask_write_proc (struct file *file, const char *buffer,
 					unsigned long count, void *data)
 {
-	unsigned long *mask = (unsigned long *) data, full_count = count, err;
-	unsigned long new_value;
+	cpumask_t *mask = (cpumask_t *)data;
+	unsigned long full_count = count, err;
+	cpumask_t new_value;
 
 	err = parse_hex_value(buffer, count, &new_value);
 	if (err)
#2 lore raw
Quoted 3 lines · William Lee Irwin III
Quoted 3 lines

Extended cpumasks for larger systems. Now featuring bigsmp, Summit, and Voyager updates in addition to PC-compatible, NUMA-Q, and SN2 bits from SGI.

Quoted 2 lines · Christoph Hellwig

Here's the PPC32 UP bits. I'll look into SMP once it starts to actually compile again.

Thanks, merged.

-- wli

#3 lore raw
In reply to William Lee Irwin III
Quoted 3 lines

Extended cpumasks for larger systems. Now featuring bigsmp, Summit, and Voyager updates in addition to PC-compatible, NUMA-Q, and SN2 bits from SGI.

Can you remove the random cleanups from this, and just leave the actual patch please? Things like:

static inline int apic_id_registered(void)
{
- return (1);
+ return 1;
}

... have sweet FA to do with this. If you want to do that, it's a separate patch.

M.

#4 lore raw
In reply to William Lee Irwin III
Quoted 9 lines · William Lee Irwin III

Extended cpumasks for larger systems. Now featuring bigsmp, Summit, and Voyager updates in addition to PC-compatible, NUMA-Q, and SN2 bits from SGI.

Several minor bugfixes with improper checks of bits and some new API pieces: cpumask_of_cpu() and cpus_promote() for replacing 1 << cpu and promoting "narrow" cpumasks (i.e. unsigned long) to full-width, respectively.

Quoted 4 lines

Successfully runs on 32x NUMA-Q. Successfully compiletested on Voyager, Summit, bigsmp, and flat logical SMP, all with typechecking. UP also successfully compiletested with and without local APIC and IO-APIC. Hopefully I can get my hands on another NUMA-Q quad or two soon.

Successfully run for 4 days with various stress loads. on normally troublesome 3way P133 with CONFIG_NR_CPUS = 72 (255 causes a #SS with large .configs/kernels)

Zwane

Signature · 1 line
function.linuxpower.ca
#5 lore raw
Quoted 3 lines · William Lee Irwin III

Extended cpumasks for larger systems. Now featuring bigsmp, Summit,

Quoted 2 lines

and Voyager updates in addition to PC-compatible, NUMA-Q, and SN2 bits from SGI.

Quoted 3 lines · Zwane Mwaikambo

Successfully run for 4 days with various stress loads. on normally troublesome 3way P133 with CONFIG_NR_CPUS = 72 (255 causes a #SS with large .configs/kernels)

To clarify, this is due to bootloading limitations and kernel image size.

-- wli

#6 lore raw
Quoted 6 lines · William Lee Irwin III
Quoted 3 lines · Zwane Mwaikambo

Successfully run for 4 days with various stress loads. on normally troublesome 3way P133 with CONFIG_NR_CPUS = 72 (255 causes a #SS with large .configs/kernels)

To clarify, this is due to bootloading limitations and kernel image size.

My bad, i didn't make that clear, i've seen the same with large NR_IRQS arrays.

Zwane

Signature · 1 line
function.linuxpower.ca