mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: How to know if there is a pending interrupt when they are masked?
Date: Thu, 14 Feb 2019 17:16:07 +0100	[thread overview]
Message-ID: <9ff685f9-d378-1942-3678-7aff8f5b3aa3@linaro.org> (raw)
In-Reply-To: <3a4ca5d5-9b90-e4e0-84ab-420bf5e460db@arm.com>


Hi Thomas,

thanks for the answer,

On 14/02/2019 16:47, Marc Zyngier wrote:
> On 14/02/2019 15: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.
> 
> On arm64, reading ISR_EL1 would give some indication of that, but...

Does 'some indication' means as soon as we read the ISR_EL1 it may be
outdated right after ?

>> 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.
> 
> as Thomas explains, the potential race is pretty tight.

Is a simple hack possible on ARM64 to check if it is worth or not?

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2019-02-14 16:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 14:34 Daniel Lezcano
2019-02-14 15:35 ` Thomas Gleixner
2019-02-14 15:47   ` Marc Zyngier
2019-02-14 16:16     ` Daniel Lezcano [this message]
2019-02-14 16:12   ` Daniel Lezcano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ff685f9-d378-1942-3678-7aff8f5b3aa3@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®