18 Jan, 2015

7 commits

  • Pull clock driver fixes from Mike Turquette:
    "Small number of fixes for clock drivers and a single null pointer
    dereference fix in the framework core code.

    The driver fixes vary from fixing section mismatch warnings to
    preventing machines from hanging (and preventing developers from
    crying)"

    * tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mike.turquette/linux:
    clk: fix possible null pointer dereference
    Revert "clk: ppc-corenet: Fix Section mismatch warning"
    clk: rockchip: fix deadlock possibility in cpuclk
    clk: berlin: bg2q: remove non-exist "smemc" gate clock
    clk: at91: keep slow clk enabled to prevent system hang
    clk: rockchip: fix rk3288 cpuclk core dividers
    clk: rockchip: fix rk3066 pll lock bit location
    clk: rockchip: Fix clock gate for rk3188 hclk_emem_peri
    clk: rockchip: add CLK_IGNORE_UNUSED flag to fix rk3066/rk3188 USB Host

    Linus Torvalds
     
  • Pull SCSI fixes from James Bottomley:
    "This is one fix for a Multiqueue sleeping in invalid context problem
    and a MAINTAINER file update for Qlogic"

    * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
    scsi: ->queue_rq can't sleep
    MAINTAINERS: Update maintainer list for qla4xxx

    Linus Torvalds
     
  • The commit 646cafc6 (clk: Change clk_ops->determine_rate to
    return a clk_hw as the best parent) opens a possibility for
    null pointer dereference, fix this.

    Signed-off-by: Stanimir Varbanov
    Reviewed-by: Stephen Boyd
    Signed-off-by: Michael Turquette

    Stanimir Varbanov
     
  • This reverts commit da788acb28386aa896224e784954bb73c99ff26c.

    That commit tried to fix the section mismatch warning by moving the
    ppc_corenet_clk_driver struct to init section. This is definitely wrong
    because the kernel would free the memories occupied by this struct
    after boot while this driver is still registered in the driver core.
    The kernel would panic when accessing this driver struct.

    Cc: stable@vger.kernel.org # 3.17
    Signed-off-by: Kevin Hao
    Acked-by: Scott Wood
    Signed-off-by: Michael Turquette

    Kevin Hao
     
  • Lockdep reported a possible deadlock between the cpuclk lock and for example
    the i2c driver.

    CPU0 CPU1
    ---- ----
    lock(clk_lock);
    local_irq_disable();
    lock(&(&i2c->lock)->rlock);
    lock(clk_lock);

    lock(&(&i2c->lock)->rlock);

    *** DEADLOCK ***

    The generic clock-types of the core ccf already use spin_lock_irqsave when
    touching clock registers, so do the same for the cpuclk.

    Signed-off-by: Heiko Stuebner
    Reviewed-by: Doug Anderson
    Signed-off-by: Michael Turquette
    [mturquette@linaro.org: removed initialization of "flags"]

    Heiko Stübner
     
  • Pull dmaengine fixes from Vinod Koul:
    "Two patches, the first by Andy to fix dw dmac runtime pm and second
    one by me to fix the dmaengine headers in MAINTAINERS"

    * 'fixes' of git://git.infradead.org/users/vkoul/slave-dma:
    dmaengine: dw: balance PM runtime calls
    MAINTAINERS: dmaengine: fix the header file for dmaengine

    Linus Torvalds
     
  • Pull perf fixes from Ingo Molnar:
    "Mostly tooling fixes, but also two PMU driver fixes"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf tools powerpc: Use dwfl_report_elf() instead of offline.
    perf tools: Fix segfault for symbol annotation on TUI
    perf test: Fix dwarf unwind using libunwind.
    perf tools: Avoid build splat for syscall numbers with uclibc
    perf tools: Elide strlcpy warning with uclibc
    perf tools: Fix statfs.f_type data type mismatch build error with uclibc
    tools: Remove bitops/hweight usage of bits in tools/perf
    perf machine: Fix __machine__findnew_thread() error path
    perf tools: Fix building error in x86_64 when dwarf unwind is on
    perf probe: Propagate error code when write(2) failed
    perf/x86/intel: Fix bug for "cycles:p" and "cycles:pp" on SLM
    perf/rapl: Fix sysfs_show() initialization for RAPL PMU

    Linus Torvalds
     

17 Jan, 2015

20 commits

  • …it/acme/linux into perf/urgent

    Pull perf/urgent fixes from Arnaldo Carvalho de Melo:

    - Fix segfault when using both the map symtab viewer and annotation
    in the TUI (Namhyung Kim).

    - uClibc build fixes (Alexey Brodkin, Vineet Gupta).

    - bitops/hweight were moved from tools/perf/ too tools/include, move
    some leftovers (Arnaldo Carvalho de Melo)

    - Fix dwarf unwind x86_64 build error (Namhyung Kim)

    - Fix __machine__findnew_thread() error path (Namhyung Kim)

    - Propagate error code when write(2) failed in 'perf probe' (Namhyung Kim)

    - Use dwfl_report_elf() instead of offline in powerpc bits to
    properly handle non prelinked DSOs (Sukadev Bhattiprolu).

    - Fix dwarf unwind using libunwind in 'perf test' (Wang Nan)

    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>

    Ingo Molnar
     
  • Avoid overflow possibility.

    [ The overflow is purely theoretical, since this is used for memory
    ranges that aren't even close to using the full 64 bits, but this is
    the right thing to do regardless. - Linus ]

    Signed-off-by: Louis Langholtz
    Cc: Yinghai Lu
    Cc: Peter Anvin
    Cc: Andrew Morton
    Signed-off-by: Linus Torvalds

    Louis Langholtz
     
  • dwfl_report_offline() works only when libraries are prelinked.

    Replace dwfl_report_offline() with dwfl_report_elf() so we correctly
    extract debug info even from libraries that are not prelinked.

    Reported-by: Jiri Olsa
    Signed-off-by: Sukadev Bhattiprolu
    Tested-by: Jiri Olsa
    Cc: Jiri Olsa
    Cc: Michael Ellerman
    Link: http://lkml.kernel.org/r/20150114221045.GA17703@us.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Sukadev Bhattiprolu
     
  • Currently the symbol structure is allocated with symbol_conf.priv_size
    to carry sideband information like annotation, map browser on TUI and
    sort-by-name tree node. So retrieving these information from symbol
    needs to care about the details of such placement.

    However the annotation code just assumes that the symbol is placed after
    the struct annotation. But actually there's other info between them.
    So accessing those struct will lead to an undefined behavior (usually a
    crash) after they write their info to the same location.

    To reproduce the problem, please follow the steps below:

    1. run perf report (TUI of course) with -v option
    2. open map browser (by pressing right arrow key for any entry)
    3. search any function (by pressing '/' key and input whatever..)
    4. return to the hist browser (by pressing 'q' or left arrow key)
    5. open annotation window for the same entry (by pressing 'a' key)

    Signed-off-by: Namhyung Kim
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1421234288-22758-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Perf tool fails to unwind user stack if the event raises in a shared
    object. This patch improves tests/dwarf-unwind.c to demonstrate the
    problem by utilizing commonly used glibc function "bsearch". If perf is
    not statically linked, the testcase will try to unwind a mixed call
    trace.

    By debugging libunwind I found that there is a bug in unwind-libunwind:
    it always passes 0 as segbase to libunwind, cause libunwind unable to
    locate debug_frame entry fir first level ip address (I add some more
    debugging output into libunwind to make things clear):

    >_Uarm_dwarf_find_debug_frame: start_ip = 10be98, end_ip = 10c2a4
    >_Uarm_dwarf_find_debug_frame: found debug_frame table `/lib/libc-2.18.so': segbase=0x0, len=7, gp=0x0, table_data=0x449388
    >_Uarm_dwarf_search_unwind_table: call lookup:ip = b6cd3bcc, segbase = 0, rel_ip = b6cd3bcc
    >lookup: e->start_ip_offset = bcf18 (rel_ip = b6cd3bcc)
    >lookup: e->start_ip_offset = 6d314 (rel_ip = b6cd3bcc)
    >lookup: e->start_ip_offset = 33d0c (rel_ip = b6cd3bcc)
    ...
    >lookup: e->start_ip_offset = 15d0c (rel_ip = b6cd3bcc)
    >lookup: e->start_ip_offset = 15c40 (rel_ip = b6cd3bcc)
    >_Uarm_dwarf_search_unwind_table: IP b6cd3bcc inside range b6c12000-b6d4c000, but no explicit unwind info found
    >put_rs_cache: unmasking signals/interrupts and releasing lock
    >_Uarm_dwarf_step: returning -10
    >_Uarm_step: dwarf_step()=-10

    This patch passes map->start as segbase to dwarf_find_debug_frame(), so
    di will be initialized correctly.

    In addition, dso and executable are different when setting segbase. This
    patch first check whether the elf is executable, and pass segbase only
    for shared object.

    Signed-off-by: Wang Nan
    Acked-by: Jiri Olsa
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Li Zefan
    Cc: Masami Hiramatsu
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1421203007-75799-1-git-send-email-wangnan0@huawei.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Wang Nan
     
  • This is due to duplicated unistd inclusion (via uClibc headers + kernel headers)
    Also seen on ARM uClibc based tools

    ------- ARC build ---------->8-------------

    CC util/evlist.o
    In file included from
    ~/arc/k.org/arch/arc/include/uapi/asm/unistd.h:25:0,
    from util/../perf-sys.h:10,
    from util/../perf.h:15,
    from util/event.h:7,
    from util/event.c:3:
    ~/arc/k.org/include/uapi/asm-generic/unistd.h:906:0:
    warning: "__NR_fcntl64" redefined [enabled by default]
    #define __NR_fcntl64 __NR3264_fcntl
    ^
    In file included from
    ~/arc/gnu/INSTALL_1412-arc-2014.12-rc1/arc-snps-linux-uclibc/sysroot/usr/include/sys/syscall.h:24:0,
    from util/../perf-sys.h:6,
    ----------------->8-------------------

    ------- ARM build ---------->8-------------

    CC FPIC plugin_scsi.o
    In file included from util/../perf-sys.h:9:0,
    from util/../perf.h:15,
    from util/cache.h:7,
    from perf.c:12:
    ~/arc/k.org/arch/arm/include/uapi/asm/unistd.h:28:0:
    warning: "__NR_restart_syscall" redefined [enabled by default]
    In file included from
    ~/buildroot/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/syscall.h:25:0,
    from util/../perf-sys.h:6,
    from util/../perf.h:15,
    from util/cache.h:7,
    from perf.c:12:
    ~/buildroot/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/bits/sysnum.h:17:0:
    note: this is the location of the previous definition
    ----------------->8-------------------

    Signed-off-by: Vineet Gupta
    Cc: Alexey Brodkin
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1421156604-30603-4-git-send-email-vgupta@synopsys.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Vineet Gupta
     
  • ----------------->8------------------
    CC bench/sched-pipe.o
    In file included from builtin-annotate.c:13:0:
    util/cache.h:76:15: warning: redundant redeclaration of 'strlcpy'
    [-Wredundant-decls]
    extern size_t strlcpy(char *dest, const char *src, size_t size);
    ^
    In file included from util/util.h:55:0,
    from builtin.h:4,
    from builtin-annotate.c:8:
    ~/vineetg/arc/gnu/INSTALL_1412-arc-2014.12-rc1/arc-snps-linux-uclibc/sysroot/usr/include/string.h:396:15:
    note: previous declaration of 'strlcpy' was here
    extern size_t strlcpy(char *__restrict dst, const char *__restrict src,
    ----------------->8------------------

    Signed-off-by: Vineet Gupta
    Cc: Alexey Brodkin
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1421156604-30603-3-git-send-email-vgupta@synopsys.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Vineet Gupta
     
  • ARC Linux uses the no legacy syscalls abi and corresponding uClibc headers
    statfs defines f_type to be U32 which causes perf build breakage

    http://git.uclibc.org/uClibc/tree/libc/sysdeps/linux/common-generic/bits/statfs.h

    ----------->8---------------
    CC fs/fs.o
    fs/fs.c: In function 'fs__valid_mount':
    fs/fs.c:82:24: error: comparison between signed and unsigned integer
    expressions [-Werror=sign-compare]
    else if (st_fs.f_type != magic)
    ^
    cc1: all warnings being treated as errors
    ----------->8---------------

    Signed-off-by: Alexey Brodkin
    Acked-by: Jiri Olsa
    Cc: Borislav Petkov
    Cc: Cody P Schafer
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Namhyung Kim
    Cc: Peter Zijlstra
    Cc: Vineet Gupta
    Link: http://lkml.kernel.org/r/1420888254-17504-2-git-send-email-vgupta@synopsys.com
    Signed-off-by: Arnaldo Carvalho de Melo

    Alexey Brodkin
     
  • We need to use lib/hweight.c for that, just like we do for lib/rbtree.c,
    so tools need to link hweight.o. For now do it directly, but we need to
    have a tools/lib/lk.a or .so that collects these goodies...

    Reported-by: Jan Beulich
    Cc: Adrian Hunter
    Cc: Borislav Petkov
    Cc: David Ahern
    Cc: Don Zickus
    Cc: Frederic Weisbecker
    Cc: Jiri Olsa
    Cc: Mike Galbraith
    Cc: Namhyung Kim
    Cc: Paul Mackerras
    Cc: Peter Zijlstra
    Cc: Stephane Eranian
    Link: http://lkml.kernel.org/n/tip-a1e91dx3apzqw5kbdt7ut21s@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Arnaldo Carvalho de Melo
     
  • When thread__init_map_groups() fails, a new thread should be removed
    from the rbtree since it's gonna be freed. Also update last match cache
    only if the function succeeded.

    Reported-by: David Ahern
    Signed-off-by: Namhyung Kim
    Acked-by: Jiri Olsa
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1420763892-15535-1-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • When build with 'make ARCH=x86' and dwarf unwind is on, there is a
    compiling error:

    CC /home/wn/perf/arch/x86/util/unwind-libdw.o
    CC /home/wn/perf/arch/x86/tests/regs_load.o
    arch/x86/tests/regs_load.S: Assembler messages:
    arch/x86/tests/regs_load.S:65: Error: operand type mismatch for `push'
    arch/x86/tests/regs_load.S:72: Error: operand type mismatch for `pop'
    make[1]: *** [/home/wn/perf/arch/x86/tests/regs_load.o] Error 1
    make[1]: INTERNAL: Exiting with 25 jobserver tokens available; should be 24!
    make: *** [all] Error 2
    ...

    Which is caused by incorrectly undefine macro HAVE_ARCH_X86_64_SUPPORT.
    'config/Makefile.arch' tests __x86_64__ only when 'ARCH=x86_64'.
    However, when building x86_64 kernel, ARCH=x86 is valid and commonly
    used. Build systems, such as yocto, uses x86_64 compiler with 'ARCH=x86'
    to build x86_64 perf, which causes mismatching.

    As __LP64__ is defined for x86_64 as well, we can consolidate the
    __x86_64__ check to the __LP64__ check and get rid of the IS_X86_64
    IMHO.

    (This patch is made by Namhyung Kim when replying my v1 patch:

    https://lkml.org/lkml/2015/1/7/17

    I modified the code to remove dependency on RAW_ARCH:

    https://lkml.org/lkml/2015/1/7/865

    Namhyung Kim didn't provide his SOB in his original email. I add
    mine only for my modification.)

    Signed-off-by: Namhyung Kim
    Signed-off-by: Wang Nan
    Acked-by: Jiri Olsa
    Cc: Jiri Olsa
    Cc: Li Zefan
    Cc: Ingo Molnar
    Cc: Namhyung Kim
    Link: http://lkml.kernel.org/r/1421029255-23039-1-git-send-email-wangnan0@huawei.com
    [ Namhyung provided his S-o-B on a followup to this patch thread on lkml ]
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • When it failed to write probe commands to the probe_event file in
    debugfs, it needs to propagate the error code properly. Current code
    blindly uses the return value of the write(2) so it always uses
    -1 (-EPERM) and it might confuse users.

    Signed-off-by: Namhyung Kim
    Acked-by: Masami Hiramatsu
    Cc: David Ahern
    Cc: Ingo Molnar
    Cc: Jiri Olsa
    Cc: Masami Hiramatsu
    Cc: Peter Zijlstra
    Link: http://lkml.kernel.org/r/1420886028-15135-4-git-send-email-namhyung@kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo

    Namhyung Kim
     
  • Pull char/misc driver fixes from Greg KH:
    "Here are three small driver fixes for reported issues for 3.19-rc5.

    All of these have been in linux-next for a while with no reported
    problems"

    * tag 'char-misc-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
    mcb: mcb-pci: Only remap the 1st 0x200 bytes of BAR 0
    mei: add ABI documentation for fw_status exported through sysfs
    mei: clean reset bit before reset

    Linus Torvalds
     
  • Pull driver core fix from Greg KH:
    "Here is one kernfs fix for a reported issue for 3.19-rc5.

    It has been in linux-next for a while"

    * tag 'driver-core-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    kernfs: Fix kernfs_name_compare

    Linus Torvalds
     
  • Pull tty/serial driver fixes from Greg KH:
    "Here are some tty and serial driver fixes for 3.19-rc5 that resolve
    some reported issues, and add a new device id to the 8250 serial port
    driver.

    All have been in linux-next with no reported problems"

    * tag 'tty-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
    serial: samsung: Add the support for Exynos5433 SoC
    Revert "tty: Fix pty master poll() after slave closes v2"
    tty: Prevent hw state corruption in exclusive mode reopen
    tty: Add support for the WCH384 4S multi-IO card
    serial: fix parisc boot hang

    Linus Torvalds
     
  • Pull staging driver fixes from Greg KH:
    "Here are 6 staging driver fixes for 3.19-rc5.

    They fix some reported issues with some IIO drivers, as well as some
    issues with the vt6655 wireless driver.

    All have been in linux-next for a while"

    * tag 'staging-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
    staging: vt6655: fix sparse warning: argument type
    staging: vt6655: Fix loss of distant/weak access points on channel change.
    staging: vt6655: vnt_tx_packet Fix corrupted tx packets.
    staging: vt6655: fix sparse warnings: incorrect argument type
    iio: iio: Fix iio_channel_read return if channel havn't info
    iio: ad799x: Fix ad7991/ad7995/ad7999 config setup

    Linus Torvalds
     
  • Pull USB fixes from Greg KH:
    "Here is a bunch of USB fixes for 3.19-rc5.

    Most of these are gadget driver fixes, along with the xhci driver fix
    that we both reported having problems with, as well as some new device
    ids and other tiny fixes.

    All have been in linux-next with no problems"

    * tag 'usb-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (43 commits)
    usb: dwc3: gadget: Stop TRB preparation after limit is reached
    usb: dwc3: gadget: Fix TRB preparation during SG
    usb: phy: mv-usb: fix usb_phy build errors
    usb: serial: handle -ENODEV quietly in generic_submit_read_urb
    usb: serial: silence all non-critical read errors
    USB: console: fix potential use after free
    USB: console: fix uninitialised ldisc semaphore
    usb: gadget: udc: atmel: fix possible oops when unloading module
    usb: gadget: gadgetfs: fix an oops in ep_write()
    usb: phy: Fix deferred probing
    OHCI: add a quirk for ULi M5237 blocking on reset
    uas: Add US_FL_NO_ATA_1X for 2 more Seagate disk enclosures
    uas: Do not blacklist ASM1153 disk enclosures
    usb: gadget: udc: avoid dereference before NULL check in ep_queue
    usb: host: ehci-tegra: request deferred probe when failing to get phy
    uas: disable UAS on Apricorn SATA dongles
    uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS566 with usb-id 0bc2:a013
    uas: Add US_FL_NO_ATA_1X for Seagate devices with usb-id 0bc2:a013
    xhci: Add broken-streams quirk for Fresco Logic FL1000G xhci controllers
    USB: EHCI: adjust error return code
    ...

    Linus Torvalds
     
  • Pull arm64 fixes from Will Deacon:
    - Wire up compat_sys_execveat for compat (AArch32) tasks
    - Revert 421520ba9829, as this breaks our side of the boot protocol

    * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
    arm64: partially revert "ARM: 8167/1: extend the reserved memory for initrd to be page aligned"
    arm64: compat: wire up compat_sys_execveat

    Linus Torvalds
     
  • Pull NFS client bugfixes from Trond Myklebust:
    "Highlights include:

    - Stable fix for a NFSv3/lockd race
    - Fixes for several NFSv4.1 client id trunking bugs
    - Remove an incorrect test when checking for delegated opens"

    * tag 'nfs-for-3.19-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
    NFSv4: Remove incorrect check in can_open_delegated()
    NFS: Ignore transport protocol when detecting server trunking
    NFSv4/v4.1: Verify the client owner id during trunking detection
    NFSv4: Cache the NFSv4/v4.1 client owner_id in the struct nfs_client
    NFSv4.1: Fix client id trunking on Linux
    LOCKD: Fix a race when initialising nlmsvc_timeout

    Linus Torvalds
     
  • …it/rostedt/linux-trace

    Pull ftrace fixes from Steven Rostedt:
    "This holds a few fixes to the ftrace infrastructure as well as the
    mixture of function graph tracing and kprobes.

    When jprobes and function graph tracing is enabled at the same time it
    will crash the system:

    # modprobe jprobe_example
    # echo function_graph > /sys/kernel/debug/tracing/current_tracer

    After the first fork (jprobe_example probes it), the system will
    crash.

    This is due to the way jprobes copies the stack frame and does not do
    a normal function return. This messes up with the function graph
    tracing accounting which hijacks the return address from the stack and
    replaces it with a hook function. It saves the return addresses in a
    separate stack to put back the correct return address when done. But
    because the jprobe functions do not do a normal return, their stack
    addresses are not put back until the function they probe is called,
    which means that the probed function will get the return address of
    the jprobe handler instead of its own.

    The simple fix here was to disable function graph tracing while the
    jprobe handler is being called.

    While debugging this I found two minor bugs with the function graph
    tracing.

    The first was about the function graph tracer sharing its function
    hash with the function tracer (they both get filtered by the same
    input). The changing of the set_ftrace_filter would not sync the
    function recording records after a change if the function tracer was
    disabled but the function graph tracer was enabled. This was due to
    the update only checking one of the ops instead of the shared ops to
    see if they were enabled and should perform the sync. This caused the
    ftrace accounting to break and a ftrace_bug() would be triggered,
    disabling ftrace until a reboot.

    The second was that the check to update records only checked one of
    the filter hashes. It needs to test both the "filter" and "notrace"
    hashes. The "filter" hash determines what functions to trace where as
    the "notrace" hash determines what functions not to trace (trace all
    but these). Both hashes need to be passed to the update code to find
    out what change is being done during the update. This also broke the
    ftrace record accounting and triggered a ftrace_bug().

    This patch set also include two more fixes that were reported
    separately from the kprobe issue.

    One was that init_ftrace_syscalls() was called twice at boot up. This
    is not a major bug, but that call performed a rather large kmalloc
    (NR_syscalls * sizeof(*syscalls_metadata)). The second call made the
    first one a memory leak, and wastes memory.

    The other fix is a regression caused by an update in the v3.19 merge
    window. The moving to enable events early, moved the enabling before
    PID 1 was created. The syscall events require setting the
    TIF_SYSCALL_TRACEPOINT for all tasks. But for_each_process_thread()
    does not include the swapper task (PID 0), and ended up being a nop.

    A suggested fix was to add the init_task() to have its flag set, but I
    didn't really want to mess with PID 0 for this minor bug. Instead I
    disable and re-enable events again at early_initcall() where it use to
    be enabled. This also handles any other event that might have its own
    reg function that could break at early boot up"

    * tag 'trace-fixes-v3.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    tracing: Fix enabling of syscall events on the command line
    tracing: Remove extra call to init_ftrace_syscalls()
    ftrace/jprobes/x86: Fix conflict between jprobes and function graph tracing
    ftrace: Check both notrace and filter for old hash
    ftrace: Fix updating of filters for shared global_ops filters

    Linus Torvalds
     

16 Jan, 2015

8 commits

  • This patch partially reverts commit 421520ba98290a73b35b7644e877a48f18e06004
    (only the arm64 part). There is no guarantee that the boot-loader places other
    images like dtb in a different page than initrd start/end, especially when the
    kernel is built with 64KB pages. When this happens, such pages must not be
    freed. The free_reserved_area() already takes care of rounding up "start" and
    rounding down "end" to avoid freeing partially used pages.

    Cc: # 3.17+
    Reported-by: Peter Maydell
    Signed-off-by: Catalin Marinas
    Signed-off-by: Will Deacon

    Catalin Marinas
     
  • cycles:p and cycles:pp do not work on SLM since commit:

    86a04461a99f ("perf/x86: Revamp PEBS event selection")

    UOPS_RETIRED.ALL is not a PEBS capable event, so it should not be used
    to count cycle number.

    Actually SLM calls intel_pebs_aliases_core2() which uses INST_RETIRED.ANY_P
    to count the number of cycles. It's a PEBS capable event. But inv and
    cmask must be set to count cycles.

    Considering SLM allows all events as PEBS with no flags, only
    INST_RETIRED.ANY_P, inv=1, cmask=16 needs to handled specially.

    Signed-off-by: Kan Liang
    Signed-off-by: Peter Zijlstra (Intel)
    Link: http://lkml.kernel.org/r/1421084541-31639-1-git-send-email-kan.liang@intel.com
    Cc: Arnaldo Carvalho de Melo
    Cc: Linus Torvalds
    Signed-off-by: Ingo Molnar

    Kan Liang
     
  • This patch fixes a problem with the initialization of the
    sysfs_show() routine for the RAPL PMU.

    The current code was wrongly relying on the EVENT_ATTR_STR()
    macro which uses the events_sysfs_show() function in the x86
    PMU code. That function itself was relying on the x86_pmu data
    structure. Yet RAPL and the core PMU (x86_pmu) have nothing to
    do with each other. They should therefore not interact with
    each other.

    The x86_pmu structure is initialized at boot time based on
    the host CPU model. When the host CPU is not supported, the
    x86_pmu remains uninitialized and some of the callbacks it
    contains are NULL.

    The false dependency with x86_pmu could potentially cause crashes
    in case the x86_pmu is not initialized while the RAPL PMU is. This
    may, for instance, be the case in virtualized environments.

    This patch fixes the problem by using a private sysfs_show()
    routine for exporting the RAPL PMU events.

    Signed-off-by: Stephane Eranian
    Signed-off-by: Peter Zijlstra (Intel)
    Link: http://lkml.kernel.org/r/20150113225953.GA21525@thinkpad
    Cc: vincent.weaver@maine.edu
    Cc: jolsa@redhat.com
    Cc: Arnaldo Carvalho de Melo
    Cc: Linus Torvalds
    Signed-off-by: Ingo Molnar

    Stephane Eranian
     
  • Pull fuse fixes from Miklos Szeredi:
    "This fixes a regression in the latest fuse update plus a fix for a
    rather theoretical memory ordering issue"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse:
    fuse: add memory barrier to INIT
    fuse: fix LOOKUP vs INIT compat handling

    Linus Torvalds
     
  • Pull fbdev fixes from Tomi Valkeinen:
    - broadsheetfb: fix memory leak
    - simplefb: fix build failure on sparc

    * tag 'fbdev-fixes-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tomba/linux:
    fbdev/broadsheetfb: fix memory leak
    simplefb: Fix build failure on Sparc

    Linus Torvalds
     
  • Pull MMC bugfix from Ulf Hansson:
    "Fix sdhci regulator regression for Qualcomm and Nvidia boards"

    * tag 'mmc-v3.19-4' of git://git.linaro.org/people/ulf.hansson/mmc:
    mmc: sdhci: Set SDHCI_POWER_ON with external vmmc

    Linus Torvalds
     
  • Pull m68k fixlet from Geert Uytterhoeven.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k:
    m68k: Wire up execveat

    Linus Torvalds
     
  • Pull powerpc fixes from Michael Ellerman:
    "A few powerpc fixes"

    * tag 'powerpc-3.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux:
    powerpc: Work around gcc bug in current_thread_info()
    cxl: Fix issues when unmapping contexts
    powernv: Fix OPAL tracepoint code

    Linus Torvalds
     

15 Jan, 2015

5 commits

  • Commit 5f893b2639b2 "tracing: Move enabling tracepoints to just after
    rcu_init()" broke the enabling of system call events from the command
    line. The reason was that the enabling of command line trace events
    was moved before PID 1 started, and the syscall tracepoints require
    that all tasks have the TIF_SYSCALL_TRACEPOINT flag set. But the
    swapper task (pid 0) is not part of that. Since the swapper task is the
    only task that is running at this early in boot, no task gets the
    flag set, and the tracepoint never gets reached.

    Instead of setting the swapper task flag (there should be no reason to
    do that), re-enabled trace events again after the init thread (PID 1)
    has been started. It requires disabling all command line events and
    re-enabling them, as just enabling them again will not reset the logic
    to set the TIF_SYSCALL_TRACEPOINT flag, as the syscall tracepoint will
    be fooled into thinking that it was already set, and wont try setting
    it again. For this reason, we must first disable it and re-enable it.

    Link: http://lkml.kernel.org/r/1421188517-18312-1-git-send-email-mpe@ellerman.id.au
    Link: http://lkml.kernel.org/r/20150115040506.216066449@goodmis.org

    Reported-by: Michael Ellerman
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     
  • trace_init() calls init_ftrace_syscalls() and then calls trace_event_init()
    which also calls init_ftrace_syscalls(). It makes more sense to only
    call it from trace_event_init().

    Calling it twice wastes memory, as it allocates the syscall events twice,
    and loses the first copy of it.

    Link: http://lkml.kernel.org/r/54AF53BD.5070303@huawei.com
    Link: http://lkml.kernel.org/r/20150115040505.930398632@goodmis.org

    Reported-by: Wang Nan
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     
  • If the function graph tracer traces a jprobe callback, the system will
    crash. This can easily be demonstrated by compiling the jprobe
    sample module that is in the kernel tree, loading it and running the
    function graph tracer.

    # modprobe jprobe_example.ko
    # echo function_graph > /sys/kernel/debug/tracing/current_tracer
    # ls

    The first two commands end up in a nice crash after the first fork.
    (do_fork has a jprobe attached to it, so "ls" just triggers that fork)

    The problem is caused by the jprobe_return() that all jprobe callbacks
    must end with. The way jprobes works is that the function a jprobe
    is attached to has a breakpoint placed at the start of it (or it uses
    ftrace if fentry is supported). The breakpoint handler (or ftrace callback)
    will copy the stack frame and change the ip address to return to the
    jprobe handler instead of the function. The jprobe handler must end
    with jprobe_return() which swaps the stack and does an int3 (breakpoint).
    This breakpoint handler will then put back the saved stack frame,
    simulate the instruction at the beginning of the function it added
    a breakpoint to, and then continue on.

    For function tracing to work, it hijakes the return address from the
    stack frame, and replaces it with a hook function that will trace
    the end of the call. This hook function will restore the return
    address of the function call.

    If the function tracer traces the jprobe handler, the hook function
    for that handler will not be called, and its saved return address
    will be used for the next function. This will result in a kernel crash.

    To solve this, pause function tracing before the jprobe handler is called
    and unpause it before it returns back to the function it probed.

    Some other updates:

    Used a variable "saved_sp" to hold kcb->jprobe_saved_sp. This makes the
    code look a bit cleaner and easier to understand (various tries to fix
    this bug required this change).

    Note, if fentry is being used, jprobes will change the ip address before
    the function graph tracer runs and it will not be able to trace the
    function that the jprobe is probing.

    Link: http://lkml.kernel.org/r/20150114154329.552437962@goodmis.org

    Cc: stable@vger.kernel.org # 2.6.30+
    Acked-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     
  • Using just the filter for checking for trampolines or regs is not enough
    when updating the code against the records that represent all functions.
    Both the filter hash and the notrace hash need to be checked.

    To trigger this bug (using trace-cmd and perf):

    # perf probe -a do_fork
    # trace-cmd start -B foo -e probe
    # trace-cmd record -p function_graph -n do_fork sleep 1

    The trace-cmd record at the end clears the filter before it disables
    function_graph tracing and then that causes the accounting of the
    ftrace function records to become incorrect and causes ftrace to bug.

    Link: http://lkml.kernel.org/r/20150114154329.358378039@goodmis.org

    Cc: stable@vger.kernel.org
    [ still need to switch old_hash_ops to old_ops_hash ]
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     
  • As the set_ftrace_filter affects both the function tracer as well as the
    function graph tracer, the ops that represent each have a shared
    ftrace_ops_hash structure. This allows both to be updated when the filter
    files are updated.

    But if function graph is enabled and the global_ops (function tracing) ops
    is not, then it is possible that the filter could be changed without the
    update happening for the function graph ops. This will cause the changes
    to not take place and may even cause a ftrace_bug to occur as it could mess
    with the trampoline accounting.

    The solution is to check if the ops uses the shared global_ops filter and
    if the ops itself is not enabled, to check if there's another ops that is
    enabled and also shares the global_ops filter. In that case, the
    modification still needs to be executed.

    Link: http://lkml.kernel.org/r/20150114154329.055980438@goodmis.org

    Cc: stable@vger.kernel.org # 3.17+
    Reviewed-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)