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=-8.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 441BDC43214 for ; Thu, 5 Aug 2021 07:12:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2565660ED6 for ; Thu, 5 Aug 2021 07:12:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237800AbhHEHNH (ORCPT ); Thu, 5 Aug 2021 03:13:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59651 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230037AbhHEHNF (ORCPT ); Thu, 5 Aug 2021 03:13:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628147571; 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=n0VxlG+I9DtspBlzYcgwvjsV5zD4hYtPEcF5uDUSb8k=; b=WnKShFfOo6rJV5EhQ9lb/uy7ktJQ7UGiYB787gx3g1QbQjDkMN2WZaPNV3i6eIIRfd7lWW xpPS6on/6Pslm66W77lCqGMyNUHz/W8xC7Pt8oXhPyihmDUVYm0crXhsdApFNo91BKeQti nD3m68uyx3SX8yz1rQkutZ6tX+65Omw= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-569-JmYAQgcHO8i4yI-utcAZbA-1; Thu, 05 Aug 2021 03:12:50 -0400 X-MC-Unique: JmYAQgcHO8i4yI-utcAZbA-1 Received: by mail-pj1-f70.google.com with SMTP id r13-20020a17090a4dcdb0290176dc35536aso4424576pjl.8 for ; Thu, 05 Aug 2021 00:12:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=n0VxlG+I9DtspBlzYcgwvjsV5zD4hYtPEcF5uDUSb8k=; b=VBcUBSudKBG6S+QliSUrb5i8WODvZj7ttV7YA5tTX6TP4byckpaeECLEEvBWCKl159 HdUVKBhOKYVf32LcXBxH793uFuTm8KSpFuKCQzZdzRh4LQTsFrKL5y6jCMkfrodLgMUw cQUmG47CaoL7Q2GOrpSVfa9VajGI2AoGkhZjOJbNzn0GhgZ8+mmCQwC56IY1zStUoPhp DCOz2gUlLuOX5vgpS6qQ2SE1sSaNPBO8YC14OVoiLtTWeP//hWbqpzv4aeUUC3va4gzk CcjU9j4yF30HslfEsCW5vg9xvQ8oQ3tm8I98tGWYU5hfMOaTbnD0roOXg30Gv+kEkN0t B97w== X-Gm-Message-State: AOAM531ar4TvYYcTR2WUmvd2XAYvKJvAZsQDV893iJL5T+TvBD+KlyIB BICeVJZItQK/swU/MyUbCXmZO1F0rb4dWadI+qKr3F4TvjldvhbV/Y9UoXZcGYFTfpFovQBqXhe LDsVynmVHbhueDLemCTpyf6JWZ4XljLwEGG4Bj+/UKROIJteIg7gfRsWicGOJVS6PcF398Vb1hy Hq X-Received: by 2002:a63:190b:: with SMTP id z11mr654577pgl.320.1628147568844; Thu, 05 Aug 2021 00:12:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUfHRxG/dXx9YH24cRrMopBNWNIkigiB28PNmXNoiyFNr8yDY8zBJY64Y2tGLqmxO/3wI2WA== X-Received: by 2002:a63:190b:: with SMTP id z11mr654537pgl.320.1628147568588; Thu, 05 Aug 2021 00:12:48 -0700 (PDT) Received: from wangxiaodeMacBook-Air.local ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id k8sm5028086pfu.116.2021.08.05.00.12.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Aug 2021 00:12:48 -0700 (PDT) Subject: Re: [PATCH v10 10/17] virtio: Handle device reset failure in register_virtio_device() To: Yongji Xie 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 References: <20210729073503.187-1-xieyongji@bytedance.com> <20210729073503.187-11-xieyongji@bytedance.com> <6bb6c689-e6dd-cfa2-094b-a0ca4258aded@redhat.com> From: Jason Wang Message-ID: Date: Thu, 5 Aug 2021 15:12:39 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/8/4 下午5:07, Yongji Xie 写道: > On Wed, Aug 4, 2021 at 4:54 PM Jason Wang wrote: >> >> 在 2021/8/4 下午4:50, Yongji Xie 写道: >>> On Wed, Aug 4, 2021 at 4:32 PM Jason Wang wrote: >>>> 在 2021/8/3 下午5:38, Yongji Xie 写道: >>>>> On Tue, Aug 3, 2021 at 4:09 PM Jason Wang wrote: >>>>>> 在 2021/7/29 下午3:34, Xie Yongji 写道: >>>>>>> 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(). Yes, you're right. Thanks > > Thanks, > Yongji >