From owner-svn-src-all@FreeBSD.ORG Wed Apr 8 22:21:58 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A595E236; Wed, 8 Apr 2015 22:21:58 +0000 (UTC) Received: from mail-qk0-x22e.google.com (mail-qk0-x22e.google.com [IPv6:2607:f8b0:400d:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5883720B; Wed, 8 Apr 2015 22:21:58 +0000 (UTC) Received: by qku63 with SMTP id 63so98860549qku.3; Wed, 08 Apr 2015 15:21:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type; bh=KQq8bzcdSQFjgQ2O/duOkMbNOynfkhOJyxHvBRrnaOU=; b=n9w+JQrwDdl+oSLLAcaTczK1g4InX98qFbNm/BZg94qWQuypgOtbqQ89XYEDk1OmX5 GVnGb+GqHPFyaabyOmty9r0ToB30J4QQj6IodzRu4tgi4whC+9tIPGV0M/uRA9TiWY50 elkOHGjGfwLCtR/JkCdBnyxVgw0F2PiyJAn2TUS1y3Xc9pnLAwUxX4xNw5TU3Y7F7HPX vREFygKi2p4O+mjFOHRcAluunohG8LMZPZzBv8KTHKiW4kUlWJ7ExJ+HoVPffn9zhhKa orxK0Qa7X0sbTYKm9eE9rrjWDlLOEMxWW8E6XnrTo+y3tzq8EC8twUYomlhldr4MlNOs Yzpw== X-Received: by 10.140.104.142 with SMTP id a14mr32747457qgf.89.1428531717458; Wed, 08 Apr 2015 15:21:57 -0700 (PDT) Received: from kan ([2601:6:6780:7e0:226:18ff:fe00:232e]) by mx.google.com with ESMTPSA id n52sm8462229qge.39.2015.04.08.15.21.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Apr 2015 15:21:56 -0700 (PDT) Date: Wed, 8 Apr 2015 18:21:50 -0400 From: Alexander Kabaev To: Jim Harris Subject: Re: svn commit: r281280 - head/sys/dev/nvme Message-ID: <20150408182150.03c2b832@kan> In-Reply-To: <201504082146.t38LkJ9s058300@svn.freebsd.org> References: <201504082146.t38LkJ9s058300@svn.freebsd.org> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; amd64-portbld-freebsd11.0) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/gKo_Qk1+A/SoeC74iMfp4ua"; protocol="application/pgp-signature" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2015 22:21:58 -0000 --Sig_/gKo_Qk1+A/SoeC74iMfp4ua Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 8 Apr 2015 21:46:19 +0000 (UTC) Jim Harris wrote: > Author: jimharris > Date: Wed Apr 8 21:46:18 2015 > New Revision: 281280 > URL: https://svnweb.freebsd.org/changeset/base/281280 >=20 > Log: > nvme: fall back to a smaller MSI-X vector allocation if necessary > =20 > Previously, if per-CPU MSI-X vectors could not be allocated, > nvme(4) would fall back to INTx with a single I/O queue pair. > This change will still fall back to a single I/O queue pair, but > allocate MSI-X vectors instead of reverting to INTx. > =20 > MFC after: 1 week > Sponsored by: Intel >=20 > Modified: > head/sys/dev/nvme/nvme_ctrlr.c >=20 > Modified: head/sys/dev/nvme/nvme_ctrlr.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/nvme/nvme_ctrlr.c Wed Apr 8 21:10:13 > 2015 (r281279) +++ head/sys/dev/nvme/nvme_ctrlr.c Wed > Apr 8 21:46:18 2015 (r281280) @@ -1144,9 +1144,17 @@ > nvme_ctrlr_construct(struct nvme_control /* One vector per IO queue, > plus one vector for admin queue. */ num_vectors =3D > ctrlr->num_io_queues + 1;=20 > - if (pci_msix_count(dev) < num_vectors) { > + /* > + * If we cannot even allocate 2 vectors (one for admin, one > for > + * I/O), then revert to INTx. > + */ > + if (pci_msix_count(dev) < 2) { > ctrlr->msix_enabled =3D 0; > goto intx; > + } else if (pci_msix_count(dev) < num_vectors) { > + ctrlr->per_cpu_io_queues =3D FALSE; > + ctrlr->num_io_queues =3D 1; > + num_vectors =3D 2; /* one for admin, one for I/O */ > } > =20 > if (pci_alloc_msix(dev, &num_vectors) !=3D 0) { Huh, Linux just falls back to as many vectors as it can and just allocates them between per-cpu queues in a round-robin manner. I think is is a better approach than what we have here, would you consider it? --=20 Alexander Kabaev --Sig_/gKo_Qk1+A/SoeC74iMfp4ua Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlUlqf8ACgkQQ6z1jMm+XZbkrACgkCASyf6ZLPccX3kZ9hqpHSa4 6ZEAmQGvCWmkCdtEV94sU6F5MMttgkoz =C4p0 -----END PGP SIGNATURE----- --Sig_/gKo_Qk1+A/SoeC74iMfp4ua--