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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BD91C433EF for ; Mon, 13 Dec 2021 23:57:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242754AbhLMX5o (ORCPT ); Mon, 13 Dec 2021 18:57:44 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:28843 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235661AbhLMX5n (ORCPT ); Mon, 13 Dec 2021 18:57:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639439862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=itrWj/FNXzyg2IvEE5KBOWVxQH40piGIDy+/PNdSvak=; b=CTrwYzMHTo8GBeK+IGtCtBjtMsLskR/a4qBL+4C/FHmjstC5CCQdic6MuVO7Vdh2gGdZXl eteEGIgVa5x3aTBzqg6yvKrOl6YcsGL8a0uoF+sUacfCRdwOC7N6woBEOQNWAVHs9IfnX0 2fGB8ELg0zxb0ddfJGa6vOuwR3f0O0c= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-483-5M1Ljq3ZO5qs0SRwjUQXEw-1; Mon, 13 Dec 2021 18:57:41 -0500 X-MC-Unique: 5M1Ljq3ZO5qs0SRwjUQXEw-1 Received: by mail-wm1-f71.google.com with SMTP id 201-20020a1c04d2000000b003335bf8075fso10446147wme.0 for ; Mon, 13 Dec 2021 15:57:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=itrWj/FNXzyg2IvEE5KBOWVxQH40piGIDy+/PNdSvak=; b=AbyQfVn04XPpY+UqBMZTqcIytmaiNwbPJTKdXQ7dGUWMYqw6YTfSDHyJ5c6qN1wNKi cTdbGW17h/v+TjIvwFrsgtXufWXUWaO93H5oqA5HOS4G3BS45XDj2cFNinzlzlbCloAk WXc3s3583wvamgqtEz5o1SW0PjuZJeWOA0V/SXy7duIb1pqe54y3MklFMSA4Aq2nCbv0 qv1uOiteq3u3e9ObdzX7TmLFl6xgrQ8QWEheLJof0R5HLhSthdqwo6tjF8BMpK+WxcN1 g6FraQ1P99ia8bNLxhmC9sFjYssrIE1cT50cgrW5cdSwSlrYqk+s6K2qAF0bc9KHAAjf jlyw== X-Gm-Message-State: AOAM532kZUXdHj2PAfovRlDAn2CgJiC/2by5r20InoYA26up6kZ039p+ W5gKc6c42J2wvCR4oRreMUY2wxVFS4gA+sBKrywYNlfvGJc1XzAERB4HOzmT8Cn7kLFUTjKL3xV UvamL8vP87rocTvTFtxoppQEDLce9 X-Received: by 2002:adf:e484:: with SMTP id i4mr1813514wrm.49.1639439860255; Mon, 13 Dec 2021 15:57:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/Pj4Z/yXyapvNcqdg05CqU9fiI6m5P/+rM1Krrug9bUUnGSeBImkdL/PcJ3lT1z6hNseTtw== X-Received: by 2002:adf:e484:: with SMTP id i4mr1813502wrm.49.1639439860103; Mon, 13 Dec 2021 15:57:40 -0800 (PST) Received: from redhat.com ([2a03:c5c0:207d:b931:2ce5:ef76:2d17:5466]) by smtp.gmail.com with ESMTPSA id v9sm10203463wrb.107.2021.12.13.15.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 15:57:39 -0800 (PST) Date: Mon, 13 Dec 2021 18:57:35 -0500 From: "Michael S. Tsirkin" To: Marcel Holtmann Cc: Linux Kernel Mailing List , Johan Hedberg , Luiz Augusto von Dentz , linux-bluetooth@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH] Bluetooth: virtio_bt: fix device removal Message-ID: <20211213185620-mutt-send-email-mst@kernel.org> References: <20211125174200.133230-1-mst@redhat.com> <20211209162149-mutt-send-email-mst@kernel.org> <20211213054357-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211213054357-mutt-send-email-mst@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Mon, Dec 13, 2021 at 05:44:13AM -0500, Michael S. Tsirkin wrote: > On Thu, Dec 09, 2021 at 04:22:58PM -0500, Michael S. Tsirkin wrote: > > On Thu, Nov 25, 2021 at 09:02:01PM +0100, Marcel Holtmann wrote: > > > Hi Michael, > > > > > > > Device removal is clearly out of virtio spec: it attempts to remove > > > > unused buffers from a VQ before invoking device reset. To fix, make > > > > open/close NOPs and do all cleanup/setup in probe/remove. > > > > > > so the virtbt_{open,close} as NOP is not really what a driver is suppose > > > to be doing. These are transport enable/disable callbacks from the BT > > > Core towards the driver. It maps to a device being enabled/disabled by > > > something like bluetoothd for example. So if disabled, I expect that no > > > resources/queues are in use. > > > > > > Maybe I misunderstand the virtio spec in that regard, but I would like > > > to keep this fundamental concept of a Bluetooth driver. It does work > > > with all other transports like USB, SDIO, UART etc. > > > > > > > The cost here is a single skb wasted on an unused bt device - which > > > > seems modest. > > > > > > There should be no buffer used if the device is powered off. We also don’t > > > have any USB URBs in-flight if the transport is not active. > > > > > > > NB: with this fix in place driver still suffers from a race condition if > > > > an interrupt triggers while device is being reset. Work on a fix for > > > > that issue is in progress. > > > > > > In the virtbt_close() callback we should deactivate all interrupts. > > > > > > Regards > > > > > > Marcel > > > > So Marcel, do I read it right that you are working on a fix > > and I can drop this patch for now? > > ping If I don't hear otherwise I'll queue my version - it might not be ideal but it at least does not violate the spec. We can work on not allocating/freeing buffers later as appropriate. > > -- > > MST 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 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6DF7EC433EF for ; Mon, 13 Dec 2021 23:57:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 12A2A8135C; Mon, 13 Dec 2021 23:57:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3x3uSRH1LRSi; Mon, 13 Dec 2021 23:57:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id B479381354; Mon, 13 Dec 2021 23:57:50 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 83050C001E; Mon, 13 Dec 2021 23:57:50 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 93191C0012 for ; Mon, 13 Dec 2021 23:57:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 6D264403E7 for ; Mon, 13 Dec 2021 23:57:49 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uDdMDPLgM2ok for ; Mon, 13 Dec 2021 23:57:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id 92BDB4013D for ; Mon, 13 Dec 2021 23:57:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639439867; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=itrWj/FNXzyg2IvEE5KBOWVxQH40piGIDy+/PNdSvak=; b=FL/u9IdbQdlicwLzUau6Yhsfntj2AGTFusIcIQB1sq0mfyaD+BwAMdD9TdeahsapgejQHV 4YHmeIIYH26z91TnUndjZPKPhPniP6w0E95IIvGHEjxC8ysGrsTgP43Ie9S39hEFu2ssi8 vsw/sxqr/W8ilJs+7taxAkSYhhMEpB4= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-184-2bnRihgSNa-cyAYmom7rCw-1; Mon, 13 Dec 2021 18:57:41 -0500 X-MC-Unique: 2bnRihgSNa-cyAYmom7rCw-1 Received: by mail-wm1-f70.google.com with SMTP id a85-20020a1c7f58000000b0033ddc0eacc8so12319682wmd.9 for ; Mon, 13 Dec 2021 15:57:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=itrWj/FNXzyg2IvEE5KBOWVxQH40piGIDy+/PNdSvak=; b=iBOTSV79TdJSa5m6B6n/Qk5ZUDrR426Mg6kM5Yxllx0OnUJL56brLrHZy0XlAcn5gK 61sLnZjUK9etsAUzTZgA86teiu6TuCgU83nXDzdzvSEW8yunIJuzvsqTber1HdhuhgcD h6kkXXOeO/2kWnS3TR+IWEzC3MqUDuqzdPyHVv8BRSh7gnun/xbFpphr1lrh+0ZZZl7e tCuC5fPXh+0PBvfjCKWFTOXnu1qCLDe7v3k2pDDBHCO0YHOC0viPnZdzrKxl8334yIrY KFb99hbDigktiyzTDf1RPrlff9p/MyMDvkpSM6VmGmZb+OIisA0q3ruk9n/Vs2JaXefN yONg== X-Gm-Message-State: AOAM531CXE5/A2RG2WY4fBxd7igawSx31bfz/9+N1ce408/iB8opWldy +Ql5GutgtQBcxxpQPPA1lq0WR7KSqlvjlL7O13zeKzMzB4jucIVsWW8uRZTckFCXdgvPAgYTEwP A1fe1KJDzVmT/TA9nknqYeyp6OS+GmDt7hrvxn2JtLQ== X-Received: by 2002:adf:e484:: with SMTP id i4mr1813512wrm.49.1639439860255; Mon, 13 Dec 2021 15:57:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/Pj4Z/yXyapvNcqdg05CqU9fiI6m5P/+rM1Krrug9bUUnGSeBImkdL/PcJ3lT1z6hNseTtw== X-Received: by 2002:adf:e484:: with SMTP id i4mr1813502wrm.49.1639439860103; Mon, 13 Dec 2021 15:57:40 -0800 (PST) Received: from redhat.com ([2a03:c5c0:207d:b931:2ce5:ef76:2d17:5466]) by smtp.gmail.com with ESMTPSA id v9sm10203463wrb.107.2021.12.13.15.57.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 15:57:39 -0800 (PST) Date: Mon, 13 Dec 2021 18:57:35 -0500 From: "Michael S. Tsirkin" To: Marcel Holtmann Subject: Re: [PATCH] Bluetooth: virtio_bt: fix device removal Message-ID: <20211213185620-mutt-send-email-mst@kernel.org> References: <20211125174200.133230-1-mst@redhat.com> <20211209162149-mutt-send-email-mst@kernel.org> <20211213054357-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 In-Reply-To: <20211213054357-mutt-send-email-mst@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: linux-bluetooth@vger.kernel.org, virtualization@lists.linux-foundation.org, Linux Kernel Mailing List , Luiz Augusto von Dentz , Johan Hedberg X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" T24gTW9uLCBEZWMgMTMsIDIwMjEgYXQgMDU6NDQ6MTNBTSAtMDUwMCwgTWljaGFlbCBTLiBUc2ly a2luIHdyb3RlOgo+IE9uIFRodSwgRGVjIDA5LCAyMDIxIGF0IDA0OjIyOjU4UE0gLTA1MDAsIE1p Y2hhZWwgUy4gVHNpcmtpbiB3cm90ZToKPiA+IE9uIFRodSwgTm92IDI1LCAyMDIxIGF0IDA5OjAy OjAxUE0gKzAxMDAsIE1hcmNlbCBIb2x0bWFubiB3cm90ZToKPiA+ID4gSGkgTWljaGFlbCwKPiA+ ID4gCj4gPiA+ID4gRGV2aWNlIHJlbW92YWwgaXMgY2xlYXJseSBvdXQgb2YgdmlydGlvIHNwZWM6 IGl0IGF0dGVtcHRzIHRvIHJlbW92ZQo+ID4gPiA+IHVudXNlZCBidWZmZXJzIGZyb20gYSBWUSBi ZWZvcmUgaW52b2tpbmcgZGV2aWNlIHJlc2V0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