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 F367D1200A for ; Mon, 15 Jan 2018 10:14:52 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2018 01:14:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,362,1511856000"; d="scan'208";a="10163799" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga007.fm.intel.com with ESMTP; 15 Jan 2018 01:14:50 -0800 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Jan 2018 01:14:50 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 15 Jan 2018 01:14:50 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Mon, 15 Jan 2018 17:14:48 +0800 From: "Chen, Junjie J" To: "Yang, Zhiyong" , "yliu@fridaylinux.org" , "maxime.coquelin@redhat.com" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] vhost: do deep copy while reallocate vq Thread-Index: AQHTjbQyopx1w1avvUa06Po/lYrCYqN0HoiAgACH5+A= Date: Mon, 15 Jan 2018 09:14:47 +0000 Message-ID: References: <1516015939-11266-1-git-send-email-junjie.j.chen@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWI5YjgxOWEtMTBmMy00Y2M1LTk1Y2ItYTQzNDUxZTEyM2RmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiI3R0JLM1dCNlV0R1FlMlZaWjFybXI0U2FXc0srcUl1OG9iMUxuSHY5RWVUNE9VYXBoclg0RHpnVTFBWmozVWtDIn0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] vhost: do deep copy while reallocate vq 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: Mon, 15 Jan 2018 09:14:53 -0000 Hi > > @@ -227,6 +227,7 @@ vhost_user_set_vring_num(struct virtio_net *dev, > > "zero copy is force disabled\n"); > > dev->dequeue_zero_copy =3D 0; > > } > > + TAILQ_INIT(&vq->zmbuf_list); > > } > > > > vq->shadow_used_ring =3D rte_malloc(NULL, @@ -261,6 +262,9 @@ > > numa_realloc(struct virtio_net *dev, int index) > > int oldnode, newnode; > > struct virtio_net *old_dev; > > struct vhost_virtqueue *old_vq, *vq; > > + struct zcopy_mbuf *new_zmbuf; > > + struct vring_used_elem *new_shadow_used_ring; > > + struct batch_copy_elem *new_batch_copy_elems; > > int ret; > > > > old_dev =3D dev; > > @@ -285,6 +289,33 @@ numa_realloc(struct virtio_net *dev, int index) > > return dev; > > > > memcpy(vq, old_vq, sizeof(*vq)); > > + TAILQ_INIT(&vq->zmbuf_list); > > + > > + new_zmbuf =3D rte_malloc_socket(NULL, vq->zmbuf_size * > > + sizeof(struct zcopy_mbuf), 0, newnode); > > + if (new_zmbuf) { > > + rte_free(vq->zmbufs); > > + vq->zmbufs =3D new_zmbuf; > > + } >=20 > You need to consider how to handle the case ( rte_malloc_socket return > NULL). If it failed to allocate new_zmbuf, it uses old zmbufs, so as to keep vhost= alive. >=20 > > + new_shadow_used_ring =3D rte_malloc_socket(NULL, > > + vq->size * sizeof(struct vring_used_elem), > > + RTE_CACHE_LINE_SIZE, > > + newnode); > > + if (new_shadow_used_ring) { > > + rte_free(vq->shadow_used_ring); > > + vq->shadow_used_ring =3D new_shadow_used_ring; > > + } > > + >=20 > Ditto >=20 > > + new_batch_copy_elems =3D rte_malloc_socket(NULL, > > + vq->size * sizeof(struct batch_copy_elem), > > + RTE_CACHE_LINE_SIZE, > > + newnode); > > + if (new_batch_copy_elems) { > > + rte_free(vq->batch_copy_elems); > > + vq->batch_copy_elems =3D new_batch_copy_elems; > > + } >=20 > Ditto >=20 > > + > > rte_free(old_vq); > > } > > > > -- > > 2.0.1