Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp125409imj; Thu, 14 Feb 2019 16:51:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IaZlJvsoN0KE1apOhrZIuHROlxxsO+jgObKNIMtmn12UU/RYR2f6GApYQapDfftn+1vovX5 X-Received: by 2002:a63:9712:: with SMTP id n18mr2646334pge.295.1550191894873; Thu, 14 Feb 2019 16:51:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550191894; cv=none; d=google.com; s=arc-20160816; b=G/k5uESGy1rnuxjbWc30hSexjg42C1NmvX7Kj+jaFoiaSK9JWh93RPV8DAeWZZW7eQ TzfKppn8toXMCLh8e8WV0UFOiwYJhq7Y+y8l/edIgi7nqVj9II/OKFUcDupon6PF8H29 tPU33T0jrpncKA1Is6uoKxIewMBBOgUNjom3a4lrH2znuLZ2WDyVBWWLNO8ZQnsGckp9 d/90J2boIo/oBnFjvge1MT48cjcdY5lPArnqIZvHsygswHi2/0eOiZu3soFcvkctzR5i sgI6pFrruUpN5xSRBxKqCTkerQfdW6AupBaKaDC7dmHcJAj4PS9ZsZ78g0GXq1YuCS/R LAzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=nymx3Vre5M6XEnXB5ncvsqDZf0lwUy52Ov5flAUtP3g=; b=Cc8ycaODNAVsvF+raC5SOHJqDMm6Z57Vx5s2NfVGf9MCTx9vCeO2YV4kr28a1EfPkf A+BSBjmGfwKOf5bKE0KXeZyboVZ5gOH7iJxYIlI9Ts2TRbwnUh30N4FebI3n1E5V8KUU FLUO9D6q1i23VL23WGDvsqALASicKHcYyYZxXjxVm4WY+1L4ibgtM/U75058kFOVrfzD rGWgV6wevtDQXFp3xmnYyDQGg3D8kPttxgCkjipu5BDiGul093+Qfpq9G65v5oOSVRdE 41bkjdWXbdZQ++RFUcV220y/GWgNUrIlo528Mbx3j4t7p7COymmxvFBPb4GuiAjCfa/4 vOSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="obDF/BGh"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si4019561plb.200.2019.02.14.16.51.19; Thu, 14 Feb 2019 16:51:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="obDF/BGh"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502648AbfBNQMm (ORCPT + 99 others); Thu, 14 Feb 2019 11:12:42 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:52484 "EHLO mail-wm1-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502615AbfBNQMk (ORCPT ); Thu, 14 Feb 2019 11:12:40 -0500 Received: by mail-wm1-f49.google.com with SMTP id m1so6914145wml.2 for ; Thu, 14 Feb 2019 08:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=nymx3Vre5M6XEnXB5ncvsqDZf0lwUy52Ov5flAUtP3g=; b=obDF/BGh+f0OUx9xmimd3aMQ/DZZX3BaslPUUYSPb3pWzJK4ppZhuK9Y1sKgs6Dhsf 0XejuV+Rl0SYCcvZ1ZEnGSQrk0hlFS7W1nwW0c/BZ1Y0bJTVI3Z31wBLi7bHeCP1DDo8 QvHWQABpJB7YK+9SgzMIy0zMlUDoNqGMG77ol+QZqu0MkQoXG7DlRLcNNn0ZTkjmJGWe kv+QwKbNlKg5jAmMLkYervkqLEd2R2srPYDHJqhND/0ubk78j2iC5l8Lc2gQQM9KVTol 63TxzU9Ek7mex2SoK1N9ymc/UHXDGpVzLB2lrdssUVR/FGhAf0tz2PkstGbIXD2gmVWR 7jog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=nymx3Vre5M6XEnXB5ncvsqDZf0lwUy52Ov5flAUtP3g=; b=WDk8j0S9syOSuOJGIrPLQ4KXO+7MT/Mp32NrRBDdLkBNlflR7cW02ZHavcPyZVcDcm qdbVl0Juq2s0aeXWxpWt+M5F2LP/Qbdi0uOGWzU/7jBp7ZKBN5yQ1RL896Ee1fAWPE+u LOSnP9Y5fPw6vUrOW3NV+6j3tCHZyh2HzVVhKGurYjVk089jIGIWc0pCBTKVHOKBSUJq qoHVhnMYkfM/x2zXGWb7zphZl+mOt/tVsCBmN9oGaeCn5ygp9w4/rxh5OUHDDzbKK+34 nQrdyi/y1wXKI1ODdIiMPxAJi9tow3AaRuF0P1lhKXEPwHR4oJoJB9Mq8sTMD3PYkgt3 Srrg== X-Gm-Message-State: AHQUAuaY73qsS/liiyH+9GVTfRBTMcexR8kvBt1FR9oKr0n3jPFRqZcz bIxtVipjBOH5hgCy1ljJ+vQCuQ== X-Received: by 2002:a7b:c0d5:: with SMTP id s21mr3587827wmh.153.1550160758374; Thu, 14 Feb 2019 08:12:38 -0800 (PST) Received: from [192.168.27.66] (sju31-1-78-210-255-2.fbx.proxad.net. [78.210.255.2]) by smtp.googlemail.com with ESMTPSA id v6sm4185127wrd.88.2019.02.14.08.12.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 08:12:37 -0800 (PST) Subject: Re: How to know if there is a pending interrupt when they are masked? To: Thomas Gleixner Cc: Marc Zyngier , Linux Kernel Mailing List , "Rafael J. Wysocki" References: From: Daniel Lezcano Message-ID: <663d069e-55c9-c4f0-dc84-f6145b998192@linaro.org> Date: Thu, 14 Feb 2019 17:12:36 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Thomas, On 14/02/2019 16:35, Thomas Gleixner wrote: > On Thu, 14 Feb 2019, Daniel Lezcano wrote: >> today we have the possibility to mask the local interrupt with the >> command local_irq_disable / local_irq_enable. >> >> The power management path disables the local interrupt in order to >> initiate a power down sequence. If there is a pending interrupt this one >> will make the power down function to abort, thus exiting right after >> calling the shutdown function after costly operations. It could be >> interesting to check if there is a pending interrupt before initiating >> the power down sequence. >> >> Is there a way to know if there is a pending interrupt on the current >> CPU when the local interrupt are disabled? Something like, >> local_irq_pending() function ? > > We have nothing like that today, but it would be possible to implement this > at least on x86 by peeking the local APIC registers. > > OTOH, the question is whether it's worth the trouble because the interrupt > could come in right after the query and the same issue which you want to > address persists. It only makes sense if it reduces the time window so > significantly that it actually matters. Yes, I agree. It should be worth only if we can prove we enter the deep idle sequence with pending interrupts much more often than what we expect. Actually, we have a similar action when the need_resched() is true, we abort the idle sequence and exit the loop. -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog