From patchwork Mon Apr 23 17:58:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rohit Zambre X-Patchwork-Id: 10357897 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B5FE60209 for ; Mon, 23 Apr 2018 17:59:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BEEA28BEA for ; Mon, 23 Apr 2018 17:59:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1090028BF0; Mon, 23 Apr 2018 17:59:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74A6728BEA for ; Mon, 23 Apr 2018 17:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932268AbeDWR67 (ORCPT ); Mon, 23 Apr 2018 13:58:59 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:55535 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932506AbeDWR64 (ORCPT ); Mon, 23 Apr 2018 13:58:56 -0400 Received: by mail-it0-f66.google.com with SMTP id l83-v6so12107298ita.5 for ; Mon, 23 Apr 2018 10:58:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uci-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ccTjP5SJvMIYXJBCYNzgS/EBCLaJtr1HUWNwLffRUbo=; b=Ssu7GFyJ2isVnnHN2ZSCjWkXOzeCVS3vtdT40ult6IBITygAihWJ/QTuKbSOgxg/AJ XVU3J9QEhwYodNUWO+7xdEen4Cl0eWLgHcwixDGq8Cam6pKV3X5ANNYZF9oWTrQgEMb8 I5WdUjEYQenmFOg+0TBBQC+mqX1SEJJafCNLZaItN9jxfcd5QZ19Y2MneKMvVP230w6V nBfZP7dE3qd17ULL6xax3ILn/9YPaNDg6z6MQZmIFcMCLxoeEgjKCMmjZNQMiIC+m86Q pvrD0qJjCr4FeV76lRGpml6S7b+bUjqgkfK5aAI+ekpkvwDxr/0KFhG5FnRtoxk/iIxK 45gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ccTjP5SJvMIYXJBCYNzgS/EBCLaJtr1HUWNwLffRUbo=; b=bk52KoaHQcAAbOGbriDEsBWsODWzrc9TyJZYsbgW8tK7/vMltENc8ulVxps07E/4nB iNTFxEeklNvH4f1+PCx5DXZuck0tnhGpSDZolpGjhT7ySjPUnEWdaWLOrX421se3gfVK pUB+EShrrWjT7Uv7SE4435mFxUi8QGm5RLCaGaqDggy2mVylWznhUQo86vVSiQ8LKFKq frlJRqDyCXY/gqPLQmQTACQffWP+fFiQsBLWrSEWHZVYHVGLZ3X3jUEQGcl2+eqDvrXS H9M/mk54ZXtbmIlQUSJSplxtH8JK9rbFIeeszy/qVDVGhqG8JPSNLBfiDuNNsAVe2yGK qpdA== X-Gm-Message-State: ALQs6tDZnfbrg4W8Jloi0dkmmbCyeFPcBbeXwXklaQpAHo2wym4RBJ4G A6tCuKkudV8X8IL0+hvnI/TklJxE X-Google-Smtp-Source: AIpwx4/IXV20JP0+Q2S+vi//+5elGnyn54vOv94GdFIGqmQYwyHfn/XsTRtTjvG4T0YktR3ADs9BJg== X-Received: by 2002:a24:cfd4:: with SMTP id y203-v6mr15192214itf.23.1524506335524; Mon, 23 Apr 2018 10:58:55 -0700 (PDT) Received: from jlselogin1.ftm.alcf.anl.gov (jlselogin1.pub.jlse.anl.gov. [140.221.96.130]) by smtp.gmail.com with ESMTPSA id z8-v6sm4334074itc.34.2018.04.23.10.58.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 10:58:54 -0700 (PDT) From: Rohit Zambre To: linux-rdma@vger.kernel.org Cc: Rohit Zambre Subject: [PATCH rdma-core 1/1] mlx5: Account for at least 1 medium bfreg in low_lat_uuars check Date: Mon, 23 Apr 2018 17:58:47 +0000 Message-Id: <1524506327-24417-1-git-send-email-rzambre@uci.edu> X-Mailer: git-send-email 1.8.3.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The calculation of need_uuar_lock rightly accounts for at least 1 medium bfreg. However, the user can wrongly request for all but one uuars to be low latency uuars. For example, setting MLX5_TOTAL_UUARS=16 and MLX5_NUM_LOW_LAT_UUARS=15 doesn't throw any error but the user gets only 14 low latency uuars; need_lock for bf_1 evaluates to 1. In this case, the first QP of the context is mapped to bf_1 which is not a low latency uuar. Signed-off-by: Rohit Zambre --- providers/mlx5/mlx5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c index 5590241..2a09a95 100644 --- a/providers/mlx5/mlx5.c +++ b/providers/mlx5/mlx5.c @@ -1026,7 +1026,8 @@ static struct verbs_context *mlx5_alloc_context(struct ibv_device *ibdev, goto err_free; } - if (low_lat_uuars > tot_uuars - 1) { + /* account for at least 1 med bfreg and the 0th uuar */ + if (low_lat_uuars > tot_uuars - 2) { errno = ENOMEM; goto err_free; }