All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: Olivier Matz <olivier.matz@6wind.com>,
	"Burakov, Anatoly" <anatoly.burakov@intel.com>,
	Kevin Traynor <ktraynor@redhat.com>,
	dpdk stable <stable@dpdk.org>
Subject: Re: [PATCH] eal: restrict ctrl threads to startup cpu affinity
Date: Thu, 14 Feb 2019 12:05:29 +0100	[thread overview]
Message-ID: <CAJFAV8wmJWmzsLqsKteVejSqHZ43yjiajCufGwb40T2Kx=coPg@mail.gmail.com> (raw)
In-Reply-To: <1550074412-31285-1-git-send-email-david.marchand@redhat.com>

On Wed, Feb 13, 2019 at 5:14 PM David Marchand <david.marchand@redhat.com>
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 <david.marchand@redhat.com>
> ---
>  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

  parent reply	other threads:[~2019-02-14 11:05 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-13 16:13 [PATCH] eal: restrict ctrl threads to startup cpu affinity David Marchand
2019-02-13 20:21 ` David Marchand
2019-02-14  9:39 ` Burakov, Anatoly
2019-02-14  9:53   ` David Marchand
2019-02-14 10:04     ` Burakov, Anatoly
2019-02-14 10:16       ` David Marchand
2019-02-14 11:05 ` David Marchand [this message]
2019-02-14 13:30 ` [PATCH v2 1/2] eal: fix potential incorrect pinning for ctrl threads David Marchand
2019-02-14 13:30   ` [PATCH v2 2/2] eal: restrict ctrl threads to startup cpu affinity David Marchand
2019-02-19 11:38     ` Burakov, Anatoly
2019-02-19 11:51       ` David Marchand
2019-02-19 16:03         ` [dpdk-stable] " Thomas Monjalon
2019-02-14 16:12   ` [PATCH v2 1/2] eal: fix potential incorrect pinning for ctrl threads Burakov, Anatoly
2019-02-14 17:45     ` David Marchand
2019-02-19 20:41   ` [PATCH v3 " David Marchand
2019-02-19 20:41     ` [PATCH v3 2/2] eal: restrict ctrl threads to startup cpu affinity David Marchand
2019-02-20 16:01       ` Burakov, Anatoly
2019-02-25  8:33         ` Olivier Matz
2019-03-07 18:23           ` Thomas Monjalon
2019-02-20 16:01     ` [PATCH v3 1/2] eal: fix potential incorrect pinning for ctrl threads Burakov, Anatoly
2019-02-25  8:33       ` Olivier Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8wmJWmzsLqsKteVejSqHZ43yjiajCufGwb40T2Kx=coPg@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=ktraynor@redhat.com \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.