From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 491D242BEF; Wed, 31 May 2023 11:30:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D2D740ED7; Wed, 31 May 2023 11:30:37 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id DAAE340A82 for ; Wed, 31 May 2023 11:30:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685525434; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MGLDs4g2M+yXPL6OPbI+Wf/5tqusqHVBlV/Jxy7hbFg=; b=fyf+VsXle0REbm0AsJJTBc/XwaV4G/xPIDE237nruXAI+OEdvEtUoKhjPDL7lIFfNLjNwR 0eEVxKHysCQJcQd3r1BYbiBvTOTHX5aVX0NZRMSG+Piu/92OeURSPaCFQw8em/Dn+0NU8l YY16HrJd2u95qlDjvf4GlydkUW45BIs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-222-ghOKiKq_Oper2_PeuQlnow-1; Wed, 31 May 2023 05:30:32 -0400 X-MC-Unique: ghOKiKq_Oper2_PeuQlnow-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC56F802E58; Wed, 31 May 2023 09:30:31 +0000 (UTC) Received: from [10.39.208.19] (unknown [10.39.208.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3C6948205E; Wed, 31 May 2023 09:30:30 +0000 (UTC) Message-ID: <9a463337-c4e7-185b-e0c3-41afb1212cc4@redhat.com> Date: Wed, 31 May 2023 11:30:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH v3 3/4] vhost: fix invalid call FD handling To: "Xia, Chenbo" , Eelco Chaudron , "david.marchand@redhat.com" Cc: "dev@dpdk.org" References: <168431450017.558450.16680518469610688737.stgit@ebuild.local> <168431454344.558450.2397970324914136724.stgit@ebuild.local> From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 5/31/23 08:12, Xia, Chenbo wrote: >> -----Original Message----- >> From: Maxime Coquelin >> Sent: Tuesday, May 30, 2023 8:54 PM >> To: Eelco Chaudron ; Xia, Chenbo >> ; david.marchand@redhat.com >> Cc: dev@dpdk.org >> Subject: Re: [PATCH v3 3/4] vhost: fix invalid call FD handling >> >> >> >> On 5/17/23 11:09, Eelco Chaudron wrote: >>> This patch fixes cases where IRQ injection is tried while >>> the call FD is not valid, which should not happen. >>> >>> Fixes: b1cce26af1dc ("vhost: add notification for packed ring") >>> Fixes: e37ff954405a ("vhost: support virtqueue interrupt/notification >> suppression") >>> >>> Signed-off-by: Maxime Coquelin >>> Signed-off-by: Eelco Chaudron >>> --- >>> lib/vhost/vhost.h | 8 ++++---- >>> 1 file changed, 4 insertions(+), 4 deletions(-) >>> >>> diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h >>> index 37609c7c8d..23a4e2b1a7 100644 >>> --- a/lib/vhost/vhost.h >>> +++ b/lib/vhost/vhost.h >>> @@ -903,9 +903,9 @@ vhost_vring_call_split(struct virtio_net *dev, >> struct vhost_virtqueue *vq) >>> "%s: used_event_idx=%d, old=%d, new=%d\n", >>> __func__, vhost_used_event(vq), old, new); >>> >>> - if ((vhost_need_event(vhost_used_event(vq), new, old) && >>> - (vq->callfd >= 0)) || >>> - unlikely(!signalled_used_valid)) { >>> + if ((vhost_need_event(vhost_used_event(vq), new, old) || >>> + unlikely(!signalled_used_valid)) && >>> + vq->callfd >= 0) { >>> eventfd_write(vq->callfd, (eventfd_t) 1); >>> if (dev->flags & VIRTIO_DEV_STATS_ENABLED) >>> __atomic_fetch_add(&vq->stats.guest_notifications, >>> @@ -974,7 +974,7 @@ vhost_vring_call_packed(struct virtio_net *dev, >> struct vhost_virtqueue *vq) >>> if (vhost_need_event(off, new, old)) >>> kick = true; >>> kick: >>> - if (kick) { >>> + if (kick && vq->callfd >= 0) { >>> eventfd_write(vq->callfd, (eventfd_t)1); >>> if (dev->notify_ops->guest_notified) >>> dev->notify_ops->guest_notified(dev->vid); >>> >> >> Reporting Chenbo's R-by, from the VDUSE series RFC: >> >> Reviewed-by: Chenbo Xia > > Thanks Maxime! Btw: what's your plan of the same fix in VDUSE series, do you plan > to drop it in VDUSE series or? Yes, I'm rebasing my VDUSE series on top of Eelco's. I just need the release note update for the new API, and I'll push Eelco series to next-virtio. Maxime > Thanks, > Chenbo >