Re: kernel BUG while reading from SPI into static buffer

2011-05-15 Thread Felix Varghese
On 13 May 2011 20:02, Mulyadi Santosa mulyadi.sant...@gmail.com wrote:
 Feel free to try to observer whether this statement is correct or
 not... and you should check the address of buffer when declared as
 static I guess

I did, and here's the result:

Local Buffer - 0xc3a61edd
Static Buffer - 0xbf03eac1

So they indeed seem to be way apart in memory :).

On 13 May 2011 20:38, Greg KH g...@kroah.com wrote:
 Don't statically allocate memory for spi, you need to dynamically
 allocate it with 'kmalloc'.

 The fact that the first time didn't crash for you was just lucky.

I'm guessing you say this because static variables are not in DMA
capable memory. But how exactly do we figure out which part of memory
is DMA-capable and which isn't? Also, is this a restriction imposed by
the kernel or by the hardware?

Thanks  Regards,
Felix.

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: kernel BUG while reading from SPI into static buffer

2011-05-13 Thread Mulyadi Santosa
Need to add...

On Fri, May 13, 2011 at 21:32, Mulyadi Santosa
mulyadi.sant...@gmail.com wrote:
 OK, a bit clear now so, I can say base on the above code snippet,
 buffer...when declared as static, somehow falls into non
 ZONE_NORMAL..i.e non directly mapped memory area...

what I precisely mean, it falls into non DMA able zone...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: kernel BUG while reading from SPI into static buffer

2011-05-13 Thread Greg KH
On Fri, May 13, 2011 at 12:33:15PM +0530, Felix Varghese wrote:
 Hi,
 
 I am trying to read some data via SPI on an a modified (custom SPI device
 attached) AT91SAM9G20-EK board. If I pass a local array buffer, declared as
 char buffer[100]; as the rx_buf pointer for the spi transfer, the code works
 fine. But if I just change the declaration to static char buffer[100]
 instead, I get the following crash:

Don't statically allocate memory for spi, you need to dynamically
allocate it with 'kmalloc'.

The fact that the first time didn't crash for you was just lucky.

hope this helps,

greg k-h

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies