Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp733304lqt; Fri, 19 Apr 2024 08:51:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVRIsn6ImtRYEYd2ra1YubmuWrnegktQviC16St22to/P/0YpA4sAoTvEMx3fAugoLEaOi9B6/VYsKkjzdeDi9+XO1h0mf4TsiMyqlXjw== X-Google-Smtp-Source: AGHT+IH8aq5EE0opLblYP1yTnpnNkj0Rctv7SJNQJf/b7dskB792rq1li9mEaG90gh3iJ62Z4mn/ X-Received: by 2002:a17:902:6508:b0:1e4:4b50:1b0a with SMTP id b8-20020a170902650800b001e44b501b0amr2655258plk.44.1713541893728; Fri, 19 Apr 2024 08:51:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713541893; cv=pass; d=google.com; s=arc-20160816; b=pBdZ7sURCPswxZpk8VrNcWOE4XrcKp8XQ6ZAfMcbi9y1ngw6CsepxxF10WgiuSpp3c 9GyAgZDlQ1dAqH7sRrNyoNcuS1LWThLJlp8c5wnCkAFZH5GMojYUPTjlKNO8lXr1ksgu l608kidNTLGqqLYoFuuJUjDsz36e2J1y0Esm8O6Us8PHUcnBBPlGrUYB1nmK6edyCGV3 HlJ+IO3TtBl+LF+dEBj0OLdllIXvcg0d+xjSQehkJ850qtZejdb3j7CTZZ/gBDooAGA9 Q+T7pNcjRnvYgo1uvXjusgRc8Ag8HeJ1OhJhxcXoBD0N3vf3wZUaGzqGGYH6Kw4Q3dZ4 /jbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:content-language :references:cc:to:subject:reply-to:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :from:dkim-signature; bh=XTjTrX8k/OV8D/4FwhpKGos9bwoXHtumU35pP/xvPFY=; fh=7nUYsaK6XZ/7DKRM/D6EH/dTSQ/gGOSqJ1ShKjT6JW4=; b=jjdhGPJkduBAQdAr/FKZj8zizXjvUXswgOXd/TDluSRHSKbeGurSVZOceLk48CKzyp ytUrZExxfsWqFTPYm8V1KAgGPuI5PvQsjdTTEXkGpT4AC0WINVqAKFxahvIIsWXePC3J qoRsBHamrHjbqaaaLv3FQbTqqM6q2GgVvsxYct1DqSqP4Rw7Ry1Rd932hF0lrd5NxfiN k+zlho2ojJdfYYin+ex/zGriPPsA7PheO0jghktC1gliB8iMV5TMX5iEKfCGyO57jazR eaXkWmHHaQ2sY3RUZnR3aLwwMomR19YPgfzhyzgs5cpSLVckHlWGV6EWwcyXpBK8FAvw Ybjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=e9+9WSiP; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-151705-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151705-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k14-20020a170902ce0e00b001e905195d0esi299277plg.89.2024.04.19.08.51.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Apr 2024 08:51:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-151705-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=e9+9WSiP; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-151705-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-151705-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BACE3B23118 for ; Fri, 19 Apr 2024 15:50:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1E077131BBB; Fri, 19 Apr 2024 15:49:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e9+9WSiP" Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 AA84B130AD3; Fri, 19 Apr 2024 15:49:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713541795; cv=none; b=qwKY/WrIa/x/KibvROiHLIGs8oUJdZf7n9VFj8A7djTxaCrt1wXykdE3F57ROE/PgfcMGVGO6R90lDDafJvzVKWarKvlFH7peLKtr2vsx81H6LXP8VaxxOJLgdwmP+LdzKlTyPu+XBIokyzI27KvV/xK+jOLrmFcthbn2O+Aluw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713541795; c=relaxed/simple; bh=3RFiDxez2acLIv9fQtWjSUCFeGh7FTIM9bGr4s+3eCI=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=qUSxvHI/1CW5KB3KQjEujEF5T0YlJg1bAj1W31iANjLrX3IMCHhz9xLrvw89l0we/B7qUxkZtEATfKfxSIGNpEq7i73RbtT22G9t9S4ODNCQP9Ae0/ElATczoYSacrscqGHTdaEYSaoi0OneMi8GKrGJsEex47HPifOZYEPFihM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e9+9WSiP; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-516d1ecaf25so2852118e87.2; Fri, 19 Apr 2024 08:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713541792; x=1714146592; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:content-language :references:cc:to:subject:reply-to:user-agent:mime-version:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=XTjTrX8k/OV8D/4FwhpKGos9bwoXHtumU35pP/xvPFY=; b=e9+9WSiPH9Xp00OMES6T9bIfFbA+p4XB4/aF18gPHZtaoqHUMrI7ENdSb/9riIad4t 4g2X6iwSeAeOP7Ep2RTxWmcVP1ASFCkmIlnVXFbVzfnho5Bio4wS/cey1wPXP/Vmw9ag O7q2iXVpnbOuAzhIqNL7ORnq4L7KrKEefuQT9XxEWldIrT745qkcQOLAwDBYn1WWlUMQ zypBi94DBiT9THsrMYxGh3y7rzpy2RiXjeG84i7ybbcbvMWQOeF5O/BKn4sp7duBWqe7 u9P6kyNUA9YvW5N3PIr9+y+cgdWw2BrA20TPcov+OuaN0k87J1gqdx3uSZjy36tSStKT FnHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713541792; x=1714146592; h=content-transfer-encoding:in-reply-to:organization:content-language :references:cc:to:subject:reply-to:user-agent:mime-version:date :message-id:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=XTjTrX8k/OV8D/4FwhpKGos9bwoXHtumU35pP/xvPFY=; b=CQLwrxZosoD/E56Z5dKVgl6xwxSFklpQO8kJN6zQiZ6VXu56+AS5hEN8+wD2hxr0oe vUrzdP5sfGT5Yv3xkIW30G7tL9Cn18sm/6C9otQ7tmyBcf99vujx9rXeKAjLVzocznso 8Hrq4ecMcLiTaGms7Iw1y/2wy23R6Y2L+FnFLArqUkAOHmcY41HCBH3ssn3TuZGb/aTf GnPGb/1LDGJIUyocWaUH1QJIXJWzy45LPCIcV5e2UCNDuA+MSd+chyaDKeCjPwWAktz6 XwFw/0oSbzvHUKUwRG2OpNBU68DkENaP9yMTmOQFHnUfILM1eslmkJbIEvp2gBhLR/eR TEig== X-Forwarded-Encrypted: i=1; AJvYcCVN42plrEqGTrBo0+3xrrvb3ZtOAvLjNMGSTTGJTZef43naQrEgK6d5FNWq7kl+elJMJleRAejVXvqPkx/yRo7K+Yt4wcuJdeXbzNd/Qp8ffhoDWPTog1Jg2rV2yTatv1bcoRPa+mUNclA57OYhAOWFdrWar8hcJvUQSvdFiGizHZjIcHqKN3FOKCDS/KiqVFzLv/oWIFYaCjZpPl44 X-Gm-Message-State: AOJu0YxGZDJ79oCFyXmgjfgRfPGOo2cqnBOz7BYzUzJSR4I84I5sAoje Fgwf6/7lQ9jOEBR/eBe56dm5nfY3BsCaR+glqKF8nowFqIu9j9/Z X-Received: by 2002:a19:7501:0:b0:516:a115:4a4d with SMTP id y1-20020a197501000000b00516a1154a4dmr1601293lfe.68.1713541791631; Fri, 19 Apr 2024 08:49:51 -0700 (PDT) Received: from [192.168.18.253] (54-240-197-236.amazon.com. [54.240.197.236]) by smtp.gmail.com with ESMTPSA id t8-20020a170906a10800b00a4e253c8735sm2357376ejy.52.2024.04.19.08.49.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Apr 2024 08:49:51 -0700 (PDT) From: Paul Durrant X-Google-Original-From: Paul Durrant Message-ID: <21bc05cf-0227-4d57-8cfa-81097b95535b@xen.org> Date: Fri, 19 Apr 2024 16:49:49 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: paul@xen.org Subject: Re: [PATCH 06/10] KVM: x86: Add KVM_VCPU_TSC_SCALE and fix the documentation on TSC migration To: David Woodhouse , kvm@vger.kernel.org Cc: Paolo Bonzini , Jonathan Corbet , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Shuah Khan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Oliver Upton , Marcelo Tosatti , jalliste@amazon.co.uk, sveith@amazon.de References: <20240418193528.41780-1-dwmw2@infradead.org> <20240418193528.41780-7-dwmw2@infradead.org> Content-Language: en-US Organization: Xen Project In-Reply-To: <20240418193528.41780-7-dwmw2@infradead.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 18/04/2024 20:34, David Woodhouse wrote: > From: David Woodhouse > > The documentation on TSC migration using KVM_VCPU_TSC_OFFSET is woefully > inadequate. It ignores TSC scaling, and ignores the fact that the host > TSC may differ from one host to the next (and in fact because of the way > the kernel calibrates it, it generally differs from one boot to the next > even on the same hardware). > > Add KVM_VCPU_TSC_SCALE to extract the actual scale ratio and frac_bits, > and attempt to document the *awful* process that we're requiring userspace > to follow to merely preserve the TSC across migration. > > I may have thrown up in my mouth a little when writing that documentation. > It's an awful API. If we do this, we should be ashamed of ourselves. > (I also haven't tested the documented process yet). > > Let's use Simon's KVM_VCPU_TSC_VALUE instead. > https://lore.kernel.org/all/20230202165950.483430-1-sveith@amazon.de/ > > Signed-off-by: David Woodhouse > --- > Documentation/virt/kvm/devices/vcpu.rst | 115 ++++++++++++++++++------ > arch/x86/include/uapi/asm/kvm.h | 6 ++ > arch/x86/kvm/x86.c | 15 ++++ > 3 files changed, 109 insertions(+), 27 deletions(-) > Reviewed-by: Paul Durrant