From patchwork Thu Mar 15 20:30:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 131859 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp1579415ljb; Thu, 15 Mar 2018 13:33:31 -0700 (PDT) X-Google-Smtp-Source: AG47ELuQCe1U8qsvhT1tQnXyvj1g6ctrm/pG8SQMHi04NnFa0w0gUWOLDN42if06eUHiLOI4fetK X-Received: by 10.36.40.83 with SMTP id h80mr8067605ith.125.1521146011420; Thu, 15 Mar 2018 13:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521146011; cv=none; d=google.com; s=arc-20160816; b=NJB2VrIew6ke0VuwnivY/TEtV2o2YRdwrJySVW8vO4qQpJ4KcwKm/y5U5jUcoRypvh MYgHpB7JRRAky+A7Nh/Kn/tKOFhcl/e/ZVVvCg7L/V8x1yhQauNqNK2LqqTX7vsf0fm0 7g08BNm77D9hlrOXhDoIBfcs3IsIsUgQ1xdLk4/B4RXCQu1b0oLbegnh4OknxJceGSlE xwwt8YlUtIy17TNh8P+4D/ME2i4k9JVx/6FpXPZfLaFiRLXn1HTvBy2u5lAuhW1314K1 g/phtQqHyOUjUyqw6l4PAY081vA8iZxcBCDTM67+trI82hZ0t6BJJvyke2TYvn3sVIM+ /E8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=JavRs346+CzGn2C4c3HF3TstlwHvSqUtEHDsP4Gsicg=; b=jGCZQK8fPVlSlDzYuLKgCUxjVYxre/GEBjwVbtX2M2t3HFqPvAeodvyAz5puFVVhY6 YxLz6ygGRr7yxRusuy1y8BwTff2K0CoOPzBZ3G23MvB3amDK5M02971h2UVUdT2CuF5a YzIaEaUxVxG2aeiwGDTDxmRGJqnG9GaPKj8kXkgQ6gIATPdag3iSdUmkg/8nE2WLVwad T/K/H7kDwDMQ8+7CTIAHzTXUkjfOj9KjSm3BXkrVxGXxInuPId1qxI7W7PhgCNWCOq4p CKbZfpqbkVEeDX/qawJFyKr+jozL+MWg+W+ELwpQwZR780UFBybTDwFjA+nxSEeh+Jyc jeSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KYQDbu7y; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e196si3620704ioe.252.2018.03.15.13.33.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 13:33:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KYQDbu7y; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ewZWp-00030s-6f; Thu, 15 Mar 2018 20:31:11 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ewZWo-00030M-3A for xen-devel@lists.xenproject.org; Thu, 15 Mar 2018 20:31:10 +0000 X-Inumbo-ID: c71a724e-288f-11e8-9728-bc764e045a96 Received: from mail-wm0-x242.google.com (unknown [2a00:1450:400c:c09::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c71a724e-288f-11e8-9728-bc764e045a96; Thu, 15 Mar 2018 21:31:03 +0100 (CET) Received: by mail-wm0-x242.google.com with SMTP id q83so12887799wme.5 for ; Thu, 15 Mar 2018 13:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2qcLK3J71szBoWhOasGJe0rqaRNWtczdmhzF7mD+Zxc=; b=KYQDbu7ymfzIErLBihDa2fNe/Uity24Oibcpq9yFEbm6tUQx+SPWRjtyU6t/SUBvVY O8+8ICHIr2wycC0UaMZLqXxiQN6sZT6dmejhWJvX2WfuAt3JlWNxGkydg8PqHv6sGg+F fes+zlCLfMe4QH5lj3jwuhdu4hMrcYKXKb9EU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2qcLK3J71szBoWhOasGJe0rqaRNWtczdmhzF7mD+Zxc=; b=qjESRuIzbUj2xyytnsgviG0kiF/aKHvm7M+u60e1PkG5WmYcOjP2TtjbTdaX2vdCa+ bfdRqcNc+0IT+zZxQO0CAqskFFWg2ekpgsc/mAvwxUktp8MSvuO5Y3dSh2LKMzmNsX1v 7W4L5clz6zonsPwMn9LB6UEtOyxSMvmayZLvSDfTMvdGZQwbMNJeeS33/Y6LUTORqiOf 3/0fzw+sme60wDGSgGnXg/l8D6EuYjO4vWfwJJWHuEGnVVEGlLxyNbaZI7uGKLoztE5P 0hO0W61/f+g1u8kv0kKRmVP5E+GZPvNLqYuLd+rQFRfI2r7Fz9vevB6SsyCgRbYRPq7o w4Ug== X-Gm-Message-State: AElRT7FhHej6UWiULbP61j/ttEZHAPKszbI1m+s/s+AZJzsi+/ECKYMi UALCVW7q6UsMSF+yZLrKC7o04Q== X-Received: by 10.28.87.211 with SMTP id l202mr5436832wmb.32.1521145867095; Thu, 15 Mar 2018 13:31:07 -0700 (PDT) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id w125sm3217102wmw.20.2018.03.15.13.31.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 13:31:06 -0700 (PDT) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Thu, 15 Mar 2018 20:30:07 +0000 Message-Id: <20180315203050.19791-3-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180315203050.19791-1-andre.przywara@linaro.org> References: <20180315203050.19791-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v2 02/45] ARM: Implement vcpu_kick() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" If we change something in a vCPU that affects its runnability or otherwise needs the vCPU's attention, we might need to tell the scheduler about it. We are using this in one place (vIRQ injection) at the moment, but will need this at more places soon. So let's factor out this functionality, using the already existing vcpu_kick() prototype (used in x86 only so far), to make this available to the rest of the Xen code. Also adjust the perfcounter name to reflect the new usage. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changelog v1 ... v2: - use vcpu_kick() name from x86 and existing prototype - rename performance counter xen/arch/arm/domain.c | 12 ++++++++++++ xen/arch/arm/vgic.c | 11 +++-------- xen/include/asm-arm/perfc_defn.h | 3 ++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index bc10f412ba..4462e62599 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -967,6 +967,18 @@ void vcpu_block_unless_event_pending(struct vcpu *v) vcpu_unblock(current); } +void vcpu_kick(struct vcpu *vcpu) +{ + bool running = vcpu->is_running; + + vcpu_unblock(vcpu); + if ( running && vcpu != current ) + { + perfc_incr(vcpu_kick); + smp_send_event_check_mask(cpumask_of(vcpu->processor)); + } +} + /* * Local variables: * mode: C diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index eb09d9ca54..3fafdd0b66 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -26,6 +26,7 @@ #include #include +#include #include #include @@ -530,7 +531,6 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq, uint8_t priority; struct pending_irq *iter, *n; unsigned long flags; - bool running; /* * For edge triggered interrupts we always ignore a "falling edge". @@ -590,14 +590,9 @@ void vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq, list_add_tail(&n->inflight, &v->arch.vgic.inflight_irqs); out: spin_unlock_irqrestore(&v->arch.vgic.lock, flags); + /* we have a new higher priority irq, inject it into the guest */ - running = v->is_running; - vcpu_unblock(v); - if ( running && v != current ) - { - perfc_incr(vgic_cross_cpu_intr_inject); - smp_send_event_check_mask(cpumask_of(v->processor)); - } + vcpu_kick(v); return; } diff --git a/xen/include/asm-arm/perfc_defn.h b/xen/include/asm-arm/perfc_defn.h index 87866264ca..8922e9525a 100644 --- a/xen/include/asm-arm/perfc_defn.h +++ b/xen/include/asm-arm/perfc_defn.h @@ -33,6 +33,8 @@ PERFCOUNTER(vpsci_cpu_suspend, "vpsci: cpu_suspend") PERFCOUNTER(vpsci_cpu_affinity_info, "vpsci: cpu_affinity_info") PERFCOUNTER(vpsci_features, "vpsci: features") +PERFCOUNTER(vcpu_kick, "vcpu: notify other vcpu") + PERFCOUNTER(vgicd_reads, "vgicd: read") PERFCOUNTER(vgicd_writes, "vgicd: write") PERFCOUNTER(vgicr_reads, "vgicr: read") @@ -44,7 +46,6 @@ PERFCOUNTER(vgic_sysreg_writes, "vgic: sysreg write") PERFCOUNTER(vgic_sgi_list , "vgic: SGI send to list") PERFCOUNTER(vgic_sgi_others, "vgic: SGI send to others") PERFCOUNTER(vgic_sgi_self, "vgic: SGI send to self") -PERFCOUNTER(vgic_cross_cpu_intr_inject, "vgic: cross-CPU irq inject") PERFCOUNTER(vgic_irq_migrates, "vgic: irq migration") PERFCOUNTER(vuart_reads, "vuart: read")