linux-kernel

Error in compiling a Linux kernel

How do you read the errors? I run after having .config -file at /home/aal/build/kernel. /usr/src/linux-2.6$ make O=/home/aal/build/kernel/ I get ... cut ... CC [M] drivers/staging/go7007/s2250-board.o /usr/src/linux-2.6/drivers/staging/go7007/s2250-board.c:24:26: error: s2250-loader.h: No such file or directory /usr/src/linux-2...

Is there a way to ask the Linux Kernel to re-run its PCI initialization code?

I'm looking for either a kernel mode call that I can make from a driver, a userland utility, or a system call that will ask the Kernel to look at the PCI bus and either completely re-run its initialization, or initialize a specific device. Specifically, I need the Kernel to recognize a device that was added to the bus after boot and the...

How to know when a schedule() call is returning because of a signal?

In a device driver for some PCI hardware, I have an ioctl call that waits for an incoming interrupt on the PCI bus. Using wait_queue_head_t, I put the task to sleep by calling schedule(). Then, the irq_handler function wakes up this task when the interrupt is raised on the PCI bus. Everything seems to work correctly. My question is how...

printf slows down my program

I have a small C program to calculate hashes (for hash tables). The code looks quite clean I hope, but there's something unrelated to it that's bugging me. I can easily generate about one million hashes in about 0.2-0.3 seconds (benchmarked with /usr/bin/time). However, when I'm printf()inging them in the for loop, the program slows dow...

Proper way to use copy_to_user?

I'm trying to define a system call that modifies the character buffer passed to it. Specifically, something like this: ... asmlinkage int sys_mycall( char __user *buff, int len ) { char tmp[1000]; copy_from_user(tmp, buff, len); /* change tmp here */ copy_to_user( buff, &tmp, len ); } Here, copy_to_user returns -1, and the...

Using static data structures for DMA

I had a driver for linux kernel (2.6.18) in which I used kmalloc(sizeof(my_struct_t), GFP_ATOMIC) to allocate memory which was later used for data transfer using DMA controller of some device. Later I had to increase the size of my_struct. It became too large so that the kmalloc() code used static assertion and compiled __you_cannot_kmal...

Why not port Linux kernel to Common Lisp?

Conventional wisdom states that OS kernels must be written in C in order to achieve the necessary levels of performance. This has been the justification for not using more expressive high level languages. However, for a few years now implementations of Common Lisp such as SBCL have proven to be just as performant as C. What then are t...

Flushing the page cache associated with an inode

Hi, I modified the block mapping in an inode and want to flush the page cache associated with the inode so that the new inode with new mapping will be loaded from disk. I tried below functions but it works some time and fails some other time. invalidate_mapping_pages() - for flushing non-dirty pages truncate_inode_pages() - for flushin...

inteldrmfb api?

I have a kernel 2.6.31 booting from a USB stick using Intel 915 based KMS to get to graphics mode. It appears to be setting itself to the native resolution and its booting nicely into framebuffer console with a beautiful Tux logo! Question is, how do I access the inteldrmfb? How do I get it into /dev? Will udev do this for me? What is ...

Copying a 2D array of char * to user space from kernel space?

In kernel space, I have the following: char * myData[MAX_BUF_SIZE][2]; I need to define a kernel method that copies this data into user-space., so how would I go about defining this method? I've got the following, but I'm not quite sure what I'm doing. asmlinkage int sys_get_my_data(char __user ***data, int rowLen, int bufferSize) { ...

Git workflow for corporate Linux kernel development

I work for a company which builds embedded systems using Linux. Historically we've always used CVS to store our kernel work. Our kernels end up being a collection of: Drivers for our proprietary hardware Random fixes for bits of Linux we use Non-proprietary hardware drivers Random yukky hacks to tailor Linux for our application We're...

What is the overhead involved in a mode switch

Hi Many a times i read/hear the argument that making a lot of system calls etc would be inefficient since the application make a mode switch i.e goes from user mode to kernel mode and after executing the system call starts executing in the user mode by making a mode switch again. My question is what is the overhead of a mode switch ? D...

Send a raw ethernet packet from inside a kernel module

I found out that I need to build a new sk_buff struct in the kernel module and pass it to my network device, but what I can't figure out is how to set the struct variables for a simple raw ethernet packet. This has to be easy, but i would really appreciate it, if someone could give me a sample code of how to put the sk_buff together. ...

User space access from Kernel space - get_user_pages

Hello, I'd like pass a pointer from a user space memory into a function in my kernel module. I don't want to use copy_from_user. I've read that I should use get_user_pages function. For example one page. struct page **pages; pages = kmalloc(1 * sizeof(*pages), GFP_KERNEL); down_read(&current->mm->mmap_sem); get_user_pages(current,cur...

Ethernet checksum checking in wireless stack

When receiving a raw ethernet packet over a wireless connection, where does the ethernet checksum get calculated, and where are errors handled? Does the wireless stack handle this, or is it handled in the upper layers? ...

SA_ONESHOT conflict in signal handling (LINUX)

Does the treatment of SA_ONESHOT in sys_signal() and get_signal_to_deliver() lead to a conflict ? ...

Why does block I/O completion take so long when crossing CPUs?

I am trying to squeeze the most performance out of a Linux block driver for a high-end storage device. One problem that has me a bit stumped at the moment is this: if a user task starts an I/O operation (read or write) on one CPU, and the device interrupt occurs on another CPU, I incur about 80 microseconds of delay before the task resu...

Using struct causes kernel panic?

I'm taking my first crack at writing some linux kernel code, and I'm hitting a weird kernel panic. I have a linked list I am maintaining with the kernel's built-in macros (include/linux/list.h). If the list is empty, I allocate an instance of the following structure: struct time_span { struct timeval start; struct timeval end; };...

Force Linux to use only memory over 4G?

I have a Linux device driver that interfaces to a device that, in theory, can perform DMA using 64-bit addresses. I'd like to test to see that this actually works. Is there a simple way that I can force a Linux machine not to use any memory below physical address 4G? It's OK if the kernel image is in low memory; I just want to be able...

Scalability of Ext4

One of the features of the file system Ext4 is its new Scalability features documented here. I was wondering what changes at the source code level would enable Ext4 to support such features, like the virtually unlimited number of sub directories which Ext3 didn't. Pointers to the relevant areas of the Kernel source tree would be greatly ...