From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:49264 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726917AbeJLR4J (ORCPT ); Fri, 12 Oct 2018 13:56:09 -0400 Subject: Re: [PATCH v2] platform-msi: Free descriptors in platform_msi_domain_free() To: Miquel Raynal Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , Thomas Petazzoni , Nadav Haklai , Gregory Clement , Maxime Chevallier , Antoine Tenart , Stefan Chulski , stable@vger.kernel.org References: <20181011091234.9605-1-miquel.raynal@bootlin.com> From: Marc Zyngier Message-ID: <2422611e-5d39-d0df-dc09-5b54cd02c9d8@arm.com> Date: Fri, 12 Oct 2018 11:24:23 +0100 MIME-Version: 1.0 In-Reply-To: <20181011091234.9605-1-miquel.raynal@bootlin.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: Hi Miquel, On 11/10/18 10:12, Miquel Raynal wrote: > Since the addition of platform MSI support, there were two helpers > supposed to allocate/free IRQs for a device: > > platform_msi_domain_alloc_irqs() > platform_msi_domain_free_irqs() > > In these helpers, IRQ descriptors are allocated in the "alloc" routine > while they are freed in the "free" one. > > Later, two other helpers have been added to handle IRQ domains on top > of MSI domains: > > platform_msi_domain_alloc() > platform_msi_domain_free() > > Seen from the outside, the logic is pretty close with the former > helpers and people used it with the same logic as before: a > platform_msi_domain_alloc() call should be balanced with a > platform_msi_domain_free() call. While this is probably what was > intended to do, the platform_msi_domain_free() does not remove/free > the IRQ descriptor(s) created/inserted in > platform_msi_domain_alloc(). > > One effect of such situation is that removing a module that requested > an IRQ will let one orphaned IRQ descriptor (with an allocated MSI > entry) in the device descriptors list. Next time the module will be > inserted back, one will observe that the allocation will happen twice > in the MSI domain, one time for the remaining descriptor, one time for > the new one. It also has the side effect to quickly overshoot the > maximum number of allocated MSI and then prevent any module requesting > an interrupt in the same domain to be inserted anymore. > > This situation has been met with loops of insertion/removal of the > mvpp2.ko module (requesting 15 MSIs each time). > > Fixes: 552c494a7666 ("platform-msi: Allow creation of a MSI-based stacked irq domain") > Cc: stable@vger.kernel.org > Signed-off-by: Miquel Raynal Thanks for the respin. If nobody disagrees, I'll route this through Thomas to stash into tip, and hopefully have that in 4.19. M. -- Jazz is not dead. It just smells funny...