From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759335AbZB0ABH (ORCPT ); Thu, 26 Feb 2009 19:01:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755416AbZB0AAz (ORCPT ); Thu, 26 Feb 2009 19:00:55 -0500 Received: from yx-out-2324.google.com ([74.125.44.30]:11115 "EHLO yx-out-2324.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755394AbZB0AAy convert rfc822-to-8bit (ORCPT ); Thu, 26 Feb 2009 19:00:54 -0500 MIME-Version: 1.0 In-Reply-To: <200902270010.38291.rjw@sisk.pl> References: <200902221837.49396.rjw@sisk.pl> <200902270010.38291.rjw@sisk.pl> Date: Thu, 26 Feb 2009 16:00:52 -0800 Message-ID: Subject: Re: [RFC][PATCH 2/2] PM: Rework handling of interrupts during suspend-resume From: =?ISO-8859-1?Q?Arve_Hj=F8nnev=E5g?= To: "Rafael J. Wysocki" Cc: Linus Torvalds , Ingo Molnar , "Eric W. Biederman" , LKML , Benjamin Herrenschmidt , Jeremy Fitzhardinge , pm list , Len Brown , Jesse Barnes , Thomas Gleixner Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 26, 2009 at 3:10 PM, Rafael J. Wysocki wrote: > On Thursday 26 February 2009, Arve Hjønnevåg wrote: >> On Thu, Feb 26, 2009 at 2:10 PM, Linus Torvalds >> wrote: >> > >> > >> > On Thu, 26 Feb 2009, Rafael J. Wysocki wrote: >> >> >> >> Well, how exactly the $subject patch does cause this problem to happen? >> > >> > Rafael, the problem is that if an interrupt happens while it's disabled - >> > but before the CPU has actually turned all interrupts off - the CPU will >> > ACK the interrupt (but just set a flag for it being PENDING), so now the >> > chipset logic around it will not see it as pending any more, so now the >> > chipset won't auto-wake the CPU immediately (or more likely, it won't >> > even suspend it). >> > >> > It's trivial to fix multiple ways, so I wouldn't worry. The most trivial >> > way is to just have some sysdev drievr code simply do something like >> > >> >  static int sysdev_suspend() >> >  { >> >        for_each_irq(irq,desc) { >> >                if (!(desc->flags & IRQF_WAKE)) >> >                        continue; >> >                if (desc->flags & IRQ_PENDING) >> >                        return -EBUSY; >> >        } >> >        return 0; >> >  } >> > >> > and that should automatically mean that if any irq is pending, the suspend >> > will fail and we'll immediately wake up again. >> > >> > It looks trivial, and I don't understand why Arve can't just do the sysdev >> > thing. >> >> I can. My point is that the patch breaks our existing code. > > Is that a mainline kernel code? No, the msm suspend support has not been merged. > >> If anyone else uses edge triggered wakeup interrupt it may break from them as >> well. The main question if this should be fixed separately for every >> platform that needs it, or if pending wakeup interrupts should always >> abort sleep. > > Well, I'm not really sure if this is the problem.  In fact the problem is that > you have a regular device the interrupt of which can be a wake-up one.  I think Is that not a common case and what enable_irq_wake is for? > the problem wouldn't have existed at all if it had been a sysdev.  Is that > correct? How many sysdevs use interrupts? I found may drivers in the mainline kernel that use enable_irq_wake, but I did not see any that handle this race condition. -- Arve Hjønnevåg