Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1979882pxb; Fri, 29 Jan 2021 09:49:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyOYx5JuMrfkUCMzDpPO16V7uoVwXd44T2hvm+Er/+TFDe3Oa7kdTI4X1LRXlTSDP1lyz3Q X-Received: by 2002:a17:906:e106:: with SMTP id gj6mr5666439ejb.337.1611942561970; Fri, 29 Jan 2021 09:49:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611942561; cv=none; d=google.com; s=arc-20160816; b=w6PH4G1aQ+LgnetGu95wekl6ybzw+V2Rhg31ADDJAXA1qI20Vs7HnDsu1dSkDQ+hTC pUiIK7cTlvdCZj8uFk3uIqdEfLRKqd6Mi841Gx6nAQjpRDc9eYShAOG/eJ4wKF0Hd4gZ si+ranPc0D+ZJ+cTz8jzBu5biIIxUTHdbNoVWC22bOGHNB1f8w9GmakSCym25hLUN+MZ ct5NpD+wAzNX29tCWUo8jdD2yzI1JwhgrjqGNix2wJFU0LSAnAB2N0Ro97M13maphGLM EnaWEhML7YqkP11wKetDEm2QDL5b3prPvAgK8xCD0EO8GSP87rGPhLy5ksMw37FwCF3t LtqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EDZFBI2Ktm4KXQ9tPgJSgleFsR41D0VLMKKTpQlt7jE=; b=dpldQyH3hZQFagLdqVVDm7mLWhxUsi+G5Z9Y6j0NjNvdEtqNDlgWugz6ufm/lv83n2 XSAy6wJ3/G1BQygy1GeUBEnfyIYkwp/9G+16xef1l2gsDOT11tByr4HiSW4dquTsAVen Row362rORYmaqRP8iJsUzl2J/NJ6bI5lJIlZtdNG5fNfKuSw4kk879yqQ/53XFPXK6xn 0SysPAjMC7WFYVexaydFwchtt6Kk+hR2l+uHkcxoQGb0yeMW2NQUimqptVAOXF5LoNfu 1CzmipR+oPK25WEzvh2/a2DQRysIDbJPxj7WW6oi+J32IAQA40I7PJV57KTcaMdhbHY4 CeKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=IuqEbTEP; 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; 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 v26si5080367ejw.44.2021.01.29.09.48.55; Fri, 29 Jan 2021 09:49:21 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=IuqEbTEP; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231784AbhA2Rry (ORCPT + 99 others); Fri, 29 Jan 2021 12:47:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbhA2Rpq (ORCPT ); Fri, 29 Jan 2021 12:45:46 -0500 Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDEB7C06174A for ; Fri, 29 Jan 2021 09:45:02 -0800 (PST) Received: by mail-vs1-xe29.google.com with SMTP id b5so5296806vsh.3 for ; Fri, 29 Jan 2021 09:45:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EDZFBI2Ktm4KXQ9tPgJSgleFsR41D0VLMKKTpQlt7jE=; b=IuqEbTEPrkK8Yjt+TNSpT7KGYFeWTsU5LqUQC8NRTaE7h9rwxFwThZsM11dOqvC8t8 LTDiprN0msmL6BqkpSByeBtnhYqDtCeTtUtCShMEmT3xoABb18VjQP8n4xZSm2gCCrbP 5yH5OQqvtASpbGVsU+7HeLQoM1r/1GhdCzJIk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EDZFBI2Ktm4KXQ9tPgJSgleFsR41D0VLMKKTpQlt7jE=; b=rIjjaC8JeaS4KCeDB719X2wMhnzgXc7gjnh0xBUUieZb05gYZtFFuru8hv75HVqDzQ fmynFh2u17yWDJbrfjg1GAnOwhvQl8FoU0RogzPbs0DuBUI9koHlr6+Gv5InMrwWqJxu vd0FoEoiHwJMaxNgrA3bv0GsiEUnX5XCdqds/vJylu275IUrekjzW4EbYxlP8gY4dxAD LBNId0AGBGKGHtE5kiFAO/zfJxxxycge7rbxNeslrmN04YjbgG5AedtsguQM+BT9MWQU BK3ryvs88dbr6sRorfrO7SUwI/pCXfEZqtrI5E5yWXCqiaveCxPGRwzor6qTcCKay/eT bDMg== X-Gm-Message-State: AOAM532ogNI2CGnsKs9DF7q3uhA0L2ui7oQYhtt3vrs1Z7RPPtBWSERq KWYf1pjU6AueMSMWUueDOZYJFVA4OCPwBpjI1SYT8A== X-Received: by 2002:a67:e353:: with SMTP id s19mr3528765vsm.53.1611942302009; Fri, 29 Jan 2021 09:45:02 -0800 (PST) MIME-Version: 1.0 References: <20210128163313.426404-1-hdegoede@redhat.com> <20210128163313.426404-2-hdegoede@redhat.com> In-Reply-To: <20210128163313.426404-2-hdegoede@redhat.com> From: Abhishek Pandit-Subedi Date: Fri, 29 Jan 2021 09:44:50 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] Bluetooth: hci_h5: Disable the hci_suspend_notifier for btrtl devices To: Hans de Goede Cc: Marcel Holtmann , Johan Hedberg , Bluez mailing list , Luiz Augusto von Dentz , Vasily Khoruzhick , max.chou@realtek.com, Alex Lu , hildawu@realtek.com, Claire Chang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi, On Thu, Jan 28, 2021 at 8:34 AM Hans de Goede wrote: > > The hci_suspend_notifier which was introduced last year, is causing > problems for uart attached btrtl devices. These devices may loose their > firmware and their baudrate setting over a suspend/resume. > > Since we don't even know the baudrate after a suspend/resume recovering > from this is tricky. The driver solves this by treating these devices > the same as USB BT HCIs which drop of the bus during suspend. > > Specifically the driver: > 1. Simply unconditionally turns the device fully off during > system-suspend to save maximum power. > 2. Calls device_reprobe() from a workqueue to fully re-init the device > from scratch on system-resume (unregistering the old HCI and > registering a new HCI). > > This means that these devices do not benefit from the suspend / resume > handling work done by the hci_suspend_notifier. At best this unnecessarily > adds some time to the suspend/resume time. > > But in practice this is actually causing problems: > > 1. These btrtl devices seem to not like the HCI_OP_WRITE_SCAN_ENABLE( > SCAN_DISABLED) request being send to them when entering the > BT_SUSPEND_CONFIGURE_WAKE state. The same request send on > BT_SUSPEND_DISCONNECT works fine, but the second one send (unnecessarily?) > from the BT_SUSPEND_CONFIGURE_WAKE transition causes the device to hang: > > [ 573.497754] PM: suspend entry (s2idle) > [ 573.554615] Filesystems sync: 0.056 seconds > [ 575.837753] Bluetooth: hci0: Timed out waiting for suspend events > [ 575.837801] Bluetooth: hci0: Suspend timeout bit: 4 > [ 575.837925] Bluetooth: hci0: Suspend notifier action (3) failed: -110 > > 2. The PM_POST_SUSPEND / BT_RUNNING transition races with the > driver-unbinding done by the device_reprobe() work. > If the hci_suspend_notifier wins the race it is talking to a dead > device leading to the following errors being logged: > > [ 598.686060] Bluetooth: hci0: Timed out waiting for suspend events > [ 598.686124] Bluetooth: hci0: Suspend timeout bit: 5 > [ 598.686237] Bluetooth: hci0: Suspend notifier action (4) failed: -110 > > In both cases things still work, but the suspend-notifier is causing > these ugly errors getting logged and ut increase both the suspend- and > the resume-time by 2 seconds. > > This commit avoids these problems by disabling the hci_suspend_notifier. > > Cc: Luiz Augusto von Dentz > Cc: Vasily Khoruzhick > Cc: Abhishek Pandit-Subedi > Signed-off-by: Hans de Goede > --- Per the other conversation thread, since the h5 driver unconditionally reprobes on resume, this change looks good as-is. Reviewed-by: Abhishek Pandit-Subedi