Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sum of interrupts/s overflows #314

Open
marcobarlo opened this issue Mar 17, 2022 · 1 comment
Open

sum of interrupts/s overflows #314

marcobarlo opened this issue Mar 17, 2022 · 1 comment

Comments

@marcobarlo
Copy link

The mpstat output regarding the sum of the interrupts per core overflows under certain conditions. On my PC I ran mpstat under stress-ng --udp and I have output similar to this:

11:20:57 CPU intr/s
11:21:00 all 1880,00
11:21:00 0 395027,00
11:21:00 1 399987,33
11:21:00 2 365727,00
11:21:00 3 303783,33

I guess there is no overflow control over the sum over the cores.
How to reproduce the issue:
run mpstat with periodic reports and generate a interrupt critical workload.

@stevekay
Copy link
Contributor

Does mpstat get the 'all' value directly from the kernel, rather than totalling up the number itself ?

https://github.com/sysstat/sysstat/blob/master/mpstat.c#L1996-L2002 ?


	/*
	 * Read total number of interrupts received among all CPU.
	 * (this is the first value on the line "intr:" in the /proc/stat file).
	 */
	if (DISPLAY_IRQ_SUM(actflags)) {
		read_stat_total_irq(st_irq[0]);
	}

https://github.com/sysstat/sysstat/blob/master/mpstat.c#L1795-L1827

/*
 ***************************************************************************
 * Read total number of interrupts from /proc/stat.
 *
 * IN:
 * @st_irq	Structure where total number of interrupts will be saved.
 *
 * OUT:
 * @st_irq	Structure with total number of interrupts.
 ***************************************************************************
 */
void read_stat_total_irq(struct stats_global_irq *st_irq)
{
	FILE *fp;
	char line[1024];
	unsigned long long irq_nr;

	if ((fp = fopen(STAT, "r")) == NULL)
		return;

	while (fgets(line, sizeof(line), fp) != NULL) {

		if (!strncmp(line, "intr ", 5)) {
			/* Read total number of interrupts received since system boot */
			sscanf(line + 5, "%llu", &irq_nr);
			st_irq->irq_nr = (unsigned int) irq_nr;

			break;
		}
	}

	fclose(fp);
}

I wasn't able to generate a sufficiently high workload on my system, but observing awk '/^intr/ { print $2 }' /proc/stat during your high workload might help to get a better understanding of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants