From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.bootlin.com ([62.4.15.54]:46532 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbeJKQn7 (ORCPT ); Thu, 11 Oct 2018 12:43:59 -0400 Date: Thu, 11 Oct 2018 11:17:23 +0200 From: Miquel Raynal To: Marc Zyngier Cc: Greg Kroah-Hartman , "Rafael J . Wysocki" , Thomas Petazzoni , "Nadav\ Haklai" , Gregory Clement , Maxime Chevallier , Antoine Tenart , Stefan Chulski , Subject: Re: [PATCH] platform-msi: Free descriptors in platform_msi_domain_free() Message-ID: <20181011111723.32008d97@xps13> In-Reply-To: <86k1moubgr.wl-marc.zyngier@arm.com> References: <20180907150129.14729-1-miquel.raynal@bootlin.com> <86r2hovwrq.wl-marc.zyngier@arm.com> <20180924153938.4047e1b1@xps13> <525716a2-96be-d7f4-f0dc-a8b59ac700e9@arm.com> <20180928171029.45199a98@xps13> <86k1moubgr.wl-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: stable-owner@vger.kernel.org List-ID: Hi Marc, Marc Zyngier wrote on Thu, 11 Oct 2018 09:36:04 +0100: > Miquel, > > On Fri, 28 Sep 2018 16:10:29 +0100, > Miquel Raynal wrote: > > > > Hi Marc, > > > > [...] > > > > > At that stage, you're better off just calling > > > > > > list_del(&desc->list); > > > free_msi_entry(desc); > > > > > > I like this approach better as we only traverse the list once. > > > > Right. > > > > > > > > > } > > > > } > > > > > /** > > > > diff --git a/include/linux/msi.h b/include/linux/msi.h > > > > index 5839d8062dfc..be8ec813dbfb 100644 > > > > --- a/include/linux/msi.h > > > > +++ b/include/linux/msi.h > > > > @@ -116,6 +116,8 @@ struct msi_desc { > > > > list_first_entry(dev_to_msi_list((dev)), struct msi_desc, list) > > > > #define for_each_msi_entry(desc, dev) \ > > > > list_for_each_entry((desc), dev_to_msi_list((dev)), list) > > > > +#define for_each_msi_entry_safe(desc, tmp, dev) \ > > > > + list_for_each_entry_safe((desc), (tmp), dev_to_msi_list((dev)), list) > > > > > #ifdef CONFIG_PCI_MSI > > > > #define first_pci_msi_entry(pdev) first_msi_entry(&(pdev)->dev) > > > > > > If you repin this, I'll queue it right away. > > > > Let me test the new version to be sure I'm not breaking anything and > > I'll send a v2. > > What is the status of this? Are you still planning to send a v2? I'd > really like this fix to reach 4.19 before we put the last nail on it. Sorry about that, I was sure I already sent the v2, now it's done. The changes in this v2 are that instead of creating a platform_msi_domain_free_descs() helper that iterates over the list of descriptors, the descriptor itself is removed from the list and destroyed directly in platform_msi_domain_free(). The for_each_msi_entry() loop is also transformed to use the "_safe" alternative. Thanks, Miquèl