Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp50216imu; Mon, 26 Nov 2018 07:49:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/W1nNhzs+50k9Qxctb5xi3AOgVrk707+sis/PJE2WsaQHpJfKJMSppZBZJLp/ZKHsUkAz4V X-Received: by 2002:a63:a002:: with SMTP id r2mr24976717pge.212.1543247399640; Mon, 26 Nov 2018 07:49:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543247399; cv=none; d=google.com; s=arc-20160816; b=Hz2ZTOj+8FQiuU9ZvuxVOarb3KJTnOhRVCdejufNqXA+lbUP+K7GvDZeTAzcGh7BlI DdDBWoK1IBZ59xwx5JMHZgpfl10NiH4c7Otcb6YmHaTFTv8A/oN+yhRhrdE8caUHU6K8 YO9iKLLO/V/9rkAi5m8HeTfY4nH4JmKcWgp4ABE+wI/8AUjigkuULItPBLCoqeHP8MPR kADQNPrZQ6yjZ2qHQKC14YILpjGvYS/vDxr6yywkjUxkIdZeQdyNywOJvnpODp1io4Ng 1Ak/eCJZHyhfszGIvjBSK1geW26YUg20cilW5AOeIqXoWz24rcyNN6dBfs+nKe4BPTiH p0pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RF7E6QAdY3iB+k1c0in/gyC/4lqxC5OJ0HHllGnINPs=; b=BW6m3/C/kDEORyGsdWHbGFElIkF+i469GxyczcDfLNk+2/2ZdC3N5MVBDcYS8JasD4 GD23qlQF7e4UY7NZV/yeYrVQ1w+Wm8eLOluiSsAGXsVkOgxKFdSWYmY84UTLkej8lyZP WEuvxzpa0lESoOuGsMpfPmJg+nKjs4TcpHZuEFfnT0dQs2bTLluZKPLlw5MZl/M4uxCE +2ug6FcnnxjtQwk0d8h71fp9iRrePBoTzcn32KA2ax3fMr9GUdtuGVl8JZClDig/JTxv 63xHSqMluffEKW+INMv02ivWFvmXtDjYO4Ad2w8IEXM2Hri6yPJEGagpPPaMTXUkSe04 /4Tw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si697147plm.334.2018.11.26.07.49.25; Mon, 26 Nov 2018 07:49:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726966AbeK0Cm0 (ORCPT + 99 others); Mon, 26 Nov 2018 21:42:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55012 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbeK0CmZ (ORCPT ); Mon, 26 Nov 2018 21:42:25 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 049803082E51; Mon, 26 Nov 2018 15:47:56 +0000 (UTC) Received: from vitty.brq.redhat.com (unknown [10.43.2.155]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEE495DD84; Mon, 26 Nov 2018 15:47:53 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org Cc: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , linux-kernel@vger.kernel.org, Roman Kagan , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , x86@kernel.org, "Michael Kelley (EOSG)" Subject: [PATCH v2 4/4] x86/kvm/hyper-v: avoid open-coding stimer_mark_pending() in kvm_hv_notify_acked_sint() Date: Mon, 26 Nov 2018 16:47:32 +0100 Message-Id: <20181126154732.23025-5-vkuznets@redhat.com> In-Reply-To: <20181126154732.23025-1-vkuznets@redhat.com> References: <20181126154732.23025-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 26 Nov 2018 15:47:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org stimers_pending optimization only helps us to avoid multiple kvm_make_request() calls. This doesn't happen very often and these calls are very cheap in the first place, remove open-coded version of stimer_mark_pending() from kvm_hv_notify_acked_sint(). Suggested-by: Paolo Bonzini Signed-off-by: Vitaly Kuznetsov --- arch/x86/kvm/hyperv.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 9533133be566..e6a2a085644a 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -206,7 +206,7 @@ static void kvm_hv_notify_acked_sint(struct kvm_vcpu *vcpu, u32 sint) struct kvm_vcpu_hv_synic *synic = vcpu_to_synic(vcpu); struct kvm_vcpu_hv *hv_vcpu = vcpu_to_hv_vcpu(vcpu); struct kvm_vcpu_hv_stimer *stimer; - int gsi, idx, stimers_pending; + int gsi, idx; trace_kvm_hv_notify_acked_sint(vcpu->vcpu_id, sint); @@ -214,19 +214,13 @@ static void kvm_hv_notify_acked_sint(struct kvm_vcpu *vcpu, u32 sint) synic_clear_sint_msg_pending(synic, sint); /* Try to deliver pending Hyper-V SynIC timers messages */ - stimers_pending = 0; for (idx = 0; idx < ARRAY_SIZE(hv_vcpu->stimer); idx++) { stimer = &hv_vcpu->stimer[idx]; if (stimer->msg_pending && stimer->config.enable && !stimer->config.direct_mode && - stimer->config.sintx == sint) { - set_bit(stimer->index, - hv_vcpu->stimer_pending_bitmap); - stimers_pending++; - } + stimer->config.sintx == sint) + stimer_mark_pending(stimer, false); } - if (stimers_pending) - kvm_make_request(KVM_REQ_HV_STIMER, vcpu); idx = srcu_read_lock(&kvm->irq_srcu); gsi = atomic_read(&synic->sint_to_gsi[sint]); -- 2.19.1