Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp962899imm; Fri, 29 Jun 2018 09:06:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJgM6NOhpPtY40GixhJ+9o0SS2SfB4phml4XXaTqyBN9Qs1FtIeKazcr3cNwofscHkLniOT X-Received: by 2002:a17:902:788e:: with SMTP id q14-v6mr15284013pll.234.1530288407314; Fri, 29 Jun 2018 09:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530288407; cv=none; d=google.com; s=arc-20160816; b=dxA986mNlRJjGhp2zAbVlZ9fnMLKUaOCHtpRp/pNoej9Elxr/p1xD72B9Z7rJXN1Cu gSBHoqKijTpKtVgxFNot4LvYgmerJx/DN0zFpVetv4ZKYVUOkyTZK1yH5rG+mCA6zSLu U1zreNA233omWuwxaVHE3HI++Pkk9ZBH2AV2wvstRFOcy+r2/MwdPvkEQMFfpths1DP3 XcnLS0uYbNwgjkTDHi7zfUPvuviyOzjnHwBvDbG+CBqZVlmi0q+DrGcg+QRn/hs7sTCl M46Uz8zjLBnxgL+2rWiU20gSTgAr4F5Fq/Ckzby7Y8qAOVfgy4IV4nazPVsrvW4sImbh YW3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from :arc-authentication-results; bh=g9oHCOUhPE7IViVHFcB56w7BAZ90iDuyvULcgkYUL6w=; b=OeII0cJis+qCHbMjj69nHWZJS8ABc5gy8RtUoI6HimSXlIZDWcWoVf/2JW/ARR6a/N XGAtGHJkqDqAKeZZUKOH1Zql2kTulfkYVcHDX8LUqsk/QHNEkaXV4CmvEzkYXBjvKqxl 38mQ77lrjxP5+E340hYOG3KNar63pX3MHzXLtojXIAvJ5CHmSJcns0wKqsTWzroY4slS qAi0JbTicSZZGi06KrBFKPiTUXHUanalbK0C1FgRqcuaKEa8s0XQ4qSY4swFPTjGKW1r 50Jo39grtIa80jLT9WZLVMEgNMg8f7+466EEZ1YNZ2OvGwn+FdN3lJwBmy7ff/ONUTY8 un+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si8104218pgq.457.2018.06.29.09.06.31; Fri, 29 Jun 2018 09:06:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936542AbeF2NVZ (ORCPT + 99 others); Fri, 29 Jun 2018 09:21:25 -0400 Received: from smtp01.smtpout.orange.fr ([80.12.242.123]:52334 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753527AbeF2NVW (ORCPT ); Fri, 29 Jun 2018 09:21:22 -0400 Received: from belgarion ([90.55.203.186]) by mwinf5d48 with ME id 4dMK1y00A41oiFu03dMKv8; Fri, 29 Jun 2018 15:21:21 +0200 X-ME-Helo: belgarion X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Fri, 29 Jun 2018 15:21:21 +0200 X-ME-IP: 90.55.203.186 From: Robert Jarzmik To: Felipe Balbi Cc: Jia-Ju Bai , gregkh@linuxfoundation.org, nicolas.ferre@microchip.com, keescook@chromium.org, allen.lkml@gmail.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] usb: gadget: r8a66597: Fix two possible sleep-in-atomic-context bugs in init_controller() References: <20180620035453.7721-1-baijiaju1990@gmail.com> <87efh0o6f9.fsf@belgarion.home> <87y3eydrs1.fsf@linux.intel.com> <87efgqkrzl.fsf@belgarion.home> <87k1qhevpd.fsf@linux.intel.com> <87a7rdlup1.fsf@belgarion.home> <87bmbtetdk.fsf@linux.intel.com> X-URL: http://belgarath.falguerolles.org/ Date: Fri, 29 Jun 2018 15:21:19 +0200 In-Reply-To: <87bmbtetdk.fsf@linux.intel.com> (Felipe Balbi's message of "Fri, 29 Jun 2018 14:15:19 +0300") Message-ID: <876021lods.fsf@belgarion.home> User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Felipe Balbi writes: > Hi, > > Robert Jarzmik writes: >>>> And as bonus question, why is it better to have mdelay() calls in the driver ? >>> >>> As a bugfix, it's the smallest fix possible, right? Ideally, we wouldn't >>> need either of them. Perhaps there's a bit which can be polled instead? >> Ideally yes. Do you remember if a "threaded interrupt" might use msleep() ? I >> seem to remember that they can, so won't that be another alternative ? > > yeah, unless, of course, you have a spinlock held. ;-) Ah yes, unless that :) I would have proposed to call the disconnect out of the spinlock path, but looking at the r8a66592_usb_disconnect(), with its spinlock flip-flop, I loose heart ... And even if I still think no mdelay() should be used, because of the kernel stall (and global uniprocessor stall), I won't argue anymore. After all, if you let in the mdelay(), perhaps the maintainers will agree to review their architecture and drop the locks or sleeps in interrupt context in a follow-up patch, who knows ... Cheers. -- Robert