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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 170E4C433DB for ; Mon, 25 Jan 2021 22:19:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D6560206DC for ; Mon, 25 Jan 2021 22:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732392AbhAYWTm (ORCPT ); Mon, 25 Jan 2021 17:19:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732060AbhAYWTO (ORCPT ); Mon, 25 Jan 2021 17:19:14 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C0EC06174A for ; Mon, 25 Jan 2021 14:18:33 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id u25so20117008lfc.2 for ; Mon, 25 Jan 2021 14:18:33 -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=A/Q6Oc7PeuEcOpsoTdR6W8VQQNB+BX6FWqtQmvephYI=; b=TGVCNCPSNbUbsysH6Tox8d7pwWgph9ObN+6ge3dhPh5MKc6p7Z5wgPqQ2NNKfuCzZj L1KLMBgdwttsYm/V0TBJ8Czaru+RbXH1bym7El17fcwB/A0PYkUidXKrhSUaqWqNj/0p bM2jSpOBuiRZIfYYmyDd6ql/u6wBz7OOs5lcA= 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=A/Q6Oc7PeuEcOpsoTdR6W8VQQNB+BX6FWqtQmvephYI=; b=c6aDhN/SdpizW9jZcpc9Jo4B0KEhsVlseNLKvgxVxrNIGmKPvEy8wd/eICBuBmimow 59R64wDTFhBV2DhpwkzSydb5BFyf88PEnjTu+nS4H9hltC7Xc7bTN6YE13ZudX8RnAx3 P3KQGqZz7RSdRXT3CqNHA30usoRZ2XQ0sFYmbBnG98dcNUdtGtu71iBX4bddFZJOedOw 7koOjD4BhBL2cwo+AfCDV+Qi+5p2vMzitvPVbSNaUe1ZS52X0PGF0ROgsPV7S2IdbSdS IopaCSgWHJCPyhGiGdd0haIyk+39lZnECAja0lzVCSVM9ONWbuONhjG0FxnHGzBv20gl LzGQ== X-Gm-Message-State: AOAM530rHAM2yA0w/aPUe0mxsL+eKa/vXRtYS2sGpRp9UXHAaXXuTMxS qY8hJ12vmTwO++ztU+V9ViSG+WsFPBGhxnVlz7RtUA== X-Google-Smtp-Source: ABdhPJyai8NTk2KgZnwz2fp7w8KnZGavKufSHn1oqZr7KwEuq5/gI61Hrs6tOhwWfyUmve7sEMkTiksFvcUnNBIRE0I= X-Received: by 2002:a19:644b:: with SMTP id b11mr1179908lfj.358.1611613112276; Mon, 25 Jan 2021 14:18:32 -0800 (PST) MIME-Version: 1.0 References: <20210121163801.v3.1.Id9bc5434114de07512661f002cdc0ada8b3d6d02@changeid> <070E7413-A3E3-4FEB-80BC-D3DD922DA19B@holtmann.org> In-Reply-To: <070E7413-A3E3-4FEB-80BC-D3DD922DA19B@holtmann.org> From: Miao-chen Chou Date: Mon, 25 Jan 2021 14:18:22 -0800 Message-ID: Subject: Re: [PATCH v3] Bluetooth: Keep MSFT ext info throughout ahci_dev's life cycle To: Marcel Holtmann Cc: Bluetooth Kernel Mailing List , Alain Michaud , Archie Pusaka , Luiz Augusto von Dentz , Abhishek Pandit-Subedi , "David S. Miller" , Johan Hedberg , LKML , netdev Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marcel, On Mon, Jan 25, 2021 at 7:13 AM Marcel Holtmann wrote: > > 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. This patch does exactly what you described - keep the values around and not wipe them until unregistration of hdev. Since the only thing that msft_do_close() does is to release msft_data and reset hdev->msft_data it to NULL, and that's why I move msft_do_close() from hci_dev_do_close() to hci_unregister_dev() to release the msft_data. If this is about naming, I am happy to change msft_do_close() to perhaps msft_reset() or something similar. As for msft_do_open(), I will change it to re-read the msft_data instead of skipping. Regards, Miao