1. 29 Mar, 2012 40 commits
    • Linus Torvalds's avatar
      Merge branch 'for-3.4' of git://linux-nfs.org/~bfields/linux · 71db34fc
      Linus Torvalds authored
      Pull nfsd changes from Bruce Fields:
      
      Highlights:
       - Benny Halevy and Tigran Mkrtchyan implemented some more 4.1 features,
         moving us closer to a complete 4.1 implementation.
       - Bernd Schubert fixed a long-standing problem with readdir cookies on
         ext2/3/4.
       - Jeff Layton performed a long-overdue overhaul of the server reboot
         recovery code which will allow us to deprecate the current code (a
         rather unusual user of the vfs), and give us some needed flexibility
         for further improvements.
       - Like the client, we now support numeric uid's and gid's in the
         auth_sys case, allowing easier upgrades from NFSv2/v3 to v4.x.
      
      Plus miscellaneous bugfixes and cleanup.
      
      Thanks to everyone!
      
      There are also some delegation fixes waiting on vfs review that I
      suppose will have to wait for 3.5.  With that done I think we'll finally
      turn off the "EXPERIMENTAL" dependency for v4 (though that's mostly
      symbolic as it's been on by default in distro's for a while).
      
      And the list of 4.1 todo's should be achievable for 3.5 as well:
      
         http://wiki.linux-nfs.org/wiki/index.php/Server_4.0_and_4.1_issues
      
      though we may still want a bit more experience with it before turning it
      on by default.
      
      * 'for-3.4' of git://linux-nfs.org/~bfields/linux: (55 commits)
        nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled
        nfsd4: use auth_unix unconditionally on backchannel
        nfsd: fix NULL pointer dereference in cld_pipe_downcall
        nfsd4: memory corruption in numeric_name_to_id()
        sunrpc: skip portmap calls on sessions backchannel
        nfsd4: allow numeric idmapping
        nfsd: don't allow legacy client tracker init for anything but init_net
        nfsd: add notifier to handle mount/unmount of rpc_pipefs sb
        nfsd: add the infrastructure to handle the cld upcall
        nfsd: add a header describing upcall to nfsdcld
        nfsd: add a per-net-namespace struct for nfsd
        sunrpc: create nfsd dir in rpc_pipefs
        nfsd: add nfsd4_client_tracking_ops struct and a way to set it
        nfsd: convert nfs4_client->cl_cb_flags to a generic flags field
        NFSD: Fix nfs4_verifier memory alignment
        NFSD: Fix warnings when NFSD_DEBUG is not defined
        nfsd: vfs_llseek() with 32 or 64 bit offsets (hashes)
        nfsd: rename 'int access' to 'int may_flags' in nfsd_open()
        ext4: return 32/64-bit dir name hash according to usage type
        fs: add new FMODE flags: FMODE_32bithash and FMODE_64bithash
        ...
      71db34fc
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile · 50483c32
      Linus Torvalds authored
      Pull arch/tile (really asm-generic) update from Chris Metcalf:
       "These are a couple of asm-generic changes that apply to tile."
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile:
        compat: use sys_sendfile64() implementation for sendfile syscall
        [PATCH v3] ipc: provide generic compat versions of IPC syscalls
      50483c32
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7fda0412
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar.
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        cpusets: Remove an unused variable
        sched/rt: Improve pick_next_highest_task_rt()
        sched: Fix select_fallback_rq() vs cpu_active/cpu_online
        sched/x86/smp: Do not enable IRQs over calibrate_delay()
        sched: Fix compiler warning about declared inline after use
        MAINTAINERS: Update email address for SCHEDULER and PERF EVENTS
      7fda0412
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 6b8212a3
      Linus Torvalds authored
      Pull x86 updates from Ingo Molnar.
      
      This touches some non-x86 files due to the sanitized INLINE_SPIN_UNLOCK
      config usage.
      
      Fixed up trivial conflicts due to just header include changes (removing
      headers due to cpu_idle() merge clashing with the <asm/system.h> split).
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/apic/amd: Be more verbose about LVT offset assignments
        x86, tls: Off by one limit check
        x86/ioapic: Add io_apic_ops driver layer to allow interception
        x86/olpc: Add debugfs interface for EC commands
        x86: Merge the x86_32 and x86_64 cpu_idle() functions
        x86/kconfig: Remove CONFIG_TR=y from the defconfigs
        x86: Stop recursive fault in print_context_stack after stack overflow
        x86/io_apic: Move and reenable irq only when CONFIG_GENERIC_PENDING_IRQ=y
        x86/apic: Add separate apic_id_valid() functions for selected apic drivers
        locking/kconfig: Simplify INLINE_SPIN_UNLOCK usage
        x86/kconfig: Update defconfigs
        x86: Fix excessive MSR print out when show_msr is not specified
      6b8212a3
    • Linus Torvalds's avatar
      Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · bcd55074
      Linus Torvalds authored
      Pull timer core updates from Thomas Gleixner.
      
      * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        ia64: vsyscall: Add missing paranthesis
        alarmtimer: Don't call rtc_timer_init() when CONFIG_RTC_CLASS=n
        x86: vdso: Put declaration before code
        x86-64: Inline vdso clock_gettime helpers
        x86-64: Simplify and optimize vdso clock_gettime monotonic variants
        kernel-time: fix s/then/than/ spelling errors
        time: remove no_sync_cmos_clock
        time: Avoid scary backtraces when warning of > 11% adj
        alarmtimer: Make sure we initialize the rtctimer
        ntp: Fix leap-second hrtimer livelock
        x86, tsc: Skip refined tsc calibration on systems with reliable TSC
        rtc: Provide flag for rtc devices that don't support UIE
        ia64: vsyscall: Use seqcount instead of seqlock
        x86: vdso: Use seqcount instead of seqlock
        x86: vdso: Remove bogus locking in update_vsyscall_tz()
        time: Remove bogus comments
        time: Fix change_clocksource locking
        time: x86: Fix race switching from vsyscall to non-vsyscall clock
      bcd55074
    • Luck, Tony's avatar
      Fix ia64 build errors (fallout from system.h disintegration) · 93f37888
      Luck, Tony authored
      Fix this build error on ia64:
      
        In file included from include/linux/sched.h:92,
                        from arch/ia64/kernel/asm-offsets.c:9:
        include/linux/llist.h:59:25: error: asm/cmpxchg.h: No such file or directory
        make[1]: *** [arch/ia64/kernel/asm-offsets.s] Error 1
      
      Right now we don't seem to need any actual contents for the
      asm/cmpxchg.h to make the build work ...  so leave the migration of
      xchg() and cmpxchg() to this new header file for a future patch.
      
      Also process.c needs <asm/switch_to.h> (for definition of pfm_syst_info).
      Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      93f37888
    • Linus Torvalds's avatar
      Merge branch 'irqdomain/merge' of git://git.secretlab.ca/git/linux-2.6 · 55a32030
      Linus Torvalds authored
      Pull the code to generalize the powerpc VIRQ_DEBUG code from Grant Likely.
      
      That code had been moved into generic irqdomain code, but still had
      powerpc-specific code and could only be enabled on powerpc.
      
      * 'irqdomain/merge' of git://git.secretlab.ca/git/linux-2.6:
        irqdomain/powerpc: updated defconfigs for VIRQ_DEBUG rename
        irqdomain: Remove powerpc dependency from debugfs file
      55a32030
    • Linus Torvalds's avatar
      Merge branch 'akpm' (Andrew's patch-bomb) · 18a06efa
      Linus Torvalds authored
      Single fix for a commit from the first batch of patches through Andrew.
      
      * emailed from Andrew Morton <akpm@linux-foundation.org>:
        pagemap: remove remaining unneeded spin_lock()
      18a06efa
    • Naoya Horiguchi's avatar
      pagemap: remove remaining unneeded spin_lock() · 10bdfb5e
      Naoya Horiguchi authored
      Commit 025c5b24 ("thp: optimize away unnecessary page table
      locking") moves spin_lock() into pmd_trans_huge_lock() in order to avoid
      locking unless pmd is for thp.  So this spin_lock() is a bug.
      Reported-by: default avatarSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      10bdfb5e
    • Grant Likely's avatar
    • Grant Likely's avatar
      irqdomain: Remove powerpc dependency from debugfs file · 092b2fb0
      Grant Likely authored
      The debugfs code is really generic for all platforms.  This patch removes the
      powerpc-specific directory reference and makes it available to all
      architectures.
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      092b2fb0
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 0a03726c
      Linus Torvalds authored
      Pull the intel i915 hibernation memory corruption fix from Dave Airlie:
       "I tracked down the misc memory corruption after i915 hibernate to the
        blinking fbcon cursor, and realised the i915 driver wasn't doing the
        fbdev suspend/resume calls at all.  nouveau and radeon have done these
        calls for a long time.
      
        This has been fairly well tested and is definitely the main culprit in
        hibernate not working."
      
      Yay.
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/i915: suspend fbdev device around suspend/hibernate
      0a03726c
    • Jeff Layton's avatar
      nfsd: only register cld pipe notifier when CONFIG_NFSD_V4 is enabled · 797a9d79
      Jeff Layton authored
      Otherwise, we get a warning or error similar to this when building with
      CONFIG_NFSD_V4 disabled:
      
          ERROR: "nfsd4_cld_block" [fs/nfsd/nfsd.ko] undefined!
      
      Fix this by wrapping the calls to rpc_pipefs_notifier_register and
      ..._unregister in another function and providing no-op replacements
      when CONFIG_NFSD_V4 is disabled.
      Reported-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
      797a9d79
    • Dave Airlie's avatar
      drm/i915: suspend fbdev device around suspend/hibernate · 3fa016a0
      Dave Airlie authored
      Looking at hibernate overwriting I though it looked like a cursor,
      so I tracked down this missing piece to stop the cursor blink
      timer. I've no idea if this is sufficient to fix the hibernate
      problems people are seeing, but please test it.
      
      Both radeon and nouveau have done this for a long time.
      
      I've run this personally all night hib/resume cycles with no fails.
      Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
      Reported-by: default avatarPetr Tesarik <kernel@tesarici.cz>
      Reported-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
      Reported-by: Lots of misc segfaults after hibernate across the world.
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=37142Tested-by: default avatarDave Airlie <airlied@redhat.com>
      Tested-by: default avatarBojan Smojver <bojan@rexursive.com>
      Tested-by: default avatarAndreas Hartmann <andihartmann@01019freenet.de>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      3fa016a0
    • Linus Torvalds's avatar
      Merge tag 'mmc-merge-for-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc · b5174fa3
      Linus Torvalds authored
      Pull MMC updates from Chris Ball:
      
      Core:
       * Support for MMC 4.5 Data Tag feature -- we tag REQ_META, so devices
         that support Data Tag will provide increased throughput for metadata.
       * Faster detection of card removal on I/O errors.
      
      Drivers:
       * dw_mmc now supports eMMC Power Off Notify, has PCI support, and
         implements pre_req and post_req for asynchronous requests.
       * omap_hsmmc now supports device tree.
       * esdhc now has power management support.
       * sdhci-tegra now supports Tegra30 devices.
       * sdhci-spear now supports hibernation.
       * tmio_mmc now supports using a GPIO for card detection.
       * Intel PCH now supports 8-bit bus transfers.
      
      * tag 'mmc-merge-for-3.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (53 commits)
        mmc: sh_mmcif: simplify bitmask macros
        mmc: sh_mobile_sdhi: support modular mmc-core with non-standard hotplug
        mmc: sh_mobile_sdhi: add a callback for board specific init code
        mmc: tmio: cosmetic: prettify the tmio_mmc_set_ios() function
        mmc: sh_mobile_sdhi: do not manage PM clocks manually
        mmc: tmio_mmc: remove unused sdio_irq_enabled flag
        mmc: tmio_mmc: power status flag doesn't have to be exposed in platform data
        mmc: sh_mobile_sdhi: pass card hotplug GPIO number to TMIO MMC
        mmc: tmio_mmc: support the generic MMC GPIO card hotplug helper
        mmc: tmio: calculate the native hotplug condition only once
        mmc: simplify mmc_cd_gpio_request() by removing two parameters
        mmc: sdhci-pci: allow 8-bit bus width for Intel PCH
        mmc: sdhci: check interrupt flags in ISR again
        mmc: sdhci-pci: Add MSI support
        mmc: core: warn when card doesn't support HPI
        mmc: davinci: Poll status for small size transfers
        mmc: davinci: Eliminate spurious interrupts
        mmc: omap_hsmmc: Avoid a regulator voltage change with dt
        mmc: omap_hsmmc: Convert hsmmc driver to use device tree
        mmc: sdhci-pci: add SDHCI_QUIRK2_HOST_OFF_CARD_ON for Medfield SDIO
        ...
      b5174fa3
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.open-osd.org/linux-open-osd · afb9bd70
      Linus Torvalds authored
      Pull trivial exofs changes from Boaz Harrosh:
       "Just nothingness really.  The big exofs changes are reserved for the
        next merge window."
      
      * 'for-linus' of git://git.open-osd.org/linux-open-osd:
        exofs: Cap on the memcpy() size
        exofs: (trivial) Fix typo in super.c
        exofs: fix endian conversion in exofs_sync_fs()
      afb9bd70
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-3.4-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 58df9b38
      Linus Torvalds authored
      Pull NFS client bugfixes for Linux 3.4 from Trond Myklebust
      
      Highlights include:
      - Fix infinite loops in the mount code
      - Fix a userspace buffer overflow in __nfs4_get_acl_uncached
      - Fix a memory leak due to a double reference count in rpcb_getport_async()
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      
      * tag 'nfs-for-3.4-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        NFSv4: Minor cleanups for nfs4_handle_exception and nfs4_async_handle_error
        NFSv4.1: Fix layoutcommit error handling
        NFSv4: Fix two infinite loops in the mount code
        SUNRPC: Use the already looked-up xprt in rpcb_getport_async()
        NFS4.1: remove duplicate variable declaration in filelayout_clear_request_commit
        Fix length of buffer copied in __nfs4_get_acl_uncached
      58df9b38
    • Linus Torvalds's avatar
      Merge tag 'squashfs-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next · 8563f878
      Linus Torvalds authored
      Pull squashfs updates from Phillip Lougher:
       "Add an extra mount time sanity check, plus some code cleanups and bug
        fixes."
      
      * tag 'squashfs-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-next:
        Squashfs: add mount time sanity check for block_size and block_log match
        Squashfs: fix f_pos check in get_dir_index_using_offset
        Squashfs: get rid of obsolete definitions in header file
        Squashfs: remove redundant length initialisation in squashfs_lookup
        Squashfs: remove redundant length initialisation in squashfs_readdir
        Squashfs: update comment removing reference to zlib only
        Squashfs: use define instead of constant
      8563f878
    • Linus Torvalds's avatar
      Merge branch 'akpm' (Andrew's patch-bomb) · 532bfc85
      Linus Torvalds authored
      Merge third batch of patches from Andrew Morton:
       - Some MM stragglers
       - core SMP library cleanups (on_each_cpu_mask)
       - Some IPI optimisations
       - kexec
       - kdump
       - IPMI
       - the radix-tree iterator work
       - various other misc bits.
      
       "That'll do for -rc1.  I still have ~10 patches for 3.4, will send
        those along when they've baked a little more."
      
      * emailed from Andrew Morton <akpm@linux-foundation.org>: (35 commits)
        backlight: fix typo in tosa_lcd.c
        crc32: add help text for the algorithm select option
        mm: move hugepage test examples to tools/testing/selftests/vm
        mm: move slabinfo.c to tools/vm
        mm: move page-types.c from Documentation to tools/vm
        selftests/Makefile: make `run_tests' depend on `all'
        selftests: launch individual selftests from the main Makefile
        radix-tree: use iterators in find_get_pages* functions
        radix-tree: rewrite gang lookup using iterator
        radix-tree: introduce bit-optimized iterator
        fs/proc/namespaces.c: prevent crash when ns_entries[] is empty
        nbd: rename the nbd_device variable from lo to nbd
        pidns: add reboot_pid_ns() to handle the reboot syscall
        sysctl: use bitmap library functions
        ipmi: use locks on watchdog timeout set on reboot
        ipmi: simplify locking
        ipmi: fix message handling during panics
        ipmi: use a tasklet for handling received messages
        ipmi: increase KCS timeouts
        ipmi: decrease the IPMI message transaction time in interrupt mode
        ...
      532bfc85
    • Masanari Iida's avatar
      backlight: fix typo in tosa_lcd.c · 8da00edc
      Masanari Iida authored
      Fix typo in drivers/video/backlight/tosa_lcd.c
      "tosa_lcd_reume" should be "tosa_lcd_resume".
      Signed-off-by: default avatarMasanari Iida <standby24x7@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8da00edc
    • Darrick J. Wong's avatar
      crc32: add help text for the algorithm select option · 82edb4ba
      Darrick J. Wong authored
      Add help text to the crc32 algorithm selection option in Kconfig.
      Signed-off-by: default avatarDarrick J. Wong <djwong@us.ibm.com>
      Reported-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      82edb4ba
    • Dave Young's avatar
      mm: move hugepage test examples to tools/testing/selftests/vm · f0f57b2b
      Dave Young authored
      hugepage-mmap.c, hugepage-shm.c and map_hugetlb.c in Documentation/vm are
      simple pass/fail tests, It's better to promote them to
      tools/testing/selftests.
      
      Thanks suggestion of Andrew Morton about this.  They all need firstly
      setting up proper nr_hugepages and hugepage-mmap need to mount hugetlbfs.
      So I add a shell script run_vmtests to do such work which will call the
      three test programs and check the return value of them.
      
      Changes to original code including below:
      a. add run_vmtests script
      b. return error when read_bytes mismatch with writed bytes.
      c. coding style fixes: do not use assignment in if condition
      
      [akpm@linux-foundation.org: build the targets before trying to execute them]
      [akpm@linux-foundation.org: Documentation/vm/ no longer has a Makefile. Fixes "make clean"]
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f0f57b2b
    • Dave Young's avatar
      mm: move slabinfo.c to tools/vm · 63e31553
      Dave Young authored
      We have tools/vm/ folder for vm tools, so move slabinfo.c from tools/slub/
      to tools/vm/
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      63e31553
    • Dave Young's avatar
      mm: move page-types.c from Documentation to tools/vm · c6dd897f
      Dave Young authored
      tools/ is the better place for vm tools which are used by many people.
      Moving them to tools also make them open to more users instead of hide in
      Documentation folder.
      
      This patch moves page-types.c to tools/vm/page-types.c.  Also add a
      Makefile in tools/vm and fix two coding style problems: a) change const
      arrary to 'const char * const', b) change a space to tab for indent.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Acked-by: default avatarWu Fengguang <fengguang.wu@intel.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c6dd897f
    • Andrew Morton's avatar
      selftests/Makefile: make `run_tests' depend on `all' · cab6b056
      Andrew Morton authored
      So a "make run_tests" will build the tests before trying to run them.
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cab6b056
    • Frederic Weisbecker's avatar
      selftests: launch individual selftests from the main Makefile · f467f714
      Frederic Weisbecker authored
      Remove the run_tests script and launch the selftests by calling "make
      run_tests" from the selftests top directory instead.  This delegates to
      the Makefile in each selftest directory, where it is decided how to launch
      the local test.
      
      This removes the need to add each selftest directory to the now removed
      "run_tests" top script.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Dave Young <dyoung@redhat.com>
      Cc: Christoph Lameter <cl@linux.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f467f714
    • Konstantin Khlebnikov's avatar
      radix-tree: use iterators in find_get_pages* functions · 0fc9d104
      Konstantin Khlebnikov authored
      Replace radix_tree_gang_lookup_slot() and
      radix_tree_gang_lookup_tag_slot() in page-cache lookup functions with
      brand-new radix-tree direct iterating.  This avoids the double-scanning
      and pointer copying.
      
      Iterator don't stop after nr_pages page-get fails in a row, it continue
      lookup till the radix-tree end.  Thus we can safely remove these restart
      conditions.
      
      Unfortunately, old implementation didn't forbid nr_pages == 0, this corner
      case does not fit into new code, so the patch adds an extra check at the
      beginning.
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
      Tested-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0fc9d104
    • Konstantin Khlebnikov's avatar
      radix-tree: rewrite gang lookup using iterator · cebbd29e
      Konstantin Khlebnikov authored
      Rewrite radix_tree_gang_lookup_* functions using the new radix-tree
      iterator.
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
      Tested-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cebbd29e
    • Konstantin Khlebnikov's avatar
      radix-tree: introduce bit-optimized iterator · 78c1d784
      Konstantin Khlebnikov authored
      A series of radix tree cleanups, and usage of them in the core pagecache
      code.
      
      Micro-benchmark:
      
      lookup 14 slots (typical page-vector size)
      in radix-tree there earch <step> slot filled and tagged
      before/after - nsec per full scan through tree
      
      * Intel Sandy Bridge i7-2620M 4Mb L3
      New code always faster
      
      * AMD Athlon 6000+ 2x1Mb L2, without L3
      New code generally faster,
      Minor degradation (marked with "*") for huge sparse trees
      
      * i386 on Sandy Bridge
      New code faster for common cases: tagged and dense trees.
      Some degradations for non-tagged lookup on sparse trees.
      
      Ideally, there might help __ffs() analog for searching first non-zero
      long element in array, gcc sometimes cannot optimize this loop corretly.
      
      Numbers:
      
      CPU: Intel Sandy Bridge i7-2620M 4Mb L3
      
      radix-tree with 1024 slots:
      
      tagged lookup
      
      step  1      before  7156        after  3613
      step  2      before  5399        after  2696
      step  3      before  4779        after  1928
      step  4      before  4456        after  1429
      step  5      before  4292        after  1213
      step  6      before  4183        after  1052
      step  7      before  4157        after  951
      step  8      before  4016        after  812
      step  9      before  3952        after  851
      step  10     before  3937        after  732
      step  11     before  4023        after  709
      step  12     before  3872        after  657
      step  13     before  3892        after  633
      step  14     before  3720        after  591
      step  15     before  3879        after  578
      step  16     before  3561        after  513
      
      normal lookup
      
      step  1      before  4266       after  3301
      step  2      before  2695       after  2129
      step  3      before  2083       after  1712
      step  4      before  1801       after  1534
      step  5      before  1628       after  1313
      step  6      before  1551       after  1263
      step  7      before  1475       after  1185
      step  8      before  1432       after  1167
      step  9      before  1373       after  1092
      step  10     before  1339       after  1134
      step  11     before  1292       after  1056
      step  12     before  1319       after  1030
      step  13     before  1276       after  1004
      step  14     before  1256       after  987
      step  15     before  1228       after  992
      step  16     before  1247       after  999
      
      radix-tree with 1024*1024*128 slots:
      
      tagged lookup
      
      step  1      before  1086102841  after  674196409
      step  2      before  816839155   after  498138306
      step  7      before  599728907   after  240676762
      step  15     before  555729253   after  185219677
      step  63     before  606637748   after  128585664
      step  64     before  608384432   after  102945089
      step  65     before  596987114   after  123996019
      step  128    before  304459225   after  56783056
      step  256    before  158846855   after  31232481
      step  512    before  86085652    after  18950595
      step  12345  before  6517189     after  1674057
      
      normal lookup
      
      step  1      before  626064869  after  544418266
      step  2      before  418809975  after  336321473
      step  7      before  242303598  after  207755560
      step  15     before  208380563  after  176496355
      step  63     before  186854206  after  167283638
      step  64     before  176188060  after  170143976
      step  65     before  185139608  after  167487116
      step  128    before  88181865   after  86913490
      step  256    before  45733628   after  45143534
      step  512    before  24506038   after  23859036
      step  12345  before  2177425    after  2018662
      
      * AMD Athlon 6000+ 2x1Mb L2, without L3
      
      radix-tree with 1024 slots:
      
      tag-lookup
      
      step  1      before  8164        after  5379
      step  2      before  5818        after  5581
      step  3      before  4959        after  4213
      step  4      before  4371        after  3386
      step  5      before  4204        after  2997
      step  6      before  4950        after  2744
      step  7      before  4598        after  2480
      step  8      before  4251        after  2288
      step  9      before  4262        after  2243
      step  10     before  4175        after  2131
      step  11     before  3999        after  2024
      step  12     before  3979        after  1994
      step  13     before  3842        after  1929
      step  14     before  3750        after  1810
      step  15     before  3735        after  1810
      step  16     before  3532        after  1660
      
      normal-lookup
      
      step  1      before  7875        after  5847
      step  2      before  4808        after  4071
      step  3      before  4073        after  3462
      step  4      before  3677        after  3074
      step  5      before  4308        after  2978
      step  6      before  3911        after  3807
      step  7      before  3635        after  3522
      step  8      before  3313        after  3202
      step  9      before  3280        after  3257
      step  10     before  3166        after  3083
      step  11     before  3066        after  3026
      step  12     before  2985        after  2982
      step  13     before  2925        after  2924
      step  14     before  2834        after  2808
      step  15     before  2805        after  2803
      step  16     before  2647        after  2622
      
      radix-tree with 1024*1024*128 slots:
      
      tag-lookup
      
      step  1      before  1288059720  after  951736580
      step  2      before  961292300   after  884212140
      step  7      before  768905140   after  547267580
      step  15     before  771319480   after  456550640
      step  63     before  504847640   after  242704304
      step  64     before  392484800   after  177920786
      step  65     before  491162160   after  246895264
      step  128    before  208084064   after  97348392
      step  256    before  112401035   after  51408126
      step  512    before  75825834    after  29145070
      step  12345  before  5603166     after  2847330
      
      normal-lookup
      
      step  1      before  1025677120  after  861375100
      step  2      before  647220080   after  572258540
      step  7      before  505518960   after  484041813
      step  15     before  430483053   after  444815320	*
      step  63     before  388113453   after  404250546	*
      step  64     before  374154666   after  396027440	*
      step  65     before  381423973   after  396704853	*
      step  128    before  190078700   after  202619384	*
      step  256    before  100886756   after  102829108	*
      step  512    before  64074505    after  56158720
      step  12345  before  4237289     after  4422299		*
      
      * i686 on Sandy bridge
      
      radix-tree with 1024 slots:
      
      tagged lookup
      
      step  1      before  7990        after  4019
      step  2      before  5698        after  2897
      step  3      before  5013        after  2475
      step  4      before  4630        after  1721
      step  5      before  4346        after  1759
      step  6      before  4299        after  1556
      step  7      before  4098        after  1513
      step  8      before  4115        after  1222
      step  9      before  3983        after  1390
      step  10     before  4077        after  1207
      step  11     before  3921        after  1231
      step  12     before  3894        after  1116
      step  13     before  3840        after  1147
      step  14     before  3799        after  1090
      step  15     before  3797        after  1059
      step  16     before  3783        after  745
      
      normal lookup
      
      step  1      before  5103       after  3499
      step  2      before  3299       after  2550
      step  3      before  2489       after  2370
      step  4      before  2034       after  2302		*
      step  5      before  1846       after  2268		*
      step  6      before  1752       after  2249		*
      step  7      before  1679       after  2164		*
      step  8      before  1627       after  2153		*
      step  9      before  1542       after  2095		*
      step  10     before  1479       after  2109		*
      step  11     before  1469       after  2009		*
      step  12     before  1445       after  2039		*
      step  13     before  1411       after  2013		*
      step  14     before  1374       after  2046		*
      step  15     before  1340       after  1975		*
      step  16     before  1331       after  2000		*
      
      radix-tree with 1024*1024*128 slots:
      
      tagged lookup
      
      step  1      before  1225865377  after  667153553
      step  2      before  842427423   after  471533007
      step  7      before  609296153   after  276260116
      step  15     before  544232060   after  226859105
      step  63     before  519209199   after  141343043
      step  64     before  588980279   after  141951339
      step  65     before  521099710   after  138282060
      step  128    before  298476778   after  83390628
      step  256    before  149358342   after  43602609
      step  512    before  76994713    after  22911077
      step  12345  before  53286669     after  1472111
      
      normal lookup
      
      step  1      before  819284564  after  533635310
      step  2      before  512421605  after  364956155
      step  7      before  271443305  after  305721345	*
      step  15     before  223591630  after  273960216	*
      step  63     before  190320247  after  217770207	*
      step  64     before  178538168  after  267411372	*
      step  65     before  186400423  after  215347937	*
      step  128    before  88106045   after  140540612	*
      step  256    before  44812420   after  70660377		*
      step  512    before  24435438   after  36328275		*
      step  12345  before  2123924    after  2148062		*
      
      bloat-o-meter delta for this patchset + patchset with related shmem cleanups
      
      bloat-o-meter: x86_64
      
      add/remove: 4/3 grow/shrink: 5/6 up/down: 928/-939 (-11)
      function                                     old     new   delta
      radix_tree_next_chunk                          -     499    +499
      shmem_unuse                                  428     554    +126
      shmem_radix_tree_replace                     131     227     +96
      find_get_pages_tag                           354     419     +65
      find_get_pages_contig                        345     407     +62
      find_get_pages                               362     396     +34
      __kstrtab_radix_tree_next_chunk                -      22     +22
      __ksymtab_radix_tree_next_chunk                -      16     +16
      __kcrctab_radix_tree_next_chunk                -       8      +8
      radix_tree_gang_lookup_slot                  204     203      -1
      static.shmem_xattr_set                       384     381      -3
      radix_tree_gang_lookup_tag_slot              208     191     -17
      radix_tree_gang_lookup                       231     187     -44
      radix_tree_gang_lookup_tag                   247     199     -48
      shmem_unlock_mapping                         278     190     -88
      __lookup                                     217       -    -217
      __lookup_tag                                 242       -    -242
      radix_tree_locate_item                       279       -    -279
      
      bloat-o-meter: i386
      
      add/remove: 3/3 grow/shrink: 8/9 up/down: 1075/-1275 (-200)
      function                                     old     new   delta
      radix_tree_next_chunk                          -     757    +757
      shmem_unuse                                  352     449     +97
      find_get_pages_contig                        269     322     +53
      shmem_radix_tree_replace                     113     154     +41
      find_get_pages_tag                           277     318     +41
      dcache_dir_lseek                             426     458     +32
      __kstrtab_radix_tree_next_chunk                -      22     +22
      vc_do_resize                                 968     977      +9
      snd_pcm_lib_read1                            725     733      +8
      __ksymtab_radix_tree_next_chunk                -       8      +8
      netlbl_cipsov4_list                         1120    1127      +7
      find_get_pages                               293     291      -2
      new_slab                                     467     459      -8
      bitfill_unaligned_rev                        425     417      -8
      radix_tree_gang_lookup_tag_slot              177     146     -31
      blk_dump_cmd                                 267     229     -38
      radix_tree_gang_lookup_slot                  212     134     -78
      shmem_unlock_mapping                         221     128     -93
      radix_tree_gang_lookup_tag                   275     162    -113
      radix_tree_gang_lookup                       255     126    -129
      __lookup                                     227       -    -227
      __lookup_tag                                 271       -    -271
      radix_tree_locate_item                       277       -    -277
      
      This patch:
      
      Implement a clean, simple and effective radix-tree iteration routine.
      
      Iterating divided into two phases:
      * lookup next chunk in radix-tree leaf node
      * iterating through slots in this chunk
      
      Main iterator function radix_tree_next_chunk() returns pointer to first
      slot, and stores in the struct radix_tree_iter index of next-to-last slot.
       For tagged-iterating it also constuct bitmask of tags for retunted chunk.
       All additional logic implemented as static-inline functions and macroses.
      
      Also adds radix_tree_find_next_bit() static-inline variant of
      find_next_bit() optimized for small constant size arrays, because
      find_next_bit() too heavy for searching in an array with one/two long
      elements.
      
      [akpm@linux-foundation.org: rework comments a bit]
      Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
      Tested-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      78c1d784
    • Andrew Morton's avatar
      fs/proc/namespaces.c: prevent crash when ns_entries[] is empty · 4c619aa0
      Andrew Morton authored
      If CONFIG_NET_NS, CONFIG_UTS_NS and CONFIG_IPC_NS are disabled,
      ns_entries[] becomes empty and things like
      ns_entries[ARRAY_SIZE(ns_entries) - 1] will explode.
      Reported-by: default avatarRichard Weinberger <richard@nod.at>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Daniel Lezcano <daniel.lezcano@free.fr>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4c619aa0
    • Wanlong Gao's avatar
      nbd: rename the nbd_device variable from lo to nbd · f4507164
      Wanlong Gao authored
      rename the nbd_device variable from "lo" to "nbd", since "lo" is just a name
      copied from loop.c.
      Signed-off-by: default avatarWanlong Gao <gaowanlong@cn.fujitsu.com>
      Cc: Paul Clements <paul.clements@steeleye.com>
      Cc: Jens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f4507164
    • Daniel Lezcano's avatar
      pidns: add reboot_pid_ns() to handle the reboot syscall · cf3f8921
      Daniel Lezcano authored
      In the case of a child pid namespace, rebooting the system does not really
      makes sense.  When the pid namespace is used in conjunction with the other
      namespaces in order to create a linux container, the reboot syscall leads
      to some problems.
      
      A container can reboot the host.  That can be fixed by dropping the
      sys_reboot capability but we are unable to correctly to poweroff/
      halt/reboot a container and the container stays stuck at the shutdown time
      with the container's init process waiting indefinitively.
      
      After several attempts, no solution from userspace was found to reliabily
      handle the shutdown from a container.
      
      This patch propose to make the init process of the child pid namespace to
      exit with a signal status set to : SIGINT if the child pid namespace
      called "halt/poweroff" and SIGHUP if the child pid namespace called
      "reboot".  When the reboot syscall is called and we are not in the initial
      pid namespace, we kill the pid namespace for "HALT", "POWEROFF",
      "RESTART", and "RESTART2".  Otherwise we return EINVAL.
      
      Returning EINVAL is also an easy way to check if this feature is supported
      by the kernel when invoking another 'reboot' option like CAD.
      
      By this way the parent process of the child pid namespace knows if it
      rebooted or not and can take the right decision.
      
      Test case:
      ==========
      
      #include <alloca.h>
      #include <stdio.h>
      #include <sched.h>
      #include <unistd.h>
      #include <signal.h>
      #include <sys/reboot.h>
      #include <sys/types.h>
      #include <sys/wait.h>
      
      #include <linux/reboot.h>
      
      static int do_reboot(void *arg)
      {
              int *cmd = arg;
      
              if (reboot(*cmd))
                      printf("failed to reboot(%d): %m\n", *cmd);
      }
      
      int test_reboot(int cmd, int sig)
      {
              long stack_size = 4096;
              void *stack = alloca(stack_size) + stack_size;
              int status;
              pid_t ret;
      
              ret = clone(do_reboot, stack, CLONE_NEWPID | SIGCHLD, &cmd);
              if (ret < 0) {
                      printf("failed to clone: %m\n");
                      return -1;
              }
      
              if (wait(&status) < 0) {
                      printf("unexpected wait error: %m\n");
                      return -1;
              }
      
              if (!WIFSIGNALED(status)) {
                      printf("child process exited but was not signaled\n");
                      return -1;
              }
      
              if (WTERMSIG(status) != sig) {
                      printf("signal termination is not the one expected\n");
                      return -1;
              }
      
              return 0;
      }
      
      int main(int argc, char *argv[])
      {
              int status;
      
              status = test_reboot(LINUX_REBOOT_CMD_RESTART, SIGHUP);
              if (status < 0)
                      return 1;
              printf("reboot(LINUX_REBOOT_CMD_RESTART) succeed\n");
      
              status = test_reboot(LINUX_REBOOT_CMD_RESTART2, SIGHUP);
              if (status < 0)
                      return 1;
              printf("reboot(LINUX_REBOOT_CMD_RESTART2) succeed\n");
      
              status = test_reboot(LINUX_REBOOT_CMD_HALT, SIGINT);
              if (status < 0)
                      return 1;
              printf("reboot(LINUX_REBOOT_CMD_HALT) succeed\n");
      
              status = test_reboot(LINUX_REBOOT_CMD_POWER_OFF, SIGINT);
              if (status < 0)
                      return 1;
              printf("reboot(LINUX_REBOOT_CMD_POWERR_OFF) succeed\n");
      
              status = test_reboot(LINUX_REBOOT_CMD_CAD_ON, -1);
              if (status >= 0) {
                      printf("reboot(LINUX_REBOOT_CMD_CAD_ON) should have failed\n");
                      return 1;
              }
              printf("reboot(LINUX_REBOOT_CMD_CAD_ON) has failed as expected\n");
      
              return 0;
      }
      
      [akpm@linux-foundation.org: tweak and add comments]
      [akpm@linux-foundation.org: checkpatch fixes]
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@free.fr>
      Acked-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Tested-by: default avatarSerge Hallyn <serge.hallyn@canonical.com>
      Reviewed-by: default avatarOleg Nesterov <oleg@redhat.com>
      Cc: Michael Kerrisk <mtk.manpages@gmail.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      cf3f8921
    • Akinobu Mita's avatar
      sysctl: use bitmap library functions · 5a04cca6
      Akinobu Mita authored
      Use bitmap_set() instead of using set_bit() for each bit.  This conversion
      is valid because the bitmap is private in the function call and atomic
      bitops were unnecessary.
      
      This also includes minor change.
      - Use bitmap_copy() for shorter typing
      Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5a04cca6
    • Corey Minyard's avatar
      ipmi: use locks on watchdog timeout set on reboot · 423a5bb4
      Corey Minyard authored
      The IPMI watchdog timer clears or extends the timer on reboot/shutdown.
      It was using the non-locking routine for setting the watchdog timer, but
      this was causing race conditions.  Instead, use the locking version to
      avoid the races.  It seems to work fine.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      423a5bb4
    • Corey Minyard's avatar
      ipmi: simplify locking · f60adf42
      Corey Minyard authored
      Now that the the IPMI driver is using a tasklet, we can simplify the
      locking in the driver and get rid of the message lock.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f60adf42
    • Corey Minyard's avatar
      ipmi: fix message handling during panics · 895dcfd1
      Corey Minyard authored
      The part of the IPMI driver that delivered panic information to the event
      log and extended the watchdog timeout during a panic was not properly
      handling the messages.  It used static messages to avoid allocation, but
      wasn't properly waiting for these, or wasn't properly handling the
      refcounts.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      895dcfd1
    • Corey Minyard's avatar
      ipmi: use a tasklet for handling received messages · 7adf579c
      Corey Minyard authored
      The IPMI driver would release a lock, deliver a message, then relock.
      This is obviously ugly, and this patch converts the message handler
      interface to use a tasklet to schedule work.  This lets the receive
      handler be called from an interrupt handler with interrupts enabled.
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7adf579c
    • Matthew Garrett's avatar
      ipmi: increase KCS timeouts · 828dc9da
      Matthew Garrett authored
      We currently time out and retry KCS transactions after 1 second of waiting
      for IBF or OBF.  This appears to be too short for some hardware.  The IPMI
      spec says "All system software wait loops should include error timeouts.
      For simplicity, such timeouts are not shown explicitly in the flow
      diagrams.  A five-second timeout or greater is recommended".  Change the
      timeout to five seconds to satisfy the slow hardware.
      Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      828dc9da
    • Srinivas_Gowda's avatar
      ipmi: decrease the IPMI message transaction time in interrupt mode · b88e7693
      Srinivas_Gowda authored
      Call the event handler immediately after starting the next message.
      
      This change considerably decreases the IPMI transaction time (cuts off
      ~9ms for a single ipmitool transaction).
      Signed-off-by: default avatarSrinivas_Gowda <srinivas_g_gowda@dell.com>
      Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b88e7693
    • Dave Young's avatar
      kdump x86: fix total mem size calculation for reservation · 09c71bfd
      Dave Young authored
      crashkernel reservation need know the total memory size.  Current
      get_total_mem simply use max_pfn - min_low_pfn.  It is wrong because it
      will including memory holes in the middle.
      
      Especially for kvm guest with memory > 0xe0000000, there's below in qemu
      code: qemu split memory as below:
      
          if (ram_size >= 0xe0000000 ) {
              above_4g_mem_size = ram_size - 0xe0000000;
              below_4g_mem_size = 0xe0000000;
          } else {
              below_4g_mem_size = ram_size;
          }
      
      So for 4G mem guest, seabios will insert a 512M usable region beyond of
      4G.  Thus in above case max_pfn - min_low_pfn will be more than original
      memsize.
      
      Fixing this issue by using memblock_phys_mem_size() to get the total
      memsize.
      Signed-off-by: default avatarDave Young <dyoung@redhat.com>
      Reviewed-by: default avatarWANG Cong <xiyou.wangcong@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@verge.net.au>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      09c71bfd