Received: by 2002:a05:6a10:5594:0:0:0:0 with SMTP id ee20csp526430pxb; Mon, 25 Apr 2022 15:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3QnO8RQYVEaU2R5ofGunnKUVbsO4gXudlJ9CUU9YMZLdxIa31eQ2dtP4AjIpNLk/syisi X-Received: by 2002:a17:90a:c246:b0:1d9:3a2e:5495 with SMTP id d6-20020a17090ac24600b001d93a2e5495mr14821346pjx.170.1650926228738; Mon, 25 Apr 2022 15:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650926228; cv=none; d=google.com; s=arc-20160816; b=GvcpL/TwirIvn+OCULCbEpHkMagkYpjdLtKHR1/b8s3PZJVuHdwxWOwkA33FS49StC HRMezUPCsYaGzJmu0yW7GAvAnHxFVa5qc/wy5eE30PJ3ImN+6t5/O9vWc2JO1yEBnyE2 kkIZ2bGEarNw/I83hzMMdxYAxBZHTHFSftFlagXhWa4HQKssZbZMGx0/eqIjRz0wDP1Q Rd2iF4dhYWUV0knAUIwERe+vpHA7u7xQF62d3WKEjKqLhUyE+NlMzX/5i6T1DwrhHbDg 7zBj+cBwXT8qiOKiBhI8/CLVqRdfZDFMxkk6Js9NXySdOyO0nxYQTTNPpcrvoJH3pdTi MPKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=vFIWlLIseN4WX4pfaeRN3WcX3IXEI83md2Kst1oG3Kw=; b=a4yWcQqxUtiKYjJf3Oqeq7lA6LtLNwEYz7iPu6JlmAzurIhfC+6ll2W506dxU5Fp3w BaFcj1dMI2W/gXtrUSqzl/KSEJrLBzBqjfj3pjbNRCZHZyX7h152cR4pGoFfa18t7RBd /uhO54RYhaB3BWAbTCQq3ce0IZ946eTj5OFjsXDkbgqdti5w6051jRTO4LWZIqWrYtk8 FhHvmX/dSkqsjV5yY+yGGP17OXQcDdI0ENsGtRAb4QYVF/5gHzoQGmec2iFa6VmkG0Bx A6BHs+R+u4sdwn7mPclFXaWgmwc90J4nRydCub67ClmfX3JW2u5jB93ycdBoql9ist/r xcKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GNi1ZTeA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y8-20020a056a00190800b004fa3a8e00b1si17563407pfi.360.2022.04.25.15.36.52; Mon, 25 Apr 2022 15:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=GNi1ZTeA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242168AbiDYNpd (ORCPT + 99 others); Mon, 25 Apr 2022 09:45:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242126AbiDYNpU (ORCPT ); Mon, 25 Apr 2022 09:45:20 -0400 Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE7E34991F for ; Mon, 25 Apr 2022 06:42:12 -0700 (PDT) Received: by mail-wr1-x44a.google.com with SMTP id v13-20020adfc5cd000000b0020ad3580cd0so1046221wrg.10 for ; Mon, 25 Apr 2022 06:42:12 -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=vFIWlLIseN4WX4pfaeRN3WcX3IXEI83md2Kst1oG3Kw=; b=GNi1ZTeAVtDL2Nf4dNjDSzCOWzxTM7w/PeYPPbwf+GDUN/OBnB6J3fPBx4TS8JcgT7 4bjzCXedONeMuwC9eS38JFMuZV6sl9jCO9bRHDLgpSEUpTXRP2me14iDzkZkM524srHX PSabzmWBBHJK1TDd+FD69L4j+qi0zOd4aQRXNPB3kNqmW2+WAFrMETkrQ0trGEtgbCtx S8Lu5gKzFwhIaCVmXWD9CFAW+ZAY/ITAQuB0VcSkPIdiQ9bq3xeZ+MNDe7jaGTldNRse lMjDaIpLrWj7n+d+bxrT92FuG1EeXHLt4dSZkJmihz5+9WFo/xQXinIVHax2/WckDQyj M1WA== 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=vFIWlLIseN4WX4pfaeRN3WcX3IXEI83md2Kst1oG3Kw=; b=hfkwL7f6m2O+ba2/kIYw1mhNUyF2vrHM6zRyL+F2PWUgfktd6kj5vNa3zSknlmWSFV iQeLNv4VfR0q1uQJfmIH47w4MZ78t/JFJrvXTeJEHyb1K3uW4rQximgZGQCccm1TOQiO 2Hl367waT7HPd9L78p69OLbiXxaVod98yz9fKyQTlyqZaEJjkFdKjV2FjdfW/bD//xpM xcfID7hOpGLG3HUQ0whsJ/NEi37msUk2Iqm/F094bY31MBcLMX0gxhrQObf8cq/mkGbT 0tYC+Ae6qzHXK4CuQkhOXM965AleqtvvCKuqh8w3/gCbidURHR15sBzNb+LJYxSFaV1D eIBg== X-Gm-Message-State: AOAM532lCxVd5/Ls2hqqM9h4+xUFhTaFTlwQobM8HvoothgMhCqeDMWn +3wWweLB41pp4FpjdQRSEULlPtiswp/aTsexTEw= X-Received: from sene.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:27c4]) (user=sebastianene job=sendgmr) by 2002:a05:600c:35c9:b0:393:f039:d10a with SMTP id r9-20020a05600c35c900b00393f039d10amr1075397wmq.95.1650894131056; Mon, 25 Apr 2022 06:42:11 -0700 (PDT) Date: Mon, 25 Apr 2022 13:42:03 +0000 Message-Id: <20220425134204.149042-1-sebastianene@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog Subject: [PATCH v3 0/2] Detect stalls on guest vCPUS From: Sebastian Ene To: Rob Herring , Greg Kroah-Hartman , Arnd Bergmann , Dragan Cvetic Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, maz@kernel.org, will@kernel.org, qperret@google.com, Sebastian Ene Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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. On a conventional watchdog-core driver, the userspace is responsible for delivering the 'pet' events by writing to the particular /dev/watchdogN node. In this case we require a strong thread affinity to be able to account for lost time on a per vCPU basis. 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 Changelog v3: - cosmetic fixes, remove pr_info and version information - improve description in the commit messag - improve description in the Kconfig help section Sebastian Ene (2): dt-bindings: vm-wdt: Add qemu,vm-watchdog compatible misc: Add a mechanism to detect stalls on guest vCPUs .../devicetree/bindings/misc/vm-wdt.yaml | 44 ++++ drivers/misc/Kconfig | 12 + drivers/misc/Makefile | 1 + drivers/misc/vm-wdt.c | 207 ++++++++++++++++++ 4 files changed, 264 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/vm-wdt.yaml create mode 100644 drivers/misc/vm-wdt.c -- 2.36.0.rc2.479.g8af0fa9b8e-goog