From: Shanker Donthineni <shankerd@codeaurora.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
Vikram Sethi <vikrams@codeaurora.org>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Jason Cooper <jason@lakedaemon.net>
Subject: Re: [PATCH v2] irqchip: gicv3-its: Fix memory leak in its_free_tables()
Date: Fri, 29 Jan 2016 19:13:14 -0600 [thread overview]
Message-ID: <56AC0E2A.1090402@codeaurora.org> (raw)
In-Reply-To: <alpine.DEB.2.11.1601290930000.3886@nanos>
On 01/29/2016 02:30 AM, Thomas Gleixner wrote:
> On Thu, 28 Jan 2016, Shanker Donthineni wrote:
>> @@ -807,9 +810,10 @@ static void its_free_tables(struct its_node *its)
>> int i;
>>
>> for (i = 0; i < GITS_BASER_NR_REGS; i++) {
>> - if (its->tables[i]) {
>> - free_page((unsigned long)its->tables[i]);
>> - its->tables[i] = NULL;
>> + if (its->tables[i].base) {
>> + free_pages((unsigned long)its->tables[i].base,
>> + get_order(its->tables[i].size));
>> + its->tables[i].base = NULL;
>> }
>> }
>> }
>> @@ -880,6 +884,7 @@ retry_alloc_baser:
>> if (alloc_pages > GITS_BASER_PAGES_MAX) {
>> alloc_pages = GITS_BASER_PAGES_MAX;
>> order = get_order(GITS_BASER_PAGES_MAX * psz);
>> + alloc_size = (1 << order) * PAGE_SIZE;
> Why don't you record the order instead of converting back and forth ?
I can use page order information to fix memory leak and I will post v3
patch with your suggestion.
We have another coding BUG which is related to not refreshing alloc_size
whenever order changes.
Because we are not updating alloc_size variable here, later part of the
code logic uses incorrect
alloc_size value in two places as shown below.
Code snippet-1:
if (!shr) {
cache = GITS_BASER_nC;
__flush_dcache_area(base, alloc_size);
}
Code snippet-2:
pr_info("ITS: allocated %d %s @%lx (psz %dK, shr %d)\n",
(int)(alloc_size / entry_size),
its_base_type_string[type],
(unsigned long)virt_to_phys(base),
psz / SZ_1K, (int)shr >> GITS_BASER_SHAREABILITY_SHIFT);
How do you suggest I fix the second problem? Should I create another
patch or include in v3 patch?
> Thanks,
>
> tglx
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2016-01-30 1:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-29 4:42 [PATCH v2] irqchip: gicv3-its: Fix memory leak in its_free_tables() Shanker Donthineni
2016-01-29 8:30 ` Thomas Gleixner
2016-01-30 1:13 ` Shanker Donthineni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56AC0E2A.1090402@codeaurora.org \
--to=shankerd@codeaurora.org \
--cc=jason@lakedaemon.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=tglx@linutronix.de \
--cc=vikrams@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).