linux-device-driver

How to get details of all modules / drivers that were initialized / probed during the Linux kernel boot?

被刻印的时光 ゝ 提交于 2019-12-01 17:32:10
问题 I need the sequence of modules/drivers that are invoked|initialized|probed during the kernl boot. Can you please let me know if any flash command-line option available to get this sequence ? 回答1: Passing the option "initcall_debug" on the kernel command line will cause timing information to be printed to the console for each init routine of built-in drivers. The initcalls are used to initialize statically linked kernel drivers and subsystems and contribute a significant amount of time to the

fsync, sync: does it really do what its supposed to? [closed]

谁说我不能喝 提交于 2019-12-01 16:00:58
I would like to have more clarification on the functionality of sync(8) and fsync functions in Linux (2.6.31). Does it make sure the files are written to the respective storage? Oliver http://linux.die.net/man/8/sync It does not make sure that files are written to respective storage. It only makes sure that cached/buffered data is flushed to the disk device. It doesn't matter if this is an SD Card or whatever. 来源: https://stackoverflow.com/questions/12262454/fsync-sync-does-it-really-do-what-its-supposed-to

Why is kernel boot too late?

拈花ヽ惹草 提交于 2019-12-01 12:06:27
问题 I have zynq-microzed board and my log messages are following... [Mon Jun 09 19:28:38.231 2014] SF: Detected S25FL129P_64K/S25FL128S_64K with page size 64 KiB, total 16 MiB [Mon Jun 09 19:28:38.446 2014] SF: 1245184 bytes @ 0x520000 Read: OK [Mon Jun 09 19:28:38.446 2014] ## Loading kernel from FIT Image at 01000000 ... [Mon Jun 09 19:28:38.446 2014] Using 'conf@1' configuration [Mon Jun 09 19:28:38.446 2014] Trying 'kernel@1' kernel subimage [Mon Jun 09 19:28:38.446 2014] Description:

Calling kernel_fpu_begin twice before kernel_fpu_end

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 09:41:07
I'm using the kernel_fpu_begin and kernel_fpu_end functions in asm/i387.h to protect the FPU register states for some simple floating point arithmetic inside of a Linux kernel module. I'm curious about the behavior of calling the kernel_fpu_begin function twice before the kernel_fpu_end function, and vice versa. For example: #include <asm/i387.h> double foo(unsigned num){ kernel_fpu_begin(); double x = 3.14; x += num; kernel_fpu_end(); return x; } ... kernel_fpu_begin(); double y = 1.23; unsigned z = 42; y -= foo(z); kernel_fpu_end(); In the foo function, I call kernel_fpu_begin and kernel_fpu

Calling kernel_fpu_begin twice before kernel_fpu_end

99封情书 提交于 2019-12-01 09:38:32
问题 I'm using the kernel_fpu_begin and kernel_fpu_end functions in asm/i387.h to protect the FPU register states for some simple floating point arithmetic inside of a Linux kernel module. I'm curious about the behavior of calling the kernel_fpu_begin function twice before the kernel_fpu_end function, and vice versa. For example: #include <asm/i387.h> double foo(unsigned num){ kernel_fpu_begin(); double x = 3.14; x += num; kernel_fpu_end(); return x; } ... kernel_fpu_begin(); double y = 1.23;

how does compiler/linker resolves kernel API like 'printk' called from a module on linux

蹲街弑〆低调 提交于 2019-12-01 09:03:45
I have written a sample hello.ko kernel module: #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ int init_module(void) { printk(KERN_INFO "Hello world.\n"); return 0; } void cleanup_module(void) { printk(KERN_INFO "Goodbye world 1.\n"); } Here, I have used "printk" method which is a Kernel API exposed by Linux. I can see the Linux exported symbols in "/proc/kallsyms". I am curious to know how do gcc/ld links the called Kernel APIs? Does gcc/ld gets address of kernel method from "/proc/kallsyms" or some other file and perform linking? If

Reason why use loff_t *offp instead of direct filp->f_pos usage

五迷三道 提交于 2019-12-01 07:45:40
问题 In following functions, taken from LDD: ssize_t read(struct file *filp, char __user *buff, size_t count, loff_t *offp); ssize_t write(struct file *filp, const char __user *buff, size_t count, loff_t *offp); Why there is the need of loff_t *offp ? Can't I use directly filp to update f_pos ? Moreover in page 54 the author says: Read and write should update a position using the pointer they receive as the last argument instead of acting on filp->f_pos directly. The one exception to this... OK,

Why udelay and ndelay is not accurate in linux kernel?

那年仲夏 提交于 2019-12-01 07:29:06
问题 I make a function like this trace_printk("111111"); udelay(4000); trace_printk("222222"); and the log shows it's 4.01 ms , it'OK But when i call like this trace_printk("111111"); ndelay(10000); ndelay(10000); ndelay(10000); ndelay(10000); .... ....//totally 400 ndelay calls trace_printk("222222"); the log will shows 4.7 ms. It's not acceptable. Why the error of ndelay is so huge like this? Look deep in the kernel code i found the implemention of this two functions void __udelay(unsigned long

how does compiler/linker resolves kernel API like 'printk' called from a module on linux

ぐ巨炮叔叔 提交于 2019-12-01 06:50:23
问题 I have written a sample hello.ko kernel module: #include <linux/module.h> /* Needed by all modules */ #include <linux/kernel.h> /* Needed for KERN_INFO */ int init_module(void) { printk(KERN_INFO "Hello world.\n"); return 0; } void cleanup_module(void) { printk(KERN_INFO "Goodbye world 1.\n"); } Here, I have used "printk" method which is a Kernel API exposed by Linux. I can see the Linux exported symbols in "/proc/kallsyms". I am curious to know how do gcc/ld links the called Kernel APIs?

what is difference between cdev_alloc and cdev_init

半腔热情 提交于 2019-12-01 06:13:57
I'm creating a character device. I found two way to initialize char device cdev_alloc and cdev_init According to book, if i'm embedding struct cdev in my device struct then i should use cdev_init Can any one tell me that what are difference between them? you can use either: struct cdev my_cdev; in this case you don't need to call cdev_alloc because memory is already allocated. Instead you must call cdev_init(&my_cdev, &fops) . and then my_cdev.owner = THIS_MODULE; OR you can use: struct cdev *my_cdev_p; in this case you must call cdev_alloc() to allocate memory. Then, you have to initialize my