Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3587683iog; Tue, 21 Jun 2022 01:41:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tHjrEW7F3Y84W4/WqWxbCIgdHBsGzvaeBsTXGX2Xhg4PBrYRt/rLrWr0HI03KLFbpy8yQ3 X-Received: by 2002:a05:6402:2405:b0:431:6ef1:e2a with SMTP id t5-20020a056402240500b004316ef10e2amr34411508eda.26.1655800861804; Tue, 21 Jun 2022 01:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655800861; cv=none; d=google.com; s=arc-20160816; b=zAbnpEbIf1T1kTWBKEUh8YEk1kdZhP59x2L5MAiq/IQV+cvT74v7GgRX38vpMkVphv z6Q7JA73RGFLi3+atWpNxL4TOH3C7dwZZiNVgRjDFjVILtVd8hjmE3poTPtFoL2yMVU6 qqa6hfY+poSAfzBOjmNGmkk3ofPqyTrOj2JGEtbOhVOV0UmJ43xyyYBBeOfxk7rNyjsm cET5F0XqyB+HYIic0rsk7Wo8AQLwjadcjjnjeUw/3+v3v2iLvMHSgf6AXgxZ9330xlC/ GZgrRtieYXSI8Up8Avs5mpgpRqZ+N/WTFEPuM2L0LK9+GqdYImMBz8d2worEYfUIaZ7b Nv6w== 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=j+rdY4Kie94u2A8T27X6OMrj7NJshFRwwluKxSWTYUs=; b=fBX4wTh3ufeP4b9xKpoAKOKAR45imZGGiunlR8fMHJzXpqt8P1nLMDeVH157UZ0nXo CHXuDlCzXA2U4zrGvNctfMzHHccoz/UGD69EPW/YxU9BHrbrMKrlK2rLCr91/2E34ve9 hVt2o5U+/I0wb7vYyk4nQfpFUXc6LVLRsEkEyvhKsg19EPrD6gn8cUnQwwmVi4KlbKZy ao+Trf3rGAOHeJdmWd8xJp8HWaVECtm5bQ2vkQzKRISMmllbS68ymdyfQlvlCBJaDyF0 n5DvrSi0hOnOXG8myQm991JbT0EQ1XfZMXRibkqOnClVwyEAWtGrAIQLVPAdwZVS2CF1 opYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YinFmWa0; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z12-20020a056402274c00b0043588fb03b6si4536528edd.409.2022.06.21.01.40.36; Tue, 21 Jun 2022 01:41:01 -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=@linuxfoundation.org header.s=korg header.b=YinFmWa0; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbiFUI2E (ORCPT + 99 others); Tue, 21 Jun 2022 04:28:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348003AbiFUI1x (ORCPT ); Tue, 21 Jun 2022 04:27:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6D3112B; Tue, 21 Jun 2022 01:27:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FA68614E8; Tue, 21 Jun 2022 08:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA0EDC3411D; Tue, 21 Jun 2022 08:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655800071; bh=vq74hwgGIXNtd0Oi63FHItQ2lILjSqcBsh/3jD/OHLE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YinFmWa0LnPWSl/yFozEUqdXRXcFe43cprSV792cAQ3aIEKKQvS1TXTpJF2xUT1cQ 5t/aEXebIamIl6rgiO7Vx6lF/0IzixGEKjwfuxgt6D+Agirczg6MS+DYZlK+4bDuNw g1lrL3YBbouTPimhhJolQbMTXmuYNdntgnGpWV0M= Date: Tue, 21 Jun 2022 10:27:48 +0200 From: Greg Kroah-Hartman To: Sebastian Ene Cc: Rob Herring , Arnd Bergmann , Dragan Cvetic , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, maz@kernel.org, will@kernel.org, vdonnefort@google.com, Guenter Roeck Subject: Re: [PATCH v7 2/2] misc: Add a mechanism to detect stalls on guest vCPUs Message-ID: References: <20220621080308.3952915-1-sebastianene@google.com> <20220621080308.3952915-3-sebastianene@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220621080308.3952915-3-sebastianene@google.com> X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tue, Jun 21, 2022 at 08:03:09AM +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/vcpu_stall_detector.c | 222 +++++++++++++++++++++++++++++ > 3 files changed, 235 insertions(+) > create mode 100644 drivers/misc/vcpu_stall_detector.c > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig > index 41d2bb0ae23a..e15c85d74c4b 100644 > --- a/drivers/misc/Kconfig > +++ b/drivers/misc/Kconfig > @@ -483,6 +483,18 @@ config OPEN_DICE > > If unsure, say N. > > +config VCPU_STALL_DETECTOR > + tristate "VCPU stall detector" > + select LOCKUP_DETECTOR > + help > + Detect CPU locks on a kvm 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. > + To compile this driver as a module, choose M here: the > + module will be called vcpu_stall_detector. Should this depend on KVM_GUEST? thanks, greg k-h