From patchwork Thu Mar 27 20:05:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 3899611 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 31F9F9F334 for ; Thu, 27 Mar 2014 20:05:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3AADD201DD for ; Thu, 27 Mar 2014 20:05:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE1AC201B4 for ; Thu, 27 Mar 2014 20:05:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757195AbaC0UFx (ORCPT ); Thu, 27 Mar 2014 16:05:53 -0400 Received: from mail-ee0-f43.google.com ([74.125.83.43]:61448 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756679AbaC0UFx (ORCPT ); Thu, 27 Mar 2014 16:05:53 -0400 Received: by mail-ee0-f43.google.com with SMTP id e53so3302035eek.16 for ; Thu, 27 Mar 2014 13:05:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=JrO5N7puCvZ9pDdDTjEXEUfeoMiGTpMEg1KaIDGw/hc=; b=gf9NWQGOPuyaZOIKfzNQK6YUM6Q/0PhGBHRDuUhVju5AIujq7zvByQOC/l1PJW/0fS 8nc7Je1xD4h4ULDJq6TG0wSEfZLHlpBp6ltBuvn2S7XJavW8Q30EYnHjbzQXJSkhJzR1 1+/w4qOi/NFGIVeY61mieyOzxJdzblWCUejxnCmbaFCDwoDjqvT7QbjUTImjaT6ZQOiB F/agusfPk8Ts6/UN2mMy09r/otCL8Ljx0yIj8dfbGgWATgYnTxQmTLvUJHRwjgGtCDQ0 gNOrQXMaLUx+qtbP6NQZeL8CK0fYCw5+jGEp9liQ7Cu2hWdDuknSwA+jBMvkKTomjHEr cMOQ== X-Gm-Message-State: ALoCoQlCAQ/XvT9Iq5v/rybrIH010yOHBV+RPoRsfttEIWUBxk+kP33c2bYjBtKgKjXPQplnr69v X-Received: by 10.14.37.8 with SMTP id x8mr3770113eea.32.1395950751704; Thu, 27 Mar 2014 13:05:51 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id y7sm6580803eev.5.2014.03.27.13.05.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Mar 2014 13:05:50 -0700 (PDT) Message-ID: <5334849A.2000201@dev.mellanox.co.il> Date: Thu, 27 Mar 2014 16:05:46 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Shlomi Nimrodi , Jim Schutt Subject: [PATCH opensm] osm_torus.c: Fix torus crash when actual topology is not torus Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Shlomi Nimrodi Date: Thu, 27 Mar 2014 18:52:49 +0200 Torus crashes when it is configured in a way but actual topology has nothing to do with torus or the configuration, changed it to fail without crash Signed-off-by: Shlomi Nimrodi Reviewed-by: Jim Schutt Signed-off-by: Hal Rosenstock --- opensm/osm_torus.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c index 71753cf..330f55d 100644 --- a/opensm/osm_torus.c +++ b/opensm/osm_torus.c @@ -7262,7 +7262,7 @@ out: } static -void build_torus(struct fabric *f, struct torus *t) +bool build_torus(struct fabric *f, struct torus *t) { int i, j, k; int im1, jm1, km1; @@ -7383,9 +7383,12 @@ again: for (k = 0; k < (int)t->z_sz; k++) for (j = 0; j < (int)t->y_sz; j++) for (i = 0; i < (int)t->x_sz; i++) - link_srcsink(t, i, j, k); + if (!link_srcsink(t, i, j, k)) { + success = false; + goto out; + } out: - return; + return success; } /* @@ -9493,7 +9496,11 @@ int torus_build_lfts(void *context) (int)torus->x_sz, (int)torus->y_sz, (int)torus->z_sz, (ALL_MESH(torus->flags) ? "mesh" : "torus")); - build_torus(fabric, torus); + if (!build_torus(fabric, torus)) { + OSM_LOG(&torus->osm->log, OSM_LOG_ERROR, "ERR 4E57: " + "build_torus finished with errors\n"); + goto out; + } OSM_LOG(&torus->osm->log, OSM_LOG_INFO, "Built %d x %d x %d %s w/ %d links, %d switches, %d CA ports\n",