From patchwork Tue Apr 5 14:19:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Ene X-Patchwork-Id: 556336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB7C1C4332F for ; Tue, 5 Apr 2022 23:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573704AbiDEWwt (ORCPT ); Tue, 5 Apr 2022 18:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447319AbiDEPqS (ORCPT ); Tue, 5 Apr 2022 11:46:18 -0400 Received: from mail-wm1-x349.google.com (mail-wm1-x349.google.com [IPv6:2a00:1450:4864:20::349]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A06BF91572 for ; Tue, 5 Apr 2022 07:21:08 -0700 (PDT) Received: by mail-wm1-x349.google.com with SMTP id r6-20020a05600c35c600b0038e6db5da9cso1881584wmq.9 for ; Tue, 05 Apr 2022 07:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=m3vxItKXnUJTINlJEdj+JcIaXhSRzpBzJXMN0Ho5eps=; b=U/rCu1Z2QfNGh7871ZpZdN4wY/+Lh1Wn/I5Ha6phoPhUI3yRDteIeF+TZGPPbHc3Ai BBQSP1z5sD9b+wklr0ZXpHQDx20253jpVlFYCml1fsblFB2Q243A1smZeVhSbDbYut0u z7IHIiryy2SGXsp58k8lugrnBQWpAfe4UaUoIoiLNUWU6VPrmVSPjgLFVRjjlsnuviJh g2vIiFzGHXI6KSMbAEIY16WttCiHeVwLMIUVeWsgv9R9tws08lP2EReN2yTioJTEcmxr 8dTXpSzd/4Gkzv5UDngHARkRMF8rXO+CxVkuFg6Z/c+C3T3Db9QNzs4r4LR3an7j0BQQ bBuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=m3vxItKXnUJTINlJEdj+JcIaXhSRzpBzJXMN0Ho5eps=; b=Lxen0uVHflG0TrzJS6YzV2YDfB/OEZfRXXMd5og8tmHtrDGrYDgvdzhLpo8OUVv4WL 8n711gZCmuvovIulzSTpLFpI1pAKcSv+9AofBpRLvOqKTiRxxF50ldJHuAz9LbeYDGSZ FXqiVi4B5WlS+gBI+WdZ35lI9zfmfT01iecgwCtQNozO4xHgxBrpXEm+Vlb9ubxBCXwZ tk8bxgvkQ1hLIIZMqnz58HcXVBi79uG4rm7wARAFUTQ4ZeKt//MQZKrM1X2Dz2nzANBt 8y84joR75/CpogqhQPHzfk2UySw+2VUk5sYHU5ZC6k5BIw+BMbVk+3h6pOt3NcfQM32M YTZg== X-Gm-Message-State: AOAM532ehpZMBooyIPPMtr+qfVj+QJ+y2j1Uy5qjXOUeRLiM9J6v32vb tT9dt36ketTIw5FC9gH1nz390+5C5P2WyyxbexM= X-Google-Smtp-Source: ABdhPJwN5QFMBNAx6z4lJuIDDPZMY0wbemxu/vZ7lASsb58ZkL62PcBPIS8ol+sPOaL6RzriqT4z3Z6RSNAw7S3JJqU= X-Received: from sene.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:27c4]) (user=sebastianene job=sendgmr) by 2002:a05:600c:4f87:b0:38c:adde:1d99 with SMTP id n7-20020a05600c4f8700b0038cadde1d99mr3320464wmq.16.1649168466877; Tue, 05 Apr 2022 07:21:06 -0700 (PDT) Date: Tue, 5 Apr 2022 14:19:53 +0000 Message-Id: <20220405141954.1489782-1-sebastianene@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.1094.g7c7d902a7c-goog Subject: [PATCH 0/2] Detect stalls on guest vCPUS From: Sebastian Ene To: Wim Van Sebroeck , Guenter Roeck , Rob Herring Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, will@kernel.org, qperret@google.com, maz@kernel.org, Sebastian Ene Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds a mechanism to detect stalls on the guest vCPUS by creating a per CPU hrtimer which periodically 'pets' the host backend driver. This device driver acts as a soft lockup detector by relying on the host backend driver to measure the elapesed time between subsequent 'pet' events. If the elapsed time doesn't match an expected value, the backend driver decides that the guest vCPU is locked and resets the guest. The host backend driver takes into account the time that the guest is not running. The communication with the backend driver is done through MMIO and the register layout of the virtual watchdog is described as part of the backend driver changes. The host backend driver is implemented as part of: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548817 Sebastian Ene (2): dt-bindings: watchdog: Add qemu,vm-watchdog compatible watchdog: Add a mechanism to detect stalls on guest vCPUs .../devicetree/bindings/watchdog/vm-wdt.yaml | 44 ++++ drivers/watchdog/Kconfig | 8 + drivers/watchdog/Makefile | 1 + drivers/watchdog/vm-wdt.c | 215 ++++++++++++++++++ 4 files changed, 268 insertions(+) create mode 100644 Documentation/devicetree/bindings/watchdog/vm-wdt.yaml create mode 100644 drivers/watchdog/vm-wdt.c