Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp370863pxb; Wed, 15 Sep 2021 04:09:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE1ridt+47t1AXbvznUllRFp06KVWhbrDLlGTKJkkwO5JbN7ByJyemob39/XbYHhLpGCH1 X-Received: by 2002:a05:6512:2253:: with SMTP id i19mr17140994lfu.281.1631704188926; Wed, 15 Sep 2021 04:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631704188; cv=none; d=google.com; s=arc-20160816; b=f4qvnfArGWdHdTwgenNJYYSLDiHxnGzF6HNzHa6UMzmt+CcLauMHqosorH9XN8/6z/ MQ3R3iPxHItBgyVYgyfEIveuTfavIiYx82veNQsZxRp2VJ+Y/6o71wy1xBThQFmcinQN f8HztduQJMtjSvIk5X1SWumPwrSMSUJR9s62/ZQmvzUAUCFdgkAQjKxoParw2UETaLHp DHZ1qJVGL+Ph0zEuLh5Htu2UbMMXjPdXcCwQmzQ3LaxtMURO9kwp30eG7Vc0sb4Y0Arz H+nCkOt+PPkuhBaml52Ovrbau6uieGnRwxosqRmXkhFAn5OdSOn6Gh+coQfIen9GjGqb oNlg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5T4EtY6YqPdr6DqANexUv6V+E1smvYyFTvihkINkGvw=; b=D6tGh5x7U4Rxhpo/OErV6z9hFWX77fdMEBjVxAPEtWuI/GwBfd5azZLpfSfeIRwuP2 +iaGgyS9jpsM/vwAPJ1wSzR65y8dNLfIJLrFH32hUjn3qtf8FBz5UV+LptGGvPfx3XQs DJQOS0Jwii/DU4ZkwcATwaGqBfYq5JZYRvSgtWA0X2n8T3am6FsBXoIsADkxsbWZg1Nf nX9lzMQKdw6NcLfuPfh59OdSOoOCfytVCrp/hJ5lYcfWZRKjo/Y1MTiYt3JxpWW5XZBi FugmgKvpv6o+bMojcsgZo4VvY/HSpMryBSJ5/yc8UrM8LzDDx3G0fUBOmFs7x4PcXWTk JLdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bVD1Lc0M; 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=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 o10si16237685ljp.65.2021.09.15.04.09.17; Wed, 15 Sep 2021 04:09:48 -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=@redhat.com header.s=mimecast20190719 header.b=bVD1Lc0M; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237415AbhIOLIq (ORCPT + 99 others); Wed, 15 Sep 2021 07:08:46 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46481 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbhIOLIq (ORCPT ); Wed, 15 Sep 2021 07:08:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631704047; 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: in-reply-to:in-reply-to:references:references; bh=5T4EtY6YqPdr6DqANexUv6V+E1smvYyFTvihkINkGvw=; b=bVD1Lc0MNYUxsApaypv8fQHJnxvVHkXFkicP2qnstMhIKTOhfpFfCQ3w+/gM7JeP5J73v1 a+2riIxEpi5BF0srmw9/ORhHAeSutihJO1gPPdMYCrdHs5fTsj/D1lksEWmdlDduS675gU KzDgBm/LlxQENWjy3Y91xgko8Wq6ZZQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-475-aCbSQP8EPLmmX-VKbchtlw-1; Wed, 15 Sep 2021 07:07:25 -0400 X-MC-Unique: aCbSQP8EPLmmX-VKbchtlw-1 Received: by mail-wm1-f71.google.com with SMTP id y12-20020a1c7d0c000000b003077f64d75fso1281666wmc.7 for ; Wed, 15 Sep 2021 04:07:25 -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:in-reply-to; bh=5T4EtY6YqPdr6DqANexUv6V+E1smvYyFTvihkINkGvw=; b=f24b5B9PdS6Zg+cXWB10ZZRR6GJJVEM0OvO+gxITXViVDgmq9S29kUtA4I1XqA1tu+ H3cZQGnNYZdCk3eUUZqCOWwJJSIHe++M6HCiEAaddHqPlvdiABHxYb4s0gw661aqL/y3 ybAIPQHTR7DiLgsr+ufoF5VWYSvSKeqDUwK9hVVkY2zighKtK7ykLx5zBJkavzMrDsAB BLwe5j99MwtGqkn0KnxV5TEQR4v7KBwCJwtAg0CrxC2HqFgw2trupypxQNZXgQi3Lhay ASk2PVQVtJEr+OTvcExD+ntf95pA74oXsg/M4crwgEM8casWTbz2wNKdXWg+uTbofNZ3 XSmQ== X-Gm-Message-State: AOAM533IMs9GC+WcImlDFq670H8GIMcUaBm68i4Ec59c9ZBDDROTfU1y QFYWIGs+zxIMVLPzZiSftP4VutJ0jIycNI7FLPm/bpZDxzysEyKrszijZYDhMMrQ8YwDC3eVZRS pLIJ/nzSx0IQ6i8pHJnVMTQW7 X-Received: by 2002:a1c:4b09:: with SMTP id y9mr3739736wma.45.1631704044487; Wed, 15 Sep 2021 04:07:24 -0700 (PDT) X-Received: by 2002:a1c:4b09:: with SMTP id y9mr3739706wma.45.1631704044191; Wed, 15 Sep 2021 04:07:24 -0700 (PDT) Received: from redhat.com ([2.55.157.56]) by smtp.gmail.com with ESMTPSA id z12sm8302896wro.75.2021.09.15.04.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 04:07:23 -0700 (PDT) Date: Wed, 15 Sep 2021 07:07:20 -0400 From: "Michael S. Tsirkin" To: Wu Zongyong Cc: jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, tiwei.bie@intel.com, wei.yang1@linux.alibaba.com Subject: Re: [PATCH] vhost_vdpa: unset vq irq before freeing irq Message-ID: <20210915070703-mutt-send-email-mst@kernel.org> References: <02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.com> <20210915032510-mutt-send-email-mst@kernel.org> <20210915075232.GA18977@L-PF27918B-1352.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210915075232.GA18977@L-PF27918B-1352.localdomain> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 15, 2021 at 03:52:32PM +0800, Wu Zongyong wrote: > On Wed, Sep 15, 2021 at 03:26:41AM -0400, Michael S. Tsirkin wrote: > > On Wed, Sep 15, 2021 at 02:39:32PM +0800, Wu Zongyong wrote: > > > Currently we unset vq irq after freeing irq and that will result in > > > error messages: > > > > > > pi_update_irte: failed to update PI IRTE > > > irq bypass consumer (token 000000005a07a12b) unregistration fails: -22 > > > > > > This patch solves this. > > > > > > Signed-off-by: Wu Zongyong > > > --- > > > drivers/vhost/vdpa.c | 8 ++++---- > > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c > > > index f41d081777f5..15bae2290bf9 100644 > > > --- a/drivers/vhost/vdpa.c > > > +++ b/drivers/vhost/vdpa.c > > > @@ -173,6 +173,10 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) > > > if (status != 0 && (ops->get_status(vdpa) & ~status) != 0) > > > return -EINVAL; > > > > > > + if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK)) > > > + for (i = 0; i < nvqs; i++) > > > + vhost_vdpa_unsetup_vq_irq(v, i); > > > + > > > > If we do this before reset like this then the device might assert the > > irq, might it not? > > > This would not be a problem. > AFAIK, vhost_vdpa_unsetup_vq_irq just disables the irq offloading, and the irq > will be handled if there comes an irq. Oh, right. ACK. > > > if (status == 0) { > > > ret = ops->reset(vdpa); > > > if (ret) > > > > > > > @@ -184,10 +188,6 @@ static long vhost_vdpa_set_status(struct vhost_vdpa *v, u8 __user *statusp) > > > for (i = 0; i < nvqs; i++) > > > vhost_vdpa_setup_vq_irq(v, i); > > > > > > - if ((status_old & VIRTIO_CONFIG_S_DRIVER_OK) && !(status & VIRTIO_CONFIG_S_DRIVER_OK)) > > > - for (i = 0; i < nvqs; i++) > > > - vhost_vdpa_unsetup_vq_irq(v, i); > > > - > > > return 0; > > > > > > > > > } > > > > > > -- > > > 2.31.1