public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Question] Calling request_firmware under the spinlocks in file advansys.c
@ 2016-09-13  9:18 Vaishali Thakkar
  2016-09-27 11:26 ` Vaishali Thakkar
  0 siblings, 1 reply; 3+ messages in thread
From: Vaishali Thakkar @ 2016-09-13  9:18 UTC (permalink / raw)
  To: Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel

Hi,

In the file drivers/scsi/advansys.c we are calling function AdvISR at 2 instances
[in the function advansys_reset and advansys_interrupt] while holding spinlock.
Function AdvISR eventually calls request_firmware following this sequence of
routines: 

AdvISR -> adv_async_callback -> AdvResetChipAndSB -> AdvInitAsc3550Driver ->
request_firmware

According to the definition of request_firmware it should be called from user
context where sleeping is allowed. And usually sleeping under the spin lock is
not allowed. Is it really necessary to call AdvISR under spinlocks here? Are
we taking care of sleeping related concern of request_firmware or am I
overlooking something here?

Thank you.

-- 
Vaishali

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Question] Calling request_firmware under the spinlocks in file advansys.c
  2016-09-13  9:18 [Question] Calling request_firmware under the spinlocks in file advansys.c Vaishali Thakkar
@ 2016-09-27 11:26 ` Vaishali Thakkar
  2016-09-27 15:16   ` Hannes Reinecke
  0 siblings, 1 reply; 3+ messages in thread
From: Vaishali Thakkar @ 2016-09-27 11:26 UTC (permalink / raw)
  To: Matthew Wilcox, Hannes Reinecke, James E.J. Bottomley,
	Martin K. Petersen, linux-scsi, linux-kernel



On Tuesday 13 September 2016 02:48 PM, Vaishali Thakkar wrote:
> Hi,
> 
> In the file drivers/scsi/advansys.c we are calling function AdvISR at 2 instances
> [in the function advansys_reset and advansys_interrupt] while holding spinlock.
> Function AdvISR eventually calls request_firmware following this sequence of
> routines: 
> 
> AdvISR -> adv_async_callback -> AdvResetChipAndSB -> AdvInitAsc3550Driver ->
> request_firmware
> 
> According to the definition of request_firmware it should be called from user
> context where sleeping is allowed. And usually sleeping under the spin lock is
> not allowed. Is it really necessary to call AdvISR under spinlocks here? Are
> we taking care of sleeping related concern of request_firmware or am I
> overlooking something here?

Hi,

Any comments on this?

Thanks

> Thank you.
> 

-- 
Vaishali

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Question] Calling request_firmware under the spinlocks in file advansys.c
  2016-09-27 11:26 ` Vaishali Thakkar
@ 2016-09-27 15:16   ` Hannes Reinecke
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2016-09-27 15:16 UTC (permalink / raw)
  To: Vaishali Thakkar, Matthew Wilcox, Hannes Reinecke,
	James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel

On 09/27/2016 01:26 PM, Vaishali Thakkar wrote:
> 
> 
> On Tuesday 13 September 2016 02:48 PM, Vaishali Thakkar wrote:
>> Hi,
>>
>> In the file drivers/scsi/advansys.c we are calling function AdvISR at 2 instances
>> [in the function advansys_reset and advansys_interrupt] while holding spinlock.
>> Function AdvISR eventually calls request_firmware following this sequence of
>> routines: 
>>
>> AdvISR -> adv_async_callback -> AdvResetChipAndSB -> AdvInitAsc3550Driver ->
>> request_firmware
>>
>> According to the definition of request_firmware it should be called from user
>> context where sleeping is allowed. And usually sleeping under the spin lock is
>> not allowed. Is it really necessary to call AdvISR under spinlocks here? Are
>> we taking care of sleeping related concern of request_firmware or am I
>> overlooking something here?
> 
> Hi,
> 
> Any comments on this?
> 
AdvISR is the main interrupt handling routine, for which we definitely
will want to have interupts disabled. Plus the SCSI parallel drivers
(ab-) use the interrupt routine to do all sorts of things, and are
thereby well versed to keep interrupts disabled for an extented amount
of time.
However, we don't really have a good way of handling a request firmware
here; we probably would need to implement a workqueue to handle this
properly ...

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-27 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13  9:18 [Question] Calling request_firmware under the spinlocks in file advansys.c Vaishali Thakkar
2016-09-27 11:26 ` Vaishali Thakkar
2016-09-27 15:16   ` Hannes Reinecke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox