2003-08-11 03:24:09

by Chris Rivera

[permalink] [raw]
Subject: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

Hi,

I am running 2.6.0-test2-mm4 on an SMP machine with dual Athlon MP
2000+s.

/proc/stat displays:

cpu 13261 0 2603 887671 4399
cpu0 6936 0 1571 443183 2285
cpu1 6325 0 1031 444488 2113
intr 5021986 4539589 5476 0 0 0 0 0 0 0 0 0 0 73888 0 16345 11 379144 0
7533 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ctxt 1677244
btime 1060567182
processes 1286
procs_running 1
procs_blocked 0

/proc/interrupts:

CPU0 CPU1
0: 26530 4875571 IO-APIC-edge timer
1: 6035 0 IO-APIC-edge i8042
2: 0 0 XT-PIC cascade
12: 77657 3869 IO-APIC-edge i8042
14: 16560 1 IO-APIC-edge ide0
15: 11 0 IO-APIC-edge ide1
16: 409959 1 IO-APIC-level radeon@PCI:1:5:0
17: 0 0 IO-APIC-level EMU10K1
18: 7942 0 IO-APIC-level eth0
NMI: 0 0
LOC: 4902124 4902123
ERR: 0
MIS: 0

I am not sure why the intr line contains all those zeros. Is this
normal behavior?

Thanks,
Chris Rivera


Attachments:
config-2.6.0-test2-mm4 (14.78 kB)

2003-08-11 03:48:52

by Randy.Dunlap

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

> Hi,
>
> I am running 2.6.0-test2-mm4 on an SMP machine with dual Athlon MP 2000+s.
>
> /proc/stat displays:
>
> cpu 13261 0 2603 887671 4399
> cpu0 6936 0 1571 443183 2285
> cpu1 6325 0 1031 444488 2113
> intr 5021986 4539589 5476 0 0 0 0 0 0 0 0 0 0 73888 0 16345 11 379144 0 7533
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> ctxt 1677244
> btime 1060567182
> processes 1286
> procs_running 1
> procs_blocked 0
>
> /proc/interrupts:
>
> CPU0 CPU1
> 0: 26530 4875571 IO-APIC-edge timer
> 1: 6035 0 IO-APIC-edge i8042
> 2: 0 0 XT-PIC cascade
> 12: 77657 3869 IO-APIC-edge i8042
> 14: 16560 1 IO-APIC-edge ide0
> 15: 11 0 IO-APIC-edge ide1
> 16: 409959 1 IO-APIC-level radeon@PCI:1:5:0
> 17: 0 0 IO-APIC-level EMU10K1
> 18: 7942 0 IO-APIC-level eth0
> NMI: 0 0
> LOC: 4902124 4902123
> ERR: 0
> MIS: 0
>
> I am not sure why the intr line contains all those zeros. Is this normal
> behavior?

Yes, for most architectures, it prints interrupts from 0 thru NR_IRQS:
for (i = 0 ; i < NR_IRQS ; i++)
len += sprintf(page + len, " %u", kstat_irqs(i));
and NR_IRQS varies depending on the kernel build options, but (for x86)
is usually either 16 or 224.

~Randy



2003-08-11 04:08:03

by Robert Love

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

On Sun, 2003-08-10 at 20:48, Randy.Dunlap wrote:

> Yes, for most architectures, it prints interrupts from 0 thru NR_IRQS:
> for (i = 0 ; i < NR_IRQS ; i++)
> len += sprintf(page + len, " %u", kstat_irqs(i));
> and NR_IRQS varies depending on the kernel build options, but (for x86)
> is usually either 16 or 224.

Eww. So I guess on SMP, it is 224.

Might be nice to only print lines that are registered, like
/proc/interrupts. But then you have no way of knowing which field is
which interrupt line. Ugh.

How can we expect anything to parse that line?

Robert Love


2003-08-11 04:33:09

by Randy.Dunlap

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

> On Sun, 2003-08-10 at 20:48, Randy.Dunlap wrote:
>
>> Yes, for most architectures, it prints interrupts from 0 thru NR_IRQS:
>> for (i = 0 ; i < NR_IRQS ; i++)
>> len += sprintf(page + len, " %u", kstat_irqs(i));
>> and NR_IRQS varies depending on the kernel build options, but (for x86) is
>> usually either 16 or 224.
>
> Eww. So I guess on SMP, it is 224.

Yes.

> Might be nice to only print lines that are registered, like
> /proc/interrupts. But then you have no way of knowing which field is which
> interrupt line. Ugh.
>
> How can we expect anything to parse that line?

Ugh-ly? We can move it to sysfs and then change the file format
to intnum:count pairs (e.g.).

~Randy



2003-08-11 04:41:12

by Randy.Dunlap

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

> On Sun, 2003-08-10 at 21:33, Randy.Dunlap wrote:
>
>> Ugh-ly? We can move it to sysfs and then change the file format to
>> intnum:count pairs (e.g.).
>
> But then how is it different from /proc/interrupts ?

Um, your turn.

~Randy



2003-08-11 04:35:29

by Robert Love

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

On Sun, 2003-08-10 at 21:33, Randy.Dunlap wrote:

> Ugh-ly? We can move it to sysfs and then change the file format
> to intnum:count pairs (e.g.).

But then how is it different from /proc/interrupts ?

Robert Love


2003-08-11 04:45:27

by Robert Love

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

On Sun, 2003-08-10 at 21:41, Randy.Dunlap wrote:

> Um, your turn.

Hahaha. I don't know, Randy. :)

Robert Love


2003-08-11 05:35:47

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

On Sun, 10 Aug 2003, Robert Love wrote:

> On Sun, 2003-08-10 at 21:41, Randy.Dunlap wrote:
>
> > Um, your turn.
>
> Hahaha. I don't know, Randy. :)

On i386 you can find out the last irq line number during MP table parsing
(ACPI bits are also in mpparse.c), for the hotplug case i suppose the
hotplug code could bump this up as devices get attached. But unless we do
dynamic NR_IRQs its all just too much effort.

2003-08-11 06:06:57

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

On Mon, 11 Aug 2003, Zwane Mwaikambo wrote:

> On i386 you can find out the last irq line number during MP table parsing
> (ACPI bits are also in mpparse.c), for the hotplug case i suppose the
> hotplug code could bump this up as devices get attached. But unless we do
> dynamic NR_IRQs its all just too much effort.

Boring weekend...

Index: linux-2.6.0-test3-huge_kpage/fs/proc/proc_misc.c
===================================================================
RCS file: /build/cvsroot/linux-2.6.0-test3/fs/proc/proc_misc.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 proc_misc.c
--- linux-2.6.0-test3-huge_kpage/fs/proc/proc_misc.c 10 Aug 2003 08:42:45 -0000 1.1.1.1
+++ linux-2.6.0-test3-huge_kpage/fs/proc/proc_misc.c 11 Aug 2003 05:49:54 -0000
@@ -411,8 +411,19 @@ static int kstat_read_proc(char *page, c
len += sprintf(page + len, "intr %u", sum);

#if !defined(CONFIG_PPC64) && !defined(CONFIG_ALPHA)
- for (i = 0 ; i < NR_IRQS ; i++)
+{
+ static int last_irq = 0;
+
+ for (i = last_irq; i < NR_IRQS; i++) {
+ if (irq_desc[i].action) {
+ if (i > last_irq)
+ last_irq = i;
+ }
+ }
+
+ for (i = 0 ; i <= last_irq ; i++)
len += sprintf(page + len, " %u", kstat_irqs(i));
+}
#endif

len += sprintf(page + len,

2003-08-11 06:38:03

by Zwane Mwaikambo

[permalink] [raw]
Subject: Re: /proc/stat's intr field looks odd, although /proc/interrupts seems correct

Now that it's booted;

This box has 20 irq lines and NR_IRQS = 224
Linux har-01.mastecende.com 2.6.0-test3 #12 SMP Mon Aug 11 01:56:51 EDT 2003 i686 i686 i386 GNU/Linux
root@har-01 ~ {0, 0} cat /proc/interrupts
CPU0
0: 386488 IO-APIC-edge timer
1: 98 IO-APIC-edge i8042
2: 0 XT-PIC cascade
8: 1 IO-APIC-edge rtc
9: 0 IO-APIC-level acpi
12: 57 IO-APIC-edge i8042
14: 10 IO-APIC-edge ide0
17: 2343 IO-APIC-level BusLogic BT-958
18: 190 IO-APIC-level PCnet/PCI II 79C970A
19: 0 IO-APIC-level uhci-hcd
NMI: 0
LOC: 383054
ERR: 0
MIS: 0
root@har-01 ~ {0, 0} cat /proc/stat
cpu 13420 48 19886 4865 384
cpu0 13420 48 19887 4865 384
intr 391995 389245 98 0 0 0 0 3 0 1 0 0 0 57 0 10 0 0 2345 237 0
ctxt 20591
btime 1058859909
processes 1097
procs_running 1
procs_blocked 0

And this one has 16 irq lines and NR_IRQS = 224
Linux mondecino.mastecende.com 2.6.0-test3 #11 SMP Mon Aug 11 01:50:37 EDT
2003 i686 i686 i386 GNU/Linux
root@mondecino ~ {0, 0} cat /proc/interrupts
CPU0
0: 1071356 XT-PIC timer
1: 12 XT-PIC i8042
2: 0 XT-PIC cascade
4: 830 XT-PIC serial
5: 1281 XT-PIC uhci-hcd, uhci-hcd, eth0
8: 1 XT-PIC rtc
9: 0 XT-PIC acpi
12: 60 XT-PIC i8042
14: 1490 XT-PIC ide0
15: 42 XT-PIC ide1
NMI: 0
LOC: 1070561
ERR: 0
MIS: 0
root@mondecino ~ {0, 0} cat /proc/stat
cpu 27374 0 1642 77426 1230
cpu0 27374 0 1642 77426 1230
intr 1080473 1076701 12 0 0 830 1334 0 1 1 0 0 0 60 0 1492 42
ctxt 16348
btime 1060581831
processes 1218
procs_running 2
procs_blocked 0