From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-f67.google.com (mail-ua1-f67.google.com [209.85.222.67]) by dpdk.org (Postfix) with ESMTP id DDAB65F1D for ; Thu, 14 Feb 2019 12:05:41 +0100 (CET) Received: by mail-ua1-f67.google.com with SMTP id p9so1876615uaa.5 for ; Thu, 14 Feb 2019 03:05:41 -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=WeJLBSBzx+8cVP9ZjyFFEhzKLa4m49RmhPzcJIX3oWI=; b=T2FvAJgY7FFp55IuQZCtTjIz7GAbM930QdIm9hf5FrmVUPjW9dVtC3c3mElkqqC3C4 gk+zavNU3R0NtN27j3SjxQiInclstcdcyYGkGc7phrpbYtzV++rYwureZGr5PnqLUCXs 4fYWEyLoL3cGag7SIJHJuqWX1PwLv8fraEzPj3LcCAis9Z4+dOP+iZCMkEg8f+fzdTJ8 YGoNRFwkFW1Sm1PJ+wNbe2DMoPlVHeIrMIYqxVUH2gs9A5tLcd/goOb5O7ba5HIqjaUP +zXKomVyHJDqMJJVMLWsilqwkDJxpfNatvkbC9K5amk2UTpMEpUtcKhITo3KrLPsQGsd 6cXA== X-Gm-Message-State: AHQUAuZRf/7TNn/btKLHG4ofcYXqMY1PTpTJEoD6EjuMXkQgr9XqQpVC /xCRZeR5dMFdgsHVh2YADjrtQfWo7ohzTE4OW9RpIoe/ X-Google-Smtp-Source: AHgI3IYglGv9met0r5UKOS+J6J9XFVhsiQoUn0lMx9xUtGzSy6B9W8YZg1PMSrigf9Bcz7G5BxBkq37V298pdzw/C0I= X-Received: by 2002:ab0:4121:: with SMTP id j30mr1524474uad.65.1550142340998; Thu, 14 Feb 2019 03:05:40 -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: Thu, 14 Feb 2019 12:05:29 +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-dev] [PATCH] eal: restrict ctrl threads to startup cpu affinity 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: , X-List-Received-Date: Thu, 14 Feb 2019 11:05:42 -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. > > 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); > Now that I am testing on Freebsd, I can see this block I took from the existing "auto detect" function is just wrong. pthread_(g|s)etaffinity_np return a > 0 error value when failing. -- David Marchand