格式化文件系统 CPU: 1 PID: 11170 Comm: mkfs.ext4 Tainted: G E ———— 3.10.0-693.2.2.el7.IO #25 Hardware name: Inventec AliServer Thor01-2U /TB800G4 , BIOS A1.04 08/01/2017 ffff885eb67c8c80 000000009250a0d5 ffff885eb28e7ad8 ffffffff817737f9 ffff885eb28e7b18 ffffffffc0527770 000000009250a0d5 ffff885eb28e7fd8 ffff885eb28e7fd8 ffff885d82fbe8c8 ffff88580dbaca00 ffff885b7edcc820
READ MORE »Posts in category 内核基础
驱动加载报错“no symbol version for module_layout”解决办法
新编译的驱动,加载时报错“no symbol version for module_layout”,查看模块vergmaic完全一致。 #insmod drivers/block/nvme.ko insmod: error inserting ‘drivers/block/nvme.ko’: -1 Invalid module format
READ MORE »Linux内核基于SCSI设备文件系统AIO读写栈
AIO同步写 #fio -ioengine=libaio -bs=4k -direct=1 -thread -rw=write -size=100M -filename=aio.tst -name=”4K write test” -iodepth=1 -runtime=10 CPU: 21 PID: 19747 Comm: fio Not tainted 3.10.0-327.alios7.x86_64.debug #50 Hardware name: Inspur SA5212M4/YZMB-00370-102, BIOS 4.1.8 07/02/2016 ffff885e5d29c000 000000004e14ca4c ffff885e61e7bcc0 ffffffff8162a7c9 ffff885e61e7bd28 ffffffffa0173b2e ffff885e61e7bcf0 ffffffff8141789a ffff885d1d925200 ffff885e604b6a08 ffff885e61e7bd28 ffff885e61e7bd08 Call Trace: [<ffffffff8162a7c9>] dump_stack+0x19/0x1b [<ffffffffa0173b2e>] _scsih_qcmd+0x4be/0x5f0 [mpt3sas] [<ffffffff8141789a>] ? […]
READ MORE »Linux内核基于SCSI设备文件系统读写栈
同步写 #fio -bs=4k -direct=1 -thread -rw=write -size=1G -filename=ssd.tst -name=”sdx” -iodepth=1 -runtime=10 [10940.221722] CPU: 0 PID: 128839 Comm: fio Not tainted 3.10.0-327.alios7.x86_64.debug #50 [10940.221723] Hardware name: Inspur SA5212M4/YZMB-00370-102, BIOS 4.1.8 07/02/2016
READ MORE »Linux内核SCSI块设备读写栈信息
以mpt3sas驱动为例,从用户态发送读写命令到控制器驱动入口。 [<ffffffff8162a7c9>] dump_stack+0x19/0x1b [<ffffffffa0173b2e>] _scsih_qcmd+0x4be/0x5f0 [mpt3sas] [<ffffffff8141789a>] ? scsi_setup_cmnd+0xfa/0x180 [<ffffffff81410b3a>] scsi_dispatch_cmd+0xaa/0x230
READ MORE »如何获取Linux内核空间read/write操作文件名
在Linux内核空间中,如何获取读写的文件名? How to get read/write filename in linux kernel space? 如ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)中如何获取读写的文件名? 答案: file->f_path.dentry->d_iname
READ MORE »升级/修改Linux内核时,如何关闭生成rescue image
问题: 通过源码编译方式升级/修改Linux内核时,由于/boot目录空闲有限,生成rescue initramfs文件时,由于空间不足,生成img文件失败。 #df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda2 51475068 17528648 31308596 36% / devtmpfs 197963156 0 197963156 0% /dev tmpfs 197980432 176 197980256 1% /dev/shm tmpfs 197980432 9400 197971032 1% /run tmpfs 197980432 0 197980432 0% /sys/fs/cgroup /dev/sda1 248783 244685 0 100% /boot tmpfs 39596088 0 39596088 0% /run/user/0 /dev/sdi 781412184 […]
READ MORE »Linux内核编译报错“error: dereferencing pointer to incomplete type”分析
调试Linux内核,在vfs_write()中获取当前文件写所属的硬盘盘符,添加以下主要代码。但编译时,报错“error: dereferencing pointer to incomplete type”。仔细检查了代码,也没发现错误。 最后感觉是struct gendisk的定义没找到,在read_write.c文件头添加包含linux/blkdev.h后,编译通过。 #include <linux/blkdev.h> struct gendisk *disk; if(file->f_path.dentry->d_inode && file->f_path.dentry->d_inode->i_bdev) disk = file->f_path.dentry->d_inode->i_bdev->bd_disk; [root@root /zlib/linux-3.10.0-327.x86_64] #make -j64 make[1]: Nothing to be done for `all’. CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CC scripts/mod/devicetable-offsets.s GEN scripts/mod/devicetable-offsets.h HOSTCC scripts/mod/file2alias.o HOSTLD scripts/mod/modpost make[1]: Nothing to be done for `relocs’. make[1]: `arch/x86/purgatory/kexec-purgatory.c’ is up to date. […]
READ MORE »Linux内核printk打印格式
来源:https://www.kernel.org/doc/Documentation/printk-formats.txt If variable is of Type, use printk format specifier: ——————————————————— int %d or %x unsigned int %u or %x long %ld or %lx unsigned long %lu or %lx long long %lld or %llx unsigned long long %llu or %llx size_t %zu or %zx ssize_t %zd or %zx s32 %d or %x u32 %u or […]
READ MORE »