Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp212321pxb; Tue, 14 Sep 2021 23:42:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwFq6tsbENF4qT+tn0Vn34ymgHrQZraQfL88C6k8oA+B9y++sok8Y99laO2tw558RwI622 X-Received: by 2002:a6b:3f08:: with SMTP id m8mr17131158ioa.117.1631688139347; Tue, 14 Sep 2021 23:42:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631688139; cv=none; d=google.com; s=arc-20160816; b=hf0x5SJqVE57PuAwQcCkBC/F7hfQvVwzSnLAh+lr//pGa5COzQ65Cybuo7ASLHchKv bhXCIH38TNnNb/wcdCjSkqX2vUlOyI2jaLby93RJmPnsQrWcvP2+y1YxwqzVoceZKzq1 OM6k0R7Pw+ZMqSHR73fE2dDrTTuDE39IdSVtVWsuWmXxvU7gOsh9/WNnkKV5qboqotP0 kpztu6jHY/VkR+Ci/6xQvq9gi/CBPuAyEmeUPRqhvFhs27YRAJ37+VkITMaQLeC00y1G DqkOLkbQhthtz7j7XM1TZIKR02W51++8+laWZi4MsUFCnZUDv6v9zj8kFpe0rwVkjs8p BOxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=wwNF0DDV38IKnxrXaX4BAJd7HgupxcBzRjJFoeHZnrE=; b=OehY3kSpwu4+hSHx9kGp07E9otztzwcrpfnhyLAPZv18ZQ1wZ36lDh68rlMvZ0ZODh NzDxr5fJG7rEW2mD4/3HZ5SNqi1S+P+Z8NWICMWQie1y8jZP9UGwN81MKBE+rZW7X7IN zZ/s2GUMjVLgrjVmsmnyeq28gOndXTRTXVRz6Ks4Szt1JvrGwZdfYOcdjqHCWydnPu/7 3KUqBu4+eLWKk07E68G8STWQdZ3nWPPaWv9R03eqJQZ/lxDMwLug+EZ9Ubni3LQDmvvw pP+3+UWzkKYVeOXlZAoMQtRxY3xAILi4q8dWzwOvbc+20SNgvNojXYDqeezoJnUmzKPL lmsA== 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 d8si13233727iow.4.2021.09.14.23.42.07; Tue, 14 Sep 2021 23:42:19 -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 S231187AbhIOGlT (ORCPT + 99 others); Wed, 15 Sep 2021 02:41:19 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:13377 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbhIOGlT (ORCPT ); Wed, 15 Sep 2021 02:41:19 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=wuzongyong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0UoSCDY4_1631687981; Received: from localhost.localdomain(mailfrom:wuzongyong@linux.alibaba.com fp:SMTPD_---0UoSCDY4_1631687981) by smtp.aliyun-inc.com(127.0.0.1); Wed, 15 Sep 2021 14:39:49 +0800 From: Wu Zongyong To: wuzongyong@linux.alibaba.com, jasowang@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, mst@redhat.com, tiwei.bie@intel.com Cc: wei.yang1@linux.alibaba.com Subject: [PATCH] vhost_vdpa: unset vq irq before freeing irq Date: Wed, 15 Sep 2021 14:39:32 +0800 Message-Id: <02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 (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