Re: variant length array?

2016-04-05 Thread Rajat Sharma
On Tue, Apr 5, 2016 at 1:00 PM, Bjørn Mork wrote: > > "Robert P. J. Day" writes: > > On Tue, 5 Apr 2016, Wenda Ni wrote: > > > >> Hi all, > >> > >> I come across the following code in a kernel module code. It defines > >> an array whose length is variant at

Re: Question about switch_mm function

2015-03-25 Thread Rajat Sharma
On Mar 25, 2015 6:33 AM, Sreejith M M sreejith...@gmail.com wrote: On Wed, Jan 28, 2015 at 9:56 PM, Sreejith M M sreejith...@gmail.com wrote: Hi, I was trying to understand the difference in scheduling between processes and threads(belong to same process). I was thinking that, when

Re: Question about switch_mm function

2015-03-25 Thread Rajat Sharma
On Wed, Mar 25, 2015 at 10:33 AM, Rajat Sharma fs.ra...@gmail.com wrote: On Mar 25, 2015 10:31 AM, Sreejith M M sreejith...@gmail.com wrote: On Wed, Mar 25, 2015 at 10:55 PM, valdis.kletni...@vt.edu wrote: On Wed, 25 Mar 2015 21:35:22 +0530, Sreejith M M said: This code

Re: Query regarding Kernel Space Memory

2015-02-24 Thread Rajat Sharma
On Tue, Feb 24, 2015 at 11:53 AM, Vishwas Srivastava vishu.ker...@gmail.com wrote: Hi Sannu, 1G/3G address split is for virtual address. I am not talking about physical address translation stuff here. When a kernel code is compiled for a 32 bit architecture, my assumption is,

Re: Implementing a NFS proxy

2014-06-05 Thread Rajat Sharma
Have a look at this: https://github.com/nfs-ganesha/nfs-ganesha/wiki/PROXY I believe NFS ganesha is quite mature and production ready implementation. On Thu, Jun 5, 2014 at 11:04 AM, Ramana Reddy gtvrre...@gmail.com wrote: Thanks for your reply. This link does not solve my problem. I need a

Re: Linux reboot command takes too long

2014-05-30 Thread Rajat Sharma
It looks like your system has: 1. Kernel crash dump configured. 2. Something is causing crash while you issue a reboot, may be some module unload path has a bug. 3. Crash is triggering kernel dump to take dump of memory (I guess you have plenty of RAM to justify 45 minutes) in

Re: Linux reboot command takes too long

2014-05-30 Thread Rajat Sharma
you have kdump enabled crashkernel=512M@128M On Fri, May 30, 2014 at 2:38 PM, Vipul Jain vipu...@gmail.com wrote: On Fri, May 30, 2014 at 12:32 PM, Vipul Jain vipu...@gmail.com wrote: Hi All, I have a quick question on Linux reboot: On my system I have /var/core directory created which

Re: Blocked I/O in read() and mmap()

2014-02-26 Thread Rajat Sharma
It seems this task landscape-sysin is trying to peek into virtual memory of your processes and the process within mmap call is holding its mm-mmap_sem semaphore which grants access to its address space. landscape-sysin is trying to grab this semaphore to poke into address space of your mmap

Re: Blocked I/O in read() and mmap()

2014-02-26 Thread Rajat Sharma
for the data. On Wed, Feb 26, 2014 at 4:14 PM, Le Tan tamlokv...@gmail.com wrote: So what should I do if I want the mmap() not to return right now? Is it strange to block in mmap() and few people will do this? Thanks for your help! 2014-02-27 4:45 GMT+08:00 Rajat Sharma fs.ra...@gmail.com: It seems

Re: Blocked I/O in read() and mmap()

2014-02-26 Thread Rajat Sharma
:00 Rajat Sharma fs.ra...@gmail.com: Why do you need to block in mmap()? mmap is supposed to create a mapping area in virtual address space for the process. Actual transfer happens later through page fault handlers on demand basis. look at vm_operations fault/readpage etc methods, these might

Re: Breaking up a bvec in a bio for reading more than 512

2014-01-06 Thread Rajat Sharma
Why do you want to avoid creating multiple bio? If you have data on multiple disks, create multiple of them and shoot them simultaneously to get advantage of parallel IO. And if it is single disk, elevators of lower disk would do a good job of reading/writing them in serial order of disk seek. I

Re: Breaking up a bvec in a bio for reading more than 512

2014-01-06 Thread Rajat Sharma
. I just meant to say that if there is another method which involves not breaking the bio (as i understand breaking the bio) i would love to know it. Regards, Neha On Mon, Jan 6, 2014 at 12:23 PM, Rajat Sharma fs.ra...@gmail.com wrote: Why do you want to avoid creating multiple bio? If you

Re: Interrupt fires when module is unloaded

2014-01-06 Thread Rajat Sharma
It would be nice to post the code when asking for debugging help. Looks like your interrupts are in masked state but when you unload the driver they are getting unmasked and hence you are receiving them on unload. -Rajat On Mon, Jan 6, 2014 at 4:09 PM, Eric Fowler eric.fow...@gmail.com wrote:

Re: Breaking up a bvec in a bio for reading more than 512

2014-01-03 Thread Rajat Sharma
create multiple bio. -Rajat On Fri, Jan 3, 2014 at 3:41 PM, neha naik nehanai...@gmail.com wrote: Hi All, I am getting a request with bvec-bv_len 512. Now, the information to be read is scattered across the entire disk in 512 chunks. So that, information on disk can be : sector 8,

Re: Can't cleanly unload driver

2013-12-30 Thread Rajat Sharma
Hi Eric, I have seen some errors with module reference counting with a nicely written code, but culprit for my case was a missing compilation flag -DMODULE which gives definition of THIS_MODULE, otherwise it is null e.g. for modules which are compiled in kernel, so they are never unloaded. Unless

Re: watchdog pet in kernel module

2013-12-04 Thread Rajat Sharma
Although /dev/watchdog is available in usermode, but nothing should stop you to write to it from a kernel thread. Rajat On Wed, Dec 4, 2013 at 5:50 PM, Peter Teoh htmldevelo...@gmail.com wrote: On Thu, Dec 5, 2013 at 9:06 AM, Vipul Jain vipu...@gmail.com wrote: On Wed, Dec 4, 2013 at

Re: Ordering / preemption of work in a workqueue preempt?

2013-11-15 Thread Rajat Sharma
Hi Rajat, On Fri, Nov 15, 2013 at 7:16 AM, Rajat Jain rajatj...@juniper.net wrote: Hi, I have a single work queue, on which I have scheduled a worker function [using queue_work(wq, fn)] in interrupt context. I get the interrupt twice before the work queue gets a chance to run, and hence

Re: Block device driver question

2013-11-01 Thread Rajat Sharma
Hi Neha, On Fri, Nov 1, 2013 at 10:26 AM, neha naik nehanai...@gmail.com wrote: Hi, I am writing a block device driver and i am using the 'blq_queue_make_request' call while registering my block device driver. Now as far as i understand this will bypass the linux kernel queue for each

Re: Block device driver question

2013-11-01 Thread Rajat Sharma
size declared as 512 ? I am doing a normal dd without any special flags, just 'bs=512'. Regards, Neha On Fri, Nov 1, 2013 at 12:16 PM, Rajat Sharma fs.ra...@gmail.com wrote: Hi Neha, On Fri, Nov 1, 2013 at 10:26 AM, neha naik nehanai...@gmail.com wrote: Hi, I am writing

RE: Help - Linux kernel and Device drivers

2013-08-22 Thread Rajat Sharma
I think you can start with Device driver book, try implementing its example drivers, at the same time you can read corresponding topics from Robert love. Later when you want to deep dive into some particular topics, refer to UTLK book. Rajat -- From: Tharanga Abeyseela

RE: Conceptual questions about device driver

2013-08-02 Thread Rajat Sharma
Freemyer Cc: Rajat Sharma; kernelnewbies Subject: Re: Conceptual questions about device driver Thanks for the responses. I have one more question for Greg. I come from filesystem background and not device driver so i may be a bit confused about the write order fidelity. I know that filesystems

Re: sys_read buffer too large

2013-07-21 Thread Rajat Sharma
On Sat, Jul 20, 2013 at 8:49 PM, anish singh anish198519851...@gmail.comwrote: On Sat, Jul 20, 2013 at 2:04 PM, Don Raikes don.rai...@oracle.com wrote: Hello all, ** ** I am very new to kernel programming. In fact, I have been working on it for a week now. ** ** I am taking

RE: Git gui tools for linux

2013-07-16 Thread Rajat Sharma
One non free option is git-eye. -- From: Anand Moon Sent: 17-07-2013 00:08 To: Kernelnewbies@kernelnewbies.org Subject: Git gui tools for linux Hi All, Could you suggest me good Git GUI tool in Linux to create/merge/update. I have installed few of them like git-gui

Re: How to benchmark my OS

