Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp423610ybi; Mon, 15 Jul 2019 23:22:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzGrHi8e4ERX4zmtkrpKStDpWmLCDioWA8HtPTf6Gp3ypFvUzKaP5uUK/fdYGHB+4n7M31 X-Received: by 2002:a17:902:8f81:: with SMTP id z1mr32422357plo.290.1563258129542; Mon, 15 Jul 2019 23:22:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563258129; cv=none; d=google.com; s=arc-20160816; b=nb7mA5ADX2mS+gIoSEQkAxQU6YRr9xubFTTCHQkw3UuTkDGqSm7vTzSOd6oOPGbF2I HnlWesmOCnEhI9PrH5DV4PsQ2g5IS0rGMT311kK+joVMr3i7HI4wXu9HFYCtkDI265Rm XYUckCKpz0h+hOc0UXV0n8OeoqEP941PUKms4vBT7hQ6zWw5v3uNah20N9NcK8d0CoCn 1mhagifWGJWYANquSSrkirA09Cf3kA+3dOOnGIUcSEYRCrrooKY1No3l4vL/cr5Dn7gL ehgAOdl2CBquRGmHcozkBK8O7votcrefUqxmnh1gs/xq8yTti6g7kk/vjkbUSgCEaHyq 3U8g== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=InsnwIQRqpNdDHDkTTUv+GiEGIjqBmfYNzBNd/Qv1cw=; b=Crx27Qd6DmgmqJdcbbhCOjag9yBXuhKLDQ1CgbHai7mEczBeXHaxHdaQ1YkRd8woCo 4SKpwVJzs9AVIP53oCBZ2MVSBIhEz1KeIdhoMEE8FOSzMExd0rruRgytZb4CCZFnmLbx ddKrGaw2JRnvEUA1g5+DLLeguJR6UKgJR/umL2N7bQlK8mRWH9qd2SauF6igty2F/GJb YZ0IBP6SIbu5bW4Y89NiPpr1GyxMffmI5v+1lqrDFoGNdt/9UCqkTEiYuNAys/4WuwYg 0n4KwLJCCx1MJiSnp1U0QbsMsy10A3viVjX9y86pjLjOXFxENK0YEd/Mux9qJnZ3lKpi idaQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1si12304420pff.178.2019.07.15.23.21.52; Mon, 15 Jul 2019 23:22:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730795AbfGPGVe (ORCPT + 99 others); Tue, 16 Jul 2019 02:21:34 -0400 Received: from gate.crashing.org ([63.228.1.57]:60171 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729533AbfGPGVe (ORCPT ); Tue, 16 Jul 2019 02:21:34 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x6G6LEHB010814; Tue, 16 Jul 2019 01:21:16 -0500 Message-ID: Subject: Re: [PATCH 2/3] nvme: Retrieve the required IO queue entry size from the controller From: Benjamin Herrenschmidt To: Christoph Hellwig Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Jens Axboe , Keith Busch , Paul Pawlowski Date: Tue, 16 Jul 2019 16:21:14 +1000 In-Reply-To: <20190716060430.GB29414@lst.de> References: <20190716004649.17799-1-benh@kernel.crashing.org> <20190716004649.17799-2-benh@kernel.crashing.org> <20190716060430.GB29414@lst.de> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-07-16 at 08:04 +0200, Christoph Hellwig wrote: > > > > + /* > > + * If our IO queue size isn't the default, update the setting > > + * in CC:IOSQES. > > + */ > > + if (ctrl->iosqes != NVME_NVM_IOSQES) { > > + ctrl->ctrl_config &= ~(0xfu << NVME_CC_IOSQES_SHIFT); > > + ctrl->ctrl_config |= ctrl->iosqes << NVME_CC_IOSQES_SHIFT; > > + ret = ctrl->ops->reg_write32(ctrl, NVME_REG_CC, > > + ctrl->ctrl_config); > > + if (ret) { > > + dev_err(ctrl->device, > > + "error updating CC register\n"); > > + goto out_free; > > + } > > + } > > Actually, this doesn't work on a "real" nvme controller, to change CC > values the controller needs to be disabled. Not really. The specs says that MPS, AMD and CSS need to be set before enabling, but IOCQES and IOSQES can be modified later as long as there is no IO queue created yet. This is necessary otherwise there's a chicken and egg problem. You need the admin queue to do the controller id in order to get the sizes and for that you need the controller to be enabled. Note: This is not a huge issue anyway since I only update the register if the required size isn't 6 which is probably never going to be the case on non-Apple HW. > So back to the version > you circulated to me in private mail that just sets q->sqes and has a > comment that this is magic for The Apple controller. If/when we get > standardized large SQE support we'll need to discover that earlier or > do a disable/enable dance. Sorry for misleading you down this road and > creating the extra work. I think it's still ok, let me know... Ben.