• Don Zickus's avatar
    nmi_watchdog: Add new, generic implementation, using perf events · 1fb9d6ad
    Don Zickus authored
    This is a new generic nmi_watchdog implementation using the perf
    events infrastructure as suggested by Ingo.
    
    The implementation is simple, just create an in-kernel perf
    event and register an overflow handler to check for cpu lockups.
    
    I created a generic implementation that lives in kernel/ and
    the hardware specific part that for now lives in arch/x86.
    
    This approach has a number of advantages:
    
     - It simplifies the x86 PMU implementation in the long run,
       in that it removes the hardcoded low-level PMU implementation
       that was the NMI watchdog before.
    
     - It allows new NMI watchdog features to be added in a central
       place.
    
     - It allows other architectures to enable the NMI watchdog,
       as long as they have perf events (that provide NMIs)
       implemented.
    
     - It also allows for more graceful co-existence of existing
       perf events apps and the NMI watchdog - before these changes
       the relationship was exclusive. (The NMI watchdog will 'spend'
       a perf event when enabled. In later iterations we might be
       able to piggyback from an existing NMI event without having
       to allocate a hardware event for the NMI watchdog - turning
       this into a no-hardware-cost feature.)
    
    As for compatibility, we'll keep the old NMI watchdog code as
    well until the new one can 100% replace it on all CPUs, old and
    new alike.  That might take some time as the NMI watchdog has
    been ported to many CPU models.
    
    I have done light testing to make sure the framework works
    correctly and it does.
    
     v2: Set the correct timeout values based on the old nmi
         watchdog
    Signed-off-by: default avatarDon Zickus <dzickus@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: gorcunov@gmail.com
    Cc: aris@redhat.com
    Cc: peterz@infradead.org
    LKML-Reference: <1265424425-31562-3-git-send-email-dzickus@redhat.com>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    1fb9d6ad
nmi_watchdog.c 4.56 KB