From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 35593274B3B for ; Fri, 10 Apr 2026 00:52:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775782354; cv=none; b=avwOLmkb1ejU2Wf3tbVFSuzBzUgcPbI//+ybdtv5nzFhupy310fq7PqUO7wMKWZx/9lylUYRk5/1iUwmGH7m0+F5WNEdVUXqectHTM+L3EHdfGPt2NTiGOONuhwnbtyoUmxinCM6aFPALAxYlnrUX7bqeo/SmcfKkKx0xoJzrsw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775782354; c=relaxed/simple; bh=zfY1C6nPL1/GQTDTHZXi/r7xI/Gam/Euq9fCMzlJllE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XD1tJGEKUdu4jgRw7ZzpzSzFHIDoxNZdCU20QhResfGD46Zw9RcWlfXJLIKyMrBJ80XmsDKTn5oGOWOnk/w0+Nvig/muVhFyCvmE+KOu+of2Thbowaqo5V6sRvAKGkDYYgF5qvt3//jo504kol0lcDa0p8y5y6k+ilyEzsuamDU= 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=mx7OWKSQ; arc=none smtp.client-ip=209.85.128.45 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="mx7OWKSQ" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-488a29e6110so16759145e9.3 for ; Thu, 09 Apr 2026 17:52:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775782350; x=1776387150; 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=fBHxPlUyjkSPQjS+B7c61Ae30u9ycDttru07yHqy8gc=; b=mx7OWKSQb+n8xA2vMpsqF4Em4Jhu8MY2txxPk/IkdBQ4CDz/oG/RSlpHLjPqtuDfqR LPYsmiAxw6lT5RxD24XxWrF2L0TrBO/8Kac5kS/WAqUAw7L3k+T50QLNctkFoj/4Dl5/ QPwJm2aYbZhDJzQ71GwNXMcydS4P12J9GyuQaz4uLUM3Bcgb63VBjEObLT9N9Fvs+bRX PLrSlWC2iVx4X1Maff5pMPpRAuvUdM5eh9Kcx2rBl+xPYsZUNPOgaIcz8pT1oCDo0T2f s577RVB7ltDquiggURXtRnMwH5OqKNRrCzeU8CT8e93Pf2GmlfXXYZ2awprEKgF3+DP3 BC7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775782350; x=1776387150; 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=fBHxPlUyjkSPQjS+B7c61Ae30u9ycDttru07yHqy8gc=; b=dCzLcWxEfH1CKnr0JtkTC3J0BZ9+qo8Gfsc+J1EombdiPWUZDHz10vKROvpm2x3ZVW klzmQMqMtgITLyCC/XOXjusOcyWSa2G0hWxiZ+GqnaPrCBLi3yziIspn5qtk246GDuMZ gMbtH9GJc9lQwoGvBrPeDELs7GM8RNDhLwIebACB34Cr83rTQF4Rcf67TW6W6SVEjMED q3IMZ+dhgiIXDZ5UtWpSn4rXIF1lijN0NfFwG3wI94SKhZRMB9pLyV0SVKs9hZrYYwkV iorw9lAmj6c03RE6aD1FB3F679faKfHQeCDtatlHgySFV3htfb3ikz5PkPPg8uT28bCP id/g== X-Forwarded-Encrypted: i=1; AJvYcCXhpbZcGwrGtS1N8ho/AyxhSeJEYNX2Nruxg6VwBEaSWQNyKQhYTek+X0vbK9F6HVK1A9CLCPChQxcFO1w=@vger.kernel.org X-Gm-Message-State: AOJu0Yw50xtahtcF03KeCLKwds/PVtWzxbyvAeTUWPpXIZQ8W0oNfsZn RfrY/cYLEqZS3URWA9Qy3A2Zg1lBXN7sKkSzv1TDPzsLbIjHhkj0Hh9o X-Gm-Gg: AeBDieuQk1UAkyCWoGdgXGxqNkU1Xy8xjfzdXOHL1+tydlzLk+aDlvZvan44Imbnj5p vgU7vLdhW8X+wvR5pqfcSeVpELbWeRIHCa/je48RIzU09O4wR2ywOumKV50L0uzo8FNqfpw+5Gg q1uqPtoe6Bu1bJPAyeU25M+9tDE6kaFXJDrBpkVakIXGH5aKngQnvfQ3HtetdkNk151hHF59dho 4oscBqeUriR8pGnUiR8ieWdzp98VW/B9KeBihIS9cYhIQtnKsUZWQ8Tuvp8xN6LgC82+RimQtBi X/7y6HljiespFLzxqCVVB0YId008XJoORPMVAJ5m6nlu6ipZSpzUdzN/Br6Eo4gMb+WfuaJqEcx y7tGL3K0pqkX1BkDA9Gm170kuFaMl3gG0r3sdzaAOVAfH1vicw/rnVaRKwyDz7CmHYmzSw/zM3w 8/lRRi8mkvbftIB6mFkJzb8Wup+sq6b20bV0RRtKwjb1DXG6WZBydurwGteraotmQp9BO7UFXwR uSuuwXmXMtPArER+3R85QE84ZrPuwwevt18HXDNgH8aCDWj X-Received: by 2002:a05:600c:6089:b0:488:d376:42cd with SMTP id 5b1f17b1804b1-488d689d9admr8981035e9.22.1775782350383; Thu, 09 Apr 2026 17:52:30 -0700 (PDT) Received: from DESKTOP-NQ2T5I7.localdomain (heme-13-b2-v4wan-167795-cust403.vm32.cable.virginm.net. [81.108.45.148]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-488d67b4903sm8508265e9.5.2026.04.09.17.52.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Apr 2026 17:52:29 -0700 (PDT) From: Prathamesh Deshpande To: Leon Romanovsky , Jason Gunthorpe Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, dledford@redhat.com, haggaie@mellanox.com, Prathamesh Deshpande Subject: [PATCH v9 0/2] IB/mlx5: Fix loopback rollback and locking Date: Fri, 10 Apr 2026 01:52:16 +0100 Message-ID: <20260410005219.5197-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 loopback state consistency in mlx5 IB. Patch 1 fixes TD rollback on mlx5_ib_enable_lb() failure, makes the success return path explicit, and initializes lb.mutex earlier. Patch 2 serializes MP force-enable state updates with lb.mutex and implements capability-aware thresholds (td_base) to ensure correct loopback behavior on both TD-capable and no-TD hardware. 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: Serialize force-enable state and preserve loopback accounting drivers/infiniband/hw/mlx5/main.c | 81 +++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 19 deletions(-) -- 2.43.0