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 A9BC9C433EF for ; Wed, 27 Oct 2021 10:18:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D44E60FC0 for ; Wed, 27 Oct 2021 10:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241374AbhJ0KVU (ORCPT ); Wed, 27 Oct 2021 06:21:20 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27524 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232533AbhJ0KVS (ORCPT ); Wed, 27 Oct 2021 06:21:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635329933; 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=0f27XW5ipOgXyw7srO4b+jUX50VuAlw+C7sxFBFkpEA=; b=Z4xywkau7qK0Pa6XDZcZ14UI/7PrtgD9YDOHNSg5tYFg5d/88pFRakzhidvff6NyyCoF+U UDZYk0YkczFVpynDIUCugpAIiwewCx6UJfWFEu3GTMfnycj77uYUuJFsVKazk/uNMNNdhc FzPOv7pWxTVcTnUvnq/+cO3NTe7tYHw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-NX_vwU-ZN9SDSZWcd7uWxg-1; Wed, 27 Oct 2021 06:18:50 -0400 X-MC-Unique: NX_vwU-ZN9SDSZWcd7uWxg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2879100C661; Wed, 27 Oct 2021 10:18:45 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5315BAE0; Wed, 27 Oct 2021 10:18:25 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 05/43] KVM: Update halt-polling stats if and only if halt-polling was attempted From: Maxim Levitsky To: Sean Christopherson , 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 , 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 Date: Wed, 27 Oct 2021 13:18:24 +0300 In-Reply-To: <20211009021236.4122790-6-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-6-seanjc@google.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2021-10-08 at 19:11 -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. > > 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)) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky 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 28ADEC433F5 for ; Wed, 27 Oct 2021 10:19:09 +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 CEE6C60F39 for ; Wed, 27 Oct 2021 10:19:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CEE6C60F39 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TEzWr/+d24fMT9n6CPjLT6FAOQQboaOxj9VqmoSj3PI=; b=1+c5fFzqgI8Rhq moMd1Ob6dJmNShxILPUMFHxHgG4fIpUrZ6Qew/5P4zrVXY1G+Lpec9eXckdp996c25TS07gWFJFUb vFTj7zQUIgnUEU7tdaC9DJrPxgg3Ruql8Nts42+qdZ/2wPwLUZzOW4x9eUpj4c/f5TUe6g9Cjzrms 9cgi+L0XA820zwlPS0JP8ES+TSif6/sZ+pbMi10mLEOJ/y+fH02PtHX/VDOZCLMSyTtqqnhpg66Du eHWRblNw8JEDwZyqwJh6UJKxqOSJEe9EW8iDSiKLBXe3b6qMSPU+VmSmCa9xGEVxAWrZYyOLIFClQ T4jG40GcbmqrppDwk/9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfg1J-004Xsl-Pu; Wed, 27 Oct 2021 10:18:57 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfg1G-004XrR-E3 for linux-riscv@lists.infradead.org; Wed, 27 Oct 2021 10:18:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635329933; 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=0f27XW5ipOgXyw7srO4b+jUX50VuAlw+C7sxFBFkpEA=; b=Z4xywkau7qK0Pa6XDZcZ14UI/7PrtgD9YDOHNSg5tYFg5d/88pFRakzhidvff6NyyCoF+U UDZYk0YkczFVpynDIUCugpAIiwewCx6UJfWFEu3GTMfnycj77uYUuJFsVKazk/uNMNNdhc FzPOv7pWxTVcTnUvnq/+cO3NTe7tYHw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-NX_vwU-ZN9SDSZWcd7uWxg-1; Wed, 27 Oct 2021 06:18:50 -0400 X-MC-Unique: NX_vwU-ZN9SDSZWcd7uWxg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2879100C661; Wed, 27 Oct 2021 10:18:45 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5315BAE0; Wed, 27 Oct 2021 10:18:25 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 05/43] KVM: Update halt-polling stats if and only if halt-polling was attempted From: Maxim Levitsky To: Sean Christopherson , 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 , 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 Date: Wed, 27 Oct 2021 13:18:24 +0300 In-Reply-To: <20211009021236.4122790-6-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-6-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_031854_554021_8AEF79B7 X-CRM114-Status: GOOD ( 18.61 ) X-BeenThere: linux-riscv@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-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, 2021-10-08 at 19:11 -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. > > 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)) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 65C89C433EF for ; Wed, 27 Oct 2021 10:20:21 +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 29B2060EBD for ; Wed, 27 Oct 2021 10:20:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 29B2060EBD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zcPrEnDJ/Kkp42IVBvTFIPuzPY1+1hsx9Ik8capcL4s=; b=jgQ2EwkaontYZv 7yTkNIijoXCC5BOeGeNZ3MD8clNRSnOVj5X1GD2Iu7XGvzIAjlzf8onHYNmomOfZacgbdqk5mKo0J canC6wgfUWeS/t06Tif8TKcdikGJ72tLfT6h2VIoqYcO/xweSoFiKmEr51Ek3pmEPrh8Ki4pHAgSs s7LUf97gaSrt9O2wN/03zOS3gtYVXroclyJExG8HW3sHKfv9Brm7Yb+uVcxXXy2W8W1prv3RagOjr paYfjvM7X4m1aOOwhlQC+UL1bGPuSu+AwF/3hAi7QIHcGJs3VZLL6ZZh2eKFSfXAqbuxqM2QCgo02 0nEMb0gPatolMh2rLs5Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfg1M-004Xsx-8l; Wed, 27 Oct 2021 10:19:00 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfg1G-004XrQ-EB for linux-arm-kernel@lists.infradead.org; Wed, 27 Oct 2021 10:18:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635329933; 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=0f27XW5ipOgXyw7srO4b+jUX50VuAlw+C7sxFBFkpEA=; b=Z4xywkau7qK0Pa6XDZcZ14UI/7PrtgD9YDOHNSg5tYFg5d/88pFRakzhidvff6NyyCoF+U UDZYk0YkczFVpynDIUCugpAIiwewCx6UJfWFEu3GTMfnycj77uYUuJFsVKazk/uNMNNdhc FzPOv7pWxTVcTnUvnq/+cO3NTe7tYHw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-NX_vwU-ZN9SDSZWcd7uWxg-1; Wed, 27 Oct 2021 06:18:50 -0400 X-MC-Unique: NX_vwU-ZN9SDSZWcd7uWxg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2879100C661; Wed, 27 Oct 2021 10:18:45 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5315BAE0; Wed, 27 Oct 2021 10:18:25 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 05/43] KVM: Update halt-polling stats if and only if halt-polling was attempted From: Maxim Levitsky To: Sean Christopherson , 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 , 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 Date: Wed, 27 Oct 2021 13:18:24 +0300 In-Reply-To: <20211009021236.4122790-6-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-6-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211027_031854_558299_36AAE729 X-CRM114-Status: GOOD ( 19.62 ) 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, 2021-10-08 at 19:11 -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. > > 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)) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky _______________________________________________ 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 9AC19C433FE for ; Wed, 27 Oct 2021 10:49:45 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 2C3596103C for ; Wed, 27 Oct 2021 10:49:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2C3596103C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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 C6BAC4B190; Wed, 27 Oct 2021 06:49:44 -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=@redhat.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 5WM9lAELAJ8T; Wed, 27 Oct 2021 06:49:43 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6FDCC4B15E; Wed, 27 Oct 2021 06:49:42 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 8DD814B11E for ; Wed, 27 Oct 2021 06:18:54 -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 pJabFyTkWZgO for ; Wed, 27 Oct 2021 06:18:53 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 9BA914B090 for ; Wed, 27 Oct 2021 06:18:53 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635329933; 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=0f27XW5ipOgXyw7srO4b+jUX50VuAlw+C7sxFBFkpEA=; b=Z4xywkau7qK0Pa6XDZcZ14UI/7PrtgD9YDOHNSg5tYFg5d/88pFRakzhidvff6NyyCoF+U UDZYk0YkczFVpynDIUCugpAIiwewCx6UJfWFEu3GTMfnycj77uYUuJFsVKazk/uNMNNdhc FzPOv7pWxTVcTnUvnq/+cO3NTe7tYHw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-578-NX_vwU-ZN9SDSZWcd7uWxg-1; Wed, 27 Oct 2021 06:18:50 -0400 X-MC-Unique: NX_vwU-ZN9SDSZWcd7uWxg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2879100C661; Wed, 27 Oct 2021 10:18:45 +0000 (UTC) Received: from starship (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC5315BAE0; Wed, 27 Oct 2021 10:18:25 +0000 (UTC) Message-ID: Subject: Re: [PATCH v2 05/43] KVM: Update halt-polling stats if and only if halt-polling was attempted From: Maxim Levitsky To: Sean Christopherson , Marc Zyngier , Huacai Chen , Aleksandar Markovic , Paul Mackerras , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Paolo Bonzini Date: Wed, 27 Oct 2021 13:18:24 +0300 In-Reply-To: <20211009021236.4122790-6-seanjc@google.com> References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-6-seanjc@google.com> User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mailman-Approved-At: Wed, 27 Oct 2021 06:49:40 -0400 Cc: Wanpeng Li , kvm@vger.kernel.org, David Hildenbrand , linux-kernel@vger.kernel.org, Atish Patra , linux-riscv@lists.infradead.org, Claudio Imbrenda , kvmarm@lists.cs.columbia.edu, Joerg Roedel , kvm-ppc@vger.kernel.org, David Matlack , linux-arm-kernel@lists.infradead.org, Jim Mattson , Cornelia Huck , linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, 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, 2021-10-08 at 19:11 -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. > > 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)) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky _______________________________________________ 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: Maxim Levitsky Date: Wed, 27 Oct 2021 10:18:24 +0000 Subject: Re: [PATCH v2 05/43] KVM: Update halt-polling stats if and only if halt-polling was attempted Message-Id: List-Id: References: <20211009021236.4122790-1-seanjc@google.com> <20211009021236.4122790-6-seanjc@google.com> In-Reply-To: <20211009021236.4122790-6-seanjc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Sean Christopherson , 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 , 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 On Fri, 2021-10-08 at 19:11 -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. > > 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)) { Reviewed-by: Maxim Levitsky Best regards, Maxim Levitsky