From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Ellerman Subject: Re: [PATCH RFC 00/77] Re-design MSI/MSI-X interrupts enablement pattern Date: Tue, 8 Oct 2013 15:33:30 +1100 Message-ID: <20131008043330.GF31666@concordia> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" To: Alexander Gordeev Cc: linux-mips@linux-mips.org, VMware@dhcp-26-207.brq.redhat.com, "Inc." , linux-nvme@lists.infradead.org, linux-ide@vger.kernel.org, linux-s390@vger.kernel.org, Andy King , linux-scsi@vger.kernel.org, linux-rdma@vger.kernel.org, x86@kernel.org, Ingo Molnar , linux-pci@vger.kernel.org, iss_storagedev@hp.com, linux-driver@qlogic.com, Tejun Heo , Bjorn Helgaas , Dan Williams , Jon Mason , Solarflare linux maintainers , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ralf Baechle , e1000-devel@lists.sourceforge.net, Martin Schwidefsky , linux390@de.ibm.com, linuxppc-dev@lists.ozlabs.org List-Id: linux-ide@vger.kernel.org On Wed, Oct 02, 2013 at 12:29:04PM +0200, Alexander Gordeev wrote: > This series is against "next" branch in Bjorn's repo: > git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git > > Currently pci_enable_msi_block() and pci_enable_msix() interfaces > return a error code in case of failure, 0 in case of success and a > positive value which indicates the number of MSI-X/MSI interrupts > that could have been allocated. The latter value should be passed > to a repeated call to the interfaces until a failure or success: > > > for (i = 0; i < FOO_DRIVER_MAXIMUM_NVEC; i++) > adapter->msix_entries[i].entry = i; > > while (nvec >= FOO_DRIVER_MINIMUM_NVEC) { > rc = pci_enable_msix(adapter->pdev, > adapter->msix_entries, nvec); > if (rc > 0) > nvec = rc; > else > return rc; > } > > return -ENOSPC; > > > This technique proved to be confusing and error-prone. Vast share > of device drivers simply fail to follow the described guidelines. To clarify "Vast share of device drivers": - 58 drivers call pci_enable_msix() - 24 try a single allocation and then fallback to MSI/LSI - 19 use the loop style allocation as above - 14 try an allocation, and if it fails retry once - 1 incorrectly continues when pci_enable_msix() returns > 0 So 33 drivers (> 50%) successfully make use of the "confusing and error-prone" return value. Another 24 happily ignore it, which is also entirely fine. And yes, one is buggy, so obviously the interface is too complex. Thanks drivers/ntb/ntb_hw.c cheers From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 08 Oct 2013 06:33:39 +0200 (CEST) Received: from ozlabs.org ([203.10.76.45]:57610 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S6819547Ab3JHEdgpDYHX (ORCPT ); Tue, 8 Oct 2013 06:33:36 +0200 Received: from concordia (ibmaus65.lnk.telstra.net [165.228.126.9]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPSA id C01462C00A2; Tue, 8 Oct 2013 15:33:30 +1100 (EST) Date: Tue, 8 Oct 2013 15:33:30 +1100 From: Michael Ellerman To: Alexander Gordeev Cc: linux-kernel@vger.kernel.org, Bjorn Helgaas , Ralf Baechle , Benjamin Herrenschmidt , Martin Schwidefsky , Ingo Molnar , Tejun Heo , Dan Williams , Andy King , Jon Mason , Matt Porter , linux-pci@vger.kernel.org, linux-mips@linux-mips.org, linuxppc-dev@lists.ozlabs.org, linux390@de.ibm.com, linux-s390@vger.kernel.org, x86@kernel.org, linux-ide@vger.kernel.org, iss_storagedev@hp.com, linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net, linux-driver@qlogic.com, Solarflare linux maintainers , VMware@dhcp-26-207.brq.redhat.com, "Inc." , linux-scsi@vger.kernel.org Subject: Re: [PATCH RFC 00/77] Re-design MSI/MSI-X interrupts enablement pattern Message-ID: <20131008043330.GF31666@concordia> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 38246 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: michael@ellerman.id.au Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On Wed, Oct 02, 2013 at 12:29:04PM +0200, Alexander Gordeev wrote: > This series is against "next" branch in Bjorn's repo: > git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git > > Currently pci_enable_msi_block() and pci_enable_msix() interfaces > return a error code in case of failure, 0 in case of success and a > positive value which indicates the number of MSI-X/MSI interrupts > that could have been allocated. The latter value should be passed > to a repeated call to the interfaces until a failure or success: > > > for (i = 0; i < FOO_DRIVER_MAXIMUM_NVEC; i++) > adapter->msix_entries[i].entry = i; > > while (nvec >= FOO_DRIVER_MINIMUM_NVEC) { > rc = pci_enable_msix(adapter->pdev, > adapter->msix_entries, nvec); > if (rc > 0) > nvec = rc; > else > return rc; > } > > return -ENOSPC; > > > This technique proved to be confusing and error-prone. Vast share > of device drivers simply fail to follow the described guidelines. To clarify "Vast share of device drivers": - 58 drivers call pci_enable_msix() - 24 try a single allocation and then fallback to MSI/LSI - 19 use the loop style allocation as above - 14 try an allocation, and if it fails retry once - 1 incorrectly continues when pci_enable_msix() returns > 0 So 33 drivers (> 50%) successfully make use of the "confusing and error-prone" return value. Another 24 happily ignore it, which is also entirely fine. And yes, one is buggy, so obviously the interface is too complex. Thanks drivers/ntb/ntb_hw.c cheers From mboxrd@z Thu Jan 1 00:00:00 1970 From: michael@ellerman.id.au (Michael Ellerman) Date: Tue, 8 Oct 2013 15:33:30 +1100 Subject: [PATCH RFC 00/77] Re-design MSI/MSI-X interrupts enablement pattern In-Reply-To: References: Message-ID: <20131008043330.GF31666@concordia> On Wed, Oct 02, 2013@12:29:04PM +0200, Alexander Gordeev wrote: > This series is against "next" branch in Bjorn's repo: > git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git > > Currently pci_enable_msi_block() and pci_enable_msix() interfaces > return a error code in case of failure, 0 in case of success and a > positive value which indicates the number of MSI-X/MSI interrupts > that could have been allocated. The latter value should be passed > to a repeated call to the interfaces until a failure or success: > > > for (i = 0; i < FOO_DRIVER_MAXIMUM_NVEC; i++) > adapter->msix_entries[i].entry = i; > > while (nvec >= FOO_DRIVER_MINIMUM_NVEC) { > rc = pci_enable_msix(adapter->pdev, > adapter->msix_entries, nvec); > if (rc > 0) > nvec = rc; > else > return rc; > } > > return -ENOSPC; > > > This technique proved to be confusing and error-prone. Vast share > of device drivers simply fail to follow the described guidelines. To clarify "Vast share of device drivers": - 58 drivers call pci_enable_msix() - 24 try a single allocation and then fallback to MSI/LSI - 19 use the loop style allocation as above - 14 try an allocation, and if it fails retry once - 1 incorrectly continues when pci_enable_msix() returns > 0 So 33 drivers (> 50%) successfully make use of the "confusing and error-prone" return value. Another 24 happily ignore it, which is also entirely fine. And yes, one is buggy, so obviously the interface is too complex. Thanks drivers/ntb/ntb_hw.c cheers