Re: Map syscall nr to syscall name

2015-05-08 Thread sahil aggarwal
Found something easier:

syscallent.sh ( similar to used by strace )

-
cat ${1+"$@"} |
sed -n 's/^#[   ]*define[   ][  ]*SYS_\([^  ]*\)[
 ]*[^0-9]*\([0-9]*\).*$/\1 \2/p
s/^#[   ]*define[   ][  ]*__NR_\([^ ]*\)[
]*[^0-9]*\([0-9]*\).*$/\1 \2/p
s/^#[ ]*define[ ][ ]*__NR_\([^ ]*\)[ ]*[^0-9()]*(__NR_Linux +
\([0-9]*\))$/\1 \2/p' |
sort -k2n | uniq |
awk '
BEGIN {
h = "#ifndef _H_SYSCALLENT\n#define
_H_SYSCALLENT\nchar *syscalls[] = { "
print h
}

{
s = "\"" $1 "\","
print s
}

END {
f = " };\n#endif"
print f
}

'
-

This creates header file:

#ifndef _H_SYSCALLENT
#define _H_SYSCALLENT
char *syscalls[] = {
"read",
"write",
"open",
"close",
"stat",
"fstat",
"lstat",
"poll",
"lseek",
"mmap",
..
.
...

}
#endif

-

included in makefile:

ARCH := $(shell getconf LONG_BIT)

ifeq ($(ARCH),64)
./syscallent.sh /usr/include/asm/unistd_64.h > $(INCDIR)/syscallent.h
else
./syscallent.sh /usr/include/asm/unistd_32.h > $(INCDIR)/syscallent.h
endif

-

Works fine for me. Just want to know if this will be portable method
and won't produce wrong result in any case.?

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


Re: Map syscall nr to syscall name

2015-05-07 Thread sahil aggarwal
> What arch? Try
x86 , but looking for portable solution.

> http://lxr.free-electrons.com/source/arch/x86/syscalls/syscall_64.tbl

For my arch this is helpful.


Thank you

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


reading dynamic array fields in ftrace

2015-05-07 Thread sahil aggarwal
hi,

some of the events in ftrace have dynamic array fields. Like :

field:__data_loc char[] arg1; offset:24; size:4; signed:1;

If i am sampling this particular event using perf_event_open(), how do
i read this field
i tried:

#define get_str(field) (char *)get_dynamic_array(field)
#define get_dynamic_array(field)  \
((void *)data + (data->__data_loc_##field & 0x))

as done in include/trace/ftrace,h

But it gives garble data.
TID:28578 PID:28578  TIME:258203626722378 CPU:4 Filename: ^\~@b�^O~H��^H�^?

Will appreciate any help.

Thanks
-sahil

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


Map syscall nr to syscall name

2015-05-06 Thread sahil aggarwal
Hi all

I am looking for an efficient way to convert syscall number to syscall
name. I can get syscall number by enabling profiling using
perf_event_open(), but cant find way to convert it to actual syscall
name.

Thanks


--sahil

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


Network Device Driver Interface

2015-04-28 Thread sahil aggarwal
Hi

I enabled sampling on net_dev_queue and net_dev_xmit using
perf_event_open(). This is what i get for cmd:  ping google.com -c 1

TID:21608 PID:21608  TIME:1022501870535899 CPU:5 DEV_QUEUE Skb:
0x880fc6389000 Len:98
TID:21608 PID:21608  TIME:1022501870541280 CPU:5 DEV_QUEUE Skb:
0x880fc6389000 Len:98
TID:21608 PID:21608  TIME:1022501870119689 CPU:7 DEV_QUEUE Skb:
0x880fc6389000 Len:70
TID:21608 PID:21608  TIME:1022501902225838 CPU:5 DEV_QUEUE Skb:
0x880fc4156100 Len:86
TID:21608 PID:21608  TIME:1022501870128677 CPU:7 DEV_XMIT Skb:
0x880fc6389000 Len:70 Ret:0
TID:21608 PID:21608  TIME:1022501870545283 CPU:5 DEV_XMIT Skb:
0x880fc6389000 Len:98 Ret:0
TID:21608 PID:21608  TIME:1022501870547378 CPU:5 DEV_XMIT Skb:
0x880fc6389000 Len:98 Ret:0
TID:21608 PID:21608  TIME:102250190223 CPU:5 DEV_XMIT Skb:
0x880fc4156100 Len:86 Ret:0
TID:21608 PID:21608  TIME:1022501870132327 CPU:7 DEV_RECV Skb:
0x880fc6389000 Len: 56
TID:21608 PID:21608  TIME:1022501902235039 CPU:5 DEV_RECV Skb:
0x880fc4156100 Len: 72
TID:21608 PID:21608  TIME:1022501870125880 CPU:7 DEV_RX Skb:
0x880fc6389000 Len: 56
TID:21608 PID:21608  TIME:1022501902229768 CPU:5 DEV_RX Skb:
0x880fc4156100 Len: 72


Here, net_dev_queue is called multiple times for same skb with changed
length. What i understood till now reading this:
http://www.cubrid.org/blog/dev-platform/understanding-tcp-ip-network-stack/
 was that skb received by device driver from IP layer is queued by
__dev_queue_xmit(): tracepoint net_dev_queue() exist here
 and transmitted to network device by
dev_hard_start_xmit(): tracepoint net_dev_xmit() exist here.

So, what is making it to queue skb again and what data it is adding to skb.?


Thanks
Regards

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


Re: Links to understand File System

2015-04-24 Thread sahil aggarwal
Very useful. Thank you.

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


Links to understand File System

2015-04-22 Thread sahil aggarwal
Hi all,

I am reading Understanding the linux kernel CH15(ext2 and ext3 file
systems) and have even started implementation of File system from
scratch for learning purpose by following this :

https://github.com/psankar/simplefs

Any leads on other links/papers to understand VFS->FS->disk flow better.?

Thank you
Sahil

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


Re: Eudyptula challenge

2015-03-26 Thread sahil aggarwal
On Wed, Mar 25, 2015 at 10:55:34AM -0500, Jonathan Jin wrote:
 
> Doesn't matter; those are the rules of the Challenge, for better or
> worse. It seems as though any mention of Challenge specifics is enough
> to get participants removed, period.

  I started again from first challenge.

 
> It's much better to find the "root" of the problem that you are trying
> to solve -- that is, the parts of the problem that, in this case, have
> nothing directly to do with the Eudyptula Challenge itself -- and ask
> about that, rather than ask about the logistical specifics of the
> Challenge like you did.
> 
> By the way, don't top-post. See: 
> http://kernelnewbies.org/mailinglistguidelines
 
  Yeah that makes sense actually. Thank you Jonathan.


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


Re: Eudyptula challenge

2015-03-25 Thread sahil aggarwal
Got removed :( i wasn't asking for implementation help :(

On 25 March 2015 at 19:25, Giedrius Statkevičius
 wrote:
> On 2015.03.25 15:22, sahil aggarwal wrote:
>> Hi all,
>>
>> I am on task5, little says to read ch 14 (device model) of LDD3 but ch
>> 13 (USB driver) seems to be the one i should read. I have already been
>> following this book and reached ch5, would it be ok to jump to ch
>> 13/14 directly.?
>>
>> Moreover reading /Documentation/usb/hotplug.txt seems to help me
>> solving the challenge. So should i read ch 13/14 of continue reading
>> in order.?
>
> Don't ask for help with eudyptula challenge on mailing lists. You may be
> removed from the challenge.
>
> --
> With regards / Su pagarba,
> Giedrius

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


Eudyptula challenge

2015-03-25 Thread sahil aggarwal
Hi all,

I am on task5, little says to read ch 14 (device model) of LDD3 but ch
13 (USB driver) seems to be the one i should read. I have already been
following this book and reached ch5, would it be ok to jump to ch
13/14 directly.?

Moreover reading /Documentation/usb/hotplug.txt seems to help me
solving the challenge. So should i read ch 13/14 of continue reading
in order.?

Thanks
Regards

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


Re: Scull Driver - Read

2015-03-21 Thread sahil aggarwal
Hi Pranay

Thanks a lot. That cleared it all.



On 21 March 2015 at 13:45, Pranay Srivastava  wrote:
> Hi Sahil
>
> On Fri, Mar 20, 2015 at 6:14 PM, sahil aggarwal  wrote:
>> Does it mean that in kernel space the direction bitfields are reversed.?
>
> No it doesn't mean that.
>
>>
>> On 20 March 2015 at 18:12, sahil aggarwal  wrote:
>>> Hi Pranay,
>>>
>>> Can you help me with this too.? In case of _IOC_READ why VERIFY_WRITE
>>> and in case of _IOC_WRITE why VERIFY_READ.? . Book says its kernel
>>> oriented so concept of read and write is reversed.
>>>
>>> if(_IOC_DIR(cmd) & _IOC_READ)
>>>  err = !access_ok(VERIFY_WRITE, (void __user*)arg, _IOC_SIZE(cmd));
>>> else if(_IOC_DIR(cmd) & _IOC_WRITE)
>>>  err = !access_ok(VERIFY_READ, (void __user*)arg, _IOC_SIZE(cmd));
>>> if(err)
>>> return -EFAULT;
>>>
>>> Thanks
>>> Regards
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 20 March 2015 at 12:36, sahil aggarwal  wrote:
>>>> Hi Pranay
>>>>
>>>> Well explained.
>>>>
>>>> Thank you.
>>>>
>>>> On 20 March 2015 at 11:46, Pranay Srivastava  wrote:
>>>>> Hi Sahil
>>>>>
>>>>> On Sun, Mar 15, 2015 at 10:17 AM, sahil aggarwal  
>>>>> wrote:
>>>>>> hi all,
>>>>>>
>>>>>> Going through scull driver code, i see read function reads only till
>>>>>> end of 1 quantum, so do kernel call read multiple times if count from
>>>>>> q_pos exceeds quantum size limit.?
>>>>>>
>>>>>>
>>>>>> Ref: ldd3.
>>>>>>
>>>>>> if(count > quantum - q_pos)
>>>>>> count = quantum - q_pos;
>>>>>> if(copy_to_user(buf, dptr->data[s_pos] + q_pos,count)){
>>>>>> retval = -EFAULT;
>>>>>> goto out;
>>>>>> }
>>>>>
>>>>> If you are not using the default read/write routines, then its up to
>>>>> you to code that.
>>>>>
>>>>> Kernel doesn't do multiple read calls. It'll do only what you asked it
>>>>> for no more but it can do less. For example, a file is say 100 KiB and
>>>>> you are reading say 4KiB in a loop when do you stop?
>>>>>
>>>>> Simply put it's the user space application which is doing the looping
>>>>> and repeatedly doing read calls because it assumes that file isn't
>>>>> finished.
>>>>>
>>>>> So again when do you stop reading from the file, without knowing size
>>>>> of the file.?
>>>>>
>>>>>> *f_pos += count;
>>>>>> retval = count;
>>>>>>
>>>>>> Thanks
>>>>>> Regards
>>>>>>
>>>>>> ___
>>>>>> Kernelnewbies mailing list
>>>>>> Kernelnewbies@kernelnewbies.org
>>>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> ---P.K.S
>
>
>
> --
> ---P.K.S

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


Re: Scull Driver - Read

2015-03-20 Thread sahil aggarwal
Does it mean that in kernel space the direction bitfields are reversed.?

On 20 March 2015 at 18:12, sahil aggarwal  wrote:
> Hi Pranay,
>
> Can you help me with this too.? In case of _IOC_READ why VERIFY_WRITE
> and in case of _IOC_WRITE why VERIFY_READ.? . Book says its kernel
> oriented so concept of read and write is reversed.
>
> if(_IOC_DIR(cmd) & _IOC_READ)
>  err = !access_ok(VERIFY_WRITE, (void __user*)arg, _IOC_SIZE(cmd));
> else if(_IOC_DIR(cmd) & _IOC_WRITE)
>  err = !access_ok(VERIFY_READ, (void __user*)arg, _IOC_SIZE(cmd));
> if(err)
> return -EFAULT;
>
> Thanks
> Regards
>
>
>
>
>
>
> On 20 March 2015 at 12:36, sahil aggarwal  wrote:
>> Hi Pranay
>>
>> Well explained.
>>
>> Thank you.
>>
>> On 20 March 2015 at 11:46, Pranay Srivastava  wrote:
>>> Hi Sahil
>>>
>>> On Sun, Mar 15, 2015 at 10:17 AM, sahil aggarwal  
>>> wrote:
>>>> hi all,
>>>>
>>>> Going through scull driver code, i see read function reads only till
>>>> end of 1 quantum, so do kernel call read multiple times if count from
>>>> q_pos exceeds quantum size limit.?
>>>>
>>>>
>>>> Ref: ldd3.
>>>>
>>>> if(count > quantum - q_pos)
>>>> count = quantum - q_pos;
>>>> if(copy_to_user(buf, dptr->data[s_pos] + q_pos,count)){
>>>> retval = -EFAULT;
>>>> goto out;
>>>> }
>>>
>>> If you are not using the default read/write routines, then its up to
>>> you to code that.
>>>
>>> Kernel doesn't do multiple read calls. It'll do only what you asked it
>>> for no more but it can do less. For example, a file is say 100 KiB and
>>> you are reading say 4KiB in a loop when do you stop?
>>>
>>> Simply put it's the user space application which is doing the looping
>>> and repeatedly doing read calls because it assumes that file isn't
>>> finished.
>>>
>>> So again when do you stop reading from the file, without knowing size
>>> of the file.?
>>>
>>>> *f_pos += count;
>>>> retval = count;
>>>>
>>>> Thanks
>>>> Regards
>>>>
>>>> ___
>>>> Kernelnewbies mailing list
>>>> Kernelnewbies@kernelnewbies.org
>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>>
>>>
>>>
>>> --
>>> ---P.K.S

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


Re: Scull Driver - Read

2015-03-20 Thread sahil aggarwal
Hi Pranay,

Can you help me with this too.? In case of _IOC_READ why VERIFY_WRITE
and in case of _IOC_WRITE why VERIFY_READ.? . Book says its kernel
oriented so concept of read and write is reversed.

if(_IOC_DIR(cmd) & _IOC_READ)
 err = !access_ok(VERIFY_WRITE, (void __user*)arg, _IOC_SIZE(cmd));
else if(_IOC_DIR(cmd) & _IOC_WRITE)
 err = !access_ok(VERIFY_READ, (void __user*)arg, _IOC_SIZE(cmd));
if(err)
return -EFAULT;

Thanks
Regards






On 20 March 2015 at 12:36, sahil aggarwal  wrote:
> Hi Pranay
>
> Well explained.
>
> Thank you.
>
> On 20 March 2015 at 11:46, Pranay Srivastava  wrote:
>> Hi Sahil
>>
>> On Sun, Mar 15, 2015 at 10:17 AM, sahil aggarwal  
>> wrote:
>>> hi all,
>>>
>>> Going through scull driver code, i see read function reads only till
>>> end of 1 quantum, so do kernel call read multiple times if count from
>>> q_pos exceeds quantum size limit.?
>>>
>>>
>>> Ref: ldd3.
>>>
>>> if(count > quantum - q_pos)
>>> count = quantum - q_pos;
>>> if(copy_to_user(buf, dptr->data[s_pos] + q_pos,count)){
>>> retval = -EFAULT;
>>> goto out;
>>> }
>>
>> If you are not using the default read/write routines, then its up to
>> you to code that.
>>
>> Kernel doesn't do multiple read calls. It'll do only what you asked it
>> for no more but it can do less. For example, a file is say 100 KiB and
>> you are reading say 4KiB in a loop when do you stop?
>>
>> Simply put it's the user space application which is doing the looping
>> and repeatedly doing read calls because it assumes that file isn't
>> finished.
>>
>> So again when do you stop reading from the file, without knowing size
>> of the file.?
>>
>>> *f_pos += count;
>>> retval = count;
>>>
>>> Thanks
>>> Regards
>>>
>>> ___
>>> Kernelnewbies mailing list
>>> Kernelnewbies@kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>>
>>
>>
>> --
>> ---P.K.S

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


Re: Scull Driver - Read

2015-03-20 Thread sahil aggarwal
Hi Pranay

Well explained.

Thank you.

On 20 March 2015 at 11:46, Pranay Srivastava  wrote:
> Hi Sahil
>
> On Sun, Mar 15, 2015 at 10:17 AM, sahil aggarwal  
> wrote:
>> hi all,
>>
>> Going through scull driver code, i see read function reads only till
>> end of 1 quantum, so do kernel call read multiple times if count from
>> q_pos exceeds quantum size limit.?
>>
>>
>> Ref: ldd3.
>>
>> if(count > quantum - q_pos)
>> count = quantum - q_pos;
>> if(copy_to_user(buf, dptr->data[s_pos] + q_pos,count)){
>> retval = -EFAULT;
>> goto out;
>> }
>
> If you are not using the default read/write routines, then its up to
> you to code that.
>
> Kernel doesn't do multiple read calls. It'll do only what you asked it
> for no more but it can do less. For example, a file is say 100 KiB and
> you are reading say 4KiB in a loop when do you stop?
>
> Simply put it's the user space application which is doing the looping
> and repeatedly doing read calls because it assumes that file isn't
> finished.
>
> So again when do you stop reading from the file, without knowing size
> of the file.?
>
>> *f_pos += count;
>> retval = count;
>>
>> Thanks
>> Regards
>>
>> ___
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> ---P.K.S

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


Scull Driver - Read

2015-03-14 Thread sahil aggarwal
hi all,

Going through scull driver code, i see read function reads only till
end of 1 quantum, so do kernel call read multiple times if count from
q_pos exceeds quantum size limit.?


Ref: ldd3.

if(count > quantum - q_pos)
count = quantum - q_pos;
if(copy_to_user(buf, dptr->data[s_pos] + q_pos,count)){
retval = -EFAULT;
goto out;
}
*f_pos += count;
retval = count;

Thanks
Regards

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


Missing sys_enter_open events

2015-03-13 Thread sahil aggarwal
Hi all

I am doing ftrace to track files being opened and mapped by process
but sys_enter_open is getting missed and getname is being traced which
is called by sys_open only. What is happening.?

mem-2474  [005] 681774.985957: getnameprobe: (sys_execve+0x21/0x5a <-
getname) arg1="bin/mem"
 mem-2474  [001] 683183.894867: sync_read:
(vfs_read+0xab/0x107 <- do_sync_read) arg1=80
 mem-2474  [001] 683183.894900: sync_read:
(vfs_read+0xab/0x107 <- do_sync_read) arg1=1c0
 mem-2474  [001] 683183.894902: sync_read:
(vfs_read+0xab/0x107 <- do_sync_read) arg1=1c
 mem-2474  [001] 683183.894913: sync_read:
(vfs_read+0xab/0x107 <- do_sync_read) arg1=80
 mem-2474  [001] 683183.895113: sync_read:
(vfs_read+0xab/0x107 <- do_sync_read) arg1=188
 mem-2474  [001] 683183.895275: getnameprobe:
(do_sys_open+0x3b/0x105 <- getname) arg1="/etc/ld.so.cache"
 mem-2474  [001] 683183.895316: getnameprobe:
(do_sys_open+0x3b/0x105 <- getname) arg1="/lib/libc.so.6"
 mem-2474  [001] 683183.895321: sys_read(fd: 4, buf:
7fff8461a0f8, count: 340)
 mem-2474  [001] 683183.895328: sync_read:
(vfs_read+0xab/0x107 <- do_sync_read) arg1=340

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


Re: Tracing allocators of virtual memory and main memory

2015-03-11 Thread sahil aggarwal
Sample Output:


  mem-3374  [005] 589012.489483: mm_fault: (do_page_fault+0x3b3/0x3d8
<- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489486: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489489: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489493: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489495: sys_brk -> 0x23f1000
 mem-3374  [005] 589012.489500: kmem_cache_alloc:
call_site=810fda40 ptr=880fbe4bf298 bytes_req=176
bytes_alloc=176 gfp_flags=GFP_KERNEL|GFP_ZERO
 mem-3374  [005] 589012.489501: sys_brk -> 0x2417000
 mem-3374  [005] 589012.489504: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489511: mm_page_alloc:
page=ea00375619f0 pfn=16578386 order=0 migratetype=0
gfp_flags=GFP_KERNEL|GFP_REPEAT|GFP_ZERO
 mem-3374  [005] 589012.489512: kmem_cache_alloc:
call_site=81101422 ptr=880fb765b6a8 bytes_req=48
bytes_alloc=48 gfp_flags=GFP_KERNEL
 mem-3374  [005] 589012.489513: kmem_cache_alloc:
call_site=81101454 ptr=880fbe4c63a0 bytes_req=64
bytes_alloc=64 gfp_flags=GFP_KERNEL
 mem-3374  [005] 589012.489518: mm_page_alloc:
page=ea0034cccf00 pfn=15818528 order=0 migratetype=2
gfp_flags=GFP_HIGHUSER_MOVABLE|GFP_ZERO
 mem-3374  [005] 589012.489520: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=0
 mem-3374  [005] 589012.489526: mm_page_alloc:
page=ea0034b8d2e0 pfn=15795140 order=0 migratetype=2
gfp_flags=GFP_HIGHUSER_MOVABLE|GFP_ZERO
 mem-3374  [005] 589012.489527: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=0
 mem-3374  [005] 589012.489534: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489536: mm_fault:
(do_page_fault+0x3b3/0x3d8 <- handle_mm_fault) arg1=512
 mem-3374  [005] 589012.489552: mark_page_acc:
(unmap_vmas+0x553/0x812 <- mark_page_accessed)
 mem-3374  [005] 589012.489556: mark_page_acc:
(unmap_vmas+0x553/0x812 <- mark_page_accessed)
 mem-3374  [005] 589012.489557: mark_page_acc:
(unmap_vmas+0x553/0x812 <- mark_page_accessed)



These are some lines of stats for a program which ask for 4096*5 bytes
but dont touch them. If it touch those pages mm_page_alloc will
increase.  So is this correct way to capture brk,mmap and
mm_page_alloc to analyze how much pages thread asked for and how many
of it actually used.?

Thank you
Regards
Sahil

On 12 March 2015 at 08:40, SAHIL  wrote:
> Hi validis
>
> Actually i want to see how much total virtual pages it asked for and how many 
> it actually used, how many were put to swap, how many major page faults 
> happened and how many faults were handled from swap.
> In short whole page level analysis of thread.
>
> Regards
> Sahil Aggarwal
> Contact-9988439647
>
>> On Mar 12, 2015, at 7:24 AM, valdis.kletni...@vt.edu wrote:
>>
>> On Thu, 12 Mar 2015 07:09:32 +0530, SAHIL said:
>>
>>> Yeah right, pidstat which read /proc gives me VSZ ans RSS but i need to
>>> backtrace when VSZ/RSS is high which indicates process is allocating memory
>>> which it is not even using.
>>
>> Do you mean pages it isn't *currently* using, or has *never* used?
>>
>> Also, note that VSZ refers to the virtual size, which may include
>> pages currently out on swap, while RSS refers to actually resident pages.
>>
>> And then there's the other great bugaboo, shared pages that are mapped by 
>> more
>> than one process.
>>
>> What exactly are you trying to do?

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


Tracing allocators of virtual memory and main memory

2015-03-11 Thread sahil aggarwal
Hi all

If i want to trace the allocators of virtual memory and main memory of
process using ftrace on which functions i need to enable the probe.?

Currently i have enabled sys_mmap,sys_brk for virtual allocations and
mm_page_alloc, kmalloc, kmem_cache_alloc for main memory allocation.
Will this give me whole picture of virtual and main memory
allocations.?

Thanks
Regards
Sahil

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


Perf API vs Ftrace

2015-03-02 Thread sahil aggarwal
Hi all

Do anybody have experience using Perf API and Ftrace.? I am writing an
application to profile a process and using Ftrace. But came to know
that Perf provide API too so looking for some facts to benchmark
efficiency.

Thanks
Sahil
Regards

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


Re: Beginner in Kernel Development

2015-02-24 Thread sahil aggarwal
Hey Raphael,

I started doing it but got stuck at assembly code which i understand
only partially. Should i spend more time understanding it or go
further.?

Thanks
Regards
Sahil

On 24 February 2015 at 14:10, manoj kumar  wrote:
> Hello Raphael,
>
> I found this very useful. Thanks for sharing!
>
> Regards
> Manoj
>
>> Date: Sat, 21 Feb 2015 09:21:11 -0200
>> Subject: Re: Beginner in Kernel Development
>> From: raphaelcampos...@gmail.com
>> To: sahil.ag...@gmail.com
>> CC: kernelnewbies@kernelnewbies.org
>
>>
>> Hi Sahil,
>>
>> Another good point to start and really know how the kernel works, is
>> the "JamesM's kernel development tutorials".
>> http://www.jamesmolloy.co.uk/tutorial_html/
>>
>> In this tutorials, you'll understand and practice some details about
>> the base of the kernel.
>>
>> The Eudyptula Challenge is very good too.
>>
>> regards,
>>
>> 2015-02-21 3:06 GMT-02:00 sahil aggarwal :
>> > Hi all,
>> >
>> > I am using linux since past 9-10 months and have good programming skills
>> > in
>> > C/C++. Since past few weeks i am looking for good source to dive in
>> > kernel
>> > development but could not find the starting point and proper order of
>> > learning to be followed to join the community. I will be grateful if
>> > someone
>> > could point me in right direction.
>> >
>> > Thanks
>> > Regards
>> > Sahil
>> >
>> > ___
>> > Kernelnewbies mailing list
>> > Kernelnewbies@kernelnewbies.org
>> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>> >
>>
>>
>>
>> --
>> Raphael Campos Silva
>> Ciência da Computação - IBILCE Rio Preto - SP
>> Knowledge, exploit it.
>>
>> ___
>> 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: Beginner in Kernel Development

2015-02-21 Thread sahil aggarwal
Hi Raphael,

This is really good tutorial. Totally beginner's stuff. :)

Thanks

On 21 February 2015 at 16:51, Raphael Campos Silva <
raphaelcampos...@gmail.com> wrote:

> Hi Sahil,
>
> Another good point to start and really know how the kernel works, is
> the "JamesM's kernel development tutorials".
> http://www.jamesmolloy.co.uk/tutorial_html/
>
> In this tutorials, you'll understand and practice some details about
> the base of the kernel.
>
> The Eudyptula Challenge is very good too.
>
> regards,
>
> 2015-02-21 3:06 GMT-02:00 sahil aggarwal :
> > Hi all,
> >
> > I am using linux since past 9-10 months and have good programming skills
> in
> > C/C++. Since past few weeks i am looking for good source to dive in
> kernel
> > development but could not find the starting point and proper order of
> > learning to be followed to join the community. I will be grateful if
> someone
> > could point me in right direction.
> >
> > Thanks
> > Regards
> > Sahil
> >
> > ___
> > Kernelnewbies mailing list
> > Kernelnewbies@kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
>
> --
> Raphael Campos Silva
> Ciência da Computação - IBILCE Rio Preto - SP
> Knowledge, exploit it.
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Beginner in Kernel Development

2015-02-21 Thread sahil aggarwal
Thanks for replying Sudip. This seems to be exactly what i was looking for:
"A STARTING POINT ". I mailed them few hours ago but didnt get any respond.
Do they usually take this much time to respond.?

Regards.


On 21 February 2015 at 11:00, Sudip Mukherjee 
wrote:

> On Sat, Feb 21, 2015 at 10:36 AM, sahil aggarwal 
> wrote:
> > Hi all,
> >
> > I am using linux since past 9-10 months and have good programming skills
> in
> > C/C++. Since past few weeks i am looking for good source to dive in
> kernel
> > development but could not find the starting point and proper order of
> > learning to be followed to join the community. I will be grateful if
> someone
> > could point me in right direction.
>
> i found the best way to start is The Eudyptula Challenge ,
>
> regards
> sudip
>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Beginner in Kernel Development

2015-02-20 Thread sahil aggarwal
Hi all,

I am using linux since past 9-10 months and have good programming skills in
C/C++. Since past few weeks i am looking for good source to dive in kernel
development but could not find the starting point and proper order of
learning to be followed to join the community. I will be grateful if
someone could point me in right direction.

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