Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp252276pxb; Wed, 15 Sep 2021 00:54:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIkFhxb1OXOkT8a4ici7cj3RED8jLWXWGo2WHczH7O0FBK3i6fmY4eDP2Y2z15tPyg395D X-Received: by 2002:a2e:6e06:: with SMTP id j6mr18942923ljc.382.1631692474845; Wed, 15 Sep 2021 00:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631692474; cv=none; d=google.com; s=arc-20160816; b=XNAwgp1x7WKq3DYRHM0Jg/oGhv7lTsWIEipM+dNc9kKM+mhtVGgiKgYZkXWrp9tN7z fQ04CqzCVW07cmfllxpRHL++qjWf+BWOH55cT8Osbzy9tWMKdVfMPrusU802rl5jDs2S 7mhfcE141Pi8Uf53ljzJ691QWuK7sAcE7BoKfbTHs0SQOfD9hXnp20KdqrgwNV3p8mi8 FdriaLcuReTKY7mjllrnJwahN8CCjt87SK96ExSIyB0QKH92EpU5oPAF905u19kzuEyX cjHu05h0eRaeQMQ7T4c8OHj8A/brR6DurSOy0HExRCk+mP2EurXWGHopO7OKVvkBosCl /oQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date; bh=iu1I4w0oOfPQ6FjOUWSOQiVcl4a0n2D7nn2L39Uijdg=; b=L66SfyV7xStXLjQSsOzlnwA7JItmzvDYA4yfH1qXpphNfE4Zslm+8oNA73PuEnuxCx aHkYweDPnzmRPpG4FHvOuuANjy8jMptsBSfTEQZ2Sls2xZXsDHDgCUSJtBLYLEQp7PRd 7x2q1iEbXAQFvf0GP/ElmIWEySK5zsy3sEidnmoThMnYtg2x/m2oHyoR+PeZYidX/5ko drxfIZr4yr/8Qgmr09x6bYIpmq7EbqDZbiIDavJok0uvCuOqUh1tgviSdmOkW4gz7VgW 0IE+B5SWskQ4ih0Ka7mdRj2etka9mQCu4CYd/ZnM38sZMCf0s2ga4OraBSVJ/+wnvypb L/Sw== ARC-Authentication-Results: i=1; mx.google.com; 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=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d16si18337504ljj.472.2021.09.15.00.54.06; Wed, 15 Sep 2021 00:54:34 -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; 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=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231603AbhIOHxx (ORCPT + 99 others); Wed, 15 Sep 2021 03:53:53 -0400 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:52468 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231480AbhIOHxw (ORCPT ); Wed, 15 Sep 2021 03:53:52 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=wuzongyong@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UoSjlhR_1631692352; Received: from localhost(mailfrom:wuzongyong@linux.alibaba.com fp:SMTPD_---0UoSjlhR_1631692352) by smtp.aliyun-inc.com(127.0.0.1); Wed, 15 Sep 2021 15:52:32 +0800 Date: Wed, 15 Sep 2021 15:52:32 +0800 From: Wu Zongyong To: "Michael S. Tsirkin" 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: <20210915075232.GA18977@L-PF27918B-1352.localdomain> Reply-To: Wu Zongyong References: <02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.com> <20210915032510-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210915032510-mutt-send-email-mst@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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