* [PATCH] blk: start bypass mode in blk_unregister_queue
[not found] <1364308501-1640-1-git-send-email-aaron.lu@intel.com>
@ 2013-04-04 14:01 ` Aaron Lu
2013-04-04 14:03 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Aaron Lu @ 2013-04-04 14:01 UTC (permalink / raw)
To: Jens Axboe, Tejun Heo; +Cc: linux-kernel@vger.kernel.org, Alan Stern
In blk_register_queue, we will end bypass mode for the queue; but in
blk_unregister_queue, we didn't start bypass mode for it. This would
cause the WARN_ON_ONCE(q->bypass_depth < 0) to trigger if the queue gets
registered, unregistered and then again registered, e.g. unload scsi
cdrom module driver sr_mod and then reload it will trigger such a
warning.
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
---
block/blk-sysfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 6206a93..bd322a1 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -615,4 +615,6 @@ void blk_unregister_queue(struct gendisk *disk)
kobject_del(&q->kobj);
blk_trace_remove_sysfs(disk_to_dev(disk));
kobject_put(&disk_to_dev(disk)->kobj);
+
+ blk_queue_bypass_start(q);
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] blk: start bypass mode in blk_unregister_queue
2013-04-04 14:01 ` [PATCH] blk: start bypass mode in blk_unregister_queue Aaron Lu
@ 2013-04-04 14:03 ` Tejun Heo
2013-04-04 14:16 ` Aaron Lu
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2013-04-04 14:03 UTC (permalink / raw)
To: Aaron Lu; +Cc: Jens Axboe, linux-kernel@vger.kernel.org, Alan Stern
On Thu, Apr 04, 2013 at 10:01:14PM +0800, Aaron Lu wrote:
> In blk_register_queue, we will end bypass mode for the queue; but in
> blk_unregister_queue, we didn't start bypass mode for it. This would
> cause the WARN_ON_ONCE(q->bypass_depth < 0) to trigger if the queue gets
> registered, unregistered and then again registered, e.g. unload scsi
> cdrom module driver sr_mod and then reload it will trigger such a
> warning.
>
> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Is this something which actually happens? Why would an unregistered
queue registered again? Do we even support that?
Starting a bypass mode can be very expensive and some drivers create
and destroy a lot of queues during probing. We don't want a call to
blk_queue_bypass_start() on every queue creation / destruction cycle.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk: start bypass mode in blk_unregister_queue
2013-04-04 14:03 ` Tejun Heo
@ 2013-04-04 14:16 ` Aaron Lu
2013-04-04 14:20 ` Tejun Heo
0 siblings, 1 reply; 5+ messages in thread
From: Aaron Lu @ 2013-04-04 14:16 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jens Axboe, linux-kernel@vger.kernel.org, Alan Stern
On 04/04/2013 10:03 PM, Tejun Heo wrote:
> On Thu, Apr 04, 2013 at 10:01:14PM +0800, Aaron Lu wrote:
>> In blk_register_queue, we will end bypass mode for the queue; but in
>> blk_unregister_queue, we didn't start bypass mode for it. This would
>> cause the WARN_ON_ONCE(q->bypass_depth < 0) to trigger if the queue gets
>> registered, unregistered and then again registered, e.g. unload scsi
>> cdrom module driver sr_mod and then reload it will trigger such a
>> warning.
>>
>> Signed-off-by: Aaron Lu <aaron.lu@intel.com>
>
> Is this something which actually happens? Why would an unregistered
> queue registered again? Do we even support that?
It probably wouldn't happen for normal user, only for some SCSI driver
developers like me, e.g. the sr_mod will normally load during boot, and
when I made some changes to the code, I'll unload the driver and reload
it. This is found when I was developing ZPODD code and I just found some
time to see what happened.
The queue for the scsi device will always be there, the queue(and the
device) will not go away on driver unregistration. So it will be left in
normal mode, and on next blk_register_queue call, the warning will show
up.
>
> Starting a bypass mode can be very expensive and some drivers create
> and destroy a lot of queues during probing. We don't want a call to
> blk_queue_bypass_start() on every queue creation / destruction cycle.
By expensive, do you mean the drain of the queue? Since the queue is to
be unregistered, I suppose the queue has to be drained somewhere?
Thanks,
Aaron
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk: start bypass mode in blk_unregister_queue
2013-04-04 14:16 ` Aaron Lu
@ 2013-04-04 14:20 ` Tejun Heo
2013-04-04 14:24 ` Aaron Lu
0 siblings, 1 reply; 5+ messages in thread
From: Tejun Heo @ 2013-04-04 14:20 UTC (permalink / raw)
To: Aaron Lu; +Cc: Jens Axboe, linux-kernel@vger.kernel.org, Alan Stern
Hello,
On Thu, Apr 04, 2013 at 10:16:39PM +0800, Aaron Lu wrote:
> It probably wouldn't happen for normal user, only for some SCSI driver
> developers like me, e.g. the sr_mod will normally load during boot, and
> when I made some changes to the code, I'll unload the driver and reload
> it. This is found when I was developing ZPODD code and I just found some
> time to see what happened.
Does that unregister and register the same queue? Ah, crap, it does.
> The queue for the scsi device will always be there, the queue(and the
> device) will not go away on driver unregistration. So it will be left in
> normal mode, and on next blk_register_queue call, the warning will show
> up.
>
> > Starting a bypass mode can be very expensive and some drivers create
> > and destroy a lot of queues during probing. We don't want a call to
> > blk_queue_bypass_start() on every queue creation / destruction cycle.
>
> By expensive, do you mean the drain of the queue? Since the queue is to
> be unregistered, I suppose the queue has to be drained somewhere?
The problematic one is synchronize_rcu(). It adds up pretty quickly.
I'd suggest just skipping blk_queue_bypass_end() during registration
if the queue is not bypassing.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk: start bypass mode in blk_unregister_queue
2013-04-04 14:20 ` Tejun Heo
@ 2013-04-04 14:24 ` Aaron Lu
0 siblings, 0 replies; 5+ messages in thread
From: Aaron Lu @ 2013-04-04 14:24 UTC (permalink / raw)
To: Tejun Heo; +Cc: Jens Axboe, linux-kernel@vger.kernel.org, Alan Stern
On 04/04/2013 10:20 PM, Tejun Heo wrote:
> Hello,
>
> On Thu, Apr 04, 2013 at 10:16:39PM +0800, Aaron Lu wrote:
>> It probably wouldn't happen for normal user, only for some SCSI driver
>> developers like me, e.g. the sr_mod will normally load during boot, and
>> when I made some changes to the code, I'll unload the driver and reload
>> it. This is found when I was developing ZPODD code and I just found some
>> time to see what happened.
>
> Does that unregister and register the same queue? Ah, crap, it does.
>
>> The queue for the scsi device will always be there, the queue(and the
>> device) will not go away on driver unregistration. So it will be left in
>> normal mode, and on next blk_register_queue call, the warning will show
>> up.
>>
>>> Starting a bypass mode can be very expensive and some drivers create
>>> and destroy a lot of queues during probing. We don't want a call to
>>> blk_queue_bypass_start() on every queue creation / destruction cycle.
>>
>> By expensive, do you mean the drain of the queue? Since the queue is to
>> be unregistered, I suppose the queue has to be drained somewhere?
>
> The problematic one is synchronize_rcu(). It adds up pretty quickly.
> I'd suggest just skipping blk_queue_bypass_end() during registration
> if the queue is not bypassing.
OK, thanks for the suggestion!
-Aaron
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-04 14:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1364308501-1640-1-git-send-email-aaron.lu@intel.com>
2013-04-04 14:01 ` [PATCH] blk: start bypass mode in blk_unregister_queue Aaron Lu
2013-04-04 14:03 ` Tejun Heo
2013-04-04 14:16 ` Aaron Lu
2013-04-04 14:20 ` Tejun Heo
2013-04-04 14:24 ` Aaron Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox