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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62ABBC433F5 for ; Tue, 28 Sep 2021 18:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4326E6124A for ; Tue, 28 Sep 2021 18:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242357AbhI1S7e (ORCPT ); Tue, 28 Sep 2021 14:59:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242218AbhI1S7d (ORCPT ); Tue, 28 Sep 2021 14:59:33 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B7DBC061746 for ; Tue, 28 Sep 2021 11:57:53 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id s75so75704pgs.5 for ; Tue, 28 Sep 2021 11:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hbmr+iwzxjrwsm+tEChOCbQhDq6UlfLy+47j+9ocUio=; b=LIUKsJb5csfGXRweUbuDpDidwcU5eWp7I/BC8UyxJljOvp53d1+D8/lVafchjWnTQ0 UFJ3m7MEw7wR7ZRxd8ACwxPZ0m52bD6vj7TVNWZMtZNMTJOZwlD3eAWWyH1Qjhl43L3U W1FytngggVEVCnX/gF5j3GcAVm16wdtULlRYpFUEUDEjCyafanTtEjpuUFGcRp39K4zP 8bcEH690dj17b/WyNjFuFNPEP5hGpR8USgdsDcq9O2S4cVlCSktUAxA777RgXT/lt+Vv Bzig6jNqwzLE2GfeCQZTnW8FZN7tYmEiOfv/wCyJ4cPc56oImH3Qexl4IlFXY6fcK+dx 1HLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hbmr+iwzxjrwsm+tEChOCbQhDq6UlfLy+47j+9ocUio=; b=6mCrZSimJSGwsa147uLeSBKVnFv1NCp3XPosv+pW1LSrbNfWjkFcEm1r0HFDA3OIGF 2wMpMXuLMIbkKEHu6/9vhnKk1JDxbw2472C4K3cSY+hmz1TTxxJrxQ85Y/+OJifM53q+ U90EsRrwxongXH8i+dUMM5WLJW0d6IYAwgFAoq9dE9GbzrOlF2OYnewEn49iIcAqJKr6 pukbuWrWcYIU8aujy0ciYxZsAiQPP6hjjlAAFrxkrRlNaDMWF7dYF56Hdkj4trkpfWft ZwWPqzxNRuiJL+nGvCJN5rq+v7UKljQQr+rGt2bq0qKrMvCeEKsXttLu/O481HpYqK1a 3X5A== X-Gm-Message-State: AOAM532iMM+gcC9b+3qdN+hJzN3maauSnsrKbbxApE7PUiIyiBM7Dw69 KQeS3oLsVsBvbGlwAjoUaIHjjg== X-Google-Smtp-Source: ABdhPJzvJEVMFLwNuCMQ/B/wkbjy954+2YLM0705uJahpnQn4hlzIhG6+toRk9qgzctw/+QJEMGtgw== X-Received: by 2002:a62:7ccf:0:b0:444:9264:dbcd with SMTP id x198-20020a627ccf000000b004449264dbcdmr7051691pfc.50.1632855472798; Tue, 28 Sep 2021 11:57:52 -0700 (PDT) Received: from google.com (254.80.82.34.bc.googleusercontent.com. [34.82.80.254]) by smtp.gmail.com with ESMTPSA id f16sm21088582pfk.110.2021.09.28.11.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 11:57:52 -0700 (PDT) Date: Tue, 28 Sep 2021 18:57:46 +0000 From: David Matlack To: Sean Christopherson Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Jing Zhang Subject: Re: [PATCH 02/14] KVM: Update halt-polling stats if and only if halt-polling was attempted Message-ID: References: <20210925005528.1145584-1-seanjc@google.com> <20210925005528.1145584-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210925005528.1145584-3-seanjc@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 24, 2021 at 05:55:16PM -0700, Sean Christopherson wrote: > Don't update halt-polling stats if halt-polling wasn't attempted. This > is a nop as @poll_ns is guaranteed to be '0' (poll_end == start), but it > will allow a future patch to move the histogram stats into the helper to > resolve a discrepancy in what is considered a "successful" halt-poll. > > No functional change intended. > > Cc: David Matlack > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > virt/kvm/kvm_main.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 768a4cbb26a6..8b33f5045b4d 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -3214,6 +3214,7 @@ update_halt_poll_stats(struct kvm_vcpu *vcpu, u64 poll_ns, bool waited) > void kvm_vcpu_block(struct kvm_vcpu *vcpu) > { > bool halt_poll_allowed = !kvm_arch_no_poll(vcpu); > + bool do_halt_poll = halt_poll_allowed && vcpu->halt_poll_ns; > ktime_t start, cur, poll_end; > bool waited = false; > u64 block_ns; > @@ -3221,7 +3222,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_blocking(vcpu); > > start = cur = poll_end = ktime_get(); > - if (vcpu->halt_poll_ns && halt_poll_allowed) { > + if (do_halt_poll) { > ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); > > ++vcpu->stat.generic.halt_attempted_poll; > @@ -3273,8 +3274,9 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_unblocking(vcpu); > block_ns = ktime_to_ns(cur) - ktime_to_ns(start); > > - update_halt_poll_stats( > - vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > + if (do_halt_poll) > + update_halt_poll_stats( > + vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > > if (halt_poll_allowed) { > if (!vcpu_valid_wakeup(vcpu)) { > -- > 2.33.0.685.g46640cef36-goog > 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24363C433F5 for ; Tue, 28 Sep 2021 19:00:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E0AA261262 for ; Tue, 28 Sep 2021 19:00:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0AA261262 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NsLCVdGBEcgxWJN+5BpZ1FaDn3aEMM685pdKjf3hOtU=; b=fjz9O0QHJ3k67C /H7Wm2PT8tlfW8n910U/FFnhLnWyurAptia/CBGE9q47iyOafeEcWcYuoJhCmFPL7eh5AbBwB0bRs dCSfRWxlLnhv9SVn957A5A8B5CTv1OrtPhleXJyUtUpa4RKiTfDiKDpz/YpZPrnLspG1BOQSCdqHm Jcvy22KB7H473nZAoHpoqR8jxjBwCbVfVm4Jb7CQ8hgwUEpCAhKl58zvYEUI6O1SVhqnVhJ+3xjd4 Ci6GuAI9610mpU2WuQ713Xm7mDyS690L1O7OuPLF0bdgjDOTTN2DZgQwDjSz80jgsIIjTN0NxrvY6 RPG/a2uaf3QyPP93QwZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVIIk-008Y7U-Uc; Tue, 28 Sep 2021 18:58:03 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVIIf-008Y5H-73 for linux-arm-kernel@lists.infradead.org; Tue, 28 Sep 2021 18:57:58 +0000 Received: by mail-pg1-x52d.google.com with SMTP id s11so45406pgr.11 for ; Tue, 28 Sep 2021 11:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hbmr+iwzxjrwsm+tEChOCbQhDq6UlfLy+47j+9ocUio=; b=LIUKsJb5csfGXRweUbuDpDidwcU5eWp7I/BC8UyxJljOvp53d1+D8/lVafchjWnTQ0 UFJ3m7MEw7wR7ZRxd8ACwxPZ0m52bD6vj7TVNWZMtZNMTJOZwlD3eAWWyH1Qjhl43L3U W1FytngggVEVCnX/gF5j3GcAVm16wdtULlRYpFUEUDEjCyafanTtEjpuUFGcRp39K4zP 8bcEH690dj17b/WyNjFuFNPEP5hGpR8USgdsDcq9O2S4cVlCSktUAxA777RgXT/lt+Vv Bzig6jNqwzLE2GfeCQZTnW8FZN7tYmEiOfv/wCyJ4cPc56oImH3Qexl4IlFXY6fcK+dx 1HLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hbmr+iwzxjrwsm+tEChOCbQhDq6UlfLy+47j+9ocUio=; b=dxbT5UOgv7YNopFBqnkGLWmeBPblwvlFJueHNA/0wpZp22/VMJ1r6q/q1nPQH0/ia6 IthUYrDjggSVIX99ViVihIygs9NluskQgcRRD1jAjSqVDZCBa1ErNCjA4GUCIU06m4GW ptgi70RPcM+maCdatw/EIxebYqGXeF3B8esvjXpoUkuq7toenPHw83b09AqMDBO4s779 P3EBWDDb57fsIzFpvosxxNUrj4IgWOuusq9b2AL1Iol5M7mVRNuPgMuq5TswI9Y0W/5t haZjNh9x5HKVGQ1r5yQ+7ickTc3BQJ2vI/z9zuElGv7r5IF8OO64kH3gEUe4d0vw0U6n o37g== X-Gm-Message-State: AOAM532nPPZ74nCke8J9WubaoMb9IU7QayJGY8NA53W3W2GXnyyyUXsH w0P/wMHZPOzzd9OicidIrdJq0Q== X-Google-Smtp-Source: ABdhPJzvJEVMFLwNuCMQ/B/wkbjy954+2YLM0705uJahpnQn4hlzIhG6+toRk9qgzctw/+QJEMGtgw== X-Received: by 2002:a62:7ccf:0:b0:444:9264:dbcd with SMTP id x198-20020a627ccf000000b004449264dbcdmr7051691pfc.50.1632855472798; Tue, 28 Sep 2021 11:57:52 -0700 (PDT) Received: from google.com (254.80.82.34.bc.googleusercontent.com. [34.82.80.254]) by smtp.gmail.com with ESMTPSA id f16sm21088582pfk.110.2021.09.28.11.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 11:57:52 -0700 (PDT) Date: Tue, 28 Sep 2021 18:57:46 +0000 From: David Matlack To: Sean Christopherson Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Jing Zhang Subject: Re: [PATCH 02/14] KVM: Update halt-polling stats if and only if halt-polling was attempted Message-ID: References: <20210925005528.1145584-1-seanjc@google.com> <20210925005528.1145584-3-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210925005528.1145584-3-seanjc@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210928_115757_290448_0D5D6DB7 X-CRM114-Status: GOOD ( 20.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 24, 2021 at 05:55:16PM -0700, Sean Christopherson wrote: > Don't update halt-polling stats if halt-polling wasn't attempted. This > is a nop as @poll_ns is guaranteed to be '0' (poll_end == start), but it > will allow a future patch to move the histogram stats into the helper to > resolve a discrepancy in what is considered a "successful" halt-poll. > > No functional change intended. > > Cc: David Matlack > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > virt/kvm/kvm_main.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 768a4cbb26a6..8b33f5045b4d 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -3214,6 +3214,7 @@ update_halt_poll_stats(struct kvm_vcpu *vcpu, u64 poll_ns, bool waited) > void kvm_vcpu_block(struct kvm_vcpu *vcpu) > { > bool halt_poll_allowed = !kvm_arch_no_poll(vcpu); > + bool do_halt_poll = halt_poll_allowed && vcpu->halt_poll_ns; > ktime_t start, cur, poll_end; > bool waited = false; > u64 block_ns; > @@ -3221,7 +3222,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_blocking(vcpu); > > start = cur = poll_end = ktime_get(); > - if (vcpu->halt_poll_ns && halt_poll_allowed) { > + if (do_halt_poll) { > ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); > > ++vcpu->stat.generic.halt_attempted_poll; > @@ -3273,8 +3274,9 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_unblocking(vcpu); > block_ns = ktime_to_ns(cur) - ktime_to_ns(start); > > - update_halt_poll_stats( > - vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > + if (do_halt_poll) > + update_halt_poll_stats( > + vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > > if (halt_poll_allowed) { > if (!vcpu_valid_wakeup(vcpu)) { > -- > 2.33.0.685.g46640cef36-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B034BC433EF for ; Wed, 29 Sep 2021 07:12:43 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 288FC613C8 for ; Wed, 29 Sep 2021 07:12:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 288FC613C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 672D24B174; Wed, 29 Sep 2021 03:12:42 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GUI4gwsNngfg; Wed, 29 Sep 2021 03:12:41 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 26D554B129; Wed, 29 Sep 2021 03:12:41 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 258764B101 for ; Tue, 28 Sep 2021 14:57:55 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W6uXycousGb6 for ; Tue, 28 Sep 2021 14:57:54 -0400 (EDT) Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id F2B9E4B0C0 for ; Tue, 28 Sep 2021 14:57:53 -0400 (EDT) Received: by mail-pg1-f178.google.com with SMTP id g184so70618pgc.6 for ; Tue, 28 Sep 2021 11:57:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hbmr+iwzxjrwsm+tEChOCbQhDq6UlfLy+47j+9ocUio=; b=LIUKsJb5csfGXRweUbuDpDidwcU5eWp7I/BC8UyxJljOvp53d1+D8/lVafchjWnTQ0 UFJ3m7MEw7wR7ZRxd8ACwxPZ0m52bD6vj7TVNWZMtZNMTJOZwlD3eAWWyH1Qjhl43L3U W1FytngggVEVCnX/gF5j3GcAVm16wdtULlRYpFUEUDEjCyafanTtEjpuUFGcRp39K4zP 8bcEH690dj17b/WyNjFuFNPEP5hGpR8USgdsDcq9O2S4cVlCSktUAxA777RgXT/lt+Vv Bzig6jNqwzLE2GfeCQZTnW8FZN7tYmEiOfv/wCyJ4cPc56oImH3Qexl4IlFXY6fcK+dx 1HLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hbmr+iwzxjrwsm+tEChOCbQhDq6UlfLy+47j+9ocUio=; b=ryzhm+tG7N8adzPxJHGtb44az0idwWjRzdKJv0wuagr8rbM9lNSblIi4UZuWX3P4wF Pqz55qnxVkvNA96RQvIGjhx7GakDpQezFNvmpGl4xeQmNWY8tMsl6A+hOzdHM+bjisJ9 Z/V1Fng3xwsQ8+auQ9rkmrRv3VTXOjq8eFLIKrWR7USMxVhIf+UUELc+K8iCqLb2U143 qMMbB+AVIn+a6Yzwz6+PkB8j+MEfswDvmmKSG0QSCRC/etnJEpInk4YU8I+YIsuEnhMU 0RBtV1AxsR0HoqP8cmjbSqdbkDjNY6z+liduHBq2Cni2u6Ho6DTp1IkFeAzDRHSppH+7 BGqw== X-Gm-Message-State: AOAM531RM7jHByyC6lJK6GAqIeiYaFONpG2SyTkPqL7FrRqg+6lTon/O y45n5HezxBwaKkxnktlfoFG30Q== X-Google-Smtp-Source: ABdhPJzvJEVMFLwNuCMQ/B/wkbjy954+2YLM0705uJahpnQn4hlzIhG6+toRk9qgzctw/+QJEMGtgw== X-Received: by 2002:a62:7ccf:0:b0:444:9264:dbcd with SMTP id x198-20020a627ccf000000b004449264dbcdmr7051691pfc.50.1632855472798; Tue, 28 Sep 2021 11:57:52 -0700 (PDT) Received: from google.com (254.80.82.34.bc.googleusercontent.com. [34.82.80.254]) by smtp.gmail.com with ESMTPSA id f16sm21088582pfk.110.2021.09.28.11.57.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 11:57:52 -0700 (PDT) Date: Tue, 28 Sep 2021 18:57:46 +0000 From: David Matlack To: Sean Christopherson Subject: Re: [PATCH 02/14] KVM: Update halt-polling stats if and only if halt-polling was attempted Message-ID: References: <20210925005528.1145584-1-seanjc@google.com> <20210925005528.1145584-3-seanjc@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210925005528.1145584-3-seanjc@google.com> X-Mailman-Approved-At: Wed, 29 Sep 2021 03:12:40 -0400 Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Paul Mackerras , Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Janosch Frank , Marc Zyngier , Joerg Roedel , Huacai Chen , Christian Borntraeger , Aleksandar Markovic , kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , linux-mips@vger.kernel.org, Paolo Bonzini , Vitaly Kuznetsov X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Fri, Sep 24, 2021 at 05:55:16PM -0700, Sean Christopherson wrote: > Don't update halt-polling stats if halt-polling wasn't attempted. This > is a nop as @poll_ns is guaranteed to be '0' (poll_end == start), but it > will allow a future patch to move the histogram stats into the helper to > resolve a discrepancy in what is considered a "successful" halt-poll. > > No functional change intended. > > Cc: David Matlack > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > virt/kvm/kvm_main.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 768a4cbb26a6..8b33f5045b4d 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -3214,6 +3214,7 @@ update_halt_poll_stats(struct kvm_vcpu *vcpu, u64 poll_ns, bool waited) > void kvm_vcpu_block(struct kvm_vcpu *vcpu) > { > bool halt_poll_allowed = !kvm_arch_no_poll(vcpu); > + bool do_halt_poll = halt_poll_allowed && vcpu->halt_poll_ns; > ktime_t start, cur, poll_end; > bool waited = false; > u64 block_ns; > @@ -3221,7 +3222,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_blocking(vcpu); > > start = cur = poll_end = ktime_get(); > - if (vcpu->halt_poll_ns && halt_poll_allowed) { > + if (do_halt_poll) { > ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); > > ++vcpu->stat.generic.halt_attempted_poll; > @@ -3273,8 +3274,9 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_unblocking(vcpu); > block_ns = ktime_to_ns(cur) - ktime_to_ns(start); > > - update_halt_poll_stats( > - vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > + if (do_halt_poll) > + update_halt_poll_stats( > + vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > > if (halt_poll_allowed) { > if (!vcpu_valid_wakeup(vcpu)) { > -- > 2.33.0.685.g46640cef36-goog > _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Matlack Date: Tue, 28 Sep 2021 18:57:46 +0000 Subject: Re: [PATCH 02/14] KVM: Update halt-polling stats if and only if halt-polling was attempted Message-Id: List-Id: References: <20210925005528.1145584-1-seanjc@google.com> <20210925005528.1145584-3-seanjc@google.com> In-Reply-To: <20210925005528.1145584-3-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sean Christopherson Cc: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Christian Borntraeger , Janosch Frank , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Jing Zhang On Fri, Sep 24, 2021 at 05:55:16PM -0700, Sean Christopherson wrote: > Don't update halt-polling stats if halt-polling wasn't attempted. This > is a nop as @poll_ns is guaranteed to be '0' (poll_end = start), but it > will allow a future patch to move the histogram stats into the helper to > resolve a discrepancy in what is considered a "successful" halt-poll. > > No functional change intended. > > Cc: David Matlack > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > virt/kvm/kvm_main.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c > index 768a4cbb26a6..8b33f5045b4d 100644 > --- a/virt/kvm/kvm_main.c > +++ b/virt/kvm/kvm_main.c > @@ -3214,6 +3214,7 @@ update_halt_poll_stats(struct kvm_vcpu *vcpu, u64 poll_ns, bool waited) > void kvm_vcpu_block(struct kvm_vcpu *vcpu) > { > bool halt_poll_allowed = !kvm_arch_no_poll(vcpu); > + bool do_halt_poll = halt_poll_allowed && vcpu->halt_poll_ns; > ktime_t start, cur, poll_end; > bool waited = false; > u64 block_ns; > @@ -3221,7 +3222,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_blocking(vcpu); > > start = cur = poll_end = ktime_get(); > - if (vcpu->halt_poll_ns && halt_poll_allowed) { > + if (do_halt_poll) { > ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns); > > ++vcpu->stat.generic.halt_attempted_poll; > @@ -3273,8 +3274,9 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) > kvm_arch_vcpu_unblocking(vcpu); > block_ns = ktime_to_ns(cur) - ktime_to_ns(start); > > - update_halt_poll_stats( > - vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > + if (do_halt_poll) > + update_halt_poll_stats( > + vcpu, ktime_to_ns(ktime_sub(poll_end, start)), waited); > > if (halt_poll_allowed) { > if (!vcpu_valid_wakeup(vcpu)) { > -- > 2.33.0.685.g46640cef36-goog >