Skip to content

Commit

Permalink
intrng: switch PIC interface to use pic_list_lock
Browse files Browse the repository at this point in the history
Using isrc_table_lock for these functions violates layering.  Instead
use pic_list_lock, which isn't quite proper, but matches the layer these
functions are located.
  • Loading branch information
ehem committed Jul 23, 2024
1 parent 45a3b7b commit 3bd9782
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions sys/kern/subr_intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ intr_assign_irq(struct intr_irqsrc *isrc, int cpu, bool do_assignment)
#ifdef SMP
int error;

mtx_lock(&isrc_table_lock);
mtx_lock(&pic_list_lock);
if (cpu == NOCPU) {
CPU_ZERO(&isrc->isrc_cpu);
isrc->isrc_flags &= ~INTR_ISRCF_BOUND;
Expand All @@ -646,11 +646,11 @@ intr_assign_irq(struct intr_irqsrc *isrc, int cpu, bool do_assignment)
error = PIC_BIND_INTR(isrc->isrc_dev, isrc);
if (error) {
CPU_ZERO(&isrc->isrc_cpu);
mtx_unlock(&isrc_table_lock);
mtx_unlock(&pic_list_lock);
return (error);
}
}
mtx_unlock(&isrc_table_lock);
mtx_unlock(&pic_list_lock);
return (0);
#else
return (EOPNOTSUPP);
Expand Down Expand Up @@ -1116,14 +1116,14 @@ intr_setup_irq(device_t dev, struct resource *res, driver_filter_t filt,
if (error != 0)
return (error);

mtx_lock(&isrc_table_lock);
mtx_lock(&pic_list_lock);
error = PIC_SETUP_INTR(isrc->isrc_dev, isrc, res, data);
if (error == 0) {
isrc->isrc_handlers++;
if (isrc->isrc_handlers == 1)
PIC_ENABLE_INTR(isrc->isrc_dev, isrc);
}
mtx_unlock(&isrc_table_lock);
mtx_unlock(&pic_list_lock);
if (error != 0)
intr_event_remove_handler(*cookiep);
return (error);
Expand Down Expand Up @@ -1168,12 +1168,12 @@ intr_teardown_irq(device_t dev, struct resource *res, void *cookie)

error = intr_event_remove_handler(cookie);
if (error == 0) {
mtx_lock(&isrc_table_lock);
mtx_lock(&pic_list_lock);
isrc->isrc_handlers--;
if (isrc->isrc_handlers == 0)
PIC_DISABLE_INTR(isrc->isrc_dev, isrc);
PIC_TEARDOWN_INTR(isrc->isrc_dev, isrc, res, data);
mtx_unlock(&isrc_table_lock);
mtx_unlock(&pic_list_lock);

intr_describe(isrc, NULL, NULL);
}
Expand Down Expand Up @@ -1580,9 +1580,9 @@ intr_pic_init_secondary(void)
*/
KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));

//mtx_lock(&isrc_table_lock);
//mtx_lock(&pic_list_lock);
PIC_INIT_SECONDARY(intr_irq_root_dev);
//mtx_unlock(&isrc_table_lock);
//mtx_unlock(&pic_list_lock);
}
#endif

Expand Down

0 comments on commit 3bd9782

Please sign in to comment.