Port-amd64 archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [PATCH] Add intr_mask() / intr_unmask() interface to mask / unmask individual interrupt sources
> On Aug 23, 2019, at 11:43 PM, Maxime Villard <max%m00nbsd.net@localhost> wrote:
>
> One possible problem though:
>
> - (*pic->pic_hwunmask)(pic, pin);
> + isp->is_distribute_pending = false;
> + if (isp->is_mask_count == 0)
>
> You get interrupted here, intr_mask_xcall() comes in and does is_mask_count++,
> then calls pic->pic_hwmask().
>
> + (*pic->pic_hwunmask)(pic, pin);
>
> Here it gets unmasked but with is_mask_count==1.
Hm, intr_mask_xcall() should only get invoked via a call to intr_mask_internal(), which takes the cpu_lock before performing any cross-calls.
The code you quote in intr_set_affinity() is called via intr_distribute_locked(), which is called via interrupt_distribute() with the cpu_lock held as well. So I think these are already safely serialized, although I could add an extra measure of safety by disabling interrupts on the current CPU around those 3 lines of code to make absolutely sure that cross-call doesn't arrive until we're done.
-- thorpej
Home |
Main Index |
Thread Index |
Old Index