printk

Enlarge Linux Kernel Log Buffer more that 2M

孤街醉人 提交于 2020-07-28 16:53:16
问题 I am in the process of collecting some sort of Linux Kernel activities. I have placed multiple printk statements with in the kernel source code and would like to monitor those during regular kernel activities. Unfortunately, I have realized that the Kernel Log Buffer size ( CONFIG_LOG_BUF_SHIFT ) cannot be more that 2^21 which is essentially equal to 2M entries. Is there any other way to record more than 2M Kernel messages ? 回答1: You can set the kernel log buffer to log_buf_len=4M in your

Enlarge Linux Kernel Log Buffer more that 2M

放肆的年华 提交于 2020-07-28 16:51:57
问题 I am in the process of collecting some sort of Linux Kernel activities. I have placed multiple printk statements with in the kernel source code and would like to monitor those during regular kernel activities. Unfortunately, I have realized that the Kernel Log Buffer size ( CONFIG_LOG_BUF_SHIFT ) cannot be more that 2^21 which is essentially equal to 2M entries. Is there any other way to record more than 2M Kernel messages ? 回答1: You can set the kernel log buffer to log_buf_len=4M in your

Linux kernel printk can skip messages?

被刻印的时光 ゝ 提交于 2019-12-24 16:23:28
问题 i see that in vprintk_emit kernel puts messages into log_buffer and then print them console_unlock->call_console_driver . But in case if we will put more messages than console (UART) could actually transmitt - what will be the behaviour? I see no blocking primitives near putting messages to log_buffer, so does it mean we will just delete some messages in the beginning of the log_buf to put some new (ring buffer)? So does it mean that printk messages could be lost? I'am talking about kernel 4

How to print a message in one single line in Linux kernel

杀马特。学长 韩版系。学妹 提交于 2019-12-18 21:54:43
问题 I am making a simple enque/deque program in kernel. I want to print message in kernel, and this is what I got: [18594.595747] Enqueue 3 [18594.595748] queue : [18594.595751] 2 [18594.595751] 1 [18594.595752] 3 But I want to print this without newline: [8594.595747] Enqueue 3 [18594.595748] queue : 2 1 3 This is a part of my code: printk(KERN_ALERT "Enqueue %d \n queue : ", a); rear++; for(i = front; i<rear; i++) printk(KERN_ALERT "%d ", queue_test[i]); In short, I want to print in kernel a

How to print a message in one single line in Linux kernel

為{幸葍}努か 提交于 2019-12-18 21:54:23
问题 I am making a simple enque/deque program in kernel. I want to print message in kernel, and this is what I got: [18594.595747] Enqueue 3 [18594.595748] queue : [18594.595751] 2 [18594.595751] 1 [18594.595752] 3 But I want to print this without newline: [8594.595747] Enqueue 3 [18594.595748] queue : 2 1 3 This is a part of my code: printk(KERN_ALERT "Enqueue %d \n queue : ", a); rear++; for(i = front; i<rear; i++) printk(KERN_ALERT "%d ", queue_test[i]); In short, I want to print in kernel a

How can I show printk() message in konsole?

浪尽此生 提交于 2019-12-13 17:21:13
问题 The information which is printed by printk() can only be seen under Alt + Ctrl + F1 ~ F7 console. These consoles are very inconvenient for debugging since they can't roll back. I am using KDE desktop environment and console terminal, how could I redirect the printk() message to console? 回答1: The syntax of printk is printk ("log level" "message", <arguments>); kernel defines 8 log levels in the file printk.h #define KERN_EMERG "<0>" /* system is unusable*/ #define KERN_ALERT "<1>" /* action

Strange behavior of printk in linux kernel module

谁说我不能喝 提交于 2019-12-12 18:04:01
问题 I am writing a code for linux kernel module and experiencing a strange behavior in it. Here is my code: int data = 0; void threadfn1() { int j; for( j = 0; j < 10; j++ ) printk(KERN_INFO "I AM THREAD 1 %d\n",j); data++; } void threadfn2() { int j; for( j = 0; j < 10; j++ ) printk(KERN_INFO "I AM THREAD 2 %d\n",j); data++; } static int __init abc_init(void) { struct task_struct *t1 = kthread_run(threadfn1, NULL, "thread1"); struct task_struct *t2 = kthread_run(threadfn2, NULL, "thread2");

difference between dmesg and /var/log/kern.log

笑着哭i 提交于 2019-12-06 22:12:22
问题 I am modifying the kvm module and I have added printk statements in the kernel code.After running the virtual machine, printk gives me the faulting address and other information about the guest OS. I need to generate the statistic from this info.When I use dmesg i can only see faulting address in the kernel space i.e their address are above 0XC0000000.(faulting address are needed when VMEXIT happens i.e we switch from guest to host mode) When I see the same statistics in kern.log I also get

difference between dmesg and /var/log/kern.log

两盒软妹~` 提交于 2019-12-05 01:55:44
I am modifying the kvm module and I have added printk statements in the kernel code.After running the virtual machine, printk gives me the faulting address and other information about the guest OS. I need to generate the statistic from this info.When I use dmesg i can only see faulting address in the kernel space i.e their address are above 0XC0000000.(faulting address are needed when VMEXIT happens i.e we switch from guest to host mode) When I see the same statistics in kern.log I also get faulting address from the user space(below 0XC0000000). So it seems to me like dmesg has limited

Linux-kernel debug printouts?

百般思念 提交于 2019-12-03 12:32:09
问题 Is there a better way to debug printouts in the Linux kernel? Right now littering the code with: printk(KERN_DBG "%s:%d - %s() <message>", __FILE__, __LINE__, __FUNCTION__ ); Which isn't very clean. There ought to be a way for the whole row to be #ifdef :ed in some nice way. 回答1: Use /* At the top of the file, before any includes */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/printk.h> /* in code... */ pr_devel("foobar happened\n"); as a basis (the standard practice). You can