Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp201913iog; Mon, 13 Jun 2022 00:10:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbH4doC/B2+4+7vwi8bnvFbScLwkyd2VRlKNcIm5qrG9Md1K7sycEC4NZhNbHewVGA+Ivp X-Received: by 2002:a17:902:ead4:b0:161:c85a:8fff with SMTP id p20-20020a170902ead400b00161c85a8fffmr14679695pld.97.1655104200695; Mon, 13 Jun 2022 00:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655104200; cv=none; d=google.com; s=arc-20160816; b=xdUPjXqatg+P0pueEW50zn5xzlmCdl+ypiNBarz+kdmfO+r08PWis65KPbFRHJspCz xOq7FynziOJJs9iNDWJWx55UWFA5nJBEKhYqj5rkW2+Z8otn9FiNDsdLnaHeRo23hcpu QWpXzMRRoq8FCCnVj3JQiqEqDO8S8ThThAdxQO5o1WZToyVF7Mseee0710u+PHO+yJv2 x+3/yAhOEishYVBMrhqMdy/mnxNkFEM8uHzNXr555aZI5BvMrsFm+GswnTmHiEisc7YO x80zHCLajPjFmCf2FTh6jjgRJ7dEz5JIXR6sm0yIAq+3MTLN8s2ZquQ3kszzsqsTgttL zp7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=oVRFLE7RGwK5y8lRXbnI7Xv89WxvPuxuOeVilE+WukU=; b=vLSNY5G7OVLPsuNA8oLIhrF9n9yEhXkfVhdf1aJ4cCfYqGbD/U7WOxD8PGxqakIFtL +c0KwXagGiRGxOdRWkYCxN9H4vQUpsmx/UHuTHJCyqWTPAsMzizELt4CVI9VXC/e2I6o riwKoG+DzXEMgwY2cWWZV0v/E9Iobm3rS/goEO9NVs0A4b5rxL8DA/o6e+id4wCdh6QW bBWdtu2b64lEQDs0jm8gYAvKZ0BVpWhpxh87n32bXlF2Y51kadSuZL0Cdf7vnco28fWi 99qA3ERiDHRTPExD4ZsHHvZUvZ6RXGohn+WTi7myPqegTjptmegWRcdNffPrfb2UyfE+ sJ9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Gf7rcEpG; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jb22-20020a170903259600b001637dbe1bc4si8311884plb.44.2022.06.13.00.09.19; Mon, 13 Jun 2022 00:10:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Gf7rcEpG; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237211AbiFMG7I (ORCPT + 99 others); Mon, 13 Jun 2022 02:59:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230204AbiFMG7D (ORCPT ); Mon, 13 Jun 2022 02:59:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 940C515FFC for ; Sun, 12 Jun 2022 23:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655103541; 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=oVRFLE7RGwK5y8lRXbnI7Xv89WxvPuxuOeVilE+WukU=; b=Gf7rcEpGIzd9NPyctYiiKt/PT9+QWioMW8dZPLLcDLOfzmnIQ3T3yQyPFm7Uw91Nnj4N9I Ic2aaPm8OjmGL0xf4nk8hMvIHmizQDA2ZswQdMZeia2oQbmyfHvDsu+guhuDh730D0z8/E /DWfmqv2V6hTueX4F8TfUTPCnGIg0SI= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-331-W92Bqzh5Nni1GWUh1nCQpA-1; Mon, 13 Jun 2022 02:59:00 -0400 X-MC-Unique: W92Bqzh5Nni1GWUh1nCQpA-1 Received: by mail-ed1-f69.google.com with SMTP id j4-20020aa7ca44000000b0042dd12a7bc5so3364904edt.13 for ; Sun, 12 Jun 2022 23:59:00 -0700 (PDT) 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=oVRFLE7RGwK5y8lRXbnI7Xv89WxvPuxuOeVilE+WukU=; b=IrD3dj5ca3eb2IZ6CEMvCDcrsI2NEXJ4Q5k9RfkXEFBeOqVci/dh5N6HtuOrCWBL1Z fvYEBI09a8FA6o4YLTE1iZDoc2giXxjz146rq5A7/EmJ183cMAls3U6HF5uWTWzFDDho CzDYWYiLErCY3hnI/JL6JX4Q2dkn+ei7PkqXucHn5rrCjz+RlChi/OE3U2+m0eYy8FIX OuQiDzx7T0g1fZk+YWoOdGsltmulgoZ19x3x+yyZIbySpwgCj4DYycu+RW+UcdihjaGR 4e4bpMIs5PJTfeifcAoE8LvQSTQd+M4chnsTb0lzK1Q/YckRsTd6VHEuIiLkknC6VLgQ ueGg== X-Gm-Message-State: AOAM530Eok1qvL/d1PA/qm6OGhZ6SRqfH9Wf9agj77zeVLB7+0dNxsCd Yb1btHHs+Dmr1agg+Tj9Pm1cI3rLJ1sGWnwpi4qK1S0zTCWsmpduKDrUXtNVCc1Vw0k5BUoqAr/ GE+n/LiWnMZLZwvo/XRQ4Jkb55EZd X-Received: by 2002:a17:906:73cc:b0:715:76d0:861f with SMTP id n12-20020a17090673cc00b0071576d0861fmr7737526ejl.279.1655103539079; Sun, 12 Jun 2022 23:58:59 -0700 (PDT) X-Received: by 2002:a17:906:73cc:b0:715:76d0:861f with SMTP id n12-20020a17090673cc00b0071576d0861fmr7737519ejl.279.1655103538884; Sun, 12 Jun 2022 23:58:58 -0700 (PDT) Received: from redhat.com ([2a03:c5c0:107c:be5a:1a30:9f6d:4400:4adc]) by smtp.gmail.com with ESMTPSA id 14-20020a170906328e00b006fee961b9e0sm3405436ejw.195.2022.06.12.23.58.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jun 2022 23:58:58 -0700 (PDT) Date: Mon, 13 Jun 2022 02:58:54 -0400 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: <20220613025539-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> <20211213185620-mutt-send-email-mst@kernel.org> <20220114151142-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: <20220114151142-mutt-send-email-mst@kernel.org> X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Fri, Jan 14, 2022 at 03:12:47PM -0500, Michael S. Tsirkin wrote: > On Thu, Dec 16, 2021 at 08:58:31PM +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. > > > > I have a patch, but it is not fully tested yet. > > > > Regards > > > > Marcel > > ping > > it's been a month ... > > I'm working on cleaning up module/device removal in virtio and bt > is kind of sticking out. I am inclined to make this driver depend on BROKEN for now. Any objections? > -- > MST