Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1232148ybi; Fri, 21 Jun 2019 16:59:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqwI0yYFOGeI0Olk2QFesQrQQ4eC9tgKeH82AOn3RQVaJMfAxTj0L2eOtc6d2D//h8jUhdvS X-Received: by 2002:a17:902:e01:: with SMTP id 1mr3877414plw.268.1561161569070; Fri, 21 Jun 2019 16:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561161569; cv=none; d=google.com; s=arc-20160816; b=gwWqgx1tMVkIYTUZqpsvl8iIBChYZFGMCmYclN3492DF4rxt9Y6GRR4XKA7gTk8bJb 2He64lU5NhmHi02zQ+pY17IXia7L7z9++M5OvL/+yCnSYcJJYUcc66PZk/zFFP7wHL3k aBwycpBUNU0O5CjaWCFXIotS/DQW+yRTQ1sFOL52jhKJ4t5VLlXxV6pe8OQ04VdFZmWU 493i8mnaLCaDJpEf1pd3hj5G1wb9vk2wPmXCTOneRXWACBkTpAXp1blQcaUtEDZGKvdR H/QC000bNRrF/dl6GorHZD6CtRuleo2K6lgFNAl3b6eWZnSwMpMD5jZsEFD2ass2Uxrp Gn2Q== 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 :message-id:date:subject:cc:to:from; bh=pserPenwVNvR2PtOPAnURcBfsy7klh27cgldRZdy9hk=; b=SFsXiX1H8jXC7yIexF3tUKQNWeG+b8aC3CcF1yNH+40ATHEaskzRlAccfdzUlDbcaN jc6JSniR/S4CEouGhXQTmURkuVmO7oYs3IuBBpKRmxT9rh7ou0ZyJHtG9hkTd/vJphrB EZRcQmVnTZXiHgxpItLpa9CHVmc58e2h4PJTO4vjQrxzkM8EQu6fzj2QKVxIJWkcNLQs hpN4gR7tpTLfRXh24rlJz1OG/fGa8sqwU7Dyq0+hLr3W9W4MFNW/C+KrPtPaByjw+YjH R8a3iT6pWH7Vzr7lF1cseHxYgxIrOyNAmRTmLjeaTV9oMy9+Hi+XXNyT3sDUDU5TuR6M 64CQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19si3676165pgi.587.2019.06.21.16.59.13; Fri, 21 Jun 2019 16:59:29 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726206AbfFUX5W (ORCPT + 99 others); Fri, 21 Jun 2019 19:57:22 -0400 Received: from mga09.intel.com ([134.134.136.24]:48779 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbfFUX5W (ORCPT ); Fri, 21 Jun 2019 19:57:22 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2019 16:57:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,402,1557212400"; d="scan'208";a="359022880" Received: from megha-z97x-ud7-th.sc.intel.com ([143.183.85.162]) by fmsmga005.fm.intel.com with ESMTP; 21 Jun 2019 16:57:21 -0700 From: Megha Dey To: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Cc: tglx@linutronix.de, marc.zyngier@arm.com, ashok.raj@intel.com, jacob.jun.pan@linux.intel.com, megha.dey@intel.com, Megha Dey Subject: [RFC V1 RESEND 0/6] Introduce dynamic allocation/freeing of MSI-X vectors Date: Fri, 21 Jun 2019 17:19:32 -0700 Message-Id: <1561162778-12669-1-git-send-email-megha.dey@linux.intel.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, MSI-X vector enabling and allocation for a PCIe device is static i.e. a device driver gets only one chance to enable a specific number of MSI-X vectors, usually during device probe. Also, in many cases, drivers usually reserve more than required number of vectors anticipating their use, which unnecessarily blocks resources that could have been made available to other devices. Lastly, there is no way for drivers to reserve more vectors, if the MSI-x has already been enabled for that device.   Hence, a dynamic MSI-X kernel infrastructure can benefit drivers by deferring MSI-X allocation to post probe phase, where actual demand information is available.   This patchset enables the dynamic allocation/de-allocation of MSI-X vectors by introducing 2 new APIs: pci_alloc_irq_vectors_dyn() and pci_free_irq_vectors_grp(): We have had requests from some of the NIC/RDMA users who have lots of interrupt resources and would like to allocate them on demand, instead of using an all or none approach. The APIs are fairly well tested (multiple allocations/deallocations), but we have no early adopters yet. Hence, sending this series as an RFC for review and comments. The patches are based out of Linux 5.2-rc5. Megha Dey (6): PCI/MSI: New structures/macros for dynamic MSI-X allocation PCI/MSI: Dynamic allocation of MSI-X vectors by group x86: Introduce the dynamic teardown function PCI/MSI: Introduce new structure to manage MSI-x entries PCI/MSI: Free MSI-X resources by group Documentation: PCI/MSI: Document dynamic MSI-X infrastructure Documentation/PCI/MSI-HOWTO.txt | 38 +++++ arch/x86/include/asm/x86_init.h | 1 + arch/x86/kernel/x86_init.c | 6 + drivers/pci/msi.c | 363 +++++++++++++++++++++++++++++++++++++--- drivers/pci/probe.c | 9 + include/linux/device.h | 3 + include/linux/msi.h | 13 ++ include/linux/pci.h | 61 +++++++ kernel/irq/msi.c | 34 +++- 9 files changed, 497 insertions(+), 31 deletions(-) -- 2.7.4