From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753041AbdAHQID (ORCPT ); Sun, 8 Jan 2017 11:08:03 -0500 Received: from mga07.intel.com ([134.134.136.100]:1965 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbdAHQH5 (ORCPT ); Sun, 8 Jan 2017 11:07:57 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,336,1477983600"; d="scan'208";a="1080576294" Message-ID: <1483891492.26691.24.camel@linux.intel.com> Subject: Re: [PATCH] serial: 8250_lpss: Release Quark MSI vectors on exit From: Andy Shevchenko To: Christoph Hellwig , Andy Shevchenko , Tejun Heo , Bjorn Helgaas Cc: Jan Kiszka , Christoph Hellwig , Greg Kroah-Hartman , "linux-serial@vger.kernel.org" , Linux Kernel Mailing List Date: Sun, 08 Jan 2017 18:04:52 +0200 In-Reply-To: <20170108102459.GA3644@infradead.org> References: <0250c46e-da6c-71f3-50ae-b7c17fd0bd2c@siemens.com> <20170108102459.GA3644@infradead.org> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2017-01-08 at 02:24 -0800, Christoph Hellwig wrote: > On Thu, Jan 05, 2017 at 12:19:56AM +0200, Andy Shevchenko wrote: > > NAK, check the PCI devres code, please. +Cc: Tejun, Bjorn. > > Releasing something through devres that wasn't allocated using a > devm_* or > pcim_* function isn't expected, and we should fix that instead. > pci_free_irq_vectors is _currently_ implemented by calling > pci_disable_msi and pci_disable_msix, but there is no guarantee for > that > in the API. > Your code works by accident, not by design.  If you want the resources > to be auto-released you need to add a proper pcim_alloc_irq_vectors > API. Though idea sounds sane I disagree this is accidental. The PCI managed introduction includes among other this one: +  pcim_enable_device() : after success, all PCI ops become managed As per commit 9ac7849e35f7 ("devres: device resource management"). Thus, I suppose a new API should follow existing design, or provide a sane fix. I briefly checked MSI/-X usage and since I'm not so familiar with the PCI core code, I wouldn't be brave to break it. Currently I suspect pci_free_irq_vectors() is not friendly with pcim_release(). -- Andy Shevchenko Intel Finland Oy