On 5/2/22 8:36 PM, Stefano Stabellini wrote:
I gave it a try and there is a problem with unbinding the IRQ here. If I do that, later when xb_init_comms calls bind_evtchn_to_irqhandler, the event channel doesn't fire anymore. I did some testing and debugging and as far as I can tell the issue is that if we call unbind_from_irqhandler here, we end up calling xen_evtchn_close. Then, when xb_init_comms calls bind_evtchn_to_irqhandler on the same evtchn, it is not enough to receive event notifications anymore because from Xen POV the evtchn is "closed".
Ah, yes. That's unfortunate.
If I comment out xen_evtchn_close() in __unbind_from_irq, then yes, I can call unbind_from_irqhandler here instead of free_irq and everything works. My suggestion is to keep the call to free_irq here (not unbind_from_irqhandler) and improve the in-code comment.
OK. You could add an argument to unbind_from_irq() to keep the event channel open (I in fact am not sure it should be closing the channel since bind routines don't open it) but that looks pretty ugly too. -boris
