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=-7.8 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=no 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 1095DC433DB for ; Tue, 5 Jan 2021 07:28:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC44F22581 for ; Tue, 5 Jan 2021 07:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbhAEH2q (ORCPT ); Tue, 5 Jan 2021 02:28:46 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32794 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726212AbhAEH2p (ORCPT ); Tue, 5 Jan 2021 02:28:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609831639; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yLi+sRfWovFP4SWZkCDhE0WXKSyNbBNcSRSqglRIET0=; b=JeGiTqhI1IWrv8wWlrrr9J6xM/SkfzJPlGb5mR7oGuQwDLASsa2+32aqPfQdHBlM4rgRa6 qedxme74zQQom0sC7G5wDVsWTS9OTFPtz6CWQQOWAiWJfDradcJpZI5tsb5gFmuBAK1iOt LuUALQbjWZBwdrU+mOHGXGUxQlZzzLw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-VIVQkWoUOPK77BKA0CsRFg-1; Tue, 05 Jan 2021 02:27:16 -0500 X-MC-Unique: VIVQkWoUOPK77BKA0CsRFg-1 Received: by mail-wm1-f70.google.com with SMTP id z12so862511wmf.9 for ; Mon, 04 Jan 2021 23:27:16 -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:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yLi+sRfWovFP4SWZkCDhE0WXKSyNbBNcSRSqglRIET0=; b=H4IBFXoS7fcMbxuNU1p1h0PA2s0Fdu8N9+wTd27RG1xnO6LCoSc6ScIGOUFd5mIrbJ BDSK/haKW1Q29Fhg5jiz0dE3beat9d9MpNmgwem0A4k1zcdAJbh27qfdOgZy13Njr4Mv BJK4UInQOxDeeVAsfSGcjqp6v+sNGisUwdiAdGxzHEDCrXoO3Uq1jUDAh1KxsCTY9O68 VsQQBUwvzBV3jNyS65NngWc0m1KeVyXAf16Ku5RAHdvb+N9T9F76qdPgYHM1v877o8VB 0nwzCVwaifDCa4LyjwcSakUJdG2Pj8O5y9IVDJ2oFIYi3Ou1IBKTPk3l82upc3jAOvsw FHLA== X-Gm-Message-State: AOAM533fMtRT54UxwtdCHYHZM7xwXKBHi3O4Qzvm706q/tA6XPVu3mE6 IuI7fpADF9TgfGBnlQBiXPhEprHOMTBP8c9iBJVjFglmCWVjczxUI5O3L09ctctbYSTOSYzsM6H SxtNKg+YYMgWaJYIkYH0ynO31 X-Received: by 2002:a5d:674c:: with SMTP id l12mr82014910wrw.399.1609831635482; Mon, 04 Jan 2021 23:27:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwXOvkNcqBuyy0EkHXdQlPxr86w8if4j/0XYHqZCidCHd3pSnhLPYbVcoCMZxikKIYvl6WJdw== X-Received: by 2002:a5d:674c:: with SMTP id l12mr82014894wrw.399.1609831635230; Mon, 04 Jan 2021 23:27:15 -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 r20sm2685257wmh.15.2021.01.04.23.27.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Jan 2021 23:27:14 -0800 (PST) Subject: Re: Possible regression in cpuacct.stats system time To: Nitesh Narayan Lal , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, tglx@linutronix.de, alexandre.chartre@oracle.com, peterz@infradead.org, w90p710@gmail.com, sean.j.christopherson@intel.com, vkuznets@redhat.com References: <12a1b9d4-8534-e23a-6bbd-736474928e6b@redhat.com> From: Paolo Bonzini Message-ID: <49664b8e-8b14-eb5c-f25c-da604b7c077b@redhat.com> Date: Tue, 5 Jan 2021 08:27:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <12a1b9d4-8534-e23a-6bbd-736474928e6b@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/01/21 22:24, Nitesh Narayan Lal wrote: > Hi, > > Last year I reported an issue of "suspicious RCU usage" [1] with the debug > kernel which was fixed with the patch: > >     87fa7f3e98 "x86/kvm: Move context tracking where it belongs" > > Recently I have come across a possible regression because of this > patch in the cpuacct.stats system time. > > With the latest upstream kernel (5.11-rc2) when we set up a VM and start > observing the system time value from cpuacct.stat then it is significantly > higher than value reported with the kernel that doesn't have the > previously mentioned patch. > > FWIU the reason behind this increase is the moving of guest_exit_irqoff() > to its proper location (near vmexit). This leads to the accounting > of instructions that were previously accounted into the guest context as a > part of the system time. > > IMO this should be an expected behavior after the previously mentioned > change. Is that a right conclusion or I am missing something here? Yes it's expected and I think it's more precise, since this is host overhead rather than guest operation . > Another question that I have is about the patch > >     d7a08882a0 "KVM: x86: Unconditionally enable irqs in guest context" > > considering we are enabling irqs early now in the code path, do we still > need this patch? No, we don't. Since the code is a bit simpler without it, feel free to send a revert. Thanks, Paolo > > [1] https://lore.kernel.org/lkml/ece36eb1-253a-8ec6-c183-309c10bb35d5@redhat.com/ > > -- > Thanks > Nitesh >