From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id F34F7690F for ; Wed, 28 Dec 2016 12:00:54 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 28 Dec 2016 03:00:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,422,1477983600"; d="scan'208";a="23663553" Received: from yliu-dev.sh.intel.com ([10.239.67.162]) by orsmga002.jf.intel.com with ESMTP; 28 Dec 2016 03:00:52 -0800 From: Yuanhan Liu To: dev@dpdk.org Cc: Yuanhan Liu Date: Wed, 28 Dec 2016 19:02:36 +0800 Message-Id: <1482922962-21036-1-git-send-email-yuanhan.liu@linux.intel.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1482391123-8149-1-git-send-email-yuanhan.liu@linux.intel.com> References: <1482391123-8149-1-git-send-email-yuanhan.liu@linux.intel.com> Subject: [dpdk-dev] [PATCH v2 0/6] net/virtio: fix several multiple process issues X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Dec 2016 11:00:55 -0000 This patch series fixes few crash issues regarding to multiple process model. In my limited fuzzy test, now it works for both virtio 0.95 and 1.0, as well as for the case some virtio-net devices are managed by kernel device while some others are managed by DPDK. --- Maintaining the multiple process support is not an easy task -- you have to be very mindful while coding -- what kind of stuff should and should not be in shared memory. Otherwise, it's very likely the multiple process model will be broken. A typical example is the ops pointer, a pointer to a set of function pointers. Normally, it's a pointer stored in a read-only data section of the application: static const struct virtio_pci_ops legacy_ops = { ..., } The pointer, of course, may vary in different process space. If, however, we store the pointer into shared memory, we could only have one value for it. Setting it from process A and accessing it from process B would likely lead to an illegal memory access. As a result, crash happens. The fix is to keep those addresses locally, in a new struct, virtio_hw_internal. By that, each process maintains it's own version of the pointer (from its own process space). Thus, everything would work as expected. --- Yuanhan Liu (6): ethdev: fix port data mismatched in multiple process model net/virtio: fix wrong Rx/Tx method for secondary process net/virtio: store PCI operators pointer locally net/virtio: store IO port info locally net/virtio: fix multiple process support net/virtio: remove dead structure field drivers/net/virtio/virtio_ethdev.c | 69 +++++++++++++++++++++++++--- drivers/net/virtio/virtio_pci.c | 81 +++++++++++++++++---------------- drivers/net/virtio/virtio_pci.h | 25 ++++++++-- drivers/net/virtio/virtio_user_ethdev.c | 5 +- drivers/net/virtio/virtqueue.h | 2 +- lib/librte_ether/rte_ethdev.c | 58 ++++++++++++++++++++--- 6 files changed, 182 insertions(+), 58 deletions(-) -- 2.8.1