Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=199.89.1.16 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796318940; b=0gxVS8DzV5DY0JXki+wY6gwV+c97Vgb/GqtMQ2nb41PXFSlzdfGju0QWuJ5W/oWUG1/4 IoqpSBBRD83zqnv7Gyg7LBZlBAfZIFNC7zPvTC9CBA1ZEbBDDrrXrKvFz+tOE2Y6mbpVG h71MfXb5BXEp0g4/W+CgebesmH87kvuSrbbPlaLIv8xXsaz2lLVbyYCipoJ4PieKj9hho BBDSoFfE9TkVI+6RJFr5OmxceCJ7OA6sMhrhHGm1xd7Mz4yQXFlilBN+7Xgj9siII1Nhw 9AG1iqGMejtvgxTDllyrddjtquc28WpS3D0Bxq/puka44i6EQv8eN5NcKIda6rQYVAg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796318940; h=DMARC-Filter:Received:DKIM-Signature:X-Virus-Scanned:Received: Received:Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc: References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=Ct1n40QB+1dCTPcpELABaq2RW05HxquMo57jdPBMIQo=; b=xEDI5F6yzKyXNKVfNwkwIOIcCObMYQJhb+4HmpP7i1PShwOuFrselo2LU6BeUS0V91MX evjnPCUl1pstWfRRYmuJvi1bkiN2txLFpCiTBljYGy3xsi4ExyMCxp/yYhye6cfdlvdGg Ie5/cdNas34mqtYbDgDr9jkJcWNhgj5/6lx+nyhgLLN/fNB4pRXvaCyI0IH/Gt2oAdC3/ FO8LLVdBgDuKkXqy2s4bu2IEi9S30jDZvWIl3pwk52NREr04I0FF70poRQRW5TjjzzFXc Qz5cOrUYPB2XD7MtPmy3D6zdwLAbbMVNZ3mXS5iGzywgubzj80tsHn/aLwrcZh95S+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=E7M5zS8y; arc=none smtp.remote-ip=199.89.1.16 Received: from 013.lax.mailroute.net (013.lax.mailroute.net [199.89.1.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE08F606A322 for ; Thu, 3 Dec 2026 17:28:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DE08F606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=acm.org header.i=@acm.org header.a=rsa-sha256 header.s=mr01 header.b=E7M5zS8y Received: from localhost (localhost [127.0.0.1]) by 013.lax.mailroute.net (Postfix) with ESMTP id 4jgM6z2nmszlfvq4; Thu, 3 Dec 2026 17:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=mr01; t=1796318937; x=1798910938; bh=Ct1n40QB+1dCTPcpELABaq2R W05HxquMo57jdPBMIQo=; b=E7M5zS8yKL7Z2Y3Ofhb+Vt//YnkXedu8QutP130j 7LMgpmnp64KC4ZuSOWO9phmbHkYSEE9GOwTLsiCnG8RQUAhzisvqa7o7X3pjgI6O q4Yod14yU07OBe0c7QqmxBh9uLAQcfVqLGgpR5In5HAh2CFZ+/HIWXxLAsOjDd0C L3HxjxUm+4E4nYManrBrxE5VIdblE7eqcS3/S3Li0Z8sxQz+HcHr/UP6ghmQYYWy SlSTmDMN9T6eINElnMN7plroT1PrTMvR7utJeX19B9Kfx2zM5ilLHG2P92vNE5N3 UWsTO6MOa4Lt0usQN/yXc6wiVbX+sq/IVayRgI7aGdCi7Q== X-Virus-Scanned: by MailRoute Received: from 013.lax.mailroute.net ([127.0.0.1]) by localhost (013.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id h1IqZUX82QHA; Thu, 3 Dec 2026 17:28:57 +0000 (UTC) Received: from [100.77.36.205] (unknown [104.135.183.85]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 013.lax.mailroute.net (Postfix) with ESMTPSA id 4jgM6x1X46zlfvq2; Thu, 3 Dec 2026 17:28:57 +0000 (UTC) Message-ID: <64e8384f-10b6-4245-95ac-b343de0dc12f@acm.org> Date: Thu, 3 Dec 2026 09:28:56 -0800 X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 29/52] blk-zoned: Add lock context annotations To: Damien Le Moal , Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig References: <700c5117bd2401b4c60fc1f9293dca58550498e3.1796261587.git.bvanassche@acm.org> Content-Language: en-US From: Bart Van Assche In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/2/26 11:43 PM, Damien Le Moal wrote: > On 2026/12/03 10:59, Bart Van Assche wrote: >> Annotate the zone write plug functions that are called with >> zwplug->lock held with __must_hold(&zwplug->lock): >> - disk_zone_wplug_abort() >> - disk_mark_zone_wplug_dead() >> - disk_check_zone_wplug_dead() >> - disk_zone_wplug_update_cond() >> - disk_zone_wplug_set_wp_offset() >> - disk_zone_wplug_schedule_work() >> - disk_zone_wplug_add_bio() >> - blk_zone_wplug_prepare_bio() >> >> Annotate the zone revalidation functions that are called with >> disk->zone_revalidate_mutex held with >> __must_hold(&disk->zone_revalidate_mutex): >> - disk_revalidate_capacity() >> - disk_alloc_zone_resources() >> - disk_init_revalidate_args() >> - disk_revalidate_zone_resources() >> - disk_revalidate_zones() >> >> Signed-off-by: Bart Van Assche > > [...] > >> @@ -826,6 +827,7 @@ static void disk_zone_wplug_abort(struct blk_zone_wplug *zwplug) >> * unhashed when its last reference is dropped. >> */ >> static void disk_mark_zone_wplug_dead(struct blk_zone_wplug *zwplug) >> + __must_hold(&zwplug->lock) >> { >> lockdep_assert_held(&zwplug->lock); > > Since we already have this assert, what does the __must_hold() do exactly? Hi Damien, lockdep_assert_held() verifies at run-time whether a lock is held and only if CONFIG_LOCKDEP is enabled. __must_hold() verifies at compile time whether all callers hold the specified lock. Today only Clang >= 23 performs this compile-time check. Even if a kernel developer who publishes a kernel patch is not using Clang, the kernel test robot will build published patches with Clang. Additionally, I'm working on implementing support in Sparse for the Clang thread-safety attributes. Bart.