linux-kernel

Monitoring CPU and memory loads on xenomai

I'm writing a xenomai applications which spawns a few threads: rt_task_spawn(&fcThread, "fcThread", FC_THREAD_STACK, FC_THREAD_PRIO, 0, &run, (void*)(this)) Each thread is very simple and looks like this: while (true) { rt_queue_read(pThis->pMsgQueue, (void*)(&msg), sizeof(mystruct), TM_INFINITE) … } They are simple threads but...

Few Questions regarding Android Kernel

Hi, I am new to android kernel and Mobile Operating Systems and I have a few questions regarding android kernel. 1) Does Android OS has Kernel Mode and a User mode like Normal desktop OSs ? Also does it support things like Virtual Memory ? Also I heard about Dalvik VMM. Is a copy of dalvik VMM created for each and every process ? 2) A...

Avoiding sleep while holding a spinlock

Hello! I've recently read section 5.5.2 (Spinlocks and Atomic Context) of LDDv3 book: Avoiding sleep while holding a lock can be more difficult; many kernel functions can sleep, and this behavior is not always well documented. Copying data to or from user space is an obvious example: the required user-space page may need to be swapp...

Question regarding interrupt handler

Can I do floating point operations in interrupt handler ? (x86 or 64) Also I would like know can I use print function inside the interrupt handler ? ...

Porting Linux kernel 2.6 to new MIPS board

I wanna port Linux kernel 2.6.x to new MIPS board. Unfortunatelly, I can't find good actual documentation with step by step explaination. Hope, you'll help me. Paper books are OK too. Thank you in advance! ...

Can ioctl commands in Linux be completely enumerated?

For the purpose of security-oriented source code review, I'm interested in finding (comprehensively) all ioctl commands that are registered in the Linux kernel. Also, I'd like to classify them as either accessible by administrators (e.g root), and which ones are accessible by unprivileged users. I'm not sure if it would be easier to rea...

How to figure out the Linux kernel's source code?

There are some books about Linux developing, internals, managers and so on. but I'm thinking about a documentation that Linux developers write when the commit a patch on the kernel. Does something like that exist? I know there is a mailing list for kernel newbies and some stuff like this but I'm not a newbie and I don't want to be kernel...

Compiling a kernel module, header problems, makefile problems

ok I'm trying to compile a simple kernel module, when I point to any of the below that contain includes, it complains about all kinds of stuff. linux-headers-2.6.31-21 linux-headers-2.6.31-22 linux-headers-2.6.31-21-generic linux-headers-2.6.31-22-generic linux-headers-2.6.31-21-generic-pae linux-h...

SpinLock read_lock_irqsave flags attribute

Hi, This is regarding the void spin_lock_irqsave(spinlock_t *lock, unsigned long flags); function call. It is mentioned that previous interrupt state is stored in flags and we can restore them by passing this to spin_unlock_irqrestore function. But I did not get how flags which is passed by values captures the previous interrupt state...

How program and compile "Hello World" code in kernel mode of linux ?

Yes, as the title, I don't know how to program and compile "Hello World" code in kernel mode of linux , please help me in the shortest and easy to understand way. Thank you ! (Any related document is welcomed too, I'm just new to this) ...

Interrupt handling and transferring data from and to application code - low latency method theories

I have a Fibre Optic link, with a proprietary Device Driver and message format. The link goes into a PCIe card. Running on a RHEL 5.2 (2.6.18-128~) I have mmap'ed the interface on the card for setup and FIFO access etc, but cannot use this for interrupts as this should be done via the kernel-space interrupt routine (correct me if require...

ioctl and execution time

Hi, I have a program running two threads - they communicate using message queues. In one thread, I call ioctl() to access the hardware decryptor. The code goes like: void Decrypt { ... .. ... if(<condition 1>) {. ... ... retVal = ioctl(...); comesInHere1++; } if(<condition 2>) { ... ... retVal = ioctl(...); comesInHere2++; } come...

Threads: some questions

Hi, I have couple of questions on threads. Could you please clarify. Suppose process with one or multiple threads. If the process is prempted/suspended, does the threads also get preempted or does the threads continue to run? When the suspended process rescheduled, does the process threads also gets scheduled? If the process has proc...

Doing a zero-copy move of data from a Linux kernel buffer to hard disk

am trying to move data from a buffer in kernel space into the hard disk without having to incur any additional copies from kernel buffer to user buffers or any other kernel buffers. Any ideas/suggestions would be most helpful. The use case is basically a demux driver which collects data into a demux buffer in kernel space and this buffe...

splice() from pipe to TCP buffered?

xpost from linuxquestions.org, sorry... I wrote a small test program to see if a simple proxy would benefit from using splice() but it always takes 200ms for the data that I spliced from a pipe to a TCP socket to be read from the other end of the socket. Here is the Perl program to test it: package test_pipes_2; use strict; use warnin...

Can anyone recommend a good book on the linux kernel?

Hi, I'm looking for a good book on the linux kernel. I've found this one http://www.kroah.com/lkn/ which is free. I'd like something I can read when away from my computer though and so want to buy a good book. I was thinking about getting this hxxp://oreilly.com/catalog/9780596000028 (cannot submit more than one link). Has anyone any...

overriding non-NAPI network polling handler with a kernel module

As those familiar with network device drivers are aware, the interface between the kernel and driver has been changed to use NAPI (New API). In this paradigm, a polling function is associated with a napi_struct, which is a new structure that must be allocated by the device driver. At any rate, I have an old driver and don't have the ti...

How many bytes does memory arbiter protect?

How many bytes does memory arbiter protect? While reading "Understanding the linux kernel, 3rd edition" chapter 2, section2.1, I encounter the following statement: In multiprocessor systems, all CPUs usually share the same memory; this means that RAM chips may be accessed concurrently by independent CPUs. Because read or write operation...

not get the cntl to application

Hi aLL, I am a linux device driver programmer. Recentely i write driver for sniffer hardware. This sniffer hardware will continously read data from the bus line. I have an interrupt handler in my driver to notify the received data. I am used dma address mapping for store the data. h/w use pyhsical address, driver use vitual address...

How does mprotect() work?

I was stracing some of the common commands in the linux kernel, and saw mprotect() was used a lot many times. I'm just wondering, what is the deciding factor that mprotect() uses to find out that the memory address it is setting a protection value for, is in its own address space? ...