Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4195756ybg; Mon, 8 Jun 2020 01:18:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNWt0dC+K6b2M5HTQ33SR/168ZmGPJQ2TOO1rWq8QXJaLGjWBWp72gC8eljZmc5pUVBWwA X-Received: by 2002:a50:f044:: with SMTP id u4mr21108326edl.226.1591604333185; Mon, 08 Jun 2020 01:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591604333; cv=none; d=google.com; s=arc-20160816; b=eUDdskZyxLzG8x40JBoQ1a82FqKKasvusrKOak3KyQO8gLXATHWmUPKl8gAumPqsgS fzD7yfmKpmly3PEvemgo7LmvKTKFLDl0vpMgZDRxMgfBlSiFOwrI9Pn0up2D445PQ0mI ihUyU3jtwsvDp9NcURdsfhmg/y1/GLGuf9sQU6gmawdtUZsN44ZdUsD6SDCVjAg2O28W D4ZaoS3azN/39wZ7y9TVEbI+ZayZrCL3ADgdq/vJ2nLvGFghAPAqBzZBAFEqpZtjL5Jh IXjL/3pfJNdogQyq/tKYORV2KAswSkQiG8atLoNgYqD3u2ezR2HuXijiYcIjcRu8rdfP IkQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=mlxpsD6ypGapmeeiFuStiRMmcjlJd0t6bBx7O91ehkw=; b=oKW1gwMb5Qs+vhjwa+bvjroxgBVA8X0+xmTaA1PSZOIkYJprXVMgoNnat54pJh7ke+ miaKCfP2WvNRSpMa3b+MEaV2qzMEkGJo+/N0hv6pJvVIn3JPjkfXf/Wn2r8MJ/sd6z0+ 4UCzmGng6SgZvWL2B6vSUI4OuksDp6Xp5fUNLZK4k89j1K3QXMCBSKgHPWIFgScRaddO p8MhhvCl21/wiQjE2NjCcRSadDm34jywLIgV5qZ9LiWcXAwlAhb6iaQ05H6C7dgRq1kV gMY9rPhXghytef9xkqGbo5qQq0V5U5qUXqwqmqbJQiwz3M2VrhOLTWaC6NBK7b6LJocc zGXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si8568503edw.278.2020.06.08.01.18.28; Mon, 08 Jun 2020 01:18:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729124AbgFHIRI convert rfc822-to-8bit (ORCPT + 99 others); Mon, 8 Jun 2020 04:17:08 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:52107 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729085AbgFHIRI (ORCPT ); Mon, 8 Jun 2020 04:17:08 -0400 Received: from marcel-macpro.fritz.box (p5b3d2638.dip0.t-ipconnect.de [91.61.38.56]) by mail.holtmann.org (Postfix) with ESMTPSA id A3843CEC82; Mon, 8 Jun 2020 10:26:54 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH v3] Bluetooth: Allow suspend even when preparation has failed From: Marcel Holtmann In-Reply-To: <20200605135009.v3.1.I0ec31d716619532fc007eac081e827a204ba03de@changeid> Date: Mon, 8 Jun 2020 10:17:05 +0200 Cc: Bluez mailing list , len.brown@intel.com, ChromeOS Bluetooth Upstreaming , linux-pm@vger.kernel.org, rafael@kernel.org, todd.e.brandt@linux.intel.com, rui.zhang@intel.com, "David S. Miller" , Johan Hedberg , netdev , open list , Jakub Kicinski Content-Transfer-Encoding: 8BIT Message-Id: <24703FC2-32D1-434A-84FC-7111BEC45C2F@holtmann.org> References: <20200605135009.v3.1.I0ec31d716619532fc007eac081e827a204ba03de@changeid> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Abhishek, > It is preferable to allow suspend even when Bluetooth has problems > preparing for sleep. When Bluetooth fails to finish preparing for > suspend, log the error and allow the suspend notifier to continue > instead. > > To also make it clearer why suspend failed, change bt_dev_dbg to > bt_dev_err when handling the suspend timeout. > > Fixes: dd522a7429b07e ("Bluetooth: Handle LE devices during suspend") > Reported-by: Len Brown > Signed-off-by: Abhishek Pandit-Subedi > --- > To verify this is properly working, I added an additional change to > hci_suspend_wait_event to always return -16. This validates that suspend > continues even when an error has occurred during the suspend > preparation. > > Example on Chromebook: > [ 55.834524] PM: Syncing filesystems ... done. > [ 55.841930] PM: Preparing system for sleep (s2idle) > [ 55.940492] Bluetooth: hci_core.c:hci_suspend_notifier() hci0: Suspend notifier action (3) failed: -16 > [ 55.940497] Freezing user space processes ... (elapsed 0.001 seconds) done. > [ 55.941692] OOM killer disabled. > [ 55.941693] Freezing remaining freezable tasks ... (elapsed 0.000 seconds) done. > [ 55.942632] PM: Suspending system (s2idle) > > I ran this through a suspend_stress_test in the following scenarios: > * Peer classic device connected: 50+ suspends > * No devices connected: 100 suspends > * With the above test case returning -EBUSY: 50 suspends > > I also ran this through our automated testing for suspend and wake on > BT from suspend continues to work. > > > Changes in v3: > - Changed printf format for unsigned long > > Changes in v2: > - Added fixes and reported-by tags > > net/bluetooth/hci_core.c | 17 ++++++++++------- > 1 file changed, 10 insertions(+), 7 deletions(-) patch has been applied to bluetooth-next tree. Regards Marcel