diff options
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/boot/bootsect.S | 2 | ||||
-rw-r--r-- | arch/i386/boot/setup.S | 6 | ||||
-rw-r--r-- | arch/i386/kernel/acpi.c | 71 | ||||
-rw-r--r-- | arch/i386/kernel/apm.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/i8259.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/io_apic.c | 4 | ||||
-rw-r--r-- | arch/i386/kernel/irq.c | 2 | ||||
-rw-r--r-- | arch/i386/kernel/traps.c | 2 | ||||
-rw-r--r-- | arch/i386/lib/Makefile | 2 |
9 files changed, 81 insertions, 12 deletions
diff --git a/arch/i386/boot/bootsect.S b/arch/i386/boot/bootsect.S index f345ea100..26c67d5fd 100644 --- a/arch/i386/boot/bootsect.S +++ b/arch/i386/boot/bootsect.S @@ -151,7 +151,7 @@ probe_loop: cbtw # extend to word movw %ax, sectors cmpw $disksizes+4, %si - jae got_sectors # if all else fails, try 9 + jae got_sectors # If all else fails, try 9 xchgw %cx, %ax # cx = track and sector xorw %dx, %dx # drive 0, head 0 diff --git a/arch/i386/boot/setup.S b/arch/i386/boot/setup.S index cfb9011d3..c91d8ff00 100644 --- a/arch/i386/boot/setup.S +++ b/arch/i386/boot/setup.S @@ -81,7 +81,7 @@ start_sys_seg: .word SYSSEG type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, # Bootlin, SYSLX, bootsect...) - # else it is set by the loader: + # Else it is set by the loader: # 0xTV: T=0 for LILO # T=1 for Loadlin # T=2 for bootsect-loader @@ -91,8 +91,8 @@ type_of_loader: .byte 0 # = 0, old one (LILO, Loadlin, # flags, unused bits must be zero (RFU) bit within loadflags loadflags: -LOADED_HIGH = 1 # if set, the kernel is loaded high -CAN_USE_HEAP = 0x80 # if set, the loader also has set +LOADED_HIGH = 1 # If set, the kernel is loaded high +CAN_USE_HEAP = 0x80 # If set, the loader also has set # heap_end_ptr to tell how much # space behind setup.S can be used for # heap purposes. diff --git a/arch/i386/kernel/acpi.c b/arch/i386/kernel/acpi.c index 4e220dafb..9993d8331 100644 --- a/arch/i386/kernel/acpi.c +++ b/arch/i386/kernel/acpi.c @@ -96,6 +96,61 @@ static unsigned long acpi_enter_lvl3_lat = ACPI_INFINITE_LAT; static unsigned long acpi_p_lvl2_lat = ACPI_INFINITE_LAT; static unsigned long acpi_p_lvl3_lat = ACPI_INFINITE_LAT; +/* Statistics.. */ +struct Cx_stat_struct { + unsigned long time; + unsigned long min; + unsigned long max; + unsigned long avg; +} Cx_stat[3]; + +static int acpi_do_stat(ctl_table *ctl, + int write, + struct file *file, + void *buffer, + size_t *len) +{ + int size; + char str[4*10]; + struct Cx_stat_struct *stat = (struct Cx_stat_struct *)ctl->data; + + if (write) { + stat->time = 0; + stat->min = 0; + stat->max = 0; + stat->avg = 0; + return 0; + } + + if (file->f_pos) { + *len = 0; + return 0; + } + size = sprintf(str, "%9lu %9lu %9lu %9lu", + stat->time, + stat->min, + stat->max, + stat->avg); + if (*len < size) { + *len = 0; + return 0; + } + copy_to_user(buffer, str, size); + return 0; +} + +static void cx_statistics(unsigned int x, unsigned long time) +{ + struct Cx_stat_struct *stat = Cx_stat + (x-1); + + stat->time += time; + if (time <= stat->min-1) + stat->min = time; + if (time > stat->max) + stat->max = time; + stat->avg = time + (stat->avg >> 1); +} + static unsigned long acpi_p_blk = 0; static int acpi_p_lvl2_tested = 0; @@ -230,6 +285,18 @@ static struct ctl_table acpi_table[] = &acpi_enter_lvl3_lat, sizeof(acpi_enter_lvl3_lat), 0644, NULL, &acpi_do_ulong}, + {ACPI_C1_TIME, "c1_time", + Cx_stat+0, sizeof(struct Cx_stat_struct), + 0644, NULL, &acpi_do_stat}, + + {ACPI_C2_TIME, "c2_time", + Cx_stat+1, sizeof(struct Cx_stat_struct), + 0644, NULL, &acpi_do_stat}, + + {ACPI_C3_TIME, "c3_time", + Cx_stat+2, sizeof(struct Cx_stat_struct), + 0644, NULL, &acpi_do_stat}, + {ACPI_S0_SLP_TYP, "s0_slp_typ", &acpi_slp_typ[ACPI_S0], sizeof(acpi_slp_typ[ACPI_S0]), 0600, NULL, &acpi_do_ulong}, @@ -1023,6 +1090,7 @@ sleep3: time = TIME_END(pm_tmr, time); __sti(); + cx_statistics(3, time); if (time < acpi_p_lvl3_lat) goto sleep2; } @@ -1049,6 +1117,7 @@ sleep3_with_arbiter: outb(arbiter, pm2_cntr); /* Enable arbiter again.. */ __sti(); + cx_statistics(3, time); if (time < acpi_p_lvl3_lat) goto sleep2; } @@ -1074,6 +1143,7 @@ sleep2: time = TIME_END(pm_tmr, time); __sti(); + cx_statistics(2, time); if (time < acpi_p_lvl2_lat) goto sleep1; if (bm_activity(facp)) { @@ -1097,6 +1167,7 @@ sleep1: time = TIME_BEGIN(pm_tmr); __asm__ __volatile__("sti ; hlt": : :"memory"); time = TIME_END(pm_tmr, time); + cx_statistics(1, time); if (time > acpi_enter_lvl2_lat) goto sleep2; } diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c index bd7c62bdf..b1debd5fe 100644 --- a/arch/i386/kernel/apm.c +++ b/arch/i386/kernel/apm.c @@ -1295,7 +1295,7 @@ static int do_release(struct inode * inode, struct file * filp) as1->next = as->next; } unlock_kernel(); - kfree_s(as, sizeof(*as)); + kfree(as); return 0; } diff --git a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c index 905f694ce..46e270774 100644 --- a/arch/i386/kernel/i8259.c +++ b/arch/i386/kernel/i8259.c @@ -36,7 +36,7 @@ BUILD_COMMON_IRQ() #define BI(x,y) \ - BUILD_IRQ(##x##y) + BUILD_IRQ(x##y) #define BUILD_16_IRQS(x) \ BI(x,0) BI(x,1) BI(x,2) BI(x,3) \ diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c index ff0db7ca3..406a30771 100644 --- a/arch/i386/kernel/io_apic.c +++ b/arch/i386/kernel/io_apic.c @@ -1059,8 +1059,6 @@ static int __init timer_irq_works(void) return 0; } -extern atomic_t nmi_counter[NR_CPUS]; - static int __init nmi_irq_works(void) { irq_cpustat_t tmp[NR_CPUS]; @@ -1072,7 +1070,7 @@ static int __init nmi_irq_works(void) for (j = 0; j < smp_num_cpus; j++) { cpu = cpu_logical_map(j); - if (atomic_read(&nmi_counter(cpu)) - atomic_read(&tmp[cpu].__nmi_counter) <= 3) { + if (nmi_counter(cpu) - tmp[cpu].__nmi_counter <= 3) { printk(KERN_WARNING "CPU#%d NMI appears to be stuck.\n", cpu); return 0; } diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c index fb0fe277c..bfb2a6841 100644 --- a/arch/i386/kernel/irq.c +++ b/arch/i386/kernel/irq.c @@ -160,7 +160,7 @@ int get_irq_list(char *buf) p += sprintf(p, "NMI: "); for (j = 0; j < smp_num_cpus; j++) p += sprintf(p, "%10u ", - atomic_read(&nmi_counter(cpu_logical_map(j)))); + nmi_counter(cpu_logical_map(j))); p += sprintf(p, "\n"); #if CONFIG_SMP p += sprintf(p, "LOC: "); diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index a9ea15597..eea525873 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -459,7 +459,7 @@ asmlinkage void do_nmi(struct pt_regs * regs, long error_code) unsigned char reason = inb(0x61); - atomic_inc(&nmi_counter(smp_processor_id())); + ++nmi_counter(smp_processor_id()); if (!(reason & 0xc0)) { #if CONFIG_X86_IO_APIC /* diff --git a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile index be8fcec0a..30e9a207c 100644 --- a/arch/i386/lib/Makefile +++ b/arch/i386/lib/Makefile @@ -3,7 +3,7 @@ # .S.o: - $(CC) $(AFLAGS) -traditional -c $< -o $*.o + $(CC) $(AFLAGS) -c $< -o $*.o L_TARGET = lib.a L_OBJS = checksum.o old-checksum.o delay.o \ |