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 932835F1D for ; Thu, 14 Feb 2019 12:05:41 +0100 (CET) Received: by mail-ua1-f67.google.com with SMTP id d21so1870992uap.9 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=TqFE+le4veuUrSp+CLxpCJ+7w9lU+XzzLTMJYiZb2gqfNT4A+dGWn+icW7/p1dKmRG in5hje24kvj62NAKoObo+LDBGDcbtrWkJ/rhnOzp8uXzoTSMO8sjD413M6wIN1SjF8i1 4zTOO80m+rSpEVgzfndthZknArQDkeVwdKC6RiqvZixkElx0RKbpxcjbpMkutc2ALFS+ t6/67Aeo//p/NYxJcCRfM8+glK9FGDdvXBdpaDcgteoDKdDMmWyxE+519u+UfHpnwH+V XuPKWvwXit1+4T+8/verTnFn2o97My9pMUxAT/CZGskSTJJr86swU06jjyOQuQyMIBoZ ILog== X-Gm-Message-State: AHQUAubtdWjpdFvcIrDJnZv6PbpIbWi3ZGtRwPDyYVFmPoXUyHArKKNo 4SMOvxT1PScVVNNOJu9R/XaSxEKX/grSsCXf5jklog== 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-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: Thu, 14 Feb 2019 11:05:41 -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