Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp430864lqa; Sat, 27 Apr 2024 08:01:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXi1qhxi7Gtz/6Tj95BpnwOg8SX1jhRnzJAteQMiOBAEgKWIGQKjBVc284AwZrNlqJoJ5QRaA+KFhcrJ5wLp+w0pG53AtWpt2aIxJ5m2w== X-Google-Smtp-Source: AGHT+IGWtu7hI25v40fpkQUFOiv/Vo1dfJe19TR93nGA3YSIfDD7VDcZvXjFDO04EOEdSEjxKmSz X-Received: by 2002:a17:906:1950:b0:a58:9899:89ab with SMTP id b16-20020a170906195000b00a58989989abmr4854284eje.22.1714230108694; Sat, 27 Apr 2024 08:01:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714230108; cv=pass; d=google.com; s=arc-20160816; b=aHnO4uJif6jMEOjf3MWz6/Douh/XYkX3cLLLWqauPNCg0sgcQTKFiDoBZC/JjdnbVz JZwQ8xBCm8C4jdgllyNBzLdCGFEn2roRA3SREo+9VyRvk+KXdkUjj+UZBWuOUMmUmyDq JHfbg3ARatlzOF5OtOcgZTdve6ecaCAo9boppni2ttfetVbkgIwr8hnJlsC2q3W0Jxk0 PUb8WSA6O5aY6n5Dzt7C+ug6i738ULaBF7/4YxRrJO7SyIqRj8zx157+JM/UpkFBfM+C GkUuBBeSrBbZAXpxrQck/LBMrLTkJ0j2QGmAY9c2KpV9zOydwHnAeMPW52RPcMTMVNQz FI3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=U35TMzdrNli2izCJdFnYbyRs0V77OD2PqLViAcJYq/4=; fh=GxGcIBasQq2Gc/176mTrpEex7eS1coPy2FlYCD7Qc50=; b=lsp/ieYGYcUxyg1wVf5upQUNPCSLQDCeuNoADeOrd2ZapEM+pZufi0TCIsDTmd8pbo 7PPKMUJS0K4modj1Bngx1fgW3VcPZnCoEjoa/R0kfQAbOq/nfY11MCMh8FA2u2jhu2Vm 5tVT5ccc2V8SA+Ke5ess06rrLLbQAXb2nXnjxnU+aB5AVe7f6OnVQzsbSGjeet8+ZsTR XgQMUxFeJclUOHr0rFKxQ6leccREdrb5tPbuVNvheJ8q+NmbDlKF/3xwn9MNlEXw3tap yT/8qJW51TUa5hGI26Ct+XXkVqxi0Khtqu7S9ZpjFChNrbqdhGk+8uZO+oW3OfdlQj5W bK7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=hxO5U5xo; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-161025-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161025-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h20-20020a17090634d400b00a58eda75131si381326ejb.475.2024.04.27.08.01.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 08:01:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161025-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=hxO5U5xo; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-161025-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161025-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id AA2B91F24A70 for ; Sat, 27 Apr 2024 11:22:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 708815026D; Sat, 27 Apr 2024 11:21:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hxO5U5xo" Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 178224D9FA; Sat, 27 Apr 2024 11:21:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714216888; cv=none; b=rn/cSXmMytuQ7c9WMbW7WTBNWYBI8JswE84ZoYPXUm9Bp533Q2vt5qeOiIgZZ7yI9l8rPfA2pwLyYs/uXrJuLgHmo/xAOAav8GNONnDipr4xCRehBukUzZ6YWrGPlIXcdXY3/x5h4HNqGlD0bCTbOPy4w9e1bLB1TtS4tdNFH10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714216888; c=relaxed/simple; bh=q234AdlrqFb6gEgXej3Qyt4lhLROvR6uaavVzSiG6sg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ofbFpNGGzYYJev88XevNeDsK3dXizRiUnPlhjHEtXIZAe/tc1kfCLATNo6XUzsxxh1b9rWjGhvrwWRmOYqXdbE/j0jEcDmVt2ZM00p7asn9j8MHoygpv9NosSRPBLeOBSIN96L1PZ7/mX0P3V/3PKHANmmxwzPeAfcIEKilp4/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=desiato.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=hxO5U5xo; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=desiato.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=U35TMzdrNli2izCJdFnYbyRs0V77OD2PqLViAcJYq/4=; b=hxO5U5xofonRRT6DH2IqMSnsZg EcjO9Z8XG5e3WWqCQhtBKrT4Ih4VcwnV71BtwC5t2Kdfx5LwM06LNUSSB/uEB2rUc3qd3sBpPjgFo 5W70XvRfCwgsiEv4Gubq6SFoV+fUpbhx9ad/aGzcd2cKFDK12PcoHm3C7fowtqBBG9N3euu2SFe/Y l+EW8Si2Z2TEoxPhIDfhUD8suRrYzxwQI/Cm5GVNKKNJz0bbpops0eoTmWlMw6rtvz2xYAQeXwrKC xw6bNP+sHOfOgP6FshXSFGhuuj7I5bbv0B4CrEIHNME8nIaU6663y/RsGLvLPVr8HzDWo+6HoWToP whoN/a+g==; Received: from [2001:8b0:10b:1::ebe] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0g5i-0000000FeZj-0p1P; Sat, 27 Apr 2024 11:20:54 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0g5g-000000002bo-2LwR; Sat, 27 Apr 2024 12:19:36 +0100 From: David Woodhouse To: 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" , Paul Durrant , 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, zide.chen@intel.com, Dongli Zhang Subject: [PATCH v2 13/15] KVM: x86: Kill cur_tsc_{nsec,offset,write} fields Date: Sat, 27 Apr 2024 12:05:10 +0100 Message-ID: <20240427111929.9600-14-dwmw2@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240427111929.9600-1-dwmw2@infradead.org> References: <20240427111929.9600-1-dwmw2@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html From: David Woodhouse These pointlessly duplicate of the last_tsc_{nsec,offset,write} values. The only place they were used was where the TSC is stable and a new vCPU is being synchronized to the previous setting, in which case the 'last_' value is definitely identical. Signed-off-by: David Woodhouse --- arch/x86/include/asm/kvm_host.h | 3 --- arch/x86/kvm/x86.c | 9 ++------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index b01c1d000fff..7d06f389a607 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1354,9 +1354,6 @@ struct kvm_arch { u32 last_tsc_khz; u64 last_tsc_offset; u64 last_tsc_scaling_ratio; - u64 cur_tsc_nsec; - u64 cur_tsc_write; - u64 cur_tsc_offset; u64 cur_tsc_generation; int nr_vcpus_matched_tsc; diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 6ec43f39bdb0..92e81bfca25a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2737,9 +2737,6 @@ static void __kvm_synchronize_tsc(struct kvm_vcpu *vcpu, u64 offset, u64 tsc, * These values are tracked in kvm->arch.cur_xxx variables. */ kvm->arch.cur_tsc_generation++; - kvm->arch.cur_tsc_nsec = ns; - kvm->arch.cur_tsc_write = tsc; - kvm->arch.cur_tsc_offset = offset; kvm->arch.nr_vcpus_matched_tsc = 0; } else if (vcpu->arch.this_tsc_generation != kvm->arch.cur_tsc_generation) { kvm->arch.nr_vcpus_matched_tsc++; @@ -2747,8 +2744,6 @@ static void __kvm_synchronize_tsc(struct kvm_vcpu *vcpu, u64 offset, u64 tsc, /* Keep track of which generation this VCPU has synchronized to */ vcpu->arch.this_tsc_generation = kvm->arch.cur_tsc_generation; - vcpu->arch.this_tsc_nsec = kvm->arch.cur_tsc_nsec; - vcpu->arch.this_tsc_write = kvm->arch.cur_tsc_write; kvm_track_tsc_matching(vcpu); } @@ -2825,8 +2820,8 @@ static void kvm_synchronize_tsc(struct kvm_vcpu *vcpu, u64 *user_value) data = kvm->arch.last_tsc_write; if (!kvm_check_tsc_unstable()) { - offset = kvm->arch.cur_tsc_offset; - ns = kvm->arch.cur_tsc_nsec; + offset = kvm->arch.last_tsc_offset; + ns = kvm->arch.last_tsc_nsec; } else { /* * ... unless the TSC is unstable and has to be -- 2.44.0