All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Philippe Gerum <rpm@xenomai.org>
Cc: adeos-main <adeos-main@gna.org>
Subject: Re: [Adeos-main] irq masking in ipipe_restore_pipeline_head
Date: Fri, 18 Jun 2010 16:54:41 +0200	[thread overview]
Message-ID: <4C1B88B1.7050709@domain.hid> (raw)
In-Reply-To: <1276871828.12743.58.camel@domain.hid>

Philippe Gerum wrote:
> On Fri, 2010-06-18 at 15:46 +0200, Jan Kiszka wrote:
>> Philippe Gerum wrote:
>>> On Fri, 2010-06-18 at 13:26 +0200, Jan Kiszka wrote:
>>>> Hi Philippe,
>>>>
>>>> don't we need this in ipipe_restore_pipeline_head to play safe
>>> I can't see what this is supposed to fix. Any hint?
>> You enter ipipe_restore_pipeline_head with hard IRQs enabled and you
>> don't take the slow path as the domain is not stalled and the passed
>> flags do not change this. Then you leave with hard IRQs disabled. Corner
>> case, but I think it's not per se impossible.
> 
> In fact, the semantics of raw_local_irq_restore() are not that specific,
> looking at various irqflags.h implementations.
> Architectures are allowed to apply a local optimization for that
> routine. They may only re-enable if the flags arg passed says irqs were
> on previously to setting them off (e.g. blackfin), or even test a
> private system variable to know the current hw state and act upon this,
> ignoring the flags argument totally for this purpose (e.g. ppc64). There
> are likely others, since flipping the irq mask is costly for some archs,
> so optimizing makes sense for them.
> 
> In short, __ipipe_restore_pipeline_head() does not guarantee more than
> the kernel does with raw_local_irq_restore(), meaning that it is only
> required to switch irqs on if they were set off by the matching
> __ipipe_test_and_stall_pipeline_head(), but nothing more.
> 
> However, it would make sense to detect such misuse of the interface and
> whine loudly whenever we enter __ipipe_restore_pipeline_head() with irqs
> on.

You mean something like

if (WARN_ON_ONCE(!irqs_disabled_hw()))
	local_irq_disable_hw();

?

(Which leaves the if path even under !CONFIG_BUG. Maybe we want a bit
more optimization.)

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux


      reply	other threads:[~2010-06-18 14:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18 11:26 [Adeos-main] irq masking in ipipe_restore_pipeline_head Jan Kiszka
2010-06-18 13:43 ` Philippe Gerum
2010-06-18 13:46   ` Jan Kiszka
2010-06-18 14:37     ` Philippe Gerum
2010-06-18 14:54       ` Jan Kiszka [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=4C1B88B1.7050709@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=adeos-main@gna.org \
    --cc=rpm@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.