Subject: Re: [PATCH] Do not inline putprops function

From: "M. Mohan Kumar" <[email-masked]>
Date: Fri, 7 Aug 2009 20:05:49 +0530

Hi,

After enabling EARLY_DEBUG (and DEBUG in some of the files in
arch/powerpc/kernel directory), without forcing the dtstruct variable to 8
byte alignment: 

# ./kexec -e
Starting new kernel
console [udbg0] enabled
 -> early_setup(), dt_ptr: 0x7723000
 -> early_init_devtree(c000000007723000)
Invalid tag 5 scanning flattened device tree !
search "chosen", depth: 0, uname:
Invalid tag 5 scanning flattened device tree !
dt_root_size_cells = 2
dt_root_addr_cells = 2
Invalid tag 5 scanning flattened device tree !
reserving: 128c000 -> 5ec1f7
reserving: 7734000 -> 8cc000
reserving: 7723000 -> f698
Phys. mem: 0
-> move_device_tree
<- move_device_tree
Scanning CPUs ...
Invalid tag 5 scanning flattened device tree !
 <- early_init_devtree()
Probing machine type ...
  pSeries ...
No suitable machine found !

So device-tree is getting corrupted when dtstruct variable is not aligned to
8 byte variable. This problem is not seen with gcc-3.4. Is it compiler
issue? or bug in the code.

Regards,
M. Mohan Kumar.

On Fri, Aug 07, 2009 at 12:24:20AM +1000, Michael Ellerman wrote:
> On Wed, 2009-08-05 at 22:19 +0530, M. Mohan Kumar wrote:
> > Hi,
> > 
> > When I align the dtstruct variable to 8 bytes, I am able to invoke kdump.
> > 
> > When the line
> > 	static unsigned dtstruct[TREEWORDS], *dt;
> > changed to 
> > 	static unsigned dtstruct[TREEWORDS] __attribute__ ((aligned (8))), *dt;
> > 
> > kexec-tool works.
> 
> Hmm, odd.
> 
> Can you check how it's aligned without your change? ie. in the original
> binary, is it 4 byte aligned?
> 
> When you make the change, is the only thing that changes in the binary
> the alignedness of dtstruct, or does it cause other things to move
> around?
> 
> I don't think an unaligned dt blob should have any effect on the kernel,
> ie. it should copy it in fine, but I'd have to look at the code.
> 
> cheers