Skip to content
  1. Dec 16, 2011
    • Eugene Surovegin's avatar
      percpu: fix per_cpu_ptr_to_phys() handling of non-page-aligned addresses · 9f57bd4d
      Eugene Surovegin authored
      
      
      per_cpu_ptr_to_phys() incorrectly rounds up its result for non-kmalloc
      case to the page boundary, which is bogus for any non-page-aligned
      address.
      
      This affects the only in-tree user of this function - sysfs handler
      for per-cpu 'crash_notes' physical address.  The trouble is that the
      crash_notes per-cpu variable is not page-aligned:
      
      crash_notes = 0xc08e8ed4
      PER-CPU OFFSET VALUES:
       CPU 0: 3711f000
       CPU 1: 37129000
       CPU 2: 37133000
       CPU 3: 3713d000
      
      So, the per-cpu addresses are:
       crash_notes on CPU 0: f7a07ed4 => phys 36b57ed4
       crash_notes on CPU 1: f7a11ed4 => phys 36b4ded4
       crash_notes on CPU 2: f7a1bed4 => phys 36b43ed4
       crash_notes on CPU 3: f7a25ed4 => phys 36b39ed4
      
      However, /sys/devices/system/cpu/cpu*/crash_notes says:
       /sys/devices/system/cpu/cpu0/crash_notes: 36b57000
       /sys/devices/system/cpu/cpu1/crash_notes: 36b4d000
       /sys/devices/system/cpu/cpu2/crash_notes: 36b43000
       /sys/devices/system/cpu/cpu3/crash_notes: 36b39000
      
      As you can see, all values are rounded down to a page
      boundary. Consequently, this is where kexec sets up the NOTE segments,
      and thus where the secondary kernel is looking for them. However, when
      the first kernel crashes, it saves the notes to the unaligned
      addresses, where they are not found.
      
      Fix it by adding offset_in_page() to the translated page address.
      
      -tj: Combined Eugene's and Petr's commit messages.
      
      Signed-off-by: default avatarEugene Surovegin <ebs@ebshome.net>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Reported-by: default avatarPetr Tesarik <ptesarik@suse.cz>
      Cc: stable@kernel.org
      9f57bd4d
    • Linus Torvalds's avatar
      Merge branch 'stable/for-linus-fixes-3.2' of... · 42ebfc61
      Linus Torvalds authored
      Merge branch 'stable/for-linus-fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
      
      * 'stable/for-linus-fixes-3.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
        xen/swiotlb: Use page alignment for early buffer allocation.
        xen: only limit memory map to maximum reservation for domain 0.
      42ebfc61
    • Konrad Rzeszutek Wilk's avatar
      xen/swiotlb: Use page alignment for early buffer allocation. · 63a74175
      Konrad Rzeszutek Wilk authored
      
      
      This fixes an odd bug found on a Dell PowerEdge 1850/0RC130
      (BIOS A05 01/09/2006) where all of the modules doing pci_set_dma_mask
      would fail with:
      
      ata_piix 0000:00:1f.1: enabling device (0005 -> 0007)
      ata_piix 0000:00:1f.1: can't derive routing for PCI INT A
      ata_piix 0000:00:1f.1: BMDMA: failed to set dma mask, falling back to PIO
      
      The issue was the Xen-SWIOTLB was allocated such as that the end of
      buffer was stradling a page (and also above 4GB). The fix was
      spotted by Kalev Leonid  which was to piggyback on git commit
      e79f86b2 "swiotlb: Use page alignment
      for early buffer allocation" which:
      
      	We could call free_bootmem_late() if swiotlb is not used, and
      	it will shrink to page alignment.
      
      	So alloc them with page alignment at first, to avoid lose two pages
      
      And doing that fixes the outstanding issue.
      
      CC: stable@kernel.org
      Suggested-by: default avatar"Kalev, Leonid" <Leonid.Kalev@ca.com>
      Reported-and-Tested-by: default avatar"Taylor, Neal E" <Neal.Taylor@ca.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      63a74175
    • Ian Campbell's avatar
      xen: only limit memory map to maximum reservation for domain 0. · d3db7281
      Ian Campbell authored
      
      
      d312ae87 "xen: use maximum reservation to limit amount of usable RAM"
      clamped the total amount of RAM to the current maximum reservation. This is
      correct for dom0 but is not correct for guest domains. In order to boot a guest
      "pre-ballooned" (e.g. with memory=1G but maxmem=2G) in order to allow for
      future memory expansion the guest must derive max_pfn from the e820 provided by
      the toolstack and not the current maximum reservation (which can reflect only
      the current maximum, not the guest lifetime max). The existing algorithm
      already behaves this correctly if we do not artificially limit the maximum
      number of pages for the guest case.
      
      For a guest booted with maxmem=512, memory=128 this results in:
       [    0.000000] BIOS-provided physical RAM map:
       [    0.000000]  Xen: 0000000000000000 - 00000000000a0000 (usable)
       [    0.000000]  Xen: 00000000000a0000 - 0000000000100000 (reserved)
      -[    0.000000]  Xen: 0000000000100000 - 0000000008100000 (usable)
      -[    0.000000]  Xen: 0000000008100000 - 0000000020800000 (unusable)
      +[    0.000000]  Xen: 0000000000100000 - 0000000020800000 (usable)
      ...
       [    0.000000] NX (Execute Disable) protection: active
       [    0.000000] DMI not present or invalid.
       [    0.000000] e820 update range: 0000000000000000 - 0000000000010000 (usable) ==> (reserved)
       [    0.000000] e820 remove range: 00000000000a0000 - 0000000000100000 (usable)
      -[    0.000000] last_pfn = 0x8100 max_arch_pfn = 0x1000000
      +[    0.000000] last_pfn = 0x20800 max_arch_pfn = 0x1000000
       [    0.000000] initial memory mapped : 0 - 027ff000
       [    0.000000] Base memory trampoline at [c009f000] 9f000 size 4096
      -[    0.000000] init_memory_mapping: 0000000000000000-0000000008100000
      -[    0.000000]  0000000000 - 0008100000 page 4k
      -[    0.000000] kernel direct mapping tables up to 8100000 @ 27bb000-27ff000
      +[    0.000000] init_memory_mapping: 0000000000000000-0000000020800000
      +[    0.000000]  0000000000 - 0020800000 page 4k
      +[    0.000000] kernel direct mapping tables up to 20800000 @ 26f8000-27ff000
       [    0.000000] xen: setting RW the range 27e8000 - 27ff000
       [    0.000000] 0MB HIGHMEM available.
      -[    0.000000] 129MB LOWMEM available.
      -[    0.000000]   mapped low ram: 0 - 08100000
      -[    0.000000]   low ram: 0 - 08100000
      +[    0.000000] 520MB LOWMEM available.
      +[    0.000000]   mapped low ram: 0 - 20800000
      +[    0.000000]   low ram: 0 - 20800000
      
      With this change "xl mem-set <domain> 512M" will successfully increase the
      guest RAM (by reducing the balloon).
      
      There is no change for dom0.
      
      Reported-and-Tested-by: default avatarGeorge Shuklin <george.shuklin@gmail.com>
      Signed-off-by: default avatarIan Campbell <ian.campbell@citrix.com>
      Cc: stable@kernel.org
      Reviewed-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      d3db7281
  2. Dec 15, 2011
  3. Dec 14, 2011
  4. Dec 13, 2011
    • Miklos Szeredi's avatar
      fuse: llseek fix race · 73104b6e
      Miklos Szeredi authored
      
      
      Fix race between lseek(fd, 0, SEEK_CUR) and read/write.  This was fixed in
      generic code by commit 5b6f1eb9 (vfs: lseek(fd, 0, SEEK_CUR) race condition).
      
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      73104b6e
    • Roel Kluin's avatar
      fuse: fix llseek bug · b48c6af2
      Roel Kluin authored
      
      
      The test in fuse_file_llseek() "not SEEK_CUR or not SEEK_SET" always evaluates
      to true.
      
      This was introduced in 3.1 by commit 06222e49 (fs: handle SEEK_HOLE/SEEK_DATA
      properly in all fs's that define their own llseek) and changed the behavior of
      SEEK_CUR and SEEK_SET to always retrieve the file attributes.  This is a
      performance regression.
      
      Fix the test so that it makes sense.
      
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@vger.kernel.org
      CC: Josef Bacik <josef@redhat.com>
      CC: Al Viro <viro@zeniv.linux.org.uk>
      b48c6af2
    • Miklos Szeredi's avatar
      fuse: fix fuse_retrieve · 48706d0a
      Miklos Szeredi authored
      
      
      Fix two bugs in fuse_retrieve():
      
       - retrieving more than one page would yield repeated instances of the
         first page
      
       - if more than FUSE_MAX_PAGES_PER_REQ pages were requested than the
         request page array would overflow
      
      fuse_retrieve() was added in 2.6.36 and these bugs had been there since the
      beginning.
      
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@vger.kernel.org
      48706d0a
    • Linus Torvalds's avatar
      linux/log2.h: Fix rounddown_pow_of_two(1) · 13c07b02
      Linus Torvalds authored
      
      
      Exactly like roundup_pow_of_two(1), the rounddown version was buggy for
      the case of a compile-time constant '1' argument.  Probably because it
      originated from the same code, sharing history with the roundup version
      from before the bugfix (for that one, see commit 1a06a52e: "Fix
      roundup_pow_of_two(1)").
      
      However, unlike the roundup version, the fix for rounddown is to just
      remove the broken special case entirely.  It's simply not needed - the
      generic code
      
          1UL << ilog2(n)
      
      does the right thing for the constant '1' argment too.  The only reason
      roundup needed that special case was because rounding up does so by
      subtracting one from the argument (and then adding one to the result)
      causing the obvious problems with "ilog2(0)".
      
      But rounddown doesn't do any of that, since ilog2() naturally truncates
      (ie "rounds down") to the right rounded down value.  And without the
      ilog2(0) case, there's no reason for the special case that had the wrong
      value.
      
      tl;dr: rounddown_pow_of_two(1) should be 1, not 0.
      
      Acked-by: default avatarDmitry Torokhov <dtor@vmware.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      13c07b02
    • Linus Torvalds's avatar
      Merge branch 'hwmon-for-linus' of... · 12870da5
      Linus Torvalds authored
      Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      * 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (jz4740) Staticise jz4740_hwmon_driver
        hwmon: (jz4740) fix signedness bug
      12870da5
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc · 71fe5cca
      Linus Torvalds authored
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc:
        mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
        mmc: sdhci-s3c: Remove old and misprototyped suspend operations
        mmc: tmio: fix clock gating on platforms with a .set_pwr() method
        mmc: sh_mmcif: fix clock gating on platforms with a .down_pwr() method
        mmc: core: Fix typo at mmc_card_sleep
        mmc: core: Fix power_off_notify during suspend
        mmc: core: Fix setting power notify state variable for non-eMMC
        mmc: core: Add quirk for long data read time
        mmc: Add module.h include to sdhci-cns3xxx.c
        mmc: mxcmmc: fix falling back to PIO
        mmc: omap_hsmmc: DMA unmap only once in case of MMC error
      71fe5cca
    • Theodore Ts'o's avatar
      ext4: display the correct mount option in /proc/mounts for [no]init_itable · fc6cb1cd
      Theodore Ts'o authored
      
      
      /proc/mounts was showing the mount option [no]init_inode_table when
      the correct mount option that will be accepted by parse_options() is
      [no]init_itable.
      
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: stable@kernel.org
      fc6cb1cd
    • Keith Packard's avatar
      Revert "x86, efi: Calling __pa() with an ioremap()ed address is invalid" · e1ad783b
      Keith Packard authored
      
      
      This hangs my MacBook Air at boot time; I get no console
      messages at all. I reverted this on top of -rc5 and my machine
      boots again.
      
      This reverts commit e8c71062.
      
      Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
      Signed-off-by: default avatarKeith Packard <keithp@keithp.com>
      Acked-by: default avatarH. Peter Anvin <hpa@zytor.com>
      Cc: Matthew Garrett <mjg@redhat.com>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Cc: Huang Ying <huang.ying.caritas@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Link: http://lkml.kernel.org/r/1321621751-3650-1-git-send-email-matt@console
      
      
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e1ad783b
    • Sage Weil's avatar
      crush: fix mapping calculation when force argument doesn't exist · f1932fc1
      Sage Weil authored
      
      
      If the force argument isn't valid, we should continue calculating a
      mapping as if it weren't specified.
      
      Signed-off-by: default avatarSage Weil <sage@newdream.net>
      f1932fc1
    • Axel Lin's avatar
      hwmon: (jz4740) Staticise jz4740_hwmon_driver · d6c4f2ac
      Axel Lin authored
      
      
      It is not used outside this driver so no need to make the symbol global.
      
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
      d6c4f2ac
    • Axel Lin's avatar
      hwmon: (jz4740) fix signedness bug · 0b57d760
      Axel Lin authored
      
      
      wait_for_completion_interruptible_timeout() may return negative value.
      In this case, checking if (t > 0)  will return true if t is unsigned.
      
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
      Cc: stable@kernel.org (3.0+)
      Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
      0b57d760
    • Paul Mackerras's avatar
      ext4: Fix crash due to getting bogus eh_depth value on big-endian systems · b4611abf
      Paul Mackerras authored
      
      
      Commit 1939dd84 ("ext4: cleanup ext4_ext_grow_indepth code") added a
      reference to ext4_extent_header.eh_depth, but forget to pass the value
      read through le16_to_cpu.  The result is a crash on big-endian
      machines, such as this crash on a POWER7 server:
      
      attempt to access beyond end of device
      sda8: rw=0, want=776392648163376, limit=168558560
      Unable to handle kernel paging request for data at address 0x6b6b6b6b6b6b6bcb
      Faulting instruction address: 0xc0000000001f5f38
      cpu 0x14: Vector: 300 (Data Access) at [c000001bd1aaecf0]
          pc: c0000000001f5f38: .__brelse+0x18/0x60
          lr: c0000000002e07a4: .ext4_ext_drop_refs+0x44/0x80
          sp: c000001bd1aaef70
         msr: 9000000000009032
         dar: 6b6b6b6b6b6b6bcb
       dsisr: 40000000
        current = 0xc000001bd15b8010
        paca    = 0xc00000000ffe4600
          pid   = 19911, comm = flush-8:0
      enter ? for help
      [c000001bd1aaeff0] c0000000002e07a4 .ext4_ext_drop_refs+0x44/0x80
      [c000001bd1aaf090] c0000000002e0c58 .ext4_ext_find_extent+0x408/0x4c0
      [c000001bd1aaf180] c0000000002e145c .ext4_ext_insert_extent+0x2bc/0x14c0
      [c000001bd1aaf2c0] c0000000002e3fb8 .ext4_ext_map_blocks+0x628/0x1710
      [c000001bd1aaf420] c0000000002b2974 .ext4_map_blocks+0x224/0x310
      [c000001bd1aaf4d0] c0000000002b7f2c .mpage_da_map_and_submit+0xbc/0x490
      [c000001bd1aaf5a0] c0000000002b8688 .write_cache_pages_da+0x2c8/0x430
      [c000001bd1aaf720] c0000000002b8b28 .ext4_da_writepages+0x338/0x670
      [c000001bd1aaf8d0] c000000000157280 .do_writepages+0x40/0x90
      [c000001bd1aaf940] c0000000001ea830 .writeback_single_inode+0xe0/0x530
      [c000001bd1aafa00] c0000000001eb680 .writeback_sb_inodes+0x210/0x300
      [c000001bd1aafb20] c0000000001ebc84 .__writeback_inodes_wb+0xd4/0x140
      [c000001bd1aafbe0] c0000000001ebfec .wb_writeback+0x2fc/0x3e0
      [c000001bd1aafce0] c0000000001ed770 .wb_do_writeback+0x2f0/0x300
      [c000001bd1aafdf0] c0000000001ed848 .bdi_writeback_thread+0xc8/0x340
      [c000001bd1aafed0] c0000000000c5494 .kthread+0xb4/0xc0
      [c000001bd1aaff90] c000000000021f48 .kernel_thread+0x54/0x70
      
      This is due to getting ext_depth(inode) == 0x101 and therefore running
      off the end of the path array in ext4_ext_drop_refs into following
      unallocated structures.
      
      This fixes it by adding the necessary le16_to_cpu.
      
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      b4611abf
  5. Dec 12, 2011
  6. Dec 11, 2011