Re: profiling functions called in interrupt context
On Tue, Sep 20, 2011 at 5:59 AM, Amit Nagal helloin.a...@gmail.com wrote: On Tue, Sep 20, 2011 at 10:25 AM, rohan puri rohan.pur...@gmail.com wrote: On Tue, Sep 20, 2011 at 10:13 AM, Amit Nagal helloin.a...@gmail.com wrote: On Tue, Sep 20, 2011 at 10:05 AM, rohan puri rohan.pur...@gmail.com wrote: On Tue, Sep 20, 2011 at 9:44 AM, Amit Nagal helloin.a...@gmail.com wrote: Hi , i want to measure time spend in a callback function called from interrupt context . since the time spend will be in us / ns , what kernel apis can i use to measure it ? also since i want to use it in interrupt context , kernel time measurement apis should not sleep . i am using embedded arm target , and tools like OProfile are not available . can i be guided which kernel time measurement apis shall i use to measure time in a interrupt callback ? Regards Amit Nagal For this you can make use of ftrace. Refer link http://www.mjmwired.net/kernel/Documentation/trace/ftrace.txt Regards, Rohan Tools like ftrace are not available to me in my embedded arm target . So i want to use kernel apis to deal with time measurement in interrupt context . Regards Amit Nagal Hi Amit, I think ftrace can be enabled and used on arm arch. Please Refer http://www.omappedia.org/wiki/Installing_and_Using_Ftrace Regards, Rohan Ok , thanks for the link . i will try the same . Couldn't use ktimer, it says that is a high resolution timer inside the kernel, you could combine ktimer with kretprobe (you assing a function prior to the calling of your function and another when finished ). It is a instrumentation method inside the kernel. Regards Amit Nagal ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -- Nuno Martins ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: profiling functions called in interrupt context
On Tue, Sep 20, 2011 at 4:11 PM, Nuno Martins nuno.m.g.mart...@gmail.com wrote: On Tue, Sep 20, 2011 at 5:59 AM, Amit Nagal helloin.a...@gmail.com wrote: On Tue, Sep 20, 2011 at 10:25 AM, rohan puri rohan.pur...@gmail.com wrote: On Tue, Sep 20, 2011 at 10:13 AM, Amit Nagal helloin.a...@gmail.com wrote: On Tue, Sep 20, 2011 at 10:05 AM, rohan puri rohan.pur...@gmail.com wrote: On Tue, Sep 20, 2011 at 9:44 AM, Amit Nagal helloin.a...@gmail.com wrote: Hi , i want to measure time spend in a callback function called from interrupt context . since the time spend will be in us / ns , what kernel apis can i use to measure it ? also since i want to use it in interrupt context , kernel time measurement apis should not sleep . i am using embedded arm target , and tools like OProfile are not available . can i be guided which kernel time measurement apis shall i use to measure time in a interrupt callback ? Regards Amit Nagal For this you can make use of ftrace. Refer link http://www.mjmwired.net/kernel/Documentation/trace/ftrace.txt Regards, Rohan Tools like ftrace are not available to me in my embedded arm target . So i want to use kernel apis to deal with time measurement in interrupt context . Regards Amit Nagal Hi Amit, I think ftrace can be enabled and used on arm arch. Please Refer http://www.omappedia.org/wiki/Installing_and_Using_Ftrace Regards, Rohan Ok , thanks for the link . i will try the same . Couldn't use ktimer, it says that is a high resolution timer inside the kernel, you could combine ktimer with kretprobe (you assing a function prior to the calling of your function and another when finished ). It is a instrumentation method inside the kernel. kernel/Documentation/kprobes.txt Regards Amit Nagal ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -- Nuno Martins ___ 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: Why do the CFS chase fairness?
Hi, I have gotten clearer idea of fairness between processes. Thanks for your explanation with enough patience. :-) 2011/9/20 Mulyadi Santosa mulyadi.sant...@gmail.com: Hi . I am reaching my virtual limit here, so beg me pardon :) On Mon, Sep 19, 2011 at 23:26, Parmenides Hmm..., does that mean timeslice weighting introduce unfainess? If we think fairness relies on each task not fetching more timeslice than other tasks, the eaiest way to achieve fairness is to give every task the same timeslice. At the extreme theoritical side, yes, but again that is if all are CPU bound the complication comes since in reality most processes are mixture of CPU and I/O bound...or sometimes I/O bound only. Can I understand like this: each task advance its progress tinier than traditional timeslice, which makes C has more chances to be selected to preempt A or B owing to its higher priority? Higer priority makes C's virtual time smaller than A and B. in non preemptive kernel i.e cooperative scheduling, your above suggested idea is the right way to achieve fairness in such situation. However, since user space (and now kernel space too) implements preemptive, adjusting time slice is not really necessary to make C kicks back into run queue. What the scheduler needs perhaps at this point is good priority recalculation is C could run ASAP. If not, even though C is in run queue, it still can beat the other processes in the competition of CPU time. -- 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
2.6.39 Kernel Changes for FileSystem, get_sb removed
Hi list, It seems that the support for get_sb function is removed from kernel 2.6.39 onwards. My code which is working till 2.6.38 series is failing with new kernels. I tried finding out but there isnt anything mentioned. So if this function itself is removed then how kernel is going to find out the superblock and use it? Are we supposed to use the mount function provided? This is what i got from one of the kernel patch email. +[mandatory] + -get_sb() is gone. Switch to use of -mount(). Typically it's just +a matter of switching from calling get_sb_... to mount_... and changing the +function type. If you were doing it manually, just switch from setting -mnt_root +to some pointer to returning that pointer. On errors return ERR_PTR(...). diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt It looks like there are other changes related to Pages are also done. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
do_gettiimeofday query
I am having trouble with do_gettimeofday() function. I have following source code: int my_module_init(void) { struct timeval tv = {0}; do_gettimeofday(tv); printk(tv.tv_sec = %lu\n, tv.tv_sec); return 0; } module_init(my_module_init); This code is built-in kernel, and therefore my_module_init is called during device_initcall. However the tv_sec value seems to be wrong (I was expecting this value to be absolute number of seconds since 1970), but it prints 11 or 12 (which seems to be number of seconds since last boot). I checked do_gettimeofday function source which gets the value from xtime variable. I could not find who is responsible for initializing xtime. I tried to change module_init by late_initcall_sync. Still it's same. Any help is appreciated. Regards Lal ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: 2.6.39 Kernel Changes for FileSystem, get_sb removed
On Tue, Sep 20, 2011 at 5:14 PM, Abhijit Pawar apawar.li...@gmail.comwrote: Hi list, It seems that the support for get_sb function is removed from kernel 2.6.39 onwards. My code which is working till 2.6.38 series is failing with new kernels. I tried finding out but there isnt anything mentioned. So if this function itself is removed then how kernel is going to find out the superblock and use it? Are we supposed to use the mount function provided? This is what i got from one of the kernel patch email. +[mandatory] + -get_sb() is gone. Switch to use of -mount(). Typically it's just +a matter of switching from calling get_sb_... to mount_... and changing the +function type. If you were doing it manually, just switch from setting -mnt_root +to some pointer to returning that pointer. On errors return ERR_PTR(...). diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt It looks like there are other changes related to Pages are also done. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies Hi Abhijit, Yes you have to make use of mount function pointer in the struct file_system_type. NOTE : - change is only in one parameter of type struct vfsmount which is basically removed from this function pointer. Regards, Rohan Puri ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: 2.6.39 Kernel Changes for FileSystem, get_sb removed
On 09/20/2011 05:14 PM, Abhijit Pawar wrote: Hi list, It seems that the support for get_sb function is removed from kernel 2.6.39 onwards. My code which is working till 2.6.38 series is failing with new kernels. I tried finding out but there isnt anything mentioned. So if this function itself is removed then how kernel is going to find out the superblock and use it? Are we supposed to use the mount function provided? This is what i got from one of the kernel patch email. +[mandatory] + -get_sb() is gone. Switch to use of -mount(). Typically it's just +a matter of switching from calling get_sb_... to mount_... and changing the +function type. If you were doing it manually, just switch from setting -mnt_root +to some pointer to returning that pointer. On errors return ERR_PTR(...). diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt It looks like there are other changes related to Pages are also done. Regards, Abhijit Pawar I have modified the code to use the mount function and its working correctly. There is one more change I noticed for struct address_space_operations: The sync_page is removed. The code is working now. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: 2.6.39 Kernel Changes for FileSystem, get_sb removed
On 09/20/2011 05:50 PM, rohan puri wrote: On Tue, Sep 20, 2011 at 5:14 PM, Abhijit Pawar apawar.li...@gmail.com mailto:apawar.li...@gmail.com wrote: Hi list, It seems that the support for get_sb function is removed from kernel 2.6.39 onwards. My code which is working till 2.6.38 series is failing with new kernels. I tried finding out but there isnt anything mentioned. So if this function itself is removed then how kernel is going to find out the superblock and use it? Are we supposed to use the mount function provided? This is what i got from one of the kernel patch email. +[mandatory] + -get_sb() is gone. Switch to use of -mount(). Typically it's just +a matter of switching from calling get_sb_... to mount_... and changing the +function type. If you were doing it manually, just switch from setting -mnt_root +to some pointer to returning that pointer. On errors return ERR_PTR(...). diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt It looks like there are other changes related to Pages are also done. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org mailto:Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies Hi Abhijit, Yes you have to make use of mount function pointer in the struct file_system_type. NOTE : - change is only in one parameter of type struct vfsmount which is basically removed from this function pointer. Regards, Rohan Puri Thanks Rohan. Yes, i have made the changes and things are looking good. struct address_space_operation's sync_page is also removed. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: 2.6.39 Kernel Changes for FileSystem, get_sb removed
On Tue, Sep 20, 2011 at 5:54 PM, Abhijit Pawar apawar.li...@gmail.comwrote: On 09/20/2011 05:50 PM, rohan puri wrote: On Tue, Sep 20, 2011 at 5:14 PM, Abhijit Pawar apawar.li...@gmail.comwrote: Hi list, It seems that the support for get_sb function is removed from kernel 2.6.39 onwards. My code which is working till 2.6.38 series is failing with new kernels. I tried finding out but there isnt anything mentioned. So if this function itself is removed then how kernel is going to find out the superblock and use it? Are we supposed to use the mount function provided? This is what i got from one of the kernel patch email. +[mandatory] +-get_sb() is gone. Switch to use of -mount(). Typically it's just +a matter of switching from calling get_sb_... to mount_... and changing the +function type. If you were doing it manually, just switch from setting -mnt_root +to some pointer to returning that pointer. On errors return ERR_PTR(...). diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt It looks like there are other changes related to Pages are also done. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies Hi Abhijit, Yes you have to make use of mount function pointer in the struct file_system_type. NOTE : - change is only in one parameter of type struct vfsmount which is basically removed from this function pointer. Regards, Rohan Puri Thanks Rohan. Yes, i have made the changes and things are looking good. struct address_space_operation's sync_page is also removed. Regards, Abhijit Pawar Welcome :) ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: 2.6.39 Kernel Changes for FileSystem, get_sb removed
Hi Abhijit, On Tue, Sep 20, 2011 at 5:14 PM, Abhijit Pawar apawar.li...@gmail.comwrote: Hi list, It seems that the support for get_sb function is removed from kernel 2.6.39 onwards. My code which is working till 2.6.38 series is failing with new kernels. The function get_sb() is still present in security/inode.c in kernel 2.6.39. Only the function pointer of get_sb() has been removed from struct file_system_type in /include/linux/fs.h. I tried finding out but there isnt anything mentioned. So if this function itself is removed then how kernel is going to find out the superblock and use it? Are we supposed to use the mount function provided? This is what i got from one of the kernel patch email. Yes , you are supposed to use mount function. visit the following link : http://lxr.linux.no/#linux+v2.6.39/security/inode.c#L144http://lxr.linux.no/#linux+v2.6.39/security/inode.c%23L144 +[mandatory] + -get_sb() is gone. Switch to use of -mount(). Typically it's just +a matter of switching from calling get_sb_... to mount_... and changing the +function type. If you were doing it manually, just switch from setting -mnt_root +to some pointer to returning that pointer. On errors return ERR_PTR(...). diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt It looks like there are other changes related to Pages are also done. Regards, Abhijit Pawar ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -- Regards, Kashish ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: do_gettiimeofday query
On Tue, Sep 20, 2011 at 5:16 PM, Lal learner.ker...@gmail.com wrote: I am having trouble with do_gettimeofday() function. I have following source code: int my_module_init(void) { struct timeval tv = {0}; do_gettimeofday(tv); printk(tv.tv_sec = %lu\n, tv.tv_sec); return 0; } module_init(my_module_init); This code is built-in kernel, and therefore my_module_init is called during device_initcall. However the tv_sec value seems to be wrong (I was expecting this value to be absolute number of seconds since 1970), but it prints 11 or 12 (which seems to be number of seconds since last boot). I checked do_gettimeofday function source which gets the value from xtime variable. I could not find who is responsible for initializing xtime. I tried to change module_init by late_initcall_sync. Still it's same. Any help is appreciated. Regards Lal ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies If you want time since the epoch in seconds then you can call the architecture specific method get_wallclock(), but make sure u hold the appropriate lock during this call. For eg. this is how its done for x86 arch : - void read_persistent_clock(struct timespec *ts) { unsigned long retval, flags; spin_lock_irqsave(rtc_lock, flags); retval = x86_platform.get_wallclock(); spin_unlock_irqrestore(rtc_lock, flags); ts-tv_sec = retval; ts-tv_nsec = 0; } NOTE : - this read_persistent_clock() function is not exported so u cannot make use of this symbol in your code. But x86_platform is exported variable, so u can make use of that. xtime is updated by the function xtime_update() do_timer() - update_wall_time() (This function sets the xtime variables time). This code path is trigger on every timer interrupt. Also, this time is measured from system boot as you correctly said. Regards, Rohan Puri. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Why do the CFS chase fairness?
Hi Permenides :) On Tue, Sep 20, 2011 at 18:11, Parmenides mobile.parmeni...@gmail.com wrote: Hi, I have gotten clearer idea of fairness between processes. Thanks for your explanation with enough patience. :-) Looks like I made few typos here and there, so allow me to put few erratas :) 2011/9/20 Mulyadi Santosa mulyadi.sant...@gmail.com: What the scheduler needs perhaps at this point is good priority recalculation is C could run ASAP. If not, even though C is in run recalculation so C could be executed ASAP. ... queue, it still can beat the other processes in the competition of CPU ...it could be beaten by other processes.. -- 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: Why do the CFS chase fairness?
2011/9/21 Mulyadi Santosa mulyadi.sant...@gmail.com: Hi Permenides :) Looks like I made few typos here and there, so allow me to put few erratas :) 2011/9/20 Mulyadi Santosa mulyadi.sant...@gmail.com: What the scheduler needs perhaps at this point is good priority recalculation is C could run ASAP. If not, even though C is in run recalculation so C could be executed ASAP. ... queue, it still can beat the other processes in the competition of CPU ...it could be beaten by other processes.. Yes, even with enough timeslice, if C does not have high enough priority, it can not preempt A or B. That's the point where priority play its role when the scheduler prefer to IO-bound tasks. Thank you again. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
question on memory mapping one page at a time
Hi all, can anyone please explain the following code, what it is doing. I want the first few statements of the code, as they are calculating page frame number. This is little confusing, thanks in advance. struct page *simple_vma_nopage(struct vm_area_struct *vma, unsigned long address, int *type) { struct page *pageptr; unsigned long offset = vma-vm_pgoff PAGE_SHIFT; unsigned long physaddr = address - vma-vm_start + offset; unsigned long pageframe = physaddr PAGE_SHIFT; if (!pfn_valid(pageframe)) return NOPAGE_SIGBUS; pageptr = pfn_to_page(pageframe); get_page(pageptr); if (type) *type = VM_FAULT_MINOR; return pageptr; } -- Regards, Sri. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: looking for 3.0 source
Thanks Mirco. But how about if I want to download 3.0.4 source? Jacky On 9/15/2011 6:08 AM, Mirco Tischler wrote: 2011/9/14 Littlefield, Tylerty...@tysdomain.com: Hello: With the recent attacks on kernel.org, it's down and I'm unsure of where to get what I want. I found the 2.6 branch on github, but I'm looking for kernel 3.0's source, not 3.4 or whatever we're on now. Is there somewhere I can get it? https://github.com/torvalds/linux is a clone of the main git repo on kernel.org. It contains all versions since 2.6.11, including 3.0 and the most recent 3.1-rc6. You can even download the tarballs there. Mirco ___ 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
File change notification along with user
Hi all, Is it possible to write a module/driver which notifies file/directory change asynchronously along with user name(or with uid) who modified it. inotify will do change notification but it will not provide uid who modified/created the file. audit and inotify combination can work, but I'm looking for a better option than this. Please help me. Thanks, Ravi ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: File change notification along with user
On Wed, Sep 21, 2011 at 10:03 AM, V.Ravikumar ravikumar.valla...@gmail.comwrote: Hi all, Is it possible to write a module/driver which notifies file/directory change asynchronously along with user name(or with uid) who modified it. inotify will do change notification but it will not provide uid who modified/created the file. audit and inotify combination can work, but I'm looking for a better option than this. Please help me. Thanks, Ravi ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies You can have a look at fanotify. Refer http://lwn.net/Articles/339253/ Regards, Rohan Puri ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies