Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp207946iob; Mon, 2 May 2022 17:14:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaBRMzUnUZGZXJgXZvRZeEfWavM9uJzLmtzPFxBdv91Jsuceho+MeY0Uy2ZRbBIvYP5Rj7 X-Received: by 2002:a17:902:9005:b0:158:e46e:688c with SMTP id a5-20020a170902900500b00158e46e688cmr13859565plp.173.1651536879599; Mon, 02 May 2022 17:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651536879; cv=none; d=google.com; s=arc-20160816; b=wZshVFdy7IE4uyA+w5nM3+Xl7Gem0NwMBdx8xVma4EyWLx+lz924acK5MSSF6y40lM n6RCfb07f0wf7zoGBYaVgwDl59uEle+vdtyCZ4v9DoWuK0QDyQFv9tlqFeSfTKhDApVF xWaTOlIJugzHaP8O+e2Sl834e+QdrxObIiaT8QoF4i+vvCInTzIYIOEOiB1VKMiZzUob +wSgmd3Q5GZKwyUxctDBcJlfnytoJs+GUJPa9XOEjqG8Ap8n/hnujd2WPcWAjWDh5Dlv ApU7IK991duFjIhJbq81LcUS42uRklxOlqDnUkbX+xXGrTpyL9/Yozna+Z0i/jLTvF3B u0rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:dkim-signature; bh=Avtg8U1a0UTlE95PYdqBdaXhxpdHsz32dmj04jLlbjQ=; b=tp3M0xtnmKSFdL9bxwvM1qBUEYuhzR+NmUbmsz8xZHiYZCWCgYQV49OsI70oJU0mNX OPvLZWsIbtxJCP0ktYAuT4k3nzLA5dOpOGhCFc3lscAMU8L2PYbdQ3Cc/1RS7++84+et QhBFvi3IRZdAn5IX4/YeYjYYqK+5D5KcxeEHZBPrmsw9PDTwBSfiGxdqKIKB7kRHqCEO L++PxrbgRzTFz//yF2218tz9UctBq1iPQ8qhgpznXgRLX2Tgd/rP/ufP4t/EJqKSxHWc Ol/v3gUvW9LBaJTTadBWhWlHV0jqCRVrUATl0mPh9lVp1xFmWQJkJesHzetwstBPwejd cHNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AlUSVqFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id k9-20020aa79989000000b0050a5da0cd2csi14605446pfh.30.2022.05.02.17.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:14:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=AlUSVqFs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 807E312627; Mon, 2 May 2022 17:13:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235138AbiD3MkS (ORCPT + 99 others); Sat, 30 Apr 2022 08:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbiD3MkQ (ORCPT ); Sat, 30 Apr 2022 08:40:16 -0400 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2CA669280; Sat, 30 Apr 2022 05:36:54 -0700 (PDT) Received: by mail-ot1-x335.google.com with SMTP id l9-20020a056830268900b006054381dd35so6875754otu.4; Sat, 30 Apr 2022 05:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Avtg8U1a0UTlE95PYdqBdaXhxpdHsz32dmj04jLlbjQ=; b=AlUSVqFsN8wJhZhPlfLFQDnmaTRsEiUtXXZPNGFzE3GdONjgSZxx3NdJq9gnYWx72u U+T7aXsXy5VreP74kwnG2Jxms2tXfp/vi42zbuAe+6B/a90LOYL31TBPR1Kt6N1mysyK BSyZF/oFW41m2cHrnApv2v53h9cBfsWZDLadlRfGJqsSbrhGUb/hR3Ql1aBN9abnAL09 e84rv+/Hsv7rlX/hl691su0M04mForgLuEkBptr/eQllOugc7Qn/SBJMX8W20EYOEaFc +mWuAzw7kDuMATWNBGj79Grqbu9BphyLT8LdPalhSfM89MG2NS1y9UtKiz2KQn5uokdU T1ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=Avtg8U1a0UTlE95PYdqBdaXhxpdHsz32dmj04jLlbjQ=; b=SQAW9LVYHG9Nxg5QG1JzpHGCvmW9SFdPFzLZE8regtPei9XCk1VYeds1JJuP3wrq1N y1PbgM/JaA7y6nTC6+Fsu3IJf6BYTDCbr+v4ndyyg9dxeKHoLif1nYQMarzVJhJzR2xE /42DUaDugbFA8OX2Y/jPmr/WrfgvYLYiv0uNsgJ1ZRhijxSKXcIiQQZIhWGejFH4sl/Q ywdu1nRvcgCUwsblNIbnFkysElhxyUmrP8RY/0V1G/ROtIrIW8yYizQz2cO0dMyXoSgo PPLlwHbKGAqiHZGxpNzbiB8L4ak4XoJrv3F4WJqQ9SlZJKPhN3FPaogtXyx6mUb6X1le Rd/A== X-Gm-Message-State: AOAM532QpJvHnSmrY8PXKPohelijuVKmvnESqOBv/xBPC/Q7E9HvHqo5 O66xAKle4FlugE/t+ckrj0I= X-Received: by 2002:a9d:1b5:0:b0:605:d7e5:7fc7 with SMTP id e50-20020a9d01b5000000b00605d7e57fc7mr1333133ote.14.1651322214128; Sat, 30 Apr 2022 05:36:54 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v23-20020a4ae057000000b0035e9f149b90sm1829877oos.3.2022.04.30.05.36.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 30 Apr 2022 05:36:53 -0700 (PDT) Sender: Guenter Roeck Message-ID: <4217c96d-2fe2-fdef-3b15-b5368499f1bf@roeck-us.net> Date: Sat, 30 Apr 2022 05:36:50 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v4 2/2] misc: Add a mechanism to detect stalls on guest vCPUs Content-Language: en-US To: Greg Kroah-Hartman Cc: Sebastian Ene , Rob Herring , Arnd Bergmann , Dragan Cvetic , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, maz@kernel.org, will@kernel.org, qperret@google.com References: <20220429083030.3241640-1-sebastianene@google.com> <20220429083030.3241640-3-sebastianene@google.com> From: Guenter Roeck In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 4/29/22 23:18, Greg Kroah-Hartman wrote: > On Fri, Apr 29, 2022 at 09:51:51AM -0700, Guenter Roeck wrote: >> On 4/29/22 01:48, 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. >>>> + To compile this driver as a module, choose M here: the >>>> + module will be called vm-wdt. >>> >>> You forgot to name the module properly here based on the Makefile change >>> you made. >>> >>> And again, as this is called a "watchdog", it seems crazy that it is not >>> in drivers/watchdog/ >>> >> >> I disagree. It is not a watchdog driver in the traditional sense (it does >> not use, want to use, or need to use the watchdog driver API or ABI). >> Its functionality is similar to the functionality of kernel/watchdog.c, >> which doesn't belong into drivers/watchdog either. > > Ah, ok, that makes more sense, the user/kernel api is not the same. > Someone should put that in the changelog next time :) > Renaming it to "VCPU stall detector" or similar should fix the confusion. Guenter