Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2917865pxb; Fri, 8 Oct 2021 19:14:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRpoMMhvtwEQK4Dzxv848c2a+kKRQuXd/1ZMjmVholtv+4deRWkFqpUqvIYD7Fyy78n2GI X-Received: by 2002:a05:6402:1057:: with SMTP id e23mr20663830edu.352.1633745689981; Fri, 08 Oct 2021 19:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633745689; cv=none; d=google.com; s=arc-20160816; b=kVN9YGKHyQ96q3zVVt83NpXoEsqIa7L9iEYydB4T0PBvPEjPTxS/2fq0pEFOC95Z6Q gf8ChpzKn0eKXl+62rNf4tbDSq/tAsUJtWjgi4Ouk02CcsEAVfE5fwFy2vjrghtg5NDF niXqEW0lQXvkdGuagiJ+ijNptMGishC50n+ZMysRKl4h9Sm2H9ZkE+iTXtpoTOE/jh0f 712RIdDb/+Jhm6zSdZy0GOexnhZm8ZX042EnhpRigJUBgxMkNrA3Iq97eZc8gPZk0RPk ul/TdELbJiZlH3itn1BP16AI3QKT2eu/Ml08pK4Ttq7uW5hjqSS6xiQidfZFt7utzN7V 708g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=OSahwrCOM8hvTCjGSN0bryGWa8lO1ktrkgbUtpkiWTU=; b=jlG7Xau6Pol1AKiiEFXsorwmxTxMlYNnFiqjyuLPy+PEepMlL+Pr78fIP1KTVd2Qa+ IykkQM+HkINZa6ZBwyb5zCcuO4WMLkqipDi+G3eL8fH0/GyyHanKyDYJU/EJ6spBftIe 8xKHKDfX42gZaC/iC8PhAymXygN58Ixi2Cf+WMdXbXxnHNE465PBUSsmmrx3Ela1VFjA Fp6XXzOSZe9VtErbwhyavArgIQADgya+yTZ0+BW3PGvh5KxNhhHWn5gFlUIGtgHhOS4O YW/Va9RT52DSYxfydBb3cqsRuxoRF8qRrYr1JVoDpFvQ/Lz9IHQWFQbkBCws2g6x+UP5 xmKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=M5Nnc+p8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr5si2322487ejc.602.2021.10.08.19.14.26; Fri, 08 Oct 2021 19:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=M5Nnc+p8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244255AbhJICOz (ORCPT + 99 others); Fri, 8 Oct 2021 22:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244196AbhJICOv (ORCPT ); Fri, 8 Oct 2021 22:14:51 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35405C061764 for ; Fri, 8 Oct 2021 19:12:55 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id f8-20020a2585480000b02905937897e3daso15197545ybn.2 for ; Fri, 08 Oct 2021 19:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=OSahwrCOM8hvTCjGSN0bryGWa8lO1ktrkgbUtpkiWTU=; b=M5Nnc+p8tzrX3sNy50+q4rLjDSCqSRYtbN8NDtIMtL5lz0M1RLPaDK9QbmYeZ771j6 iFkLbm77/+6Yc0cSHxabd0QyOohOgtVklZfs3Cn2dN0a1ZwfX67QbT1JAQNLhjpc4+uO vi9O60Ie3T48wyOT5Z4Gu0fSaeBm6K+RcT5Zaus4zoWDP/z2bfzcS0MRP6qrM18VmvI1 q2TtwZL4vCj4M6FLDBiRgBUXmYKIdxYeZUm1TBqJ6arSG1KgtQu+aFJsGYHUTkfjGQof tTaWlTLEfPIrKFJvjF0monIrG5PmtaBKUx6Tf3cXwYd6T3mEDwvkPUW8UU30Bw8nBP9y 0gDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=OSahwrCOM8hvTCjGSN0bryGWa8lO1ktrkgbUtpkiWTU=; b=5HEpFdWPK89TvSy8GjgZ/o09+e/MS4eRYqEqxp+Uwk3l9yruMQcF9294GQz5JyowhV /RmyEBJ4SeRsr+xlfj++YfNnxdYmqWG4xemzuv9Lvk8sMJ6kXsG6rG8G4+FL7VJIeGFP EupP6zl0G1q2oNDQuiZaj/33a4V6d5iAwMGEEYlLJcFSr/JpAmzvZXYNMo35kL1wZmvU 4Oa03C4gA4yJaWy395QmI9TU1WyiDZzX/ZTS0L3JXUgJJalKJfEQjX2E6koe6Hz7STqV RG19CWUD0uuVTrJBJKDBDtBdnkWlsFheA6I9WPTvigo17PPXrrFvs8l10taK9UF9xWgK OaZA== X-Gm-Message-State: AOAM532VdkH9gzm9dZGsPWHZvx/sjPDFS7qIqHMTmTFY5uWnfNgh2UMt lNoK+VId1RYi6k1LT82wTCmHkvNmKHQ= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:90:200:e39b:6333:b001:cb]) (user=seanjc job=sendgmr) by 2002:a05:6902:124e:: with SMTP id t14mr2047183ybu.221.1633745574354; Fri, 08 Oct 2021 19:12:54 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 8 Oct 2021 19:11:58 -0700 In-Reply-To: <20211009021236.4122790-1-seanjc@google.com> Message-Id: <20211009021236.4122790-6-seanjc@google.com> Mime-Version: 1.0 References: <20211009021236.4122790-1-seanjc@google.com> X-Mailer: git-send-email 2.33.0.882.g93a45727a2-goog Subject: [PATCH v2 05/43] KVM: Update halt-polling stats if and only if halt-polling was attempted From: Sean Christopherson To: Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Cc: James Morse , Alexandru Elisei , Suzuki K Poulose , Atish Patra , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Sean Christopherson , 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, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, David Matlack , Oliver Upton , Jing Zhang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: David Matlack Signed-off-by: Sean Christopherson --- 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 5d4a90032277..6156719bcbbc 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -3217,6 +3217,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu) { struct rcuwait *wait = kvm_arch_vcpu_get_wait(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; @@ -3224,7 +3225,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; @@ -3276,8 +3277,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.882.g93a45727a2-goog