From patchwork Wed Nov 28 19:03:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 1817911 X-Patchwork-Delegate: alexne@voltaire.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8ED4CDF26F for ; Wed, 28 Nov 2012 19:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754788Ab2K1TDb (ORCPT ); Wed, 28 Nov 2012 14:03:31 -0500 Received: from mail-bk0-f46.google.com ([209.85.214.46]:61131 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754421Ab2K1TDa (ORCPT ); Wed, 28 Nov 2012 14:03:30 -0500 Received: by mail-bk0-f46.google.com with SMTP id q16so5900875bkw.19 for ; Wed, 28 Nov 2012 11:03:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding:x-gm-message-state; bh=Pezn1ozliFHld0Zy9HLbob/z1DLqyo4Mz/5cDFsjuQw=; b=U1MX1jNtYfCWi6ewhEJzI7isnfG66aolbgtBJV6OIxrx4ctufVpZ64IIF9gixDuAL9 pZ7zEPbidjfHoQRP+TvKq+ZaKzZ1DxxT6oe2TQ5Y5j3cburblDxK9S2iFjvDSzefXKpX sfzJyard45G0wiQ35dkt+6q9IfopB7503bcU4Zo8qsrIAJLAYimR9qtiadMxwDW6afWl YRN9MM/jIAqsxgPZC4UcXfpp2FxWtvgNUkPKYUxbdekuk0g+Y8UVOok7BvZg0PGFm5LB jCIiw0rXksbs7g8nC+TM/Rm/EZapH72ax2VSjhh4F7/BeICkzCix6Cz2ZM/Jxng41ZmN aPWg== Received: by 10.204.146.1 with SMTP id f1mr6223332bkv.130.1354129409590; Wed, 28 Nov 2012 11:03:29 -0800 (PST) Received: from [192.168.1.102] (c-71-192-10-85.hsd1.ma.comcast.net. [71.192.10.85]) by mx.google.com with ESMTPS id d16sm13522684bkw.2.2012.11.28.11.03.28 (version=SSLv3 cipher=OTHER); Wed, 28 Nov 2012 11:03:29 -0800 (PST) Message-ID: <50B65FFE.6020304@dev.mellanox.co.il> Date: Wed, 28 Nov 2012 14:03:26 -0500 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: Alex Netes CC: "linux-rdma (linux-rdma@vger.kernel.org)" , Jim Schutt Subject: [PATCH 5/8] opensm/osm_torus.c: Improve QoS configuration X-Gm-Message-State: ALoCoQmgvU3EeB3nebzk7bYapyAFWzjnbQLUWs56AGgRaXsi1efMwqYdkTolLroja0EvDImbOlOS Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org There are two basic VLArb checks: - the endport check, that weights for VLs 2-7 are zero - the switch external check, with uniform weights for VLs 0-3 and also 4-7 So that the user can learn what exactly needs fixing when bad configuration is found, it should correctly discriminate between: - bad user-supplied config for a specific port type - user-supplied default config that is bad as applied to a specific port type - OpenSM default config that is bad as applied to a specific port type For the config below: qos_vlarb_high 0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0 qos_vlarb_low 0:64,1:64,2:64,3:64,4:64,5:64,6:64,7:64,8:64 qos_ca_vlarb_low 0:64,1:64 it should produce the VLs 2-7 VLArb warning for qos_vlarb_low as used for qos_sw0_vlarb_low, qos_rtr_vlarb_low. This config should produce no warnings: qos_vlarb_high 0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0 qos_vlarb_low 0:32,1:64 qos_swe_vlarb_low 0:32,1:32,2:32,3:32,4:64,5:64,6:64,7:64 Finally, a config with no VLArb data at all should warn about the default qos_vlarb_low, qos_vlarb_high values as used for qos_swe_vlarb_low, qos_swe_vlarb_high. It should also warn about the default qos_vlarb_low values as used for qos_ca_vlarb_low and other endpoint types. Signed-off-by: Jim Schutt Signed-off-by: Hal Rosenstock --- opensm/osm_torus.c | 189 ++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 147 insertions(+), 42 deletions(-) diff --git a/opensm/osm_torus.c b/opensm/osm_torus.c index 9d41297..b52cdfb 100644 --- a/opensm/osm_torus.c +++ b/opensm/osm_torus.c @@ -9254,13 +9254,11 @@ out: } static -void check_vlarb_config(const char *vlarb_str, bool is_default, - const char *str, const char *pri, osm_log_t *log) +void sum_vlarb_weights(const char *vlarb_str, + unsigned total_weight[IB_MAX_NUM_VLS]) { - unsigned total_weight[IB_MAX_NUM_VLS] = {0,}; unsigned i = 0, v, vl = 0; char *end; - bool uniform; while (*vlarb_str && i++ < 2 * IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK) { v = strtoul(vlarb_str, &end, 0); @@ -9272,15 +9270,29 @@ void check_vlarb_config(const char *vlarb_str, bool is_default, else total_weight[vl] += v & 0xff; } - uniform = true; - v = total_weight[0]; - for (i = 1; i < 8; i++) { - if (i == 4) - v = total_weight[i]; - if (total_weight[i] != v) - uniform = false; +} + +static +int uniform_vlarb_weight_value(unsigned *weight, unsigned count) +{ + int i, v = weight[0]; + + for (i = 1; i < count; i++) { + if (v != weight[i]) + return -1; } - if (!uniform) + return v; +} + +static +void check_vlarb_config(const char *vlarb_str, bool is_default, + const char *str, const char *pri, osm_log_t *log) +{ + unsigned total_weight[IB_MAX_NUM_VLS] = {0,}; + + sum_vlarb_weights(vlarb_str, total_weight); + if (!(uniform_vlarb_weight_value(&total_weight[0], 4) >= 0 && + uniform_vlarb_weight_value(&total_weight[4], 4) >= 0)) OSM_LOG(log, OSM_LOG_INFO, "Warning: torus-2QoS requires same VLarb weights for " "VLs 0-3; also for VLs 4-7: not true for %s " @@ -9288,47 +9300,136 @@ void check_vlarb_config(const char *vlarb_str, bool is_default, (is_default ? "default" : "configured"), str, pri); } +/* + * Use this to check the qos_config for switch external ports. + */ static -void check_qos_config(osm_qos_options_t *opt, bool tgt_is_default, +void check_qos_config(osm_qos_options_t *opt, osm_qos_options_t *def, const char *str, osm_log_t *log) { - const char *vlarb_str; + const char *vlarb_str, *tstr; bool is_default; + unsigned max_vls; - if (opt->max_vls > 0 && opt->max_vls < 8) + max_vls = def->max_vls; + if (opt->max_vls > 0) + max_vls = opt->max_vls; + + if (max_vls > 0 && max_vls < 8) OSM_LOG(log, OSM_LOG_INFO, "Warning: full torus-2QoS functionality not available " - "for configured %s_max_vls = %d\n", str, opt->max_vls); + "for configured %s_max_vls = %d\n", + (opt->max_vls > 0 ? str : "qos"), opt->max_vls); - if (!strcmp(str, "qos_ca")) - goto check_sl2vl; + vlarb_str = opt->vlarb_high; + is_default = false; + tstr = "qos_swe"; + if (!vlarb_str) { + vlarb_str = def->vlarb_high; + tstr = "qos"; + } + if (!vlarb_str) { + vlarb_str = OSM_DEFAULT_QOS_VLARB_HIGH; + is_default = true; + } + check_vlarb_config(vlarb_str, is_default, tstr, "high", log); - if (opt->vlarb_high) { - is_default = false; - vlarb_str = opt->vlarb_high; - } else { + vlarb_str = opt->vlarb_low; + is_default = false; + tstr = "qos_swe"; + if (!vlarb_str) { + vlarb_str = def->vlarb_low; + tstr = "qos"; + } + if (!vlarb_str) { + vlarb_str = OSM_DEFAULT_QOS_VLARB_LOW; is_default = true; - vlarb_str = OSM_DEFAULT_QOS_VLARB_HIGH; } - /* - * Only check values that were actually configured, or the overall - * defaults that target-specific (CA, switch port, etc) defaults - * are set from. - */ - if (!is_default || tgt_is_default) - check_vlarb_config(vlarb_str, is_default, str, "high", log); + check_vlarb_config(vlarb_str, is_default, tstr, "low", log); - if (opt->vlarb_low) { - is_default = false; - vlarb_str = opt->vlarb_low; - } else { + if (opt->sl2vl) + OSM_LOG(log, OSM_LOG_INFO, + "Warning: torus-2QoS must override configured " + "%s_sl2vl to generate deadlock-free routes\n", str); +} + +static +void check_ep_vlarb_config(const char *vlarb_str, + bool is_default, bool is_specific, + const char *str, const char *pri, osm_log_t *log) +{ + unsigned i, total_weight[IB_MAX_NUM_VLS] = {0,}; + int val = 0; + + sum_vlarb_weights(vlarb_str, total_weight); + for (i = 2; i < 8; i++) { + val += total_weight[i]; + } + if (!val) + return; + + if (is_specific) + OSM_LOG(log, OSM_LOG_INFO, + "Warning: torus-2QoS recommends 0 VLarb weights" + " for VLs 2-7 on endpoint links; not true for " + " configured %s_vlarb_%s\n", str, pri); + else + OSM_LOG(log, OSM_LOG_INFO, + "Warning: torus-2QoS recommends 0 VLarb weights " + "for VLs 2-7 on endpoint links; not true for %s " + "qos_vlarb_%s values used for %s_vlarb_%s\n", + (is_default ? "default" : "configured"), pri, str, pri); +} + +/* + * Use this to check the qos_config for endports + */ +static +void check_qos_ep_config(osm_qos_options_t *opt, osm_qos_options_t *def, + const char *str, osm_log_t *log) +{ + const char *vlarb_str; + bool is_default, is_specific; + unsigned max_vls; + + max_vls = def->max_vls; + if (opt->max_vls > 0) + max_vls = opt->max_vls; + + if (max_vls > 0 && max_vls < 2) + OSM_LOG(log, OSM_LOG_INFO, + "Warning: full torus-2QoS functionality not available " + "for configured %s_max_vls = %d\n", + (opt->max_vls > 0 ? str : "qos"), opt->max_vls); + + vlarb_str = opt->vlarb_high; + is_default = false; + is_specific = true; + if (!vlarb_str) { + vlarb_str = def->vlarb_high; + is_specific = false; + } + if (!vlarb_str) { + vlarb_str = OSM_DEFAULT_QOS_VLARB_HIGH; is_default = true; + } + check_ep_vlarb_config(vlarb_str, is_default, is_specific, + str, "high", log); + + vlarb_str = opt->vlarb_low; + is_default = false; + is_specific = true; + if (!vlarb_str) { + vlarb_str = def->vlarb_low; + is_specific = false; + } + if (!vlarb_str) { vlarb_str = OSM_DEFAULT_QOS_VLARB_LOW; + is_default = true; } - if (!is_default || tgt_is_default) - check_vlarb_config(vlarb_str, is_default, str, "low", log); + check_ep_vlarb_config(vlarb_str, is_default, is_specific, + str, "low", log); -check_sl2vl: if (opt->sl2vl) OSM_LOG(log, OSM_LOG_INFO, "Warning: torus-2QoS must override configured " @@ -9417,11 +9518,15 @@ out: teardown_torus(ctx->torus); ctx->torus = torus; - check_qos_config(&opt->qos_options, 1, "qos", log); - check_qos_config(&opt->qos_ca_options, 0, "qos_ca", log); - check_qos_config(&opt->qos_sw0_options, 0, "qos_sw0", log); - check_qos_config(&opt->qos_swe_options, 0, "qos_swe", log); - check_qos_config(&opt->qos_rtr_options, 0, "qos_rtr", log); + check_qos_config(&opt->qos_swe_options, + &opt->qos_options, "qos_swe", log); + + check_qos_ep_config(&opt->qos_ca_options, + &opt->qos_options, "qos_ca", log); + check_qos_ep_config(&opt->qos_sw0_options, + &opt->qos_options, "qos_sw0", log); + check_qos_ep_config(&opt->qos_rtr_options, + &opt->qos_options, "qos_rtr", log); } teardown_fabric(fabric); return status;