]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
Merge branch 'x86-rdrand-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Jan 2012 23:02:00 +0000 (15:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Jan 2012 23:02:00 +0000 (15:02 -0800)
* 'x86-rdrand-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  random: Use arch_get_random_int instead of cycle counter if avail

468 files changed:
Documentation/DocBook/debugobjects.tmpl
Documentation/RCU/checklist.txt
Documentation/RCU/rcu.txt
Documentation/RCU/stallwarn.txt
Documentation/RCU/torture.txt
Documentation/RCU/trace.txt
Documentation/RCU/whatisRCU.txt
Documentation/atomic_ops.txt
Documentation/kernel-parameters.txt
Documentation/lockdep-design.txt
Documentation/trace/events.txt
Documentation/virtual/kvm/api.txt
MAINTAINERS
Makefile
arch/Kconfig
arch/arm/Kconfig
arch/arm/common/pl330.c
arch/arm/configs/imx_v4_v5_defconfig
arch/arm/kernel/process.c
arch/arm/kernel/setup.c
arch/arm/mach-exynos/cpu.c
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/clock-imx35.c
arch/arm/mach-imx/mach-cpuimx35.c
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
arch/arm/mm/init.c
arch/arm/mm/proc-v7.S
arch/arm/oprofile/common.c
arch/arm/plat-mxc/cpufreq.c
arch/arm/plat-mxc/include/mach/uncompress.h
arch/arm/plat-mxc/pwm.c
arch/arm/plat-orion/gpio.c
arch/arm/plat-samsung/include/plat/cpu-freq-core.h
arch/avr32/kernel/process.c
arch/blackfin/kernel/process.c
arch/cris/arch-v32/kernel/time.c
arch/ia64/Kconfig
arch/ia64/include/asm/cputime.h
arch/ia64/mm/contig.c
arch/ia64/mm/init.c
arch/m68k/platform/68328/timers.c
arch/m68k/platform/coldfire/dma_timer.c
arch/m68k/platform/coldfire/pit.c
arch/m68k/platform/coldfire/sltimers.c
arch/m68k/platform/coldfire/timers.c
arch/microblaze/include/asm/memblock.h [deleted file]
arch/microblaze/kernel/process.c
arch/microblaze/kernel/prom.c
arch/mips/Kconfig
arch/mips/kernel/process.c
arch/mips/kernel/setup.c
arch/mips/sgi-ip27/ip27-memory.c
arch/openrisc/include/asm/memblock.h [deleted file]
arch/openrisc/kernel/idle.c
arch/openrisc/kernel/prom.c
arch/parisc/kernel/time.c
arch/powerpc/Kconfig
arch/powerpc/include/asm/cputime.h
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/include/asm/kvm_book3s_64.h
arch/powerpc/include/asm/memblock.h [deleted file]
arch/powerpc/kernel/idle.c
arch/powerpc/kernel/machine_kexec.c
arch/powerpc/kernel/prom.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_pr.c
arch/powerpc/kvm/e500.c
arch/powerpc/mm/init_32.c
arch/powerpc/mm/mem.c
arch/powerpc/mm/numa.c
arch/powerpc/mm/tlb_nohash.c
arch/powerpc/platforms/embedded6xx/wii.c
arch/powerpc/platforms/iseries/setup.c
arch/powerpc/platforms/ps3/mm.c
arch/powerpc/platforms/pseries/lpar.c
arch/s390/Kconfig
arch/s390/appldata/appldata_os.c
arch/s390/include/asm/cputime.h
arch/s390/kernel/process.c
arch/s390/kernel/setup.c
arch/s390/oprofile/hwsampler.c
arch/s390/oprofile/init.c
arch/s390/oprofile/op_counter.h [new file with mode: 0644]
arch/score/Kconfig
arch/score/kernel/setup.c
arch/sh/Kconfig
arch/sh/include/asm/memblock.h [deleted file]
arch/sh/kernel/idle.c
arch/sh/kernel/machine_kexec.c
arch/sh/kernel/setup.c
arch/sh/mm/Kconfig
arch/sh/mm/init.c
arch/sh/oprofile/common.c
arch/sparc/Kconfig
arch/sparc/include/asm/memblock.h [deleted file]
arch/sparc/kernel/process_64.c
arch/sparc/kernel/setup_32.c
arch/sparc/mm/init_64.c
arch/tile/kernel/process.c
arch/tile/mm/fault.c
arch/um/kernel/process.c
arch/um/kernel/time.c
arch/unicore32/kernel/process.c
arch/unicore32/kernel/setup.c
arch/unicore32/mm/init.c
arch/unicore32/mm/mmu.c
arch/x86/Kconfig
arch/x86/ia32/ia32entry.S
arch/x86/include/asm/alternative-asm.h
arch/x86/include/asm/apic.h
arch/x86/include/asm/apic_flat_64.h [new file with mode: 0644]
arch/x86/include/asm/apicdef.h
arch/x86/include/asm/bitops.h
arch/x86/include/asm/cmpxchg.h
arch/x86/include/asm/cmpxchg_32.h
arch/x86/include/asm/cmpxchg_64.h
arch/x86/include/asm/div64.h
arch/x86/include/asm/e820.h
arch/x86/include/asm/hardirq.h
arch/x86/include/asm/i387.h
arch/x86/include/asm/insn.h
arch/x86/include/asm/mach_timer.h
arch/x86/include/asm/mc146818rtc.h
arch/x86/include/asm/memblock.h [deleted file]
arch/x86/include/asm/numachip/numachip_csr.h [new file with mode: 0644]
arch/x86/include/asm/percpu.h
arch/x86/include/asm/perf_event.h
arch/x86/include/asm/pgtable.h
arch/x86/include/asm/processor-flags.h
arch/x86/include/asm/processor.h
arch/x86/include/asm/spinlock.h
arch/x86/include/asm/thread_info.h
arch/x86/include/asm/topology.h
arch/x86/include/asm/tsc.h
arch/x86/include/asm/uaccess.h
arch/x86/include/asm/x86_init.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/amd_nb.c
arch/x86/kernel/aperture_64.c
arch/x86/kernel/apic/Makefile
arch/x86/kernel/apic/apic.c
arch/x86/kernel/apic/apic_flat_64.c
arch/x86/kernel/apic/apic_numachip.c [new file with mode: 0644]
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/check.c
arch/x86/kernel/cpu/amd.c
arch/x86/kernel/cpu/centaur.c
arch/x86/kernel/cpu/common.c
arch/x86/kernel/cpu/cpu.h
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/kernel/cpu/mcheck/mce_amd.c
arch/x86/kernel/cpu/mcheck/therm_throt.c
arch/x86/kernel/cpu/mcheck/threshold.c
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/cpu/perf_event.h
arch/x86/kernel/cpu/perf_event_amd.c
arch/x86/kernel/cpu/perf_event_intel.c
arch/x86/kernel/cpu/powerflags.c
arch/x86/kernel/cpu/proc.c
arch/x86/kernel/e820.c
arch/x86/kernel/entry_32.S
arch/x86/kernel/entry_64.S
arch/x86/kernel/head.c
arch/x86/kernel/head32.c
arch/x86/kernel/head64.c
arch/x86/kernel/hpet.c
arch/x86/kernel/irq.c
arch/x86/kernel/jump_label.c
arch/x86/kernel/mpparse.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/setup.c
arch/x86/kernel/smpboot.c
arch/x86/kernel/trampoline.c
arch/x86/kernel/traps.c
arch/x86/kernel/tsc.c
arch/x86/kernel/tsc_sync.c
arch/x86/kernel/vsyscall_64.c
arch/x86/kernel/x86_init.c
arch/x86/kvm/i8254.c
arch/x86/kvm/x86.c
arch/x86/lib/inat.c
arch/x86/lib/insn.c
arch/x86/lib/string_32.c
arch/x86/lib/x86-opcode-map.txt
arch/x86/mm/Makefile
arch/x86/mm/extable.c
arch/x86/mm/fault.c
arch/x86/mm/init.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
arch/x86/mm/memblock.c [deleted file]
arch/x86/mm/memtest.c
arch/x86/mm/numa.c
arch/x86/mm/numa_32.c
arch/x86/mm/numa_64.c
arch/x86/mm/numa_emulation.c
arch/x86/mm/pageattr.c
arch/x86/mm/srat.c
arch/x86/oprofile/Makefile
arch/x86/oprofile/init.c
arch/x86/oprofile/nmi_int.c
arch/x86/oprofile/nmi_timer_int.c [deleted file]
arch/x86/platform/efi/efi.c
arch/x86/tools/Makefile
arch/x86/tools/gen-insn-attr-x86.awk
arch/x86/tools/insn_sanity.c [new file with mode: 0644]
arch/x86/xen/enlighten.c
arch/x86/xen/mmu.c
arch/x86/xen/setup.c
arch/xtensa/kernel/time.c
block/blk-map.c
block/blk-tag.c
block/cfq-iosched.c
block/ioctl.c
drivers/base/cpu.c
drivers/clocksource/acpi_pm.c
drivers/clocksource/i8253.c
drivers/clocksource/tcb_clksrc.c
drivers/cpufreq/cpufreq_conservative.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/cpufreq/cpufreq_stats.c
drivers/dma/Kconfig
drivers/edac/sb_edac.c
drivers/gpu/drm/i915/i915_gem_execbuffer.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/radeon/evergreen.c
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
drivers/hwmon/coretemp.c
drivers/input/mouse/sentelic.c
drivers/input/mouse/sentelic.h
drivers/iommu/intel-iommu.c
drivers/iommu/iommu.c
drivers/lguest/x86/core.c
drivers/macintosh/rack-meter.c
drivers/media/video/gspca/gspca.c
drivers/mmc/host/mmci.c
drivers/net/ethernet/freescale/Kconfig
drivers/net/ethernet/marvell/skge.c
drivers/net/ethernet/mellanox/mlx4/en_cq.c
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/b43/pio.c
drivers/net/wireless/mwifiex/sta_ioctl.c
drivers/of/platform.c
drivers/oprofile/nmi_timer_int.c [new file with mode: 0644]
drivers/oprofile/oprof.c
drivers/oprofile/oprof.h
drivers/oprofile/timer_int.c
drivers/pci/Kconfig
drivers/pci/ioapic.c
drivers/rtc/interface.c
drivers/watchdog/coh901327_wdt.c
drivers/watchdog/hpwdt.c
drivers/watchdog/iTCO_wdt.c
drivers/watchdog/sp805_wdt.c
fs/ceph/dir.c
fs/cifs/connect.c
fs/compat_ioctl.c
fs/ioctl.c
fs/locks.c
fs/minix/inode.c
fs/proc/array.c
fs/proc/stat.c
fs/proc/uptime.c
fs/xfs/xfs_super.c
fs/xfs/xfs_sync.c
fs/xfs/xfs_sync.h
include/asm-generic/cputime.h
include/linux/bitops.h
include/linux/bootmem.h
include/linux/cpu.h
include/linux/debugobjects.h
include/linux/hardirq.h
include/linux/jump_label.h
include/linux/kernel_stat.h
include/linux/kvm.h
include/linux/latencytop.h
include/linux/lockdep.h
include/linux/memblock.h
include/linux/mm.h
include/linux/mmzone.h
include/linux/perf_event.h
include/linux/poison.h
include/linux/rcupdate.h
include/linux/sched.h
include/linux/security.h
include/linux/srcu.h
include/linux/tick.h
include/linux/wait.h
include/net/ip_vs.h
include/trace/events/rcu.h
include/trace/events/sched.h
init/Kconfig
init/main.c
kernel/Makefile
kernel/acct.c
kernel/cpu.c
kernel/debug/kdb/kdb_support.c
kernel/events/Makefile
kernel/events/callchain.c [new file with mode: 0644]
kernel/events/core.c
kernel/events/internal.h
kernel/exit.c
kernel/fork.c
kernel/futex.c
kernel/hung_task.c
kernel/itimer.c
kernel/jump_label.c
kernel/lockdep.c
kernel/panic.c
kernel/posix-cpu-timers.c
kernel/printk.c
kernel/ptrace.c
kernel/rcu.h
kernel/rcupdate.c
kernel/rcutiny.c
kernel/rcutiny_plugin.h
kernel/rcutorture.c
kernel/rcutree.c
kernel/rcutree.h
kernel/rcutree_plugin.h
kernel/rcutree_trace.c
kernel/rtmutex-debug.c
kernel/rtmutex.c
kernel/sched.c [deleted file]
kernel/sched/Makefile [new file with mode: 0644]
kernel/sched/auto_group.c [new file with mode: 0644]
kernel/sched/auto_group.h [new file with mode: 0644]
kernel/sched/clock.c [new file with mode: 0644]
kernel/sched/core.c [new file with mode: 0644]
kernel/sched/cpupri.c [new file with mode: 0644]
kernel/sched/cpupri.h [new file with mode: 0644]
kernel/sched/debug.c [new file with mode: 0644]
kernel/sched/fair.c [new file with mode: 0644]
kernel/sched/features.h [new file with mode: 0644]
kernel/sched/idle_task.c [new file with mode: 0644]
kernel/sched/rt.c [new file with mode: 0644]
kernel/sched/sched.h [new file with mode: 0644]
kernel/sched/stats.c [new file with mode: 0644]
kernel/sched/stats.h [new file with mode: 0644]
kernel/sched/stop_task.c [new file with mode: 0644]
kernel/sched_autogroup.c [deleted file]
kernel/sched_autogroup.h [deleted file]
kernel/sched_clock.c [deleted file]
kernel/sched_cpupri.c [deleted file]
kernel/sched_cpupri.h [deleted file]
kernel/sched_debug.c [deleted file]
kernel/sched_fair.c [deleted file]
kernel/sched_features.h [deleted file]
kernel/sched_idletask.c [deleted file]
kernel/sched_rt.c [deleted file]
kernel/sched_stats.h [deleted file]
kernel/sched_stoptask.c [deleted file]
kernel/signal.c
kernel/softirq.c
kernel/sys.c
kernel/time/clockevents.c
kernel/time/tick-sched.c
kernel/time/timekeeping.c
kernel/timer.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events_filter.c
kernel/trace/trace_irqsoff.c
kernel/trace/trace_output.c
kernel/trace/trace_sched_wakeup.c
kernel/tsacct.c
kernel/wait.c
lib/debugobjects.c
mm/Kconfig
mm/hugetlb.c
mm/memblock.c
mm/mempolicy.c
mm/nobootmem.c
mm/page_alloc.c
mm/slub.c
net/bluetooth/hci_core.c
net/netfilter/ipvs/ip_vs_conn.c
net/netfilter/ipvs/ip_vs_ctl.c
net/netfilter/ipvs/ip_vs_sync.c
net/netfilter/nf_conntrack_netlink.c
net/packet/af_packet.c
net/sched/sch_netem.c
net/sched/sch_qfq.c
net/socket.c
security/security.c
sound/soc/codecs/wm8776.c
tools/perf/Documentation/perf-annotate.txt
tools/perf/Documentation/perf-buildid-list.txt
tools/perf/Documentation/perf-evlist.txt
tools/perf/Documentation/perf-kmem.txt
tools/perf/Documentation/perf-lock.txt
tools/perf/Documentation/perf-record.txt
tools/perf/Documentation/perf-report.txt
tools/perf/Documentation/perf-sched.txt
tools/perf/Documentation/perf-script.txt
tools/perf/Documentation/perf-test.txt
tools/perf/Documentation/perf-timechart.txt
tools/perf/Makefile
tools/perf/builtin-annotate.c
tools/perf/builtin-buildid-list.c
tools/perf/builtin-diff.c
tools/perf/builtin-evlist.c
tools/perf/builtin-inject.c
tools/perf/builtin-kmem.c
tools/perf/builtin-kvm.c
tools/perf/builtin-lock.c
tools/perf/builtin-probe.c
tools/perf/builtin-record.c
tools/perf/builtin-report.c
tools/perf/builtin-sched.c
tools/perf/builtin-script.c
tools/perf/builtin-stat.c
tools/perf/builtin-test.c
tools/perf/builtin-timechart.c
tools/perf/builtin-top.c
tools/perf/perf.c
tools/perf/perf.h
tools/perf/util/annotate.c
tools/perf/util/annotate.h
tools/perf/util/build-id.c
tools/perf/util/build-id.h
tools/perf/util/callchain.h
tools/perf/util/cgroup.c
tools/perf/util/config.c
tools/perf/util/debugfs.c
tools/perf/util/debugfs.h
tools/perf/util/event.c
tools/perf/util/event.h
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/evsel.c
tools/perf/util/evsel.h
tools/perf/util/header.c
tools/perf/util/header.h
tools/perf/util/hist.h
tools/perf/util/include/linux/bitops.h
tools/perf/util/map.c
tools/perf/util/map.h
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h
tools/perf/util/probe-finder.h
tools/perf/util/scripting-engines/trace-event-perl.c
tools/perf/util/scripting-engines/trace-event-python.c
tools/perf/util/session.c
tools/perf/util/session.h
tools/perf/util/setup.py
tools/perf/util/symbol.c
tools/perf/util/symbol.h
tools/perf/util/thread.c
tools/perf/util/thread.h
tools/perf/util/tool.h [new file with mode: 0644]
tools/perf/util/top.h
tools/perf/util/trace-event-info.c
tools/perf/util/trace-event-scripting.c
tools/perf/util/trace-event.h
tools/perf/util/ui/browsers/annotate.c
tools/perf/util/ui/browsers/hists.c
tools/perf/util/ui/progress.c
tools/perf/util/usage.c
tools/perf/util/util.h
tools/perf/util/values.c
virt/kvm/assigned-dev.c

index 08ff908aa7a239732fce68cc1b06e507626f216a..24979f691e3e88dd1ab82b3b00633e683445093f 100644 (file)
@@ -96,6 +96,7 @@
        <listitem><para>debug_object_deactivate</para></listitem>
        <listitem><para>debug_object_destroy</para></listitem>
        <listitem><para>debug_object_free</para></listitem>
+       <listitem><para>debug_object_assert_init</para></listitem>
       </itemizedlist>
       Each of these functions takes the address of the real object and
       a pointer to the object type specific debug description
        debug checks.
       </para>
     </sect1>
+
+    <sect1 id="debug_object_assert_init">
+      <title>debug_object_assert_init</title>
+      <para>
+       This function is called to assert that an object has been
+       initialized.
+      </para>
+      <para>
+       When the real object is not tracked by debugobjects, it calls
+       fixup_assert_init of the object type description structure
+       provided by the caller, with the hardcoded object state
+       ODEBUG_NOT_AVAILABLE. The fixup function can correct the problem
+       by calling debug_object_init and other specific initializing
+       functions.
+      </para>
+      <para>
+       When the real object is already tracked by debugobjects it is
+       ignored.
+      </para>
+    </sect1>
   </chapter>
   <chapter id="fixupfunctions">
     <title>Fixup functions</title>
        statistics.
       </para>
     </sect1>
+    <sect1 id="fixup_assert_init">
+      <title>fixup_assert_init</title>
+      <para>
+       This function is called from the debug code whenever a problem
+       in debug_object_assert_init is detected.
+      </para>
+      <para>
+       Called from debug_object_assert_init() with a hardcoded state
+       ODEBUG_STATE_NOTAVAILABLE when the object is not found in the
+       debug bucket.
+      </para>
+      <para>
+       The function returns 1 when the fixup was successful,
+       otherwise 0. The return value is used to update the
+       statistics.
+      </para>
+      <para>
+       Note, this function should make sure debug_object_init() is
+       called before returning.
+      </para>
+      <para>
+       The handling of statically initialized objects is a special
+       case. The fixup function should check if this is a legitimate
+       case of a statically initialized object or not. In this case only
+       debug_object_init() should be called to make the object known to
+       the tracker. Then the function should return 0 because this is not
+       a real fixup.
+      </para>
+    </sect1>
   </chapter>
   <chapter id="bugs">
     <title>Known Bugs And Assumptions</title>
index 0c134f8afc6f60b1316b9551577179f1b6dc3961..bff2d8be1e18ca0593274e2596d58181095b71cc 100644 (file)
@@ -328,6 +328,12 @@ over a rather long period of time, but improvements are always welcome!
        RCU rather than SRCU, because RCU is almost always faster and
        easier to use than is SRCU.
 
+       If you need to enter your read-side critical section in a
+       hardirq or exception handler, and then exit that same read-side
+       critical section in the task that was interrupted, then you need
+       to srcu_read_lock_raw() and srcu_read_unlock_raw(), which avoid
+       the lockdep checking that would otherwise this practice illegal.
+
        Also unlike other forms of RCU, explicit initialization
        and cleanup is required via init_srcu_struct() and
        cleanup_srcu_struct().  These are passed a "struct srcu_struct"
index 31852705b5863063f453fbb500dd6e6dfa456498..bf778332a28f8e8332bcdde2a32772c555e83498 100644 (file)
@@ -38,11 +38,11 @@ o   How can the updater tell when a grace period has completed
 
        Preemptible variants of RCU (CONFIG_TREE_PREEMPT_RCU) get the
        same effect, but require that the readers manipulate CPU-local
-       counters.  These counters allow limited types of blocking
-       within RCU read-side critical sections.  SRCU also uses
-       CPU-local counters, and permits general blocking within
-       RCU read-side critical sections.  These two variants of
-       RCU detect grace periods by sampling these counters.
+       counters.  These counters allow limited types of blocking within
+       RCU read-side critical sections.  SRCU also uses CPU-local
+       counters, and permits general blocking within RCU read-side
+       critical sections.  These variants of RCU detect grace periods
+       by sampling these counters.
 
 o      If I am running on a uniprocessor kernel, which can only do one
        thing at a time, why should I wait for a grace period?
index 4e959208f7363c7a2fb1e5e3e190fac2c0c90887..083d88cbc0899ffde94946fff16cc044f94c22a9 100644 (file)
@@ -101,6 +101,11 @@ o  A CPU-bound real-time task in a CONFIG_PREEMPT_RT kernel that
        CONFIG_TREE_PREEMPT_RCU case, you might see stall-warning
        messages.
 
+o      A hardware or software issue shuts off the scheduler-clock
+       interrupt on a CPU that is not in dyntick-idle mode.  This
+       problem really has happened, and seems to be most likely to
+       result in RCU CPU stall warnings for CONFIG_NO_HZ=n kernels.
+
 o      A bug in the RCU implementation.
 
 o      A hardware failure.  This is quite unlikely, but has occurred
@@ -109,12 +114,11 @@ o A hardware failure.  This is quite unlikely, but has occurred
        This resulted in a series of RCU CPU stall warnings, eventually
        leading the realization that the CPU had failed.
 
-The RCU, RCU-sched, and RCU-bh implementations have CPU stall
-warning.  SRCU does not have its own CPU stall warnings, but its
-calls to synchronize_sched() will result in RCU-sched detecting
-RCU-sched-related CPU stalls.  Please note that RCU only detects
-CPU stalls when there is a grace period in progress.  No grace period,
-no CPU stall warnings.
+The RCU, RCU-sched, and RCU-bh implementations have CPU stall warning.
+SRCU does not have its own CPU stall warnings, but its calls to
+synchronize_sched() will result in RCU-sched detecting RCU-sched-related
+CPU stalls.  Please note that RCU only detects CPU stalls when there is
+a grace period in progress.  No grace period, no CPU stall warnings.
 
 To diagnose the cause of the stall, inspect the stack traces.
 The offending function will usually be near the top of the stack.
index 783d6c134d3f007c220ca6a24203b1a16ea136c2..d67068d0d2b9818cf3d5344c42452a2d395e9ff0 100644 (file)
@@ -61,11 +61,24 @@ nreaders    This is the number of RCU reading threads supported.
                To properly exercise RCU implementations with preemptible
                read-side critical sections.
 
+onoff_interval
+               The number of seconds between each attempt to execute a
+               randomly selected CPU-hotplug operation.  Defaults to
+               zero, which disables CPU hotplugging.  In HOTPLUG_CPU=n
+               kernels, rcutorture will silently refuse to do any
+               CPU-hotplug operations regardless of what value is
+               specified for onoff_interval.
+
 shuffle_interval
                The number of seconds to keep the test threads affinitied
                to a particular subset of the CPUs, defaults to 3 seconds.
                Used in conjunction with test_no_idle_hz.
 
+shutdown_secs  The number of seconds to run the test before terminating
+               the test and powering off the system.  The default is
+               zero, which disables test termination and system shutdown.
+               This capability is useful for automated testing.
+
 stat_interval  The number of seconds between output of torture
                statistics (via printk()).  Regardless of the interval,
                statistics are printed when the module is unloaded.
index aaf65f6c6cd7845e7cf671366671b713bcd8fe16..49587abfc2f77cd3e9872efcf34bee4b9ac6e22f 100644 (file)
@@ -105,14 +105,10 @@ o "dt" is the current value of the dyntick counter that is incremented
        or one greater than the interrupt-nesting depth otherwise.
        The number after the second "/" is the NMI nesting depth.
 
-       This field is displayed only for CONFIG_NO_HZ kernels.
-
 o      "df" is the number of times that some other CPU has forced a
        quiescent state on behalf of this CPU due to this CPU being in
        dynticks-idle state.
 
-       This field is displayed only for CONFIG_NO_HZ kernels.
-
 o      "of" is the number of times that some other CPU has forced a
        quiescent state on behalf of this CPU due to this CPU being
        offline.  In a perfect world, this might never happen, but it
index 6ef692667e2f67aac0dbf87b232c16153180739e..6bbe8dcdc3da94166160f3d27a96a6f2a622287f 100644 (file)
@@ -4,6 +4,7 @@ to start learning about RCU:
 1.     What is RCU, Fundamentally?  http://lwn.net/Articles/262464/
 2.     What is RCU? Part 2: Usage   http://lwn.net/Articles/263130/
 3.     RCU part 3: the RCU API      http://lwn.net/Articles/264090/
+4.     The RCU API, 2010 Edition    http://lwn.net/Articles/418853/
 
 
 What is RCU?
@@ -834,6 +835,8 @@ SRCU:       Critical sections       Grace period            Barrier
 
        srcu_read_lock          synchronize_srcu        N/A
        srcu_read_unlock        synchronize_srcu_expedited
+       srcu_read_lock_raw
+       srcu_read_unlock_raw
        srcu_dereference
 
 SRCU:  Initialization/cleanup
@@ -855,27 +858,33 @@ list can be helpful:
 
 a.     Will readers need to block?  If so, you need SRCU.
 
-b.     What about the -rt patchset?  If readers would need to block
+b.     Is it necessary to start a read-side critical section in a
+       hardirq handler or exception handler, and then to complete
+       this read-side critical section in the task that was
+       interrupted?  If so, you need SRCU's srcu_read_lock_raw() and
+       srcu_read_unlock_raw() primitives.
+
+c.     What about the -rt patchset?  If readers would need to block
        in an non-rt kernel, you need SRCU.  If readers would block
        in a -rt kernel, but not in a non-rt kernel, SRCU is not
        necessary.
 
-c.     Do you need to treat NMI handlers, hardirq handlers,
+d.     Do you need to treat NMI handlers, hardirq handlers,
        and code segments with preemption disabled (whether
        via preempt_disable(), local_irq_save(), local_bh_disable(),
        or some other mechanism) as if they were explicit RCU readers?
        If so, you need RCU-sched.
 
-d.     Do you need RCU grace periods to complete even in the face
+e.     Do you need RCU grace periods to complete even in the face
        of softirq monopolization of one or more of the CPUs?  For
        example, is your code subject to network-based denial-of-service
        attacks?  If so, you need RCU-bh.
 
-e.     Is your workload too update-intensive for normal use of
+f.     Is your workload too update-intensive for normal use of
        RCU, but inappropriate for other synchronization mechanisms?
        If so, consider SLAB_DESTROY_BY_RCU.  But please be careful!
 
-f.     Otherwise, use RCU.
+g.     Otherwise, use RCU.
 
 Of course, this all assumes that you have determined that RCU is in fact
 the right tool for your job.
index 3bd585b449270afe15e8a439cef612a0a696ddef..27f2b21a9d5cd5e040da0ab0e9cb9abbb69296a6 100644 (file)
@@ -84,6 +84,93 @@ compiler optimizes the section accessing atomic_t variables.
 
 *** YOU HAVE BEEN WARNED! ***
 
+Properly aligned pointers, longs, ints, and chars (and unsigned
+equivalents) may be atomically loaded from and stored to in the same
+sense as described for atomic_read() and atomic_set().  The ACCESS_ONCE()
+macro should be used to prevent the compiler from using optimizations
+that might otherwise optimize accesses out of existence on the one hand,
+or that might create unsolicited accesses on the other.
+
+For example consider the following code:
+
+       while (a > 0)
+               do_something();
+
+If the compiler can prove that do_something() does not store to the
+variable a, then the compiler is within its rights transforming this to
+the following:
+
+       tmp = a;
+       if (a > 0)
+               for (;;)
+                       do_something();
+
+If you don't want the compiler to do this (and you probably don't), then
+you should use something like the following:
+
+       while (ACCESS_ONCE(a) < 0)
+               do_something();
+
+Alternatively, you could place a barrier() call in the loop.
+
+For another example, consider the following code:
+
+       tmp_a = a;
+       do_something_with(tmp_a);
+       do_something_else_with(tmp_a);
+
+If the compiler can prove that do_something_with() does not store to the
+variable a, then the compiler is within its rights to manufacture an
+additional load as follows:
+
+       tmp_a = a;
+       do_something_with(tmp_a);
+       tmp_a = a;
+       do_something_else_with(tmp_a);
+
+This could fatally confuse your code if it expected the same value
+to be passed to do_something_with() and do_something_else_with().
+
+The compiler would be likely to manufacture this additional load if
+do_something_with() was an inline function that made very heavy use
+of registers: reloading from variable a could save a flush to the
+stack and later reload.  To prevent the compiler from attacking your
+code in this manner, write the following:
+
+       tmp_a = ACCESS_ONCE(a);
+       do_something_with(tmp_a);
+       do_something_else_with(tmp_a);
+
+For a final example, consider the following code, assuming that the
+variable a is set at boot time before the second CPU is brought online
+and never changed later, so that memory barriers are not needed:
+
+       if (a)
+               b = 9;
+       else
+               b = 42;
+
+The compiler is within its rights to manufacture an additional store
+by transforming the above code into the following:
+
+       b = 42;
+       if (a)
+               b = 9;
+
+This could come as a fatal surprise to other code running concurrently
+that expected b to never have the value 42 if a was zero.  To prevent
+the compiler from doing this, write something like:
+
+       if (a)
+               ACCESS_ONCE(b) = 9;
+       else
+               ACCESS_ONCE(b) = 42;
+
+Don't even -think- about doing this without proper use of memory barriers,
+locks, or atomic operations if variable a can change at runtime!
+
+*** WARNING: ACCESS_ONCE() DOES NOT IMPLY A BARRIER! ***
+
 Now, we move onto the atomic operation interfaces typically implemented with
 the help of assembly code.
 
index 81c287fad79d6370d0d697d5ddf33b8af756a036..e229769606f2f4c59debdea548891f482da64633 100644 (file)
@@ -1885,6 +1885,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        arch_perfmon: [X86] Force use of architectural
                                perfmon on Intel CPUs instead of the
                                CPU specific event set.
+                       timer: [X86] Force use of architectural NMI
+                               timer mode (see also oprofile.timer
+                               for generic hr timer mode)
+                               [s390] Force legacy basic mode sampling
+                                (report cpu_type "timer")
 
        oops=panic      Always panic on oopses. Default is to just kill the
                        process, but there is a small probability of
@@ -2750,11 +2755,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
                        functions are at fixed addresses, they make nice
                        targets for exploits that can control RIP.
 
-                       emulate     Vsyscalls turn into traps and are emulated
-                                   reasonably safely.
+                       emulate     [default] Vsyscalls turn into traps and are
+                                   emulated reasonably safely.
 
-                       native      [default] Vsyscalls are native syscall
-                                   instructions.
+                       native      Vsyscalls are native syscall instructions.
                                    This is a little bit faster than trapping
                                    and makes a few dynamic recompilers work
                                    better than they would in emulation mode.
index abf768c681e208c3fe5c4d7c5fc27f788c6c29c7..5dbc99c04f6e3d5469c7fa39f228a86900de89ab 100644 (file)
@@ -221,3 +221,66 @@ when the chain is validated for the first time, is then put into a hash
 table, which hash-table can be checked in a lockfree manner. If the
 locking chain occurs again later on, the hash table tells us that we
 dont have to validate the chain again.
+
+Troubleshooting:
+----------------
+
+The validator tracks a maximum of MAX_LOCKDEP_KEYS number of lock classes.
+Exceeding this number will trigger the following lockdep warning:
+
+       (DEBUG_LOCKS_WARN_ON(id >= MAX_LOCKDEP_KEYS))
+
+By default, MAX_LOCKDEP_KEYS is currently set to 8191, and typical
+desktop systems have less than 1,000 lock classes, so this warning
+normally results from lock-class leakage or failure to properly
+initialize locks.  These two problems are illustrated below:
+
+1.     Repeated module loading and unloading while running the validator
+       will result in lock-class leakage.  The issue here is that each
+       load of the module will create a new set of lock classes for
+       that module's locks, but module unloading does not remove old
+       classes (see below discussion of reuse of lock classes for why).
+       Therefore, if that module is loaded and unloaded repeatedly,
+       the number of lock classes will eventually reach the maximum.
+
+2.     Using structures such as arrays that have large numbers of
+       locks that are not explicitly initialized.  For example,
+       a hash table with 8192 buckets where each bucket has its own
+       spinlock_t will consume 8192 lock classes -unless- each spinlock
+       is explicitly initialized at runtime, for example, using the
+       run-time spin_lock_init() as opposed to compile-time initializers
+       such as __SPIN_LOCK_UNLOCKED().  Failure to properly initialize
+       the per-bucket spinlocks would guarantee lock-class overflow.
+       In contrast, a loop that called spin_lock_init() on each lock
+       would place all 8192 locks into a single lock class.
+
+       The moral of this story is that you should always explicitly
+       initialize your locks.
+
+One might argue that the validator should be modified to allow
+lock classes to be reused.  However, if you are tempted to make this
+argument, first review the code and think through the changes that would
+be required, keeping in mind that the lock classes to be removed are
+likely to be linked into the lock-dependency graph.  This turns out to
+be harder to do than to say.
+
+Of course, if you do run out of lock classes, the next thing to do is
+to find the offending lock classes.  First, the following command gives
+you the number of lock classes currently in use along with the maximum:
+
+       grep "lock-classes" /proc/lockdep_stats
+
+This command produces the following output on a modest system:
+
+        lock-classes:                          748 [max: 8191]
+
+If the number allocated (748 above) increases continually over time,
+then there is likely a leak.  The following command can be used to
+identify the leaking lock classes:
+
+       grep "BD" /proc/lockdep
+
+Run the command and save the output, then compare against the output from
+a later run of this command to identify the leakers.  This same output
+can also help you find situations where runtime lock initialization has
+been omitted.
index b510564aac7ebcc22ab036c7662392d0006000d7..bb24c2a0e870dc873ef8e8250f77d44d76a017b9 100644 (file)
@@ -191,8 +191,6 @@ And for string fields they are:
 
 Currently, only exact string matches are supported.
 
-Currently, the maximum number of predicates in a filter is 16.
-
 5.2 Setting filters
 -------------------
 
index 7945b0bd35e2ad50d7561ffa88a428c21175b50b..e2a4b5287361d25c0800954cbc79eccea88291d3 100644 (file)
@@ -1100,6 +1100,15 @@ emulate them efficiently. The fields in each entry are defined as follows:
    eax, ebx, ecx, edx: the values returned by the cpuid instruction for
          this function/index combination
 
+The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned
+as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC
+support.  Instead it is reported via
+
+  ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER)
+
+if that returns true and you use KVM_CREATE_IRQCHIP, or if you emulate the
+feature in userspace, then you can enable the feature for KVM_SET_CPUID2.
+
 4.47 KVM_PPC_GET_PVINFO
 
 Capability: KVM_CAP_PPC_GET_PVINFO
@@ -1151,6 +1160,13 @@ following flags are specified:
 /* Depends on KVM_CAP_IOMMU */
 #define KVM_DEV_ASSIGN_ENABLE_IOMMU    (1 << 0)
 
+The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure
+isolation of the device.  Usages not specifying this flag are deprecated.
+
+Only PCI header type 0 devices with PCI BAR resources are supported by
+device assignment.  The user requesting this ioctl must have read/write
+access to the PCI sysfs resource files associated with the device.
+
 4.49 KVM_DEASSIGN_PCI_DEVICE
 
 Capability: KVM_CAP_DEVICE_DEASSIGNMENT
index 6afba60c390488acdfe818b98c823f0921a19749..62f1cd357ddf76ef0cc1c63e4a38133a3935dbe0 100644 (file)
@@ -1698,11 +1698,9 @@ F:       arch/x86/include/asm/tce.h
 
 CAN NETWORK LAYER
 M:     Oliver Hartkopp <socketcan@hartkopp.net>
-M:     Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
-M:     Urs Thuermann <urs.thuermann@volkswagen.de>
 L:     linux-can@vger.kernel.org
-L:     netdev@vger.kernel.org
-W:     http://developer.berlios.de/projects/socketcan/
+W:     http://gitorious.org/linux-can
+T:     git git://gitorious.org/linux-can/linux-can-next.git
 S:     Maintained
 F:     net/can/
 F:     include/linux/can.h
@@ -1713,9 +1711,10 @@ F:       include/linux/can/gw.h
 
 CAN NETWORK DRIVERS
 M:     Wolfgang Grandegger <wg@grandegger.com>
+M:     Marc Kleine-Budde <mkl@pengutronix.de>
 L:     linux-can@vger.kernel.org
-L:     netdev@vger.kernel.org
-W:     http://developer.berlios.de/projects/socketcan/
+W:     http://gitorious.org/linux-can
+T:     git git://gitorious.org/linux-can/linux-can-next.git
 S:     Maintained
 F:     drivers/net/can/
 F:     include/linux/can/dev.h
@@ -2700,7 +2699,7 @@ FIREWIRE SUBSYSTEM
 M:     Stefan Richter <stefanr@s5r6.in-berlin.de>
 L:     linux1394-devel@lists.sourceforge.net
 W:     http://ieee1394.wiki.kernel.org/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394.git
 S:     Maintained
 F:     drivers/firewire/
 F:     include/linux/firewire*.h
index ea51081812f38d5ee8dfaeaab060a9fb4a86ba67..adddd11c3b3b8a2827dc4f591b573b1fde5768a9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 3
 PATCHLEVEL = 2
 SUBLEVEL = 0
-EXTRAVERSION = -rc7
+EXTRAVERSION =
 NAME = Saber-toothed Squirrel
 
 # *DOCUMENTATION*
index 4b0669cbb3b01d4c0eb66f364859cb6f65654693..2505740b81d2e24696ff4420f2f9af86713b817b 100644 (file)
@@ -30,6 +30,10 @@ config OPROFILE_EVENT_MULTIPLEX
 config HAVE_OPROFILE
        bool
 
+config OPROFILE_NMI_TIMER
+       def_bool y
+       depends on PERF_EVENTS && HAVE_PERF_EVENTS_NMI
+
 config KPROBES
        bool "Kprobes"
        depends on MODULES
index 776d76b8cb695ff052f310d9f50a737209e96f1b..b259c7c644e357a9999c3767fd34431d8c39ae8a 100644 (file)
@@ -1246,7 +1246,7 @@ config PL310_ERRATA_588369
 
 config ARM_ERRATA_720789
        bool "ARM errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID"
-       depends on CPU_V7 && SMP
+       depends on CPU_V7
        help
          This option enables the workaround for the 720789 Cortex-A9 (prior to
          r2p0) erratum. A faulty ASID can be sent to the other CPUs for the
@@ -1282,7 +1282,7 @@ config ARM_ERRATA_743622
 
 config ARM_ERRATA_751472
        bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation"
-       depends on CPU_V7 && SMP
+       depends on CPU_V7
        help
          This option enables the workaround for the 751472 Cortex-A9 (prior
          to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the
index f407a6b35d3dd1e6ad1e72afec38837dcfdd796a..8d8df744f7a5eb72e02bc65bf85029c2b9f60a63 100644 (file)
  */
 #define MCODE_BUFF_PER_REQ     256
 
-/*
- * Mark a _pl330_req as free.
- * We do it by writing DMAEND as the first instruction
- * because no valid request is going to have DMAEND as
- * its first instruction to execute.
- */
-#define MARK_FREE(req) do { \
-                               _emit_END(0, (req)->mc_cpu); \
-                               (req)->mc_len = 0; \
-                       } while (0)
-
 /* If the _pl330_req is available to the client */
 #define IS_FREE(req)   (*((u8 *)((req)->mc_cpu)) == CMD_DMAEND)
 
@@ -301,8 +290,10 @@ struct pl330_thread {
        struct pl330_dmac *dmac;
        /* Only two at a time */
        struct _pl330_req req[2];
-       /* Index of the last submitted request */
+       /* Index of the last enqueued request */
        unsigned lstenq;
+       /* Index of the last submitted request or -1 if the DMA is stopped */
+       int req_running;
 };
 
 enum pl330_dmac_state {
@@ -778,6 +769,22 @@ static inline void _execute_DBGINSN(struct pl330_thread *thrd,
        writel(0, regs + DBGCMD);
 }
 
+/*
+ * Mark a _pl330_req as free.
+ * We do it by writing DMAEND as the first instruction
+ * because no valid request is going to have DMAEND as
+ * its first instruction to execute.
+ */
+static void mark_free(struct pl330_thread *thrd, int idx)
+{
+       struct _pl330_req *req = &thrd->req[idx];
+
+       _emit_END(0, req->mc_cpu);
+       req->mc_len = 0;
+
+       thrd->req_running = -1;
+}
+
 static inline u32 _state(struct pl330_thread *thrd)
 {
        void __iomem *regs = thrd->dmac->pinfo->base;
@@ -836,31 +843,6 @@ static inline u32 _state(struct pl330_thread *thrd)
        }
 }
 
-/* If the request 'req' of thread 'thrd' is currently active */
-static inline bool _req_active(struct pl330_thread *thrd,
-               struct _pl330_req *req)
-{
-       void __iomem *regs = thrd->dmac->pinfo->base;
-       u32 buf = req->mc_bus, pc = readl(regs + CPC(thrd->id));
-
-       if (IS_FREE(req))
-               return false;
-
-       return (pc >= buf && pc <= buf + req->mc_len) ? true : false;
-}
-
-/* Returns 0 if the thread is inactive, ID of active req + 1 otherwise */
-static inline unsigned _thrd_active(struct pl330_thread *thrd)
-{
-       if (_req_active(thrd, &thrd->req[0]))
-               return 1; /* First req active */
-
-       if (_req_active(thrd, &thrd->req[1]))
-               return 2; /* Second req active */
-
-       return 0;
-}
-
 static void _stop(struct pl330_thread *thrd)
 {
        void __iomem *regs = thrd->dmac->pinfo->base;
@@ -892,17 +874,22 @@ static bool _trigger(struct pl330_thread *thrd)
        struct _arg_GO go;
        unsigned ns;
        u8 insn[6] = {0, 0, 0, 0, 0, 0};
+       int idx;
 
        /* Return if already ACTIVE */
        if (_state(thrd) != PL330_STATE_STOPPED)
                return true;
 
-       if (!IS_FREE(&thrd->req[1 - thrd->lstenq]))
-               req = &thrd->req[1 - thrd->lstenq];
-       else if (!IS_FREE(&thrd->req[thrd->lstenq]))
-               req = &thrd->req[thrd->lstenq];
-       else
-               req = NULL;
+       idx = 1 - thrd->lstenq;
+       if (!IS_FREE(&thrd->req[idx]))
+               req = &thrd->req[idx];
+       else {
+               idx = thrd->lstenq;
+               if (!IS_FREE(&thrd->req[idx]))
+                       req = &thrd->req[idx];
+               else
+                       req = NULL;
+       }
 
        /* Return if no request */
        if (!req || !req->r)
@@ -933,6 +920,8 @@ static bool _trigger(struct pl330_thread *thrd)
        /* Only manager can execute GO */
        _execute_DBGINSN(thrd, insn, true);
 
+       thrd->req_running = idx;
+
        return true;
 }
 
