From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CACEC83013 for ; Mon, 30 Nov 2020 14:17:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 26DE42084C for ; Mon, 30 Nov 2020 14:17:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XDnqifpW" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727414AbgK3OQs (ORCPT ); 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-Google-Smtp-Source: ABdhPJy4NO6q15SbHWukyBJ8MRyRFWENoejaNPVjxMUi4v5OO3B+V6ojxrsSeiVtMWCnB1wM/pytUg== 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