From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C90334D4E2 for ; Sun, 10 May 2026 22:23:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778451823; cv=none; b=LtoVcseEn65X7Wvql/76h3cUtaM81/BvzXLm8qAzqDbHqRrHAU6ysMeHFkLLdW377VJvUGbYB80Gbqgu1Z1qEDYmAkiSh/m8PnQbanx2asvZtbnPh0fh6d4aBtImDuj7yb9gLhfaXFYyM0+8w4ak6VH/c5wdhLs+ivXf8FLk6Eo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778451823; c=relaxed/simple; bh=wsuuQQeFXqjjCdzMamwoZR6Nb5LPZ2Ta7fMPyj595rg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=aUmz3K/oNQo9tUeza14RZPOsKZcB3hn9rMfRjpWY2+TW9DHJvuQy87EH3aaYBpf9XOjrOBI5nOqewA+KQPjOHG4tGZSyQhdYigDNfFiy+udOEzK42K9O//qFklHRigwbPwBIDBgPHiN2iHEmOq7OjmciEOexq/B7ewbZO00d3tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iY41hdfm; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iY41hdfm" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4896c22fcbaso31571965e9.0 for ; Sun, 10 May 2026 15:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778451820; x=1779056620; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QTIxERfOi6NFuZxzcV/Y+ncOqxgrdE5KUKp4LKfbWFA=; b=iY41hdfm8IlwHm787S2oy+/xINOHMt855TcD9smHummlm1lBWjL4Jk8oYDLGBJwrzU uLLzw8pRSZnlSDeKqGYiIe5rVVDONXGC6qVRcUQEb59+9hduZZCsqqIFVc0RLiMhguri 4WqppNLJfkzXFYpZotTP1euyr2t4KEpMKUWWgBY+fSlNA+OHI2lXR8jQONHPLjr/bT9C N/vdOeyzbI7JsfSaFvmmSEzzWAd0zLWtVQVp3iMg0crqqDb9+kJQYDG3H+xY+YcE2Ivn mf0RvTnUG9saKHqf1SE82sn/Wi4Yl+NZqNqzW8KjI1x+MXpyoPqpzE/m3N8qzbIZ/XVy ErWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778451820; x=1779056620; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QTIxERfOi6NFuZxzcV/Y+ncOqxgrdE5KUKp4LKfbWFA=; b=XwFq1x8wxLVy1OZ4LFC1+s0ILQapShKUAhkPdfXlY30bTrnNskW9hAxjTYyykzFbdK Rh9nU9cH9G8qmkpAgLhI1xvXt3RusW+aTMCL21PSFFpZhv8HqhJRWCSTyEPLjVyTnfUO oeA537P7vpeh7VfxAYZ9imcuA1o4xIQujfwJKtOiCbA79d+GshtvRXoM8O4YVQneR6Be xiuiK3+TdLPjF2eu8OJK9LXzN/o7jav2DsrR6JzTd3EkJd3Kly2d5c3Smh/pknE80Xpl a8Ky2Jn0lKUJ6/icgCKQCVm/apsU9ziDOfw6/nnCvTTN3NF3gvzmK5K96Mt5QnGwtYjV leBQ== X-Forwarded-Encrypted: i=1; AFNElJ8r9y8P1lT6cnvLMHrZQu/3dz1ChsY9z80svNcYugpmMLaTroWrtIxfr9VEJOsQtT6AAbxmF9YcOLuksGw=@vger.kernel.org X-Gm-Message-State: AOJu0YwDIiLqcKifG2qN86DDvn2QGeu/s2uhlEQHdVAHadrMWSfo+EAC kRPBv4YB1XerEwc3qZapXmDFPJ1wd0wIpJkZIYmhZ+S8625+MlfLCgi7 X-Gm-Gg: Acq92OEs74qwuZ+cDiaERkB0wTHQWascojdLOUQDJkIRD0juYoykx0kZzbLfPEOoEtp I3e/KKb2PcPS/d/qcQ1aNFzWt1vhbnzmTUn30zcOVZKucWOn3u4OXbMsYlm/oEJ+TbFBTMghigJ tczWNRZzxHMb2gkUS3FtN06ZnS5s9rE5Lop5KP5pxJ1BwTHmoDbdk8wAN6DB6ImmH2rfS6cxBCh qFFwZuHGvfJ9vorB593k7ZCcsfiBt9dII+r+c+YJq3pX0u5zrshyaK8NIscTJRye3phdfagNvCN zzqb0R3x810LznMaVqz/7+RKDetIhhXrQFl9eTTTdgi3BtwgmcSx0F1wbu6Tu+zR/Tp46uPvlsY 3J6a+dlGE5H5mbp5fldS3zC6hs6V+NzQJvh3XErH60T8YpYaPQ0tt+aMs5VME5eOIb2e3Z28i+0 k39PbbqPcp3yZhMWRLHgqgzEuqCKeSyqg7pb15e3nhqxFqkimXdA805lgZz1CihTZm7xITNsxsG pT4TCOyew9YbL3FywA2NapJraV3kuDrA6E9CSh8IA== X-Received: by 2002:a05:600c:5296:b0:487:219e:42d with SMTP id 5b1f17b1804b1-48e706932d5mr112432275e9.11.1778451820293; Sun, 10 May 2026 15:23:40 -0700 (PDT) Received: from SD.localdomain (heme-13-b2-v4wan-167795-cust403.vm32.cable.virginm.net. [81.108.45.148]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e6f9fbf12sm152399565e9.0.2026.05.10.15.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 May 2026 15:23:39 -0700 (PDT) From: Prathamesh Deshpande To: Leon Romanovsky , Jason Gunthorpe Cc: Patrisious Haddad , Mark Bloch , Doug Ledford , Haggai Eran , Majd Dibbiny , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Prathamesh Deshpande Subject: [PATCH v12 0/2] IB/mlx5: Fix loopback rollback and threshold accounting Date: Sun, 10 May 2026 23:22:52 +0100 Message-ID: <20260510222258.6654-1-prathameshdeshpande7@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series fixes transport-domain rollback and inconsistent accounting in the regular (non-MP) device paths. Patch 1 fixes TD rollback on mlx5_ib_enable_lb() failure, makes the success return path explicit, initializes lb.mutex earlier, and destroys it on cleanup/failure paths. Patch 2 corrects the loopback threshold logic to use a capability-aware baseline rather than a hardcoded value and ensures that user_td/qps counters are rolled back if the hardware command fails. v12: - Add mutex_destroy() for lb.mutex in mlx5_ib_stage_init_cleanup() and mlx5_ib_stage_init_init() failure paths. - Keep MP helper behavior unchanged. v11: - Dropped the MP locking changes per review feedback to keep the logic unchanged. - Narrowed the scope of Patch 2/2 to focus solely on regular-path threshold and accounting fixes. v10: - Initialize lb.mutex before multiport master init to avoid race. - Use <= td_base in disable paths to handle idle/no-TD cases. v9: - Address race/state issues around force_enable and enabled. - Fix TD leak on failure after successful allocation. - Implement hardware-aware thresholds via mlx5_ib_lb_td_base() to handle both TD-capable and no-TD hardware correctly. - Serialize MP force-enable transitions under lb.mutex. v8: - Resubmitted as a fresh, independent thread per maintainer request. - No functional changes since v7. v7: - Split the series into two patches to isolate the return-value/mutex initialization fix from the refcounting logic. - Moved force_enable check after increments/decrements to fix leaks. - Updated hardware disable condition to a strict zero-check. v1-v6: - Initial combined versions. - Added deallocation of tdn on failure. - Moved mutex_init to stage_init_init to prevent crashes on non-ETH. - Implemented atomic rollback in enable/disable paths. Prathamesh Deshpande (2): IB/mlx5: Fix transport-domain rollback and initialize lb mutex earlier IB/mlx5: Fix loopback threshold/accounting in regular path drivers/infiniband/hw/mlx5/main.c | 47 ++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 14 deletions(-) -- 2.43.0