From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753036Ab0EFXsn (ORCPT ); Thu, 6 May 2010 19:48:43 -0400 Received: from mail-vw0-f46.google.com ([209.85.212.46]:41368 "EHLO mail-vw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790Ab0EFXsm convert rfc822-to-8bit (ORCPT ); Thu, 6 May 2010 19:48:42 -0400 MIME-Version: 1.0 In-Reply-To: References: <201005062128.31068.rjw@sisk.pl> Date: Thu, 6 May 2010 16:48:41 -0700 Message-ID: Subject: Re: [PATCH 1/8] PM: Add suspend block api. From: =?ISO-8859-1?Q?Arve_Hj=F8nnev=E5g?= To: Alan Stern Cc: "Rafael J. Wysocki" , Linux-pm mailing list , Kernel development list , Tejun Heo , Oleg Nesterov , Len Brown , Pavel Machek , Randy Dunlap , Jesse Barnes , Nigel Cunningham , Cornelia Huck , Ming Lei , Wu Fengguang , Andrew Morton , Maxim Levitsky , linux-doc@vger.kernel.org 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, May 6, 2010 at 12:40 PM, Alan Stern wrote: > On Thu, 6 May 2010, Rafael J. Wysocki wrote: > >> > Here's a completely new issue.  When using opportunistic suspends on an >> > SMP system, it could happen that the system gets a wakeup event and >> > this routine starts running again before the event's IRQ handler has >> > finished (or has enabled a suspend blocker).  The system would >> > re-suspend too soon. >> >> This routine will be run from a freezable workqueue. > > But how do you know that processes won't get unfrozen until all the > pending IRQs have been handled?  Imagine something like this: > >        CPU 0                   CPU 1 >        -----                   ----- >        Wake up non-boot CPUs >        Resume devices          Invoke the IRQ handler > >        [ CPU 0 should wait here for the handler to finish, >          but it doesn't ] > >        Defrost threads         Handler running... >        Workqueue routine runs >        Start another suspend >                                Handler enables a suspend blocker, >                                but it's too late It is not optimal, but it is not too late. We check if any suspend blockers block suspend after disabling non-boot cpus so as long as this is done in a way that does not lose interrupts the resuspend attempt will not succeed. -- Arve Hjønnevåg