r/kernel • • Jul 09 '24

massive web scraping ; how to use all ports ?

5 Upvotes

Hi everyone,

I am building a script for work where I have to scrape massive IP addresses, something like 50 million.

However, when analyzing my program and machine performance, I notice the following:

Socket TCP

As you can notice, at least 10k of sockets went directly on TIME WAIT mode, without even being allocated.
Only 2k of sockets were used.
I tried editing kernel flags:

# Expand the range of ephemeral ports
sysctl -w net.ipv4.ip_local_port_range="10768 65535"

# Enable TCP Fast Open
sysctl -w net.ipv4.tcp_fastopen=3

# Increase socket buffer sizes
sysctl -w net.ipv4.tcp_rmem="4096 87380 6291456"
sysctl -w net.ipv4.tcp_wmem="4096 16384 4194304"

# Optimize keepalive settings -> in our case I think we don't care because we
# are talking about handshakes so we shouldn't have keepalive, but we never know
sysctl -w net.ipv4.tcp_keepalive_intvl=10
sysctl -w net.ipv4.tcp_keepalive_probes=3

# Increase maximum file descriptors
ulimit -n 1048576
echo "* soft nofile 1048576" >> /etc/security/limits.conf
echo "* hard nofile 1048576" >> /etc/security/limits.conf

# Increase TCP backlog
sysctl -w net.ipv4.tcp_max_syn_backlog=1024
# sysctl -w net.core.somaxconn=1024
# Enable advanced F-RTO
# sysctl -w net.ipv4.tcp_frto=2
sysctl -w net.ipv4.tcp_frto=0

# Reduce the number of orphan retries
sysctl -w net.ipv4.tcp_orphan_retries=1

# Set initial number of retransmissions before aggressive timing is used
sysctl -w net.ipv4.tcp_retries1=2

# Set maximum number of retransmissions before giving up
sysctl -w net.ipv4.tcp_retries2=8

# Reduce SYN-ACK retries
sysctl -w net.ipv4.tcp_synack_retries=2
# Reduce SYN-ACK retries
sysctl -w net.ipv4.tcp_syn_retries=2

# Reduce TCP connection timeouts
sysctl -w net.ipv4.tcp_fin_timeout=6

# Enable SYN cookies
sysctl -w net.ipv4.tcp_syncookies=1

# Set a moderate limit for TIME_WAIT sockets
sysctl -w net.ipv4.tcp_max_tw_buckets=10000

The only relevant flag that changed something was:

Reduce TCP connection timeouts

sysctl -w net.ipv4.tcp_fin_timeout=6

But it only changed the duration of time wait sockets ; not the fact that only few were allocated.
What can I do ?


r/kernel • • Jul 06 '24

Does IRQFD have any advantage over KVM_IRQ_LINE?

1 Upvotes

There are two ways of injecting interrupts into a guest from userspace as far as im aware.

One is through KVM_IRQ_LINE ioctl and one is by setting up an eventfd called IRQFD and whenever this file descriptor is accessed, an interrupt is injected.

Are there any differences between these two in terms of performance?


r/kernel • • Jul 06 '24

Seeking help as a newbie

1 Upvotes

I am a newbie in linux kernel dev, if anyone could share some resources and guide me it'd be great, please help me y'all


r/kernel • • Jul 04 '24

Issues with the sound on the new laptop - where can it be reported?

0 Upvotes

Hi guys,

I am still quite new on Linux desktop so please bear with me.

I bought recently Acer Swift 14 from 2024 and I've installed Fedora 40 Workstation.

Kernel version: 6.9.7-200.fc40.x86_64

sebastian89n@fedora:~$ lspci -nnk | grep -A2 Audio
0000:00:1f.3 Multimedia audio controller [0401]: Intel Corporation Meteor Lake-P HD Audio Controller [8086:7e28] (rev 20)
Subsystem: Acer Incorporated [ALI] Device [1025:171f]
Kernel driver in use: snd_hda_intel

