02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

25 Feb, 2017

1 commit

  • Many watchdog drivers explicitly stop the watchdog when unregistering it.
    While it is unclear if this is actually needed (the whatdog should not be
    running at that time if it can be stopped), introduce a helper to
    explicitly stop the watchdog in the watchdog core when unregistering it.
    This helps reducing driver code size while retaining functionality.

    Signed-off-by: Guenter Roeck

    Guenter Roeck
     

08 Oct, 2016

1 commit

  • The change adds a simple watchdog pretimeout framework infrastructure,
    its purpose is to allow users to select a desired handling of watchdog
    pretimeout events, which may be generated by some watchdog devices.

    A user selects a default watchdog pretimeout governor during
    compilation stage.

    Watchdogs with WDIOF_PRETIMEOUT capability now have one more device
    attribute in sysfs, pretimeout_governor attribute is intended to display
    the selected watchdog pretimeout governor.

    The framework has no impact at runtime on watchdog devices with no
    WDIOF_PRETIMEOUT capability set.

    Signed-off-by: Vladimir Zapolskiy
    Reviewed-by: Guenter Roeck
    Reviewed-by: Wolfram Sang
    Tested-by: Wolfram Sang
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Vladimir Zapolskiy
     

24 Sep, 2016

1 commit

  • Since the watchdog framework centrializes the IOCTL interfaces of device
    drivers now, SETPRETIMEOUT and GETPRETIMEOUT need to be added in the
    common code.

    Signed-off-by: Robin Gong
    Signed-off-by: Wolfram Sang
    [vzapolskiy: added conditional pretimeout sysfs attribute visibility]
    Signed-off-by: Vladimir Zapolskiy
    Reviewed-by: Guenter Roeck
    Signed-off-by: Guenter Roeck
    Signed-off-by: Wim Van Sebroeck

    Wolfram Sang
     

18 Jul, 2016

2 commits


17 Mar, 2016

3 commits

  • Some watchdogs require a minimum time between heartbeats.
    Examples are the watchdogs in DA9062 and AT91SAM9x.

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

    Guenter Roeck
     
  • The WDOG_HW_RUNNING flag is expected to be set by watchdog drivers if
    the hardware watchdog is running. If the flag is set, the watchdog
    subsystem will ping the watchdog even if the watchdog device is closed.

    The watchdog driver stop function is now optional and may be omitted
    if the watchdog can not be stopped. If stopping the watchdog is not
    possible but the driver implements a stop function, it is responsible
    to set the WDOG_HW_RUNNING flag in its stop function.

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

    Guenter Roeck
     
  • Introduce an optional hardware maximum heartbeat in the watchdog core.
    The hardware maximum heartbeat can be lower than the maximum timeout.

    Drivers can set the maximum hardware heartbeat value in the watchdog data
    structure. If the configured timeout exceeds the maximum hardware heartbeat,
    the watchdog core enables a timer function to assist sending keepalive
    requests to the watchdog driver.

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

    Guenter Roeck
     

01 Mar, 2016

1 commit


12 Jan, 2016

3 commits

  • The lifetime of the watchdog device pointer is different from the lifetime
    of its character device. Remove it entirely to avoid race conditions.

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

    Guenter Roeck
     
  • The Zodiac watchdog driver attaches additional sysfs attributes to the
    watchdog device. This has a number of problems: The watchdog device
    lifetime differs from the driver lifetime, and the device structure
    should therefore not be accessed from drivers. Also, creating sysfs
    attributes after driver registration results in a potential race condition
    if user space expects the attributes to exist but they don't exist yet.

    Add support for creating driver specific sysfs attributes to the watchdog
    core to solve the problems.

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

    Guenter Roeck
     
  • ref/unref ops are not called at all so even marked them as deprecated
    is misleading, we need to just drop the API.

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

    Tomas Winkler
     

30 Dec, 2015

