/r/kernel
A moderated community dedicated to technical discussion about the Linux kernel.
Welcome to /r/kernel, a moderated community dedicated to all things about the Linux kernel. Technical articles only, please!
You may be interested in the following links:
And some books:
Related Communities
/r/kernel
Further, how should I find the source code for any sysfs interface?
Hi, i am developing some kernel modules for a short time in my university course. I dual boot Fedora and Windows (sadly it is required for some applications) and i don't want to disable the secure boot or go trough the long procedure of signing the modules as they are simple. Is there any setup to develop the modules via QEMU, docker or any other way?
Hi everybody, I'm reaching out seeking some guidance.
I'd be happy to get your help/advice about block device (SCSI specifically) IOs process/path in kernel version 6.x.
I work on a kernel module (module is running on a VM, and captured by the virtualization host kernel driver).
I face 2 problems with the new kernel:
The first one is a completion function, in older kernel such as kernel 5.x scsi_cmnd provided a field that is a function pointer which no longer exists in 6.x:
/* Low-level done function - can be used by low-level driver to point
* to completion function. Not used by mid/upper level code. */
void (*) (struct *);/* Low-level done function - can be used by low-level driver to point
* to completion function. Not used by mid/upper level code. */
void (*scsi_done) (struct scsi_cmnd *);
The second is that every attempt to generate a scsi_cmnd on the fly (whether it's a new one, or copy the fields of one I've intercepted on it's way down) fails on my attempt to queue it to the kernel.
I've attempted to queue it using Scsi_host->scsi_host_template->queuecommand. all attempts seem to fail on tagging the request properly, but I can't seem to grasp what the author desire was or how one should do it properly.
I've tried the web for information but all guides point to LDD guides for kernel 2.6, which show obsolete/deprecated/non-existing functions. I'd be grateful if you can point me to the right direction, some guidance or a tutorial on what's the correct way for a kernel module to:
1. create a scsi_cmnd and queue it to the kernel to execute it, i.e how the author intended.
2. understand more about the block device infrastructure in the kernel.
To share my efforts so far in attempting to understand this or find a way, I've worked a lot with trace-cmd to see callstacks of successful executions (I/Os that aren't mine), my own dumps, and researched the kernel source code using bootlin and comparing old to new versions attempting to understand how the infra works but to no real solution.
I'd appreciate any pointers to relevant information, and thank you for reading through.
Thanks!
I'm aware that user-space programs have only their "portion" of the physical memory (and a little bit of the kernel memory that is necessary for context switches) mapped into their virtual address spaces, and (correct me if I'm wrong) on x86(_64), the entire physical memory is "mapped" into the kernel's address space. Does this also hold for other architectures, for example for ARM64? Is the entire physical memory always accessible to the kernel no matter the context that the kernel-space code is running in?
Also, before KPTI patches, every user-space program had the kernel address space mapped into its virtual address space on x86_64. Was that also the case with ARM64? How did the duality of the registers (TTBR0 and TTBR1 instead of just CR3) to store the address of translation tables affect this?
My background is in web backend development and I'm used to learn (primarily) by reading technical documentation. As a Linux user I'm trying to learn how the Linux kernel work, I'm trying to write some drivers in order to learn by doing. I'm finding it tough as the documentation looks kind of incomplete to me. At this point I'm not sure if the only real way is to read the source code or if I'm doing something wrong.
Ofcourse the hypervisor in EL2 will trap it, but what happens afterwards?
Are there any books or videos .From which I can understand the inner working of kernel .I just know extremely basic thing about kernel that it manages process and memory management .I want to learn more .
Hi,
How feasible is it to have a calling convention where the parameters are passed in a separate stack from the address stack?
The advantages of this would be:
The disadvantages:
Best regards,
313243358d5ca7bcf6d4a0f12bc48e56d3f712a00b4c1d0fdd646cb9582602ad
hello, quick question, what does "runtime" mean in programming?
for example, i can go to wikipedia and go to
https://en.wikipedia.org/wiki/Runtime
and it's giving me several different things that runtime could mean, so i wanted to ask, what is runtime to you?
thank you
You are more than welcome to disagree with the decisions and opinions expressed by anyone in the upstream community, including Linus, so long as you express your opinion on the matter in a measured and respectful way. This subreddit is to some degree meant to reflect the culture of the Linux kernel community. You can call it like you see it, and say things that may otherwise be considered somewhat “mean”, “prickly”, or overly direct in normal circles. In other words, for the most part, this community can reflect the tone and standards followed on LKML, and it will be fine.
What we absolutely will not tolerate is calling anyone a derogatory slur, or make offensive comparisons that are grossly slanderous. For instance, do not call someone a nazi because you disagree with them, or compare them to Hitler. Doing so will result in an instant ban, no warning.
It’s sad that this even needs to be said, but this latest unfortunate and understandably controversial news about banning Russian maintainers has resulted in some of the worst takes I’ve ever seen.
That is all.
Speaking from a demand perspective, what skill set is typically more needed by more companies? Of course the two disciplines are relatively niche and most companies don't need either. Regardless, I am curious to know!
Is it viable to do kernel dev on wsl2 or not? I wish I could use arch which I have but games hold me back so I need something that is not as slow as a vm but fast and just works ootb aka wsl 2. TIA
Hi,
I created a kernel module that implements a dynamic queue within a Kernel module for educational purposes.
It supports IOCTL so that userspace programs may communicate with it.
It might be helpful for beginners.
message d'erreur kernel/makefile:1926: .] error 2
Hello everyone, I'm a master's student, soon to become a computer engineer. After a long journey searching for the right project idea for my degree, I knew I wanted to focus on something related to operating systems, low-level programming, or networking. However, I was unsure about the exact direction, especially since I now lean more toward software-oriented work. Recently, I came across an interesting theme: "Low-Latency Kernel Bypass Framework for High-Performance Networking." I'm considering pursuing this idea, but I have a few concerns. Is it feasible to complete within a one-year period? Also, would this project be a case of reinventing the wheel, given that some existing tools already perform similar tasks? if you have better project ideas please feel free to share them here! THANK YOU!!
ok, so i'm doing research for a new laptop, and when i look for a new laptop i like to get a laptop with two drives, one that is ssd for my linux operating system
and another that is hdd for all my files, i like to encrypt both of them with two different passwords.
now, i have been doing research into buying a new laptop, and i can't find any laptops with both a hdd and sdd, it's either one or the other.
so i wanted to ask, is this a feature that linux's encryption "luks" can do for me?
1_can i make two paritions on the same sdd drive,
2_can it encrypt both when two different passwords
3_can one the operating system partition be unencrypted while my file partition be encrypted?
4_how can i do this? how can i set this up on my new laptop? what would i need to do when i format and install linux on my new laptop?
Hi,
I'm following the A Beginner's Guide to Linux Kernel Development (LFD103) course and I a bit confused about one part.
According to the tutorial, I should be cloning :
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
But after looking a bit at https://git.kernel.org/ there is no linux-stable.git
There are :
|| || |kernel/git/stable/linux.git|Linux kernel stable treekernel/git/stable/linux.gitLinux kernel stable tree|
|| || |kernel/git/stable/linux-stable-rc.git|Linux Stable -rc releaseskernel/git/stable/linux-stable-rc.gitLinux Stable -rc releases|
And I don't know which one is the correct one to use.
Any help is appreciated.
Thank you.
How do you testrace conditions to see if the written logic works ?
Or, in general how do mutex providers (kernel) test their code ?
What are the involved tools ?
How can I mimic a race to check a piece of code ?
I'm looking at an SoC with a reconfigurable L2 cache, some can be RAM some can be L2 and you can dynamically allocate it before any OS comes up.
Its 2MB total but in reality the out of the box set up is 1MB as cache. Looking at the dt for the device its set as 2MB in the dt.
I'm guessing this would have some impact on performance but the scale of the impact I'm not sure of. Can anyone explain what this might be? Linux thinking it has a 2MB L2 and actually only having 1MB.
Not sure if I can post this here, but I've been trying to compile an android kernel (source) and got this error:WARNING: vmlinux.o(.data+0x1f3288): Section mismatch in reference from the variable modem_spi_boot_driver to the function .init.text:modem_spi_boot_probe()
The variable modem_spi_boot_driver references
the function __init modem_spi_boot_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console
I'm not sure exactly what this means or what I would have to do to fix it. I'd really appreciate any help I could get.
EDIT: just tried compiling the Pixel OS kernel (source) for the same phone and got the same error. It might not be an error with a kernel, but something wrong with my build environment instead. I'n not sure how I would fix that either.
If a page is allocated using GFP_HIGHUSER, and its type is MIGRATE_UNMOVABLE as obtained through get_pageblock_migratetype, will this page be reclaimed? My current understanding is that as long as the page type is MIGRATE_UNMOVABLE, it will neither be migrated nor reclaimed. However, I'm not sure if this is correct. I've been searching online but haven't found a definitive answer, and I couldn't find any explanation in the official documentation either. I would greatly appreciate it if someone could clarify this for me. Thanks!
hello, i'm doing researching into process 0 and i can't seem to get answers on the most basic questions?
what is process 0?
what does it do?
why does it do it?
and so i wanted to ask here and ask what is process 0?
i checked around online and found this
https://blog.dave.tf/post/linux-pid0/
and this
https://superuser.com/questions/377572/what-is-the-main-purpose-of-the-swapper-process-in-unix
but i can't seem to get answers for basic questions, so i thought you guys might know
thank you
Does anyone know of something like a Thunderbird (or any other email application) plugin, configuration, template, etc. that enforces the Linux Kernel Mailing List conventions? In-line replies, plain text, possibly some integration with Git or syntax highlighting for patches.
I have been manually composing and formatting replies in Vim, and then sending with git-send-email. It does the job, but gets really tedious.
I'm sure most Linux kernel developers know some black magic to do all of the above with command line tools, but I'm very GUI-centric.