Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752537AbbETDGd (ORCPT ); Tue, 19 May 2015 23:06:33 -0400 Received: from mga11.intel.com ([192.55.52.93]:28110 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbbETDG2 (ORCPT ); Tue, 19 May 2015 23:06:28 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,462,1427785200"; d="scan'208";a="574013305" Message-ID: <555BFA31.5040206@linux.intel.com> Date: Wed, 20 May 2015 11:06:25 +0800 From: Jiang Liu Organization: Intel User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Thomas Gleixner CC: "Rafael J . Wysocki" , Bjorn Helgaas , Lv Zheng , LKML , linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org, "x86 @ kernel . org" Subject: Re: [RFC 2/4] PCI, MSI: Optionally free legacy PCI IRQ when enabling MSI/MSI-X References: <1430968374-29286-1-git-send-email-jiang.liu@linux.intel.com> <1430968374-29286-3-git-send-email-jiang.liu@linux.intel.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1322 Lines: 47 On 2015/5/16 5:02, Thomas Gleixner wrote: > On Thu, 7 May 2015, Jiang Liu wrote: > >> Once PCI MSI/MSI-X is enabled by the device driver, PCI device won't >> make use of legacy PCI IRQ until PCI MSI/MSI-X is disabled again. >> So optionally free legacy PCI IRQ when enabling MSI/MSI-X and reallocate >> when disabling MSI/MSI-X. > > This is a bit odd. With your proposed change we'll have: > > alloc_legacy_irq() > > msi[x]_enable() > free_legacy_irq() > > msi[x]_disable() > alloc_legacy_irq() Hi Thomas, It's for safety. I'm not sure whether the device driver will make use of legacy IRQ after calling msi[x]_disable(). I have concerns about following pattern in PCI device drivers: --------------------------------------------------- if (enable_msi() == SUCCESS) { if (allocate_resource_for_msi() == SUCCESS) return; disable_msi(); } use_legacy_irq() Thanks! Gerry > > And after that we shut down the device which will free the legacy irq > again. > > Shouldn't we allocate the legacy irq only if we really need it? > > Thanks, > > tglx > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/