15 Jan, 2015

16 commits

  • Assign intel_irq_remap_ops to remap_ops only if
    intel_irq_remap_ops.prepare() succeeds.

    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-15-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • Simplify irq_remapping code by killing irq_remapping_supported() and
    related interfaces.

    Joerg posted a similar patch at https://lkml.org/lkml/2014/12/15/490,
    so assume an signed-off from Joerg.

    Signed-off-by: Jiang Liu
    Signed-off-by: Joerg Roedel
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-14-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • This allows to get rid of the irq_remapping_supported() function and
    all its call-backs into the Intel and AMD IOMMU drivers.

    Signed-off-by: Joerg Roedel
    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-13-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Joerg Roedel
     
  • When interrupt remapping hardware is not in X2APIC, CPU X2APIC mode
    will be disabled if:
    1) Maximum CPU APIC ID is bigger than 255
    2) hypervisior doesn't support x2apic mode.

    But we should only check whether hypervisor supports X2APIC mode when
    hypervisor(CONFIG_HYPERVISOR_GUEST) is enabled, otherwise X2APIC will
    always be disabled when CONFIG_HYPERVISOR_GUEST is disabled and IR
    doesn't work in X2APIC mode.

    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-12-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • Currently if CPU supports X2APIC, IR hardware must work in X2APIC mode
    or disabled. Change the code to support IR working in XAPIC mode when
    CPU supports X2APIC. Then the CPU APIC driver will decide how to handle
    such as configuration by:
    1) Disabling X2APIC mode
    2) Forcing X2APIC physical mode

    This change also fixes a live locking when
    1) BIOS enables CPU X2APIC
    2) DMAR table disables X2APIC mode or IR hardware doesn't support X2APIC
    with following messages:
    [ 37.863463] dmar: INTR-REMAP: Request device [[f0:1f.7] fault index 2
    [ 37.863463] INTR-REMAP:[fault reason 36] Detected reserved fields in the IRTE entry
    [ 37.879372] dmar: INTR-REMAP: Request device [[f0:1f.7] fault index 2
    [ 37.879372] INTR-REMAP:[fault reason 36] Detected reserved fields in the IRTE entry
    [ 37.895282] dmar: INTR-REMAP: Request device [[f0:1f.7] fault index 2
    [ 37.895282] INTR-REMAP:[fault reason 36] Detected reserved fields in the IRTE entry
    [ 37.911192] dmar: INTR-REMAP: Request device [[f0:1f.7] fault index 2

    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-11-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • IRQ remapping is only supported when all IOMMUs in the
    system support it. So check if all IOMMUs in the system
    support IRQ remapping before doing the allocations.

    [Jiang]
    1) Rebased to v3.19.
    2) Remove redundant check of ecap_ir_support(iommu->ecap) in function
    intel_enable_irq_remapping().

    Signed-off-by: Joerg Roedel
    Signed-off-by: Jiang Liu
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-10-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Joerg Roedel
     
  • Prepare for killing function irq_remapping_supported() by moving code
    from intel_irq_remapping_supported() into intel_prepare_irq_remapping().

    Combined with patch from Joerg at https://lkml.org/lkml/2014/12/15/487,
    so assume an signed-off from Joerg.

    Signed-off-by: Jiang Liu
    Signed-off-by: Joerg Roedel
    Tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Link: http://lkml.kernel.org/r/1420615903-28253-9-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • If remapping is in XAPIC mode, the setup code just skips X2APIC
    initialization without checking max CPU APIC ID in system, which may
    cause problem if system has a CPU with APIC ID bigger than 255.

    Handle IR in XAPIC mode the same way as if remapping is disabled.

    [ tglx: Split out from previous patch ]

    Signed-off-by: Jiang Liu
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Joerg Roedel
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-8-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • Refine enable_IR_x2apic() and related functions for better readability.

    [ tglx: Removed the XAPIC mode change and split it out into a seperate
    patch. Added comments. ]

    Signed-off-by: Jiang Liu
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Joerg Roedel
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-8-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • X2APIC will be disabled if user specifies "nox2apic" on kernel command
    line, even when x2apic_preenabled is true. So correctly detect X2APIC
    status by using x2apic_enabled() instead of x2apic_preenabled.

    Signed-off-by: Jiang Liu
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Joerg Roedel
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-7-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • Local variable x2apic_enabled has been assigned to but never referred,
    so kill it.

    Signed-off-by: Jiang Liu
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Joerg Roedel
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-6-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • When kernel doesn't support X2APIC but BIOS has enabled X2APIC, system
    may panic or hang without useful messages. On the other hand, it's
    hard to dynamically disable X2APIC when CONFIG_X86_X2APIC is disabled.
    So panic with a clear message in such a case.

    Now system panics as below when X2APIC is disabled and interrupt remapping
    is enabled:
    [ 0.316118] LAPIC pending interrupts after 512 EOI
    [ 0.322126] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
    [ 0.368655] Kernel panic - not syncing: timer doesn't work through Interrupt-remapped IO-APIC
    [ 0.378300] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.0+ #340
    [ 0.385300] Hardware name: Intel Corporation BRICKLAND/BRICKLAND, BIOS BRIVTIN1.86B.0051.L05.1406240953 06/24/2014
    [ 0.396997] ffff88046dc03000 ffff88046c307dd8 ffffffff8179dada 00000000000043f2
    [ 0.405629] ffffffff81a92158 ffff88046c307e58 ffffffff8179b757 0000000000000002
    [ 0.414261] 0000000000000008 ffff88046c307e68 ffff88046c307e08 ffffffff813ad82b
    [ 0.422890] Call Trace:
    [ 0.425711] [] dump_stack+0x45/0x57
    [ 0.431533] [] panic+0xc1/0x1f5
    [ 0.436978] [] ? delay_tsc+0x3b/0x70
    [ 0.442910] [] panic_if_irq_remap+0x1c/0x20
    [ 0.449524] [] setup_IO_APIC+0x405/0x82e
    [ 0.464979] [] native_smp_prepare_cpus+0x2d9/0x31c
    [ 0.472274] [] kernel_init_freeable+0xd6/0x223
    [ 0.479170] [] ? rest_init+0x80/0x80
    [ 0.485099] [] kernel_init+0xe/0xf0
    [ 0.490932] [] ret_from_fork+0x7c/0xb0
    [ 0.497054] [] ? rest_init+0x80/0x80
    [ 0.502983] ---[ end Kernel panic - not syncing: timer doesn't work through Interrupt-remapped IO-APIC

    System hangs as below when X2APIC and interrupt remapping are both disabled:
    [ 1.102782] pci 0000:00:02.0: System wakeup disabled by ACPI
    [ 1.109351] pci 0000:00:03.0: System wakeup disabled by ACPI
    [ 1.115915] pci 0000:00:03.2: System wakeup disabled by ACPI
    [ 1.122479] pci 0000:00:03.3: System wakeup disabled by ACPI
    [ 1.132274] pci 0000:00:1c.0: Enabling MPC IRBNCE
    [ 1.137620] pci 0000:00:1c.0: Intel PCH root port ACS workaround enabled
    [ 1.145239] pci 0000:00:1c.0: System wakeup disabled by ACPI
    [ 1.151790] pci 0000:00:1c.7: Enabling MPC IRBNCE
    [ 1.157128] pci 0000:00:1c.7: Intel PCH root port ACS workaround enabled
    [ 1.164748] pci 0000:00:1c.7: System wakeup disabled by ACPI
    [ 1.171447] pci 0000:00:1e.0: System wakeup disabled by ACPI
    [ 1.178612] acpiphp: Slot [8] registered
    [ 1.183095] pci 0000:00:02.0: PCI bridge to [bus 01]
    [ 1.188867] acpiphp: Slot [2] registered

    With this patch applied, the system panics in both cases with a proper
    panic message.

    Signed-off-by: Jiang Liu
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Joerg Roedel
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Link: http://lkml.kernel.org/r/1420615903-28253-5-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Thomas Gleixner

    Jiang Liu
     
  • If x2apic got disabled on the kernel command line, then the following
    issue can happen:

    enable_IR_x2apic()
    ....
    x2apic_mode = 1;
    enable_x2apic();

    if (x2apic_disabled) {
    __disable_x2apic();
    return;
    }

    That leaves X2APIC disabled in hardware, but x2apic_mode stays 1. So
    all other code which checks x2apic_mode gets the wrong information.

    Set x2apic_mode to 0 after disabling it in hardware.

    This is just a hotfix. The proper solution is to rework this code so
    it has seperate functions for the initial setup on the boot processor
    and the secondary cpus, but that's beyond the scope of this fix.

    Signed-off-by: Thomas Gleixner
    Cc: Jiang Liu
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: H. Peter Anvin
    Cc: Joerg Roedel
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: Borislav Petkov
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig

    Thomas Gleixner
     
  • No reason anymore to do GFP_ATOMIC allocations which are not harmful
    in the normal bootup case, but matter in the physical hotplug
    scenario.

    Signed-off-by: Thomas Gleixner
    Tested-by: Borislav Petkov
    Acked-and-tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: x86@kernel.org
    Link: http://lkml.kernel.org/r/20141205084147.472428339@linutronix.de
    Link: http://lkml.kernel.org/r/1420615903-28253-4-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Jiang Liu
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • The whole iommu setup for irq remapping is a convoluted mess. The
    iommu detect function gets called from mem_init() and the prepare
    callback gets called from enable_IR_x2apic() for unknown reasons.

    Of course AMD and Intel setup differs in nonsensical ways. Intels
    prepare callback is explicit while AMDs prepare callback is implicit
    in setup_irq_remapping_ops() just to be called in the prepare call
    again.

    Because all of this gets called from enable_IR_x2apic() and the dmar
    prepare function merily parses the ACPI tables, but does not allocate
    memory we end up with memory allocation from irq disabled context
    later on.

    AMDs iommu code at least allocates the required memory from the
    prepare function. That has issues as well, but thats not scope of this
    patch.

    The goal of this change is to distangle the allocation from the actual
    enablement. There is no point to allocate memory from irq disabled
    regions with GFP_ATOMIC just because it does not matter at that point
    in the boot stage. It matters with physical hotplug later on.

    There is another issue with the current setup. Due to the conversion
    to stacked irqdomains we end up with a call into the irqdomain
    allocation code from irq disabled context, but that code does
    GFP_KERNEL allocations rightfully as there is no reason to do
    preperatory allocations with GFP_ATOMIC.

    That change caused the allocator code to complain about GFP_KERNEL
    allocations invoked in atomic context. Boris provided a temporary
    hackaround which changed the GFP flags if irq_domain_add() got called
    from atomic context. Not pretty and we really dont want to get this
    into a mainline release for obvious reasons.

    Move the ACPI table parsing and the resulting memory allocations from
    the enable to the prepare function. That allows to get rid of the
    horrible hackaround in irq_domain_add() later.

    [Jiang] Rebased onto v3.19

    Signed-off-by: Thomas Gleixner
    Tested-by: Borislav Petkov
    Acked-and-tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: x86@kernel.org
    Link: http://lkml.kernel.org/r/20141205084147.313026156@linutronix.de
    Link: http://lkml.kernel.org/r/1420615903-28253-3-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Jiang Liu
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     
  • enable_IR_x2apic() calls setup_irq_remapping_ops() which by default
    installs the intel dmar remapping ops and then calls the amd iommu irq
    remapping prepare callback to figure out whether we are running on an
    AMD machine with irq remapping hardware.

    Right after that it calls irq_remapping_prepare() which pointlessly
    checks:
    if (!remap_ops || !remap_ops->prepare)
    return -ENODEV;
    and then calls

    remap_ops->prepare()

    which is silly in the AMD case as it got called from
    setup_irq_remapping_ops() already a few microseconds ago.

    Simplify this and just collapse everything into
    irq_remapping_prepare().

    The irq_remapping_prepare() remains still silly as it assigns blindly
    the intel ops, but that's not scope of this patch.

    The scope here is to move the preperatory work, i.e. memory
    allocations out of the atomic section which is required to enable irq
    remapping.

    Signed-off-by: Thomas Gleixner
    Tested-by: Borislav Petkov
    Acked-and-tested-by: Joerg Roedel
    Cc: Tony Luck
    Cc: iommu@lists.linux-foundation.org
    Cc: Joerg Roedel
    Cc: H. Peter Anvin
    Cc: Benjamin Herrenschmidt
    Cc: Yinghai Lu
    Cc: David Rientjes
    Cc: HATAYAMA Daisuke
    Cc: Jan Beulich
    Cc: Richard Weinberger
    Cc: Oren Twaig
    Cc: x86@kernel.org
    Link: http://lkml.kernel.org/r/20141205084147.232633738@linutronix.de
    Link: http://lkml.kernel.org/r/1420615903-28253-2-git-send-email-jiang.liu@linux.intel.com
    Signed-off-by: Jiang Liu
    Signed-off-by: Thomas Gleixner

    Thomas Gleixner
     

12 Jan, 2015

8 commits

  • Linus Torvalds
     
  • Pull ARM fixes from Russell King:
    "Three small fixes from over the Christmas period, and wiring up the
    new execveat syscall for ARM"

    * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
    ARM: 8275/1: mm: fix PMD_SECT_RDONLY undeclared compile error
    ARM: 8253/1: mm: use phys_addr_t type in map_lowmem() for kernel mem region
    ARM: 8249/1: mm: dump: don't skip regions
    ARM: wire up execveat syscall

    Linus Torvalds
     
  • Pull x86 fixes from Ingo Molnar:
    "Misc fixes: two vdso fixes, two kbuild fixes and a boot failure fix
    with certain odd memory mappings"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86, vdso: Use asm volatile in __getcpu
    x86/build: Clean auto-generated processor feature files
    x86: Fix mkcapflags.sh bash-ism
    x86: Fix step size adjustment during initial memory mapping
    x86_64, vdso: Fix the vdso address randomization algorithm

    Linus Torvalds
     
  • Pull scheduler fixes from Ingo Molnar:
    "Misc fixes: group scheduling corner case fix, two deadline scheduler
    fixes, effective_load() overflow fix, nested sleep fix, 6144 CPUs
    system fix"

    * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    sched/fair: Fix RCU stall upon -ENOMEM in sched_create_group()
    sched/deadline: Avoid double-accounting in case of missed deadlines
    sched/deadline: Fix migration of SCHED_DEADLINE tasks
    sched: Fix odd values in effective_load() calculations
    sched, fanotify: Deal with nested sleeps
    sched: Fix KMALLOC_MAX_SIZE overflow during cpumask allocation

    Linus Torvalds
     
  • Pull perf fixes from Ingo Molnar:
    "Mostly tooling fixes, but also some kernel side fixes: uncore PMU
    driver fix, user regs sampling fix and an instruction decoder fix that
    unbreaks PEBS precise sampling"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf/x86/uncore/hsw-ep: Handle systems with only two SBOXes
    perf/x86_64: Improve user regs sampling
    perf: Move task_pt_regs sampling into arch code
    x86: Fix off-by-one in instruction decoder
    perf hists browser: Fix segfault when showing callchain
    perf callchain: Free callchains when hist entries are deleted
    perf hists: Fix children sort key behavior
    perf diff: Fix to sort by baseline field by default
    perf list: Fix --raw-dump option
    perf probe: Fix crash in dwarf_getcfi_elf
    perf probe: Fix to fall back to find probe point in symbols
    perf callchain: Append callchains only when requested
    perf ui/tui: Print backtrace symbols when segfault occurs
    perf report: Show progress bar for output resorting

    Linus Torvalds
     
  • Pull locking fixes from Ingo Molnar:
    "A liblockdep fix and a mutex_unlock() mutex-debugging fix"

    * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    mutex: Always clear owner field upon mutex_unlock()
    tools/liblockdep: Fix debug_check thinko in mutex destroy

    Linus Torvalds
     
  • Fix for BUG_ON(anon_vma->degree) splashes in unlink_anon_vmas() ("kernel
    BUG at mm/rmap.c:399!") caused by commit 7a3ef208e662 ("mm: prevent
    endless growth of anon_vma hierarchy")

    Anon_vma_clone() is usually called for a copy of source vma in
    destination argument. If source vma has anon_vma it should be already
    in dst->anon_vma. NULL in dst->anon_vma is used as a sign that it's
    called from anon_vma_fork(). In this case anon_vma_clone() finds
    anon_vma for reusing.

    Vma_adjust() calls it differently and this breaks anon_vma reusing
    logic: anon_vma_clone() links vma to old anon_vma and updates degree
    counters but vma_adjust() overrides vma->anon_vma right after that. As
    a result final unlink_anon_vmas() decrements degree for wrong anon_vma.

    This patch assigns ->anon_vma before calling anon_vma_clone().

    Signed-off-by: Konstantin Khlebnikov
    Reported-and-tested-by: Chris Clayton
    Reported-and-tested-by: Oded Gabbay
    Reported-and-tested-by: Chih-Wei Huang
    Acked-by: Rik van Riel
    Acked-by: Vlastimil Babka
    Cc: Daniel Forrest
    Cc: Michal Hocko
    Cc: stable@vger.kernel.org # to match back-porting of 7a3ef208e662
    Signed-off-by: Linus Torvalds

    Konstantin Khlebnikov
     
  • Commit fee7e49d4514 ("mm: propagate error from stack expansion even for
    guard page") made sure that we return the error properly for stack
    growth conditions. It also theorized that counting the guard page
    towards the stack limit might break something, but also said "Let's see
    if anybody notices".

    Somebody did notice. Apparently android-x86 sets the stack limit very
    close to the limit indeed, and including the guard page in the rlimit
    check causes the android 'zygote' process problems.

    So this adds the (fairly trivial) code to make the stack rlimit check be
    against the actual real stack size, rather than the size of the vma that
    includes the guard page.

    Reported-and-tested-by: Chih-Wei Huang
    Cc: Jay Foad
    Cc: stable@kernel.org # to match back-porting of fee7e49d4514
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

11 Jan, 2015

3 commits


10 Jan, 2015

10 commits

  • Pull sound fixes from Takashi Iwai:
    "All a few small regression or stable fixes: a Nvidia HDMI ID addition,
    a regression fix for CAIAQ stream count, a typo fix for GPIO setup
    with STAC/IDT HD-audio codecs, and a Fireworks big-endian fix"

    * tag 'sound-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: fireworks: fix an endianness bug for transaction length
    ALSA: hda - Add new GPU codec ID 0x10de0072 to snd-hda
    ALSA: hda - Fix wrong gpio_dir & gpio_mask hint setups for IDT/STAC codecs
    ALSA: snd-usb-caiaq: fix stream count check

    Linus Torvalds
     
  • Pull HID updates from Jiri Kosina:

    - bounds checking fixes in logitech and roccat drivers, from Peter Wu
    and Dan Carpenter

    - double-kfree fix in i2c-hid driver on bus shutdown, from Mika
    Westerberg

    - a couple of various small driver fixes

    - a few device id additions

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
    HID: roccat: potential out of bounds in pyra_sysfs_write_settings()
    HID: Add a new id 0x501a for Genius MousePen i608X
    HID: logitech-hidpp: prefix the name with "Logitech"
    HID: logitech-hidpp: avoid unintended fall-through
    HID: Allow HID_BATTERY_STRENGTH to be enabled
    HID: i2c-hid: Do not free buffers in i2c_hid_stop()
    HID: add battery quirk for USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO keyboard
    HID: logitech-hidpp: check WTP report length
    HID: logitech-dj: check report length

    Linus Torvalds
     
  • Pull drm fixes from Dave Airlie:
    "I'm briefly working between holidays and LCA, so this is close to a
    couple of weeks of fixes,

    Two sets of amdkfd fixes, this is a new feature this kernel, and this
    pull fixes a few issues since it got merged, ordering when built-in to
    kernel and also the iommu vs gpu ordering patch, it also reworks the
    ioctl before the initial release.

    Otherwise:
    - radeon: some misc fixes all over, hdmi, 4k, dpm
    - nouveau: mcp77 init fixes, oops fix, bug on fix, msi fix
    - i915: power fixes, revert VGACNTR patch

    Probably be quiteer next week since I'll be at LCA anyways"

    * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (33 commits)
    drm/amdkfd: rewrite kfd_ioctl() according to drm_ioctl()
    drm/amdkfd: reformat IOCTL definitions to drm-style
    drm/amdkfd: Do copy_to/from_user in general kfd_ioctl()
    drm/radeon: integer underflow in radeon_cp_dispatch_texture()
    drm/radeon: adjust default bapm settings for KV
    drm/radeon: properly filter DP1.2 4k modes on non-DP1.2 hw
    drm/radeon: fix sad_count check for dce3
    drm/radeon: KV has three PPLLs (v2)
    drm/amdkfd: unmap VMIDPASID when relesing VMID (non-HWS)
    drm/radeon: Init amdkfd only if it was compiled
    amdkfd: actually allocate longs for the pasid bitmask
    drm/nouveau/nouveau: Do not BUG_ON(!spin_is_locked()) on UP
    drm/nv4c/mc: disable msi
    drm/nouveau/fb/ram/mcp77: enable NISO poller
    drm/nouveau/fb/ram/mcp77: use carveout reg to determine size
    drm/nouveau/fb/ram/mcp77: subclass nouveau_ram
    drm/nouveau: wake up the card if necessary during gem callbacks
    drm/nouveau/device: Add support for GK208B, resolves bug 86935
    drm/nouveau: fix missing return statement in nouveau_ttm_tt_unpopulate
    drm/nouveau/bios: fix oops on pre-nv50 chipsets
    ...

    Linus Torvalds
     
  • Pull arm64 fixes from Will Deacon:
    "Here is a handful of minor arm64 fixes discovered and fixed over the
    Christmas break. The main part is adding some missing #includes that
    we seem to be getting transitively but have started causing problems
    in -next.

    - Fix early mapping fixmap corruption by EFI runtime services
    - Fix __NR_compat_syscalls off-by-one
    - Add missing sanity checks for some 32-bit registers
    - Add some missing #includes which we get transitively
    - Remove unused prepare_to_copy() macro"

    * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    arm64/efi: add missing call to early_ioremap_reset()
    arm64: fix missing asm/io.h include in kernel/smp_spin_table.c
    arm64: fix missing asm/alternative.h include in kernel/module.c
    arm64: fix missing linux/bug.h include in asm/arch_timer.h
    arm64: fix missing asm/pgtable-hwdef.h include in asm/processor.h
    arm64: sanity checks: add missing AArch32 registers
    arm64: Remove unused prepare_to_copy()
    arm64: Correct __NR_compat_syscalls for bpf

    Linus Torvalds
     
  • Pull kgdb/kdb fixes from Jason Wessel:
    "These have been around since 3.17 and in kgdb-next for the last 9
    weeks and some will go back to -stable.

    Summary of changes:

    Cleanups
    - kdb: Remove unused command flags, repeat flags and KDB_REPEAT_NONE

    Fixes
    - kgdb/kdb: Allow access on a single core, if a CPU round up is
    deemed impossible, which will allow inspection of the now "trashed"
    kernel
    - kdb: Add enable mask for the command groups
    - kdb: access controls to restrict sensitive commands"

    * tag 'for_linus-3.19-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/kgdb:
    kernel/debug/debug_core.c: Logging clean-up
    kgdb: timeout if secondary CPUs ignore the roundup
    kdb: Allow access to sensitive commands to be restricted by default
    kdb: Add enable mask for groups of commands
    kdb: Categorize kdb commands (similar to SysRq categorization)
    kdb: Remove KDB_REPEAT_NONE flag
    kdb: Use KDB_REPEAT_* values as flags
    kdb: Rename kdb_register_repeat() to kdb_register_flags()
    kdb: Rename kdb_repeat_t to kdb_cmdflags_t, cmd_repeat to cmd_flags
    kdb: Remove currently unused kdbtab_t->cmd_flags

    Linus Torvalds
     
  • Pull two nfsd bugfixes from Bruce Fields.

    * 'for-3.19' of git://linux-nfs.org/~bfields/linux:
    rpc: fix xdr_truncate_encode to handle buffer ending on page boundary
    nfsd: fix fi_delegees leak when fi_had_conflict returns true

    Linus Torvalds
     
  • Pull two Ceph fixes from Sage Weil:
    "These are both pretty trivial: a sparse warning fix and size_t printk
    thing"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
    libceph: fix sparse endianness warnings
    ceph: use %zu for len in ceph_fill_inline_data()

    Linus Torvalds
     
  • Pull btrfs fixes from Chris Mason:
    "None of these are huge, but my commit does fix a regression from 3.18
    that could cause lost files during log replay.

    This also adds Dave Sterba to the list of Btrfs maintainers. It
    doesn't mean we're doing things differently, but Dave has really been
    helping with the maintainer workload for years"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
    Btrfs: don't delay inode ref updates during log replay
    Btrfs: correctly get tree level in tree_backref_for_extent
    Btrfs: call inode_dec_link_count() on mkdir error path
    Btrfs: abort transaction if we don't find the block group
    Btrfs, scrub: uninitialized variable in scrub_extent_for_parity()
    Btrfs: add more maintainers

    Linus Torvalds
     
  • Merge misc fixes from Andrew Morton:
    "12 fixes"

    * emailed patches from Andrew Morton :
    mm, vmscan: prevent kswapd livelock due to pfmemalloc-throttled process being killed
    memcg: fix destination cgroup leak on task charges migration
    mm: memcontrol: switch soft limit default back to infinity
    mm/debug_pagealloc: remove obsolete Kconfig options
    vfs: renumber FMODE_NONOTIFY and add to uniqueness check
    arch/blackfin/mach-bf533/boards/stamp.c: add linux/delay.h
    ocfs2: fix the wrong directory passed to ocfs2_lookup_ino_from_name() when link file
    MAINTAINERS: update rydberg's addresses
    mm: protect set_page_dirty() from ongoing truncation
    mm: prevent endless growth of anon_vma hierarchy
    exit: fix race between wait_consider_task() and wait_task_zombie()
    ocfs2: remove bogus check in dlm_process_recovery_data

    Linus Torvalds
     
  • In v3.19-rc3 tree when CONFIG_ARM_LPAE and CONFIG_DEBUG_RODATA are enabled
    image failed to compile with the following error:

    arch/arm/mm/init.c:661:14: error: ‘PMD_SECT_RDONLY’ undeclared here (not in a function)

    It seems that '80d6b0c ARM: mm: allow text and rodata sections to be read-only'
    and 'ded9477 ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE'
    commits crossed. 80d6b0c uses PMD_SECT_RDONLY macro but ded9477 renames it
    and uses software bits L_PMD_SECT_RDONLY instead.

    Fix is to use L_PMD_SECT_RDONLY instead PMD_SECT_RDONLY as ded9477 does in
    another places.

    Signed-off-by: Victor Kamensky
    Acked-by: Will Deacon
    Signed-off-by: Russell King

    Victor Kamensky
     

09 Jan, 2015

3 commits

  • This is a static checker fix. We write some binary settings to the
    sysfs file. One of the settings is the "->startup_profile". There
    isn't any checking to make sure it fits into the
    pyra->profile_settings[] array in the profile_activated() function.

    I added a check to pyra_sysfs_write_settings() in both places because
    I wasn't positive that the other callers were correct.

    Cc:
    Signed-off-by: Dan Carpenter
    Signed-off-by: Jiri Kosina

    Dan Carpenter
     
  • Currently if DEBUG_MUTEXES is enabled, the mutex->owner field is only
    cleared iff debug_locks is active. This exposes a race to other users of
    the field where the mutex->owner may be still set to a stale value,
    potentially upsetting mutex_spin_on_owner() among others.

    References: https://bugs.freedesktop.org/show_bug.cgi?id=87955
    Signed-off-by: Chris Wilson
    Signed-off-by: Peter Zijlstra (Intel)
    Acked-by: Davidlohr Bueso
    Cc: Daniel Vetter
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/r/1420540175-30204-1-git-send-email-chris@chris-wilson.co.uk
    Signed-off-by: Ingo Molnar

    Chris Wilson
     
  • When alloc_fair_sched_group() in sched_create_group() fails,
    free_sched_group() is called, and free_fair_sched_group() is called by
    free_sched_group(). Since destroy_cfs_bandwidth() is called by
    free_fair_sched_group() without calling init_cfs_bandwidth(),
    RCU stall occurs at hrtimer_cancel():

    INFO: rcu_sched self-detected stall on CPU { 1} (t=60000 jiffies g=13074 c=13073 q=0)
    Task dump for CPU 1:
    (fprintd) R running task 0 6249 1 0x00000088
    ...
    Call Trace:
    [] sched_show_task+0xa8/0x110
    [] dump_cpu_task+0x3d/0x50
    [] rcu_dump_cpu_stacks+0x90/0xd0
    [] rcu_check_callbacks+0x491/0x700
    [] update_process_times+0x4b/0x80
    [] tick_sched_handle.isra.20+0x36/0x50
    [] tick_sched_timer+0x42/0x70
    [] __run_hrtimer+0x69/0x1a0
    [] ? tick_sched_handle.isra.20+0x50/0x50
    [] hrtimer_interrupt+0xef/0x230
    [] local_apic_timer_interrupt+0x3b/0x70
    [] smp_apic_timer_interrupt+0x45/0x60
    [] apic_timer_interrupt+0x6d/0x80
    [] ? lock_hrtimer_base.isra.23+0x18/0x50
    [] ? __kmalloc+0x211/0x230
    [] hrtimer_try_to_cancel+0x22/0xd0
    [] ? __kmalloc+0x211/0x230
    [] hrtimer_cancel+0x22/0x30
    [] free_fair_sched_group+0x25/0xd0
    [] free_sched_group+0x16/0x40
    [] sched_create_group+0x4b/0x80
    [] sched_autogroup_create_attach+0x43/0x1c0
    [] sys_setsid+0x7c/0x110
    [] system_call_fastpath+0x12/0x17

    Check whether init_cfs_bandwidth() was called before calling
    destroy_cfs_bandwidth().

    Signed-off-by: Tetsuo Handa
    [ Move the check into destroy_cfs_bandwidth() to aid compilability. ]
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: Paul Turner
    Cc: Ben Segall
    Cc: Linus Torvalds
    Link: http://lkml.kernel.org/r/201412252210.GCC30204.SOMVFFOtQJFLOH@I-love.SAKURA.ne.jp
    Signed-off-by: Ingo Molnar

    Tetsuo Handa