From patchwork Mon Mar 5 16:03:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 130661 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2853644lja; Mon, 5 Mar 2018 08:07:03 -0800 (PST) X-Google-Smtp-Source: AG47ELun85eDt06R6JOoeWlDUeISbxOEXyl5wFlRdV+8XeM+QqxfdZJ3NomNKNFLlBTt6c0KL33f X-Received: by 10.107.7.23 with SMTP id 23mr18251454ioh.113.1520266023207; Mon, 05 Mar 2018 08:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520266023; cv=none; d=google.com; s=arc-20160816; b=gNddhO1EDPe2t0uGXrAGVhxFYWhyw2M0QVGN5WXT2lQxxktQyu1GEQ/5KZO3jg0YzH wvuHOxRJkaSAzpOnCvc2mDTH5KoHdGLzWXoMxWEZLWeQhgqVDIAAmO7Dq8NEbx73z/dO TkGKEq9gjs+5AHTTE072RO4F8mh6/iWK88uUYo5HB3Ik5JC/eI4VBuVdi/5eOAJahx/+ I91wq5ROw7qDfCea+Rlg7Yf7NLfY21/0YXUoadSWX2iDvp2Ou90sTFkTDBmGEpHHvOC2 tMQ2PtjZUw0vrYcJdsf/ALUsQjXbvD3Ai4iJcmDAr/ifjPL+dEMgaxxD1aw6NEXyd/EW N0tw== 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=u6CPaDnPMJ9WrEe+1Wq2kKRHzZBkEE2IiV5TRZ7x4XY=; b=wtiVpfnaUKE5BX+8PXk2xU6AhwTm4l7a3B42e0xkjSaUuGm82UL+fg801Yj9jZ1Yoy fVkdUvCVS+MSR3iuLLEeNM1HYhFzxdhrK1eCu9IkkYK+I/jypGnQ6t8o/acenN7APFsw Hc3bQ+zexRpfLffcz49iISESZBVlz9S/bG1JQvd91NNnjokviYn4wO2c3eJDPEHNU3iI ZPSQs8tgCRPFhfYdC3MjR5IZBc1f0/lwxCUNdHe3N5/6ws3fYEAi462MfDYTnh2H0I9C +mjaMDkmYOpHbWQIc8b9gNqXmh+OBh81ls5qFk3k9hSFBruMY//ZRygx27Tp9tUhg92R VI6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=kVpTtYQf; 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 b129si5487321ith.156.2018.03.05.08.07.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 08:07:03 -0800 (PST) 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=kVpTtYQf; 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 1essbS-0007PI-CN; Mon, 05 Mar 2018 16:04:42 +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 1essbR-0007Ni-Nx for xen-devel@lists.xenproject.org; Mon, 05 Mar 2018 16:04:41 +0000 X-Inumbo-ID: c1fc11f2-208e-11e8-ba59-bc764e045a96 Received: from mail-wm0-x243.google.com (unknown [2a00:1450:400c:c09::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id c1fc11f2-208e-11e8-ba59-bc764e045a96; Mon, 05 Mar 2018 17:03:35 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id h21so16912052wmd.1 for ; Mon, 05 Mar 2018 08:04:40 -0800 (PST) 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=O9Ul8HQGzPYMtJZlrgVJbTzUp4+dhr0vROOXD+mvNlU=; b=kVpTtYQfveHvZKyVeqMZIYW5AyHGyDWQc2JvrkI3t02rkEcL7UlR82kI8V5y7GEYYm DFfRZ6n6nTw1W0aPb2JJOPDmgHEQlBlWvsBh+SxXq0cMxeLF1/Do5WwtPlrIKw6OjWZr r3S2yvAafibuD5uvtOh+YgxK5ZsE+wsZYbICs= 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=O9Ul8HQGzPYMtJZlrgVJbTzUp4+dhr0vROOXD+mvNlU=; b=Btp6u8LeIX5/EUvZd+1ziONVwJhhTBBKLI2sgJFHTO6m4rD9UbHQJTFNk5gtM4tKoF qfYBoNtvyKqs10lErwfu+iqEjhhmL8cfX57jLTNFIvc3y/Y0IRr3eVlEQNNBQ8jPU2Wj 5c+AUAvqsoMAnRseLRGS61TFl5wnkDEEoCXvRwJuk6VRMKOGspfOBAJtuwucoBd9nJk1 TyiRWyYzHFLvrPHw1tVuH182mOQzF4rKyfi2C66/ZkkL66dbKQbWLMbRHyHRKar2UbYD 3+aomGOVMv83G7XujvVs9Mykp+JvsiQ1s1Em6fWhPVeP9ihT0b8VQUJo1kgtJujMJq9E TKiA== X-Gm-Message-State: AElRT7GqSg/5JroC4bvUF485I2pGTcU4/qNZxLOcN5SRcHmlFj+fj7Hu fpRa3+MGyP+fdb9rwMnbyTw0XA== X-Received: by 10.28.231.10 with SMTP id e10mr9095847wmh.125.1520265879963; Mon, 05 Mar 2018 08:04:39 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id y6sm6574381wmy.14.2018.03.05.08.04.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 08:04:39 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Mon, 5 Mar 2018 16:03:35 +0000 Message-Id: <20180305160415.16760-18-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180305160415.16760-1-andre.przywara@linaro.org> References: <20180305160415.16760-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 17/57] ARM: Introduce kick_vcpu() 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 in the new kick_vcpu() function and make this available to the whole Xen arch code. Signed-off-by: Andre Przywara --- Changelog RFC ... v1: - new patch xen/arch/arm/smp.c | 14 ++++++++++++++ xen/arch/arm/vgic.c | 10 ++-------- xen/include/asm-arm/smp.h | 3 +++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c index 62f57f0ba2..381a4786a2 100644 --- a/xen/arch/arm/smp.c +++ b/xen/arch/arm/smp.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include void flush_tlb_mask(const cpumask_t *mask) { @@ -32,6 +34,18 @@ void smp_send_call_function_mask(const cpumask_t *mask) } } +void kick_vcpu(struct vcpu *vcpu) +{ + bool running = vcpu->is_running; + + vcpu_unblock(vcpu); + if ( running && vcpu != current ) + { + perfc_incr(vgic_cross_cpu_intr_inject); + 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 3c77d5fef6..e44de9ea95 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -530,7 +530,6 @@ int 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 +589,9 @@ int 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)); - } + kick_vcpu(v); return 0; } diff --git a/xen/include/asm-arm/smp.h b/xen/include/asm-arm/smp.h index 3c122681d7..7c8ef75789 100644 --- a/xen/include/asm-arm/smp.h +++ b/xen/include/asm-arm/smp.h @@ -28,6 +28,9 @@ extern void init_secondary(void); extern void smp_init_cpus(void); extern void smp_clear_cpu_maps (void); extern int smp_get_max_cpus (void); + +void kick_vcpu(struct vcpu *vcpu); + #endif /*