All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Dmitry Adamushko <dmitry.adamushko@domain.hid>,
	Philippe Gerum <rpm@xenomai.org>
Cc: xenomai@xenomai.org
Subject: [Xenomai-core] Re: [patch] memory barriers in intr.c :: xnintr_lock/unlock()
Date: Fri, 17 Nov 2006 19:40:45 +0100	[thread overview]
Message-ID: <455E022D.2000306@domain.hid> (raw)
In-Reply-To: <b647ffbd0611111559y8e66c37m12deb64828a85d08@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 1387 bytes --]

Dmitry Adamushko wrote:
> ...
> In case of linux, smp_mb__after_atomic_inc() and
> smp_mb__before_atomic_dec()
> would do the job. But so far, I decided not to add something like
> xnarch_memory_barrier__after_atomic_inc() :) , provided that both seem to
> end up being either mb() or barrier() at the same time (have to check more
> thoroughly) anyway.
> 
> Any suggestions?

As we now know that this patch actually solves a real issue on SMP
(tested by Paolo in RTAI's RTDM variant recently), I would say /some/
form of it should quickly go into the branches.

Actually, this kind of locking via reference counter, may it be atomic
or per-cpu, is a generic pattern for many (RCU-like) use cases. We have
it in RTnet (and I guess it's broken there as well, sigh), and I could
imagine to use it more broadly in the future. This means we should think
about a generic interface (to reduce the probability to use it the wrong
way around...). And for such an interface, we will have a need of
efficient memory barriers.

I see two paths now:

A) If we go for atomic_inc/dec with such locking service,
xnarch_memory_barrier__after_atomic_inc & friends will be needed anyway
and could be already introduced now.

B) If we aim at per-cpu counters (complicates things, but SMP clearly
benefits), we may simply merge Dmitry's patch as is.

Any thoughts?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-11-17 18:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-11 23:59 [Xenomai-core] [patch] memory barriers in intr.c :: xnintr_lock/unlock() Dmitry Adamushko
2006-11-17 18:40 ` Jan Kiszka [this message]
2006-11-19 10:55   ` [Xenomai-core] " Dmitry Adamushko
2006-11-20  9:13     ` Jan Kiszka
2006-11-20 20:09       ` Dmitry Adamushko
2006-11-20 23:40         ` Jan Kiszka
2006-11-21  9:32           ` Dmitry Adamushko
2006-11-21 11:28             ` Jan Kiszka
2006-12-06 23:03 ` Jan Kiszka
2006-12-08 17:54   ` Philippe Gerum

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=455E022D.2000306@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=dmitry.adamushko@domain.hid \
    --cc=rpm@xenomai.org \
    --cc=xenomai@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.