Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3371408pxb; Mon, 25 Jan 2021 14:21:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxH69+7ik0YjJMbkqZ6/XFu/VI1XBewwNF6SqmOxlmCYn1rHU3+jLkLPdUUboov6+oQid/W X-Received: by 2002:aa7:cc98:: with SMTP id p24mr2336727edt.126.1611613275995; Mon, 25 Jan 2021 14:21:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611613275; cv=none; d=google.com; s=arc-20160816; b=qQrgEL8DiRkXCldBimWCCqo8fYiV4sa5us2//HEXLHkVtdPJixv0V57LjKgavhLOyE 1y1Dn1UqfIHOT+XC6Z7Sr1rtfZKwh1Dsp8q9EYt5sN3rZeTYgcCT4bk1sWbZIWP5wN3g wUtAeJIXB9oyS0OZnPPP+R7cYXON01SfwmgMFj85oO9pF2GD2UvVDKe8K9SL5DOVVFFk 3OrTmAERNcJp4DA2dZAkeyxI4vfe4tqMOx0oIwyC6kNXZ/4iSMFzfKEpjfE1o7Rw8OUV 4J/P+HVWZivot5fLqppNnjZvMZJB8EOBUkE6YjTEYLKXYHAu+4QdViQMPXZ4RmWvC3H/ 9q3A== 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=A/Q6Oc7PeuEcOpsoTdR6W8VQQNB+BX6FWqtQmvephYI=; b=DfH44BPesBiPb3R7fX6ruSYcnT/BPLEDtRQKAHz6zS+pJy5yEgie4ElVvyGSRwTiuk TLVrLjmxLnf+Zlw0a1oqUbH00vomxgpJDsGg2eMOFmC/SL3JgqjmrAbo2R0mjK1XbZwU dFTJK49+DXCHZwuGd/c4iMFOFmhC7YCzR1JHiNQGkfVIzjZTEcTZ1PIJ98lpTRh/VKZv G4ucY5fiKoFo9LOJgj2d+JS9DV3stz4QlEkgQnB9oog0lQ5jvKz2qnOI82TK5Fj60m2X BUS6vWErjXUCiH2z33zoXmSdCebVlJIuaSAjpMM9U5GWNKo0GVno6XCLYqNFzlkGCTxD SaGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TGVCNCPS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 lb13si2655251ejc.423.2021.01.25.14.20.51; Mon, 25 Jan 2021 14:21:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=TGVCNCPS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S1732353AbhAYWTb (ORCPT + 99 others); Mon, 25 Jan 2021 17:19:31 -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-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