Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp239450pxb; Wed, 15 Sep 2021 00:31:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/Rqtynvq7CGmxQacLQ0bn17PJ05kM267MQiFzxFhnsard5qv3x0J/jFEO9tow46qhmx52 X-Received: by 2002:a2e:7d0e:: with SMTP id y14mr19253620ljc.251.1631691082326; Wed, 15 Sep 2021 00:31:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631691082; cv=none; d=google.com; s=arc-20160816; b=xOYLXmIifcDeWttEqbNGe/ZAH7ZfhSDxCoIdrie/S1R4ruF7GrC7qwcTsAB9KjiwQK J0eLPz0gmN/9F3vjauRHThMLzGgH/379+Tv5H4iVGjRw8a+sE0o8FYAwIzcEUu8L1reM HnGsYp5nJn/tSEpjfTzoPO3iKqICfYd18PCEDPRZPvYyE1aigIdCoCl4uMLs2W3aSuWE 8+x5HG0oaGgRLr8MSjCMl/W/7Qy0OHZTGwbus12aE3K0+n9AlEbNXl67w2VdHXkewrpW /jXOfO/+0gdZYsqpGCkbXAgg0JTqqdVonSsyklFZ14uUOOaTXKG5dsl9DmbZ1Ex3J9Ve rNTw== 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=LxE2x0LHpSWmPDUKiA4SC3PMYHF62O6V8fJ2k4L/mOE=; b=Uc0lE274xyhNTXFaqJ8oNIXSIqA4fSwsYCkuz5Writ6FO5ZbmLP4qj+JTW+qp14x32 8napVAHVgKUmbem7rJ55y1uZJqthICq+aVshOprhNBvKviwU0gAhVTp+GxajgFYq3BjT 1U3d5qVR7oYHzt+UT4visnUhSkUF+9uqKmnhTSNECHupJWTnkfV1yTGIlpbfKPW3rUkp OL7GDecF0e2vR8ls6xWsN05I9pTUIW8mHUCUoUxVZ1BKpESSJAlxQN5rvKufCKBv/6SI 0H42jQ5eVcKiUA/Mnc1SEBa3tt/tvPSUPuhes8f9M7hFtl33je0fIXZfkOsOXiwRPr3q LxBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="N1LOt/FR"; 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 x6si15884591ljj.36.2021.09.15.00.30.54; Wed, 15 Sep 2021 00:31:22 -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="N1LOt/FR"; 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 S236553AbhIOH2H (ORCPT + 99 others); Wed, 15 Sep 2021 03:28:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:39594 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230240AbhIOH2G (ORCPT ); Wed, 15 Sep 2021 03:28:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631690807; 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=LxE2x0LHpSWmPDUKiA4SC3PMYHF62O6V8fJ2k4L/mOE=; b=N1LOt/FRiyDIe6kI7xYI4sFN8TFiBfzratPsqoxJOVDM5pDLhyFCJlsfkghmBbkdrv0Bfo zmNYy2dhegqrE7P6IkW1oZZfX06U3T1FQVDA1bbSz35e1m8oQtft0RMO3jmoDtYFTf8UhU tEjeFtwyQ7rLCrHxmBSY9JtsqDluuqw= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-511-0u5L16_nPjS_EZDWTSBAcg-1; Wed, 15 Sep 2021 03:26:46 -0400 X-MC-Unique: 0u5L16_nPjS_EZDWTSBAcg-1 Received: by mail-wr1-f69.google.com with SMTP id e1-20020adfa741000000b0015e424fdd01so170641wrd.11 for ; Wed, 15 Sep 2021 00:26:46 -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=LxE2x0LHpSWmPDUKiA4SC3PMYHF62O6V8fJ2k4L/mOE=; b=LHEZPQXRbA6aDnieXNCGapU6bV/MXd4QrgdAIbEy1OVCNdWMQiUO5KOao7Qvsp+hMS qEya5Eeoj4Ti7bUoC4HJKfxqZCfjq73Xci3Cjy1FcCPaHo1uxOZF7RcPWnCqxK2dH07a TpZ6RuBzr4KvQMU01IVHYQr45AYqSqC27XlfaVLY0htkHEGXVfOCIEbqXNT9Bu0c65e7 Kb6Onx2X/e8HrrniUfeu3BOey25qISLKvo8o/MgZCFOWhRjaUz9K20q5kTZs60KFGvSS zvUlwz1mpAnW+aPbGUxkv6RN8PpiStmYTr28nczYoVKCAla/mCH0YMaAYtzAwrJMr+gD ML5Q== X-Gm-Message-State: AOAM5321OEhOkXlyDMPAFgbg90kNnuwF1V1sbeMlk8CdbcyYflQPPhv9 tkTZDirjFDpRkz/FfwWSjSqfiJ8EJv2xwEWKRaOUU0/YP4uSsOY4jl2AnMPz41XaQPz0liHfHCc tJXvBchnv5vbibKfVZF9bQIEV X-Received: by 2002:a1c:f00a:: with SMTP id a10mr2795702wmb.112.1631690805673; Wed, 15 Sep 2021 00:26:45 -0700 (PDT) X-Received: by 2002:a1c:f00a:: with SMTP id a10mr2795691wmb.112.1631690805485; Wed, 15 Sep 2021 00:26:45 -0700 (PDT) Received: from redhat.com ([2.55.157.56]) by smtp.gmail.com with ESMTPSA id m29sm13517929wrb.89.2021.09.15.00.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Sep 2021 00:26:44 -0700 (PDT) Date: Wed, 15 Sep 2021 03:26:41 -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: <20210915032510-mutt-send-email-mst@kernel.org> References: <02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <02637d38dcf4e4b836c5b3a65055fe92bf812b3b.1631687872.git.wuzongyong@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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