Query regarding physically discontiguous memory

2013-12-25 Thread Pritam Bankar
Hi,
I just started reading Memory Managment chapter from book Professional
Linux Kernel Architecture.  At very start of chapter I came across terms
FLATMEM, DISCONTIGMEM and SPARSEMEM. Out of these DISCONTIGMEM and
SPARSEMEM are available to NUMA systens only. Book also says UMA systems
can also choose DISCONTIGMEM option if there address space contains large
holes.  Some googling says DISCONTIGMEM is prefered when we have physical
discontiguous memory.
This is what I don't understand what does it mean by

containing large holes?

physical discontiguous memory?

Is it like when I put 2 RAM chips in a system then memory for them will be
discontiguous?

Would /proc/iomem give me details I wanted?

Per my understanding RAM memory will ALWAYS be contiguous whether its 512
MB or 4 GB.

Please give me graceful example of discontiguous physical memory
That will really help me out.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Spinlocks schedule_timeout

2013-12-25 Thread SaNtosh kuLkarni
Hi,

I wanted to verify/clarify if using schedule_timeout after acquiring a
spinlock is safe?. So basically you have a situation where you are working
on a critical code and you acquire a spin lock and you end up using
a schedule_timeout after say setting the current task to Interruptible
state 'cause you are waiting for some user space code to fill in some
buffer from which you want to read.
So my doubt is simple, is it safe to acquire a spinlock and use
schedule_timeout.
I assume the task is put in the run queue and will ALWAYS
be scheduled back after the specified delay in schedule_timeout.

-- 

*Regards,Santosh*
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Spinlocks schedule_timeout

2013-12-25 Thread SaNtosh kuLkarni
Sent from my Sony Xperia™ smartphone
On Dec 25, 2013 4:16 PM, Pranay Srivastava pran...@gmail.com wrote:

 Hi santosh

 I hope you understand difference between semaphores and spin locks.


Ya I am completely aware of sleeping locks n spin locks
 If however you are stuck a situation where you can afford being preempted
then you can use sem/mutex. But i think your serialization requires that
you use spin locks then best is to have a guarded variable with spin lock
and release the lock before you schedule.


I just wanted to verify if it was possible n if yes considering preemption
is disabled..
 Even if you set the state preempt count would be increased when you
acquire spin lock. so you Cant schedule or go to sleep after spin lock.


Since schedule_timout would make sure the task remains on the run queue and
intended to be scheduled back after the specificed jeffies period. It was
just out of curiosity anyway .Thanks !!!

 Regards

 On Dec 25, 2013 3:36 PM, SaNtosh kuLkarni santosh.yesop...@gmail.com
wrote:

 Hi,

 I wanted to verify/clarify if using schedule_timeout after acquiring a
spinlock is safe?. So basically you have a situation where you are working
on a critical code and you acquire a spin lock and you end up using
a schedule_timeout after say setting the current task to Interruptible
state 'cause you are waiting for some user space code to fill in some
buffer from which you want to read.
 So my doubt is simple, is it safe to acquire a spinlock and use
schedule_timeout.
 I assume the task is put in the run queue and will ALWAYS
be scheduled back after the specified delay in schedule_timeout.

 --
 Regards,
 Santosh

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

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


Re: how to find kernel patch applied on existing build kernel

2013-12-25 Thread Valdis . Kletnieks
On Wed, 25 Dec 2013 11:28:35 +0800, Dong Zhu said:

 rpm -q kernel --changelog

That won't actually list all the 10,000+ commits between kernel
releases - it often won't even list all the vendor-applied patches
that they've put on top of the Linus kernel.  And it assumes an RPM
based system

As somebody else mentioned, 'git tag --contains (commit-id)' is the
best bet here.


pgpaO86r94l32.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Query regarding physically discontiguous memory

