From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qg0-f45.google.com (mail-qg0-f45.google.com [209.85.192.45]) by dpdk.org (Postfix) with ESMTP id 2EFFE2BAB for ; Fri, 4 Mar 2016 08:11:50 +0100 (CET) Received: by mail-qg0-f45.google.com with SMTP id y89so36960751qge.2 for ; Thu, 03 Mar 2016 23:11:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=jLM9UszcUjwVX7s2i1z9tle60/bUpFBuUUuC9t9g+Tk=; b=ahSPO7NPNVDOgy8rk9DPUbUVYgbbKZLVSAlEigZ7bjMY2E6Xu++fNtmTuj1T5Xmi3P bqC4dTvsxGQnyTYsah5uvfpcICzJkLlK7fcerTbsDuh2yJackW2F0MM/0hznsT5AFEaU A9GL3pQyu9E/Q1UgDgMzXgsG25vM4PAqMy3a+z83yRdSQM1ea/pVsSqRQfqXI7J3q94X tCSktCcobE5ICpkQfzNclXqzJHuNx1Our9rmwvjFvWWlTKQAYjIOW8iO2xq17ICbaD/x ke+jRGL5oxK+wcQpET9EkrDr2sl9nIHkjvUGFDg5ExEG1GsGgyxcsnJ3/DACS00B10CQ 3GKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=jLM9UszcUjwVX7s2i1z9tle60/bUpFBuUUuC9t9g+Tk=; b=T518PsfQDHJEalLWDvmfBzTZSDN94BbJcjIIreL5f7hSBuprlqbuaNKXOeIiwcaWTG Vvcakq/HmCglcdfRxvI2lt+xUZdL20OKiovaln2IxJ+mS2pmMWrMBSIBPZ3X9q6PV71k uveTqKsyhTGBw6+NBPCD/E8ZMbfPlovzywyLtRS8JYKp84crjt45psP/dcneYG0KOWWS pbxeJgAATJasA2D49wjTCU8yeIgAiVex5BxNob/Eq4fVxnJ31M3DABgnh+QVXpGSG3G2 ZPqGgD8Zzv27WyU+NcWbseL77BKS9Qwth5+rP6J5a7ZGMsHZnfkbY3qraTxDT+DbcKJf Yjvw== X-Gm-Message-State: AD7BkJJCdDvWmQCqkjRjtiqfYr9r0vgXpflYRjZ7flgtzXjDvdbqxTJqU9UFidffrYeA69S/PqQRXnkJK8FH2vK7 X-Received: by 10.140.104.234 with SMTP id a97mr8152414qgf.57.1457075509639; Thu, 03 Mar 2016 23:11:49 -0800 (PST) MIME-Version: 1.0 Received: by 10.55.207.20 with HTTP; Thu, 3 Mar 2016 23:11:30 -0800 (PST) In-Reply-To: <1456849970-1847-1-git-send-email-christian.ehrhardt@canonical.com> References: <1456849970-1847-1-git-send-email-christian.ehrhardt@canonical.com> From: Christian Ehrhardt Date: Fri, 4 Mar 2016 08:11:30 +0100 Message-ID: To: Christian Ehrhardt , dev Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC] avoid testpmd only working in XEN X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2016 07:11:50 -0000 Hi, I expected more of a discussion fallout as there would be so different approaches to solve it (with the explicit xs_open stuff I mentioned, but that I consider overengineering). I had this running a while now and I can only say for me it works. A few internal people working with Xen acked it as sufficient - but only by looking at the code. Since I got neither objections nor any other negative feedback so far I'll just rewrite the comment and submit it as patch. Christian Ehrhardt Software Engineer, Ubuntu Server Canonical Ltd On Tue, Mar 1, 2016 at 5:32 PM, Christian Ehrhardt < christian.ehrhardt@canonical.com> wrote: > With LIBRTE_PMD_XENVIRT enabled testpmd is built in a way to ONLY work > in XEN environments. > It will surface as: > PMD: gntalloc: ioctl error > EAL: Error - exiting with code: 1 > Cause: Creation of mbuf pool for socket 0 failed > > There could be a complex solution checking if this is a Xen env via > something like: > #include > struct xs_handle *xsh = NULL; > xsh = xs_open(XS_OPEN_READONLY); > check for xsh being NULL ... > > But I see no reason to go so complex and instead the patch goes the > simple and more readable way of just falling back to the normal > allocation if the xen based allocation failed. > --- > app/test-pmd/testpmd.c | 33 ++++++++++++++++----------------- > 1 file changed, 16 insertions(+), 17 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 1319917..b008df3 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -410,7 +410,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned > nb_mbuf, > unsigned int socket_id) > { > char pool_name[RTE_MEMPOOL_NAMESIZE]; > - struct rte_mempool *rte_mp; > + struct rte_mempool *rte_mp = NULL; > uint32_t mb_size; > > mb_size = sizeof(struct rte_mbuf) + mbuf_seg_size; > @@ -423,24 +423,23 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned > nb_mbuf, > rte_pktmbuf_pool_init, NULL, > rte_pktmbuf_init, NULL, > socket_id, 0); > - > - > - > -#else > - if (mp_anon != 0) > - rte_mp = mempool_anon_create(pool_name, nb_mbuf, mb_size, > - (unsigned) mb_mempool_cache, > - sizeof(struct > rte_pktmbuf_pool_private), > - rte_pktmbuf_pool_init, NULL, > - rte_pktmbuf_init, NULL, > - socket_id, 0); > - else > - /* wrapper to rte_mempool_create() */ > - rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf, > - mb_mempool_cache, 0, mbuf_seg_size, socket_id); > - > #endif > > + /* if the former XEN allocation failed fall back to normal > allocation */ > + if (rte_mp == NULL) { > + if (mp_anon != 0) > + rte_mp = mempool_anon_create(pool_name, nb_mbuf, > + mb_size, (unsigned) > mb_mempool_cache, > + sizeof(struct > rte_pktmbuf_pool_private), > + rte_pktmbuf_pool_init, NULL, > + rte_pktmbuf_init, NULL, > + socket_id, 0); > + else > + /* wrapper to rte_mempool_create() */ > + rte_mp = rte_pktmbuf_pool_create(pool_name, > nb_mbuf, > + mb_mempool_cache, 0, mbuf_seg_size, > socket_id); > + } > + > if (rte_mp == NULL) { > rte_exit(EXIT_FAILURE, "Creation of mbuf pool for socket > %u " > "failed\n", socket_id); > -- > 2.7.0 > >