From patchwork Fri Sep 18 20:34:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pravin B Shelar X-Patchwork-Id: 519575 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (li376-54.members.linode.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 5CBE11401F0 for ; Sat, 19 Sep 2015 06:34:46 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 6EA7C22C443; Fri, 18 Sep 2015 13:34:45 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v1.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id CB70D22C442 for ; Fri, 18 Sep 2015 13:34:43 -0700 (PDT) Received: from bar4.cudamail.com (bar2 [192.168.15.2]) by mx3v1.cudamail.com (Postfix) with ESMTP id 583FB6191FE for ; Fri, 18 Sep 2015 14:34:28 -0600 (MDT) X-ASG-Debug-ID: 1442608464-03dc210b8104360001-byXFYA Received: from mx3-pf3.cudamail.com ([192.168.14.3]) by bar4.cudamail.com with ESMTP id ysAr3jkxKOyIdtBR (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 Sep 2015 14:34:24 -0600 (MDT) X-Barracuda-Envelope-From: pshelar@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.3 Received: from unknown (HELO mail-pa0-f49.google.com) (209.85.220.49) by mx3-pf3.cudamail.com with ESMTPS (RC4-SHA encrypted); 18 Sep 2015 20:34:23 -0000 Received-SPF: unknown (mx3-pf3.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.49 Received: by padhk3 with SMTP id hk3so59598643pad.3 for ; Fri, 18 Sep 2015 13:34:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=p8w55P4k/6+qH9anZCXcGyr+GWwvBFOWaN9W3VvAhN4=; b=f4ogwLCDdz6p3TEOfu5v3GIHs0lpWDyIi2QGErz/Ncu+eyQn0Jppr3OrTt94uAKZoH 1ktgORNbLcke1OXHZECXQ+E5NkqCkyY6ymKYER7Fz24s2duf5FjDmzYnLJj4Y/1oJv0i kELjXR1vQXIOql1pmbMrSu2ooUxN/oPp+6QUFq5tTZWfMEhQ+5XpDSqJ9XlLYgKi6YfG bl/ZReNsMCMISMzsog6rqFlfVlPWUpDkscePaFU6QwR3w9mtuS9aNigJbD2fFQVt4SnY 8j4ioNtdd6vD8jV/iU65x459vDzLpEmjBUJDCfJbL3qhOK+CZwHSIl2mNXEuYeO58rEs k8Qg== X-Gm-Message-State: ALoCoQnh1ETsjzemZoIQoT5s5lf6+44lTSLl/mpSXZgICjGOWR1zqCgDewcP1cw1dcKPvB4Zvqax X-Received: by 10.68.176.227 with SMTP id cl3mr9276328pbc.8.1442608463584; Fri, 18 Sep 2015 13:34:23 -0700 (PDT) Received: from localhost ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id wj12sm10628849pac.9.2015.09.18.13.34.22 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 18 Sep 2015 13:34:23 -0700 (PDT) X-CudaMail-Envelope-Sender: pshelar@nicira.com X-Barracuda-Apparent-Source-IP: 208.91.1.34 From: Pravin B Shelar To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V3-917050507 X-CudaMail-DTE: 091815 X-CudaMail-Originating-IP: 209.85.220.49 Date: Fri, 18 Sep 2015 13:34:22 -0700 X-ASG-Orig-Subj: [##CM-V3-917050507##][PATCH] datapath: Backport "openvswitch: allocate nr_node_ids flow_stats instead of num_possible_nodes" Message-Id: <1442608462-1825-1-git-send-email-pshelar@nicira.com> X-Mailer: git-send-email 1.7.1 X-Barracuda-Connect: UNKNOWN[192.168.14.3] X-Barracuda-Start-Time: 1442608464 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Chris J Arges Subject: [ovs-dev] [PATCH] datapath: Backport "openvswitch: allocate nr_node_ids flow_stats instead of num_possible_nodes" X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" From: Chris J Arges Upstream commit: openvswitch: allocate nr_node_ids flow_stats instead of num_possible_nodes Some architectures like POWER can have a NUMA node_possible_map that contains sparse entries. This causes memory corruption with openvswitch since it allocates flow_cache with a multiple of num_possible_nodes() and assumes the node variable returned by for_each_node will index into flow->stats[node]. Use nr_node_ids to allocate a maximal sparse array instead of num_possible_nodes(). The crash was noticed after 3af229f2 was applied as it changed the node_possible_map to match node_online_map on boot. Fixes: 3af229f2071f5b5cb31664be6109561fbe19c861 Signed-off-by: Chris J Arges Acked-by: Pravin B Shelar Acked-by: Nishanth Aravamudan Signed-off-by: David S. Miller Upstream: bac541e4631(""openvswitch: allocate nr_node_ids flow_stats instead of num_possible_nodes") Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/flow_table.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/datapath/flow_table.c b/datapath/flow_table.c index 409f9dd..c76f2a1 100644 --- a/datapath/flow_table.c +++ b/datapath/flow_table.c @@ -988,7 +988,7 @@ int ovs_flow_init(void) BUILD_BUG_ON(sizeof(struct sw_flow_key) % sizeof(long)); flow_cache = kmem_cache_create("sw_flow", sizeof(struct sw_flow) - + (num_possible_nodes() + + (nr_node_ids * sizeof(struct flow_stats *)), 0, 0, NULL); if (flow_cache == NULL)