26 Sep, 2018

40 commits

  • [ Upstream commit c715fcfda5a08edabaa15508742be926b7ee51db ]

    For powerpc64, redundant entries in the callchain are filtered out by
    determining the state of the return address and the stack frame using
    DWARF debug information.

    For making these filtering decisions we must analyze the debug
    information for the location corresponding to the program counter value,
    i.e. the first entry in the callchain, and not the LR value; otherwise,
    perf may filter out either the second or the third entry in the
    callchain incorrectly.

    This can be observed on a powerpc64le system running Fedora 27 as shown
    below.

    Case 1 - Attaching a probe at inet_pton+0x8 (binary offset 0x15af28).
    Return address is still in LR and a new stack frame is not yet
    allocated. The LR value, i.e. the second entry, should not be
    filtered out.

    # objdump -d /usr/lib64/libc-2.26.so | less
    ...
    000000000010eb10 :
    ...
    10fa48: 78 bb e4 7e mr r4,r23
    10fa4c: 0a 00 60 38 li r3,10
    10fa50: d9 b4 04 48 bl 15af28
    10fa54: 00 00 00 60 nop
    10fa58: ac f4 ff 4b b 10ef04
    ...
    0000000000110450 :
    ...
    1105a8: 54 00 ff 38 addi r7,r31,84
    1105ac: 58 00 df 38 addi r6,r31,88
    1105b0: 69 e5 ff 4b bl 10eb18
    1105b4: 78 1b 71 7c mr r17,r3
    1105b8: 50 01 7f e8 ld r3,336(r31)
    ...
    000000000015af20 :
    15af20: 0b 00 4c 3c addis r2,r12,11
    15af24: e0 c1 42 38 addi r2,r2,-15904
    15af28: a6 02 08 7c mflr r0
    15af2c: f0 ff c1 fb std r30,-16(r1)
    15af30: f8 ff e1 fb std r31,-8(r1)
    ...

    # perf probe -x /usr/lib64/libc-2.26.so -a inet_pton+0x8
    # perf record -e probe_libc:inet_pton -g ping -6 -c 1 ::1
    # perf script

    Before:

    ping 4507 [002] 514985.546540: probe_libc:inet_pton: (7fffa7dbaf28)
    7fffa7dbaf28 __GI___inet_pton+0x8 (/usr/lib64/libc-2.26.so)
    7fffa7d705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    13fb52d70 _init+0xbfc (/usr/bin/ping)
    7fffa7c836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa7c83898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    After:

    ping 4507 [002] 514985.546540: probe_libc:inet_pton: (7fffa7dbaf28)
    7fffa7dbaf28 __GI___inet_pton+0x8 (/usr/lib64/libc-2.26.so)
    7fffa7d6fa54 gaih_inet.constprop.7+0xf44 (/usr/lib64/libc-2.26.so)
    7fffa7d705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    13fb52d70 _init+0xbfc (/usr/bin/ping)
    7fffa7c836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa7c83898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    Case 2 - Attaching a probe at _int_malloc+0x180 (binary offset 0x9cf10).
    Return address in still in LR and a new stack frame has already
    been allocated but not used. The caller's caller, i.e. the third
    entry, is invalid and should be filtered out and not the second
    one.

    # objdump -d /usr/lib64/libc-2.26.so | less
    ...
    000000000009cd90 :
    9cd90: 17 00 4c 3c addis r2,r12,23
    9cd94: 70 a3 42 38 addi r2,r2,-23696
    9cd98: 26 00 80 7d mfcr r12
    9cd9c: f8 ff e1 fb std r31,-8(r1)
    9cda0: 17 00 e4 3b addi r31,r4,23
    9cda4: d8 ff 61 fb std r27,-40(r1)
    9cda8: 78 23 9b 7c mr r27,r4
    9cdac: 1f 00 bf 2b cmpldi cr7,r31,31
    9cdb0: f0 ff c1 fb std r30,-16(r1)
    9cdb4: b0 ff c1 fa std r22,-80(r1)
    9cdb8: 78 1b 7e 7c mr r30,r3
    9cdbc: 08 00 81 91 stw r12,8(r1)
    9cdc0: 11 ff 21 f8 stdu r1,-240(r1)
    9cdc4: 4c 01 9d 41 bgt cr7,9cf10
    9cdc8: 20 00 a4 2b cmpldi cr7,r4,32
    ...
    9cf08: 00 00 00 60 nop
    9cf0c: 00 00 42 60 ori r2,r2,0
    9cf10: e4 06 ff 7b rldicr r31,r31,0,59
    9cf14: 40 f8 a4 7f cmpld cr7,r4,r31
    9cf18: 68 05 9d 41 bgt cr7,9d480
    ...
    000000000009e3c0 :
    ...
    9e420: 40 02 80 38 li r4,576
    9e424: 78 fb e3 7f mr r3,r31
    9e428: 71 e9 ff 4b bl 9cd98
    9e42c: 00 00 a3 2f cmpdi cr7,r3,0
    9e430: 78 1b 7e 7c mr r30,r3
    ...
    000000000009f7a0 :
    ...
    9f8f8: 00 00 89 2f cmpwi cr7,r9,0
    9f8fc: 1c ff 9e 40 bne cr7,9f818
    9f900: c9 ea ff 4b bl 9e3c8
    9f904: 00 00 00 60 nop
    9f908: e8 90 22 e9 ld r9,-28440(r2)
    ...

    # perf probe -x /usr/lib64/libc-2.26.so -a _int_malloc+0x180
    # perf record -e probe_libc:_int_malloc -g ./test-malloc
    # perf script

    Before:

    test-malloc 6554 [009] 515975.797403: probe_libc:_int_malloc: (7fffa6e6cf10)
    7fffa6e6cf10 _int_malloc+0x180 (/usr/lib64/libc-2.26.so)
    7fffa6dd0000 [unknown] (/usr/lib64/libc-2.26.so)
    7fffa6e6f904 malloc+0x164 (/usr/lib64/libc-2.26.so)
    7fffa6e6f9fc malloc+0x25c (/usr/lib64/libc-2.26.so)
    100006b4 main+0x38 (/home/testuser/test-malloc)
    7fffa6df36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa6df3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    After:

    test-malloc 6554 [009] 515975.797403: probe_libc:_int_malloc: (7fffa6e6cf10)
    7fffa6e6cf10 _int_malloc+0x180 (/usr/lib64/libc-2.26.so)
    7fffa6e6e42c tcache_init.part.4+0x6c (/usr/lib64/libc-2.26.so)
    7fffa6e6f904 malloc+0x164 (/usr/lib64/libc-2.26.so)
    7fffa6e6f9fc malloc+0x25c (/usr/lib64/libc-2.26.so)
    100006b4 main+0x38 (/home/sandipan/test-malloc)
    7fffa6df36a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fffa6df3898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    Signed-off-by: Sandipan Das
    Cc: Jiri Olsa
    Cc: Maynard Johnson
    Cc: Naveen N. Rao
    Cc: Ravi Bangoria
    Cc: Sukadev Bhattiprolu
    Fixes: a60335ba3298 ("perf tools powerpc: Adjust callchain based on DWARF debug info")
    Link: http://lkml.kernel.org/r/24bb726d91ed173aebc972ec3f41a2ef2249434e.1530724939.git.sandipan@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     
  • [ Upstream commit cd4806911cee3901bc2b5eb95603cf1958720b57 ]

    For most of Exynos SoCs, Power Management Unit (PMU) address space is
    mapped into global variable 'pmu_base_addr' very early when initializing
    PMU interrupt controller. A lot of other machine code depends on it so
    when doing iounmap() on this address, clear the global as well to avoid
    usage of invalid value (pointing to unmapped memory region).

    Properly mapped PMU address space is a requirement for all other machine
    code so this fix is purely theoretical. Boot will fail immediately in
    many other places after following this error path.

    Signed-off-by: Krzysztof Kozlowski
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Krzysztof Kozlowski
     
  • [ Upstream commit 1ba0a59cea41ea05fda92daaf2a2958a2246b9cf ]

    I discovered the problem when developing a frame buffer driver for the
    PlayStation 2 (not yet merged), using the following video modes for the
    PlayStation 3 in drivers/video/fbdev/ps3fb.c:

    }, {
    /* 1080if */
    "1080if", 50, 1920, 1080, 13468, 148, 484, 36, 4, 88, 5,
    FB_SYNC_BROADCAST, FB_VMODE_INTERLACED
    }, {
    /* 1080pf */
    "1080pf", 50, 1920, 1080, 6734, 148, 484, 36, 4, 88, 5,
    FB_SYNC_BROADCAST, FB_VMODE_NONINTERLACED
    },

    In ps3fb_probe, the mode_option module parameter is used with fb_find_mode
    but it can only select the interlaced variant of 1920x1080 since the loop
    matching the modes does not take the difference between interlaced and
    progressive modes into account.

    In short, without the patch, progressive 1920x1080 cannot be chosen as a
    mode_option parameter since fb_find_mode (falsely) thinks interlace is a
    perfect match.

    Signed-off-by: Fredrik Noring
    Cc: "Maciej W. Rozycki"
    [b.zolnierkie: updated patch description]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Fredrik Noring
     
  • [ Upstream commit b951d80aaf224b1f774e10def672f5e37488e4ee ]

    When parsing the video modes from DT properties, make sure to zero out
    memory before using it. This is important because not all fields in the mode
    struct are explicitly initialized, even though they are used later on.

    Fixes: 420a488278e86 ("video: fbdev: pxafb: initial devicetree conversion")
    Reviewed-by: Robert Jarzmik
    Signed-off-by: Daniel Mack
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Daniel Mack
     
  • [ Upstream commit 9068533e4f470daf2b0f29c71d865990acd8826e ]

    For powerpc64, perf will filter out the second entry in the callchain,
    i.e. the LR value, if the return address of the function corresponding
    to the probed location has already been saved on its caller's stack.

    The state of the return address is determined using debug information.
    At any point within a function, if the return address is already saved
    somewhere, a DWARF expression can tell us about its location. If the
    return address in still in LR only, no DWARF expression would exist.

    Typically, the instructions in a function's prologue first copy the LR
    value to R0 and then pushes R0 on to the stack. If LR has already been
    copied to R0 but R0 is yet to be pushed to the stack, we can still get a
    DWARF expression that says that the return address is in R0. This is
    indicating that getting a DWARF expression for the return address does
    not guarantee the fact that it has already been saved on the stack.

    This can be observed on a powerpc64le system running Fedora 27 as shown
    below.

    # objdump -d /usr/lib64/libc-2.26.so | less
    ...
    000000000015af20 :
    15af20: 0b 00 4c 3c addis r2,r12,11
    15af24: e0 c1 42 38 addi r2,r2,-15904
    15af28: a6 02 08 7c mflr r0
    15af2c: f0 ff c1 fb std r30,-16(r1)
    15af30: f8 ff e1 fb std r31,-8(r1)
    15af34: 78 1b 7f 7c mr r31,r3
    15af38: 78 23 83 7c mr r3,r4
    15af3c: 78 2b be 7c mr r30,r5
    15af40: 10 00 01 f8 std r0,16(r1)
    15af44: c1 ff 21 f8 stdu r1,-64(r1)
    15af48: 28 00 81 f8 std r4,40(r1)
    ...

    # readelf --debug-dump=frames-interp /usr/lib64/libc-2.26.so | less
    ...
    00027024 0000000000000024 00027028 FDE cie=00000000 pc=000000000015af20..000000000015af88
    LOC CFA r30 r31 ra
    000000000015af20 r1+0 u u u
    000000000015af34 r1+0 c-16 c-8 r0
    000000000015af48 r1+64 c-16 c-8 c+16
    000000000015af5c r1+0 c-16 c-8 c+16
    000000000015af78 r1+0 u u
    ...

    # perf probe -x /usr/lib64/libc-2.26.so -a inet_pton+0x18
    # perf record -e probe_libc:inet_pton -g ping -6 -c 1 ::1
    # perf script

    Before:

    ping 2829 [005] 512917.460174: probe_libc:inet_pton: (7fff7e2baf38)
    7fff7e2baf38 __GI___inet_pton+0x18 (/usr/lib64/libc-2.26.so)
    7fff7e2705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    12f152d70 _init+0xbfc (/usr/bin/ping)
    7fff7e1836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fff7e183898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    After:

    ping 2829 [005] 512917.460174: probe_libc:inet_pton: (7fff7e2baf38)
    7fff7e2baf38 __GI___inet_pton+0x18 (/usr/lib64/libc-2.26.so)
    7fff7e26fa54 gaih_inet.constprop.7+0xf44 (/usr/lib64/libc-2.26.so)
    7fff7e2705b4 getaddrinfo+0x164 (/usr/lib64/libc-2.26.so)
    12f152d70 _init+0xbfc (/usr/bin/ping)
    7fff7e1836a0 generic_start_main.isra.0+0x140 (/usr/lib64/libc-2.26.so)
    7fff7e183898 __libc_start_main+0xb8 (/usr/lib64/libc-2.26.so)
    0 [unknown] ([unknown])

    Reported-by: Ravi Bangoria
    Signed-off-by: Sandipan Das
    Cc: Jiri Olsa
    Cc: Maynard Johnson
    Cc: Naveen N. Rao
    Cc: Ravi Bangoria
    Cc: Sukadev Bhattiprolu
    Link: http://lkml.kernel.org/r/66e848a7bdf2d43b39210a705ff6d828a0865661.1530724939.git.sandipan@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sandipan Das
     
  • [ Upstream commit b6566b47a67e07fdca44cf51abb14e2fbe17d3eb ]

    Fix a build warning in viafbdev.c when CONFIG_PROC_FS is not enabled
    by marking the unused function as __maybe_unused.

    ../drivers/video/fbdev/via/viafbdev.c:1471:12: warning: 'viafb_sup_odev_proc_show' defined but not used [-Wunused-function]

    Signed-off-by: Randy Dunlap
    Cc: Florian Tobias Schandinat
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     
  • [ Upstream commit 5958fde72d04e7b8c6de3669d1f794a90997e3eb ]

    goldfish_fb_probe() allocates memory for fb, but goldfish_fb_remove() does
    not have deallocation of fb, which leads to memory leak on probe/remove.

    The patch adds deallocation into goldfish_fb_remove().

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Anton Vasilyev
    Cc: Aleksandar Markovic
    Cc: Miodrag Dinic
    Cc: Goran Ferenc
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Anton Vasilyev
     
  • [ Upstream commit 46b3722cc7765582354488da633aafffcb138458 ]

    We occasionaly hit following assert failure in 'perf top', when processing the
    /proc info in multiple threads.

    perf: ...include/linux/refcount.h:109: refcount_inc:
    Assertion `!(!refcount_inc_not_zero(r))' failed.

    The gdb backtrace looks like this:

    [Switching to Thread 0x7ffff11ba700 (LWP 13749)]
    0x00007ffff50839fb in raise () from /lib64/libc.so.6
    (gdb)
    #0 0x00007ffff50839fb in raise () from /lib64/libc.so.6
    #1 0x00007ffff5085800 in abort () from /lib64/libc.so.6
    #2 0x00007ffff507c0da in __assert_fail_base () from /lib64/libc.so.6
    #3 0x00007ffff507c152 in __assert_fail () from /lib64/libc.so.6
    #4 0x0000000000535373 in refcount_inc (r=0x7fffdc009be0)
    at ...include/linux/refcount.h:109
    #5 0x00000000005354f1 in comm_str__get (cs=0x7fffdc009bc0)
    at util/comm.c:24
    #6 0x00000000005356bd in __comm_str__findnew (str=0x7fffd000b260 ":2",
    root=0xbed5c0 ) at util/comm.c:72
    #7 0x000000000053579e in comm_str__findnew (str=0x7fffd000b260 ":2",
    root=0xbed5c0 ) at util/comm.c:95
    #8 0x000000000053582e in comm__new (str=0x7fffd000b260 ":2",
    timestamp=0, exec=false) at util/comm.c:111
    #9 0x00000000005363bc in thread__new (pid=2, tid=2) at util/thread.c:57
    #10 0x0000000000523da0 in ____machine__findnew_thread (machine=0xbfde38,
    threads=0xbfdf28, pid=2, tid=2, create=true) at util/machine.c:457
    #11 0x0000000000523eb4 in __machine__findnew_thread (machine=0xbfde38,
    ...

    The failing assertion is this one:

    REFCOUNT_WARN(!refcount_inc_not_zero(r), ...

    The problem is that we keep global comm_str_root list, which
    is accessed by multiple threads during the 'perf top' startup
    and following 2 paths can race:

    thread 1:
    ...
    thread__new
    comm__new
    comm_str__findnew
    down_write(&comm_str_lock);
    __comm_str__findnew
    comm_str__get

    thread 2:
    ...
    comm__override or comm__free
    comm_str__put
    refcount_dec_and_test
    down_write(&comm_str_lock);
    rb_erase(&cs->rb_node, &comm_str_root);

    Because thread 2 first decrements the refcnt and only after then it removes the
    struct comm_str from the list, the thread 1 can find this object on the list
    with refcnt equls to 0 and hit the assert.

    This patch fixes the thread 1 __comm_str__findnew path, by ignoring objects
    that already dropped the refcnt to 0. For the rest of the objects we take the
    refcnt before comparing its name and release it afterwards with comm_str__put,
    which can also release the object completely.

    Signed-off-by: Jiri Olsa
    Acked-by: Namhyung Kim
    Cc: Alexander Shishkin
    Cc: Andi Kleen
    Cc: David Ahern
    Cc: Kan Liang
    Cc: Lukasz Odzioba
    Cc: Peter Zijlstra
    Cc: Wang Nan
    Cc: kernel-team@lge.com
    Link: http://lkml.kernel.org/r/20180720101740.GA27176@krava
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit 5ec1ec35b2979b59d0b33381e7c9aac17e159d16 ]

    The omapfb_register_client[] array has OMAPFB_PLANE_NUM elements so the
    > should be >= or we are one element beyond the end of the array.

    Fixes: 8b08cf2b64f5 ("OMAP: add TI OMAP framebuffer driver")
    Signed-off-by: Dan Carpenter
    Cc: Imre Deak
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • [ Upstream commit e8fedff1cc729fd227924305152ccc6f580e8c83 ]

    Stephan reported, that pipe mode does not carry the group information
    and thus the piped report won't display the grouped output for following
    command:

    # perf record -e '{cycles,instructions,branches}' -a sleep 4 | perf report

    It has no idea about the group setup, so it will display events
    separately:

    # Overhead Command Shared Object ...
    # ........ ............... .......................
    #
    6.71% swapper [kernel.kallsyms]
    2.28% offlineimap libpython2.7.so.1.0
    0.78% perf [kernel.kallsyms]
    ...

    Fix GROUP_DESC feature record to be synthesized in pipe mode, so the
    report output is grouped if there are groups defined in record:

    # Overhead Command Shared ...
    # ........................ ............... .......
    #
    7.57% 0.16% 0.30% swapper [kernel
    1.87% 3.15% 2.46% offlineimap libpyth
    1.33% 0.00% 0.00% perf [kernel
    ...

    Reported-by: Stephane Eranian
    Signed-off-by: Jiri Olsa
    Tested-by: Arnaldo Carvalho de Melo
    Tested-by: Stephane Eranian
    Cc: Alexander Shishkin
    Cc: David Ahern
    Cc: David Carrillo-Cisneros
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/20180712135202.14774-1-jolsa@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jiri Olsa
     
  • [ Upstream commit e79e0e1428188b24c3b57309ffa54a33c4ae40c4 ]

    Before this patch, you could get into situations like this:

    1. Process 1 searches for X free blocks, finds them, makes a reservation
    2. Process 2 searches for free blocks in the same rgrp, but now the
    bitmap is full because process 1's reservation is skipped over.
    So it marks the bitmap as GBF_FULL.
    3. Process 1 tries to allocate blocks from its own reservation, but
    since the GBF_FULL bit is set, it skips over the rgrp and searches
    elsewhere, thus not using its own reservation.

    This patch adds an additional check to allow processes to use their
    own reservations.

    Signed-off-by: Bob Peterson
    Signed-off-by: Andreas Gruenbacher
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Bob Peterson
     
  • [ Upstream commit 9ef0112442bdddef5fb55adf20b3a5464b33de75 ]

    Perf test 40 for example has several subtests numbered 1-4 when
    displaying the start of the subtest. When the subtest results
    are displayed the subtests are numbered 0-3.

    Use this command to generate trace output:

    [root@s35lp76 perf]# ./perf test -Fv 40 2>/tmp/bpf1

    Fix this by adjusting the subtest number when show the
    subtest result.

    Output before:

    [root@s35lp76 perf]# egrep '(^40\.[0-4]| subtest [0-4]:)' /tmp/bpf1
    40.1: Basic BPF filtering :
    BPF filter subtest 0: Ok
    40.2: BPF pinning :
    BPF filter subtest 1: Ok
    40.3: BPF prologue generation :
    BPF filter subtest 2: Ok
    40.4: BPF relocation checker :
    BPF filter subtest 3: Ok
    [root@s35lp76 perf]#

    Output after:

    root@s35lp76 ~]# egrep '(^40\.[0-4]| subtest [0-4]:)' /tmp/bpf1
    40.1: Basic BPF filtering :
    BPF filter subtest 1: Ok
    40.2: BPF pinning :
    BPF filter subtest 2: Ok
    40.3: BPF prologue generation :
    BPF filter subtest 3: Ok
    40.4: BPF relocation checker :
    BPF filter subtest 4: Ok
    [root@s35lp76 ~]#

    Signed-off-by: Thomas Richter
    Reviewed-by: Hendrik Brueckner
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Link: http://lkml.kernel.org/r/20180724134858.100644-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Thomas Richter
     
  • [ Upstream commit 4adb0a0432f489c5eb802b33dae7737f69e6fd7a ]

    The external clock frequency was set to 23.88MHz by mistake
    because of a platform which cannot get closer to 24MHz.
    The supported by the driver external clock is 24MHz so
    set it correctly and also fix the values of the pixel
    clock and link clock.
    However allow 1% tolerance to the external clock as this
    difference is small enough to be insignificant.

    Signed-off-by: Todor Tomov
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Todor Tomov
     
  • [ Upstream commit 1d25e3eeed1d987404e2d2e451eebac8c15cecc1 ]

    Fix 2 printk format warnings (this driver is currently only used by
    arch/sh/) by using "%pap" instead of "%lx".

    Fixes these build warnings:

    ../drivers/mtd/maps/solutionengine.c: In function 'init_soleng_maps':
    ../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
    ../drivers/mtd/maps/solutionengine.c:62:54: note: format string is defined here
    printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
    ~~~~^
    %08x
    ../include/linux/kern_levels.h:5:18: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
    ../drivers/mtd/maps/solutionengine.c:62:72: note: format string is defined here
    printk(KERN_NOTICE "Solution Engine: Flash at 0x%08lx, EPROM at 0x%08lx\n",
    ~~~~^
    %08x

    Cc: David Woodhouse
    Cc: Brian Norris
    Cc: Boris Brezillon
    Cc: Marek Vasut
    Cc: Richard Weinberger
    Cc: linux-mtd@lists.infradead.org
    Cc: Yoshinori Sato
    Cc: Rich Felker
    Cc: linux-sh@vger.kernel.org
    Cc: Sergei Shtylyov

    Signed-off-by: Randy Dunlap
    Signed-off-by: Boris Brezillon
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     
  • [ Upstream commit 99a7e2bf704d64c966dfacede1ba2d9b47cb676e ]

    Fix to return a negative error code from the ipoib_neigh_hash_init()
    error handling case instead of 0, as done elsewhere in this function.

    Fixes: 515ed4f3aab4 ("IB/IPoIB: Separate control and data related initializations")
    Signed-off-by: Wei Yongjun
    Reviewed-by: Yuval Shaia
    Signed-off-by: Jason Gunthorpe
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Wei Yongjun
     
  • [ Upstream commit 42c9cdfe1e11e083dceb0f0c4977b758cf7403b9 ]

    Set max_discard_segments to USHRT_MAX in blk_set_stacking_limits() so
    that blk_stack_limits() can stack up this limit for stacked devices.

    before:

    $ cat /sys/block/nvme0n1/queue/max_discard_segments
    256
    $ cat /sys/block/dm-0/queue/max_discard_segments
    1

    after:

    $ cat /sys/block/nvme0n1/queue/max_discard_segments
    256
    $ cat /sys/block/dm-0/queue/max_discard_segments
    256

    Fixes: 1e739730c5b9e ("block: optionally merge discontiguous discard bios into a single request")
    Reviewed-by: Christoph Hellwig
    Signed-off-by: Mike Snitzer
    Signed-off-by: Jens Axboe
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mike Snitzer
     
  • [ Upstream commit 536ca245c512aedfd84cde072d7b3ca14b6e1792 ]

    According to "Annex A16: RDMA over Converged Ethernet (RoCE)":

    A16.4.3 MANAGEMENT INTERFACES

    As defined in the base specification, a special Queue Pair, QP0 is defined
    solely for communication between subnet manager(s) and subnet management
    agents. Since such an IB-defined subnet management architecture is outside
    the scope of this annex, it follows that there is also no requirement that
    a port which conforms to this annex be associated with a QP0. Thus, for
    end nodes designed to conform to this annex, the concept of QP0 is
    undefined and unused for any port connected to an Ethernet network.

    CA16-8: A packet arriving at a RoCE port containing a BTH with the
    destination QP field set to QP0 shall be silently dropped.

    Signed-off-by: Zhu Yanjun
    Acked-by: Moni Shoua
    Reviewed-by: Yuval Shaia
    Signed-off-by: Jason Gunthorpe
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Zhu Yanjun
     
  • [ Upstream commit b509d733d337417bcb7fa4a35be3b9a49332b724 ]

    The vb2_core_qbuf() function didn't check if q->error was set. It is
    checked in __buf_prepare(), but that function isn't called if the buffer
    was already prepared before with VIDIOC_PREPARE_BUF.

    So check it at the start of vb2_core_qbuf() as well.

    Signed-off-by: Hans Verkuil
    Acked-by: Sakari Ailus
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Hans Verkuil
     
  • [ Upstream commit f8a7bfe1cb2c1ebfa07775c9c8ac0ad3ba8e5ff5 ]

    This patch disables irq on reboot to fix hang issues that were observed
    due to pending interrupts.

    Signed-off-by: Felix Fietkau
    Signed-off-by: John Crispin
    Signed-off-by: Paul Burton
    Patchwork: https://patchwork.linux-mips.org/patch/19913/
    Cc: James Hogan
    Cc: Ralf Baechle
    Cc: linux-mips@linux-mips.org
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Felix Fietkau
     
  • [ Upstream commit e49756544a21f5625b379b3871d27d8500764670 ]

    In pl330_update() when checking if a channel has been aborted, the
    channel's lock is not taken, only the overall pl330_dmac lock. But in
    pl330_terminate_all() the aborted flag (req_running==-1) is set under
    the channel lock and not the pl330_dmac lock.

    With threaded interrupts, this leads to a potential race:

    pl330_terminate_all pl330_update
    ------------------- ------------
    lock channel
    entry
    lock pl330
    _stop channel
    unlock pl330
    lock pl330
    check req_running != -1
    req_running = -1
    _start channel

    Signed-off-by: John Keeping
    Signed-off-by: Vinod Koul
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    John Keeping
     
  • [ Upstream commit 5a1a2f63d840dc2631505b607e11ff65ac1b7d3c ]

    The error path currently calls tw686x_video_free() which requires
    vc->dev to be initialized, causing a NULL dereference on uninitizalized
    channels.

    Fix this by setting the vc->dev fields for all the channels first.

    Fixes: f8afaa8dbc0d ("[media] tw686x: Introduce an interface to support multiple DMA modes")

    Signed-off-by: Krzysztof Ha?asa
    Signed-off-by: Hans Verkuil
    Signed-off-by: Mauro Carvalho Chehab
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Krzysztof Ha?asa
     
  • [ Upstream commit 9c2af1c7377a8a6ef86e5cabf80978f3dbbb25c0 ]

    If Make gets a fatal signal while a shell is executing, it may delete
    the target file that the recipe was supposed to update. This is needed
    to make sure that it is remade from scratch when Make is next run; if
    Make is interrupted after the recipe has begun to write the target file,
    it results in an incomplete file whose time stamp is newer than that
    of the prerequisites files. Make automatically deletes the incomplete
    file on interrupt unless the target is marked .PRECIOUS.

    The situation is just the same as when the shell fails for some reasons.
    Usually when a recipe line fails, if it has changed the target file at
    all, the file is corrupted, or at least it is not completely updated.
    Yet the file’s time stamp says that it is now up to date, so the next
    time Make runs, it will not try to update that file.

    However, Make does not cater to delete the incomplete target file in
    this case. We need to add .DELETE_ON_ERROR somewhere in the Makefile
    to request it.

    scripts/Kbuild.include seems a suitable place to add it because it is
    included from almost all sub-makes.

    Please note .DELETE_ON_ERROR is not effective for phony targets.

    The external module building should never ever touch the kernel tree.
    The following recipe fails if include/generated/autoconf.h is missing.
    However, include/config/auto.conf is not deleted since it is a phony
    target.

    PHONY += include/config/auto.conf

    include/config/auto.conf:
    $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
    echo >&2; \
    echo >&2 " ERROR: Kernel configuration is invalid."; \
    echo >&2 " include/generated/autoconf.h or $@ are missing.";\
    echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
    echo >&2 ; \
    /bin/false)

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Masahiro Yamada
     
  • [ Upstream commit f6dab4233d6b64d719109040503b567f71fbfa01 ]

    Fixed factor clock has two initializations at of_clk_init() time
    and during platform driver probe. Before of_clk_init() call,
    node is marked as populated and so its probe never gets called.

    During of_clk_init() fixed factor clock registration may fail if
    any of its parent clock is not registered. In this case, it doesn't
    get chance to retry registration from probe. Clear OF_POPULATED
    flag if fixed factor clock registration fails so that clock
    registration is attempted again from probe.

    Signed-off-by: Rajan Vaja
    Signed-off-by: Stephen Boyd
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Rajan Vaja
     
  • [ Upstream commit 365f7a89c881e84f1ebc925f65f899d5d7ce547e ]

    Patch "clk: core: Copy connection id" made it so that the connector id
    'con_id' is kstrdup_const()ed to cater to drivers that pass non-constant
    connection ids. The patch added the corresponding kfree_const to
    __clk_free_clk(), but struct clk's can be freed also via __clk_put().
    Add the kfree_const call to __clk_put() and add comments to both
    functions to remind that the logic in them should be kept in sync.

    Fixes: 253160a8ad06 ("clk: core: Copy connection id")
    Signed-off-by: Mikko Perttunen
    Reviewed-by: Leonard Crestez
    Signed-off-by: Stephen Boyd
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Mikko Perttunen
     
  • [ Upstream commit 11177e7a7aaef95935592072985526ebf0a3df43 ]

    of_find_compatible_node() is returning a device node with refcount
    incremented and must be explicitly decremented after the last use
    which is right after the us in of_iomap() here.

    Signed-off-by: Nicholas Mc Guire
    Fixes: 787b4271a6a0 ("clk: imx: add imx6ul clk tree support")
    Signed-off-by: Stephen Boyd
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Nicholas Mc Guire
     
  • [ Upstream commit 776125785a87ff05d49938bd5b9f336f2a05bff6 ]

    To speed up the common case of appending to a file,
    gfs2_write_alloc_required presumes that writing beyond the end of a file
    will always require additional blocks to be allocated. This assumption
    is incorrect for preallocates files, but there are no negative
    consequences as long as *some* space is still left on the filesystem.

    One special file that always has some space preallocated beyond the end
    of the file is the rindex: when growing a filesystem, gfs2_grow adds one
    or more new resource groups and appends records describing those
    resource groups to the rindex; the preallocated space ensures that this
    is always possible.

    However, when a filesystem is completely full, gfs2_write_alloc_required
    will indicate that an additional allocation is required, and appending
    the next record to the rindex will fail even though space for that
    record has already been preallocated. To fix that, skip the incorrect
    optimization in gfs2_write_alloc_required, but for the rindex only.
    Other writes to preallocated space beyond the end of the file are still
    allowed to fail on completely full filesystems.

    Signed-off-by: Andreas Gruenbacher
    Reviewed-by: Bob Peterson
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Andreas Gruenbacher
     
  • [ Upstream commit b24dbfe9ce03d9f83306616f22fb0e04e8960abe ]

    The dma_mapping_error() returns true or false, but we want
    to return -ENOMEM if there was an error.

    Fixes: 174fd2597b0b ("amd-xgbe: Implement split header receive support")
    Signed-off-by: YueHaibing
    Signed-off-by: David S. Miller
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     
  • [ Upstream commit 934ffce1343f22ed5e2d0bd6da4440f4848074de ]

    Fix a static code checker warning:

    net/xfrm/xfrm_policy.c:1836 xfrm_resolve_and_create_bundle() warn: passing zero to 'ERR_PTR'

    xfrm_tmpl_resolve return 0 just means no xdst found, return NULL
    instead of passing zero to ERR_PTR.

    Fixes: d809ec895505 ("xfrm: do not assume that template resolving always returns xfrms")
    Signed-off-by: YueHaibing
    Signed-off-by: Steffen Klassert
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    YueHaibing
     
  • [ Upstream commit bd1cd0eb2ce9141100628d476ead4de485501b29 ]

    AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC()
    for expanding idVendor and idProduct fields. However, the latter
    macro adds also match_flags and bInterfaceClass, which are different
    from the values AU0828_DEVICE() macro sets after that.

    For fixing them, just expand idVendor and idProduct fields manually in
    AU0828_DEVICE().

    This fixes sparse warnings like:
    sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice

    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • [ Upstream commit 7c500f9ea139d0c9b80fdea5a9c911db3166ea54 ]

    The default sample sizes set by msnd driver are bogus; it sets ALSA
    PCM format, not the actual bit width.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • [ Upstream commit 29859aeb8a6ea17ba207933a81b6b77b4d4df81a ]

    When run on a 64-bit system in selftest, the v7s driver may obtain page
    table with physical addresses larger than 32-bit. Level-2 tables are 1KB
    and are are allocated with slab, which doesn't accept the GFP_DMA32
    flag. Currently map() truncates the address written in the PTE, causing
    iova_to_phys() or unmap() to access invalid memory. Kasan reports it as
    a use-after-free. To avoid any nasty surprise, test if the physical
    address fits in a PTE before returning a new table. 32-bit systems,
    which are the main users of this page table format, shouldn't see any
    difference.

    Signed-off-by: Jean-Philippe Brucker
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Jean-Philippe Brucker
     
  • [ Upstream commit 0d535967ac658966c6ade8f82b5799092f7d5441 ]

    When PRI queue occurs overflow, driver should update the OVACKFLG to
    the PRIQ consumer register, otherwise subsequent PRI requests will not
    be processed.

    Cc: Will Deacon
    Cc: Robin Murphy
    Signed-off-by: Miao Zhong
    Signed-off-by: Will Deacon
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Miao Zhong
     
  • [ Upstream commit 9a7faac3650216112e034b157289bf1a48a99e2d ]

    Commit ff3f0789b3dc ("usb: dwc3: use BIT() macro where possible")
    changed DWC3_DEPCFG_STREAM_EVENT_EN from bit 13 to bit 12.

    Spotted this cleanup typo while looking at diffs between 4.9.35 and
    4.14.16 for a separate issue.

    Fixes: ff3f0789b3dc ("usb: dwc3: use BIT() macro where possible")
    Signed-off-by: Erich E. Hoover
    Signed-off-by: Felipe Balbi
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Erich E. Hoover
     
  • commit b19b46346f483ae055fa027cb2d5c2ca91484b91 upstream.

    The recent commit 916c5e1413be ("hv/netvsc: fix handling of fallback
    to single queue mode") tried to fix the fallback behavior to a single
    queue mode, but it changed the function to return zero incorrectly,
    while the function should return an object pointer. Eventually this
    leads to a NULL dereference at the callers that expect non-NULL
    value.

    Fix it by returning the proper net_device object.

    Fixes: 916c5e1413be ("hv/netvsc: fix handling of fallback to single queue mode")
    Signed-off-by: Takashi Iwai
    Reviewed-by: Stephen Hemminger
    Signed-off-by: David S. Miller
    Cc: Alakesh Haloi
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • [ Upstream commit 5cf4a8532c992bb22a9ecd5f6d93f873f4eaccc2 ]

    According to the documentation in msg_zerocopy.rst, the SO_ZEROCOPY
    flag was introduced because send(2) ignores unknown message flags and
    any legacy application which was accidentally passing the equivalent of
    MSG_ZEROCOPY earlier should not see any new behaviour.

    Before commit f214f915e7db ("tcp: enable MSG_ZEROCOPY"), a send(2) call
    which passed the equivalent of MSG_ZEROCOPY without setting SO_ZEROCOPY
    would succeed. However, after that commit, it fails with -ENOBUFS. So
    it appears that the SO_ZEROCOPY flag fails to fulfill its intended
    purpose. Fix it.

    Fixes: f214f915e7db ("tcp: enable MSG_ZEROCOPY")
    Signed-off-by: Vincent Whitchurch
    Acked-by: Willem de Bruijn
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Vincent Whitchurch
     
  • [ Upstream commit 5a64506b5c2c3cdb29d817723205330378075448 ]

    If erspan tunnel hasn't been established, we'd better send icmp port
    unreachable message after receive erspan packets.

    Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
    Cc: William Tu
    Signed-off-by: Haishuang Yan
    Acked-by: William Tu
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Haishuang Yan
     
  • [ Upstream commit 51dc63e3911fbb1f0a7a32da2fe56253e2040ea4 ]

    When processing icmp unreachable message for erspan tunnel, tunnel id
    should be erspan_net_id instead of ipgre_net_id.

    Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
    Cc: William Tu
    Signed-off-by: Haishuang Yan
    Acked-by: William Tu
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Haishuang Yan
     
  • [ Upstream commit 52ea992cfac357b73180d5c051dca43bc8d20c2a ]

    tls_sw_sendmsg() allocates plaintext and encrypted SG entries using
    function sk_alloc_sg(). In case the number of SG entries hit
    MAX_SKB_FRAGS, sk_alloc_sg() returns -ENOSPC and sets the variable for
    current SG index to '0'. This leads to calling of function
    tls_push_record() with 'sg_encrypted_num_elem = 0' and later causes
    kernel crash. To fix this, set the number of SG elements to the number
    of elements in plaintext/encrypted SG arrays in case sk_alloc_sg()
    returns -ENOSPC.

    Fixes: 3c4d7559159b ("tls: kernel TLS support")
    Signed-off-by: Vakul Garg
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Vakul Garg
     
  • [ Upstream commit c88a026e01219488e745f4f0267fd76c2bb68421 ]

    The memory allocated for the slow path table flow group input structure
    was not freed upon successful return, fix that.

    Fixes: 1967ce6ea5c8 ("net/mlx5: E-Switch, Refactor fast path FDB table creation in switchdev mode")
    Signed-off-by: Raed Salem
    Reviewed-by: Or Gerlitz
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Greg Kroah-Hartman

    Raed Salem
     
  • [ Upstream commit 5df816e7f43f1297c40021ef17ec6e722b45c82f ]

    When initializing the device (procedure init_one), the driver
    calls mlx5_pci_init to perform pci initialization. As part of this
    initialization, mlx5_pci_init creates a debugfs directory.
    If this creation fails, init_one aborts, returning failure to
    the caller (which is the probe method caller).

    The main reason for such a failure to occur is if the debugfs
    directory already exists. This can happen if the last time
    mlx5_pci_close was called, debugfs_remove (silently) failed due
    to the debugfs directory not being empty.

    Guarantee that such a debugfs_remove failure will not occur by
    instead calling debugfs_remove_recursive in procedure mlx5_pci_close.

    Fixes: 59211bd3b632 ("net/mlx5: Split the load/unload flow into hardware and software flows")
    Signed-off-by: Jack Morgenstein
    Reviewed-by: Daniel Jurgens
    Signed-off-by: Saeed Mahameed
    Signed-off-by: Greg Kroah-Hartman

    Jack Morgenstein