@@ -1382,8 +1371,8 @@ static void pl330_dotask(unsigned long data)
 
                        thrd->req[0].r = NULL;
                        thrd->req[1].r = NULL;
-                       MARK_FREE(&thrd->req[0]);
-                       MARK_FREE(&thrd->req[1]);
+                       mark_free(thrd, 0);
+                       mark_free(thrd, 1);
 
                        /* Clear the reset flag */
                        pl330->dmac_tbd.reset_chan &= ~(1 << i);
@@ -1461,14 +1450,12 @@ int pl330_update(const struct pl330_info *pi)
 
                        thrd = &pl330->channels[id];
 
-                       active = _thrd_active(thrd);
-                       if (!active) /* Aborted */
+                       active = thrd->req_running;
+                       if (active == -1) /* Aborted */
                                continue;
 
-                       active -= 1;
-
                        rqdone = &thrd->req[active];
-                       MARK_FREE(rqdone);
+                       mark_free(thrd, active);
 
                        /* Get going again ASAP */
                        _start(thrd);
@@ -1509,7 +1496,7 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
        struct pl330_thread *thrd = ch_id;
        struct pl330_dmac *pl330;
        unsigned long flags;
-       int ret = 0, active;
+       int ret = 0, active = thrd->req_running;
 
        if (!thrd || thrd->free || thrd->dmac->state == DYING)
                return -EINVAL;
@@ -1525,28 +1512,24 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
 
                thrd->req[0].r = NULL;
                thrd->req[1].r = NULL;
-               MARK_FREE(&thrd->req[0]);
-               MARK_FREE(&thrd->req[1]);
+               mark_free(thrd, 0);
+               mark_free(thrd, 1);
                break;
 
        case PL330_OP_ABORT:
-               active = _thrd_active(thrd);
-
                /* Make sure the channel is stopped */
                _stop(thrd);
 
                /* ABORT is only for the active req */
-               if (!active)
+               if (active == -1)
                        break;
 
-               active--;
-
                thrd->req[active].r = NULL;
-               MARK_FREE(&thrd->req[active]);
+               mark_free(thrd, active);
 
                /* Start the next */
        case PL330_OP_START:
-               if (!_thrd_active(thrd) && !_start(thrd))
+               if ((active == -1) && !_start(thrd))
                        ret = -EIO;
                break;
 
@@ -1587,14 +1570,13 @@ int pl330_chan_status(void *ch_id, struct pl330_chanstatus *pstatus)
        else
                pstatus->faulting = false;
 
-       active = _thrd_active(thrd);
+       active = thrd->req_running;
 
-       if (!active) {
+       if (active == -1) {
                /* Indicate that the thread is not running */
                pstatus->top_req = NULL;
                pstatus->wait_req = NULL;
        } else {
-               active--;
                pstatus->top_req = thrd->req[active].r;
                pstatus->wait_req = !IS_FREE(&thrd->req[1 - active])
                                        ? thrd->req[1 - active].r : NULL;
@@ -1659,9 +1641,9 @@ void *pl330_request_channel(const struct pl330_info *pi)
                                thrd->free = false;
                                thrd->lstenq = 1;
                                thrd->req[0].r = NULL;
-                               MARK_FREE(&thrd->req[0]);
+                               mark_free(thrd, 0);
                                thrd->req[1].r = NULL;
-                               MARK_FREE(&thrd->req[1]);
+                               mark_free(thrd, 1);
                                break;
                        }
                }
@@ -1767,14 +1749,14 @@ static inline void _reset_thread(struct pl330_thread *thrd)
        thrd->req[0].mc_bus = pl330->mcode_bus
                                + (thrd->id * pi->mcbufsz);
        thrd->req[0].r = NULL;
-       MARK_FREE(&thrd->req[0]);
+       mark_free(thrd, 0);
 
        thrd->req[1].mc_cpu = thrd->req[0].mc_cpu
                                + pi->mcbufsz / 2;
        thrd->req[1].mc_bus = thrd->req[0].mc_bus
                                + pi->mcbufsz / 2;
        thrd->req[1].r = NULL;
-       MARK_FREE(&thrd->req[1]);
+       mark_free(thrd, 1);
 }
 
 static int dmac_alloc_threads(struct pl330_dmac *pl330)
index 11a4192197c8fbaef84a10a53ce24fb497ae3947..cf497ce41dfe725bf5f4549faab3bc4c82a5728c 100644 (file)
@@ -18,9 +18,10 @@ CONFIG_ARCH_MXC=y
 CONFIG_ARCH_IMX_V4_V5=y
 CONFIG_ARCH_MX1ADS=y
 CONFIG_MACH_SCB9328=y
+CONFIG_MACH_APF9328=y
 CONFIG_MACH_MX21ADS=y
 CONFIG_MACH_MX25_3DS=y
-CONFIG_MACH_EUKREA_CPUIMX25=y
+CONFIG_MACH_EUKREA_CPUIMX25SD=y
 CONFIG_MACH_MX27ADS=y
 CONFIG_MACH_PCM038=y
 CONFIG_MACH_CPUIMX27=y
@@ -72,17 +73,16 @@ CONFIG_MTD_CFI_GEOMETRY=y
 CONFIG_MTD_CFI_INTELEXT=y
 CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_MXC=y
 CONFIG_MTD_UBI=y
 CONFIG_MISC_DEVICES=y
 CONFIG_EEPROM_AT24=y
 CONFIG_EEPROM_AT25=y
 CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
-CONFIG_SMC91X=y
 CONFIG_DM9000=y
+CONFIG_SMC91X=y
 CONFIG_SMC911X=y
-# CONFIG_NETDEV_1000 is not set
-# CONFIG_NETDEV_10000 is not set
+CONFIG_SMSC_PHY=y
 # CONFIG_INPUT_MOUSEDEV is not set
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_KEYBOARD is not set
@@ -100,6 +100,7 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_IMX=y
 CONFIG_SPI=y
 CONFIG_SPI_IMX=y
+CONFIG_SPI_SPIDEV=y
 CONFIG_W1=y
 CONFIG_W1_MASTER_MXC=y
 CONFIG_W1_SLAVE_THERM=y
@@ -139,6 +140,7 @@ CONFIG_MMC=y
 CONFIG_MMC_MXC=y
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
 CONFIG_LEDS_MC13783=y
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
index 3d0c6fb74ae4efe521cfc563ea11e0fa9738d465..e8e8fe505df140f11be486792c10801d971f343b 100644 (file)
@@ -183,7 +183,8 @@ void cpu_idle(void)
 
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                leds_event(led_idle_start);
                while (!need_resched()) {
 #ifdef CONFIG_HOTPLUG_CPU
@@ -213,7 +214,8 @@ void cpu_idle(void)
                        }
                }
                leds_event(led_idle_end);
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 8fc2c8fcbdc646a4a8babecbf4a758f88e6d8d60..c0b59bff6be640a7ee23a0443020d62dce591465 100644 (file)
@@ -52,6 +52,7 @@
 #include <asm/mach/time.h>
 #include <asm/traps.h>
 #include <asm/unwind.h>
+#include <asm/memblock.h>
 
 #if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
 #include "compat.h"
index 90ec247f3b375f498e20f46c20e25fe2c943b54a..cc8d4bd6d0f71666f4fe369dab28908bbd7af741 100644 (file)
@@ -110,11 +110,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
                .pfn            = __phys_to_pfn(EXYNOS4_PA_DMC0),
                .length         = SZ_4K,
                .type           = MT_DEVICE,
-       }, {
-               .virtual        = (unsigned long)S5P_VA_SROMC,
-               .pfn            = __phys_to_pfn(EXYNOS4_PA_SROMC),
-               .length         = SZ_4K,
-               .type           = MT_DEVICE,
        }, {
                .virtual        = (unsigned long)S3C_VA_USB_HSPHY,
                .pfn            = __phys_to_pfn(EXYNOS4_PA_HSPHY),
index c44aa974e79c473d123631236269bdb8c2daa8a3..0e6f1af260b651b1894a9203f449ae8ecb5cac26 100644 (file)
@@ -132,7 +132,7 @@ config MACH_MX25_3DS
        select IMX_HAVE_PLATFORM_MXC_NAND
        select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
 
-config MACH_EUKREA_CPUIMX25
+config MACH_EUKREA_CPUIMX25SD
        bool "Support Eukrea CPUIMX25 Platform"
        select SOC_IMX25
        select IMX_HAVE_PLATFORM_FLEXCAN
@@ -148,7 +148,7 @@ config MACH_EUKREA_CPUIMX25
 
 choice
        prompt "Baseboard"
-       depends on MACH_EUKREA_CPUIMX25
+       depends on MACH_EUKREA_CPUIMX25SD
        default MACH_EUKREA_MBIMXSD25_BASEBOARD
 
 config MACH_EUKREA_MBIMXSD25_BASEBOARD
@@ -542,7 +542,7 @@ config MACH_MX35_3DS
          Include support for MX35PDK platform. This includes specific
          configurations for the board and its peripherals.
 
-config MACH_EUKREA_CPUIMX35
+config MACH_EUKREA_CPUIMX35SD
        bool "Support Eukrea CPUIMX35 Platform"
        select SOC_IMX35
        select IMX_HAVE_PLATFORM_FLEXCAN
@@ -560,7 +560,7 @@ config MACH_EUKREA_CPUIMX35
 
 choice
        prompt "Baseboard"
-       depends on MACH_EUKREA_CPUIMX35
+       depends on MACH_EUKREA_CPUIMX35SD
        default MACH_EUKREA_MBIMXSD35_BASEBOARD
 
 config MACH_EUKREA_MBIMXSD35_BASEBOARD
index aba73214c2a8cd640e0f4371caf4ce99ac53dc0f..d97f409ce98be4a9d796dc21d3dc30fb9c7de9c7 100644 (file)
@@ -24,7 +24,7 @@ obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
 
 # i.MX25 based machines
 obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o
-obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += mach-eukrea_cpuimx25.o
+obj-$(CONFIG_MACH_EUKREA_CPUIMX25SD) += mach-eukrea_cpuimx25.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd25-baseboard.o
 
 # i.MX27 based machines
@@ -57,7 +57,7 @@ obj-$(CONFIG_MACH_BUG) += mach-bug.o
 # i.MX35 based machines
 obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o
 obj-$(CONFIG_MACH_MX35_3DS) += mach-mx35_3ds.o
-obj-$(CONFIG_MACH_EUKREA_CPUIMX35) += mach-cpuimx35.o
+obj-$(CONFIG_MACH_EUKREA_CPUIMX35SD) += mach-cpuimx35.o
 obj-$(CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD) += eukrea_mbimxsd35-baseboard.o
 obj-$(CONFIG_MACH_VPR200) += mach-vpr200.o
 
index 8116f119517d8065ca0653a603863275e29be71b..ac8238caecb98a98bf6c326e267fae24d88bb861 100644 (file)
@@ -507,7 +507,7 @@ static struct clk_lookup lookups[] = {
 
 int __init mx35_clocks_init()
 {
-       unsigned int cgr2 = 3 << 26, cgr3 = 0;
+       unsigned int cgr2 = 3 << 26;
 
 #if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
        cgr2 |= 3 << 16;
@@ -521,6 +521,12 @@ int __init mx35_clocks_init()
        __raw_writel((3 << 18), CCM_BASE + CCM_CGR0);
        __raw_writel((3 << 2) | (3 << 4) | (3 << 6) | (3 << 8) | (3 << 16),
                        CCM_BASE + CCM_CGR1);
+       __raw_writel(cgr2, CCM_BASE + CCM_CGR2);
+       __raw_writel(0, CCM_BASE + CCM_CGR3);
+
+       clk_enable(&iim_clk);
+       imx_print_silicon_rev("i.MX35", mx35_revision());
+       clk_disable(&iim_clk);
 
        /*
         * Check if we came up in internal boot mode. If yes, we need some
@@ -529,17 +535,11 @@ int __init mx35_clocks_init()
         */
        if (!(__raw_readl(CCM_BASE + CCM_RCSR) & (3 << 10))) {
                /* Additionally turn on UART1, SCC, and IIM clocks */
-               cgr2 |= 3 << 16 | 3 << 4;
-               cgr3 |= 3 << 2;
+               clk_enable(&iim_clk);
+               clk_enable(&uart1_clk);
+               clk_enable(&scc_clk);
        }
 
-       __raw_writel(cgr2, CCM_BASE + CCM_CGR2);
-       __raw_writel(cgr3, CCM_BASE + CCM_CGR3);
-
-       clk_enable(&iim_clk);
-       imx_print_silicon_rev("i.MX35", mx35_revision());
-       clk_disable(&iim_clk);
-
 #ifdef CONFIG_MXC_USE_EPIT
        epit_timer_init(&epit1_clk,
                        MX35_IO_ADDRESS(MX35_EPIT1_BASE_ADDR), MX35_INT_EPIT1);
index 66af2e8f7e576dffd5372862653d397d22811069..362aae780601efc41e346a8a7beade651f610d83 100644 (file)
@@ -53,12 +53,18 @@ static const struct imxi2c_platform_data
        .bitrate =              100000,
 };
 
+#define TSC2007_IRQGPIO                IMX_GPIO_NR(3, 2)
+static int tsc2007_get_pendown_state(void)
+{
+       return !gpio_get_value(TSC2007_IRQGPIO);
+}
+
 static struct tsc2007_platform_data tsc2007_info = {
        .model                  = 2007,
        .x_plate_ohms           = 180,
+       .get_pendown_state = tsc2007_get_pendown_state,
 };
 
-#define TSC2007_IRQGPIO                IMX_GPIO_NR(3, 2)
 static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
        {
                I2C_BOARD_INFO("pcf8563", 0x51),
index 7f8915ad50990b1af2e877ed169c32cd0d15cd02..eef43e2e163e92224e23ea3c5b6250c14d2747fb 100644 (file)
@@ -3247,18 +3247,14 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = {
 
 /* 3430ES1-only hwmods */
 static __initdata struct omap_hwmod *omap3430es1_hwmods[] = {
-       &omap3xxx_iva_hwmod,
        &omap3430es1_dss_core_hwmod,
-       &omap3xxx_mailbox_hwmod,
        NULL
 };
 
 /* 3430ES2+-only hwmods */
 static __initdata struct omap_hwmod *omap3430es2plus_hwmods[] = {
-       &omap3xxx_iva_hwmod,
        &omap3xxx_dss_core_hwmod,
        &omap3xxx_usbhsotg_hwmod,
-       &omap3xxx_mailbox_hwmod,
        NULL
 };
 
index fbdd12ea3a587a146497f9e560d28d86c52fca45..7c38474e533a47c63ac4b78a698f245457a1b7de 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <asm/memblock.h>
 
 #include "mm.h"
 
@@ -332,7 +333,6 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
 
        sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
 
-       memblock_init();
        for (i = 0; i < mi->nr_banks; i++)
                memblock_add(mi->bank[i].start, mi->bank[i].size);
 
@@ -371,7 +371,7 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
        if (mdesc->reserve)
                mdesc->reserve();
 
-       memblock_analyze();
+       memblock_allow_resize();
        memblock_dump_all();
 }
 
index 2c559ac381425d325757c68d83e73c37c77e6b5d..e70a73731eaacb823b15f625ddb614c99b44c5f2 100644 (file)
@@ -363,11 +363,13 @@ __v7_setup:
        orreq   r10, r10, #1 << 6               @ set bit #6
        mcreq   p15, 0, r10, c15, c0, 1         @ write diagnostic register
 #endif
-#ifdef CONFIG_ARM_ERRATA_751472
-       cmp     r6, #0x30                       @ present prior to r3p0
+#if defined(CONFIG_ARM_ERRATA_751472) && defined(CONFIG_SMP)
+       ALT_SMP(cmp r6, #0x30)                  @ present prior to r3p0
+       ALT_UP_B(1f)
        mrclt   p15, 0, r10, c15, c0, 1         @ read diagnostic register
        orrlt   r10, r10, #1 << 11              @ set bit #11
        mcrlt   p15, 0, r10, c15, c0, 1         @ write diagnostic register
+1:
 #endif
 
 3:     mov     r10, #0
index c074e66ad224e83d18d1f278afc78aa00e18b494..4e0a371630b38fb3a950b9063f30a53d3ed0b5a7 100644 (file)
@@ -116,7 +116,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        return oprofile_perf_init(ops);
 }
 
-void __exit oprofile_arch_exit(void)
+void oprofile_arch_exit(void)
 {
        oprofile_perf_exit();
 }
index adbff706ef6f88f0757a6f13d5d2f748d56109a3..73db34bf588ae7985fc50c71e9e2a4aa3af7a5f8 100644 (file)
@@ -98,7 +98,7 @@ static int mxc_set_target(struct cpufreq_policy *policy,
        return ret;
 }
 
-static int __init mxc_cpufreq_init(struct cpufreq_policy *policy)
+static int mxc_cpufreq_init(struct cpufreq_policy *policy)
 {
        int ret;
        int i;
index 88fd40452567a30aeb6f2b55ba1e3f4684959a78..477971b009308a929c53c19ce40c4b35c425d623 100644 (file)
@@ -98,6 +98,7 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)
        case MACH_TYPE_PCM043:
        case MACH_TYPE_LILLY1131:
        case MACH_TYPE_VPR200:
+       case MACH_TYPE_EUKREA_CPUIMX35SD:
                uart_base = MX3X_UART1_BASE_ADDR;
                break;
        case MACH_TYPE_MAGX_ZN5:
index 845de59f07edef9058a40c0afa5197d6313f8ce0..e032717f7d02c211ee8cad0d0200cec5f83974cf 100644 (file)
@@ -77,6 +77,15 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
                do_div(c, period_ns);
                duty_cycles = c;
 
+               /*
+                * according to imx pwm RM, the real period value should be
+                * PERIOD value in PWMPR plus 2.
+                */
+               if (period_cycles > 2)
+                       period_cycles -= 2;
+               else
+                       period_cycles = 0;
+
                writel(duty_cycles, pwm->mmio_base + MX3_PWMSAR);
                writel(period_cycles, pwm->mmio_base + MX3_PWMPR);
 
index 41ab97ebe4cfc8877fc58cd09f446c02636a030d..10d160888133c72101101f8e1dfafb53ddaf1af9 100644 (file)
@@ -384,12 +384,16 @@ void __init orion_gpio_init(int gpio_base, int ngpio,
        struct orion_gpio_chip *ochip;
        struct irq_chip_generic *gc;
        struct irq_chip_type *ct;
+       char gc_label[16];
 
        if (orion_gpio_chip_count == ARRAY_SIZE(orion_gpio_chips))
                return;
 
+       snprintf(gc_label, sizeof(gc_label), "orion_gpio%d",
+               orion_gpio_chip_count);
+
        ochip = orion_gpio_chips + orion_gpio_chip_count;
-       ochip->chip.label = "orion_gpio";
+       ochip->chip.label = kstrdup(gc_label, GFP_KERNEL);
        ochip->chip.request = orion_gpio_request;
        ochip->chip.direction_input = orion_gpio_direction_input;
        ochip->chip.get = orion_gpio_get;
index dac4760c0f0aeb58b4c68b5b01913f41dc1430b4..95509d8eb140fda1367658d048660790253b35d5 100644 (file)
@@ -202,14 +202,6 @@ extern int s3c_plltab_register(struct cpufreq_frequency_table *plls,
 extern struct s3c_cpufreq_config *s3c_cpufreq_getconfig(void);
 extern struct s3c_iotimings *s3c_cpufreq_getiotimings(void);
 
-extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
-                                    struct s3c_cpufreq_config *cfg,
-                                    union s3c_iobank *iob);
-
-extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
-                                    struct s3c_cpufreq_config *cfg,
-                                    union s3c_iobank *iob);
-
 #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUGFS
 #define s3c_cpufreq_debugfs_call(x) x
 #else
@@ -226,6 +218,10 @@ extern void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg);
 extern void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg);
 
 #ifdef CONFIG_S3C2410_IOTIMING
+extern void s3c2410_iotiming_debugfs(struct seq_file *seq,
+                                    struct s3c_cpufreq_config *cfg,
+                                    union s3c_iobank *iob);
+
 extern int s3c2410_iotiming_calc(struct s3c_cpufreq_config *cfg,
                                 struct s3c_iotimings *iot);
 
@@ -235,6 +231,7 @@ extern int s3c2410_iotiming_get(struct s3c_cpufreq_config *cfg,
 extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
                                 struct s3c_iotimings *iot);
 #else
+#define s3c2410_iotiming_debugfs NULL
 #define s3c2410_iotiming_calc NULL
 #define s3c2410_iotiming_get NULL
 #define s3c2410_iotiming_set NULL
@@ -242,8 +239,10 @@ extern void s3c2410_iotiming_set(struct s3c_cpufreq_config *cfg,
 
 /* S3C2412 compatible routines */
 
-extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
-                               struct s3c_iotimings *timings);
+#ifdef CONFIG_S3C2412_IOTIMING
+extern void s3c2412_iotiming_debugfs(struct seq_file *seq,
+                                    struct s3c_cpufreq_config *cfg,
+                                    union s3c_iobank *iob);
 
 extern int s3c2412_iotiming_get(struct s3c_cpufreq_config *cfg,
                                struct s3c_iotimings *timings);
@@ -253,6 +252,12 @@ extern int s3c2412_iotiming_calc(struct s3c_cpufreq_config *cfg,
 
 extern void s3c2412_iotiming_set(struct s3c_cpufreq_config *cfg,
                                 struct s3c_iotimings *iot);
+#else
+#define s3c2412_iotiming_debugfs NULL
+#define s3c2412_iotiming_calc NULL
+#define s3c2412_iotiming_get NULL
+#define s3c2412_iotiming_set NULL
+#endif /* CONFIG_S3C2412_IOTIMING */
 
 #ifdef CONFIG_CPU_FREQ_S3C24XX_DEBUG
 #define s3c_freq_dbg(x...) printk(KERN_INFO x)
index ef5a2a08fcca24d7975bcbc3482ac2b6956f4de8..ea33957503243c44ce8eaed1b7d114fec608f792 100644 (file)
@@ -34,10 +34,12 @@ void cpu_idle(void)
 {
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched())
                        cpu_idle_sleep();
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 6a80a9e9fc4aefa8d97f564f6d23ba978a242131..8dd0416673cb56f631e2b6f45db7af749982730d 100644 (file)
@@ -88,10 +88,12 @@ void cpu_idle(void)
 #endif
                if (!idle)
                        idle = default_idle;
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched())
                        idle();
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index bb978ede89852ef06bc7d41f6520cb9bb20769b5..6773fc83a670f08568a059bfa81c2c2e7a3bfa7f 100644 (file)
@@ -47,14 +47,12 @@ static struct clocksource cont_rotime = {
        .rating = 300,
        .read   = read_cont_rotime,
        .mask   = CLOCKSOURCE_MASK(32),
-       .shift  = 10,
        .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 static int __init etrax_init_cont_rotime(void)
 {
-       cont_rotime.mult = clocksource_khz2mult(100000, cont_rotime.shift);
-       clocksource_register(&cont_rotime);
+       clocksource_register_khz(&cont_rotime, 100000);
        return 0;
 }
 arch_initcall(etrax_init_cont_rotime);
index 27489b6dd5334a2297b24c69536293935728afa3..3b7a7c483785929f0f126953756aa5f40c694dd0 100644 (file)
@@ -23,6 +23,9 @@ config IA64
        select HAVE_ARCH_TRACEHOOK
        select HAVE_DMA_API_DEBUG
        select HAVE_GENERIC_HARDIRQS
+       select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
+       select ARCH_DISCARD_MEMBLOCK
        select GENERIC_IRQ_PROBE
        select GENERIC_PENDING_IRQ if SMP
        select IRQ_PER_CPU
@@ -474,9 +477,6 @@ config NODES_SHIFT
          MAX_NUMNODES will be 2^(This value).
          If in doubt, use the default.
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 # VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
 # VIRTUAL_MEM_MAP has been retained for historical reasons.
 config VIRTUAL_MEM_MAP
index 6073b187528a26a8ac16826aa98cd7986c5724ed..3deac956d325f3f3331d31a4256925dab758e365 100644 (file)
 #include <linux/jiffies.h>
 #include <asm/processor.h>
 
-typedef u64 cputime_t;
-typedef u64 cputime64_t;
+typedef u64 __nocast cputime_t;
+typedef u64 __nocast cputime64_t;
 
-#define cputime_zero                   ((cputime_t)0)
 #define cputime_one_jiffy              jiffies_to_cputime(1)
-#define cputime_max                    ((~((cputime_t)0) >> 1) - 1)
-#define cputime_add(__a, __b)          ((__a) +  (__b))
-#define cputime_sub(__a, __b)          ((__a) -  (__b))
-#define cputime_div(__a, __n)          ((__a) /  (__n))
-#define cputime_halve(__a)             ((__a) >> 1)
-#define cputime_eq(__a, __b)           ((__a) == (__b))
-#define cputime_gt(__a, __b)           ((__a) >  (__b))
-#define cputime_ge(__a, __b)           ((__a) >= (__b))
-#define cputime_lt(__a, __b)           ((__a) <  (__b))
-#define cputime_le(__a, __b)           ((__a) <= (__b))
-
-#define cputime64_zero                 ((cputime64_t)0)
-#define cputime64_add(__a, __b)                ((__a) + (__b))
-#define cputime64_sub(__a, __b)                ((__a) - (__b))
-#define cputime_to_cputime64(__ct)     (__ct)
 
 /*
  * Convert cputime <-> jiffies (HZ)
  */
-#define cputime_to_jiffies(__ct)       ((__ct) / (NSEC_PER_SEC / HZ))
-#define jiffies_to_cputime(__jif)      ((__jif) * (NSEC_PER_SEC / HZ))
-#define cputime64_to_jiffies64(__ct)   ((__ct) / (NSEC_PER_SEC / HZ))
-#define jiffies64_to_cputime64(__jif)  ((__jif) * (NSEC_PER_SEC / HZ))
+#define cputime_to_jiffies(__ct)       \
+       ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
+#define jiffies_to_cputime(__jif)      \
+       (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
+#define cputime64_to_jiffies64(__ct)   \
+       ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
+#define jiffies64_to_cputime64(__jif)  \
+       (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
 
 /*
  * Convert cputime <-> microseconds
  */
-#define cputime_to_usecs(__ct)         ((__ct) / NSEC_PER_USEC)
-#define usecs_to_cputime(__usecs)      ((__usecs) * NSEC_PER_USEC)
+#define cputime_to_usecs(__ct)         \
+       ((__force u64)(__ct) / NSEC_PER_USEC)
+#define usecs_to_cputime(__usecs)      \
+       (__force cputime_t)((__usecs) * NSEC_PER_USEC)
+#define usecs_to_cputime64(__usecs)    \
+       (__force cputime64_t)((__usecs) * NSEC_PER_USEC)
 
 /*
  * Convert cputime <-> seconds
  */
-#define cputime_to_secs(__ct)          ((__ct) / NSEC_PER_SEC)
-#define secs_to_cputime(__secs)                ((__secs) * NSEC_PER_SEC)
+#define cputime_to_secs(__ct)          \
+       ((__force u64)(__ct) / NSEC_PER_SEC)
+#define secs_to_cputime(__secs)                \
+       (__force cputime_t)((__secs) * NSEC_PER_SEC)
 
 /*
  * Convert cputime <-> timespec (nsec)
  */
 static inline cputime_t timespec_to_cputime(const struct timespec *val)
 {
-       cputime_t ret = val->tv_sec * NSEC_PER_SEC;
-       return (ret + val->tv_nsec);
+       u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec;
+       return (__force cputime_t) ret;
 }
 static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
 {
-       val->tv_sec  = ct / NSEC_PER_SEC;
-       val->tv_nsec = ct % NSEC_PER_SEC;
+       val->tv_sec  = (__force u64) ct / NSEC_PER_SEC;
+       val->tv_nsec = (__force u64) ct % NSEC_PER_SEC;
 }
 
 /*
@@ -86,25 +80,28 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
  */
 static inline cputime_t timeval_to_cputime(struct timeval *val)
 {
-       cputime_t ret = val->tv_sec * NSEC_PER_SEC;
-       return (ret + val->tv_usec * NSEC_PER_USEC);
+       u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC;
+       return (__force cputime_t) ret;
 }
 static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
 {
-       val->tv_sec = ct / NSEC_PER_SEC;
-       val->tv_usec = (ct % NSEC_PER_SEC) / NSEC_PER_USEC;
+       val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
+       val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC;
 }
 
 /*
  * Convert cputime <-> clock (USER_HZ)
  */
-#define cputime_to_clock_t(__ct)       ((__ct) / (NSEC_PER_SEC / USER_HZ))
-#define clock_t_to_cputime(__x)                ((__x) * (NSEC_PER_SEC / USER_HZ))
+#define cputime_to_clock_t(__ct)       \
+       ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ))
+#define clock_t_to_cputime(__x)                \
+       (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
 
 /*
  * Convert cputime64 to clock.
  */
-#define cputime64_to_clock_t(__ct)      cputime_to_clock_t((cputime_t)__ct)
+#define cputime64_to_clock_t(__ct)     \
+       cputime_to_clock_t((__force cputime_t)__ct)
 
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING */
 #endif /* __IA64_CPUTIME_H */
index f114a3b14c6ad73c7fa6afbe950375f46d98b876..1516d1dc11fd3662d8d1b70497989f84750546d2 100644 (file)
@@ -16,6 +16,7 @@
  */
 #include <linux/bootmem.h>
 #include <linux/efi.h>
+#include <linux/memblock.h>
 #include <linux/mm.h>
 #include <linux/nmi.h>
 #include <linux/swap.h>
@@ -348,7 +349,7 @@ paging_init (void)
                printk("Virtual mem_map starts at 0x%p\n", mem_map);
        }
 #else /* !CONFIG_VIRTUAL_MEM_MAP */
-       add_active_range(0, 0, max_low_pfn);
+       memblock_add_node(0, PFN_PHYS(max_low_pfn), 0);
        free_area_init_nodes(max_zone_pfns);
 #endif /* !CONFIG_VIRTUAL_MEM_MAP */
        zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
index 00cb0e26c64e02cd9663c381fa359e22f6c8104a..13df239dbed1682c74c5746ebdbaa7320054faec 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/bootmem.h>
 #include <linux/efi.h>
 #include <linux/elf.h>
+#include <linux/memblock.h>
 #include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
@@ -557,8 +558,7 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
 #endif
 
        if (start < end)
-               add_active_range(nid, __pa(start) >> PAGE_SHIFT,
-                       __pa(end) >> PAGE_SHIFT);
+               memblock_add_node(__pa(start), end - start, nid);
        return 0;
 }
 
index 309f725995bf4900bb1423a64ad21f0353acd697..f2678866067bb3b41faf4eb1c7f71eae6ff63832 100644 (file)
@@ -93,7 +93,6 @@ static struct clocksource m68328_clk = {
        .name   = "timer",
        .rating = 250,
        .read   = m68328_read_clk,
-       .shift  = 20,
        .mask   = CLOCKSOURCE_MASK(32),
        .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -115,8 +114,7 @@ void hw_timer_init(void)
 
        /* Enable timer 1 */
        TCTL |= TCTL_TEN;
-       m68328_clk.mult = clocksource_hz2mult(TICKS_PER_JIFFY*HZ, m68328_clk.shift);
-       clocksource_register(&m68328_clk);
+       clocksource_register_hz(&m68328_clk, TICKS_PER_JIFFY*HZ);
 }
 
 /***************************************************************************/
index a5f562823d7acfa9e5d4fc6a66d37b9cd31c4428..235ad57c470798c9538fab0fab7fef4936bd7a3c 100644 (file)
@@ -44,7 +44,6 @@ static struct clocksource clocksource_cf_dt = {
        .rating         = 200,
        .read           = cf_dt_get_cycles,
        .mask           = CLOCKSOURCE_MASK(32),
-       .shift          = 20,
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -60,9 +59,7 @@ static int __init  init_cf_dt_clocksource(void)
        __raw_writeb(0x00, DTER0);
        __raw_writel(0x00000000, DTRR0);
        __raw_writew(DMA_DTMR_CLK_DIV_16 | DMA_DTMR_ENABLE, DTMR0);
-       clocksource_cf_dt.mult = clocksource_hz2mult(DMA_FREQ,
-                                                    clocksource_cf_dt.shift);
-       return clocksource_register(&clocksource_cf_dt);
+       return clocksource_register_hz(&clocksource_cf_dt, DMA_FREQ);
 }
 
 arch_initcall(init_cf_dt_clocksource);
index c2b980926becfb001f8ec21f8b98d5cc233550e8..02663d25822ddb6f8ce8363c8e7501f97b299867 100644 (file)
@@ -144,7 +144,6 @@ static struct clocksource pit_clk = {
        .name   = "pit",
        .rating = 100,
        .read   = pit_read_clk,
-       .shift  = 20,
        .mask   = CLOCKSOURCE_MASK(32),
 };
 
@@ -162,8 +161,7 @@ void hw_timer_init(void)
 
        setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &pit_irq);
 
