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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 D0870C4338F for ; Wed, 4 Aug 2021 09:08:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8CAA60240 for ; Wed, 4 Aug 2021 09:08:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236906AbhHDJIO (ORCPT ); Wed, 4 Aug 2021 05:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235350AbhHDJIO (ORCPT ); Wed, 4 Aug 2021 05:08:14 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D145C06179A for ; Wed, 4 Aug 2021 02:08:02 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id gs8so2628187ejc.13 for ; Wed, 04 Aug 2021 02:08:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vHxgnDbRze3cfbummo1oFdspd0VXUkioTGyKAxbmjBY=; b=rrLb5avlbWWVVZAoiqSf4GuH1Tep3672/ZPFrJ1q2sFsUjVxFnNVB7tKQ6xXG4rhnv 1PpAczmI/qacC7vsiZ2BEcntWSoQhW130Qwg+GEKxWvTPhhjdU0zMqHukOrvN7jIhUoV Nsn2eb0p8F8I1ZJcwL62tBSr6vb1HYCK7y/HkosE9AxRt7VX5in8838+OKYoj/JdigCO 22pQ6zrUz1MLqHboxSN2WElTA63GZmG1OcBMMKNc/LoDbjlq6Lf4z01rVYSWbqkkn5bl mqGmd/oNyGjYpPMnG5vHW8RpUjXvzzZbHlRoL8cVzBdZSTws01CqFaXWZkQX3ftOVtMV f9GA== 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:content-transfer-encoding; bh=vHxgnDbRze3cfbummo1oFdspd0VXUkioTGyKAxbmjBY=; b=Ca+i6jyls5++/mikAcgfMU42eLGkOs0EOJdQtZD8Zv5IsG371X9X7Cl68xdkjMJefc 7jILmLEKACO51rZxXJmP6OLmh3G42Hcs6d4qBpGLTSW8JV5KL8/hXusH2pCz5AXPNjyp IgcdR2zTWyDnHJmM4pxhf1dOf/fEupX3fdfO5nw1mOC39RBoofQqg0pXbwMXe6fphQZH C6hsBKskqtXn/WkGajTmnUCPW1YgOMXWbAqb+D/BAF+bVE1fJp2Qq0zI4kt58NJuatvZ uRTQQoR99aSqCNHzXQk7LFyaB4qxfvns+uiK4d5+wjbGBi8JtkhHS2+vLGexZSzw4tWD R5aQ== X-Gm-Message-State: AOAM533OSbNZ1UggrKh2R6RztK3JX0iJsE02T68HNfDmUN4jHsGkk85x JUuWolLU0ZEJd6bRVlfSWBUib+q0OXnGdpJtbX6q X-Google-Smtp-Source: ABdhPJz7ndtSUpcqEgNkoVHcDwP0fq03BR0Lre7qDAvevyBxeyuNZM0taxEDcIn1Kzh847IXKZfSmIisXg0eBWVCt2c= X-Received: by 2002:a17:906:58c7:: with SMTP id e7mr24219405ejs.197.1628068080494; Wed, 04 Aug 2021 02:08:00 -0700 (PDT) MIME-Version: 1.0 References: <20210729073503.187-1-xieyongji@bytedance.com> <20210729073503.187-11-xieyongji@bytedance.com> <6bb6c689-e6dd-cfa2-094b-a0ca4258aded@redhat.com> In-Reply-To: From: Yongji Xie Date: Wed, 4 Aug 2021 17:07:49 +0800 Message-ID: Subject: Re: [PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device() To: Jason Wang Cc: "Michael S. Tsirkin" , Stefan Hajnoczi , Stefano Garzarella , Parav Pandit , Christoph Hellwig , Christian Brauner , Randy Dunlap , Matthew Wilcox , Al Viro , Jens Axboe , bcrl@kvack.org, Jonathan Corbet , =?UTF-8?Q?Mika_Penttil=C3=A4?= , Dan Carpenter , joro@8bytes.org, Greg KH , He Zhe , Liu Xiaodong , Joe Perches , songmuchun@bytedance.com, virtualization , netdev@vger.kernel.org, kvm , linux-fsdevel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Aug 4, 2021 at 4:54 PM Jason Wang wrote: > > > =E5=9C=A8 2021/8/4 =E4=B8=8B=E5=8D=884:50, Yongji Xie =E5=86=99=E9=81=93: > > On Wed, Aug 4, 2021 at 4:32 PM Jason Wang wrote: > >> > >> =E5=9C=A8 2021/8/3 =E4=B8=8B=E5=8D=885:38, Yongji Xie =E5=86=99=E9=81= =93: > >>> On Tue, Aug 3, 2021 at 4:09 PM Jason Wang wrote= : > >>>> =E5=9C=A8 2021/7/29 =E4=B8=8B=E5=8D=883:34, Xie Yongji =E5=86=99=E9= =81=93: > >>>>> The device reset may fail in virtio-vdpa case now, so add checks to > >>>>> its return value and fail the register_virtio_device(). > >>>> So the reset() would be called by the driver during remove as well, = or > >>>> is it sufficient to deal only with the reset during probe? > >>>> > >>> Actually there is no way to handle failure during removal. And it > >>> should be safe with the protection of software IOTLB even if the > >>> reset() fails. > >>> > >>> Thanks, > >>> Yongji > >> > >> If this is true, does it mean we don't even need to care about reset > >> failure? > >> > > But we need to handle the failure in the vhost-vdpa case, isn't it? > > > Yes, but: > > - This patch is for virtio not for vhost, if we don't care virtio, we > can avoid the changes > - For vhost, there could be two ways probably: > > 1) let the set_status to report error > 2) require userspace to re-read for status > > It looks to me you want to go with 1) and I'm not sure whether or not > it's too late to go with 2). > Looks like 2) can't work if reset failure happens in vhost_vdpa_release() and vhost_vdpa_open(). Thanks, Yongji