Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp753371pxk; Wed, 9 Sep 2020 19:08:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHFifq/Liz3KUo7yco83WD+yVdgLn94d7KRR4a9pd0xugDngCXxfTQyFEQUAS9V0J5Fx9q X-Received: by 2002:a17:906:341b:: with SMTP id c27mr6474316ejb.286.1599703700255; Wed, 09 Sep 2020 19:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599703700; cv=none; d=google.com; s=arc-20160816; b=Yv/sTGP1gjba8KP4RKxDajxf02joVmUOOJpmmfu7idG/TlNZpeDJC+vwrYklLW47Gd rWsD+beI71OyD3bVoNj4Kq4AdeqSD9YjiGN+iIBW7plIGTQgCg/DbL1uQ7yIzmHe1V0v QWVpExwUBCYHA2+aMF6D3L2Pl/FdlxjkhEWRsoziXTAwG8VCREwg/vF+JLpcWSm6tHki QIUhk0EaY51DnbTrcTFTh9Y168L+E1U9zZIBf80vArFMHJ0Ip5pZv+Jiyh75f+52fg2/ 7HLffWR1A2nIQK1WPB16GHq9CTtUlcTU0DZr4xd8YpxI5irw2ERGK0H3l6++vVXy/jqO f0Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=gTez5zBL4O/mFCX1yAYIY6uoJGixvvecrhH5yeefCRU=; b=TSCWy3sj4qaEjZtkXB1RID8zZPJHeQGo996AacBzBuKdN6JMK67sHy3zplkqe7rb2j S2woVNGOuzfllI8l/UutU60xVikt4+Gl5qB3GN7UPLZFA4hw/zo7Errs8R2rO68lS4Zc fWrmcXsoZnceIs9oGFhEviemh0qeRLDBlrpPZTU6FTbs1b79uOYJRXBnHhr8MNwg5G1Z ugQnVedoDhEzex3AViSDLnz825jMNzPvtEEyrQ9t7XjYe+wXCMiCu+C6jLvtjWKZpDv2 V4HyLEB4qWTs4Y6BJrFSyr6/sNb4ebRkZ8laL9QMA7rRR09jsW6TiHdCDlj9ImhVoOhk L+zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b0zJlrJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds1si2969805ejc.279.2020.09.09.19.07.57; Wed, 09 Sep 2020 19:08:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=b0zJlrJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730555AbgIJCDF (ORCPT + 99 others); Wed, 9 Sep 2020 22:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729507AbgIJBk6 (ORCPT ); Wed, 9 Sep 2020 21:40:58 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B46C061342 for ; Wed, 9 Sep 2020 18:40:57 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id s65so2300473pgb.0 for ; Wed, 09 Sep 2020 18:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gTez5zBL4O/mFCX1yAYIY6uoJGixvvecrhH5yeefCRU=; b=b0zJlrJ3/FxkSGhXn87cvP+RTMUhelRrCM1riW4kT7+txcP800FsUvP6kSl1Tx+BQ9 nlnSbaIdcJf/ctfzMo8lklWjGAlMfBcz670pLHXNIAzEyKNqQRUVeGBFLUGnDrDQvmmo LiL1peql9jifg/8mL5CDMgP9HFRyzTX8uyAco= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gTez5zBL4O/mFCX1yAYIY6uoJGixvvecrhH5yeefCRU=; b=AZi8rafTABa/JTVIjxuffU9/ZGTYjkrycu47HfvE56mV4lXSOQCTNExsJ6dnucuFf5 G4ZZYpOaHTT3VaVNPX+INos2uT1hTQKxY3z/3EbdtlLAo+lNktJtGJ23Ilwy3oWit1Pi 2pmSH1ICq9lCGHus21IShlkCu1Up5rA6zIQtOxocyY5DgOM7uS8CUQqAXGVEERuGrVtU FTIRHqECb0wWD5zfRrTzC7mjoS9EDm7KG+zRsOOHkrpuSU6VG2TtJLqA0/+bxhqVpX0r rewHbMm9/7UaVNCEBO83WQX6IOMAW7f0s9FBgi42Ixmo6g77IdsFmFZI0a9N2l9dhRmU Unfg== X-Gm-Message-State: AOAM533jfd/CZuhUkqWVtOFuKlOX6PoNySNMzIjov47UPuiGpBdYlc4k xk+RuJweeJkJ2xfbNBCwOszaOQ== X-Received: by 2002:a63:d25:: with SMTP id c37mr2501235pgl.403.1599702057352; Wed, 09 Sep 2020 18:40:57 -0700 (PDT) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:7220:84ff:fe09:2b94]) by smtp.gmail.com with ESMTPSA id j19sm3885366pfi.51.2020.09.09.18.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Sep 2020 18:40:56 -0700 (PDT) From: Abhishek Pandit-Subedi To: linux-bluetooth@vger.kernel.org Cc: marcel@holtmann.org, Abhishek Pandit-Subedi , "David S. Miller" , Johan Hedberg , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jakub Kicinski Subject: [PATCH] Bluetooth: Re-order clearing suspend tasks Date: Wed, 9 Sep 2020 18:40:06 -0700 Message-Id: <20200909183952.1.Ie55bb8dde9847e8005f24402f3f2d66ea09cd7b2@changeid> X-Mailer: git-send-email 2.28.0.618.gf4bc123cb7-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unregister_pm_notifier is a blocking call so suspend tasks should be cleared beforehand. Otherwise, the notifier will wait for completion before returning (and we encounter a 2s timeout on resume). Fixes: 0e9952804ec9c8 (Bluetooth: Clear suspend tasks on unregister) Signed-off-by: Abhishek Pandit-Subedi --- Should have caught that unregister_pm_notifier was blocking last time but when testing the earlier patch, I got unlucky and saw that the error message was never hit (the suspend timeout). When re-testing this patch on the same device, I was able to reproduce the problem on an older build with the 0e9952804ec9c8 but not on a newer build with the same patch. Changing the order correctly fixes it everywhere. Confirmed this by adding debug logs in btusb_disconnect and hci_suspend_notifier to confirm what order things were getting called. Sorry about the churn. Next I'm going try to do something about the palm shaped indentation on my forehead... net/bluetooth/hci_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index efc0fe2b47dac2..be9cdf5dabe5dc 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3794,8 +3794,8 @@ void hci_unregister_dev(struct hci_dev *hdev) cancel_work_sync(&hdev->power_on); - unregister_pm_notifier(&hdev->suspend_notifier); hci_suspend_clear_tasks(hdev); + unregister_pm_notifier(&hdev->suspend_notifier); cancel_work_sync(&hdev->suspend_prepare); hci_dev_do_close(hdev); -- 2.28.0.618.gf4bc123cb7-goog