Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp218726yba; Wed, 17 Apr 2019 23:24:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0csBwn0zcHR6H6f4Slb8SglVOsvm5O471FbeUYPXMjNkfi6Hco9odiCV8k7ycBzeVTU0u X-Received: by 2002:a62:aa06:: with SMTP id e6mr4448584pff.254.1555568696066; Wed, 17 Apr 2019 23:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555568696; cv=none; d=google.com; s=arc-20160816; b=D5xPT9/cZkoRCCQJvQYqxYDe+YZAitbf6JzxaUF5HmLFFpYzOP9UnKwdW6jFcKoWHQ BDCYOXScs7wuWfwKyVldg/hNGoPgMNadm51JVxRSJCyP+x7JaGq4g9Mq7kXJ4Mu69aqB LU4ZEfw2Uosisc+7sxTkJDVGjR+G9URCWmP+/UhLmEV2hiWC94ouQdTiR7ioTmCmR6X9 lmS7TbypAzI2K4n869bt7Q0+L/cKT8gxSaiw595DmW/Nr6v9+3mL9QxaNnyAos6KMQyd 5DJdo1LbmoZwtzQJXUbd3+xiCXHrZbelTQPaS/GqasekaY5o5HOhAILb0vnKjO5TFW4A l2mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:to:subject; bh=1NfmU/a+2SSJl2SluYtNeVIznC4Q3R0z+IBsslY4MKw=; b=bNtTA+GybLnlvGCNeJOuZi2o+HA26SYi4ucn5FRXxCV/r+m3SfYoAB+B4x8HmU3zKp APTIaogUqCqnyYX46FMYH0kp9tJ/2aDEAmOKl2ZbruE1TxGaQVd482dQJAXFpi3O5cJZ WZgPcJYVZpiFJrekcsL3gB8WR8Zc/T8BTbZ8LqWpvJzY7Qy+ZvglDj/ccJfeUvaHac7A vQ77HQpD0L3GZETYnC+q6lbsl+CT53UEfKUmtr1UujGfo3iHcPV7o3VU+sfWGjzbFfAz CBeJy4wTjIakYEFs642FVTytBFgUkJoJshDqRiIzkofYPaJ4W/8HfpfwNzGDPduCoeOU eqbw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si1017941pgq.84.2019.04.17.23.24.41; Wed, 17 Apr 2019 23:24:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388115AbfDRGWJ (ORCPT + 99 others); Thu, 18 Apr 2019 02:22:09 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58984 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733067AbfDRGWI (ORCPT ); Thu, 18 Apr 2019 02:22:08 -0400 Received: from [125.35.49.90] (helo=[10.0.0.40]) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hH0Qt-00065n-9J; Thu, 18 Apr 2019 06:22:03 +0000 Subject: Re: [PATCH] nvme: determine the number of IO queues To: Maxim Levitsky , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, keith.busch@intel.com, axboe@fb.com References: <1555510379-20199-1-git-send-email-aaron.ma@canonical.com> <096935354b16662eb481aeda1f48001ba489463c.camel@redhat.com> From: Aaron Ma Openpgp: preference=signencrypt Autocrypt: addr=aaron.ma@canonical.com; prefer-encrypt=mutual; keydata= mQENBFffeLkBCACi4eE4dPsgWN6B9UDOVcAvb5QgU/hRG6yS0I1lGKQv4KA+bke0c5g8clbO 9gIlIl2bityfA9NzBsDik4Iei3AxMbFyxv9keMwcOFQBIOZF0P3f05qjxftF8P+yp9QTV4hp BkFzsXzWRgXN3r8hU8wqZybepF4B1C83sm2kQ5A5N0AUGbZli9i2G+/VscG9sWfLy8T7f4YW MjmlijCjoV6k29vsmTWQPZ7EApNpvR5BnZQPmQWzkkr0lNXlsKcyLgefQtlwg6drK4fe4wz0 ouBIHJEiXE1LWK1hUzkCUASra4WRwKk1Mv/NLLE/aJRqEvF2ukt3uVuM77RWfl7/H/v5ABEB AAG0IUFhcm9uIE1hIDxhYXJvbi5tYUBjYW5vbmljYWwuY29tPokBNwQTAQgAIQUCV994uQIb AwULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRDNxCzQfVU6ntJ9B/9aVy0+RkLqF9QpLmw+ LAf1m3Fd+4ZarPTerqDqkLla3ekYhbrEtlI1mYuB5f+gtrIjmcW27gacHdslKB9YwaL8B4ZB GJKhcrntLg4YPzYUnXZkHHTv1hMw7fBYw82cBT+EbG0Djh6Po6Ihqyr3auHhfFcp1PZH4Mtq 6hN5KaDZzF/go+tRF5e4bn61Nhdue7mrhFSlfkzLG2ehHWmRV+S91ksH81YDFnazK0sRINBx V1S8ts3WJ2f1AbgmnDlbK3c/AfI5YxnIHn/x2ZdXj1P/wn7DgZHmpMy5DMuk0gN34NLUPLA/ cHeKoBAF8emugljiKecKBpMTLe8FrVOxbkrauQENBFffeLkBCACweKP3Wx+gK81+rOUpuQ00 sCyKzdtMuXXJ7oL4GzYHbLfJq+F+UHpQbytVGTn3R5+Y61v41g2zTYZooaC+Hs1+ixf+buG2 +2LZjPSELWPNzH9lsKNlCcEvu1XhyyHkBDbnFFHWlUlql3nSXMo//dOTG/XGKaEaZUxjCLUC 8ehLc16DJDvdXsPwWhHrCH/4k92F6qQ14QigBMsl75jDTDJMEYgRYEBT1D/bwxdIeoN1BfIG mYgf059RrWax4SMiJtVDSUuDOpdwoEcZ0FWesRfbFrM+k/XKiIbjMZSvLunA4FIsOdWYOob4 Hh0rsm1G+fBLYtT+bE26OWpQ/lSn4TdhABEBAAGJAR8EGAEIAAkFAlffeLkCGwwACgkQzcQs 0H1VOp6p5Af/ap5EVuP1AhFdPD3pXLNrUUt72W3cuAOjXyss43qFC2YRjGfktrizsDjQU46g VKoD6EW9XUPgvYM+k8BJEoXDLhHWnCnMKlbHP3OImxzLRhF4kdlnLicz1zKRcessQatRpJgG NIiD+eFyh0CZcWBO1BB5rWikjO/idicHao2stFdaBmIeXvhT9Xp6XNFEmzOmfHps+kKpWshY 9LDAU0ERBNsW4bekOCa/QxfqcbZYRjrVQvya0EhrPhq0bBpzkIL/7QSBMcdv6IajTlHnLARF nAIofCEKeEl7+ksiRapL5Nykcbt4dldE3sQWxIybC94SZ4inENKw6I8RNpigWm0R5w== Message-ID: Date: Thu, 18 Apr 2019 14:21:57 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <096935354b16662eb481aeda1f48001ba489463c.camel@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/18/19 1:33 AM, Maxim Levitsky wrote: > On Wed, 2019-04-17 at 20:32 +0300, Maxim Levitsky wrote: >> On Wed, 2019-04-17 at 22:12 +0800, Aaron Ma wrote: >>> Some controllers support limited IO queues, when over set >>> the number, it will return invalid field error. >>> Then NVME will be removed by driver. >>> >>> Find the max number of IO queues that controller supports. >>> When it still got invalid result, set 1 IO queue at least to >>> bring NVME online. >> To be honest a spec compliant device should not need this. >> The spec states: >> >> "Number of I/O Completion Queues Requested (NCQR): Indicates the number of I/O >> Completion >> Queues requested by software. This number does not include the Admin >> Completion >> Queue. A >> minimum of one queue shall be requested, reflecting that the minimum support >> is >> for one I/O >> Completion Queue. This is a 0’s based value. The maximum value that may be >> specified is 65,534 >> (i.e., 65,535 I/O Completion Queues). If the value specified is 65,535, the >> controller should return >> an error of Invalid Field in Command." >> >> >> This implies that you can ask for any value and the controller must not >> respond >> with an error, but rather indicate how many queues it supports. >> >> Maybe its better to add a quirk for the broken device, which needs this? Adding quirk only makes the code more complicated. This patch doesn't change the default behavior. Only handle the NVME error code. Yes the IO queues number is 0's based, but driver would return error and remove the nvme device as dead. So set it as 1 at least the NVME can be probed properly. Regards, Aaron > I forgot to add the relevant paragraph: > > "Note: The value allocated may be smaller or larger than the number of queues > requested, often in virtualized > implementations. The controller may not have as many queues to allocate as are > requested. Alternatively, > the controller may have an allocation unit of queues (e.g. power of two) and may > supply more queues to > host software to satisfy its allocation unit." > > > Best regards, > Maxim Levitsky >