1. 16 5月, 2019 1 次提交
    • V
      nds32: Fix vDSO clock_getres() · af9abd65
      Vincenzo Frascino 提交于
      clock_getres in the vDSO library has to preserve the same behaviour
      of posix_get_hrtimer_res().
      
      In particular, posix_get_hrtimer_res() does:
          sec = 0;
          ns = hrtimer_resolution;
      and hrtimer_resolution depends on the enablement of the high
      resolution timers that can happen either at compile or at run time.
      
      Fix the nds32 vdso implementation of clock_getres keeping a copy of
      hrtimer_resolution in vdso data and using that directly.
      
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Vincent Chen <deanbo422@gmail.com>
      Signed-off-by: NVincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: NGreentime Hu <greentime@andestech.com>
      af9abd65
  2. 15 5月, 2019 2 次提交
  3. 07 5月, 2019 5 次提交
  4. 24 4月, 2019 1 次提交
  5. 08 4月, 2019 2 次提交
  6. 05 4月, 2019 2 次提交
    • S
      syscalls: Remove start and number from syscall_set_arguments() args · 32d92586
      Steven Rostedt (VMware) 提交于
      After removing the start and count arguments of syscall_get_arguments() it
      seems reasonable to remove them from syscall_set_arguments(). Note, as of
      today, there are no users of syscall_set_arguments(). But we are told that
      there will be soon. But for now, at least make it consistent with
      syscall_get_arguments().
      
      Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org
      
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: "Dmitry V. Levin" <ldv@altlinux.org>
      Cc: x86@kernel.org
      Cc: linux-snps-arc@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-c6x-dev@linux-c6x.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Cc: linux-hexagon@vger.kernel.org
      Cc: linux-ia64@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: nios2-dev@lists.rocketboards.org
      Cc: openrisc@lists.librecores.org
      Cc: linux-parisc@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-riscv@lists.infradead.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-sh@vger.kernel.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: linux-xtensa@linux-xtensa.org
      Cc: linux-arch@vger.kernel.org
      Acked-by: Max Filippov <jcmvbkbc@gmail.com> # For xtensa changes
      Acked-by: Will Deacon <will.deacon@arm.com> # For the arm64 bits
      Reviewed-by: Thomas Gleixner <tglx@linutronix.de> # for x86
      Reviewed-by: NDmitry V. Levin <ldv@altlinux.org>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      32d92586
    • S
      syscalls: Remove start and number from syscall_get_arguments() args · b35f549d
      Steven Rostedt (Red Hat) 提交于
      At Linux Plumbers, Andy Lutomirski approached me and pointed out that the
      function call syscall_get_arguments() implemented in x86 was horribly
      written and not optimized for the standard case of passing in 0 and 6 for
      the starting index and the number of system calls to get. When looking at
      all the users of this function, I discovered that all instances pass in only
      0 and 6 for these arguments. Instead of having this function handle
      different cases that are never used, simply rewrite it to return the first 6
      arguments of a system call.
      
      This should help out the performance of tracing system calls by ptrace,
      ftrace and perf.
      
      Link: http://lkml.kernel.org/r/20161107213233.754809394@goodmis.org
      
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: "Dmitry V. Levin" <ldv@altlinux.org>
      Cc: x86@kernel.org
      Cc: linux-snps-arc@lists.infradead.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-c6x-dev@linux-c6x.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Cc: linux-hexagon@vger.kernel.org
      Cc: linux-ia64@vger.kernel.org
      Cc: linux-mips@vger.kernel.org
      Cc: nios2-dev@lists.rocketboards.org
      Cc: openrisc@lists.librecores.org
      Cc: linux-parisc@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-riscv@lists.infradead.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-sh@vger.kernel.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: linux-xtensa@linux-xtensa.org
      Cc: linux-arch@vger.kernel.org
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
      Acked-by: Max Filippov <jcmvbkbc@gmail.com> # For xtensa changes
      Acked-by: Will Deacon <will.deacon@arm.com> # For the arm64 bits
      Reviewed-by: Thomas Gleixner <tglx@linutronix.de> # for x86
      Reviewed-by: NDmitry V. Levin <ldv@altlinux.org>
      Reported-by: NAndy Lutomirski <luto@amacapital.net>
      Signed-off-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      b35f549d
  7. 03 4月, 2019 3 次提交
    • P
      ia64/tlb: Eradicate tlb_migrate_finish() callback · 64559598
      Peter Zijlstra 提交于
      Only ia64-sn2 uses this as an optimization, and there it is of
      questionable correctness due to the mm_users==1 test.
      
      Remove it entirely.
      
      No change in behavior intended.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      64559598
    • P
      arch/tlb: Clean up simple architectures · 6137fed0
      Peter Zijlstra 提交于
      For the architectures that do not implement their own tlb_flush() but
      do already use the generic mmu_gather, there are two options:
      
       1) the platform has an efficient flush_tlb_range() and
          asm-generic/tlb.h doesn't need any overrides at all.
      
       2) the platform lacks an efficient flush_tlb_range() and
          we select MMU_GATHER_NO_RANGE to minimize full invalidates.
      
      Convert all 'simple' architectures to one of these two forms.
      
      alpha:	    has no range invalidate -> 2
      arc:	    already used flush_tlb_range() -> 1
      c6x:	    has no range invalidate -> 2
      hexagon:    has an efficient flush_tlb_range() -> 1
                  (flush_tlb_mm() is in fact a full range invalidate,
      	     so no need to shoot down everything)
      m68k:	    has inefficient flush_tlb_range() -> 2
      microblaze: has no flush_tlb_range() -> 2
      mips:	    has efficient flush_tlb_range() -> 1
      	    (even though it currently seems to use flush_tlb_mm())
      nds32:	    already uses flush_tlb_range() -> 1
      nios2:	    has inefficient flush_tlb_range() -> 2
      	    (no limit on range iteration)
      openrisc:   has inefficient flush_tlb_range() -> 2
      	    (no limit on range iteration)
      parisc:	    already uses flush_tlb_range() -> 1
      sparc32:    already uses flush_tlb_range() -> 1
      unicore32:  has inefficient flush_tlb_range() -> 2
      	    (no limit on range iteration)
      xtensa:	    has efficient flush_tlb_range() -> 1
      
      Note this also fixes a bug in the existing code for a number
      platforms. Those platforms that did:
      
        tlb_end_vma() -> if (!full_mm) flush_tlb_*()
        tlb_flush -> if (full_mm) flush_tlb_mm()
      
      missed the case of shift_arg_pages(), which doesn't have @fullmm set,
      nor calls into tlb_*vma(), but still frees page-tables and thus needs
      an invalidate. The new code handles this by detecting a non-empty
      range, and either issuing the matching range invalidate or a full
      invalidate, depending on the capabilities.
      
      No change in behavior intended.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Greentime Hu <green.hu@gmail.com>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Jonas Bonn <jonas@southpole.se>
      Cc: Ley Foon Tan <lftan@altera.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mark Salter <msalter@redhat.com>
      Cc: Max Filippov <jcmvbkbc@gmail.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Nick Piggin <npiggin@gmail.com>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Richard Kuo <rkuo@codeaurora.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      6137fed0
    • P
      asm-generic/tlb, arch: Provide generic VIPT cache flush · e7fd28a7
      Peter Zijlstra 提交于
      The one obvious thing SH and ARM want is a sensible default for
      tlb_start_vma(). (also: https://lkml.org/lkml/2004/1/15/6 )
      
      Avoid all VIPT architectures providing their own tlb_start_vma()
      implementation and rely on architectures to provide a no-op
      flush_cache_range() when it is not relevant.
      
      This patch makes tlb_start_vma() default to flush_cache_range(), which
      should be right and sufficient. The only exceptions that I found where
      (oddly):
      
        - m68k-mmu
        - sparc64
        - unicore
      
      Those architectures appear to have flush_cache_range(), but their
      current tlb_start_vma() does not call it.
      
      No change in behavior intended.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NWill Deacon <will.deacon@arm.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Guan Xuetao <gxt@pku.edu.cn>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nick Piggin <npiggin@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@surriel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      e7fd28a7
  8. 21 3月, 2019 3 次提交
    • D
      syscall_get_arch: add "struct task_struct *" argument · 16add411
      Dmitry V. Levin 提交于
      This argument is required to extend the generic ptrace API with
      PTRACE_GET_SYSCALL_INFO request: syscall_get_arch() is going
      to be called from ptrace_request() along with syscall_get_nr(),
      syscall_get_arguments(), syscall_get_error(), and
      syscall_get_return_value() functions with a tracee as their argument.
      
      The primary intent is that the triple (audit_arch, syscall_nr, arg1..arg6)
      should describe what system call is being called and what its arguments
      are.
      
      Reverts: 5e937a9a ("syscall_get_arch: remove useless function arguments")
      Reverts: 1002d94d ("syscall.h: fix doc text for syscall_get_arch()")
      Reviewed-by: Andy Lutomirski <luto@kernel.org> # for x86
      Reviewed-by: NPalmer Dabbelt <palmer@sifive.com>
      Acked-by: NPaul Moore <paul@paul-moore.com>
      Acked-by: Paul Burton <paul.burton@mips.com> # MIPS parts
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Acked-by: Kees Cook <keescook@chromium.org> # seccomp parts
      Acked-by: Mark Salter <msalter@redhat.com> # for the c6x bit
      Cc: Elvira Khabirova <lineprinter@altlinux.org>
      Cc: Eugene Syromyatnikov <esyr@redhat.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: x86@kernel.org
      Cc: linux-alpha@vger.kernel.org
      Cc: linux-snps-arc@lists.infradead.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-c6x-dev@linux-c6x.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Cc: linux-hexagon@vger.kernel.org
      Cc: linux-ia64@vger.kernel.org
      Cc: linux-m68k@lists.linux-m68k.org
      Cc: linux-mips@vger.kernel.org
      Cc: nios2-dev@lists.rocketboards.org
      Cc: openrisc@lists.librecores.org
      Cc: linux-parisc@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-riscv@lists.infradead.org
      Cc: linux-s390@vger.kernel.org
      Cc: linux-sh@vger.kernel.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: linux-xtensa@linux-xtensa.org
      Cc: linux-arch@vger.kernel.org
      Cc: linux-audit@redhat.com
      Signed-off-by: NDmitry V. Levin <ldv@altlinux.org>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      16add411
    • D
      nds32: define syscall_get_arch() · fa562447
      Dmitry V. Levin 提交于
      syscall_get_arch() is required to be implemented on all architectures
      in addition to already implemented syscall_get_nr(),
      syscall_get_arguments(), syscall_get_error(), and
      syscall_get_return_value() functions in order to extend the generic
      ptrace API with PTRACE_GET_SYSCALL_INFO request.
      Acked-by: NPaul Moore <paul@paul-moore.com>
      Acked-by: NVincent Chen <vincentc@andestech.com>
      Acked-by: NGreentime Hu <greentime@andestech.com>
      Cc: Elvira Khabirova <lineprinter@altlinux.org>
      Cc: Eugene Syromyatnikov <esyr@redhat.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: linux-audit@redhat.com
      Signed-off-by: NDmitry V. Levin <ldv@altlinux.org>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      fa562447
    • D
      Move EM_NDS32 to uapi/linux/elf-em.h · 530ff23a
      Dmitry V. Levin 提交于
      This should never have been defined in the arch tree to begin with,
      and now uapi/linux/audit.h header is going to use EM_NDS32
      in order to define AUDIT_ARCH_NDS32 which is needed to implement
      syscall_get_arch() which in turn is required to extend
      the generic ptrace API with PTRACE_GET_SYSCALL_INFO request.
      Acked-by: NPaul Moore <paul@paul-moore.com>
      Acked-by: NVincent Chen <vincentc@andestech.com>
      Acked-by: NGreentime Hu <greentime@andestech.com>
      Cc: Elvira Khabirova <lineprinter@altlinux.org>
      Cc: Eugene Syromyatnikov <esyr@redhat.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: linux-audit@redhat.com
      Signed-off-by: NDmitry V. Levin <ldv@altlinux.org>
      Signed-off-by: NPaul Moore <paul@paul-moore.com>
      530ff23a
  9. 17 3月, 2019 1 次提交
  10. 05 3月, 2019 1 次提交
    • L
      get rid of legacy 'get_ds()' function · 736706be
      Linus Torvalds 提交于
      Every in-kernel use of this function defined it to KERNEL_DS (either as
      an actual define, or as an inline function).  It's an entirely
      historical artifact, and long long long ago used to actually read the
      segment selector valueof '%ds' on x86.
      
      Which in the kernel is always KERNEL_DS.
      
      Inspired by a patch from Jann Horn that just did this for a very small
      subset of users (the ones in fs/), along with Al who suggested a script.
      I then just took it to the logical extreme and removed all the remaining
      gunk.
      
      Roughly scripted with
      
         git grep -l '(get_ds())' -- :^tools/ | xargs sed -i 's/(get_ds())/(KERNEL_DS)/'
         git grep -lw 'get_ds' -- :^tools/ | xargs sed -i '/^#define get_ds()/d'
      
      plus manual fixups to remove a few unusual usage patterns, the couple of
      inline function cases and to fix up a comment that had become stale.
      
      The 'get_ds()' function remains in an x86 kvm selftest, since in user
      space it actually does something relevant.
      Inspired-by: NJann Horn <jannh@google.com>
      Inspired-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      736706be
  11. 20 2月, 2019 1 次提交
    • A
      asm-generic: Make time32 syscall numbers optional · c8ce48f0
      Arnd Bergmann 提交于
      We don't want new architectures to even provide the old 32-bit time_t
      based system calls any more, or define the syscall number macros.
      
      Add a new __ARCH_WANT_TIME32_SYSCALLS macro that gets enabled for all
      existing 32-bit architectures using the generic system call table,
      so we don't change any current behavior.
      Since this symbol is evaluated in user space as well, we cannot use
      a Kconfig CONFIG_* macro but have to define it in uapi/asm/unistd.h.
      
      On 64-bit architectures, the same system call numbers mostly refer to
      the system calls we want to keep, as they already pass 64-bit time_t.
      
      As new architectures no longer provide these, we need new exceptions
      in checksyscalls.sh.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      c8ce48f0
  12. 19 2月, 2019 1 次提交
    • Y
      asm-generic: Drop getrlimit and setrlimit syscalls from default list · 80d7da1c
      Yury Norov 提交于
      The newer prlimit64 syscall provides all the functionality of getrlimit
      and setrlimit syscalls and adds the pid of target process, so future
      architectures won't need to include getrlimit and setrlimit.
      
      Therefore drop getrlimit and setrlimit syscalls from the generic syscall
      list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
      unistd.h prior to including asm-generic/unistd.h, and adjust all
      architectures using the generic syscall list to define it so that no
      in-tree architectures are affected.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: linux-arch@vger.kernel.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-hexagon@vger.kernel.org
      Cc: uclinux-h8-devel@lists.sourceforge.jp
      Signed-off-by: NYury Norov <ynorov@caviumnetworks.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: Mark Salter <msalter@redhat.com> [c6x]
      Acked-by: James Hogan <james.hogan@imgtec.com> [metag]
      Acked-by: Ley Foon Tan <lftan@altera.com> [nios2]
      Acked-by: Stafford Horne <shorne@gmail.com> [openrisc]
      Acked-by: Will Deacon <will.deacon@arm.com> [arm64]
      Acked-by: Vineet Gupta <vgupta@synopsys.com> #arch/arc bits
      Signed-off-by: NYury Norov <ynorov@marvell.com>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      80d7da1c
  13. 06 1月, 2019 3 次提交
  14. 05 1月, 2019 1 次提交
    • J
      mm: treewide: remove unused address argument from pte_alloc functions · 4cf58924
      Joel Fernandes (Google) 提交于
      Patch series "Add support for fast mremap".
      
      This series speeds up the mremap(2) syscall by copying page tables at
      the PMD level even for non-THP systems.  There is concern that the extra
      'address' argument that mremap passes to pte_alloc may do something
      subtle architecture related in the future that may make the scheme not
      work.  Also we find that there is no point in passing the 'address' to
      pte_alloc since its unused.  This patch therefore removes this argument
      tree-wide resulting in a nice negative diff as well.  Also ensuring
      along the way that the enabled architectures do not do anything funky
      with the 'address' argument that goes unnoticed by the optimization.
      
      Build and boot tested on x86-64.  Build tested on arm64.  The config
      enablement patch for arm64 will be posted in the future after more
      testing.
      
      The changes were obtained by applying the following Coccinelle script.
      (thanks Julia for answering all Coccinelle questions!).
      Following fix ups were done manually:
      * Removal of address argument from  pte_fragment_alloc
      * Removal of pte_alloc_one_fast definitions from m68k and microblaze.
      
      // Options: --include-headers --no-includes
      // Note: I split the 'identifier fn' line, so if you are manually
      // running it, please unsplit it so it runs for you.
      
      virtual patch
      
      @pte_alloc_func_def depends on patch exists@
      identifier E2;
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      type T2;
      @@
      
       fn(...
      - , T2 E2
       )
       { ... }
      
      @pte_alloc_func_proto_noarg depends on patch exists@
      type T1, T2, T3, T4;
      identifier fn =~ "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      @@
      
      (
      - T3 fn(T1, T2);
      + T3 fn(T1);
      |
      - T3 fn(T1, T2, T4);
      + T3 fn(T1, T2);
      )
      
      @pte_alloc_func_proto depends on patch exists@
      identifier E1, E2, E4;
      type T1, T2, T3, T4;
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      @@
      
      (
      - T3 fn(T1 E1, T2 E2);
      + T3 fn(T1 E1);
      |
      - T3 fn(T1 E1, T2 E2, T4 E4);
      + T3 fn(T1 E1, T2 E2);
      )
      
      @pte_alloc_func_call depends on patch exists@
      expression E2;
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      @@
      
       fn(...
      -,  E2
       )
      
      @pte_alloc_macro depends on patch exists@
      identifier fn =~
      "^(__pte_alloc|pte_alloc_one|pte_alloc|__pte_alloc_kernel|pte_alloc_one_kernel)$";
      identifier a, b, c;
      expression e;
      position p;
      @@
      
      (
      - #define fn(a, b, c) e
      + #define fn(a, b) e
      |
      - #define fn(a, b) e
      + #define fn(a) e
      )
      
      Link: http://lkml.kernel.org/r/20181108181201.88826-2-joelaf@google.comSigned-off-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
      Suggested-by: NKirill A. Shutemov <kirill@shutemov.name>
      Acked-by: NKirill A. Shutemov <kirill@shutemov.name>
      Cc: Michal Hocko <mhocko@kernel.org>
      Cc: Julia Lawall <Julia.Lawall@lip6.fr>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: William Kucharski <william.kucharski@oracle.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4cf58924
  15. 04 1月, 2019 1 次提交
    • L
      Remove 'type' argument from access_ok() function · 96d4f267
      Linus Torvalds 提交于
      Nobody has actually used the type (VERIFY_READ vs VERIFY_WRITE) argument
      of the user address range verification function since we got rid of the
      old racy i386-only code to walk page tables by hand.
      
      It existed because the original 80386 would not honor the write protect
      bit when in kernel mode, so you had to do COW by hand before doing any
      user access.  But we haven't supported that in a long time, and these
      days the 'type' argument is a purely historical artifact.
      
      A discussion about extending 'user_access_begin()' to do the range
      checking resulted this patch, because there is no way we're going to
      move the old VERIFY_xyz interface to that model.  And it's best done at
      the end of the merge window when I've done most of my merges, so let's
      just get this done once and for all.
      
      This patch was mostly done with a sed-script, with manual fix-ups for
      the cases that weren't of the trivial 'access_ok(VERIFY_xyz' form.
      
      There were a couple of notable cases:
      
       - csky still had the old "verify_area()" name as an alias.
      
       - the iter_iov code had magical hardcoded knowledge of the actual
         values of VERIFY_{READ,WRITE} (not that they mattered, since nothing
         really used it)
      
       - microblaze used the type argument for a debug printout
      
      but other than those oddities this should be a total no-op patch.
      
      I tried to fix up all architectures, did fairly extensive grepping for
      access_ok() uses, and the changes are trivial, but I may have missed
      something.  Any missed conversion should be trivially fixable, though.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      96d4f267
  16. 22 11月, 2018 4 次提交
  17. 06 11月, 2018 3 次提交
    • N
      nds32: Power management for nds32 · 7938e631
      Nick Hu 提交于
      There are three sleep states in nds32:
      	suspend to idle,
      	suspend to standby,
      	suspend to ram
      
      In suspend to ram, we use the 'standby' instruction to emulate
      power management device to hang the system util wakeup source
      send wakeup events to break the loop.
      
      First, we push the general purpose registers and system registers
      to stack. Second, we translate stack pointer to physical address
      and store to memory to save the stack pointer. Third, after write
      back and invalid the cache we hang in 'standby' intruction.
      When wakeup source trigger wake up events, the loop will be break
      and resume the system.
      Signed-off-by: NNick Hu <nickhu@andestech.com>
      Acked-by: NPavel Machek <pavel@ucw.cz>
      Acked-by: NGreentime Hu <greentime@andestech.com>
      Signed-off-by: NGreentime Hu <greentime@andestech.com>
      7938e631
    • N
      nds32: Perf porting · ebd09753
      Nickhu 提交于
      This is the commit that porting the perf for nds32.
      
      1.Raw event:
      	The raw events start with 'r'.
      		Usage:
      			perf stat -e rXYZ ./app
      			X: the index of performance counter.
      			YZ: the index(convert to hexdecimal) of events
      
      		Example:
      			'perf stat -e r101 ./app' means the counter 1 will count the instruction
      		event.
      
      		The index of counter and events can be found in
      		"Andes System Privilege Architecture Version 3 Manual".
      
      Or you can perform the 'perf list' to find the symbolic name of raw events.
      
      2.Perf mmap2:
      
      	Fix unexpected perf mmap2() page fault
      
      	When the mmap2() called by perf application,
      	you will encounter such condition:"failed to write."
      	With return value -EFAULT
      
      	This is due to the page fault caused by "reading" buffer
      	from the mapped legal address region to write to the descriptor.
      	The page_fault handler will get a VM_FAULT_SIGBUS return value,
      	which should not happens here.(Due to this is a read request.)
      
      	You can refer to kernel/events/core.c:perf_mmap_fault(...)
      	If "(vmf->pgoff && (vmf->flags & FAULT_FLAG_WRITE))" is evaluated
      	as true, you will get VM_FAULT_SIGBUS as return value.
      
      	However, this is not an write request. The flags which indicated
      	why the page fault happens is wrong.
      
      	Furthermore, NDS32 SPAv3 is not able to detect it is read or write.
      	It only know  either it is instruction fetch or data access.
      
      	Therefore, by removing the wrong flag assignment(actually, the hardware
      	is not able to show the reason), we can fix this bug.
      
      3.Perf multiple events map to same counter.
      
      	When there are multiple events map to the same counter, the counter
      	counts inaccurately. This is because each counter only counts one event
      	in the same time.
      	So when there are multiple events map to same counter, they have to take
      	turns in each context.
      
      	There are two solution:
      	1. Print the error message when multiple events map to the same counter.
      	But print the error message would let the program hang in loop. The ltp
      	(linux test program) would be failed when the program hang in loop.
      
      	2. Don't print the error message, the ltp would pass. But the user need to
      	have the knowledge that don't count the events which map to the same
      	counter, or the user will get the inaccurate results.
      
      	We choose method 2 for the solution
      Signed-off-by: NNickhu <nickhu@andestech.com>
      Acked-by: NGreentime Hu <greentime@andestech.com>
      Signed-off-by: NGreentime Hu <greentime@andestech.com>
      ebd09753
    • N
      nds32: Fix bug in bitfield.h · 9aaafac8
      Nickhu 提交于
      There two bitfield bug for perfomance counter
      in bitfield.h:
      
      	PFM_CTL_offSEL1		21 --> 16
      	PFM_CTL_offSEL2		27 --> 22
      
      This commit fix it.
      Signed-off-by: NNickhu <nickhu@andestech.com>
      Acked-by: NGreentime Hu <greentime@andestech.com>
      Signed-off-by: NGreentime Hu <greentime@andestech.com>
      9aaafac8
  18. 02 11月, 2018 1 次提交
  19. 31 10月, 2018 1 次提交
  20. 04 9月, 2018 3 次提交