Quantcast
Channel: Active questions tagged linux-kernel - Stack Overflow
Viewing all 12315 articles
Browse latest View live

What really are options of the "read_format" attribute of the "perf_event_attr" structure?

$
0
0

I'm currently using the perf_event_open syscall (on Linux systems), and I try to understand a configuration parameter of this syscall wich is given by the struct perf_event_attr structure.

It's about the read_format option. Has anyone can see on the man page of this syscall, this parameter is releated to the output of this call.

But I don't understand what every possible argument can do.


Especially this two possibilities:

  • PERF_FORMAT_TOTAL_TIME_ENABLED
  • PERF_FORMAT_TOTAL_TIME_RUNNING

Can anyone with that information give me a straight answer?


/sbin/init: error while loading shared libraries: libc.so.6: cannot open shared object files: No such file or directory

$
0
0
/sbin/init: error while loading shared libraries: libc.so.6: cannot open shared object files: No such file or directory

Kernel panic - not syncing: Attempted to kill init!
Pid: 1, comm: init Not tainted 2.6.32-573.26.1.el6x86_64 #1
Call Trace:
[<ffffffff81538b77>] ? panic+0xa7/0x16f

screenshot

I have a backup appliance that wrote it's recovery files to the wrong the directory - it's own root.

Now the machine won't turn on and I cannot access the backups.

This is the error I get when starting it. Can it be saved? Where do I start?

I can boot to live cd and see the file system but not sure how to try and repair it.

Kenel memory configuration 2G/2G user/kernel space [duplicate]

$
0
0

I have a 2GB ARM device that runs the 3.10.17 Linux kernel. The memory split configuration is set to 2G/2G user/kernel space split, but I can choose for the 3G/1G.

  • Does the kernel divide the memory per ratio?
    2G/2G on 2G RAM = 1G/1G user/kernel,
    3G/1G on 2G RAM = 768M/256M user/kernel.

  • The kernel doesn't take the entire split. Will enabling the 3/1 split only decrease the kernels' kernel-space memory range? Or does it affect memory management in a different way?

(The kernel configuration items are VMSPLIT_2G and VMSPLIT_3G).

fedora self-built kernel hangs even before booting (at first step) [migrated]

$
0
0

I'm running Fedora 31 and compiled a kernel with acs patch I needed according to this recipe, but it didn't boot at all(*). I followed these steps:

# rpmdev-setuptree
# koji download-build --arch=src kernel-5.4.18-200.fc31
# rpm -Uhv kernel-5.4.18-200.fc31.src.rpm
# cd SPECS/

... (here I applied the acs patch, but I also tried a clean build, i.e. without any action here)

# dnf builddep kernel.spec
# rpmbuild -bb kernel.spec
# cd ../RPMS
# rpm -ihv kernel-5.4.18-200.fc31.x86_64.rpm kernel-core-5.4.18-200.fc31.x86_64.rpm kernel-modules-5.4.18-200.fc31.x86_64.rpm kernel-modules-extra-5.4.18-200.fc31.x86_64.rpm kernel-modules-internal-5.4.18-200.fc31.x86_64.rpm kernel-devel-5.4.18-200.fc31.x86_64.rpm
# reboot

