lkml.org 
[lkml]   [2023]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [patch V3 13/33] x86/apic/vector: Provide MSI parent domain
Date
Jason,

On Wed, Jan 04 2023 at 08:34, Jason Gunthorpe wrote:
> Our test team has discovered some kmem leak complaints on rc1 and
> bisected it to this patch.
>
> I don't see an obvious way that fwnode gets destroyed here. So maybe
> it should be like this?
>
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index 955267bbc2be63..cbbcb7fd2bd00d 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -1000,7 +1000,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
> fail:
> msi_unlock_descs(dev);
> free_fwnode:
> - kfree(fwnode);
> + irq_domain_free_fwnode(fwnode); // ???

That's correct. kfree(fwnode) leaks fwnode->name

> free_bundle:
> kfree(bundle);
> return false;
> @@ -1013,6 +1013,7 @@ bool msi_create_device_irq_domain(struct device *dev, unsigned int domid,
> */
> void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
> {
> + struct fwnode_handle *fwnode = NULL;
> struct msi_domain_info *info;
> struct irq_domain *domain;
>
> @@ -1025,7 +1026,10 @@ void msi_remove_device_irq_domain(struct device *dev, unsigned int domid)
>
> dev->msi.data->__domains[domid].domain = NULL;
> info = domain->host_data;
> + if (domain->flags & IRQ_DOMAIN_FLAG_MSI_DEVICE)
> + fwnode = domain->fwnode;

irq_domain_is_msi_device() ?

> irq_domain_remove(domain);
> + irq_domain_free_fwnode(fwnode);

For some reason I thought the fwnode would be handled by
irq_domain_remove() but fwnode_handle_put() is a NOP for the named
fwnodes.

Care to send a proper patch with changelog?

Thanks,

tglx

\
 
 \ /
  Last update: 2023-03-26 23:34    [W:1.755 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site