17 Mar, 2019

1 commit

  • Currently, every arch/*/include/uapi/asm/Kbuild explicitly includes
    the common Kbuild.asm file. Factor out the duplicated include directives
    to scripts/Makefile.asm-generic so that no architecture would opt out
    of the mandatory-y mechanism.

    um is not forced to include mandatory-y since it is a very exceptional
    case which does not support UAPI.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

13 Mar, 2019

1 commit

  • Add check for the return value of memblock_alloc*() functions and call
    panic() in case of error. The panic message repeats the one used by
    panicing memblock allocators with adjustment of parameters to include
    only relevant ones.

    The replacement was mostly automated with semantic patches like the one
    below with manual massaging of format strings.

    @@
    expression ptr, size, align;
    @@
    ptr = memblock_alloc(size, align);
    + if (!ptr)
    + panic("%s: Failed to allocate %lu bytes align=0x%lx\n", __func__, size, align);

    [anders.roxell@linaro.org: use '%pa' with 'phys_addr_t' type]
    Link: http://lkml.kernel.org/r/20190131161046.21886-1-anders.roxell@linaro.org
    [rppt@linux.ibm.com: fix format strings for panics after memblock_alloc]
    Link: http://lkml.kernel.org/r/1548950940-15145-1-git-send-email-rppt@linux.ibm.com
    [rppt@linux.ibm.com: don't panic if the allocation in sparse_buffer_init fails]
    Link: http://lkml.kernel.org/r/20190131074018.GD28876@rapoport-lnx
    [akpm@linux-foundation.org: fix xtensa printk warning]
    Link: http://lkml.kernel.org/r/1548057848-15136-20-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Signed-off-by: Anders Roxell
    Reviewed-by: Guo Ren [c-sky]
    Acked-by: Paul Burton [MIPS]
    Acked-by: Heiko Carstens [s390]
    Reviewed-by: Juergen Gross [Xen]
    Reviewed-by: Geert Uytterhoeven [m68k]
    Acked-by: Max Filippov [xtensa]
    Cc: Catalin Marinas
    Cc: Christophe Leroy
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Dennis Zhou
    Cc: Greentime Hu
    Cc: Greg Kroah-Hartman
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Mark Salter
    Cc: Matt Turner
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Petr Mladek
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Rob Herring
    Cc: Rob Herring
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Tony Luck
    Cc: Vineet Gupta
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

10 Mar, 2019

1 commit

  • Pull fscrypt updates from Eric Biggers:
    "First: Ted, Jaegeuk, and I have decided to add me as a co-maintainer
    for fscrypt, and we're now using a shared git tree. So we've updated
    MAINTAINERS accordingly, and I'm doing the pull request this time.

    The actual changes for v5.1 are:

    - Remove the fs-specific kconfig options like CONFIG_EXT4_ENCRYPTION
    and make fscrypt support for all fscrypt-capable filesystems be
    controlled by CONFIG_FS_ENCRYPTION, similar to how CONFIG_QUOTA
    works.

    - Improve error code for rename() and link() into encrypted
    directories.

    - Various cleanups"

    * tag 'fscrypt-for-linus' of git://git.kernel.org/pub/scm/fs/fscrypt/fscrypt:
    MAINTAINERS: add Eric Biggers as an fscrypt maintainer
    fscrypt: return -EXDEV for incompatible rename or link into encrypted dir
    fscrypt: remove filesystem specific build config option
    f2fs: use IS_ENCRYPTED() to check encryption status
    ext4: use IS_ENCRYPTED() to check encryption status
    fscrypt: remove CRYPTO_CTR dependency

    Linus Torvalds
     

08 Mar, 2019

1 commit

  • There are several early memory allocations in arch/ code that use
    memblock_phys_alloc() to allocate memory, convert the returned physical
    address to the virtual address and then set the allocated memory to
    zero.

    Exactly the same behaviour can be achieved simply by calling
    memblock_alloc(): it allocates the memory in the same way as
    memblock_phys_alloc(), then it performs the phys_to_virt() conversion
    and clears the allocated memory.

    Replace the longer sequence with a simpler call to memblock_alloc().

    Link: http://lkml.kernel.org/r/1546248566-14910-6-git-send-email-rppt@linux.ibm.com
    Signed-off-by: Mike Rapoport
    Cc: Arnd Bergmann
    Cc: Benjamin Herrenschmidt
    Cc: Christoph Hellwig
    Cc: "David S. Miller"
    Cc: Greentime Hu
    Cc: Guan Xuetao
    Cc: Heiko Carstens
    Cc: Jonas Bonn
    Cc: Mark Salter
    Cc: Martin Schwidefsky
    Cc: Michael Ellerman
    Cc: Michal Hocko
    Cc: Michal Simek
    Cc: Michal Simek
    Cc: Paul Mackerras
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Stefan Kristiansson
    Cc: Vincent Chen
    Cc: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mike Rapoport
     

06 Mar, 2019

1 commit

  • Pull year 2038 updates from Thomas Gleixner:
    "Another round of changes to make the kernel ready for 2038. After lots
    of preparatory work this is the first set of syscalls which are 2038
    safe:

    403 clock_gettime64
    404 clock_settime64
    405 clock_adjtime64
    406 clock_getres_time64
    407 clock_nanosleep_time64
    408 timer_gettime64
    409 timer_settime64
    410 timerfd_gettime64
    411 timerfd_settime64
    412 utimensat_time64
    413 pselect6_time64
    414 ppoll_time64
    416 io_pgetevents_time64
    417 recvmmsg_time64
    418 mq_timedsend_time64
    419 mq_timedreceiv_time64
    420 semtimedop_time64
    421 rt_sigtimedwait_time64
    422 futex_time64
    423 sched_rr_get_interval_time64

    The syscall numbers are identical all over the architectures"

    * 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
    riscv: Use latest system call ABI
    checksyscalls: fix up mq_timedreceive and stat exceptions
    unicore32: Fix __ARCH_WANT_STAT64 definition
    asm-generic: Make time32 syscall numbers optional
    asm-generic: Drop getrlimit and setrlimit syscalls from default list
    32-bit userspace ABI: introduce ARCH_32BIT_OFF_T config option
    compat ABI: use non-compat openat and open_by_handle_at variants
    y2038: add 64-bit time_t syscalls to all 32-bit architectures
    y2038: rename old time and utime syscalls
    y2038: remove struct definition redirects
    y2038: use time32 syscall names on 32-bit
    syscalls: remove obsolete __IGNORE_ macros
    y2038: syscalls: rename y2038 compat syscalls
    x86/x32: use time64 versions of sigtimedwait and recvmmsg
    timex: change syscalls to use struct __kernel_timex
    timex: use __kernel_timex internally
    sparc64: add custom adjtimex/clock_adjtime functions
    time: fix sys_timer_settime prototype
    time: Add struct __kernel_timex
    time: make adjtime compat handling available for 32 bit
    ...

    Linus Torvalds
     

05 Mar, 2019

1 commit

  • 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: Jann Horn
    Inspired-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

28 Feb, 2019

1 commit

  • …rnd/playground into timers/2038

    Pull additional syscall ABI cleanup for y2038 from Arnd Bergmann:

    This is a follow-up to the y2038 syscall patches already merged in the tip
    tree. As the final 32-bit RISC-V syscall ABI is still being decided on,
    this is the last chance to make a few corrections to leave out interfaces
    based on 32-bit time_t along with the old off_t and rlimit types.

    The series achieves this in a few steps:

    - A couple of bug fixes for minor regressions I introduced
    in the original series

    - A couple of older patches from Yury Norov that I had never
    merged in the past, these fix up the openat/open_by_handle_at and
    getrlimit/setrlimit syscalls to disallow the old versions of off_t
    and rlimit.

    - Hiding the deprecated system calls behind an #ifdef in
    include/uapi/asm-generic/unistd.h

    - Change arch/riscv to drop all these ABIs.

    Originally, the plan was to also leave these out on C-Sky, but that now
    has a glibc port that uses the older interfaces, so we need to leave
    them in place.

    Thomas Gleixner
     

20 Feb, 2019

1 commit

  • 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: Arnd Bergmann

    Arnd Bergmann
     

19 Feb, 2019

2 commits

  • 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
    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: Yury Norov
    Acked-by: Arnd Bergmann
    Acked-by: Mark Salter [c6x]
    Acked-by: James Hogan [metag]
    Acked-by: Ley Foon Tan [nios2]
    Acked-by: Stafford Horne [openrisc]
    Acked-by: Will Deacon [arm64]
    Acked-by: Vineet Gupta #arch/arc bits
    Signed-off-by: Yury Norov
    Signed-off-by: Arnd Bergmann

    Yury Norov
     
  • All new 32-bit architectures should have 64-bit userspace off_t type, but
    existing architectures has 32-bit ones.

    To enforce the rule, new config option is added to arch/Kconfig that defaults
    ARCH_32BIT_OFF_T to be disabled for new 32-bit architectures. All existing
    32-bit architectures enable it explicitly.

    New option affects force_o_largefile() behaviour. Namely, if userspace
    off_t is 64-bits long, we have no reason to reject user to open big files.

    Note that even if architectures has only 64-bit off_t in the kernel
    (arc, c6x, h8300, hexagon, nios2, openrisc, and unicore32),
    a libc may use 32-bit off_t, and therefore want to limit the file size
    to 4GB unless specified differently in the open flags.

    Signed-off-by: Yury Norov
    Acked-by: Arnd Bergmann
    Signed-off-by: Yury Norov
    Signed-off-by: Arnd Bergmann

    Yury Norov
     

24 Jan, 2019

1 commit

  • In order to have a common code base for fscrypt "post read" processing
    for all filesystems which support encryption, this commit removes
    filesystem specific build config option (e.g. CONFIG_EXT4_FS_ENCRYPTION)
    and replaces it with a build option (i.e. CONFIG_FS_ENCRYPTION) whose
    value affects all the filesystems making use of fscrypt.

    Reviewed-by: Eric Biggers
    Signed-off-by: Chandan Rajendra
    Signed-off-by: Eric Biggers

    Chandan Rajendra
     

17 Jan, 2019

1 commit


06 Jan, 2019

4 commits

  • Now that Kbuild automatically creates asm-generic wrappers for missing
    mandatory headers, it is redundant to list the same headers in
    generic-y and mandatory-y.

    Suggested-by: Sam Ravnborg
    Signed-off-by: Masahiro Yamada
    Acked-by: Sam Ravnborg

    Masahiro Yamada
     
  • These comments are leftovers of commit fcc8487d477a ("uapi: export all
    headers under uapi directories").

    Prior to that commit, exported headers must be explicitly added to
    header-y. Now, all headers under the uapi/ directories are exported.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • This commit removes redundant generic-y defines in
    arch/nds32/include/asm/Kbuild.

    [1] It is redundant to define the same generic-y in both
    arch/$(ARCH)/include/asm/Kbuild and
    arch/$(ARCH)/include/uapi/asm/Kbuild.

    Remove the following generic-y:

    bitsperlong.h
    bpf_perf_event.h
    errno.h
    fcntl.h
    ioctl.h
    ioctls.h
    mman.h
    shmbuf.h
    stat.h

    [2] It is redundant to define generic-y when arch-specific
    implementation exists in arch/$(ARCH)/include/asm/*.h

    Remove the following generic-y:

    ftrace.h

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     
  • Merge more updates from Andrew Morton:

    - procfs updates

    - various misc bits

    - lib/ updates

    - epoll updates

    - autofs

    - fatfs

    - a few more MM bits

    * emailed patches from Andrew Morton : (58 commits)
    mm/page_io.c: fix polled swap page in
    checkpatch: add Co-developed-by to signature tags
    docs: fix Co-Developed-by docs
    drivers/base/platform.c: kmemleak ignore a known leak
    fs: don't open code lru_to_page()
    fs/: remove caller signal_pending branch predictions
    mm/: remove caller signal_pending branch predictions
    arch/arc/mm/fault.c: remove caller signal_pending_branch predictions
    kernel/sched/: remove caller signal_pending branch predictions
    kernel/locking/mutex.c: remove caller signal_pending branch predictions
    mm: select HAVE_MOVE_PMD on x86 for faster mremap
    mm: speed up mremap by 20x on large regions
    mm: treewide: remove unused address argument from pte_alloc functions
    initramfs: cleanup incomplete rootfs
    scripts/gdb: fix lx-version string output
    kernel/kcov.c: mark write_comp_data() as notrace
    kernel/sysctl: add panic_print into sysctl
    panic: add options to print system info when panic happens
    bfs: extra sanity checking and static inode bitmap
    exec: separate MM_ANONPAGES and RLIMIT_STACK accounting
    ...

    Linus Torvalds
     

05 Jan, 2019

1 commit

  • 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.com
    Signed-off-by: Joel Fernandes (Google)
    Suggested-by: Kirill A. Shutemov
    Acked-by: Kirill A. Shutemov
    Cc: Michal Hocko
    Cc: Julia Lawall
    Cc: Kirill A. Shutemov
    Cc: William Kucharski
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joel Fernandes (Google)
     

04 Jan, 2019

1 commit

  • 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: Linus Torvalds

    Linus Torvalds
     

30 Dec, 2018

1 commit

  • Pull nds32 updates from Greentime Hu:

    - Perf support

    - Power management support

    - FPU support

    - Hardware prefetcher support

    - Build error fixed

    - Performance enhancement

    * tag 'nds32-for-linus-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/greentime/linux:
    nds32: support hardware prefetcher
    nds32: Fix the items of hwcap_str ordering issue.
    math-emu/soft-fp.h: (_FP_ROUND_ZERO) cast 0 to void to fix warning
    math-emu/op-2.h: Use statement expressions to prevent negative constant shift
    nds32: support denormalized result through FP emulator
    nds32: Support FP emulation
    nds32: nds32 FPU port
    nds32: Remove duplicated include from pm.c
    nds32: Power management for nds32
    nds32: Add document for NDS32 PMU.
    nds32: Add perf call-graph support.
    nds32: Perf porting
    nds32: Fix bug in bitfield.h
    nds32: Fix gcc 8.0 compiler option incompatible.
    nds32: Fill all TLB entries with kernel image mapping
    nds32: Remove the redundant assignment

    Linus Torvalds
     

29 Dec, 2018

2 commits

  • Pull Devicetree updates from Rob Herring:
    "The biggest highlight here is the start of using json-schema for DT
    bindings. Being able to validate bindings has been discussed for years
    with little progress.

    - Initial support for DT bindings using json-schema language. This is
    the start of converting DT bindings from free-form text to a
    structured format.

    - Reworking of initrd address initialization. This moves to using the
    phys address instead of virt addr in the DT parsing code. This
    rework was motivated by CONFIG_DEV_BLK_INITRD causing unnecessary
    rebuilding of lots of files.

    - Fix stale phandle entries in phandle cache

    - DT overlay validation improvements. This exposed several memory
    leak bugs which have been fixed.

    - Use node name and device_type helper functions in DT code

    - Last remaining conversions to using %pOFn printk specifier instead
    of device_node.name directly

    - Create new common RTC binding doc and move all trivial RTC devices
    out of trivial-devices.txt.

    - New bindings for Freescale MAG3110 magnetometer, Cadence Sierra
    PHY, and Xen shared memory

    - Update dtc to upstream version v1.4.7-57-gf267e674d145"

    * tag 'devicetree-for-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (68 commits)
    of: __of_detach_node() - remove node from phandle cache
    of: of_node_get()/of_node_put() nodes held in phandle cache
    gpio-omap.txt: add reg and interrupts properties
    dt-bindings: mrvl,intc: fix a trivial typo
    dt-bindings: iio: magnetometer: add dt-bindings for freescale mag3110
    dt-bindings: Convert trivial-devices.txt to json-schema
    dt-bindings: arm: mrvl: amend Browstone compatible string
    dt-bindings: arm: Convert Tegra board/soc bindings to json-schema
    dt-bindings: arm: Convert ZTE board/soc bindings to json-schema
    dt-bindings: arm: Add missing Xilinx boards
    dt-bindings: arm: Convert Xilinx board/soc bindings to json-schema
    dt-bindings: arm: Convert VIA board/soc bindings to json-schema
    dt-bindings: arm: Convert ST STi board/soc bindings to json-schema
    dt-bindings: arm: Convert SPEAr board/soc bindings to json-schema
    dt-bindings: arm: Convert CSR SiRF board/soc bindings to json-schema
    dt-bindings: arm: Convert QCom board/soc bindings to json-schema
    dt-bindings: arm: Convert TI nspire board/soc bindings to json-schema
    dt-bindings: arm: Convert TI davinci board/soc bindings to json-schema
    dt-bindings: arm: Convert Calxeda board/soc bindings to json-schema
    dt-bindings: arm: Convert Altera board/soc bindings to json-schema
    ...

    Linus Torvalds
     
  • Pull DMA mapping updates from Christoph Hellwig:
    "A huge update this time, but a lot of that is just consolidating or
    removing code:

    - provide a common DMA_MAPPING_ERROR definition and avoid indirect
    calls for dma_map_* error checking

    - use direct calls for the DMA direct mapping case, avoiding huge
    retpoline overhead for high performance workloads

    - merge the swiotlb dma_map_ops into dma-direct

    - provide a generic remapping DMA consistent allocator for
    architectures that have devices that perform DMA that is not cache
    coherent. Based on the existing arm64 implementation and also used
    for csky now.

    - improve the dma-debug infrastructure, including dynamic allocation
    of entries (Robin Murphy)

    - default to providing chaining scatterlist everywhere, with opt-outs
    for the few architectures (alpha, parisc, most arm32 variants) that
    can't cope with it

    - misc sparc32 dma-related cleanups

    - remove the dma_mark_clean arch hook used by swiotlb on ia64 and
    replace it with the generic noncoherent infrastructure

    - fix the return type of dma_set_max_seg_size (Niklas Söderlund)

    - move the dummy dma ops for not DMA capable devices from arm64 to
    common code (Robin Murphy)

    - ensure dma_alloc_coherent returns zeroed memory to avoid kernel
    data leaks through userspace. We already did this for most common
    architectures, but this ensures we do it everywhere.
    dma_zalloc_coherent has been deprecated and can hopefully be
    removed after -rc1 with a coccinelle script"

    * tag 'dma-mapping-4.21' of git://git.infradead.org/users/hch/dma-mapping: (73 commits)
    dma-mapping: fix inverted logic in dma_supported
    dma-mapping: deprecate dma_zalloc_coherent
    dma-mapping: zero memory returned from dma_alloc_*
    sparc/iommu: fix ->map_sg return value
    sparc/io-unit: fix ->map_sg return value
    arm64: default to the direct mapping in get_arch_dma_ops
    PCI: Remove unused attr variable in pci_dma_configure
    ia64: only select ARCH_HAS_DMA_COHERENT_TO_PFN if swiotlb is enabled
    dma-mapping: bypass indirect calls for dma-direct
    vmd: use the proper dma_* APIs instead of direct methods calls
    dma-direct: merge swiotlb_dma_ops into the dma_direct code
    dma-direct: use dma_direct_map_page to implement dma_direct_map_sg
    dma-direct: improve addressability error reporting
    swiotlb: remove dma_mark_clean
    swiotlb: remove SWIOTLB_MAP_ERROR
    ACPI / scan: Refactor _CCA enforcement
    dma-mapping: factor out dummy DMA ops
    dma-mapping: always build the direct mapping code
    dma-mapping: move dma_cache_sync out of line
    dma-mapping: move various slow path functions out of line
    ...

    Linus Torvalds
     

14 Dec, 2018

2 commits

  • All architectures except for sparc64 use the dma-direct code in some
    form, and even for sparc64 we had the discussion of a direct mapping
    mode a while ago. In preparation for directly calling the direct
    mapping code don't bother having it optionally but always build the
    code in. This is a minor hardship for some powerpc and arm configs
    that don't pull it in yet (although they should in a relase ot two),
    and sparc64 which currently doesn't need it at all, but it will
    reduce the ifdef mess we'd otherwise need significantly.

    Signed-off-by: Christoph Hellwig
    Acked-by: Jesper Dangaard Brouer
    Tested-by: Jesper Dangaard Brouer
    Tested-by: Tony Luck

    Christoph Hellwig
     
  • Rob Herring
     

28 Nov, 2018

1 commit

  • The function_graph_enter() function does the work of calling the function
    graph hook function and the management of the shadow stack, simplifying the
    work done in the architecture dependent prepare_ftrace_return().

    Have nds32 use the new code, and remove the shadow stack management as well as
    having to set up the trace structure.

    This is needed to prepare for a fix of a design bug on how the curr_ret_stack
    is used.

    Cc: Greentime Hu
    Cc: stable@kernel.org
    Fixes: 03274a3ffb449 ("tracing/fgraph: Adjust fgraph depth before calling trace return callback")
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt (VMware)

    Steven Rostedt (VMware)
     

27 Nov, 2018

1 commit


22 Nov, 2018

5 commits

  • We add a config for user to enable or disable this feature.
    It can be used to control the hardware prefetch function.

    Signed-off-by: Nylon Chen
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Nylon Chen
     
  • The hwcap_str should be set in a correct order according to HWCAP_xx.
    We also add the missing "fpu_dp" to it.

    Signed-off-by: Nylon Chen
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Nylon Chen
     
  • Currently, the nds32 FPU dose not support the arithmetic of denormalized
    number. When the nds32 FPU finds the result of the instruction is a
    denormlized number, the nds32 FPU considers it to be an underflow condition
    and rounds the result to an appropriate number. It may causes some loss
    of precision. This commit proposes a solution to re-execute the
    instruction by the FPU emulator to enhance the precision. To transfer
    calculations from user space to kernel space, this feature will enable
    the underflow exception trap by default. Enabling this feature may cause
    some side effects:
    1. Performance loss due to extra FPU exception
    2. Need another scheme to control real underflow trap
    A new parameter, UDF_trap, which is belong to FPU context is used
    to control underflow trap.

    User can configure this feature via CONFIG_SUPPORT_DENORMAL_ARITHMETIC

    Signed-off-by: Vincent Chen
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Vincent Chen
     
  • The Andes FPU coprocessor does not support denormalized number handling.
    According to the specification, FPU generates a denorm input exception
    that requires the kernel to deal with this instrution operation when it
    encounters denormalized operands. Hence an nds32 FPU ISA emulator in the
    kernel is required to meet requirement.

    Signed-off-by: Vincent Chen
    Signed-off-by: Nickhu
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Vincent Chen
     
  • This patch set contains basic components for supporting the nds32 FPU,
    such as exception handlers and context switch for FPU registers. By
    default, the lazy FPU scheme is supported and the user can configure it via
    CONFIG_LZAY_FPU.

    Signed-off-by: Vincent Chen
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Vincent Chen
     

09 Nov, 2018

1 commit

  • Pull s390 fixes from Martin Schwidefsky:

    - A fix for the pgtable_bytes misaccounting on s390. The patch changes
    common code part in regard to page table folding and adds extra
    checks to mm_[inc|dec]_nr_[pmds|puds].

    - Add FORCE for all build targets using if_changed

    - Use non-loadable phdr for the .vmlinux.info section to avoid a
    segment overlap that confuses kexec

    - Cleanup the attribute definition for the diagnostic sampling

    - Increase stack size for CONFIG_KASAN=y builds

    - Export __node_distance to fix a build error

    - Correct return code of a PMU event init function

    - An update for the default configs

    * tag 's390-4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
    s390/perf: Change CPUM_CF return code in event init function
    s390: update defconfigs
    s390/mm: Fix ERROR: "__node_distance" undefined!
    s390/kasan: increase instrumented stack size to 64k
    s390/cpum_sf: Rework attribute definition for diagnostic sampling
    s390/mm: fix mis-accounting of pgtable_bytes
    mm: add mm_pxd_folded checks to pgtable_bytes accounting functions
    mm: introduce mm_[p4d|pud|pmd]_folded
    mm: make the __PAGETABLE_PxD_FOLDED defines non-empty
    s390: avoid vmlinux segments overlap
    s390/vdso: add missing FORCE to build targets
    s390/decompressor: add missing FORCE to build targets

    Linus Torvalds
     

06 Nov, 2018

8 commits

  • Remove duplicated include.

    Signed-off-by: YueHaibing
    Acked-by: Pavel Machek
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    YueHaibing
     
  • 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: Nick Hu
    Acked-by: Pavel Machek
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Nick Hu
     
  • The perf call-graph option can trace the callchain
    between functions. This commit add the perf callchain
    for nds32. There are kerenl callchain and user callchain.
    The kerenl callchain can trace the function in kernel
    space. There are two type for user callchain. One for the
    'optimize for size' config is set, and another one for the
    config is not set. The difference between two types is that
    the index of frame-pointer in user stack is not the same.

    For example:
    With optimize for size:
    User Stack:
    ---------
    | lp |
    ---------
    | gp |
    ---------
    | fp |

    Without optimize for size:
    User Stack:
    1. non-leaf function:
    ---------
    | lp |
    ---------
    | fp |

    2. leaf function:
    ---------
    | fp |

    Signed-off-by: Nickhu
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    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: Nickhu
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    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: Nickhu
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Nickhu
     
  • When the kernel configs of ftrace and frame pointer options are
    choosed, the compiler option of kernel will incompatible.
    Error message:
    nds32le-linux-gcc: error: -pg and -fomit-frame-pointer are incompatible

    Signed-off-by: Nickhu
    Signed-off-by: Zong Li
    Acked-by: Greentime Hu
    Signed-off-by: Greentime Hu

    Nickhu
     
  • We use earlycon replace with early_printk and doesn't use
    early_io_map() to create UART mapping. It is not necessary
    to reserve the one way in TLB for now.

    It didn't make sense if use direct-mapped and reserve one
    way at the same time. It allow the direct-mapped now.

    Signed-off-by: Zong Li
    Signed-off-by: Greentime Hu

    Zong Li
     
  • For early version, the value of r2 register was used to display
    a character on UART when error occurred. Remove these r2 assignments
    because we no longer show the character.

    Signed-off-by: Zong Li
    Signed-off-by: Greentime Hu

    Zong Li
     

02 Nov, 2018

1 commit