Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1881389pxu; Tue, 24 Nov 2020 11:05:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3lEK3QCxf1TwqM+BxZ0Aj3F5ThZRMNfAnHaOahSYNUZVgq4uOumPojLzA1QIrOJPEmLhS X-Received: by 2002:a17:906:824a:: with SMTP id f10mr5747903ejx.167.1606244747422; Tue, 24 Nov 2020 11:05:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606244747; cv=none; d=google.com; s=arc-20160816; b=fVe7AcW6jdMQippx8cnoQJMYYQ1tajZr3zyeCbHEg5rr2Ph0T1uYIKW85pWypS1Zp5 ayMreCBh+a3ybDlnaDXzfSTMFLH27nfCReJnzjZ6Uhtu8bIaBVfBt65tndTVL6iBk7CJ S/D+G5jgGg6A/9V40R6wrE9XwETUAvjhMOq8MHvzXDDlysTLRlwTr1PgR5zNgQEGAdjV sZbIPycIldfiBPgobm/KZlKFMszpqj2uC7QUCby4O6o58KIuodyxcKP3CAuHbJySmDbv aIOGq3sqUh2s+k262/LqdRV3YQ5mjytwz8NgQABnOgqVEglZuCyh6uo8kAQi1GS650TT XSUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+W7jJwGCb4X3aPAYb2bHPal61y/DMNXzXOlkAo3IyKk=; b=rpPAT6CbrUSlSDaoemU+OM+cOqTlMcjG/vbdifUMC3wXlmHKbT6kqC17tbRMSYCVou xRSWE36aM0P6BmTU9avtwMgJdD1OaZNm4XKRTc7XswNbtUsWFBXNTtGwebiWuGSjoXzR HdCvbHH9zRYQZNczTHFYvnd2NVjVZIIGk9Aa7Mk5hkhqLqlaKPf4CvirakSuoWp2lOHB 7kdz0Ell1xOZC9Z9Iaj4FAwB5q+N48q71Vx7aZP1oJ4aRLmMdFNTXQ9IzpfgIqDdwq3B 2tsnBVzfUpnnXIkiVdlyj+8M4FJ5q2A+AhMrWQ5K1nBkop7wfkH8fGpbilTFlZgDGfQr Objg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dhla6vIb; 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 dk11si7151108ejb.542.2020.11.24.11.05.23; Tue, 24 Nov 2020 11:05:47 -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=dhla6vIb; 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 S2390932AbgKXTFN (ORCPT + 99 others); Tue, 24 Nov 2020 14:05:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390880AbgKXTFM (ORCPT ); Tue, 24 Nov 2020 14:05:12 -0500 Received: from mail-ua1-x941.google.com (mail-ua1-x941.google.com [IPv6:2607:f8b0:4864:20::941]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A763C0613D6 for ; Tue, 24 Nov 2020 11:05:12 -0800 (PST) Received: by mail-ua1-x941.google.com with SMTP id x13so7155633uar.4 for ; Tue, 24 Nov 2020 11:05:12 -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:content-transfer-encoding; bh=+W7jJwGCb4X3aPAYb2bHPal61y/DMNXzXOlkAo3IyKk=; b=dhla6vIb81DplBpzZLwmgSqIMb8/g00dQOHCA8f7CzfLhqNexO5v1F9qzMupZ/M44P JDyHyiO1hLjhNR86YyCqljUxDMrfYV0ZHB5zX8efRxxgVDl4JEfFDEvOYJSK+Aq5VWk1 iQYuKHw1wr+jCurwMWlFlJs+R16OqgXWjn7vE= 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:content-transfer-encoding; bh=+W7jJwGCb4X3aPAYb2bHPal61y/DMNXzXOlkAo3IyKk=; b=hyFT+tfKcC3meF78Eklx6z7Kh3ztDfedRJeLv9YIP99DH2hxj8oymQvNqvPAJSkLum wwwAdlJl+RQUQo3YGWuTI2I27YUTV/3kBw8dz3qq/svE5XJyPTGPOQ2Y5OWwcCVq3s9y PmxWfJSQ0K8hf+FlIZ15AK4WnI1TqqX06eR/r1fQsJahbGkyzTWWMrx2skcb/dRt32vd nEiRdkDje8eE5yvpC7qgXfW4H8c3XmhFHrXZj4klWn2cDksGUAijd9IbweetXJQo7SE7 +jYvDewCIZqZHRJFr/AkSe4V4M7lN68H4eh80i8hAdnD94VcifKHVJP07otA1d8yczIm iJtQ== X-Gm-Message-State: AOAM533mVRn7egP936xAXClfzpl6lKCVY90yqBRoWsC400jDC5RKnYrl W+yDhyKmzBm6YwdF4byZSX6AR8wFqTghZNBZbSbPCQ== X-Received: by 2002:ab0:104c:: with SMTP id g12mr4823113uab.136.1606244710878; Tue, 24 Nov 2020 11:05:10 -0800 (PST) MIME-Version: 1.0 References: <20201118234352.2138694-1-abhishekpandit@chromium.org> <7235CD4E-963C-4BCB-B891-62494AD7F10D@holtmann.org> In-Reply-To: From: Abhishek Pandit-Subedi Date: Tue, 24 Nov 2020 11:04:59 -0800 Message-ID: Subject: Re: [PATCH 0/3] Bluetooth: Power down controller when suspending To: Marcel Holtmann , chin-ran.lo@nxp.com, amitkumar.karwar@nxp.com Cc: BlueZ development , ChromeOS Bluetooth Upstreaming , Miao-chen Chou , Daniel Winkler , "David S. Miller" , Johan Hedberg , netdev , LKML , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Re-send to NXP email addresses for Chin-Ran Lo and Amitkumar Karwar (Marvell wireless IP acquired by NXP) On Tue, Nov 24, 2020 at 11:02 AM Abhishek Pandit-Subedi wrote: > > Hi Marcel, > > > On Mon, Nov 23, 2020 at 3:46 AM Marcel Holtmann wro= te: > > > > Hi Abhishek, > > > > > This patch series adds support for a quirk that will power down the > > > Bluetooth controller when suspending and power it back up when resumi= ng. > > > > > > On Marvell SDIO Bluetooth controllers (SD8897 and SD8997), we are see= ing > > > a large number of suspend failures with the following log messages: > > > > > > [ 4764.773873] Bluetooth: hci_cmd_timeout() hci0 command 0x0c14 tx ti= meout > > > [ 4767.777897] Bluetooth: btmrvl_enable_hs() Host sleep enable comman= d failed > > > [ 4767.777920] Bluetooth: btmrvl_sdio_suspend() HS not actived, suspe= nd failed! > > > [ 4767.777946] dpm_run_callback(): pm_generic_suspend+0x0/0x48 return= s -16 > > > [ 4767.777963] call mmc2:0001:2+ returned -16 after 4882288 usecs > > > > > > The daily failure rate with this signature is quite significant and > > > users are likely facing this at least once a day (and some unlucky us= ers > > > are likely facing it multiple times a day). > > > > > > Given the severity, we'd like to power off the controller during susp= end > > > so the driver doesn't need to take any action (or block in any way) w= hen > > > suspending and power on during resume. This will break wake-on-bt for > > > users but should improve the reliability of suspend. > > > > > > We don't want to force all users of MVL8897 and MVL8997 to encounter > > > this behavior if they're not affected (especially users that depend o= n > > > Bluetooth for keyboard/mouse input) so the new behavior is enabled vi= a > > > module param. We are limiting this quirk to only Chromebooks (i.e. > > > laptop). Chromeboxes will continue to have the old behavior since use= rs > > > may depend on BT HID to wake and use the system. > > > > I don=E2=80=99t have a super great feeling with this change. > > > > So historically only hciconfig hci0 up/down was doing a power cycle of = the controller and when adding the mgmt interface we moved that to the mgmt= interface. In addition we added a special case of power up via hdev->setup= . We never had an intention that the kernel otherwise can power up/down the= controller as it pleases. > > Aside from the powered setting, the stack is resilient to the > controller crashing (which would be akin to a power off and power on). > From the view of bluez, adapter lost and power down should be almost > equivalent right? ChromeOS has several platforms where Bluetooth has > been reset after suspend, usually due USB being powered off in S3, and > the stack is still well-behaving when that occurs. > > > > > Can we ask Marvell first to investigate why this is fundamentally broke= n with their hardware? > > +Chin-Ran Lo and +Amitkumar Karwar (added based on changes to > drivers/bluetooth/btmrvl_main.c) > > Could you please take a look at the original cover letter and comment > (or add others at Marvell who may be able to)? Is this a known issue > or a fix? > > >Since what you are proposing is a pretty heavy change that might has sid= e affects. For example the state machine for the mgmt interface has no conc= ept of a power down/up from the kernel. It is all triggered by bluetoothd. > > > > I am careful here since the whole power up/down path is already complic= ated enough. > > > > That sounds reasonable. I have landed this within ChromeOS so we can > test whether a) this improves stability enough and b) whether the > power off/on in the kernel has significant side effects. This will go > through our automated testing and dogfooding over the next few weeks > and hopefully identify those side-effects. I will re-raise this topic > with updates once we have more data. > > Also, in case it wasn't very clear, I put this behind a module param > that defaults to False because this is so heavy handed. We're only > using it on specific Chromebooks that are exhibiting the worst > behavior and not disabling it wholesale for all btmrvl controllers. > > Thanks > Abhishek > > > Regards > > > > Marcel > >