From patchwork Fri Mar 9 15:11:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 131151 Delivered-To: patch@linaro.org Received: by 10.80.194.209 with SMTP id u17csp1135577edf; Fri, 9 Mar 2018 07:14:09 -0800 (PST) X-Google-Smtp-Source: AG47ELu4d3xS/hXZymIYrRO1CDtJMZy3PSwCnmBhMtM/rcMTAeF68fVW0R01OyslD9oJy9r7T0nt X-Received: by 10.107.148.16 with SMTP id w16mr572686iod.225.1520608449292; Fri, 09 Mar 2018 07:14:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520608449; cv=none; d=google.com; s=arc-20160816; b=HcnBRKGGJsgtbliEQLAGcGmsLeprzxHN6GnqjAKwtcKWcZn3nZxQW5jtH5hDGp27TL XM3D4//1C2JnU5GFMI2jUqqfDKFKnmS9QQGABx4gQ0KMUsDBfWTpP3g0dzvIpwnVn8ZX 2pHoE8vFViNyYYRLdjPYil4N2E1g0bIEiU1VTfsJiHkONXpQwpThVVe0Hc4lRagc/CIa aHEn1X1AgzkXNW/UNqiHJ+NmylFiheKuGdCVG5xcDosJu1Gy+UdKzXnRc4yC/4ZLJyZS 7aTcnGHwW1Fz5yg+0aySJUMTa/TnfRc7dRApN+Isi5MbQYPwPjTWhD1zl+jTsNSps2A3 b9Hg== 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=NmHbTjgMflT+HyTm0Ep/O8gVM0gcNSkq8FR++KUuV2s=; b=byEehYenUdwdmtYknZSOauiCoMjvbHm8aOAk9Toho+jdLByBv1YRBc3p0oNz7bOcwg WhU5we54/nKfXKDn46SDfCJjYHAdT4nOj1A+0TG7wfFvei8D9dRNURe+D7k0X9CrnHWX sRtIv6iNy8EtvIHWl/52bO8TdZO/vXvBPqKLwAXOs3Gf4gDgDOL1qmOjYDaJVZWNSVN8 zod+2UyZaVtZ59dYkh2Y31dW6A06Ze0t7Fw9uqMBP8AFy92Bcy0vlRH1nZNbuztDxesU 5us15sDv/IyG02iJwNEjAslSRsBVk10gsZOqSDKPeICLMCOPUUvgykr6WGx3y6qdipP1 P7rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cvX/qbsp; 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 g19si992861iob.234.2018.03.09.07.14.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 07:14:09 -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=cvX/qbsp; 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 1euJge-00062M-4c; Fri, 09 Mar 2018 15:12:00 +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 1euJgd-00061F-BM for xen-devel@lists.xenproject.org; Fri, 09 Mar 2018 15:11:59 +0000 X-Inumbo-ID: 0afa4aff-23ac-11e8-ba59-bc764e045a96 Received: from mail-wr0-x242.google.com (unknown [2a00:1450:400c:c0c::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 0afa4aff-23ac-11e8-ba59-bc764e045a96; Fri, 09 Mar 2018 16:10:46 +0100 (CET) Received: by mail-wr0-x242.google.com with SMTP id f14so9334632wre.8 for ; Fri, 09 Mar 2018 07:11:58 -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=jg4mGSqcmSy9zuFx/cCcSkv7Wxp8VOmCtlPQ79onVWM=; b=cvX/qbsplQVn20gGm8uy2VtdW5LMTxrfApCYIYgZXw9ShQY6KwsKh4hKDTmEvHXhL6 X+UvOcDc16SP6VNvHo8MC/jUIyRckE2RAM1qoJDDwMwymx4lbmplCccWecEDWZWh5YrF lwhe3v1+IX4wshYJAgxY7MdpEKgQS9jK2h3fo= 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=jg4mGSqcmSy9zuFx/cCcSkv7Wxp8VOmCtlPQ79onVWM=; b=Ymunq4lgt50mzyQi9o7feKvuDINhIDxxHgy5NaWmy9jZq9A42Y7C4je9AstMW1LeHL 7gcuj97spV8S68k87CCQEtnXlAlq/8BAh6XM8qMZIcITA5/Cwg2FkjHUkEnUz7I4SF8/ h+ZVqBgAkXaRMXjRr5rSVepZL794YvpPdFKPEAqF6ychjOkj+qcNbrug8tSREo81o0uO Rq5IKsTuNCsIkejX+nU0sXmj79X2CBitA7A1sxjoRDNEukfOKm98g7cp9BIMAWi1QP9i iK4CwfljvTetGOknZ7FM0HDDL+cz8OV5toRCpVpKAssZXXprRjPv10OMw/Y/4LwHzqMg 2w+Q== X-Gm-Message-State: APf1xPAV3XIZ2YA7DRHZYIQNkWSlH0ltdXuyQJVpwqm0WBbyBrzZXNBC byUegV212cEZ8dOjYOi09GZ7sA== X-Received: by 10.223.164.20 with SMTP id d20mr25933224wra.136.1520608317507; Fri, 09 Mar 2018 07:11:57 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id 1sm1721198wmj.35.2018.03.09.07.11.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 07:11:57 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Fri, 9 Mar 2018 15:11:30 +0000 Message-Id: <20180309151133.31371-15-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180309151133.31371-1-andre.przywara@linaro.org> References: <20180309151133.31371-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 14/17] 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. Signed-off-by: Andre Przywara --- - Rename to vcpu_kick(), to blend in with existing (x86) prototype xen/arch/arm/domain.c | 12 ++++++++++++ xen/arch/arm/vgic.c | 11 +++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index bc10f412ba..650712e0f2 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(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 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; }