From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26A3FC4167B for ; Tue, 28 Nov 2023 19:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376279AbjK1TC4 (ORCPT ); Tue, 28 Nov 2023 14:02:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbjK1TCz (ORCPT ); Tue, 28 Nov 2023 14:02:55 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE22CC3 for ; Tue, 28 Nov 2023 11:03:01 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3BF7C433C8; Tue, 28 Nov 2023 19:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701198181; bh=2SQ8nvZfspwKy1et1VHxsaVcIH7exyr+AqAnPoaC4q0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qIqofS+xJmG1Hdyo9mOGQ7WWhrSLt7JnhNRiAWWhDW2eqrXLV0YqBF8x+IAXTCBAY 7SrHq5chBNn6+yG3xBeuSrOzyGVYcEB2MOLhc+OJ6mszIcKIjAU3cD7YSGSZNHvExx iYqofMI4dh+xkcF3HxISDhGdR35hcd14Lnhulw9kOXo0S9mSOVFlhtqbtXjSLHpy9K aKYswY96frh8VpfXZaUrbK9KqE3eOtZffK5w2EIBqGQpwhV1YcGJFW44LTBc9wTKsF cYf0Hnp6I6V7NSC/Lx3cziaEoI3BJc7dUG/e1U+YupqvYDFQzK8tpsFpJJWR96lSdv FOFUi6jQo9ODg== Date: Tue, 28 Nov 2023 12:02:58 -0700 From: Keith Busch To: Christoph Hellwig Cc: Daniel Wagner , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Sagi Grimberg , Hannes Reinecke Subject: Re: [RFC v1] nvme: add cse, ds, ms, nsze and nuse to sysfs Message-ID: References: <20231127103208.25748-1-dwagner@suse.de> <20231127141857.GA25833@lst.de> <20231127155649.GA1403@lst.de> <20231127163333.GA2273@lst.de> <20231128130508.GA8221@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231128130508.GA8221@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 28, 2023 at 02:05:08PM +0100, Christoph Hellwig wrote: > On Mon, Nov 27, 2023 at 09:46:43AM -0700, Keith Busch wrote: > > > > > > Yes. But does it care about the tuple size, or the actual size of the > > > metadata field even if is bigger than the PI tuple? > > > > tuple_size is the same value as metadata size regardless of PI usage. > > See nvme_init_integrity() for how this driver sets it: > > > > integrity.tuple_size = ns->ms; > > Yes, for the case where we actually support integrity in the kernel > for a given device. But if the device has a metadata size larger than > the PI size we still support it, and just let the device strip/insert > the PI. I'm pretty sure that isn't right. We already support PI regardless of the metadata size as long as the PI field is in the first 8 bytes. Strip/insert doesn't even work if metadata is larger than a PI field. For any metadata case where PI isn't used, the driver requests allocating an empty buffer for the purpose. > And if nvme-cli wants to report detailed information about > the namespace it probably needs to report the actual metadata size > as the tuple size won't be reported given that we're never initializing > the kernel PI support. I don't understand. For any namespace with a metadata size, even if the namespace format doesn't have PI support, we still register an "integrity" profile with no-ops to get that unused buffer just so the block layer can access the format. We alyways set the tuple_size to the namespace metadata-size so the kernel buffer is correctly sized. This all works as long as the metadata is separate (not extended) and kernel has CONFIG_BLK_DEV_INTEGRITY.