From nobody Thu Apr 18 20:45:31 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1557512988; cv=none; d=zoho.com; s=zohoarc; b=X1q3LmiLciU1aGbM/dhWRRh+pyhT8FhFpgE2sAe26MoQwntD3iI6EmNb4mJ31z6qHwp4nnxFo7vB9h7bUe0KgteSjD8eANsF9N+Rzng+HFYcPArIlGdikJaXt1bGqw3a3cKO3e8U1BnKBPfzK180vshrdWSMdKBlzlYf/PB14yo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557512988; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=iCpF0FMAgm26iHyiXJ0zAbP1+yFSFUMjoACE+iItje8=; b=DvpGZhgg6EvkhAjYiP+0v5sYf4qjPuJ5P/2SkG5SXbeouV7MiW5868PhwBOiUZlagCkV/a5PdV7qGcJbR/Q8oLBtwQEAhvwES7pTgVho1ssSakRx/GOYLp6mITpXhbkCxEjXiuBLRBpZBLBJC7QxAktv9roNHDSnrc8aamLT7R0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1557512988346521.5876549699516; Fri, 10 May 2019 11:29:48 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hPAFg-0006vm-UI; Fri, 10 May 2019 18:28:12 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hPAFf-0006vX-Nk for xen-devel@lists.xenproject.org; Fri, 10 May 2019 18:28:11 +0000 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 5d84b725-7351-11e9-8980-bc764e045a96; Fri, 10 May 2019 18:28:11 +0000 (UTC) X-Inumbo-ID: 5d84b725-7351-11e9-8980-bc764e045a96 X-IronPort-AV: E=Sophos;i="5.60,454,1549929600"; d="scan'208";a="85337738" From: Andrew Cooper To: Xen-devel Date: Fri, 10 May 2019 19:28:04 +0100 Message-ID: <1557512884-32395-5-git-send-email-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1557512884-32395-1-git-send-email-andrew.cooper3@citrix.com> References: <1557512884-32395-1-git-send-email-andrew.cooper3@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/4] xen/watchdog: Support disable all watchdog timers in one go X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Christian Lindig , Pau Ruiz Safont , Julien Grall , =?UTF-8?q?Edwin=20T=C3=B6r=C3=B6k?= , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" For a domain which has been using watchdogs, but wants to cleanly reboot, stopping all active timers is necessary to avoid crashing late during shutdown. The number of watchdogs isn't part of Xen's ABI, so to simplify cleanup and error handling logic, support using id =3D 0, timeout =3D 0 to deactivate a= ll timers in one go. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: George Dunlap CC: Edwin T=C3=B6r=C3=B6k CC: Christian Lindig CC: Pau Ruiz Safont --- xen/common/schedule.c | 9 ++++++++- xen/include/public/sched.h | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 98c2c35..284f657 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -1066,7 +1066,7 @@ static long domain_watchdog(struct domain *d, uint32_= t id, uint32_t timeout) goto unlock; } } - else /* Allocate the next available timer. */ + else if ( timeout ) /* Allocate the next available timer. */ { id =3D ffs(~d->watchdog_inuse_map) - 1; =20 @@ -1079,6 +1079,13 @@ static long domain_watchdog(struct domain *d, uint32= _t id, uint32_t timeout) __set_bit(id, &d->watchdog_inuse_map); rc =3D id + 1; } + else /* id 0, timeout 0 =3D> disable all timers. */ + { + d->watchdog_inuse_map =3D 0; + for ( ; id < NR_DOMAIN_WATCHDOG_TIMERS; ++id ) + stop_timer(&d->watchdog_timer[id]); + goto unlock; + } =20 /* (re-)arm, or clear a specific timer. */ if ( unlikely(timeout =3D=3D 0) ) diff --git a/xen/include/public/sched.h b/xen/include/public/sched.h index 811bd87..994a0e5 100644 --- a/xen/include/public/sched.h +++ b/xen/include/public/sched.h @@ -112,8 +112,10 @@ /* * Setup, poke and destroy a domain watchdog timer. * @arg =3D=3D pointer to sched_watchdog_t structure. - * With id =3D=3D 0, setup a domain watchdog timer to cause domain shutdown - * after timeout, returns watchdog id. + * With id =3D=3D 0 and timeout !=3D 0, setup a domain watchdog timer to c= ause + * domain shutdown after timeout, returns + * watchdog id. + * With id =3D=3D 0 and timeout =3D=3D 0, destroy all watchdog timers. * With id !=3D 0 and timeout =3D=3D 0, destroy domain watchdog timer. * With id !=3D 0 and timeout !=3D 0, poke watchdog timer and set new time= out. */ --=20 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel