x86: Expose loops_per_jiffy through /proc/cpuinfo.
PATCH 1/1 x86: Expose loops_per_jiffy through /proc/cpuinfo.
From: "Richard W.M. Jones" <[email protected]>
When we run the current kernel using qemu with TCG (software emulation of x86), adding the lpj= option to the guest kernel helps greatly with clock stability especially when the host is heavily loaded.
Currently the calculated 'lpj=...' argument is printed by the kernel during boot, but isn't available after boot (eg. if boot messages have scrolled off the kernel message ring). It is also not possible to calculate lpj from available information, especially as non-root.
This adds lpj to /proc/cpuinfo information so it is always available.
--- arch/x86/kernel/cpu/proc.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/proc.c +1 -0
@@ -103,6 +103,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"\nbogomips\t: %lu.%02lu\n" , c->loops_per_jiffy/(500000 /HZ ), (c->loops_per_jiffy/(5000 /HZ )) %100 ); +seq_printf (m,"lpj\t\t: %lu\n" , c->loops_per_jiffy);#ifdef CONFIG_X86_64 if (c->x86_tlbsize >0 )
Signature · 1 line
1.8.1.2
Ignore this patch, it's obviously wrong. Too late in the afternoon ...
Rich.
Signature · 4 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Quoted 1 line · Richard W.M. Jones
Ignore this patch, it's obviously wrong. Too late in the afternoon ...
Actually, NOT wrong. You can't get HZ from userspace, so exporting loops_per_jiffy like this is necessary.
Rich.
Signature · 3 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org