From: Borislav Petkov <bp@alien8.de>
To: "Mateusz Jończyk" <mat.jonczyk@o2.pl>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
tony.luck@intel.com, x86@kernel.org,
Smita.KoralahalliChannabasappa@amd.com, mpatocka@redhat.com,
gregkh@linuxfoundation.org
Subject: Re: [PATCH] x86/MCE/AMD: Decrement threshold_bank refcount when removing threshold blocks
Date: Sat, 13 Aug 2022 12:09:52 +0200 [thread overview]
Message-ID: <Yvd4cCW4ng2cG96p@zn.tnic> (raw)
In-Reply-To: <7c8e34c8-f12d-e7e4-b6bc-4867824865ea@o2.pl>
On Fri, Aug 12, 2022 at 11:14:44PM +0200, Mateusz Jończyk wrote:
> Shouldn't there be "kobject_put(&pos->kobj)" here instead?
Yes, it should.
> Also, it seems to me that "kobject_put(b->kobj);" before the loop
> may be relocated after the loop - so that the refcounts on the child
> objects are decreased first, then the refcount on the parent object.
Yes, I guess we can do that.
> Additionally, shouldn't there be a call to
> "kobject_put(&b->blocks->kobj);" in __threshold_remove_blocks()?
Makes sense, we do
kobject_add(&b->blocks->kobj, ...
in __threshold_add_blocks().
> From what I understand, b->blocks is a list head, so we need to
> decrease the refcount on it too.
Not list_heads - we modify the refcount of kobjects. See what the arg of
kobject_put() is.
> After these changes, the __threshold_remove_blocks() function looks
> very similar to deallocate_threshold_blocks() function just above it.
Yes, minus the list_del(&pos->miscj); But that can be made conditional
with a bool arg to deallocate_threshold_blocks() and then remove
__threshold_remove_blocks().
Care to take Yazen's patch, fix it up, test it thoroughly (you should
enable KASAN to catch any potential memory leaks) and send it?
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2022-08-13 10:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-14 17:43 [PATCH] x86/MCE/AMD: Decrement threshold_bank refcount when removing threshold blocks Yazen Ghannam
2022-06-15 6:33 ` Greg KH
2022-06-15 13:51 ` Yazen Ghannam
2022-10-26 10:16 ` Borislav Petkov
2022-10-26 12:04 ` Greg KH
2022-10-26 15:39 ` Yazen Ghannam
2022-10-26 18:29 ` Borislav Petkov
2022-10-26 19:44 ` Yazen Ghannam
2022-10-26 20:12 ` Borislav Petkov
2022-11-02 2:36 ` Yazen Ghannam
2022-08-12 21:14 ` Mateusz Jończyk
2022-08-13 10:09 ` Borislav Petkov [this message]
2022-08-13 12:04 ` Mateusz Jończyk
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=Yvd4cCW4ng2cG96p@zn.tnic \
--to=bp@alien8.de \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mat.jonczyk@o2.pl \
--cc=mpatocka@redhat.com \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=yazen.ghannam@amd.com \
/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