From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932415AbcHIU4V (ORCPT ); Tue, 9 Aug 2016 16:56:21 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:29642 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751774AbcHIU4U (ORCPT ); Tue, 9 Aug 2016 16:56:20 -0400 Subject: Re: [PATCH] device probe: add self triggered delayed work request To: Shamir Rabinovitch References: <20160808104250.GA12480@shamir-linux.uk.oracle.com> <57A91F5D.1060605@oracle.com> <20160809101122.GA30759@shamir-linux.uk.oracle.com> Cc: Greg Kroah-Hartman , Grant Likely , Santosh Shilimkar , linux-kernel@vger.kernel.org From: Qing Huang Message-ID: <57AA43CB.5050209@oracle.com> Date: Tue, 9 Aug 2016 13:57:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <20160809101122.GA30759@shamir-linux.uk.oracle.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/09/2016 03:11 AM, Shamir Rabinovitch wrote: > On Mon, Aug 08, 2016 at 05:10:05PM -0700, Qing Huang wrote: >> Not sure if I understood your scenario. Why there is a deadlock here? >> > CPU0 | CPU1 > --------------------------------------------------------------------------------------------- > driver_deferred_probe_add | driver_deferred_probe_trigger_wrapper > mutex_lock(&deferred_probe_mutex) | driver_deferred_probe_trigger > cancel_delayed_work(&deferred_probe_trigger_work) | mutex_lock(&deferred_probe_mutex) > wait for "driver_deferred_probe_trigger_wrapper" | wait for "deferred_probe_mutex" > > is this possible scenario with this patch? > > if yes then CPU0 will wait for CPU1 to finish the delayed work whith > mutex deferred_probe_mutex held while CPU1 will try to finish the > delayed work and will wait for the same mutex forever. CPU0 will not wait for "driver_deferred_probe_trigger_wrapper" to finish, it simply puts the work request onto the queue and returns. Qing > > it seems like dead lock scenario to me. > > please say if this scenario is possible. > > BR, Shamir Rabinovitch