diff mbox

[0/1] Recurse when searching for empty slots in resources trees

Message ID alpine.LFD.2.01.0906161804030.16802@localhost.localdomain (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Linus Torvalds June 17, 2009, 1:04 a.m. UTC
On Tue, 16 Jun 2009, Linus Torvalds wrote:
> 
> Can you try this patch?

Oops. As Jesse pointed out, there was no patch.

_This_ time.

		Linus

---
 kernel/resource.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Andrew Patterson June 17, 2009, 3:19 a.m. UTC | #1
On Tue, 2009-06-16 at 18:04 -0700, Linus Torvalds wrote:
> 
> On Tue, 16 Jun 2009, Linus Torvalds wrote:
> > 
> > Can you try this patch?
> 

This looks functionally equivalent to the current code.  I get way too
much output to be useful.  I can log the serial port if we need it all,
or I can change it to just look at the buses in question if desired. 

My hardware got changed around on me, so I will have to try this
tomorrow with the original hardware config.

Andrew


> Oops. As Jesse pointed out, there was no patch.
> 
> _This_ time.
> 
> 		Linus
> 
> ---
>  kernel/resource.c |   13 ++++++++++---
>  1 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/resource.c b/kernel/resource.c
> index ac5f3a3..d9d7ede 100644
> --- a/kernel/resource.c
> +++ b/kernel/resource.c
> @@ -140,6 +140,13 @@ __initcall(ioresources_init);
>  
>  #endif /* CONFIG_PROC_FS */
>  
> +#define set_parent(x,p) __set_parent(__FUNCTION__, x, p)
> +static void __set_parent(const char *fn, struct resource *x, struct resource *parent)
> +{
> +	WARN("%s: parent of '%s' is '%s'\n", fn, x->name, parent ? parent->name : "none");
> +	x->parent = parent;
> +}
> +
>  /* Return the conflict entry if you can't request it */
>  static struct resource * __request_resource(struct resource *root, struct resource *new)
>  {
> @@ -159,7 +166,7 @@ static struct resource * __request_resource(struct resource *root, struct resour
>  		if (!tmp || tmp->start > end) {
>  			new->sibling = tmp;
>  			*p = new;
> -			new->parent = root;
> +			set_parent(new, root);
>  			return NULL;
>  		}
>  		p = &tmp->sibling;
> @@ -395,13 +402,13 @@ static struct resource * __insert_resource(struct resource *parent, struct resou
>  			break;
>  	}
>  
> -	new->parent = parent;
> +	set_parent(new, parent);
>  	new->sibling = next->sibling;
>  	new->child = first;
>  
>  	next->sibling = NULL;
>  	for (next = first; next; next = next->sibling)
> -		next->parent = new;
> +		set_parent(next, new);
>  
>  	if (parent->child == first) {
>  		parent->child = new;
>
Linus Torvalds June 17, 2009, 4:19 a.m. UTC | #2
On Wed, 17 Jun 2009, Andrew Patterson wrote:
> 
> This looks functionally equivalent to the current code.

Absolutely. It's only meant to add the call chains for all the resource 
additions, so that we could see how that buggy 'c2' resource gets added as 
a parent to 'c3' (when it should be the other way around).

> I get way too much output to be useful.  I can log the serial port if we 
> need it all, or I can change it to just look at the buses in question if 
> desired.

Sure. Or increase CONFIG_LOG_BUF_SHIFT to 22 or somethng insane like that 
(so that it logs up to 4MB of messages).

But yeah, if you just make it smarter, and only do that WARN() thing for 
resources that match "PCI Bus" at the beginning of the name, that should 
be plenty good enough.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/kernel/resource.c b/kernel/resource.c
index ac5f3a3..d9d7ede 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -140,6 +140,13 @@  __initcall(ioresources_init);
 
 #endif /* CONFIG_PROC_FS */
 
+#define set_parent(x,p) __set_parent(__FUNCTION__, x, p)
+static void __set_parent(const char *fn, struct resource *x, struct resource *parent)
+{
+	WARN("%s: parent of '%s' is '%s'\n", fn, x->name, parent ? parent->name : "none");
+	x->parent = parent;
+}
+
 /* Return the conflict entry if you can't request it */
 static struct resource * __request_resource(struct resource *root, struct resource *new)
 {
@@ -159,7 +166,7 @@  static struct resource * __request_resource(struct resource *root, struct resour
 		if (!tmp || tmp->start > end) {
 			new->sibling = tmp;
 			*p = new;
-			new->parent = root;
+			set_parent(new, root);
 			return NULL;
 		}
 		p = &tmp->sibling;
@@ -395,13 +402,13 @@  static struct resource * __insert_resource(struct resource *parent, struct resou
 			break;
 	}
 
-	new->parent = parent;
+	set_parent(new, parent);
 	new->sibling = next->sibling;
 	new->child = first;
 
 	next->sibling = NULL;
 	for (next = first; next; next = next->sibling)
-		next->parent = new;
+		set_parent(next, new);
 
 	if (parent->child == first) {
 		parent->child = new;