From patchwork Mon Dec 2 15:42:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 63505 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64794A04B5; Mon, 2 Dec 2019 16:42:11 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 025451BDFD; Mon, 2 Dec 2019 16:42:11 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id DEC091BDFD for ; Mon, 2 Dec 2019 16:42:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575301329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RIHeK1j4oXPi6ZvVIBfd7V7RyeHhAv+KgjUpHAcFENA=; b=gQHZ/iB5Rb9aF4l+6CV+nOqudQnRgfHqvKG1bpLxUf/VDSUn5Do2OuMrQiRDNLqMv/rO1v AbVdP24IzIRhZ/sagd+sh0SFktkK6uX0MJDbRz+fYZ8YJ4ssIus+eLHX8viWExhfBGkJyd 9n64E3sN8bcd2VnY9J0iBZoEZ7OKY4c= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-305-VCzHXVXpMEGFXzs7-hk_dA-1; Mon, 02 Dec 2019 10:42:08 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 703531099BAF for ; Mon, 2 Dec 2019 15:42:07 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-205-88.brq.redhat.com [10.40.205.88]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4ACDE5DA2C; Mon, 2 Dec 2019 15:42:05 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: aconole@redhat.com Date: Mon, 2 Dec 2019 16:42:01 +0100 Message-Id: <20191202154201.10721-1-david.marchand@redhat.com> In-Reply-To: <20191202153559.9709-1-david.marchand@redhat.com> References: <20191202153559.9709-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: VCzHXVXpMEGFXzs7-hk_dA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 2/4] eal: do not cache lcore detection state 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" We use this state in control path only for services cores and -c/-l options. The value is not updated when using --lcores. Use the internal helper where needed. Signed-off-by: David Marchand --- lib/librte_eal/common/eal_common_lcore.c | 4 +--- lib/librte_eal/common/eal_common_options.c | 10 +++++----- lib/librte_eal/common/eal_private.h | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c index 39efadef1a..1d16fb2156 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -139,9 +139,7 @@ rte_eal_cpu_init(void) socket_id = eal_cpu_socket_id(lcore_id); lcore_to_socket_id[lcore_id] = socket_id; - /* in 1:1 mapping, record related cpu detected state */ - lcore_config[lcore_id].detected = eal_cpu_detected(lcore_id); - if (lcore_config[lcore_id].detected == 0) { + if (eal_cpu_detected(lcore_id) == 0) { config->lcore_role[lcore_id] = ROLE_OFF; lcore_config[lcore_id].core_index = -1; continue; diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index a7f9c5f9bd..68f7d1cd73 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -373,7 +373,7 @@ eal_parse_service_coremask(const char *coremask) return -1; } - if (!lcore_config[idx].detected) { + if (eal_cpu_detected(idx) == 0) { RTE_LOG(ERR, EAL, "lcore %u unavailable\n", idx); return -1; @@ -429,7 +429,7 @@ update_lcore_config(int *cores) for (i = 0; i < RTE_MAX_LCORE; i++) { if (cores[i] != -1) { - if (!lcore_config[i].detected) { + if (eal_cpu_detected(i) == 0) { RTE_LOG(ERR, EAL, "lcore %u unavailable\n", i); ret = -1; continue; @@ -785,7 +785,7 @@ convert_to_cpuset(rte_cpuset_t *cpusetp, if (!set[idx]) continue; - if (!lcore_config[idx].detected) { + if (eal_cpu_detected(idx) == 0) { RTE_LOG(ERR, EAL, "core %u " "unavailable\n", idx); return -1; @@ -1138,7 +1138,7 @@ available_cores(void) /* find the first available cpu */ for (idx = 0; idx < RTE_MAX_LCORE; idx++) { - if (!lcore_config[idx].detected) + if (eal_cpu_detected(idx) == 0) continue; break; } @@ -1152,7 +1152,7 @@ available_cores(void) sequence = 0; for (idx++ ; idx < RTE_MAX_LCORE; idx++) { - if (!lcore_config[idx].detected) + if (eal_cpu_detected(idx) == 0) continue; if (idx == previous + 1) { diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 8a9d493f0c..ddcfbe2e44 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -29,7 +29,6 @@ struct lcore_config { unsigned int core_id; /**< core number on socket for this lcore */ int core_index; /**< relative index, starting from 0 */ uint8_t core_role; /**< role of core eg: OFF, RTE, SERVICE */ - uint8_t detected; /**< true if lcore was detected */ rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */ };