Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2553991pxb; Sun, 5 Sep 2021 23:10:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK1S6aJv38JG+HN2PhtHCKipRmFC72p1bEXQzYvK2NyClOrKbNhbOGE9NSpfIn2Pmnm7ev X-Received: by 2002:a6b:d90b:: with SMTP id r11mr8457743ioc.99.1630908658711; Sun, 05 Sep 2021 23:10:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630908658; cv=none; d=google.com; s=arc-20160816; b=iyWT2b3FDhxtOCD897M7FcQYNU48PVI93e1Tg+YOy+G1HBlvQkrGBueUECPT1BybUX 5MX97+r2kwM3EpSainKPvcMsiEAvjBnr0MGTRrs6i0X7NtCCsqGLEnPX02uDrOI5B7oe DBzIFxq5yOO047yq0X31p4t3AquSeNkjRCh2QrUM1aARaY3nyXjlm22YIHMiNahfaHGN lOs+szEmbqgbEO8INFnbK30Z6pbJM7Q0ApIWj6PBdVONuDmLTrYLHAm6+jjdyirXkpYC yU7RJriI4yGKl1O8hO6r26MP6PSRY1AGWNgAsPvpNwOtdVA6aucW2CuhEKi9YgBHxqs9 OXVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=iLQZhgxKgfIDFt5lvdc2MzHzo2TIxIc31ByxAdyguDw=; b=f/4fi/bowfNPc+dFZsz2F4BKaunpgKUDavMnMsVSLmhdW2vEeugQcBWjtbfsh/2yON 0hXWXjT3pXJRhEiyUirycG8s88ya5wWIXtVFlLr5Bs1NOhXQEPs4iiuD3sFXcpSoq7sH n4f0QaiHnqsaVQdTW0KK6QdVO/io98Qy5VbIM2RT59ZgqE5jIxgQX8njQhLluEmE1LXx MC31vpZl/WyEkyzB7pEX5dNhJCErYnvZLAodufHZnK1PC0LXxhwBKI8W6wR4qBZw4GyC hJNpXEN55hNlTC2/TTm42VHvx8ExNLh08ugruXKj/KusPtsPjV/ZLsr+j2s5SmY7LzJB b1Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=odHfcBGs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i62si6183332iof.83.2021.09.05.23.10.48; Sun, 05 Sep 2021 23:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=odHfcBGs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239199AbhIFGKm (ORCPT + 99 others); Mon, 6 Sep 2021 02:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239048AbhIFGKl (ORCPT ); Mon, 6 Sep 2021 02:10:41 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F111C061757 for ; Sun, 5 Sep 2021 23:09:37 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id z19so7933252edi.9 for ; Sun, 05 Sep 2021 23:09:37 -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; bh=iLQZhgxKgfIDFt5lvdc2MzHzo2TIxIc31ByxAdyguDw=; b=odHfcBGsXMMsYB2K8Do9ItkBkMTq6LWsGfzwSwjDSZ150IpQF83y0vfBln5L7YVgiw 3MpZwyeS+QD8McxuPPxYxbm0B8uAK5/6bNVzGCQ3vsq1gUyf9m37Tv+e5qVdZqDNjAev Xaqo2CLPu9Y3meToLpI9B7J78zGlu+7JUYZ4izYbDZgP2XtyOGajNL0pzHncLqlgsEVm 4bIszAuRtDUfeh0uGsQB/wMMzlHe4FXMtOXP7CcKYI3X3EKfrVxan8x6W96Lfrgxnfnf VkoHn8zk2d48PQu1VwJZG2YCEYOwA1Adig/icsv06Ld2WfJcAwY0GQAelyk08s8IO8Ul YFcQ== 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; bh=iLQZhgxKgfIDFt5lvdc2MzHzo2TIxIc31ByxAdyguDw=; b=CkStBh57TyRQeIntfxZB3nUxvI9iS9tZy2gN7o869851U4mbYGNmq/VXfE9OJ6ssqS 80Bl/ingE6jtrVTZ2oIJgOsqdi3Xi2yRrH3C03Qu93jq3p7I9I1zuLEbBH/haQ09e8mX KakYyIPhK6LcWnTW+UB6YWAxOKsHaPvYStf3N9o1tsZ81zdVtoiemwpasJ9voAtUHY3I xvmOpDeKYhSs3CsLqP6b3APjOW+G6Jmi4xG2Hz2c9ZmKBY8SDyZJEzIPJ3o4MXk6EDXp YXyl7CQQcYYjm4i9Z44FtuDiHXTohAGuJfjp05/ARwQjtsELrcf7+K99Su2eV2i67M09 rAUw== X-Gm-Message-State: AOAM533xhWF+6PGqah9LM49TGigrHijQWOrjpsW8Fdkje5jgvkNZoMUV xaVEcNyEcDsMRWmNo1bD/iGqoPlS/vBvw9cjfV7I X-Received: by 2002:a05:6402:4247:: with SMTP id g7mr11700392edb.287.1630908576144; Sun, 05 Sep 2021 23:09:36 -0700 (PDT) MIME-Version: 1.0 References: <20210831103634.33-1-xieyongji@bytedance.com> <20210831103634.33-6-xieyongji@bytedance.com> <20210906015524-mutt-send-email-mst@kernel.org> In-Reply-To: <20210906015524-mutt-send-email-mst@kernel.org> From: Yongji Xie Date: Mon, 6 Sep 2021 14:09:25 +0800 Message-ID: Subject: Re: [PATCH v13 05/13] vdpa: Add reset callback in vdpa_config_ops To: "Michael S. Tsirkin" Cc: Jason Wang , 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 , Robin Murphy , Will Deacon , John Garry , 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 6, 2021 at 1:56 PM Michael S. Tsirkin wrote: > > On Tue, Aug 31, 2021 at 06:36:26PM +0800, Xie Yongji wrote: > > This adds a new callback to support device specific reset > > behavior. The vdpa bus driver will call the reset function > > instead of setting status to zero during resetting. > > > > Signed-off-by: Xie Yongji > > > This does gloss over a significant change though: > > > > --- > > @@ -348,12 +352,12 @@ static inline struct device *vdpa_get_dma_dev(struct vdpa_device *vdev) > > return vdev->dma_dev; > > } > > > > -static inline void vdpa_reset(struct vdpa_device *vdev) > > +static inline int vdpa_reset(struct vdpa_device *vdev) > > { > > const struct vdpa_config_ops *ops = vdev->config; > > > > vdev->features_valid = false; > > - ops->set_status(vdev, 0); > > + return ops->reset(vdev); > > } > > > > static inline int vdpa_set_features(struct vdpa_device *vdev, u64 features) > > > Unfortunately this breaks virtio_vdpa: > > > static void virtio_vdpa_reset(struct virtio_device *vdev) > { > struct vdpa_device *vdpa = vd_get_vdpa(vdev); > > vdpa_reset(vdpa); > } > > > and there's no easy way to fix this, kernel can't recover > from a reset failure e.g. during driver unbind. > Yes, but it should be safe with the protection of software IOTLB even if the reset() fails during driver unbind. Thanks, Yongji