1 commit

  • All variables required by the watchdog core to manage a watchdog are
    currently stored in struct watchdog_device. The lifetime of those
    variables is determined by the watchdog driver. However, the lifetime
    of variables used by the watchdog core differs from the lifetime of
    struct watchdog_device. To remedy this situation, watchdog drivers
    can implement ref and unref callbacks, to be used by the watchdog
    core to lock struct watchdog_device in memory.

    While this solves the immediate problem, it depends on watchdog drivers
    to actually implement the ref/unref callbacks. This is error prone,
    often not implemented in the first place, or not implemented correctly.

    To solve the problem without requiring driver support, split the variables
    in struct watchdog_device into two data structures - one for variables
    associated with the watchdog driver, one for variables associated with
    the watchdog core. With this approach, the watchdog core can keep track
    of its variable lifetime and no longer depends on ref/unref callbacks
    in the driver. As a side effect, some of the variables originally in
    struct watchdog_driver are now private to the watchdog core and no longer
    visible in watchdog drivers.

    As a side effect of the changes made, an ioctl will now always fail
    with -ENODEV after a watchdog device was unregistered with the character
    device still open. Previously, it would only fail with -ENODEV in some
    situations. Also, ioctl operations are now atomic from driver perspective.
    With this change, it is now guaranteed that the driver will not unregister
    a watchdog between a timeout change and the subsequent ping.

    The 'ref' and 'unref' callbacks in struct watchdog_driver are no longer
    used and marked as deprecated.

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

    Guenter Roeck
     

13 Dec, 2015

2 commits

  • Many watchdog drivers register a reboot notifier in order to stop the
    watchdog on system reboot. Thus we can factorize this code in the
    watchdog core.

    For that purpose, a new notifier block is added in watchdog_device for
    internal use only, as well as a new watchdog_stop_on_reboot helper
    function.

    If this helper is called, watchdog core registers the related notifier
    block and will stop the watchdog when SYS_HALT or SYS_DOWN is received.

    Since this operation can be critical on some platforms, abort the device
    registration if the reboot notifier registration fails.

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

    Damien Riegel
     
  • Many watchdog drivers implement the same code to register a restart
    handler. This patch provides a generic way to set such a function.

    The patch adds a new restart watchdog operation. If a restart priority
    greater than 0 is needed, the driver can call
    watchdog_set_restart_priority to set it.

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

    Damien Riegel
     

04 Nov, 2015

2 commits


03 Nov, 2015

1 commit

  • Up to now, a new timeout value is only evaluated against min_timeout
    if max_timeout is provided. This does not really make sense; a driver
    can have a minimum timeout even if it does not have a maximum timeout.
    Ensure that it is not smaller than min_timeout, even if max_timeout
    is not set.

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

    Guenter Roeck
     

05 Sep, 2015

1 commit

  • The kernel's NMI watchdog has nothing to do with the watchdog subsystem.
    Its header declarations should be in linux/nmi.h, not linux/watchdog.h.

    The code provided two sets of dummy functions if HARDLOCKUP_DETECTOR is
    not configured, one in the include file and one in kernel/watchdog.c.
    Remove the dummy functions from kernel/watchdog.c and use those from the
    include file.

    Signed-off-by: Guenter Roeck
    Cc: Stephane Eranian
    Cc: Peter Zijlstra (Intel)
    Cc: Ingo Molnar
    Cc: Don Zickus
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Guenter Roeck
     

29 Jun, 2015

1 commit


02 Apr, 2015

1 commit

  • This patch adds two new functions to enable/disable
    the watchdog across all CPUs.

    This will be used by the HT PMU bug workaround code to
    disable/enable the NMI watchdog across quirk enablement.

    Signed-off-by: Stephane Eranian
    Signed-off-by: Peter Zijlstra (Intel)
    Cc: bp@alien8.de
    Cc: jolsa@redhat.com
    Cc: kan.liang@intel.com
    Cc: maria.n.dimakopoulou@gmail.com
    Cc: Frederic Weisbecker
    Cc: Don Zickus
    Cc: Andrew Morton
    Link: http://lkml.kernel.org/r/1416251225-17721-12-git-send-email-eranian@google.com
    Signed-off-by: Ingo Molnar

    Stephane Eranian
     

21 Oct, 2014

1 commit


01 Mar, 2013

1 commit

  • Add support for watchdog drivers to initialize/set the timeout field
    of the watchdog_device structure. The timeout field is initialised
    either with the module timeout parameter value (if valid) or with the
    timeout-sec dt property (if valid). If both are invalid the initial
    value is unchanged.

    Signed-off-by: Fabio Porcedda
    Acked-by: Nicolas Ferre
    Signed-off-by: Wim Van Sebroeck

    Fabio Porcedda
     

20 Dec, 2012

1 commit


19 Nov, 2012

1 commit


13 Oct, 2012

1 commit


30 May, 2012

6 commits

  • If a driver's watchdog_device struct is part of a dynamically allocated
    struct (which it often will be), merely locking the module is not enough,
    even with a drivers module locked, the driver can be unbound from the device,
    examples:
    1) The root user can unbind it through sysfd
    2) The i2c bus master driver being unloaded for an i2c watchdog

    I will gladly admit that these are corner cases, but we still need to handle
    them correctly.

    The fix for this consists of 2 parts:
    1) Add ref / unref operations, so that the driver can refcount the struct
    holding the watchdog_device struct and delay freeing it until any
    open filehandles referring to it are closed
    2) Most driver operations will do IO on the device and the driver should not
    do any IO on the device after it has been unbound. Rather then letting each
    driver deal with this internally, it is better to ensure at the watchdog
    core level that no operations (other then unref) will get called after
    the driver has called watchdog_unregister_device(). This actually is the
    bulk of this patch.

    Signed-off-by: Hans de Goede
    Signed-off-by: Wim Van Sebroeck

    Hans de Goede
     
  • This patch fixes some potential multithreading issues, despite only
    allowing one process to open the /dev/watchdog device, we can still get
    called multiple times at the same time, since a program could be using thread,
    or could share the fd after a fork.

    This causes 2 potential problems:
    1) watchdog_start / open do an unlocked test_n_set / test_n_clear,
    if these 2 race, the watchdog could be stopped while the active
    bit indicates it is running or visa versa.

    2) Most watchdog_dev drivers probably assume that only one
    watchdog-op will get called at a time, this is not necessary
    true atm.

    Signed-off-by: Hans de Goede
    Signed-off-by: Wim Van Sebroeck

    Hans de Goede
     
  • Create the watchdog class and it's associated devices.

    Signed-off-by: Alan Cox
    Signed-off-by: Hans de Goede
    Signed-off-by: Wim Van Sebroeck

    Alan Cox
     
  • Some watchdogs merely trigger external alarms and controls. In a managed
    environment this is very useful but we want drivers to be able to figure
    out which is which now multiple dogs can be loaded. Thus add an ALARMONLY
    feature flag.

    Signed-off-by: Alan Cox
    Signed-off-by: Hans de Goede
    Signed-off-by: Wim Van Sebroeck

    Alan Cox
     
  • We keep the old /dev/watchdog interface file for the first watchdog via
    miscdev. This is basically a cut and paste of the relevant interface code
    from the rtc driver layer tweaked for watchdog.

    Revised to fix problems noted by Hans de Goede

    Signed-off-by: Alan Cox
    Signed-off-by: Hans de Goede
    Signed-off-by: Tomas Winkler
    Signed-off-by: Wim Van Sebroeck

    Alan Cox
     
  • Some watchdog may need to check if watchdog is ACTIVE or not, for example in
    their suspend/resume hooks.

    This patch adds this routine and changes the core drivers to use it.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Wim Van Sebroeck

    Viresh Kumar
     

28 Mar, 2012

2 commits


06 Jan, 2012

1 commit


28 Jul, 2011

4 commits