From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E2CC433DB for ; Tue, 26 Jan 2021 07:32:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A452520754 for ; Tue, 26 Jan 2021 07:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389541AbhAZHbC convert rfc822-to-8bit (ORCPT ); Tue, 26 Jan 2021 02:31:02 -0500 Received: from coyote.holtmann.net ([212.227.132.17]:48839 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730379AbhAYPq7 (ORCPT ); Mon, 25 Jan 2021 10:46:59 -0500 Received: from marcel-macbook.holtmann.net (p4ff9f11c.dip0.t-ipconnect.de [79.249.241.28]) by mail.holtmann.org (Postfix) with ESMTPSA id EAD99CECCA; Mon, 25 Jan 2021 16:20:27 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.40.0.2.32\)) Subject: Re: [PATCH v3] Bluetooth: Keep MSFT ext info throughout ahci_dev's life cycle From: Marcel Holtmann In-Reply-To: <20210121163801.v3.1.Id9bc5434114de07512661f002cdc0ada8b3d6d02@changeid> Date: Mon, 25 Jan 2021 16:13:02 +0100 Cc: Bluetooth Kernel Mailing List , Alain Michaud , Archie Pusaka , Luiz Augusto von Dentz , Abhishek Pandit-Subedi , "David S. Miller" , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <070E7413-A3E3-4FEB-80BC-D3DD922DA19B@holtmann.org> References: <20210121163801.v3.1.Id9bc5434114de07512661f002cdc0ada8b3d6d02@changeid> To: Miao-chen Chou X-Mailer: Apple Mail (2.3654.40.0.2.32) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Miao-chen, > This moves msft_do_close() from hci_dev_do_close() to > hci_unregister_dev() to avoid clearing MSFT extension info. This also > avoids retrieving MSFT info upon every msft_do_open() if MSFT extension > has been initialized. > > The following test steps were performed. > (1) boot the test device and verify the MSFT support debug log in syslog > (2) restart bluetoothd and verify msft_do_close() doesn't get invoked > > Signed-off-by: Miao-chen Chou > Reviewed-by: Abhishek Pandit-Subedi > Reviewed-by: Archie Pusaka > --- > Hi Maintainers, > > This patch fixes the life cycle of MSFT HCI extension. The current > symmetric calls to msft_do{open,close} in hci_dev_do_{open,close} cause > incorrect MSFT features during bluetoothd start-up. After the kernel > powers on the controller to register the hci_dev, it performs > hci_dev_do_close() which call msft_do_close() and MSFT data gets wiped > out. And then during the startup of bluetoothd, Adv Monitor Manager > relies on reading the MSFT features from the kernel to present the > feature set of the controller to D-Bus clients. However, the power state > of the controller is off during the init of D-Bus interfaces. As a > result, invalid MSFT features are returned by the kernel, since it was > previously wiped out due to hci_dev_do_close(). then just keep the values around and not wipe them. However I prefer still to keep the symmetry and re-read the value every time we init. We can make sure to release the msft_data on unregister. Regards Marcel