10 Sep, 2015

25 commits

  • /sys/class/watchdog/watchdogn/device/modalias can help to identify the
    driver/module for a given watchdog node. However, many wdt devices do not
    set their parent and so, we do not see an entry for device in sysfs for
    such devices.

    This patch fixes parent of watchdog_device so that
    /sys/class/watchdog/watchdogn/device is populated.

    Exceptions: booke, diag288, octeon, softdog and w83627hf -- They do not
    have any parent. Not sure, how we can identify driver for these devices.

    Signed-off-by: Pratyush Anand
    Reviewed-by: Johannes Thumshirn
    Acked-by: Guenter Roeck
    Acked-by: H Hartley Sweeten
    Acked-by: Lee Jones
    Acked-by: Lubomir Rintel
    Acked-by: Maxime Coquelin
    Acked-by: Thierry Reding
    Acked-by: Viresh Kumar
    Acked-by: Linus Walleij
    Signed-off-by: Wim Van Sebroeck

    Pratyush Anand
     
  • syscon_node_to_regmap() returns a regmap or an ERR_PTR().

    Signed-off-by: Bjorn Andersson
    Acked-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Bjorn Andersson
     
  • Commit dca1a4b5ff6e ("clk: at91: keep slow clk enabled to prevent system
    hang") added a workaround for the slow clock as it is not properly handled
    by its users.

    Get and use the slow clock as it is necessary for the at91sam9 watchdog.

    Signed-off-by: Alexandre Belloni
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Alexandre Belloni
     
  • The compatible "atmel,sama5d4-wdt" supports the SAMA5D4 watchdog driver
    and the watchdog's WDT_MR register can be written more than once.

    Signed-off-by: Wenyou Yang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wenyou Yang
     
  • From SAMA5D4, the watchdog timer is upgrated with a new feature,
    which is describled as in the datasheet, "WDT_MR can be written
    until a LOCKMR command is issued in WDT_CR".
    That is to say, as long as the bootstrap and u-boot don't issue
    a LOCKMR command, WDT_MR can be written more than once in the driver.

    So the SAMA5D4 watchdog driver's implementation is different from
    the at91sam9260 watchdog driver implemented in file at91sam9_wdt.c.
    The user application open the device file to enable the watchdog timer
    hardware, and close to disable it, and set the watchdog timer timeout
    by seting WDV and WDD fields of WDT_MR register, and ping the watchdog
    by issuing WDRSTT command to WDT_CR register with hard-coded key.

    Signed-off-by: Wenyou Yang
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wenyou Yang
     
  • The MPC5125 processor features a watchdog device that is identical to
    the MPC8610 one. So allow to enable the driver for MPC512x kernel
    configurations.

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • checkpatch warns about ENOSYS, telling "ENOSYS means 'invalid syscall
    nr' and nothing else". So use ENODEV instead.

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • Instead of relying on global static memory dynamically allocate the
    needed data. This has the benefit of some saved bytes if the driver is
    not in use and making it possible to bind more than one device (even
    though this has no known use case).

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • This simplifies the error paths and device unbinding.

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • This function is new in v4.2-rc1 and makes a forward declaration of the
    match table superfluous which can so be removed.

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • Since commit ef90174f8210 ("watchdog: watchdog_core: Add watchdog
    registration deferral mechanism") there is no need to delay the call to
    watchdog_register_device any more. So simplify the registration code
    accordingly.

    Resetting wd_base to NULL can the also be dropped because nothing
    depends on it being NULL to signal probe failure any more. (The matching
    wd_base = NULL in .remove was missing, too.)

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • Signed-off-by: Fengguang Wu
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Fengguang Wu
     
  • Add the devicetree binding document for NXP LPC18xx Watchdog Timer.

    Signed-off-by: Ariel D'Alessandro
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Ariel D'Alessandro
     
  • This commit adds support for the watchdog timer found in NXP LPC SoCs
    family, which includes LPC18xx/LPC43xx. Other SoCs in that family may
    share the same watchdog hardware.

    Watchdog driver registers a restart handler that will restart the system
    by performing an incorrect feed after ensuring the watchdog is enabled in
    reset mode.

    As watchdog cannot be disabled in hardware, driver's stop routine will
    regularly send a keepalive ping using a timer.

    Signed-off-by: Ariel D'Alessandro
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Ariel D'Alessandro
     
  • During probe for an always-running watchdog a timer is setup to
    constantly ping the watchdog while the device is not open. The gpio to
    ping the watchdog is setup to inactive.

    For a watchdog with hw_algo = "toggle" this results in a ping depending
    on the initial state of the gpio, for hw_algo = "level" no ping is
    generated.

    Make sure that the first automatic ping is sent immediately and not only
    when the timer expires the first time. This makes the machine survive in
    case more than half of the watchdog timeout is already elapsed. (Which
    is very probable for the chip I'm faced with that has a timeout of one
    second.)

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • strncmp(algo, "toggle", 6) doesn't compare the trailing '\0' byte, so
    using

    hw_algo = "toggleboggle"

    is recognized the same way as

    hw_algo = "toggle"

    . While this doesn't introduce any problems for a device tree that
    sticks to the documented settings it's still ugly.

    Fix this by using strcmp to only match on "toggle" and "level".

    Signed-off-by: Uwe Kleine-König
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Uwe Kleine-König
     
  • The watchdog has an input clock, the slow clock. It is required as it will
    not function without it.

    Signed-off-by: Alexandre Belloni
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Alexandre Belloni
     
  • The watchdog infrastructure checks the maximum timeout for us.
    Use it.

    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Guenter Roeck
     
  • Tested on the Nvidia chipset with an SMBus controller PCI ID 0x0AA2
    (as shown in the PCI listing during the boot sequence).

    Signed-off-by: Vivien Didelot
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Vivien Didelot
     
  • Commit f2147de33470 ("watchdog: sunxi: support parameterized compatible
    strings") introduced a regression in sunxi_wdt_start(), by which
    the system reset function of the watchdog is not enabled upon
    starting the watchdog. As a result, the system is not reset when the
    watchdog expires. Fix it.

    Fixes: f2147de33470 ("watchdog: sunxi: support parameterized compatible strings")
    Signed-off-by: Francesco Lavra
    Acked-by: Maxime Ripard
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck
    Cc: stable@vger.kernel.org

    Francesco Lavra
     
  • Without .shutdown(), watchdog might reset the system during power off.
    For example, if watchdog's timeout is set to 30s, then it is reset to
    zero by mtk_wdt_ping(). During power off, no app will ping watchdog,
    but watchdog is still running and may trigger reset.

    Signed-off-by: Greta Zhang
    Signed-off-by: Eddie Huang
    Acked-by: Matthias Brugger
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Greta Zhang
     
  • add mediatek watchdog driver suspend/resume support

    Signed-off-by: Greta Zhang
    Signed-off-by: Roger Lu
    Signed-off-by: Eddie Huang
    Acked-by: Matthias Brugger
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Greta Zhang
     
  • Commit c631f20068 ("watchdog: imgpdc: Add reboot support") introduced
    a restart handler but forgot to unregister it on driver removal. Fix it.

    Fixes: c631f20068 ("watchdog: imgpdc: Add reboot support")
    Reported-by: Ariel D'Alessandro
    Signed-off-by: Ezequiel Garcia
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Ezequiel Garcia
     
  • The watchdog test program is much more useful if it can configure the
    timeout value and ping rate. This will allow you to test actual timeouts.

    Adds the -t parameter to set the timeout value (in seconds), and -p to set
    the ping rate (number of seconds between pings).

    Signed-off-by: Timur Tabi
    Reviewed-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Timur Tabi
     

24 Aug, 2015

2 commits


23 Aug, 2015

4 commits

  • Pull MIPS bug fixes from Ralf Baechle:
    "Two more fixes for 4.2.

    One fixes a build issue with the LLVM assembler - LLVM assembler macro
    names are case sensitive, GNU as macro names are insensitive; the
    other corrects a license string (GPL v2, not GPLv2) such that the
    module loader will recognice the license correctly"

    * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
    FIRMWARE: bcm47xx_nvram: Fix module license.
    MIPS: Fix LLVM build issue.

    Linus Torvalds
     
  • Pull 9p regression fix from Al Viro:
    "Fix for breakage introduced when switching p9_client_{read,write}() to
    struct iov_iter * (went into 4.1)"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    9p: ensure err is initialized to 0 in p9_client_read/write

    Linus Torvalds
     
  • Some use of those functions were providing unitialized values to those
    functions. Notably, when reading 0 bytes from an empty file on a 9P
    filesystem, the return code of read() was not 0.

    Tested with this simple program:

    #include
    #include
    #include
    #include
    #include

    int main(int argc, const char **argv)
    {
    assert(argc == 2);
    char buffer[256];
    int fd = open(argv[1], O_RDONLY|O_NOCTTY);
    assert(fd >= 0);
    assert(read(fd, buffer, 0) == 0);
    return 0;
    }

    Cc: stable@vger.kernel.org # v4.1
    Signed-off-by: Vincent Bernat
    Signed-off-by: Al Viro

    Vincent Bernat
     
  • Pull ARM fixes from Russell King:
    "Another couple of small ARM fixes.

    A patch from Masahiro Yamada who noticed that "make -jN all zImage"
    would end up generating bad images where N > 1, and a patch from
    Nicolas to fix the Marvell CPU user access optimisation code when page
    faults are disabled"

    * 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
    ARM: 8418/1: add boot image dependencies to not generate invalid images
    ARM: 8414/1: __copy_to_user_memcpy: fix mmap semaphore usage

    Linus Torvalds
     

22 Aug, 2015

9 commits

  • Pull x86 fixes from Ingo Molnar:
    "Various low level fixes: fix more fallout from the FPU rework and the
    asm entry code rework, plus an MSI rework fix, and an idle-tracing fix"

    * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    x86/fpu/math-emu: Fix crash in fork()
    x86/fpu/math-emu: Fix math-emu boot crash
    x86/idle: Restore trace_cpu_idle to mwait_idle() calls
    x86/irq: Build correct vector mapping for multiple MSI interrupts
    Revert "sched/x86_64: Don't save flags on context switch"

    Linus Torvalds
     
  • Pull perf fixes from Ingo Molnar:
    "Tooling fixes: a 'perf record' deadlock fix plus debuggability fixes"

    * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    perf top: Show backtrace when handling a SIGSEGV on --stdio mode
    perf tools: Fix buildid processing
    perf tools: Make fork event processing more resilient
    perf tools: Avoid deadlock when map_groups are broken

    Linus Torvalds
     
  • Pull irq fixes from Thomas Gleixner:
    "A series of small fixlets for a regression visible on OMAP devices
    caused by the conversion of the OMAP interrupt chips to hierarchical
    interrupt domains. Mostly one liners on the driver side plus a small
    helper function in the core to avoid open coded mess in the drivers"

    * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    irqchip/crossbar: Restore set_wake functionality
    irqchip/crossbar: Restore the mask on suspend behaviour
    ARM: OMAP: wakeupgen: Restore the irq_set_type() mechanism
    irqchip/crossbar: Restore the irq_set_type() mechanism
    genirq: Introduce irq_chip_set_type_parent() helper
    genirq: Don't return ENOSYS in irq_chip_retrigger_hierarchy

    Linus Torvalds
     
  • Pull timer fixes from Thomas Gleixner:
    "Two minimalistic fixes for 4.2 regressions:

    - Eric fixed a thinko in the timer_list base switching code caused by
    the overhaul of the timer wheel. It can cause a cpu to see the
    wrong base for a timer while we move the timer around.

    - Guenter fixed a regression for IMX if booted w/o device tree, where
    the timer interrupt is not initialized and therefor the machine
    fails to boot"

    * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    clocksource/imx: Fix boot with non-DT systems
    timer: Write timer->flags atomically

    Linus Torvalds
     
  • During later stages of math-emu bootup the following crash triggers:

    math_emulate: 0060:c100d0a8
    Kernel panic - not syncing: Math emulation needed in kernel
    CPU: 0 PID: 1511 Comm: login Not tainted 4.2.0-rc7+ #1012
    [...]
    Call Trace:
    [] dump_stack+0x41/0x52
    [] panic+0x77/0x189
    [] ? math_error+0x140/0x140
    [] math_emulate+0xba7/0xbd0
    [] ? fpu__copy+0x138/0x1c0
    [] ? __alloc_pages_nodemask+0x12c/0x870
    [] ? proc_clear_tty+0x40/0x70
    [] ? session_clear_tty+0x1e/0x30
    [] ? math_error+0x140/0x140
    [] do_device_not_available+0x45/0x70
    [] ? fpu__copy+0x138/0x1c0
    [] error_code+0x5a/0x60
    [] ? math_error+0x140/0x140
    [] ? fpu__copy+0x138/0x1c0
    [] arch_dup_task_struct+0x25/0x30
    [] copy_process.part.51+0xea/0x1480
    [] ? dput+0x175/0x200
    [] ? no_tty+0x30/0x30
    [] ? do_vfs_ioctl+0x322/0x540
    [] _do_fork+0xca/0x340
    [] ? SyS_rt_sigaction+0x66/0x90
    [] SyS_clone+0x27/0x30
    [] sysenter_do_call+0x12/0x12

    The reason is the incorrect assumption in fpu_copy(), that FNSAVE
    can be executed from math-emu kernels as well.

    Don't try to copy the registers, the soft state will be copied
    by fork anyway, so the child task inherits the parent task's
    soft math state.

    With this fix applied math-emu kernels boot up fine on modern
    hardware and the 'no387 nofxsr' boot options.

    Cc: Andy Lutomirski
    Cc: Bobby Powers
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dave Hansen
    Cc: Denys Vlasenko
    Cc: Fenghua Yu
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Quentin Casasnovas
    Cc: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • On a math-emu bootup the following crash occurs:

    Initializing CPU#0
    ------------[ cut here ]------------
    kernel BUG at arch/x86/kernel/traps.c:779!
    invalid opcode: 0000 [#1] SMP
    [...]
    EIP is at do_device_not_available+0xe/0x70
    [...]
    Call Trace:
    [] error_code+0x5a/0x60
    [] ? math_error+0x140/0x140
    [] ? fpu__init_cpu+0x59/0xa0
    [] cpu_init+0x202/0x330
    [] ? __native_set_fixmap+0x1f/0x30
    [] trap_init+0x305/0x346
    [] start_kernel+0x1a5/0x35d
    [] i386_start_kernel+0x82/0x86

    The reason is that in the following commit:

    b1276c48e91b ("x86/fpu: Initialize fpregs in fpu__init_cpu_generic()")

    I failed to consider math-emu's limitation that it cannot execute the
    FNINIT instruction in kernel mode.

    The long term fix might be to allow math-emu to execute (certain) kernel
    mode FPU instructions, but for now apply the safe (albeit somewhat ugly)
    fix: initialize the emulation state explicitly without trapping out to
    the FPU emulator.

    Cc: Andy Lutomirski
    Cc: Borislav Petkov
    Cc: Brian Gerst
    Cc: Dave Hansen
    Cc: Denys Vlasenko
    Cc: Fenghua Yu
    Cc: H. Peter Anvin
    Cc: Linus Torvalds
    Cc: Oleg Nesterov
    Cc: Peter Zijlstra
    Cc: Quentin Casasnovas
    Cc: Thomas Gleixner
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Ingo Molnar

    Ingo Molnar
     
  • While the idea behind get_maintainer seems highly useful it's
    unfortunately way to trigger happy to grab people that once had a few
    commits to files. For someone like me who does a lot of tree-wide API
    work that leads to an incredible amount of Cc spam.

    Signed-off-by: Christoph Hellwig
    Cc: Joe Perches
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Commit c48a11c7ad26 ("netvm: propagate page->pfmemalloc to skb") added
    checks for page->pfmemalloc to __skb_fill_page_desc():

    if (page->pfmemalloc && !page->mapping)
    skb->pfmemalloc = true;

    It assumes page->mapping == NULL implies that page->pfmemalloc can be
    trusted. However, __delete_from_page_cache() can set set page->mapping
    to NULL and leave page->index value alone. Due to being in union, a
    non-zero page->index will be interpreted as true page->pfmemalloc.

    So the assumption is invalid if the networking code can see such a page.
    And it seems it can. We have encountered this with a NFS over loopback
    setup when such a page is attached to a new skbuf. There is no copying
    going on in this case so the page confuses __skb_fill_page_desc which
    interprets the index as pfmemalloc flag and the network stack drops
    packets that have been allocated using the reserves unless they are to
    be queued on sockets handling the swapping which is the case here and
    that leads to hangs when the nfs client waits for a response from the
    server which has been dropped and thus never arrive.

    The struct page is already heavily packed so rather than finding another
    hole to put it in, let's do a trick instead. We can reuse the index
    again but define it to an impossible value (-1UL). This is the page
    index so it should never see the value that large. Replace all direct
    users of page->pfmemalloc by page_is_pfmemalloc which will hide this
    nastiness from unspoiled eyes.

    The information will get lost if somebody wants to use page->index
    obviously but that was the case before and the original code expected
    that the information should be persisted somewhere else if that is
    really needed (e.g. what SLAB and SLUB do).

    [akpm@linux-foundation.org: fix blooper in slub]
    Fixes: c48a11c7ad26 ("netvm: propagate page->pfmemalloc to skb")
    Signed-off-by: Michal Hocko
    Debugged-by: Vlastimil Babka
    Debugged-by: Jiri Bohac
    Cc: Eric Dumazet
    Cc: David Miller
    Acked-by: Mel Gorman
    Cc: [3.6+]
    Signed-off-by: Andrew Morton

    Signed-off-by: Linus Torvalds

    Michal Hocko
     
  • Pull PCI fixes from Bjorn Helgaas:
    "These are fixes for ASPM-related NULL pointer dereference crashes on
    Sparc and PowerPC and 64-bit PCI address-related HPMC crashes on
    PA-RISC. These are both caused by things we merged in the v4.2 merge
    window. Details:

    Resource management
    - Don't use 64-bit bus addresses on PA-RISC

    Miscellaneous
    - Tolerate hierarchies with no Root Port"

    * tag 'pci-v4.2-fixes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
    PCI: Don't use 64-bit bus addresses on PA-RISC
    PCI: Tolerate hierarchies with no Root Port

    Linus Torvalds