public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: Re: [B.A.T.M.A.N.] [PATCH] 32bit sequence number and TTL for broadcasts
Date: Mon, 26 Apr 2010 10:49:32 +0200	[thread overview]
Message-ID: <201004261049.42172.sven.eckelmann@gmx.de> (raw)
In-Reply-To: <201004261555.59856.lindner_marek@yahoo.de>

[-- Attachment #1: Type: Text/Plain, Size: 2624 bytes --]

Marek Lindner wrote:
> On Monday 26 April 2010 04:48:13 Sven Eckelmann wrote:
> > First thing: it doesn't compile here :( (UML), but I am quite unsure if
> > 
> >  this is a UML problem like many other things or a bigger problem.... it
> >  seems that it is uml specific as ATOMIC64_INIT and other thingss are
> >  defined, but the implementation of specific functions are missing... but
> >  this is not the first time such thing happens with uml. Maybe someone
> >  with some time can check different openwrt builds.
> > 
> > For example other architecture seems to use the generic implementation of
> > 
> >  it: * arm
> >  * parisc
> >  * powerpc
> >  * sh
> 
> I think Sven got a point here. It seems that for atomic64_t to work one
> needs a CPU which supports 64Bit operations otherwise the linux kernel
> will use its generic implementation.

This is not really true. There are optimized implementation for different cpus 
which don't have 64 bit atomic operations. But yes, the mentioned 
architectures doesn't seem to have it or I've just ignored their 
implementation.

> Apparently it uses an array of 16
> spinlocks to provide this functionality. I wonder whether this might be a
> lot of overhead for our needs.

Yes, it uses that array and decides which spinlock to use by hashing the 
address (probably address & 0xf) - it doesn't use all 16 hashes at the same 
time. It isn't really perfect when we have a lot of cpus and/or stuff which 
generates a lot of interrupts and uses atomic64_t. But I don't think we can 
avoid using spinlocks when we don't use platform optimized atomic*_t.

> Furthermore the generic implementation was
> added recently (as far as I can tell 2.6.30 does not have it) which raises
> the question of backward compatibility.

Correct, forgot to check in which version this functionality came (so it is 
not Simon's fault, but mine). The basic problem why it was decided that it is 
needed to use atomic64_t was that until 2.6.3 atomic_t only provided 24-bit 
useful bits. This would result in in big caps while checking the seqno 
(problems for restart detection or other things).

The documentation still states that we can only hope for 24 useful bits in 
atomic_read. So I would guess that it is maybe the best idea to ask the kernel 
developers if the statenments in arch/mn10300/include/asm/atomic.h and 
include/asm-generic/atomic.h are obsolete and 32 useful bits are guaranteed 
after 2.6.3. Otherwise we have to choose between backward compatibility, 
spinlock overhead or a magical third option.

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2010-04-26  8:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-25 16:51 [B.A.T.M.A.N.] [PATCH] 32bit sequence number and TTL for broadcasts Simon Wunderlich
2010-04-25 20:48 ` Sven Eckelmann
2010-04-25 22:04   ` Simon Wunderlich
2010-04-26  7:55   ` Marek Lindner
2010-04-26  8:49     ` Sven Eckelmann [this message]
2010-04-26  8:47 ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: " Sven Eckelmann
2010-04-28 21:01   ` Sven Eckelmann

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=201004261049.42172.sven.eckelmann@gmx.de \
    --to=sven.eckelmann@gmx.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=lindner_marek@yahoo.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