Re: Lock Constrains about Fast Dispatch for Messenger

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

 



Thanks!

On Tue, Dec 2, 2014 at 11:03 PM, Gregory Farnum <greg@xxxxxxxxxxx> wrote:
> On Tue, Dec 2, 2014 at 12:26 AM, Haomai Wang <haomaiwang@xxxxxxxxx> wrote:
>> Hi Gregoy and Sage,
>>
>> I'm just writing Messenger's unit tests to ensure that SimpleMessenger and
>> AsyncMessenger behavior same and expected.
>>
>> I think the most unclear thing is the lock rule of fast dispatch. When
>> introduced fast dispatch, there exists three methods "ms_fast_connect",
>> "ms_fast_accept", "ms_fast_dispatch" will be called within Messenger's
>> thread. Because without fast dispatcher all messages are delivered from
>> queue to queue, fast path will result in potential dead lock I think.
>>
>> "ms_fast_accept" and "ms_fast_connect" are called with "pipe_lock"(Pipe) or
>> "lock"(AsyncConnection). And Connection::send_message will called outsider.
>> So it may happen:
>>
>> Other thread                   Messenger's thread
>>        lock()                          connection lock()
>>   send_message()                  connect
>>  try connection lock()         ms_fast_connect()
>>
>>                           DEAD LOCK
>
> Sorry, which lock() is the "Other thread" calling? It's not like
> anybody can access the Pipe's lock before it has been connect()ed.
> Or perhaps you're referring to some kind of global lock that you're
> worried ms_fast_connect() will try and access? In that case, yes, the
> rules on locking within the Dispatcher *fast* functions are very
> strict. We basically don't want any of them to take locks at all; in
> the case of the OSD we don't quite manage that and have had to dance
> through a number of hoops to avoid various tight races, but we're very
> close.
> -Greg



-- 
Best Regards,

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




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux