Domanda

I would like to know how /proc/interrupts is getting up to date?

is it have only irq of drivers were probed or it contains the list of all the possible irqs in the system?

È stato utile?

Soluzione

As you can see in the source of the kernel, it displays all possible irqs of the system.
In source/fs/proc/interrupts.c:39 a sequence operation is initialized to return as many elements as interrupts exist in the system for /proc/interrupts.

In source/kernel/irq/proc.c:479 we can see that the counters of every interrupt gets extracted from global counters via kstat_irqs_cpu(irq, cpu).
This means the interrupt count information gets updated in different counters, one for each cpu. The counters get summed upon reading the proc file. This is a common pattern in the kernel. It prevents contention on a global counter.

More onfo about per-cpu variables you can read here. More about interrupts in linux you can get here.

Altri suggerimenti

All files under /proc are pseudo files , which means there is no actual data present in them.

When you access any file under proc fs , proc methods linked with that particular proc file is invoked , and the proc methods , access certain related kernel data structures and generate data dynamically , which can be read and displayed. Data from proc file is generally used to display status information of the system , or the state of a device driver.

The proc fs is generally implemented as part of the driver , by adding the proc and the seq fs layer to the driver code , however proc is also used by the kernel , to display status information of the system in general.Since there is no general hierarchy or classification among the proc files , they are used rarely in comparison with the newer sysfs file system.

To know how the information is generated , you must study the proc layer implemented in fs/proc/interrupts.c

This website briefly explains some of those methods.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top