From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 95F4AA00C2; Wed, 30 Nov 2022 19:41:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7888D40693; Wed, 30 Nov 2022 19:41:18 +0100 (CET) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id 1072240395 for ; Wed, 30 Nov 2022 19:41:17 +0100 (CET) Received: by inbox.dpdk.org (Postfix, from userid 33) id ED1C7A00C3; Wed, 30 Nov 2022 19:41:16 +0100 (CET) From: bugzilla@dpdk.org To: dev@dpdk.org Subject: [Bug 1137] CPU affinity set incorrectly when lcore_id 0 is not the master-lcore Date: Wed, 30 Nov 2022 18:41:16 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: core X-Bugzilla-Version: 22.11 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ltroup@cisco.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org https://bugs.dpdk.org/show_bug.cgi?id=3D1137 Bug ID: 1137 Summary: CPU affinity set incorrectly when lcore_id 0 is not the master-lcore Product: DPDK Version: 22.11 Hardware: All OS: Linux Status: UNCONFIRMED Severity: normal Priority: Normal Component: core Assignee: dev@dpdk.org Reporter: ltroup@cisco.com Target Milestone: --- Created attachment 233 --> https://bugs.dpdk.org/attachment.cgi?id=3D233&action=3Dedit Logs showing incorrect CPU set assignment When a range of CPUs are used (e.g. 0-3), and the master-lcore is set to non-zero, the CPU affinity for lcore-id 0 is set incorrectly, due to its cp= uset being overwritten by the control-thread creation. CPU arguments passed are '-c f --master-lcore 3', to indicate that CPUs 0-3 should be used, with the master on CPU 3. In particular, DPDK itself is initialized from CPU 3. When the control threads (eal-intr-thread, rte_mp_handle) are created, they= are initialized from CPU3 - so inherit the cpuset containing just this CPU. When calling __rte_thread_init(), ctrl_thread_init() passes the result of rte_lcore_id() - but this is not yet initialized for this thread - so is se= t to 0. This means that internally, the lcore_id for the control-thread is set to 0= - and=20 in particular, the call to thread_update_affinity() overwrites the cpuset f= or lcore_id=3D0 with the cpuset of CPU3: memmove(&lcore_config[lcore_id].cpuset, cpusetp, sizeof(rte_cpuset_t)); This all occurs before the main __rte_thread_init() call for each Slave thr= ead - so that the slave thread associated with lcore_id, which should be runnin= g on CPU0, instead has its affinity incorrectly set to CPU3. RTE logs are attached showing this behavior (and including some additional = logs added locally to print the lcore-id and cpusets being passed). The fix for this should be to make ctrl_thread_init() more similar to rte_thread_register(), so that it calls eal_lcore_non_eal_allocate() to ass= ign an lcore-id, then passes this to __rte_thread_init(). I have tested a fix f= or this locally to confirm. --=20 You are receiving this mail because: You are the assignee for the bug.=