Patchwork Do not inline putprops function

login
register
mail settings
Submitter Mohan Kumar M
Date June 17, 2009, 11:34 a.m.
Message ID <20090617113456.GC31595@in.ibm.com>
Download mbox | patch
Permalink /patch/28774/
State Superseded
Headers show

Comments

Mohan Kumar M - June 17, 2009, 11:34 a.m.
Do not inline putprops function

With the recent kexec-tools git tree, both kexec and kdump kernels hang (i.e
kexec -l and kexec -p respectively). This happened after the patch "ppc64:
cleanups" commit b43a84a31a4be6ed025c1bdef3bb1c3c12e01b16. I tried
reverting each hunk and then found out that retaining following lines in
fs2dt.c makes kexec/kdump work.

-static unsigned *dt_len; /* changed len of modified cmdline
-                           in flat device-tree */

[....]

-               dt_len = dt;

I don't have any clue why removing a unused variable would cause the kexec
kernel to hang. After further investigation, I observed that if the putprops
function is not inlined, kexec/kdump kernel would work even after removing
the above lines.

This patch directs gcc to not inline the putprops function. Now we could
invoke kexec and kdump kernels.
---
 kexec/arch/ppc64/fs2dt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Simon Horman - June 17, 2009, 11:45 a.m.
On Wed, Jun 17, 2009 at 05:04:56PM +0530, M. Mohan Kumar wrote:
> Do not inline putprops function
> 
> With the recent kexec-tools git tree, both kexec and kdump kernels hang (i.e
> kexec -l and kexec -p respectively). This happened after the patch "ppc64:
> cleanups" commit b43a84a31a4be6ed025c1bdef3bb1c3c12e01b16. I tried
> reverting each hunk and then found out that retaining following lines in
> fs2dt.c makes kexec/kdump work.
> 
> -static unsigned *dt_len; /* changed len of modified cmdline
> -                           in flat device-tree */
> 
> [....]
> 
> -               dt_len = dt;
> 
> I don't have any clue why removing a unused variable would cause the kexec
> kernel to hang. After further investigation, I observed that if the putprops
> function is not inlined, kexec/kdump kernel would work even after removing
> the above lines.
> 
> This patch directs gcc to not inline the putprops function. Now we could
> invoke kexec and kdump kernels.

I'm happy to apply this if you provide a sign-off,
but do you know why not inlining makes a difference here?

> ---
>  kexec/arch/ppc64/fs2dt.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c
> index 1f551fd..1e01f74 100644
> --- a/kexec/arch/ppc64/fs2dt.c
> +++ b/kexec/arch/ppc64/fs2dt.c
> @@ -259,7 +259,7 @@ static void add_usable_mem_property(int fd, int len)
>  }
>  
>  /* put all properties (files) in the property structure */
> -static void putprops(char *fn, struct dirent **nlist, int numlist)
> +__attribute__ ((noinline)) static void putprops(char *fn, struct dirent **nlist, int numlist)
>  {
>  	struct dirent *dp;
>  	int i = 0, fd, len;
> -- 
> 1.6.0.6

Patch

diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c
index 1f551fd..1e01f74 100644
--- a/kexec/arch/ppc64/fs2dt.c
+++ b/kexec/arch/ppc64/fs2dt.c
@@ -259,7 +259,7 @@  static void add_usable_mem_property(int fd, int len)
 }
 
 /* put all properties (files) in the property structure */
-static void putprops(char *fn, struct dirent **nlist, int numlist)
+__attribute__ ((noinline)) static void putprops(char *fn, struct dirent **nlist, int numlist)
 {
 	struct dirent *dp;
 	int i = 0, fd, len;