* Re: [PATCH] PER_CPU [1/4] - PER_CPU-cpu_tlbstate [not found] <200407090141.i691ffws016223@fire-2.osdl.org> @ 2004-07-09 2:21 ` Andrew Morton 2004-07-09 3:30 ` Shai Fultheim [not found] ` <200407090330.i693UPws023956@fire-2.osdl.org> 0 siblings, 2 replies; 4+ messages in thread From: Andrew Morton @ 2004-07-09 2:21 UTC (permalink / raw) To: Shai Fultheim; +Cc: linux-kernel, mort, jes "Shai Fultheim" <shai@scalex86.org> wrote: > > Please find below one out of collection of patched that move NR_CPU array variables to the per-cpu area. This is an `allmodconfig' build, gcc-3.4: distcc[19912] ERROR: compile on vmm failed arch/i386/mm/fault.c: In function `get_segment_eip': arch/i386/mm/fault.c:110: error: `per_cpu__cpu_gdt_table' undeclared (first use in this function) arch/i386/mm/fault.c:110: error: (Each undeclared identifier is reported only once arch/i386/mm/fault.c:110: error: for each function it appears in.) arch/i386/mm/fault.c:110: warning: type defaults to `int' in declaration of `type name' arch/i386/mm/fault.c:110: error: invalid type argument of `unary *' make[1]: *** [arch/i386/mm/fault.o] Error 1 make[1]: *** Waiting for unfinished jobs.... distcc[20015] ERROR: compile on vmm failed arch/i386/kernel/ioport.c: In function `sys_ioperm': arch/i386/kernel/ioport.c:86: error: `per_cpu__init_tss' undeclared (first use in this function) arch/i386/kernel/ioport.c:86: error: (Each undeclared identifier is reported only once arch/i386/kernel/ioport.c:86: error: for each function it appears in.) arch/i386/kernel/ioport.c:86: warning: type defaults to `int' in declaration of `type name' arch/i386/kernel/ioport.c:86: error: invalid type argument of `unary *' make[1]: *** [arch/i386/kernel/ioport.o] Error 1 make[1]: *** Waiting for unfinished jobs.... distcc[20004] ERROR: compile on vmm failed arch/i386/kernel/vm86.c: In function `save_v86_state': arch/i386/kernel/vm86.c:124: error: `per_cpu__init_tss' undeclared (first use in this function) arch/i386/kernel/vm86.c:124: error: (Each undeclared identifier is reported only once arch/i386/kernel/vm86.c:124: error: for each function it appears in.) arch/i386/kernel/vm86.c:124: warning: type defaults to `int' in declaration of `type name' arch/i386/kernel/vm86.c:124: error: invalid type argument of `unary *' arch/i386/kernel/vm86.c: In function `do_sys_vm86': arch/i386/kernel/vm86.c:306: error: `per_cpu__init_tss' undeclared (first use in this function) arch/i386/kernel/vm86.c:306: warning: type defaults to `int' in declaration of `type name' arch/i386/kernel/vm86.c:306: error: invalid type argument of `unary *' make[1]: *** [arch/i386/kernel/vm86.o] Error 1 make: *** [arch/i386/kernel] Error 2 make: *** Waiting for unfinished jobs.... distcc[19929] ERROR: compile on vmm failed arch/i386/kernel/process.c: In function `exit_thread': arch/i386/kernel/process.c:301: error: `per_cpu__init_tss' undeclared (first use in this function) arch/i386/kernel/process.c:301: error: (Each undeclared identifier is reported only once arch/i386/kernel/process.c:301: error: for each function it appears in.) arch/i386/kernel/process.c:301: warning: type defaults to `int' in declaration of `type name' arch/i386/kernel/process.c:301: error: invalid type argument of `unary *' arch/i386/kernel/process.c: In function `__switch_to': arch/i386/kernel/process.c:510: error: `per_cpu__init_tss' undeclared (first use in this function) arch/i386/kernel/process.c:510: warning: type defaults to `int' in declaration of `type name' arch/i386/kernel/process.c:510: error: invalid type argument of `unary *' make: *** [arch/i386/mm] Error 2 ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] PER_CPU [1/4] - PER_CPU-cpu_tlbstate 2004-07-09 2:21 ` [PATCH] PER_CPU [1/4] - PER_CPU-cpu_tlbstate Andrew Morton @ 2004-07-09 3:30 ` Shai Fultheim [not found] ` <200407090330.i693UPws023956@fire-2.osdl.org> 1 sibling, 0 replies; 4+ messages in thread From: Shai Fultheim @ 2004-07-09 3:30 UTC (permalink / raw) To: 'Andrew Morton'; +Cc: linux-kernel, mort, jes "Andrew Morton" <akpm@osdl.org> wrote: > This is an `allmodconfig' build, gcc-3.4: > > distcc[19912] ERROR: compile on vmm failed > arch/i386/mm/fault.c: In function `get_segment_eip': > arch/i386/mm/fault.c:110: error: `per_cpu__cpu_gdt_table' undeclared > arch/i386/kernel/ioport.c: In function `sys_ioperm': > arch/i386/kernel/ioport.c:86: error: `per_cpu__init_tss' undeclared (first > use in this function) > arch/i386/kernel/vm86.c: In function `save_v86_state': > arch/i386/kernel/vm86.c:124: error: `per_cpu__init_tss' undeclared (first > use in this function) > arch/i386/kernel/vm86.c: In function `do_sys_vm86': > arch/i386/kernel/vm86.c:306: error: `per_cpu__init_tss' undeclared (first > use in this function) > arch/i386/kernel/process.c: In function `exit_thread': > arch/i386/kernel/process.c:301: error: `per_cpu__init_tss' undeclared > (first use in this function) > arch/i386/kernel/process.c: In function `__switch_to': > arch/i386/kernel/process.c:510: error: `per_cpu__init_tss' undeclared > (first use in this function) I'm not getting any of those, using gcc-3.2.2 (just rebuilt it all). I can try with 3.4, it might be different. The fix should be easy, it just missing couple of DECLARE_PER_CPU. I don't where this is coming from, and MORE IMPORTANT, how you haven't got these errors before, since I made sure all replaced all declarations by the patch. I find out that the following need to be added to PER_CPU-gdt_table, I'll send updated patch once I find why you getting the errors above. arch/i386/kernel/apm.c | 34 +++++++++++++++++----------------- drivers/pnp/pnpbios/bioscalls.c | 14 +++++++------- 2 files changed, 24 insertions(+), 24 deletions(-) ===== arch/i386/kernel/apm.c 1.63 vs edited ===== --- 1.63/arch/i386/kernel/apm.c 2004-04-19 01:12:13 -07:00 +++ edited/arch/i386/kernel/apm.c 2004-07-08 20:08:03 -07:00 @@ -600,8 +600,8 @@ cpus = apm_save_cpus(); cpu = get_cpu(); - save_desc_40 = cpu_gdt_table[cpu][0x40 / 8]; - cpu_gdt_table[cpu][0x40 / 8] = bad_bios_desc; + save_desc_40 = per_cpu(cpu_gdt_table, cpu)[0x40 / 8]; + per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = bad_bios_desc; local_save_flags(flags); APM_DO_CLI; @@ -609,7 +609,7 @@ apm_bios_call_asm(func, ebx_in, ecx_in, eax, ebx, ecx, edx, esi); APM_DO_RESTORE_SEGS; local_irq_restore(flags); - cpu_gdt_table[cpu][0x40 / 8] = save_desc_40; + per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = save_desc_40; put_cpu(); apm_restore_cpus(cpus); @@ -643,8 +643,8 @@ cpus = apm_save_cpus(); cpu = get_cpu(); - save_desc_40 = cpu_gdt_table[cpu][0x40 / 8]; - cpu_gdt_table[cpu][0x40 / 8] = bad_bios_desc; + save_desc_40 = per_cpu(cpu_gdt_table, cpu)[0x40 / 8]; + per_cpu(cpu_gdt_table, cpu)[0x40 / 8] = bad_bios_desc; local_save_flags(flags); APM_DO_CLI; @@ -652,7 +652,7 @@ error = apm_bios_call_simple_asm(func, ebx_in, ecx_in, eax); APM_DO_RESTORE_SEGS; local_irq_restore(flags); - cpu_gdt_table[smp_processor_id()][0x40 / 8] = save_desc_40; + per_cpu(cpu_gdt_table, smp_processor_id())[0x40 / 8] = save_desc_40; put_cpu(); apm_restore_cpus(cpus); return error; @@ -1976,35 +1976,35 @@ apm_bios_entry.segment = APM_CS; for (i = 0; i < NR_CPUS; i++) { - set_base(cpu_gdt_table[i][APM_CS >> 3], + set_base(per_cpu(cpu_gdt_table, i)[APM_CS >> 3], __va((unsigned long)apm_info.bios.cseg << 4)); - set_base(cpu_gdt_table[i][APM_CS_16 >> 3], + set_base(per_cpu(cpu_gdt_table, i)[APM_CS_16 >> 3], __va((unsigned long)apm_info.bios.cseg_16 << 4)); - set_base(cpu_gdt_table[i][APM_DS >> 3], + set_base(per_cpu(cpu_gdt_table, i)[APM_DS >> 3], __va((unsigned long)apm_info.bios.dseg << 4)); #ifndef APM_RELAX_SEGMENTS if (apm_info.bios.version == 0x100) { #endif /* For ASUS motherboard, Award BIOS rev 110 (and others?) */ - _set_limit((char *)&cpu_gdt_table[i][APM_CS >> 3], 64 * 1024 - 1); + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_CS >> 3], 64 * 1024 - 1); /* For some unknown machine. */ - _set_limit((char *)&cpu_gdt_table[i][APM_CS_16 >> 3], 64 * 1024 - 1); + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_CS_16 >> 3], 64 * 1024 - 1); /* For the DEC Hinote Ultra CT475 (and others?) */ - _set_limit((char *)&cpu_gdt_table[i][APM_DS >> 3], 64 * 1024 - 1); + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_DS >> 3], 64 * 1024 - 1); #ifndef APM_RELAX_SEGMENTS } else { - _set_limit((char *)&cpu_gdt_table[i][APM_CS >> 3], + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_CS >> 3], (apm_info.bios.cseg_len - 1) & 0xffff); - _set_limit((char *)&cpu_gdt_table[i][APM_CS_16 >> 3], + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_CS_16 >> 3], (apm_info.bios.cseg_16_len - 1) & 0xffff); - _set_limit((char *)&cpu_gdt_table[i][APM_DS >> 3], + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_DS >> 3], (apm_info.bios.dseg_len - 1) & 0xffff); /* workaround for broken BIOSes */ if (apm_info.bios.cseg_len <= apm_info.bios.offset) - _set_limit((char *)&cpu_gdt_table[i][APM_CS >> 3], 64 * 1024 -1); + _set_limit((char *)&per_cpu(cpu_gdt_table, i)[APM_CS >> 3], 64 * 1024 -1); if (apm_info.bios.dseg_len <= 0x40) { /* 0x40 * 4kB == 64kB */ /* for the BIOS that assumes granularity = 1 */ - cpu_gdt_table[i][APM_DS >> 3].b |= 0x800000; + per_cpu(cpu_gdt_table, i)[APM_DS >> 3].b |= 0x800000; printk(KERN_NOTICE "apm: we set the granularity of dseg.\n"); } } ===== drivers/pnp/pnpbios/bioscalls.c 1.4 vs edited ===== --- 1.4/drivers/pnp/pnpbios/bioscalls.c 2004-05-22 01:23:01 -07:00 +++ edited/drivers/pnp/pnpbios/bioscalls.c 2004-07-08 20:10:10 -07:00 @@ -69,14 +69,14 @@ #define Q_SET_SEL(cpu, selname, address, size) \ do { \ -set_base(cpu_gdt_table[cpu][(selname) >> 3], __va((u32)(address))); \ -set_limit(cpu_gdt_table[cpu][(selname) >> 3], size); \ +set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], __va((u32)(address))); \ +set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \ } while(0) #define Q2_SET_SEL(cpu, selname, address, size) \ do { \ -set_base(cpu_gdt_table[cpu][(selname) >> 3], (u32)(address)); \ -set_limit(cpu_gdt_table[cpu][(selname) >> 3], size); \ +set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], (u32)(address)); \ +set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \ } while(0) static struct desc_struct bad_bios_desc = { 0, 0x00409200 }; @@ -115,8 +115,8 @@ return PNP_FUNCTION_NOT_SUPPORTED; cpu = get_cpu(); - save_desc_40 = cpu_gdt_table[cpu][0x40 / 8]; - cpu_gdt_table[cpu][0x40 / 8] = bad_bios_desc; + save_desc_40 = per_cpu(cpu_gdt_table,cpu)[0x40 / 8]; + per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = bad_bios_desc; /* On some boxes IRQ's during PnP BIOS calls are deadly. */ spin_lock_irqsave(&pnp_bios_lock, flags); @@ -158,7 +158,7 @@ ); spin_unlock_irqrestore(&pnp_bios_lock, flags); - cpu_gdt_table[cpu][0x40 / 8] = save_desc_40; + per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = save_desc_40; put_cpu(); /* If we get here and this is set then the PnP BIOS faulted on us. */ ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <200407090330.i693UPws023956@fire-2.osdl.org>]
* Re: [PATCH] PER_CPU [1/4] - PER_CPU-cpu_tlbstate [not found] ` <200407090330.i693UPws023956@fire-2.osdl.org> @ 2004-07-09 3:36 ` Andrew Morton 0 siblings, 0 replies; 4+ messages in thread From: Andrew Morton @ 2004-07-09 3:36 UTC (permalink / raw) To: Shai Fultheim; +Cc: linux-kernel, mort, jes "Shai Fultheim" <shai@scalex86.org> wrote: > > I find out that the following need to be added to PER_CPU-gdt_table, I'll > send updated patch once I find why you getting the errors above. I applied all four patches on top of the current Linus tree, did `make allmodconfig ; make vmlinux'. The same occurs with gcc-2.95.3. Anyway, I dropped everything so please resend all patches once it's sorted. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] PER_CPU [1/4] - PER_CPU-cpu_tlbstate
@ 2004-07-09 1:41 Shai Fultheim
0 siblings, 0 replies; 4+ messages in thread
From: Shai Fultheim @ 2004-07-09 1:41 UTC (permalink / raw)
To: 'Andrew Morton'
Cc: 'Linux Kernel ML', 'Martin Hicks',
'Jes Sorensen'
Andrew,
Please find below one out of collection of patched that move NR_CPU array variables to the per-cpu area. Please consider applying,
any comment will highly appreciated.
1/4. PER_CPU-cpu_tlbstate
2/4. PER_CPU-irq_stat
3/4. PER_CPU-init_tss
4/4. PER_CPU-cpu_gdt_table
PER_CPU-cpu_tlbstate:
arch/i386/kernel/smp.c | 12 ++++++------
include/asm-i386/mmu_context.h | 12 ++++++------
include/asm-i386/tlbflush.h | 2 +-
3 files changed, 13 insertions(+), 13 deletions(-)
Signed-off-by: Martin Hicks <mort@wildopensource.com>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
=================================================================================
diff -Nru a/arch/i386/kernel/smp.c b/arch/i386/kernel/smp.c
--- a/arch/i386/kernel/smp.c 2004-07-08 14:43:17 -07:00
+++ b/arch/i386/kernel/smp.c 2004-07-08 14:43:17 -07:00
@@ -105,7 +105,7 @@
* about nothing of note with C stepping upwards.
*/
-struct tlb_state cpu_tlbstate[NR_CPUS] __cacheline_aligned = {[0 ... NR_CPUS-1] = { &init_mm, 0, }};
+DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) = { &init_mm, 0, };
/*
* the following functions deal with sending IPIs between CPUs.
@@ -256,9 +256,9 @@
*/
static inline void leave_mm (unsigned long cpu)
{
- if (cpu_tlbstate[cpu].state == TLBSTATE_OK)
+ if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
BUG();
- cpu_clear(cpu, cpu_tlbstate[cpu].active_mm->cpu_vm_mask);
+ cpu_clear(cpu, per_cpu(cpu_tlbstate, cpu).active_mm->cpu_vm_mask);
load_cr3(swapper_pg_dir);
}
@@ -325,8 +325,8 @@
* BUG();
*/
- if (flush_mm == cpu_tlbstate[cpu].active_mm) {
- if (cpu_tlbstate[cpu].state == TLBSTATE_OK) {
+ if (flush_mm == per_cpu(cpu_tlbstate, cpu).active_mm) {
+ if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) {
if (flush_va == FLUSH_ALL)
local_flush_tlb();
else
@@ -458,7 +458,7 @@
unsigned long cpu = smp_processor_id();
__flush_tlb_all();
- if (cpu_tlbstate[cpu].state == TLBSTATE_LAZY)
+ if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_LAZY)
leave_mm(cpu);
}
diff -Nru a/include/asm-i386/mmu_context.h b/include/asm-i386/mmu_context.h
--- a/include/asm-i386/mmu_context.h 2004-07-08 14:43:17 -07:00
+++ b/include/asm-i386/mmu_context.h 2004-07-08 14:43:17 -07:00
@@ -18,8 +18,8 @@
{
#ifdef CONFIG_SMP
unsigned cpu = smp_processor_id();
- if (cpu_tlbstate[cpu].state == TLBSTATE_OK)
- cpu_tlbstate[cpu].state = TLBSTATE_LAZY;
+ if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
+ per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_LAZY;
#endif
}
@@ -33,8 +33,8 @@
/* stop flush ipis for the previous mm */
cpu_clear(cpu, prev->cpu_vm_mask);
#ifdef CONFIG_SMP
- cpu_tlbstate[cpu].state = TLBSTATE_OK;
- cpu_tlbstate[cpu].active_mm = next;
+ per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
+ per_cpu(cpu_tlbstate, cpu).active_mm = next;
#endif
cpu_set(cpu, next->cpu_vm_mask);
@@ -49,8 +49,8 @@
}
#ifdef CONFIG_SMP
else {
- cpu_tlbstate[cpu].state = TLBSTATE_OK;
- BUG_ON(cpu_tlbstate[cpu].active_mm != next);
+ per_cpu(cpu_tlbstate, cpu).state = TLBSTATE_OK;
+ BUG_ON(per_cpu(cpu_tlbstate, cpu).active_mm != next);
if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
/* We were in lazy tlb mode and leave_mm disabled
diff -Nru a/include/asm-i386/tlbflush.h b/include/asm-i386/tlbflush.h
--- a/include/asm-i386/tlbflush.h 2004-07-08 14:43:17 -07:00
+++ b/include/asm-i386/tlbflush.h 2004-07-08 14:43:17 -07:00
@@ -131,7 +131,7 @@
int state;
char __cacheline_padding[L1_CACHE_BYTES-8];
};
-extern struct tlb_state cpu_tlbstate[NR_CPUS];
+DECLARE_PER_CPU(struct tlb_state, cpu_tlbstate);
#endif
=================================================================================
-----------------
Shai Fultheim
Scalex86.org
-----------------
Shai Fultheim
Scalex86.org
^ permalink raw reply [flat|nested] 4+ messages in threadend of thread, other threads:[~2004-07-09 3:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200407090141.i691ffws016223@fire-2.osdl.org>
2004-07-09 2:21 ` [PATCH] PER_CPU [1/4] - PER_CPU-cpu_tlbstate Andrew Morton
2004-07-09 3:30 ` Shai Fultheim
[not found] ` <200407090330.i693UPws023956@fire-2.osdl.org>
2004-07-09 3:36 ` Andrew Morton
2004-07-09 1:41 Shai Fultheim
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®