From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5108F3EB7E5 for ; Mon, 13 Jul 2026 11:55:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943721; cv=none; b=oQzHWOzefU3tcX30wikNxbMwY5PJB8tVmOhAQXYa4N2pgcZ84BWYklvC5Ve9tfvOUxFwQEXtpFp+KnfMMUyCMWMZKqhNta70/3ZibWBHQcNAeQOYAHLILU8cJFIuwfpf1XAmnav947359AaKv42pQQL1hhHnQg+zRpP8rsE9O2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943721; c=relaxed/simple; bh=0tyz0Ok0dZeBsPaUjBaHpnDazTAD9J6yHQJKN7agDa4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kJ2YjlbJGsx/89hU+oskLMwTbxMBfrVEj4kcLHK6ty3+Tr+j/7ZfmkoIxxNm1hREeB5Jh97PPENIzToZRjdoW/2AIlItudD72GichKDk0rM46Fkz6aE2T51OvXK5iPjActYyvDPOSO2uyrId9JOybiKYRJ628n5H/REfuSPZWBs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=VObOpOU9; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="VObOpOU9" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6ftmm1668583; Mon, 13 Jul 2026 11:55:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=EComTKARJb89wPXmL llPWe40ccC9VGBvxmvNUjxIFfM=; b=VObOpOU9nWnvMp9qCgc7M6Iu699bw0s3M 6FeqU9Lu2pLJhbgtfi9hyYChIAvNryYyjOnby/KrVYWQ5wAUEBP5giUyuMFjOhVe 7dlId7FyyqbnjN1t2AGdQln5HQ8yEH0OCeVe65UR7AVYfqiRzQpQlOSj22NzGt3R pnxM0ciUs8eL0l428PidkWURq8+TAI6ajQLLr1h7ufuqztzzNGxjU//OGhdaWUXx FrmYOaL0spg+T9E4e43lWT7/DOpkQdPZID8jc1H0hSEPudQwgRak8F9gUJjNfo5a mwmSiTdjmixB1CQo4Y9kc9XR5enYspCkRjDCua53LQYGfO7HTzh8w== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbexwg1ta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:04 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBna5S023614; Mon, 13 Jul 2026 11:55:03 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:03 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBsx4K52101552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:54:59 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 64EE820043; Mon, 13 Jul 2026 11:54:59 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7BC4120040; Mon, 13 Jul 2026 11:54:57 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:54:57 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 01/20] list: introduce LIST_HEAD_GUARDED Date: Mon, 13 Jul 2026 17:24:02 +0530 Message-ID: <20260713115444.465704-2-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: bTKwBTJjdhCUN3eOzq9uFUDeJ3HPzemx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX1p7fjFnYjPXe 75XQd1C8yqfdE0CyjisUkf+8S/Ndgu6FPCvs7fHVCopY/ehJy7cRHHGA7XCUKx5E5v9RdbSQvuP /TUUKQqwQmTwhH7qFLvs1fLnzBoU+k+07EMLgYgv+lOJbkdimhK80NJP7p+r5Qr2SjBDoI5NoU4 JtlneMFwTM6qtJbQP3llj7mGhX62oLla17ur5anQkJ7/ty2Ci/I4VT98X4FZrvotu8fKvEUtRbW sWOUYsPMC1fT49/9ZvNUlpzI+cc1n6IKacMoCAgTXrziZbmK4ApWLlKcyAIBwPJA0lpylxOVDyo JqVZ71EtHBLjl7TZWaYsS7JJQMA1PWHMZDW+Z4zc4tSNdY1yJDSmiWSai45XAUcq+0+dnIqaNSX rUKcGDDz1vEa9BwjypH0I89Q0fXjdICsoKpxYFyHUyZ3Mc90G8FimqoHS5O9gxP3kkXMgAoB5zs 3ZrrXNkY2Ukef0hvjmw== X-Authority-Analysis: v=2.4 cv=XJoAjwhE c=1 sm=1 tr=0 ts=6a54d218 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=yEdB1FNURbGifd-vTGUA:9 X-Proofpoint-ORIG-GUID: -hgeGAVeqLIyNtYsh-QJ85jlscnWnySb X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXwEnMtMBdEE0j EO7laSTHVqvvZfjMmwUNKwx5vM3QFZIzpkTtJOM/OT3HZkvM/4QYbpwF3trkKw5vktS/kvVkHB9 r4YwF6FOqkmAT9rRO1Bg0TzPHGWh0X4= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Introduce LIST_HEAD_GUARDED(name, lock) to define a struct list_head annotated with __guarded_by(lock). This provides a convenient shorthand for defining lock-protected list heads and allows compiler context analysis to validate accesses to the list against the associated lock. The new helper also reduces boilerplate and improves consistency across callers that annotate struct list_head objects with __guarded_by(). This is a preparatory change for subsequent patches that annotate LIST_HEAD() instances with their protecting lock. Suggested-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- include/linux/list.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/list.h b/include/linux/list.h index 09d979976b3b..f6f22c8b06f7 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -33,6 +33,14 @@ #define LIST_HEAD(name) \ struct list_head name =3D LIST_HEAD_INIT(name) =20 +/** + * LIST_HEAD_GUARDED - define a &struct list_head annotated with __guarded= _by() + * @name: name of the list_head + * @lock: lock protecting the list + */ +#define LIST_HEAD_GUARDED(name, lock) \ + __guarded_by(&(lock)) LIST_HEAD(name) + /** * INIT_LIST_HEAD - Initialize a list_head structure * @list: list_head structure to be initialized. --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 439043F58E9 for ; Mon, 13 Jul 2026 11:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943726; cv=none; b=CTxwHIfwHcZ//wCZRLF8j/7YaE/nn9rLjzf23ktxCVJp5bM6v/N7bhtJ8+B2vfK3njjbY31SVIingBJr7/FYj9HzJkEvrQly62tRs653oFhJamoxH5Os/WasroS9GlijDkuRX7EEJRGcRrg/pgDyTQ8l1OM+QaQiwTFVxyepEuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943726; c=relaxed/simple; bh=9famA7iYMgV1szWsgpchH0LLweh9Zetp9tpUFUGJj6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=chmZxZvd0zdo8xCurb6h3ly0taKqjiHNya81k0o+n426x6e2zVsSkFa+AHIZx+/zufeZdPVYpqSvm/ktW+do8jQj2VWMSTUO7oEM8MWy7mJnK+FZhBhD1uLfgIx1TjDQOGdltImb+BRVrrZ3+XUoCKWGxr564SSZjep4vkaQbM8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=XuEA7eg+; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="XuEA7eg+" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6fYdU1740140; Mon, 13 Jul 2026 11:55:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ZNwHp1WLvUb5u+QxI V8sWET71/YQVNBNKDMDCrQyGDM=; b=XuEA7eg+dRNi4AomCSmXRMxlQjKyPolhP o/utX/Cq/cBQHlUxBJvcAtbxX6jzBK3u6VY/LLl0eDUkCOIhsHEdEYaluBQUf2b8 KYI5TOsPDqE8LAcgiV01OtkM5BswJS5VhTjZ/AwzleOWRES34gJD8ivvk8AgLC/m diFyzuAvBNsJH92yGGQyeKU1Rr3KCVm2mw6EKHSplV7vUNSFLxKUT2yvgXjREYb6 qZMDuLRVe5F5ojwHUDoRCorl0ssRqkWUvnkIlO6sWg9OdZYeUnBUxbcztuIVR/5c sf2ie3dBAI2+z8ZJfgy4ZGOiKNBf+lTZ8lK26ySOpyUlLomsCjhlw== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbegt0f9e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:06 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBndB9006908; Mon, 13 Jul 2026 11:55:05 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fc05pwnvu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:05 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBt1Y842991982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:01 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7EF42004B; Mon, 13 Jul 2026 11:55:01 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B1B2920040; Mon, 13 Jul 2026 11:54:59 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:54:59 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 02/20] list: Permit context-unguarded access with list_empty_careful() Date: Mon, 13 Jul 2026 17:24:03 +0530 Message-ID: <20260713115444.465704-3-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: pBXu_KgKEnzESMAVMVi0knc0nyS4Hqn5 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX0PJWpUfvdfx2 uIlnjfkKrVsicG6eqGstkmC8oQb97wqyMO/G6WB9qqZtjdAIP60obgKZsfouqKx+B/If27wYne3 mmzX8EIrm2ZSJrc8JymMZMOf6oeJPPg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX6l3+y5MTFnws AZXkW19M3LTmTvC+OGFFaqeNOmpxh/B2pNy3FagzsR1PgKQecDKjWbvqwjN88xOonohBjUQCRxL zqrmPXTMT7qBgVUM+ILNaleCN9AFSnnxBXXyUJwlaEn5XnVctJ/A0wYNEXuUjc1VWbfowVYztYU W3ROqLpMidafFM+T5/VNi/oISfuzqX+QPz++2LuZcuVIBnWmQ8gBM/36TUeP2/Flh1HhIR7OL/d POgFSFqPM2nd2xgv1F2ChmYEXqx82gjxaGvWtp3p5nzC0VScn7yNHCO9eomc2SOpTWpz6ngTPJ0 dlzo7d+NJHr+R/gBEf7C0zkgaIQDCAFIheKMqollnL5gYOxwgz0fjaOEYhWuMS7izc85uytt3X4 n/RK0ZXT5K5A46UIkiYMpHHx0Pr8MaR49KAOpUlkNEzbEKtck8ayAOB/A6gvb4P2dvXjOxCH6Kb V2c+bqiRywdZQ9afI1Q== X-Authority-Analysis: v=2.4 cv=IqMutr/g c=1 sm=1 tr=0 ts=6a54d21b cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=1XWaLZrsAAAA:8 a=VnNF1IyMAAAA:8 a=4at8UNLr3tDfbFC0C8MA:9 X-Proofpoint-GUID: oR7CKBTJwnTWHzyfnKAHwgeyasazEjKA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" From: Marco Elver With Context Analysis (viz. Clang's Thread Safety Analysis), list_heads that are __guarded_by(..) require holding the appropriate context lock when accessing and manipulating them via the list API. Because Clang's warning diagnostics do not perform inter-procedural analysis, this is enforced by Clang with -Wthread-safety-pointer in the caller at the call boundary; a warning is produced when passing a pointer to a guarded variable without holding the appropriate context locks: warning: passing pointer to variable 'list' requires holding [...] [-Wthr= ead-safety-pointer] if (list_empty(&ctrl->list)) An exception is list_empty_careful(), which is like list_empty(), except that it is permitted to use without holding any context lock (carefully). Mark list_empty_careful() __context_unsafe, which disables context analysis within list_empty_careful(), but also suppresses warnings generated in callers related to its pointer arguments. Signed-off-by: Marco Elver Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- include/linux/list.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/list.h b/include/linux/list.h index f6f22c8b06f7..19212bfc3f6d 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -444,6 +444,7 @@ static inline void list_del_init_careful(struct list_he= ad *entry) * if another CPU could re-list_add() it. */ static inline int list_empty_careful(const struct list_head *head) + __context_unsafe(/* intentional lockless access to @head */) { struct list_head *next =3D smp_load_acquire(&head->next); return list_is_head(next, head) && (next =3D=3D READ_ONCE(head->prev)); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABEE93F4DC7 for ; Mon, 13 Jul 2026 11:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943727; cv=none; b=ceqXCpuzDfkEGlXD3ulN2c9oHHvXdLJvSsTLmxqxwb9WtvrgQYhKW9JwTyN4doOXmuZN4aU3Ve9e27+n4hWYU5iukqXOzkvbWaf5YeVVfNlYdagkkqvByeZ+RqZQNUJ8axql7Hk8Hp0FrdxPJ6fXm/RJAbyQ3cD1uK2/w3SQtHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943727; c=relaxed/simple; bh=bWSGrwBrW5QQftVmCvPyK3FZUdqzTKKqSqFRsVThtps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nv8i9Xr/ZEBLWpzRSNb6xVdw2glhS9WYkgIjw+8ccNbpn3sYK+nrbtraoq/nwtMu5gy+pU847S0DFn8DKvSYgrbOZoZT0hE1eZSV7aaAaobAHn8KllyUsOVWk7pZmYdVY/SubYI612+yripA0rbFpPv5Lkd/FjuN+ZBdWDqlYkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=fAeG+shb; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="fAeG+shb" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6gWrO1728555; Mon, 13 Jul 2026 11:55:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QakmAYygB0U9BE+3q kUyBXTW78Hm6uwh3yDd4Bo9AuM=; b=fAeG+shbB8tTdXb8pYeIirAS2sPVJ2zbF KPEUatNZH7r5Jh7xOA0drej3iRa6ygdT71OB3+G6j4I9YMNTApXsq8umPAsvaOLj TCUNTCDC+ikYIGK80HEjw9h7jWom4XElUsS8c9iVBZ7HUO1fvaIqyiwaq5cWxvsW JrayfrcY1jPzr5q3h74Rwqdsa1uBGcAn+irbjrc3vySc3MlCWQz0oW+B8LPaza8b /xI17gaRhLNNUwDWhRTjAxDDRMbAVrzh24PNppY7OQWycvFs3W6ACheY4j6IA4m+ ep6d+Rb2PxKsUvKT4UPM2Bl4qbXG48unV5x6ANoxzuzNj2TyZ9KNg== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbepx8dcr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:09 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBne8S023628; Mon, 13 Jul 2026 11:55:08 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cvh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:07 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBt37H57934138 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:04 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D961E2004B; Mon, 13 Jul 2026 11:55:03 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1AC9F20040; Mon, 13 Jul 2026 11:55:02 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:01 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 03/20] nvme: update nvme_passthru_end() signature Date: Mon, 13 Jul 2026 17:24:04 +0530 Message-ID: <20260713115444.465704-4-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: cPv2Eno8wz7eORVtW1E1OF_JY3XZs7hS X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX4qpjfouRQ5zl 2s73uVAR7A3hovVbw7kY3dUPKiUr20AXxLBFdozoJfXizYr1LGhLn3V8pPQnWH97HXJK6biV/Wk JlppAAQOuqMDeQqUDaFZwliK6BlfDw0= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXyRtV6A+vE95x uWV8gqsaenNqUNANrJt1DuzZl+4+SGUUlu2GfP2a1cb0ce0el7b74YVRXhh6Heztj6L+/9ml+J5 /Q0xOPvVUl+lsDdHR+8zCznOG5eAx6k6x8oddXhuy/0Tdw7c0t1zoXBrPvfOUCP+7I5lxIWTEn0 tH26zPTAl2VCKQPpvB07oG9ijkjsiZLxU2OZXW2oq7xIPMIeyD5xtnp4WvJBxF8+8G+61xwEbWC mayUbcQtBYeJdMUQC2tMQ6e8uIC6DNWRrfsZy6+CLat+4rDjiBUegVlEVsto+UwTJUBZrBx+5w3 iuJV5qlqOwphMBpYYnc2HCZUgXWZCGBu5ULZQGn6UwQv/zJwxoOXhc8tIozwfWyfkLVGn0DaMQb bWqNPqpnlW2ckA6I3v/FU4Zp1C8qGgxoMQQXprpMdHu94N7Mp399p38Kg6EzjjyQcGT1aEhuPeP zHTA16zomznYk8/34aQ== X-Authority-Analysis: v=2.4 cv=XbS5Co55 c=1 sm=1 tr=0 ts=6a54d21d cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=SiEiA-kSKP9ZIulfK2kA:9 X-Proofpoint-ORIG-GUID: QbetWT8_2HwMVd0I9wPlGF391Uql1V0y X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Change nvme_passthru_end() to return the command effects value passed to it. This is a preparatory change for Clang's context/thread-safety analysis support. The conditional release annotations (__cond_releases()) model lock release based on a function's return value. Returning the existing effects value allows a subsequent patch to annotate nvme_passthru_end() as conditionally releasing locks acquired by nvme_passthru_start(). No functional change intended. A follow-up patch will add the corresponding context analysis annotations. Reviewed-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/core.c | 6 ++++-- drivers/nvme/host/nvme.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 453c1f0b2dd0..d6a095e1e44e 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1268,7 +1268,7 @@ u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struc= t nvme_ns *ns, u8 opcode) } EXPORT_SYMBOL_NS_GPL(nvme_passthru_start, "NVME_TARGET_PASSTHRU"); =20 -void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 eff= ects, +u32 nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effe= cts, struct nvme_command *cmd, int status) { if (effects & NVME_CMD_EFFECTS_CSE_MASK) { @@ -1289,7 +1289,7 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, struct= nvme_ns *ns, u32 effects, flush_work(&ctrl->scan_work); } if (ns) - return; + return effects; =20 switch (cmd->common.opcode) { case nvme_admin_set_features: @@ -1310,6 +1310,8 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, struct= nvme_ns *ns, u32 effects, default: break; } + + return effects; } EXPORT_SYMBOL_NS_GPL(nvme_passthru_end, "NVME_TARGET_PASSTHRU"); =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 824651cc898d..0797c3a6a9c1 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -1292,7 +1292,7 @@ u32 nvme_command_effects(struct nvme_ctrl *ctrl, stru= ct nvme_ns *ns, u8 opcode); u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opc= ode); int nvme_execute_rq(struct request *rq, bool at_head); -void nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 eff= ects, +u32 nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effe= cts, struct nvme_command *cmd, int status); struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7C4C3F54C9 for ; Mon, 13 Jul 2026 11:55:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943727; cv=none; b=mVd6eXU2fdibp9EN+vS/WasXeZLTkxA/u5Hm/2YuFpCmyhX/ynafXPDo1wg0RfNWhmE/Hd+X2dbuh+zeqLrY9a9Q0Cc0YcHhHsZJpp47npxyFe72KG3Q7i3ui1FYo2Qqcs3Un8z9eNq5TTa9n6ecwkXq/SloetjsM3vl0ijuUas= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943727; c=relaxed/simple; bh=DBPpneQG3eKsHd7bnS4HNzj/2xHFvkDMmaH6lPZpMMY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZRFgUUwd8fjb0NZ+6XWHjA1Wnw31Xg+Np4qvxIuQe4v+GDU2HYqh7bxsGe+KIIYuKL53JCoVyyVK8xRNMUw9VmgiU1IiYgAvPX4omnMo+vBLpZ84KIaacGYNrj4juC47d8prAzxORi3/wGRc1G7KWDo8E/R4KFdmSGdiILh5SeU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Qpn5HlGZ; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Qpn5HlGZ" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6flB71731614; Mon, 13 Jul 2026 11:55:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=8+M7RExt2GjfkCztu hQCS86rc+iABZUktjOmqv/Izig=; b=Qpn5HlGZrZ/88/mdPM94GmW5bfB9Of4f5 UcUzAJ0D71RQfpmnWA+rnzWZxDgvxwn6z+IdfIe4dlBX6ydI9uyJADyuUBa1D8HC W2n5jT/qoPzY17xwIOXADYGEkhLLmXJAbWaZe3jXcnLDeY91R6zFH64dBoB9dm0h aH2vNbYoVkL3DlyelBNnwGxJe8be9c1jFHTWYOzUoMuU2jTOppVi475qgsYREl2H 67nHIwt9c6DmBFUPS0SGb1RkdLqd/bl4Ny5dXWoHjQrSUeDG5LCPPGcTYUNMnzyF OvTR9gEaGq/wyY5Zu5LnWt2HPh32TihqcOj9lcn44qWt8K4tuuxqA== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbegbg3yy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:10 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBna27012330; Mon, 13 Jul 2026 11:55:10 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc0hvwk4m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:10 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBt6dk43319648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:06 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F2C8D2004B; Mon, 13 Jul 2026 11:55:05 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2CDDA20040; Mon, 13 Jul 2026 11:55:04 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:03 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 04/20] nvme: add context annotations for nvme_passthru_{start|stop} Date: Mon, 13 Jul 2026 17:24:05 +0530 Message-ID: <20260713115444.465704-5-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=fOcJG5ae c=1 sm=1 tr=0 ts=6a54d21f cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=7bgEqNGeQr-mGYOCYikA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX594Zpo8qzJA1 NHVwUvuwp44u/vEOS1rItGJbQa4XyCzMDoo5br12XC5Y5dvTktH+lXUUMk518tcjzKq6fouUPng 2yKT0hYuiK/rlouGrs7lzOENrW+sJSPyrqRFQZv2GS2Prwq4Bswb1SAfPoPrvNVPmRPeXhzrqZJ i0rGm2GHcZJmOq1dX0dM3BNFUTVzkccbYKGh0j7XC4+sbxuhHLGCMNcw0Qz2PRLKauIMmo2544T vdSOrI2uerJS3miMeiFsK6qUajYSC/2h/PJUcKRxM0GZptvsOA4AuIyITf/stsSvcsrVrBi1oia voYfQHB+RpEAhR2+kRGw7jqFeYiobspKDUDtfHAIy6/3Yhk9CTE8jNxLscEscQ1xMfx9UpxjrM9 2KKIceibBxx0I74EVWZIToMV4hM3AKA0AOAXiHwrSVAF83J40G8pcveBHSOsZN8LET2i4Ai1H0G HV0oGUkCxcDZSdW7gCA== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX6ZJDYeipiNJ7 vbzaM0nzy4oCt04Rs4sZSUSSTi8Ck8vN0Eo4q6WpiQ5npqkZs6fWJ0VyaO2bGqjjnOGQJiyzldL gRpOwueL5883/qjfSTn3anxuhMRXdDA= X-Proofpoint-GUID: SiOZ5Jh9bkyAy_Ye9XFxQoE_Lwg1Ad-K X-Proofpoint-ORIG-GUID: nuTAGwprWG5uwOGFCqnTBEGVCT28Gzzn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Annotate nvme_passthru_start() and nvme_passthru_end() for Clang context/thread-safety analysis. The __cond_acquires() and __cond_releases() annotations model conditional lock acquisition and release based on a function's return value. Use a nonzero return value as the abstract condition denoting that the associated locks have been acquired or released. This allows the analyzer to track the lock state across the nvme_passthru_start() / nvme_passthru_end() pair and verify correct locking semantics. Reviewed-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/nvme.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 0797c3a6a9c1..fba2d7674623 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -1290,10 +1290,16 @@ static inline void nvme_auth_revoke_tls_key(struct = nvme_ctrl *ctrl) {}; =20 u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opcode); -u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opc= ode); +u32 nvme_passthru_start(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u8 opc= ode) + __cond_acquires(nonzero, &ctrl->subsys->lock) + __cond_acquires(nonzero, &ctrl->scan_lock); + int nvme_execute_rq(struct request *rq, bool at_head); u32 nvme_passthru_end(struct nvme_ctrl *ctrl, struct nvme_ns *ns, u32 effe= cts, - struct nvme_command *cmd, int status); + struct nvme_command *cmd, int status) + __cond_releases(nonzero, &ctrl->scan_lock) + __cond_releases(nonzero, &ctrl->subsys->lock); + struct nvme_ctrl *nvme_ctrl_from_file(struct file *file); struct nvme_ns *nvme_find_get_ns(struct nvme_ctrl *ctrl, unsigned nsid); bool nvme_get_ns(struct nvme_ns *ns); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B48D3F8253 for ; Mon, 13 Jul 2026 11:55:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943731; cv=none; b=TmJ6UciDyUGfr1zIhRAo455kQ6OJtQ5JeUCJk/dbNjztJQcN+fl94IPzTP9/WfjDnKgh7Eu/V/COZwHI9ljhMqz24d68knvVGfC6KB2Gce0HKyD334vWXseK9Dm0u6g0YXbyn/McIcr4s3oJcnVtLBJVamgQ+lrdd22Aes91wFo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943731; c=relaxed/simple; bh=qvsNIs9s1kFB6WmEce2GaW2XfElLMWCPDPQnLIkBujo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M+EB1OGM6upcWYGeP49oNMtGSzGKqqL/tPHmJp1fZBElly/7eZAAH97Lz9DA3jQ1Zw4/N3hgOJ7W2Y4d6T/sPLzezEOgX1yx26KYb5UMsn4bV1WAMyS24Jje5GeLfDBaqwIXzL7ltgryQUZ1AkjNdhG4gB384ncskc66xFe3j6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=BrTzR7Pu; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="BrTzR7Pu" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6fksm1731610; Mon, 13 Jul 2026 11:55:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=FR6j68Zkk2rMQiUg0 dCwX5UmoEHpYnxTCiV0hVRmlE0=; b=BrTzR7PuYHLzyVwx1jJqUXSv78WnHsmHz JbvzVQPYJqPak7YpGXL6z4s9UzYywuKLmkoUiE2F/3rJGxryEExhsxey8ajsU1vS 7Cr/QfeWeEqERmxCeCqphsa6CIXRnBG/xtIY92AD9N41JU1bV2gyDBDbCX2AJRat 4YfJaxr2Fa2Y6uTTb3NKRdX7Ofk6jbEr9VdC3HTfqyjuVxPbq5OT/P/QWpmA7hJp +zTmZKEAPr6dWhkPcEuGAInhtbQEIemDXR7sNOLhZ4scS3XBvkyVkoDwoBOfF2B1 8HCK4UOABI2ilExLmO5jol9QxEQjkDw9yyXphO2tZoFkuuqAQa3zw== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbegbg403-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:12 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnilm023639; Mon, 13 Jul 2026 11:55:12 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:12 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBt8XF40436034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:08 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 107802004B; Mon, 13 Jul 2026 11:55:08 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4605020040; Mon, 13 Jul 2026 11:55:06 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:06 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 05/20] nvme: add context annotations for nvme_ns_head::srcu Date: Mon, 13 Jul 2026 17:24:06 +0530 Message-ID: <20260713115444.465704-6-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Authority-Analysis: v=2.4 cv=fOcJG5ae c=1 sm=1 tr=0 ts=6a54d221 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=GpToc5QlgnibPQXIAUYA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX1e4i3cNsHAgL 1i1y6YYttne7DpN2Gtveti5vtGOSlN/SqldywRsh1etVyNyaM3Jz0jjj8blOhs2cYBBgIXgg0TL Af8hfxP1t+CIqzVnOLEx1+DxEijWJ83BDI6lIpWEc0g+C8T6630T5l6yafmapCWMRy74rvtg47D mOxIsoRz1y+4kunwoXCBYaUqHmQrQDnRUp35wpAIkWscP0hLajiigvt04KC93c1KYfHfjP4G/Ce 8O2kjq+x+uNzrqiBiKyHwni2RlE/7WQOkDqIz6j2L6pWLhWkVqOreBAxYe2YscNG+4ndrGNxSu2 CmTRv4UR4uPiiFxR1vcGmPOW3ohRzkbK7FZUb2psyPAMKBf9ANf+wV76DVqtsAvu/5tnDN4IVxk W7z2wt8B/CDjfmJZSE1qlJEV2iQWX7EPNgQT9vUJOqv8oukgC5yvywT8w9XDoR46wnvXzEe1i/Z htCLFDS5RjY/ybo3Rug== X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX5bcazKp0i+g2 gA8f3wWgXRDx9RZoJhuNss14Bp8m2cFchTNqWeVfNVVTozVsxoeRjr7wiFaWRxviBK5ADFiQTvM 1pSoHTWxNR2z6qQQiu2TqqqodTDVVP0= X-Proofpoint-GUID: 9h9neOdAzg5KahqyZgcpqIxHiS7EcUln X-Proofpoint-ORIG-GUID: FMfV-NW6_1eENQyajYXOE5M-EC8QBAC1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 impostorscore=0 suspectscore=0 adultscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Add Clang lock context annotations for helpers that operate under head->srcu read-side protection. The path selection helpers invoked by nvme_find_path() access SRCU- protected data through srcu_dereference() or list APIs which iterate through rcu protected list and therefore require the caller to hold head->srcu. Annotate these helpers and nvme_find_path() with __must_hold_shared(&head->srcu) so that Clang's lock context analysis can verify the SRCU locking requirements across the call chain. Also update nvme_ns_head_ctrl_ioctl() to use __releases_shared() to match the shared SRCU read-side lock acquired through srcu_read_lock(). Reviewed-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/ioctl.c | 2 +- drivers/nvme/host/multipath.c | 6 ++++++ drivers/nvme/host/nvme.h | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 664216eece4a..406e09a79c89 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -692,7 +692,7 @@ int nvme_ns_chr_uring_cmd_iopoll(struct io_uring_cmd *i= oucmd, static int nvme_ns_head_ctrl_ioctl(struct nvme_ns *ns, unsigned int cmd, void __user *argp, struct nvme_ns_head *head, int srcu_idx, bool open_for_write) - __releases(&head->srcu) + __releases_shared(&head->srcu) { struct nvme_ctrl *ctrl =3D ns->ctrl; int ret; diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 9b9a657fa330..fd2c2a5b1e33 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -306,6 +306,7 @@ static bool nvme_path_is_disabled(struct nvme_ns *ns) } =20 static struct nvme_ns *__nvme_find_path(struct nvme_ns_head *head, int nod= e) + __must_hold_shared(&head->srcu) { int found_distance =3D INT_MAX, fallback_distance =3D INT_MAX, distance; struct nvme_ns *found =3D NULL, *fallback =3D NULL, *ns; @@ -348,6 +349,7 @@ static struct nvme_ns *__nvme_find_path(struct nvme_ns_= head *head, int node) =20 static struct nvme_ns *nvme_next_ns(struct nvme_ns_head *head, struct nvme_ns *ns) + __must_hold_shared(&head->srcu) { ns =3D list_next_or_null_rcu(&head->list, &ns->siblings, struct nvme_ns, siblings); @@ -357,6 +359,7 @@ static struct nvme_ns *nvme_next_ns(struct nvme_ns_head= *head, } =20 static struct nvme_ns *nvme_round_robin_path(struct nvme_ns_head *head) + __must_hold_shared(&head->srcu) { struct nvme_ns *ns, *found =3D NULL; int node =3D numa_node_id(); @@ -405,6 +408,7 @@ static struct nvme_ns *nvme_round_robin_path(struct nvm= e_ns_head *head) } =20 static struct nvme_ns *nvme_queue_depth_path(struct nvme_ns_head *head) + __must_hold_shared(&head->srcu) { struct nvme_ns *best_opt =3D NULL, *best_nonopt =3D NULL, *ns; unsigned int min_depth_opt =3D UINT_MAX, min_depth_nonopt =3D UINT_MAX; @@ -448,6 +452,7 @@ static inline bool nvme_path_is_optimized(struct nvme_n= s *ns) } =20 static struct nvme_ns *nvme_numa_path(struct nvme_ns_head *head) + __must_hold_shared(&head->srcu) { int node =3D numa_node_id(); struct nvme_ns *ns; @@ -473,6 +478,7 @@ inline struct nvme_ns *nvme_find_path(struct nvme_ns_he= ad *head) } =20 static bool nvme_available_path(struct nvme_ns_head *head) + __must_hold_shared(&head->srcu) { struct nvme_ns *ns; =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index fba2d7674623..b7c3ba9c0fc1 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -1032,7 +1032,8 @@ extern const struct attribute_group *nvme_dev_attr_gr= oups[]; extern const struct block_device_operations nvme_bdev_ops; =20 void nvme_delete_ctrl_sync(struct nvme_ctrl *ctrl); -struct nvme_ns *nvme_find_path(struct nvme_ns_head *head); +struct nvme_ns *nvme_find_path(struct nvme_ns_head *head) + __must_hold_shared(&head->srcu); #ifdef CONFIG_NVME_MULTIPATH static inline bool nvme_ctrl_use_ana(struct nvme_ctrl *ctrl) { --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C8AD3F823B for ; Mon, 13 Jul 2026 11:55:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943730; cv=none; b=Yuca5Xmuj9BwIl+RPnRFpcdEilt64OMZ/bLy0mdPZsaH564wr0sL5w9/Nh6JYR2Ghot8PiX6k0zoNVRXCLz47J/IYjOWulZ7mVoLS+omHguc26HkorLVtX5qkzY+rYBtjUV1bkGeYXT2L0jWgb+/Le2yKvhvvqaVYNz/Zr/wL00= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943730; c=relaxed/simple; bh=pg6ZN5v2hNcacRM7O4kzFz8MDxzEaP7fvp+OoMGq8BE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WJKxbqi6qXr9bRJIL6VKuDBY0FnB813gDaMbNwVEHWex11Qifs1I4c81bD+V6BaukAWI0uHS4DTwfnR/eCoS6gPeEFuHFjlGSnCI01vO/wSjX23HPNMALrL8sT4j2jqMjSw4j8BfzbMuml+9T2DzNs2kktUNUmt3jFsAimyNbG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=P+fEsukS; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="P+fEsukS" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D7vG2d006621; Mon, 13 Jul 2026 11:55:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=4XHor9izBOOlUDLjo Ndz/TnnxIkQ3jXlqq+bxvGr4rY=; b=P+fEsukSOZuzV47EWn/iT8GrziJDh5OJ1 Pxr3J0READQnSPf+EJxNs95MpOnZPReppOpAJIiu/FeyWbjxVgcvZeasMtQtUCT1 xoIz1FC7bs2KvJQQRe813FUdmGI73hzXQ4UplzDtnjMSICN3yvGRnRZYmznnanZ8 61Uon7UypkCM+F+9W98A515JhETAb2KduiR1/JN4u/pyO57iz+U8evUrzgr3Li3z KUJeSurgNlVD1IHuZ+dRDVrSdKG0vmYN3d/hLxxZKdGdhUnrtsxsjqLYRJaAtYg2 Hofv6D/TIEEiVK8VqbU2B8TP0iQRbkc2aWp40vPwY8vMiNvwLdA9A== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fcv330xwv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:14 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnafc006899; Mon, 13 Jul 2026 11:55:13 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fc05pwnwc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:13 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtAWl59703564 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:10 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 312F32004B; Mon, 13 Jul 2026 11:55:10 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56D8F20040; Mon, 13 Jul 2026 11:55:08 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:08 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 06/20] nvme: remove redundant initialization of nvme_ns_head::requeue_list Date: Mon, 13 Jul 2026 17:24:07 +0530 Message-ID: <20260713115444.465704-7-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX1mML+Tjfq3dz rx4/1thipcypaXZUtaOqs41T0MEKKgyU2kMn9HII/QNqtZ2zycQ6YMzeFp00Df10fTJylf8D523 6OfPmNfds4hK1wQGkAtyWqm2CTLuseE= X-Authority-Analysis: v=2.4 cv=Mp1iLWae c=1 sm=1 tr=0 ts=6a54d223 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=f4kkqRrmUjAs7RFRYyoA:9 X-Proofpoint-GUID: eBMgaTt6QXbHzmHZu3KLeyNOYoArPYcy X-Proofpoint-ORIG-GUID: atZms1Efk_FHcqYkI53EyofSvEMN1MWG X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX226aIKlRUPpo GjKrLdsxN4Ip9XfH6vOYHy6V75zYnotIcorQ0IXuSkXwIZnpXz1Xpl+SPWTS4jPCupZIXXMZA3R KdMiEAwbvOhBswLDA7zVrvRoUgypBOn78PlEDRyQNrMXSdBNyjISpRu4mBw/GsOrYKGgmREewIZ GdMyEdos1XOIrEd39inQ3auAyoQZBZ5t2PEtFdROms6CGWbzSiFeA55PaQLGJdA/u0lOdoJfK+B zhVfo3RqPfqDjjC6NBbodY0pLAflWMhGHrRuIFI8uxtyVK5Ta/vvo8YJj8+7TN8XqXzQ+s2j8tB zL/1JH6p+sSX8HcCGBsFm1KhrFd9TqJCoXwwVRqmhtEiGLWVdqoTd4IbN0XrP3mE6iDeySr8eBj Qsrtys3jK90PoY41odtKCukUK7+GcWbewUZQgnTujK1p+zr/qVCtw77OiEcv3slBiQWuuPCiWZa GF20u4PL0+jIyg+xtYw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" bio_list_init() is a no-op for zero-initialized objects. Remove the redundant initialization of nvme_ns_head::requeue_list from nvme_mpath_alloc_disk(). Besides simplifying the code, this also avoids a false positive from Clang's context analysis once nvme_ns_head::requeue_list is annotated with __guarded_by(&requeue_lock). Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/multipath.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index fd2c2a5b1e33..282cd8abd0b7 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -734,7 +734,6 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struc= t nvme_ns_head *head) struct queue_limits lim; =20 mutex_init(&head->lock); - bio_list_init(&head->requeue_list); spin_lock_init(&head->requeue_lock); INIT_WORK(&head->requeue_work, nvme_requeue_work); INIT_WORK(&head->partition_scan_work, nvme_partition_scan_work); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EB6E3F825F for ; Mon, 13 Jul 2026 11:55:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943731; cv=none; b=YTasGQux+QgaH8aKSAsx0oVAc332vsAI56Gyxwi1bfRcM6AX/qOK/uxHVC5CRYFOBEn5NKPg8K0BPhFBR1l9IrXdRDE9US5IDqeA2O7p8LUArcAGaLhDxVP2XT8gMg2Ip9piEdS611ULFVYzhbF8y2nfvxBAczPZfDQTOC/70+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943731; c=relaxed/simple; bh=vPj5DXwfzYXzz7+W1qazCkWuiIJF8mD3gyLXDvSVfio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NXSEVpf88O5wwEH9qsbVSyRe/o6cvdWbcLFhAtzDpjc+2TnNdzSa9FXoK+KdN6pLDTg9WmGA5AqYnjs7GL9V+LcZLJTwigyyF/ZDT5Jnv7sTjg/t7wqRH8fAiC3uZm/aIFByT0D7rZiBcYj63hNS1rz76yNwdIWda/nYJmUL/Gs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=SckQrmmp; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="SckQrmmp" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6gD2d1672711; Mon, 13 Jul 2026 11:55:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=2K9f9UMC288rNpZom qQoWokjlEBATFSb6ee88bjWywA=; b=SckQrmmpEGt4q3XpechK/HTfBvtvGEcdv 6Vn2ChUg7RsbKmPbP0HNkvsjaTfyHIjEaXQcoBzFdsIM8zaV4dhqkKOSx3qVB+z/ uNmE0pOD6egk9+WiDvB+HysgT1a2KM7TUU+M6h98DAx7Xo3bMr5O+U7lTKELdvM8 LbSZVMMt2g+6qhQzJE3NnrgKwIX7eCqYVT/vGanVUhpAGSW9AnWnBgDDWW2kmXE9 BLnAFH6iJkjHFMePXW9Z+MUmxX7sYwOl0DMzoLnfxPMm1lT2x77uPRIW1YfEZMCq Sjj+xUcbZWb1yyZuEKgshiYiAEMCWQRSv8rZSUjVrkmAVBBbCNw/g== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbf2a01w9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:17 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnlCa023653; Mon, 13 Jul 2026 11:55:16 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cw2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:16 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtCth18350540 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:12 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4B0DD2004B; Mon, 13 Jul 2026 11:55:12 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7817E20040; Mon, 13 Jul 2026 11:55:10 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:10 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 07/20] nvme: add context annotations for nvme_ns_head::requeue_list Date: Mon, 13 Jul 2026 17:24:08 +0530 Message-ID: <20260713115444.465704-8-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX17K9QyqB896N DKdM0UZ0CiSEkJPaz7B+JN+zUmtRJwrqtaPlS/N6kFKLTKU/BZesWuKEd6n+3PEPj0/BX9B8T+H oswuUzy/UR5Xz/XbAy0cZMqGVpd556Y= X-Proofpoint-GUID: FqlIQZcrEEr67HKGM1SSgmrAxGWucDPx X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX3V462lhtP5Fq R/D3qWMX5xWEiHtJeufOS8ynux8/dANWzNNqg5DY2lA7UaHinJDaDunc33CYkQJIxNzlUoIbJBA MZcq42DE0jrB8GUsmCUKMWXgoB1aBagSRsOHLQWpBSwgP/4yneAvVWS0WkP/uQqFoeX0YyDXktc 8VqKKiOzj6bZ6cMGpwCa/a/TWdsjqkwT/i4tvnTtvFi+/fJ5dsixcJ+02fJW1ZG48Eokm70rROq U1yzLfwUx/mpdKWFxFt7eEsxw5wMfpKLlkBUoPjHzr2tNRoZuuPEs/NizL53VUqfjU6XgQ8smia xc5Aff49y4rkR7kos4PTP5qcIUXFEIE0B+wY6saY3JZdcdfhXR5qwj1nAvX9bLRrOrsPueQ2Qnq KSXRXQOoC4waJD8xSTFUxIs/VrVejNoQ4B+S3+v7A3+7jv4WJcFPhN+zLE+/G6e55oRZpNcYjL6 D8uFeU21E7j/5lDQrRw== X-Proofpoint-ORIG-GUID: nsI4EP-qNr3rEPcJvhwneWO3LccdaRzV X-Authority-Analysis: v=2.4 cv=PvajqQM3 c=1 sm=1 tr=0 ts=6a54d225 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=nWZzvH9bQxjurKPVp9IA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" nvme_ns_head::requeue_list is protected by nvme_ns_head::requeue_lock. Annotate requeue_list with __guarded_by(&requeue_lock) so that Clang's context analysis can validate accesses to the list. Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/nvme.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index b7c3ba9c0fc1..5e746ae1c805 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -561,7 +561,8 @@ struct nvme_ns_head { u16 nr_plids; u16 *plids; #ifdef CONFIG_NVME_MULTIPATH - struct bio_list requeue_list; + struct bio_list requeue_list + __guarded_by(&requeue_lock); spinlock_t requeue_lock; struct work_struct requeue_work; struct work_struct partition_scan_work; --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 495653F8EDB for ; Mon, 13 Jul 2026 11:55:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943733; cv=none; b=GNCM/mbmW5FFxvgGH8KQ8esTiiY2mtbZ7vuWFNbH/qDhd8px42s0BLeSD0++g9yNy1hNYyykiMYvLJYvG384BzVcK7OS1klmBtmQjijGLlvc7aFkPYVmCWDOE0XQf3wnJJA0zDkGwQi3fnrfHYOGwVzTdq8d7UFh01AYIIT6TF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943733; c=relaxed/simple; bh=0/rU4ny3yUsN9SpaeAQEMkowqdMsQR6OPb6QAQydasw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZVuWCrQZ5h20Mx57MHus9IyNFYj45rjcW4FsE6uBfcNTI9paAs18uxFmkzKlP20myAvlVyOBa+0W3fXe7Bns2poo8nUc1ID5c06pWFkDHVct7OVd1p7I1TAyUS+qgRDfHDkErMFNZspECfQFJ5icp5B1JNmEXjI9/x0cuDI/gnQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=mMM5iOSm; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="mMM5iOSm" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D7vBPs006476; Mon, 13 Jul 2026 11:55:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=1i6d4hwoRxvcYPiwC zCA3z0Yi8e/soMW87XruELS66U=; b=mMM5iOSmSmYbDs5JRzpJYjgBop+Arnluy uydUhYckWQLmUY/UxR+xICjQNBX7PHcPbDGSh3I2bLM7RpZZdQN+pxlSfnZm3RO9 CT2CFWLftZMuAOSa3aDHIjiZI8nEI5N6SlaTCpTsXuNjGGA9Piy/UfIemw7ho5lE aCLyOLo301+Hb19Tr5mZvNs7kdWv3btNyXD4jVA/wr1GnDhxe1d3qn4xCsbXEDED 3mJ44H8f+Jv1uCMttgk4xJftwd8hdVfChUIEqzQx8agJaEYbuTua4ToorvY9DsM5 nG3xwAgxOSDZ1I8dfTBwwkn1ZKkXKSTPr3IN03uF1sDYCS2HLUk5A== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fcv330xx8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:19 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnfGB027150; Mon, 13 Jul 2026 11:55:18 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc15jnfuq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:18 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtEBE12255522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:14 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 885992004B; Mon, 13 Jul 2026 11:55:14 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9234120040; Mon, 13 Jul 2026 11:55:12 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:12 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff , "Paul E. McKenney" Subject: [PATCH v4 08/20] nvme: add context annotations for nvme_ns_head::current_path Date: Mon, 13 Jul 2026 17:24:09 +0530 Message-ID: <20260713115444.465704-9-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX5pHx9v+YSYBW 8mi6QrH6XQuBan6VrCG5/Z+ocSIrrPb2mpuCyrwhOYul2M+Oo9rq+7uqpDb33aINEjwrpdhThRX OWWbHRGJGyy2KFnzLZ9qn7j91H3Eq1Q= X-Authority-Analysis: v=2.4 cv=Mp1iLWae c=1 sm=1 tr=0 ts=6a54d228 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=TuOugfuq9IBefrGnjZgA:9 X-Proofpoint-GUID: b6Pv_6aCkUt1aotHgJsq2mTnhc-MObW8 X-Proofpoint-ORIG-GUID: GwU0V2HzGffqwxunjWRkN7NWF9NDKbv8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX79O3jrPX9gl4 iXzGHFW7G+Qvrx23WfiVsE5Cq0fmjO6R4x1lG/c4RTNWVOvaomoloaBDW7mK/pajiXLh/Ng9IeZ eJw4J9oC3Ln0/L1eWyj9py0x1t9ZUbRJ/H742CGtCrWyRzNEDtIfcA1huj3q7NVXriD5aPcRyh4 hErSQeHDMj9g5RLgbdzNPs0L+uwPKjjfHv+wK1gy7Art1y0QAjb0PHdOYmmcqxk2UfYE8nbIFzX 2HXczkBbrZQYTU0vZFMouHFbF0n93v2S7aTLPeJYgw45XMm69KgzcgWFvhPI7QLDKe2X+4TQd9Z tbwqkA/6fp7TgS3ojDpcshFD2pe91viGzmIK5HB8uaexvAtcotpvEa04gljWPMGBvD2pCi5LORe pZMj168yejsZuuC3IG3wFYmUW/Btc9lknbRcnBsu30GVQ9oWTIN7f97vQ+Yr/OwQo0tYIwijH3R QifDnbJX7BnYdZJnaIg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Annotate nvme_ns_head::current_path[] with __rcu_guarded so that Clang's context analysis can validate accesses to the SRCU/RCU protected pointer. Cc: Paul E. McKenney Reviewed-by: Paul E. McKenney Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/nvme.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 5e746ae1c805..610c685e2263 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -575,7 +575,7 @@ struct nvme_ns_head { #define NVME_NSHEAD_DISK_LIVE 0 #define NVME_NSHEAD_QUEUE_IF_NO_PATH 1 #define NVME_NSHEAD_CDEV_LIVE 2 - struct nvme_ns __rcu *current_path[]; + struct nvme_ns __rcu_guarded *current_path[]; #endif }; =20 --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECBEC3F65E7 for ; Mon, 13 Jul 2026 11:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943737; cv=none; b=IXd+OErAA/lD4cJIGjZprF5WCTdTNLrDavY/N3svvq5s5Xqcu4OnInpu9AES9hApaDLMCmx5OqsAYkFp8Fl6JMGkyuQKKJVNXsxUHzyo7/bTHQnuijxoD+ri3VXbDcYqdHN1nulLxgAtkFblFvWgiBPzMqqidVB0be7UdCTOYEQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943737; c=relaxed/simple; bh=nnMyAitwlMPfSa1KgE5WB1T8ODSsAVUA3xaECxi//Mc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZKicSj7Z+Xyyy8uIthNdlCayyDB/QoSaAEukRIhgjKlX7YUilEnHf2Ktxi3exqtUfPPf0YVNzsA6yVmKrvJSHljNEp9EkIHXm7II7JXmhtGTYL/vjRb8SuDclQDzf1M7vh1B2F4NSznVr4r0imdTrKtyMtAevtldiz+z39gu7eU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Dyc8sZRy; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Dyc8sZRy" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6g1Me1668752; Mon, 13 Jul 2026 11:55:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=EQ/135VJVeLMIERaY ABh/o2+dfGg4dSPAPpzTXu39NQ=; b=Dyc8sZRyjagT6lzYgSW+mLAnF6oCrHNGY 6w90WWH/TesZ0nAJVEI4DLBureVAjNyM24IJEW4eC7BYVE02xXItosLU62fTTn0c ZuddgmdFZ1f7N6KsfLmV7QQL0AH7KiT8AeyIb9DZkmS0VBqcHkifF6i0uOYiW2sl PJWz1MF3pEQRjie/xWoGuBCA0lGGxKkQzBsplo6j03uDpNCSi41PNGt0eTccqrgP 3/PaQlV4iSrYKWR40uSBisIq0Rc1JfrsYgyO51IiWbv8z03Jl0LRTvrhDCEbFQKi K44VxmYNwABrFZChoSiW4bIfFJ8AdYV5g9JjX/ws/r5U3dTrAAcDQ== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbexwg1v6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:21 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBne8U023628; Mon, 13 Jul 2026 11:55:20 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cwa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:20 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtGtw53084494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:16 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C13942004B; Mon, 13 Jul 2026 11:55:16 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D360820040; Mon, 13 Jul 2026 11:55:14 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:14 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 09/20] nvme: add context annotations for nvme_dev::shutdown_lock Date: Mon, 13 Jul 2026 17:24:10 +0530 Message-ID: <20260713115444.465704-10-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: -bDJKtEYH7jhlvQoOvVR9afX5Ovy0TU6 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX6rY1xGePzThg dWTcW2RkQHN89nx9zkzc/TFqG0mOjDExfCaAeaIMgJ4NKQx2u50D+jvMvFQlpFxvQyTS0Sjm3Bs 0l9JlX6s6gz1tSxTV0lcaGEVii2vchcS0dvM1sgXliJe9/i7Dh35s4gzGw2Ox6Hqhd5g6zPCREO +0j4WPKN8HMIBQNdTLFwXAccPV6U8SWM5z9PwuW8X5Xn6K+1nwoBFZ9/wISsQoEyCo3EBmC6rIA 1l3dPrXxkFw5W5SgSXULhq0V1ommMOzgl0DjkU1tzgrf814a7QKpGMJogsbHRiaFZHYbcedEiTn /1WRdhv81Y9PBQm7Br1gCrLLk6NMf2deqlnw++V5gLp3W4AAn6aCQ2wW22g6xxOwloLqknqudL+ q+mS8xuBb/bb9wH/1NreVNdyeK/BODqi/soV0vozImdOYfJl/zPHhYPPv4U07Z+EoW5KSvgtbnW 2N671hItcHt9OOje/XQ== X-Authority-Analysis: v=2.4 cv=XJoAjwhE c=1 sm=1 tr=0 ts=6a54d229 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=lhRNW2dt6MhivXYX8oYA:9 X-Proofpoint-ORIG-GUID: 6TE3Oq3gb6sx4VSQJ4AceaN3kVA6jf12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXzqoiGb2xp89K HDjnYxlRP/QnXdyJ8UrqZ0BCaWsX/5jb1y1BsXUcA4VhX002upLpZGW2LgCb729sgeOdSce5s0C Ma5Tk20nrzeuzDzIiTWJgmcO+7SX8Io= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" nvme_setup_io_queues_trylock() conditionally acquires dev->shutdown_lock using mutex_trylock(). The function returns 0 when the lock is successfully acquired and a negative error code otherwise. Annotate the function with __cond_acquires(0, &dev->shutdown_lock) so that Clang's lock context analysis can track the lock state based on the return value and verify correct lock usage at call sites. Reviewed-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 69932d640b53..7954417d1252 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2199,6 +2199,7 @@ static void nvme_init_queue(struct nvme_queue *nvmeq,= u16 qid) * Try getting shutdown_lock while setting up IO queues. */ static int nvme_setup_io_queues_trylock(struct nvme_dev *dev) + __cond_acquires(0, &dev->shutdown_lock) { /* * Give up if the lock is being held by nvme_dev_disable. --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 543B73F4DEB for ; Mon, 13 Jul 2026 11:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943736; cv=none; b=E6mFJHVp8osNZ6seAIQ2FkgkGYCJPiO53cZ8FwxD5AnRtpHR5hluOgyjHniXfI+q1c0EIMJJxpDhLdAFpiN+IqvOmK4196OtdjMVw2W56GETozzAfV2MksQ9TSUnwDoUIFG5EGyx4sQJ6n9rpKyfgs0hYO6uq674gSuBo+aGkoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943736; c=relaxed/simple; bh=7vyyFzFsatS/xtl0l8/nQoIFJr1fJcFTr6EQ2ahfrV0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sxZlmVj4l+teIOza9uvyklCEz3gblUpaG4JCKSM4HVyVIgMoRkTAT/ajHTMNwwRcOOatPPTCPza18lnoj8XmWdBDzxU0zbUqAQSy9SArfN6zJEB++CmC11P6irUCvsk5oGWI/xyD8oTuiH6chC8n2GBhM6qAjUZv749blAWR21s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=keLa06CZ; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="keLa06CZ" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6gD2e1672711; Mon, 13 Jul 2026 11:55:24 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=prWyQO7az6EdCikSb m7PyvCS6DCv1GEBSeh5RqzSMGw=; b=keLa06CZCXV73bWxpadEPldWZZfXChaGD fyG9zyyUOwGxCDM3VJ4bo0bgs0ApsZrD1PJOVtF0KP1fg4V0yaGb8JcnEv/ovUXl aw1/+DdLGS+PFQ9aslW6TDX0DOco6u2XiVoz/AhgsK2/Lbvpsw5YcIIV0adOd/7a 0zxJdpURDI5f4/mOt2eE7d8ZKq1JfxlxvpGCrHbSSzXMex8swsC4JzimpfC9J05x GyJI46t90jwKAywVpduC1ASi57m79+AXH1v2Q7BxcJPzyEbs2sR1AIg2uWRHKEUS v7r+7AM3Q7RPcLuAHLJXClQg+A4xOgSBdzIrHoZQimUH+MRIIbT5Q== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbf2a01wm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:23 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnc37012359; Mon, 13 Jul 2026 11:55:23 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc0hvwk5g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:22 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtIeY56820060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:19 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DC9372004B; Mon, 13 Jul 2026 11:55:18 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 143C020040; Mon, 13 Jul 2026 11:55:17 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:16 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 10/20] nvme: remove redundant initialization of delayed_removal_secs Date: Mon, 13 Jul 2026 17:24:11 +0530 Message-ID: <20260713115444.465704-11-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX4EOzd6A2jAs7 jeZ3HG04MYU4w9Uqeyz7VVt0ZtQ+a3TVngviN5AfvOQPLrabocotKBIjPV3iyujZe6tJMrIw7pc AV+Np22LmoeqqyvKyP6+63WDPbPqQ24= X-Proofpoint-GUID: toPQ4cB3a5E-m2TSjqKF5Oyw3iaKtHiY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXwHDggB8ALPbR 7D4V8+tFkUm0chGzLsr0fcQN1kRbbHx0EYx7lidmH4TeZNfPhvf8hpRHXzG65woxeR8I2LnIjws YK84wQc4hBheADvppz6567kUUuSktrlAvzF+O07U8p22ktBoDmGYYE/j/yJ86+GAhfxWuMOiEoh weFLk03g7Giqo3LkQXNlQ2Sx0o+Sv4HljRLEUw8cL8NTJmubxyPBhVmnUKlA80bKu/oQuXhNRqU br2L+OCndsg5aconSKHxEyicSNWOEdDRp3i08MXGADqBn1HYeACN3oj/g64mtxG3fqOa+FhArB4 PTPWZpadxkVnja3/oBh0D3a7oFtW3wRoABWFHKn37QCaMVom4xaWeKnP1PrUycFGmiz3/LzIU31 G1FK3Im0u7C/p5UO+K8ZopHQXtr2vz4qfnUP9n0M6TSaM+UwZoSIaAJfdnpMnxMU79KcZMVnA1X WlTk1cBBZMN279xRYWA== X-Proofpoint-ORIG-GUID: kgCZpnVN6fTjgFia82pTRKiHv4kHvxJs X-Authority-Analysis: v=2.4 cv=PvajqQM3 c=1 sm=1 tr=0 ts=6a54d22c cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=ZXaoojwfDXdfg_wq30kA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" nvme_ns_head is allocated with kzalloc(), so explicitly initializing nvme_ns_head::delayed_removal_secs to 0 in nvme_mpath_alloc_disk() is redundant. Removing the redundant initialization also avoids a false positive from Clang's context analysis once nvme_ns_head::delayed_removal_secs is annotated with __guarded_by(nvme_subsystem::lock). Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/multipath.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 282cd8abd0b7..698d79a97045 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -738,7 +738,6 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struc= t nvme_ns_head *head) INIT_WORK(&head->requeue_work, nvme_requeue_work); INIT_WORK(&head->partition_scan_work, nvme_partition_scan_work); INIT_DELAYED_WORK(&head->remove_work, nvme_remove_head_work); - head->delayed_removal_secs =3D 0; =20 /* * If "multipath_always_on" is enabled, a multipath node is added --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C4823F4DEB for ; Mon, 13 Jul 2026 11:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943799; cv=none; b=Uq+HOuh4EHeHLR5mKWaPZAoMelKKlikti/36NzOE3YLf2w/1gMZpaz3b5oHjBpvDR049UHc+kltFpJjKYVqOiGfcG2dWEq41E1sr3bhwvxzqu3oIIO8tMyMx64DDAV9IgGvJ+e1e/azz74jKfaz87mY/39y37Ddx33TrW8scgHM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943799; c=relaxed/simple; bh=N20axemvhPVoSV5p/2U+BzLE+FLOXUz+hrfpndsm1MU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bsv+766X2ctx0dvRlE3tviNnZzL5lXuIU32rBul/op0KyI341fS9BdzUNAmpcqfTiUq1lzeE+4PjYRXjDKABbTZrScqbkJ9ykeBIfyyJgahkk0b9HR2kZqG61ilvFgERUn4vHHJ16Ufgfj4ohAX8I5snH39Xav1erKciD3eVrn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rau18VnY; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rau18VnY" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6fjFf1740312; Mon, 13 Jul 2026 11:55:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=10KeGQhgQdm8EqX8o Hgi30BrTmqbiEtfTzFxYq7imyk=; b=rau18VnYMgJTue2UBJU7X7S30Fu8AkZIz B3BEvbnEJjhMrZYm4mXHq+X1ZB6W+YcKU8Wf10xN3Mu7Hgyh/MQR/v625vKz8C5M LEFy2iWlGnk45vvuf44LHxDnCqSb59gIk/BEjpEE+ZskA0O5zn7sW9M35VqhBipG jXaALZAJipf0lSkpCObgiJj2P6WCZ8m7I/g/XbTJ4cLnmh22YUy5H4jjpmxlT8b2 Su7KsS9A6a9x09H/MuJFqAaZzW3TIRSsMb9xa89MVxohVSQ8rK//3hF+CVm0loQH HBAub3bfXsx6P1xkTnRPkoRNMrTaMEWbm4fv0NbDlBGvuvnuPGfmw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbegt0fb9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:26 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBncFL012349; Mon, 13 Jul 2026 11:55:25 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc0hvwk5m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:25 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtLAW16646450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:21 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFDBA2004B; Mon, 13 Jul 2026 11:55:20 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2F0CD20040; Mon, 13 Jul 2026 11:55:19 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:19 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 11/20] nvme: add context annotations for nvme_subsystem::lock Date: Mon, 13 Jul 2026 17:24:12 +0530 Message-ID: <20260713115444.465704-12-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: W5VfR1l2pUHL2LTFnzNpw29C-LnStUlr X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX8s9dhfk3JbLt mUGCL4sQPkLJi96ERz7KO6Xf1rwP2lmnOh6TNdlleobBap5p5+KWbA4AKfVXZ+z7NYB1AWK4gIl mQMrmttBBNrrhIa51Vq+ojAR9yvmatw= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX3XSzda/6q14M Q+MSUYZYb+sMKjvEvlGMHJdb1mPX64MVgZ9yWiYAGHHGGQnn08IBB4++tMAeJv5DOktfKJEFNhy clvH2AVyeS9ynXL0QcgCN9NeKKs4xJ+Kxa0m0zDAqUyA71k/taEjAUo47/o6GSuklFYbyOt/bw2 JmBNU/qeCkhOLV25r63GK6tisXcQhjn0KbXNfBnJZFuownbjFBDYJj59H8KlivuDDYph1yS+R3t nSl3EyhGHkrpC2uMnvL1iujif0Dfrw6VOSXquMqlOX2h9NPzOmWPWzUqFbjQh4TAPbk0/faw981 mGowgZ3IAUoW0QIrgksXoXLwmjF51vJI9Vo3X9epZYYLF3rh4ypx4qK5nZA05CN6L5yU11I65z6 yAUYR9i9A2BjAsXz2ARorDMqIPAWJ+OfMcxyKSb1ypgIIrPcm320OVSGf/o1hjqoBR/FqqCG/o6 BRO4mXHGoHmNJ7UQYwg== X-Authority-Analysis: v=2.4 cv=IqMutr/g c=1 sm=1 tr=0 ts=6a54d22e cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=8XytNyI1XRNVYq53IcYA:9 X-Proofpoint-GUID: Snb85HC2S5zro0m81QXsFEEYiB3HilX- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Several helpers access or traverse data structures protected by nvme_subsystem::lock and therefore require callers to hold the lock. Annotate nvme_mpath_unfreeze(), nvme_mpath_wait_freeze(), nvme_mpath_start_freeze(), nvme_find_ns_head(), nvme_alloc_ns_head() and nvme_subsys_check_duplicate_ids() with __must_hold(&subsys->lock) so that Clang's lock context analysis can validate the locking requirements at compile time. Also annotate nvme_subsystem::nsheads and nvme_ns_head::delayed_removal_secs with __guarded_by(&subsys->lock), as both are protected by the subsystem lock. Annotate nvme_init_subsystem() with __context_unsafe(), as it initializes these lock-protected members before the object is published, suppressing a false positive from Clang's context analysis. Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/core.c | 4 ++++ drivers/nvme/host/nvme.h | 15 ++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d6a095e1e44e..f7a4cdb988f1 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3274,6 +3274,7 @@ static bool nvme_validate_cntlid(struct nvme_subsyste= m *subsys, } =20 static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl= *id) + __context_unsafe(/* initialize unpublished/lock-guarded variables */) { struct nvme_subsystem *subsys, *found; int ret; @@ -3845,6 +3846,7 @@ static const struct file_operations nvme_dev_fops =3D= { =20 static struct nvme_ns_head *nvme_find_ns_head(struct nvme_ctrl *ctrl, unsigned nsid) + __must_hold(&ctrl->subsys->lock) { struct nvme_ns_head *h; =20 @@ -3867,6 +3869,7 @@ static struct nvme_ns_head *nvme_find_ns_head(struct = nvme_ctrl *ctrl, =20 static int nvme_subsys_check_duplicate_ids(struct nvme_subsystem *subsys, struct nvme_ns_ids *ids) + __must_hold(&subsys->lock) { bool has_uuid =3D !uuid_is_null(&ids->uuid); bool has_nguid =3D memchr_inv(ids->nguid, 0, sizeof(ids->nguid)); @@ -3968,6 +3971,7 @@ static void nvme_add_ns_cdev(struct nvme_ns *ns) =20 static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl, struct nvme_ns_info *info) + __must_hold(&ctrl->subsys->lock) { struct nvme_ns_head *head; size_t size =3D sizeof(*head); diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 610c685e2263..602d567f3def 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -496,7 +496,8 @@ struct nvme_subsystem { struct list_head entry; struct mutex lock; struct list_head ctrls; - struct list_head nsheads; + struct list_head nsheads + __guarded_by(&lock); char subnqn[NVMF_NQN_SIZE]; char serial[20]; char model[40]; @@ -569,7 +570,8 @@ struct nvme_ns_head { struct mutex lock; unsigned long flags; struct delayed_work remove_work; - unsigned int delayed_removal_secs; + unsigned int delayed_removal_secs + __guarded_by(&subsys->lock); atomic_long_t io_requeue_no_usable_path_count; atomic_long_t io_fail_no_available_path_count; #define NVME_NSHEAD_DISK_LIVE 0 @@ -1041,9 +1043,12 @@ static inline bool nvme_ctrl_use_ana(struct nvme_ctr= l *ctrl) return ctrl->ana_log_buf !=3D NULL; } =20 -void nvme_mpath_unfreeze(struct nvme_subsystem *subsys); -void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys); -void nvme_mpath_start_freeze(struct nvme_subsystem *subsys); +void nvme_mpath_unfreeze(struct nvme_subsystem *subsys) + __must_hold(&subsys->lock); +void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) + __must_hold(&subsys->lock); +void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) + __must_hold(&subsys->lock); void nvme_mpath_default_iopolicy(struct nvme_subsystem *subsys); void nvme_failover_req(struct request *req); void nvme_kick_requeue_lists(struct nvme_ctrl *ctrl); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31C883F54A7 for ; Mon, 13 Jul 2026 11:56:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943800; cv=none; b=LNU6MQJou/cyp+mJqQFwUdRoPFNDq3LTjgLnWvQN2tzGwmzTFVCZQfrnnlC45QeB6gqRcVfgcpA+JkGrYdV4rzQME6MaenpxDE01qBQvIhrBNzIt7mshwkdvnMKaytiC7G15Lw/v+b5zNVEkAyCz6IHNpRyyQ2lpqwaUmKXX3K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943800; c=relaxed/simple; bh=eFj9jWyS8+DbcpEsaBDMHcWa2T+61b015ORSU21s0UY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qxCnkHuQcV7jOcUALMq5NizgmDgtWUlHxvHdnC+3lJIlYC4BU6Xfjy6nXKOSOFbVgR05Jkah1ncPWCThiiDCQncZ/Qa+Gp0k2ZsbRWtTdxcBHyC+o8UOXYzHZhaxELe5QDqX7GrmH4x1TS24CsS53TipO0nj9YaQ33TWMBxVkXo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=RfNjB1bP; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="RfNjB1bP" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6g5Ce1672536; Mon, 13 Jul 2026 11:55:28 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=bKxboCO9RJDnoe1/2 +byHzuPFK5h7lZPoqfHSK6jzS8=; b=RfNjB1bPG1XOEvBZ/g8ipfl28DAxfPiV5 OjMUMmiRnMwQYDKocnRqJIPEjaqXaMXDpgWEMaXdAfRc6Pj7nVXQkKQ/IW+g7uJl B3BPlbZGfAQpt33BIswVACp5PF4VxZStkzyyb5x8Iqh4an9WINTHxVocs9dnHHA7 lKBU1S0MdA/o8Ux+lTGXhLlH18PbLVX+anw/Q0CeJVE2Dz0wx0Vln9ydzPRBTvr9 nKL2Dz6PFmZbMM/IrjwfOHoDu/02EcNNbBEd5Nl2xTPZmFcKj3ptpQP6CSuutZPB kNhSmmUFmSHUR24xSYiX5CYdpDN6485R6ii7omXXtYJoPFriSrhKQ== Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbf2a01ww-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:27 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnhsE001929; Mon, 13 Jul 2026 11:55:26 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fc2cg58pq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:26 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtNE638404484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:23 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 149DB2004E; Mon, 13 Jul 2026 11:55:23 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 42A0A20040; Mon, 13 Jul 2026 11:55:21 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:21 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 12/20] nvme: add context annotations for nvme_ctrl::ana_lock Date: Mon, 13 Jul 2026 17:24:13 +0530 Message-ID: <20260713115444.465704-13-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX1EqSEstlvkYI eKs+PBb/P0qfWZPzlWd0MoP0xthtRBHQE8gA0DjY5a+R+oOZlRwSJPN6mD/EWijRdcxmG5I9Rjf fSeST17xq65AHoCxzU8yEMdLYB+y8qw= X-Proofpoint-GUID: 2l4JzMV2DhZm3KVCEszizGQVAFYy3dGX X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX6ZApbsauEarA B2tO0AYbpefW5lguAW+vcwD+IhybUIDtHOGjWXuaaP1Ey85CVZtvF486dqy3oJgjjiu37VOcYmZ RV/yxSB7FjwMd5D2xFuV3XgQF4yPinjspJ313QPzGOMof2fxUgRlAKO8wbJ1C371wQTvMoTurWB ttFLshXO/QtIhL2H9+FzWbCEZg83swsKP23TRS56WWlRwuljaV2e6X7xN13wkn5dPcN/R1rOSoA ApY45GmOPyFPLImJ6fhiaKtrMB9z3kdS92NQjc9kUSkofeJKYvS/xzVNkLFB6ws7kGvnHdc0JYI oZRNd9IwJX07lHq1hqUabQIUytM1NWNaB5kugSuhbUS6ZybcNKeO41131uRbneqIIBhzylONHDm KEyiyQtC4rynLF4cVnx4mHlxHUVeYaUC4elng+eYeZnGcJVR2sKF5bC2cK1Dg+gOzURCU3jpnPN T5TwcIO9754j7NmonYQ== X-Proofpoint-ORIG-GUID: w_2gv5lushqVimUQlyRFebiIB_fiu3uZ X-Authority-Analysis: v=2.4 cv=PvajqQM3 c=1 sm=1 tr=0 ts=6a54d230 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=dKw57NzDpq4Cn0Z9zg4A:9 a=ZXulRonScM0A:10 a=zZCYzV9kfG8A:10 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" nvme_parse_ana_log() accesses ANA state protected by ctrl->ana_lock and therefore requires callers to hold the lock. Annotate nvme_parse_ana_log() with __must_hold(&ctrl->ana_lock) so that Clang's lock context analysis can verify the locking requirement at compile time. Reviewed-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/multipath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 698d79a97045..d714852ddc01 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -829,6 +829,7 @@ static void nvme_mpath_set_live(struct nvme_ns *ns) static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data, int (*cb)(struct nvme_ctrl *ctrl, struct nvme_ana_group_desc *, void *)) + __must_hold(&ctrl->ana_lock) { void *base =3D ctrl->ana_log_buf; size_t offset =3D sizeof(struct nvme_ana_rsp_hdr); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5ADB3F8EC9 for ; Mon, 13 Jul 2026 11:55:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943760; cv=none; b=VnGX7yy2ryMBHl+QTJzbVTmhqMKjJkF8rijcR4BMPie7LdqQTewkhfod3Z+3IVhC82N+FM1XVh1IJBslkOzmgR+bq0nz1liDEWrlQuet9pCcdNlX1WkXOBGjJquLetNzu2x2nN9s/TF1boh6yntw+B/cv29KDQkh+Mz5uNEWIi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943760; c=relaxed/simple; bh=xrjmR/e/5Xqmk878wAR4CD3zQppayCvksTnFLy7j4b4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lQPEslQ29w5+JQYcVE0mwds+BAVdrYnJ+E9/GLVDFMYICqPeoAJGR5zx15K9JhvwqM1hMgxA+SHomsHS+gsFAIDOT2W05Rw5Lg0sssj8dVcLiYmxce/2GydLNGuf3xBe5lbNNOU2IQIivyrv6ThdmRaqDYQn2Cfry1WHM00Nk2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=N5dPoXIW; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="N5dPoXIW" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6fk671740418; Mon, 13 Jul 2026 11:55:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ChkAh3gaywzJXImQm QOWd1t1cE3zaSyeQwaizlxDvlw=; b=N5dPoXIWtRs1KGWdz/DPeCJ4l3nQJHWrR y9XoCvs0DjfaFhSkP/DvUB2NkEBpbYWT/AV/07fYsOVNXyx36UvNVlnuBRlHG1DA zT899NxjVfflttMxdkNVxSpK0qivTLLfJC7fuFynNt0NzR/TTxxf2UtVV5Ef8XKT +ZZfQpjDtRyJf7MKqqF6mws7h581rFb936WK7aBMiZD3aOaf8N9zC5eZhpzOrdU0 V0H6xUhkkufVMstGlNz8KcnWLo0O7ru3NtRRpkQGvN/63YBU9bI7F6nqTfwg7lQ/ 7LhuA6jgqHyCIT0wFFkwOd3ZPpug6IZS3c8LnQWd6qfvEAmowmx8w== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbegt0fbp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:30 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnatJ023611; Mon, 13 Jul 2026 11:55:29 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cwt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:29 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtP1A56820086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:25 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3321F2004D; Mon, 13 Jul 2026 11:55:25 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5BB8F20040; Mon, 13 Jul 2026 11:55:23 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:23 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 13/20] nvme: add context annotations for nvme_subsystems_lock Date: Mon, 13 Jul 2026 17:24:14 +0530 Message-ID: <20260713115444.465704-14-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: i6BWqseZdvXsjF5OyEStSp8ePD9-S3By X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXx44yqvTJsyQa yzVQssw3+eDOH8GL3YIbd4nlzk/5Mak00CZPrD4BFs9BENBPYCXiJtxkCpiTpY/0X9nxiwvN3VY OOaF2SYVkGGffYlLok1umscP2+HPN68= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX6T1KnuvSTR5g mvE59+m0UyG8DNHJobo6SxSZV8Ap6rBEJd1deZIM+BDNg8NcRNmlybcY6nkL1whCFzBKtOOK1qB u4fNkQ5cHDlF5Y7JJ7C3+1VyGl26LOtfKNGBEMUVIDHnoxQJOqFp8SxA5DbIo4yb5hsi4x7XZm9 jMghQ6hS80rtJXwXPTuVC9+OQYCUp4NvsY2wh2lE9ur0dMe6OirLyI2FNmcIIYHOGtkCA0CEoOD +rhftSOwJImgOJc4oMUUxkmMMLZwULMf58647sa5nv1cQqP0SeMJMZhTWAPRhWgSA3iwsARE3xu e7h104M9+f4FMQ2OstG9iHF9/fOjDSiUkqhmB9YMgdyA3S7sO0umlGjMrgMLbmMQqe404KjQ6EY VlUjOkpEy28Hul7ECETY5gdTLNLRt6QgQlyTqNYDWy9sChtt29geDOAah5YwL4WD0e4hqA+1fTU kASzhxQpl17gLVGhcWA== X-Authority-Analysis: v=2.4 cv=IqMutr/g c=1 sm=1 tr=0 ts=6a54d232 cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=ey47_XiNFC_5WBcqlPkA:9 X-Proofpoint-GUID: JwurJhM-YsHSMAGDzBbiGAudLrkREORx X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" The global nvme_subsystems list, nvme_subsystem::entry, nvme_subsystem::ctrls, and nvme_ctrl::subsys_entry are protected by nvme_subsystems_lock. Annotate these objects with __guarded_by(&nvme_subsystems_lock) so that Clang's context analysis can validate accesses to them. __nvme_find_get_subsystem() and nvme_validate_cntlid() traverse the global subsystem list and subsystem controller list and therefore require callers to hold nvme_subsystems_lock. Annotate both helpers with __must_hold(&nvme_subsystems_lock). Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/core.c | 4 +++- drivers/nvme/host/nvme.h | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f7a4cdb988f1..26bca14e7d81 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -126,8 +126,8 @@ EXPORT_SYMBOL_GPL(nvme_reset_wq); struct workqueue_struct *nvme_delete_wq; EXPORT_SYMBOL_GPL(nvme_delete_wq); =20 -static LIST_HEAD(nvme_subsystems); DEFINE_MUTEX(nvme_subsystems_lock); +static LIST_HEAD_GUARDED(nvme_subsystems, nvme_subsystems_lock); =20 static DEFINE_IDA(nvme_instance_ida); static dev_t nvme_ctrl_base_chr_devt; @@ -3200,6 +3200,7 @@ static void nvme_put_subsystem(struct nvme_subsystem = *subsys) } =20 static struct nvme_subsystem *__nvme_find_get_subsystem(const char *subsys= nqn) + __must_hold(&nvme_subsystems_lock) { struct nvme_subsystem *subsys; =20 @@ -3244,6 +3245,7 @@ static inline bool nvme_is_io_ctrl(struct nvme_ctrl *= ctrl) =20 static bool nvme_validate_cntlid(struct nvme_subsystem *subsys, struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) + __must_hold(&nvme_subsystems_lock) { struct nvme_ctrl *tmp; =20 diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 602d567f3def..607fa9664272 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -361,7 +361,8 @@ struct nvme_ctrl { wait_queue_head_t state_wq; =20 struct nvme_subsystem *subsys; - struct list_head subsys_entry; + struct list_head subsys_entry + __guarded_by(&nvme_subsystems_lock); =20 struct opal_dev *opal_dev; =20 @@ -493,9 +494,11 @@ struct nvme_subsystem { * a separate refcount. */ struct kref ref; - struct list_head entry; + struct list_head entry + __guarded_by(&nvme_subsystems_lock); struct mutex lock; - struct list_head ctrls; + struct list_head ctrls + __guarded_by(&nvme_subsystems_lock); struct list_head nsheads __guarded_by(&lock); char subnqn[NVMF_NQN_SIZE]; --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56D5E3EFFB9 for ; Mon, 13 Jul 2026 11:56:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943804; cv=none; b=GYoPKwmQk8U7D8TqehsoSIOIwneXaxbGGQbVQRHtw0/OqmZpsQ8p3vs8jF0GkoOxlo9TNfxQOfyeoE8CQO0pO2COtu+GQqohlEbMPLmAjuF0i7rB6jwMXvWTKGG8pYqLby5qGwKiypnJwtyECGFetsUyV1OuUcaof0di4xh9rlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943804; c=relaxed/simple; bh=ewRCNoKqptqM59oF+4oYhgKaHOU5Rcrn1soX1O00Eno=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RMM+DymjzIOCsRxyO1pgCy77mmzviU8kLC4XYlg6LYDzG974Umbe73nRr6XPJozCy/sfnZmOFkmGfBkB/YNuuKhmrMkuycel0AoMgrIi/DZJZeocfxZazghn9TnM5MJPd/H446B8NOwiCk9p/5JWd9vISjRBY9rEd91GsyAOggo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=miyzMrOm; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="miyzMrOm" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6fsTP1668576; Mon, 13 Jul 2026 11:55:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=2fn2gtZrJrMBMygP2 UI2ix/dHIlz0KNp+E6gd6CEnxw=; b=miyzMrOmO7LF5cJwL3mUr0VKTaAE1XJpG NR6Rd/vRCO4TkYidPQWZmTS3C1Un8GEYr+ZEFX5Vus0+z/wgTv/BL+Kpis42OzJe O1GsSGyAlRhiUvEfS+rgzm57hHgdqAVEGWXgJbztJEEEfUx5IxwnVyFRpx1tOfs7 P9+7fAaOPA57ci6iXXhndhTz6kG15QqPn2VnT2uvgUKY2oBSldCyd0QClBkrSy+p Ig4Odtr2pnLYiHuSkNvv263+Fy9FGVZ9NP+aDXxnojJBW6zrOAhTUnHkgUSlYamE ilaGLoGGnqEZQEnCXP2z7yp0xUgoSM/jjODGOT43pX7oJQueblkBQ== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbexwg1vu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:31 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnuoH010517; Mon, 13 Jul 2026 11:55:31 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fc2uxw6es-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:31 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtRMn48562662 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:27 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4DFCF2004B; Mon, 13 Jul 2026 11:55:27 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7A58520040; Mon, 13 Jul 2026 11:55:25 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:25 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 14/20] nvme: add context annotations in fabric.c Date: Mon, 13 Jul 2026 17:24:15 +0530 Message-ID: <20260713115444.465704-15-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: Cdz1jkgVFV0lNI72_gdtIRUNMDfb6skb X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX52Qf0Ci/6qtJ BNrZ/5yupAnRANuIAmrmQvkGcfd2DFMNq5jZjay+WgbVKiFbsgklWtMK1IauB5kyPQ1lpPbJzvs sWbT2EDWklW6E6bqJR8psCpQRqdDQzf1lXsI/nYVBswW3/V0F3TUgSDB6Zx7QaPNHeO/1bnLP1O 9H15w3l72Zm7y6JplQJ/JeDlwYvtrs4ZmHMTDf1bPxW+nh/H/ib5z5vIPrpZpGfxjPC8YnRAy0t deOMG4f9garDipgL8IrOYFCQJYQ5OHerDXt5ixmvwkfpwlfZ/wnzL+SbdVgo+Cgp5FlOdjJ3HQL dt4JWa7jx0udw12+YxlEPivf/jGGa6FsfQyJn5UO/FMb9UPCGuNbZ3147uRCGTFEvxot2qmojF6 Lpr/mKTZwK8s8Qg+L+9FlG/QY20JVRrqBoKxd4ODhosQeMwRo4OpfRJDnmDxoyur0BdfGVtWd/P NEtrYiJMO7SFFgic1WA== X-Authority-Analysis: v=2.4 cv=XJoAjwhE c=1 sm=1 tr=0 ts=6a54d234 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=-W7SLkP_sVXSNSbjlKUA:9 X-Proofpoint-ORIG-GUID: 8UYGcwGA6qjeYPr48lyrH7mN_iqtU4-J X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXwoCD5/+hoRjZ yf4yIP+rOMGZ5w7imHzzygioosJC2wRqcA7fbiYeQureIV4jLhOXH8GS0yW0+f1xKa7l/19BVqG 3DDKW6do4qi8/2SSR/lNzAaFP2BzJPI= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" The global nvmf_transports list is protected by nvmf_transports_rwsem and the global nvmf_hosts list is protected by nvmf_hosts_mutex. Define both lists using LIST_HEAD_GUARDED() so that Clang's context analysis can validate accesses to the lists against the corresponding locking requirements. Reviewed-by: Christoph Hellwig Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/fabrics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index ac3d4f400601..fd5abd04e080 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -14,11 +14,11 @@ #include "fabrics.h" #include =20 -static LIST_HEAD(nvmf_transports); static DECLARE_RWSEM(nvmf_transports_rwsem); +static LIST_HEAD_GUARDED(nvmf_transports, nvmf_transports_rwsem); =20 -static LIST_HEAD(nvmf_hosts); static DEFINE_MUTEX(nvmf_hosts_mutex); +static LIST_HEAD_GUARDED(nvmf_hosts, nvmf_hosts_mutex); =20 static struct nvmf_host *nvmf_default_host; =20 --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F51A3F7A92 for ; Mon, 13 Jul 2026 11:56:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943808; cv=none; b=mhrP+yJDFSI28OwUVPegmYhEF9NLQS4vv3mgeurbqaPwPEg3QOskhd5My4FvB4UKf4CrkNrKSxZStSNkxB1+PTEfsuPdlhNXMtm8hGMqgSoKy1AF7bUexryEGkr1DScgBrHdmTknqfShGfItEhsyuZuw/k7jLm8oeX/+MsCeyg4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943808; c=relaxed/simple; bh=3Yq/H6+ePBCUWWcU1WXW/SYQtta8YQLIoODtbLPZe9Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E+AL0cnsS5KaUhid1yQKDN/MX2wDIBN0GBmkzlg18ab8Mvn7dfxf2ixnfyGHINWCSGmXuO3iELBLlObid68sapvbdiNmz5DdwCOmZLa0gZEi9FcegkLV5IJRhsObgpLsJ/Eud2lmpEXyQ48ANsfbmQMqdIniJvxoSUnRZmFnrzU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=i+mbpnjL; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="i+mbpnjL" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6g3Jq1727673; Mon, 13 Jul 2026 11:55:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=QxRAGixmwL0kgeaao pK6cJ/hkegshcFF1sp+4+CUmzE=; b=i+mbpnjLmYM3CVhFbk5GdHGWCXD9ZBgB8 9A3M8nuP7n6kZ6ONwy1pWgqEb3i9wiw/0PC4BSyM87M+Syw2Vu2ObLtsloEsNd9o sQz/MDTIBEUkUS4cw/glVo34WTl99fHd3oOZEAK0NnChB6DM8HNZLhtuMAkxAhKB N4OJhi1Z1ncKmMu0H6uBWSlvJAVHffYodGttXqJZBTDLyjhpENjrVsvt+wC4Q+h4 /htwbWrKUshtZ5XlLzZ5RK3ln/C4cneQsM2c71uG88gWRcJoZk4u3RVYIctWUpv1 iJZ5w0qslCEBwtxcW5w4Z9Q+2yVhlc+ll+A5fVLAxrGlIaVko/nEw== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbepx8de6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:34 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnc38012359; Mon, 13 Jul 2026 11:55:33 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc0hvwk63-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:33 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtTcS46465338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:29 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7C9FC2004B; Mon, 13 Jul 2026 11:55:29 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9562620040; Mon, 13 Jul 2026 11:55:27 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:27 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 15/20] nvme: add context annotations for nvme_queue::sq_lock Date: Mon, 13 Jul 2026 17:24:16 +0530 Message-ID: <20260713115444.465704-16-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: hTVD9Xl3iTGsN5Vib3Qnk3KbAva9uYmw X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX3Dq0/wMaidpt RfeA+4fkUQd6DzWBvvRp/c6+qmH4vI4kadLt3V3zUvRcbSy9xRTp5uAuSmR9GX2qxszRs/WIEoR OpVP8qT1d+6uQJ/Mm+BLC7jfkyboS64= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfXzsJitAQCvoQD BPyIty8GNNauE+kfT1xTqtyLubeMBFQ8c9CCzmv94owcLQo3vaf4N9RgaYkP4f4Y+ZsLbsLsiUC cRrMUgs8PGlLfsw5GoxGaB/kiy5o+sfW9vjdaIB9lNW/ziKKaOvp8EXlvK4LCv6irztp76D8mC5 OrTDPpmNXB4elffHu2+sJRWxXEWJDkV5WfXgb2CoXDFR0HQ7t0qkTsZuK9MG+10vRADmfnyVFpU BhnYxleaVQp9Abook82WSubYCC2iLdf4rPGHFAwQ1yes6wu/kWccu7YKN/09Qu11pYOgfUcv4zk gMhYJSCf3EkvpLLuQjhgWS3vWkmp1TptvjkLJdxiE+1rjHDHzI+aKvbCipqFasAwOsqRRE7wubN RNG9a1QSOy3SbOUU/QmeC8Dtk5X2lzFTGj22abdCKCgXhUnUROYm/0reA620IFRrDDOWfxKD3uZ VJ95GdtszprjzMXZ2Sw== X-Authority-Analysis: v=2.4 cv=XbS5Co55 c=1 sm=1 tr=0 ts=6a54d237 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=VnNF1IyMAAAA:8 a=YfWjjCuxrD_un2WB3cEA:9 X-Proofpoint-ORIG-GUID: Byqlq2H5JarKp6CYv3NdKAEukqnPCs1n X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 suspectscore=0 spamscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 malwarescore=0 impostorscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" nvme_queue::sq_tail, nvme_queue::last_sq_tail and nvme_queue::sq_cmds are protected by nvme_queue::sq_lock. Annotate each field with __guarded_by(&sq_lock) and annotate helpers that access them with __must_hold(&sq_lock) so that Clang's context analysis can validate the locking requirements. Access to nvme_queue::sq_tail used solely for tracing is annotated with data_race(), as they only require a lockless snapshot of the value. nvme_init_queue() initializes nvme_queue::sq_tail and nvme_queue::last_sq_tail before the queue is published and thus do not require nvme_queue::sq_lock protection. So annotate nvme_init_queue() with context_unsafe() to suppress false positive context analyzer warning. nvme_free_queue() operate on queues which are no longer reachable, and therefore do not require nvme_queue::sq_lock protection. Similarly, nvme_alloc_sq_cmds() allocates memory for nvme_queue::sq_cmds for the queue which is not yet published or in use and hence it's safe to annotate all these helpers using context_unsafe. Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/pci.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 7954417d1252..50ca643c16c5 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -366,7 +366,8 @@ struct nvme_queue { struct nvme_dev *dev; struct nvme_descriptor_pools descriptor_pools; spinlock_t sq_lock; - void *sq_cmds; + void *sq_cmds + __guarded_by(&sq_lock); /* only used for poll queues: */ spinlock_t cq_poll_lock ____cacheline_aligned_in_smp; struct nvme_completion *cqes; @@ -375,9 +376,11 @@ struct nvme_queue { u32 __iomem *q_db; u32 q_depth; u16 cq_vector; - u16 sq_tail; - u16 last_sq_tail; u16 cq_head; + u16 sq_tail + __guarded_by(&sq_lock); + u16 last_sq_tail + __guarded_by(&sq_lock); u16 qid; u8 cq_phase; u8 sqes; @@ -716,6 +719,7 @@ static void nvme_pci_map_queues(struct blk_mq_tag_set *= set) * Write sq tail if we are asked to, or if the next command would wrap. */ static inline void nvme_write_sq_db(struct nvme_queue *nvmeq, bool write_s= q) + __must_hold(&nvmeq->sq_lock) { if (!write_sq) { u16 next_tail =3D nvmeq->sq_tail + 1; @@ -734,6 +738,7 @@ static inline void nvme_write_sq_db(struct nvme_queue *= nvmeq, bool write_sq) =20 static inline void nvme_sq_copy_cmd(struct nvme_queue *nvmeq, struct nvme_command *cmd) + __must_hold(&nvmeq->sq_lock) { memcpy(nvmeq->sq_cmds + (nvmeq->sq_tail << nvmeq->sqes), absolute_pointer(cmd), sizeof(*cmd)); @@ -1586,7 +1591,12 @@ static inline void nvme_handle_cqe(struct nvme_queue= *nvmeq, return; } =20 - trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail); + /* + * Tracing only; annotate a lockless snapshot of nvmeq->sq_tail using + * data_race(). This would also help suppress context analysis warning + * while accessing nvmeq->sq_tail without acquiring ->sq_lock. + */ + trace_nvme_sq(req, cqe->sq_head, data_race(nvmeq->sq_tail)); if (!nvme_try_complete_req(req, cqe->status, cqe->result) && !blk_mq_add_to_batch(req, iob, nvme_req(req)->status !=3D NVME_SC_SUCCESS, @@ -2013,6 +2023,7 @@ static enum blk_eh_timer_return nvme_timeout(struct r= equest *req) } =20 static void nvme_free_queue(struct nvme_queue *nvmeq) + __context_unsafe(/* frees queue which is no longer in use */) { dma_free_coherent(nvmeq->dev->dev, CQ_SIZE(nvmeq), (void *)nvmeq->cqes, nvmeq->cq_dma_addr); @@ -2107,6 +2118,7 @@ static int nvme_cmb_qdepth(struct nvme_dev *dev, int = nr_io_queues, =20 static int nvme_alloc_sq_cmds(struct nvme_dev *dev, struct nvme_queue *nvm= eq, int qid) + __context_unsafe(/* safe to allocate sq_cmds without any protection */) { struct pci_dev *pdev =3D to_pci_dev(dev->dev); =20 @@ -2181,6 +2193,7 @@ static int queue_request_irq(struct nvme_queue *nvmeq) } =20 static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid) + __context_unsafe(/* initialize unpublished/lock-guarded variables */) { struct nvme_dev *dev =3D nvmeq->dev; =20 --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 595093F4DFE for ; Mon, 13 Jul 2026 11:55:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943751; cv=none; b=SVyr37AA8Dis6NJ6w28ajvMBY5SJiybOEuqSfVazF3WUpmqQSKPN/UqVzlVFxDWeNinTyWJQGNfZmVvGpeNCChzguJFOogbDej2h8RDblzKDdzxHeCVsLFOPTLwrIV4yy7audYZtl+Ikiu4c7icp/l7l0xMTPwXCcNwHCcbzOCA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943751; c=relaxed/simple; bh=bA6RtKwtITcfYFWjMyGxT4TWlbKy3bwA27davf7P6Dc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YX5Nsj07lz/LkeTdPlT+Sy39806NqBjBjCMieOTEKJEiVsS01Fdd/NxqKeujpl3kJf0DAziPxcxSx5iKxpuOuN/UDk0a7K9Xn7LJ2vr+MMtpdPfE91lsl3nhiXzTfGbVWR9ZqRfLCzN6kYs2PQsvw+qceBZDkMl/HUsKq9iiZAI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=hewz5+fT; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="hewz5+fT" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6g4Oa1672462; Mon, 13 Jul 2026 11:55:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=KzKjfiOm8C5ofWaZa rKqIxzGPOR4iEIRQYAY15MYzQY=; b=hewz5+fT+OMbgHO8R1QPmN5O+H0nhlZQz GDou0e7qDpwfz6n9KoUj3TLLivVOVE5E7EMxJQG2re1GmDmXrQcgRhUWPE52m63B HHQcTORRMNgs2viVIn9YhuF4b8ioXFjyceLUz3yz8ZHfsVWoqbdpeA+JCJ+e1MHB TsFd9PavbGyhqh6alqMa7qVSnrW5sB/k0Cnma0bJMOVTXtwa64xYIpFybCCzo9pa OsiVgPkZYQgpGY6kfJKSdwZ9cqt5BNvJ1m8jyq+bMmJ6cZXNv0IXMji2kGdu0QsV i4UarNEKHb/XhBpXOtox2E0tk6L3SM2XUoCvBRMN4a9NpMFjaFdxQ== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbf2a01xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:36 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnmjY010489; Mon, 13 Jul 2026 11:55:35 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fc2uxw6ex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:35 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtV1547514042 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:31 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8DB1B20043; Mon, 13 Jul 2026 11:55:31 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C381820040; Mon, 13 Jul 2026 11:55:29 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:29 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 16/20] nvme: add context annotations in rdma.c Date: Mon, 13 Jul 2026 17:24:17 +0530 Message-ID: <20260713115444.465704-17-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX2jEEL09yJV9+ w1fZ4FWsss/7IESoM6ywqBmVcBv5ALXXHDaECm1t1oGQQq7+7h2GvTFFzL5Aa3wHyGof/niFF9P 9OE25ITFzUwJz44Wduv1foCxgQovKDE= X-Proofpoint-GUID: yD715B-JWCZfBBU4FZln2IYfqh3UiHsT X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX1SiqEpFJRmZA zumfHSgotWBqqcRXMfgCEsmYZkzD5y8Qm530KF4h0rB4qaV/rjBA9VOjttbDIaW0ynjLKI1MkiU V7ecHa6StDzZPBn3WnaUj4w24vb/LwzeAhK3KXETkaFQ2UVQ/0APwqv3HZFm5bOPNd0SBwVr6OO lTcJvf3rasmhlawgZP/LqxZbVFAhRWgkoAuIGVG99n+TXJZ9FUvvyaRteKLyggULZWcMr7hwdcU C1hjeo1EkxoWCHSiddCr5RLI7SqBEEncy5lEa+MCKJvgPezinfr5qJN01fRD6F+OowaWftna/5D sjIIqmiZMvBYCAcmk/+PzhR3X5kTqAdKaVo8JQdcCM/x21zqefs2xBQUiL8cjFTfBBZf71LBPmH psOI9iAvT8QrS/IED3zC2RQ0gHmiSZLvWlYioDr6u6stKvLBxzYLsCx/ti9F7LpMbrqZVc8fmam +TbiDSpXyAOOy5FD2JQ== X-Proofpoint-ORIG-GUID: wCU4fWLMGx79F85VaNsK021DQGIizjhE X-Authority-Analysis: v=2.4 cv=PvajqQM3 c=1 sm=1 tr=0 ts=6a54d238 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=pOGEuHxQbtI5uFpJoR8A:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" device_list and nvme_rdma_device::entry are protected by device_list_mutex. Define device_list using LIST_HEAD_GUARDED(device_list, device_list_mutex) and annotate nvme_rdma_device::entry with __guarded_by(&device_list_mutex) so that Clang's context analysis can validate accesses against the corresponding locking requirements. Similarly, nvme_rdma_ctrl_list and nvme_rdma_ctrl::list are protected by nvme_rdma_ctrl_mutex. Define nvme_rdma_ctrl_list using LIST_HEAD_GUARDED(nvme_rdma_ctrl_list, nvme_rdma_ctrl_mutex) and annotate nvme_rdma_ctrl::list with __guarded_by(&nvme_rdma_ctrl_mutex). It is safe to initialize nvme_rdma_ctrl::list while allocating the controller object because the list entry has not yet been added to nvme_rdma_ctrl_list. Annotate the initialization with context_unsafe() to suppress the corresponding Clang context analysis warning. Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/rdma.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 6909e3542794..bf392035037a 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -39,11 +39,18 @@ #define NVME_RDMA_METADATA_SGL_SIZE \ (sizeof(struct scatterlist) * NVME_INLINE_METADATA_SG_CNT) =20 +static DEFINE_MUTEX(device_list_mutex); +static LIST_HEAD_GUARDED(device_list, device_list_mutex); + +static DEFINE_MUTEX(nvme_rdma_ctrl_mutex); +static LIST_HEAD_GUARDED(nvme_rdma_ctrl_list, nvme_rdma_ctrl_mutex); + struct nvme_rdma_device { struct ib_device *dev; struct ib_pd *pd; struct kref ref; - struct list_head entry; + struct list_head entry + __guarded_by(&device_list_mutex); unsigned int num_inline_segments; }; =20 @@ -112,7 +119,8 @@ struct nvme_rdma_ctrl { =20 struct delayed_work reconnect_work; =20 - struct list_head list; + struct list_head list + __guarded_by(&nvme_rdma_ctrl_mutex); =20 struct blk_mq_tag_set admin_tag_set; struct nvme_rdma_device *device; @@ -132,12 +140,6 @@ static inline struct nvme_rdma_ctrl *to_rdma_ctrl(stru= ct nvme_ctrl *ctrl) return container_of(ctrl, struct nvme_rdma_ctrl, ctrl); } =20 -static LIST_HEAD(device_list); -static DEFINE_MUTEX(device_list_mutex); - -static LIST_HEAD(nvme_rdma_ctrl_list); -static DEFINE_MUTEX(nvme_rdma_ctrl_mutex); - /* * Disabling this option makes small I/O goes faster, but is fundamentally * unsafe. With it turned off we will have to register a global rkey that @@ -2254,7 +2256,10 @@ static struct nvme_rdma_ctrl *nvme_rdma_alloc_ctrl(s= truct device *dev, if (!ctrl) return ERR_PTR(-ENOMEM); ctrl->ctrl.opts =3D opts; - INIT_LIST_HEAD(&ctrl->list); + /* + * Safe to init list while allocating ctrl object. + */ + context_unsafe(INIT_LIST_HEAD(&ctrl->list)); =20 if (!(opts->mask & NVMF_OPT_TRSVCID)) { opts->trsvcid =3D --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2E6A3F4831 for ; Mon, 13 Jul 2026 11:55:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943752; cv=none; b=VMDEIiJFZEGCUdC9Ul+geY7reJI8pXN8nvSaPoYQB7CGeHr3WRLgzh3IkqGngH2+iPbkpuiUW3nCfUVlc5kbO8Ordr8bmXX7uTKxupIBuqI5dSX1/kzIfPOiMH+ZJ4oTuKsOMdmgCpQEoJfNzje+9Bne05/NXfWPKn/0uGoMQB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943752; c=relaxed/simple; bh=CvrF3v+GJlUKfPBoWOvn5i8PYE2RXVmPU6DSfM1kQ/Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ugg86rAekJT2tVUZsbRmINI6cAW/3KJCdGzapkCbazQKK/UtyTpvkhmDCsP3OtwS3N4qhvXq1F8pnLTBFjh2BTiUEakduMzGikvxGfZis4UNuphvh8lw30Q+Y17SUqOdnQpQ54xc3JSY6jmxIGTdmSh3BfRbsNKpcByG7umQmnk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Jno+35ET; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Jno+35ET" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6gPdx1669232; Mon, 13 Jul 2026 11:55:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=SlZg2WL9PhzUTcVOC L9j+gYbUADaKzo/Ork3fhiGgTo=; b=Jno+35ETnwEfslaPCNOpsLGWqziKqlAVu BmFzYMlNt2/m1O3FPcRa8h4Qzxm0xzYTvxOzztW8QaY4FV1AZCTdedY5cZtIz68m 92fDHJHZS+F6aj7AuIeXAZj0fRZxlPzkkr3Ls3OY136b1FFj3UbH0idxfhwo6DES TQtcvEYB9bN7cr6pmFmFcMbox+50R+5DISPMV4uZl/BhdsgFAQxq8FO5pDeVFpYG 7Oi1Ag0QKA6kl3wbHurG4LrjcVaSDpGZ0D1ONoj65i18dZZ2/lfqhtNQu0uue6wt YlmviIS+uYbcSwNggcCUQXt5ZbPYsJb8Cd93Y6svbXG7TZT+fM7Zg== Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbexwg1w7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:38 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnaKl027142; Mon, 13 Jul 2026 11:55:38 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc15jnfvq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:37 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtXT714811636 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:33 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D59D2004B; Mon, 13 Jul 2026 11:55:33 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D498720040; Mon, 13 Jul 2026 11:55:31 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:31 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 17/20] nvme: fix context analysis warning in rdma.c Date: Mon, 13 Jul 2026 17:24:18 +0530 Message-ID: <20260713115444.465704-18-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: _K3Lq6yLPal-Fw4FKggRXtdwad9XgHzR X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX8CxGqsxEqscA YGObHfWf7mzNC5FNsbt6JwAzLHcp4PEdTkQ/OPqssUH6EYO7tP0pLwcMBe7wBtwoSTW+PFBBXBI DReXWRcFDP+vR7ygaCNkyhAqBWFrkDN4qL13ja2Z537UuPbbShsUSlI6sk3kbdtBy6GgWbwa3AV 2WjYfjG1GCKoNVeJOMxCCuOk62i6EndCTKLowaTwGQ4JKmZGq7eHxRgxH9aEF0XWtrew0QWTw8x v/LswiKu50sJHhsAJSFsLwL07/kjkC52IYW2K51n3zrD3w8ZcuiyF7HoKLTI+Wu3hB8uUs2EcRz +u9L8Oo3STIDYQ4adrQz+9tSfvgE+akwNOo2MeogU+et1gdIB0RGQFspvsRTrlmAbtf/42qxZDm iw3KXQobj8QLIrvmJFgOewqIqwLP5o4/hUhPvFCUVvKQwgbJ6J7dFYjDxV4OxTz0Tw2beOUAACL O5aeZD5J1WKpe0GU/KA== X-Authority-Analysis: v=2.4 cv=XJoAjwhE c=1 sm=1 tr=0 ts=6a54d23b cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=V8glGbnc2Ofi9Qvn3v5h:22 a=VnNF1IyMAAAA:8 a=L-zbExpT5qCHzqbmkREA:9 X-Proofpoint-ORIG-GUID: u1-EEtZRuTsszOJWTJU5D-YW94gzRvHZ X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX67t28ReGyAow 0n7+0RSYMTwkkRNtoGahBHjI2HzglFuHDND/610N5ARPLLjTjeU4ix/SQXNxmEA3Ctcj2O3WDDh YoY+s4VJhJgCN+bTVd+1IajJeLXzS0A= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 bulkscore=0 phishscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 spamscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" After adding Clang lock context annotations in rdma.c, Clang reports the following warning when context analysis is enabled: drivers/nvme/host/rdma.c:972:24: warning: passing pointer to variable 'list= ' requires holding mutex 'nvme_rdma_ctrl_mutex' [-Wthread-safety-pointer] 972 | if (list_empty(&ctrl->list)) | ^ The warning is triggered because ctrl->list is annotated as being protected by nvme_rdma_ctrl_mutex, but list_empty(&ctrl->list) is invoked without holding that mutex. Replace list_empty() with list_empty_careful(), which is intended for lockless inspection of list heads during teardown when no concurrent list modifications are expected. This suppresses the corresponding context analysis warning while preserving the existing behavior. Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index bf392035037a..cdd8837da03a 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -971,7 +971,7 @@ static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl) { struct nvme_rdma_ctrl *ctrl =3D to_rdma_ctrl(nctrl); =20 - if (list_empty(&ctrl->list)) + if (list_empty_careful(&ctrl->list)) goto free_ctrl; =20 mutex_lock(&nvme_rdma_ctrl_mutex); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B49B93F8236 for ; Mon, 13 Jul 2026 11:55:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943756; cv=none; b=jpXwtHkP2aBuWPRA3zHydU5efCSa4/iVjHTUWVfvAIItQ+sx8LDkxlTiBJHo7CSJXQn8OXzDXTSTfmlffNB/DjfYnVFbboZyWOw+V9jBXV0GmlUWyUbtIIAcBDfJ5mDFn9+MqLXaeBIa20dXJZv0CahNYnKCguRXPSfBl6gqTtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943756; c=relaxed/simple; bh=9988o8QDOQwlYYeBqaUJ7f5erhURRSS4td6u7R3+Ut0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SbVke6wkZMgjlphKnEkOq2XLL12ZhrRW7VeEqOREpjOKu0OtISA2jtFdwHpzyMdX9kTdWZeFP0Ymt04P3CCrBIzY7A5IOk3Uyvnz7NFDIaPFma/LuhC1H/xhxTsWmrme0go43Dti0zV/RiJwOCtmICkWmta/2iJ3OJo6t0o32qo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=AzSmilwn; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="AzSmilwn" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D7vTWq006795; Mon, 13 Jul 2026 11:55:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=B8ug9Et3HqRFe3N0G +eeisLxaTEy55ZyWgWF052eE4U=; b=AzSmilwnr+WivmdGjQdLq6rHfCpOGBxfG pEqF1mw0vDU2qPGMh/cEBPKtyshXbPllDRFt3ryaoQ7owVLjabJD/IHjbifELkdH 7bRZT4ryBb6FLPTKYd9FoG9cLUH32PJQUheqZMsElKvucYu4vBRtQt8I1X/C/ZzN 9oleoa3pReB3bqnKDFw6q2Euvtym3yShrVQYhHlZv/tUexFkiVj60vh+0jD0JXQF mUrSIncS93o1p9sSAK7YLCgNBaRZFtnX/1Z31NXT6MPNVHGbJDqpwDpDs4opqfye zCPi/4vtSwDT46bLP+NczcPFLTJviL/0xbJGr+wdPeXVo1y1xx/VA== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fcv330xyj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:41 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnmaZ023657; Mon, 13 Jul 2026 11:55:40 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc1nh5cx7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:39 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtaCI48824586 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:36 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 05B8420040; Mon, 13 Jul 2026 11:55:36 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E3FFF20043; Mon, 13 Jul 2026 11:55:33 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:33 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 18/20] nvme: add context annotations in tcp.c Date: Mon, 13 Jul 2026 17:24:19 +0530 Message-ID: <20260713115444.465704-19-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX0sEScOfTPZu8 HFm1TUQn/RgrwIbpOI6xbJL53i4ocpVINRydwBCKnaX3uuh1cz92hEbMA4NPd0L15Hp6ICM4gpf ti4kgYVe2wpWgaXB3ilDBNGYGNbFeE0= X-Authority-Analysis: v=2.4 cv=Mp1iLWae c=1 sm=1 tr=0 ts=6a54d23d cx=c_pps a=3Bg1Hr4SwmMryq2xdFQyZA==:117 a=3Bg1Hr4SwmMryq2xdFQyZA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=TfvOO_zgRogsC6GeyRwA:9 X-Proofpoint-GUID: uOsSCATg7Q8ji4Z6xGEHnPuNxDBMkDg9 X-Proofpoint-ORIG-GUID: _zA-TdQiJ0xgBOJN1InFRycTkX1Jq3Pk X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX+hr7vVj1FYTA oGM12C3yhOiOqYApX7/10g278RIz7kb9gDiQZ5AJrAFmwzDC8UcpdtFBbEtVJdjIq6wUpVshquN eRaBs7zN5tgs2LmNDgKH3Pd5cBMltf4W7xinnBm7Hb16olgEAXwnxmL5K6u9kO3HLcpsO4YYlDC xlCXFSanbFMJaXnmljZES0NERE8P7lz0N3AsDxhRxfkCzZzbvd7ckzwArou9rj9bTDHi4rVBrrY 57mLwVGFriol1+ZI+jC6KJEZwHUqD51Az5L18TdQBWfeel3VLuJP4zygGAkytowbyMoIPG/R764 lvfs5pyVb1TNlw2Oe62fbABh5kpARFPMyczHdR8ImIwyEH29EXW8dOtokapHEk4C/yfICMnDdXu Lj8NQTzip/Ok1sXu3sk0iAFENURk7H2efrnwzKg8aTdY9D5EeeGTc5cxkyrF0tdG/Uqs+HfurKo 7wQSLTqGzzmDZF73yMw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" The nvme_tcp_ctrl_list and nvme_tcp_ctrl::list are protected by nvme_tcp_ctrl_mutex. Define nvme_tcp_ctrl_list using LIST_HEAD_GUARDED(nvme_tcp_ctrl_list, nvme_tcp_ctrl_mutex) and annotate nvme_tcp_ctrl::list using __guarded_by(&nvme_tcp_ctrl_mutex) so that Clang's context analysis can validate accesses against the corresponding locking requirements. It is safe to initialize nvme_tcp_ctrl::list while allocating the controller object because the list entry has not yet been added to nvme_tcp_ctrl_list. Annotate the initialization with context_unsafe() to suppress the corresponding Clang warning. Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/tcp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index ba5c7b3e2a7c..8d2fbfc7cd8d 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -149,13 +149,17 @@ struct nvme_tcp_queue { #endif }; =20 +static DEFINE_MUTEX(nvme_tcp_ctrl_mutex); +static LIST_HEAD_GUARDED(nvme_tcp_ctrl_list, nvme_tcp_ctrl_mutex); + struct nvme_tcp_ctrl { /* read only in the hot path */ struct nvme_tcp_queue *queues; struct blk_mq_tag_set tag_set; =20 /* other member variables */ - struct list_head list; + struct list_head list + __guarded_by(&nvme_tcp_ctrl_mutex); struct blk_mq_tag_set admin_tag_set; struct sockaddr_storage addr; struct sockaddr_storage src_addr; @@ -167,8 +171,6 @@ struct nvme_tcp_ctrl { u32 io_queues[HCTX_MAX_TYPES]; }; =20 -static LIST_HEAD(nvme_tcp_ctrl_list); -static DEFINE_MUTEX(nvme_tcp_ctrl_mutex); static struct workqueue_struct *nvme_tcp_wq; static const struct blk_mq_ops nvme_tcp_mq_ops; static const struct blk_mq_ops nvme_tcp_admin_mq_ops; @@ -2919,7 +2921,10 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(str= uct device *dev, if (!ctrl) return ERR_PTR(-ENOMEM); =20 - INIT_LIST_HEAD(&ctrl->list); + /* + * Safe to init list while allocating ctrl object. + */ + context_unsafe(INIT_LIST_HEAD(&ctrl->list)); ctrl->ctrl.opts =3D opts; ctrl->ctrl.queue_count =3D opts->nr_io_queues + opts->nr_write_queues + opts->nr_poll_queues + 1; --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0F9023F54DD for ; Mon, 13 Jul 2026 11:57:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943827; cv=none; b=fJ8k4QBlN/bGw6Iw+HZ/u+SE95qWoOtPcIOQywxsRDTHbxucOqPXOCF9LXUW/epXQPoZP/ObYt0Naa5G8En0EhiVpEZAQV6K3nUgd1TQMq+iD0uo4Me2bWx9rmnsBOjF166vLCo0hYhz4KEODmyCzEzFLcjZEzHWzWKJncqM84w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943827; c=relaxed/simple; bh=SQYssl+EKWIt/yYFuLAu40YaNGMZGrqV7ZQ3CDdlFV0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SQWLvOZ4vNkUtnVDobH6gfb3r6EK2chthdmD95c08ca4GTHyAhY26PBQjy2S6Aq6AoSU/gV1YH4ItnIDoKk9HcU2IEKEQMgBC7XkDc2KCeDsBhgTlhGLkEvuMPLcBUHBHA4GCm/OCAPGaXOLsz+U/aHQfq1M1bgwh3xm5paNbBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=UxQwISe4; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="UxQwISe4" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6fZaJ1740154; Mon, 13 Jul 2026 11:55:43 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=vaatYQhQiYTzBO2/i UmWVXdWlKHkVWN0eT8ZSjsZSnQ=; b=UxQwISe45BMRA+GSGPl9HaZ766mdA96Au eMHp8MJFrep74/BMv57lO01Of6NCZeGbZMvr5lMw2Ilkj2qwJQo46yCCs8xxPG7Z jTTzd5nDgSUG/V+hywPaxMaIiJ/eJYMJsP2P9cYspYBXhgFNNyxW4f45wuREnTiZ O7xw+VpM10IbNZNOZ5alIy2GI69iNRXsCZO+oLnDB24L3vThxbor036M4cvNuV4l jbfqqn4pAlRImi3pWMC3PIDCSBPt5y8nsHomypsrMFkRu/bWegYt+agsLaH7q54m vpC4DoZeV+G/J3g2d/XqEJtvPL3LcZQNEY13jbaabfLYu53hsvjvw== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbegt0fcm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:43 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBndBF006908; Mon, 13 Jul 2026 11:55:42 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fc05pwnxg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:42 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtcYP47514058 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:38 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 374642004D; Mon, 13 Jul 2026 11:55:38 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4C99320040; Mon, 13 Jul 2026 11:55:36 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:36 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 19/20] nvme: fix context analysis warning in tcp.c Date: Mon, 13 Jul 2026 17:24:20 +0530 Message-ID: <20260713115444.465704-20-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-ORIG-GUID: 5huRcoF49ZqK5X3EUtzri1tUt_1iqIQc X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX7Sg9UXy/viWi QWUE0mfcOkC9t0KfONDUBxmRAfi5Is9B76VL0tzS4EHdDD/WW4gAY6iJtRskjUgKGzjbxBrJXCd 1rc9onVNFErt8YN49cB0agDzRD2aXuQ= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX28dWUO6HUTzY FDp99Zl7yUuPK2fIbYmfbNPkt17wnPRug6c+96OdVihyaoWhncyB/h4K41k9NELB6RLTK0y5Azq /GoF5Tv2n58e9ij3AyZSEtLWdwRL9NepLRwAHWnUumMrBuBOToW+f06aMQf/v2XrMgfA42K6Tn6 1Fv/B9l37td+zoj9JZYlzp9mPd1CcWmL7Vy2PjGYojXBjoGugk7q5QROKurKpO7LYXuWTXXMjAT 2yQ1fL8s3DarzhA5HKFhNi2rlmQfztVvu0kzaJFjTr2gnloRw7nVeTHfPfOUrTVvaawKtBjUbfF iM48gS9KqWLD2A2siEEJbAs5S+3XPx+Uf4LRjffGrXr5DpkRyuIX8thsaNemwX/IEVOIeqG5XjX 6/Rgpq65PR43D6LnF0IZCnCdFEFBYiskGNWabBoKX7BRSfmw4GUB7tgURT4wdlLUAznOMpUC2jZ tJ35MS7/lni73DdYa4A== X-Authority-Analysis: v=2.4 cv=IqMutr/g c=1 sm=1 tr=0 ts=6a54d23f cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=VnNF1IyMAAAA:8 a=OaIR7dClPEixnHXHKS4A:9 X-Proofpoint-GUID: 4c6DzjkBMwTU4BPciZB4eg-N2GgKeGMJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 impostorscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" After adding Clang context annotations, compiling tcp.c reports the following warning while context analysis is enabled: drivers/nvme/host/tcp.c:2572:24: warning: passing pointer to variable 'list= ' requires holding mutex 'nvme_tcp_ctrl_mutex' [-Wthread-safety-pointer] 2572 | if (list_empty(&ctrl->list)) | ^ The above warning is triggered because ctrl->list is guarded with mutex nvme_tcp_ctrl_mutex but when list_empty(&ctrl->list) is invoked it doesn't acquire nvme_tcp_ctrl_mutex. Replace list_empty() with list_empty_careful(), which is intended for lockless inspection of list heads during teardown when no concurrent list modifications are expected. This suppresses the corresponding Clang context analysis warning while preserving the existing behavior. Signed-off-by: Nilay Shroff Acked-by: Marco Elver Reviewed-by: Christoph Hellwig --- drivers/nvme/host/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 8d2fbfc7cd8d..87d8067f3283 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2579,7 +2579,7 @@ static void nvme_tcp_free_ctrl(struct nvme_ctrl *nctr= l) { struct nvme_tcp_ctrl *ctrl =3D to_tcp_ctrl(nctrl); =20 - if (list_empty(&ctrl->list)) + if (list_empty_careful(&ctrl->list)) goto free_ctrl; =20 mutex_lock(&nvme_tcp_ctrl_mutex); --=20 2.53.0 From nobody Sat Jul 25 21:19:13 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28F423EFFB9 for ; Mon, 13 Jul 2026 11:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943823; cv=none; b=UbRCp3wpCeEsgNY1VxU4Ug9BYPN6h6dcrHp52ZMogI8L1ztpx+Q7ECiVDYx+UrpWj0+SZsdMspUxdND26enmXfQ7CNIHeI7JYW57HB3jvLd/ZXxwACQjMU+yYvKEaRFjgn89ljQJ7X9blQtSvu4sjp7mFOE9d7J4l68t2gdxwK0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783943823; c=relaxed/simple; bh=QFFwStm4X14VLL7T044be08VuPX8nYUOxy/DhQ1TeRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rmvPTJ/voj9YG8tMTSMQcE063CV870AeTi/4I/nSsPSOSnu26kJao/hrFiyzfzxtghDmrlD4k9ubXCFsSZi8rzKzBCAmsD7tlEQhGqbbQi0woF3X+JujrSFl/AQGKRSEELA7XayiXq094LXp32DxRqRphU55NDdmLvo1/peMVPM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=sP40s3h0; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="sP40s3h0" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66D6gCbv1672687; Mon, 13 Jul 2026 11:55:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=ZDOuf+17wYcDr5Psy vzgD2sagqVvJYl3zxrieacw8BU=; b=sP40s3h0PJ1UnRfI+GutCcXb7unTi6I5Z fiM65EzCFVqZFK9JSggFsOf49zqp1vULnz4fMiXUNawZgIWqhC2ncF71/hENFkmW +gvK1rKSWj9XcN8vOfNZrqH/z6681WjMISPtmT8UUuKQe9KxaT6kndfSgFI1Wwl4 FsuLS4IA5bMluOZ5y+IIDUy8KqC4pEN3loDahj6zuUFTHLo68KtIp2bh2JGdfEV7 m1Bmj0HGmH9+RSONWBVidSG2NLW+7mPA6c3ORLE0T4+Wcu22WH3qyXu+Xe0gsw59 gUfhgbLT1kgiStQ7NPyjitcRHhEhRq4YodqtPXD4voKB4qu2suDWg== Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fbf2a01y5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:45 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 66DBnbMa012342; Mon, 13 Jul 2026 11:55:44 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fc0hvwk6c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Jul 2026 11:55:44 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 66DBtewD31326598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jul 2026 11:55:40 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 911FA20043; Mon, 13 Jul 2026 11:55:40 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7F2CC20040; Mon, 13 Jul 2026 11:55:38 +0000 (GMT) Received: from li-a84c74cc-2b13-11b2-a85c-acdd023f0674.bl1-in.ibm.com (unknown [9.123.7.57]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Jul 2026 11:55:38 +0000 (GMT) From: Nilay Shroff To: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: hch@lst.de, elver@google.com, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com, Nilay Shroff Subject: [PATCH v4 20/20] nvme: enable context analysis support for nvme host driver Date: Mon, 13 Jul 2026 17:24:21 +0530 Message-ID: <20260713115444.465704-21-nilay@linux.ibm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260713115444.465704-1-nilay@linux.ibm.com> References: <20260713115444.465704-1-nilay@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX2MsIQXfZDzaI JyFZYMjzTtFYBqz0DZTUXyeQ8jIOj7t/GXDXp1TlIaoy5qOCaOnrHVMTEMOAsIDtvUkzhPVtcoM 4sngP95MmCXbZ1LWGGpNM7CvO/HSOHQ= X-Proofpoint-GUID: tI3GHZRU6j72kCTiIFFlCACHr952gzcP X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzEzMDEyMiBTYWx0ZWRfX67lkLwzkfbPU L/+xoXkbqRRAvasXwzbg/+WxFZ1ALPjDsLkrV2ji9TA5MIoiMuGTfjUTImlrtp2Rzx80rD6jP6C md+Cw6Nq+O2mFpAHTU7sTAcBxld52J0DbA0Od3y5aMVPnGhgAtArtQVbm910AF2RugStrbKY5Cz 35uJcYE/Adsa+F7ou0Pm/4esNJmwhOvtNkbQ7W7wR/ZKPq6WuFZj61PDuJ6/MJiJtUjmnsjmqqh ITR2jMsG0Ca38uCOOP3RRiHbYLFtLXi0G5qT9vmWkB/4t0n0BCFdy/svFvGBa2FIeY+h6tulvKZ yBou179nivDOVqzWdSDRc41oNmxZP7rYPGtH0ToQYA+xIA1AmVjIk4+aMUJkD8CihqhN6sgl2Ia UoVi7tSwfZwz9Vr87dx+N7yRJJyPkZs9d1sX+iTDERF/GOeOwAVKDABgx6LJTgVeyKYtHdRr89F oi1IYfppUveBMFFJdww== X-Proofpoint-ORIG-GUID: pgEtUyCXozLtzFKhFCOgzL7pfTw6p54h X-Authority-Analysis: v=2.4 cv=PvajqQM3 c=1 sm=1 tr=0 ts=6a54d241 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=GVzyxF2uuL8LOb_S8PgA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-13_02,2026-07-10_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 bulkscore=0 impostorscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 spamscore=0 suspectscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607130122 Content-Type: text/plain; charset="utf-8" Update nvme host driver makefile to enable support for the Clang's context anaysis. Signed-off-by: Nilay Shroff Acked-by: Marco Elver --- drivers/nvme/host/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/Makefile b/drivers/nvme/host/Makefile index 6414ec968f99..67563a69f7dc 100644 --- a/drivers/nvme/host/Makefile +++ b/drivers/nvme/host/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 =20 +CONTEXT_ANALYSIS :=3D y ccflags-y +=3D -I$(src) =20 obj-$(CONFIG_NVME_CORE) +=3D nvme-core.o --=20 2.53.0