From patchwork Thu Jan 22 16:09:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 43528 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 18DCC240DB for ; Thu, 22 Jan 2015 16:09:58 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id gm9sf1578376lab.0 for ; Thu, 22 Jan 2015 08:09:57 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=dD67wDw2r0Xa/xmVlrT+8mz6MBFR15+F0BbaeCvKo1U=; b=j6T2qnLL/GfIgdMbdRroUa+n6ydY1lgH11542QDaSnZUA6K3Zm5gMKYswy15rwpdSx dABCjV+fHzN81lFDfOtiAhzp0jGiYQyELrqRCWmyJEqLFx/CJMAfqZ1IzF+2KOiqZiyd b9aPRxnVis1sgg2Rgb7Akj7s5clkjwVhh08g8dgUBax5vIF8Ur00mQ0BIvdd6u1MZnq9 LzROGZKU1cBXl0ilPVDXIwV9l3P0NHbCXPaevCYiBRqA67djxN0NTZ60keOJIXnSAeo1 GdsUmz4/DziXaLPCc9zW+EzL73oBD6+UqxQGr8uk7yCHgeKOoZhZuGypooaGzA/PHe4b vRDw== X-Gm-Message-State: ALoCoQkpdNQ13oBmT7eeCv/SH5MiPiNZJyace8NRWlyss/dm4JFCJNG7CHY9RcgQk9ew0cYHQ6nR X-Received: by 10.180.93.165 with SMTP id cv5mr507404wib.6.1421942997053; Thu, 22 Jan 2015 08:09:57 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.202 with SMTP id u10ls147219lau.68.gmail; Thu, 22 Jan 2015 08:09:56 -0800 (PST) X-Received: by 10.112.198.233 with SMTP id jf9mr2610544lbc.9.1421942996152; Thu, 22 Jan 2015 08:09:56 -0800 (PST) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com. [209.85.215.44]) by mx.google.com with ESMTPS id d5si22488757lab.63.2015.01.22.08.09.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2015 08:09:56 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id s18so2499490lam.3 for ; Thu, 22 Jan 2015 08:09:56 -0800 (PST) X-Received: by 10.112.180.135 with SMTP id do7mr2515372lbc.23.1421942996059; Thu, 22 Jan 2015 08:09:56 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.9.200 with SMTP id c8csp311845lbb; Thu, 22 Jan 2015 08:09:55 -0800 (PST) X-Received: by 10.224.166.202 with SMTP id n10mr3879621qay.69.1421942994346; Thu, 22 Jan 2015 08:09:54 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id p1si7592322qaa.13.2015.01.22.08.09.53 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 Jan 2015 08:09:54 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YEKKN-0008Vw-I4; Thu, 22 Jan 2015 16:09:51 +0000 Received: from mail-lb0-f177.google.com ([209.85.217.177]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YEKK7-0008Ry-DU for lng-odp@lists.linaro.org; Thu, 22 Jan 2015 16:09:35 +0000 Received: by mail-lb0-f177.google.com with SMTP id p9so2369231lbv.8 for ; Thu, 22 Jan 2015 08:09:29 -0800 (PST) X-Received: by 10.112.54.167 with SMTP id k7mr2556925lbp.72.1421942969548; Thu, 22 Jan 2015 08:09:29 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id v4sm6429275lav.25.2015.01.22.08.09.27 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Jan 2015 08:09:28 -0800 (PST) From: Ciprian Barbu To: zoltan.kiss@linaro.org, lng-odp@lists.linaro.org Date: Thu, 22 Jan 2015 18:09:08 +0200 Message-Id: <1421942949-12189-5-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1421942949-12189-1-git-send-email-ciprian.barbu@linaro.org> References: <1421942949-12189-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH 4/5] ovs-numa: workaround missing numa support for pmd netdevs X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ciprian.barbu@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Ciprian Barbu --- This is a workaround to make odp-ovs compile on KS2 which has no NUMA support. It might make it as a proper fix, because the only thing needed is the list of cpus, and the number of numa nodes can very well be 1. lib/ovs-numa.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c index dabdd18..cad4bca 100644 --- a/lib/ovs-numa.c +++ b/lib/ovs-numa.c @@ -94,13 +94,27 @@ discover_numa_and_core(void) { int n_cpus = 0; int i; + DIR *dir; + char* path; + bool has_numa = 1; + int max_numa_nodes = MAX_NUMA_NODES; + + + path = xasprintf("/sys/devices/system/node"); + dir = opendir(path); + free(path); + if (!dir) { + has_numa = 0; + max_numa_nodes = 1; + } - for (i = 0; i < MAX_NUMA_NODES; i++) { - DIR *dir; - char* path; - + for (i = 0; i < max_numa_nodes; i++) { /* Constructs the path to node /sys/devices/system/nodeX. */ - path = xasprintf("/sys/devices/system/node/node%d", i); + if (has_numa) { + path = xasprintf("/sys/devices/system/node/node%d", i); + } else { + path = xasprintf("/sys/devices/system/cpu"); + } dir = opendir(path); /* Creates 'struct numa_node' if the 'dir' is non-null. */