1. 08 10月, 2016 16 次提交
  2. 07 10月, 2016 3 次提交
    • H
      parisc: Drop bootmem and switch to memblock · 4fe9e1d9
      Helge Deller 提交于
      Memblock is the standard kernel boot-time memory tracker/allocator. Use it
      instead of the bootmem allocator. This allows using kmemleak, CMA and
      other features.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      4fe9e1d9
    • P
      arch/x86: Handle non enumerated CPU after physical hotplug · 2a51fe08
      Prarit Bhargava 提交于
      When a CPU is physically added to a system then the MADT table is not
      updated.
      
      If subsequently a kdump kernel is started on that physically added CPU then
      the ACPI enumeration fails to provide the information for this CPU which is
      now the boot CPU of the kdump kernel.
      
      As a consequence, generic_processor_info() is not invoked for that CPU so
      the number of enumerated processors is 0 and none of the initializations,
      including the logical package id management, are performed.
      
      We have code which relies on the correctness of the logical package map and
      other information which is initialized via generic_processor_info().
      Executing such code will result in undefined behaviour or kernel crashes.
      
      This problem applies only to the kdump kernel because a normal kexec will
      switch to the original boot CPU, which is enumerated in MADT, before
      jumping into the kexec kernel.
      
      The boot code already has a check for num_processors equal 0 in
      prefill_possible_map(). We can use that check as an indicator that the
      enumeration of the boot CPU did not happen and invoke generic_processor_info()
      for it. That initializes the relevant data for the boot CPU and therefore
      prevents subsequent failure.
      
      [ tglx: Refined the code and rewrote the changelog ]
      Signed-off-by: NPrarit Bhargava <prarit@redhat.com>
      Fixes: 1f12e32f ("x86/topology: Create logical package id")
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: dyoung@redhat.com
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: kexec@lists.infradead.org
      Link: http://lkml.kernel.org/r/1475514432-27682-1-git-send-email-prarit@redhat.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      2a51fe08
    • H
      parisc: Add hardened usercopy feature · 9e91db6b
      Helge Deller 提交于
      Add hardened usercopy checks to parisc architecture and clean up
      indenting.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      9e91db6b
  3. 06 10月, 2016 10 次提交
    • B
      xen/x86: Update topology map for PV VCPUs · a6a198bc
      Boris Ostrovsky 提交于
      Early during boot topology_update_package_map() computes
      logical_pkg_ids for all present processors.
      
      Later, when processors are brought up, identify_cpu() updates
      these values based on phys_pkg_id which is a function of
      initial_apicid. On PV guests the latter may point to a
      non-existing node, causing logical_pkg_ids to be set to -1.
      
      Intel's RAPL uses logical_pkg_id (as topology_logical_package_id())
      to index its arrays and therefore in this case will point to index
      65535 (since logical_pkg_id is a u16). This could lead to either a
      crash or may actually access random memory location.
      
      As a workaround, we recompute topology during CPU bringup to reset
      logical_pkg_id to a valid value.
      
      (The reason for initial_apicid being bogus is because it is
      initial_apicid of the processor from which the guest is launched.
      This value is CPUID(1).EBX[31:24])
      Signed-off-by: NBoris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NDavid Vrabel <david.vrabel@citrix.com>
      a6a198bc
    • L
      nios2: use of_property_read_bool · 476080a7
      Ley Foon Tan 提交于
      Use of_property_read_bool instead of open-coding it as fpcu_has.
      Convert the members of struct cpuinfo from u32 to bool accordingly as
      they are only used as boolean anyhow.
      Signed-off-by: NTobias Klauser <tklauser@distanz.ch>
      Acked-by: NLey Foon Tan <lftan@altera.com>
      476080a7
    • J
      x86/unwind: Fix oprofile module link error · cfee9edd
      Josh Poimboeuf 提交于
      When compiling on x86 with CONFIG_OPROFILE=m and CONFIG_FRAME_POINTER=n,
      the oprofile module fails to link:
      
        ERROR: ftrace_graph_ret_addr" [arch/x86/oprofile/oprofile.ko] undefined!
      
      The problem was introduced when oprofile was converted to use the new
      x86 unwinder.  When frame pointers are disabled, the "guess" unwinder's
      unwind_get_return_address() is an inline function which calls
      ftrace_graph_ret_addr(), which is not exported.
      
      Fix it by converting the "guess" version of unwind_get_return_address()
      to an exported out-of-line function, just like its frame pointer
      counterpart.
      Reported-by: NKarl Beldan <karl.beldan@gmail.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: ec2ad9cc ("oprofile/x86: Convert x86_backtrace() to use the new unwinder")
      Link: http://lkml.kernel.org/r/be08d589f6474df78364e081c42777e382af9352.1475731632.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      cfee9edd
    • R
      ARM: fix delays · fb833b1f
      Russell King 提交于
      Commit 215e362d ("ARM: 8306/1: loop_udelay: remove bogomips value
      limitation") tried to increase the bogomips limitation, but in doing
      so messed up udelay such that it always gives about a 5% error in the
      delay, even if we use a timer.
      
      The calculation is:
      
      	loops = UDELAY_MULT * us_delay * ticks_per_jiffy >> UDELAY_SHIFT
      
      Originally, UDELAY_MULT was ((UL(2199023) * HZ) >> 11) and UDELAY_SHIFT
      30.  Assuming HZ=100, us_delay of 1000 and ticks_per_jiffy of 1660000
      (eg, 166MHz timer, 1ms delay) this would calculate:
      
      	((UL(2199023) * HZ) >> 11) * 1000 * 1660000 >> 30
      		=> 165999
      
      With the new values of 2047 * HZ + 483648 * HZ / 1000000 and 31, we get:
      
      	(2047 * HZ + 483648 * HZ / 1000000) * 1000 * 1660000 >> 31
      		=> 158269
      
      which is incorrect.  This is due to a typo - correcting it gives:
      
      	(2147 * HZ + 483648 * HZ / 1000000) * 1000 * 1660000 >> 31
      		=> 165999
      
      i.o.w, the original value.
      
      Fixes: 215e362d ("ARM: 8306/1: loop_udelay: remove bogomips value limitation")
      Cc: <stable@vger.kernel.org>
      Reviewed-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@armlinux.org.uk>
      fb833b1f
    • N
      sparc: fixing ident and beautifying code · 98e98eb6
      netmonk@netmonk.org 提交于
      Good evening,
      
      Following LinuxCodingStyle documentation and with the help of Sam, fixed
      severals identation issues in the code, and few others cosmetic changes
      
      And last and i hope least fixing my name :)
      
      Signed-off-by : Dominique Carrel <netmonk@netmonk.org>
      Acked-by: NSam Ravnborg <sam@ravnborg.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      98e98eb6
    • C
      sparc64: Enable setting "relaxed ordering" in IOMMU mappings · aa7bde1a
      chris hyser 提交于
      Enable relaxed ordering for memory writes in IOMMU TSB entry from
      dma_4v_alloc_coherent(), dma_4v_map_page() and dma_4v_map_sg() when
      dma_attrs DMA_ATTR_WEAK_ORDERING is set. This requires PCI IOMMU I/O
      Translation Services version 2.0 API.
      
      Many PCIe devices allow enabling relaxed-ordering (memory writes bypassing
      other memory writes) for various DMA buffers. A notable exception is the
      Mellanox mlx4 IB adapter. Due to the nature of x86 HW this appears to have
      little performance impact there. On SPARC HW however, this results in major
      performance degradation getting only about 3Gbps. Enabling RO in the IOMMU
      entries corresponding to mlx4 data buffers increases the throughput to
      about 13 Gbps.
      
      Orabug: 19245907
      Signed-off-by: NChris Hyser <chris.hyser@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aa7bde1a
    • C
      sparc64: Enable PCI IOMMU version 2 API · 8914391b
      chris hyser 提交于
      Enable Version 2 of the PCI IOMMU API needed for advanced features
      such as PCI Relaxed Ordering and greater than 2 GB DMA address
      space per root complex.
      Signed-off-by: NChris Hyser <chris.hyser@oracle.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8914391b
    • P
      sparc: migrate exception table users off module.h and onto extable.h · cdd4f4c7
      Paul Gortmaker 提交于
      These files were only including module.h for exception table
      related functions.  We've now separated that content out into its
      own file "extable.h" so now move over to that and avoid all the
      extra header content in module.h that we don't really need to compile
      these files.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: sparclinux@vger.kernel.org
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      cdd4f4c7
    • H
      parisc: Add cfi_startproc and cfi_endproc to assembly code · f39cce65
      Helge Deller 提交于
      Add ENTRY_CFI() and ENDPROC_CFI() macros for dwarf debug info and
      convert assembly users to new macros.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      f39cce65
    • H
      parisc: Move hpmc stack into page aligned bss section · 2929e738
      Helge Deller 提交于
      Do not reserve space in data section for hpmc stack, instead move it
      into the page aligned bss section.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      2929e738
  4. 05 10月, 2016 4 次提交
  5. 04 10月, 2016 7 次提交
    • M
      x86/irq: Prevent force migration of irqs which are not in the vector domain · db91aa79
      Mika Westerberg 提交于
      When a CPU is about to be offlined we call fixup_irqs() that resets IRQ
      affinities related to the CPU in question. The same thing is also done when
      the system is suspended to S-states like S3 (mem).
      
      For each IRQ we try to complete any on-going move regardless whether the
      IRQ is actually part of x86_vector_domain. For each IRQ descriptor we fetch
      its chip_data, assume it is of type struct apic_chip_data and manipulate it
      by clearing old_domain mask etc. For irq_chips that are not part of the
      x86_vector_domain, like those created by various GPIO drivers, will find
      their chip_data being changed unexpectly.
      
      Below is an example where GPIO chip owned by pinctrl-sunrisepoint.c gets
      corrupted after resume:
      
        # cat /sys/kernel/debug/gpio
        gpiochip0: GPIOs 360-511, parent: platform/INT344B:00, INT344B:00:
         gpio-511 (                    |sysfs               ) in  hi
      
        # rtcwake -s10 -mmem
        <10 seconds passes>
      
        # cat /sys/kernel/debug/gpio
        gpiochip0: GPIOs 360-511, parent: platform/INT344B:00, INT344B:00:
         gpio-511 (                    |sysfs               ) in  ?
      
      Note '?' in the output. It means the struct gpio_chip ->get function is
      NULL whereas before suspend it was there.
      
      Fix this by first checking that the IRQ belongs to x86_vector_domain before
      we try to use the chip_data as struct apic_chip_data.
      Reported-and-tested-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Cc: stable@vger.kernel.org # 4.4+
      Link: http://lkml.kernel.org/r/20161003101708.34795-1-mika.westerberg@linux.intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      db91aa79
    • N
      powerpc/bpf: Add support for bpf constant blinding · b7b7013c
      Naveen N. Rao 提交于
      In line with similar support for other architectures by Daniel Borkmann.
      
      'MOD Default X' from test_bpf without constant blinding:
      84 bytes emitted from JIT compiler (pass:3, flen:7)
      d0000000058a4688 + <x>:
         0:	nop
         4:	nop
         8:	std     r27,-40(r1)
         c:	std     r28,-32(r1)
        10:	xor     r8,r8,r8
        14:	xor     r28,r28,r28
        18:	mr      r27,r3
        1c:	li      r8,66
        20:	cmpwi   r28,0
        24:	bne     0x0000000000000030
        28:	li      r8,0
        2c:	b       0x0000000000000044
        30:	divwu   r9,r8,r28
        34:	mullw   r9,r28,r9
        38:	subf    r8,r9,r8
        3c:	rotlwi  r8,r8,0
        40:	li      r8,66
        44:	ld      r27,-40(r1)
        48:	ld      r28,-32(r1)
        4c:	mr      r3,r8
        50:	blr
      
      ... and with constant blinding:
      140 bytes emitted from JIT compiler (pass:3, flen:11)
      d00000000bd6ab24 + <x>:
         0:	nop
         4:	nop
         8:	std     r27,-40(r1)
         c:	std     r28,-32(r1)
        10:	xor     r8,r8,r8
        14:	xor     r28,r28,r28
        18:	mr      r27,r3
        1c:	lis     r2,-22834
        20:	ori     r2,r2,36083
        24:	rotlwi  r2,r2,0
        28:	xori    r2,r2,36017
        2c:	xoris   r2,r2,42702
        30:	rotlwi  r2,r2,0
        34:	mr      r8,r2
        38:	rotlwi  r8,r8,0
        3c:	cmpwi   r28,0
        40:	bne     0x000000000000004c
        44:	li      r8,0
        48:	b       0x000000000000007c
        4c:	divwu   r9,r8,r28
        50:	mullw   r9,r28,r9
        54:	subf    r8,r9,r8
        58:	rotlwi  r8,r8,0
        5c:	lis     r2,-17137
        60:	ori     r2,r2,39065
        64:	rotlwi  r2,r2,0
        68:	xori    r2,r2,39131
        6c:	xoris   r2,r2,48399
        70:	rotlwi  r2,r2,0
        74:	mr      r8,r2
        78:	rotlwi  r8,r8,0
        7c:	ld      r27,-40(r1)
        80:	ld      r28,-32(r1)
        84:	mr      r3,r8
        88:	blr
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b7b7013c
    • N
      powerpc/bpf: Implement support for tail calls · ce076141
      Naveen N. Rao 提交于
      Tail calls allow JIT'ed eBPF programs to call into other JIT'ed eBPF
      programs. This can be achieved either by:
      (1) retaining the stack setup by the first eBPF program and having all
      subsequent eBPF programs re-using it, or,
      (2) by unwinding/tearing down the stack and having each eBPF program
      deal with its own stack as it sees fit.
      
      To ensure that this does not create loops, there is a limit to how many
      tail calls can be done (currently 32). This requires the JIT'ed code to
      maintain a count of the number of tail calls done so far.
      
      Approach (1) is simple, but requires every eBPF program to have (almost)
      the same prologue/epilogue, regardless of whether they need it. This is
      inefficient for small eBPF programs which may not sometimes need a
      prologue at all. As such, to minimize impact of tail call
      implementation, we use approach (2) here which needs each eBPF program
      in the chain to use its own prologue/epilogue. This is not ideal when
      many tail calls are involved and when all the eBPF programs in the chain
      have similar prologue/epilogue. However, the impact is restricted to
      programs that do tail calls. Individual eBPF programs are not affected.
      
      We maintain the tail call count in a fixed location on the stack and
      updated tail call count values are passed in through this. The very
      first eBPF program in a chain sets this up to 0 (the first 2
      instructions). Subsequent tail calls skip the first two eBPF JIT
      instructions to maintain the count. For programs that don't do tail
      calls themselves, the first two instructions are NOPs.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      ce076141
    • N
      powerpc/bpf: Introduce accessors for using the tmp local stack space · 7b847f52
      Naveen N. Rao 提交于
      While at it, ensure that the location of the local save area is
      consistent whether or not we setup our own stackframe. This property is
      utilised in the next patch that adds support for tail calls.
      Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      7b847f52
    • M
      powerpc/fadump: Fix build break when CONFIG_PROC_VMCORE=n · 2685f826
      Michael Ellerman 提交于
      The fadump code calls vmcore_cleanup() which only exists if
      CONFIG_PROC_VMCORE=y. We don't want to depend on CONFIG_PROC_VMCORE,
      because it's user selectable, so just wrap the call in an #ifdef.
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      2685f826
    • C
      powerpc: tm: Enable transactional memory (TM) lazily for userspace · 5d176f75
      Cyril Bur 提交于
      Currently the MSR TM bit is always set if the hardware is TM capable.
      This adds extra overhead as it means the TM SPRS (TFHAR, TEXASR and
      TFAIR) must be swapped for each process regardless of if they use TM.
      
      For processes that don't use TM the TM MSR bit can be turned off
      allowing the kernel to avoid the expensive swap of the TM registers.
      
      A TM unavailable exception will occur if a thread does use TM and the
      kernel will enable MSR_TM and leave it so for some time afterwards.
      Signed-off-by: NCyril Bur <cyrilbur@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      5d176f75
    • C
      powerpc/tm: Add TM Unavailable Exception · 172f7aaa
      Cyril Bur 提交于
      If the kernel disables transactional memory (TM) and userspace still
      tries TM related actions (TM instructions or TM SPR accesses) TM aware
      hardware will cause the kernel to take a facility unavailable
      exception.
      
      Add checks for the exception being caused by illegal TM access in
      userspace.
      Signed-off-by: NCyril Bur <cyrilbur@gmail.com>
      [mpe: Rewrite comment entirely, bugs in it are mine]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      172f7aaa