-       pit_clk.mult = clocksource_hz2mult(FREQ, pit_clk.shift);
-       clocksource_register(&pit_clk);
+       clocksource_register_hz(&pit_clk, FREQ);
 }
 
 /***************************************************************************/
index 6a85daf9a7fd5a2b3dfc7ed9cde4a487cc92500d..b7f822b552bbdba06474d78dfa2b89832d15995c 100644 (file)
@@ -114,7 +114,6 @@ static struct clocksource mcfslt_clk = {
        .name   = "slt",
        .rating = 250,
        .read   = mcfslt_read_clk,
-       .shift  = 20,
        .mask   = CLOCKSOURCE_MASK(32),
        .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -136,8 +135,7 @@ void hw_timer_init(void)
 
        setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);
 
-       mcfslt_clk.mult = clocksource_hz2mult(MCF_BUSCLK, mcfslt_clk.shift);
-       clocksource_register(&mcfslt_clk);
+       clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);
 
 #ifdef CONFIG_HIGHPROFILE
        mcfslt_profile_init();
index 60242f65fea90a3df427d9fca7158cd37b45fb89..0d90da32fcdb7631f6eec295c9e98e0476e6ba3f 100644 (file)
@@ -88,7 +88,6 @@ static struct clocksource mcftmr_clk = {
        .name   = "tmr",
        .rating = 250,
        .read   = mcftmr_read_clk,
-       .shift  = 20,
        .mask   = CLOCKSOURCE_MASK(32),
        .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
@@ -109,8 +108,7 @@ void hw_timer_init(void)
        __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
                MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
 
-       mcftmr_clk.mult = clocksource_hz2mult(FREQ, mcftmr_clk.shift);
-       clocksource_register(&mcftmr_clk);
+       clocksource_register_hz(&mcftmr_clk, FREQ);
 
        setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);
 
diff --git a/arch/microblaze/include/asm/memblock.h b/arch/microblaze/include/asm/memblock.h
deleted file mode 100644 (file)
index 20a8e25..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright (C) 2008 Michal Simek <monstr@monstr.eu>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#ifndef _ASM_MICROBLAZE_MEMBLOCK_H
-#define _ASM_MICROBLAZE_MEMBLOCK_H
-
-#endif /* _ASM_MICROBLAZE_MEMBLOCK_H */
-
-
index 95cc295976a73279878ddd103aeb6777c263c9a6..7dcb5bfffb75527a6875e7c41ed701d973d44c4c 100644 (file)
@@ -103,10 +103,12 @@ void cpu_idle(void)
                if (!idle)
                        idle = default_idle;
 
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched())
                        idle();
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
 
                preempt_enable_no_resched();
                schedule();
index 977484add216913f9073841c033ed4abe5b0bd9f..80d314e81901a2d3b0c27240af5f6ff07c3d99f7 100644 (file)
@@ -122,7 +122,6 @@ void __init early_init_devtree(void *params)
        of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
 
        /* Scan memory nodes and rebuild MEMBLOCKs */
-       memblock_init();
        of_scan_flat_dt(early_init_dt_scan_root, NULL);
        of_scan_flat_dt(early_init_dt_scan_memory, NULL);
 
@@ -130,7 +129,7 @@ void __init early_init_devtree(void *params)
        strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
        parse_early_param();
 
-       memblock_analyze();
+       memblock_allow_resize();
 
        pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size());
 
index d46f1da18a3c4ca587d16db23265b2aa557ceb1b..9c652eb68aaaed344950e143c05c8dbffc0f3409 100644 (file)
@@ -25,6 +25,9 @@ config MIPS
        select GENERIC_IRQ_SHOW
        select HAVE_ARCH_JUMP_LABEL
        select IRQ_FORCED_THREADING
+       select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
+       select ARCH_DISCARD_MEMBLOCK
 
 menu "Machine selection"
 
@@ -2064,9 +2067,6 @@ config ARCH_DISCONTIGMEM_ENABLE
          or have huge holes in the physical address space for other reasons.
          See <file:Documentation/vm/numa> for more.
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 config ARCH_SPARSEMEM_ENABLE
        bool
        select SPARSEMEM_STATIC
index c47f96e453c0fd4c2d3118b194ebed14134e6390..7955409051c479e1075fa424dd02f993731fbd53 100644 (file)
@@ -56,7 +56,8 @@ void __noreturn cpu_idle(void)
 
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched() && cpu_online(cpu)) {
 #ifdef CONFIG_MIPS_MT_SMTC
                        extern void smtc_idle_loop_hook(void);
@@ -77,7 +78,8 @@ void __noreturn cpu_idle(void)
                     system_state == SYSTEM_BOOTING))
                        play_dead();
 #endif
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 84af26ab221236d3a4077e76fea2497ae769a640..b1cb8f87d7b438186d50bd82ed955a20a165b6a8 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/ioport.h>
 #include <linux/export.h>
 #include <linux/screen_info.h>
+#include <linux/memblock.h>
 #include <linux/bootmem.h>
 #include <linux/initrd.h>
 #include <linux/root_dev.h>
@@ -352,7 +353,7 @@ static void __init bootmem_init(void)
                        continue;
 #endif
 
-               add_active_range(0, start, end);
+               memblock_add_node(PFN_PHYS(start), PFN_PHYS(end - start), 0);
        }
 
        /*
index bc1297109cc54e61487f3645f0237114c126e685..b105eca3c02042d2e9319bffce8b7dee68ad6b4c 100644 (file)
@@ -12,6 +12,7 @@
  */
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/memblock.h>
 #include <linux/mm.h>
 #include <linux/mmzone.h>
 #include <linux/module.h>
@@ -381,8 +382,8 @@ static void __init szmem(void)
                                continue;
                        }
                        num_physpages += slot_psize;
-                       add_active_range(node, slot_getbasepfn(node, slot),
-                                        slot_getbasepfn(node, slot) + slot_psize);
+                       memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)),
+                                         PFN_PHYS(slot_psize), node);
                }
        }
 }
diff --git a/arch/openrisc/include/asm/memblock.h b/arch/openrisc/include/asm/memblock.h
deleted file mode 100644 (file)
index bbe5a1c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- * et al.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_MEMBLOCK_H
-#define __ASM_OPENRISC_MEMBLOCK_H
-
-/* empty */
-
-#endif /* __ASM_OPENRISC_MEMBLOCK_H */
index d5bc5f813e89e5045c06634822d9772bacf1b4ae..e5fc788778306965c13615f90a0bccff84626402 100644 (file)
@@ -51,7 +51,8 @@ void cpu_idle(void)
 
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
 
                while (!need_resched()) {
                        check_pgt_cache();
@@ -69,7 +70,8 @@ void cpu_idle(void)
                        set_thread_flag(TIF_POLLING_NRFLAG);
                }
 
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 1bb58ba89afac44625778b49828ed6b599d3b23f..3d4478f6c94292f853a5bc225f772b7e498c7546 100644 (file)
@@ -76,14 +76,13 @@ void __init early_init_devtree(void *params)
        of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
 
        /* Scan memory nodes and rebuild MEMBLOCKs */
-       memblock_init();
        of_scan_flat_dt(early_init_dt_scan_root, NULL);
        of_scan_flat_dt(early_init_dt_scan_memory, NULL);
 
        /* Save command line for /proc/cmdline and then parse parameters */
        strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
 
-       memblock_analyze();
+       memblock_allow_resize();
 
        /* We must copy the flattend device tree from init memory to regular
         * memory because the device tree references the strings in it
index 45b7389d77aa5a18e1ce4adf883ff7c985b320cc..7c0774397b896a0e42450bf1dc0266ad903b67b1 100644 (file)
@@ -198,8 +198,6 @@ static struct clocksource clocksource_cr16 = {
        .rating                 = 300,
        .read                   = read_cr16,
        .mask                   = CLOCKSOURCE_MASK(BITS_PER_LONG),
-       .mult                   = 0, /* to be set */
-       .shift                  = 22,
        .flags                  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -270,7 +268,5 @@ void __init time_init(void)
 
        /* register at clocksource framework */
        current_cr16_khz = PAGE0->mem_10msec/10;  /* kHz */
-       clocksource_cr16.mult = clocksource_khz2mult(current_cr16_khz,
-                                               clocksource_cr16.shift);
-       clocksource_register(&clocksource_cr16);
+       clocksource_register_khz(&clocksource_cr16, current_cr16_khz);
 }
index 951e18f5335b268965d3880881d900bed63e7356..ead0bc68439dd7e2204d23e688a4fc319b20c84d 100644 (file)
@@ -117,6 +117,7 @@ config PPC
        select HAVE_KRETPROBES
        select HAVE_ARCH_TRACEHOOK
        select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_DMA_ATTRS
        select HAVE_DMA_API_DEBUG
        select USE_GENERIC_SMP_HELPERS if SMP
@@ -421,9 +422,6 @@ config ARCH_SPARSEMEM_DEFAULT
        def_bool y
        depends on (SMP && PPC_PSERIES) || PPC_PS3
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 config SYS_SUPPORTS_HUGETLBFS
        bool
 
index 1cf20bdfbecaada5bb2b88d439d776c32af2558c..6ec1c380a4d622ae7251c4d62cc0c14cf50d1a9d 100644 (file)
@@ -29,25 +29,8 @@ static inline void setup_cputime_one_jiffy(void) { }
 #include <asm/time.h>
 #include <asm/param.h>
 
-typedef u64 cputime_t;
-typedef u64 cputime64_t;
-
-#define cputime_zero                   ((cputime_t)0)
-#define cputime_max                    ((~((cputime_t)0) >> 1) - 1)
-#define cputime_add(__a, __b)          ((__a) +  (__b))
-#define cputime_sub(__a, __b)          ((__a) -  (__b))
-#define cputime_div(__a, __n)          ((__a) /  (__n))
-#define cputime_halve(__a)             ((__a) >> 1)
-#define cputime_eq(__a, __b)           ((__a) == (__b))
-#define cputime_gt(__a, __b)           ((__a) >  (__b))
-#define cputime_ge(__a, __b)           ((__a) >= (__b))
-#define cputime_lt(__a, __b)           ((__a) <  (__b))
-#define cputime_le(__a, __b)           ((__a) <= (__b))
-
-#define cputime64_zero                 ((cputime64_t)0)
-#define cputime64_add(__a, __b)                ((__a) + (__b))
-#define cputime64_sub(__a, __b)                ((__a) - (__b))
-#define cputime_to_cputime64(__ct)     (__ct)
+typedef u64 __nocast cputime_t;
+typedef u64 __nocast cputime64_t;
 
 #ifdef __KERNEL__
 
@@ -65,7 +48,7 @@ DECLARE_PER_CPU(unsigned long, cputime_scaled_last_delta);
 
 static inline unsigned long cputime_to_jiffies(const cputime_t ct)
 {
-       return mulhdu(ct, __cputime_jiffies_factor);
+       return mulhdu((__force u64) ct, __cputime_jiffies_factor);
 }
 
 /* Estimate the scaled cputime by scaling the real cputime based on
@@ -74,14 +57,15 @@ static inline cputime_t cputime_to_scaled(const cputime_t ct)
 {
        if (cpu_has_feature(CPU_FTR_SPURR) &&
            __get_cpu_var(cputime_last_delta))
-               return ct * __get_cpu_var(cputime_scaled_last_delta) /
-                           __get_cpu_var(cputime_last_delta);
+               return (__force u64) ct *
+                       __get_cpu_var(cputime_scaled_last_delta) /
+                       __get_cpu_var(cputime_last_delta);
        return ct;
 }
 
 static inline cputime_t jiffies_to_cputime(const unsigned long jif)
 {
-       cputime_t ct;
+       u64 ct;
        unsigned long sec;
 
        /* have to be a little careful about overflow */
@@ -93,7 +77,7 @@ static inline cputime_t jiffies_to_cputime(const unsigned long jif)
        }
        if (sec)
                ct += (cputime_t) sec * tb_ticks_per_sec;
-       return ct;
+       return (__force cputime_t) ct;
 }
 
 static inline void setup_cputime_one_jiffy(void)
@@ -103,7 +87,7 @@ static inline void setup_cputime_one_jiffy(void)
 
 static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
 {
-       cputime_t ct;
+       u64 ct;
        u64 sec;
 
        /* have to be a little careful about overflow */
@@ -114,13 +98,13 @@ static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
                do_div(ct, HZ);
        }
        if (sec)
-               ct += (cputime_t) sec * tb_ticks_per_sec;
-       return ct;
+               ct += (u64) sec * tb_ticks_per_sec;
+       return (__force cputime64_t) ct;
 }
 
 static inline u64 cputime64_to_jiffies64(const cputime_t ct)
 {
-       return mulhdu(ct, __cputime_jiffies_factor);
+       return mulhdu((__force u64) ct, __cputime_jiffies_factor);
 }
 
 /*
@@ -130,12 +114,12 @@ extern u64 __cputime_msec_factor;
 
 static inline unsigned long cputime_to_usecs(const cputime_t ct)
 {
-       return mulhdu(ct, __cputime_msec_factor) * USEC_PER_MSEC;
+       return mulhdu((__force u64) ct, __cputime_msec_factor) * USEC_PER_MSEC;
 }
 
 static inline cputime_t usecs_to_cputime(const unsigned long us)
 {
-       cputime_t ct;
+       u64 ct;
        unsigned long sec;
 
        /* have to be a little careful about overflow */
@@ -147,9 +131,11 @@ static inline cputime_t usecs_to_cputime(const unsigned long us)
        }
        if (sec)
                ct += (cputime_t) sec * tb_ticks_per_sec;
-       return ct;
+       return (__force cputime_t) ct;
 }
 
+#define usecs_to_cputime64(us)         usecs_to_cputime(us)
+
 /*
  * Convert cputime <-> seconds
  */
@@ -157,12 +143,12 @@ extern u64 __cputime_sec_factor;
 
 static inline unsigned long cputime_to_secs(const cputime_t ct)
 {
-       return mulhdu(ct, __cputime_sec_factor);
+       return mulhdu((__force u64) ct, __cputime_sec_factor);
 }
 
 static inline cputime_t secs_to_cputime(const unsigned long sec)
 {
-       return (cputime_t) sec * tb_ticks_per_sec;
+       return (__force cputime_t)((u64) sec * tb_ticks_per_sec);
 }
 
 /*
@@ -170,7 +156,7 @@ static inline cputime_t secs_to_cputime(const unsigned long sec)
  */
 static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p)
 {
-       u64 x = ct;
+       u64 x = (__force u64) ct;
        unsigned int frac;
 
        frac = do_div(x, tb_ticks_per_sec);
@@ -182,11 +168,11 @@ static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p)
 
 static inline cputime_t timespec_to_cputime(const struct timespec *p)
 {
-       cputime_t ct;
+       u64 ct;
 
        ct = (u64) p->tv_nsec * tb_ticks_per_sec;
        do_div(ct, 1000000000);
-       return ct + (u64) p->tv_sec * tb_ticks_per_sec;
+       return (__force cputime_t)(ct + (u64) p->tv_sec * tb_ticks_per_sec);
 }
 
 /*
@@ -194,7 +180,7 @@ static inline cputime_t timespec_to_cputime(const struct timespec *p)
  */
 static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p)
 {
-       u64 x = ct;
+       u64 x = (__force u64) ct;
        unsigned int frac;
 
        frac = do_div(x, tb_ticks_per_sec);
@@ -206,11 +192,11 @@ static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p)
 
 static inline cputime_t timeval_to_cputime(const struct timeval *p)
 {
-       cputime_t ct;
+       u64 ct;
 
        ct = (u64) p->tv_usec * tb_ticks_per_sec;
        do_div(ct, 1000000);
-       return ct + (u64) p->tv_sec * tb_ticks_per_sec;
+       return (__force cputime_t)(ct + (u64) p->tv_sec * tb_ticks_per_sec);
 }
 
 /*
@@ -220,12 +206,12 @@ extern u64 __cputime_clockt_factor;
 
 static inline unsigned long cputime_to_clock_t(const cputime_t ct)
 {
-       return mulhdu(ct, __cputime_clockt_factor);
+       return mulhdu((__force u64) ct, __cputime_clockt_factor);
 }
 
 static inline cputime_t clock_t_to_cputime(const unsigned long clk)
 {
-       cputime_t ct;
+       u64 ct;
        unsigned long sec;
 
        /* have to be a little careful about overflow */
@@ -236,8 +222,8 @@ static inline cputime_t clock_t_to_cputime(const unsigned long clk)
                do_div(ct, USER_HZ);
        }
        if (sec)
-               ct += (cputime_t) sec * tb_ticks_per_sec;
-       return ct;
+               ct += (u64) sec * tb_ticks_per_sec;
+       return (__force cputime_t) ct;
 }
 
 #define cputime64_to_clock_t(ct)       cputime_to_clock_t((cputime_t)(ct))
index d4df013ad77964353fdf5a59c8ed6afde4ed1ce2..69c7377d2071aa821fd1ff9529cafd4e49d10081 100644 (file)
@@ -381,39 +381,6 @@ static inline bool kvmppc_critical_section(struct kvm_vcpu *vcpu)
 }
 #endif
 
-static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
-                                            unsigned long pte_index)
-{
-       unsigned long rb, va_low;
-
-       rb = (v & ~0x7fUL) << 16;               /* AVA field */
-       va_low = pte_index >> 3;
-       if (v & HPTE_V_SECONDARY)
-               va_low = ~va_low;
-       /* xor vsid from AVA */
-       if (!(v & HPTE_V_1TB_SEG))
-               va_low ^= v >> 12;
-       else
-               va_low ^= v >> 24;
-       va_low &= 0x7ff;
-       if (v & HPTE_V_LARGE) {
-               rb |= 1;                        /* L field */
-               if (cpu_has_feature(CPU_FTR_ARCH_206) &&
-                   (r & 0xff000)) {
-                       /* non-16MB large page, must be 64k */
-                       /* (masks depend on page size) */
-                       rb |= 0x1000;           /* page encoding in LP field */
-                       rb |= (va_low & 0x7f) << 16; /* 7b of VA in AVA/LP field */
-                       rb |= (va_low & 0xfe);  /* AVAL field (P7 doesn't seem to care) */
-               }
-       } else {
-               /* 4kB page */
-               rb |= (va_low & 0x7ff) << 12;   /* remaining 11b of VA */
-       }
-       rb |= (v >> 54) & 0x300;                /* B field */
-       return rb;
-}
-
 /* Magic register values loaded into r3 and r4 before the 'sc' assembly
  * instruction for the OSI hypercalls */
 #define OSI_SC_MAGIC_R3                        0x113724FA
index e43fe42b9875308b49e13faa8a67ef91fe125200..d0ac94f98f9e3a2dcca21ff90631b841e4ab5060 100644 (file)
@@ -29,4 +29,37 @@ static inline struct kvmppc_book3s_shadow_vcpu *to_svcpu(struct kvm_vcpu *vcpu)
 
 #define SPAPR_TCE_SHIFT                12
 
+static inline unsigned long compute_tlbie_rb(unsigned long v, unsigned long r,
+                                            unsigned long pte_index)
+{
+       unsigned long rb, va_low;
+
+       rb = (v & ~0x7fUL) << 16;               /* AVA field */
+       va_low = pte_index >> 3;
+       if (v & HPTE_V_SECONDARY)
+               va_low = ~va_low;
+       /* xor vsid from AVA */
+       if (!(v & HPTE_V_1TB_SEG))
+               va_low ^= v >> 12;
+       else
+               va_low ^= v >> 24;
+       va_low &= 0x7ff;
+       if (v & HPTE_V_LARGE) {
+               rb |= 1;                        /* L field */
+               if (cpu_has_feature(CPU_FTR_ARCH_206) &&
+                   (r & 0xff000)) {
+                       /* non-16MB large page, must be 64k */
+                       /* (masks depend on page size) */
+                       rb |= 0x1000;           /* page encoding in LP field */
+                       rb |= (va_low & 0x7f) << 16; /* 7b of VA in AVA/LP field */
+                       rb |= (va_low & 0xfe);  /* AVAL field (P7 doesn't seem to care) */
+               }
+       } else {
+               /* 4kB page */
+               rb |= (va_low & 0x7ff) << 12;   /* remaining 11b of VA */
+       }
+       rb |= (v >> 54) & 0x300;                /* B field */
+       return rb;
+}
+
 #endif /* __ASM_KVM_BOOK3S_64_H__ */
diff --git a/arch/powerpc/include/asm/memblock.h b/arch/powerpc/include/asm/memblock.h
deleted file mode 100644 (file)
index 43efc34..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _ASM_POWERPC_MEMBLOCK_H
-#define _ASM_POWERPC_MEMBLOCK_H
-
-#include <asm/udbg.h>
-
-#define MEMBLOCK_DBG(fmt...) udbg_printf(fmt)
-
-#endif /* _ASM_POWERPC_MEMBLOCK_H */
index 39a2baa6ad58aec28a3c1d0782753569bbb51f6e..9c3cd490b1bd978bbde68327f103b73bfd1d0e6a 100644 (file)
@@ -46,6 +46,12 @@ static int __init powersave_off(char *arg)
 }
 __setup("powersave=off", powersave_off);
 
+#if defined(CONFIG_PPC_PSERIES) && defined(CONFIG_TRACEPOINTS)
+static const bool idle_uses_rcu = 1;
+#else
+static const bool idle_uses_rcu;
+#endif
+
 /*
  * The body of the idle task.
  */
@@ -56,7 +62,10 @@ void cpu_idle(void)
 
        set_thread_flag(TIF_POLLING_NRFLAG);
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               if (!idle_uses_rcu)
+                       rcu_idle_enter();
+
                while (!need_resched() && !cpu_should_die()) {
                        ppc64_runlatch_off();
 
@@ -93,7 +102,9 @@ void cpu_idle(void)
 
                HMT_medium();
                ppc64_runlatch_on();
-               tick_nohz_restart_sched_tick();
+               if (!idle_uses_rcu)
+                       rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                if (cpu_should_die())
                        cpu_die();
index 9ce1672afb59c1581151d1a83bc8a80b20586385..a2158a395d96a9c6121861c4084e2aeba29a2512 100644 (file)
@@ -107,9 +107,6 @@ void __init reserve_crashkernel(void)
        unsigned long long crash_size, crash_base;
        int ret;
 
-       /* this is necessary because of memblock_phys_mem_size() */
-       memblock_analyze();
-
        /* use common parsing */
        ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
                        &crash_size, &crash_base);
index fa1235b0503bd9fd0ae819afc94838d7f4905005..abe405dab34d88db0734db2f4cbab727ade30e1d 100644 (file)
@@ -733,8 +733,6 @@ void __init early_init_devtree(void *params)
        of_scan_flat_dt(early_init_dt_scan_chosen_ppc, cmd_line);
 
        /* Scan memory nodes and rebuild MEMBLOCKs */
-       memblock_init();
-
        of_scan_flat_dt(early_init_dt_scan_root, NULL);
        of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
 
@@ -756,20 +754,14 @@ void __init early_init_devtree(void *params)
        early_reserve_mem();
        phyp_dump_reserve_mem();
 
-       limit = memory_limit;
-       if (! limit) {
-               phys_addr_t memsize;
-
-               /* Ensure that total memory size is page-aligned, because
-                * otherwise mark_bootmem() gets upset. */
-               memblock_analyze();
-               memsize = memblock_phys_mem_size();
-               if ((memsize & PAGE_MASK) != memsize)
-                       limit = memsize & PAGE_MASK;
-       }
+       /*
+        * Ensure that total memory size is page-aligned, because otherwise
+        * mark_bootmem() gets upset.
+        */
+       limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
        memblock_enforce_memory_limit(limit);
 
-       memblock_analyze();
+       memblock_allow_resize();
        memblock_dump_all();
 
        DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
index 0cb137a9b0381f1175d5962c67aac18f566af662..336983da9e726c1e144b9a29be03934308800958 100644 (file)
@@ -538,7 +538,7 @@ static void kvmppc_start_thread(struct kvm_vcpu *vcpu)
        tpaca->kvm_hstate.napping = 0;
        vcpu->cpu = vc->pcpu;
        smp_wmb();
-#ifdef CONFIG_PPC_ICP_NATIVE
+#if defined(CONFIG_PPC_ICP_NATIVE) && defined(CONFIG_SMP)
        if (vcpu->arch.ptid) {
                tpaca->cpu_start = 0x80;
                wmb();
index 3c791e1eb675299c96e7b428b499e7bec4e5f434..e2cfb9e1e20ebdea21c726e946e1f37aef1c8c6f 100644 (file)
@@ -658,10 +658,12 @@ program_interrupt:
                        ulong cmd = kvmppc_get_gpr(vcpu, 3);
                        int i;
 
+#ifdef CONFIG_KVM_BOOK3S_64_PR
                        if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE) {
                                r = RESUME_GUEST;
                                break;
                        }
+#endif
 
                        run->papr_hcall.nr = cmd;
                        for (i = 0; i < 9; ++i) {
index 26d20903f2bc5c8cce1a94637f58ea9dea73a696..8c0d45a6faf7f49db9aef9c9a495c1ef20d155d8 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/kvm_host.h>
 #include <linux/slab.h>
 #include <linux/err.h>
+#include <linux/export.h>
 
 #include <asm/reg.h>
 #include <asm/cputable.h>
index 161cefde5c157823558aee1ae07b668f1a35510d..58861fa1220e12672980f4159eb94451ea26542e 100644 (file)
@@ -134,8 +134,7 @@ void __init MMU_init(void)
 
        if (memblock.memory.cnt > 1) {
 #ifndef CONFIG_WII
-               memblock.memory.cnt = 1;
-               memblock_analyze();
+               memblock_enforce_memory_limit(memblock.memory.regions[0].size);
                printk(KERN_WARNING "Only using first contiguous memory region");
 #else
                wii_memory_fixups();
@@ -158,7 +157,6 @@ void __init MMU_init(void)
 #ifndef CONFIG_HIGHMEM
                total_memory = total_lowmem;
                memblock_enforce_memory_limit(total_lowmem);
-               memblock_analyze();
 #endif /* CONFIG_HIGHMEM */
        }
 
index 2dd6bdd31fe14f77a0bc097f746ca59e790f0b0e..8e2eb6611b0bd4ece8c8d4003cf6d64b9ca6f238 100644 (file)
@@ -199,7 +199,7 @@ void __init do_init_bootmem(void)
                unsigned long start_pfn, end_pfn;
                start_pfn = memblock_region_memory_base_pfn(reg);
                end_pfn = memblock_region_memory_end_pfn(reg);
-               add_active_range(0, start_pfn, end_pfn);
+               memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
        }
 
        /* Add all physical memory to the bootmem map, mark each area
index b22a83a91cb852b92d023529e3f1b3bf011dce38..e6eea0ac80c8efcf2c87e5deb5e3805c89efb9a0 100644 (file)
@@ -127,45 +127,25 @@ static int __cpuinit fake_numa_create_new_node(unsigned long end_pfn,
 }
 
 /*
- * get_active_region_work_fn - A helper function for get_node_active_region
- *     Returns datax set to the start_pfn and end_pfn if they contain
- *     the initial value of datax->start_pfn between them
- * @start_pfn: start page(inclusive) of region to check
- * @end_pfn: end page(exclusive) of region to check
- * @datax: comes in with ->start_pfn set to value to search for and
- *     goes out with active range if it contains it
- * Returns 1 if search value is in range else 0
- */
-static int __init get_active_region_work_fn(unsigned long start_pfn,
-                                       unsigned long end_pfn, void *datax)
-{
-       struct node_active_region *data;
-       data = (struct node_active_region *)datax;
-
-       if (start_pfn <= data->start_pfn && end_pfn > data->start_pfn) {
-               data->start_pfn = start_pfn;
-               data->end_pfn = end_pfn;
-               return 1;
-       }
-       return 0;
-
-}
-
-/*
- * get_node_active_region - Return active region containing start_pfn
+ * get_node_active_region - Return active region containing pfn
  * Active range returned is empty if none found.
- * @start_pfn: The page to return the region for.
- * @node_ar: Returned set to the active region containing start_pfn
+ * @pfn: The page to return the region for
+ * @node_ar: Returned set to the active region containing @pfn
  */
-static void __init get_node_active_region(unsigned long start_pfn,
-                      struct node_active_region *node_ar)
+static void __init get_node_active_region(unsigned long pfn,
+                                         struct node_active_region *node_ar)
 {
-       int nid = early_pfn_to_nid(start_pfn);
+       unsigned long start_pfn, end_pfn;
+       int i, nid;
 
-       node_ar->nid = nid;
-       node_ar->start_pfn = start_pfn;
-       node_ar->end_pfn = start_pfn;
-       work_with_active_regions(nid, get_active_region_work_fn, node_ar);
+       for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
+               if (pfn >= start_pfn && pfn < end_pfn) {
+                       node_ar->nid = nid;
+                       node_ar->start_pfn = start_pfn;
+                       node_ar->end_pfn = end_pfn;
+                       break;
+               }
+       }
 }
 
 static void map_cpu_to_node(int cpu, int node)
@@ -710,9 +690,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
                        node_set_online(nid);
                        sz = numa_enforce_memory_limit(base, size);
                        if (sz)
-                               add_active_range(nid, base >> PAGE_SHIFT,
-                                                (base >> PAGE_SHIFT)
-                                                + (sz >> PAGE_SHIFT));
+                               memblock_set_node(base, sz, nid);
                } while (--ranges);
        }
 }
@@ -802,8 +780,7 @@ new_range:
                                continue;
                }
 
-               add_active_range(nid, start >> PAGE_SHIFT,
-                               (start >> PAGE_SHIFT) + (size >> PAGE_SHIFT));
+               memblock_set_node(start, size, nid);
 
                if (--ranges)
                        goto new_range;
@@ -839,7 +816,8 @@ static void __init setup_nonnuma(void)
                end_pfn = memblock_region_memory_end_pfn(reg);
 
                fake_numa_create_new_node(end_pfn, &nid);
-               add_active_range(nid, start_pfn, end_pfn);
+               memblock_set_node(PFN_PHYS(start_pfn),
+                                 PFN_PHYS(end_pfn - start_pfn), nid);
                node_set_online(nid);
        }
 }
index 4e13d6f9023e851a3f17ff240d9076030506c99e..573ba3b69d1f81aa7e2e1b75420fadfcd7c32888 100644 (file)
@@ -615,7 +615,6 @@ static void __early_init_mmu(int boot_cpu)
 
                /* limit memory so we dont have linear faults */
                memblock_enforce_memory_limit(linear_map_top);
-               memblock_analyze();
 
                patch_exception(0x1c0, exc_data_tlb_miss_bolted_book3e);
                patch_exception(0x1e0, exc_instruction_tlb_miss_bolted_book3e);
index 1b5dc1a2e1452abed0462c31879331514c94bdee..6d8dadf19f0b84e95cd58fbed9bfbdd1101f3126 100644 (file)
@@ -79,24 +79,19 @@ void __init wii_memory_fixups(void)
        BUG_ON(memblock.memory.cnt != 2);
        BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
 
-       p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE);
-       p[1].size = _ALIGN_DOWN(p[1].size, PAGE_SIZE);
+       /* trim unaligned tail */
+       memblock_remove(ALIGN(p[1].base + p[1].size, PAGE_SIZE),
+                       (phys_addr_t)ULLONG_MAX);
 
-       wii_hole_start = p[0].base + p[0].size;
+       /* determine hole, add & reserve them */
+       wii_hole_start = ALIGN(p[0].base + p[0].size, PAGE_SIZE);
        wii_hole_size = p[1].base - wii_hole_start;
-
-       pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
-       pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size);
-       pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size);
-
-       p[0].size += wii_hole_size + p[1].size;
-
-       memblock.memory.cnt = 1;
-       memblock_analyze();
-
-       /* reserve the hole */
+       memblock_add(wii_hole_start, wii_hole_size);
        memblock_reserve(wii_hole_start, wii_hole_size);
 
+       BUG_ON(memblock.memory.cnt != 1);
+       __memblock_dump_all();
+
        /* allow ioremapping the address space in the hole */
        __allow_ioremap_reserved = 1;
 }
index ea0acbd8966ddc846b5fb3b113f39190bb64d22d..8fc62586a973a8017179b90df32203aa36dea60f 100644 (file)
@@ -563,7 +563,8 @@ static void yield_shared_processor(void)
 static void iseries_shared_idle(void)
 {
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched() && !hvlpevent_is_pending()) {
                        local_irq_disable();
                        ppc64_runlatch_off();
@@ -577,7 +578,8 @@ static void iseries_shared_idle(void)
                }
 
                ppc64_runlatch_on();
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
 
                if (hvlpevent_is_pending())
                        process_iSeries_events();
@@ -593,7 +595,8 @@ static void iseries_dedicated_idle(void)
        set_thread_flag(TIF_POLLING_NRFLAG);
 
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                if (!need_resched()) {
                        while (!need_resched()) {
                                ppc64_runlatch_off();
@@ -610,7 +613,8 @@ static void iseries_dedicated_idle(void)
                }
 
                ppc64_runlatch_on();
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 72714ad278424a250c887e02635c3d5ef37b5979..8bd6ba542691e7674b29e275339b36e43539d5bc 100644 (file)
@@ -319,7 +319,6 @@ static int __init ps3_mm_add_memory(void)
        }
 
        memblock_add(start_addr, map.r1.size);
-       memblock_analyze();
 
        result = online_pages(start_pfn, nr_pages);
 
index 27a49508b410711beebff40be49524c28ee3bddc..52d429be6c764a4a9e27a9efa5c1a9c5c0e819af 100644 (file)
@@ -555,6 +555,8 @@ void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
 
        (*depth)++;
        trace_hcall_entry(opcode, args);
+       if (opcode == H_CEDE)
+               rcu_idle_enter();
        (*depth)--;
 
 out:
@@ -575,6 +577,8 @@ void __trace_hcall_exit(long opcode, unsigned long retval,
                goto out;
 
        (*depth)++;
+       if (opcode == H_CEDE)
+               rcu_idle_exit();
        trace_hcall_exit(opcode, retval, retbuf);
        (*depth)--;
 
index 373679b3744a7992c7009281c1747b3aeb38157a..d48ede33443477513925b7fac80b09674046d349 100644 (file)
@@ -92,6 +92,9 @@ config S390
        select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
        select HAVE_RCU_TABLE_FREE if SMP
        select ARCH_SAVE_PAGE_KEYS if HIBERNATION
+       select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
+       select ARCH_DISCARD_MEMBLOCK
        select ARCH_INLINE_SPIN_TRYLOCK
        select ARCH_INLINE_SPIN_TRYLOCK_BH
        select ARCH_INLINE_SPIN_LOCK
@@ -345,9 +348,6 @@ config WARN_DYNAMIC_STACK
 
          Say N if you are unsure.
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 comment "Kernel preemption"
 
 source "kernel/Kconfig.preempt"
index 92f1cb745d6946c603586820a4daed13b461d7a3..4de031d6b76cf8a8662d12f0c6858c590a3a70ba 100644 (file)
@@ -115,21 +115,21 @@ static void appldata_get_os_data(void *data)
        j = 0;
        for_each_online_cpu(i) {
                os_data->os_cpu[j].per_cpu_user =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.user);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_USER]);
                os_data->os_cpu[j].per_cpu_nice =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.nice);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_NICE]);
                os_data->os_cpu[j].per_cpu_system =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.system);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SYSTEM]);
                os_data->os_cpu[j].per_cpu_idle =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.idle);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IDLE]);
                os_data->os_cpu[j].per_cpu_irq =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.irq);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IRQ]);
                os_data->os_cpu[j].per_cpu_softirq =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.softirq);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_SOFTIRQ]);
                os_data->os_cpu[j].per_cpu_iowait =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.iowait);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_IOWAIT]);
                os_data->os_cpu[j].per_cpu_steal =
-                       cputime_to_jiffies(kstat_cpu(i).cpustat.steal);
+                       cputime_to_jiffies(kcpustat_cpu(i).cpustat[CPUTIME_STEAL]);
                os_data->os_cpu[j].cpu_id = i;
                j++;
        }
index 0814348782966ac99c571990c89975d06aedffe1..c23c3900c3040925f253b83900ca72b8cb2481f4 100644 (file)
 
 /* We want to use full resolution of the CPU timer: 2**-12 micro-seconds. */
 
-typedef unsigned long long cputime_t;
-typedef unsigned long long cputime64_t;
+typedef unsigned long long __nocast cputime_t;
+typedef unsigned long long __nocast cputime64_t;
 
-#ifndef __s390x__
-
-static inline unsigned int
-__div(unsigned long long n, unsigned int base)
+static inline unsigned long __div(unsigned long long n, unsigned long base)
 {
+#ifndef __s390x__
        register_pair rp;
 
        rp.pair = n >> 1;
        asm ("dr %0,%1" : "+d" (rp) : "d" (base >> 1));
        return rp.subreg.odd;
+#else /* __s390x__ */
+       return n / base;
+#endif /* __s390x__ */
 }
 
-#else /* __s390x__ */
+#define cputime_one_jiffy              jiffies_to_cputime(1)
+
+/*
+ * Convert cputime to jiffies and back.
+ */
+static inline unsigned long cputime_to_jiffies(const cputime_t cputime)
+{
+       return __div((__force unsigned long long) cputime, 4096000000ULL / HZ);
+}
 
-static inline unsigned int
-__div(unsigned long long n, unsigned int base)
+static inline cputime_t jiffies_to_cputime(const unsigned int jif)
 {
-       return n / base;
+       return (__force cputime_t)(jif * (4096000000ULL / HZ));
 }
 
-#endif /* __s390x__ */
+static inline u64 cputime64_to_jiffies64(cputime64_t cputime)
+{
+       unsigned long long jif = (__force unsigned long long) cputime;
+       do_div(jif, 4096000000ULL / HZ);
+       return jif;
+}
 
-#define cputime_zero                   (0ULL)
-#define cputime_one_jiffy              jiffies_to_cputime(1)
-#define cputime_max                    ((~0UL >> 1) - 1)
-#define cputime_add(__a, __b)          ((__a) +  (__b))
-#define cputime_sub(__a, __b)          ((__a) -  (__b))
-#define cputime_div(__a, __n) ({               \
-       unsigned long long __div = (__a);       \
-       do_div(__div,__n);                      \
-       __div;                                  \
-})
-#define cputime_halve(__a)             ((__a) >> 1)
-#define cputime_eq(__a, __b)           ((__a) == (__b))
-#define cputime_gt(__a, __b)           ((__a) >  (__b))
-#define cputime_ge(__a, __b)           ((__a) >= (__b))
-#define cputime_lt(__a, __b)           ((__a) <  (__b))
-#define cputime_le(__a, __b)           ((__a) <= (__b))
-#define cputime_to_jiffies(__ct)       (__div((__ct), 4096000000ULL / HZ))
-#define cputime_to_scaled(__ct)                (__ct)
-#define jiffies_to_cputime(__hz)       ((cputime_t)(__hz) * (4096000000ULL / HZ))
-
-#define cputime64_zero                 (0ULL)
-#define cputime64_add(__a, __b)                ((__a) + (__b))
-#define cputime_to_cputime64(__ct)     (__ct)
-
-static inline u64
-cputime64_to_jiffies64(cputime64_t cputime)
-{
-       do_div(cputime, 4096000000ULL / HZ);
-       return cputime;
+static inline cputime64_t jiffies64_to_cputime64(const u64 jif)
+{
+       return (__force cputime64_t)(jif * (4096000000ULL / HZ));
 }
 
 /*
  * Convert cputime to microseconds and back.
  */
-static inline unsigned int
-cputime_to_usecs(const cputime_t cputime)
+static inline unsigned int cputime_to_usecs(const cputime_t cputime)
 {
-       return cputime_div(cputime, 4096);
+       return (__force unsigned long long) cputime >> 12;
 }
 
-static inline cputime_t
-usecs_to_cputime(const unsigned int m)
+static inline cputime_t usecs_to_cputime(const unsigned int m)
 {
-       return (cputime_t) m * 4096;
+       return (__force cputime_t)(m * 4096ULL);
 }
 
+#define usecs_to_cputime64(m)          usecs_to_cputime(m)
+
 /*
  * Convert cputime to milliseconds and back.
  */
-static inline unsigned int
-cputime_to_secs(const cputime_t cputime)
+static inline unsigned int cputime_to_secs(const cputime_t cputime)
 {
-       return __div(cputime, 2048000000) >> 1;
+       return __div((__force unsigned long long) cputime, 2048000000) >> 1;
 }
 
-static inline cputime_t
-secs_to_cputime(const unsigned int s)
+static inline cputime_t secs_to_cputime(const unsigned int s)
 {
-       return (cputime_t) s * 4096000000ULL;
+       return (__force cputime_t)(s * 4096000000ULL);
 }
 
 /*
  * Convert cputime to timespec and back.
  */
-static inline cputime_t
-timespec_to_cputime(const struct timespec *value)
+static inline cputime_t timespec_to_cputime(const struct timespec *value)
 {
-       return value->tv_nsec * 4096 / 1000 + (u64) value->tv_sec * 4096000000ULL;
+       unsigned long long ret = value->tv_sec * 4096000000ULL;
+       return (__force cputime_t)(ret + value->tv_nsec * 4096 / 1000);
 }
 
-static inline void
-cputime_to_timespec(const cputime_t cputime, struct timespec *value)
+static inline void cputime_to_timespec(const cputime_t cputime,
+                                      struct timespec *value)
 {
+       unsigned long long __cputime = (__force unsigned long long) cputime;
 #ifndef __s390x__
        register_pair rp;
 
-       rp.pair = cputime >> 1;
+       rp.pair = __cputime >> 1;
        asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL));
        value->tv_nsec = rp.subreg.even * 1000 / 4096;
        value->tv_sec = rp.subreg.odd;
 #else
-       value->tv_nsec = (cputime % 4096000000ULL) * 1000 / 4096;
-       value->tv_sec = cputime / 4096000000ULL;
+       value->tv_nsec = (__cputime % 4096000000ULL) * 1000 / 4096;
+       value->tv_sec = __cputime / 4096000000ULL;
 #endif
 }
 
@@ -132,50 +118,52 @@ cputime_to_timespec(const cputime_t cputime, struct timespec *value)
  * Since cputime and timeval have the same resolution (microseconds)
  * this is easy.
  */
-static inline cputime_t
-timeval_to_cputime(const struct timeval *value)
+static inline cputime_t timeval_to_cputime(const struct timeval *value)
 {
-       return value->tv_usec * 4096 + (u64) value->tv_sec * 4096000000ULL;
+       unsigned long long ret = value->tv_sec * 4096000000ULL;
+       return (__force cputime_t)(ret + value->tv_usec * 4096ULL);
 }
 
-static inline void
-cputime_to_timeval(const cputime_t cputime, struct timeval *value)
+static inline void cputime_to_timeval(const cputime_t cputime,
+                                     struct timeval *value)
 {
+       unsigned long long __cputime = (__force unsigned long long) cputime;
 #ifndef __s390x__
        register_pair rp;
 
-       rp.pair = cputime >> 1;
+       rp.pair = __cputime >> 1;
        asm ("dr %0,%1" : "+d" (rp) : "d" (2048000000UL));
        value->tv_usec = rp.subreg.even / 4096;
        value->tv_sec = rp.subreg.odd;
 #else
-       value->tv_usec = (cputime % 4096000000ULL) / 4096;
-       value->tv_sec = cputime / 4096000000ULL;
+       value->tv_usec = (__cputime % 4096000000ULL) / 4096;
+       value->tv_sec = __cputime / 4096000000ULL;
 #endif
 }
 
 /*
  * Convert cputime to clock and back.
  */
-static inline clock_t
-cputime_to_clock_t(cputime_t cputime)
+static inline clock_t cputime_to_clock_t(cputime_t cputime)
 {
-       return cputime_div(cputime, 4096000000ULL / USER_HZ);
+       unsigned long long clock = (__force unsigned long long) cputime;
+       do_div(clock, 4096000000ULL / USER_HZ);
+       return clock;
 }
 
-static inline cputime_t
-clock_t_to_cputime(unsigned long x)
+static inline cputime_t clock_t_to_cputime(unsigned long x)
 {
-       return (cputime_t) x * (4096000000ULL / USER_HZ);
+       return (__force cputime_t)(x * (4096000000ULL / USER_HZ));
 }
 
 /*
  * Convert cputime64 to clock.
  */
