Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1443937iob; Fri, 29 Apr 2022 05:34:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm1Cck/YoPMKtHhNv82QAuI5MygMwsBaIhTWgxA9WeS4VTFwXAzazK4rsmxCd4djpCmztL X-Received: by 2002:a17:90a:d593:b0:1d9:2bc9:f1a6 with SMTP id v19-20020a17090ad59300b001d92bc9f1a6mr3660706pju.207.1651235661206; Fri, 29 Apr 2022 05:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651235661; cv=none; d=google.com; s=arc-20160816; b=lAnVMtHvaNzIT26kZ0ZtwRgO5TPox0XEOOiiBv+riuEYNw0TM0MCKuGatX4Rp3o8SG hJGb/lsIp+pEKCGEYmjLhYWHENq9mk9sl0QcVEbcD11tBbZ3o5nifVLcqXNQBlkQMhXn 4EU9/pA1mcAorMONWxxq6cXq+2SaD/N2dfNE9di+kIcrYlXl9/QGlm8KhvUQKzdYOj9U d2XfRK9MG7vJRmELZ+NVHH2iPKHBI8HjUwq1Yhx7MNKXkyCStW9SbOw/fmNDu+hheuU4 tMvitIeYdiXopokiHlUzWj5M+LbDyrLN6rRUrjfo4Io5FvjJ0cBJz48PyoE8RkTsgIAN whIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QX7FQMLThcuJs/2cBMas+FdLeZ0raDGjPsBB8zqn6fk=; b=ikWz4+L6Nuvd6yIkg6EV5OqytcJVmGXQbnyjhfz9SAq88o//TnPWb646fBDz2gf8uU /3NoQGoa8C1cKSbC04YlvBMpT+zIO8BJIhK+9IjHcgjg/A9tLHmJNpVg4ipVO7i3XGwa HAML3qw6VDb7ic0p8OltxAHfHkFuM3JVdC6oUfwxP7TtaJOwBc6CleNfIGACEBwDcEp0 g2LybZ1AuyB5YMeVBBFYFnZ2hZ+dqt/Xw0NlzReeaE4rC5R+KE35Boh9PaWs0+zRbKiC IRD4TnVj2AgLLivK7Y/DOvtMW9sf2XN0L+Wu7Olj2Dup8232VOV+R614hjZF3LXZ5kUG 3WDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=IGLrSesT; 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 z1-20020a170903018100b001586fbb2b6dsi8262997plg.566.2022.04.29.05.34.05; Fri, 29 Apr 2022 05:34:21 -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=IGLrSesT; 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 S1356544AbiD2J3x (ORCPT + 99 others); Fri, 29 Apr 2022 05:29:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356541AbiD2J3r (ORCPT ); Fri, 29 Apr 2022 05:29:47 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D38F8C4013 for ; Fri, 29 Apr 2022 02:26:29 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id t6so9985616wra.4 for ; Fri, 29 Apr 2022 02:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=QX7FQMLThcuJs/2cBMas+FdLeZ0raDGjPsBB8zqn6fk=; b=IGLrSesTPryWuHxSpSIcGomwqe3OV44Xq4NPCw4fMrdMIT8H3Bjkf8aMNdxvR4bUm8 E72PxAGOEOzBCd2lmfeqBdnV94WA3+wHZrvVNySCmMppiXLvcnMpf15IOTjiqk9HG5fk kBrxEqsTugnJoBpKqqBdpQ7Up902WpOw8ty0lx74MNvU9Tta35pcLhYiZYQ2l0TcBMQO uwtPoJjn5nUBiAuT2mf2TuHaLhi9/4gfqHVXkupG1vd543LmM/gFw+I2cBEt6JdFnqgJ FiqEZUOsxHXWTdMBSbMJ73O1WAt8KdyGAKLG9v/xeoeULDw8cVjqFOplvxqOoJ4BtWUT BWaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=QX7FQMLThcuJs/2cBMas+FdLeZ0raDGjPsBB8zqn6fk=; b=XrVcArXNOFlZYDmBhJMBrzijTGQf5F2GHwuMgS6UakLtsyGY7DVG7QsM+kreStTDsF ZqSAx6lCYa8L85MoGqmdt5B8vKAgB9bDGyor1/7GcwFfO4A4IGDc2f8pFntgQjxGBLXW 2B28dNZFSS0r/s5qfaqkvJUWAVc24HmyBeQRm0CqOfit3j4cMWRi+whuDb3RbCZj5+57 WU5KPlouqKM93mc4m/d9PYEgny0FHZyaVDcepSklhLt5FZg4AFemf5ioesm6NegTI/uO RVlX5pdhKN+JwB/ZIQmXocC6AvgemOs6FbRVR79jYemrsChlDljkf1rA1DfqQ4NwrMRY ix1A== X-Gm-Message-State: AOAM5311RFJZtcztTiUIA4A69fT34QMoAJJXxOmhoPQ8IFrjMTVcho4Z xRuXH+KJgFFTD4cn0cwlO2xZ9w== X-Received: by 2002:a5d:4311:0:b0:205:f26b:fb98 with SMTP id h17-20020a5d4311000000b00205f26bfb98mr30515219wrq.202.1651224388238; Fri, 29 Apr 2022 02:26:28 -0700 (PDT) Received: from google.com (49.222.77.34.bc.googleusercontent.com. [34.77.222.49]) by smtp.gmail.com with ESMTPSA id f10-20020adfc98a000000b0020acee46c88sm2057293wrh.21.2022.04.29.02.26.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 02:26:27 -0700 (PDT) Date: Fri, 29 Apr 2022 09:26:26 +0000 From: Sebastian Ene To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Derek Kiernan , Dragan Cvetic , Arnd Bergmann , devicetree@vger.kernel.org, qperret@google.com, will@kernel.org, Rob Herring , Guenter Roeck Subject: Re: [PATCH v4 2/2] misc: Add a mechanism to detect stalls on guest vCPUs Message-ID: References: <20220429083030.3241640-1-sebastianene@google.com> <20220429083030.3241640-3-sebastianene@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 On Fri, Apr 29, 2022 at 10:51:14AM +0200, Greg Kroah-Hartman wrote: > On Fri, Apr 29, 2022 at 08:30:33AM +0000, Sebastian Ene wrote: > > This driver creates per-cpu hrtimers which are required to do the > > periodic 'pet' operation. 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. > > > > This part of the driver is the 'frontend' which is reponsible for > > delivering the periodic 'pet' events, configuring the virtual peripheral > > and listening for cpu hotplug events. The other part of the driver > > handles the peripheral emulation and this part accounts for lost time by > > looking at the /proc/{}/task/{}/stat entries and is located here: > > https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3548817 > > > > Signed-off-by: Sebastian Ene > > --- > > drivers/misc/Kconfig | 12 +++ > > drivers/misc/Makefile | 1 + > > drivers/misc/vm-watchdog.c | 206 +++++++++++++++++++++++++++++++++++++ > > 3 files changed, 219 insertions(+) > > create mode 100644 drivers/misc/vm-watchdog.c > > > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig > > index 2b9572a6d114..26c3a99e269c 100644 > > --- a/drivers/misc/Kconfig > > +++ b/drivers/misc/Kconfig > > @@ -493,6 +493,18 @@ config OPEN_DICE > > > > If unsure, say N. > > > > +config VM_WATCHDOG > > + tristate "Virtual Machine Watchdog" > > + select LOCKUP_DETECTOR > > + help > > + Detect CPU locks on the virtual machine. This driver relies on the > > + hrtimers which are CPU-binded to do the 'pet' operation. When a vCPU > > + has to do a 'pet', it exits the guest through MMIO write and the > > + backend driver takes into account the lost ticks for this particular > > + CPU. Hi, > > There's nothing to keep this tied to a virtual machine at all, right? > You are just relying on some iomem address to be updated, so it should > be a "generic_iomem_watchdog" driver as there's nothing specific to vms > at all from what I can tell. > > thanks, > > greg k-h That's right although I might think of using the term "generic lockup detector" instead of watchdog. The only reason why I would keep "virtual machine" word in, is that there is no actual hardware for this. Thanks, Seb