Re: possible race condition for usb_stor_port_reset and usb_reset_and_verify_device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 10 Jul 2015, yoma sophian wrote:

> hi Alan:
> 
> 2015-05-27 22:40 GMT+08:00 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>:
> > On Wed, 27 May 2015, yoma sophian wrote:
> >
> >> After reading the kernel power document, freezing-of-tasks.txt , can I
> >> get the below conclusion:
> >> if I put my thread in freezable, it will get frozen automatically
> >> whenever the system goes in to suspend or hibernate.
> >
> > It's not entirely automatic.  Your thread has to call try_to_freeze()
> > at appropriate spots.  Of course, if your thread is a work queue then
> > the workqueue core will do that for you.
> after tracing more kernel based your guide, may I get below conclusion:
> if I try to create a thread that will do the IO
> 1. create the thread, with set_freezable, and call try_to_freeze() at
> appropriate spots.
> 2. hook my thread on system_freezable_wq
>      such as calling queue_delayed_work(system_freezable_wq, &mythread, intv)
>      or mod_delayed_work((system_freezable_wq, &mythread, intv)
> 
> is hub_thread the 1st kind?

It depends on which kernel you're looking at.  Up until commit 
32a6958998c5, which was added in the 3.18 kernel, hub_thread was the 
1st kind.

In the 3.18 kernel, hub_thread was replaced by a freezable workqueue
different from system_freezable_wq.

> if Yes, where it try_to_freeze?

Before 3.18, try_to_freeze was checked inside wait_event_freezable(),
which was called in hub_thread().

> And why not make hub_thread as above #2 kind?

We probably could, but it works okay the way it is now.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux