From nobody Sat May 4 17:25:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1497769641245759.0439788764415; Sun, 18 Jun 2017 00:07:21 -0700 (PDT) Received: from localhost ([::1]:37355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMUIn-0001zi-9U for importer@patchew.org; Sun, 18 Jun 2017 03:07:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMUHz-0001he-G2 for qemu-devel@nongnu.org; Sun, 18 Jun 2017 03:06:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMUHw-0006Ja-An for qemu-devel@nongnu.org; Sun, 18 Jun 2017 03:06:27 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:36655) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMUHv-0006Hw-WC for qemu-devel@nongnu.org; Sun, 18 Jun 2017 03:06:24 -0400 Received: by mail-wm0-x22b.google.com with SMTP id m125so55137369wmm.1 for ; Sun, 18 Jun 2017 00:06:23 -0700 (PDT) Received: from gmail.com ([192.115.217.6]) by smtp.gmail.com with ESMTPSA id y17sm11149483wrb.39.2017.06.18.00.06.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Jun 2017 00:06:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernelim-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=hMv8llifMFmHrwQD6NyKHvoCNQqr0uIRbsozF+BidWs=; b=rFtENz8vtP3H9rXPSsHJ0JnnyyhuZEaxTk2rQ9wfIG04qtWtLdUaRtgcnWBUuYxn8K AVP4/ghDr5QBzts+/J3KoJ/7aCJk/1EchNdKe50Akl2uDuQ6nEMO0kCg9oip6iwAgxxx +NX494SWdjeB7ydaAt2utnasdM2klcDo/SCsyOxPwPg+qnrawHeKO/bMIY8r1kGHReWp WuaxWPNEJZmezNOOey1E2EorgeHfb5Zkee1K4Bdqw+pGtNMCHdQ1bpVvRnvNJqIK1BJn t5tBQagGkmkUh2L15gQEk41zSyEkCQ8xR42fBC9ueeswuNK2YUsPho4dy3TQuQ4Lwgl/ Dkzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=hMv8llifMFmHrwQD6NyKHvoCNQqr0uIRbsozF+BidWs=; b=mhYdcfPu/UswjnbKkreqXt4eXR2w3zyRopCHlasWsaUoDhIriabk982rOuAOFbrPVz y3G//PJPPm01ylOGg1CoXrtf9STXVntNDYChWVDv07JZ1eYKWqLlcSz0JBFOoEK14iVc 8aOvSnbyYMfL/X10U3KKvEVbtXPlUqHeSVLStxIM/n3EgiBuITBmczNHkVN9g01+6M8D CTBJc7w/0eX56Fa/ojDux9iyx+wvaopmqkCMtC0VQNx7Mw/Niri9pb2mGsWgI/Q0lnvN eA+Wdn+RaqZHho1ieb7BHf7hjavfXiMwbPII181Jm45a0aQ0x3VoSl2MBa/gDY308oNd Y4gA== X-Gm-Message-State: AKS2vOzfDzxbh2/6rSwqZWQrhhZZurZ8HnV3YEw2nYDsEHSibnx8seIX AODcpKxiVL72OD5Ddbk= X-Received: by 10.28.68.135 with SMTP id r129mr11787142wma.95.1497769581894; Sun, 18 Jun 2017 00:06:21 -0700 (PDT) Date: Sun, 18 Jun 2017 10:06:17 +0300 From: Dan Aloni To: qemu-devel@nongnu.org Message-ID: <20170618070617.GA12026@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.8.0 (2017-02-23) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22b Subject: [Qemu-devel] [dan@kernelim.com: [PATCH] nvme: Fix get/set number of queues feature, again] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Keith Busch Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Comments? ----- Forwarded message from Dan Aloni ----- Date: Sun, 28 May 2017 16:06:49 +0300 From: Dan Aloni To: qemu-devel@nongnu.org Cc: Alex Friedman , Keith Busch = , Stefan Hajnoczi Subject: [PATCH] nvme: Fix get/set number of queues feature, again X-Mailer: git-send-email 2.9.4 The number of queues that should be return by the admin command should: 1) Only mention the number of non-admin queues. 2) It is zero-based, meaning that '0 =3D=3D one non-admin queue', '1 =3D=3D two non-admin queues', and so forth. Because our `num_queues` means the number of queues _plus_ the admin queue, then the right calculation for the number returned from the admin command is `num_queues - 2`, combining the two requirements mentioned. The issue was discovered by reducing num_queues from 64 to 8 and running a Linux VM with an SMP parameter larger than that (e.g. 22). It tries to utilize all queues, and therefore fails with an invalid queue number when trying to queue I/Os on the last queue. Signed-off-by: Dan Aloni CC: Alex Friedman CC: Keith Busch CC: Stefan Hajnoczi --- hw/block/nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/block/nvme.c b/hw/block/nvme.c index 7428db9f0c91..08ddf3a39e2f 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -573,7 +573,7 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) result =3D blk_enable_write_cache(n->conf.blk); break; case NVME_NUMBER_OF_QUEUES: - result =3D cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) = << 16)); + result =3D cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) = << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; @@ -594,7 +594,7 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *= cmd, NvmeRequest *req) break; case NVME_NUMBER_OF_QUEUES: req->cqe.result =3D - cpu_to_le32((n->num_queues - 1) | ((n->num_queues - 1) << 16)); + cpu_to_le32((n->num_queues - 2) | ((n->num_queues - 2) << 16)); break; default: return NVME_INVALID_FIELD | NVME_DNR; --=20 2.9.4 ----- End forwarded message ----- --=20 Dan Aloni