From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.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 A2F5136AF2 for ; Mon, 23 Sep 2024 12:02:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727092961; cv=none; b=MidmtgqWc1+Ek+rnbXKUT1cZa0Ebjw0o4hc9qNZjF7KfhaFKyR/V6b4zq9IBrAFcIIb/xaT+aRMwNv4TpU1PIhSQoeougktGqUSfTlRSfrgt7Mk9Y7lvz2Ijbm7C4kzshbKvemGFT8ea/548y/JM5vRAe3vZVnf5tMh3PeWrmoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727092961; c=relaxed/simple; bh=IvZUnWEEwtJBrX0C0B8heXZmuNKkdtrz+/xYCRUqA8o=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WpVm472pIDYf3ng4vEKmKkTy036htveM2EdB0jjo6lydXlQjaP1LLvorQe7e3eOi98dAZ92AaEDECOjQlhj/A2/aJwMm2EUHhFkDknSEyNULNIpwJ8gTEqoDNJSWiEXptQZQMc57NS0/40OVgq3Oj2mjW5V4BwxtNm1flaUNIU0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=xwM3n/Ww; arc=none smtp.client-ip=209.85.214.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--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xwM3n/Ww" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-207302f244aso32184815ad.0 for ; Mon, 23 Sep 2024 05:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1727092955; x=1727697755; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=GFr6vxdUJL3MJwqVUaF07T8lI8KCh6OBnGa3LNPrPOg=; b=xwM3n/WwG2vd7Z4p91w5XZ6x97LQaR31QqLG2lAfMjccgifY/KceQC75M8ESkkdbKh szTJK+tPuh00GM/2xCJg1qekjruw9yekBSoRPWA8L9UtGT+kMKLVxG8vjqq9RjpyXvpy 3IsEUO+BQ1qHWHm2AQO7mblXin6Ml8pEIabP0JwPjPSgjkp+Yf+t9CDYQ9mEZ9f77ONd I0xSAVboTBFXXI0gotR0hhxvZMw8KSeaHG+qq75s9pTaTjtBT3z+KlEsT388fpZGKgqy 5jOsa0TEhVqsoOlP9vLsHflCfvt7i7yLAL284QQ1DwhhPw8r0kEpt8pwvY2uNgQ3d8YL g2VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727092955; x=1727697755; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GFr6vxdUJL3MJwqVUaF07T8lI8KCh6OBnGa3LNPrPOg=; b=AMi+GUT/oUa9d+OtDfDjWE12VdhiiLwZjkEvkh2nXGZfqvb7VkwVhas0HLj91ZZwrG fppO7APTI9AamK0i/QXkGMb/dLaovQiwZoErAhZIsyWGMwPnIPQSsgl1+iruMhzV2J6v 9LyMunbEGiHsqX7K5oaL7bYwVuAB0E0MRGksxJmGG+Adveg4j+6JSiWV45AZxfQ6vvpQ yQql5npy25YtN2nIlsAQhpXIe/BGzoee2toPTDCPmqvXfZ75vfTqu+82IVG8tm9RRfl8 VvLImcB5G+zzO/+tnG6+3d3meAyErohEtdkWxZmFsCvu/reuXEHSZsPZIGHpQxzd/oNq 6CSA== X-Forwarded-Encrypted: i=1; AJvYcCXSMSpcVQ1WtKZ6zWJgSb3dKkV/XpMKy0eSpGvxPpJaEWhOOIfgv6jkzIWeAfp7JymB1OwFZmuP5FzvwIU=@vger.kernel.org X-Gm-Message-State: AOJu0YxKuTG4nB4HWCSf4uvV25jV5w0Jy/CW6FFYQc/I4cqadBhryktI dsOECDFuKFh4kN+XpnDSguVwRKqcESbTg3Plk0LhTAX08Lw4CgxyP7DP7Se0m3vBcZSR7Vs21sj dBg== X-Google-Smtp-Source: AGHT+IEzIfiOWVAmnllUJ4P4EA/eChnQTcqs5HjwigF762cm3txY3x/6niburLV6pAX5GE7eUr1i6RUXpp4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:ec8c:b0:205:79b7:b36e with SMTP id d9443c01a7336-208d96f5defmr357005ad.0.1727092954784; Mon, 23 Sep 2024 05:02:34 -0700 (PDT) Date: Mon, 23 Sep 2024 04:46:30 -0700 In-Reply-To: <0288f7f5-4ae8-4097-b00c-f1b747f80183@yandex-team.ru> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240917112028.278005-1-den-plotnikov@yandex-team.ru> <0288f7f5-4ae8-4097-b00c-f1b747f80183@yandex-team.ru> Message-ID: Subject: Re: [PATCH] kvm/debugfs: add file to get vcpu steal time statistics From: Sean Christopherson To: Denis Plotnikov Cc: kvm@vger.kernel.org, pbonzini@redhat.com, yc-core@yandex-team.ru, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" On Mon, Sep 23, 2024, Denis Plotnikov wrote: > On 9/22/24 11:04, Sean Christopherson wrote: > > On Tue, Sep 17, 2024, Denis Plotnikov wrote: > > > It's helpful to know whether some other host activity affects a virtual > > > machine to estimate virtual machine quality of sevice. > > > The fact of virtual machine affection from the host side can be obtained > > > by reading "preemption_reported" counter via kvm entries of sysfs, but > > > the exact vcpu waiting time isn't reported to the host. > > > This patch adds this reporting. > > > > > > Signed-off-by: Denis Plotnikov > > > --- > > > arch/x86/include/asm/kvm_host.h | 1 + > > > arch/x86/kvm/debugfs.c | 17 +++++++++++++++++ > > > > Using debugfs is undesirable, as it's (a) not ABI and (b) not guaranteed to be > > present as KVM (correctly) ignores debugfs setup errors. > > > > Using debugfs is also unnecessary. The total steal time is available in guest > > memory, and by definition that memory is shared with the host. To query total > > steal time from userspace, use MSR filtering to trap writes (and reflect writes > > back into KVM) so that the GPA of the steal time structure is known, and then > > simply read the actual steal time from guest memory as needed. > Thanks for the reply! > Just to clarify, by reading the actual steal time from guest memory do you > mean by using some kind of new vcpu ioctl? No, I mean by using the host userspace VMA to read the memory.