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=-8.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 1BD0CC64E8A for ; Mon, 30 Nov 2020 17:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A8CCA20789 for ; Mon, 30 Nov 2020 17:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="VEp9D8pB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729083AbgK3RCy (ORCPT ); Mon, 30 Nov 2020 12:02:54 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32549 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728837AbgK3RCx (ORCPT ); Mon, 30 Nov 2020 12:02:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1606755687; 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=VgFd89DHnuHQ3v4vDDMB2aGeZJsjGIrSQaYmVa9y5pY=; b=VEp9D8pBF4sMTGq8N3MVIOPnAgvLA8NREGcTrV0Tew8f1dZ+vamoAwm2l6YhCgUa70VJKd MC8mVEpUc6v19fzcqKX+siLYFhX+AylL7on3CWxvCbRraFNtFNr1ePT/shRYBSh9rvLekJ frDhUrMTqhuusYoYSxWNeEEEw22O7dY= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-Znzk7FiHPgKyuxryIfCcPA-1; Mon, 30 Nov 2020 12:01:19 -0500 X-MC-Unique: Znzk7FiHPgKyuxryIfCcPA-1 Received: by mail-ed1-f70.google.com with SMTP id g13so606695eds.10 for ; Mon, 30 Nov 2020 09:01:19 -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=VgFd89DHnuHQ3v4vDDMB2aGeZJsjGIrSQaYmVa9y5pY=; b=JlVNbs6jLC23u63nvov4650HbPY+lteQQYb5QODVbeMrw+0PlDPebB7s9bk+5nihOu oEYGVQO7+y9cn/vTQa497d83Nz4sW7RNNcSh2X5e8UAeXdDnciDD8a9X+QkeyrBT6G4Y sMCIrU8bg4fLlxSy0VHVc7CJpLgFyNDaW+TGlsO31XwKdO/cfTuvOJuT0a1eSyfy7QbD XjMUJmToLYba4OL+b8yb3pvH7RUHdW3miruPIvfxQz8l6rLzi/I43gAGeLgGS6nalk9q IGSFHOD6ppXs/sjzFCASRxg0ZnbmX4A7Su1TfbaOtrZ2uZMJ99QlP1gwrdxHxwSgTljf bPvw== X-Gm-Message-State: AOAM530223I15OHnT96WFWhF4W1CVViO+LG7jkagEriUa6iIPX8ZRos0 53giQT1AckohDXSc07bC3ZO7AzLeiBmmlGBITJvG7JhyaVJce8agfLKdoDvm0E5CP5+2sqtaKOv fQT2eRbE42GG0gdFLCabmz+Gv X-Received: by 2002:a50:9991:: with SMTP id m17mr8474529edb.48.1606755678217; Mon, 30 Nov 2020 09:01:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzuh5JY/rp8mBQt2cCoqr5FsmGZwPNmCeuL6bdGW9SV9BsoqQFM1sgKQnAFQijgEJHRpPd3MQ== X-Received: by 2002:a50:9991:: with SMTP id m17mr8474488edb.48.1606755678013; Mon, 30 Nov 2020 09:01:18 -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 e3sm9022319ejq.96.2020.11.30.09.01.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 09:01:17 -0800 (PST) Subject: Re: [PATCH 1/2] KVM: x86: implement KVM_SET_TSC_PRECISE/KVM_GET_TSC_PRECISE 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-2-mlevitsk@redhat.com> <38602ef4-7ecf-a5fd-6db9-db86e8e974e4@redhat.com> From: Paolo Bonzini Message-ID: <005aaf41-9376-d535-211f-9ff08e53bcc4@redhat.com> Date: Mon, 30 Nov 2020 18:01:16 +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: 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 16:58, Maxim Levitsky wrote: >> This is mostly useful for userspace that doesn't disable the quirk, right? > Isn't this the opposite? If I understand the original proposal correctly, > the reason that we include the TSC_ADJUST in the new ioctl, is that > we would like to disable the special kvm behavior (that is disable the quirk), > which would mean that tsc will jump on regular host initiated TSC_ADJUST write. > > To avoid this, userspace would set TSC_ADJUST through this new interface. Yeah, that makes sense. It removes the need to think "I have to set TSC adjust before TSC". > Do you think that this is an issue? If so I can make the code work with > signed numbers. Not sure if it's an issue, but I prefer to make the API "less surprising" for userspace. Who knows how it will be used. > About nsec == 0, this is to allow to use this API for VM initialization. > (That is to call KVM_SET_TSC_PRECISE prior to doing KVM_GET_TSC_PRECISE) I prefer using flags for that purpose. Paolo