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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA258CED606 for ; Wed, 9 Oct 2024 06:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=3R8UMdCYJ6u1qdjzgLSTWsSDbL2ji3UrqXX3eFvXSy4=; b=A7xLu7/MmqfaYQaeSThAWAPamT Q6cqUAzbS34XHj33qENZ3chdTdKfnL2bcaXMsVVvCtRZMrZOJ2+7HL9Yv/J6aX/5kM+AAbNbuG/OB 9ZFk1FLyLokM6LK/UagKslMv6TZMUE9Q8VgQ9+kLl8ZviP/Nly5uPV3qbJmGGNyuAVz23iQrydcUT RdnEWHIYrENtiG4yO6PfokqzQHSgTl2jH4IKP3mo4tgrVFjWXIAYZbVLeW+RX5bS/3Ubkcdk7tRJU 99gE20+lj9lrfhpSdgYSQJBCfb/wMrv077U/6L23pzrRvCM7HzGJbGXWS+KydU3zS43sxYE2Lgfbm m8uM6q2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syQ2G-000000084gv-0fU0; Wed, 09 Oct 2024 06:19:00 +0000 Received: from smtp-out2.suse.de ([2a07:de40:b251:101:10:150:64:2]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syPzp-000000084Bc-2GVF for linux-nvme@lists.infradead.org; Wed, 09 Oct 2024 06:16:32 +0000 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5D0EB1FE73; Wed, 9 Oct 2024 06:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728454586; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3R8UMdCYJ6u1qdjzgLSTWsSDbL2ji3UrqXX3eFvXSy4=; b=1/lJZdfGjiZ+7uPaiXe8MiZumN6mcL97DUThe+ZUc3fo3oefjYcgqMORKY2wov1ngdN/w7 zjf08R7sCJ64lIP/aFB/HKqMHV/LAyGeZRj3+2Q6ctyMZEiTUY1TV19pFhY16yS8iT5fVh KiM3rez/9ywM9KPtLwXPRoKTF1mzHu4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728454586; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3R8UMdCYJ6u1qdjzgLSTWsSDbL2ji3UrqXX3eFvXSy4=; b=NwAhINPKyVLEFLzpuokmrQahsKghdOu//b4R73gG/9AV5X+7wvHnDIAtvBOnX6/yt4QscJ zNk9/jUfsooLCmCQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="1/lJZdfG"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=NwAhINPK DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1728454586; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3R8UMdCYJ6u1qdjzgLSTWsSDbL2ji3UrqXX3eFvXSy4=; b=1/lJZdfGjiZ+7uPaiXe8MiZumN6mcL97DUThe+ZUc3fo3oefjYcgqMORKY2wov1ngdN/w7 zjf08R7sCJ64lIP/aFB/HKqMHV/LAyGeZRj3+2Q6ctyMZEiTUY1TV19pFhY16yS8iT5fVh KiM3rez/9ywM9KPtLwXPRoKTF1mzHu4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1728454586; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3R8UMdCYJ6u1qdjzgLSTWsSDbL2ji3UrqXX3eFvXSy4=; b=NwAhINPKyVLEFLzpuokmrQahsKghdOu//b4R73gG/9AV5X+7wvHnDIAtvBOnX6/yt4QscJ zNk9/jUfsooLCmCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F0DEB136BA; Wed, 9 Oct 2024 06:16:25 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id nRQEObkfBmfzJAAAD6G6ig (envelope-from ); Wed, 09 Oct 2024 06:16:25 +0000 Message-ID: Date: Wed, 9 Oct 2024 08:16:25 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] nvme: make independent ns identify default To: =?UTF-8?Q?Matias_Bj=C3=B8rling?= , kbusch@kernel.org, hch@lst.de, dlemoal@kernel.org, cassel@kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?Q?Matias_Bj=C3=B8rling?= References: <20241008145503.987195-1-m@bjorling.me> <20241008145503.987195-2-m@bjorling.me> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20241008145503.987195-2-m@bjorling.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5D0EB1FE73 X-Rspamd-Action: no action X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[9]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:mid,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_231629_761620_F30C4509 X-CRM114-Status: GOOD ( 23.42 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On 10/8/24 16:55, Matias Bjørling wrote: > From: Matias Bjørling > > The NVMe 2.0 specification adds an independent identify namespace > data structure that contains generic attributes that apply to all > namespace types. Some attributes carry over from the NVM command set > identify namespace data structure, and others are new. > > Currently, the data structure only considered when CRIMS is enabled or > when the namespace type is key-value. > > However, the independent namespace data structure > is mandatory for devices that implement features from the 2.0+ > specification. Therefore, we can check this data structure first. If > unavailable, retrieve the generic attributes from the NVM command set > identify namespace data structure. > > Signed-off-by: Matias Bjørling > --- > drivers/nvme/host/core.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c > index 0dc8bcc664f2..9cbef6342c39 100644 > --- a/drivers/nvme/host/core.c > +++ b/drivers/nvme/host/core.c > @@ -3999,7 +3999,7 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid) > { > struct nvme_ns_info info = { .nsid = nsid }; > struct nvme_ns *ns; > - int ret; > + int ret = 1; > > if (nvme_identify_ns_descs(ctrl, &info)) > return; > @@ -4015,10 +4015,9 @@ static void nvme_scan_ns(struct nvme_ctrl *ctrl, unsigned nsid) > * data structure to find all the generic information that is needed to > * set up a namespace. If not fall back to the legacy version. > */ > - if ((ctrl->cap & NVME_CAP_CRMS_CRIMS) || > - (info.ids.csi != NVME_CSI_NVM && info.ids.csi != NVME_CSI_ZNS)) > + if (!nvme_ctrl_limited_cns(ctrl)) > ret = nvme_ns_info_from_id_cs_indep(ctrl, &info); > - else > + if (ret > 0) > ret = nvme_ns_info_from_identify(ctrl, &info); > > if (info.is_removed) That is a very odd coding. 'info' will only be filled out for a non-zero return value of nvme_ns_info_from_cs_indep(). So why not check for that? But if we get an NVME status back there is a fair chance that something else than 'invalid field' (or whatever indicated that the command is not supported). That then would cause the device to be misdetected without the admin knowning. Shouldn't we add a message if we fall back to nvme_ns_info_from_identify()? Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich