diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-07-21 22:00:56 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-07-21 22:00:56 +0000 |
commit | 168660f24dfc46c2702acbe4701a446f42a59578 (patch) | |
tree | f431368afbf6b1b71809cf3fd904d800ea126f4d /arch/i386/kernel | |
parent | 6420f767924fa73b0ea267864d96820815f4ba5a (diff) |
Merge with Linux 2.4.0-test5-pre3.
Diffstat (limited to 'arch/i386/kernel')
-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 |
6 files changed, 76 insertions, 7 deletions
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 /* |