-static inline clock_t
-cputime64_to_clock_t(cputime64_t cputime)
+static inline clock_t cputime64_to_clock_t(cputime64_t cputime)
 {
-       return cputime_div(cputime, 4096000000ULL / USER_HZ);
+       unsigned long long clock = (__force unsigned long long) cputime;
+       do_div(clock, 4096000000ULL / USER_HZ);
+       return clock;
 }
 
 struct s390_idle_data {
index 9451b210a1b4f17e180ea0332b1108e154feaf87..3201ae447990c50052d7536d079e39286a77120d 100644 (file)
@@ -91,10 +91,12 @@ static void default_idle(void)
 void cpu_idle(void)
 {
        for (;;) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched())
                        default_idle();
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index e54c4ff8abaaa3d1a34efd34decd0d12c713e4ef..f11d1b037c50d31c48573730c8354dee330f8be0 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
+#include <linux/memblock.h>
 #include <linux/mm.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
@@ -820,7 +821,8 @@ setup_memory(void)
                end_chunk = min(end_chunk, end_pfn);
                if (start_chunk >= end_chunk)
                        continue;
-               add_active_range(0, start_chunk, end_chunk);
+               memblock_add_node(PFN_PHYS(start_chunk),
+                                 PFN_PHYS(end_chunk - start_chunk), 0);
                pfn = max(start_chunk, start_pfn);
                for (; pfn < end_chunk; pfn++)
                        page_set_storage_key(PFN_PHYS(pfn),
index f43c0e4282af5e46033b4a97349cf1fce4d88c26..9daee91e6c3fc20f8668a1797a8d388c102b62aa 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/irq.h>
 
 #include "hwsampler.h"
+#include "op_counter.h"
 
 #define MAX_NUM_SDB 511
 #define MIN_NUM_SDB 1
@@ -896,6 +897,8 @@ static void add_samples_to_oprofile(unsigned int cpu, unsigned long *sdbt,
                if (sample_data_ptr->P == 1) {
                        /* userspace sample */
                        unsigned int pid = sample_data_ptr->prim_asn;
+                       if (!counter_config.user)
+                               goto skip_sample;
                        rcu_read_lock();
                        tsk = pid_task(find_vpid(pid), PIDTYPE_PID);
                        if (tsk)
@@ -903,6 +906,8 @@ static void add_samples_to_oprofile(unsigned int cpu, unsigned long *sdbt,
                        rcu_read_unlock();
                } else {
                        /* kernelspace sample */
+                       if (!counter_config.kernel)
+                               goto skip_sample;
                        regs = task_pt_regs(current);
                }
 
@@ -910,7 +915,7 @@ static void add_samples_to_oprofile(unsigned int cpu, unsigned long *sdbt,
                oprofile_add_ext_hw_sample(sample_data_ptr->ia, regs, 0,
                                !sample_data_ptr->P, tsk);
                mutex_unlock(&hws_sem);
-
+       skip_sample:
                sample_data_ptr++;
        }
 }
index bd58b72454cf52c62b76bc049547931c74e020e6..2297be406c61a5d78d473a2890bb755715a8f210 100644 (file)
@@ -2,10 +2,11 @@
  * arch/s390/oprofile/init.c
  *
  * S390 Version
- *   Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *   Copyright (C) 2002-2011 IBM Deutschland Entwicklung GmbH, IBM Corporation
  *   Author(s): Thomas Spatzier (tspat@de.ibm.com)
  *   Author(s): Mahesh Salgaonkar (mahesh@linux.vnet.ibm.com)
  *   Author(s): Heinz Graalfs (graalfs@linux.vnet.ibm.com)
+ *   Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com)
  *
  * @remark Copyright 2002-2011 OProfile authors
  */
@@ -14,6 +15,8 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
+#include <linux/module.h>
+#include <asm/processor.h>
 
 #include "../../../drivers/oprofile/oprof.h"
 
@@ -22,6 +25,7 @@ extern void s390_backtrace(struct pt_regs * const regs, unsigned int depth);
 #ifdef CONFIG_64BIT
 
 #include "hwsampler.h"
+#include "op_counter.h"
 
 #define DEFAULT_INTERVAL       4127518
 
@@ -35,16 +39,41 @@ static unsigned long oprofile_max_interval;
 static unsigned long oprofile_sdbt_blocks = DEFAULT_SDBT_BLOCKS;
 static unsigned long oprofile_sdb_blocks = DEFAULT_SDB_BLOCKS;
 
-static int hwsampler_file;
+static int hwsampler_enabled;
 static int hwsampler_running;  /* start_mutex must be held to change */
+static int hwsampler_available;
 
 static struct oprofile_operations timer_ops;
 
+struct op_counter_config counter_config;
+
+enum __force_cpu_type {
+       reserved = 0,           /* do not force */
+       timer,
+};
+static int force_cpu_type;
+
+static int set_cpu_type(const char *str, struct kernel_param *kp)
+{
+       if (!strcmp(str, "timer")) {
+               force_cpu_type = timer;
+               printk(KERN_INFO "oprofile: forcing timer to be returned "
+                                "as cpu type\n");
+       } else {
+               force_cpu_type = 0;
+       }
+
+       return 0;
+}
+module_param_call(cpu_type, set_cpu_type, NULL, NULL, 0);
+MODULE_PARM_DESC(cpu_type, "Force legacy basic mode sampling"
+                          "(report cpu_type \"timer\"");
+
 static int oprofile_hwsampler_start(void)
 {
        int retval;
 
-       hwsampler_running = hwsampler_file;
+       hwsampler_running = hwsampler_enabled;
 
        if (!hwsampler_running)
                return timer_ops.start();
@@ -72,10 +101,16 @@ static void oprofile_hwsampler_stop(void)
        return;
 }
 
+/*
+ * File ops used for:
+ * /dev/oprofile/0/enabled
+ * /dev/oprofile/hwsampling/hwsampler  (cpu_type = timer)
+ */
+
 static ssize_t hwsampler_read(struct file *file, char __user *buf,
                size_t count, loff_t *offset)
 {
-       return oprofilefs_ulong_to_user(hwsampler_file, buf, count, offset);
+       return oprofilefs_ulong_to_user(hwsampler_enabled, buf, count, offset);
 }
 
 static ssize_t hwsampler_write(struct file *file, char const __user *buf,
@@ -91,6 +126,9 @@ static ssize_t hwsampler_write(struct file *file, char const __user *buf,
        if (retval <= 0)
                return retval;
 
+       if (val != 0 && val != 1)
+               return -EINVAL;
+
        if (oprofile_started)
                /*
                 * save to do without locking as we set
@@ -99,7 +137,7 @@ static ssize_t hwsampler_write(struct file *file, char const __user *buf,
                 */
                return -EBUSY;
 
-       hwsampler_file = val;
+       hwsampler_enabled = val;
 
        return count;
 }
@@ -109,38 +147,311 @@ static const struct file_operations hwsampler_fops = {
        .write          = hwsampler_write,
 };
 
+/*
+ * File ops used for:
+ * /dev/oprofile/0/count
+ * /dev/oprofile/hwsampling/hw_interval  (cpu_type = timer)
+ *
+ * Make sure that the value is within the hardware range.
+ */
+
+static ssize_t hw_interval_read(struct file *file, char __user *buf,
+                               size_t count, loff_t *offset)
+{
+       return oprofilefs_ulong_to_user(oprofile_hw_interval, buf,
+                                       count, offset);
+}
+
+static ssize_t hw_interval_write(struct file *file, char const __user *buf,
+                                size_t count, loff_t *offset)
+{
+       unsigned long val;
+       int retval;
+
+       if (*offset)
+               return -EINVAL;
+       retval = oprofilefs_ulong_from_user(&val, buf, count);
+       if (retval)
+               return retval;
+       if (val < oprofile_min_interval)
+               oprofile_hw_interval = oprofile_min_interval;
+       else if (val > oprofile_max_interval)
+               oprofile_hw_interval = oprofile_max_interval;
+       else
+               oprofile_hw_interval = val;
+
+       return count;
+}
+
+static const struct file_operations hw_interval_fops = {
+       .read           = hw_interval_read,
+       .write          = hw_interval_write,
+};
+
+/*
+ * File ops used for:
+ * /dev/oprofile/0/event
+ * Only a single event with number 0 is supported with this counter.
+ *
+ * /dev/oprofile/0/unit_mask
+ * This is a dummy file needed by the user space tools.
+ * No value other than 0 is accepted or returned.
+ */
+
+static ssize_t hwsampler_zero_read(struct file *file, char __user *buf,
+                                   size_t count, loff_t *offset)
+{
+       return oprofilefs_ulong_to_user(0, buf, count, offset);
+}
+
+static ssize_t hwsampler_zero_write(struct file *file, char const __user *buf,
+                                    size_t count, loff_t *offset)
+{
+       unsigned long val;
+       int retval;
+
+       if (*offset)
+               return -EINVAL;
+
+       retval = oprofilefs_ulong_from_user(&val, buf, count);
+       if (retval)
+               return retval;
+       if (val != 0)
+               return -EINVAL;
+       return count;
+}
+
+static const struct file_operations zero_fops = {
+       .read           = hwsampler_zero_read,
+       .write          = hwsampler_zero_write,
+};
+
+/* /dev/oprofile/0/kernel file ops.  */
+
+static ssize_t hwsampler_kernel_read(struct file *file, char __user *buf,
+                                    size_t count, loff_t *offset)
+{
+       return oprofilefs_ulong_to_user(counter_config.kernel,
+                                       buf, count, offset);
+}
+
+static ssize_t hwsampler_kernel_write(struct file *file, char const __user *buf,
+                                     size_t count, loff_t *offset)
+{
+       unsigned long val;
+       int retval;
+
+       if (*offset)
+               return -EINVAL;
+
+       retval = oprofilefs_ulong_from_user(&val, buf, count);
+       if (retval)
+               return retval;
+
+       if (val != 0 && val != 1)
+               return -EINVAL;
+
+       counter_config.kernel = val;
+
+       return count;
+}
+
+static const struct file_operations kernel_fops = {
+       .read           = hwsampler_kernel_read,
+       .write          = hwsampler_kernel_write,
+};
+
+/* /dev/oprofile/0/user file ops. */
+
+static ssize_t hwsampler_user_read(struct file *file, char __user *buf,
+                                  size_t count, loff_t *offset)
+{
+       return oprofilefs_ulong_to_user(counter_config.user,
+                                       buf, count, offset);
+}
+
+static ssize_t hwsampler_user_write(struct file *file, char const __user *buf,
+                                   size_t count, loff_t *offset)
+{
+       unsigned long val;
+       int retval;
+
+       if (*offset)
+               return -EINVAL;
+
+       retval = oprofilefs_ulong_from_user(&val, buf, count);
+       if (retval)
+               return retval;
+
+       if (val != 0 && val != 1)
+               return -EINVAL;
+
+       counter_config.user = val;
+
+       return count;
+}
+
+static const struct file_operations user_fops = {
+       .read           = hwsampler_user_read,
+       .write          = hwsampler_user_write,
+};
+
+
+/*
+ * File ops used for: /dev/oprofile/timer/enabled
+ * The value always has to be the inverted value of hwsampler_enabled. So
+ * no separate variable is created. That way we do not need locking.
+ */
+
+static ssize_t timer_enabled_read(struct file *file, char __user *buf,
+                                 size_t count, loff_t *offset)
+{
+       return oprofilefs_ulong_to_user(!hwsampler_enabled, buf, count, offset);
+}
+
+static ssize_t timer_enabled_write(struct file *file, char const __user *buf,
+                                  size_t count, loff_t *offset)
+{
+       unsigned long val;
+       int retval;
+
+       if (*offset)
+               return -EINVAL;
+
+       retval = oprofilefs_ulong_from_user(&val, buf, count);
+       if (retval)
+               return retval;
+
+       if (val != 0 && val != 1)
+               return -EINVAL;
+
+       /* Timer cannot be disabled without having hardware sampling.  */
+       if (val == 0 && !hwsampler_available)
+               return -EINVAL;
+
+       if (oprofile_started)
+               /*
+                * save to do without locking as we set
+                * hwsampler_running in start() when start_mutex is
+                * held
+                */
+               return -EBUSY;
+
+       hwsampler_enabled = !val;
+
+       return count;
+}
+
+static const struct file_operations timer_enabled_fops = {
+       .read           = timer_enabled_read,
+       .write          = timer_enabled_write,
+};
+
+
 static int oprofile_create_hwsampling_files(struct super_block *sb,
-                                               struct dentry *root)
+                                           struct dentry *root)
 {
-       struct dentry *hw_dir;
+       struct dentry *dir;
+
+       dir = oprofilefs_mkdir(sb, root, "timer");
+       if (!dir)
+               return -EINVAL;
+
+       oprofilefs_create_file(sb, dir, "enabled", &timer_enabled_fops);
+
+       if (!hwsampler_available)
+               return 0;
 
        /* reinitialize default values */
-       hwsampler_file = 1;
+       hwsampler_enabled = 1;
+       counter_config.kernel = 1;
+       counter_config.user = 1;
 
-       hw_dir = oprofilefs_mkdir(sb, root, "hwsampling");
-       if (!hw_dir)
-               return -EINVAL;
+       if (!force_cpu_type) {
+               /*
+                * Create the counter file system.  A single virtual
+                * counter is created which can be used to
+                * enable/disable hardware sampling dynamically from
+                * user space.  The user space will configure a single
+                * counter with a single event.  The value of 'event'
+                * and 'unit_mask' are not evaluated by the kernel code
+                * and can only be set to 0.
+                */
+
+               dir = oprofilefs_mkdir(sb, root, "0");
+               if (!dir)
+                       return -EINVAL;
 
-       oprofilefs_create_file(sb, hw_dir, "hwsampler", &hwsampler_fops);
-       oprofilefs_create_ulong(sb, hw_dir, "hw_interval",
-                               &oprofile_hw_interval);
-       oprofilefs_create_ro_ulong(sb, hw_dir, "hw_min_interval",
-                               &oprofile_min_interval);
-       oprofilefs_create_ro_ulong(sb, hw_dir, "hw_max_interval",
-                               &oprofile_max_interval);
-       oprofilefs_create_ulong(sb, hw_dir, "hw_sdbt_blocks",
-                               &oprofile_sdbt_blocks);
+               oprofilefs_create_file(sb, dir, "enabled", &hwsampler_fops);
+               oprofilefs_create_file(sb, dir, "event", &zero_fops);
+               oprofilefs_create_file(sb, dir, "count", &hw_interval_fops);
+               oprofilefs_create_file(sb, dir, "unit_mask", &zero_fops);
+               oprofilefs_create_file(sb, dir, "kernel", &kernel_fops);
+               oprofilefs_create_file(sb, dir, "user", &user_fops);
+               oprofilefs_create_ulong(sb, dir, "hw_sdbt_blocks",
+                                       &oprofile_sdbt_blocks);
 
+       } else {
+               /*
+                * Hardware sampling can be used but the cpu_type is
+                * forced to timer in order to deal with legacy user
+                * space tools.  The /dev/oprofile/hwsampling fs is
+                * provided in that case.
+                */
+               dir = oprofilefs_mkdir(sb, root, "hwsampling");
+               if (!dir)
+                       return -EINVAL;
+
+               oprofilefs_create_file(sb, dir, "hwsampler",
+                                      &hwsampler_fops);
+               oprofilefs_create_file(sb, dir, "hw_interval",
+                                      &hw_interval_fops);
+               oprofilefs_create_ro_ulong(sb, dir, "hw_min_interval",
+                                          &oprofile_min_interval);
+               oprofilefs_create_ro_ulong(sb, dir, "hw_max_interval",
+                                          &oprofile_max_interval);
+               oprofilefs_create_ulong(sb, dir, "hw_sdbt_blocks",
+                                       &oprofile_sdbt_blocks);
+       }
        return 0;
 }
 
 static int oprofile_hwsampler_init(struct oprofile_operations *ops)
 {
+       /*
+        * Initialize the timer mode infrastructure as well in order
+        * to be able to switch back dynamically.  oprofile_timer_init
+        * is not supposed to fail.
+        */
+       if (oprofile_timer_init(ops))
+               BUG();
+
+       memcpy(&timer_ops, ops, sizeof(timer_ops));
+       ops->create_files = oprofile_create_hwsampling_files;
+
+       /*
+        * If the user space tools do not support newer cpu types,
+        * the force_cpu_type module parameter
+        * can be used to always return \"timer\" as cpu type.
+        */
+       if (force_cpu_type != timer) {
+               struct cpuid id;
+
+               get_cpu_id (&id);
+
+               switch (id.machine) {
+               case 0x2097: case 0x2098: ops->cpu_type = "s390/z10"; break;
+               case 0x2817: case 0x2818: ops->cpu_type = "s390/z196"; break;
+               default: return -ENODEV;
+               }
+       }
+
        if (hwsampler_setup())
                return -ENODEV;
 
        /*
-        * create hwsampler files only if hwsampler_setup() succeeds.
+        * Query the range for the sampling interval from the
+        * hardware.
         */
        oprofile_min_interval = hwsampler_query_min_interval();
        if (oprofile_min_interval == 0)
@@ -155,23 +466,17 @@ static int oprofile_hwsampler_init(struct oprofile_operations *ops)
        if (oprofile_hw_interval > oprofile_max_interval)
                oprofile_hw_interval = oprofile_max_interval;
 
-       if (oprofile_timer_init(ops))
-               return -ENODEV;
-
-       printk(KERN_INFO "oprofile: using hardware sampling\n");
-
-       memcpy(&timer_ops, ops, sizeof(timer_ops));
+       printk(KERN_INFO "oprofile: System z hardware sampling "
+              "facility found.\n");
 
        ops->start = oprofile_hwsampler_start;
        ops->stop = oprofile_hwsampler_stop;
-       ops->create_files = oprofile_create_hwsampling_files;
 
        return 0;
 }
 
 static void oprofile_hwsampler_exit(void)
 {
-       oprofile_timer_exit();
        hwsampler_shutdown();
 }
 
@@ -182,7 +487,15 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        ops->backtrace = s390_backtrace;
 
 #ifdef CONFIG_64BIT
-       return oprofile_hwsampler_init(ops);
+
+       /*
+        * -ENODEV is not reported to the caller.  The module itself
+         * will use the timer mode sampling as fallback and this is
+         * always available.
+        */
+       hwsampler_available = oprofile_hwsampler_init(ops) == 0;
+
+       return 0;
 #else
        return -ENODEV;
 #endif
diff --git a/arch/s390/oprofile/op_counter.h b/arch/s390/oprofile/op_counter.h
new file mode 100644 (file)
index 0000000..1a8d3ca
--- /dev/null
@@ -0,0 +1,23 @@
+/**
+ * arch/s390/oprofile/op_counter.h
+ *
+ *   Copyright (C) 2011 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *   Author(s): Andreas Krebbel (krebbel@linux.vnet.ibm.com)
+ *
+ * @remark Copyright 2011 OProfile authors
+ */
+
+#ifndef OP_COUNTER_H
+#define OP_COUNTER_H
+
+struct op_counter_config {
+       /* `enabled' maps to the hwsampler_file variable.  */
+       /* `count' maps to the oprofile_hw_interval variable.  */
+       /* `event' and `unit_mask' are unused. */
+       unsigned long kernel;
+       unsigned long user;
+};
+
+extern struct op_counter_config counter_config;
+
+#endif /* OP_COUNTER_H */
index df169e84db4ed689361431c2044512af1289557b..8b0c9464aa9d10ece5562bad884969665ee6f348 100644 (file)
@@ -4,6 +4,9 @@ config SCORE
        def_bool y
        select HAVE_GENERIC_HARDIRQS
        select GENERIC_IRQ_SHOW
+       select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
+       select ARCH_DISCARD_MEMBLOCK
 
 choice
        prompt "System type"
@@ -60,9 +63,6 @@ config 32BIT
 config ARCH_FLATMEM_ENABLE
        def_bool y
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 source "mm/Kconfig"
 
 config MEMORY_START
index 6f898c0578781cf0862863d6e23a931c60b12c17..b48459afefddb835582e548f5b8d7b4ffd026e0d 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/bootmem.h>
 #include <linux/initrd.h>
 #include <linux/ioport.h>
+#include <linux/memblock.h>
 #include <linux/mm.h>
 #include <linux/seq_file.h>
 #include <linux/screen_info.h>
@@ -54,7 +55,8 @@ static void __init bootmem_init(void)
        /* Initialize the boot-time allocator with low memory only. */
        bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
                                         min_low_pfn, max_low_pfn);
-       add_active_range(0, min_low_pfn, max_low_pfn);
+       memblock_add_node(PFN_PHYS(min_low_pfn),
+                         PFN_PHYS(max_low_pfn - min_low_pfn), 0);
 
        free_bootmem(PFN_PHYS(start_pfn),
                     (max_low_pfn - start_pfn) << PAGE_SHIFT);
index 5629e2099130aeee5c24d7c08f9705d48550e995..47a2f1c2cb0d4d63bf914d1e3f644111fe628276 100644 (file)
@@ -4,6 +4,7 @@ config SUPERH
        select CLKDEV_LOOKUP
        select HAVE_IDE if HAS_IOPORT
        select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_OPROFILE
        select HAVE_GENERIC_DMA_COHERENT
        select HAVE_ARCH_TRACEHOOK
diff --git a/arch/sh/include/asm/memblock.h b/arch/sh/include/asm/memblock.h
deleted file mode 100644 (file)
index e87063f..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __ASM_SH_MEMBLOCK_H
-#define __ASM_SH_MEMBLOCK_H
-
-#endif /* __ASM_SH_MEMBLOCK_H */
index db4ecd731a003792783ddbc524fcc60f020d4bf7..406508d4ce742d1cffb375dfdd1bee911b6adf76 100644 (file)
@@ -89,7 +89,8 @@ void cpu_idle(void)
 
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
 
                while (!need_resched()) {
                        check_pgt_cache();
@@ -111,7 +112,8 @@ void cpu_idle(void)
                        start_critical_timings();
                }
 
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index c5a33f007f886b571443a96d5c4c4f30847269ef..9fea49f6e667c9b4093bfaa6c59f725375b9760d 100644 (file)
@@ -157,9 +157,6 @@ void __init reserve_crashkernel(void)
        unsigned long long crash_size, crash_base;
        int ret;
 
-       /* this is necessary because of memblock_phys_mem_size() */
-       memblock_analyze();
-
        ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
                        &crash_size, &crash_base);
        if (ret == 0 && crash_size > 0) {
index 1a0e946679a4d799038f4051811a8c0390156357..7b57bf1dc85510c08b40a9f88892ffacbf78c379 100644 (file)
@@ -230,7 +230,8 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
        pmb_bolt_mapping((unsigned long)__va(start), start, end - start,
                         PAGE_KERNEL);
 
-       add_active_range(nid, start_pfn, end_pfn);
+       memblock_set_node(PFN_PHYS(start_pfn),
+                         PFN_PHYS(end_pfn - start_pfn), nid);
 }
 
 void __init __weak plat_early_device_setup(void)
index c3e61b36649380f5db818c5f6edb05bfc897de1c..cb8f9920f4dd873b69050e81c4a46fc7e40f5007 100644 (file)
@@ -143,9 +143,6 @@ config MAX_ACTIVE_REGIONS
                       CPU_SUBTYPE_SH7785)
        default "1"
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 config ARCH_SELECT_MEMORY_MODEL
        def_bool y
 
index 939ca0f356f6a79bd7ee34905dd42b96533ac7bc..82cc576fab1572e62d2b48e20f3a972618d06dae 100644 (file)
@@ -324,7 +324,6 @@ void __init paging_init(void)
        unsigned long vaddr, end;
        int nid;
 
-       memblock_init();
        sh_mv.mv_mem_init();
 
        early_reserve_mem();
@@ -337,7 +336,7 @@ void __init paging_init(void)
                sh_mv.mv_mem_reserve();
 
        memblock_enforce_memory_limit(memory_limit);
-       memblock_analyze();
+       memblock_allow_resize();
 
        memblock_dump_all();
 
index b4c2d2b946ddc084bfe48b2d58128d47e2f724aa..e4dd5d5a111506889b5a69284355721fc23c80f7 100644 (file)
@@ -49,7 +49,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        return oprofile_perf_init(ops);
 }
 
-void __exit oprofile_arch_exit(void)
+void oprofile_arch_exit(void)
 {
        oprofile_perf_exit();
        kfree(sh_pmu_op_name);
@@ -60,5 +60,5 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        ops->backtrace = sh_backtrace;
        return -ENODEV;
 }
-void __exit oprofile_arch_exit(void) {}
+void oprofile_arch_exit(void) {}
 #endif /* CONFIG_HW_PERF_EVENTS */
index f92602e86607cb094f04ead294b8a3d6f6decdcf..70ae9d81870ee6211819e4ba7f3e37284f58558f 100644 (file)
@@ -43,6 +43,7 @@ config SPARC64
        select HAVE_KPROBES
        select HAVE_RCU_TABLE_FREE if SMP
        select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_SYSCALL_WRAPPERS
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FTRACE_MCOUNT_RECORD
@@ -352,9 +353,6 @@ config NODES_SPAN_OTHER_NODES
        def_bool y
        depends on NEED_MULTIPLE_NODES
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y if SPARC64
-
 config ARCH_SELECT_MEMORY_MODEL
        def_bool y if SPARC64
 
diff --git a/arch/sparc/include/asm/memblock.h b/arch/sparc/include/asm/memblock.h
deleted file mode 100644 (file)
index c67b047..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _SPARC64_MEMBLOCK_H
-#define _SPARC64_MEMBLOCK_H
-
-#include <asm/oplib.h>
-
-#define MEMBLOCK_DBG(fmt...) prom_printf(fmt)
-
-#endif /* !(_SPARC64_MEMBLOCK_H) */
index 3739a06a76cbfdbd93a0dde7bf0494e6b8e74285..39d8b05201a23bd83eb6866d05477f3b34664957 100644 (file)
@@ -95,12 +95,14 @@ void cpu_idle(void)
        set_thread_flag(TIF_POLLING_NRFLAG);
 
        while(1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
 
                while (!need_resched() && !cpu_is_offline(cpu))
                        sparc64_yield(cpu);
 
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
 
                preempt_enable_no_resched();
 
index fe1e3fc31bc580f7a41e9e73406f191e9e8e8f76..ffb883ddd0f0109d80748fb524a930828499f0ac 100644 (file)
@@ -84,7 +84,7 @@ static void prom_sync_me(void)
 
        prom_printf("PROM SYNC COMMAND...\n");
        show_free_areas(0);
-       if(current->pid != 0) {
+       if (!is_idle_task(current)) {
                local_irq_enable();
                sys_sync();
                local_irq_disable();
index 8e073d802139705aa9d6fc280c8e20f8d8f8e0f0..b3f5e7dfea51a21a4d2c28ee66518db1336a5023 100644 (file)
@@ -790,7 +790,7 @@ static int find_node(unsigned long addr)
        return -1;
 }
 
-u64 memblock_nid_range(u64 start, u64 end, int *nid)
+static u64 memblock_nid_range(u64 start, u64 end, int *nid)
 {
        *nid = find_node(start);
        start += PAGE_SIZE;
@@ -808,7 +808,7 @@ u64 memblock_nid_range(u64 start, u64 end, int *nid)
        return start;
 }
 #else
-u64 memblock_nid_range(u64 start, u64 end, int *nid)
+static u64 memblock_nid_range(u64 start, u64 end, int *nid)
 {
        *nid = 0;
        return end;
@@ -816,7 +816,7 @@ u64 memblock_nid_range(u64 start, u64 end, int *nid)
 #endif
 
 /* This must be invoked after performing all of the necessary
- * add_active_range() calls for 'nid'.  We need to be able to get
+ * memblock_set_node() calls for 'nid'.  We need to be able to get
  * correct data from get_pfn_range_for_nid().
  */
 static void __init allocate_node_data(int nid)
@@ -987,14 +987,11 @@ static void __init add_node_ranges(void)
 
                        this_end = memblock_nid_range(start, end, &nid);
 
-                       numadbg("Adding active range nid[%d] "
+                       numadbg("Setting memblock NUMA node nid[%d] "
                                "start[%lx] end[%lx]\n",
                                nid, start, this_end);
 
-                       add_active_range(nid,
-                                        start >> PAGE_SHIFT,
-                                        this_end >> PAGE_SHIFT);
-
+                       memblock_set_node(start, this_end - start, nid);
                        start = this_end;
                }
        }
@@ -1282,7 +1279,6 @@ static void __init bootmem_init_nonnuma(void)
 {
        unsigned long top_of_ram = memblock_end_of_DRAM();
        unsigned long total_ram = memblock_phys_mem_size();
-       struct memblock_region *reg;
 
        numadbg("bootmem_init_nonnuma()\n");
 
@@ -1292,20 +1288,8 @@ static void __init bootmem_init_nonnuma(void)
               (top_of_ram - total_ram) >> 20);
 
        init_node_masks_nonnuma();
-
-       for_each_memblock(memory, reg) {
-               unsigned long start_pfn, end_pfn;
-
-               if (!reg->size)
-                       continue;
-
-               start_pfn = memblock_region_memory_base_pfn(reg);
-               end_pfn = memblock_region_memory_end_pfn(reg);
-               add_active_range(0, start_pfn, end_pfn);
-       }
-
+       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
        allocate_node_data(0);
-
        node_set_online(0);
 }
 
@@ -1769,8 +1753,6 @@ void __init paging_init(void)
                sun4v_ktsb_init();
        }
 
-       memblock_init();
-
        /* Find available physical memory...
         *
         * Read it twice in order to work around a bug in openfirmware.
@@ -1796,7 +1778,7 @@ void __init paging_init(void)
 
        memblock_enforce_memory_limit(cmdline_memory_size);
 
-       memblock_analyze();
+       memblock_allow_resize();
        memblock_dump_all();
 
        set_bit(0, mmu_context_bmap);
index 9c45d8bbdf57a7d6b7e9b8eb99da20138e16116e..4c1ac6e5347ac687bdbb4de54be8a736485d9416 100644 (file)
@@ -85,7 +85,8 @@ void cpu_idle(void)
 
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched()) {
                        if (cpu_is_offline(cpu))
                                BUG();  /* no HOTPLUG_CPU */
@@ -105,7 +106,8 @@ void cpu_idle(void)
                                local_irq_enable();
                        current_thread_info()->status |= TS_POLLING;
                }
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 25b7b90fd62064b46cf6faf0204a7cbc78b28cc1..c1eaaa1fcc2089bed7d135875d9fe654d3254e0a 100644 (file)
@@ -54,7 +54,7 @@ static noinline void force_sig_info_fault(const char *type, int si_signo,
        if (unlikely(tsk->pid < 2)) {
                panic("Signal %d (code %d) at %#lx sent to %s!",
                      si_signo, si_code & 0xffff, address,
-                     tsk->pid ? "init" : "the idle task");
+                     is_idle_task(tsk) ? "the idle task" : "init");
        }
 
        info.si_signo = si_signo;
