From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from homiemail-a95.g.dreamhost.com (sub4.mail.dreamhost.com [69.163.253.135]) by dpdk.org (Postfix) with ESMTP id BDAA93977 for ; Wed, 16 Nov 2016 00:32:03 +0100 (CET) Received: from homiemail-a95.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a95.g.dreamhost.com (Postfix) with ESMTP id 705856000503; Tue, 15 Nov 2016 15:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=aclectic.com; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s= aclectic.com; bh=czWSSl2ZXGqjRY576U61D/CpQGY=; b=XeVr0sEcAGHrzKZ M196oPkIn0XaY8P/eMMP7TSwPp+e/KWWt7Jo9Nc8rafSeQjvQ6fgsBSLmt89rPyH zAlFnKIW0QqNgoZXudLrCm58gGnClHakNYITZWEqc25l4V4gYEJ6uJSKoCLFmNtG 0x/kLVEnpCYnhqPOjD8rRlCRsDU4= Received: from [192.168.42.133] (184-23-16-60.dsl.static.fusionbroadband.com [184.23.16.60]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jason.lefley@aclectic.com) by homiemail-a95.g.dreamhost.com (Postfix) with ESMTPSA id 2FE0E6000501; Tue, 15 Nov 2016 15:32:02 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: Jason Lefley In-Reply-To: <80e0712c-6bc6-745e-bf5e-610bae2290f0@intel.com> Date: Tue, 15 Nov 2016 15:32:00 -0800 Cc: users@dpdk.org, "Yahya H. Mirza" Content-Transfer-Encoding: quoted-printable Message-Id: <79F32956-AE3D-44AA-9138-7855C6E412AB@aclectic.com> References: <80e0712c-6bc6-745e-bf5e-610bae2290f0@intel.com> To: Daniel Verkamp X-Mailer: Apple Mail (2.3124) Subject: Re: [dpdk-users] Using DPDK EAL with existing multi-threaded application X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2016 23:32:04 -0000 Hi Daniel, Thanks for the information. I reverted my changes to rte_eal_init() and = added the following code rte_cpuset_t cpuSet; CPU_ZERO(&cpuSet); unsigned coreCount =3D sysconf(_SC_NPROCESSORS_CONF); for (unsigned i =3D 0; i < coreCount; i++) { CPU_SET(i, &cpuSet); } rte_thread_set_affinity(&cpuSet); after calling rte_eal_init(). My TBB code now works as expected. > On Nov 11, 2016, at 10:19 AM, Daniel Verkamp = wrote: >=20 > On 11/07/2016 11:39 PM, Jason Lefley wrote: >> I am working on leveraging SPDK (which internally uses EAL from DPDK) >> from an existing application that uses Intel=E2=80=99s TBB. I do not = need to >> use EAL for multithreading but SPDK does require at least huge page >> support and PCI access from EAL. >>=20 >> I noticed that if I try to use TBB=E2=80=99s parallel_for() after I = have >> called rte_eal_init(), then the TBB operation doesn=E2=80=99t = actually run in >> parallel. If I remove the call to rte_eal_init(), the TBB operations >> work as expected however I then cannot use SPDK. Does anyone have any >> input regarding how I can keep my existing multi-threaded application >> working as intended as I integrate SPDK/DPDK? >>=20 >> Thanks >>=20 >=20 > Hi Jason, >=20 > If you are not calling any functions that rely on DPDK's lcore pinning > for correctness, you should be able to change the calling thread's CPU > affinity with rte_thread_set_affinity() so that newly-created threads > can run on more than one CPU core. I am not sure how TBB creates its > threads, but as long as you set the affinity before calling any TBB > functions, the updated CPU affinity should be inherited by any > newly-created threads. >=20 > There is a recently-implemented helper function in SPDK to temporarily > change the thread affinity in this way: >=20 > = https://github.com/spdk/spdk/commit/fa5206c416144b41c384d678cf33f98f1fe104= 2c >=20 > Thanks, > -- Daniel