[+cc Greg, Ludwig (participants in previous conversation)] On Fri, Mar 6, 2015 at 6:00 AM, Paulo Fortuna Carvalho <pricardofc@xxxxxxxxx> wrote: > Good morning, > I have an ATCA systema with a PCIe endpoint card. > I need to stop applications from running everytime i remove the PCIe > endpoint before remove event occurs. That would be convenient, but a more robust design would be to make the applications able to deal with unexpected device removal. Then the apps could still work even with devices in different form factors like ExpressCard, where you don't get any warning about a device being removed. > For that task I have 2 hot-add events a MRL Sensor event and the > PRESENCE OFF event. > At the moment with the hotplug scripts (.rules files) I can configure > the behaviour of remove procedure using the "remove" tag. I dont know > if there is the possibility to use the same script (and which tag) > for the MRL Sensor event. > In addiction, is it better to use the MRL Sensor event or the > Attention Button for this purpose? As far as I can tell, pciehp currently doesn't do much with MRL Sensor events. Starting with PCI_EXP_SLTSTA_MRLSS, it looks like pciehp_handle_switch_change() will queue an INT_SWITCH_OPEN or INT_SWITCH_CLOSE close event, but interrupt_event_handler() ignores those events. It seems possible that we could treat MRL sensor "switch open" and button press events as a "request to remove device" signal and expose that to user-space via udev. But we'd have to think about whether that really makes sense and what the implications would be, e.g., how to handle subsequent "switch close" or button press events. And you might want some sort of signal from user-space back into the kernel to say "yes, it's OK to remove the device." That sounds like more of an issue because then the kernel is dependent on something in user-space, and I don't really want to go that direction. If you want to prototype all this and experiment with it, that would be a first step to exploring it. But I would encourage you to focus on making the applications more resilient if at all possible. Bjorn -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html