From mboxrd@z Thu Jan 1 00:00:00 1970 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 3DD073BB11D for ; Wed, 1 Jul 2026 07:50:40 +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=1782892241; cv=none; b=s+ztSHPd4Alr25IOZ6Sji+K39Hxyy1CbyfeSKuZZZFEZZvRXAXMNjeGMtpIX2NOuVoMP85HHS50GUx6a7MpgmIipPzqM2Iy6VE9gI267dHjpKUcmy6kqoC1eG9w6qPw9LseNnt6km3+/rueOTE6ulgOLrDYuMILRgLBV8biBQgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782892241; c=relaxed/simple; bh=EhGdJ6i2lFHqTHyiJ3+Mti53P643BV8ZVl1pK12E4TA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WAYI8qjOLKqx7eoLZcAPoiGNi3ONvnr6Q4aHX40F3lkyeM1hjhbexH6f0IQuroTAeBHqpqLGWc/5YLu6vVEHoRNwyKexPa/DUliKllImOv/7q7rkbiOZMaK1XhTYxACPtf1wwnkvuMSu0mTGrUFZ4goqh0Peq6xyIWboYDs7OTI= 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=qrTsMb8B; 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="qrTsMb8B" 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 6613ITbR3867661; Wed, 1 Jul 2026 07:50:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=j7yjBx n+RXlqEyGtEL1doJnueXp/GEdmgWXccPGDj50=; b=qrTsMb8BjVysxPdBYsHgmX 6IY1IJ9fiXZag7L3GjFmqxVLpYhNVzdMJe58prrHotRO+tZ1DT3x65bmrzjHvZpL E46RyOal7ntf6yByyhrPjXYXaDx7iGLoLLzr/peyQ5i26wSDt5Jm4hUCJZKBPHJh ev4J7IqAktL+KuPPVmZ0h/BhwlDHfS8w7FtGf0PLJ96Y0enYbmCN7X3XE+5qlErI ND9im9RBr1lzfv+1Z9I27LAcM046GoWuz/bnlChYBn/AU3OegCcVsc0kkg4+2hof s+wvf6hqiRir4BZHz4mqF24JLRvw1QUbZSF4SvHxvxCJSXeOyv9/wRpM/JtGbpyQ == 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 4f26n5u8hq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Jul 2026 07:50: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 6617nfXi010409; Wed, 1 Jul 2026 07:50:25 GMT Received: from smtprelay04.wdc07v.mail.ibm.com ([172.16.1.71]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4f2s7w6bqb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 01 Jul 2026 07:50:25 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (smtpav01.wdc07v.mail.ibm.com [10.39.53.228]) by smtprelay04.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6617oOmx55574820 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 1 Jul 2026 07:50:24 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B9C8B58063; Wed, 1 Jul 2026 07:50:24 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 324A458059; Wed, 1 Jul 2026 07:50:21 +0000 (GMT) Received: from [9.43.78.19] (unknown [9.43.78.19]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 1 Jul 2026 07:50:20 +0000 (GMT) Message-ID: Date: Wed, 1 Jul 2026 13:20:19 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv2 14/17] nvme: fix Clang context analysis warning in rdma.c To: Marco Elver Cc: Christoph Hellwig , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, kbusch@kernel.org, sagi@grimberg.me, axboe@fb.com, bvanassche@acm.org, gjoyce@linux.ibm.com References: <20260614131541.2017845-1-nilay@linux.ibm.com> <20260614131541.2017845-15-nilay@linux.ibm.com> <20260626064916.GC11106@lst.de> <20260629125054.GC23695@lst.de> <4fba3fdb-73df-4cd0-9318-00ff5a1e4fe6@linux.ibm.com> Content-Language: en-US From: Nilay Shroff In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzAxMDA3OCBTYWx0ZWRfX+QgTZy0TbngW vaFjrjb3Ik/Cy++MGymWXNKRnFPi3DZJhu0dFRGS4+w6Nl4RBcUUb5UGaq4G+xh3SSJFgpPChEr UxCCSKXLcUVTFIaU8iUbw9xgbJ0HyukyCoX+xmDhHRgurEL2X+mxWhBSiE57pLK61ny/QmepPsi 1wqC3bMiFyrniV/7bdG5COnRwV1y0cSNmevGhZMDpCSv5Y1FFkDCtzEIqwqDpBsxTdJ45fOKUn4 Xm2ivXczz7M7l5NnTQtmwY+sLkes6a/t5zQztFyQWlA0eqJl+PdhNdAZQ+NZ3phFWyZVd1zjkfJ OQX6MXGuqD9VeKdyrtb5n6A02CpA/E+d+/LDJAzGuohYTldAFHBxoaSJ9Z/ITNf8k8KwBms5U5b u+qWFww79ICRxAwNANON6nEdFnaqRFqOqXtmxyHLlcOhbxGPvHiLXNh5o/g9TeS34mAfncsD9IV juNQpnosKOHbrrCBERA== X-Authority-Analysis: v=2.4 cv=V45NF+ni c=1 sm=1 tr=0 ts=6a44c6c2 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=U7nrCbtTmkRpXpFmAIza:22 a=1XWaLZrsAAAA:8 a=3hIta75tlVvESI0EOnUA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: kXYas2i8sCdRJdWU2SNm9Bdsk7K-D7ur X-Proofpoint-GUID: YtEDIEQDcBMfrNSlcSlFZKTOl2CaEcGw X-Proofpoint-Spam-Info: AW1haW4tMjYwNzAxMDA3OCBTYWx0ZWRfX1jponuy6qqkO 4b4DsyAMm4tpsqLIPBcK8G8IgtANQ9b6RTJkBu8AhC7LnDMfq86gzW5oEtVDf+trsq3uUSJ9Wkn lvJjjejYRzs1nww7IPsmwDN0ovFXdgE= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-07-01_01,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 clxscore=1015 impostorscore=0 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607010078 > > See patch below; to avoid more dependency issues for you, I suggest you > pick it up and carry it as part of this series unless someone else wants > it before for other reasons. > > Only lightly tested, please test. > Thanks! this is useful and it's working as expected. So, yes I will pick it up and send out while I spin the next version of this series. > ------ >8 ------ > > From: Marco Elver > Date: Tue, 30 Jun 2026 12:01:26 +0200 > Subject: [PATCH] list: Permit context-unguarded access with > list_empty_careful() > > 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 [...] [-Wthread-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 > --- > include/linux/list.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/linux/list.h b/include/linux/list.h > index 09d979976b3b..ba3c255f6112 100644 > --- a/include/linux/list.h > +++ b/include/linux/list.h > @@ -436,6 +436,7 @@ static inline void list_del_init_careful(struct list_head *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 = smp_load_acquire(&head->next); > return list_is_head(next, head) && (next == READ_ONCE(head->prev)); Thanks, --Nilay