Apart from a few objtool: unreachable instruction .... warnings (which I was lead to believe shouldn't be problematic for normal operation), all output appeared normal and all rpms were built.

After the GRUB menu I literally see nothing (only a blinking cursor), that is, after I disabled EDD. Before disabling EDD, I just saw the first logging line mentioning EDD, and the kernel hung immediately afterwards.

Increasing loglevel or installing the -debug kernel (from the packages built along the above kernel) doesn't make any difference, i.e. I don't get a single line of debug info, probably because the kernel halts before even starting(?).

My cmdline is applied to all kernels (with grubby --update-kernel=ALL --args=...) and reads BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.4.10-200.fc31.x86_64 root=/dev/mapper/fedora_1nnoserv-root ro resume=/dev/mapper/fedora_1nnoserv-swap rd.lvm.lv=fedora_1nnoserv/root rd.lvm.lv=fedora_1nnoserv/swap intel_iommu=on pcie_acs_override=downstream,multifunction iommu=pt rd.driver.pre=vfio-pci video=vesafb:off vga=normal nofb nomodeset edd=off loglevel=7

(Obviously this example was obtained from the standard kernel which could normally boot. The options disabling all fb stuff is because it's a headless server for which I intend to use GPU passthrough to a kvm VM, so I want to avoid any fb drivers occupying the GPU before vfio is loaded).

All I could find on the net appears to be related to boot errors later in the boot process, but in my case I have no idea where to start because there is zero output.

Why no ARP REQUEST send when ARP entry timeout?

$
0
0

I have two hostA/hostB connected directly with ipA/ipB in same IP mask, like this:

# hostA
# ip addr show Vlan100
137: Vlan100@Bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d8:c4:97:e9:20:14 brd ff:ff:ff:ff:ff:ff
    inet 10.134.224.212/24 scope global Vlan100
       valid_lft forever preferred_lft forever
    inet 192.168.0.1/24 scope global Vlan100
       valid_lft forever preferred_lft forever

# hostB
bond0 192.168.0.2

When hostA ping hostB, then arp entry added, but after timeout, it's deleted with no ARP timeout mechanism, such as send ARP request, like this:

# hostA ping hostB OK
root@gyw-233:~# ping 192.168.0.2 -I Vlan100
PING 192.168.0.2 (192.168.0.2) from 192.168.0.1 Vlan100: 56(84) bytes of data.
64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.398 ms
^C
--- 192.168.0.2 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.398/0.398/0.398/0.000 ms

# hostA add ARP entry
root@gyw-233:~# ip neigh show
172.18.8.1 dev eth0 lladdr 7c:a2:3e:fb:f1:8a REACHABLE
192.168.0.2 dev Vlan100 lladdr 50:6b:4b:43:35:48 REACHABLE
fe80::526b:4bff:fe43:3548 dev Vlan100  FAILED
root@gyw-233:~# ip neigh show
172.18.8.1 dev eth0 lladdr 7c:a2:3e:fb:f1:8a REACHABLE
192.168.0.2 dev Vlan100 lladdr 50:6b:4b:43:35:48 REACHABLE
fe80::526b:4bff:fe43:3548 dev Vlan100  FAILED

# After timeout, hostA delete ARP entry
root@gyw-233:~# ip neigh show
172.18.8.1 dev eth0 lladdr 7c:a2:3e:fb:f1:8a REACHABLE
fe80::526b:4bff:fe43:3548 dev Vlan100  FAILED

hostB just receive first ARP REQUEST when ping start, then receive no more ARP REQUEST

This is the ARP kernel param in hostA:

anycast_delay
100

app_solicit
0

base_reachable_time
30

base_reachable_time_ms
30000

delay_first_probe_time
5

gc_interval
30

gc_stale_time
60

gc_thresh1
1

gc_thresh2
512

gc_thresh3
1024

locktime
100

mcast_resolicit
0

mcast_solicit
3

proxy_delay
80

proxy_qlen
64

retrans_time
100

retrans_time_ms
1000

ucast_solicit
3

unres_qlen
31

unres_qlen_bytes
65536

This is the ARP kernel param in hostB, most is same, except these:

gc_thresh1
128

no mcast_resolicit in hostB

But hostB ping hostA is OK, which ARP entry exist for long time, and these is ARP REQUEST after timeout.

So is anyone encounter this bug?

Writing a file in /proc continuouly floods the dmesg

$
0
0

I am trying to read/Write a variable in the linux kernel module using /proc file entry facility. Kernel module compiles successfully but when tried writing it via

echo 1 > My_file

This operation didn't finish.

Also, dmesg console is continuously flooded with some random value.

[ 1171.481231] proc_write_flag New_Flag 1124646486
[ 1171.481245] proc_write_flag New_Flag 1124646486
[ 1171.481259] proc_write_flag New_Flag 1124646486
[ 1171.481271] proc_write_flag New_Flag 1124646486
[ 1171.481473] ^C

I am new to linux device drivers and trying to use /proc facility provided by the linux kernel. I tried removing the this kernel module, but again, the operation didn't finish.

what is causing this behaviour and how can i rectify it?

Here is the code:

int my_flag;
static struct proc_dir_entry *pdir = NULL;

MODULE_LICENSE("GPL");
MODULE_AUTHOR("GPL");

static ssize_t proc_read_flag(struct file* page,char __user * data, size_t count, loff_t *offset);
static ssize_t proc_write_flag(struct file *file, const char __user* ubuf, size_t count, loff_t* offset);

static struct file_operations myops = 
{
    .owner = THIS_MODULE,
    .read = proc_read_flag,
    .write= proc_write_flag,
};


//ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
//Updated Read function after the reply.
    static ssize_t proc_read_flag(struct file* page,char __user * data, size_t count,loff_t *offset)
{
    int ret;
    if( count >my_flag)         //my_flag holds the count of chars received by write function.
            count = my_flag;
    ret = copy_to_user(data, my_buf, my_flag );
     printk("%s: ret = %d ,my_flag %d\n",__FUNCTION__, ret, my_flag);
    return ( my_flag - ret );
}


//ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
//Updated Write function After the reply.
static ssize_t proc_write_flag(struct file *file, const char __user* ubuf, size_t count, loff_t* offset)
{

    if( copy_from_user(my_buf,ubuf,count) ){        //Returns No. of bytes could not copy
            return -EFAULT;
    }
    my_flag = count;
    printk("%s New_Flag %d Data: %s\n",__FUNCTION__,my_flag,my_buf);
    return count;
}

int init_module(void)
{
    struct proc_dir_entry *pfile = NULL;

    pdir = proc_mkdir("My_dir",NULL);
    if(!pdir){
        return -ENOMEM;
    }

    pfile = proc_create("My_file", 0666, pdir, &myops);
    if(!pfile)
        return -ENOMEM;


    printk("Proc_entry Created Successfully, Module initialized\n");
    return 0;
}

void cleanup_function(void)
{
    remove_proc_entry("My_file", pdir);
    remove_proc_entry("My_dir", NULL);
    printk("Removing Proc_entry!!!");
}

What does features of Ethernet devices in ethtool mean? How to changes features in C program?

$
0
0

As we know we can use ethtool -k to get features of Ethernet devices, and we can use ethtool -K to change the featueres' status.

I want to change some features of Ethernet devices in my C program.
I want to use ioctl with ETHTOOL_SFEATURES to do this:

#define ETHTOOL_SFEATURES   0x0000003b /* Change device offload settings */

I think maybe I need to pass an argument of struct ethtool_sfeatures to ioctl:

/**
 * struct ethtool_set_features_block - block with request for 32 features
 * @valid: mask of features to be changed
 * @requested: values of features to be changed
 */
struct ethtool_set_features_block {
    __u32   valid;
    __u32   requested;
};

/**
 * struct ethtool_sfeatures - command to request change in device's features
 * @cmd: command number = %ETHTOOL_SFEATURES
 * @size: array size of the features[] array
 * @features: feature change masks
 */
struct ethtool_sfeatures {
    __u32   cmd;
    __u32   size;
    struct ethtool_set_features_block features[0];
};

But I don't know what the valid of ethtool_set_features_block should be and I don't know what does the mask mean in comments.
I tried to compile ethtool with -g and debug when I use ethtool -K to change a feature, and I can get a mask, but I want to know if the mask would be different in different computer or in different Ethernet devices?
Maybe I should try to get mask of features every time before changing it so that I won't use mask which may be wrong?

Kernel error: IRQ remapping doesn't support X2APIC mode, disabled x2apic

$
0
0

I need to enable x2apic on Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz, and I find x2apic was supported in cpuinfo:

enter image description here

But when kernel started, I find error message:

[ 0.138328] IRQ remapping doesn't support X2APIC mode, disable x2apic.

I have checked my kernel config:

CONFIG_X86_X2APIC=y

What can I do to fix this problem?


How linux arm64 switch between AArch32 and AArch64

$
0
0

linux supports running 32-bit application, as long as

  1. kernel enables CONFIG_COMPAT
  2. the hardware supports the AArch32

i assume that 32-bit application must run in arm AArch32 execution state and if the environment has 32-bit application and 64-bit application.

32-bit application process -> arm state is AArch32

64-bit application process and kernel -> arm state is AArch64

is it correct?

if so, how does the linux handle the AArch32 and AArch64 switch? does kernel know the running process is 32bit or 64bit?

Where i can find about basic linux tutorial ?, especially ubuntu [closed]

$
0
0

Where i can find about basic linux tutorial ?, especially ubuntu

For these tutorial : - About basic linux command lines - About basic C programming in linux (system call, toolchain, ...) - and About basic linux internal

i'm new in linux, but i have experienced 7 years software development in windows

J1939 in Linux Kernel [duplicate]

$
0
0

Iam working with imx6ull board. Iam developing software stack for CAN J1939 protocol.In the development stage i got to know that we need to add support for J1939 in Kernel. Iam using Linux kernel version 4.1.15.Can anyone suggest a way to install J1939 in Linux kernel?

Linux Platform Drivers: How to pass DMA Ops to cells?

$
0
0

I am writing a multi function driver (mfd) for a PCIe device with DMA capabilities. Several cells are added through mfd_add_devices.

I found that the struct device* of the top level mfd driver has the correct struct dma_ops set to allocate buffers, manage DMA transfers etc. Howewer, the child platform drivers get another struct dma_ops filled with dummy implementations.

How can arrange for the child platform drivers to get/inherit the correct set of DMA operations from their parent?

How to remount root after chroot [closed]

$
0
0

My system run chroot after kernel started. When I run

mount -o size=1024M,remount,rw /

I got an error:

mount: can't find / in /proc/mounts

By the way, my rootfs is ramfs.

Get 'cmdline' as exported in /proc/$PID/cmdline from Linux Kernel Code

$
0
0

I'm trying to get the cmdline of a process as it is shown in /proc/$PID/cmdline by it's PID from within Kernel Context.

I can access the task_struct and it's field "comm", which however only holds 16 characters.

What is the best way to achieve this?

I'm using the AOSP Wahoo Kernel

( repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-wahoo-4.4-pie-qpr2 )

Map sharing between different ebpf program types

$
0
0

Is it possible to share ebpf maps between different program types. I need to share a map between a tc-bpf program and a cgroup bpf program. This should be possible if the map is pinned to file system that act as global namespace. But, I haven't got this working.

The map is created by tc-bpf program and pinned to global namespace. Since it is tc-bpf program, the map is of type struct bpf_elf_map. This bpf program is loaded via iproute2.

Now, I have a cgroup bpf program that should be accessing this map, but since it is loaded via a user.c (libbpf) or bpftool and not iproute, the map that is defined here cannot be ‘bpf_elf_map’, but it is struct bpf_map_def. So in the cgroup bpf program, the same map is defined as struct bpf_map_def and not struct bpf_elf_map.

Probably because of this the cgroup program gets a new map_id when I dump the maps (and does not share the intended map), ideally when the same map is shared across bpf programs, these bpf programs would be having the same map_id associated with their unique prog_ids.


Why can't I stop this thread from the Linux kernel?

$
0
0

Edit: Clarification -- This is Linux kernel code.

I send SIGSTOP to a thread and then call wait_task_inactive to make sure it stopped. But the CPU RCU-stalls judging by the kernel log. I have no spin-lock acquired and I should have root privileges. I should also mention that the thread I'm trying to stop is not special in any way, it's just a single-threaded user script. Also, if someone has a better suggestion on how to make sure the thread woke up, I'm all ears.

With the Linus' tree comment at wait_task_inactive() in mind, I can only think of two possibilities:

  • There is some spinlock acquired which I'm not aware of. I don't think is this one.

  • The signal is never received or handled by the thread. I don't know why could this happen other than privileges (i.e. I don't have enough to send that signal, which I doubt) or that wait_task_inactive has higher priority and the thread starves waiting. But there are plenty of CPU and the thread is runned by me so...

In conclusion, I am stalled too!

Code:

void __send_signal(int sig_num, struct task_struct* p){
       struct siginfo info;
       unsigned long previous_state = p->state;
       int ret = 0;
       memset(&info, 0, sizeof(struct siginfo));
       info.si_signo = sig_num;
       info.si_code = 0;
       info.si_int = 1234;
       ret = send_sig_info(sig_num, &info,  p);
       /* Make sure the signal has been captured */
       switch(sig_num){
        case SIGSTOP:
            wait_task_inactive(p, p->state); /* It believe it stalls here */
            break;
        case SIGCONT:
            /* You definitely don't want to send a SIGCONT to a non-runnable thread. */
            while (previous_state != TASK_RUNNING && previous_state != TASK_WAKING &&
                     p->state == previous_state){
                cpu_relax();
            }
            break;
        default:
            printk(KERN_INFO "Signal %d was only sent...\n",sig_num);
       }
        if (ret < 0) {
               printk(KERN_ALERT "Error sending signal to PID %d\n",p->pid);
       }
}

Kernel buffer:

INFO: rcu_preempt detected stalls on CPUs/tasks:
[  184.838479]  6-...: (1 GPs behind) idle=315/140000000000000/0 softirq=40955/40956 fqs=2625 
[  184.846927]  (detected by 0, t=5252 jiffies, g=16297, c=16296, q=5592)
[  184.853610] Task dump for CPU 6:
[  184.856919] executable    R  running task    14288  5286   5172 0x0000000c
[  184.864198]  0000000000000086 ffffffff8a047a20 ffffb69449493b00 ffffffff89a6aab2
[  184.871992]  00000000ffffffff ffffb69449493b20 ffffffff894c004e 0000000000000006
[  184.879783]  000000000000002c ffffb69449493b38 ffffffff894c4fc9 ffffffff89a6a89a
[  184.887576] Call Trace:
[  184.890111]  [<ffffffff89a6aab2>] ? _raw_spin_unlock_irqrestore+0x32/0x60
[  184.896979]  [<ffffffff894c004e>] ? down_trylock+0x2e/0x40
[  184.902550]  [<ffffffff894c4fc9>] console_trylock+0x19/0x70
[  184.908202]  [<ffffffff89a6a89a>] ? _raw_spin_unlock+0x1a/0x30
[  184.914113]  [<ffffffff894c6eb5>] vprintk_emit+0x2f5/0x520
[  184.919679]  [<ffffffff894c724f>] vprintk_default+0x1f/0x30
[  184.925338]  [<ffffffff89577eb1>] printk+0x48/0x50
[  184.930222]  [<ffffffffc1a2c0db>] send_signal+0x70/0xe2 [module]

How to allocate large contiguous, memory regions in Linux

$
0
0

Yes, I will ultimately be using this for DMA but lets leave coherency aside for the moment. I have 64 bit BAR registers, therefore, AFAIK, all of RAM (e.g. higher than 4G) is available for DMA.

I am looking for about 64MB of contiguous RAM. Yes, that's a lot.

Ubuntu 16 and 18 have CONFIG_CMA=y but CONFIG_DMA_CMA is not set at kernel compile time.

I note that if both were set (at Kernel build time) I could simply call dma_alloc_coherent, however, for logistical reasons, it is undesirable to recompile the kernel.

The machines will always have at least 32GB of RAM, do not run anything RAM intensive, and the kernel module will load shortly after boot before RAM becomes significantly fragmented and, AFAIK, nothing else is using the CMA.

I have set the kernel parameter CMA=1G. (and have tried 256M and 512M)

# dmesg | grep cma
[    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.4.170 root=UUID=2b25933c-e10c-4833-b5b2-92e9d3a33fec ro cma=1G
[    0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-4.4.170 root=UUID=2b25933c-e10c-4833-b5b2-92e9d3a33fec ro cma=1G
[    0.000000] Memory: 65612056K/67073924K available (8604K kernel code, 1332K rwdata, 3972K rodata, 1484K init, 1316K bss, 1461868K reserved, 0K cma-reserved)

I have tried alloc_pages(GFP_KERNEL | __GFP_HIGHMEM, order), no joy.

And finally the actual question: How does one get large contiguous blocks from the CMA? Everything I have found online suggests the use of dma_alloc_coherent but I know this only works with CONFIG_CMA=y and CONFIG_DMA_CMA=yes.

The module source, tim.c

#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/gfp.h>
unsigned long big;
const int order = 15;
static int __init tim_init(void)
{
        printk(KERN_INFO "Hello Tim!\n");
        big = __get_free_pages(GFP_KERNEL | __GFP_HIGHMEM, order);
        printk(KERN_NOTICE "big = %lx\n", big);
        if (!big)
                return -EIO; // AT&T

        return 0; // success
}

static void __exit tim_exit(void)
{
        free_pages(big, order);
        printk(KERN_INFO "Tim says, Goodbye world\n");
}

module_init(tim_init);
module_exit(tim_exit);
MODULE_LICENSE("GPL");

Inserting the module yields...

# insmod tim.ko
insmod: ERROR: could not insert module tim.ko: Input/output error
# dmesg | tail -n 33

[  176.137053] Hello Tim!
[  176.137056] ------------[ cut here ]------------
[  176.137062] WARNING: CPU: 4 PID: 2829 at mm/page_alloc.c:3198 __alloc_pages_nodemask+0xd14/0xe00()
[  176.137063] Modules linked in: tim(OE+) xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 xt_tcpudp bridge stp llc ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter ip_tables x_tables configfs vxlan ip6_udp_tunnel udp_tunnel uio pf_ring(OE) x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm mei_me mei irqbypass sb_edac ioatdma edac_core shpchp serio_raw input_leds lpc_ich dca acpi_pad 8250_fintek mac_hid ib_iser rdma_cm iw_cm ib_cm ib_sa ib_mad ib_core ib_addr iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi autofs4 btrfs raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid0 multipath linear
[  176.137094]  hid_generic usbhid crct10dif_pclmul crc32_pclmul ghash_clmulni_intel e1000e aesni_intel raid1 aes_x86_64 isci lrw libsas ahci gf128mul ptp glue_helper ablk_helper cryptd psmouse hid libahci scsi_transport_sas pps_core wmi fjes
[  176.137105] CPU: 4 PID: 2829 Comm: insmod Tainted: G           OE   4.4.170 #1
[  176.137106] Hardware name: Supermicro X9SRL-F/X9SRL-F, BIOS 3.3 11/13/2018
[  176.137108]  0000000000000286 8ba89d23429d5749 ffff88100f5cba90 ffffffff8140a061
[  176.137110]  0000000000000000 ffffffff81cd89dd ffff88100f5cbac8 ffffffff810852d2
[  176.137112]  ffffffff821da620 0000000000000000 000000000000000f 000000000000000f
[  176.137113] Call Trace:
[  176.137118]  [<ffffffff8140a061>] dump_stack+0x63/0x82
[  176.137121]  [<ffffffff810852d2>] warn_slowpath_common+0x82/0xc0
[  176.137123]  [<ffffffff8108541a>] warn_slowpath_null+0x1a/0x20
[  176.137125]  [<ffffffff811a2504>] __alloc_pages_nodemask+0xd14/0xe00
[  176.137128]  [<ffffffff810ddaef>] ? msg_print_text+0xdf/0x1a0
[  176.137132]  [<ffffffff8117bc3e>] ? irq_work_queue+0x8e/0xa0
[  176.137133]  [<ffffffff810de04f>] ? console_unlock+0x20f/0x550
[  176.137137]  [<ffffffff811edbdc>] alloc_pages_current+0x8c/0x110
[  176.137139]  [<ffffffffc0024000>] ? 0xffffffffc0024000
[  176.137141]  [<ffffffff8119ca2e>] __get_free_pages+0xe/0x40
[  176.137143]  [<ffffffffc0024020>] tim_init+0x20/0x1000 [tim]
[  176.137146]  [<ffffffff81002125>] do_one_initcall+0xb5/0x200
[  176.137149]  [<ffffffff811f90c5>] ? kmem_cache_alloc_trace+0x185/0x1f0
[  176.137151]  [<ffffffff81196eb5>] do_init_module+0x5f/0x1cf
[  176.137154]  [<ffffffff81111b05>] load_module+0x22e5/0x2960
[  176.137156]  [<ffffffff8110e080>] ? __symbol_put+0x60/0x60
[  176.137159]  [<ffffffff81221710>] ? kernel_read+0x50/0x80
[  176.137161]  [<ffffffff811123c4>] SYSC_finit_module+0xb4/0xe0
[  176.137163]  [<ffffffff8111240e>] SyS_finit_module+0xe/0x10
[  176.137167]  [<ffffffff8186179b>] entry_SYSCALL_64_fastpath+0x22/0xcb
[  176.137169] ---[ end trace 6aa0b905b8418c7b ]---
[  176.137170] big = 0

curiously, trying it again yields...

# insmod tim.ko
insmod: ERROR: could not insert module tim.ko: Input/output error
...and dmesg just shows:

[  302.068396] Hello Tim!
[  302.068398] big = 0

why no stack dump the second (and subsequent) try(s)?

What are the relations between a kernel control path a kernel thread?

$
0
0

Understanding The Linux Kernel says:

A kernel control path denotes the sequence of instructions executed by the kernel to handle a system call, an exception, or an interrupt.

and

Besides user processes, Unix systems include a few privileged processes called kernel threads with the following characteristics:

• They run in Kernel Mode in the kernel address space.

• They do not interact with users, and thus do not require terminal devices.

• They are usually created during system startup and remain alive until the system is shut down.

  1. What are the relations between the two concepts: a kernel control path a kernel thread?

    Is a kernel control path a kernel thread?

    Is a kernel thread a kernel control path?

  2. If I am correct, a kernel thread is represented as a task_struct object.

    So is a kernel control path?
    If not, what kinds of kernel control paths can be and what kinds can't be?

  3. If I am correct, a kernel thread can be scheduled together with processes.

    Can a kernel control path? If not, what kinds of kernel control paths can be and what kinds can't be?

What is the significance of THIS_MODULE in Linux kernel module drivers?

$
0
0

In Linux device driver development, the file_operations structure uses struct module *owner.

  • What is the use of this structure when we always initialize it with THIS_MODULE?
  • When can this field be set to NULL?

linux headers are consuming a lot of disk space on the EC2 machine. Is it safe to manually delete the headers with rm command?

$
0
0

EC2 machine on aws is filled with multiple linux headers and currently / is 100% full on disk space. I ran commands like apt-get autoremove but it is throwing an error saying

No apport report written because the error message indicates a disk full error
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)

Can I remove the old headers by the rm command? Is it safe? and if I remove with rm command, should I do any clean up after that? Here is the list of headers:

du -h -d1 /usr/src/ | sort -hr
2.8G    /usr/src/
106M    /usr/src/linux-aws-headers-4.4.0-1099
106M    /usr/src/linux-aws-headers-4.4.0-1098
106M    /usr/src/linux-aws-headers-4.4.0-1096
106M    /usr/src/linux-aws-headers-4.4.0-1095
106M    /usr/src/linux-aws-headers-4.4.0-1094
106M    /usr/src/linux-aws-headers-4.4.0-1092
106M    /usr/src/linux-aws-headers-4.4.0-1090
106M    /usr/src/linux-aws-headers-4.4.0-1088
106M    /usr/src/linux-aws-headers-4.4.0-1087
106M    /usr/src/linux-aws-headers-4.4.0-1085
106M    /usr/src/linux-aws-headers-4.4.0-1084
106M    /usr/src/linux-aws-headers-4.4.0-1083
106M    /usr/src/linux-aws-headers-4.4.0-1079
106M    /usr/src/linux-aws-headers-4.4.0-1077
106M    /usr/src/linux-aws-headers-4.4.0-1075
106M    /usr/src/linux-aws-headers-4.4.0-1074
106M    /usr/src/linux-aws-headers-4.4.0-1072
106M    /usr/src/linux-aws-headers-4.4.0-1070
106M    /usr/src/linux-aws-headers-4.4.0-1069
106M    /usr/src/linux-aws-headers-4.4.0-1066
106M    /usr/src/linux-aws-headers-4.4.0-1065
106M    /usr/src/linux-aws-headers-4.4.0-1062
106M    /usr/src/linux-aws-headers-4.4.0-1061
106M    /usr/src/linux-aws-headers-4.4.0-1060
13M /usr/src/linux-headers-4.4.0-1100-aws
13M /usr/src/linux-headers-4.4.0-1099-aws
13M /usr/src/linux-headers-4.4.0-1098-aws
13M /usr/src/linux-headers-4.4.0-1096-aws
13M /usr/src/linux-headers-4.4.0-1095-aws
13M /usr/src/linux-headers-4.4.0-1094-aws
13M /usr/src/linux-headers-4.4.0-1092-aws
13M /usr/src/linux-headers-4.4.0-1090-aws
13M /usr/src/linux-headers-4.4.0-1088-aws
13M /usr/src/linux-headers-4.4.0-1087-aws
13M /usr/src/linux-headers-4.4.0-1085-aws
13M /usr/src/linux-headers-4.4.0-1084-aws
13M /usr/src/linux-headers-4.4.0-1083-aws
13M /usr/src/linux-headers-4.4.0-1079-aws
13M /usr/src/linux-headers-4.4.0-1077-aws
13M /usr/src/linux-headers-4.4.0-1075-aws
13M /usr/src/linux-headers-4.4.0-1074-aws
13M /usr/src/linux-headers-4.4.0-1072-aws
13M /usr/src/linux-headers-4.4.0-1070-aws
13M /usr/src/linux-headers-4.4.0-1069-aws
13M /usr/src/linux-headers-4.4.0-1066-aws
13M /usr/src/linux-headers-4.4.0-1065-aws
13M /usr/src/linux-headers-4.4.0-1062-aws
13M /usr/src/linux-headers-4.4.0-1061-aws
13M /usr/src/linux-headers-4.4.0-1060-aws

df command output:

df -k
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              499316       0    499316   0% /dev
tmpfs             101444   10740     90704  11% /run
/dev/xvda1       8065444 8049060         0 100% /
tmpfs             507212       0    507212   0% /dev/shm
tmpfs               5120       0      5120   0% /run/lock
tmpfs             507212       0    507212   0% /sys/fs/cgroup
/dev/xvdf        5029504   10244   4740732   1% /data
tmpfs             101444       0    101444   0% /run/user/1000
Viewing all 12315 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>