From patchwork Tue Aug 20 04:35:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suleiman Souhlal X-Patchwork-Id: 13769311 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB36513D2BC for ; Tue, 20 Aug 2024 04:38:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724128695; cv=none; b=klQPORsXn7Ec3JsnXqUVhu6Ej8cmohG+5IUW3goml+XRjyl7qcpPcm+GiVf/zDTeyxM/d77KoL/DIIL2YtOgWRQ9vfAxysCeuDO7Rc9bkAik5wBUcljaNUFrgBGLqgnfEtjSsFOP3tYbaa6LFCRUS1hrccwkBlR4L6VTySR+t1g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724128695; c=relaxed/simple; bh=poG3kBQSpIW+a3CJ5/IyZwN+BzRPc6FZnR04OujsFQg=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=dyYex07o7hubJwaf63th9RE2KKHA3XVQKJsItExxJlsv1BgjwTjg5maRncunMWDSESnBokIGJUvOqATcrxTdDE5weQE0O+SGFW0ywcnbtGPHIEWEgnciIA3uqkpTYeCDrT77O8944GIVngyBTb/0Ym7jy9niIin4s6wIBMy/IVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--suleiman.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=bUC3M/fQ; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--suleiman.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="bUC3M/fQ" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e1159fb161fso7297342276.1 for ; Mon, 19 Aug 2024 21:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1724128693; x=1724733493; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=FKSsf9Lzm9EYSf/AobA/jkSovK0xSmbEfKJnNNfJ50Y=; b=bUC3M/fQqZnqH1rD8fpY3F9qkrAMk0f+EUiXIqH/UVW65QGRQXTOurrRZcvnpmtu4G jgAn5BT8NEUe1al6TBJSv+qYvgV2Wte8V826LErJ96/5DUjhxG2SXsHONgzNvrnAwM95 5sGtSot3OrqbEVvWjOhJxPHNMwhLDZh3hJiBnGTmtYUfM7SAEqRA2so6E3dlNnwJce2P 65urq+d2lfGiqv7fuwGHEbSVr8a+/pjG9OQcj3j77NHRHzc3ly11ah8S3C3vBusadEcr U586u0Iqy08zMYigEKQREx02PBrxG9J2HbvoKmJsHnk7ja2PazqfvMmxCTazc1Ug7lhx /MVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724128693; x=1724733493; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=FKSsf9Lzm9EYSf/AobA/jkSovK0xSmbEfKJnNNfJ50Y=; b=iFKWI4nyKZjfbt0D3XuGz7zy/iDGnAMvfxc0KDYW3+8TmsbJRvIGshZkWmuLr8MCdM Di43OXEe6HQRx7djMIHYnsIYGHScxY0Ln16wlaYkuTXQ2KxTrTDfD4gPXHqMHhnRLUuX pDLGdWOiPBRVD6pKeZBM9F2a07yHJoKyzIqFozStEKTTCeKo2QcOMxmrp1H9gZdDrntR vvo+ycv1bKjqEIcFm/nRVt0MQKCifsRm59M/YLQg2/04F6eGdlmGFNxS0oFuBHizVMIb ZQaE3wCRjIQ0n/M+K7reqE1lK0c2ey+Ojz3yHeVrnQyiheSPXTifh9Qa0hu1OuCk9oGl J5UQ== X-Forwarded-Encrypted: i=1; AJvYcCVMUW+alSie0aPRpRB+O2sTIHy8HTDyOCMCnTw8EWREcdXFIq/nueI+sNCnYF86J1tJ5E4=@vger.kernel.org X-Gm-Message-State: AOJu0Yzuah3XBpog4e8xTPLkd9ZP0v9gDrhMZF72i3U517KzOTUcDcm7 87YAMd2yGLOqxp3zYM4Zjc49S/Q5YhW/RrYD/R+T07wydlJWkfjdhT7l6xdK9P6QG8F5Viy+7q5 +1so+4FuIMA== X-Google-Smtp-Source: AGHT+IFPqwVaoVkfiG5pcO12KiFYHLAsirwex5WI2NFCnwFw7UYHoZ3jKbECokBCiiQpEVBTD1Terc8qaRFOPQ== X-Received: from suleiman1.tok.corp.google.com ([2401:fa00:8f:203:7c18:89e3:3db:64bf]) (user=suleiman job=sendgmr) by 2002:a05:6902:504:b0:e11:7105:956a with SMTP id 3f1490d57ef6-e1180e6c0d4mr23970276.3.1724128692630; Mon, 19 Aug 2024 21:38:12 -0700 (PDT) Date: Tue, 20 Aug 2024 13:35:41 +0900 In-Reply-To: <20240820043543.837914-1-suleiman@google.com> Message-Id: <20240820043543.837914-2-suleiman@google.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240820043543.837914-1-suleiman@google.com> X-Mailer: git-send-email 2.46.0.184.g6999bdac58-goog Subject: [PATCH v2 1/3] KVM: Introduce kvm_total_suspend_ns(). From: Suleiman Souhlal To: Paolo Bonzini , Sean Christopherson Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Chao Gao , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, ssouhlal@freebsd.org, Suleiman Souhlal It returns the cumulative nanoseconds that the host has been suspended. It is intended to be used for reporting host suspend time to the guest. Signed-off-by: Suleiman Souhlal Reviewed-by: Chao Gao --- include/linux/kvm_host.h | 2 ++ virt/kvm/kvm_main.c | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index b23c6d48392f7c..8fec37b372d8c0 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -2494,4 +2494,6 @@ long kvm_arch_vcpu_pre_fault_memory(struct kvm_vcpu *vcpu, struct kvm_pre_fault_memory *range); #endif +u64 kvm_total_suspend_ns(void); + #endif diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index cb2b78e92910fb..2235933d9247bc 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -5720,6 +5720,15 @@ static void kvm_shutdown(void) on_each_cpu(hardware_disable_nolock, NULL, 1); } +static u64 last_suspend; +static u64 total_suspend_ns; + +u64 +kvm_total_suspend_ns(void) +{ + return total_suspend_ns; +} + static int kvm_suspend(void) { /* @@ -5735,6 +5744,8 @@ static int kvm_suspend(void) if (kvm_usage_count) hardware_disable_nolock(NULL); + + last_suspend = ktime_get_boottime_ns(); return 0; } @@ -5745,6 +5756,8 @@ static void kvm_resume(void) if (kvm_usage_count) WARN_ON_ONCE(__hardware_enable_nolock()); + + total_suspend_ns += ktime_get_boottime_ns() - last_suspend; } static struct syscore_ops kvm_syscore_ops = { From patchwork Tue Aug 20 04:35:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suleiman Souhlal X-Patchwork-Id: 13769312 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 88202148FF7 for ; Tue, 20 Aug 2024 04:38:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724128699; cv=none; b=ByEiONeGC0JCP7bsaUq73ugAb0+yho71LzD41KTS2vgzw8/Ln2cMYRL5IT31/dJ/YdKeD8DIm5WejIKtpH5IK6Id2v5arsa+MRZItH2Pj3VQxQdcZS9QG0h7aZkrh8y85d69FHUNrZ6fNeBEbiEYjUBUg2sU4r08VA6kJ/2DUH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724128699; c=relaxed/simple; bh=ImKLYihAGgQNZ/oanLjd47JquPgT6FVsGy+myZKO39w=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=AWKgcfdKaDttK4jF/OdBhIeo7MqJi4Kje+z/yeb+Ek1IyPN/XAIQdjONxpnHaKLCTJydaaA7/sHUkrxieWy7zg0YME2jAUZmuh+hSFupOcWr8o4vN5IyTuwmTUZ2Kvdc0pJFuz37mSzppLlAkZG3lgn81rNdOVrRpNYPUOjAG70= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--suleiman.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=10kIfqLQ; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--suleiman.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="10kIfqLQ" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e0bcd04741fso8490201276.2 for ; Mon, 19 Aug 2024 21:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1724128696; x=1724733496; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=5TZmmuMT9WUBBRzzYYXG22ftk/TTrrT11BrmS5ZBbdU=; b=10kIfqLQes1O13GioGpSnKp+rIEBS3MZymAGGiIS4+O+JuP1efMi/3W6QTwqfIAp13 UNK3ta5A2BuNtFVZg+lZmh3EG+/XNT0qBJbqIEJEi4o/GJNtWMI2Jre68qBZ8oMywC1z 7tYlBstOF3AzD9euvPu1YLhT0hD2mgLogGEyDVRWnR7R+husIhuw9+NeOe2QTF8CCMl4 ootXaW39oCa4Egh/N1oVzPMkrdR1iIm/UtktuFizaQwvvzSX3fdoo8miDZD8xArWWphM t7hgtjps/cnAmCqWpKjBYRt7rSu7gTLc7eFj6CvLl6INXrKiG9QRb74I4/EOc2SahSZj 1Y2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724128696; x=1724733496; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5TZmmuMT9WUBBRzzYYXG22ftk/TTrrT11BrmS5ZBbdU=; b=LwjlDTJfo6JF3mzkqfdlYdf2VfgZ/yOevZTMr1Rvo4d1KQvKTcvMyrhkNcr5gTUxJN wyse4/o63UIYeY3SCew2ATbyXlwPU2bX26d7yldX2cQm+UpV2oNYfb72R5X71BpfFoQ0 2aWEk34y4F5wx8fxBYCQGpAmKtlGLY1If7c/nufwsPHjClZ2vmqC0HfwYdevDWvhHbah d9Z5aPZHxP5jMP/Vu8uArJz2EJUfCHVkOAT7DaMx6T1mBFEmJnAGkTP/gN8d4u0Oarud KzB/dpLS/sFfxllmd0iKsYmTOAsRtu2aZPOHjGduIPZ7qRBz5wImppJXSuQNqVtmwqVk 23/w== X-Forwarded-Encrypted: i=1; AJvYcCW1tgjxHChaem2XrxWKyWrfmz7/CdKWx6zwn3l64+ju5aGUyjfdaHudd6kQzZBMKDXhuTpJWEBnJoDzdH+9ILzRZihY X-Gm-Message-State: AOJu0YyDcARdhg5rX7BKbKJTr5PVYdUF7IwRLvwZIhGAQV50pwKN64+L OhUmnflj9Fhv1LKoGcZm1IxPOnXrhRe7YfXBBMPZPdQ0bnuvJmOwwxrC2uG4WE/uYhSvBHUg1YW On7lA+siHYQ== X-Google-Smtp-Source: AGHT+IFko9TuAg/fFH2b16tsE1En7DdlM8+lW8euXc+4FXbWb9LNWhThz2XFNutJecp7dklcYDTE0EbtT0+y8g== X-Received: from suleiman1.tok.corp.google.com ([2401:fa00:8f:203:7c18:89e3:3db:64bf]) (user=suleiman job=sendgmr) by 2002:a05:6902:14d:b0:e11:7112:6b9b with SMTP id 3f1490d57ef6-e1180e625a1mr258826276.3.1724128696422; Mon, 19 Aug 2024 21:38:16 -0700 (PDT) Date: Tue, 20 Aug 2024 13:35:42 +0900 In-Reply-To: <20240820043543.837914-1-suleiman@google.com> Message-Id: <20240820043543.837914-3-suleiman@google.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240820043543.837914-1-suleiman@google.com> X-Mailer: git-send-email 2.46.0.184.g6999bdac58-goog Subject: [PATCH v2 2/3] KVM: x86: Include host suspended time in steal time. From: Suleiman Souhlal To: Paolo Bonzini , Sean Christopherson Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Chao Gao , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, ssouhlal@freebsd.org, Suleiman Souhlal When the host resumes from a suspend, the guest thinks any task that was running during the suspend ran for a long time, even though the effective run time was much shorter, which can end up having negative effects with scheduling. This can be particularly noticeable if the guest task was RT, as it can end up getting throttled for a long time. To mitigate this issue, we include the time that the host was suspended in steal time, which lets the guest subtract the duration from the tasks' runtime. Note that the case of a suspend happening during a VM migration might not be accounted. Signed-off-by: Suleiman Souhlal --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/x86.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4a68cb3eba78f8..728798decb6d12 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -898,6 +898,7 @@ struct kvm_vcpu_arch { u8 preempted; u64 msr_val; u64 last_steal; + u64 last_suspend_ns; struct gfn_to_hva_cache cache; } st; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 70219e4069874a..104f3d318026fa 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3654,7 +3654,7 @@ static void record_steal_time(struct kvm_vcpu *vcpu) struct kvm_steal_time __user *st; struct kvm_memslots *slots; gpa_t gpa = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; - u64 steal; + u64 steal, suspend_ns; u32 version; if (kvm_xen_msr_enabled(vcpu->kvm)) { @@ -3735,6 +3735,14 @@ static void record_steal_time(struct kvm_vcpu *vcpu) steal += current->sched_info.run_delay - vcpu->arch.st.last_steal; vcpu->arch.st.last_steal = current->sched_info.run_delay; + /* + * Include the time that the host was suspended in steal time. + * Note that the case of a suspend happening during a VM migration + * might not be accounted. + */ + suspend_ns = kvm_total_suspend_ns(); + steal += suspend_ns - vcpu->arch.st.last_suspend_ns; + vcpu->arch.st.last_suspend_ns = suspend_ns; unsafe_put_user(steal, &st->steal, out); version += 1; @@ -12280,6 +12288,7 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) vcpu->arch.arch_capabilities = kvm_get_arch_capabilities(); vcpu->arch.msr_platform_info = MSR_PLATFORM_INFO_CPUID_FAULT; + vcpu->arch.st.last_suspend_ns = kvm_total_suspend_ns(); kvm_xen_init_vcpu(vcpu); vcpu_load(vcpu); kvm_set_tsc_khz(vcpu, vcpu->kvm->arch.default_tsc_khz); From patchwork Tue Aug 20 04:35:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suleiman Souhlal X-Patchwork-Id: 13769313 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 294B914A0B3 for ; Tue, 20 Aug 2024 04:38:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724128702; cv=none; b=nwKDvOos5oilKqPxzGmqAxXMy5q0kxDZ+ssJ3jXLQcT4+qWFdvLRwPjynINRRUDa5EegM8eBqWnloeDszPMTPZEu6pFohQHLW7IiXqXiVdbMicsXGSG6G1TQ+KervmoMCquZIJiBGx09N8BaqV/WX7/utcbarhkIb3lgi8XMIL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724128702; c=relaxed/simple; bh=KhyS8lX/LLl+hyGdd5SPZp0IVwMMSQOPguoeq4EtDCE=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Cc:Content-Type; b=VGqe3ULf6/NTtmPigCc224/ImzP+IJT6ySFzH8YR3/TzePCZZt5vKw6lfBDp80wNQB1VocO8D//E4IpB5FwMw0jY9veecdeKRZEIIGNFU7KWrafGDxMfF1yb8vfCphUkn046fupYeIZZAPQ8+hOSot2MP1SAP9SpPE7L4RAnEvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--suleiman.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=uCCXfjgB; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--suleiman.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uCCXfjgB" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e1159159528so4143425276.1 for ; Mon, 19 Aug 2024 21:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1724128700; x=1724733500; darn=vger.kernel.org; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qNDCnS5K1Pk0TOt/H51ksBrj3Ct5dgsW0PJU7Ovd3Rk=; b=uCCXfjgBzVuteMgqdMXJx92VAvJF6+8ibKqLjoU1HwfZwCmM7c9l0df1eTOVXfAvfv OYJ5hTuvWQO/Z3+po1SJ3U/lNv4MU3P/xkpzc6ncfAIihGyTD6SHhPlJeOOjUpP0yMph Tz6jsg9pOt6S64DfqAL2Nh39fcpBd8zAwphEpr4jcbYyMm+QgtmbhXNdgxstcWhjQX8E gTPsuJol+FQFM6QkneM/FQqvquPDjs00qJSuSZAXNd12+C0K9q7IjOjECKjLsX/zkFkt DAARrczHqEoxNzIjevqCMQzXK4KT+PzwJJjMNgOeIln2mcWE6ZU/M839sss/tpW3IVi8 ST8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724128700; x=1724733500; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qNDCnS5K1Pk0TOt/H51ksBrj3Ct5dgsW0PJU7Ovd3Rk=; b=EXyBXuodoLlyzdh53x2P4zibI1Qpd4XZVwJ9vBwBhbkJT3D4CSzJo4spXGovQY0xdQ gRg0jzHBqNxb7TFY3qwETXcUO8O1OFB25J40uvdpVWVthLcP3IsRFqbFvF2PTD2jI/V2 MTB7hACYeBQgrHjvyGVCDCYRb/g1Aaaj8cSFZZ9zsb/2aJvTaWVqymD5zgVCJaQwjW1g f5rLWOGpqWa+bFyYj6QGZpg+u/E1mn3iSUSW7uIpi5TIMCCL8HJyfgjOt/io5D+n/Oby pHFCkaXVdkG4KuFujkTIO+UYb8R8xN7yOKNHCM8dVmDbtuGPiaos82X45D7MlEv+7yNh Dbug== X-Forwarded-Encrypted: i=1; AJvYcCVir811CYcAeLCarc9yeBTDtuglGHb/zHqf7JJ81uKI3MRgbuXwjZ1dwjzPsTs+EfUVPG8=@vger.kernel.org X-Gm-Message-State: AOJu0YzdWTbZBVTwBjOdQHHqEQYQ/Zl+nqRTxpsOBDi6g5K39cP9j5y9 vHvAxgMNGVA4Htlcvm2kH4Q/DaCU8qkZJ2qBmRYOYX0mYbc4wTg+7g6HHNbdrKg++Y7GN4ngQYv 2xRtTdhaugQ== X-Google-Smtp-Source: AGHT+IHPhKfnyXpFhVq0R4vg3+eMT/2Vl0KfVD5sy7EldgzlYqzQx5123h4uD0zjvjOy+hF0Z61eezyg0WQfwg== X-Received: from suleiman1.tok.corp.google.com ([2401:fa00:8f:203:7c18:89e3:3db:64bf]) (user=suleiman job=sendgmr) by 2002:a5b:207:0:b0:e0b:acc7:b1fd with SMTP id 3f1490d57ef6-e164a9cecccmr57101276.4.1724128700014; Mon, 19 Aug 2024 21:38:20 -0700 (PDT) Date: Tue, 20 Aug 2024 13:35:43 +0900 In-Reply-To: <20240820043543.837914-1-suleiman@google.com> Message-Id: <20240820043543.837914-4-suleiman@google.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240820043543.837914-1-suleiman@google.com> X-Mailer: git-send-email 2.46.0.184.g6999bdac58-goog Subject: [PATCH v2 3/3] KVM: x86: Document host suspend being included in steal time. From: Suleiman Souhlal To: Paolo Bonzini , Sean Christopherson Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Chao Gao , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, ssouhlal@freebsd.org, Suleiman Souhlal Steal time now includes the time that the host was suspended. Signed-off-by: Suleiman Souhlal --- Documentation/virt/kvm/x86/msr.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Documentation/virt/kvm/x86/msr.rst b/Documentation/virt/kvm/x86/msr.rst index 3aecf2a70e7b43..81c17c2200ca2f 100644 --- a/Documentation/virt/kvm/x86/msr.rst +++ b/Documentation/virt/kvm/x86/msr.rst @@ -294,8 +294,10 @@ data: steal: the amount of time in which this vCPU did not run, in - nanoseconds. Time during which the vcpu is idle, will not be - reported as steal time. + nanoseconds. This includes the time during which the host is + suspended. However, the case where the host suspends during a + VM migration might not be correctly accounted. Time during + which the vcpu is idle, will not be reported as steal time. preempted: indicate the vCPU who owns this struct is running or