From patchwork Fri May 11 12:19:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 8533 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 47E7623E00 for ; Fri, 11 May 2012 12:20:50 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id 0E525A18B35 for ; Fri, 11 May 2012 12:20:49 +0000 (UTC) Received: by ggnf1 with SMTP id f1so1521301ggn.11 for ; Fri, 11 May 2012 05:20:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:mime-version:content-type :x-gm-message-state; bh=dcteCD/4b7OhxS4pOe/hd1FH2vuu1yTh8qdge+k7nfo=; b=k/fBp/NwsZqP44f4Z7XVuLeZQLkkXfHznmytr2YXjO5o4lS6SfZhDoU2T7Yb9LJ0WA k7Dz7c8y/gfI5HhqTfbB8mFcDvAVopR4594gSF+/SeVrpZ7QBhlnx7Sj+rFzeewYHDwi rlvqwloZrF0J8egrAG9DBbu69d4/MmXFJ9TX98zceacabqrUbnRRSt2o2YHqXeHCuwlY j3bpAVkw4e+LHAwVMsLmGIZh7VomeC6D1Vx6o10w6z8mNIArMNK+hjU+UHtWC99XYGL/ A8qoPOrKUsiWqzDHEtY3G1vE5xK9PRev6oq4egnxqIdYha3eYz3f/7Kpa5qh55ilR3op 3ufg== Received: by 10.50.181.164 with SMTP id dx4mr1605371igc.1.1336738849083; Fri, 11 May 2012 05:20:49 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.73.147 with SMTP id q19csp169594ibj; Fri, 11 May 2012 05:20:47 -0700 (PDT) Received: by 10.14.52.133 with SMTP id e5mr1872684eec.127.1336738847381; Fri, 11 May 2012 05:20:47 -0700 (PDT) Received: from eu1sys200aog105.obsmtp.com (eu1sys200aog105.obsmtp.com. [207.126.144.119]) by mx.google.com with SMTP id p47si1509377eef.204.2012.05.11.05.20.43 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 11 May 2012 05:20:47 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.119; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.119 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob105.postini.com ([207.126.147.11]) with SMTP ID DSNKT60EFnx4QxWhOJcddxNYM09mlenBZTfn@postini.com; Fri, 11 May 2012 12:20:47 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id E145B40; Fri, 11 May 2012 12:19:49 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 5991457; Fri, 11 May 2012 09:56:43 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 17A84A8081; Fri, 11 May 2012 14:20:01 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Fri, 11 May 2012 14:20:05 +0200 From: Linus Walleij To: Cc: Julia Lawall , Linus Walleij , , Brian Swetland , David Brown , Daniel Walker , Bryan Huntsman Subject: [PATCH] RFC: ARM: msm: re-read DMA IRQ status on each iteration Date: Fri, 11 May 2012 14:19:51 +0200 Message-ID: <1336738791-15037-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.9.2 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQnIE+C2J2qJ0524l9/A+hns1yD011uIAqS3QfEgwkG29OaeFEQD2cdt0GpCYX/O6wboL+qg From: Linus Walleij We have recently found a number or erroneous IRQ handlers in the kernel where the flag iterator loop miss IRQs that get raised when the loop is executing. This was spotted in the MSM DMA driver by Julia Lawall using this cocinelle snippet: @@ expression pending,gedr,e1; statement S; @@ *pending = readl(gedr); ... when != pending = e1 while (pending) S Cc: arve@android.com Cc: Brian Swetland Cc: David Brown Cc: Daniel Walker Cc: Bryan Huntsman Reported-by: Julia Lawall Signed-off-by: Linus Walleij --- David et al: I'm uncertain about this one since the comment says that the read clears the IRQ, such as if the read operation itself will latch out the flag register and clear it. (I encountered this behaviour in the MOS6569 VIC raster IRQ register $D019 in the 1980s if I'm not mistaken.) --- arch/arm/mach-msm/dma.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-msm/dma.c b/arch/arm/mach-msm/dma.c index 02cae5e..ee11afe 100644 --- a/arch/arm/mach-msm/dma.c +++ b/arch/arm/mach-msm/dma.c @@ -147,10 +147,8 @@ static irqreturn_t msm_datamover_irq_handler(int irq, void *dev_id) spin_lock_irqsave(&msm_dmov_lock, irq_flags); - int_status = readl(DMOV_ISR); /* read and clear interrupt */ - PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status); - - while (int_status) { + while (int_status = readl(DMOV_ISR)) { + PRINT_FLOW("msm_datamover_irq_handler: DMOV_ISR %x\n", int_status); mask = int_status & -int_status; id = fls(mask) - 1; PRINT_FLOW("msm_datamover_irq_handler %08x %08x id %d\n", int_status, mask, id);