From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-f65.google.com (mail-vs1-f65.google.com [209.85.217.65]) by dpdk.org (Postfix) with ESMTP id 5666F1B108 for ; Tue, 19 Feb 2019 12:51:28 +0100 (CET) Received: by mail-vs1-f65.google.com with SMTP id e10so11533778vsp.1 for ; Tue, 19 Feb 2019 03:51:28 -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=O0xCceHCQkHEscY+SDXBkBl6tQNRekA0vByvj8z1eAc=; b=nfQz2RoxUbgqYR9afqj5AuzOEvOf1CR9tMFf1qvdrlcrG1034SE5MW9Z+hvrGBUfqM /5QVHLH15ppX+0j0PXI5/5BJ2ZQutCb/qBHCbMM8h0cikhdMsMhcfBG7GHRresdR44NU rt5zkXHWOWkWeBW1fuN4yVzWjWB/8RzHhcYH1rh8uNa2STrtRHCK4ffgECRvQsyRdVq5 LHBma5K2xf57jQ8w/sI11pDlEgjH2R1YnW3y8CkYs3VI6XgV2njPtwo6iy302dv85O4c TvMd4fNjlFN52QPJzP+6pW+ld7/joLU4Dh8PzwUu+s2Rp4sNFCQrhjRq1dR2kRsrJhDh 5+yQ== X-Gm-Message-State: AHQUAuZlINo7YH+2NbOybeeAFstqfRVpt4oEXtosE74l4JCrNXlOh19Q oZNtjoeqK49H8Iv0ljLdki6WpfUg7a+M/ZjcKUTLqA== X-Google-Smtp-Source: AHgI3IY2sXgX0mzfaKuG40e1yWvAR/FOKmFnCvwTcqC/Yk6PnODEKK7VSIRpOSlD0+YXnCNk8P+iFu4soeSLp5JAH90= X-Received: by 2002:a67:2045:: with SMTP id g66mr14197601vsg.180.1550577087717; Tue, 19 Feb 2019 03:51:27 -0800 (PST) MIME-Version: 1.0 References: <1550074412-31285-1-git-send-email-david.marchand@redhat.com> <1550151042-9764-1-git-send-email-david.marchand@redhat.com> <1550151042-9764-2-git-send-email-david.marchand@redhat.com> <6d3960bc-9798-fa79-2538-339d63caf81b@intel.com> In-Reply-To: <6d3960bc-9798-fa79-2538-339d63caf81b@intel.com> From: David Marchand Date: Tue, 19 Feb 2019 12:51:16 +0100 Message-ID: To: "Burakov, Anatoly" Cc: dev@dpdk.org, Olivier Matz , 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 v2 2/2] 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: Tue, 19 Feb 2019 11:51:28 -0000 On Tue, Feb 19, 2019 at 12:38 PM Burakov, Anatoly wrote: > On 14-Feb-19 1:30 PM, David Marchand wrote: > > --- a/doc/guides/prog_guide/env_abstraction_layer.rst > > +++ b/doc/guides/prog_guide/env_abstraction_layer.rst > > @@ -498,6 +498,20 @@ Those TLS include *_cpuset* and *_socket_id*: > > * *_socket_id* stores the NUMA node of the CPU set. If the CPUs in > CPU set belong to different NUMA node, the *_socket_id* will be set to > SOCKET_ID_ANY. > > > > > > +Control Thread API > > +~~~~~~~~~~~~~~~~~~ > > + > > +It is possible to create Control Threads using the public API > ``rte_ctrl_thread_create()``. > > +Those threads can be used for management/infrastructure tasks and are > used internally by DPDK for multi process support and interrupt handling. > > + > > +Those threads will be scheduled on cpus part of the original process > cpu affinity from which the dataplane and service lcores are excluded. > > + > > +For example, on a 8 cpus system, starting a dpdk application with -l > 2,3 (dataplane cores), then depending on the affinity configuration which > can be controlled with tools like taskset (Linux) or cpuset (FreeBSD), > > + > > +- with no affinity configuration, the Control Threads will end up on > 0-1,4-7 cpus. > > +- with affinity restricted to 2-4, the Control Threads will end up on > cpu 4. > > +- with affinity restricted to 2-3, the Control Threads will end up on > cpu 2 (master lcore, which is the default when no cpu is available). > > You're not winning anything by foregoing the 80 char limit on > documentation (doxygen will still generate this correctly), but you're > losing in readability when working in terminal. I would prefer if you > didn't do those long lines :) > I don't really care, I will just wait for Thomas opinion. > Thomas, do we want checkpatch to warn about this? > > > + > > .. _known_issue_label: > > > > Known Issues > > diff --git a/lib/librte_eal/common/eal_common_options.c > b/lib/librte_eal/common/eal_common_options.c > > index 1f45f82..fca3f83 100644 > > --- a/lib/librte_eal/common/eal_common_options.c > > +++ b/lib/librte_eal/common/eal_common_options.c > > @@ -217,6 +217,7 @@ struct device_option { > > internal_cfg->create_uio_dev = 0; > > internal_cfg->iova_mode = RTE_IOVA_DC; > > internal_cfg->user_mbuf_pool_ops_name = NULL; > > + CPU_ZERO(&internal_cfg->ctrl_cpuset); > > internal_cfg->init_complete = 0; > > } > > > > @@ -1359,6 +1360,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) > > Shouldn't this be != 0? Manpage doesn't say the error values will be > negative. > Good catch... /me hides Thanks for the review. -- David Marchand