On Thu, Dec 06, 2018 at 10:47:33AM +0200, Gal Pressman wrote: > >> +static void efa_destroy_ah_id(struct efa_dev *dev, u8 *id) { > >> + u16 device_ah; > >> + u32 ref_count; > >> + int err; > >> + > >> + mutex_lock(&dev->ah_list_lock); > > > > Create and destroy ah for kernel consumers cannot sleep. > > Though I understand that currently you don't have kernel consumers. > > This should be changed to spin lock along with other allocation to GFP_ATOMIC. > > Create/destroy AH must be communicated with our device (in the form of an admin > command), this requires us to sleep regardless of the mutex/memory allocation > (we shouldn't busy wait while waiting for the device to complete the command). > None of the currently supported flows are done in an atomic context, we will > have to figure that out when we add support for those. You don't get to make up your own rules. The function pointer this is being assigned to required atomic support. That the driver doesn't happen to trigger that call path today doesn't matter at all. We can't maintain the core code properly if drivers randomly decide to not follow the rules because it is inconvenient. Jason