printk is a function that prints messages and is used in the C Programming Language exclusively for the Linux Kernel. It accepts a string parameter called the format string, which specifies a method for rendering an arbitrary number of varied data type parameter(s) into a string. The string is then printed to the kernel log.
Questions tagged [printk]
94 questions
1
vote
0 answers
Printing array of u8 in Linux Kernel as Hex
I am trying to print the following variables in my custom Linux Kernel Module for debugging purposes:
__le16 length; // The length of the data
u8 data[128];
The data variable has a maximum length of 128 bytes but we might not use all if it. The…

IoT
- 607
- 1
- 11
- 23
1
vote
1 answer
Strange printk effect on linux stack size testing
I am trying to test linux kernel stack size in 64 bit.
I found this weird behaviour.
I wrote following code to crash the kernel but strange thing is that
it crashes only if printk is uncommented,
otherwise runs fine with no errors/warnings!!.
…

Naveen Kumar V C
- 43
- 3
1
vote
2 answers
pr_* and printk do not print
I'm using Xubuntu and I am trying to fix an issue with dell-wmi.ko and the Latitude XT. In order to be able to do this I need to be able to see debug output. That's where the problem lies.
pr_* and printk simply just do not work after boot. I can…

X91t
- 11
- 1
1
vote
0 answers
SSE register return with SSE disabled error
I have written the following command for kernel level thread:
#include
#include
#include
#include
#include
#include
#include
static…

Osho Agyeya
- 11
- 1
- 4
1
vote
1 answer
How to compile kernel modules with debug logs enabled
I have downloaded linux kernel source v4.2.0 and built it. Now I am trying to compile one driver module and see the debug logs on console.
I am am compiling the module by following command :
make -C /lib/modules/4.2.0-16-generic/build M=$PWD
also…

Sanjeev Kumar
- 55
- 1
- 9
1
vote
1 answer
Printk or I/O dangers in interrupt handler
Why is printk or (I/O) prohibited in interrupt handler in linux .? Under what condition I/O in a interrupt handler can cause deadlock in a linux system?

addy
- 33
- 5
1
vote
2 answers
What is the similar to printk in user mode?
We can use printk to send debug message in kernel driver. I have a user mode AP that call kernel driver. I would like to output user mode AP debug message with kernel mode driver at the same time. How to do that?

Jan Kuei Yang
- 11
- 2
1
vote
1 answer
How does 'printk' get the current time with high resolution?
Each time printk outputs something, a high-resolution time will automatically be showed in a square bracket at the beginning of the line. How does printk get the current time with high resolution? I also wanted to get such a high resolution time in…

xiaokaoy
- 1,608
- 3
- 15
- 27
1
vote
0 answers
Why these printk's doesn't appear in dmesg?
I have provided few debug message in .S file and expected it to be appeared in dmesg output.
Following is the snippet:
--- a/arch/arm/kvm/interrupts.S
+++ b/arch/arm/kvm/interrupts.S
@@ -98,6 +98,8 @@ ENTRY(__kvm_vcpu_run)
save_host_regs
+ …

Amit Singh Tomar
- 8,380
- 27
- 120
- 199
1
vote
1 answer
Why the printk console_loglevel can be lower than minimum_console_loglevel?
My Linux distro is RHEL7, and kernel version is 3.10.0.
Form the printk document, I know minimum_console_loglevel definition:
minimum_console_loglevel: minimum (highest) value to which
console_loglevel can be set
Querying current log level…

Nan Xiao
- 16,671
- 18
- 103
- 164
1
vote
0 answers
Linux kernel printk can skip messages?
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…

Alex Hoppus
- 3,821
- 4
- 28
- 47
1
vote
0 answers
How to change the default path where printk writes?
The printk writes in /var/log/messages. So I was wondering if I could change this path from somewhere and get printk to write in STDOUT or maybe a file. I searched but didn't find anything on the internet or man pages. Can anybody tell me if it is…

Imdad
- 683
- 1
- 9
- 27
1
vote
1 answer
Print the MAC addresses from the mac header of IEEE802.11 packet when extracted using sk_buff
I am writing a module that extracts the MAC address of the Ethernet Mac header of wireless 802.11 packet. I extract the ethernetmac header as
ieee = (struct ieee80211_hdr…

Areebah
- 43
- 8
1
vote
1 answer
printk timestamp resolution in Linux kernel
How to enable timestamp with nanoseconds resolution in linux kernel.
Currently it shows in miliseconds resolution as below.
Is there any config or macro that i need to enable???
....
[ 0.220000] omap_mux_init: Add partition: #1: core, flags: 4
[ …

Nirav Rabara
- 11
- 3
1
vote
2 answers
Record kernel Log while running an application
I have put some printk statement inside Linux kernel like this
printk(KERN_DEBUG " Hello from Kernel ");
and I am interested to record output of this command while running a.out application , like:
cp /var/log/dmesg oldLog.txt
./a.out
cp…

ARH
- 1,355
- 3
- 18
- 32