From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 53103237 for ; Tue, 21 Nov 2017 14:27:07 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 0ACDF207F5; Tue, 21 Nov 2017 08:27:05 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 21 Nov 2017 08:27:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=BHIdFVQV7boPSkC3T N2AsK/cN470UnEdFRW7xxfO5UI=; b=pevwzafsX/QKvItX4IM60xZ8vhd2dFj5D XNuiJgnz1dSNOTRKgpfdnubHcixkP0BkiUC6e/4QftJuowp6gSjzkFSENgY9hFAD oNugoiPPG1fZrGDbrqCcbcprVQ2ONvts09xruCTqrVOodzQSfno6YBX/pG+OYAsT Jp09i40O7Q6s8QIP47rbsMa2c+UjmMH89sL3YiK7isQHmlKKivvl0V6FvcS9/Ld4 Z0JDE2E/4nEaD9xPDQwOcgRrpRGMNaMKbSaEwcdDYrlHVADRVd60pjA0xDwJsPrP Jjpdf6412olJXZruqQBhF0TgfOi+InO+crC84lHgpqai/J1XyRRcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=BHIdFVQV7boPSkC3TN2AsK/cN470UnEdFRW7xxfO5UI=; b=WKDl9aE8 /KBZSz9KicEY9aauzkF8Yzx+EMjRIS72k07xWGtaCTVyJMm34MhZfYfp0JWGA6Qa wx8NuzRS82gRlVvz23l6wOg2FuNfP+znysTRVDzUd/ump18AjrPbfoJnO4Uz2aEE vwQrex3UBMOWA4Ipq/sNS8xXzsD+cPHPa+3yEhXl8lc5JjHGTm7g4jTWrf7TRtXV qfvT9aWR1i6Pa05BDMKAISYaPfa8bvjmi05wvz/KU0zTN8osr9qJkCHn/akaMNR5 SIU0TJF0FbCuLoigrzyT8TT+EEOWMvGE2xTnKmktd8jUQYX4Z4rPEdU6gCN9gp5n nLdqa9mxaC9NFw== X-ME-Sender: Received: from localhost.localdomain (unknown [180.158.62.0]) by mail.messagingengine.com (Postfix) with ESMTPA id 0D87B24A81; Tue, 21 Nov 2017 08:27:01 -0500 (EST) From: Yuanhan Liu To: Anatoly Burakov Cc: dpdk stable Date: Tue, 21 Nov 2017 21:17:44 +0800 Message-Id: <1511270333-31002-122-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> References: <1511270333-31002-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'vfio: fix secondary process initialization' has been queued to stable release 17.08.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Nov 2017 13:27:07 -0000 Hi, FYI, your patch has been queued to stable release 17.08.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 11/24/17. So please shout if anyone has objections. Thanks. --yliu --- >>From 0b4818ab16b92bcfcb77f1696ad3f9b50a41ae02 Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Fri, 20 Oct 2017 14:23:52 +0100 Subject: [PATCH] vfio: fix secondary process initialization [ upstream commit 69f7504949e95f6ad89260fb59da90f0f1fede87 ] When getting group fd from primary process, secondary wasn't storing the fd anywhere, leading to a (harmless) error message in EAL logs, and (not so harmless) potential problems when hot-unplugging devices managed by VFIO in a secondary process. Fix it by actually storing the group fd whenever we get a valid one from the secondary process. Fixes: 94c0776b1bad ("vfio: support hotplug") Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_vfio.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c index 946df7e..3f048f1 100644 --- a/lib/librte_eal/linuxapp/eal/eal_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c @@ -68,8 +68,8 @@ vfio_get_group_fd(int iommu_group_no) { int i; int vfio_group_fd; - int group_idx = -1; char filename[PATH_MAX]; + struct vfio_group *cur_grp; /* check if we already have the group descriptor open */ for (i = 0; i < VFIO_MAX_GROUPS; i++) @@ -85,12 +85,12 @@ vfio_get_group_fd(int iommu_group_no) /* Now lets get an index for the new group */ for (i = 0; i < VFIO_MAX_GROUPS; i++) if (vfio_cfg.vfio_groups[i].group_no == -1) { - group_idx = i; + cur_grp = &vfio_cfg.vfio_groups[i]; break; } /* This should not happen */ - if (group_idx == -1) { + if (i == VFIO_MAX_GROUPS) { RTE_LOG(ERR, EAL, "No VFIO group free slot found\n"); return -1; } @@ -123,8 +123,8 @@ vfio_get_group_fd(int iommu_group_no) /* noiommu group found */ } - vfio_cfg.vfio_groups[group_idx].group_no = iommu_group_no; - vfio_cfg.vfio_groups[group_idx].fd = vfio_group_fd; + cur_grp->group_no = iommu_group_no; + cur_grp->fd = vfio_group_fd; vfio_cfg.vfio_active_groups++; return vfio_group_fd; } @@ -157,9 +157,12 @@ vfio_get_group_fd(int iommu_group_no) return 0; case SOCKET_OK: vfio_group_fd = vfio_mp_sync_receive_fd(socket_fd); - /* if we got the fd, return it */ + /* if we got the fd, store it and return it */ if (vfio_group_fd > 0) { close(socket_fd); + cur_grp->group_no = iommu_group_no; + cur_grp->fd = vfio_group_fd; + vfio_cfg.vfio_active_groups++; return vfio_group_fd; } /* fall-through on error */ -- 2.7.4