From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1F24AA0487 for ; Tue, 30 Jul 2019 11:47:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ECA261C0AC; Tue, 30 Jul 2019 11:47:02 +0200 (CEST) Received: from mail-vs1-f65.google.com (mail-vs1-f65.google.com [209.85.217.65]) by dpdk.org (Postfix) with ESMTP id CAB831C07C for ; Tue, 30 Jul 2019 11:47:00 +0200 (CEST) Received: by mail-vs1-f65.google.com with SMTP id 2so42996285vso.8 for ; Tue, 30 Jul 2019 02:47:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Sprk5f6vF+GjqhRywWRQ0i3YLG8EOuCnrhfwm1Bzgjs=; b=Rv1COWBq8E5xDsNE5l0OBVZZIwb2XxK0LDDnQs8K3/JIEMh3xAd8wKYhdr7PZW4YT8 1/t+QW4Y2vlO0k07hvR2Gbyo+kgZ2kfGvCHt6GOGJIzalVX2HnLpH5A7rSy0mmzKT8mM +a0qQJaMR8JB7rpYM/5Ozc98tn/H5c4270nnWF+Mk6nV5VW4WOfmsGopx7i+WDisTOF9 GazrYbDJI2D7UTj//xXZ6WqNiOvWxhgyBdlf4gZL76YvA6RE0vkgk9kFu6MNBJnMNMDt ABa+xh9cvkSDTSqErNl622fxCX/KPXEnX6aSHDM8oDtCKv0iVma8169Mr16wnNhxmsTp VMnQ== X-Gm-Message-State: APjAAAX5bsX9GiQnukgQWCBpiL+E/3Hfqpyj4pwul26FooGi+n5E2BDd 5MnBCp01S5O1zsAxEBZHqdxJxg4hbJsU46pWSrhoFQ== X-Google-Smtp-Source: APXvYqzqhaIoYX3V2+bDa6BRvp//UFgf/9VVjdmq4Xbgm5ytLv95F5PjGlCcCyU0Rj0qrN1Dp9i56NH2biPQyK2tQeg= X-Received: by 2002:a67:f998:: with SMTP id b24mr22617033vsq.180.1564480020224; Tue, 30 Jul 2019 02:47:00 -0700 (PDT) MIME-Version: 1.0 References: <1564479354-11192-1-git-send-email-david.marchand@redhat.com> In-Reply-To: From: David Marchand Date: Tue, 30 Jul 2019 11:46:48 +0200 Message-ID: To: Jerin Jacob Kollanukkaran Cc: "dev@dpdk.org" , "johan.kallstrom@ericsson.com" , "anatoly.burakov@intel.com" , "olivier.matz@6wind.com" , "stable@dpdk.org" Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH] eal: fix ctrl thread affinity with --lcores 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jul 30, 2019 at 11:45 AM Jerin Jacob Kollanukkaran wrote: > > > -----Original Message----- > > From: dev On Behalf Of David Marchand > > Sent: Tuesday, July 30, 2019 3:06 PM > > To: dev@dpdk.org > > Cc: johan.kallstrom@ericsson.com; anatoly.burakov@intel.com; > > olivier.matz@6wind.com; stable@dpdk.org > > Subject: [dpdk-dev] [PATCH] eal: fix ctrl thread affinity with --lcores > > > > When using -l/-c options, each lcore is mapped to a physical cpu in a > > 1:1 fashion. > > On the contrary, when using --lcores, each lcore has its own cpuset on which the > > associated EAL thread runs. > > > > To handle those two situations, rely on the per lcore cpuset. > > > > Introduced macros to manipulate cpusets in both Linux and FreeBSD. > > > > Examples in a 4 cores FreeBSD vm: > > > > $ ./build/app/testpmd --master-lcore 1 --lcores '0@(1,3),1@2' \ --no-huge --no- > > pci -m 512 -- -i --total-num-mbufs=2048 > > > > PID TID COMM TDNAME CPU CSID CPU MASK > > 31733 100155 testpmd - 2 1 2 > > 31733 100286 testpmd eal-intr-thread 0 1 0 > > 31733 100287 testpmd rte_mp_handle 0 1 0 > > 31733 100288 testpmd lcore-slave-0 3 1 1,3 > > > > $ cpuset -l 1,2,3 \ > > ./build/app/testpmd --master-lcore 1 --lcores '0@(1,3),1@2' \ --no-huge --no- > > pci -m 512 -- -i --total-num-mbufs=2048 > > > > PID TID COMM TDNAME CPU CSID CPU MASK > > 31757 100139 testpmd - 2 2 2 > > 31757 100292 testpmd eal-intr-thread 2 2 2 > > 31757 100293 testpmd rte_mp_handle 2 2 2 > > 31757 100294 testpmd lcore-slave-0 3 2 1,3 > > > > $ cpuset -l 1,2,3 \ > > ./build/app/testpmd --master-lcore 1 --lcores '0@1,1@2' \ --no-huge --no-pci - > > m 512 -- -i --total-num-mbufs=2048 > > > > PID TID COMM TDNAME CPU CSID CPU MASK > > 31776 100166 testpmd - 2 2 2 > > 31776 100295 testpmd eal-intr-thread 3 2 3 > > 31776 100296 testpmd rte_mp_handle 3 2 3 > > 31776 100297 testpmd lcore-slave-0 1 2 1 > > > > Bugzilla ID: 322 > > Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affinity") > > Cc: stable@dpdk.org > > > > Signed-off-by: David Marchand > > @@ -25,6 +25,19 @@ extern "C" { > > #if defined(__linux__) > > [snip] > > > #elif defined(__FreeBSD__) > > #include > > typedef cpuset_t rte_cpuset_t; > > @@ -35,6 +48,21 @@ typedef cpuset_t rte_cpuset_t; > > CPU_AND(&tmp, src2); \ > > CPU_COPY(&tmp, dst); \ > > } while (0) > > +#define RTE_CPU_OR(dst, src1, src2) do \ { \ > > + cpuset_t tmp; \ > > + CPU_COPY(src1, &tmp); \ > > + CPU_OR(&tmp, src2); \ > > + CPU_COPY(&tmp, dst); \ > > +} while (0) > > +#define RTE_CPU_FILL(set) CPU_FILL(set) #define RTE_CPU_NOT(dst, src) > > +do \ { \ > > + cpuset_t tmp; \ > > + CPU_FILL(&tmp); \ > > + CPU_NAND(&tmp, src); \ > > + CPU_COPY(&tmp, dst); \ > > +} while (0) > > Considering windows eal or a new eal in mind, IMO, it is better > to move to lib/librte_eal/freebsd/eal/include/rte_os.h > and it will avoid #ifdef clutter in common code too. > > > This patch will get backported in 18.11. I would prefer we do this cleanup later when the windows port needs it. -- David Marchand