From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vk1-f195.google.com (mail-vk1-f195.google.com [209.85.221.195]) by dpdk.org (Postfix) with ESMTP id 5293B4CC0 for ; Wed, 13 Feb 2019 21:21:32 +0100 (CET) Received: by mail-vk1-f195.google.com with SMTP id h128so845397vkg.11 for ; Wed, 13 Feb 2019 12:21:32 -0800 (PST) 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=DqOpcI97crOzFP9QyJDysFTr9y8EtXRy/zsmj/zRigg=; b=f9IrHvYQkDR2q1wh6R/peBSj3nj2n8T/Ztjce6Cy7w1rSnPi6dzfVo7vVAqXrjt4Vc mqOsqxKHuTbQXZkdQx6SPf38t/+gCBxOw1NMpEsfTbGHt4FDN7aJAslvG2I/H9nkva43 NE8eJrog8nBIDjF1Aq0k7cl1n7Hodho3jwbGYShvEmri32QJNMfUQEcIbP13gtJnC51T XpHPd+681Z6va0LczZW2Ytl1f5WxKECI22rsvF8a795rqW1BAhuPRlldgxp1G7h/9fIe XeBpGmeFX4wtmy6XZcbj7aMZsN5QKYymgQBOOm9OA92UxEq3h0X0mNiBQcIHY6rasq4+ JK+A== X-Gm-Message-State: AHQUAubEZ9jn4S+REL7Cg5DsUeWZn7yg0YPsGQdq78rh6HEpqFlrZjaE VYB1nVoqfRYDg9WGSzd8ILj8ZmZOFO7vVo9VNY0Kug== X-Google-Smtp-Source: AHgI3IbXWTq8tZRkYoPaHu72Y7uhW27t+iLtV7V1IM6i+GreusHP2/JOaR0VqgEJo9QU9xon15Ah7/pK+42lg2gj+kQ= X-Received: by 2002:a1f:35f:: with SMTP id 92mr428740vkd.52.1550089291703; Wed, 13 Feb 2019 12:21:31 -0800 (PST) MIME-Version: 1.0 References: <1550074412-31285-1-git-send-email-david.marchand@redhat.com> In-Reply-To: <1550074412-31285-1-git-send-email-david.marchand@redhat.com> From: David Marchand Date: Wed, 13 Feb 2019 21:21:20 +0100 Message-ID: To: dev@dpdk.org Cc: Olivier Matz , "Burakov, Anatoly" , Kevin Traynor , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] eal: restrict ctrl threads to startup cpu affinity X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2019 20:21:32 -0000 On Wed, Feb 13, 2019 at 5:14 PM David Marchand wrote: > Spawning the ctrl threads on anything that is not part of the eal > coremask is not that polite to the rest of the system. > > Rather than introduce yet another eal options for this, let's take > the startup cpu affinity as a reference and remove the eal coremask > from it. > If no cpu is left, then we default to the master core. > > The cpuset is computed once at init before the original cpu affinity. > Need to fix this last sentence... > Fixes: d651ee4919cd ("eal: set affinity for control threads") > Signed-off-by: David Marchand > --- > lib/librte_eal/common/eal_common_options.c | 28 > ++++++++++++++++++++++++++++ > lib/librte_eal/common/eal_common_thread.c | 21 ++++----------------- > lib/librte_eal/common/eal_internal_cfg.h | 3 +++ > 3 files changed, 35 insertions(+), 17 deletions(-) > > diff --git a/lib/librte_eal/common/eal_common_options.c > b/lib/librte_eal/common/eal_common_options.c > index 6c96f45..b766252 100644 > --- a/lib/librte_eal/common/eal_common_options.c > +++ b/lib/librte_eal/common/eal_common_options.c > @@ -1360,6 +1361,31 @@ static int xdigit2val(unsigned char c) > cfg->lcore_count -= removed; > } > > +static void > +compute_ctrl_threads_cpuset(struct internal_config *internal_cfg) > +{ > + rte_cpuset_t *cpuset = &internal_cfg->ctrl_cpuset; > + rte_cpuset_t default_set; > + unsigned int lcore_id; > + > + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { > + if (eal_cpu_detected(lcore_id) && > + rte_lcore_has_role(lcore_id, ROLE_OFF)) { > + CPU_SET(lcore_id, cpuset); > + } > + } > + > + if (pthread_getaffinity_np(pthread_self(), sizeof(rte_cpuset_t), > + &default_set) < 0) > + CPU_ZERO(&default_set); > + > + CPU_AND(cpuset, cpuset, &default_set); > CPU_AND is different on Freebsd. *CPU*_*AND*(*cpuset*_*t* **dst*, *cpuset*_*t* **src*); The *CPU*_*AND*() macro removes CPUs absent from *src* from *dst*. (It is the *cpuset(9)* equivalent of the scalar: *dst* &= *src*.) *CPU*_*AND*_*ATOMIC*() is similar, with the same atomic semantics as *CPU*_*OR*_*ATOMIC*(). Will fix in v2. -- David Marchand