1. 22 4月, 2015 4 次提交
  2. 19 4月, 2015 5 次提交
  3. 18 4月, 2015 10 次提交
    • K
      config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected · a6dfa128
      Konrad Rzeszutek Wilk 提交于
      A huge amount of NIC drivers use the DMA API, however if
      compiled under 32-bit an very important part of the DMA API can
      be ommitted leading to the drivers not working at all
      (especially if used with 'swiotlb=force iommu=soft').
      
      As Prashant Sreedharan explains it: "the driver [tg3] uses
      DEFINE_DMA_UNMAP_ADDR(), dma_unmap_addr_set() to keep a copy of
      the dma "mapping" and dma_unmap_addr() to get the "mapping"
      value. On most of the platforms this is a no-op, but ... with
      "iommu=soft and swiotlb=force" this house keeping is required,
      ... otherwise we pass 0 while calling pci_unmap_/pci_dma_sync_
      instead of the DMA address."
      
      As such enable this even when using 32-bit kernels.
      Reported-by: NIan Jackson <Ian.Jackson@eu.citrix.com>
      Signed-off-by: NKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Acked-by: NPrashant Sreedharan <prashant@broadcom.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michael Chan <mchan@broadcom.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: boris.ostrovsky@oracle.com
      Cc: cascardo@linux.vnet.ibm.com
      Cc: david.vrabel@citrix.com
      Cc: sanjeevb@broadcom.com
      Cc: siva.kallam@broadcom.com
      Cc: vyasevich@gmail.com
      Cc: xen-devel@lists.xensource.com
      Link: http://lkml.kernel.org/r/20150417190448.GA9462@l.oracle.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      a6dfa128
    • I
      perf/x86/intel/pt: Fix and clean up error handling in pt_event_add() · 0c99241c
      Ingo Molnar 提交于
      Dan Carpenter reported that pt_event_add() has buggy
      error handling logic: it returns 0 instead of -EBUSY when
      it fails to start a newly added event.
      
      Furthermore, the control flow in this function is messy,
      with cleanup labels mixed with direct returns.
      
      Fix the bug and clean up the code by converting it to
      a straight fast path for the regular non-failing case,
      plus a clear sequence of cascading goto labels to do
      all cleanup.
      
      NOTE: I materially changed the existing clean up logic in the
      pt_event_start() failure case to use the direct
      perf_aux_output_end() path, not pt_event_del(), because
      perf_aux_output_end() is enough here.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Julia Lawall <julia.lawall@lip6.fr>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150416103830.GB7847@gmail.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      0c99241c
    • C
      tile: nohz: warn if nohz_full uses hypervisor shared cores · 128f3cb9
      Chris Metcalf 提交于
      The "hypervisor shared" cores are ones that the Tilera hypervisor
      uses to receive interrupts to manage hypervisor-owned devices.
      It's a bad idea to try to use those cores with nohz_full, since
      they will get interrupted unpredictably -- and invisibly to Linux
      tracing tools, since the interrupts are delivered at a higher
      privilege level to the Tilera hypervisor.
      
      Generate a clear warning at boot up that this doesn't end well
      for the nohz_full cores in question.
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      128f3cb9
    • T
      tile: ftrace: fix function_graph tracer issues · 437d3e12
      Tony Lu 提交于
      - Add support for ARCH_SUPPORTS_FTRACE_OPS
      - Replace the instruction in ftrace_call with the bundle {move r10, lr;
      jal ftrace_stub}, so that the lr contains the right value after returning
      from ftrace_stub.  An alternative fix might be to leave the instruction
      in ftrace_call alone when it is being updated with ftrace_stub.
      Signed-off-by: NTony Lu <zlu@ezchip.com>
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      437d3e12
    • C
      tile: map data region shadow of kernel as R/W · a84f2423
      Chris Metcalf 提交于
      This is necessary for things like reading /proc/kcore, doing ftrace,
      etc.  It happens by default when using huge pages to map the kernel
      data, but not when using small pages.
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      a84f2423
    • C
      tile: support CONTEXT_TRACKING and thus NOHZ_FULL · 49e4e156
      Chris Metcalf 提交于
      Add the TIF_NOHZ flag appropriately.
      
      Add call to user_exit() on entry to do_work_pending() and on entry
      to syscalls via do_syscall_trace_enter(), and also the top of
      do_syscall_trace_exit() just because it's done in x86.
      
      Add call to user_enter() at the bottom of do_work_pending() once we
      have no more work to do before returning to userspace.
      
      Wrap all the trap code in exception_enter() / exception_exit().
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      49e4e156
    • C
      tile: support arch_irq_work_raise · b340c656
      Chris Metcalf 提交于
      Tile includes a hypervisor hook to deliver messages to arbitrary
      tiles, so we can use that to raise an interrupt as soon as
      possible on our own core.  Unfortunately the Tilera hypervisor
      disabled that support on principle in previous releases, but
      it will be available in MDE 4.3.4 and later.
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      Acked-by: NFrederic Weisbecker <fweisbec@gmail.com>
      b340c656
    • C
      arch: tile: fix null pointer dereference on pt_regs pointer · 9088616f
      Colin Ian King 提交于
      Cppcheck reports the following issue:
      [arch/tile/kernel/stack.c:116]: (error) Possible null
        pointer dereference: p
      
      In this case, on reporting on an odd fault, p is set to NULL
      and immediately afterwords p is dereferenced iff
      !kbt->profile is false.  Rather than doing this check just
      return NULL rather than falling through to the potential
      null pointer dereference (since the original intentional
      outcome would be to return NULL anyhow) for this odd fault
      case.
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com> [tweaked lightly]
      9088616f
    • D
      tile/elf: reorganize notify_exec() · 5a3b4e80
      Davidlohr Bueso 提交于
      In the future mm->exe_file will be done without mmap_sem
      serialization, thus isolate and reorganize the tile elf
      code to make the transition easier. Good users will, make
      use of the more standard get_mm_exe_file(), requiring only
      holding the mmap_sem to read the value, and relying on reference
      counting to make sure that the exe file won't dissappear
      underneath us.
      
      The visible effects of this patch are:
      
         o We now take and drop the mmap_sem more often. Instead of
           just in arch_setup_additional_pages(), we also do it in:
      
           1) get_mm_exe_file()
           2) to get the mm->vm_file and notify the simulator.
      
          [Note that 1) will disappear once we change the locking
           rules for exe_file.]
      
         o We avoid getting a free page and doing d_path() while
           holding the mmap_sem. This requires reordering the checks.
      Signed-off-by: NDavidlohr Bueso <dbueso@suse.de>
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      5a3b4e80
    • C
      tile: use si_int instead of si_ptr for compat_siginfo · 89067c2d
      Chris Metcalf 提交于
      To be compatible with the generic get_compat_sigevent(), the
      copy_siginfo_to_user32() and thus copy_siginfo_from_user32()
      have to use si_int instead of si_ptr.  Using si_ptr means that
      for the case of ILP32 compat code running in big-endian mode,
      we would end up copying the high 32 bits of the pointer value
      into si_int instead of the desired low 32 bits.
      Signed-off-by: NChris Metcalf <cmetcalf@ezchip.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      89067c2d
  4. 17 4月, 2015 18 次提交
  5. 16 4月, 2015 3 次提交
    • O
      x86/ptrace: Fix the TIF_FORCED_TF logic in handle_signal() · fd0f86b6
      Oleg Nesterov 提交于
      When the TIF_SINGLESTEP tracee dequeues a signal,
      handle_signal() clears TIF_FORCED_TF and X86_EFLAGS_TF but
      leaves TIF_SINGLESTEP set.
      
      If the tracer does PTRACE_SINGLESTEP again, enable_single_step()
      sets X86_EFLAGS_TF but not TIF_FORCED_TF.  This means that the
      subsequent PTRACE_CONT doesn't not clear X86_EFLAGS_TF, and the
      tracee gets the wrong SIGTRAP.
      
      Test-case (needs -O2 to avoid prologue insns in signal handler):
      
      	#include <unistd.h>
      	#include <stdio.h>
      	#include <sys/ptrace.h>
      	#include <sys/wait.h>
      	#include <sys/user.h>
      	#include <assert.h>
      	#include <stddef.h>
      
      	void handler(int n)
      	{
      		asm("nop");
      	}
      
      	int child(void)
      	{
      		assert(ptrace(PTRACE_TRACEME, 0,0,0) == 0);
      		signal(SIGALRM, handler);
      		kill(getpid(), SIGALRM);
      		return 0x23;
      	}
      
      	void *getip(int pid)
      	{
      		return (void*)ptrace(PTRACE_PEEKUSER, pid,
      					offsetof(struct user, regs.rip), 0);
      	}
      
      	int main(void)
      	{
      		int pid, status;
      
      		pid = fork();
      		if (!pid)
      			return child();
      
      		assert(wait(&status) == pid);
      		assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGALRM);
      
      		assert(ptrace(PTRACE_SINGLESTEP, pid, 0, SIGALRM) == 0);
      		assert(wait(&status) == pid);
      		assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP);
      		assert((getip(pid) - (void*)handler) == 0);
      
      		assert(ptrace(PTRACE_SINGLESTEP, pid, 0, SIGALRM) == 0);
      		assert(wait(&status) == pid);
      		assert(WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP);
      		assert((getip(pid) - (void*)handler) == 1);
      
      		assert(ptrace(PTRACE_CONT, pid, 0,0) == 0);
      		assert(wait(&status) == pid);
      		assert(WIFEXITED(status) && WEXITSTATUS(status) == 0x23);
      
      		return 0;
      	}
      
      The last assert() fails because PTRACE_CONT wrongly triggers
      another single-step and X86_EFLAGS_TF can't be cleared by
      debugger until the tracee does sys_rt_sigreturn().
      
      Change handle_signal() to do user_disable_single_step() if
      stepping, we do not need to preserve TIF_SINGLESTEP because we
      are going to do ptrace_notify(), and it is simply wrong to leak
      this bit.
      
      While at it, change the comment to explain why we also need to
      clear TF unconditionally after setup_rt_frame().
      
      Note: in the longer term we should probably change
      setup_sigcontext() to use get_flags() and then just remove this
      user_disable_single_step().  And, the state of TIF_FORCED_TF can
      be wrong after restore_sigcontext() which can set/clear TF, this
      needs another fix.
      
      This fix fixes the 'single_step_syscall_32' testcase in
      the x86 testsuite:
      
      Before:
      
      	~/linux/tools/testing/selftests/x86> ./single_step_syscall_32
      	[RUN]   Set TF and check nop
      	[OK]    Survived with TF set and 9 traps
      	[RUN]   Set TF and check int80
      	[OK]    Survived with TF set and 9 traps
      	[RUN]   Set TF and check a fast syscall
      	[WARN]  Hit 10000 SIGTRAPs with si_addr 0xf7789cc0, ip 0xf7789cc0
      	Trace/breakpoint trap (core dumped)
      
      After:
      
      	~/linux/linux/tools/testing/selftests/x86> ./single_step_syscall_32
      	[RUN]   Set TF and check nop
      	[OK]    Survived with TF set and 9 traps
      	[RUN]   Set TF and check int80
      	[OK]    Survived with TF set and 9 traps
      	[RUN]   Set TF and check a fast syscall
      	[OK]    Survived with TF set and 39 traps
      	[RUN]   Fast syscall with TF cleared
      	[OK]    Nothing unexpected happened
      Reported-by: NEvan Teran <eteran@alum.rit.edu>
      Reported-by: NPedro Alves <palves@redhat.com>
      Tested-by: NAndres Freund <andres@anarazel.de>
      Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      [ Added x86 self-test info. ]
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      fd0f86b6
    • J
      s390: remove use of seq_printf return value · c2f0b61d
      Joe Perches 提交于
      The seq_printf return value, because it's frequently misused,
      will eventually be converted to void.
      
      See: commit 1f33c41c ("seq_file: Rename seq_overflow() to
           seq_has_overflowed() and make public")
      Signed-off-by: NJoe Perches <joe@perches.com>
      Acked-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
      Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
      Cc: Peter Oberparleiter <oberpar@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c2f0b61d
    • J
      cris fasttimer: remove use of seq_printf return value · dc640a88
      Joe Perches 提交于
      The seq_printf return value, because it's frequently misused,
      will eventually be converted to void.
      
      See: commit 1f33c41c ("seq_file: Rename seq_overflow() to
           seq_has_overflowed() and make public")
      
      Miscellanea:
      
      o Coalesce formats, realign arguments
      Signed-off-by: NJoe Perches <joe@perches.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      dc640a88