From patchwork Fri Feb 14 15:51:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 24654 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C4A09202B2 for ; Fri, 14 Feb 2014 15:53:32 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id wp4sf46102708obc.1 for ; Fri, 14 Feb 2014 07:53:31 -0800 (PST) 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=krGbotNFN+zaR51EhmkoeUFoBw504j1hNzOkM4JYBhg=; b=N/UpEcoWZ2675b2Qd8+JwQgimVMbcjvJwvCUoFPrWqhEV1jzEpJczBqePGeXyinzLK f/oxQLz5KaZGJnFhOefZ2OfG+ZXb2kxsKimtFvEm1o5xB0a2XCwZ1jpdn58x9KM48C6a nXvwjW5mcWfu9UHChUti9G7ORQZ1eXPkrudVxYtRa0OT35yzJ+Kvxj1jNyJIykFQc5RM WLVEINT8299W39iAMSNweheMFRxds8MbyumkE/meEqnvNqdHGpe6AdelLVVMsFQNvofo vPTtHG076RNa1mRuCMFFGTPnVWhHDW+YuiPSXcCfFAVBNvySqQln5MDK+LGSgb1tI5BM hGPw== X-Gm-Message-State: ALoCoQk9+XBC9JBAiuoU+gssIcKTeFyeQlog2yVXydil2YhsMZUoJIwvHa8CLibfGN1WAWuc8hnd X-Received: by 10.42.75.10 with SMTP id y10mr3118325icj.19.1392393211812; Fri, 14 Feb 2014 07:53:31 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.136 with SMTP id v8ls108091qgd.17.gmail; Fri, 14 Feb 2014 07:53:31 -0800 (PST) X-Received: by 10.52.247.168 with SMTP id yf8mr243676vdc.65.1392393211738; Fri, 14 Feb 2014 07:53:31 -0800 (PST) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id wm4si2044002vcb.79.2014.02.14.07.53.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Feb 2014 07:53:31 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id ie18so9240164vcb.26 for ; Fri, 14 Feb 2014 07:53:31 -0800 (PST) X-Received: by 10.220.250.203 with SMTP id mp11mr5830681vcb.2.1392393211654; Fri, 14 Feb 2014 07:53:31 -0800 (PST) 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.174.196 with SMTP id u4csp119345vcz; Fri, 14 Feb 2014 07:53:31 -0800 (PST) X-Received: by 10.236.3.10 with SMTP id 10mr2044687yhg.79.1392393211177; Fri, 14 Feb 2014 07:53:31 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id ca6si1789124qcb.95.2014.02.14.07.53.30 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 14 Feb 2014 07:53:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) 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 1WEL3x-00083x-3D; Fri, 14 Feb 2014 15:52:25 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WEL3u-00080E-Au for xen-devel@lists.xensource.com; Fri, 14 Feb 2014 15:52:22 +0000 Received: from [85.158.137.68:58465] by server-11.bemta-3.messagelabs.com id 63/48-04255-5BB3EF25; Fri, 14 Feb 2014 15:52:21 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1392393136!626381!3 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.9.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32542 invoked from network); 14 Feb 2014 15:52:20 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-16.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 14 Feb 2014 15:52:20 -0000 X-IronPort-AV: E=Sophos;i="4.95,845,1384300800"; d="scan'208";a="100823983" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 14 Feb 2014 15:51:46 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Fri, 14 Feb 2014 10:51:46 -0500 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1WEL3E-0004ww-IP; Fri, 14 Feb 2014 15:51:40 +0000 From: Stefano Stabellini To: Date: Fri, 14 Feb 2014 15:51:36 +0000 Message-ID: <1392393098-7351-8-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: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, Stefano Stabellini Subject: [Xen-devel] [PATCH-4.5 v2 08/10] xen/arm: avoid taking unconditionally the vgic.lock in gic_clear_lrs 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=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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: We don't actually need to call _gic_clear_lr with the vgic.lock taken, only in case the GICH_LR has to be free'ed we need the lock. Add a boolean vgic_locked parameter to _gic_clear_lr, so that we can avoid taking the lock if it has been already taken, or take the lock only in the necessary case if it hasn't. Signed-off-by: Stefano Stabellini --- xen/arch/arm/gic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 6386ccb..54be9ca 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -689,7 +689,7 @@ void gic_set_guest_irq(struct vcpu *v, unsigned int irq, gic_add_to_lr_pending(v, irq, priority); } -static void _gic_clear_lr(struct vcpu *v, int i) +static void _gic_clear_lr(struct vcpu *v, int i, int vgic_locked) { int irq; uint32_t lr; @@ -711,6 +711,7 @@ static void _gic_clear_lr(struct vcpu *v, int i) GICH[GICH_LR + i] = 0; clear_bit(i, &this_cpu(lr_mask)); + if ( !vgic_locked ) spin_lock(&v->arch.vgic.lock); if ( p->desc != NULL ) p->desc->status &= ~IRQ_INPROGRESS; clear_bit(GIC_IRQ_GUEST_VISIBLE, &p->status); @@ -721,6 +722,7 @@ static void _gic_clear_lr(struct vcpu *v, int i) gic_add_to_lr_pending(v, irq, p->priority); } else list_del_init(&p->inflight); + if ( !vgic_locked ) spin_unlock(&v->arch.vgic.lock); } } @@ -731,16 +733,14 @@ static void gic_clear_lrs(struct vcpu *v) while ((i = find_next_bit((const long unsigned int *) &this_cpu(lr_mask), nr_lrs, i)) < nr_lrs) { - spin_lock(&v->arch.vgic.lock); - _gic_clear_lr(v, i); - spin_unlock(&v->arch.vgic.lock); + _gic_clear_lr(v, i, 0); i++; } } void gic_set_clear_lr(struct vcpu *v, struct pending_irq *p) { - _gic_clear_lr(v, p->lr); + _gic_clear_lr(v, p->lr, 1); } static void gic_restore_pending_irqs(struct vcpu *v)