From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-vs1-f68.google.com (mail-vs1-f68.google.com [209.85.217.68]) by dpdk.org (Postfix) with ESMTP id BBA6B1B456 for ; Thu, 14 Feb 2019 18:41:51 +0100 (CET) Received: by mail-vs1-f68.google.com with SMTP id e10so4175763vsp.1 for ; Thu, 14 Feb 2019 09:41:51 -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=h5UDiBbTeiCZ/AzOUT5NrB8eiXIKK8OanylCK4RXL04=; b=QqZ7gFdIN96cuSQZXk/voHBpROCk14ki4nTduLMieYGpbPiwBABj/nTH6FtKBkplAR D97ecHOTJH5MJV4zQgUHj+aymnRKpOlULbg5U/soxG+8hB3on4Es6cO0G8NK+zwk82bJ cE4WSps/3YmUNgXdOYnNWlb8L2u6qJOUppM4vOwsLocM1aDx9hFTBWCyBI+VMA/9UP7k OyxkivrfIXdB2RZ0E5TiYs8sYJFmDvkU/XgkZwy9VTuO9QRoCC7d1qUJT5m2CNy0UsBr MQpsulJsWEUEq4YoG1r8PeJI7tYrK3DZMB1emrr+Xqfdtgp069iwtfWb9bO/AeRGP+lo s5iw== X-Gm-Message-State: AHQUAuZFXPArbHdkRDNXRhXiV1snbhw8cAgfic+qFXDBeiO7COwVidpd m7pRzvZiH+DpKQqNupatGh9d21wJZsXJ9A+8hkUZXaO5 X-Google-Smtp-Source: AHgI3IamM+74SAwPmmd02FhGgvvFKNFDSaHdWyeVKDC0eKqFK3Sgac/oLlzDhfKWLwycaAr3H7NJUEkc6Yf6LHDvnFw= X-Received: by 2002:a67:2045:: with SMTP id g66mr2529818vsg.180.1550166109719; Thu, 14 Feb 2019 09:41:49 -0800 (PST) MIME-Version: 1.0 References: <1550150874-9535-1-git-send-email-david.marchand@redhat.com> <1fed1442-efc2-0156-7db1-8b2c01292659@intel.com> In-Reply-To: <1fed1442-efc2-0156-7db1-8b2c01292659@intel.com> From: David Marchand Date: Thu, 14 Feb 2019 18:41:38 +0100 Message-ID: To: "Burakov, Anatoly" Cc: dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] eal: fix check when retrieving current 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 17:41:51 -0000 On Thu, Feb 14, 2019 at 5:44 PM Burakov, Anatoly wrote: > On 14-Feb-19 1:27 PM, David Marchand wrote: > > pthread_getaffinity_np returns a >0 value when failing. > > > > This is mainly for the sake of correctness. > > The only case where it could fail is when passing an incorrect cpuset > > size wrt to the kernel. > > > > Fixes: 2eba8d21f3c9 ("eal: restrict cores auto detection") > > Signed-off-by: David Marchand > > --- > > lib/librte_eal/common/eal_common_options.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/lib/librte_eal/common/eal_common_options.c > b/lib/librte_eal/common/eal_common_options.c > > index 6c96f45..1f45f82 100644 > > --- a/lib/librte_eal/common/eal_common_options.c > > +++ b/lib/librte_eal/common/eal_common_options.c > > @@ -1343,10 +1343,9 @@ static int xdigit2val(unsigned char c) > > unsigned int lcore_id; > > unsigned int removed = 0; > > rte_cpuset_t affinity_set; > > - pthread_t tid = pthread_self(); > > > > - if (pthread_getaffinity_np(tid, sizeof(rte_cpuset_t), > > - &affinity_set) < 0) > > + if (pthread_getaffinity_np(pthread_self(), sizeof(rte_cpuset_t), > > + &affinity_set)) > > CPU_ZERO(&affinity_set); > > > > for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { > > > CC: stable? > Not really sure about CCing stable for this. I did not get errors with pthread_getaffinity_np so far. Afaiu, it would need the kernel and libc to have different cpuset sizes. I did not investigate in which situations it could happen. -- David Marchand