From patchwork Sat Oct 12 00:39:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 3030061 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7E2959F1E1 for ; Sat, 12 Oct 2013 00:44:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8F4D2039B for ; Sat, 12 Oct 2013 00:44:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C8CDA2034F for ; Sat, 12 Oct 2013 00:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754896Ab3JLAoh (ORCPT ); Fri, 11 Oct 2013 20:44:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40314 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754509Ab3JLAnt (ORCPT ); Fri, 11 Oct 2013 20:43:49 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r9C0hmvA015018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 11 Oct 2013 20:43:48 -0400 Received: from amt.cnet (vpn1-5-105.gru2.redhat.com [10.97.5.105]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r9C0hlbZ012686; Fri, 11 Oct 2013 20:43:48 -0400 Received: from amt.cnet (localhost [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id C3F19104A4F; Fri, 11 Oct 2013 21:43:29 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.6/8.14.6/Submit) id r9C0hTKk004640; Fri, 11 Oct 2013 21:43:29 -0300 Message-Id: <20131012004217.058840904@amt.cnet> User-Agent: quilt/0.60-1 Date: Fri, 11 Oct 2013 21:39:26 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: dzickus@redhat.com, pbonzini@redhat.com, gleb@redhat.com, linux-kernel@vger.kernel.org, Marcelo Tosatti Subject: [patch 2/2] hung_task: add method to reset detector References: <20131012003924.092908362@amt.cnet> Content-Disposition: inline; filename=01-hung-task-watchdog-reset X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In certain occasions it is possible for a hung task detector positive to be false: continuation from a paused VM, for example. Add a method to reset detection, similar as is done with other kernel watchdogs. Signed-off-by: Marcelo Tosatti --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: kvm/kernel/hung_task.c =================================================================== --- kvm.orig/kernel/hung_task.c +++ kvm/kernel/hung_task.c @@ -203,6 +203,14 @@ int proc_dohung_task_timeout_secs(struct return ret; } +static atomic_t reset_hung_task = ATOMIC_INIT(0); + +void reset_hung_task_detector(void) +{ + atomic_set(&reset_hung_task, 1); +} +EXPORT_SYMBOL_GPL(reset_hung_task_detector); + /* * kthread which checks for tasks stuck in D state */ @@ -216,6 +224,9 @@ static int watchdog(void *dummy) while (schedule_timeout_interruptible(timeout_jiffies(timeout))) timeout = sysctl_hung_task_timeout_secs; + if (atomic_xchg(&reset_hung_task, 0)) + continue; + check_hung_uninterruptible_tasks(timeout); } Index: kvm/include/linux/sched.h =================================================================== --- kvm.orig/include/linux/sched.h +++ kvm/include/linux/sched.h @@ -285,6 +285,14 @@ static inline void lockup_detector_init( } #endif +#ifdef CONFIG_DETECT_HUNG_TASK +void reset_hung_task_detector(void); +#else +static inline void reset_hung_task_detector(void) +{ +} +#endif + /* Attach to any functions which should be ignored in wchan output. */ #define __sched __attribute__((__section__(".sched.text"))) Index: kvm/arch/x86/kernel/pvclock.c =================================================================== --- kvm.orig/arch/x86/kernel/pvclock.c +++ kvm/arch/x86/kernel/pvclock.c @@ -48,6 +48,7 @@ void pvclock_touch_watchdogs(void) touch_softlockup_watchdog_sync(); clocksource_touch_watchdog(); rcu_cpu_stall_reset(); + reset_hung_task_detector(); } static atomic64_t last_value = ATOMIC64_INIT(0);