From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796067275; b=UEkkQ7bWJAIkzeUwBO6qQSUBeDo+RY33Ug8n0Ow/7XB5ttb5Dcgz18LkT6ZyQLqB3Tan BIwK+Z+1UyaabBO2N+PDgXrCe6rTVqGeD9LTeRa0sIcO/sWq0TCJAWQqbqJF6xLgkq8+q MUiiAP2HfLI2zcJJRi6CbUC2Ur5oczBY0ari+bX+w4sa1R5++Ow8leuMGCM5BbijvgTY1 1fjv7qb3QDAk0g2SjjXDvhWb+7lI3NM80gYnHHAM9ORcKn6oUjJzYtULbJxu7ZLsXbJbD W+Ee2qiOWtN9QktSW2mwS7yFE2HakcMUEhXSMg9Y1XGNLuwdCehjlTVTUm6ZTgrdoYg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796067275; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Jj3IbrKLY1teEJF41KErspMy9v06Lmphx47EvnLjZtA=; b=nhakrORZ0ceeo28uQDFNsPpY3SFp18dx7rN5y3H5c/W2FCFzhvF9UQQ5IR/WChWbnThI lVS31HcTtQFDIREH4yCySyyR8E3BAWkmwhQpApRsrPJr/cdjALzSjaw1lNlMK02ZzKhxX dlyy0glT8t5YpWkMSqGIWIjycRUPDk1Z5sbZrHcahBk3OXeLKow8NKVNOgwugO9dmco1L 56UJ5KwKUELNMIH8Hzb20Tgov8ASJOG4R8DPCommhRnpFk3WMBBDrIBVf/Vzs6BCWI/KN +y6wjsgllBixr0eOveiiNw5nDgNgoKcsifWb/bMusC3MjJKMrc5lFQugoEuhPYRzIUQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BFGs+r9A; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77BE4606A320 for ; Mon, 30 Nov 2026 19:34:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BFGs+r9A Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECE0D1F00896; Mon, 30 Nov 2026 19:34:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796067275; bh=Jj3IbrKLY1teEJF41KErspMy9v06Lmphx47EvnLjZtA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=BFGs+r9A/CRuWef/3O+RF4X2PhIAHLGFb0e08Q2hO7geykgElioWRG5eydU89yyeu 0CLWg+VVLrxBFFqMXvi113j7M/r/5bg94gF5Cy0xDotdZFQlB9FVFaT1wA0tFaexIZ jAM6ttd7ncCPF3j4ALZePfMBkrrrWDTxAAFtyMC7ErGZRdRJvTpQDLroNx1pwHe66n CIAMlKUSuT9On0hSOyZtl7cKP+B6sr/xjypIHGxC5qmrY8E4o2gr4zkMWKwlxevzqU vdUwtQV1IdtC5ilEItDi2sVOgxUE4Kz152Enq9sXB3DLjxXVoXQ6j+veQ+G38g7VuJ 74SPw8ir+A1mQ== Date: Mon, 30 Nov 2026 12:34:33 -0700 From: Keith Busch To: Erwan Velu Cc: Erwan Velu , linux-nvme@lists.infradead.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvme: honor the volatile write cache enable state Message-ID: References: <7fec6534-9e57-4041-8699-72c5950c7e2a@criteo.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Nov 30, 2026 at 06:10:14PM +0100, Erwan Velu wrote: > [...] > > There's just a gap with the multipath head: if you start up with WCE > > cleared, then turn it on, the head isn't updated to indicate flush > > limits. Let's get that fixed, then I'll queue this up. > Hi Keith, > > Back to this, I'll work on a v2. > > Before I do, I want to be sure I fix the right gap. With a single > controller, my understanding is that the head does pick up the change: > the Set Features triggers a rescan that we wait for, nvme_update_ns_info() > commits BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA on the path, then stacks it > on the head with queue_limits_stack_bdev(), and blk_stack_limits() > inherits both flags through BLK_FEAT_INHERIT_MASK. > > The gap I can see is with several controllers in the subsystem: the > Set Features only refreshes the controller it was sent to. The other > controllers keep WCE cleared, so their paths stay write-through. The head > is write-back, but a flush or FUA write routed through one of those > paths has REQ_PREFLUSH/REQ_FUA stripped by submit_bio_noacct(), so it > never reaches the device. > > There is also the opposite direction: since stacking only ORs the > inherited features, once the head is write-back it stays write-back > after WCE is cleared. It is harmless for data integrity, but the head > keeps reporting a write-back cache. > > Is the multi-controller case what you had in mind? If so, for v2 I plan > to refresh the WCE state and rescan every controller of the subsystem > after a successful Set Features, waiting for the rescans when the cache > gets enabled. Should I also recompute the head write cache features from > all the paths, so that clearing WCE is reflected on the head as well? You're right about the single controller case for the off->on transtion, I was mistaken there. The on->off transition will show the wrong thing on the head, but I think that's mostly harmless. Your multi-controller question turned up an existing problem when WCE is turned on: the spec says a Flush only covers commands completed by the controller it's sent to, but multipath sends it down only one path. Writes completed through another controller path aren't necessarily made durable. So sorry again, I think I really do have something to fix up ahead of your patch.