Skip to content

Commit b362647

Browse files
committed
Give device names to ithreads p_comm and evcounters to softintr.
Concatenate all device names in the ithread's process name, this is useful for debugging and/or profiling. Also put event counters on software interrupts, I can't recall how many times I wanted to know this. A ps auxkl might show the following now: root 6034 0.0 0.0 0 0 ?? DK 2:01AM 0:04.97 (softclock) 0 0 0 -18 0 intr root 24717 0.0 0.0 0 0 ?? DK 2:01AM 0:01.06 (softnet) 0 0 0 -18 0 intr root 25481 0.0 0.0 0 0 ?? DK 2:01AM 0:01.08 (ehci0,mpi0) 0 0 0 -18 0 intr root 23688 0.0 0.0 0 0 ?? DK 2:01AM 0:01.02 (em0) 0 0 0 -18 0 intr ....
1 parent c5f7f43 commit b362647

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

sys/dev/ic/com.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1822,7 +1822,7 @@ com_attach_subr(struct com_softc *sc)
18221822

18231823
timeout_set(&sc->sc_diag_tmo, comdiag, sc);
18241824
timeout_set(&sc->sc_dtr_tmo, com_raisedtr, sc);
1825-
sc->sc_si = softintr_establish(IPL_TTY, comsoft, sc);
1825+
sc->sc_si = softintr_establish(IPL_TTY, comsoft, sc, "softcom");
18261826
if (sc->sc_si == NULL)
18271827
panic("%s: can't establish soft interrupt",
18281828
sc->sc_dev.dv_xname);

sys/dev/usb/usb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ usb_attach(struct device *parent, struct device *self, void *aux)
197197
USB_TASK_TYPE_EXPLORE);
198198

199199
sc->sc_bus->soft = softintr_establish(IPL_SOFTNET,
200-
sc->sc_bus->methods->soft_intr, sc->sc_bus);
200+
sc->sc_bus->methods->soft_intr, sc->sc_bus, "softusb");
201201

202202
if (!usb_attach_roothub(sc)) {
203203
struct usbd_device *dev = sc->sc_bus->root_hub;

sys/kern/kern_clock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ initclocks(void)
112112
{
113113
int i;
114114

115-
softclock_si = softintr_establish(IPL_SOFTCLOCK, softclock, NULL);
115+
softclock_si = softintr_establish(IPL_SOFTCLOCK, softclock, NULL,
116+
"softclock");
116117

117118
/*
118119
* Set divisors to 1 (normal case) and let the machine-specific

sys/kern/kern_ithread.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,23 +166,23 @@ void
166166
ithread_forkall(void)
167167
{
168168
struct intrsource *is;
169-
static int softs;
169+
struct intrhand *ih;
170170
char name[MAXCOMLEN+1];
171171

172172
TAILQ_FOREACH(is, &ithreads, entry) {
173173
DPRINTF(1, "ithread forking intrsource pin %d\n", is->is_pin);
174-
175-
if (is->is_pic == &softintr_pic) {
176-
snprintf(name, sizeof name, "ithread soft %d",
177-
softs++);
178-
if (kthread_create(ithread, is, &is->is_proc, name))
179-
panic("ithread_forkall");
180-
} else {
181-
snprintf(name, sizeof name, "ithread pin %d",
182-
is->is_pin);
183-
if (kthread_create(ithread, is, &is->is_proc, name))
184-
panic("ithread_forkall");
174+
for (ih = is->is_handlers; ih != NULL; ih = ih->ih_next) {
175+
KASSERT(ih->ih_count.ec_name != NULL);
176+
if (ih == is->is_handlers) {
177+
strlcpy(name, ih->ih_count.ec_name,
178+
sizeof(name));
179+
continue;
180+
}
181+
strlcat(name, ",", sizeof(name));
182+
strlcat(name, ih->ih_count.ec_name, sizeof(name));
185183
}
184+
if (kthread_create(ithread, is, &is->is_proc, name))
185+
panic("ithread_forkall");
186186
}
187187
}
188188

sys/kern/kern_softintr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
* SCHED_LOCK, which is totally unacceptable in the future.
3232
*/
3333
void *
34-
softintr_establish(int level, int (*handler)(void *), void *arg)
34+
softintr_establish(int level, int (*handler)(void *), void *arg,
35+
const char *name)
3536
{
3637
struct intrsource *is;
3738
struct intrhand *ih;
@@ -57,6 +58,7 @@ softintr_establish(int level, int (*handler)(void *), void *arg)
5758
/* Just prepend it */
5859
ih->ih_next = is->is_handlers;
5960
is->is_handlers = ih;
61+
evcount_attach(&ih->ih_count, name, &ih->ih_irq);
6062

6163
ithread_register(is);
6264

sys/net/netisr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,5 @@ netintr(void *unused) /* ARGSUSED */
8181
void
8282
netisr_init(void)
8383
{
84-
netisr_intr = softintr_establish(IPL_SOFTNET, netintr, NULL);
84+
netisr_intr = softintr_establish(IPL_SOFTNET, netintr, NULL, "softnet");
8585
}

sys/net/pipex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ pipex_init(void)
149149
IFQ_SET_MAXLEN(&pipexinq, IFQ_MAXLEN);
150150
IFQ_SET_MAXLEN(&pipexoutq, IFQ_MAXLEN);
151151
pipex_softintr =
152-
softintr_establish(IPL_SOFTNET, pipex_softintr_handler, NULL);
152+
softintr_establish(IPL_SOFTNET, pipex_softintr_handler, NULL, "pipex");
153153
}
154154

155155
void

sys/sys/softintr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* Generic software interrupt support for all platforms.
2727
*/
2828

29-
void *softintr_establish(int, int (*)(void *), void *);
29+
void *softintr_establish(int, int (*)(void *), void *, const char *);
3030
void softintr_disestablish(void *);
3131
void softintr_init(void);
3232
void softintr_dispatch(int);

0 commit comments

Comments
 (0)