From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout3.samsung.com ([203.254.224.33]:44751 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753485AbeFOAwZ (ORCPT ); Thu, 14 Jun 2018 20:52:25 -0400 MIME-version: 1.0 Content-transfer-encoding: 8BIT Content-type: text/plain; charset="utf-8" Message-id: <5B230DC0.3050000@samsung.com> Date: Fri, 15 Jun 2018 09:52:16 +0900 From: Chanwoo Choi To: "H. Nikolaus Schaller" , Roger Quadros Cc: Linux Kernel Mailing List , chanwoo@kernel.org, myungjoo.ham@samsung.com, stable , Kishon Vijay Abraham I , Tony Giaccone Subject: Re: [PATCH] extcon: Release locking when sending the notification of connector state In-reply-to: <764C1A35-7D06-48AD-8809-0F6BB3526A23@goldelico.com> References: <1528949687-32002-1-git-send-email-cw00.choi@samsung.com> <5B22410C.9080002@samsung.com> <9AEF5153-4234-4C30-984A-8A3D51D04623@goldelico.com> <764C1A35-7D06-48AD-8809-0F6BB3526A23@goldelico.com> Sender: stable-owner@vger.kernel.org List-ID: Hi Roger, If possible, Could you please review this patch? Regards, Chanwoo Choi On 2018년 06월 14일 20:33, H. Nikolaus Schaller wrote: > >> Am 14.06.2018 um 12:39 schrieb H. Nikolaus Schaller : >> >> Hi Roger and Chanwoo, >> >>> Am 14.06.2018 um 12:18 schrieb Chanwoo Choi : >>> >>> + H. Nikolaus Schaller >>> >>> On 2018년 06월 14일 13:14, Chanwoo Choi wrote: >>>> Previously, extcon used the spinlock before calling the notifier_call_chain >>>> to prevent the scheduled out of task and to prevent the notification delay. >>>> When spinlock is locked for sending the notification, deadlock issue >>>> occured on the side of extcon consumer device. To fix this issue, >>>> extcon consumer device should always use the work. it is always not >>>> reasonable to use work. >>>> >>>> To fix this issue on extcon consumer device, release locking when sending >>>> the notification of connector state. >>>> >>>> Fixes: ab11af049f88 ("extcon: Add the synchronization extcon APIs to support the notification") >>>> Cc: stable@vger.kernel.org >>>> Cc: Roger Quadros >>>> Cc: Kishon Vijay Abraham I >>>> Signed-off-by: Chanwoo Choi >>>> --- >>>> drivers/extcon/extcon.c | 3 ++- >>>> 1 file changed, 2 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c >>>> index 8bff5fd18185..f75b08a45d4e 100644 >>>> --- a/drivers/extcon/extcon.c >>>> +++ b/drivers/extcon/extcon.c >>>> @@ -433,8 +433,8 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id) >>>> return index; >>>> >>>> spin_lock_irqsave(&edev->lock, flags); >>>> - >>>> state = !!(edev->state & BIT(index)); >>>> + spin_unlock_irqrestore(&edev->lock, flags); >>>> >>>> /* >>>> * Call functions in a raw notifier chain for the specific one >>>> @@ -448,6 +448,7 @@ int extcon_sync(struct extcon_dev *edev, unsigned int id) >>>> */ >>>> raw_notifier_call_chain(&edev->nh_all, state, edev); >>>> >>>> + spin_lock_irqsave(&edev->lock, flags); >>>> /* This could be in interrupt handler */ >>>> prop_buf = (char *)get_zeroed_page(GFP_ATOMIC); >>>> if (!prop_buf) { >>>> >> >> I have tested on the Pyra handheld prototype and now it works. Plugging in an OTG cable >> enables/disables OTG power as expected and there are no kernel oops any more. > > I did take some minutes to check and it now also works again on the OMAP5EVM. > > BR, > Nikolaus > >