@@ -515,7 +515,7 @@ no_context:
 
        if (unlikely(tsk->pid < 2)) {
                panic("Kernel page fault running %s!",
-                     tsk->pid ? "init" : "the idle task");
+                     is_idle_task(tsk) ? "the idle task" : "init");
        }
 
        /*
index c5338351aecd20606738198b2694a983b10a38af..69f24905abdc4350e368a84e94e9ed5dc9da3d3c 100644 (file)
@@ -246,10 +246,12 @@ void default_idle(void)
                if (need_resched())
                        schedule();
 
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                nsecs = disable_timer();
                idle_sleep(nsecs);
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
        }
 }
 
index a08d9fab81f2025c008c23e8b4ed229ff6c65525..82a6e22f1f3567d4e4c95c668c3635ed058cda4c 100644 (file)
@@ -75,8 +75,6 @@ static struct clocksource itimer_clocksource = {
        .rating         = 300,
        .read           = itimer_read,
        .mask           = CLOCKSOURCE_MASK(64),
-       .mult           = 1000,
-       .shift          = 0,
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
@@ -94,9 +92,9 @@ static void __init setup_itimer(void)
                clockevent_delta2ns(60 * HZ, &itimer_clockevent);
        itimer_clockevent.min_delta_ns =
                clockevent_delta2ns(1, &itimer_clockevent);
-       err = clocksource_register(&itimer_clocksource);
+       err = clocksource_register_hz(&itimer_clocksource, USEC_PER_SEC);
        if (err) {
-               printk(KERN_ERR "clocksource_register returned %d\n", err);
+               printk(KERN_ERR "clocksource_register_hz returned %d\n", err);
                return;
        }
        clockevents_register_device(&itimer_clockevent);
index ba401df971ed807077e75d570177ae8ff940c68c..52edc2b628732552c1e8cc6578acb5fe2a8a0427 100644 (file)
@@ -55,7 +55,8 @@ void cpu_idle(void)
 {
        /* endless idle loop with no priority at all */
        while (1) {
-               tick_nohz_stop_sched_tick(1);
+               tick_nohz_idle_enter();
+               rcu_idle_enter();
                while (!need_resched()) {
                        local_irq_disable();
                        stop_critical_timings();
@@ -63,7 +64,8 @@ void cpu_idle(void)
                        local_irq_enable();
                        start_critical_timings();
                }
-               tick_nohz_restart_sched_tick();
+               rcu_idle_exit();
+               tick_nohz_idle_exit();
                preempt_enable_no_resched();
                schedule();
                preempt_disable();
index 471b6bca8da477c449ee2d1d4dbe4f9708cb0d3b..673d7a89d8fff0fd86573ac9dfede09d456c309c 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/traps.h>
+#include <asm/memblock.h>
 
 #include "setup.h"
 
index 3b379cddbc641cced14c4472a4d7838852a47935..de186bde89751b6e426735cc1494afce050a6b3a 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/setup.h>
 #include <asm/sizes.h>
 #include <asm/tlb.h>
+#include <asm/memblock.h>
 #include <mach/map.h>
 
 #include "mm.h"
@@ -245,7 +246,6 @@ void __init uc32_memblock_init(struct meminfo *mi)
        sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]),
                meminfo_cmp, NULL);
 
-       memblock_init();
        for (i = 0; i < mi->nr_banks; i++)
                memblock_add(mi->bank[i].start, mi->bank[i].size);
 
@@ -264,7 +264,7 @@ void __init uc32_memblock_init(struct meminfo *mi)
 
        uc32_mm_memblock_reserve();
 
-       memblock_analyze();
+       memblock_allow_resize();
        memblock_dump_all();
 }
 
index 3e5c3e5a0b4542a99cb1e6bda573ab3dfc002dcc..43c20b40e4444a0af02f11f226e6f2c6a581db5c 100644 (file)
@@ -25,6 +25,7 @@
 #include <asm/setup.h>
 #include <asm/sizes.h>
 #include <asm/tlb.h>
+#include <asm/memblock.h>
 
 #include <mach/map.h>
 
index efb42949cc09349e37246baa07f018648186386f..5731eb70e0a0642d422ad8653cd7725b762757d0 100644 (file)
@@ -26,6 +26,8 @@ config X86
        select HAVE_IOREMAP_PROT
        select HAVE_KPROBES
        select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
+       select ARCH_DISCARD_MEMBLOCK
        select ARCH_WANT_OPTIONAL_GPIOLIB
        select ARCH_WANT_FRAME_POINTERS
        select HAVE_DMA_ATTRS
@@ -204,9 +206,6 @@ config ZONE_DMA32
        bool
        default X86_64
 
-config ARCH_POPULATES_NODE_MAP
-       def_bool y
-
 config AUDIT_ARCH
        bool
        default X86_64
@@ -343,6 +342,7 @@ config X86_EXTENDED_PLATFORM
 
          If you enable this option then you'll be able to select support
          for the following (non-PC) 64 bit x86 platforms:
+               Numascale NumaChip
                ScaleMP vSMP
                SGI Ultraviolet
 
@@ -351,6 +351,18 @@ config X86_EXTENDED_PLATFORM
 endif
 # This is an alphabetically sorted list of 64 bit extended platforms
 # Please maintain the alphabetic order if and when there are additions
+config X86_NUMACHIP
+       bool "Numascale NumaChip"
+       depends on X86_64
+       depends on X86_EXTENDED_PLATFORM
+       depends on NUMA
+       depends on SMP
+       depends on X86_X2APIC
+       depends on !EDAC_AMD64
+       ---help---
+         Adds support for Numascale NumaChip large-SMP systems. Needed to
+         enable more than ~168 cores.
+         If you don't have one of these, you should say N here.
 
 config X86_VSMP
        bool "ScaleMP vSMP"
index a6253ec1b28461e12d6f650683c6d05c99a7a7cc..3e274564f6bf0d89f06b489484eb7d86faa049d6 100644 (file)
@@ -134,7 +134,7 @@ ENTRY(ia32_sysenter_target)
        CFI_REL_OFFSET rsp,0
        pushfq_cfi
        /*CFI_REL_OFFSET rflags,0*/
-       movl    8*3-THREAD_SIZE+TI_sysenter_return(%rsp), %r10d
+       movl    TI_sysenter_return+THREAD_INFO(%rsp,3*8-KERNEL_STACK_OFFSET),%r10d
        CFI_REGISTER rip,r10
        pushq_cfi $__USER32_CS
        /*CFI_REL_OFFSET cs,0*/
@@ -150,9 +150,8 @@ ENTRY(ia32_sysenter_target)
        .section __ex_table,"a"
        .quad 1b,ia32_badarg
        .previous       
-       GET_THREAD_INFO(%r10)
-       orl    $TS_COMPAT,TI_status(%r10)
-       testl  $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
+       orl     $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
+       testl   $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        CFI_REMEMBER_STATE
        jnz  sysenter_tracesys
        cmpq    $(IA32_NR_syscalls-1),%rax
@@ -162,13 +161,12 @@ sysenter_do_call:
 sysenter_dispatch:
        call    *ia32_sys_call_table(,%rax,8)
        movq    %rax,RAX-ARGOFFSET(%rsp)
-       GET_THREAD_INFO(%r10)
        DISABLE_INTERRUPTS(CLBR_NONE)
        TRACE_IRQS_OFF
-       testl   $_TIF_ALLWORK_MASK,TI_flags(%r10)
+       testl   $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jnz     sysexit_audit
 sysexit_from_sys_call:
-       andl    $~TS_COMPAT,TI_status(%r10)
+       andl    $~TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        /* clear IF, that popfq doesn't enable interrupts early */
        andl  $~0x200,EFLAGS-R11(%rsp) 
        movl    RIP-R11(%rsp),%edx              /* User %eip */
@@ -205,7 +203,7 @@ sysexit_from_sys_call:
        .endm
 
        .macro auditsys_exit exit
-       testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
+       testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jnz ia32_ret_from_sys_call
        TRACE_IRQS_ON
        sti
@@ -215,12 +213,11 @@ sysexit_from_sys_call:
        movzbl %al,%edi         /* zero-extend that into %edi */
        inc %edi /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */
        call audit_syscall_exit
-       GET_THREAD_INFO(%r10)
        movl RAX-ARGOFFSET(%rsp),%eax   /* reload syscall return value */
        movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
        cli
        TRACE_IRQS_OFF
-       testl %edi,TI_flags(%r10)
+       testl %edi,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jz \exit
        CLEAR_RREGS -ARGOFFSET
        jmp int_with_check
@@ -238,7 +235,7 @@ sysexit_audit:
 
 sysenter_tracesys:
 #ifdef CONFIG_AUDITSYSCALL
-       testl   $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
+       testl   $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jz      sysenter_auditsys
 #endif
        SAVE_REST
@@ -309,9 +306,8 @@ ENTRY(ia32_cstar_target)
        .section __ex_table,"a"
        .quad 1b,ia32_badarg
        .previous       
-       GET_THREAD_INFO(%r10)
-       orl   $TS_COMPAT,TI_status(%r10)
-       testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
+       orl     $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
+       testl   $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        CFI_REMEMBER_STATE
        jnz   cstar_tracesys
        cmpq $IA32_NR_syscalls-1,%rax
@@ -321,13 +317,12 @@ cstar_do_call:
 cstar_dispatch:
        call *ia32_sys_call_table(,%rax,8)
        movq %rax,RAX-ARGOFFSET(%rsp)
-       GET_THREAD_INFO(%r10)
        DISABLE_INTERRUPTS(CLBR_NONE)
        TRACE_IRQS_OFF
-       testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
+       testl $_TIF_ALLWORK_MASK,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jnz sysretl_audit
 sysretl_from_sys_call:
-       andl $~TS_COMPAT,TI_status(%r10)
+       andl $~TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        RESTORE_ARGS 0,-ARG_SKIP,0,0,0
        movl RIP-ARGOFFSET(%rsp),%ecx
        CFI_REGISTER rip,rcx
@@ -355,7 +350,7 @@ sysretl_audit:
 
 cstar_tracesys:
 #ifdef CONFIG_AUDITSYSCALL
-       testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
+       testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jz cstar_auditsys
 #endif
        xchgl %r9d,%ebp
@@ -420,9 +415,8 @@ ENTRY(ia32_syscall)
        /* note the registers are not zero extended to the sf.
           this could be a problem. */
        SAVE_ARGS 0,1,0
-       GET_THREAD_INFO(%r10)
-       orl   $TS_COMPAT,TI_status(%r10)
-       testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
+       orl $TS_COMPAT,TI_status+THREAD_INFO(%rsp,RIP-ARGOFFSET)
+       testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags+THREAD_INFO(%rsp,RIP-ARGOFFSET)
        jnz ia32_tracesys
        cmpq $(IA32_NR_syscalls-1),%rax
        ja ia32_badsys
@@ -459,8 +453,8 @@ quiet_ni_syscall:
        CFI_ENDPROC
        
        .macro PTREGSCALL label, func, arg
-       .globl \label
-\label:
+       ALIGN
+GLOBAL(\label)
        leaq \func(%rip),%rax
        leaq -ARGOFFSET+8(%rsp),\arg    /* 8 for return address */
        jmp  ia32_ptregs_common 
@@ -477,7 +471,8 @@ quiet_ni_syscall:
        PTREGSCALL stub32_vfork, sys_vfork, %rdi
        PTREGSCALL stub32_iopl, sys_iopl, %rsi
 
-ENTRY(ia32_ptregs_common)
+       ALIGN
+ia32_ptregs_common:
        popq %r11
        CFI_ENDPROC
        CFI_STARTPROC32 simple
index 091508b533b46810603bb3dfa86a207d24e1e9c0..952bd0100c5c050289baff430ab0e4e30f56e0fc 100644 (file)
@@ -4,10 +4,10 @@
 
 #ifdef CONFIG_SMP
        .macro LOCK_PREFIX
-1:     lock
+672:   lock
        .section .smp_locks,"a"
        .balign 4
-       .long 1b - .
+       .long 672b - .
        .previous
        .endm
 #else
index 1a6c09af048fbd587613c750502677d7cbb1c052..3ab9bdd87e79969c8a56b2811dd0deb761d8ca7a 100644 (file)
@@ -176,6 +176,7 @@ static inline u64 native_x2apic_icr_read(void)
 }
 
 extern int x2apic_phys;
+extern int x2apic_preenabled;
 extern void check_x2apic(void);
 extern void enable_x2apic(void);
 extern void x2apic_icr_write(u32 low, u32 id);
@@ -198,6 +199,9 @@ static inline void x2apic_force_phys(void)
        x2apic_phys = 1;
 }
 #else
+static inline void disable_x2apic(void)
+{
+}
 static inline void check_x2apic(void)
 {
 }
@@ -212,6 +216,7 @@ static inline void x2apic_force_phys(void)
 {
 }
 
+#define        nox2apic        0
 #define        x2apic_preenabled 0
 #define        x2apic_supported()      0
 #endif
@@ -410,6 +415,7 @@ extern int wakeup_secondary_cpu_via_nmi(int apicid, unsigned long start_eip);
 #endif
 
 #ifdef CONFIG_X86_LOCAL_APIC
+
 static inline u32 apic_read(u32 reg)
 {
        return apic->read(reg);
diff --git a/arch/x86/include/asm/apic_flat_64.h b/arch/x86/include/asm/apic_flat_64.h
new file mode 100644 (file)
index 0000000..a2d3127
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef _ASM_X86_APIC_FLAT_64_H
+#define _ASM_X86_APIC_FLAT_64_H
+
+extern void flat_init_apic_ldr(void);
+
+#endif
+
index 3925d80078642d76f1890202d55037e9442b3f03..134bba00df09db0ebc3c6b6a0fa091cd367e1e3c 100644 (file)
 
 #define APIC_BASE (fix_to_virt(FIX_APIC_BASE))
 #define APIC_BASE_MSR  0x800
+#define XAPIC_ENABLE   (1UL << 11)
 #define X2APIC_ENABLE  (1UL << 10)
 
 #ifdef CONFIG_X86_32
index 1775d6e5920e1b8f2a463600a048a9e3b097d978..b97596e2b68c7ea3f62eebb38cd1f155719c150e 100644 (file)
@@ -380,6 +380,8 @@ static inline unsigned long __fls(unsigned long word)
        return word;
 }
 
+#undef ADDR
+
 #ifdef __KERNEL__
 /**
  * ffs - find first set bit in word
@@ -395,10 +397,25 @@ static inline unsigned long __fls(unsigned long word)
 static inline int ffs(int x)
 {
        int r;
-#ifdef CONFIG_X86_CMOV
+
+#ifdef CONFIG_X86_64
+       /*
+        * AMD64 says BSFL won't clobber the dest reg if x==0; Intel64 says the
+        * dest reg is undefined if x==0, but their CPU architect says its
+        * value is written to set it to the same as before, except that the
+        * top 32 bits will be cleared.
+        *
+        * We cannot do this on 32 bits because at the very least some
+        * 486 CPUs did not behave this way.
+        */
+       long tmp = -1;
+       asm("bsfl %1,%0"
+           : "=r" (r)
+           : "rm" (x), "0" (tmp));
+#elif defined(CONFIG_X86_CMOV)
        asm("bsfl %1,%0\n\t"
            "cmovzl %2,%0"
-           : "=r" (r) : "rm" (x), "r" (-1));
+           : "=&r" (r) : "rm" (x), "r" (-1));
 #else
        asm("bsfl %1,%0\n\t"
            "jnz 1f\n\t"
@@ -422,7 +439,22 @@ static inline int ffs(int x)
 static inline int fls(int x)
 {
        int r;
-#ifdef CONFIG_X86_CMOV
+
+#ifdef CONFIG_X86_64
+       /*
+        * AMD64 says BSRL won't clobber the dest reg if x==0; Intel64 says the
+        * dest reg is undefined if x==0, but their CPU architect says its
+        * value is written to set it to the same as before, except that the
+        * top 32 bits will be cleared.
+        *
+        * We cannot do this on 32 bits because at the very least some
+        * 486 CPUs did not behave this way.
+        */
+       long tmp = -1;
+       asm("bsrl %1,%0"
+           : "=r" (r)
+           : "rm" (x), "0" (tmp));
+#elif defined(CONFIG_X86_CMOV)
        asm("bsrl %1,%0\n\t"
            "cmovzl %2,%0"
            : "=&r" (r) : "rm" (x), "rm" (-1));
@@ -434,11 +466,35 @@ static inline int fls(int x)
 #endif
        return r + 1;
 }
-#endif /* __KERNEL__ */
-
-#undef ADDR
 
-#ifdef __KERNEL__
+/**
+ * fls64 - find last set bit in a 64-bit word
+ * @x: the word to search
+ *
+ * This is defined in a similar way as the libc and compiler builtin
+ * ffsll, but returns the position of the most significant set bit.
+ *
+ * fls64(value) returns 0 if value is 0 or the position of the last
+ * set bit if value is nonzero. The last (most significant) bit is
+ * at position 64.
+ */
+#ifdef CONFIG_X86_64
+static __always_inline int fls64(__u64 x)
+{
+       long bitpos = -1;
+       /*
+        * AMD64 says BSRQ won't clobber the dest reg if x==0; Intel64 says the
+        * dest reg is undefined if x==0, but their CPU architect says its
+        * value is written to set it to the same as before.
+        */
+       asm("bsrq %1,%0"
+           : "+r" (bitpos)
+           : "rm" (x));
+       return bitpos + 1;
+}
+#else
+#include <asm-generic/bitops/fls64.h>
+#endif
 
 #include <asm-generic/bitops/find.h>
 
@@ -450,12 +506,6 @@ static inline int fls(int x)
 
 #include <asm-generic/bitops/const_hweight.h>
 
-#endif /* __KERNEL__ */
-
-#include <asm-generic/bitops/fls64.h>
-
-#ifdef __KERNEL__
-
 #include <asm-generic/bitops/le.h>
 
 #include <asm-generic/bitops/ext2-atomic-setbit.h>
index 5d3acdf5a7a682d96681f78c86548a18203aaf98..0c9fa2745f13e4c1f242d3f37813f25849aebd6d 100644 (file)
@@ -14,6 +14,8 @@ extern void __cmpxchg_wrong_size(void)
        __compiletime_error("Bad argument size for cmpxchg");
 extern void __xadd_wrong_size(void)
        __compiletime_error("Bad argument size for xadd");
+extern void __add_wrong_size(void)
+       __compiletime_error("Bad argument size for add");
 
 /*
  * Constants for operation sizes. On 32-bit, the 64-bit size it set to
@@ -31,60 +33,47 @@ extern void __xadd_wrong_size(void)
 #define        __X86_CASE_Q    -1              /* sizeof will never return -1 */
 #endif
 
+/* 
+ * An exchange-type operation, which takes a value and a pointer, and
+ * returns a the old value.
+ */
+#define __xchg_op(ptr, arg, op, lock)                                  \
+       ({                                                              \
+               __typeof__ (*(ptr)) __ret = (arg);                      \
+               switch (sizeof(*(ptr))) {                               \
+               case __X86_CASE_B:                                      \
+                       asm volatile (lock #op "b %b0, %1\n"            \
+                                     : "+r" (__ret), "+m" (*(ptr))     \
+                                     : : "memory", "cc");              \
+                       break;                                          \
+               case __X86_CASE_W:                                      \
+                       asm volatile (lock #op "w %w0, %1\n"            \
+                                     : "+r" (__ret), "+m" (*(ptr))     \
+                                     : : "memory", "cc");              \
+                       break;                                          \
+               case __X86_CASE_L:                                      \
+                       asm volatile (lock #op "l %0, %1\n"             \
+                                     : "+r" (__ret), "+m" (*(ptr))     \
+                                     : : "memory", "cc");              \
+                       break;                                          \
+               case __X86_CASE_Q:                                      \
+                       asm volatile (lock #op "q %q0, %1\n"            \
+                                     : "+r" (__ret), "+m" (*(ptr))     \
+                                     : : "memory", "cc");              \
+                       break;                                          \
+               default:                                                \
+                       __ ## op ## _wrong_size();                      \
+               }                                                       \
+               __ret;                                                  \
+       })
+
 /*
  * Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
  * Since this is generally used to protect other memory information, we
  * use "asm volatile" and "memory" clobbers to prevent gcc from moving
  * information around.
  */
-#define __xchg(x, ptr, size)                                           \
-({                                                                     \
-       __typeof(*(ptr)) __x = (x);                                     \
-       switch (size) {                                                 \
-       case __X86_CASE_B:                                              \
-       {                                                               \
-               volatile u8 *__ptr = (volatile u8 *)(ptr);              \
-               asm volatile("xchgb %0,%1"                              \
-                            : "=q" (__x), "+m" (*__ptr)                \
-                            : "0" (__x)                                \
-                            : "memory");                               \
-               break;                                                  \
-       }                                                               \
-       case __X86_CASE_W:                                              \
-       {                                                               \
-               volatile u16 *__ptr = (volatile u16 *)(ptr);            \
-               asm volatile("xchgw %0,%1"                              \
-                            : "=r" (__x), "+m" (*__ptr)                \
-                            : "0" (__x)                                \
-                            : "memory");                               \
-               break;                                                  \
-       }                                                               \
-       case __X86_CASE_L:                                              \
-       {                                                               \
-               volatile u32 *__ptr = (volatile u32 *)(ptr);            \
-               asm volatile("xchgl %0,%1"                              \
-                            : "=r" (__x), "+m" (*__ptr)                \
-                            : "0" (__x)                                \
-                            : "memory");                               \
-               break;                                                  \
-       }                                                               \
-       case __X86_CASE_Q:         &n