Re: [PATCH] Avoid that ATA error handling hangs

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

 



Bart,

On 2/22/18 13:39, Bart Van Assche wrote:
> On Thu, 2018-02-22 at 04:39 +0000, Bart Van Assche wrote:
>> On Thu, 2018-02-22 at 04:19 +0000, Damien Le Moal wrote:
>>> It looks OK to me, at least if CONFIG_DEBUG_OBJECTS_RCU_HEAD is turned
>>> off since the init_rcu_head() and destroy_rcu_head() functions only care
>>> about that.
>>>
>>> With rcu head debug turned on, I am not so sure. The object debug code
>>> will have references to unused rcu heads left behind for unused scsi
>>> cmds, which are indeed dynamically allocated for a device together with
>>> requests when the device is initialized, but they are never freed until
>>> the device is removed. So "dynamically allocated object", yes, but that
>>> does not match the use of the object done in scsi (i.e. alloc before use
>>> + free after use).
>>
>> Hello Damien,
>>
>> Please have a look at the following part of
>> Documentation/RCU/Design/Requirements/Requirements.html:
>>
>> 	Similarly, statically allocated non-stack <tt>rcu_head</tt>
>> 	structures must be initialized with <tt>init_rcu_head()</tt>
>> 	and cleaned up with <tt>destroy_rcu_head()</tt>.
> 
> And from <linux/rcupdate.h>:
> 
>  * rcu_head structures
>  * allocated dynamically in the heap or defined statically don't need any
>  * initialization.

Yes, I understood that. But my guess is this comment implies that the
objects are freed after use, which clears any reference to it from the
memory object debug hash automatically. That is not the case with scsi
command structs: there are allocated dynamically with the device, but
they are not freed after use. And here by use, I mean the normal use
cycle of a request+cmd: get unused request -> issue command -> command
completed -> return request in free state.
That is not an alloc+free cycle, so the memory object debug code will
never be involved and the scsi command rcu head never destroyed.

Considering that, I am not sure if it is really safe to remove the
init/destroy rcu head functions. At the very least, that will make the
memory object debug table grow larger with the first use of any scsi
command.

Cheers.

-- 
Damien Le Moal,
Western Digital




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]