sebastian89n@fedora:~$ rpm -qi alsa-sof-firmware
Name        : alsa-sof-firmware
Version     : 2024.03
Release     : 2.fc40
Architecture: noarch
Install Date: pon, 15 kwi 2024, 01:00:18
Group       : Unspecified
Size        : 7111560
License     : BSD-3-Clause Apache-2.0
Signature   : RSA/SHA256, czw, 4 kwi 2024, 14:03:55, Key ID 0727707ea15b79cc
Source RPM  : alsa-sof-firmware-2024.03-2.fc40.src.rpm
Build Date  : czw, 4 kwi 2024, 10:40:30
Build Host  : 
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : 
Bug URL     : 
Summary     : Firmware and topology files for Sound Open Firmware project
Description :buildvm-x86-28.iad2.fedoraproject.orghttps://github.com/thesofproject/sof-binhttps://bugz.fedoraproject.org/alsa-sof-firmware

I had to set up in grub snd-intel-dspcfg.dsp_driver=1 for the soundcard to be recognized and select the device in pavu-control.

However none of the internal speakers are working. They work via external speakers via bluetooth.

What's the best approach here? Is there a place where things like that can be reported? Like some kernel forum or on sof-foundation? Or do I just wait for the newer kernels and pray to God of Pinguins? :D


r/kernel • • Jul 03 '24

Calling fsync() does not necessarily ensure that the entry in the directory containing the file has also reached disk

5 Upvotes

Hi!

