Brush up previous, or make things more similar to x86:

- Prevent pic_name from appearing vmstat(1) twice.
- Restore "irq" in interrupt id fields of intrctl(8).

For these purposes,

- Add is_evname member to struct intr_source.
- Bump size of is_source to INTRIDBUF, and rename it to is_intrid for clarity.

Now, outputs from vmstat(1) and intrctl(8) are like:

----
$ vmstat -ev
...
openpic irq 39                                 3967   26 intr
...
$ intrctl list
interrupt id   CPU0  device name(s)
...
openpic irq 39 3967* wdc1
...
----
This commit is contained in:
rin 2021-03-22 01:36:10 +00:00
parent 4df5d7619b
commit ebb772824e
2 changed files with 12 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.31 2021/03/06 07:24:24 rin Exp $ */
/* $NetBSD: intr.c,v 1.32 2021/03/22 01:36:10 rin Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -29,7 +29,7 @@
#define __INTR_PRIVATE
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.31 2021/03/06 07:24:24 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.32 2021/03/22 01:36:10 rin Exp $");
#ifdef _KERNEL_OPT
#include "opt_interrupt.h"
@ -200,10 +200,12 @@ intr_establish_xname(int hwirq, int type, int ipl, int (*ih_fun)(void *),
break;
}
if (is->is_hand == NULL) {
snprintf(is->is_source, sizeof(is->is_source), "%s %d",
snprintf(is->is_intrid, sizeof(is->is_intrid), "%s irq %d",
pic->pic_name, is->is_hwirq);
snprintf(is->is_evname, sizeof(is->is_evname), "irq %d",
is->is_hwirq);
evcnt_attach_dynamic(&is->is_ev, EVCNT_TYPE_INTR, NULL,
pic->pic_name, is->is_source);
pic->pic_name, is->is_evname);
}
/*
@ -744,7 +746,7 @@ intr_get_source(const char *intrid)
int irq;
for (irq = 0, is = intrsources; irq < NVIRQ; irq++, is++) {
if (strcmp(intrid, is->is_source) == 0)
if (strcmp(intrid, is->is_intrid) == 0)
return is;
}
return NULL;
@ -858,7 +860,7 @@ interrupt_construct_intrids(const kcpuset_t *cpuset)
if (is->is_hand == NULL)
continue;
strncpy(ids[i], is->is_source, sizeof(intrid_t));
strncpy(ids[i], is->is_intrid, sizeof(intrid_t));
i++;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: picvar.h,v 1.12 2020/04/16 23:29:52 rin Exp $ */
/* $NetBSD: picvar.h,v 1.13 2021/03/22 01:36:10 rin Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: picvar.h,v 1.12 2020/04/16 23:29:52 rin Exp $");
__KERNEL_RCSID(0, "$NetBSD: picvar.h,v 1.13 2021/03/22 01:36:10 rin Exp $");
#ifndef PIC_VAR_H
#define PIC_VAR_H
@ -62,7 +62,8 @@ struct intr_source {
struct intrhand *is_hand;
struct pic_ops *is_pic;
struct evcnt is_ev;
char is_source[16];
char is_evname[16];
char is_intrid[INTRIDBUF];
};
#define OPENPIC_MAX_ISUS 4