Questions tagged [linux-kernel]

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers). Questions about writing userspace code in Linux should generally be tagged [linux] instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers).

Questions about writing userspace code in Linux should generally be tagged instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

The kernel is a UNIX-like kernel initially created by Linus Torvalds in 1991 and now is maintained by developers around the world.

Frequently Asked Questions

Online resources

Books

Kernel source code and source code browsers

Further reading

Mailing lists

17371 questions
6
votes
2 answers

Read and write hard disk sector directly and efficiently

I have a special need for block data storage. My data are formatted data blocks in size of 4096. For high efficiency, I want to directly manipulate the block on hard disk sector and do not want to treat the data block as file. I think one way is to…
chenatu
  • 827
  • 2
  • 10
  • 22
6
votes
4 answers

Unload kernel module for only a specific device (preferrably from code in another kernel module)

I'm working on a project where I have a management system that exports PCIe hardware devices to other systems via PCI Express. I have a working management kernel module but need to find a way to ensure that a device I export doesn't have a driver…
user3015665
  • 61
  • 1
  • 1
  • 2
6
votes
2 answers

Where to start with Linux Kernel Modules?

A little background, I'm a CMPE Student currently in an Operating Systems class. I have some basic knowledge of C coding but am more comfortable with C++ (taken about 3 semesters of that). Other than that, never had any other formal training in…
thewill2live
  • 215
  • 2
  • 6
6
votes
1 answer

How to use contiguous memory in linux kernel?

I found that physical memory is split into ranks as follows (Memory Interleaving): rank0: [0-512KB] [2048KB-2560KB] [4096KB-4608KB] ... rank1: [512KB-1024KB] [2560KB-3072KB] [4608KB-5120KB] ... rank2: [1024KB-1536KB] [3072KB-3584KB]…
Rajesh Golani
  • 448
  • 1
  • 6
  • 13
6
votes
2 answers

Server send RST to client when TCP connection max than 65000~

I am work on a high load tcp application with Java Netty, which expect to arrive 300k concurrent TCP connections. It works perfect on test server, arrive 300k connections, but when deploy to production server, it only can support 65387 connections,…
Santal Li
  • 126
  • 1
  • 7
6
votes
3 answers

What does actually cdev_add() do? in terms of registering a device to the kernel

What does cdev_add() actually do? I'm asking terms of registering a device with the kernel. Does it add the pointer to cdev structure in some map which is indexed by major and minor number? How exactly does this happen when you say the device is…
Anup Buchke
  • 5,210
  • 5
  • 22
  • 38
6
votes
2 answers

Is there a libc in kernel space?

Is there a libc in kernel space? I mean you have to build kernel against some libc right? So Is there a libc (probably statically-linked) sitting within kernel space? If yes, how is this related to userland glibc? Must they be the same version?
Ohcet Efil
  • 61
  • 1
  • 2
6
votes
2 answers

Linux kernel API changes/additions

I'm not sure if this is the right place to ask this, but I'm trying to find a webpage or docs or XYZ that will allow me to see all the API changes/additions/removals between two kernel versions. I found http://kernelnewbies.org/LinuxChanges , but…
alexandernst
  • 14,352
  • 22
  • 97
  • 197
6
votes
2 answers

Using ELF section in LKM

I have this POC in C that saves a few structs in a custom section and then iterates over those structs, showing their content. #include char a, b, c; struct counter_info { int counter; char *name; }…
alexandernst
  • 14,352
  • 22
  • 97
  • 197
6
votes
1 answer

Memory allocation during linux booting?

I have tried to search this topic on google and this site but I can't find a proper answer. I am trying to allocate a big continuous block of memory (a few MB) at a set physical address during the Linux booting process. But I am still not clear…
Shahril
  • 65
  • 1
  • 7
6
votes
1 answer

U-boot with redundant environment, fw_setenv does not update both environments

why fw_setenv tool set value of variable only for one environment? I am using uboot with redundant env (#define CONFIG_ENV_OFFSET 0xc0000, #define CONFIG_ENV_OFFSET_REDUND 0x100000 ), and I am going to set value of uboot env variable from linux.…
Yuri
  • 1,179
  • 4
  • 13
  • 27
6
votes
3 answers

How do I find ARM Linux entry point when it fails to uncompress?

I am trying to boot Linux via U-boot on a custom board with i.MX6 (CPU core is ARM Cortex A9) We seem to have ported Das U-Boot(2009.08) successfully. But booting Linux fails at the last U-Boot message: "Starting kernel ..." Here is my relevant…
Atilla Filiz
  • 2,383
  • 8
  • 29
  • 47
6
votes
2 answers

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…
Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406
6
votes
1 answer

System call vs Interrupt contexts

System calls are implemented using software interrupts(interrupt vector 128). In roberts love book "Linux Kernel Development" its written that interrupt handle happens at interrupt context. Its also written that system call runs at process…
arkadish
  • 345
  • 2
  • 13
6
votes
1 answer

Send packet with sockets from kernel module

I am writing a kernel module that should receive messages from user-space and send response back via socket. When program and module are on the same machine and I use IP 127.0.0.1, everything works fine. But when I try it on different machines and…
Mykola Niemtsov
  • 540
  • 1
  • 7
  • 23
1 2 3
99
100