2013-07-15 Thread Rajat Sharma
I am not sure if this one is directly relevant to your case, but you might want to take a look at LTP: http://ltp.sourceforge.net/ -Rajat On Mon, Jul 15, 2013 at 8:26 AM, Steven Zhou lullaby2...@gmail.com wrote: Hi, We have developed our private OS and we want to benchmark the performance

Re: hi Why is can't find a register in class ‘AREG’ while reloading ‘asm’ ?

2013-05-27 Thread Rajat Sharma
I tried compiling this but I get slightly different error: error: can’t find a register in class ‘CREG’ while reloading ‘asm’ this error is because of explicit clobber list which is not needed in this case as all registers in clobber list are input list. Note that it is CREG because it

Re: Reference material for x86-64 assembly on Linux

2013-05-20 Thread Rajat Sharma
Following book describes GNU assembler in a very simple manner: http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764579010.html On Mon, May 20, 2013 at 2:43 PM, wannabehacker wb wbhac...@gmail.comwrote: The art of assembly language by randall hyde is an excellent reference. Intel website

Re: Forum for asking questions related to block device drivers

2013-04-11 Thread Rajat Sharma
? When i tried seeing what read requests were coming then i saw that when i issue dd with count=1 it retrieves 4 pages, so i tried with 'direct' flag. But even with direct io my read performance is way lower than my write performance. Regards, Neha On Wed, Apr 10, 2013 at 11:15 PM, Rajat Sharma

Re: Forum for asking questions related to block device drivers

2013-04-10 Thread Rajat Sharma
Hi, On Thu, Apr 11, 2013 at 2:23 AM, neha naik nehanai...@gmail.com wrote: Hi All, Nobody has replied to my query here. So i am just wondering if there is a forum for block device driver where i can post my query. Please tell me if there is any such forum. Thanks, Neha --

Re: Where does kernel store per task file position?

2013-01-29 Thread Rajat Sharma
I'm still not able to figure out where exactly is the position of file stored per task_struct. struct file * itself is per process (task_struct) so file-f_pos is file position per process, if thats what you are looking for. I hope you haven't assumed that struct file itself is unique for a file,

Re: Where does kernel store per task file position?

2013-01-29 Thread Rajat Sharma
Correct :) On Wed, Jan 30, 2013 at 12:01 PM, Pranay Kumar Srivastava pranay.shrivast...@hcl.com wrote: -Original Message- From: Rajat Sharma [mailto:fs.ra...@gmail.com] Sent: Wednesday, January 30, 2013 11:16 AM To: Pranay Kumar Srivastava Cc: kernelnewbies

Re: internel implemention of file operation

2013-01-11 Thread Rajat Sharma
out writing a simple mmap program. -Rajat On Fri, Jan 11, 2013 at 3:31 AM, horseriver horseriv...@gmail.com wrote: On Fri, Jan 11, 2013 at 12:39:26PM +0530, Rajat Sharma wrote: Default read/write inerfaces are better suited for sequential read/write within your program. Although you can

Re: What is asmlinkage ?

2013-01-10 Thread Rajat Sharma
-for-a-c-function-to-be-called-from-assembly From above, asmlinkage is also NOT the only way.. On Fri, Jan 4, 2013 at 6:29 PM, anish singh anish198519851...@gmail.comwrote: On Fri, Jan 4, 2013 at 3:41 PM, Rajat Sharma fs.ra...@gmail.com wrote: Is this correct for all architectures? I

Re: What is asmlinkage ?

2013-01-10 Thread Rajat Sharma
is used which is nothing special and just extern 'C' declaration to avoid garbled naming of C++ linkage, thats it. -Rajat On Fri, Jan 11, 2013 at 12:00 PM, Peter Teoh htmldevelo...@gmail.comwrote: On Fri, Jan 11, 2013 at 1:35 PM, Rajat Sharma fs.ra...@gmail.com wrote: asmlinkage is defined

Re: internel implemention of file operation

2013-01-10 Thread Rajat Sharma
Default read/write inerfaces are better suited for sequential read/write within your program. Although you can seek to any location within the file, you still have overhead to issue system calls to get data. However mmap allows you to map a section of file into program address space. Now if your

Re: internel implemention of file operation

2013-01-03 Thread Rajat Sharma
, 2013 at 3:39 PM, horseriver horseriv...@gmail.com wrote: On Thu, Jan 03, 2013 at 01:16:06PM +0530, Rajat Sharma wrote: will it be maped with vm_area struct ? Yes if it is accessed via mmap system call. you know that , in the struct vm_area_struct,there is a struct vm_operations_struct

Re: What is asmlinkage ?

2013-01-03 Thread Rajat Sharma
So with asmlinkage we request compiler to put args on stack. What is advantage of this to start_kernel or in general to other functions ? See its about implementation ease and little of performance too. Assuming the default model of keeping arguments in registers is used. lets say arguments are

Re: internel implemention of file operation

2013-01-02 Thread Rajat Sharma
Never heard of page-cache? On Thu, Jan 3, 2013 at 12:29 PM, horseriver horseriv...@gmail.com wrote: hi: when one file is opened , does its data be put into memory ? and all operation on this file will be implemented by operation on its mapping memory area ? thanks!

Re: internel implemention of file operation

2013-01-02 Thread Rajat Sharma
operation? file operations for data access like read/write will look into page-cache first before going to disk. -Rajat On Thu, Jan 3, 2013 at 1:01 PM, horseriver horseriv...@gmail.com wrote: On Thu, Jan 03, 2013 at 12:48:01PM +0530, Rajat Sharma wrote: Never heard of page-cache? will it be maped

Re: Max open file limit

2012-12-05 Thread Rajat Sharma
Well this is not really a limit on number of files, rather a memory allocation optimization for fd_array. The limit you are looking for is: int sysctl_nr_open __read_mostly = 1024*1024; $ cat /proc/sys/fs/nr_open 1048576 -Rajat On Wed, Dec 5, 2012 at 4:38 PM, Vijay Chauhan

Re: Compiling the source RPM file.

2012-09-28 Thread Rajat Sharma
If you already have a source rpm, rather use rpmbuild to automatically apply patches and build rpm. When you install the source rpm, it will create a directory hierarchy in your home directory something like this: BUILD SOURCES SPEC RPMS SOURCES will hold the tar ball and SPEC holds rpm

Re: Problem during /init execve

2012-09-25 Thread Rajat Sharma
The result is the same with and without CONFIG_EXT2_FS_XATTR enabled. so may be its not getxattr, but inode itself is null: if (!inode || !inode-i_op-getxattr) you can verify that by breaking if condition into two separate conditions. CONFIG_AUDIT is disabled in my config. A priori, I don't

Re: Problem during /init execve

2012-09-24 Thread Rajat Sharma
Does your kernel config set this option: CONFIG_EXT2_FS_XATTR=y And what is the state of CONFIG_AUDIT option? Do you need Kernel Audit support in your environment? -Rajat On Mon, Sep 24, 2012 at 9:42 PM, stl st.lamber...@gmail.com wrote: Hi it is for the VFS, ext2 is selected in my .config.

Re: Maximum size of data segment used by c program

2012-09-17 Thread Rajat Sharma
yes there is a limit, look at # man setrlimit RLIMIT_DATA The maximum size of the process's data segment (initialized data, uninitialized data, and heap). This limit affects calls to brk(2) and sbrk(2), which fail with the error ENOMEM upon encountering the soft

Re: Maximum size of data segment used by c program

2012-09-17 Thread Rajat Sharma
On Mon, Sep 17, 2012 at 4:34 PM, devendra.aaru devendra.a...@gmail.com wrote: On Mon, Sep 17, 2012 at 6:17 AM, Rajat Sharma fs.ra...@gmail.com wrote: yes there is a limit, look at getrlimit show the size as 4GiGs of RLIMIT_DATA on a 32-bit. which means that its unlimited? I mean

Re: kernel stack memory

2012-09-16 Thread Rajat Sharma
Some useful debugging options: CONFIG_DEBUG_STACK_USAGE CONFIG_DEBUG_STACKOVERFLOW if you take enough large array so as to hit the heap area at that present moment (they both grow towards each other) I doubt if it is true for kernel mode stack. Kernel stack allocation is plain pages

Re: kernel stack memory

2012-09-13 Thread Rajat Sharma
The kernel stack is part of task_struct of the running process Please double check that, its not part of task_struct, rather on some architectures, kernel stack is extended by a thread_info structure at the end which keeps a link to task_struct of the process. -Rajat On Thu, Sep 13, 2012 at

Re: Is it possible to use a local drive to cache an NFS share

2012-09-03 Thread Rajat Sharma
Hi, NFS client support FSCache support which is default in recent kernels CONFIG_NFS_FSCACHE=y, But as I remember, it is a read cache (not even write-through), so a compile load generates lots of new files, so those won't really be benefited by FSCache. But as you are pointing out, your setup is

Re: Stackable file systems and NFS

2012-08-16 Thread Rajat Sharma
Sinha rnjn.si...@gmail.com wrote: Hi, On Tue, Aug 14, 2012 at 4:19 PM, Rajat Sharma fs.ra...@gmail.com wrote: Try mounting with noac nfs mount option to disable attribute caching. ac / noac Selects whether the client may cache file attributes. If neither option is specified (or if ac

Re: Stackable file systems and NFS

2012-08-16 Thread Rajat Sharma
What is the pattern other NFS client is writing to the file? Can't it be a legitimate NUL by any chance? On Thu, Aug 16, 2012 at 1:22 PM, Ranjan Sinha rnjn.si...@gmail.com wrote: On Thu, Aug 16, 2012 at 1:00 PM, Rajat Sharma fs.ra...@gmail.com wrote: Correct me if I am reading something wrong

Re: Stackable file systems and NFS

2012-08-16 Thread Rajat Sharma
So is it truncating the file? i.e. # ping /nfs/somefile On Thu, Aug 16, 2012 at 2:46 PM, Ranjan Sinha rnjn.si...@gmail.com wrote: On Thu, Aug 16, 2012 at 1:33 PM, Rajat Sharma fs.ra...@gmail.com wrote: What is the pattern other NFS client is writing to the file? Can't it be a legitimate NUL

Re: Stackable file systems and NFS

2012-08-14 Thread Rajat Sharma
Try mounting with noac nfs mount option to disable attribute caching. ac / noac Selects whether the client may cache file attributes. If neither option is specified (or if ac is specified), the client caches file attributes. -Rajat On Tue, Aug 14, 2012 at 3:51 PM, Mulyadi Santosa

RE: How to know which programming model is used on may Linux

2012-07-25 Thread Rajat Sharma
machine MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Just compile the code with kbuild and print sizeof? -- Rajat From: Pritam Bankar Sent: 25-07-2012 16:34 To: kernelnewbies Subject: How to know which programming model is used on may Linux machine

RE: [RFC]confusions about 'struct' define

2012-05-30 Thread Rajat Sharma
This might be the case of cyclic dependency where header files defining these structures are also including this .h file. -Rajat From: harryxiyou Sent: 30-05-2012 23:08 To: Gaurav Jain Cc: Greg-Kroah-Hartman; Harry Wei; kernelnewbies@kernelnewbies.org Subject: Re: [RFC]confusions about 'struct'

Re: Question on registering driver fops

2012-02-14 Thread Rajat Sharma
On Wed, Feb 15, 2012 at 10:15 AM, Ezequiel García elezegar...@gmail.comwrote: El día 14 de febrero de 2012 19:42, Greg KH g...@kroah.com escribió: On Tue, Feb 14, 2012 at 07:05:48PM -0300, Ezequiel García wrote: I noticed that after registering a video driver with video_register_device the

Re: Init global variables at run-time

2012-01-22 Thread Rajat Sharma
Means the initialization function of this driver is called multiple times, once on module load, further may be some reset functionality? On Sun, Jan 22, 2012 at 2:14 AM, V l vlove...@gmail.com wrote: Can some one throw more light on this statement= /* Init global variables at run-time, not as

Re: Re: Re: Problem with OOM killer killing process even when there is plenty of RAM.

2011-12-07 Thread Rajat Sharma
On Thu, Dec 8, 2011 at 1:41 AM, Greg KH g...@kroah.com wrote: On Thu, Dec 08, 2011 at 01:26:42AM +0530, mindentropy wrote: On Wednesday 07 Dec 2011 11:35:36 AM Greg KH wrote: On Thu, Dec 08, 2011 at 12:36:43AM +0530, mindentropy wrote: On Thursday 08 Dec 2011 1:38:19 AM Mulyadi Santosa

Re: Problem with OOM killer killing process even when there is plenty of RAM.

2011-12-06 Thread Rajat Sharma
driver allocating 512M !!?? what kind of driver it is? -Rajat On Wed, Dec 7, 2011 at 12:17 AM, mindentropy mindentr...@gmail.com wrote: Hi,  I am trying to allocate 512MB of RAM in my driver loaded as a module, but the OOM killer starts killing all my processes. This machine has around 24GB

Re: Spinlocks and interrupts

2011-11-10 Thread Rajat Sharma
For most of the block drivers bio_endio runs in a context of its tasklet, so it is indeed atomic context. -Rajat On Fri, Nov 11, 2011 at 4:50 AM, Kai Meyer k...@gnukai.com wrote: On 11/10/2011 04:00 PM, Jeff Haran wrote: -Original Message- From:

Re: How can I test if a physical address is already mapped or not.

2011-10-18 Thread Rajat Sharma
On Wed, Oct 19, 2011 at 6:46 AM, Jeff Haran jha...@bytemobile.com wrote: -Original Message- From: StephanT [mailto:stman937-linew...@yahoo.com] Sent: Tuesday, October 18, 2011 6:01 PM To: Jeff Haran; kernelnewbies Subject: Re: How can I test if a physical address is already mapped or

Re: How can I test if a physical address is already mapped or not.

2011-10-17 Thread Rajat Sharma
On Tue, Oct 18, 2011 at 1:34 AM, StephanT stman937-linew...@yahoo.com wrote: Hi all, In a kernel module is there a way to test if an address range has been already mapped by the kernel or not. Ex:  (on a PC with the latest kernel) - an access to physical 0xC000 will return the value at

Re: Hooking exec system call

2011-09-23 Thread Rajat Sharma
Untidy way : - Yes, you can do that by registering a new binary format handler. Whenever exec is called, a list of registered binary format handlers is scanned, in the same way you can hook the load_binary load_library function pointers of the already registered binary format handlers.

Re: difference between io_schedule() and schedule()

2011-08-10 Thread Rajat Sharma
On Wed, Aug 10, 2011 at 1:07 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: Hi Rajat... On Tue, Aug 9, 2011 at 09:30, Rajat Sharma fs.ra...@gmail.com wrote: of course I looked at the source (obvious first step) before asking question and further following tsk-in_iowait, it seems

difference between io_schedule() and schedule()

2011-08-06 Thread Rajat Sharma
Hi All, What is the difference between io_schedule() and schedule(), is io_schedule() more restrictive to shedule only I/O bound processes or it just favours I/O bound processes. Any documentation link would be great help. Thanks, Rajat ___

Re: Asynchronous read

2011-07-31 Thread Rajat Sharma
On Mon, Aug 1, 2011 at 8:15 AM, Adam Cozzette acozze...@cs.hmc.edu wrote: On Sun, Jul 31, 2011 at 03:58:55PM -0700, Da Zheng wrote: Hello, I'm trying to understand the read operation in VFS, and get confused by the asynchronous and synchronous operations. At the beginning, do_sync_read()

Re: Regarding remap_pfn_page

2011-07-21 Thread Rajat Sharma
On Wed, Jul 20, 2011 at 11:59 PM, mindentropy mindentr...@gmail.com wrote: huge range means you already have huge physical memory to be mapped and user space process has huge virtual memory area to accomodate that. Note that is mapping is specific to one particular process (or threads sharing

Re: Regarding remap_pfn_page

2011-07-21 Thread Rajat Sharma
On Thu, Jul 21, 2011 at 11:48 PM, mindentropy mindentr...@gmail.com wrote: Sorry to kicks in... Was wondering where you were :) hm, quite likely you run out of contigous virtual address space that as big as you requested... in above, you requested 16 MiB, right? Not virtual address space but

Re: Regarding remap_pfn_page

2011-07-20 Thread Rajat Sharma
On Tue, Jul 19, 2011 at 11:26 PM, mindentropy mindentr...@gmail.com wrote: Hi,  When I mmap pages via remap_pfn_page method would the physical frames assigned the linear address be contiguous? If yes what would happen if I mmap a huge range? Thanks.

Re: Device mapper header file error

2011-07-14 Thread Rajat Sharma
On Wed, Jul 13, 2011 at 11:49 PM, Adil Mujeeb mujeeb.a...@gmail.com wrote: Hi List, I am trying to compile a kernel module which uses the device mapper header files (dm.h and dm-bio-list.h). I checked in the stock kernel source that these files are present under drivers/md directory. When

Re: system call

2011-06-11 Thread Rajat Sharma
search for SYSCALL_DEFINEX(syscall) in linux source e.g. SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode) in fs/open.c here X depends on number of arguments to system call: 3 in case of open. you would find open, read, write and close in fs directory only. -Rajat On

Re: Problems with hypercalls

2011-06-08 Thread Rajat Sharma
are you doing 64bit devision on 32 bit arch? If that is the case, do_div is worth considering. On Wed, Jun 8, 2011 at 3:25 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: On Tue, Jun 7, 2011 at 15:39, emilie lefebvre triche...@hotmail.fr wrote: divide error: [#1] SMP ...  

Re: mmap on a block device

2011-06-07 Thread Rajat Sharma
yes its fairly possible, go ahead and try it. On Tue, Jun 7, 2011 at 9:57 AM, Kaustubh Ashtekar ksashte...@gmail.com wrote: Hello All, Is it possible to mmap on a block device? I am writing my own kernel space filesystem on Linux (academic project). I am writing a user space tool to format

Re: How a program could generate the memory addresses for its variables, when it is about to run?

2011-05-27 Thread Rajat Sharma
Hi Sandeep, probably you want to look at how your program is loaded in memory. For example an ELF binary is understood by ELF format handler inside kernel. Format handler supply their load_binary methods to load a program image im memory and initial its different virtual memory areas (stack, heap

Re: How to retrieve page pointer from vm_area_struct?

2011-04-17 Thread Rajat Sharma
use get_user_pages, this function works on vma and pin pages in memory as well, typically used by filesystem Direct I/O implementation. Thanks, Rajat On Sun, Apr 17, 2011 at 9:34 AM, Park Chan ho parkc...@gmail.com wrote: Hi all, I want to retrieve struct page pointer from vm_area_struct. How

Re: GSoC project idea: HFS Plus journal

2011-03-21 Thread Rajat Sharma
On Mon, Mar 21, 2011 at 2:15 AM, Greg Freemyer greg.freem...@gmail.com wrote: On Sun, Mar 20, 2011 at 1:07 PM, Naohiro Aota na...@elisp.net wrote: Greg KH g...@kroah.com writes: On Thu, Mar 17, 2011 at 06:57:27PM +0900, Naohiro Aota wrote: Hi, I see some of you are talking about GSoC

Re: release used memory

2011-03-11 Thread Rajat Sharma
If I have enough input data, the memory is not enough (the free value gets smaller and smaller, and the cached value gets bigger and bigger). Then kswapd appears in the list of running processes. I would expect that Linux gets rid of the cached stuff so that the program gets more memory.

Re: Page table queries

2011-02-19 Thread Rajat Sharma
So, in the start, the page might have kernel mode address, but in the end it has user mode address. But kernel is still the one that tracks all the page...be it anonymous or non anonymous ones. Not really. In this particular case of .nopage (page fault handler) of vma, we already have a user

Re: Page Table query

2011-02-19 Thread Rajat Sharma
Even I keep on seeing these errors, everytime I post anything on kernelnewbies. Initially I kept ignoring, but looks I am not alone to face this. As a resolution to this, we need to remove id a...@fibcom.com from kernelnewbies subscribers. Rajat On Sat, Feb 19, 2011 at 12:28 PM, anish singh

Re: Mapping memory between kernel and user space

2011-02-11 Thread Rajat Sharma
Hi Sri, LKD chapter 15 is right resource for you. specifically you can look for remap_pfn_range function to map I/O memory to user space. Thanks, Rajat On Fri, Feb 11, 2011 at 6:12 PM, YOUNGWHAN SONG breadn...@gmail.com wrote: Hi Sri, On Feb 10, 2011, at 11:56 AM, Sri Ram Vemulpali wrote:

Re: fsck for NFS

2011-02-09 Thread Rajat Sharma
Is is possible to run fsck against NFS (in the unmounted state)? Don't you think its really a wierd query?? NFS is a remote filesystem, if it is unmounted, there is no existense of filesystem on client. If you are asking from NFS server side, then the filesystem server is exporting may have

Re: x86 memory detection

2011-02-02 Thread Rajat Sharma
On most of the x86 linux boxes, I have seen it to be 2 or other variants where boot loader informs about memory map. -Rajat On Thu, Feb 3, 2011 at 10:18 AM, Arun S inbox1.a...@gmail.com wrote: Hi,  How does the kernel detects the amount of available System RAM in the system under x86

Re: typecheck code

2011-01-31 Thread Rajat Sharma
Can anyone help me, explain the above code typecheck. How does (void)(__dummy == __dummy2) evaluates to 1 Its not this comparison getting evaluated to 1, but last expression 1; \ which is forcibly returning 1 in every case. Since it is just compile time warning and should not effect the program

Re: vfs functions

2011-01-12 Thread Rajat Sharma
Mohit its not clear what you are trying to ask. what do you mean by 'something' here? Rajat On Wed, Jan 12, 2011 at 1:43 PM, mohit verma mohit89m...@gmail.com wrote: hi folks, i am confused with the functions starting from vfs_ . i  think they show the significance of VFS model  i  mean if

Re: vfs functions

2011-01-12 Thread Rajat Sharma
Mohit, From your mails it looks to me you are coming very early to post questions on this list. I would suggest to be little patient and go through some text books (preferably Understanding Linux Kernel 3rd Ed.) and try to cover all I/O subsystem related chapters. I am sure most of your answers

Re: syscall trace at kernel land

2011-01-11 Thread Rajat Sharma
*/ #define ERESTART_RESTARTBLOCK 516 /* restart by calling sys_restart_syscall */ ... #endif Rajat On Tue, Jan 11, 2011 at 9:32 PM, Dave Hylands dhyla...@gmail.com wrote: Hi Rajat, On Tue, Jan 11, 2011 at 2:10 AM, Rajat Sharma fs.ra...@gmail.com wrote: is there any procedure in kernel to check

Re: compiler error in simple module

2011-01-10 Thread Rajat Sharma
Hi, yes you are missing a very vital thing and that is EXPORT_SYMBOL. Loadable Kernel modules are not part of kernel image and can not just use any symbol of kernel, They can use only exported symbols either exported through EXPORT_SYMBOL or EXPORT_SYMBOL_GPL. GPL version has limitation that your

Re: New proc entry under /proc/[pid]

2011-01-10 Thread Rajat Sharma
Try this: 1. do a path_lookup for parent proc dir e.g. /proc/1234 and get its inode. 2. get proc_inode structure for parent from vfs inode like this: sruct proc_inode *parent = PROC_I(inode). PROC_I is defined in proc_fs.h 3. get parent proc_dir_entry object: struct

Re: Questions about complete

2011-01-08 Thread Rajat Sharma
taking spin_lock_irqsave, so timer ISR should not preempt the complete API. Rajat On Fri, Jan 7, 2011 at 7:51 PM, loody milo...@gmail.com wrote: hi all: 2011/1/6 Rajat Sharma fs.ra...@gmail.com: Hi loody, calling complete will make the waiter process runnable but won't necessarily

Re: spin_lock and scheduler confusion

2011-01-08 Thread Rajat Sharma
Hi Dave, spin_lock_irqsave(); schedule(); spin_lock_irqrestore(); You're not supposed to call schedule with interrupts disbled. If you follow the code though schedule, you'll see that it calls schedule_debug, which in turns checks to see if its being called from an atomic context and

Re: spin_lock and scheduler confusion

2011-01-07 Thread Rajat Sharma
, nilesh nilesh.tay...@netscout.com wrote: On Fri, 2011-01-07 at 13:05 +0530, Rajat Sharma wrote: As I remember timer interrupt as well is an NMI so, it is possible (although not advised) to call schedule function while holding spinlock

Re: nameidata data structure again

2011-01-06 Thread Rajat Sharma
Hi Mohit, Please refer to ULK 3rd edition Section 12.5 pathname lookup, it says: struct qstr last Last component of the pathname (used when the LOOKUP_PARENT flag is set) so if LOOKUP_PARENT is set, last refers to the last name components, e.g. in /a/b/c it reference to c while

Re: Starting NFS kernel daemon fail

2011-01-06 Thread Rajat Sharma
I hope you are using correct version of nfs-util which matches with your kernel version. some debugging with /etc/init.d/nfs-kernel-server will surely help to know where is it actually failing. It happened with me once, that this script checked for kernel symbol to find if module is loaded by

Re: Question on mmap / expecting more calls to vfs_read

2011-01-06 Thread Rajat Sharma
, it will still be better if you can state what you want to achieve in little layman language. Rajat On Fri, Jan 7, 2011 at 5:39 AM, Manish Katiyar mkati...@gmail.com wrote: On Thu, Jan 6, 2011 at 3:49 PM, Sebastian Pipping sebast...@pipping.org wrote: On 01/06/11 07:53, Rajat Sharma wrote: Hi

Re: spin_lock and scheduler confusion

2011-01-06 Thread Rajat Sharma
As I remember timer interrupt as well is an NMI so, it is possible (although not advised) to call schedule function while holding spinlock on same core. spin_lock_irqsave(); schedule(); spin_lock_irqrestore(); however if you have debugging options turned on like CONFIG_DEBUG_SPINLOCK, you may

Re: Question on mmap / expecting more calls to vfs_read

2011-01-05 Thread Rajat Sharma
Hi Sebastian, you guess for ELF header seems to be valid to me. When executables or binaries are loaded memory, it is done through mmap call to the file, and to understand what file is and what binary handler in kernel can handle its section, kernel needs to know its header first, which is within

Re: fixed memory bytes

2011-01-04 Thread Rajat Sharma
A nice kernel document regarding unaligned memory access. It may not be directly answering all the questions asked, but once gone through and understood completely, it will become easy to figure out how to write portable kernel code.