Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp724553pxb; Fri, 14 Jan 2022 15:04:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUveNLhGkzmIod07VG0tHAlu6ZAfOE+G37vNYzcvancDBcowFT+wibo3A7P1OCnyxaP+nt X-Received: by 2002:a17:90a:1fcf:: with SMTP id z15mr2020886pjz.185.1642201477952; Fri, 14 Jan 2022 15:04:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642201477; cv=none; d=google.com; s=arc-20160816; b=ZX1yQ34Ei0y1MptV1ztQ0lpYET9PFZ/KPi6Ale/vneHPFrjbEJYJN1gBLGWz8TfAPL idevSVFz5D5bW7iB+nDs+PGwfKsPnR/LhMVw3gb2HNDqtmX7Ncr108iEa1aqZO/MvH/L q/Tlt6y/v+1eOf6JFhylx68LVV3UXiANwEKeNiu0WjmDJpCWKNzUYUPhWUf1eZvFYMZS sBYZ1rproi1iI6OIDJ/v3SGvAQ1PIdNdsfrv3/jv32Y4GfWGLUhejd4wedUJtg+qJBAg UQeDIPBcPpOuxV14lNdoYVnN9DUnQwhst4yM0QqUkhT5M3ju1hN74pWWTZj1t9zSimYk T/pw== 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=7iTzTn2n67utbixR5b6YXHlQ+XdyXgKqOT9cBufKBdM=; b=ODHkAUfU9cR8jp47OETmw2TcaJCD42TUqG4CysYg9/XkFQbi/8kgCs8tr+2YteBgXa 6QoW8u4ubD9O/STs3YzFoqsuCYrE7o8nzza4zkziD5ztuo8lZgFBEh8Zt2hjuVbIZoDd vlfdDcqfYgqI4YPjFDGemCG3NSDA+eV6z6tq9im8z1hOGQm4SCuYj0VF3S/88X3EpVvP rBdEWqMWoNXBlkU6SqYWx8iR+4+DrR46LbwB9BsjUIg0YHGkyNHPGtQ//ihwY4BvyqK2 luLtSnHS79T0AQ+G08t9HjjuMl3tSfr6y3JhJ/pmxeDupkbTuo+IXMgvy3/Kb5suXrKR 5bQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=N3W2Haql; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k4si7417762pgq.617.2022.01.14.15.04.12; Fri, 14 Jan 2022 15:04:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-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=@redhat.com header.s=mimecast20190719 header.b=N3W2Haql; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 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 S244196AbiANUMu (ORCPT + 99 others); Fri, 14 Jan 2022 15:12:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36024 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239687AbiANUMu (ORCPT ); Fri, 14 Jan 2022 15:12:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642191169; 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=7iTzTn2n67utbixR5b6YXHlQ+XdyXgKqOT9cBufKBdM=; b=N3W2HaqlnIcpnA8wvXXDuIJy5nZtLaefHh/bcQ+DjI+zmlcWawXTFPdElFTaoKsX3EwI3G JUqoIdIqj3XPqn9kcrVfYIQMD95aDEKi/A82JvI3j3vKfAM+XSOyxlK/ek4ldoM3JoD1vP cwhBD4DNMhOyEDu8LoF+9096dViVLtE= 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-466-WqMW-0tYOkCJQvw7kViKBg-1; Fri, 14 Jan 2022 15:12:48 -0500 X-MC-Unique: WqMW-0tYOkCJQvw7kViKBg-1 Received: by mail-ed1-f69.google.com with SMTP id i9-20020a05640242c900b003fe97faab62so9025389edc.9 for ; Fri, 14 Jan 2022 12:12:48 -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=7iTzTn2n67utbixR5b6YXHlQ+XdyXgKqOT9cBufKBdM=; b=HTSO2PCM9Z+IM4Vba94xx3Wqpak3kXbNpXGl3iPj9AZXE6nQNTJlYPJwZjFVTm0axz l+xetiDjzrtgszsbtUDqoxGac5ExIRTmMX8/wJ1s5YoH4L4iSzg4dAiCpI4jwADiny3U BKL2KCz6UMLx1UrpETNrhvbxoM+Jh2A86u40el5sEansrCKos608ZX8msWyGYN67lbGr ENrFZFIkq1y4e8XKStoxmqBHmS1HA1fWjm9L0Nal9nlsQ0087iQES6E2guC4ryISNljN oswNhN2M1jhLo2GhPhIOJiJDmAAfkanhGe0zPZZ/yQRQVJ2rrgGJOzG4EUH1c9bJBwC1 8g+A== X-Gm-Message-State: AOAM5309WIWVv8fROpiH1Ds3kfvj9oBYfdkmSFxBTFmBiAXbWTMxxAYP rzSGMurhYrlPb2rVb39loSHMMi1XODmaSpfNxjF/6zdfA0oTMyAp69RxnVBcEo7p5OAzqlJ197V AOoUFvBd0DFGxNXhUJAgaIk6WPTUJ X-Received: by 2002:a17:906:4998:: with SMTP id p24mr8386859eju.131.1642191167097; Fri, 14 Jan 2022 12:12:47 -0800 (PST) X-Received: by 2002:a17:906:4998:: with SMTP id p24mr8386847eju.131.1642191166939; Fri, 14 Jan 2022 12:12:46 -0800 (PST) Received: from redhat.com ([2.55.154.210]) by smtp.gmail.com with ESMTPSA id u12sm1884500eda.56.2022.01.14.12.12.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 12:12:45 -0800 (PST) Date: Fri, 14 Jan 2022 15:12:42 -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: <20220114151142-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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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. -- MST