From patchwork Thu Nov 20 10:53:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 41228 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f72.google.com (mail-ee0-f72.google.com [74.125.83.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2555323588 for ; Thu, 20 Nov 2014 10:54:55 +0000 (UTC) Received: by mail-ee0-f72.google.com with SMTP id e53sf1903673eek.11 for ; Thu, 20 Nov 2014 02:54:54 -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 :mime-version:cc:subject:precedence:list-id:list-unsubscribe :list-post:list-help:list-subscribe:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=fc72l/l85sFKunLYoH9ZL8dM9h5BrTM2G7BB2N7xu6g=; b=DHjDRurEKdx/SY158b1jasDht0UxVwG2wnWrPO2qi0y4isyWKWsHUS1WwnXnxnySQd jRdF1Lj8rbPqBg9Ka/L0ueAilORWhvpj/QvuTjSid+AEPrBHW+e9Fobqs6MSAvwuX5Rs 3x1PHBFCUhgWtquBmiKPAZdvCF1j2U0vMjQq5DDU2OLzP+se+LDr3Q0tIt8QOZV8mAmA gEeXGJIVvIqU6KZgflHDmy6+X8MHpKXwA5m/Xp2KYLvjThxoe6BFhj/KXJ2MqEO62MG/ EkQwHF8WJJm3PdrTEFWjsXZcwkLM2eo/4rUQFk1wMCR4xjsUd9rGg6tS4Gil7YRz33Z6 CBfA== X-Gm-Message-State: ALoCoQn4dEGXB1IM+LKbESrS3yaOpF0QADOnCH1hY86uVoNk4MFjRbSN/IKnlpXjpWusU5EuFexA X-Received: by 10.112.163.229 with SMTP id yl5mr82857lbb.23.1416480894326; Thu, 20 Nov 2014 02:54:54 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.1 with SMTP id lk1ls56203lac.9.gmail; Thu, 20 Nov 2014 02:54:53 -0800 (PST) X-Received: by 10.112.72.225 with SMTP id g1mr2305607lbv.75.1416480893557; Thu, 20 Nov 2014 02:54:53 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id pz8si1900796lbb.36.2014.11.20.02.54.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 02:54:53 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id s18so2211606lam.15 for ; Thu, 20 Nov 2014 02:54:53 -0800 (PST) X-Received: by 10.112.62.166 with SMTP id z6mr2276647lbr.74.1416480893412; Thu, 20 Nov 2014 02:54:53 -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.112.184.201 with SMTP id ew9csp239929lbc; Thu, 20 Nov 2014 02:54:52 -0800 (PST) X-Received: by 10.224.72.5 with SMTP id k5mr2201787qaj.2.1416480891966; Thu, 20 Nov 2014 02:54:51 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id t10si2157073qam.80.2014.11.20.02.54.51 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 20 Nov 2014 02:54:51 -0800 (PST) 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 1XrPN0-00018r-JW; Thu, 20 Nov 2014 10:53:50 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XrPMz-00018i-MQ for xen-devel@lists.xensource.com; Thu, 20 Nov 2014 10:53:49 +0000 Received: from [193.109.254.147] by server-8.bemta-14.messagelabs.com id 1F/6C-03148-D38CD645; Thu, 20 Nov 2014 10:53:49 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1416480827!13706283!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.12.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15964 invoked from network); 20 Nov 2014 10:53:48 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 20 Nov 2014 10:53:48 -0000 X-IronPort-AV: E=Sophos;i="5.07,423,1413244800"; d="scan'208";a="194744685" Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.3.181.6; Thu, 20 Nov 2014 05:53: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 1XrPMw-0000pd-8e; Thu, 20 Nov 2014 10:53:46 +0000 From: Stefano Stabellini To: Date: Thu, 20 Nov 2014 10:53:24 +0000 Message-ID: <1416480804-25651-1-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@citrix.com, stefano.stabellini@eu.citrix.com, Ian.Campbell@citrix.com, andrii.tseglytskyi@globallogic.com Subject: [Xen-devel] [PATCH v2 for-4.5] xen/arm: clear UIE on hypervisor entry 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.215.42 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: UIE being set can cause maintenance interrupts to occur when Xen writes to one or more LR registers. The effect is a busy loop around the interrupt handler in Xen (http://marc.info/?l=xen-devel&m=141597517132682): everything gets stuck. Signed-off-by: Stefano Stabellini Reported-and-Tested-by: Andrii Tseglytskyi CC: konrad.wilk@oracle.com Reviewed-by: Julien Grall Tested-by: Julien Grall --- Konrad, this fixes an actual bug, at least on OMAP5. It should have no bad side effects on any other platforms as far as I can tell. It should go in 4.5. Changes in v2: - add an in-code comment about maintenance_interrupt not being called. diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 70d10d6..c6c11d3 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -403,6 +403,8 @@ void gic_clear_lrs(struct vcpu *v) if ( is_idle_vcpu(v) ) return; + gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 0); + spin_lock_irqsave(&v->arch.vgic.lock, flags); while ((i = find_next_bit((const unsigned long *) &this_cpu(lr_mask), @@ -527,8 +529,6 @@ void gic_inject(void) if ( !list_empty(¤t->arch.vgic.lr_pending) && lr_all_full() ) gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 1); - else - gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 0); } static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi) @@ -598,6 +598,10 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r * Receiving the interrupt is going to cause gic_inject to be called * on return to guest that is going to clear the old LRs and inject * new interrupts. + * + * Do not add code here: maintenance interrupts caused by setting + * GICH_HCR_UIE, might read as spurious interrupts (1023). As a + * consequence sometimes this handler might not be called. */ }