Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp564188imm; Fri, 29 Jun 2018 02:38:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpei79N+uJ47V6Av9GyAocUkxJKiSLUmdxbDXpRLw+xlcvAMSIS5GG4d8wdu/0D50Dx6Apwt X-Received: by 2002:aa7:8004:: with SMTP id j4-v6mr13649272pfi.174.1530265120513; Fri, 29 Jun 2018 02:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530265120; cv=none; d=google.com; s=arc-20160816; b=ZnLo9qlNJDOIxgqh/plemW6gBzBiMPGhybYwhFlo3+c0wQyj6l6F8jfVyQkt6fjICm SPwu3GQDUROYug5Y5UNz3hPfqtUAXmPAkTeBE6iMoGKxdhWspqsDUvVqfAwwqEnWbWGJ fiDA6UkifGQNY9vMCoZ65/s32J7ayXa8+GPA2gADHvB4Oug4umnU/tSUiGL57azoODgE ctzigQRqPma1Lsxb/73xQtwasS+ASzDUXFkC6lqAR4QMC2ZP6dampDuNMKXbgNASKWOl dYPrd2wbQw9562BNfpwScATK9glHdSGlQgOi/fo43EMyTglYIfij76x0Pr4DenVOufW4 dorA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:arc-authentication-results; bh=7CqnXGYNEq4C+WgFYFIO2mCW+BNANnF0S6xrihx4UJk=; b=G8obs3xXeybe/g7BuXK4QW7jaP6fHAK1Y6NvNiCJIVMpdNLEbkl0L5i1u70t/aB2Yl 2dEckTXl57WUQ9Tayj1H9iw162ExeUkWdFxiOAW4eEfCEn+UZTWltMdAkfVyStEEMnMM zmoIvN+TL0KOpKA+GSYTUYMuDZbVegGiajkEUUtsGI+GxHDnZ0QhKLEbfTK36Qlsr+92 U5xqyhmOlhrlRLJHuw6nHG6mchDE/3qMTxfWVVbuE+Bg+kfFCCPsDzBHVrKeq1ytv0H/ 4mp3xJRZ5Th5zkJ34YRRTouEpH0ycNbhjGVtRT36/VwWheRa53mp8KB195cZXlFe56jf iHCQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b39-v6si8619065plb.249.2018.06.29.02.38.26; Fri, 29 Jun 2018 02:38:40 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933021AbeF2Gh7 (ORCPT + 99 others); Fri, 29 Jun 2018 02:37:59 -0400 Received: from mga18.intel.com ([134.134.136.126]:31639 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932209AbeF2Gh6 (ORCPT ); Fri, 29 Jun 2018 02:37:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2018 23:37:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,285,1526367600"; d="scan'208";a="63107232" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by orsmga003.jf.intel.com with ESMTP; 28 Jun 2018 23:37:44 -0700 From: Felipe Balbi To: Robert Jarzmik , Jia-Ju Bai Cc: 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() In-Reply-To: <87efh0o6f9.fsf@belgarion.home> References: <20180620035453.7721-1-baijiaju1990@gmail.com> <87efh0o6f9.fsf@belgarion.home> Date: Fri, 29 Jun 2018 09:35:10 +0300 Message-ID: <87y3eydrs1.fsf@linux.intel.com> 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 Hi, Robert Jarzmik writes: > Jia-Ju Bai writes: > >> The driver may sleep with holding a spinlock. >> The function call paths (from bottom to top) in Linux-4.16.7 are: >> >> [FUNC] msleep >> drivers/usb/gadget/udc/r8a66597-udc.c, 839: >> msleep in init_controller >> drivers/usb/gadget/udc/r8a66597-udc.c, 96: >> init_controller in r8a66597_usb_disconnect >> drivers/usb/gadget/udc/r8a66597-udc.c, 93: >> spin_lock in r8a66597_usb_disconnect > > That should not happen... > > If think the issue you have is that your usb_connect() and usb_disconnect() are > called from interrupt context. I think the proper fix, as what is done in most > udc phys, is to schedule a workqueue, see drivers/usb/phy/phy-gpio-vbus-usb.c, > gpio_vbus_data.vbus. argh, no. No workqueues needed here. Sorry -- balbi