/* * test module to check whether the TSC-based delay routine continues * to work properly after cpufreq transitions. Needs ACPI to work * properly. * * Based partly on the Power Management Timer (PMTMR) code to be found * in arch/i386/kernel/timers/timer_pm.c on recent 2.6. kernels, especially * code written by John Stultz. The read_pmtmr function was copied verbatim * from that file. * * (C) 2004 Dominik Brodowski * * To use: * 1.) pass clock=tsc to the kernel on your bootloader * 2.) modprobe this module (it'll fail) * 3.) change CPU frequency * 4.) modprobe this module again * 5.) if the third value, "diff_pmtmr", changes between 2. and 4., the * TSC-based delay routine on the Linux kernel does not correctly * handle the cpufreq transition. Please report this to * linux-pm@vger.kernel.org */ #include #include #include #include #include #include static int pm_tmr_ioport = 0; /*helper function to safely read acpi pm timesource*/ static u32 read_pmtmr(void) { u32 v1=0,v2=0,v3=0; /* It has been reported that because of various broken * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time * source is not latched, so you must read it multiple * times to insure a safe value is read. */ do { v1 = inl(pm_tmr_ioport); v2 = inl(pm_tmr_ioport); v3 = inl(pm_tmr_ioport); } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2)); /* mask the output to 24 bits */ return (v2 & 0xFFFFFF); } static int __init cpufreq_test_tsc(void) { u32 now, then, diff; u64 now_tsc, then_tsc, diff_tsc; int i; /* the following code snipped is copied from arch/x86/kernel/acpi/boot.c of Linux v2.6.25. */ /* detect the location of the ACPI PM Timer */ if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) { /* FADT rev. 2 */ if (acpi_gbl_FADT.xpm_timer_block.space_id != ACPI_ADR_SPACE_SYSTEM_IO) return 0; pm_tmr_ioport = acpi_gbl_FADT.xpm_timer_block.address; /* * "X" fields are optional extensions to the original V1.0 * fields, so we must selectively expand V1.0 fields if the * corresponding X field is zero. */ if (!pm_tmr_ioport) pm_tmr_ioport = acpi_gbl_FADT.pm_timer_block; } else { /* FADT rev. 1 */ pm_tmr_ioport = acpi_gbl_FADT.pm_timer_block; } printk(KERN_DEBUG "start--> \n"); then = read_pmtmr(); then_tsc = rdtsc(); for (i=0;i<20;i++) { mdelay(100); now = read_pmtmr(); now_tsc = rdtsc(); diff = (now - then) & 0xFFFFFF; diff_tsc = now_tsc - then_tsc; printk(KERN_DEBUG "t1: %08u t2: %08u diff_pmtmr: %08u diff_tsc: %016llu\n", then, now, diff, diff_tsc); then = now; then_tsc = now_tsc; } printk(KERN_DEBUG "<-- end \n"); return -ENODEV; } static void __exit cpufreq_none(void) { return; } module_init(cpufreq_test_tsc) module_exit(cpufreq_none) MODULE_AUTHOR("Dominik Brodowski"); MODULE_DESCRIPTION("Verify the TSC cpufreq notifier working correctly -- needs ACPI-enabled system"); MODULE_LICENSE ("GPL"); commit/include?h=nds-private-remove&id=62906027091f1d02de44041524f0769f60bb9cf3'>include/trace/events/nmi.h
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2016-12-25 13:00:30 +1000
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 11:54:48 -0800
commit62906027091f1d02de44041524f0769f60bb9cf3 (patch)
tree6444171af03e463bb0123a392d7b91a0ae6a1f40 /include/trace/events/nmi.h
parent6326fec1122cde256bd2a8c63f2606e08e44ce1d (diff)
mm: add PageWaiters indicating tasks are waiting for a page bit
Add a new page flag, PageWaiters, to indicate the page waitqueue has tasks waiting. This can be tested rather than testing waitqueue_active which requires another cacheline load. This bit is always set when the page has tasks on page_waitqueue(page), and is set and cleared under the waitqueue lock. It may be set when there are no tasks on the waitqueue, which will cause a harmless extra wakeup check that will clears the bit. The generic bit-waitqueue infrastructure is no longer used for pages. Instead, waitqueues are used directly with a custom key type. The generic code was not flexible enough to have PageWaiters manipulation under the waitqueue lock (which simplifies concurrency). This improves the performance of page lock intensive microbenchmarks by 2-3%. Putting two bits in the same word opens the opportunity to remove the memory barrier between clearing the lock bit and testing the waiters bit, after some work on the arch primitives (e.g., ensuring memory operand widths match and cover both bits). Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Bob Peterson <rpeterso@redhat.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Andrew Lutomirski <luto@kernel.org> Cc: Andreas Gruenbacher <agruenba@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/trace/events/nmi.h')