Skip to content
  1. May 19, 2012
    • H. Peter Anvin's avatar
      x86, realmode: 16-bit real-mode code support for relocs tool · 6520fe55
      H. Peter Anvin authored
      
      
      A new option is added to the relocs tool called '--realmode'.
      This option causes the generation of 16-bit segment relocations
      and 32-bit linear relocations for the real-mode code. When
      the real-mode code is moved to the low-memory during kernel
      initialization, these relocation entries can be used to
      relocate the code properly.
      
      In the assembly code 16-bit segment relocations must be relative
      to the 'real_mode_seg' absolute symbol. Linear relocations must be
      relative to a symbol prefixed with 'pa_'.
      
      16-bit segment relocation is used to load cs:ip in 16-bit code.
      Linear relocations are used in the 32-bit code for relocatable
      data references. They are declared in the linker script of the
      real-mode code.
      
      The relocs tool is moved to arch/x86/tools/relocs.c, and added new
      target archscripts that can be used to build scripts needed building
      an architecture.  be compiled before building the arch/x86 tree.
      
      [ hpa: accelerating this because it detects invalid absolute
        relocations, a serious bug in binutils 2.22.52.0.x which currently
        produces bad kernels. ]
      
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Link: http://lkml.kernel.org/r/1336501366-28617-2-git-send-email-jarkko.sakkinen@intel.com
      
      
      Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@intel.com>
      Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      6520fe55
  2. May 13, 2012
  3. May 12, 2012
    • Benjamin Herrenschmidt's avatar
      powerpc/irq: Fix another case of lazy IRQ state getting out of sync · 7c0482e3
      Benjamin Herrenschmidt authored
      
      
      So we have another case of paca->irq_happened getting out of
      sync with the HW irq state. This can happen when a perfmon
      interrupt occurs while soft disabled, as it will return to a
      soft disabled but hard enabled context while leaving a stale
      PACA_IRQ_HARD_DIS flag set.
      
      This patch fixes it, and also adds a test for the condition
      of those flags being out of sync in arch_local_irq_restore()
      when CONFIG_TRACE_IRQFLAGS is enabled.
      
      This helps catching those gremlins faster (and so far I
      can't seem see any anymore, so that's good news).
      
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      7c0482e3
  4. May 11, 2012
    • Rolf Eike Beer's avatar
      parisc: move definition of PAGE0 to asm/page.h · 4a8a0788
      Rolf Eike Beer authored
      
      
      This was defined in asm/pdc.h which needs to include asm/page.h for
      __PAGE_OFFSET. This leads to an include loop so that page.h eventually will
      include pdc.h again. While this is no problem because of header guards, it is
      a problem because some symbols may be undefined. Such an error is this:
      
      In file included from include/linux/bitops.h:35:0,
                       from include/asm-generic/getorder.h:7,
                       from arch/parisc/include/asm/page.h:162,
                       from arch/parisc/include/asm/pdc.h:346,
                       from arch/parisc/include/asm/processor.h:16,
                       from arch/parisc/include/asm/spinlock.h:6,
                       from arch/parisc/include/asm/atomic.h:20,
                       from include/linux/atomic.h:4,
                       from include/linux/sysfs.h:20,
                       from include/linux/kobject.h:21,
                       from include/linux/device.h:17,
                       from include/linux/eisa.h:5,
                       from arch/parisc/kernel/pci.c:11:
      arch/parisc/include/asm/bitops.h: In function ‘set_bit’:
      arch/parisc/include/asm/bitops.h:82:2: error: implicit declaration of function ‘_atomic_spin_lock_irqsave’ [-Werror=implicit-function-declaration]
      arch/parisc/include/asm/bitops.h:84:2: error: implicit declaration of function ‘_atomic_spin_unlock_irqrestore’ [-Werror=implicit-function-declaration]
      
      Signed-off-by: default avatarRolf Eike Beer <eike-kernel@sf-tec.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4a8a0788
    • Rolf Eike Beer's avatar
      parisc: add missing include of asm/page.h to asm/pgtable.h · 9b05b1ec
      Rolf Eike Beer authored
      
      
      Fixes these errors:
      
      In file included from arch/parisc/include/asm/io.h:5:0,
                       from include/linux/io.h:22,
                       from include/linux/pci.h:54,
                       from arch/parisc/kernel/setup.c:35:
      arch/parisc/include/asm/pgtable.h:92:6: warning: "PAGE_SHIFT" is not defined [-Wundef]
      arch/parisc/include/asm/pgtable.h:92:6: warning: "PAGE_SHIFT" is not defined [-Wundef]
      arch/parisc/include/asm/pgtable.h:92:6: warning: "BITS_PER_PTE_ENTRY" is not defined [-Wundef]
      
      Signed-off-by: default avatarRolf Eike Beer <eike-kernel@sf-tec.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9b05b1ec
    • Rolf Eike Beer's avatar
      parisc: drop include of asm/pdc.h from asm/hardware.h · 6eb608f5
      Rolf Eike Beer authored
      
      
      It seems none of the symbols defined by pdc.h is needed, but it introduces an
      include loop causing compile errors:
      
      In file included from arch/parisc/include/asm/spinlock.h:4:0,
                       from arch/parisc/include/asm/atomic.h:20,
                       from include/linux/atomic.h:4,
                       from arch/parisc/include/asm/bitops.h:56,
                       from include/linux/bitops.h:35,
                       from include/asm-generic/getorder.h:7,
                       from arch/parisc/include/asm/page.h:162,
                       from arch/parisc/include/asm/pdc.h:346,
                       from arch/parisc/include/asm/hardware.h:5,
                       from arch/parisc/kernel/hardware.c:30:
      arch/parisc/include/asm/processor.h:74:16: error: field ‘cpu_type’ has incomplete type
      arch/parisc/include/asm/processor.h:77:20: error: field ‘model’ has incomplete type
      arch/parisc/include/asm/processor.h: In function ‘parisc_requires_coherency’:
      arch/parisc/include/asm/processor.h:349:36: error: ‘mako’ undeclared (first use in this function)
      arch/parisc/include/asm/processor.h:349:36: note: each undeclared identifier is reported only once for each function it appears in
      arch/parisc/include/asm/processor.h:350:30: error: ‘mako2’ undeclared (first use in this function)
      
      Signed-off-by: default avatarRolf Eike Beer <eike-kernel@sf-tec.de>
      Acked-by: default avatarGrant Grundler <grantgrundler@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6eb608f5
    • Rolf Eike Beer's avatar
      parisc: add missing forward declarations in asm/hardware.h · 25fe853d
      Rolf Eike Beer authored
      
      
      Fixes this warnings:
      
      In file included from arch/parisc/include/asm/processor.h:15:0,
                       from arch/parisc/include/asm/spinlock.h:4,
                       from arch/parisc/include/asm/atomic.h:20,
                       from include/linux/atomic.h:4,
                       from arch/parisc/include/asm/bitops.h:11,
                       from include/linux/bitops.h:22,
                       from include/linux/kernel.h:19,
                       from include/linux/sched.h:55,
                       from arch/parisc/kernel/asm-offsets.c:31:
      arch/parisc/include/asm/hardware.h:106:10: warning: ‘struct hardware_path’ declared inside parameter list [enabled by default]
      arch/parisc/include/asm/hardware.h:106:10: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
      arch/parisc/include/asm/hardware.h:116:59: warning: ‘struct hardware_path’ declared inside parameter list [enabled by default]
      arch/parisc/include/asm/hardware.h:118:47: warning: ‘struct hardware_path’ declared inside parameter list [enabled by default]
      arch/parisc/include/asm/hardware.h:119:57: warning: ‘struct hardware_path’ declared inside parameter list [enabled by default]
      
      Signed-off-by: default avatarRolf Eike Beer <eike-kernel@sf-tec.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      25fe853d
    • Rolf Eike Beer's avatar
      parisc: add missing includes in asm/spinlock.h · 1cab4201
      Rolf Eike Beer authored
      
      
      This leads to this errors:
      
      In file included from arch/parisc/include/asm/atomic.h:20:0,
                       from include/linux/atomic.h:4,
                       from arch/parisc/include/asm/bitops.h:56,
                       from include/linux/bitops.h:22,
                       from include/linux/kernel.h:19,
                       from include/linux/sched.h:55,
                       from arch/parisc/kernel/asm-offsets.c:31:
      arch/parisc/include/asm/spinlock.h: In function ‘arch_spin_is_locked’:
      arch/parisc/include/asm/spinlock.h:9:2: error: implicit declaration of function ‘__ldcw_align’ [-Werror=implicit-function-declaration]
      arch/parisc/include/asm/spinlock.h:9:29: warning: initialization makes pointer from integer without a cast [enabled by default]
      arch/parisc/include/asm/spinlock.h: In function ‘arch_spin_lock_flags’:
      arch/parisc/include/asm/spinlock.h:22:2: error: implicit declaration of function ‘mb’ [-Werror=implicit-function-declaration]
      arch/parisc/include/asm/spinlock.h:23:4: warning: assignment makes pointer from integer without a cast [enabled by default]
      arch/parisc/include/asm/spinlock.h:24:2: error: implicit declaration of function ‘__ldcw’ [-Werror=implicit-function-declaration]
      
      Signed-off-by: default avatarRolf Eike Beer <eike-kernel@sf-tec.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1cab4201
    • David S. Miller's avatar
      sparc64: Do not clobber %g2 in xcall_fetch_glob_regs(). · a5a737e0
      David S. Miller authored
      
      
      %g2 is meant to hold the CPUID number throughout this routine, since
      at the very beginning, and at the very end, we use %g2 to calculate
      indexes into per-cpu arrays.
      
      However we erroneously clobber it in order to hold the %cwp register
      value mid-stream.
      
      Fix this code to use %g3 for the %cwp read and related calulcations
      instead.
      
      Reported-by: default avatarMeelis Roos <mroos@linux.ee>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a5a737e0
  5. May 09, 2012
  6. May 08, 2012
    • David Gibson's avatar
      KVM: PPC: Book3S HV: Fix refcounting of hugepages · de6c0b02
      David Gibson authored
      
      
      The H_REGISTER_VPA hcall implementation in HV Power KVM needs to pin some
      guest memory pages into host memory so that they can be safely accessed
      from usermode.  It does this used get_user_pages_fast().  When the VPA is
      unregistered, or the VCPUs are cleaned up, these pages are released using
      put_page().
      
      However, the get_user_pages() is invoked on the specific memory are of the
      VPA which could lie within hugepages.  In case the pinned page is huge,
      we explicitly find the head page of the compound page before calling
      put_page() on it.
      
      At least with the latest kernel, this is not correct.  put_page() already
      handles finding the correct head page of a compound, and also deals with
      various counts on the individual tail page which are important for
      transparent huge pages.  We don't support transparent hugepages on Power,
      but even so, bypassing this count maintenance can lead (when the VM ends)
      to a hugepage being released back to the pool with a non-zero mapcount on
      one of the tail pages.  This can then lead to a bad_page() when the page
      is released from the hugepage pool.
      
      This removes the explicit compound_head() call to correct this bug.
      
      Signed-off-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Acked-by: default avatarAlexander Graf <agraf@suse.de>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      de6c0b02
    • Steven King's avatar
      m68knommu: enable qspi support when SPI_COLDFIRE_QSPI = m · 83ca6009
      Steven King authored
      
      
      Enable Coldfire QSPI support when SPI_COLDFIRE_QSPI is built as a module.
      
      This version of the patch combines changes to the config files and  device.c
      and uses IF_ENABLED (thanks to Sam Ravnborg for the suggestion).
      
      Signed-off-by: default avatarSteven King <sfking@fdwdc.com>
      Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
      83ca6009
    • David Vrabel's avatar
      xen/pci: don't use PCI BIOS service for configuration space accesses · 76a8df7b
      David Vrabel authored
      
      
      The accessing PCI configuration space with the PCI BIOS32 service does
      not work in PV guests.
      
      On systems without MMCONFIG or where the BIOS hasn't marked the
      MMCONFIG region as reserved in the e820 map, the BIOS service is
      probed (even though direct access is preferred) and this hangs.
      
      CC: stable@kernel.org
      Acked-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
      [v1: Fixed compile error when CONFIG_PCI is not set]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      76a8df7b
  7. May 07, 2012
    • Konrad Rzeszutek Wilk's avatar
      xen/pte: Fix crashes when trying to see non-existent PGD/PMD/PUD/PTEs · b7e5ffe5
      Konrad Rzeszutek Wilk authored
      
      
      If I try to do "cat /sys/kernel/debug/kernel_page_tables"
      I end up with:
      
      BUG: unable to handle kernel paging request at ffffc7fffffff000
      IP: [<ffffffff8106aa51>] ptdump_show+0x221/0x480
      PGD 0
      Oops: 0000 [#1] SMP
      CPU 0
      .. snip..
      RAX: 0000000000000000 RBX: ffffc00000000fff RCX: 0000000000000000
      RDX: 0000800000000000 RSI: 0000000000000000 RDI: ffffc7fffffff000
      
      which is due to the fact we are trying to access a PFN that is not
      accessible to us. The reason (at least in this case) was that
      PGD[256] is set to __HYPERVISOR_VIRT_START which was setup (by the
      hypervisor) to point to a read-only linear map of the MFN->PFN array.
      During our parsing we would get the MFN (a valid one), try to look
      it up in the MFN->PFN tree and find it invalid and return ~0 as PFN.
      Then pte_mfn_to_pfn would happilly feed that in, attach the flags
      and return it back to the caller. 'ptdump_show' bitshifts it and
      gets and invalid value that it tries to dereference.
      
      Instead of doing all of that, we detect the ~0 case and just
      return !_PAGE_PRESENT.
      
      This bug has been in existence .. at least until 2.6.37 (yikes!)
      
      CC: stable@kernel.org
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      b7e5ffe5
    • Konrad Rzeszutek Wilk's avatar
      xen/apic: Return the APIC ID (and version) for CPU 0. · 558daa28
      Konrad Rzeszutek Wilk authored
      
      
      On x86_64 on AMD machines where the first APIC_ID is not zero, we get:
      
      ACPI: LAPIC (acpi_id[0x01] lapic_id[0x10] enabled)
      BIOS bug: APIC version is 0 for CPU 1/0x10, fixing up to 0x10
      BIOS bug: APIC version mismatch, boot CPU: 0, CPU 1: version 10
      
      which means that when the ACPI processor driver loads and
      tries to parse the _Pxx states it fails to do as, as it
      ends up calling acpi_get_cpuid which does this:
      
      for_each_possible_cpu(i) {
              if (cpu_physical_id(i) == apic_id)
                      return i;
      }
      
      And the bootup CPU, has not been found so it fails and returns -1
      for the first CPU - which then subsequently in the loop that
      "acpi_processor_get_info" does results in returning an error, which
      means that "acpi_processor_add" failing and per_cpu(processor)
      is never set (and is NULL).
      
      That means that when xen-acpi-processor tries to load (much much
      later on) and parse the P-states it gets -ENODEV from
      acpi_processor_register_performance() (which tries to read
      the per_cpu(processor)) and fails to parse the data.
      
      Reported-by-and-Tested-by: default avatarStefan Bader <stefan.bader@canonical.com>
      Suggested-by: default avatarBoris Ostrovsky <boris.ostrovsky@amd.com>
      [v2: Bit-shift APIC ID by 24 bits]
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      558daa28
    • Larry Finger's avatar
      IA32 emulation: Fix build problem for modular ia32 a.out support · febb72a6
      Larry Finger authored
      Commit ce7e5d2d
      
       ("x86: fix broken TASK_SIZE for ia32_aout") breaks
      kernel builds when "CONFIG_IA32_AOUT=m" with
      
        ERROR: "set_personality_ia32" [arch/x86/ia32/ia32_aout.ko] undefined!
        make[1]: *** [__modpost] Error 1
      
      The entry point needs to be exported.
      
      Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
      Acked-by: default avatarAl Viro <viro@zeniv.linux.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      febb72a6
    • Al Viro's avatar
      x86: fix broken TASK_SIZE for ia32_aout · ce7e5d2d
      Al Viro authored
      
      
      Setting TIF_IA32 in load_aout_binary() used to be enough; these days
      TASK_SIZE is controlled by TIF_ADDR32 and that one doesn't get set
      there.  Switch to use of set_personality_ia32()...
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ce7e5d2d
  8. May 06, 2012
    • Gleb Natapov's avatar
      KVM: Do not take reference to mm during async #PF · 62c49cc9
      Gleb Natapov authored
      
      
      It turned to be totally unneeded. The reason the code was introduced is
      so that KVM can prefault swapped in page, but prefault can fail even
      if mm is pinned since page table can change anyway. KVM handles this
      situation correctly though and does not inject spurious page faults.
      
      Fixes:
       "INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected" warning while
       running LTP inside a KVM guest using the recent -next kernel.
      
      Reported-by: default avatarSasha Levin <levinsasha928@gmail.com>
      Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      62c49cc9
    • Gleb Natapov's avatar
      KVM: ensure async PF event wakes up vcpu from halt · a4fa1635
      Gleb Natapov authored
      
      
      If vcpu executes hlt instruction while async PF is waiting to be delivered
      vcpu can block and deliver async PF only after another even wakes it
      up. This happens because kvm_check_async_pf_completion() will remove
      completion event from vcpu->async_pf.done before entering kvm_vcpu_block()
      and this will make kvm_arch_vcpu_runnable() return false. The solution
      is to make vcpu runnable when processing completion.
      
      Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      a4fa1635
    • Colin Cross's avatar
      ARM: 7414/1: SMP: prevent use of the console when using idmap_pgd · fde165b2
      Colin Cross authored
      Commit 4e8ee7de
      
       (ARM: SMP: use
      idmap_pgd for mapping MMU enable during secondary booting)
      switched secondary boot to use idmap_pgd, which is initialized
      during early_initcall, instead of a page table initialized during
      __cpu_up.  This causes idmap_pgd to contain the static mappings
      but be missing all dynamic mappings.
      
      If a console is registered that creates a dynamic mapping, the
      printk in secondary_start_kernel will trigger a data abort on
      the missing mapping before the exception handlers have been
      initialized, leading to a hang.  Initial boot is not affected
      because no consoles have been registered, and resume is usually
      not affected because the offending console is suspended.
      Onlining a cpu with hotplug triggers the problem.
      
      A workaround is to the printk in secondary_start_kernel until
      after the page tables have been switched back to init_mm.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarColin Cross <ccross@android.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      fde165b2
    • Jiri Slaby's avatar
      TTY: pdc_cons, fix regression in close · 49a5f3cf
      Jiri Slaby authored
      The test in pdc_console_tty_close '!tty->count' was always wrong
      because tty->count is decremented after tty->ops->close is called and
      thus can never be zero. Hence the 'then' branch was never executed and
      the timer never deleted.
      
      This did not matter until commit 5dd5bc40
      
       ("TTY: pdc_cons, use
      tty_port").  There we needed to set TTY in tty_port to NULL, but this
      never happened due to the bug above.
      
      So change the test to really trigger at the last close by changing the
      condition to 'tty->count == 1'.
      
      Well, the driver should not touch tty->count at all.  It should use
      tty_port->count and count open count there itself.
      
      Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
      Reported-and-tested-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      49a5f3cf
  9. May 05, 2012
  10. May 04, 2012
    • Linus Torvalds's avatar
      vfs: make word-at-a-time accesses handle a non-existing page · e419b4cc
      Linus Torvalds authored
      
      
      It turns out that there are more cases than CONFIG_DEBUG_PAGEALLOC that
      can have holes in the kernel address space: it seems to happen easily
      with Xen, and it looks like the AMD gart64 code will also punch holes
      dynamically.
      
      Actually hitting that case is still very unlikely, so just do the
      access, and take an exception and fix it up for the very unlikely case
      of it being a page-crosser with no next page.
      
      And hey, this abstraction might even help other architectures that have
      other issues with unaligned word accesses than the possible missing next
      page.  IOW, this could do the byte order magic too.
      
      Peter Anvin fixed a thinko in the shifting for the exception case.
      
      Reported-and-tested-by: default avatarJana Saout <jana@saout.de>
      Cc:  Peter Anvin <hpa@zytor.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e419b4cc