[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <421b9738bee141648d87a5b1c1b4d4aa@SVR-IES-MBX-03.mgc.mentorg.com>
Date: Tue, 13 Aug 2019 08:09:29 +0000
From: "Schmid, Carsten" <Carsten_Schmid@...tor.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Wei Yang <richard.weiyang@...il.com>
CC: "bp@...e.de" <bp@...e.de>,
"dan.j.williams@...el.com" <dan.j.williams@...el.com>,
"mingo@...nel.org" <mingo@...nel.org>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"osalvador@...e.de" <osalvador@...e.de>,
"rdunlap@...radead.org" <rdunlap@...radead.org>,
"richardw.yang@...ux.intel.com" <richardw.yang@...ux.intel.com>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
Subject: AW: Resend [PATCH] kernel/resource.c: invalidate parent when freed
resource has childs
> >
> > In theory, child may have siblings. Would it be possible to have several
> > devices under xhci-hcd?
>
> I'm less interested in the xhci-hcd case - which I certainly *hope* is
> fixed already? - than in "if this happens somewhere else".
>
> So if we do want to remove the parent (which may be a good idea with a
> warning), and want to make sure that the children are really removed
> from the resource hierarchy, we should do somethiing like
>
> static bool detach_children(struct resource *res)
> {
> res = res->child;
> if (!res)
> return false;
> do {
> res->parent = NULL;
> res = res->sibling;
> } while (res);
> return true;
> }
>
> and then we could write the __release_region() warning as
>
> /* You should not release a resource that has children */
> WARN_ON_ONCE(detach_children(res));
>
> or something?
>
... and a child may have children too ...
There is a __release_child_resources in resource.c around line 242.
A bit noisy, and does a similar thing you outlined above.
I'm thinking about to re-use that, but with more precise output
and WARN_ON_ONCE.
Suggestions before i start work on that?
Best regards
Carsten
Powered by blists - more mailing lists