Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp135575lqj; Wed, 10 Apr 2024 06:27:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7vwsAgUqCwZ/spP6bhwPm1WIncRecIr18973exGn7zKkYMU4GSl3L5xE4prOvgdPQO6lgKaNX4R4C4jGTpinVA/sX2pEUfzMvcEJClg== X-Google-Smtp-Source: AGHT+IHRhXecG/FKRT4t6R/rs/l0YQuyW+Df6GL6ccmpamL8mNmtKBpbYx894HsM2iz6BUa3Vz8N X-Received: by 2002:a05:620a:22c4:b0:78d:68f2:11af with SMTP id o4-20020a05620a22c400b0078d68f211afmr3454701qki.23.1712755636307; Wed, 10 Apr 2024 06:27:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712755636; cv=pass; d=google.com; s=arc-20160816; b=vlckPsKBkWs25CwIMc+qjKg/5Cw2OiJLMt1ilo6UN/Q5Kfdmx6sB8weZyE9gA/7iCU FP5DFNut1cieufvPVBdrLCHgettktVvFegymjUmxu+XpXXU5TN+3hVodIVF15hfqXe2U AuCgV2kjn9YIngQCI4BuCpz/C4dri6Q31vh6uPuQS05R2Qm4PN/LuMqh2fliIDGS2vsv v+MibVaHeOp4VrRBZEQaHV8uOOl+Z5ovZKdcffUBJscepDxos5duKK8iUWY+x0Gyp4LY j7AY4a38Curtkf4JV1cyuzKqzJFOkMx6H+GtMjCwAQCa/Iw+APv54j08mQef4jNR0XzU p1mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:references:in-reply-to :user-agent:subject:cc:to:from:date:dkim-signature; bh=T3LuN1qZGAG1mn2CrH18sNzVhvy7sMk/dlTCxB4L9Uo=; fh=h8dKdDfIhU9za8lnNK+xaH7d7JhEKk7+mXX930nCzv8=; b=FLZBrxj6bsKN8LuQjPCKQtR4724egV3jSdhpg+N5oN8YoiwoxwNWpQu+pcWfZPnhoT 1GB6Je6erfWCJMxcHz+CIpJtgFUfwe9crka6uthjE0zTIaQZHmZSVjMxka49h5B3eRy2 nDl+qv8POf774dHkQwEtWe5F1vb9O/XNF31NUwuy4+QPVA3/lC88hd+aL3SPB1C9xvwy FtsRneGuLWs1ELWeV5wQo6yM41jC9wi6TPQ9RLFvkm/3nbs+U1x2hGcLZzPYHAkGbKFu oHJQhE9+kX/rIUy58Gb96F3W9vKrOVcH7QiAifGBZRkoBd1SweN7G9yMvvTXvVWwnOek qqHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UETbghUH; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-138472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138472-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x15-20020a05620a098f00b0078d723b17d2si3169226qkx.585.2024.04.10.06.27.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:27:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=UETbghUH; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-138472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138472-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9941F1C2279E for ; Wed, 10 Apr 2024 12:11:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B81415B124; Wed, 10 Apr 2024 12:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="UETbghUH" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 27F87155395; Wed, 10 Apr 2024 12:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712751068; cv=none; b=O3bMdiosGDFXmJc+bQI/ajaQWZiOYKnGdnr5a63aj/MllHggM9gtLzFww2ABMViqKNiyQLNjVCxVRJpGtPDcL6IwuK7MXTwkEH2Um/BrYUfUyVffF8QzNLBY6ip3xuTN2BtWd3DTOuhu8KGg4k0AelOAGFvhij1bULyA3XkBeKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712751068; c=relaxed/simple; bh=fCXmHu/sj1xLLBtmb9MsJcANXl0QSG8UGKO3OOLOI5U=; h=Date:From:To:CC:Subject:In-Reply-To:References:Message-ID: MIME-Version:Content-Type; b=ZwQWy4IsNZuF6gpYv+Rh5hnVzHIIBQSR6Fp+PdSvcmHit89OJlTj9qg7NXywjzazMtyZ2MNAkIcXIQW3x3SyVou6wKiwJkVM3+VSW4VO5CU9LmOaj9PN7Veyfp+4+8Ecq+n5M2sCGv1bdtySnI0pWl7Mtyulr2XoBDhBIFMKFqw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=casper.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=UETbghUH; arc=none smtp.client-ip=90.155.50.34 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=casper.srs.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:References:In-Reply-To:Subject:CC:To:From:Date:Sender :Reply-To:Content-ID:Content-Description; bh=T3LuN1qZGAG1mn2CrH18sNzVhvy7sMk/dlTCxB4L9Uo=; b=UETbghUHyLxMARcTyfFfhvaPM2 /FF5w/vKOvU0qHFs1OGAhixNnPiOLHtJqaho3k4Pn125svSZA81JdZrnQP2IJR+K4qGRcgTj6CWLj 37Fagij1sLWAuVblPNMlKMc9MmyM5P56iCPsNTWaaJNrbt7qs3YyO9CXd3n4U8iZPwysQqZWsKVrs p8fbVIyicXMTL+FWrCbDCW/21eqejyQ5VUfvrmnE9nCQnGOC1kw8aN7ZOKDXyMLOpBR2XwdwSyeXd 3FXLfFxd6fnTkuVLV7pN0l+DbwMXvfMIuL85owAzkaxs4zGghDeCvcjFkkfC51QULrDv4sK/+jg9P DmUAOGeA==; Received: from [2a00:23ee:1400:1bb8:e7d6:9885:5536:57d8] (helo=[IPv6:::1]) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1ruWmu-00000004Psm-0dXv; Wed, 10 Apr 2024 12:10:50 +0000 Date: Wed, 10 Apr 2024 13:09:45 +0100 From: David Woodhouse To: paul@xen.org, Paul Durrant , Jack Allister CC: bp@alien8.de, corbet@lwn.net, dave.hansen@linux.intel.com, hpa@zytor.com, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, pbonzini@redhat.com, seanjc@google.com, tglx@linutronix.de, x86@kernel.org, Dongli Zhang Subject: =?US-ASCII?Q?Re=3A_=5BPATCH_v2_1/2=5D_KVM?= =?US-ASCII?Q?=3A_x86=3A_Add_KVM=5F=5BGS=5DET=5F?= =?US-ASCII?Q?CLOCK=5FGUEST_for_accurate_KVM_clock_migration?= User-Agent: K-9 Mail for Android In-Reply-To: <005911c5-7f9d-4397-8145-a1ad4494484d@xen.org> References: <20240408220705.7637-1-jalliste@amazon.com> <20240410095244.77109-1-jalliste@amazon.com> <20240410095244.77109-2-jalliste@amazon.com> <005911c5-7f9d-4397-8145-a1ad4494484d@xen.org> Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html On 10 April 2024 11:29:13 BST, Paul Durrant wrote: >On 10/04/2024 10:52, Jack Allister wrote: >> + * It's possible that this vCPU doesn't have a HVCLOCK configured >> + * but the other vCPUs may=2E If this is the case calculate based >> + * upon the time gathered in the seqcount but do not update the >> + * vCPU specific PVTI=2E If we have one, then use that=2E > >Given this is a per-vCPU ioctl, why not fail in the case the vCPU doesn't= have HVCLOCK configured? Or is your intention that a GET/SET should always= work if TSC is stable? It definitely needs to work for SET even when the vCPU hasn't been run yet= (and doesn't have a hvclock in vcpu->arch=2Ehv_clock)=2E I think it should ideally work for GET too=2E I did try arguing that if th= e vCPU hasn't set up its pvclock then why would it care if it's inaccurate?= But there's a pathological case of AMP where one vCPU is dedicated to an R= TOS or something, and only the *other* vCPUs bring up their pvclock=2E This of course brings you to the question of why we have it as a per-vCPU = ioctl at all? It only needs to be done *once* to get/set the KVM-wide clock And a function of *this* vCPU's TSC=2E And the point is that if we're in = use_master_clock mode, that's consistent across *all* vCPUs=2E There would = be a bunch of additional complexity in making it a VM ioctl though, especia= lly around the question of what to do if userspace tries to restore it when= there *aren't* any vCPUs yet=2E So we didn't do that=2E