2013-12-25 Thread Valdis . Kletnieks
On Wed, 25 Dec 2013 14:45:01 +0530, Pritam Bankar said:

 This is what I don't understand what does it mean by

 containing large holes?

 physical discontiguous memory?

 Is it like when I put 2 RAM chips in a system then memory for them will be
 discontiguous?

 Per my understanding RAM memory will ALWAYS be contiguous whether its 512
 MB or 4 GB.

Your understanding is wrong.  That may be true on most x86-based desktops
and laptops and the like, but it's often very wrong on other architectures.
In fact, given that the x86 architecture is just one of like 27 archs that
Linux supports, it's a good bet that there's more archs that *don't* enforce
contiguous memory than do. Counting through the defconfigs to get a number
is left as an exercise for the student. :)

A common case for embedded systems is 256M of RAM at address 0, and
256M of RAM at address 0x8000 (or whatever the halfway mark for the
architecture is).

NUMA boxes are sometimes each node's RAM is at node number*4G or similar,
which means lots of holes if each node is partly populated with only 2G.


pgpHfEtDXxcFF.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Unable to access FPGA device with virtual address returned by ioremap()

2013-12-25 Thread Sri Ram Vemulpali
Hi All,

I am working on bringing up the board sbc8641d, which is mostly similar in
architecture with mpc8641 having powerpc chip. My board was customized to
add FPGA. This FPGA was connected as external device to processor on
localbus. I am able to boot the board recognizing all the devices, except
external device FPGA. I have mentioned in device tree regarding chip select
and parent address in processor address domain of the fpga. I have the
following problems.

I have problem with ioremap returned address to my device in kernel.
ioremap takes physical address and returns virtual address. Using virtual
address, if I write and read, there is no result. I am writing to scratch
pad of the FPGA chip and reading from it the same string. When I read I do
not see any value (written value).

Second, when I typed command in bash free -m it shows 756MB memory
available. I used mem= commandline option to tell kernel to use 4GB
memory. But after booting the kernel it still shows 756MB. Why is this?

Can anyone help me in directing where to look to debug this. Any help would
be appreciated. Is there anyway I can debug pagetables to see what is
happening at address mapping level.

NOTE: this is powerpc architecture.


On Wed, Dec 25, 2013 at 3:53 PM, Sri Ram Vemulpali
sri.ram.gm...@gmail.comwrote:

 Hi All,

 I am working on bringing up the board sbc8641d, which is mostly similar in
 architecture with mpc8641 having powerpc chip. My board was customized to
 add FPGA. This FPGA was connected as external device to processor on
 localbus. I am able to boot the board recognizing all the devices, except
 external device FPGA. I have mentioned in device tree regarding chip select
 and parent address in processor address domain of the fpga. I have the
 following problems.

 I have problem with ioremap returned address to my device in kernel.
 ioremap takes physical address and returns virtual address. Using virtual
 address, if I write and read, there is no result. I am writing to scratch
 pad of the FPGA chip and reading from it the same string. When I read I do
 not see any value (written value).

 Second, when I typed command in bash free -m it shows 756MB memory
 available. I used mem= commandline option to tell kernel to use 4GB
 memory. But after booting the kernel it still shows 756MB. Why is this?

 Can anyone help me in directing where to look to debug this. Any help
 would be appreciated. Is there anyway I can debug pagetables to see what is
 happening at address mapping level.

 NOTE: this is powerpc architecture.

 --
 Regards,
 Sri.




-- 
Regards,
Sri.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


MPC8641 based custom board kernel Bug

