Re: [PATCH v1] proc/vmcore: fix false positive lockdep warning

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

 



On 19.01.22 16:15, David Hildenbrand wrote:
> On 19.01.22 16:08, Boqun Feng wrote:
>> Hi,
>>
>> On Wed, Jan 19, 2022 at 12:37:02PM +0100, David Hildenbrand wrote:
>>> Lockdep complains that we do during mmap of the vmcore:
>>> 	down_write(mmap_lock);
>>> 	down_read(vmcore_cb_rwsem);
>>> And during read of the vmcore:
>>> 	down_read(vmcore_cb_rwsem);
>>> 	down_read(mmap_lock);
>>>
>>> We cannot possibly deadlock when only taking vmcore_cb_rwsem in read
>>> mode, however, it's hard to teach that to lockdep.
>>>
>>
>> Lockdep warned about the above sequences because rw_semaphore is a fair
>> read-write lock, and the following can cause a deadlock:
>>
>> 	TASK 1			TASK 2		TASK 3
>> 	======			======		======
>> 	down_write(mmap_lock);
>> 				down_read(vmcore_cb_rwsem)
>> 						down_write(vmcore_cb_rwsem); // blocked
>> 	down_read(vmcore_cb_rwsem); // cannot get the lock because of the fairness
>> 				down_read(mmap_lock); // blocked
>> 	
>> IOW, a reader can block another read if there is a writer queued by the
>> second reader and the lock is fair.
>>
>> So there is a deadlock possiblity.
> 
> Task 3 will never take the mmap_lock before doing a
> down_write(vmcore_cb_rwsem).
> 
> How would this happen?

Ah, I get it, nevermind. I'll adjust the patch description.

Thanks!

-- 
Thanks,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux