mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <linux-rt-users@vger.kernel.org>
Subject: Re: question about irq_enter()/irq_exit() calling policy
Date: Wed, 30 Nov 2016 11:07:49 -0600	[thread overview]
Message-ID: <9c334b42-6b22-397f-93f6-e19e9163a17c@ti.com> (raw)
In-Reply-To: <20161130102134.GB14217@n2100.armlinux.org.uk>

Hi Russell,

On 11/30/2016 04:21 AM, Russell King - ARM Linux wrote:
> On Tue, Nov 29, 2016 at 05:47:12PM -0600, Grygorii Strashko wrote:
>> 2) Should these function be called for each processed irq?
>>
>>
>> HW IRQ:
>>  switch (IRQ mode)
>>   ...
>>   while (irq = get_pending_irq()) {
>>   	...
>>   	irq_enter()
>> 		handle(irq) - execute hw_irq_hadler
>>   	irq_exit()
>>  }
>>  ...
>>  switch
> 
> We tend to do (2) as a general rule, which isn't much different from what
> other architectures do - even if they have a method to directly enter
> through vectors (eg, x86) the effect of two pending interrupts is that one
> will run after each other, and there will be an intervening exit -> entry.
> 
> In the case of ARM CPUs, if the interrupt signal is active, you vector
> back to the interrupt handler as soon as you exit back to the parent
> context without executing any parent context instructions.
> 
> So, we have the choice of going through all the IRQ entry code, processing
> one interrupt, and returning only to then re-vector back through the IRQ
> entry code, or we can process all the pending IRQs that we can see at that
> time.
> 
> The former method wastes all the CPU cycles getting from the parent context
> to the IRQ context for each and every interrupt.
> 

Thanks a lot for your detailed explanation.
When I've asked this question my intention was to understand possibility of calling 
irq_enter()/irq_exit() only once for the case (2), like:
 HW IRQ:
  switch (IRQ mode)
   ...
  irq_enter()
   while (irq = get_pending_irq()) {
   	...
 	handle(irq) - execute hw_irq_hadler
  }
  irq_exit()
  ...
  switch

-- 
regards,
-grygorii

      reply	other threads:[~2016-11-30 17:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 23:47 Grygorii Strashko
2016-11-30 10:21 ` Russell King - ARM Linux
2016-11-30 17:07   ` Grygorii Strashko [this message]

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=9c334b42-6b22-397f-93f6-e19e9163a17c@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    /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®