Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18C0FC4332F for ; Fri, 10 Dec 2021 00:56:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234992AbhLJA6R (ORCPT ); Thu, 9 Dec 2021 19:58:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbhLJA6P (ORCPT ); Thu, 9 Dec 2021 19:58:15 -0500 Received: from mail-oo1-xc2c.google.com (mail-oo1-xc2c.google.com [IPv6:2607:f8b0:4864:20::c2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C307DC061746 for ; Thu, 9 Dec 2021 16:54:41 -0800 (PST) Received: by mail-oo1-xc2c.google.com with SMTP id g11-20020a4a754b000000b002c679a02b18so2079950oof.3 for ; Thu, 09 Dec 2021 16:54:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PWSk6caqvw2Au0Kq7gSkUUH//LBYrIaVkaVjdQPwyR4=; b=IOlMdKeYy196r8n0PAcOxjUB0ETIqkl1nL3Cw5mVz/oH8PLyC/QoJL5cFV5a0lo6P6 jKIuocs2zxpr/Dwi1v3XG0qChzeCU+yKZgwlGV0mLk7I2RKrsf61AIHSOUPgN5aDrZmn KnjTcG98KkfZIMw99M3eIlx0IOZqg+vO1ffaOSrESbDCv3ZDK62DMLgWwxZJ6QDFihK5 imbt51xWySK0Z5w7O42BaxpANJhTuwspB43Eb3nG4BeZL+Nlgq6zLzfBOwcXPhvc9TCW 6QKP6Mjd7ABkOxZMJyu+Ag2tkWTpY6jDpUHfX4CqAXdiS4ZojngbazxSgOFtWV1+6fyN nrQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PWSk6caqvw2Au0Kq7gSkUUH//LBYrIaVkaVjdQPwyR4=; b=hL+pd7uzRnIZR/cnQ05r7BGIC+GjrurBgojgSzsNjyBTSfqZ6Dr1oow+orih80bODM w2meA1GpgZF1EzohB2JSo44pspL7KWnbevxsA20MsAnP66tYQe2YSkP1/Pb0ZVihEqZk MNEhCvgHgKvUPP7jjrw99r/octimvYL0ViaoZAqM3KsqTMyoEUhbZcfcghJX1IApbBaC PVtuMuV2JQfP75oQUQy3rLaK5+Ec31pDP9pXD4mdLqtWn5EsGoRjge+KqoRJZ/RrvAmt mkIdTVbKORCk/vxtRvPRm7uDAe7Gq0CehE6n1v5HVicDNhsFkmOuTxNuaAgsnCMX/Fhy tBVg== X-Gm-Message-State: AOAM530Bzu9+mjBnNhRXKCoPCuByo17fSaXCm/CBO3vlh4BCVYjpwA+e XnvHOF9zV/0Ys0YUbrN8iU0M8+uyIQQ7lU76IkpCRQ== X-Google-Smtp-Source: ABdhPJy3fxlViF5YsiaUrlmQ7lDKoLcWRAbIkuAC5QKtqf9Pu6c2RqE4NKgnir0c/u09WjzeRYQlcZ2YcGfsPnO1sbs= X-Received: by 2002:a4a:d284:: with SMTP id h4mr6427005oos.31.1639097680669; Thu, 09 Dec 2021 16:54:40 -0800 (PST) MIME-Version: 1.0 References: <20211130074221.93635-1-likexu@tencent.com> <20211130074221.93635-5-likexu@tencent.com> <0ca44f61-f7f1-0440-e1e1-8d5e8aa9b540@gmail.com> In-Reply-To: <0ca44f61-f7f1-0440-e1e1-8d5e8aa9b540@gmail.com> From: Jim Mattson Date: Thu, 9 Dec 2021 16:54:29 -0800 Message-ID: Subject: Re: [PATCH v2 4/6] KVM: x86/pmu: Add pmc->intr to refactor kvm_perf_overflow{_intr}() To: Like Xu Cc: Andi Kleen , Kim Phillips , Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Like Xu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 9, 2021 at 12:28 AM Like Xu wrote: > > On 9/12/2021 12:25 pm, Jim Mattson wrote: > > > > Not your change, but if the event is counting anything based on > > cycles, and the guest TSC is scaled to run at a different rate from > > the host TSC, doesn't the initial value of the underlying hardware > > counter have to be adjusted as well, so that the interrupt arrives > > when the guest's counter overflows rather than when the host's counter > > overflows? > > I've thought about this issue too and at least the Intel Specification > did not let me down on this detail: > > "The counter changes in the VMX non-root mode will follow > VMM's use of the TSC offset or TSC scaling VMX controls" Where do you see this? I see similar text regarding TSC packets in the section on Intel Processor Trace, but nothing about PMU counters advancing at a scaled TSC frequency. > Not knowing if AMD or the real world hardware > will live up to this expectation and I'm pessimistic. > > cc Andi and Kim. >