From patchwork Thu Jan 22 16:11:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Barbu X-Patchwork-Id: 43533 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 22123240DB for ; Thu, 22 Jan 2015 16:12:03 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id l18sf1547884wgh.3 for ; Thu, 22 Jan 2015 08:12:02 -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=M8jOVB41QaXfF6AGIXMobP/WFwfrvRkFLJTB4FL4bOQVy+V4fXhrsLgE1P7k6OD2lv vwmvSfgVZEN91V8MUCwvFaKriVkkTqAFxS3kaFQnVmERYj63hqtsx7D2fK4rsOp9RHFD ufnQtK6jY1io8vI4t37TglK/1PIOrU5EG9v0KIvqkzNMf9TvEbIrWWAkhryrb80zXmiK 3nixNz6znWjzQi1/UjxbWY8aIGcl19O2q94jUFv1TlDBbjb7PSAo+8iLtIE1EWuH2g8O UawPDh6zbyuLi1UCQhyfA4sm31+Vn+hMHgFZmf48ww1KJ/Vefph/U/DvKPWr/OqorSLl xJpA== X-Gm-Message-State: ALoCoQkX0hgJWcIDkhteeXXYXH9EzjjWNmyEkqO94tt/JGch1+xNKEta5JDhCErrjV0E51u4a63p X-Received: by 10.180.105.97 with SMTP id gl1mr4450395wib.7.1421943122358; Thu, 22 Jan 2015 08:12:02 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.5.97 with SMTP id r1ls197974lar.81.gmail; Thu, 22 Jan 2015 08:12:02 -0800 (PST) X-Received: by 10.112.47.135 with SMTP id d7mr2610143lbn.54.1421943122189; Thu, 22 Jan 2015 08:12:02 -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 tt6si21127481lbb.45.2015.01.22.08.12.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jan 2015 08:12:02 -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 s18so2512105lam.3 for ; Thu, 22 Jan 2015 08:12:02 -0800 (PST) X-Received: by 10.112.170.36 with SMTP id aj4mr2556881lbc.3.1421943122098; Thu, 22 Jan 2015 08:12:02 -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 c8csp312652lbb; Thu, 22 Jan 2015 08:12:01 -0800 (PST) X-Received: by 10.140.34.177 with SMTP id l46mr3795094qgl.37.1421943118729; Thu, 22 Jan 2015 08:11:58 -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 i6si9414548qan.53.2015.01.22.08.11.57 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 Jan 2015 08:11:58 -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 1YEKMO-0000Cm-Ah; Thu, 22 Jan 2015 16:11:56 +0000 Received: from mail-la0-f54.google.com ([209.85.215.54]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YEKM6-0000AN-HG for lng-odp@lists.linaro.org; Thu, 22 Jan 2015 16:11:38 +0000 Received: by mail-la0-f54.google.com with SMTP id hv19so2462154lab.13 for ; Thu, 22 Jan 2015 08:11:32 -0800 (PST) X-Received: by 10.112.158.200 with SMTP id ww8mr1574744lbb.89.1421943092611; Thu, 22 Jan 2015 08:11:32 -0800 (PST) Received: from cipriantemp.enea.se (sestofw01.enea.se. [192.36.1.252]) by mx.google.com with ESMTPSA id o1sm6428902laj.29.2015.01.22.08.11.31 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 Jan 2015 08:11:31 -0800 (PST) From: Ciprian Barbu To: zoltan.kiss@linaro.org, lng-odp@lists.linaro.org Date: Thu, 22 Jan 2015 18:11:15 +0200 Message-Id: <1421943076-12240-5-git-send-email-ciprian.barbu@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1421943076-12240-1-git-send-email-ciprian.barbu@linaro.org> References: <1421943076-12240-1-git-send-email-ciprian.barbu@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH odp-ovs 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. */