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 764E1A0487 for ; Tue, 30 Jul 2019 11:45:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1061C1C05C; Tue, 30 Jul 2019 11:45:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id B42EC1C044; Tue, 30 Jul 2019 11:45:23 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x6U9eSUE006738; Tue, 30 Jul 2019 02:45:22 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=Wb5d7HwSgsPno6B34ZWDLEvA64qPAleY8bzHuL6xGVs=; b=yxY9OG7+RTia8IuZsKNKiJArHdgHxrBbko880DzsH6f8Zuxq8FVzlI57isfvEgR9tsK3 FOki79UaixrnVpdBWZt2i6rf+PK6VIhTaYfKuIqezJfn8gqfUlonw8vzPgf28u1ivuss GXWW4J2//G7G5DxPOspxFLfDGGTsfeoikq59W0U8Q7t3+JG+OcUUpDQQgzqKPxkito/8 vd3GdS0yyEZH0Y5GuMXUJAqahUiIXWrS2weT50i3rLdrSUsncwEdyqN5EX1co/BZGThG Yg/iirBSYZ9X5aeRsPt80diMjt5dFC9dkk1gheImY7QeUEEvsROM2/6sqqbuwj7Zj+61 cA== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2u0p4m2vqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 30 Jul 2019 02:45:22 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 30 Jul 2019 02:45:20 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.59) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3 via Frontend Transport; Tue, 30 Jul 2019 02:45:20 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y0gAo87aXH1kD4/2e2YwGXLY2N+h/BY0pobPWvCZXtyOa/uxtaaoNRA6GW3XAhMoI4rscAGQnPdhy8UPF9F0aots9DcpCaGoYQDNVWmXTyhJfVsWD3ZTSGfy9outZMEO/1YKrxqwWKwnueOUyagrVVIVKIelw5WiYg5FW39zuAoBgMvjqlknlZfZtPXW0W5Cg0pbDhGWN3sBlIoUThbjKmxKBXVZ3v0oZZjbVLb+SDbTbwtecj4wxYKNYEEEpo50c0T+CxSV/uKHwihiMi2hb+1tphWuVOW4h784KstNldotX4zTruAKcpWEz8iZpH60cuXf6DUILaAN5GyIz26qUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wb5d7HwSgsPno6B34ZWDLEvA64qPAleY8bzHuL6xGVs=; b=QvsF/lmAABCDRJOo5mkCpDFSy8YkyddBjS3NAUBbrBUaI1WFkzleQP893j3n0XBPValoxNJORYquHy59SNxxnLUGhCHP68QO8DA7bdGXEI8dRL/0hHpJq+deNoqCjDSwxxNyolrJ0mghSlbqyt2lVgAmLuy7XaTNmFR/UYSTJj10zVtSBbQBOszdpS6YbqfWni7pFB0be86zdwKCIPLO0wYkOrpOpCEH0hwTFEfcclQ6pc/aX415vYJv8RgnHA6qNljxtV9kFbY46AzbF+puB6zuemZ/0XRe4JwI20G0eYHrr27iDcLvCgv3d/TzWnnXRVzSMM2/qS9GhrC8Dc9zYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=marvell.com;dmarc=pass action=none header.from=marvell.com;dkim=pass header.d=marvell.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wb5d7HwSgsPno6B34ZWDLEvA64qPAleY8bzHuL6xGVs=; b=U/Sika10GHVhkSsFGyVVKRL9s/mJPUL5fsqZrppVTcFrgxg1QPKiybzip4yOaa9/HoRIwglCXLGuq4p59zDWiGTsrfWXAfBvQi8Xiw8i+wEJUQnMg2GN7Z86t6SHM4+Du+8MNdPB+QRNHI2JHRH4MncExQx0d6TqeP5oF4OQyL8= Received: from BYAPR18MB2424.namprd18.prod.outlook.com (20.179.91.149) by BYAPR18MB2536.namprd18.prod.outlook.com (20.179.93.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.10; Tue, 30 Jul 2019 09:45:19 +0000 Received: from BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::2d42:12b6:aa2e:2862]) by BYAPR18MB2424.namprd18.prod.outlook.com ([fe80::2d42:12b6:aa2e:2862%4]) with mapi id 15.20.2115.005; Tue, 30 Jul 2019 09:45:19 +0000 From: Jerin Jacob Kollanukkaran To: David Marchand , "dev@dpdk.org" CC: "johan.kallstrom@ericsson.com" , "anatoly.burakov@intel.com" , "olivier.matz@6wind.com" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] eal: fix ctrl thread affinity with --lcores Thread-Index: AQHVRrpCcVy5QxmEsE2/Hbd/TwHM2Kbi6LEQ Date: Tue, 30 Jul 2019 09:45:18 +0000 Message-ID: References: <1564479354-11192-1-git-send-email-david.marchand@redhat.com> In-Reply-To: <1564479354-11192-1-git-send-email-david.marchand@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [106.200.230.107] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 37d1ddd3-a14e-46af-3367-08d714d2a20a x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:BYAPR18MB2536; x-ms-traffictypediagnostic: BYAPR18MB2536: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:4502; x-forefront-prvs: 0114FF88F6 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(366004)(39860400002)(136003)(396003)(199004)(189003)(13464003)(76176011)(110136005)(54906003)(446003)(68736007)(186003)(316002)(26005)(6506007)(102836004)(71200400001)(66066001)(66946007)(66446008)(76116006)(66556008)(64756008)(66476007)(476003)(99286004)(86362001)(256004)(2501003)(2906002)(5660300002)(53546011)(8676002)(81156014)(81166006)(7696005)(52536014)(486006)(71190400001)(8936002)(7736002)(305945005)(478600001)(3846002)(6116002)(4326008)(11346002)(14454004)(6246003)(53936002)(25786009)(55016002)(9686003)(74316002)(6436002)(33656002)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR18MB2536; H:BYAPR18MB2424.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: marvell.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Rkvx+lIswBLclYJewFqqW/GwMxmadYpdTIwboDVmgeqPSpCt28rkWnX19emyoP3mKFJw4QxFO48v8wtRpx+qjzMOhkVweSk4nPUu8b9xqVn7acXvW54MxMgtYYIHzfuh/7vlCCxm9lo+lnxeGZZ5HgHUXWyC2+kzVbH3aUNZv7CWhFFJGbzj52s7kbnD6AmAkuMb8Zq0FRBrIsgOU6ZR2CQX4wEtnEN7VXI7dCzPvo4vF/vRwLtttMO/vF2jCK0otzeDVAizgJyqYvUBXGFTrAuOEBouyEKf8jxA//8UayUsUIrw6/KF3MIKyOCtmd1BBjkFARUcar4K94h/1WoM61tSxoRdppL4kphew1tMb5mb8lxWPfm2QQM5mFtAY/Fk01JD9JzPOweWPcxEMSWcAcqY9anllj8nbFAPdjXcohI= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 37d1ddd3-a14e-46af-3367-08d714d2a20a X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jul 2019 09:45:18.8420 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: jerinj@marvell.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2536 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-07-30_04:2019-07-29,2019-07-30 signatures=0 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" > -----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 >=20 > 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 wh= ich the > associated EAL thread runs. >=20 > To handle those two situations, rely on the per lcore cpuset. >=20 > Introduced macros to manipulate cpusets in both Linux and FreeBSD. >=20 > Examples in a 4 cores FreeBSD vm: >=20 > $ ./build/app/testpmd --master-lcore 1 --lcores '0@(1,3),1@2' \ --no-hug= e --no- > pci -m 512 -- -i --total-num-mbufs=3D2048 >=20 > 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 >=20 > $ 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=3D2048 >=20 > 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 >=20 > $ cpuset -l 1,2,3 \ > ./build/app/testpmd --master-lcore 1 --lcores '0@1,1@2' \ --no-huge --n= o-pci - > m 512 -- -i --total-num-mbufs=3D2048 >=20 > 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 >=20 > Bugzilla ID: 322 > Fixes: c3568ea37670 ("eal: restrict control threads to startup CPU affini= ty") > Cc: stable@dpdk.org >=20 > 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.