From patchwork Thu May 22 12:32:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 30623 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7521D20671 for ; Thu, 22 May 2014 12:53:24 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id id10sf2715478vcb.0 for ; Thu, 22 May 2014 05:53:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=ybFOtZX4xfb5AePOTvII1Oa2FG0ai+EbhDB5EpSim1w=; b=jU6WJeaPNcUP8zzvHuz7RrVzEfyCxhA4sg9DXYl/vPpFSDgS3lmPMNDdPk9Jvr84zM 0rqlAVP+XZXB/y8ylfDPKBapHTnJf123rYou6iaDdhpDdDW3+AFIiZvgLylwJ8uGIyov rNu2avzrgm1U1n+SBFL3NQwO0se3PulTDYC5LMpnvL5wHf2VEx2zoeTBa9NG82lgGRFW Sq0a9Gm48yJD27HgW20lXhOQmYLYxT0wLx0YMBvlF6Vn/yndKtMLIVO2da3NFUdRxwTM uMSw4G3DJo1JcfNCFDfJK/Nt2riEoJ1aPn10RS5DS6T/HI/pQpIvs5VNw8vHU4osyjlz VVFQ== X-Gm-Message-State: ALoCoQlZK8icqeHgJPNAuZHkQ3pfrdJK+Ujin+YysmVwZBCu7YAhZnjRp8fbjuAeClZtb3yEpBHl X-Received: by 10.236.7.1 with SMTP id 1mr23953263yho.28.1400763204292; Thu, 22 May 2014 05:53:24 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.99 with SMTP id l90ls1316987qge.13.gmail; Thu, 22 May 2014 05:53:24 -0700 (PDT) X-Received: by 10.52.238.161 with SMTP id vl1mr155453vdc.88.1400763204104; Thu, 22 May 2014 05:53:24 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id e8si3063535vdv.65.2014.05.22.05.53.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 22 May 2014 05:53:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id db11so4305756veb.36 for ; Thu, 22 May 2014 05:53:24 -0700 (PDT) X-Received: by 10.221.7.71 with SMTP id on7mr15752553vcb.18.1400763204013; Thu, 22 May 2014 05:53:24 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp196155vcb; Thu, 22 May 2014 05:53:23 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr15682198vcb.24.1400763203684; Thu, 22 May 2014 05:53:23 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id f2si3064701vds.107.2014.05.22.05.53.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 May 2014 05:53:23 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnSTJ-0006Bf-1x; Thu, 22 May 2014 12:51:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WnSTH-0006BC-GW for xen-devel@lists.xensource.com; Thu, 22 May 2014 12:51:43 +0000 Received: from [85.158.139.211:51541] by server-8.bemta-5.messagelabs.com id 90/2E-11310-ED2FD735; Thu, 22 May 2014 12:51:42 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1400763100!2943018!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17146 invoked from network); 22 May 2014 12:51:42 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 22 May 2014 12:51:42 -0000 X-IronPort-AV: E=Sophos;i="4.98,887,1392163200"; d="scan'208";a="133892482" Received: from accessns.citrite.net (HELO FTLPEX01CL03.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 22 May 2014 12:51:40 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.80) with Microsoft SMTP Server id 14.3.181.6; Thu, 22 May 2014 08:51:39 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WnSBI-0003tn-Dm; Thu, 22 May 2014 13:33:08 +0100 From: Stefano Stabellini To: Date: Thu, 22 May 2014 13:32:30 +0100 Message-ID: <1400761950-25035-13-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v8 13/13] gic_remove_from_queues: take a lock on the right vcpu X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: At the moment gic_remove_from_queues doesn't handle the case where the guest kernel disables an irq on a different vcpu compared to the one currently receiving the interrupt. Make sure to take the right vcpu lock before removing the irq from lr_queue. Document that the function should remove irqs from LR registers too. Signed-off-by: Stefano Stabellini --- xen/arch/arm/gic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 2bfaba9..bb598eb 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -589,9 +589,16 @@ static inline void gic_add_to_lr_pending(struct vcpu *v, struct pending_irq *n) void gic_remove_from_queues(struct vcpu *v, unsigned int virtual_irq) { - struct pending_irq *p = irq_to_pending(v, virtual_irq); + struct pending_irq *p; unsigned long flags; + /* TODO: do not assume SPI delivery on vcpu0 */ + if ( virtual_irq >= 32 && v->vcpu_id != 0 ) + v = v->domain->vcpu[0]; + + p = irq_to_pending(v, virtual_irq); + + /* TODO: evict the irq from LRs */ spin_lock_irqsave(&v->arch.vgic.lock, flags); if ( !list_empty(&p->lr_queue) ) list_del_init(&p->lr_queue);