Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3585985pxu; Mon, 30 Nov 2020 06:20:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxq0w++9urOfNlFS9iEWjKSHkKQkHhlVh2e1AlmkGeif/gDBVuE6JEcLQlczZlAOeYSj/q X-Received: by 2002:a19:c393:: with SMTP id t141mr10161896lff.529.1606746049162; Mon, 30 Nov 2020 06:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606746049; cv=none; d=google.com; s=arc-20160816; b=XdCgxgrfA8fa5/vHfrWAlBQangwTnIQOw7vPoacxHok/KAlM71qLENwsK9k5zTY7S6 qVCWzsMNNRdllFun/Uno5f5UCmP0jhe5ypjjNERpYl5AFMZXo4583awABS9bfrwP407a 9IphaN1pFI2whXRBG7Hffd+1PvDFTKYQ68y6SJUCUQJYjOA7Svy4WkoLQYGvT0kMJkAy rxDC40E8nj4w9jclzezvtUvsvvnRJK9vqrJGAyDQkqnHKtY8yDb/Z3DMZ6wP+UkrpnNV oSReYYDwEAJlBr9XMRwT8m0Rll4RKFRIXPLuGlcr1xns2f4gEpQCwQuFNQag5DJwVWd0 KpKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Jy2WUd8qluzxUHyAVJZ0iTyH/i+egdeldCJel1aWn4Y=; b=kaOTECgNZeLZUNGlgallJW0FUxfj8RBZojD4soNTE2WlQOLALsh+K/DDN7mLrnrWzP z9FHDWrccgGPKe5PS+ba4ksvXkC3FUgZKrI5m0u55QiIci8OLLe2L0TXJp1PXR/L5i8B h22lWF8vpe65U+znn985dd0g8jI1LU7o6ARl982u1/NL3IAoOj/fJTO8tR1qr8IzaJWy fvg3Eol6Pon4I+4tdWfD/V3XrPC9D9My+FBMbmgx57wrovSElGbW1UKExXfLThC4mmr6 UvwB9BI2h5SORr8qbrOwXTwPxP9UY3m2rsL7jRMTDbT1EpyjTPU8FZes9z4BJyNgh5wG xeRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XDnqifpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k15si10715807ejk.389.2020.11.30.06.20.26; Mon, 30 Nov 2020 06:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XDnqifpW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727392AbgK3OQs (ORCPT + 99 others); Mon, 30 Nov 2020 09:16:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29717 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727384AbgK3OQp (ORCPT ); Mon, 30 Nov 2020 09:16:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606745719; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jy2WUd8qluzxUHyAVJZ0iTyH/i+egdeldCJel1aWn4Y=; b=XDnqifpWWWmEqPhPm1iVO60/JIDzX23/GFgzXvTaYNfxFZgYPSNC5sQAO5VBUijHNwsnic K2mqG1IwzrH+tQPdAwWpTuhZB5FMpgexKys2muyrOIuykIsqNRl6GrM9cAu+qNdsB0fOLJ jXj01XFz0XF1nOG2guGgEuXuUfmhhew= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-255-CR_B_9FKOZmR61IWjvQYjQ-1; Mon, 30 Nov 2020 09:15:15 -0500 X-MC-Unique: CR_B_9FKOZmR61IWjvQYjQ-1 Received: by mail-wm1-f69.google.com with SMTP id b184so1120492wmh.6 for ; Mon, 30 Nov 2020 06:15:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Jy2WUd8qluzxUHyAVJZ0iTyH/i+egdeldCJel1aWn4Y=; b=R7/GFm4fU3KezCpZ473n36WE0ljSrILWE3rWL0sAGYDwpFsv2jRPynsJ3GrSqho7FV 3/c5YXwDO7vc2CTAIGYPDZ2o923gFXW+hyGjmLrjCkhKu2lUDTdNJD59H8vR0o2/c/1G 39CGTBjHORFojB6us/C7h4B9fN/nt/XKoF9TrC4Cvder4ohZXEHgzpybNre6pT6dwT1p d4orOtMEyqKxcQk8oiTBbryKpUnOKkTinax6Aml2ZWkZ2f+DmDfRyeq1UaT9ZCRZiP8V Wra7asxMtETkN/8zqZIeZkbA78t4kz1/3AHJV4lQoyXllwOv2jJ3uxtpQs1n0s+O1JjT +/Hw== X-Gm-Message-State: AOAM532fASvkseE+yVWktydAH/+HoDidYRh+j0tQrVDLxNZjL5FdLOvs frzqjto0axlwSohCBo3G9rZT4s08cn8x01BV8M4YdWauT5SsmbA05hm3u94WMJpYSyNWoWx1zWA I72k34MZiWYJdvuLCOJZN0nu0 X-Received: by 2002:a1c:e142:: with SMTP id y63mr10768881wmg.28.1606745714374; Mon, 30 Nov 2020 06:15:14 -0800 (PST) X-Received: by 2002:a1c:e142:: with SMTP id y63mr10768795wmg.28.1606745713286; Mon, 30 Nov 2020 06:15:13 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id s2sm24357624wmh.37.2020.11.30.06.15.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 06:15:12 -0800 (PST) Subject: Re: [PATCH 2/2] KVM: x86: introduce KVM_X86_QUIRK_TSC_HOST_ACCESS To: Maxim Levitsky , kvm@vger.kernel.org Cc: Oliver Upton , Ingo Molnar , Sean Christopherson , Thomas Gleixner , open list , Marcelo Tosatti , Jonathan Corbet , Wanpeng Li , Borislav Petkov , Jim Mattson , "H. Peter Anvin" , "open list:DOCUMENTATION" , Joerg Roedel , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Vitaly Kuznetsov References: <20201130133559.233242-1-mlevitsk@redhat.com> <20201130133559.233242-3-mlevitsk@redhat.com> <638a2919cf7c11c55108776beecafdd8e2da2995.camel@redhat.com> From: Paolo Bonzini Message-ID: <5e77e912-893b-0c8f-a9a6-b43eaee24ed3@redhat.com> Date: Mon, 30 Nov 2020 15:15:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <638a2919cf7c11c55108776beecafdd8e2da2995.camel@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/11/20 15:11, Maxim Levitsky wrote: > On Mon, 2020-11-30 at 14:54 +0100, Paolo Bonzini wrote: >> On 30/11/20 14:35, Maxim Levitsky wrote: >>> This quirk reflects the fact that we currently treat MSR_IA32_TSC >>> and MSR_TSC_ADJUST access by the host (e.g qemu) in a way that is different >>> compared to an access from the guest. >>> >>> For host's MSR_IA32_TSC read we currently always return L1 TSC value, and for >>> host's write we do the tsc synchronization. >>> >>> For host's MSR_TSC_ADJUST write, we don't make the tsc 'jump' as we should >>> for this msr. >>> >>> When the hypervisor uses the new TSC GET/SET state ioctls, all of this is no >>> longer needed, thus leave this enabled only with a quirk >>> which the hypervisor can disable. >>> >>> Suggested-by: Paolo Bonzini >>> Signed-off-by: Maxim Levitsky >> >> This needs to be covered by a variant of the existing selftests testcase >> (running the same guest code, but different host code of course). > Do you think that the test should go to the kernel's kvm unit tests, > or to kvm-unit-tests project? The latter already has x86_64/tsc_msrs_test.c (which I created in preparation for this exact change :)). Paolo