lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Jun 2011 11:42:09 -0700
From:	Arun Sharma <asharma@...com>
To:	Mike Frysinger <vapier.adi@...il.com>
CC:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Eric Dumazet <eric.dumazet@...il.com>,
	Ingo Molnar <mingo@...e.hu>, David Miller <davem@...emloft.net>
Subject: Re: [PATCH] atomic: cleanup asm-generic atomic*.h inclusion

On 6/17/11 11:06 AM, Mike Frysinger wrote:

> fixes one thing while breaking another.  linux/atomic.h includes
> asm/atomic.h which includes asm-generic/atomic.h which includes
> asm-generic/atomic-long.h which needs atomic_add_unless(), but that
> isnt provided until after the asm/atomic.h include in linux/atomic.h.
>
> but linux/atomic.h needs asm/atomic.h before atomic_add_unless()
> because it relies on the new __atomic_add_unless().
>

Right. I think we need to get rid of that include as well:

--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -156,7 +145,5 @@ static inline void atomic_clear_mask(unsigned long 
mask, unsigned long *addr)
  #define smp_mb__before_atomic_inc()    barrier()
  #define smp_mb__after_atomic_inc()     barrier()

-#include <asm-generic/atomic-long.h>
-
  #endif /* __KERNEL__ */
  #endif /* __ASM_GENERIC_ATOMIC_H */

since <linux/atomic.h> includes it directly now.

> having linux/atomic.h and asm-generic/atomic.h just strikes me as
> wrong.  the point of asm-generic is to unify things, but now we have
> two places to unify things without 0 indication as to which is for
> which ?  i'm wondering if we shouldnt convert all arches to
> asm-generic/atomic.h and then add your new logic there and just skip
> this whole linux/atomic.h mess.

I believe the logic is:

<asm-generic/atomic.h> shared code for simple archs that don't want to 
define their own primitives. Only used by 4 archs.

<linux/atomic.h> a header file that's usable in machine independent 
kernel code.

<linux/atomic.h> seems to be relatively recent, introduced by:

commit 3f9d35b9514da6757ca98831372518f9eeb71b33
Author: Eric Dumazet <eric.dumazet@...il.com>
Date:   Thu Nov 11 14:05:08 2010 -0800

     atomic: add atomic_inc_not_zero_hint()

<asm-generic/atomic.h> came from:

commit d3cb487149bd706aa6aeb02042332a450978dc1c
Author: Christoph Lameter <clameter@...r.sgi.com>
Date:   Fri Jan 6 00:11:20 2006 -0800

     [PATCH] atomic_long_t & include/asm-generic/atomic.h V2

My guess is that if <linux/atomic.h> existed in 2006, people would've 
added shared code over there. Also, the code in <asm-generic/atomic.h> 
is not truly generic:

smp_mb__before_atomic_dec() for eg is implemented differently for some 
archs.

  -Arun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