linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Brian Norris <briannorris@chromium.org>,
	"Gustavo F. Padovan" <gustavo@padovan.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Bluez mailing list <linux-bluetooth@vger.kernel.org>,
	linux-serial@vger.kernel.org,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	stable <stable@vger.kernel.org>,
	Leif Liddy <leif.linux@gmail.com>,
	Matthias Kaehlcke <mka@chromium.org>,
	Daniel Drake <drake@endlessm.com>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	matadeen@qti.qualcomm.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version
Date: Fri, 16 Feb 2018 12:45:44 +0100	[thread overview]
Message-ID: <6B37F6AC-1103-4FCF-A5DC-4BA236A7B11B@holtmann.org> (raw)
In-Reply-To: <345b0de8-1a23-d2f8-bc56-507eadf7faa7@redhat.com>

Hi Hans,

>>>>> Commit 7d06d5895c15 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"")
>>>>> removed the setting of the BTUSB_RESET_RESUME quirk for QCA Rome devices,
>>>>> instead favoring adding USB_QUIRK_RESET_RESUME quirks in usb/core/quirks.c.
>>>>> 
>>>>> This was done because the DIY BTUSB_RESET_RESUME reset-resume handling
>>>>> has several issues (see the original commit message). An added advantage
>>>>> of moving over to the USB-core reset-resume handling is that it also
>>>>> disables autosuspend for these devices, which is similarly broken on these.
>>>> 
>>>> Wait, is autosuspend actually broken for all QCA Rome chipsets? I don't
>>>> think so -- I'm using one now.
>>> 
>>> And have you manually enabled USB autosuspend for it, or are you
>>> running something which might have done so, e.g. powertop --auto-tune ?
>>> 
>>> Because if you did not do that then you're already not using autosuspend
>>> for your QCA devices and this patch will change nothing.
>> I use a set of udev rules that manually whitelist devices for
>> autosuspend. You can see it here:
>> https://chromium.googlesource.com/chromiumos/platform2/+/43728a93f6de137006c6b92fbb2a7cc4f353c9bf/power_manager/udev/gen_autosuspend_rules.py#83
>> You'll find at least one Rome chip in there.
> >
>>>> Thus, this is a poor solution, which
>>>> negatively affects my systems. However, I see that this patch was
>>>> applied regardless...
>>> 
>>> Note that there already is a quirk to handle broken suspend/resume
>>> behavior on ALL QCA devices in older kernels. Also note that the
>> Yes, and the quirk was broken, and I made sure it got reverted when it
>> broke my devices ;)
> 
> Note that the revert for this:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7d06d5895c15
> 
> Says: "This commit causes a regression on some QCA ROME chips. The USB device reset happens
> in btusb_open(), hence firmware loading gets interrupted."
> 
> And says:
> 
> "If we really want to reset the USB device, we need to do it before btusb_open(). Let's
> handle it in drivers/usb/core/quirks.c."
> 
> It does not mention that the quirk is not necessary on some devices only
> that the implementation of it we had before had issues.
> 
> And the original commit of the quirk:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/drivers/bluetooth/btusb.c?id=fd865802c66bc451dc515ed89360f84376ce1a56
> 
> Says: "There's been numerous reported instances where BTUSB_QCA_ROME
> bluetooth controllers stop functioning upon resume from suspend."
> 
> So it may be platform specific but it is not just limited to 1 or
> 2 platforms I think.
> 
> Note I'm not saying that I don't believe you that the quirk is not
> necessary on your devices.
> 
>>> patches series which this commit builds on top of was already
>>> setting USB_QUIRK_RESET_RESUME for some devices in
>>> usb/core/quirks.c.
>>> 
>>> All my commit does is instead of duplicating all the QCA USB-ids in
>>> usb/core/quirks.c, move the setting of USB_QUIRK_RESET_RESUME
>>> to btusb.c so that we don't need to duplicate the USB-id tables.
>> I was slightly more OK with marking specific IDs as broken, because
>> those IDs didn't happen to be ones that I knew were currently working.
>> Now you're breaking my systems again. But this time, it's more subtle
>> because bluetooth will still work, but we just suck more power leaving
>> our USB port active all the time.
> 
> I see, sorry about that. Ok, so we are going to need to make the
> reset-on-resume quirking more fine grained. I can see 3 ways to do this:
> 
> 1) Make it a separate per usb-id BTUSB_RESET_RESUME flag in the
> usb_device_id table inside btusb.c (I still believe duplicating most
> ids to usb/core/quirks.c is a bad idea).
> 
> 2) Use dmi based whitelisting to opt out of reset-resume behavior on
> QCA btusb devices.
> 
> 3) Use dmi based blacklisting which enables reset-resume behavior.
> 
> In retrospect I guess 3 would have been best, but if we do that now
> it will cause regressions.
> 
> I guess we should go with 1. adding the BTUSB_RESET_RESUME to all the
> QCA usb-ids except for the ones where you know things work and which
> only seem to be used in working devices (based on you not having
> objections against the additions of the quirk for some ids to
> drivers/usb/core/quirks.c).
> 
> And if then those usb-ids do turn out to have broken suspend on
> on some devices too I guess we need to move to 2.

actually if this is really platform related as Qualcomm is indicating, then we should just go with 3) and the two platforms that previously added quirks to usb/core/quirks.c and blacklist these. I am all for figuring out what is going on here. So lets blacklist these and see how this goes. Maybe there are only two bad platforms out there and we are making too much fuzz about this. Before we added quirks in the USB core these platforms were just plain broken as well. So not much different situation than before. We need to push the DMI blacklisting back into -stable as well and that means any impact of a 3rd broken platform briefly working and then be broken again is slim and also fixable via -stable.

I addition we can add a module option to btusb.ko that allows us to force this flag to be set. That way testing this is easy on a vendor kernel. A bunch of the btusb quirks (and also core quirks) can be tested via module options or debugfs.

Regards

Marcel

  reply	other threads:[~2018-02-16 11:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180108094416.4789-1-hdegoede@redhat.com>
2018-02-13  2:24 ` [PATCH] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version Brian Norris
2018-02-13 11:25   ` Hans de Goede
2018-02-16  2:27     ` Brian Norris
2018-02-16  3:23       ` Guenter Roeck
2018-02-16  8:26       ` udev USB autosupend whitelist (was Re: [PATCH] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version) Hans de Goede
2018-02-16 16:49         ` Brian Norris
2018-02-19 14:59           ` Hans de Goede
2018-02-16  8:43       ` [PATCH] Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version Marcel Holtmann
2018-02-16  8:56       ` Hans de Goede
2018-02-16 11:45         ` Marcel Holtmann [this message]
2018-02-16 12:10           ` Hans de Goede
2018-02-16 17:59             ` Brian Norris
2018-02-19 10:17               ` Hans de Goede
2018-02-23  3:12                 ` Brian Norris
2018-02-23  7:14                   ` Hans de Goede
2018-02-27  2:29                     ` Brian Norris
2018-02-27 14:07                       ` Hans de Goede
2018-02-28 10:54                         ` Hans de Goede
2018-03-09  0:56                           ` Leif Liddy
2018-03-10  2:42                             ` Leif Liddy
2018-02-18  8:13             ` Kai-Heng Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6B37F6AC-1103-4FCF-A5DC-4BA236A7B11B@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=briannorris@chromium.org \
    --cc=drake@endlessm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gustavo@padovan.org \
    --cc=hdegoede@redhat.com \
    --cc=johan.hedberg@gmail.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=leif.linux@gmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=matadeen@qti.qualcomm.com \
    --cc=mka@chromium.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).