2013-12-25 Thread Ashish Khetan
Hi,
I was trying to port Linux-3.12 for MPC8641 based custom designed board for
evaluation purpose. I have been facing a kernel bug at mpic initialization.
Is somebody have faced this kind of bugs or can give me any pointer for
further steps how to solve kernel bugs will be really helpful. here is the
snapshot for the bug that may be helpful to address the bug.
Using MPC86xx HPCN machine description
Total memory = 512MB; using 1024kB for hash table (at cff0)
Linux version 3.12.0 (ashish@ashish-VirtualBox) (gcc version 4.7.2 (GCC) )
#2 We
d Dec 25 16:04:36 IST 2013
Found initrd at 0xde975000:0xdfec428a
bootconsole [udbg0] enabled
setup_arch: bootmem
mpc86xx_hpcn_setup_arch()
MPC86xx HPCN board from Freescale Semiconductor
arch: exit
Zone ranges:
  DMA  [mem 0x-0x1fff]
  Normal   empty
  HighMem  empty
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x-0x1fff]
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: root=/dev/ram0 rw rootfs console=ttyS0,115200
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Sorting __ex_table...
Memory: 424980K/524288K available (4172K kernel code, 208K rwdata, 1304K
rodata,
 196K init, 149K bss, 99308K reserved, 0K highmem)
Kernel virtual memory layout:
  * 0xfffcf000..0xf000  : fixmap
  * 0xff80..0xffc0  : highmem PTEs
  * 0xff7fe000..0xff80  : early ioremap
  * 0xe100..0xff7fe000  : vmalloc  ioremap
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:512 nr_irqs:512 16
[ cut here ]
kernel BUG at arch/powerpc/platforms/86xx/pic.c:42!
Oops: Exception in kernel mode, sig: 5 [#1]
MPC86xx HPCN
Modules linked in:
CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.0 #2
task: c05903e0 ti: c05b4000 task.ti: c05b4000
NIP: c0567438 LR: c0567430 CTR: c0567400
REGS: c05b5ee0 TRAP: 0700   Not tainted  (3.12.0)
MSR: 00021032 ME,IR,DR,RI  CR: 2442  XER: 2000

GPR00: c0567430 c05b5f90 c05903e0  c04e4ff8 c051e588 008f
0002
GPR08: c042789c 0001 006f  2248 bebd 11a7b4e5
200c8000
GPR16: ffbe   0024  1fec56f8 1fec59a7

GPR24:  1fff97e8 4000 1ffcc6a0 c0bff080 c05c2490 c05c2628
c0585b60
NIP [c0567438] mpc86xx_init_irq+0x38/0x108
LR [c0567430] mpc86xx_init_irq+0x30/0x108
Call Trace:
[c05b5f90] [c0567430] mpc86xx_init_irq+0x30/0x108 (unreliable)
[c05b5fb0] [c0562784] init_IRQ+0x24/0x38
[c05b5fc0] [c055fde4] start_kernel+0x1bc/0x2ec
[c05b5ff0] [3444] 0x3444
Instruction dump:
3d00c04f 3880 38a01002 38c0 38e00100 39088f8c 3860 90010024
bfa10014 4bffec35 7c690034 5529d97e 0f09 3fa0c04f 4bfff391 3860
---[ end trace 31fd0ba7d8756001 ]---

Kernel panic - not syncing: Attempted to kill the idle task!
Rebooting in 180 seconds..


Thanks  Regards
Ashish Khetan
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Spinlocks schedule_timeout

2013-12-25 Thread arshad hussain
On Wed, Dec 25, 2013 at 3:29 PM, SaNtosh kuLkarni 
santosh.yesop...@gmail.com wrote:

 Hi,

 I wanted to verify/clarify if using schedule_timeout after acquiring a
 spinlock is safe?.


No it is not safe. schedule_timeout is sleepy function and it is
wrong to sleep when holding a spin lock.


 So basically you have a situation where you are working on a critical code
 and you acquire a spin lock and you end up using a schedule_timeout after
 say setting the current task to Interruptible state 'cause you are waiting
 for some user space code to fill in some buffer from which you want to read.
 So my doubt is simple, is it safe to acquire a spinlock and use
 schedule_timeout.
 I assume the task is put in the run queue and will ALWAYS
 be scheduled back after the specified delay in schedule_timeout.

 --

 *Regards,Santosh*

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


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