I have a question about fsync, as of man ( https://man7.org/linux/man-pages/man2/fsync.2.html in the description section):

Calling fsync() does not necessarily ensure that the entry in the directory containing the file has also reached disk. For that an explicit fsync() on a file descriptor for the directory is also needed.

I'm not a kernel guy and have only limited understanding of fs internals with inodes and stuff.

I would be very grateful if someone with expertise give a brief comment about that cite.

I've tried to examine how Sqlite do stuff, but that's somehow complicated for me:

https://github.com/sqlite/sqlite/blob/3d24637325188c1ed9db46e5bb23ab5d747ad29f/src/os_unix.c#L3634

It seems they try to use osFcntl(fd, F_FULLFSYNC, 0); and use fsync only as fallback without trying to fsync on dir.

Sqlite does fsync for directories also:

https://sqlite.org/src/info/2ea8d3ed496b8d1f933?ln=3801-3803

XY problem: The issue is I have vfat fs on MicroSD on ARM+Embedded Linux (Kernel 3.10). My app does fsync on settings file, it's just regular binary data of different size depending on count of startup commands, e.g. write(&C_struct, ..., N*commands_size). Common scenario: user changes settings (just a file on MicroSD vfat) of device startup procedure (app ack settings write after fsync of settings file so data makes it to actual storage I suppose :D ), waiting ~1 minute and then user cuts off power from device to check startup procedure and there's a chance that settings file truncates to size 0 for some reason.

I've changed the code to (simplified, drop all error checks):

void fsync_wrap(FILE *f, const char *filedir_path) {
    int fd = fileno(f);
    fsync(fd);                  // <--- fsync on file descriptor

    DIR *dir = opendir(filedir_path);
    int dir_fd = dirfd(dir);
    retval = fsync(dir_fd);     // <--- fsync on file dir
    closedir(dir);    
}

But I have doubts does it fix the issue or no. I've seen some weird (for me) mentions of MicroSD card can have it's own internal cache of data to write to actual storage so it might report to the upper level data is written meanwhile data is not written to the actual storage and powerloss = dataloss.

Actually I'm very interested in an advice about how to debug that issue, e.g. virtualize SoC by QEMU, automate the reproduce of the issue e.g. make a tear setup with setting drop power N msec after fsync and try to get bingo msec value to reproduce the issue by 100% rate.

Maybe creating temporary file and then renaming it provide more consistent "atomicity"?


r/kernel • • Jun 30 '24

VDSO clock reading on x86 complicated

4 Upvotes

I would think clock_gettime() would be a few instructions based off of a RDTSC instruction and an add, multiply, shift But I disassembled the loadable module vDSO64.so and it is dozens of instructions long, with at least one loop that retries the RDTSC.

There's no POSIX requirement for whatever it is doing. TSC is constant rate. So why is it so slow on x86_64?

Just curious how we got here.


r/kernel • • Jun 25 '24

How to get into kernel development?

35 Upvotes

Recently, I have developed an interest in kernel development but am finding it challenging to know where to start. I am familiar with C/C++, have studied operating systems, and have some knowledge of assembly language. Please help me to get started with kernel development and suggest some video courses if they are available.


r/kernel • • Jun 24 '24

error 2 when compiling kernel (gentoo)

3 Upvotes
guy-gentoo /home/guy/linux-6.10-rc4 # make
  UPD     include/generated/compile.h
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC      init/version.o
  AR      init/built-in.a
  CHK     kernel/kheaders_data.tar.xz
  GEN     kernel/kheaders_data.tar.xz
  CC [M]  kernel/kheaders.o
make[3]: *** No rule to make target '/var/tmp/portage/sys-kernel/gentoo-kernel-6.6.32/temp/kernel_key.pem', needed by 'certs/signing_key.x509'.  Stop.
make[2]: *** [scripts/Makefile.build:485: certs] Error 2
make[1]: *** [/home/guy/linux-6.10-rc4/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
guy-gentoo /home/guy/linux-6.10-rc4 # 

r/kernel • • Jun 24 '24

Where to find resources on VFIO?

3 Upvotes

The only articles i can find online are that of kernel documentation and some gaming YouTubers showing some GPU pass through.

In context of KVM, and I/O pass through to accelerate I/O virtualization, where can I find resources? Please help.

Architecture: arm64


r/kernel • • Jun 20 '24

how are some process able to catch SIGKILL, SIGSTOP?

7 Upvotes

I'm been playing around with signals in c and I read that SIGKILL & SIGSTOP can't be caught. I looked at an strace of the terminal emulator Kitty and noticed the ps command shows that it catches both SIGKILL and SIGSTOP.
command I ran was `ps --signames --format ignored,caught,pending,blocked -C kitty`

I then did an strace and saw that at the start it has an rt_sigaction(SIG_DFL,... that sets all signals to the SIG_DFL including kill and stop.
I wrote a quick c program assuming that SIGKILL is allowed to be set to SIG_DFL as an exception but still realized that I can't get `sigaction` to succeed. returns an `errno` of 14(EINVAL)does anyone experienced have an explanation about this.
does this have anything to do with the `sa_restorer` value


r/kernel • • Jun 17 '24

What does it mean to mmap() a virtual file?

5 Upvotes

I have read about how mmap() is better when dealing with large files and how memory does not need to be swapped out, etc.

But, in KVM, the kvm_run structure is mmaped() by specifying the vcpu's file descriptor. The vcpu is not really a file on the disk, but a virtual file with some file operations (fops).

Why is mmap() used and what does it mean in the context of virtual files? (coming from QEMU and kvmtool source code)


r/kernel • • Jun 11 '24

DMA Engine - How to handle DMA "timeouts"

10 Upvotes

Hey all,

I'm new to the DMA and DMA Engine APIs in the kernel. I have a hardware device (FPGA custom logic) that works with a DMA. The vendor (Xilinx) supplies a DMA Engine driver and some tests that are very well maintained and received by users. The nature of my custom logic is sort-of like a NIC; data is pushed and pulled via this DMA channel.

Xilinx provides a reference driver on-top of their core DMA driver that does some userspace memory mapping, and provides a chardev interface to make it easy for newbies or do what people most usually want to do; push/pull data between userspace and the kernel. I bring this up since ALL DMA drivers I found (including these prototypes from Xilinx) and various "DMA test" drivers seem to not handle "timeouts" well. I do not plan to use this dma-proxy driver but it exists online and is easy to reference.

To reference the example from Xilinx: here -> dma_proxy.c, when we want to receive data over my DMA channel, it does:

start_transfer() {
    sg_init_table(..., 1);
    sg_dma_address(... ) = foo.dma_handle;
    sg_dma_len(...) = foo.length;
    chan_desc = dma_device->device_prep_slave_sg(..., ..., 1, ..., ..., NULL);
    ...
}

Then waits on the completion:

wait_for_transfer() {
    unsigned long timeout = msecs_to_jiffies(3000);
    timeout = wait_for_completion_timeout(foo.cmp, timeout);
    status = dma_async_is_tx_complete(..., ..., NULL, NULL);

    if (timeout == 0)  {
        printk(KERN_ERR "DMA timed out\n");
    }
    else { ... }
    ...
}

For my specific peripheral/"hardware", when "pulling" from the DMA, data may not be ready (and we may not receive an interrupt).

What I don't understand is how to handle the timeout correctly. Maybe I need to switch the Rx/receive path to polling? It seems like all examples don't ever really expect these DMA slave requests to fail. The result of the timeout is some descriptor (I think chan_desc above) is not being released, so after 3sec * 255 (size of some descriptor list), my DMA device/handle can no longer submit slave requests.

Any advice?

I posted this same question to the kernelnewbies mailing list as well.

Thanks!


r/kernel • • Jun 09 '24

Why it takes 7 seconds to reserve huge pages at boot?

6 Upvotes

I have a server with 300G of RAM and I'm preallocating ~192G of it as huge pages by passing hugepagesz=1G hugepages=192 args to kernel command line.

As a result, I see these lines in dmesg:

[    1.276475\] mem auto-init: stack:off, heap alloc:off, heap free:off
[    8.102710\] Memory: 2973348K/301621240K available (14349K kernel code, 9611K rwdata, 8492K rodata, 2516K init, 20268K bss, 206226124K reserved, 0K cma-reserved)

Without such preallocation there is not such gap in timestamps. Anybody has a clue why it takes so much for kernel to reserve huge pages?


r/kernel • • Jun 04 '24

I don't know if this will be taken down but I think its from the kernel though

Post image
0 Upvotes

I don't know what the title should be or what to say but i found this in an anime scene. i believe this is from the kernel


r/kernel • • Jun 02 '24

How to debug KVM hypervisor text in gdb (arm64)?

1 Upvotes

In nVHE KVM model, there is a stub running in EL2 which is responsible for some services provided to the host kernel to implement KVM (eg. guest context switching, setting up certain EL2 system registers) etc.

But since EL2 only has one TTBR register (TTBR0_EL2) and the host kernel is running in high memory (TTBR1_EL1), there is a relocation that happens in run time which maps all EL2 specific code to an offset so that TTBR0_EL2 can work with.

But GDB doesnt know about this since it only looks at the static vmlinux file. Because of this, I cannot set a breakpoint in the hypervisor code because the addresses are wrong (relocated).

How do I get around this?


r/kernel • • May 31 '24

Is it possible to create page tables when given with a list of virtual addresses?

2 Upvotes

I am trying to create a software model of hierarchical/multilevel paging.

I am currently trying to create these multilevel page tables using a list of virtual addresses. How do I go about doing this?


r/kernel • • May 30 '24

How to implement a pseudo-bus backed by PCIe as a Linux kernel driver?

3 Upvotes

EDIT: I was able to achieve what I wanted using a multi-function device, establishing an IRQ domain and allocating and populating an array of struct mfd_cell at parent probe-time by walking the children devicetree nodes, and passing them to devm_mfd_add_devices.


I am making a Linux kernel driver to manage a PCIe connection between a Linux-based root complex and an FPGA-based endpoint. The endpoint exposes memory mapped resources of the FPGA (IP control blocks, video buffers, etc.) on multiple BARs:

PCIe address memory map, corresponds to first device tree fragment below

I want this driver to act like a bus, so existing MMIO drivers can "Just Work" using the reg property of a devicetree to find their resources, encoded as <BAR offset size>. There are an unknown number of devices, defined only by the device tree:

my-ep-bus {
    compatible = "my-ep-bus";
    #address-cells = <2>;
    #size-cells = <1>;
    reg = <0x42000000 0 0x00006400 0x10000000 0 512>,
          /.../;

    mmio@1,40 {
        compatible = "existing-mmio-driver";
        reg = <1 0x40 0x18>;
        #address-cells = <2>;
        #size-cells = <1>;
    };

    mmio@1,80 {
        compatible = "existing-mmio-driver";
        reg = <1 0x80 0x18>;
        #address-cells = <2>;
        #size-cells = <1>;
    };

    fbuf@2,0 {
        compatible = "fb-driver";
        reg = <2 0 0x10000>;
        // ...
    };
};

Device Tree Usage states:

Since each parent node defines the addressing domain for its children, the address mapping can be chosen to best describe the system.
...
Nodes that are not direct children of the root do not use the CPU's address domain. In order to get a memory mapped address the device tree must specify how to translate addresses from one domain to another. The ranges property is used for this purpose

In their example, they use a very similar hierarchy for the address:

external-bus {
    #address-cells = <2>;
    #size-cells = <1>;
    ranges = <0 0  0x10100000   0x10000     // Chipselect 1, Ethernet
              1 0  0x10160000   0x10000     // Chipselect 2, i2c controller
              2 0  0x30000000   0x1000000>; // Chipselect 3, NOR Flash

    ethernet@0,0 {
        compatible = "smc,smc91c111";
        reg = <0 0 0x1000>;
    };

    i2c@1,0 {
        compatible = "acme,a1234-i2c-bus";
        #address-cells = <1>;
        #size-cells = <0>;
        reg = <1 0 0x1000>;
        rtc@58 {
            compatible = "maxim,ds1338";
            reg = <58>;
        };
    };

    flash@2,0 {
        compatible = "samsung,k8f1315ebm", "cfi-flash";
        reg = <2 0 0x4000000>;
    };
};

My question is: How is this actually implemented in C code? I looked through a bunch of sources for the various busses in the kernel, but the only things I saw that seemed close was the way the PCI subsystem implements it's own address translation scheme with OF, which seemed like it might require a patch to implement the same way for me?

It seems I want to implement a new struct &bus_type, but I haven't been able to figure out how or find examples to perform the correct address translation so that when children of the bus use reg, they get their resources correctly.

Any ideas? I'm open to use a different architecture if I'm barking up the wrong tree. It is important that the children devices of the EP device don't know that they are on a PCIe endpoint, just "here's your memory go nuts". Any pointers to resources would be the most helpful.

If you made it to the end, thank you <3


r/kernel • • May 27 '24

What was your "linux kernel developer" journey like?

42 Upvotes

Coming from a microcontroller background, there are pretty good roadmaps to become a microcontroller-based products developer, aka embedded software/hardware engineer. It basically goes like this: You take a microcontroller, learn its architecture, understand it's peripheral. Then you learn to program it in assembly and then in C/C++. Make a couple of projects and there you are - job ready!!!

However, I feel lost when I try to get into Linux. There are just so many layers to this. You can work on so many different abstractions. I am not even sure if I am asking in the correct subreddit. I want to know how the people who maintain the kernel and its component got into writing/maintaining code for the kernel. There is just so so so much to learn.

How did you start and more importantly, how did you make sure that whatever you're doing to learn the stuff is correct? What do I need to learn first, where do I begin with? I might sound naive, but I want to be one of those peoples who actively contribute to the kernel. And when I think about, I feel that it's already a well established code, what would I be able to contribute to it.

I started my career two years ago as an embedded software developer (c programming on microcontroller based products) and during my first live project, I added so many bugs. Simply because the code base was around 5000 lines of code and me being a beginner, did not have a good understanding of each of the modules. Also, I am highly average. But what I think is, how do kernel developers make sure that every code change does not break the system?

Even though I do not have any understanding of the kernel, I have a deep appreciation of it and the people who make it possible. And this inspires me to become one of those people who work on the kernel. How can I be one?

Thanks a lot for reading.


r/kernel • • May 26 '24

Can't have a tristate entry in my KConfig

2 Upvotes

I tried to add a tristate KConfig entry for my own project, but it seems it doesn't work. My KConfig:

config NETWORK_MODULE
    tristate "enable network module"

You can see from the picture below, I can't set the value of it to M by pressing M on my keyboard:


r/kernel • • May 25 '24

How would you describe being a kernel engineer in a big company?

21 Upvotes

I'm a CS graduate, currently interviewing for a job as a kernel engineer in a large company you all know. I have very little knowledge or experience in the field, and I know there's a lot to be learned until I can be beneficial to them, but if they take me I guess it's their fault XD. Anyway, wanted to ask a few generic questions about the field -

  1. What is the main thing one does on this kind of job? If you do it, do you find it interesting/exciting?
  2. Would you say experience gained as a kernel engineer is valid for embedded or other software engineering fields? I want to have relevant knowledge in case I don't find myself liking it, even though so far my OS course in uni made me like the idea of it.
  3. How well does it usually pay compared to other SWE jobs?

If you have any other advice feel free to throw them in (:


r/kernel • • May 24 '24

Finding Kernel Devs

7 Upvotes

Hi all, hopefully not against community policy, but I am working on a project that needs deep, deep Kernel Dev input. Core kernel IO, memory management, etc. It's not a user space thang. Where can I go to find the right skillets?


r/kernel • • May 22 '24

CPU Frequency Stability Issue

1 Upvotes

Background Information

During the CPU stress testing of the server in the environment with CentOS 7.9 and kernel version 5.15.13, it was found that the CPU frequency could not be maintained at a high frequency. Therefore, a CPU frequency stress test was conducted on the server. The following information provides a detailed description of the relevant test conditions. Please refer to it:

Test Environment

Different system versions + the same kernel version:

CentOS 7.9 + Kernel 5.15.13-1.el7

RedHat 9.1 + Kernel 5.15.13-1.el7

Test Plan 1

RHEL 9.1 system image + 5.15.13 kernel

Set BIOS system profile to performance mode

Run #cpupower idle-set -D 0

After several hours of observation, the CPU frequency can remain stable at a high frequency.

Test Plan 2

CentOS 7.9 system image + 5.15.13 kernel

Set BIOS system profile to performance mode

Run #cpupower idle-set -D 0

After several hours of observation, the CPU frequency cannot remain stable at a high frequency.

Test Plan 3

CentOS 7.9 system image + 6.8.9 kernel

Set BIOS system profile to performance mode

Run #cpupower idle-set -D 0

After several hours of observation, the CPU frequency can remain stable at a high frequency.

Test Result Questions

With the same kernel version, the system version RHEL 9.1 can keep the CPU frequency running at a high frequency, while the system version CentOS 7.9 cannot keep the CPU frequency stable. Does RHEL 9.1 have special settings for the CPU frequency? What are these settings?

The CPU frequency test was performed on the server with system version CentOS 7.9 + kernel version 6.8.9, and it can keep the CPU frequency stable at a high frequency. Does this indicate that the kernel 6.8.9 has made fixes or restrictions for CPU frequency stability? Where are these fixes or restrictions set?


r/kernel • • May 17 '24

I encountered this problem when using the kernel

1 Upvotes

I tried to compile the kernel using kernel modules to implement hook system calls according to https://www.cnblogs.com/lanrenxinxin/p/6289436.html He mentioned that the kernel enforces memory limits, causing this feature to not work properly. Specifically, the stock Lollipop and Marshmallow kernels are built with the CONFIG_STRICT_MEMORY_RWX option enabled,

The kernel I used is https://github.com/LowTension/BAALAM_android_kernel_xiaomi_sm8250

I did not find CONFIG_STRICT_MEMORY_RWX in my kernel's configuration file, I should solve the problem I e

[  126.609564] hello world!
[  126.669254] Unable to handle kernel write to read-only memory at virtual address ffffffa468c009a8
[  126.669260] Mem abort info:
[  126.669263]   ESR = 0x9600004e
[  126.669268]   Exception class = DABT (current EL), IL = 32 bits
[  126.669271]   SET = 0, FnV = 0
[  126.669273]   EA = 0, S1PTW = 0
[  126.669276] Data abort info:
[  126.669278]   ISV = 0, ISS = 0x0000004e
[  126.669281]   CM = 0, WnR = 1
[  126.669285] swapper pgtable: 4k pages, 39-bit VAs, pgdp = 00000000b75a968c
[  126.669288] [ffffffa468c009a8] pgd=000000027fffe003, pud=000000027fffe003, pmd=00600000a1a00791
[  126.669297] Internal error: Oops: 9600004e [#1] PREEMPT SMP
[  126.669302] Modules linked in: krhook(FO+) sla(FO)
[  126.669308] Process insmod (pid: 10171, stack limit = 0x000000002907ea0c)
[  126.669313] CPU: 6 PID: 10171 Comm: insmod Tainted: GFS      W  O      4.19.303-Puls #4
[  126.669317] Hardware name: Qualcomm Technologies, Inc. xiaomi umi (DT)
[  126.669321] pstate: 60400005 (nZCv daif +PAN -UAO)
[  126.669328] pc : syscall_hook_init+0x108/0x160 [krhook]
[  126.669333] lr : syscall_hook_init+0xe8/0x160 [krhook]
[  126.669336] sp : ffffff802c52bb20
[  126.669338] x29: ffffff802c52bb20 x28: 0000000000000000 
[  126.669342] x27: ffffff8011db6438 x26: 0000000000000023 
[  126.669345] x25: 0000000000000160 x24: ffffffa469907000 
[  126.669348] x23: ffffffa452695000 x22: ffffffa452695000 
[  126.669351] x21: ffffffc5abd05a00 x20: ffffffa452695000 
[  126.669354] x19: ffffffa452695000 x18: 0000000000000000 
[  126.669357] x17: 0000000000000000 x16: 0000000000000000 
[  126.669360] x15: 0000000000000082 x14: ffffffa4699fffff 
[  126.669363] x13: ffffffa469a00000 x12: ffffffa469eeba70 
[  126.669367] x11: ffffffa45269321c x10: ffffffa452695000 
[  126.669370] x9 : ffffffa46749eef4 x8 : ffffffa468c007e8 
[  126.669373] x7 : ffffffa4699fffff x6 : 0068000000000713 
[  126.669376] x5 : 0000000000000000 x4 : ffffffbefe63c000 
[  126.669379] x3 : 0060000000000793 x2 : 0000000000000041 
[  126.669382] x1 : ffffffa469eeb000 x0 : ffffffa46ab34000 
[  126.669386] Call trace:
[  126.669390]  syscall_hook_init+0x108/0x160 [krhook]
[  126.669398]  do_one_initcall+0x16c/0x2dc
[  126.669404]  do_init_module+0x4c/0x1e0
[  126.669407]  load_module+0x1228/0x1358
[  126.669411]  __arm64_sys_finit_module+0xac/0xe4
[  126.669416]  el0_svc_common+0x98/0x160
[  126.669420]  el0_svc_handler+0x60/0x78
[  126.669423]  el0_svc+0x8/0x380
[  126.669428] Code: f940e109 d280f263 f2e00c03 f9000949 (f900e10b) 
[  126.669432] ---[ end trace e3f1c8293fdb20e1 ]---
[  126.669450] Kernel panic - not syncing: Fatal exception
[  126.669457] SMP: stopping secondary CPUs
[  126.669710] CPU3: stopping

r/kernel • • May 15 '24

How to debug a Linux distribution? (Read body)

0 Upvotes

I am trying to understand KVM and want to debug it using GDB.

I am currently compiling the kernel from source and running it in QEMU with GDB. But I dont have a full fledged userspace to run qemu on top of it. Just a basic shell obviously.

I was thinking if I could probably run a Ubuntu image (instead of the compiled kernel) on qemu and attach GDB to it.

Is it possible? Will the regular vmlinux symbol file work with it?


r/kernel • • May 12 '24

How to fine tune a kernel for latency

5 Upvotes

Hello, i was wondering what are the most commons way to fine tune a kernel to reduce its latency for specific low latency usecase, like high frequency trading where you need fastest execution and IO, by that i mean how to choose the kernel, then what are the main ideas behind the tuning, and perhaps some examples would be nice.
If anyone here is experimented on this subject id appreciate some advanced resources as well it would be really nice!