Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1982005pxb; Fri, 29 Jan 2021 09:52:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxY5z4xBJIFAO4ZHjhB+9XXXMmQiwG16xV5YZ0FixBrQwTw9Jgny52O/7jBePyu5b4bOMKH X-Received: by 2002:a17:906:4451:: with SMTP id i17mr5530765ejp.436.1611942767723; Fri, 29 Jan 2021 09:52:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611942767; cv=none; d=google.com; s=arc-20160816; b=XQb7BfNPvCDdUn+88MDAT4VD3AomEA1goEt0nBOEyl72Vin4ap0x6uuSkL4RQTpuRL 5rlp6tHXXXkBg6O3329Eh7qAQRDD+7Cr4hfJH9WJ8p+3KLfw3IfE+8GpUYuTe70Dqodo Xav1FHt6fXsY7c8s7XbT7dUa2hTYU0ebRMvEDG72LC/z+Mx9HyAZL4EoUQ/j9xzdlNP2 GJp14tpjHDtywk20KgBqMy3B90guQWTyPY9PobcIQ3AWgII/U2If6d1PoXnx5AcMwT65 Uwlbw6SyARO6cWlRFhvAiYZisqergrZwOWx1z0Ufd+W7/t69JA9ghv1DIgkGBdWQ0lLt E6aA== 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=uQVkwbFdVxWBpP1ri9UZR53ShcAtPgjyzjoEk8DQhUE=; b=FSmjXIYVHklWdN6ernB+/1xeOxYcMwlR807YQXmrYu5EEM7Y9qPCeSZfZidIYeyy4Q TZC6u14Wnp/taWBOS9ZUYI1RQpLq4KCd580Bb4gwxXjnzhlTPumYvi7BBwFa8viPFjdz oUyW5fpKG4ciQML434EA6lpalMsLk8EwyWEFEEdxtlfYW94gE/WwUT6D9fSdX9MJkVt2 qGg1IAYfIi0IIrBTJ0qb9VvThxQ3FeYmO7n5p2ZvPJJzfSr4T6YRZQ8zW4M+IfQzHpoH Qypnjcgf4H0rIwhNwQtQG3sAgPxWV7i58DIZnMMS2gG+opZ8y1gw/qIYN9lP6194YyuQ 9t8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=An+wSLBc; 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 k17si5779287edx.245.2021.01.29.09.52.23; Fri, 29 Jan 2021 09:52: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=An+wSLBc; 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 S231597AbhA2Rv1 (ORCPT + 99 others); Fri, 29 Jan 2021 12:51:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbhA2RuS (ORCPT ); Fri, 29 Jan 2021 12:50:18 -0500 Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3739FC061573 for ; Fri, 29 Jan 2021 09:49:38 -0800 (PST) Received: by mail-vs1-xe2a.google.com with SMTP id b5so5305297vsh.3 for ; Fri, 29 Jan 2021 09:49:38 -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=uQVkwbFdVxWBpP1ri9UZR53ShcAtPgjyzjoEk8DQhUE=; b=An+wSLBc38OJie7BFNh3zfzRikkXDFO5Cy731hUTE5LkzGJLXKbfimmP1r4KbPwBIy UFlRadEuYGwQmTVLYiwNsyBLPT03HanIFxjDwHJGfFYK88NfUi075+nLHu9MMKo2xu5u UW2SUgMyxPy6IsTqyHHE0QyeLu5R21mrV2mmc= 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=uQVkwbFdVxWBpP1ri9UZR53ShcAtPgjyzjoEk8DQhUE=; b=gElb4ySXmH2usGCWSyJ/oo/LQ0z/y8BwMIMeLAgU4JpFuCWh//e05HJTqfdNR5UzPx LhMJonYb/SxNWDHVUmYrU6sOiSNkQlE+Z8kZlyy4MoyYw49s6A1hIeEcBk6YURlX7V0J pBhjrwVIScHRDQP8qxi9RYWruss9lMBjMuX1/fGYuIYIER5p0rAaRCqFPMvY+lOOUT8K rnyDkYytAgnGfuoKWF80QagfGZqSZjMHEL56C19An9LbfhpclebWFeRKt9bIld3k4ZqZ G2cC99lGe3PxkVY4MP2Y+vQy88c6om5NhOEa/unszwd3eUZ7Kx7NzaZx7Aad7/kd32V2 Oulw== X-Gm-Message-State: AOAM530PSHM7Lz/NOtaNLpyGqpnAOgmRTk98rPEBotHCVRO8IDYPGEWR Fh1uU27+cDNtAFtkmfVuSAWfFFSRFgrGJ41NVVhK0Q== X-Received: by 2002:a67:eb06:: with SMTP id a6mr3736611vso.30.1611942577427; Fri, 29 Jan 2021 09:49:37 -0800 (PST) MIME-Version: 1.0 References: <20210128120007.5676-1-hdegoede@redhat.com> In-Reply-To: <20210128120007.5676-1-hdegoede@redhat.com> From: Abhishek Pandit-Subedi Date: Fri, 29 Jan 2021 09:49:25 -0800 Message-ID: Subject: Re: Recent(ish) bluetooth hci_suspend_notifier() changes To: Hans de Goede Cc: Marcel Holtmann , Johan Hedberg , Bluez mailing list , Alain Michaud Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Hans, Thanks for the pointers. I'll try to spin up a patch to fix these issues (or ask for some help on my team). Thanks, Abhishek On Thu, Jan 28, 2021 at 4:00 AM Hans de Goede wrote: > > Hi All, > > While debugging an rtl8723bs bluetooth issue I noticed that last year > the bluetooth core has grown a new hci_suspend_notifier() mechanism and > I noticed a number of possible issues / improvements with that mechanism > which I noticed: > > 1. HCI_OP_WRITE_SCAN_ENABLE gets send to the HCI in some places without > a hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) check > > 2. HCI_OP_SET_EVENT_FLT gets end to the HCI in some places without > a hci_dev_test_flag(hdev, HCI_BREDR_ENABLED) check > > 3. hci_req_set_event_filter sends the following requests: > 1 HCI_OP_SET_EVENT_FLT > 2 HCI_OP_WRITE_SCAN_ENABLE (if the scan parameters have changed only) > 3 HCI_OP_SET_EVENT_FLT (if their are relevant whitelist entries_ > 4 HCI_OP_WRITE_SCAN_ENABLE unconditionally > > It seems to me that 2. is unnecessary since it will immediately be > followed by 4. and 4. misses the check to see if the scan parameters > need updating which 2 does (this check is done in __hci_req_update_scan() > > > 4. There is another unconditional, possibly unnecessary HCI_OP_WRITE_SCAN_ENABLE > in the if (next == BT_SUSPEND_DISCONNECT) {} block of hci_req_prepare_suspend() > Note if this is made conditional then the: > set_bit(SUSPEND_SCAN_DISABLE, hdev->suspend_tasks); > should also be made conditional since then req might not contain any requests > in which case suspend_req_complete() will not run. > > Regards, > > Hans >