From owner-svn-src-projects@FreeBSD.ORG Sun May 8 00:39:50 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35FBE106566C; Sun, 8 May 2011 00:39:50 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 251518FC08; Sun, 8 May 2011 00:39:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p480do1Z021495; Sun, 8 May 2011 00:39:50 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p480doiZ021493; Sun, 8 May 2011 00:39:50 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105080039.p480doiZ021493@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 May 2011 00:39:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 00:39:50 -0000 Author: attilio Date: Sun May 8 00:39:49 2011 New Revision: 221614 URL: http://svn.freebsd.org/changeset/base/221614 Log: All architectures define the size-bounded types (uint32_t, uint64_t, etc.) starting from base C types (int, long, etc). That is also reflected when building atomic operations, as the size-bounded types are built from the base C types. However, powerpc does the inverse thing, leading to a serie of nasty bugs. Cleanup the atomic implementation by defining as base the base C type version and depending on them, appropriately. Tested by: jceel Modified: projects/largeSMP/sys/powerpc/include/atomic.h Modified: projects/largeSMP/sys/powerpc/include/atomic.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/atomic.h Sat May 7 23:34:14 2011 (r221613) +++ projects/largeSMP/sys/powerpc/include/atomic.h Sun May 8 00:39:49 2011 (r221614) @@ -48,13 +48,7 @@ * { *p += v; } */ -#define __ATOMIC_ADD_8(p, v, t) \ - 8-bit atomic_add not implemented - -#define __ATOMIC_ADD_16(p, v, t) \ - 16-bit atomic_add not implemented - -#define __ATOMIC_ADD_32(p, v, t) \ +#define __atomic_add_int(p, v, t) \ __asm __volatile( \ "1: lwarx %0, 0, %2\n" \ " add %0, %3, %0\n" \ @@ -63,10 +57,10 @@ : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_ADD_32 */ + /* __atomic_add_int */ #ifdef __powerpc64__ -#define __ATOMIC_ADD_64(p, v, t) \ +#define __atomic_add_long(p, v, t) \ __asm __volatile( \ "1: ldarx %0, 0, %2\n" \ " add %0, %3, %0\n" \ @@ -75,69 +69,78 @@ : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_ADD_64 */ + /* __atomic_add_long */ #else -#define __ATOMIC_ADD_64(p, v, t) \ - 64-bit atomic_add not implemented +#define __atomic_add_long(p, v, t) \ + long atomic_add not implemented #endif -#define _ATOMIC_ADD(width, suffix, type) \ +#define _ATOMIC_ADD(type) \ static __inline void \ - atomic_add_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_ADD_##width(p, v, t); \ + atomic_add_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_add_##type(p, v, t); \ } \ \ static __inline void \ - atomic_add_acq_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_ADD_##width(p, v, t); \ + atomic_add_acq_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_add_##type(p, v, t); \ __ATOMIC_BARRIER; \ } \ \ static __inline void \ - atomic_add_rel_##suffix(volatile type *p, type v) { \ - type t; \ + atomic_add_rel_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ __ATOMIC_BARRIER; \ - __ATOMIC_ADD_##width(p, v, t); \ + __atomic_add_##type(p, v, t); \ } \ /* _ATOMIC_ADD */ -#if 0 -_ATOMIC_ADD(8, 8, uint8_t) -_ATOMIC_ADD(8, char, u_char) -_ATOMIC_ADD(16, 16, uint16_t) -_ATOMIC_ADD(16, short, u_short) -#endif -_ATOMIC_ADD(32, 32, uint32_t) -_ATOMIC_ADD(32, int, u_int) -#ifdef __powerpc64__ -_ATOMIC_ADD(64, 64, uint64_t) -_ATOMIC_ADD(64, long, u_long) -_ATOMIC_ADD(64, ptr, uintptr_t) -#else -_ATOMIC_ADD(32, long, u_long) -_ATOMIC_ADD(32, ptr, uintptr_t) -#endif +_ATOMIC_ADD(int) +#define atomic_add_32 atomic_add_int +#define atomic_add_acq_32 atomic_add_acq_int +#define atomic_add_rel_32 atomic_add_rel_int + +#ifdef __powerpc64__ +_ATOMIC_ADD(long) + +#define atomic_add_64 atomic_add_long +#define atomic_add_acq_64 atomic_add_acq_long +#define atomic_add_rel_64 atomic_add_rel_long + +#define atomic_add_ptr(p, v) \ + atomic_add_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_add_acq_ptr(p, v) \ + atomic_add_acq_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_add_rel_ptr(p, v) \ + atomic_add_rel_long((volatile u_long *)(p), (u_long)(v)) +#else +#define atomic_add_long(p, v) \ + atomic_add_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_acq_long(p, v) \ + atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_rel_long(p, v) \ + atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) + +#define atomic_add_ptr(p, v) \ + atomic_add_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_acq_ptr(p, v) \ + atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_rel_ptr(p, v) \ + atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) +#endif #undef _ATOMIC_ADD -#undef __ATOMIC_ADD_64 -#undef __ATOMIC_ADD_32 -#undef __ATOMIC_ADD_16 -#undef __ATOMIC_ADD_8 +#undef __atomic_add_long +#undef __atomic_add_int /* * atomic_clear(p, v) * { *p &= ~v; } */ -#define __ATOMIC_CLEAR_8(p, v, t) \ - 8-bit atomic_clear not implemented - -#define __ATOMIC_CLEAR_16(p, v, t) \ - 16-bit atomic_clear not implemented - -#define __ATOMIC_CLEAR_32(p, v, t) \ +#define __atomic_clear_int(p, v, t) \ __asm __volatile( \ "1: lwarx %0, 0, %2\n" \ " andc %0, %0, %3\n" \ @@ -146,10 +149,10 @@ _ATOMIC_ADD(32, ptr, uintptr_t) : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_CLEAR_32 */ + /* __atomic_clear_int */ #ifdef __powerpc64__ -#define __ATOMIC_CLEAR_64(p, v, t) \ +#define __atomic_clear_long(p, v, t) \ __asm __volatile( \ "1: ldarx %0, 0, %2\n" \ " andc %0, %0, %3\n" \ @@ -158,56 +161,72 @@ _ATOMIC_ADD(32, ptr, uintptr_t) : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_CLEAR_64 */ + /* __atomic_clear_long */ #else -#define __ATOMIC_CLEAR_64(p, v, t) \ - 64-bit atomic_clear not implemented +#define __atomic_clear_long(p, v, t) \ + long atomic_clear not implemented #endif -#define _ATOMIC_CLEAR(width, suffix, type) \ +#define _ATOMIC_CLEAR(type) \ static __inline void \ - atomic_clear_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_CLEAR_##width(p, v, t); \ + atomic_clear_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_clear_##type(p, v, t); \ } \ \ static __inline void \ - atomic_clear_acq_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_CLEAR_##width(p, v, t); \ + atomic_clear_acq_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_clear_##type(p, v, t); \ __ATOMIC_BARRIER; \ } \ \ static __inline void \ - atomic_clear_rel_##suffix(volatile type *p, type v) { \ - type t; \ + atomic_clear_rel_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ __ATOMIC_BARRIER; \ - __ATOMIC_CLEAR_##width(p, v, t); \ + __atomic_clear_##type(p, v, t); \ } \ /* _ATOMIC_CLEAR */ -#if 0 -_ATOMIC_CLEAR(8, 8, uint8_t) -_ATOMIC_CLEAR(8, char, u_char) -_ATOMIC_CLEAR(16, 16, uint16_t) -_ATOMIC_CLEAR(16, short, u_short) -#endif -_ATOMIC_CLEAR(32, 32, uint32_t) -_ATOMIC_CLEAR(32, int, u_int) -#ifdef __powerpc64__ -_ATOMIC_CLEAR(64, 64, uint64_t) -_ATOMIC_CLEAR(64, long, u_long) -_ATOMIC_CLEAR(64, ptr, uintptr_t) -#else -_ATOMIC_CLEAR(32, long, u_long) -_ATOMIC_CLEAR(32, ptr, uintptr_t) -#endif - -#undef _ATOMIC_CLEAR -#undef __ATOMIC_CLEAR_64 -#undef __ATOMIC_CLEAR_32 -#undef __ATOMIC_CLEAR_16 -#undef __ATOMIC_CLEAR_8 + +_ATOMIC_CLEAR(int) + +#define atomic_clear_32 atomic_clear_int +#define atomic_clear_acq_32 atomic_clear_acq_int +#define atomic_clear_rel_32 atomic_clear_rel_int + +#ifdef __powerpc64__ +_ATOMIC_CLEAR(long) + +#define atomic_clear_64 atomic_clear_long +#define atomic_clear_acq_64 atomic_clear_acq_long +#define atomic_clear_rel_64 atomic_clear_rel_long + +#define atomic_clear_ptr(p, v) \ + atomic_clear_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_clear_acq_ptr(p, v) \ + atomic_clear_acq_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_clear_rel_ptr(p, v) \ + atomic_clear_rel_long((volatile u_long *)(p), (u_long)(v)) +#else +#define atomic_clear_long(p, v) \ + atomic_clear_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_acq_long(p, v) \ + atomic_clear_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_rel_long(p, v) \ + atomic_clear_rel_int((volatile u_int *)(p), (u_int)(v)) + +#define atomic_clear_ptr(p, v) \ + atomic_clear_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_acq_ptr(p, v) \ + atomic_clear_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_rel_ptr(p, v) \ + atomic_clear_rel_int((volatile u_int *)(p), (u_int)(v)) +#endif +#undef _ATOMIC_ADD +#undef __atomic_clear_long +#undef __atomic_clear_int /* * atomic_cmpset(p, o, n) @@ -229,13 +248,7 @@ _ATOMIC_CLEAR(32, ptr, uintptr_t) * { *p |= v; } */ -#define __ATOMIC_SET_8(p, v, t) \ - 8-bit atomic_set not implemented - -#define __ATOMIC_SET_16(p, v, t) \ - 16-bit atomic_set not implemented - -#define __ATOMIC_SET_32(p, v, t) \ +#define __atomic_set_int(p, v, t) \ __asm __volatile( \ "1: lwarx %0, 0, %2\n" \ " or %0, %3, %0\n" \ @@ -244,10 +257,10 @@ _ATOMIC_CLEAR(32, ptr, uintptr_t) : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_SET_32 */ + /* __atomic_set_int */ #ifdef __powerpc64__ -#define __ATOMIC_SET_64(p, v, t) \ +#define __atomic_set_long(p, v, t) \ __asm __volatile( \ "1: ldarx %0, 0, %2\n" \ " or %0, %3, %0\n" \ @@ -256,69 +269,78 @@ _ATOMIC_CLEAR(32, ptr, uintptr_t) : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_SET_64 */ + /* __atomic_set_long */ #else -#define __ATOMIC_SET_64(p, v, t) \ - 64-bit atomic_set not implemented +#define __atomic_set_long(p, v, t) \ + long atomic_set not implemented #endif -#define _ATOMIC_SET(width, suffix, type) \ +#define _ATOMIC_SET(type) \ static __inline void \ - atomic_set_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_SET_##width(p, v, t); \ + atomic_set_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_set_##type(p, v, t); \ } \ \ static __inline void \ - atomic_set_acq_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_SET_##width(p, v, t); \ + atomic_set_acq_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_set_##type(p, v, t); \ __ATOMIC_BARRIER; \ } \ \ static __inline void \ - atomic_set_rel_##suffix(volatile type *p, type v) { \ - type t; \ + atomic_set_rel_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ __ATOMIC_BARRIER; \ - __ATOMIC_SET_##width(p, v, t); \ + __atomic_set_##type(p, v, t); \ } \ /* _ATOMIC_SET */ -#if 0 -_ATOMIC_SET(8, 8, uint8_t) -_ATOMIC_SET(8, char, u_char) -_ATOMIC_SET(16, 16, uint16_t) -_ATOMIC_SET(16, short, u_short) -#endif -_ATOMIC_SET(32, 32, uint32_t) -_ATOMIC_SET(32, int, u_int) -#ifdef __powerpc64__ -_ATOMIC_SET(64, 64, uint64_t) -_ATOMIC_SET(64, long, u_long) -_ATOMIC_SET(64, ptr, uintptr_t) -#else -_ATOMIC_SET(32, long, u_long) -_ATOMIC_SET(32, ptr, uintptr_t) -#endif +_ATOMIC_SET(int) +#define atomic_set_32 atomic_set_int +#define atomic_set_acq_32 atomic_set_acq_int +#define atomic_set_rel_32 atomic_set_rel_int + +#ifdef __powerpc64__ +_ATOMIC_SET(long) + +#define atomic_set_64 atomic_set_long +#define atomic_set_acq_64 atomic_set_acq_long +#define atomic_set_rel_64 atomic_set_rel_long + +#define atomic_set_ptr(p, v) \ + atomic_set_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_set_acq_ptr(p, v) \ + atomic_set_acq_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_set_rel_ptr(p, v) \ + atomic_set_rel_long((volatile u_long *)(p), (u_long)(v)) +#else +#define atomic_set_long(p, v) \ + atomic_set_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_acq_long(p, v) \ + atomic_set_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_rel_long(p, v) \ + atomic_set_rel_int((volatile u_int *)(p), (u_int)(v)) + +#define atomic_set_ptr(p, v) \ + atomic_set_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_acq_ptr(p, v) \ + atomic_set_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_rel_ptr(p, v) \ + atomic_set_rel_int((volatile u_int *)(p), (u_int)(v)) +#endif #undef _ATOMIC_SET -#undef __ATOMIC_SET_64 -#undef __ATOMIC_SET_32 -#undef __ATOMIC_SET_16 -#undef __ATOMIC_SET_8 +#undef __atomic_set_long +#undef __atomic_set_int /* * atomic_subtract(p, v) * { *p -= v; } */ -#define __ATOMIC_SUBTRACT_8(p, v, t) \ - 8-bit atomic_subtract not implemented - -#define __ATOMIC_SUBTRACT_16(p, v, t) \ - 16-bit atomic_subtract not implemented - -#define __ATOMIC_SUBTRACT_32(p, v, t) \ +#define __atomic_subtract_int(p, v, t) \ __asm __volatile( \ "1: lwarx %0, 0, %2\n" \ " subf %0, %3, %0\n" \ @@ -327,10 +349,10 @@ _ATOMIC_SET(32, ptr, uintptr_t) : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_SUBTRACT_32 */ + /* __atomic_subtract_int */ #ifdef __powerpc64__ -#define __ATOMIC_SUBTRACT_64(p, v, t) \ +#define __atomic_subtract_long(p, v, t) \ __asm __volatile( \ "1: ldarx %0, 0, %2\n" \ " subf %0, %3, %0\n" \ @@ -339,56 +361,71 @@ _ATOMIC_SET(32, ptr, uintptr_t) : "=&r" (t), "=m" (*p) \ : "r" (p), "r" (v), "m" (*p) \ : "cc", "memory") \ - /* __ATOMIC_SUBTRACT_64 */ + /* __atomic_subtract_long */ #else -#define __ATOMIC_SUBTRACT_64(p, v, t) \ - 64-bit atomic_subtract not implemented +#define __atomic_subtract_long(p, v, t) \ + long atomic_subtract not implemented #endif -#define _ATOMIC_SUBTRACT(width, suffix, type) \ - static __inline void \ - atomic_subtract_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_SUBTRACT_##width(p, v, t); \ - } \ - \ - static __inline void \ - atomic_subtract_acq_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_SUBTRACT_##width(p, v, t); \ - __ATOMIC_BARRIER; \ - } \ - \ - static __inline void \ - atomic_subtract_rel_##suffix(volatile type *p, type v) { \ - type t; \ - __ATOMIC_BARRIER; \ - __ATOMIC_SUBTRACT_##width(p, v, t); \ - } \ +#define _ATOMIC_SUBTRACT(type) \ + static __inline void \ + atomic_subtract_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_subtract_##type(p, v, t); \ + } \ + \ + static __inline void \ + atomic_subtract_acq_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __atomic_subtract_##type(p, v, t); \ + __ATOMIC_BARRIER; \ + } \ + \ + static __inline void \ + atomic_subtract_rel_##type(volatile u_##type *p, u_##type v) { \ + u_##type t; \ + __ATOMIC_BARRIER; \ + __atomic_subtract_##type(p, v, t); \ + } \ /* _ATOMIC_SUBTRACT */ -#if 0 -_ATOMIC_SUBTRACT(8, 8, uint8_t) -_ATOMIC_SUBTRACT(8, char, u_char) -_ATOMIC_SUBTRACT(16, 16, uint16_t) -_ATOMIC_SUBTRACT(16, short, u_short) -#endif -_ATOMIC_SUBTRACT(32, 32, uint32_t) -_ATOMIC_SUBTRACT(32, int, u_int) -#ifdef __powerpc64__ -_ATOMIC_SUBTRACT(64, 64, uint64_t) -_ATOMIC_SUBTRACT(64, long, u_long) -_ATOMIC_SUBTRACT(64, ptr, uintptr_t) -#else -_ATOMIC_SUBTRACT(32, long, u_long) -_ATOMIC_SUBTRACT(32, ptr, uintptr_t) -#endif +_ATOMIC_SUBTRACT(int) +#define atomic_subtract_32 atomic_subtract_int +#define atomic_subtract_acq_32 atomic_subtract_acq_int +#define atomic_subtract_rel_32 atomic_subtract_rel_int + +#ifdef __powerpc64__ +_ATOMIC_SUBTRACT(long) + +#define atomic_subtract_64 atomic_subtract_long +#define atomic_subtract_acq_64 atomic_subract_acq_long +#define atomic_subtract_rel_64 atomic_subtract_rel_long + +#define atomic_subtract_ptr(p, v) \ + atomic_subtract_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_subtract_acq_ptr(p, v) \ + atomic_subtract_acq_long((volatile u_long *)(p), (u_long)(v)) +#define atomic_subtract_rel_ptr(p, v) \ + atomic_subtract_rel_long((volatile u_long *)(p), (u_long)(v)) +#else +#define atomic_subtract_long(p, v) \ + atomic_subtract_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_acq_long(p, v) \ + atomic_subtract_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_rel_long(p, v) \ + atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) + +#define atomic_subtract_ptr(p, v) \ + atomic_subtract_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_acq_ptr(p, v) \ + atomic_subtract_acq_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_rel_ptr(p, v) \ + atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) +#endif #undef _ATOMIC_SUBTRACT -#undef __ATOMIC_SUBTRACT_64 -#undef __ATOMIC_SUBTRACT_32 -#undef __ATOMIC_SUBTRACT_16 -#undef __ATOMIC_SUBTRACT_8 +#undef __atomic_subtract_long +#undef __atomic_subtract_int /* * atomic_store_rel(p, v) @@ -399,10 +436,10 @@ _ATOMIC_SUBTRACT(32, ptr, uintptr_t) * Old/original implementations that still need revisiting. */ -static __inline uint32_t -atomic_readandclear_32(volatile uint32_t *addr) +static __inline u_int +atomic_readandclear_int(volatile u_int *addr) { - uint32_t result,temp; + u_int result,temp; #ifdef __GNUCLIKE_ASM __asm __volatile ( @@ -420,10 +457,10 @@ atomic_readandclear_32(volatile uint32_t } #ifdef __powerpc64__ -static __inline uint64_t -atomic_readandclear_64(volatile uint64_t *addr) +static __inline u_long +atomic_readandclear_long(volatile u_long *addr) { - uint64_t result,temp; + u_long result,temp; #ifdef __GNUCLIKE_ASM __asm __volatile ( @@ -441,37 +478,25 @@ atomic_readandclear_64(volatile uint64_t } #endif -#define atomic_readandclear_int atomic_readandclear_32 +#define atomic_readandclear_32 atomic_readandclear_int #ifdef __powerpc64__ -#define atomic_readandclear_long atomic_readandclear_64 -#define atomic_readandclear_ptr atomic_readandclear_64 +#define atomic_readandclear_64 atomic_readandclear_long + +#define atomic_readandclear_ptr(p) \ + atomic_readandclear_long((volatile u_long *)(p)) #else -#define atomic_readandclear_long atomic_readandclear_32 -#define atomic_readandclear_ptr atomic_readandclear_32 +#define atomic_readandclear_long(p) \ + atomic_readandclear_int((volatile u_int *)(p)) + +#define atomic_readandclear_ptr(p) \ + atomic_readandclear_int((volatile u_int *)(p)) #endif /* * We assume that a = b will do atomic loads and stores. */ -#define ATOMIC_STORE_LOAD(TYPE, WIDTH) \ -static __inline u_##TYPE \ -atomic_load_acq_##WIDTH(volatile u_##TYPE *p) \ -{ \ - u_##TYPE v; \ - \ - v = *p; \ - __ATOMIC_BARRIER; \ - return (v); \ -} \ - \ -static __inline void \ -atomic_store_rel_##WIDTH(volatile u_##TYPE *p, u_##TYPE v) \ -{ \ - __ATOMIC_BARRIER; \ - *p = v; \ -} \ - \ +#define ATOMIC_STORE_LOAD(TYPE) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ @@ -489,25 +514,32 @@ atomic_store_rel_##TYPE(volatile u_##TYP *p = v; \ } -ATOMIC_STORE_LOAD(char, 8) -ATOMIC_STORE_LOAD(short, 16) -ATOMIC_STORE_LOAD(int, 32) -#ifdef __powerpc64__ -ATOMIC_STORE_LOAD(long, 64) -#endif +ATOMIC_STORE_LOAD(int) + +#define atomic_load_acq_32 atomic_load_acq_int +#define atomic_store_rel_32 atomic_store_rel_int #ifdef __powerpc64__ -#define atomic_load_acq_long atomic_load_acq_64 -#define atomic_store_rel_long atomic_store_rel_64 -#define atomic_load_acq_ptr atomic_load_acq_64 -#define atomic_store_rel_ptr atomic_store_rel_64 +ATOMIC_STORE_LOAD(long) + +#define atomic_load_acq_64 atomic_load_acq_long +#define atomic_store_rel_64 atomic_store_rel_long + +#define atomic_load_acq_ptr(p) \ + atomic_load_acq_long((volatile u_long *)(p)) +#define atomic_store_rel_ptr(p, v) \ + atomic_store_rel_long((volatile u_long *)(p), (u_long)(v)) #else -#define atomic_load_acq_long atomic_load_acq_32 -#define atomic_store_rel_long atomic_store_rel_32 -#define atomic_load_acq_ptr atomic_load_acq_32 -#define atomic_store_rel_ptr atomic_store_rel_32 -#endif +#define atomic_load_acq_long(p) \ + atomic_load_acq_int((volatile u_int *)(p)) +#define atomic_store_rel_long(p, v) \ + atomic_store_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_load_acq_ptr(p) \ + atomic_load_acq_int((volatile u_int *)(p)) +#define atomic_store_rel_ptr(p, v) \ + atomic_store_rel_int((volatile u_int *)(p), (u_int)(v)) +#endif #undef ATOMIC_STORE_LOAD /* @@ -516,7 +548,7 @@ ATOMIC_STORE_LOAD(long, 64) * zero if the compare failed, nonzero otherwise. */ static __inline int -atomic_cmpset_32(volatile uint32_t* p, uint32_t cmpval, uint32_t newval) +atomic_cmpset_int(volatile u_int* p, u_int cmpval, u_int newval) { int ret; @@ -542,32 +574,43 @@ atomic_cmpset_32(volatile uint32_t* p, u } static __inline int +atomic_cmpset_acq_int(volatile u_int *p, u_int cmpval, u_int newval) +{ + int retval; + + retval = atomic_cmpset_int(p, cmpval, newval); + __ATOMIC_BARRIER; + return (retval); +} + +static __inline int +atomic_cmpset_rel_int(volatile u_int *p, u_int cmpval, u_int newval) +{ + __ATOMIC_BARRIER; + return (atomic_cmpset_int(p, cmpval, newval)); +} + +#define atomic_cmpset_32 atomic_cmpset_int +#define atomic_cmpset_acq_32 atomic_cmpset_acq_int +#define atomic_cmpset_rel_32 atomic_cmpset_rel_int + +#ifdef __powerpc64__ +static __inline int atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval) { int ret; #ifdef __GNUCLIKE_ASM __asm __volatile ( - #ifdef __powerpc64__ "1:\tldarx %0, 0, %2\n\t" /* load old value */ "cmpld %3, %0\n\t" /* compare */ "bne 2f\n\t" /* exit if not equal */ "stdcx. %4, 0, %2\n\t" /* attempt to store */ - #else - "1:\tlwarx %0, 0, %2\n\t" /* load old value */ - "cmplw %3, %0\n\t" /* compare */ - "bne 2f\n\t" /* exit if not equal */ - "stwcx. %4, 0, %2\n\t" /* attempt to store */ - #endif "bne- 1b\n\t" /* spin if failed */ "li %0, 1\n\t" /* success - retval = 1 */ "b 3f\n\t" /* we've succeeded */ "2:\n\t" - #ifdef __powerpc64__ "stdcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ - #else - "stwcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ - #endif "li %0, 0\n\t" /* failure - retval = 0 */ "3:\n\t" : "=&r" (ret), "=m" (*p) @@ -578,33 +621,6 @@ atomic_cmpset_long(volatile u_long* p, u return (ret); } -#define atomic_cmpset_int atomic_cmpset_32 - -#ifdef __powerpc64__ -#define atomic_cmpset_ptr(dst, old, new) \ - atomic_cmpset_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new)) -#else -#define atomic_cmpset_ptr(dst, old, new) \ - atomic_cmpset_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) -#endif - -static __inline int -atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) -{ - int retval; - - retval = atomic_cmpset_32(p, cmpval, newval); - __ATOMIC_BARRIER; - return (retval); -} - -static __inline int -atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) -{ - __ATOMIC_BARRIER; - return (atomic_cmpset_32(p, cmpval, newval)); -} - static __inline int atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval) { @@ -622,39 +638,59 @@ atomic_cmpset_rel_long(volatile u_long * return (atomic_cmpset_long(p, cmpval, newval)); } -#define atomic_cmpset_acq_int atomic_cmpset_acq_32 -#define atomic_cmpset_rel_int atomic_cmpset_rel_32 - -#ifdef __powerpc64__ -#define atomic_cmpset_acq_ptr(dst, old, new) \ - atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new)) -#define atomic_cmpset_rel_ptr(dst, old, new) \ - atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new)) -#else -#define atomic_cmpset_acq_ptr(dst, old, new) \ - atomic_cmpset_acq_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) -#define atomic_cmpset_rel_ptr(dst, old, new) \ - atomic_cmpset_rel_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) +#define atomic_cmpset_64 atomic_cmpset_long +#define atomic_cmpset_acq_64 atomic_cmpset_acq_long +#define atomic_cmpset_rel_64 atomic_cmpset_rel_long + +#define atomic_cmpset_ptr(dst, old, new) \ + atomic_cmpset_long((volatile u_long *)(dst), (u_long)(old), \ + (u_long)(new)) +#define atomic_cmpset_acq_ptr(dst, old, new) \ + atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)(old), \ + (u_long)(new)) +#define atomic_cmpset_rel_ptr(dst, old, new) \ + atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), \ + (u_long)(new)) +#else +#define atomic_cmpset_long(dst, old, new) \ + atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) +#define atomic_cmpset_acq_long(dst, old, new) \ + atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) +#define atomic_cmpset_rel_long(dst, old, new) \ + atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) + +#define atomic_cmpset_ptr(dst, old, new) \ + atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) +#define atomic_cmpset_acq_ptr(dst, old, new) \ + atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) +#define atomic_cmpset_rel_ptr(dst, old, new) \ + atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ + (u_int)(new)) #endif -static __inline uint32_t -atomic_fetchadd_32(volatile uint32_t *p, uint32_t v) +static __inline u_int +atomic_fetchadd_int(volatile u_int *p, u_int v) { - uint32_t value; + u_int value; do { value = *p; - } while (!atomic_cmpset_32(p, value, value + v)); + } while (!atomic_cmpset_int(p, value, value + v)); return (value); } -#define atomic_fetchadd_int atomic_fetchadd_32 +#define atomic_fetchadd_32 atomic_fetchadd_int #ifdef __powerpc64__ -static __inline uint64_t -atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) +static __inline u_long +atomic_fetchadd_long(volatile u_long *p, u_long v) { - uint64_t value; + u_long value; do { value = *p; @@ -662,10 +698,10 @@ atomic_fetchadd_64(volatile uint64_t *p, return (value); } -#define atomic_fetchadd_long atomic_fetchadd_64 +#define atomic_fetchadd_64 atomic_fetchadd_long #else -#define atomic_fetchadd_long(p, v) \ - (u_long)atomic_fetchadd_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_fetchadd_long(p, v) \ + (u_long)atomic_fetchadd_int((volatile u_int *)(p), (u_int)(v)) #endif #endif /* ! _MACHINE_ATOMIC_H_ */ From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:10:44 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE77A1065675; Sun, 8 May 2011 14:10:44 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 63C3F8FC28; Sun, 8 May 2011 14:10:44 +0000 (UTC) Received: by yxl31 with SMTP id 31so1992686yxl.13 for ; Sun, 08 May 2011 07:10:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=dH0p4Eg1GiUhAAkYn3ceUILBJ8AL26NERvYzDPlt4f0=; b=tjHDJuUrfWUKU7pBo9BsaDcPgwIzGa2G3haaJNoBr5BwgevW9rOmSztuniITBEHvZO wg0AiSME3SQPGYNrzxLrkEL8le7JTTUhS4wqgaJEo4qZmMm32ChBBOkYiSXJhdECYNcp EkJhMMjNN6MeWO64MipneD3xJBAyclwb8sHwM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Dh1s2qqi1YfMTZfhalPSO+TBEfLs+aGSfqVaX/22Mk9UNYPVELItSk2IL7aRuYgII2 MSOKyiwW6pdx3ly7Xwk0nzLICbLo4swtJWrHPeRhpsByECaL75qdammJQan7HByhmMsf qfd1lLFL0fI/DIigzGJyqTPQrndk2aQvRcTes= MIME-Version: 1.0 Received: by 10.236.193.10 with SMTP id j10mr6821756yhn.506.1304863843498; Sun, 08 May 2011 07:10:43 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Sun, 8 May 2011 07:10:43 -0700 (PDT) In-Reply-To: <20110508202725.K1192@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> Date: Sun, 8 May 2011 10:10:43 -0400 X-Google-Sender-Auth: I9uRsGvdS4riKL_tCYM0cfxNYC0 Message-ID: From: Attilio Rao To: Bruce Evans Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:10:44 -0000 2011/5/8 Bruce Evans : > On Sun, 8 May 2011, Attilio Rao wrote: > >> Log: >> =C2=A0All architectures define the size-bounded types (uint32_t, uint64_= t, >> etc.) >> =C2=A0starting from base C types (int, long, etc). >> =C2=A0That is also reflected when building atomic operations, as the >> =C2=A0size-bounded types are built from the base C types. >> >> =C2=A0However, powerpc does the inverse thing, leading to a serie of nas= ty > > I think you mean that it does the inverse thing for atomic ops only. > >> =C2=A0bugs. >> =C2=A0Cleanup the atomic implementation by defining as base the base C t= ype >> =C2=A0version and depending on them, appropriately. > > I think that it is mostly the other arches that are backwards here, > except for plain ints. =C2=A0MI code cannot use atomic ops for anything > except plain ints, since no other type is guaranteed to be supported > by the MD code. =C2=A0For example, sparc64 doesn't support any 8-bit or > 16-bit types, and i386 doesn't support any 64-bit types (until recently; > it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support > 64, bit types), and my version of i386 doesn't support any 8-bit or > 16-bit types or long since these types are unusable in MI code and > unused in MD code (long is misused in some MI code but I don't use > such broken code). > > At least one type must be supported, and to keep things sane, int must > be supported. =C2=A0The type could be int32_t instead, but then you would= have > a hard-coded assumption that int is int32_t instead of a hard-coded > assumption that int can be an atomic type. =C2=A0The latter is a better > assumption for MI code. =C2=A0But MD code can make the former assumption > except of course on arches where it is false, but there are none of > those yet. =C2=A0This gives the following structure in atomic.h: > > o basic definitions in terms of uint8/16/32/64_t. =C2=A0But don't define = the > =C2=A08/16/64 bit ones unless they are actually used in MD code, which is > =C2=A0rare. =C2=A0MI code cannot use these. > o assume that u_int is uint32_t and #define all the atomic_foo_int() > =C2=A0interfaces as atomic_foo_32. =C2=A0Similarly for pointers, except u= se > =C2=A0atomic_foo_64 in some cases. > o do something for long. =C2=A0MI code cannot use atomic ops on longs, bu= t does. > =C2=A0Correctly-sized longs are usually fundamentally non-atomic since th= ey > =C2=A0are twice as long as the register width and the register width is u= sually > =C2=A0the same as the bus width and atomicness for widths wider than the = bus is > =C2=A0unnatural and/or inefficient. =C2=A0But no supported arch has corre= ctly-sized > =C2=A0longs. So the thing is that we define the uintXX_t type from int,long,etc and then we should really expect to follow the same pattern for atomic instructions. >> Modified: projects/largeSMP/sys/powerpc/include/atomic.h >> >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- projects/largeSMP/sys/powerpc/include/atomic.h =C2=A0 =C2=A0 =C2=A0S= at May =C2=A07 >> 23:34:14 2011 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r221613) >> +++ projects/largeSMP/sys/powerpc/include/atomic.h =C2=A0 =C2=A0 =C2=A0S= un May =C2=A08 >> 00:39:49 2011 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r221614) >> @@ -48,13 +48,7 @@ >> =C2=A0* { *p +=3D v; } >> =C2=A0*/ >> >> -#define __ATOMIC_ADD_8(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A08-bit atomic_add not implemented >> - >> -#define __ATOMIC_ADD_16(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> - =C2=A0 =C2=A016-bit atomic_add not implemented >> - > > Already correctly left out except for bogusly #defining it and #undefinin= g > it. =C2=A0Now not bogusly #defined either. I don't see the point to have something like that, also because is never used in the kernel. >> -#define __ATOMIC_ADD_32(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> +#define __atomic_add_int(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0__asm __volatile( =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0"1: =C2=A0 =C2=A0 lwarx =C2=A0 %0, 0, %2\n" = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0" =C2=A0 =C2=A0 =C2=A0 add =C2=A0 =C2=A0 %0, = %3, %0\n" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> @@ -63,10 +57,10 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "=3D&r" (t), "=3Dm" (*p) =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "r" (p), "r" (v), "m" (*p) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "cc", "memory") =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> - =C2=A0 =C2=A0/* __ATOMIC_ADD_32 */ >> + =C2=A0 =C2=A0/* __atomic_add_int */ > > No type problems at this level. Yes, but I also want uniformity in the implementation, thus try to give a common pattern. >> #ifdef __powerpc64__ >> -#define __ATOMIC_ADD_64(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> +#define __atomic_add_long(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0__asm __volatile( =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0"1: =C2=A0 =C2=A0 ldarx =C2=A0 %0, 0, %2\n" = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0" =C2=A0 =C2=A0 =C2=A0 add =C2=A0 =C2=A0 %0, = %3, %0\n" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> @@ -75,69 +69,78 @@ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "=3D&r" (t), "=3Dm" (*p) =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "r" (p), "r" (v), "m" (*p) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "cc", "memory") =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> - =C2=A0 =C2=A0/* __ATOMIC_ADD_64 */ >> + =C2=A0 =C2=A0/* __atomic_add_long */ >> #else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__ATOMIC_ADD_64(p, v, t) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A064-bit atomic_add not implemented > > Now correctly left out when it is not supported. See below, for non powerpc64 case it must not be used. >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__atomic_add_long(p, v, t) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0long atomic_add not implemented >> #endif > > atomic_add_long() should never be supported, but it is (mis)used in > standard kernel files so not having it will break more than just LINT. > But the above is not atomic_add_long()...hacks are used below to make > that sort of work. In which sense "should never be supported"? If you are on a 64 bit arch and you want and atomic operation for long you are supposed to use 64-bit version directly? I don't get the point. >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_64 =C2=A0 =C2=A0 =C2= =A0 atomic_add_acq_long >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_64 =C2=A0 =C2=A0 =C2= =A0 atomic_add_rel_long >> + >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_ptr(p, v) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_long((volatile u_long *)(p), (u_long)(= v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_acq_long((volatile u_long *)(p), (u_lo= ng)(v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_rel_long((volatile u_long *)(p), (u_lo= ng)(v)) > > This uses bogus casts to break warnings. =C2=A0amd64 is still missing thi= s bug. > Someone added this bug to i386 after reviewers objected to it. =C2=A0Even= i386 > only has this bug for accesses to pointers. =C2=A0For char/short/long, it= uses > type-safe code with separate functions/#defines like the ones for int. I'll probabilly may have get from the i386 version, I'll verify, thanks. > The casts for pointers break jhb's intentions that: > - atomic accesses to pointers should be rare > - when they are needed, the caller must cast > > I don't know why we don't have separate functions/#defines for pointers, > but like not having the bloat for it. Nice history, I didn't know that explicitly, but I'll check that later along with the cast thing. >> +#else >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_long(p, v) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_int((volatile u_int *)(p), (u_int)(v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_long(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_acq_int((volatile u_int *)(p), (u_int)= (v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_long(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_rel_int((volatile u_int *)(p), (u_int)= (v)) >> + >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_ptr(p, v) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_int((volatile u_int *)(p), (u_int)(v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_acq_int((volatile u_int *)(p), (u_int)= (v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_add_rel_int((volatile u_int *)(p), (u_int)= (v)) >> +#endif > > Now you need the bogus casts for the longs, since although atomic > accesses to longs should be rarer than ones to pointers (never on MI code= ), > it is not intended that the caller must bogusly cast for them, especially > since the bogus casts are MD. > > The bogus casts for the pointers should have no effect except to break > warnings in new code, since at least old MI code must already have the > casts in callers else it wouldn't compile on amd64. > >> [... often I snip bits without noting this as here] >> -#if 0 >> -_ATOMIC_CLEAR(8, 8, uint8_t) >> -_ATOMIC_CLEAR(8, char, u_char) >> -_ATOMIC_CLEAR(16, 16, uint16_t) >> -_ATOMIC_CLEAR(16, short, u_short) >> -#endif >> -_ATOMIC_CLEAR(32, 32, uint32_t) >> -_ATOMIC_CLEAR(32, int, u_int) >> -#ifdef __powerpc64__ >> -_ATOMIC_CLEAR(64, 64, uint64_t) >> -_ATOMIC_CLEAR(64, long, u_long) >> -_ATOMIC_CLEAR(64, ptr, uintptr_t) >> -#else >> -_ATOMIC_CLEAR(32, long, u_long) >> -_ATOMIC_CLEAR(32, ptr, uintptr_t) >> -#endif > > Seems a better way, and still used on amd64 and i386, to generate > separate type-safe code for each type supported. =C2=A0Here the only erro= r > relative to amd64 and i386 seems to have been to generate from long > to a 32/64 suffix and #define from that back to a long suffix, instead > of to generate from long to a long suffix and #define from that to a > 32/64 suffix. I'm a bit confused on what you are stating here exactly... are in favor of this change or not? >> ... >> @@ -622,39 +638,59 @@ atomic_cmpset_rel_long(volatile u_long * >> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (atomic_cmpset_long(p, cmpval, newval)= ); >> } >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_int =C2=A0 atomic_= cmpset_acq_32 >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_int =C2=A0 atomic_= cmpset_rel_32 >> - >> -#ifdef __powerpc64__ >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new)= =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)= (old), >> (u_long)(new)) >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new)= =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)= (old), >> (u_long)(new)) >> -#else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new)= =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0atomic_cmpset_acq_32((volatile u_int *)(dst), (u_int)(old= ), >> (u_int)(new)) >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new)= =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0atomic_cmpset_rel_32((volatile u_int *)(dst), (u_int)(old= ), >> (u_int)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_64 =C2=A0 =C2=A0 =C2= =A0 =C2=A0atomic_cmpset_long >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_64 =C2=A0 =C2=A0at= omic_cmpset_acq_long >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_64 =C2=A0 =C2=A0at= omic_cmpset_rel_long >> + >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_ptr(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0\ > > No bogus casts for these now. > >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_long((volatile u_long *)(dst), (u_l= ong)(old), =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_long)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_acq_long((volatile u_long *)(dst), = (u_long)(old), \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_long)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_rel_long((volatile u_long *)(dst), = (u_long)(old), \ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_long)(new)) > > These bogus casts seem more bogus than before -- they seem to do nothing > except break type safety, since you already have functions with the right > suffixes and types (except the suffix says `long' but only u_longs are > supported). > >> +#else >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_long(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_int((volatile u_int *)(dst), (u_int= )(old), =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_long(dst, old, new= ) >> =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_acq_int((volatile u_int *)(dst), (u= _int)(old), =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_long(dst, old, new= ) >> =C2=A0 =C2=A0 =C2=A0 \ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_rel_int((volatile u_int *)(dst), (u= _int)(old), =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) > > Usual bogus casts to type-pun from long to int in the 32-bit case. =C2=A0= Even > here, the ones on the non-pointer args have no useful effect. > >> + >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_ptr(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_int((volatile u_int *)(dst), (u_int= )(old), =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_acq_int((volatile u_int *)(dst), (u= _int)(old), =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new) >> =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_rel_int((volatile u_int *)(dst), (u= _int)(old), =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >> #endif > > Usual bogus casts for the pointer case. > >> #ifdef __powerpc64__ >> -static __inline uint64_t >> -atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) >> +static __inline u_long >> +atomic_fetchadd_long(volatile u_long *p, u_long v) >> { >> - =C2=A0 =C2=A0 =C2=A0 uint64_t value; >> + =C2=A0 =C2=A0 =C2=A0 u_long value; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0do { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0value =3D *p; >> @@ -662,10 +698,10 @@ atomic_fetchadd_64(volatile uint64_t *p, >> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (value); >> } >> >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_long =C2=A0 =C2=A0at= omic_fetchadd_64 >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_64 =C2=A0 =C2=A0 =C2= =A0atomic_fetchadd_long >> #else >> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_long(p, v) =C2=A0 = =C2=A0 =C2=A0\ >> - =C2=A0 =C2=A0(u_long)atomic_fetchadd_32((volatile u_int *)(p), (u_int)= (v)) >> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_long(p, v) >> =C2=A0 =C2=A0 =C2=A0\ >> + =C2=A0 =C2=A0 =C2=A0 (u_long)atomic_fetchadd_int((volatile u_int *)(p)= , (u_int)(v)) > > i386 uses a function to type-pun from fetchadd_long to fetchadd_int(). > This has minor technical advantages. =C2=A0Why be different? I'm not entirely sure what you mean with 'function to type-pun' but will look at that as well, thanks. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:23:21 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C49491065674; Sun, 8 May 2011 14:23:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B77BF8FC0A; Sun, 8 May 2011 14:23:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48ENLat050003; Sun, 8 May 2011 14:23:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48ENL1K050000; Sun, 8 May 2011 14:23:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105081423.p48ENL1K050000@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 May 2011 14:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221661 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:23:21 -0000 Author: attilio Date: Sun May 8 14:23:21 2011 New Revision: 221661 URL: http://svn.freebsd.org/changeset/base/221661 Log: - Fix a typo - Fix an inversion in the logic Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c projects/largeSMP/sys/sparc64/sparc64/pmap.c Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Sun May 8 14:03:44 2011 (r221660) +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Sun May 8 14:23:21 2011 (r221661) @@ -497,7 +497,7 @@ cpu_mp_shutdown(void) shutdown_cpus = PCPU_GET(other_cpus); cpus = shutdown_cpus; - /* XXX: Stopp all the CPUs which aren't already. */ + /* XXX: Stop all the CPUs which aren't already. */ if (CPU_CMP(&stopped_cpus, &cpus)) { /* pc_other_cpus is just a flat "on" mask without curcpu. */ Modified: projects/largeSMP/sys/sparc64/sparc64/pmap.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/pmap.c Sun May 8 14:03:44 2011 (r221660) +++ projects/largeSMP/sys/sparc64/sparc64/pmap.c Sun May 8 14:23:21 2011 (r221661) @@ -664,7 +664,7 @@ pmap_bootstrap(u_int cpu_impl) pm = kernel_pmap; for (i = 0; i < MAXCPU; i++) pm->pm_context[i] = TLB_CTX_KERNEL; - CPU_ZERO(&pm->pm_active); + CPU_FILL(&pm->pm_active); /* * Flush all non-locked TLB entries possibly left over by the From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:29:26 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CD221065672; Sun, 8 May 2011 14:29:26 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F4B98FC08; Sun, 8 May 2011 14:29:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48ETQwq050225; Sun, 8 May 2011 14:29:26 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48ETPvo050219; Sun, 8 May 2011 14:29:25 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105081429.p48ETPvo050219@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 May 2011 14:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221662 - projects/largeSMP/lib/libmemstat X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:29:26 -0000 Author: attilio Date: Sun May 8 14:29:25 2011 New Revision: 221662 URL: http://svn.freebsd.org/changeset/base/221662 Log: Revert MAXCPU introduction. In userland it is always 1. Noted by: marcel Modified: projects/largeSMP/lib/libmemstat/memstat.c projects/largeSMP/lib/libmemstat/memstat.h projects/largeSMP/lib/libmemstat/memstat_internal.h projects/largeSMP/lib/libmemstat/memstat_malloc.c projects/largeSMP/lib/libmemstat/memstat_uma.c Modified: projects/largeSMP/lib/libmemstat/memstat.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat.c Sun May 8 14:23:21 2011 (r221661) +++ projects/largeSMP/lib/libmemstat/memstat.c Sun May 8 14:29:25 2011 (r221662) @@ -193,7 +193,7 @@ _memstat_mt_reset_stats(struct memory_ty mtp->mt_zonefree = 0; mtp->mt_kegfree = 0; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i < MEMSTAT_MAXCPU; i++) { mtp->mt_percpu_alloc[i].mtp_memalloced = 0; mtp->mt_percpu_alloc[i].mtp_memfreed = 0; mtp->mt_percpu_alloc[i].mtp_numallocs = 0; Modified: projects/largeSMP/lib/libmemstat/memstat.h ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat.h Sun May 8 14:23:21 2011 (r221661) +++ projects/largeSMP/lib/libmemstat/memstat.h Sun May 8 14:29:25 2011 (r221662) @@ -30,6 +30,12 @@ #define _MEMSTAT_H_ /* + * Number of CPU slots in library-internal data structures. This should be + * at least value of MAXCPU from param.h + */ +#define MEMSTAT_MAXCPU 32 + +/* * Amount of caller data to maintain for each caller data slot. Applications * must not request more than this number of caller save data, or risk * corrupting internal libmemstat(3) data structures. A compile time check Modified: projects/largeSMP/lib/libmemstat/memstat_internal.h ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_internal.h Sun May 8 14:23:21 2011 (r221661) +++ projects/largeSMP/lib/libmemstat/memstat_internal.h Sun May 8 14:29:25 2011 (r221662) @@ -100,11 +100,11 @@ struct memory_type { uint64_t mtp_sizemask; /* Per-CPU mt_sizemask. */ void *mtp_caller_pointer[MEMSTAT_MAXCALLER]; uint64_t mtp_caller_uint64[MEMSTAT_MAXCALLER]; - } mt_percpu_alloc[MAXCPU]; + } mt_percpu_alloc[MEMSTAT_MAXCPU]; struct { uint64_t mtp_free; /* Per-CPU cache free items. */ - } mt_percpu_cache[MAXCPU]; + } mt_percpu_cache[MEMSTAT_MAXCPU]; LIST_ENTRY(memory_type) mt_list; /* List of types. */ }; Modified: projects/largeSMP/lib/libmemstat/memstat_malloc.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_malloc.c Sun May 8 14:23:21 2011 (r221661) +++ projects/largeSMP/lib/libmemstat/memstat_malloc.c Sun May 8 14:29:25 2011 (r221662) @@ -96,7 +96,7 @@ retry: return (-1); } - if (maxcpus > MAXCPU) { + if (maxcpus > MEMSTAT_MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; return (-1); } @@ -160,7 +160,7 @@ retry: return (-1); } - if (mtshp->mtsh_maxcpus > MAXCPU) { + if (mtshp->mtsh_maxcpus > MEMSTAT_MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; free(buffer); return (-1); @@ -295,7 +295,7 @@ memstat_kvm_malloc(struct memory_type_li void *kmemstatistics; int hint_dontsearch, j, mp_maxcpus, ret; char name[MEMTYPE_MAXNAME]; - struct malloc_type_stats mts[MAXCPU], *mtsp; + struct malloc_type_stats mts[MEMSTAT_MAXCPU], *mtsp; struct malloc_type_internal *mtip; struct malloc_type type, *typep; kvm_t *kvm; @@ -322,7 +322,7 @@ memstat_kvm_malloc(struct memory_type_li return (-1); } - if (mp_maxcpus > MAXCPU) { + if (mp_maxcpus > MEMSTAT_MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; return (-1); } @@ -348,6 +348,11 @@ memstat_kvm_malloc(struct memory_type_li list->mtl_error = ret; return (-1); } + + /* + * Since our compile-time value for MAXCPU may differ from the + * kernel's, we populate our own array. + */ mtip = type.ks_handle; ret = kread(kvm, mtip->mti_stats, mts, mp_maxcpus * sizeof(struct malloc_type_stats), 0); Modified: projects/largeSMP/lib/libmemstat/memstat_uma.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_uma.c Sun May 8 14:23:21 2011 (r221661) +++ projects/largeSMP/lib/libmemstat/memstat_uma.c Sun May 8 14:29:25 2011 (r221662) @@ -27,7 +27,6 @@ */ #include -#include #include #define LIBMEMSTAT /* Cause vm_page.h not to include opt_vmpage.h */ @@ -106,7 +105,7 @@ retry: return (-1); } - if (maxcpus > MAXCPU) { + if (maxcpus > MEMSTAT_MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; return (-1); } @@ -170,7 +169,7 @@ retry: return (-1); } - if (ushp->ush_maxcpus > MAXCPU) { + if (ushp->ush_maxcpus > MEMSTAT_MAXCPU) { list->mtl_error = MEMSTAT_ERROR_TOOMANYCPUS; free(buffer); return (-1); From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:36:24 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CAB11065670; Sun, 8 May 2011 14:36:24 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id B603E8FC17; Sun, 8 May 2011 14:36:23 +0000 (UTC) Received: by yxl31 with SMTP id 31so1996391yxl.13 for ; Sun, 08 May 2011 07:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=2jWQelJWb/Oxc5CFWT7QyIUL2p3BOd/UGkuPhAb+zHE=; b=EWATGCenGrPkf82cEuKGjhVm+KDIHC5+OuS1/mreU2P764hR4A6Bi6p36MHwfftI8k 5W6H6geunzzUHoNMvBFddPregwz+REs2hRRcTjTC61fXNki2Hrt9SRA0/YGNf0MyMtlK BM4p7gplQzd8jARFbZVsw4ADp7NKkRb/k3v+Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=JdDWw8/8Hs+IcfRCxD0QkwwfBu7ZPRO/1Ya22aOYo1LcXsP6gFhJI2StvzQiAceiVG HXyNwSLGn3yY+z0AtqN+BZ9UaafnZ+JW226Cd2srdVsbdBp7LZoEVDPt3W4bBQRCLNCO 8xFqI8710AYTejIRFZjLsAMnpWRahx+h+7oTI= MIME-Version: 1.0 Received: by 10.236.195.99 with SMTP id o63mr6344303yhn.238.1304865382766; Sun, 08 May 2011 07:36:22 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Sun, 8 May 2011 07:36:22 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> Date: Sun, 8 May 2011 10:36:22 -0400 X-Google-Sender-Auth: BnxmsJcjWuXk1soZfZoQ6gcjfCQ Message-ID: From: Attilio Rao To: Bruce Evans Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:36:24 -0000 2011/5/8 Attilio Rao : > 2011/5/8 Bruce Evans : >> On Sun, 8 May 2011, Attilio Rao wrote: >> >>> Log: >>> =C2=A0All architectures define the size-bounded types (uint32_t, uint64= _t, >>> etc.) >>> =C2=A0starting from base C types (int, long, etc). >>> =C2=A0That is also reflected when building atomic operations, as the >>> =C2=A0size-bounded types are built from the base C types. >>> >>> =C2=A0However, powerpc does the inverse thing, leading to a serie of na= sty >> >> I think you mean that it does the inverse thing for atomic ops only. >> >>> =C2=A0bugs. >>> =C2=A0Cleanup the atomic implementation by defining as base the base C = type >>> =C2=A0version and depending on them, appropriately. >> >> I think that it is mostly the other arches that are backwards here, >> except for plain ints. =C2=A0MI code cannot use atomic ops for anything >> except plain ints, since no other type is guaranteed to be supported >> by the MD code. =C2=A0For example, sparc64 doesn't support any 8-bit or >> 16-bit types, and i386 doesn't support any 64-bit types (until recently; >> it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support >> 64, bit types), and my version of i386 doesn't support any 8-bit or >> 16-bit types or long since these types are unusable in MI code and >> unused in MD code (long is misused in some MI code but I don't use >> such broken code). >> >> At least one type must be supported, and to keep things sane, int must >> be supported. =C2=A0The type could be int32_t instead, but then you woul= d have >> a hard-coded assumption that int is int32_t instead of a hard-coded >> assumption that int can be an atomic type. =C2=A0The latter is a better >> assumption for MI code. =C2=A0But MD code can make the former assumption >> except of course on arches where it is false, but there are none of >> those yet. =C2=A0This gives the following structure in atomic.h: >> >> o basic definitions in terms of uint8/16/32/64_t. =C2=A0But don't define= the >> =C2=A08/16/64 bit ones unless they are actually used in MD code, which i= s >> =C2=A0rare. =C2=A0MI code cannot use these. >> o assume that u_int is uint32_t and #define all the atomic_foo_int() >> =C2=A0interfaces as atomic_foo_32. =C2=A0Similarly for pointers, except = use >> =C2=A0atomic_foo_64 in some cases. >> o do something for long. =C2=A0MI code cannot use atomic ops on longs, b= ut does. >> =C2=A0Correctly-sized longs are usually fundamentally non-atomic since t= hey >> =C2=A0are twice as long as the register width and the register width is = usually >> =C2=A0the same as the bus width and atomicness for widths wider than the= bus is >> =C2=A0unnatural and/or inefficient. =C2=A0But no supported arch has corr= ectly-sized >> =C2=A0longs. > > So the thing is that we define the uintXX_t type from int,long,etc and > then we should really expect to follow the same pattern for atomic > instructions. > >>> Modified: projects/largeSMP/sys/powerpc/include/atomic.h >>> >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>> --- projects/largeSMP/sys/powerpc/include/atomic.h =C2=A0 =C2=A0 =C2=A0= Sat May =C2=A07 >>> 23:34:14 2011 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r221613) >>> +++ projects/largeSMP/sys/powerpc/include/atomic.h =C2=A0 =C2=A0 =C2=A0= Sun May =C2=A08 >>> 00:39:49 2011 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r221614) >>> @@ -48,13 +48,7 @@ >>> =C2=A0* { *p +=3D v; } >>> =C2=A0*/ >>> >>> -#define __ATOMIC_ADD_8(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A08-bit atomic_add not implemented >>> - >>> -#define __ATOMIC_ADD_16(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> - =C2=A0 =C2=A016-bit atomic_add not implemented >>> - >> >> Already correctly left out except for bogusly #defining it and #undefini= ng >> it. =C2=A0Now not bogusly #defined either. > > I don't see the point to have something like that, also because is > never used in the kernel. > >>> -#define __ATOMIC_ADD_32(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> +#define __atomic_add_int(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> =C2=A0 =C2=A0__asm __volatile( =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0"1: =C2=A0 =C2=A0 lwarx =C2=A0 %0, 0, %2\n" = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0" =C2=A0 =C2=A0 =C2=A0 add =C2=A0 =C2=A0 %0,= %3, %0\n" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> @@ -63,10 +57,10 @@ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "=3D&r" (t), "=3Dm" (*p) =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "r" (p), "r" (v), "m" (*p) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "cc", "memory") =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> - =C2=A0 =C2=A0/* __ATOMIC_ADD_32 */ >>> + =C2=A0 =C2=A0/* __atomic_add_int */ >> >> No type problems at this level. > > Yes, but I also want uniformity in the implementation, thus try to > give a common pattern. > >>> #ifdef __powerpc64__ >>> -#define __ATOMIC_ADD_64(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> +#define __atomic_add_long(p, v, t) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> =C2=A0 =C2=A0__asm __volatile( =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0"1: =C2=A0 =C2=A0 ldarx =C2=A0 %0, 0, %2\n" = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0" =C2=A0 =C2=A0 =C2=A0 add =C2=A0 =C2=A0 %0,= %3, %0\n" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> @@ -75,69 +69,78 @@ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "=3D&r" (t), "=3Dm" (*p) =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "r" (p), "r" (v), "m" (*p) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0\ >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0: "cc", "memory") =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> - =C2=A0 =C2=A0/* __ATOMIC_ADD_64 */ >>> + =C2=A0 =C2=A0/* __atomic_add_long */ >>> #else >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__ATOMIC_ADD_64(p, v, t) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A064-bit atomic_add not implemented >> >> Now correctly left out when it is not supported. > > See below, for non powerpc64 case it must not be used. > >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__atomic_add_long(p, v, t) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0long atomic_add not implemented >>> #endif >> >> atomic_add_long() should never be supported, but it is (mis)used in >> standard kernel files so not having it will break more than just LINT. >> But the above is not atomic_add_long()...hacks are used below to make >> that sort of work. > > In which sense "should never be supported"? > If you are on a 64 bit arch and you want and atomic operation for long > you are supposed to use 64-bit version directly? I don't get the > point. > >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_64 =C2=A0 =C2=A0 =C2= =A0 atomic_add_acq_long >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_64 =C2=A0 =C2=A0 =C2= =A0 atomic_add_rel_long >>> + >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_ptr(p, v) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_long((volatile u_long *)(p), (u_long)= (v)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_acq_long((volatile u_long *)(p), (u_l= ong)(v)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_rel_long((volatile u_long *)(p), (u_l= ong)(v)) >> >> This uses bogus casts to break warnings. =C2=A0amd64 is still missing th= is bug. >> Someone added this bug to i386 after reviewers objected to it. =C2=A0Eve= n i386 >> only has this bug for accesses to pointers. =C2=A0For char/short/long, i= t uses >> type-safe code with separate functions/#defines like the ones for int. > > I'll probabilly may have get from the i386 version, I'll verify, thanks. > >> The casts for pointers break jhb's intentions that: >> - atomic accesses to pointers should be rare >> - when they are needed, the caller must cast >> >> I don't know why we don't have separate functions/#defines for pointers, >> but like not having the bloat for it. > > Nice history, I didn't know that explicitly, but I'll check that later > along with the cast thing. > >>> +#else >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_long(p, v) =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_int((volatile u_int *)(p), (u_int)(v)= ) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_long(p, v) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_acq_int((volatile u_int *)(p), (u_int= )(v)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_long(p, v) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_rel_int((volatile u_int *)(p), (u_int= )(v)) >>> + >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_ptr(p, v) =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_int((volatile u_int *)(p), (u_int)(v)= ) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_acq_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_acq_int((volatile u_int *)(p), (u_int= )(v)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_add_rel_ptr(p, v) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_add_rel_int((volatile u_int *)(p), (u_int= )(v)) >>> +#endif >> >> Now you need the bogus casts for the longs, since although atomic >> accesses to longs should be rarer than ones to pointers (never on MI cod= e), >> it is not intended that the caller must bogusly cast for them, especiall= y >> since the bogus casts are MD. >> >> The bogus casts for the pointers should have no effect except to break >> warnings in new code, since at least old MI code must already have the >> casts in callers else it wouldn't compile on amd64. >> >>> [... often I snip bits without noting this as here] >>> -#if 0 >>> -_ATOMIC_CLEAR(8, 8, uint8_t) >>> -_ATOMIC_CLEAR(8, char, u_char) >>> -_ATOMIC_CLEAR(16, 16, uint16_t) >>> -_ATOMIC_CLEAR(16, short, u_short) >>> -#endif >>> -_ATOMIC_CLEAR(32, 32, uint32_t) >>> -_ATOMIC_CLEAR(32, int, u_int) >>> -#ifdef __powerpc64__ >>> -_ATOMIC_CLEAR(64, 64, uint64_t) >>> -_ATOMIC_CLEAR(64, long, u_long) >>> -_ATOMIC_CLEAR(64, ptr, uintptr_t) >>> -#else >>> -_ATOMIC_CLEAR(32, long, u_long) >>> -_ATOMIC_CLEAR(32, ptr, uintptr_t) >>> -#endif >> >> Seems a better way, and still used on amd64 and i386, to generate >> separate type-safe code for each type supported. =C2=A0Here the only err= or >> relative to amd64 and i386 seems to have been to generate from long >> to a 32/64 suffix and #define from that back to a long suffix, instead >> of to generate from long to a long suffix and #define from that to a >> 32/64 suffix. > > I'm a bit confused on what you are stating here exactly... are in > favor of this change or not? > >>> ... >>> @@ -622,39 +638,59 @@ atomic_cmpset_rel_long(volatile u_long * >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (atomic_cmpset_long(p, cmpval, newval= )); >>> } >>> >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_int =C2=A0 atomic= _cmpset_acq_32 >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_int =C2=A0 atomic= _cmpset_rel_32 >>> - >>> -#ifdef __powerpc64__ >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new= ) =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A0atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long= )(old), >>> (u_long)(new)) >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new= ) =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A0atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long= )(old), >>> (u_long)(new)) >>> -#else >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new= ) =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A0atomic_cmpset_acq_32((volatile u_int *)(dst), (u_int)(ol= d), >>> (u_int)(new)) >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new= ) =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A0atomic_cmpset_rel_32((volatile u_int *)(dst), (u_int)(ol= d), >>> (u_int)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_64 =C2=A0 =C2=A0 =C2= =A0 =C2=A0atomic_cmpset_long >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_64 =C2=A0 =C2=A0a= tomic_cmpset_acq_long >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_64 =C2=A0 =C2=A0a= tomic_cmpset_rel_long >>> + >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_ptr(dst, old, new) >>> =C2=A0 =C2=A0 =C2=A0\ >> >> No bogus casts for these now. >> >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_long((volatile u_long *)(dst), (u_= long)(old), =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_long)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new= ) >>> =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_acq_long((volatile u_long *)(dst),= (u_long)(old), \ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_long)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new= ) >>> =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_rel_long((volatile u_long *)(dst),= (u_long)(old), \ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_long)(new)) >> >> These bogus casts seem more bogus than before -- they seem to do nothing >> except break type safety, since you already have functions with the righ= t >> suffixes and types (except the suffix says `long' but only u_longs are >> supported). >> >>> +#else >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_long(dst, old, new) >>> =C2=A0 =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_int((volatile u_int *)(dst), (u_in= t)(old), =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_long(dst, old, ne= w) >>> =C2=A0 =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_acq_int((volatile u_int *)(dst), (= u_int)(old), =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_long(dst, old, ne= w) >>> =C2=A0 =C2=A0 =C2=A0 \ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_rel_int((volatile u_int *)(dst), (= u_int)(old), =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >> >> Usual bogus casts to type-pun from long to int in the 32-bit case. =C2= =A0Even >> here, the ones on the non-pointer args have no useful effect. >> >>> + >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_ptr(dst, old, new) >>> =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_int((volatile u_int *)(dst), (u_in= t)(old), =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_acq_ptr(dst, old, new= ) >>> =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_acq_int((volatile u_int *)(dst), (= u_int)(old), =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_cmpset_rel_ptr(dst, old, new= ) >>> =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 atomic_cmpset_rel_int((volatile u_int *)(dst), (= u_int)(old), =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (u_int)(new)) >>> #endif >> >> Usual bogus casts for the pointer case. >> >>> #ifdef __powerpc64__ >>> -static __inline uint64_t >>> -atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) >>> +static __inline u_long >>> +atomic_fetchadd_long(volatile u_long *p, u_long v) >>> { >>> - =C2=A0 =C2=A0 =C2=A0 uint64_t value; >>> + =C2=A0 =C2=A0 =C2=A0 u_long value; >>> >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0do { >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0value =3D *p; >>> @@ -662,10 +698,10 @@ atomic_fetchadd_64(volatile uint64_t *p, >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (value); >>> } >>> >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_long =C2=A0 =C2=A0a= tomic_fetchadd_64 >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_64 =C2=A0 =C2=A0 = =C2=A0atomic_fetchadd_long >>> #else >>> -#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_long(p, v) =C2=A0 = =C2=A0 =C2=A0\ >>> - =C2=A0 =C2=A0(u_long)atomic_fetchadd_32((volatile u_int *)(p), (u_int= )(v)) >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_fetchadd_long(p, v) >>> =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0 =C2=A0 (u_long)atomic_fetchadd_int((volatile u_int *)(p= ), (u_int)(v)) >> >> i386 uses a function to type-pun from fetchadd_long to fetchadd_int(). >> This has minor technical advantages. =C2=A0Why be different? > > I'm not entirely sure what you mean with 'function to type-pun' but > will look at that as well, thanks. > I think I got what you mean with "type-pun" version of long and I'll fix as expected, thanks. On a related note, in previous e-mail you just noticed the lenghty of atomic in powerpc. I just wanted to let you note that atomic.h needs to actually cater 2 different type of architectures (keeping the support of both powerpc and powerpc64). sparc64, amd64 and i386 don't have these problem. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:40:43 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 591511065670; Sun, 8 May 2011 14:40:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx10.syd.optusnet.com.au (fallbackmx10.syd.optusnet.com.au [211.29.132.251]) by mx1.freebsd.org (Postfix) with ESMTP id B20EF8FC15; Sun, 8 May 2011 14:40:42 +0000 (UTC) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by fallbackmx10.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p48CQTBS019898; Sun, 8 May 2011 22:26:29 +1000 Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p48CQDAM013247 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 8 May 2011 22:26:25 +1000 Date: Sun, 8 May 2011 22:26:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: <201105080039.p480doiZ021493@svn.freebsd.org> Message-ID: <20110508202725.K1192@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:40:43 -0000 On Sun, 8 May 2011, Attilio Rao wrote: > Log: > All architectures define the size-bounded types (uint32_t, uint64_t, etc.) > starting from base C types (int, long, etc). > That is also reflected when building atomic operations, as the > size-bounded types are built from the base C types. > > However, powerpc does the inverse thing, leading to a serie of nasty I think you mean that it does the inverse thing for atomic ops only. > bugs. > Cleanup the atomic implementation by defining as base the base C type > version and depending on them, appropriately. I think that it is mostly the other arches that are backwards here, except for plain ints. MI code cannot use atomic ops for anything except plain ints, since no other type is guaranteed to be supported by the MD code. For example, sparc64 doesn't support any 8-bit or 16-bit types, and i386 doesn't support any 64-bit types (until recently; it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support 64, bit types), and my version of i386 doesn't support any 8-bit or 16-bit types or long since these types are unusable in MI code and unused in MD code (long is misused in some MI code but I don't use such broken code). At least one type must be supported, and to keep things sane, int must be supported. The type could be int32_t instead, but then you would have a hard-coded assumption that int is int32_t instead of a hard-coded assumption that int can be an atomic type. The latter is a better assumption for MI code. But MD code can make the former assumption except of course on arches where it is false, but there are none of those yet. This gives the following structure in atomic.h: o basic definitions in terms of uint8/16/32/64_t. But don't define the 8/16/64 bit ones unless they are actually used in MD code, which is rare. MI code cannot use these. o assume that u_int is uint32_t and #define all the atomic_foo_int() interfaces as atomic_foo_32. Similarly for pointers, except use atomic_foo_64 in some cases. o do something for long. MI code cannot use atomic ops on longs, but does. Correctly-sized longs are usually fundamentally non-atomic since they are twice as long as the register width and the register width is usually the same as the bus width and atomicness for widths wider than the bus is unnatural and/or inefficient. But no supported arch has correctly-sized longs. > Modified: projects/largeSMP/sys/powerpc/include/atomic.h > ============================================================================== > --- projects/largeSMP/sys/powerpc/include/atomic.h Sat May 7 23:34:14 2011 (r221613) > +++ projects/largeSMP/sys/powerpc/include/atomic.h Sun May 8 00:39:49 2011 (r221614) > @@ -48,13 +48,7 @@ > * { *p += v; } > */ > > -#define __ATOMIC_ADD_8(p, v, t) \ > - 8-bit atomic_add not implemented > - > -#define __ATOMIC_ADD_16(p, v, t) \ > - 16-bit atomic_add not implemented > - Already correctly left out except for bogusly #defining it and #undefining it. Now not bogusly #defined either. > -#define __ATOMIC_ADD_32(p, v, t) \ > +#define __atomic_add_int(p, v, t) \ > __asm __volatile( \ > "1: lwarx %0, 0, %2\n" \ > " add %0, %3, %0\n" \ > @@ -63,10 +57,10 @@ > : "=&r" (t), "=m" (*p) \ > : "r" (p), "r" (v), "m" (*p) \ > : "cc", "memory") \ > - /* __ATOMIC_ADD_32 */ > + /* __atomic_add_int */ No type problems at this level. > #ifdef __powerpc64__ > -#define __ATOMIC_ADD_64(p, v, t) \ > +#define __atomic_add_long(p, v, t) \ > __asm __volatile( \ > "1: ldarx %0, 0, %2\n" \ > " add %0, %3, %0\n" \ > @@ -75,69 +69,78 @@ > : "=&r" (t), "=m" (*p) \ > : "r" (p), "r" (v), "m" (*p) \ > : "cc", "memory") \ > - /* __ATOMIC_ADD_64 */ > + /* __atomic_add_long */ > #else > -#define __ATOMIC_ADD_64(p, v, t) \ > - 64-bit atomic_add not implemented Now correctly left out when it is not supported. > +#define __atomic_add_long(p, v, t) \ > + long atomic_add not implemented > #endif atomic_add_long() should never be supported, but it is (mis)used in standard kernel files so not having it will break more than just LINT. But the above is not atomic_add_long()...hacks are used below to make that sort of work. > +#ifdef __powerpc64__ > +_ATOMIC_ADD(long) > + > +#define atomic_add_64 atomic_add_long No problems with longs on 64-bit arches. > +#define atomic_add_acq_64 atomic_add_acq_long > +#define atomic_add_rel_64 atomic_add_rel_long > + > +#define atomic_add_ptr(p, v) \ > + atomic_add_long((volatile u_long *)(p), (u_long)(v)) > +#define atomic_add_acq_ptr(p, v) \ > + atomic_add_acq_long((volatile u_long *)(p), (u_long)(v)) > +#define atomic_add_rel_ptr(p, v) \ > + atomic_add_rel_long((volatile u_long *)(p), (u_long)(v)) This uses bogus casts to break warnings. amd64 is still missing this bug. Someone added this bug to i386 after reviewers objected to it. Even i386 only has this bug for accesses to pointers. For char/short/long, it uses type-safe code with separate functions/#defines like the ones for int. The casts for pointers break jhb's intentions that: - atomic accesses to pointers should be rare - when they are needed, the caller must cast I don't know why we don't have separate functions/#defines for pointers, but like not having the bloat for it. > +#else > +#define atomic_add_long(p, v) \ > + atomic_add_int((volatile u_int *)(p), (u_int)(v)) > +#define atomic_add_acq_long(p, v) \ > + atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) > +#define atomic_add_rel_long(p, v) \ > + atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) > + > +#define atomic_add_ptr(p, v) \ > + atomic_add_int((volatile u_int *)(p), (u_int)(v)) > +#define atomic_add_acq_ptr(p, v) \ > + atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) > +#define atomic_add_rel_ptr(p, v) \ > + atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) > +#endif Now you need the bogus casts for the longs, since although atomic accesses to longs should be rarer than ones to pointers (never on MI code), it is not intended that the caller must bogusly cast for them, especially since the bogus casts are MD. The bogus casts for the pointers should have no effect except to break warnings in new code, since at least old MI code must already have the casts in callers else it wouldn't compile on amd64. > [... often I snip bits without noting this as here] > -#if 0 > -_ATOMIC_CLEAR(8, 8, uint8_t) > -_ATOMIC_CLEAR(8, char, u_char) > -_ATOMIC_CLEAR(16, 16, uint16_t) > -_ATOMIC_CLEAR(16, short, u_short) > -#endif > -_ATOMIC_CLEAR(32, 32, uint32_t) > -_ATOMIC_CLEAR(32, int, u_int) > -#ifdef __powerpc64__ > -_ATOMIC_CLEAR(64, 64, uint64_t) > -_ATOMIC_CLEAR(64, long, u_long) > -_ATOMIC_CLEAR(64, ptr, uintptr_t) > -#else > -_ATOMIC_CLEAR(32, long, u_long) > -_ATOMIC_CLEAR(32, ptr, uintptr_t) > -#endif Seems a better way, and still used on amd64 and i386, to generate separate type-safe code for each type supported. Here the only error relative to amd64 and i386 seems to have been to generate from long to a 32/64 suffix and #define from that back to a long suffix, instead of to generate from long to a long suffix and #define from that to a 32/64 suffix. > ... > @@ -622,39 +638,59 @@ atomic_cmpset_rel_long(volatile u_long * > return (atomic_cmpset_long(p, cmpval, newval)); > } > > -#define atomic_cmpset_acq_int atomic_cmpset_acq_32 > -#define atomic_cmpset_rel_int atomic_cmpset_rel_32 > - > -#ifdef __powerpc64__ > -#define atomic_cmpset_acq_ptr(dst, old, new) \ > - atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new)) > -#define atomic_cmpset_rel_ptr(dst, old, new) \ > - atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), (u_long)(new)) > -#else > -#define atomic_cmpset_acq_ptr(dst, old, new) \ > - atomic_cmpset_acq_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) > -#define atomic_cmpset_rel_ptr(dst, old, new) \ > - atomic_cmpset_rel_32((volatile u_int *)(dst), (u_int)(old), (u_int)(new)) > +#define atomic_cmpset_64 atomic_cmpset_long > +#define atomic_cmpset_acq_64 atomic_cmpset_acq_long > +#define atomic_cmpset_rel_64 atomic_cmpset_rel_long > + > +#define atomic_cmpset_ptr(dst, old, new) \ No bogus casts for these now. > + atomic_cmpset_long((volatile u_long *)(dst), (u_long)(old), \ > + (u_long)(new)) > +#define atomic_cmpset_acq_ptr(dst, old, new) \ > + atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)(old), \ > + (u_long)(new)) > +#define atomic_cmpset_rel_ptr(dst, old, new) \ > + atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), \ > + (u_long)(new)) These bogus casts seem more bogus than before -- they seem to do nothing except break type safety, since you already have functions with the right suffixes and types (except the suffix says `long' but only u_longs are supported). > +#else > +#define atomic_cmpset_long(dst, old, new) \ > + atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), \ > + (u_int)(new)) > +#define atomic_cmpset_acq_long(dst, old, new) \ > + atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ > + (u_int)(new)) > +#define atomic_cmpset_rel_long(dst, old, new) \ > + atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ > + (u_int)(new)) Usual bogus casts to type-pun from long to int in the 32-bit case. Even here, the ones on the non-pointer args have no useful effect. > + > +#define atomic_cmpset_ptr(dst, old, new) \ > + atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), \ > + (u_int)(new)) > +#define atomic_cmpset_acq_ptr(dst, old, new) \ > + atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ > + (u_int)(new)) > +#define atomic_cmpset_rel_ptr(dst, old, new) \ > + atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ > + (u_int)(new)) > #endif Usual bogus casts for the pointer case. > #ifdef __powerpc64__ > -static __inline uint64_t > -atomic_fetchadd_64(volatile uint64_t *p, uint64_t v) > +static __inline u_long > +atomic_fetchadd_long(volatile u_long *p, u_long v) > { > - uint64_t value; > + u_long value; > > do { > value = *p; > @@ -662,10 +698,10 @@ atomic_fetchadd_64(volatile uint64_t *p, > return (value); > } > > -#define atomic_fetchadd_long atomic_fetchadd_64 > +#define atomic_fetchadd_64 atomic_fetchadd_long > #else > -#define atomic_fetchadd_long(p, v) \ > - (u_long)atomic_fetchadd_32((volatile u_int *)(p), (u_int)(v)) > +#define atomic_fetchadd_long(p, v) \ > + (u_long)atomic_fetchadd_int((volatile u_int *)(p), (u_int)(v)) i386 uses a function to type-pun from fetchadd_long to fetchadd_int(). This has minor technical advantages. Why be different? > #endif > > #endif /* ! _MACHINE_ATOMIC_H_ */ This file is disgustingly large. Sizes in a few-months-old sources: % 483 1887 16123 amd64/include/atomic.h % 388 1257 10623 arm/include/atomic.h % 487 1897 16033 i386/include/atomic.h % 389 1383 12377 ia64/include/atomic.h % 633 2333 18697 mips/include/atomic.h % 6 22 154 pc98/include/atomic.h % 671 2259 17306 powerpc/include/atomic.h % 299 1346 8953 sparc64/include/atomic.h % 299 1346 8950 sun4v/include/atomic.h sparc64 is cleanest. i386 atomic.h is about 150 lines smaller after removing unused mistakes. The extra code for powerpc64/32 ifdefs shouldn't take another 200 lines. I checked for type errors related to fetchadd. Most arches define 3 or 4 fetchadd functions. Only atomic_fetchadd_long is actually used. All of its uses are in MI code with bogus types: % ./kern/kern_resource.c: if (atomic_fetchadd_long(&uip->ui_proccnt, (long)diff) + diff > max) { % ./kern/kern_resource.c: if (atomic_fetchadd_long(&uip->ui_sbsize, (long)diff) + diff > max) { % ./kern/kern_resource.c: if (atomic_fetchadd_long(&uip->ui_ptscnt, (long)diff) + diff > max) { The ui_ fields are only long because 4.4BSD had too many longs and these fields didn't cause any ABI problems so they were left as longs. The pure counters here never needed to be more than 32-bits, so ints would have suffixed for them since we always assumed that ints have 32 bits. ui_sbsize just might want to grow larger than 2**31 on a 64-bit machine, but limiting it to 2**31 is reasonable (the ulimit for it defaults to unlimited (2**63-1), but serious memory shortages would develop if you allowed anyone to actually use as much as 2**31 for just socket buffers). The similar but should-be-less-restrictive limit on pipekva only grows from 16MB on i386 to 128MB on amd64. Bruce From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:44:05 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95A681065672; Sun, 8 May 2011 14:44:05 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id 3DA7A8FC0C; Sun, 8 May 2011 14:44:04 +0000 (UTC) Received: by yie12 with SMTP id 12so1993816yie.13 for ; Sun, 08 May 2011 07:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=NGRanqLS3HgfU5/R+o+Mqo+kG9L5GKqzuEbSEiEcrNQ=; b=ORp/n+mIjrYRqwSEwaLuVFqz5LY5FUABRDvPHf3wMQJ42G5QRGYc12AW86v3ia/0ts Qg1RxAzq+BBaOkAHNSP5PSFyNFJuKR7O/GtXQalEOBCKj5o40MR0JKfAkQOhXPCPZ2G3 65WBYtBGS7+zCa4KPTSlpoa1gXJzFla0rdAr4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=uQcyHQNjETBm1zdr/intc6V2z+cjF3IikTAJgqy65CJTok8latcxVh+lJDNFgXRY1q cOqDrby1elFJQvD3niX00fqrUo8OFzlbA5Na0a3qPGfmlMhKP48TO/9BwN4sWe/uV2Pk fcAX4vfVPeB3ZFOamUsSBvzgRZtTXL8VHQAOc= MIME-Version: 1.0 Received: by 10.236.139.233 with SMTP id c69mr6941584yhj.171.1304865844557; Sun, 08 May 2011 07:44:04 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Sun, 8 May 2011 07:44:04 -0700 (PDT) In-Reply-To: <20110508202725.K1192@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> Date: Sun, 8 May 2011 10:44:04 -0400 X-Google-Sender-Auth: BStGxSwon_SC3IySNHZdx5jcTmE Message-ID: From: Attilio Rao To: Bruce Evans Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:44:05 -0000 2011/5/8 Bruce Evans : > On Sun, 8 May 2011, Attilio Rao wrote: > >> Log: >> =C2=A0All architectures define the size-bounded types (uint32_t, uint64_= t, >> etc.) >> =C2=A0starting from base C types (int, long, etc). >> =C2=A0That is also reflected when building atomic operations, as the >> =C2=A0size-bounded types are built from the base C types. >> >> =C2=A0However, powerpc does the inverse thing, leading to a serie of nas= ty > > I think you mean that it does the inverse thing for atomic ops only. > >> =C2=A0bugs. >> =C2=A0Cleanup the atomic implementation by defining as base the base C t= ype >> =C2=A0version and depending on them, appropriately. > > I think that it is mostly the other arches that are backwards here, > except for plain ints. =C2=A0MI code cannot use atomic ops for anything > except plain ints, since no other type is guaranteed to be supported > by the MD code. =C2=A0For example, sparc64 doesn't support any 8-bit or > 16-bit types, and i386 doesn't support any 64-bit types (until recently; > it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support > 64, bit types), and my version of i386 doesn't support any 8-bit or > 16-bit types or long since these types are unusable in MI code and > unused in MD code (long is misused in some MI code but I don't use > such broken code). I want to comment specifically on this. I think you are right and that over time our kernel policy on atomic has got very flakey. My personal idea is that MI part should support only this: - _int version - _32 bit version - _ptr version and the common sense also mandates it could support easilly: - _long version The following should just be used in specific MD code or be totally unsuppo= rted: - _char, _short, _8 bit, _16 bit versions The following should just be used in MD code: - _64 bit version I'm not entirely sure what would be the impact on the current kernel of this scheme, but maybe with some luck this is how it is already got. Someone interested can check that. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:45:54 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 048FB106564A; Sun, 8 May 2011 14:45:54 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBABA8FC14; Sun, 8 May 2011 14:45:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48Ejru0050765; Sun, 8 May 2011 14:45:53 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48Ejrox050763; Sun, 8 May 2011 14:45:53 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105081445.p48Ejrox050763@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 May 2011 14:45:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221663 - projects/largeSMP/lib/libmemstat X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:45:54 -0000 Author: attilio Date: Sun May 8 14:45:53 2011 New Revision: 221663 URL: http://svn.freebsd.org/changeset/base/221663 Log: Fix a mismerge. Modified: projects/largeSMP/lib/libmemstat/memstat_uma.c Modified: projects/largeSMP/lib/libmemstat/memstat_uma.c ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat_uma.c Sun May 8 14:29:25 2011 (r221662) +++ projects/largeSMP/lib/libmemstat/memstat_uma.c Sun May 8 14:45:53 2011 (r221663) @@ -27,6 +27,7 @@ */ #include +#include #include #define LIBMEMSTAT /* Cause vm_page.h not to include opt_vmpage.h */ From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:49:51 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A344106564A; Sun, 8 May 2011 14:49:51 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id D21518FC12; Sun, 8 May 2011 14:49:50 +0000 (UTC) Received: by gwb15 with SMTP id 15so1995852gwb.13 for ; Sun, 08 May 2011 07:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=BNdSVxPnmISSdEqbMOElcisvjSJu9lrsMshUdXDu+d8=; b=l6WzlCAQeTwdf9PaA0IhZlqVfqawrI0VCjz8EAHBZHwngsq+qAeZHs1lMML0DJCbiH mnEOzd8x1kphP9JpbARhGtLpfU7bupN1NxO1LB043O3n4zytbQ9CSESgN+ujMuXY51Dg 669hc/A4jWBSMdx9o2wpIJ3J9f/v4Jz/NQJHU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=RH1sZYQ/dPUizA+mzIolA/8Zbbx66UdZVX0ZttUUHAF2KD0BPRaMBcD77yqYWn9vpK YaahI3TcVplj/oED5IP4HdDQwpXucjtz1xzIvirNvYd7xgTYW0bvDssydwVtK53gGy0q AgHfNaMLMfA/sbNWbC8VIEWZvKLmYik18E3JY= MIME-Version: 1.0 Received: by 10.236.153.161 with SMTP id f21mr6817727yhk.37.1304866190143; Sun, 08 May 2011 07:49:50 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Sun, 8 May 2011 07:49:50 -0700 (PDT) In-Reply-To: <4DC6ACE6.2090609@freebsd.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> <4DC6ACE6.2090609@freebsd.org> Date: Sun, 8 May 2011 10:49:50 -0400 X-Google-Sender-Auth: 7WZmLFMQd3gWo7DWSc10qvZYI-k Message-ID: From: Attilio Rao To: Nathan Whitehorn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:49:51 -0000 2011/5/8 Nathan Whitehorn : > On 05/08/11 09:44, Attilio Rao wrote: >> >> 2011/5/8 Bruce Evans: >>> >>> On Sun, 8 May 2011, Attilio Rao wrote: >>> >>>> Log: >>>> =C2=A0All architectures define the size-bounded types (uint32_t, uint6= 4_t, >>>> etc.) >>>> =C2=A0starting from base C types (int, long, etc). >>>> =C2=A0That is also reflected when building atomic operations, as the >>>> =C2=A0size-bounded types are built from the base C types. >>>> >>>> =C2=A0However, powerpc does the inverse thing, leading to a serie of n= asty >>> >>> I think you mean that it does the inverse thing for atomic ops only. >>> >>>> =C2=A0bugs. >>>> =C2=A0Cleanup the atomic implementation by defining as base the base C= type >>>> =C2=A0version and depending on them, appropriately. >>> >>> I think that it is mostly the other arches that are backwards here, >>> except for plain ints. =C2=A0MI code cannot use atomic ops for anything >>> except plain ints, since no other type is guaranteed to be supported >>> by the MD code. =C2=A0For example, sparc64 doesn't support any 8-bit or >>> 16-bit types, and i386 doesn't support any 64-bit types (until recently= ; >>> it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support >>> 64, bit types), and my version of i386 doesn't support any 8-bit or >>> 16-bit types or long since these types are unusable in MI code and >>> unused in MD code (long is misused in some MI code but I don't use >>> such broken code). >> >> I want to comment specifically on this. >> I think you are right and that over time our kernel policy on atomic >> has got very flakey. >> My personal idea is that MI part should support only this: >> - _int version >> - _32 bit version >> - _ptr version >> >> and the common sense also mandates it could support easilly: >> - _long version > > One thing I'd like to point out about your patch (which Andreas already > mentioned) is that it disconnects atomic_*_long operations on 32-bit PPC, > making them undefined. Since long is also a 32-bit type like int on these > systems, the 32-bit kernel does in fact support this. > >> The following should just be used in specific MD code or be totally >> unsupported: >> - _char, _short, _8 bit, _16 bit versions >> >> The following should just be used in MD code: >> - _64 bit version > > One other unrelated comment here: ZFS requires 64-bit atomics, so we alre= ady > don't have this situation, sadly. I'm wondering how is that supposed to work on 32 bit stuff then. I really don't want to see 32 bits arch having 64-bits faking atomics as the only right way to do that is with some sort of interlocking and that is not really what we want about the concept of 'atomic' (a lockless and fast primitive). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:55:13 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DCBB106564A; Sun, 8 May 2011 14:55:13 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id B6CA78FC08; Sun, 8 May 2011 14:55:03 +0000 (UTC) Received: by gyg13 with SMTP id 13so1991181gyg.13 for ; Sun, 08 May 2011 07:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=c7F5CM6eaupX++vjv51NCYYnS5aSJSu+SuPkY6cgGTY=; b=Kg0beBZ7QYFLOV1vVJhCU48bDlnu0tG4Md/WziPfCKXOIlWI2yH4mvct2WChT033zc XVsEsA0t3HzoAsxTVpYsvrel/Dlfu6E6XyHtHF06mgNEmv9E09Cisawwwo0ZS3J9hQSy lnTPUONR3GEHDEPLOYBojvFE6PpEL4dE24RxA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=HeVqRuK6oeN/9KpHVzHBIsDyfUxwBKXrUA4/C2M8M05z80RG/UrrzmnkpdI5ZrzLVB QAvvoK+aMlFSAaYRjbot0dQ1xCYLY1mtB1tOzoi63SL6UKkae4tqgU6XHRBLt04wnK7w MR72ZA2twzBkzA5LWyNFUs/MCUC8Ef18Ax5J4= MIME-Version: 1.0 Received: by 10.236.157.37 with SMTP id n25mr6669275yhk.439.1304866502921; Sun, 08 May 2011 07:55:02 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Sun, 8 May 2011 07:55:02 -0700 (PDT) In-Reply-To: <4DC6AE27.3060803@freebsd.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> <4DC6ACE6.2090609@freebsd.org> <4DC6AE27.3060803@freebsd.org> Date: Sun, 8 May 2011 10:55:02 -0400 X-Google-Sender-Auth: IIj4JbU4fuTfAZKf0pp4D6zABwA Message-ID: From: Attilio Rao To: Nathan Whitehorn Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:55:13 -0000 2011/5/8 Nathan Whitehorn : > On 05/08/11 09:49, Attilio Rao wrote: >> >> 2011/5/8 Nathan Whitehorn: >>> >>> On 05/08/11 09:44, Attilio Rao wrote: >>>> >>>> 2011/5/8 Bruce Evans: >>>>> >>>>> On Sun, 8 May 2011, Attilio Rao wrote: >>>>> >>>>>> Log: >>>>>> =C2=A0All architectures define the size-bounded types (uint32_t, uin= t64_t, >>>>>> etc.) >>>>>> =C2=A0starting from base C types (int, long, etc). >>>>>> =C2=A0That is also reflected when building atomic operations, as the >>>>>> =C2=A0size-bounded types are built from the base C types. >>>>>> >>>>>> =C2=A0However, powerpc does the inverse thing, leading to a serie of= nasty >>>>> >>>>> I think you mean that it does the inverse thing for atomic ops only. >>>>> >>>>>> =C2=A0bugs. >>>>>> =C2=A0Cleanup the atomic implementation by defining as base the base= C type >>>>>> =C2=A0version and depending on them, appropriately. >>>>> >>>>> I think that it is mostly the other arches that are backwards here, >>>>> except for plain ints. =C2=A0MI code cannot use atomic ops for anythi= ng >>>>> except plain ints, since no other type is guaranteed to be supported >>>>> by the MD code. =C2=A0For example, sparc64 doesn't support any 8-bit = or >>>>> 16-bit types, and i386 doesn't support any 64-bit types (until >>>>> recently; >>>>> it now uses cmpxchg8b on some CPUs and a hack on other CPUs to suppor= t >>>>> 64, bit types), and my version of i386 doesn't support any 8-bit or >>>>> 16-bit types or long since these types are unusable in MI code and >>>>> unused in MD code (long is misused in some MI code but I don't use >>>>> such broken code). >>>> >>>> I want to comment specifically on this. >>>> I think you are right and that over time our kernel policy on atomic >>>> has got very flakey. >>>> My personal idea is that MI part should support only this: >>>> - _int version >>>> - _32 bit version >>>> - _ptr version >>>> >>>> and the common sense also mandates it could support easilly: >>>> - _long version >>> >>> One thing I'd like to point out about your patch (which Andreas already >>> mentioned) is that it disconnects atomic_*_long operations on 32-bit PP= C, >>> making them undefined. Since long is also a 32-bit type like int on the= se >>> systems, the 32-bit kernel does in fact support this. >>> >>>> The following should just be used in specific MD code or be totally >>>> unsupported: >>>> - _char, _short, _8 bit, _16 bit versions >>>> >>>> The following should just be used in MD code: >>>> - _64 bit version >>> >>> One other unrelated comment here: ZFS requires 64-bit atomics, so we >>> already >>> don't have this situation, sadly. >> >> I'm wondering how is that supposed to work on 32 bit stuff then. >> I really don't want to see 32 bits arch having 64-bits faking atomics >> as the only right way to do that is with some sort of interlocking and >> that is not really what we want about the concept of 'atomic' (a >> lockless and fast primitive). >> > > The answer is that it mostly doesn't. On i386, it uses cmp8xchg. On all > other 32-bit systems (ARM/MIPS/PowerPC), it works only with a giant mutex > that covers atomic operations. This type of code is still ok, I'd say, because it handle platform size in different ways (it is true it is MI code, but it just uses the _64 bit operations only for 64 bit architectures, and locking for the other, if I got it right). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sun May 8 14:56:03 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F16F1065670; Sun, 8 May 2011 14:56:03 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F283E8FC1A; Sun, 8 May 2011 14:56:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p48Eu2GT051126; Sun, 8 May 2011 14:56:02 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p48Eu2EA051112; Sun, 8 May 2011 14:56:02 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105081456.p48Eu2EA051112@svn.freebsd.org> From: Attilio Rao Date: Sun, 8 May 2011 14:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221664 - in projects/largeSMP: bin/sh contrib/top etc/rc.d sbin/dumpfs sbin/geom/class/eli sbin/growfs sbin/hastd sbin/tunefs share/mk sys/dev/ath/ath_hal sys/dev/ath/ath_hal/ar5416 sy... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 14:56:03 -0000 Author: attilio Date: Sun May 8 14:56:02 2011 New Revision: 221664 URL: http://svn.freebsd.org/changeset/base/221664 Log: MFC Added: projects/largeSMP/tools/regression/bin/sh/builtins/case5.0 - copied unchanged from r221663, head/tools/regression/bin/sh/builtins/case5.0 projects/largeSMP/tools/regression/bin/sh/expansion/trim8.0 - copied unchanged from r221663, head/tools/regression/bin/sh/expansion/trim8.0 Modified: projects/largeSMP/bin/sh/expand.c projects/largeSMP/bin/sh/sh.1 projects/largeSMP/etc/rc.d/nfsd projects/largeSMP/sbin/dumpfs/dumpfs.8 projects/largeSMP/sbin/geom/class/eli/geli.8 projects/largeSMP/sbin/growfs/growfs.8 projects/largeSMP/sbin/hastd/parse.y projects/largeSMP/sbin/tunefs/tunefs.8 projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h projects/largeSMP/sys/dev/iwn/if_iwn.c projects/largeSMP/sys/dev/iwn/if_iwnreg.h projects/largeSMP/sys/dev/iwn/if_iwnvar.h projects/largeSMP/sys/dev/usb/usb_device.c projects/largeSMP/sys/fs/nfsserver/nfs_nfsdkrpc.c projects/largeSMP/sys/fs/nfsserver/nfs_nfsdport.c projects/largeSMP/sys/geom/eli/g_eli.c projects/largeSMP/sys/geom/eli/g_eli.h projects/largeSMP/sys/geom/eli/g_eli_ctl.c projects/largeSMP/sys/geom/eli/g_eli_integrity.c projects/largeSMP/sys/geom/eli/g_eli_key_cache.c projects/largeSMP/sys/geom/part/g_part_apm.c projects/largeSMP/sys/geom/part/g_part_bsd.c projects/largeSMP/sys/geom/part/g_part_ebr.c projects/largeSMP/sys/geom/part/g_part_mbr.c projects/largeSMP/sys/geom/part/g_part_pc98.c projects/largeSMP/sys/geom/part/g_part_vtoc8.c projects/largeSMP/sys/netinet/sctp_auth.c projects/largeSMP/sys/netinet/sctp_auth.h projects/largeSMP/sys/netinet/sctp_indata.c projects/largeSMP/sys/netinet/sctp_input.c projects/largeSMP/sys/netinet/sctp_input.h projects/largeSMP/sys/netinet/sctp_output.c projects/largeSMP/sys/netinet/sctp_output.h projects/largeSMP/sys/netinet/sctp_pcb.c projects/largeSMP/sys/netinet/sctp_timer.c projects/largeSMP/sys/netinet/sctp_usrreq.c projects/largeSMP/sys/netinet/sctp_var.h projects/largeSMP/sys/netinet/sctputil.c projects/largeSMP/sys/sun4v/sun4v/mp_machdep.c projects/largeSMP/usr.sbin/jail/jail.8 Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/bin/sh/expand.c ============================================================================== --- projects/largeSMP/bin/sh/expand.c Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/bin/sh/expand.c Sun May 8 14:56:02 2011 (r221664) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include /* * Routines to expand arguments to commands. We have to deal with @@ -111,16 +112,16 @@ static void addfname(char *); static struct strlist *expsort(struct strlist *); static struct strlist *msort(struct strlist *, int); static char *cvtnum(int, char *); -static int collate_range_cmp(int, int); +static int collate_range_cmp(wchar_t, wchar_t); static int -collate_range_cmp(int c1, int c2) +collate_range_cmp(wchar_t c1, wchar_t c2) { - static char s1[2], s2[2]; + static wchar_t s1[2], s2[2]; s1[0] = c1; s2[0] = c2; - return (strcoll(s1, s2)); + return (wcscoll(s1, s2)); } /* @@ -1377,6 +1378,23 @@ msort(struct strlist *list, int len) +static wchar_t +get_wc(const char **p) +{ + wchar_t c; + int chrlen; + + chrlen = mbtowc(&c, *p, 4); + if (chrlen == 0) + return 0; + else if (chrlen == -1) + c = 0; + else + *p += chrlen; + return c; +} + + /* * Returns true if the pattern matches the string. */ @@ -1386,6 +1404,7 @@ patmatch(const char *pattern, const char { const char *p, *q; char c; + wchar_t wc, wc2; p = pattern; q = string; @@ -1404,7 +1423,11 @@ patmatch(const char *pattern, const char case '?': if (squoted && *q == CTLESC) q++; - if (*q++ == '\0') + if (localeisutf8) + wc = get_wc(&q); + else + wc = *q++; + if (wc == '\0') return 0; break; case '*': @@ -1434,7 +1457,7 @@ patmatch(const char *pattern, const char case '[': { const char *endp; int invert, found; - char chr; + wchar_t chr; endp = p; if (*endp == '!' || *endp == '^') @@ -1455,8 +1478,11 @@ patmatch(const char *pattern, const char p++; } found = 0; - chr = *q++; - if (squoted && chr == CTLESC) + if (squoted && *q == CTLESC) + q++; + if (localeisutf8) + chr = get_wc(&q); + else chr = *q++; if (chr == '\0') return 0; @@ -1466,19 +1492,31 @@ patmatch(const char *pattern, const char continue; if (c == CTLESC) c = *p++; + if (localeisutf8 && c & 0x80) { + p--; + wc = get_wc(&p); + if (wc == 0) /* bad utf-8 */ + return 0; + } else + wc = c; if (*p == '-' && p[1] != ']') { p++; while (*p == CTLQUOTEMARK) p++; if (*p == CTLESC) p++; - if ( collate_range_cmp(chr, c) >= 0 - && collate_range_cmp(chr, *p) <= 0 + if (localeisutf8) { + wc2 = get_wc(&p); + if (wc2 == 0) /* bad utf-8 */ + return 0; + } else + wc2 = *p++; + if ( collate_range_cmp(chr, wc) >= 0 + && collate_range_cmp(chr, wc2) <= 0 ) found = 1; - p++; } else { - if (chr == c) + if (chr == wc) found = 1; } } while ((c = *p++) != ']'); Modified: projects/largeSMP/bin/sh/sh.1 ============================================================================== --- projects/largeSMP/bin/sh/sh.1 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/bin/sh/sh.1 Sun May 8 14:56:02 2011 (r221664) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd May 5, 2011 +.Dd May 8, 2011 .Dt SH 1 .Os .Sh NAME @@ -2591,4 +2591,9 @@ was originally written by .Sh BUGS The .Nm -utility does not recognize multibyte characters. +utility does not recognize multibyte characters other than UTF-8. +Splitting using +.Va IFS +and the line editing library +.Xr editline 3 +do not recognize multibyte characters. Modified: projects/largeSMP/etc/rc.d/nfsd ============================================================================== --- projects/largeSMP/etc/rc.d/nfsd Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/etc/rc.d/nfsd Sun May 8 14:56:02 2011 (r221664) @@ -33,13 +33,13 @@ nfsd_precmd() else rc_flags="${nfs_server_flags}" - # Load the modules now, so that the vfs.newnfs sysctl + # Load the modules now, so that the vfs.nfsd sysctl # oids are available. load_kld nfsd if checkyesno nfs_reserved_port_only; then echo 'NFS on reserved port only=YES' - sysctl vfs.newnfs.nfs_privport=1 > /dev/null + sysctl vfs.nfsd.nfs_privport=1 > /dev/null fi if checkyesno nfsv4_server_enable; then @@ -52,7 +52,7 @@ nfsd_precmd() fi else echo 'NFSv4 is disabled' - sysctl vfs.newnfs.server_max_nfsvers=3 > /dev/null + sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null fi fi Modified: projects/largeSMP/sbin/dumpfs/dumpfs.8 ============================================================================== --- projects/largeSMP/sbin/dumpfs/dumpfs.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/dumpfs/dumpfs.8 Sun May 8 14:56:02 2011 (r221664) @@ -28,12 +28,12 @@ .\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 28, 2009 +.Dd May 8, 2011 .Dt DUMPFS 8 .Os .Sh NAME .Nm dumpfs -.Nd dump file system information +.Nd dump UFS file system information .Sh SYNOPSIS .Nm .Op Fl f @@ -42,7 +42,7 @@ .Sh DESCRIPTION The .Nm -utility prints out the super block and cylinder group information +utility prints out the UFS super block and cylinder group information for the file system or special device specified, unless the .Fl f or Modified: projects/largeSMP/sbin/geom/class/eli/geli.8 ============================================================================== --- projects/largeSMP/sbin/geom/class/eli/geli.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/geom/class/eli/geli.8 Sun May 8 14:56:02 2011 (r221664) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2005-2010 Pawel Jakub Dawidek +.\" Copyright (c) 2005-2011 Pawel Jakub Dawidek .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -627,9 +627,13 @@ variables can be used to control the beh .Nm ELI GEOM class. The default value is shown next to each variable. -All variables can also be set in +Some variables can also be set in .Pa /boot/loader.conf . .Bl -tag -width indent +.It Va kern.geom.eli.version +Version number of the +.Nm ELI +GEOM class. .It Va kern.geom.eli.debug : No 0 Debug level of the .Nm ELI @@ -668,6 +672,22 @@ When set to 1, can speed-up crypto opera Batching allows to reduce number of interrupts by responding on a group of crypto requests with one interrupt. The crypto card and the driver has to support this feature. +.It Va kern.geom.eli.key_cache_limit : No 8192 +Specifies how many encryption keys to cache. +The default limit +.No ( 8192 +keys) will allow to cache all keys for 4TB provider with 512 bytes sectors and +will take around 1MB of memory. +.It Va kern.geom.eli.key_cache_hits +Reports how many times we were looking up a key and it was already in cache. +This sysctl is not updated for providers that need less keys than the limit +specified in +.Va kern.geom.eli.key_cache_limit . +.It Va kern.geom.eli.key_cache_misses +Reports how many times we were looking up a key and it was not in cache. +This sysctl is not updated for providers that need less keys than the limit +specified in +.Va kern.geom.eli.key_cache_limit . .El .Sh EXIT STATUS Exit status is 0 on success, and 1 if the command fails. Modified: projects/largeSMP/sbin/growfs/growfs.8 ============================================================================== --- projects/largeSMP/sbin/growfs/growfs.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/growfs/growfs.8 Sun May 8 14:56:02 2011 (r221664) @@ -37,12 +37,12 @@ .\" $TSHeader: src/sbin/growfs/growfs.8,v 1.3 2000/12/12 19:31:00 tomsoft Exp $ .\" $FreeBSD$ .\" -.Dd September 8, 2000 +.Dd May 8, 2011 .Dt GROWFS 8 .Os .Sh NAME .Nm growfs -.Nd grow size of an existing ufs file system +.Nd grow size of an existing UFS file system .Sh SYNOPSIS .Nm .Op Fl Ny Modified: projects/largeSMP/sbin/hastd/parse.y ============================================================================== --- projects/largeSMP/sbin/hastd/parse.y Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/hastd/parse.y Sun May 8 14:56:02 2011 (r221664) @@ -92,8 +92,10 @@ isitme(const char *name) * Now check if it matches first part of the host name. */ pos = strchr(buf, '.'); - if (pos != NULL && pos != buf && strncmp(buf, name, pos - buf) == 0) + if (pos != NULL && (size_t)(pos - buf) == strlen(name) && + strncmp(buf, name, pos - buf) == 0) { return (1); + } /* * At the end check if name is equal to our host's UUID. @@ -287,6 +289,7 @@ yy_config_free(struct hastd_config *conf %token FULLSYNC MEMSYNC ASYNC NONE CRC32 SHA256 HOLE LZF %token NUM STR OB CB +%type remote_str %type replication_type %type checksum_type %type compression_type @@ -794,7 +797,7 @@ resource_node_entry: source_statement ; -remote_statement: REMOTE STR +remote_statement: REMOTE remote_str { assert(depth == 2); if (mynode) { @@ -811,6 +814,12 @@ remote_statement: REMOTE STR } ; +remote_str: + NONE { $$ = strdup("none"); } + | + STR { } + ; + source_statement: SOURCE STR { assert(depth == 2); Modified: projects/largeSMP/sbin/tunefs/tunefs.8 ============================================================================== --- projects/largeSMP/sbin/tunefs/tunefs.8 Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sbin/tunefs/tunefs.8 Sun May 8 14:56:02 2011 (r221664) @@ -28,12 +28,12 @@ .\" @(#)tunefs.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd December 9, 2010 +.Dd May 8, 2011 .Dt TUNEFS 8 .Os .Sh NAME .Nm tunefs -.Nd tune up an existing file system +.Nd tune up an existing UFS file system .Sh SYNOPSIS .Nm .Op Fl A @@ -56,7 +56,7 @@ .Sh DESCRIPTION The .Nm -utility is designed to change the dynamic parameters of a file system +utility is designed to change the dynamic parameters of a UFS file system which affect the layout policies. The .Nm Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.h Sun May 8 14:56:02 2011 (r221664) @@ -95,10 +95,10 @@ #define AR5416_OPFLAGS_11A 0x01 #define AR5416_OPFLAGS_11G 0x02 -#define AR5416_OPFLAGS_5G_HT40 0x04 -#define AR5416_OPFLAGS_2G_HT40 0x08 -#define AR5416_OPFLAGS_5G_HT20 0x10 -#define AR5416_OPFLAGS_2G_HT20 0x20 +#define AR5416_OPFLAGS_N_5G_HT40 0x04 /* If set, disable 5G HT40 */ +#define AR5416_OPFLAGS_N_2G_HT40 0x08 +#define AR5416_OPFLAGS_N_5G_HT20 0x10 +#define AR5416_OPFLAGS_N_2G_HT20 0x20 /* RF silent fields in EEPROM */ #define EEP_RFSILENT_ENABLED 0x0001 /* enabled/disabled */ Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sun May 8 14:56:02 2011 (r221664) @@ -286,6 +286,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO ar5416InitIMR(ah, opmode); ar5212SetCoverageClass(ah, AH_PRIVATE(ah)->ah_coverageClass, 1); ar5416InitQoS(ah); + /* This may override the AR_DIAG_SW register */ ar5416InitUserSettings(ah); /* @@ -520,7 +521,6 @@ ar5416InitBB(struct ath_hal *ah, const s /* Turn on PLL on 5416 */ HALDEBUG(ah, HAL_DEBUG_RESET, "%s %s channel\n", __func__, IEEE80211_IS_CHAN_5GHZ(chan) ? "5GHz" : "2GHz"); - AH5416(ah)->ah_initPLL(ah, chan); /* Activate the PHY (includes baseband activate and synthesizer on) */ OS_REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_EN); @@ -673,6 +673,10 @@ ar5416ChipReset(struct ath_hal *ah, cons if (!ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) return AH_FALSE; +#ifdef notyet + ahp->ah_chipFullSleep = AH_FALSE; +#endif + AH5416(ah)->ah_initPLL(ah, chan); /* @@ -681,8 +685,7 @@ ar5416ChipReset(struct ath_hal *ah, cons * with an active radio can result in corrupted shifts to the * radio device. */ - if (chan != AH_NULL) - ar5416SetRfMode(ah, chan); + ar5416SetRfMode(ah, chan); return AH_TRUE; } @@ -1102,7 +1105,11 @@ ar5416Disable(struct ath_hal *ah) { if (!ar5212SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) return AH_FALSE; - return ar5416SetResetReg(ah, HAL_RESET_COLD); + if (! ar5416SetResetReg(ah, HAL_RESET_COLD)) + return AH_FALSE; + + AH5416(ah)->ah_initPLL(ah, AH_NULL); + return AH_TRUE; } /* @@ -1114,7 +1121,11 @@ ar5416Disable(struct ath_hal *ah) HAL_BOOL ar5416PhyDisable(struct ath_hal *ah) { - return ar5416SetResetReg(ah, HAL_RESET_WARM); + if (! ar5416SetResetReg(ah, HAL_RESET_WARM)) + return AH_FALSE; + + AH5416(ah)->ah_initPLL(ah, AH_NULL); + return AH_TRUE; } /* @@ -1277,34 +1288,52 @@ ar5416SetReset(struct ath_hal *ah, int t } } - AH5416(ah)->ah_initPLL(ah, AH_NULL); - return AH_TRUE; } void ar5416InitChainMasks(struct ath_hal *ah) { - if (AH5416(ah)->ah_rx_chainmask == 0x5 || - AH5416(ah)->ah_tx_chainmask == 0x5) - OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); - /* Setup Chain Masks */ - OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); - OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + int rx_chainmask = AH5416(ah)->ah_rx_chainmask; + + if (rx_chainmask) + OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + + /* + * Workaround for OWL 1.0 calibration failure; enable multi-chain; + * then set true mask after calibration. + */ + if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) { + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7); + } else { + OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, AH5416(ah)->ah_rx_chainmask); + } OS_REG_WRITE(ah, AR_SELFGEN_MASK, AH5416(ah)->ah_tx_chainmask); + if (AH5416(ah)->ah_tx_chainmask == 0x5) + OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); + if (AR_SREV_HOWL(ah)) { OS_REG_WRITE(ah, AR_PHY_ANALOG_SWAP, OS_REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001); } } +/* + * Work-around for Owl 1.0 calibration failure. + * + * ar5416InitChainMasks sets the RX chainmask to 0x7 if it's Owl 1.0 + * due to init calibration failures. ar5416RestoreChainMask restores + * these registers to the correct setting. + */ void ar5416RestoreChainMask(struct ath_hal *ah) { int rx_chainmask = AH5416(ah)->ah_rx_chainmask; - if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) { + if (IS_5416V1(ah) && (rx_chainmask == 0x5 || rx_chainmask == 0x3)) { OS_REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask); OS_REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask); } @@ -2488,17 +2517,17 @@ ar5416OverrideIni(struct ath_hal *ah, co */ OS_REG_SET_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT)); - if (AR_SREV_MERLIN_20_OR_LATER(ah)) { - val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); + if (AR_SREV_MERLIN_10_OR_LATER(ah)) { + val = OS_REG_READ(ah, AR_PCU_MISC_MODE2); + val &= (~AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE); + if (!AR_SREV_9271(ah)) + val &= ~AR_PCU_MISC_MODE2_HWWAR1; - if (!AR_SREV_9271(ah)) - val &= ~AR_PCU_MISC_MODE2_HWWAR1; + if (AR_SREV_9287_11_OR_LATER(ah)) + val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - if (AR_SREV_9287_11_OR_LATER(ah)) - val = val & (~AR_PCU_MISC_MODE2_HWWAR2); - - OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); - } + OS_REG_WRITE(ah, AR_PCU_MISC_MODE2, val); + } /* * Disable RIFS search on some chips to avoid baseband Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Sun May 8 14:56:02 2011 (r221664) @@ -535,6 +535,12 @@ #define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE 0x00000002 #define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT 0x00000004 +/* + * This bit enables the Multicast search based on both MAC Address and Key ID. + * If bit is 0, then Multicast search is based on MAC address only. + * For Merlin and above only. + */ +#define AR_PCU_MISC_MODE2_ADHOC_MCAST_KEYID_ENABLE 0x00000040 #define AR_PCU_MISC_MODE2_HWWAR1 0x00100000 #define AR_PCU_MISC_MODE2_HWWAR2 0x02000000 Modified: projects/largeSMP/sys/dev/iwn/if_iwn.c ============================================================================== --- projects/largeSMP/sys/dev/iwn/if_iwn.c Sun May 8 14:45:53 2011 (r221663) +++ projects/largeSMP/sys/dev/iwn/if_iwn.c Sun May 8 14:56:02 2011 (r221664) @@ -92,8 +92,10 @@ static const struct iwn_ident iwn_ident_ { 0x8086, 0x4229, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x422b, "Intel(R) Centrino(R) Ultimate-N 6300" }, { 0x8086, 0x422c, "Intel(R) Centrino(R) Advanced-N 6200" }, + { 0x8086, 0x422d, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4230, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4232, "Intel(R) WiFi Link 5100" }, + { 0x8086, 0x4233, "Intel(R) Wireless WiFi Link 4965" }, { 0x8086, 0x4235, "Intel(R) Ultimate N WiFi Link 5300" }, { 0x8086, 0x4236, "Intel(R) Ultimate N WiFi Link 5300" }, { 0x8086, 0x4237, "Intel(R) WiFi Link 5100" }, @@ -152,9 +154,7 @@ static void iwn4965_print_power_group(st static void iwn5000_read_eeprom(struct iwn_softc *); static uint32_t iwn_eeprom_channel_flags(struct iwn_eeprom_chan *); static void iwn_read_eeprom_band(struct iwn_softc *, int); -#if 0 /* HT */ static void iwn_read_eeprom_ht40(struct iwn_softc *, int); -#endif static void iwn_read_eeprom_channels(struct iwn_softc *, int, uint32_t); static struct iwn_eeprom_chan *iwn_find_eeprom_channel(struct iwn_softc *, struct ieee80211_channel *); @@ -172,10 +172,8 @@ static void iwn_rx_phy(struct iwn_softc struct iwn_rx_data *); static void iwn_rx_done(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#if 0 /* HT */ static void iwn_rx_compressed_ba(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); -#endif static void iwn5000_rx_calib_results(struct iwn_softc *, struct iwn_rx_desc *, struct iwn_rx_data *); static void iwn_rx_statistics(struct iwn_softc *, struct iwn_rx_desc *, @@ -186,6 +184,7 @@ static void iwn5000_tx_done(struct iwn_s struct iwn_rx_data *); static void iwn_tx_done(struct iwn_softc *, struct iwn_rx_desc *, int, uint8_t); +static void iwn_ampdu_tx_done(struct iwn_softc *, int, int, int, void *); static void iwn_cmd_done(struct iwn_softc *, struct iwn_rx_desc *); static void iwn_notif_intr(struct iwn_softc *); static void iwn_wakeup_intr(struct iwn_softc *); @@ -199,7 +198,6 @@ static void iwn5000_update_sched(struct #ifdef notyet static void iwn5000_reset_sched(struct iwn_softc *, int, int); #endif -static uint8_t iwn_plcp_signal(int); static int iwn_tx_data(struct iwn_softc *, struct mbuf *, struct ieee80211_node *); static int iwn_tx_data_raw(struct iwn_softc *, struct mbuf *, @@ -252,24 +250,26 @@ static uint8_t *ieee80211_add_ssid(uint8 static int iwn_scan(struct iwn_softc *); static int iwn_auth(struct iwn_softc *, struct ieee80211vap *vap); static int iwn_run(struct iwn_softc *, struct ieee80211vap *vap); -#if 0 /* HT */ -static int iwn_ampdu_rx_start(struct ieee80211com *, - struct ieee80211_node *, uint8_t); -static void iwn_ampdu_rx_stop(struct ieee80211com *, - struct ieee80211_node *, uint8_t); +static int iwn_ampdu_rx_start(struct ieee80211_node *, + struct ieee80211_rx_ampdu *, int, int, int); +static void iwn_ampdu_rx_stop(struct ieee80211_node *, + struct ieee80211_rx_ampdu *); +static int iwn_addba_request(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); +static int iwn_addba_response(struct ieee80211_node *, + struct ieee80211_tx_ampdu *, int, int, int); static int iwn_ampdu_tx_start(struct ieee80211com *, struct ieee80211_node *, uint8_t); -static void iwn_ampdu_tx_stop(struct ieee80211com *, - struct ieee80211_node *, uint8_t); +static void iwn_ampdu_tx_stop(struct ieee80211_node *, + struct ieee80211_tx_ampdu *); static void iwn4965_ampdu_tx_start(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); -static void iwn4965_ampdu_tx_stop(struct iwn_softc *, + struct ieee80211_node *, int, uint8_t, uint16_t); +static void iwn4965_ampdu_tx_stop(struct iwn_softc *, int, uint8_t, uint16_t); static void iwn5000_ampdu_tx_start(struct iwn_softc *, - struct ieee80211_node *, uint8_t, uint16_t); -static void iwn5000_ampdu_tx_stop(struct iwn_softc *, + struct ieee80211_node *, int, uint8_t, uint16_t); +static void iwn5000_ampdu_tx_stop(struct iwn_softc *, int, uint8_t, uint16_t); -#endif static int iwn5000_query_calibration(struct iwn_softc *); static int iwn5000_send_calibration(struct iwn_softc *); static int iwn5000_send_wimax_coex(struct iwn_softc *); @@ -550,21 +550,6 @@ iwn_attach(device_t dev) /* Clear pending interrupts. */ IWN_WRITE(sc, IWN_INT, 0xffffffff); - /* Count the number of available chains. */ - sc->ntxchains = - ((sc->txchainmask >> 2) & 1) + - ((sc->txchainmask >> 1) & 1) + - ((sc->txchainmask >> 0) & 1); - sc->nrxchains = - ((sc->rxchainmask >> 2) & 1) + - ((sc->rxchainmask >> 1) & 1) + - ((sc->rxchainmask >> 0) & 1); - if (bootverbose) { - device_printf(dev, "MIMO %dT%dR, %.4s, address %6D\n", - sc->ntxchains, sc->nrxchains, sc->eeprom_domain, - macaddr, ":"); - } - ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211); if (ifp == NULL) { device_printf(dev, "can not allocate ifnet structure\n"); @@ -584,42 +569,13 @@ iwn_attach(device_t dev) | IEEE80211_C_SHSLOT /* short slot time supported */ | IEEE80211_C_WPA | IEEE80211_C_SHPREAMBLE /* short preamble supported */ - | IEEE80211_C_BGSCAN /* background scanning */ #if 0 | IEEE80211_C_IBSS /* ibss/adhoc mode */ #endif | IEEE80211_C_WME /* WME */ ; -#if 0 /* HT */ - /* XXX disable until HT channel setup works */ - ic->ic_htcaps = - IEEE80211_HTCAP_SMPS_ENA /* SM PS mode enabled */ - | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width */ - | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ - | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ - | IEEE80211_HTCAP_RXSTBC_2STREAM/* 1-2 spatial streams */ - | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ - /* s/w capabilities */ - | IEEE80211_HTC_HT /* HT operation */ - | IEEE80211_HTC_AMPDU /* tx A-MPDU */ - | IEEE80211_HTC_AMSDU /* tx A-MSDU */ - ; - - /* Set HT capabilities. */ - ic->ic_htcaps = -#if IWN_RBUF_SIZE == 8192 - IEEE80211_HTCAP_AMSDU7935 | -#endif - IEEE80211_HTCAP_CBW20_40 | - IEEE80211_HTCAP_SGI20 | - IEEE80211_HTCAP_SGI40; if (sc->hw_type != IWN_HW_REV_TYPE_4965) - ic->ic_htcaps |= IEEE80211_HTCAP_GF; - if (sc->hw_type == IWN_HW_REV_TYPE_6050) - ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DYN; - else - ic->ic_htcaps |= IEEE80211_HTCAP_SMPS_DIS; -#endif + ic->ic_caps |= IEEE80211_C_BGSCAN; /* background scanning */ /* Read MAC address, channels, etc from EEPROM. */ if ((error = iwn_read_eeprom(sc, macaddr)) != 0) { @@ -628,14 +584,45 @@ iwn_attach(device_t dev) goto fail; } -#if 0 /* HT */ - /* Set supported HT rates. */ - ic->ic_sup_mcs[0] = 0xff; - if (sc->nrxchains > 1) - ic->ic_sup_mcs[1] = 0xff; - if (sc->nrxchains > 2) - ic->ic_sup_mcs[2] = 0xff; + /* Count the number of available chains. */ + sc->ntxchains = + ((sc->txchainmask >> 2) & 1) + + ((sc->txchainmask >> 1) & 1) + + ((sc->txchainmask >> 0) & 1); + sc->nrxchains = + ((sc->rxchainmask >> 2) & 1) + + ((sc->rxchainmask >> 1) & 1) + + ((sc->rxchainmask >> 0) & 1); + if (bootverbose) { + device_printf(dev, "MIMO %dT%dR, %.4s, address %6D\n", + sc->ntxchains, sc->nrxchains, sc->eeprom_domain, + macaddr, ":"); + } + + if (sc->sc_flags & IWN_FLAG_HAS_11N) { + ic->ic_rxstream = sc->nrxchains; + ic->ic_txstream = sc->ntxchains; + ic->ic_htcaps = + IEEE80211_HTCAP_SMPS_OFF /* SMPS mode disabled */ + | IEEE80211_HTCAP_SHORTGI20 /* short GI in 20MHz */ +#ifdef notyet + | IEEE80211_HTCAP_CHWIDTH40 /* 40MHz channel width*/ + | IEEE80211_HTCAP_SHORTGI40 /* short GI in 40MHz */ + | IEEE80211_HTCAP_GREENFIELD +#if IWN_RBUF_SIZE == 8192 + | IEEE80211_HTCAP_MAXAMSDU_7935 /* max A-MSDU length */ +#else + | IEEE80211_HTCAP_MAXAMSDU_3839 /* max A-MSDU length */ +#endif +#endif + /* s/w capabilities */ + | IEEE80211_HTC_HT /* HT operation */ + | IEEE80211_HTC_AMPDU /* tx A-MPDU */ +#ifdef notyet + | IEEE80211_HTC_AMSDU /* tx A-MSDU */ #endif + ; + } if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_softc = sc; @@ -652,12 +639,16 @@ iwn_attach(device_t dev) ic->ic_vap_delete = iwn_vap_delete; ic->ic_raw_xmit = iwn_raw_xmit; ic->ic_node_alloc = iwn_node_alloc; -#if 0 /* HT */ + sc->sc_ampdu_rx_start = ic->ic_ampdu_rx_start; ic->ic_ampdu_rx_start = iwn_ampdu_rx_start; + sc->sc_ampdu_rx_stop = ic->ic_ampdu_rx_stop; ic->ic_ampdu_rx_stop = iwn_ampdu_rx_stop; - ic->ic_ampdu_tx_start = iwn_ampdu_tx_start; - ic->ic_ampdu_tx_stop = iwn_ampdu_tx_stop; -#endif + sc->sc_addba_request = ic->ic_addba_request; + ic->ic_addba_request = iwn_addba_request; + sc->sc_addba_response = ic->ic_addba_response; + ic->ic_addba_response = iwn_addba_response; + sc->sc_addba_stop = ic->ic_addba_stop; + ic->ic_addba_stop = iwn_ampdu_tx_stop; ic->ic_newassoc = iwn_newassoc; ic->ic_wme.wme_update = iwn_updateedca; ic->ic_update_mcast = iwn_update_mcast; @@ -714,11 +705,10 @@ iwn4965_attach(struct iwn_softc *sc, uin ops->set_gains = iwn4965_set_gains; ops->add_node = iwn4965_add_node; ops->tx_done = iwn4965_tx_done; -#if 0 /* HT */ ops->ampdu_tx_start = iwn4965_ampdu_tx_start; ops->ampdu_tx_stop = iwn4965_ampdu_tx_stop; -#endif sc->ntxqs = IWN4965_NTXQUEUES; + sc->firstaggqueue = IWN4965_FIRSTAGGQUEUE; sc->ndmachnls = IWN4965_NDMACHNLS; sc->broadcast_id = IWN4965_ID_BROADCAST; sc->rxonsz = IWN4965_RXONSZ; @@ -753,11 +743,10 @@ iwn5000_attach(struct iwn_softc *sc, uin ops->set_gains = iwn5000_set_gains; ops->add_node = iwn5000_add_node; ops->tx_done = iwn5000_tx_done; -#if 0 /* HT */ ops->ampdu_tx_start = iwn5000_ampdu_tx_start; ops->ampdu_tx_stop = iwn5000_ampdu_tx_stop; -#endif sc->ntxqs = IWN5000_NTXQUEUES; + sc->firstaggqueue = IWN5000_FIRSTAGGQUEUE; sc->ndmachnls = IWN5000_NDMACHNLS; sc->broadcast_id = IWN5000_ID_BROADCAST; sc->rxonsz = IWN5000_RXONSZ; @@ -1489,13 +1478,6 @@ iwn_alloc_tx_ring(struct iwn_softc *sc, __func__, error); goto fail; } - /* - * We only use rings 0 through 4 (4 EDCA + cmd) so there is no need - * to allocate commands space for other rings. - * XXX Do we really need to allocate descriptors for other rings? - */ - if (qid > 4) - return 0; size = IWN_TX_RING_COUNT * sizeof (struct iwn_tx_cmd); error = iwn_dma_contig_alloc(sc, &ring->cmd_dma, (void **)&ring->cmd, @@ -1694,7 +1676,7 @@ iwn4965_read_eeprom(struct iwn_softc *sc iwn_read_prom_data(sc, IWN4965_EEPROM_DOMAIN, sc->eeprom_domain, 4); /* Read the list of authorized channels (20MHz ones only). */ - for (i = 0; i < 5; i++) { + for (i = 0; i < 7; i++) { addr = iwn4965_regulatory_bands[i]; iwn_read_eeprom_channels(sc, i, addr); } @@ -1781,8 +1763,11 @@ iwn5000_read_eeprom(struct iwn_softc *sc sc->eeprom_domain, 4); /* Read the list of authorized channels (20MHz ones only). */ - for (i = 0; i < 5; i++) { - addr = base + iwn5000_regulatory_bands[i]; + for (i = 0; i < 7; i++) { + if (sc->hw_type >= IWN_HW_REV_TYPE_6000) + addr = base + iwn6000_regulatory_bands[i]; + else + addr = base + iwn5000_regulatory_bands[i]; iwn_read_eeprom_channels(sc, i, addr); } @@ -1884,18 +1869,15 @@ iwn_read_eeprom_band(struct iwn_softc *s "add chan %d flags 0x%x maxpwr %d\n", chan, channels[i].flags, channels[i].maxpwr); -#if 0 /* HT */ - /* XXX no constraints on using HT20 */ - /* add HT20, HT40 added separately */ - c = &ic->ic_channels[ic->ic_nchans++]; - c[0] = c[-1]; - c->ic_flags |= IEEE80211_CHAN_HT20; - /* XXX NARROW =>'s 1/2 and 1/4 width? */ -#endif + if (sc->sc_flags & IWN_FLAG_HAS_11N) { + /* add HT20, HT40 added separately */ + c = &ic->ic_channels[ic->ic_nchans++]; + c[0] = c[-1]; + c->ic_flags |= IEEE80211_CHAN_HT20; + } } } -#if 0 /* HT */ static void iwn_read_eeprom_ht40(struct iwn_softc *sc, int n) { @@ -1904,55 +1886,59 @@ iwn_read_eeprom_ht40(struct iwn_softc *s struct iwn_eeprom_chan *channels = sc->eeprom_channels[n]; const struct iwn_chan_band *band = &iwn_bands[n]; struct ieee80211_channel *c, *cent, *extc; - int i; + uint8_t chan; + int i, nflags; + + if (!(sc->sc_flags & IWN_FLAG_HAS_11N)) + return; for (i = 0; i < band->nchan; i++) { - if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID) || - !(channels[i].flags & IWN_EEPROM_CHAN_WIDE)) { + if (!(channels[i].flags & IWN_EEPROM_CHAN_VALID)) { DPRINTF(sc, IWN_DEBUG_RESET, "skip chan %d flags 0x%x maxpwr %d\n", band->chan[i], channels[i].flags, channels[i].maxpwr); continue; } + chan = band->chan[i]; + nflags = iwn_eeprom_channel_flags(&channels[i]); + /* * Each entry defines an HT40 channel pair; find the * center channel, then the extension channel above. */ - cent = ieee80211_find_channel_byieee(ic, band->chan[i], - band->flags & ~IEEE80211_CHAN_HT); + cent = ieee80211_find_channel_byieee(ic, chan, + (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A)); if (cent == NULL) { /* XXX shouldn't happen */ device_printf(sc->sc_dev, - "%s: no entry for channel %d\n", - __func__, band->chan[i]); + "%s: no entry for channel %d\n", __func__, chan); continue; } extc = ieee80211_find_channel(ic, cent->ic_freq+20, - band->flags & ~IEEE80211_CHAN_HT); + (n == 5 ? IEEE80211_CHAN_G : IEEE80211_CHAN_A)); if (extc == NULL) { DPRINTF(sc, IWN_DEBUG_RESET, - "skip chan %d, extension channel not found\n", - band->chan[i]); + "%s: skip chan %d, extension channel not found\n", + __func__, chan); continue; } DPRINTF(sc, IWN_DEBUG_RESET, "add ht40 chan %d flags 0x%x maxpwr %d\n", - band->chan[i], channels[i].flags, channels[i].maxpwr); + chan, channels[i].flags, channels[i].maxpwr); c = &ic->ic_channels[ic->ic_nchans++]; c[0] = cent[0]; c->ic_extieee = extc->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; - c->ic_flags |= IEEE80211_CHAN_HT40U; + c->ic_flags |= IEEE80211_CHAN_HT40U | nflags; c = &ic->ic_channels[ic->ic_nchans++]; c[0] = extc[0]; c->ic_extieee = cent->ic_ieee; c->ic_flags &= ~IEEE80211_CHAN_HT; - c->ic_flags |= IEEE80211_CHAN_HT40D; + c->ic_flags |= IEEE80211_CHAN_HT40D | nflags; } } -#endif static void iwn_read_eeprom_channels(struct iwn_softc *sc, int n, uint32_t addr) @@ -1965,25 +1951,34 @@ iwn_read_eeprom_channels(struct iwn_soft if (n < 5) iwn_read_eeprom_band(sc, n); -#if 0 /* HT */ else iwn_read_eeprom_ht40(sc, n); -#endif ieee80211_sort_channels(ic->ic_channels, ic->ic_nchans); } static struct iwn_eeprom_chan * iwn_find_eeprom_channel(struct iwn_softc *sc, struct ieee80211_channel *c) { - int i, j; + int band, chan, i, j; - for (j = 0; j < 7; j++) { - for (i = 0; i < iwn_bands[j].nchan; i++) { - if (iwn_bands[j].chan[i] == c->ic_ieee) - return &sc->eeprom_channels[j][i]; + if (IEEE80211_IS_CHAN_HT40(c)) { + band = IEEE80211_IS_CHAN_5GHZ(c) ? 6 : 5; + if (IEEE80211_IS_CHAN_HT40D(c)) + chan = c->ic_extieee; + else + chan = c->ic_ieee; + for (i = 0; i < iwn_bands[band].nchan; i++) { + if (iwn_bands[band].chan[i] == chan) + return &sc->eeprom_channels[band][i]; + } + } else { + for (j = 0; j < 5; j++) { + for (i = 0; i < iwn_bands[j].nchan; i++) { + if (iwn_bands[j].chan[i] == c->ic_ieee) + return &sc->eeprom_channels[j][i]; + } } } - return NULL; } @@ -2020,18 +2015,22 @@ static void iwn_read_eeprom_enhinfo(struct iwn_softc *sc) { struct iwn_eeprom_enhinfo enhinfo[35]; + struct ifnet *ifp = sc->sc_ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211_channel *c; uint16_t val, base; int8_t maxpwr; - int i; + uint8_t flags; + int i, j; iwn_read_prom_data(sc, IWN5000_EEPROM_REG, &val, 2); base = le16toh(val); iwn_read_prom_data(sc, base + IWN6000_EEPROM_ENHINFO, enhinfo, sizeof enhinfo); - memset(sc->enh_maxpwr, 0, sizeof sc->enh_maxpwr); for (i = 0; i < nitems(enhinfo); i++) { - if (enhinfo[i].chan == 0 || enhinfo[i].reserved != 0) + flags = enhinfo[i].flags; + if (!(flags & IWN_ENHINFO_VALID)) continue; /* Skip invalid entries. */ maxpwr = 0; @@ -2045,11 +2044,34 @@ iwn_read_eeprom_enhinfo(struct iwn_softc maxpwr = MAX(maxpwr, enhinfo[i].mimo2); else if (sc->ntxchains == 3) maxpwr = MAX(maxpwr, enhinfo[i].mimo3); - maxpwr /= 2; /* Convert half-dBm to dBm. */ - DPRINTF(sc, IWN_DEBUG_RESET, "enhinfo %d, maxpwr=%d\n", i, - maxpwr); - sc->enh_maxpwr[i] = maxpwr; + for (j = 0; j < ic->ic_nchans; j++) { + c = &ic->ic_channels[j]; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sun May 8 15:11:15 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4506A1065673; Sun, 8 May 2011 15:11:15 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 0B0C48FC12; Sun, 8 May 2011 15:11:14 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 1EFAB582C0; Sun, 8 May 2011 09:47:04 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id qCZ6SgPRNIgT; Sun, 8 May 2011 09:47:04 -0500 (CDT) Received: from wanderer.tachypleus.net (unknown [76.210.65.155]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 74CFF582A6; Sun, 8 May 2011 09:47:03 -0500 (CDT) Message-ID: <4DC6ACE6.2090609@freebsd.org> Date: Sun, 08 May 2011 09:47:02 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110317 Thunderbird/3.1.9 MIME-Version: 1.0 To: Attilio Rao References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 15:11:15 -0000 On 05/08/11 09:44, Attilio Rao wrote: > 2011/5/8 Bruce Evans: >> On Sun, 8 May 2011, Attilio Rao wrote: >> >>> Log: >>> All architectures define the size-bounded types (uint32_t, uint64_t, >>> etc.) >>> starting from base C types (int, long, etc). >>> That is also reflected when building atomic operations, as the >>> size-bounded types are built from the base C types. >>> >>> However, powerpc does the inverse thing, leading to a serie of nasty >> >> I think you mean that it does the inverse thing for atomic ops only. >> >>> bugs. >>> Cleanup the atomic implementation by defining as base the base C type >>> version and depending on them, appropriately. >> >> I think that it is mostly the other arches that are backwards here, >> except for plain ints. MI code cannot use atomic ops for anything >> except plain ints, since no other type is guaranteed to be supported >> by the MD code. For example, sparc64 doesn't support any 8-bit or >> 16-bit types, and i386 doesn't support any 64-bit types (until recently; >> it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support >> 64, bit types), and my version of i386 doesn't support any 8-bit or >> 16-bit types or long since these types are unusable in MI code and >> unused in MD code (long is misused in some MI code but I don't use >> such broken code). > > I want to comment specifically on this. > I think you are right and that over time our kernel policy on atomic > has got very flakey. > My personal idea is that MI part should support only this: > - _int version > - _32 bit version > - _ptr version > > and the common sense also mandates it could support easilly: > - _long version One thing I'd like to point out about your patch (which Andreas already mentioned) is that it disconnects atomic_*_long operations on 32-bit PPC, making them undefined. Since long is also a 32-bit type like int on these systems, the 32-bit kernel does in fact support this. > The following should just be used in specific MD code or be totally unsupported: > - _char, _short, _8 bit, _16 bit versions > > The following should just be used in MD code: > - _64 bit version One other unrelated comment here: ZFS requires 64-bit atomics, so we already don't have this situation, sadly. -Nathan From owner-svn-src-projects@FreeBSD.ORG Sun May 8 15:11:15 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46BCF1065675; Sun, 8 May 2011 15:11:15 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from mail.icecube.wisc.edu (trout.icecube.wisc.edu [128.104.255.119]) by mx1.freebsd.org (Postfix) with ESMTP id 0B01A8FC0C; Sun, 8 May 2011 15:11:14 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.icecube.wisc.edu (Postfix) with ESMTP id 954D5582C2; Sun, 8 May 2011 09:52:25 -0500 (CDT) X-Virus-Scanned: amavisd-new at icecube.wisc.edu Received: from mail.icecube.wisc.edu ([127.0.0.1]) by localhost (trout.icecube.wisc.edu [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id baswJtNgXG7k; Sun, 8 May 2011 09:52:25 -0500 (CDT) Received: from wanderer.tachypleus.net (unknown [76.210.65.155]) by mail.icecube.wisc.edu (Postfix) with ESMTP id DD3BF582A6; Sun, 8 May 2011 09:52:24 -0500 (CDT) Message-ID: <4DC6AE27.3060803@freebsd.org> Date: Sun, 08 May 2011 09:52:23 -0500 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110317 Thunderbird/3.1.9 MIME-Version: 1.0 To: Attilio Rao References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> <4DC6ACE6.2090609@freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 15:11:15 -0000 On 05/08/11 09:49, Attilio Rao wrote: > 2011/5/8 Nathan Whitehorn: >> On 05/08/11 09:44, Attilio Rao wrote: >>> >>> 2011/5/8 Bruce Evans: >>>> >>>> On Sun, 8 May 2011, Attilio Rao wrote: >>>> >>>>> Log: >>>>> All architectures define the size-bounded types (uint32_t, uint64_t, >>>>> etc.) >>>>> starting from base C types (int, long, etc). >>>>> That is also reflected when building atomic operations, as the >>>>> size-bounded types are built from the base C types. >>>>> >>>>> However, powerpc does the inverse thing, leading to a serie of nasty >>>> >>>> I think you mean that it does the inverse thing for atomic ops only. >>>> >>>>> bugs. >>>>> Cleanup the atomic implementation by defining as base the base C type >>>>> version and depending on them, appropriately. >>>> >>>> I think that it is mostly the other arches that are backwards here, >>>> except for plain ints. MI code cannot use atomic ops for anything >>>> except plain ints, since no other type is guaranteed to be supported >>>> by the MD code. For example, sparc64 doesn't support any 8-bit or >>>> 16-bit types, and i386 doesn't support any 64-bit types (until recently; >>>> it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support >>>> 64, bit types), and my version of i386 doesn't support any 8-bit or >>>> 16-bit types or long since these types are unusable in MI code and >>>> unused in MD code (long is misused in some MI code but I don't use >>>> such broken code). >>> >>> I want to comment specifically on this. >>> I think you are right and that over time our kernel policy on atomic >>> has got very flakey. >>> My personal idea is that MI part should support only this: >>> - _int version >>> - _32 bit version >>> - _ptr version >>> >>> and the common sense also mandates it could support easilly: >>> - _long version >> >> One thing I'd like to point out about your patch (which Andreas already >> mentioned) is that it disconnects atomic_*_long operations on 32-bit PPC, >> making them undefined. Since long is also a 32-bit type like int on these >> systems, the 32-bit kernel does in fact support this. >> >>> The following should just be used in specific MD code or be totally >>> unsupported: >>> - _char, _short, _8 bit, _16 bit versions >>> >>> The following should just be used in MD code: >>> - _64 bit version >> >> One other unrelated comment here: ZFS requires 64-bit atomics, so we already >> don't have this situation, sadly. > > I'm wondering how is that supposed to work on 32 bit stuff then. > I really don't want to see 32 bits arch having 64-bits faking atomics > as the only right way to do that is with some sort of interlocking and > that is not really what we want about the concept of 'atomic' (a > lockless and fast primitive). > The answer is that it mostly doesn't. On i386, it uses cmp8xchg. On all other 32-bit systems (ARM/MIPS/PowerPC), it works only with a giant mutex that covers atomic operations. -Nathan From owner-svn-src-projects@FreeBSD.ORG Sun May 8 15:42:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D09D1106564A; Sun, 8 May 2011 15:42:34 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id 44F0A8FC0A; Sun, 8 May 2011 15:42:33 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p48FgSXj018875 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 May 2011 01:42:30 +1000 Date: Mon, 9 May 2011 01:42:28 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: Message-ID: <20110509003256.F2061@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-2138985585-1304869348=:2061" Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 15:42:34 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-2138985585-1304869348=:2061 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 8 May 2011, Attilio Rao wrote: > 2011/5/8 Bruce Evans : >> On Sun, 8 May 2011, Attilio Rao wrote: >> >>> Log: >>> =C2=A0All architectures define the size-bounded types (uint32_t, uint64= _t, >>> etc.) >>> =C2=A0starting from base C types (int, long, etc). >>> =C2=A0That is also reflected when building atomic operations, as the >>> =C2=A0size-bounded types are built from the base C types. >>> >>> =C2=A0However, powerpc does the inverse thing, leading to a serie of na= sty >> >> I think you mean that it does the inverse thing for atomic ops only. The quoted material is now almost unreadable due to hard \xc2\xa0 (these weren't there when I replied before). In fact, the problem is so large in this mail that it should have been filtered as spam. Source code that began with tabs is now completely unreadable. [... context lost to unreadability] > So the thing is that we define the uintXX_t type from int,long,etc and > then we should really expect to follow the same pattern for atomic > instructions. _stdint.h has to do this for the technical reason that there is nothing else except the basic types to start with (short of using attribute(()) and gcc SImode or simlar). But once we have the uintXX_t types declared, and we do in atomic.h, we can start from them almost as easily. There is a minor problem translating back to the basic types. MD code can easily know the translation, but has to be especially careful when variants of the arch support either 32 or 64-bit longs. _stdint has some idfefs related to this, which may make similar ifdefs in atomic.h uneccessary provided you translate in the right direction. > I don't see the point to have something like that, also because is > never used in the kernel. ["That" was definitions with intentional syntax errors for unsupported cases (except the undefs make it unclear whether these ifdes are used).] Yes, I think there as some confusion about what must be supported (I'm not sure about this myself for userland (ab)use of atomic(9)), and the syntax errors were there for debugging this. >> No type problems at this level. > > Yes, but I also want uniformity in the implementation, thus try to > give a common pattern. [This level in (the !#&&#\xc2\xa0 deleted) was the inline function level.] I meant that I liked this part. Inline functions tend to have less type hacks than macros. >>> - =C2=A0 =C2=A064-bit atomic_add not implemented >> >> Now correctly left out when it is not supported. > > See below, for non powerpc64 case it must not be used. Yes, it's best to leave out unsupported cases. I think this is similar to i386 until recently. i386 needed cmpxchg8b for atomic ops on 64-bit variables, but the code for that wasn't written. I think it should have remained unwritten, and 64-bit variables used less so that atomic ops on them are not needed. >>> +#define =C2=A0 =C2=A0 =C2=A0 =C2=A0__atomic_add_long(p, v, t) =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >>> + =C2=A0 =C2=A0long atomic_add not implemented >>> #endif >> >> atomic_add_long() should never be supported, but it is (mis)used in >> standard kernel files so not having it will break more than just LINT. >> But the above is not atomic_add_long()...hacks are used below to make >> that sort of work. > > In which sense "should never be supported"? > If you are on a 64 bit arch and you want and atomic operation for long > you are supposed to use 64-bit version directly? I don't get the > point. 64-bit arches should have 128-bit longs (and maybe 64-bit ints, 32-bit shorts and 16-bit chars)). If they did, then support for atomic ops on longs would be even further off than for 64-bit longs on 32-bit arches, since amd64 doesn't seem to have cmpxchg16b. I guess amd64 could use SSE for 128-bit atomic ops and later AVX for 256-bit ones, but in the kernel those would be more inefficient than usual. "Should never be supported" is in the sense that if you support it then someone might use it and you have to keep supporting it, including on future arches where the support may be too expensive. It's better to discourage use of longs. I think I would prefer guaranteed support for atomic ops on uint64_t (even on 32-bit arches) and use of uint64_t in MI code. long is too flexible. >> This uses bogus casts to break warnings. =C2=A0amd64 is still missing th= is bug. >> Someone added this bug to i386 after reviewers objected to it. =C2=A0Eve= n i386 >> only has this bug for accesses to pointers. =C2=A0For char/short/long, i= t uses >> type-safe code with separate functions/#defines like the ones for int. > > I'll probabilly may have get from the i386 version, I'll verify, thanks. Check the amd64 and sparc64 versions first. >>> [... often I snip bits without noting this as here] >>> -#if 0 >>> -_ATOMIC_CLEAR(8, 8, uint8_t) >>> -_ATOMIC_CLEAR(8, char, u_char) >>> -_ATOMIC_CLEAR(16, 16, uint16_t) >>> -_ATOMIC_CLEAR(16, short, u_short) >>> -#endif >>> -_ATOMIC_CLEAR(32, 32, uint32_t) >>> -_ATOMIC_CLEAR(32, int, u_int) >>> -#ifdef __powerpc64__ >>> -_ATOMIC_CLEAR(64, 64, uint64_t) >>> -_ATOMIC_CLEAR(64, long, u_long) >>> -_ATOMIC_CLEAR(64, ptr, uintptr_t) >>> -#else >>> -_ATOMIC_CLEAR(32, long, u_long) >>> -_ATOMIC_CLEAR(32, ptr, uintptr_t) >>> -#endif >> >> Seems a better way, and still used on amd64 and i386, to generate >> separate type-safe code for each type supported. =C2=A0Here the only err= or >> relative to amd64 and i386 seems to have been to generate from long >> to a 32/64 suffix and #define from that back to a long suffix, instead >> of to generate from long to a long suffix and #define from that to a >> 32/64 suffix. > > I'm a bit confused on what you are stating here exactly... are in > favor of this change or not? I may have been confused by the patch, but the above seems to delete too much. The macros are a bit obfuscatory, but they let you generate a largish inline function from 1 line of code and thus handle N different types with almost full type safety in only N lines of code. This seems preferable to 1-line macros that expand to a function call with parameter casting. Both convert the parameters, but the functions have implicit conversions which should generate warnings about some type errors, while explicit casts should suppress warnings. >> i386 uses a function to type-pun from fetchadd_long to fetchadd_int(). >> This has minor technical advantages. =C2=A0Why be different? > > I'm not entirely sure what you mean with 'function to type-pun' but > will look at that as well, thanks. Just that the wrapper to make some type puns (pun for the pointer and null conversion for the value) is implemented as an inline function on i386 and as a macro on powerpc32. We do the same for cmpset. fetchadd is shorter on at least i386, partly because it is only used in the SMP case and it is assumed that all CPUs that support SMP have xaddl; so it would be easy and cleaner on at least i386 to duplicate it with s/int/long/ to avoid the type puns. This would also fit better with the structure of the file for powerpc64 (there has to be a separate function for longs in the 64-bit case). Bruce --0-2138985585-1304869348=:2061-- From owner-svn-src-projects@FreeBSD.ORG Sun May 8 16:17:35 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FE4B1065674; Sun, 8 May 2011 16:17:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id A0B908FC18; Sun, 8 May 2011 16:17:34 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p48GHVb0017487 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 May 2011 02:17:32 +1000 Date: Mon, 9 May 2011 02:17:31 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: Message-ID: <20110509020034.E2292@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1450297231-1304871451=:2292" Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 16:17:35 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1450297231-1304871451=:2292 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 8 May 2011, Attilio Rao wrote: > 2011/5/8 Bruce Evans : >> >> I think that it is mostly the other arches that are backwards here, >> except for plain ints. =C2=A0MI code cannot use atomic ops for anything >> except plain ints, since no other type is guaranteed to be supported >> by the MD code. =C2=A0For example, sparc64 doesn't support any 8-bit or >> 16-bit types, and i386 doesn't support any 64-bit types (until recently; >> it now uses cmpxchg8b on some CPUs and a hack on other CPUs to support >> 64, bit types), and my version of i386 doesn't support any 8-bit or >> 16-bit types or long since these types are unusable in MI code and >> unused in MD code (long is misused in some MI code but I don't use >> such broken code). > > I want to comment specifically on this. > I think you are right and that over time our kernel policy on atomic > has got very flakey. > My personal idea is that MI part should support only this: > - _int version > - _32 bit version > - _ptr version > > and the common sense also mandates it could support easilly: > - _long version > > The following should just be used in specific MD code or be totally unsup= ported: > - _char, _short, _8 bit, _16 bit versions > > The following should just be used in MD code: > - _64 bit version This agrees exactly with my policy, except I think 64-bit types should be prepared for, and supported when it is easy (about the same as long if longs are 64 bits). atomic(9) agrees with this for the _char, _short, _8 bit, _16 bit versions. It disagrees for: - unsigned long: says that full support is always available. Correct, but inhibits expanding long. - uint64_t: says that full support is always available. Was just wrong on i386 until recently. i386 now has support for load/store only. Apparently still just wrong for powerpc32. Bruce --0-1450297231-1304871451=:2292-- From owner-svn-src-projects@FreeBSD.ORG Sun May 8 16:25:28 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 969351065676; Sun, 8 May 2011 16:25:28 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail01.syd.optusnet.com.au (mail01.syd.optusnet.com.au [211.29.132.182]) by mx1.freebsd.org (Postfix) with ESMTP id 301D48FC08; Sun, 8 May 2011 16:25:27 +0000 (UTC) Received: from c122-106-155-58.carlnfd1.nsw.optusnet.com.au (c122-106-155-58.carlnfd1.nsw.optusnet.com.au [122.106.155.58]) by mail01.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p48GPP4A013950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 May 2011 02:25:26 +1000 Date: Mon, 9 May 2011 02:25:25 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: Message-ID: <20110509021804.D2381@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110508202725.K1192@besplex.bde.org> <4DC6ACE6.2090609@freebsd.org> <4DC6AE27.3060803@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org, Nathan Whitehorn , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 May 2011 16:25:28 -0000 On Sun, 8 May 2011, Attilio Rao wrote: > 2011/5/8 Nathan Whitehorn : >> On 05/08/11 09:49, Attilio Rao wrote: >>> >>> 2011/5/8 Nathan Whitehorn: >>>> >>>> On 05/08/11 09:44, Attilio Rao wrote: >>>>> I want to comment specifically on this. >>>>> I think you are right and that over time our kernel policy on atomic >>>>> has got very flakey. >>>>> My personal idea is that MI part should support only this: >>>>> - _int version >>>>> - _32 bit version >>>>> - _ptr version >>>>> >>>>> and the common sense also mandates it could support easilly: >>>>> - _long version >>>> >>>> One thing I'd like to point out about your patch (which Andreas already >>>> mentioned) is that it disconnects atomic_*_long operations on 32-bit PPC, >>>> making them undefined. Since long is also a 32-bit type like int on these >>>> systems, the 32-bit kernel does in fact support this. I thought that the macro hackery for that was still there (but moved). Otherwise standard kernel files won't compile. >>>>> The following should just be used in specific MD code or be totally >>>>> unsupported: >>>>> - _char, _short, _8 bit, _16 bit versions >>>>> >>>>> The following should just be used in MD code: >>>>> - _64 bit version >>>> >>>> One other unrelated comment here: ZFS requires 64-bit atomics, so we >>>> already >>>> don't have this situation, sadly. >>> >>> I'm wondering how is that supposed to work on 32 bit stuff then. >>> I really don't want to see 32 bits arch having 64-bits faking atomics >>> as the only right way to do that is with some sort of interlocking and >>> that is not really what we want about the concept of 'atomic' (a >>> lockless and fast primitive). >> >> The answer is that it mostly doesn't. On i386, it uses cmp8xchg. On all >> other 32-bit systems (ARM/MIPS/PowerPC), it works only with a giant mutex >> that covers atomic operations. i386 has only used cmpxchg8b for a few weeks, and only uses it for load/ store. But a non-giant mutex should work OK (just like it does for a data structure much larger than 32 or 64 bits). The mutex has to cover _all_ accesses to the parts of the struct locked by it, which is sometimes not so easy. > This type of code is still ok, I'd say, because it handle platform > size in different ways (it is true it is MI code, but it just uses the > _64 bit operations only for 64 bit architectures, and locking for the > other, if I got it right). Probably much slower for the non-64 arches if it is just hacked on. Bruce From owner-svn-src-projects@FreeBSD.ORG Mon May 9 15:59:35 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096991065679; Mon, 9 May 2011 15:59:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ED8998FC16; Mon, 9 May 2011 15:59:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49FxYqN002998; Mon, 9 May 2011 15:59:34 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49FxYqC002996; Mon, 9 May 2011 15:59:34 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105091559.p49FxYqC002996@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 15:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221696 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 15:59:35 -0000 Author: attilio Date: Mon May 9 15:59:34 2011 New Revision: 221696 URL: http://svn.freebsd.org/changeset/base/221696 Log: - Introduce stubs for type-pun from long to int - Don't auto-cast _ptr operations as initially they were intended to be used rarely and consumers had to cast on their own. Reported by: bde, andreast Modified: projects/largeSMP/sys/powerpc/include/atomic.h Modified: projects/largeSMP/sys/powerpc/include/atomic.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/atomic.h Mon May 9 15:57:04 2011 (r221695) +++ projects/largeSMP/sys/powerpc/include/atomic.h Mon May 9 15:59:34 2011 (r221696) @@ -43,6 +43,31 @@ #define wmb() mb() #define rmb() mb() +#define _ATOMIC_PUN_LTOI(FUNC) \ + static __inline void \ + atomic_##FUNC##_long(volatile u_long *p, u_long v) \ + { \ + \ + atomic_##FUNC##_int((volatile u_int *)p, (u_int)v); \ + } \ + \ + static __inline void \ + atomic_##FUNC##_acq_long(volatile u_long *p, u_long v) \ + { \ + \ + atomic_##FUNC##_acq_int((volatile u_int *)p, \ + (u_int)v); \ + } \ + \ + static __inline void \ + atomic_##FUNC##_rel_long(volatile u_long *p, u_long v) \ + { \ + \ + atomic_##FUNC##_rel_int((volatile u_int *)p, \ + (u_int)v); \ + } \ + /* _ATOMIC_PUN_LTOI */ + /* * atomic_add(p, v) * { *p += v; } @@ -110,26 +135,15 @@ _ATOMIC_ADD(long) #define atomic_add_acq_64 atomic_add_acq_long #define atomic_add_rel_64 atomic_add_rel_long -#define atomic_add_ptr(p, v) \ - atomic_add_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_add_acq_ptr(p, v) \ - atomic_add_acq_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_add_rel_ptr(p, v) \ - atomic_add_rel_long((volatile u_long *)(p), (u_long)(v)) -#else -#define atomic_add_long(p, v) \ - atomic_add_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_acq_long(p, v) \ - atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_rel_long(p, v) \ - atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) - -#define atomic_add_ptr(p, v) \ - atomic_add_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_acq_ptr(p, v) \ - atomic_add_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_rel_ptr(p, v) \ - atomic_add_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_ptr atomic_add_long +#define atomic_add_acq_ptr atomic_add_acq_long +#define atomic_add_rel_ptr atomic_add_rel_long +#else +_ATOMIC_PUN_LTOI(add) + +#define atomic_add_ptr atomic_add_int +#define atomic_add_acq_ptr atomic_add_acq_int +#define atomic_add_rel_ptr atomic_add_rel_int #endif #undef _ATOMIC_ADD #undef __atomic_add_long @@ -203,26 +217,15 @@ _ATOMIC_CLEAR(long) #define atomic_clear_acq_64 atomic_clear_acq_long #define atomic_clear_rel_64 atomic_clear_rel_long -#define atomic_clear_ptr(p, v) \ - atomic_clear_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_clear_acq_ptr(p, v) \ - atomic_clear_acq_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_clear_rel_ptr(p, v) \ - atomic_clear_rel_long((volatile u_long *)(p), (u_long)(v)) -#else -#define atomic_clear_long(p, v) \ - atomic_clear_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_acq_long(p, v) \ - atomic_clear_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_rel_long(p, v) \ - atomic_clear_rel_int((volatile u_int *)(p), (u_int)(v)) - -#define atomic_clear_ptr(p, v) \ - atomic_clear_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_acq_ptr(p, v) \ - atomic_clear_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_clear_rel_ptr(p, v) \ - atomic_clear_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_ptr atomic_clear_long +#define atomic_clear_acq_ptr atomic_clear_acq_long +#define atomic_clear_rel_ptr atomic_clear_rel_long +#else +_ATOMIC_PUN_LTOI(clear) + +#define atomic_clear_ptr atomic_clear_int +#define atomic_clear_acq_ptr atomic_clear_acq_int +#define atomic_clear_rel_ptr atomic_clear_rel_int #endif #undef _ATOMIC_ADD #undef __atomic_clear_long @@ -310,26 +313,15 @@ _ATOMIC_SET(long) #define atomic_set_acq_64 atomic_set_acq_long #define atomic_set_rel_64 atomic_set_rel_long -#define atomic_set_ptr(p, v) \ - atomic_set_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_set_acq_ptr(p, v) \ - atomic_set_acq_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_set_rel_ptr(p, v) \ - atomic_set_rel_long((volatile u_long *)(p), (u_long)(v)) -#else -#define atomic_set_long(p, v) \ - atomic_set_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_set_acq_long(p, v) \ - atomic_set_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_set_rel_long(p, v) \ - atomic_set_rel_int((volatile u_int *)(p), (u_int)(v)) - -#define atomic_set_ptr(p, v) \ - atomic_set_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_set_acq_ptr(p, v) \ - atomic_set_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_set_rel_ptr(p, v) \ - atomic_set_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_ptr atomic_set_long +#define atomic_set_acq_ptr atomic_set_acq_long +#define atomic_set_rel_ptr atomic_set_rel_long +#else +_ATOMIC_PUN_LTOI(set) + +#define atomic_set_ptr atomic_set_int +#define atomic_set_acq_ptr atomic_set_acq_int +#define atomic_set_rel_ptr atomic_set_rel_int #endif #undef _ATOMIC_SET #undef __atomic_set_long @@ -402,31 +394,22 @@ _ATOMIC_SUBTRACT(long) #define atomic_subtract_acq_64 atomic_subract_acq_long #define atomic_subtract_rel_64 atomic_subtract_rel_long -#define atomic_subtract_ptr(p, v) \ - atomic_subtract_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_subtract_acq_ptr(p, v) \ - atomic_subtract_acq_long((volatile u_long *)(p), (u_long)(v)) -#define atomic_subtract_rel_ptr(p, v) \ - atomic_subtract_rel_long((volatile u_long *)(p), (u_long)(v)) -#else -#define atomic_subtract_long(p, v) \ - atomic_subtract_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_acq_long(p, v) \ - atomic_subtract_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_rel_long(p, v) \ - atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) - -#define atomic_subtract_ptr(p, v) \ - atomic_subtract_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_acq_ptr(p, v) \ - atomic_subtract_acq_int((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_rel_ptr(p, v) \ - atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_ptr atomic_subtract_long +#define atomic_subtract_acq_ptr atomic_subtract_acq_long +#define atomic_subtract_rel_ptr atomic_subtract_rel_long +#else +_ATOMIC_PUN_LTOI(subtract) + +#define atomic_subtract_ptr atomic_subtract_int +#define atomic_subtract_acq_ptr atomic_subtract_acq_int +#define atomic_subtract_rel_ptr atomic_subtract_rel_int #endif #undef _ATOMIC_SUBTRACT #undef __atomic_subtract_long #undef __atomic_subtract_int +#undef _ATOMIC_PUN_LTOI + /* * atomic_store_rel(p, v) */ @@ -483,14 +466,16 @@ atomic_readandclear_long(volatile u_long #ifdef __powerpc64__ #define atomic_readandclear_64 atomic_readandclear_long -#define atomic_readandclear_ptr(p) \ - atomic_readandclear_long((volatile u_long *)(p)) +#define atomic_readandclear_ptr atomic_readandclear_long #else -#define atomic_readandclear_long(p) \ - atomic_readandclear_int((volatile u_int *)(p)) +static __inline u_long +atomic_readandclear_long(volatile u_long *addr) +{ -#define atomic_readandclear_ptr(p) \ - atomic_readandclear_int((volatile u_int *)(p)) + return ((u_long)atomic_readandclear_int((volatile u_int *)addr)); +} + +#define atomic_readandclear_ptr atomic_readandclear_int #endif /* @@ -525,20 +510,25 @@ ATOMIC_STORE_LOAD(long) #define atomic_load_acq_64 atomic_load_acq_long #define atomic_store_rel_64 atomic_store_rel_long -#define atomic_load_acq_ptr(p) \ - atomic_load_acq_long((volatile u_long *)(p)) -#define atomic_store_rel_ptr(p, v) \ - atomic_store_rel_long((volatile u_long *)(p), (u_long)(v)) -#else -#define atomic_load_acq_long(p) \ - atomic_load_acq_int((volatile u_int *)(p)) -#define atomic_store_rel_long(p, v) \ - atomic_store_rel_int((volatile u_int *)(p), (u_int)(v)) - -#define atomic_load_acq_ptr(p) \ - atomic_load_acq_int((volatile u_int *)(p)) -#define atomic_store_rel_ptr(p, v) \ - atomic_store_rel_int((volatile u_int *)(p), (u_int)(v)) +#define atomic_load_acq_ptr atomic_load_acq_long +#define atomic_store_rel_ptr atomic_store_rel_long +#else +static __inline u_long +atomic_load_acq_long(volatile u_long *addr) +{ + + return ((u_long)atomic_load_acq_int((volatile u_int *)addr)); +} + +static __inline void +atomic_store_rel_long(volatile u_long *addr, u_long val) +{ + + atomic_store_rel_int((volatile u_int *)addr, (u_int)val); +} + +#define atomic_load_acq_ptr atomic_load_acq_int +#define atomic_store_rel_ptr atomic_store_rel_int #endif #undef ATOMIC_STORE_LOAD @@ -572,29 +562,6 @@ atomic_cmpset_int(volatile u_int* p, u_i return (ret); } - -static __inline int -atomic_cmpset_acq_int(volatile u_int *p, u_int cmpval, u_int newval) -{ - int retval; - - retval = atomic_cmpset_int(p, cmpval, newval); - __ATOMIC_BARRIER; - return (retval); -} - -static __inline int -atomic_cmpset_rel_int(volatile u_int *p, u_int cmpval, u_int newval) -{ - __ATOMIC_BARRIER; - return (atomic_cmpset_int(p, cmpval, newval)); -} - -#define atomic_cmpset_32 atomic_cmpset_int -#define atomic_cmpset_acq_32 atomic_cmpset_acq_int -#define atomic_cmpset_rel_32 atomic_cmpset_rel_int - -#ifdef __powerpc64__ static __inline int atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval) { @@ -602,15 +569,26 @@ atomic_cmpset_long(volatile u_long* p, u #ifdef __GNUCLIKE_ASM __asm __volatile ( + #ifdef __powerpc64__ "1:\tldarx %0, 0, %2\n\t" /* load old value */ "cmpld %3, %0\n\t" /* compare */ "bne 2f\n\t" /* exit if not equal */ - "stdcx. %4, 0, %2\n\t" /* attempt to store */ + "stdcx. %4, 0, %2\n\t" /* attempt to store */ + #else + "1:\tlwarx %0, 0, %2\n\t" /* load old value */ + "cmplw %3, %0\n\t" /* compare */ + "bne 2f\n\t" /* exit if not equal */ + "stwcx. %4, 0, %2\n\t" /* attempt to store */ + #endif "bne- 1b\n\t" /* spin if failed */ "li %0, 1\n\t" /* success - retval = 1 */ "b 3f\n\t" /* we've succeeded */ "2:\n\t" - "stdcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ + #ifdef __powerpc64__ + "stdcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ + #else + "stwcx. %0, 0, %2\n\t" /* clear reservation (74xx) */ + #endif "li %0, 0\n\t" /* failure - retval = 0 */ "3:\n\t" : "=&r" (ret), "=m" (*p) @@ -622,6 +600,23 @@ atomic_cmpset_long(volatile u_long* p, u } static __inline int +atomic_cmpset_acq_int(volatile u_int *p, u_int cmpval, u_int newval) +{ + int retval; + + retval = atomic_cmpset_int(p, cmpval, newval); + __ATOMIC_BARRIER; + return (retval); +} + +static __inline int +atomic_cmpset_rel_int(volatile u_int *p, u_int cmpval, u_int newval) +{ + __ATOMIC_BARRIER; + return (atomic_cmpset_int(p, cmpval, newval)); +} + +static __inline int atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval) { u_long retval; @@ -638,39 +633,22 @@ atomic_cmpset_rel_long(volatile u_long * return (atomic_cmpset_long(p, cmpval, newval)); } +#define atomic_cmpset_32 atomic_cmpset_int +#define atomic_cmpset_acq_32 atomic_cmpset_acq_int +#define atomic_cmpset_rel_32 atomic_cmpset_rel_int + +#ifdef __powerpc64__ #define atomic_cmpset_64 atomic_cmpset_long #define atomic_cmpset_acq_64 atomic_cmpset_acq_long #define atomic_cmpset_rel_64 atomic_cmpset_rel_long -#define atomic_cmpset_ptr(dst, old, new) \ - atomic_cmpset_long((volatile u_long *)(dst), (u_long)(old), \ - (u_long)(new)) -#define atomic_cmpset_acq_ptr(dst, old, new) \ - atomic_cmpset_acq_long((volatile u_long *)(dst), (u_long)(old), \ - (u_long)(new)) -#define atomic_cmpset_rel_ptr(dst, old, new) \ - atomic_cmpset_rel_long((volatile u_long *)(dst), (u_long)(old), \ - (u_long)(new)) -#else -#define atomic_cmpset_long(dst, old, new) \ - atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) -#define atomic_cmpset_acq_long(dst, old, new) \ - atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) -#define atomic_cmpset_rel_long(dst, old, new) \ - atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) - -#define atomic_cmpset_ptr(dst, old, new) \ - atomic_cmpset_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) -#define atomic_cmpset_acq_ptr(dst, old, new) \ - atomic_cmpset_acq_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) -#define atomic_cmpset_rel_ptr(dst, old, new) \ - atomic_cmpset_rel_int((volatile u_int *)(dst), (u_int)(old), \ - (u_int)(new)) +#define atomic_cmpset_ptr atomic_cmpset_long +#define atomic_cmpset_acq_ptr atomic_cmpset_acq_long +#define atomic_cmpset_rel_ptr atomic_cmpset_rel_long +#else +#define atomic_cmpset_ptr atomic_cmpset_int +#define atomic_cmpset_acq_ptr atomic_cmpset_acq_int +#define atomic_cmpset_rel_ptr atomic_cmpset_rel_int #endif static __inline u_int @@ -684,9 +662,6 @@ atomic_fetchadd_int(volatile u_int *p, u return (value); } -#define atomic_fetchadd_32 atomic_fetchadd_int - -#ifdef __powerpc64__ static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { @@ -698,10 +673,10 @@ atomic_fetchadd_long(volatile u_long *p, return (value); } +#define atomic_fetchadd_32 atomic_fetchadd_int + +#ifdef __powerpc64__ #define atomic_fetchadd_64 atomic_fetchadd_long -#else -#define atomic_fetchadd_long(p, v) \ - (u_long)atomic_fetchadd_int((volatile u_int *)(p), (u_int)(v)) #endif #endif /* ! _MACHINE_ATOMIC_H_ */ From owner-svn-src-projects@FreeBSD.ORG Mon May 9 16:16:16 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 080711065673; Mon, 9 May 2011 16:16:16 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E18268FC1E; Mon, 9 May 2011 16:16:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49GGF8A003625; Mon, 9 May 2011 16:16:15 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49GGFnT003613; Mon, 9 May 2011 16:16:15 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105091616.p49GGFnT003613@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 16:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221697 - in projects/largeSMP/sys/powerpc: aim booke include powerpc X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 16:16:16 -0000 Author: attilio Date: Mon May 9 16:16:15 2011 New Revision: 221697 URL: http://svn.freebsd.org/changeset/base/221697 Log: Add the powerpc support. Note that there is a dirty hack for calling openpic_write(), but nwhitehorn approved it. Discussed with: nwhitehorn Modified: projects/largeSMP/sys/powerpc/aim/mmu_oea.c projects/largeSMP/sys/powerpc/aim/mmu_oea64.c projects/largeSMP/sys/powerpc/booke/pmap.c projects/largeSMP/sys/powerpc/include/_types.h projects/largeSMP/sys/powerpc/include/openpicvar.h projects/largeSMP/sys/powerpc/include/pmap.h projects/largeSMP/sys/powerpc/include/smp.h projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c projects/largeSMP/sys/powerpc/powerpc/openpic.c projects/largeSMP/sys/powerpc/powerpc/pic_if.m Modified: projects/largeSMP/sys/powerpc/aim/mmu_oea.c ============================================================================== --- projects/largeSMP/sys/powerpc/aim/mmu_oea.c Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/aim/mmu_oea.c Mon May 9 16:16:15 2011 (r221697) @@ -118,11 +118,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -838,7 +841,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k PMAP_LOCK_INIT(kernel_pmap); for (i = 0; i < 16; i++) kernel_pmap->pm_sr[i] = EMPTY_SEGMENT + i; - kernel_pmap->pm_active = ~0; + CPU_FILL(&kernel_pmap->pm_active); /* * Set up the Open Firmware mappings @@ -960,7 +963,9 @@ moea_activate(mmu_t mmu, struct thread * pm = &td->td_proc->p_vmspace->vm_pmap; pmr = pm->pmap_phys; - pm->pm_active |= PCPU_GET(cpumask); + sched_pin(); + CPU_OR(&pm->pm_active, PCPU_PTR(cpumask)); + sched_unpin(); PCPU_SET(curpmap, pmr); } @@ -970,7 +975,9 @@ moea_deactivate(mmu_t mmu, struct thread pmap_t pm; pm = &td->td_proc->p_vmspace->vm_pmap; - pm->pm_active &= ~PCPU_GET(cpumask); + sched_pin(); + CPU_NAND(&pm->pm_active, PCPU_PTR(cpumask)); + sched_unpin(); PCPU_SET(curpmap, NULL); } Modified: projects/largeSMP/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- projects/largeSMP/sys/powerpc/aim/mmu_oea64.c Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/aim/mmu_oea64.c Mon May 9 16:16:15 2011 (r221697) @@ -118,11 +118,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include #include #include +#include #include #include #include @@ -845,7 +848,7 @@ moea64_mid_bootstrap(mmu_t mmup, vm_offs #endif kernel_pmap->pmap_phys = kernel_pmap; - kernel_pmap->pm_active = ~0; + CPU_FILL(&kernel_pmap->pm_active); PMAP_LOCK_INIT(kernel_pmap); @@ -1013,7 +1016,9 @@ moea64_activate(mmu_t mmu, struct thread pmap_t pm; pm = &td->td_proc->p_vmspace->vm_pmap; - pm->pm_active |= PCPU_GET(cpumask); + sched_pin(); + CPU_OR(&pm->pm_active, PCPU_PTR(cpumask)); + sched_unpin(); #ifdef __powerpc64__ PCPU_SET(userslb, pm->pm_slb); @@ -1028,7 +1033,9 @@ moea64_deactivate(mmu_t mmu, struct thre pmap_t pm; pm = &td->td_proc->p_vmspace->vm_pmap; - pm->pm_active &= ~(PCPU_GET(cpumask)); + sched_pin(); + CPU_NAND(&pm->pm_active, PCPU_PTR(cpumask)); + sched_unpin(); #ifdef __powerpc64__ PCPU_SET(userslb, NULL); #else Modified: projects/largeSMP/sys/powerpc/booke/pmap.c ============================================================================== --- projects/largeSMP/sys/powerpc/booke/pmap.c Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/booke/pmap.c Mon May 9 16:16:15 2011 (r221697) @@ -1228,7 +1228,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset PTE_VALID; } /* Mark kernel_pmap active on all CPUs */ - kernel_pmap->pm_active = ~0; + CPU_FILL(&kernel_pmap->pm_active); /*******************************************************/ /* Final setup */ @@ -1483,7 +1483,7 @@ mmu_booke_pinit(mmu_t mmu, pmap_t pmap) PMAP_LOCK_INIT(pmap); for (i = 0; i < MAXCPU; i++) pmap->pm_tid[i] = TID_NONE; - pmap->pm_active = 0; + CPU_ZERO(&kernel_pmap->pm_active); bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); bzero(&pmap->pm_pdir, sizeof(pte_t *) * PDIR_NENTRIES); TAILQ_INIT(&pmap->pm_ptbl_list); @@ -1838,7 +1838,7 @@ mmu_booke_activate(mmu_t mmu, struct thr mtx_lock_spin(&sched_lock); - atomic_set_int(&pmap->pm_active, PCPU_GET(cpumask)); + CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); PCPU_SET(curpmap, pmap); if (pmap->pm_tid[PCPU_GET(cpuid)] == TID_NONE) @@ -1867,7 +1867,9 @@ mmu_booke_deactivate(mmu_t mmu, struct t CTR5(KTR_PMAP, "%s: td=%p, proc = '%s', id = %d, pmap = 0x%08x", __func__, td, td->td_proc->p_comm, td->td_proc->p_pid, pmap); - atomic_clear_int(&pmap->pm_active, PCPU_GET(cpumask)); + sched_pin(); + CPU_NAND_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); + sched_unpin(); PCPU_SET(curpmap, NULL); } Modified: projects/largeSMP/sys/powerpc/include/_types.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/_types.h Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/include/_types.h Mon May 9 16:16:15 2011 (r221697) @@ -72,7 +72,6 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __uint32_t __clock_t; /* clock()... */ -typedef unsigned int __cpumask_t; typedef double __double_t; typedef double __float_t; #ifdef __LP64__ Modified: projects/largeSMP/sys/powerpc/include/openpicvar.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/openpicvar.h Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/include/openpicvar.h Mon May 9 16:16:15 2011 (r221697) @@ -57,7 +57,7 @@ int openpic_common_attach(device_t, uint /* * PIC interface. */ -void openpic_bind(device_t dev, u_int irq, cpumask_t cpumask); +void openpic_bind(device_t dev, u_int irq, cpuset_t cpumask); void openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity); void openpic_dispatch(device_t, struct trapframe *); void openpic_enable(device_t, u_int, u_int); Modified: projects/largeSMP/sys/powerpc/include/pmap.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/pmap.h Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/include/pmap.h Mon May 9 16:16:15 2011 (r221697) @@ -66,6 +66,7 @@ #include #include +#include #include #include #include @@ -98,7 +99,7 @@ struct pmap { #else register_t pm_sr[16]; #endif - cpumask_t pm_active; + cpuset_t pm_active; struct pmap *pmap_phys; struct pmap_statistics pm_stats; @@ -175,7 +176,7 @@ void slb_free_user_cache(struct slb **); struct pmap { struct mtx pm_mtx; /* pmap mutex */ tlbtid_t pm_tid[MAXCPU]; /* TID to identify this pmap entries in TLB */ - cpumask_t pm_active; /* active on cpus */ + cpuset_t pm_active; /* active on cpus */ struct pmap_statistics pm_stats; /* pmap statistics */ /* Page table directory, array of pointers to page tables. */ Modified: projects/largeSMP/sys/powerpc/include/smp.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/smp.h Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/include/smp.h Mon May 9 16:16:15 2011 (r221697) @@ -40,9 +40,11 @@ #ifndef LOCORE +#include + void ipi_all_but_self(int ipi); void ipi_cpu(int cpu, u_int ipi); -void ipi_selected(cpumask_t cpus, int ipi); +void ipi_selected(cpuset_t cpus, int ipi); struct cpuref { uintptr_t cr_hwref; Modified: projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c Mon May 9 16:16:15 2011 (r221697) @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -98,7 +99,7 @@ struct powerpc_intr { u_int intline; u_int vector; u_int cntindex; - cpumask_t cpu; + cpuset_t cpu; enum intr_trigger trig; enum intr_polarity pol; }; @@ -205,7 +206,7 @@ intr_lookup(u_int irq) #ifdef SMP i->cpu = all_cpus; #else - i->cpu = 1; + CPU_SETOF(0, &i->cpu); #endif for (vector = 0; vector < INTR_VECTORS && vector <= nvectors; @@ -296,7 +297,7 @@ powerpc_assign_intr_cpu(void *arg, u_cha if (cpu == NOCPU) i->cpu = all_cpus; else - i->cpu = 1 << cpu; + CPU_SETOF(cpu, &i->cpu); if (!cold && i->pic != NULL && i->pic == root_pic) PIC_BIND(i->pic, i->intline, i->cpu); Modified: projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/powerpc/mp_machdep.c Mon May 9 16:16:15 2011 (r221697) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -157,7 +158,7 @@ cpu_mp_start(void) cpu.cr_cpuid); goto next; } - if (all_cpus & (1 << cpu.cr_cpuid)) { + if (CPU_ISSET(cpu.cr_cpuid, &all_cpus)) { printf("SMP: cpu%d: skipped - duplicate ID\n", cpu.cr_cpuid); goto next; @@ -174,9 +175,9 @@ cpu_mp_start(void) pc->pc_cpuid = bsp.cr_cpuid; pc->pc_bsp = 1; } - pc->pc_cpumask = 1 << pc->pc_cpuid; + CPU_SETOF(pc->pc_cpuid, &pc->pc_cpumask); pc->pc_hwref = cpu.cr_hwref; - all_cpus |= pc->pc_cpumask; + CPU_OR(&all_cpus, &pc->pc_cpumask); next: error = platform_smp_next_cpu(&cpu); } @@ -214,7 +215,8 @@ cpu_mp_unleash(void *dummy) smp_cpus = 0; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; - pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; + pc->pc_other_cpus = all_cpus; + CPU_NAND(&pc->pc_other_cpus, &pc->pc_cpumask); if (!pc->pc_bsp) { if (bootverbose) printf("Waking up CPU %d (dev=%x)\n", @@ -236,7 +238,7 @@ cpu_mp_unleash(void *dummy) pc->pc_cpuid, pc->pc_pir, pc->pc_awake); smp_cpus++; } else - stopped_cpus |= (1 << pc->pc_cpuid); + CPU_SET(pc->pc_cpuid, &stopped_cpus); } ap_awake = 1; @@ -276,7 +278,7 @@ SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_ int powerpc_ipi_handler(void *arg) { - cpumask_t self; + cpuset_t self; uint32_t ipimask; int msg; @@ -311,11 +313,11 @@ powerpc_ipi_handler(void *arg) savectx(&stoppcbs[PCPU_GET(cpuid)]); self = PCPU_GET(cpumask); savectx(PCPU_GET(curpcb)); - atomic_set_int(&stopped_cpus, self); - while ((started_cpus & self) == 0) + CPU_OR_ATOMIC(&stopped_cpus, &self); + while (!CPU_OVERLAP(&started_cpus, &self)) cpu_spinwait(); - atomic_clear_int(&started_cpus, self); - atomic_clear_int(&stopped_cpus, self); + CPU_NAND_ATOMIC(&started_cpus, &self); + CPU_NAND_ATOMIC(&stopped_cpus, &self); CTR1(KTR_SMP, "%s: IPI_STOP (restart)", __func__); break; case IPI_HARDCLOCK: @@ -343,12 +345,12 @@ ipi_send(struct pcpu *pc, int ipi) /* Send an IPI to a set of cpus. */ void -ipi_selected(cpumask_t cpus, int ipi) +ipi_selected(cpuset_t cpus, int ipi) { struct pcpu *pc; SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { - if (cpus & pc->pc_cpumask) + if (CPU_OVERLAP(&cpus, &pc->pc_cpumask)) ipi_send(pc, ipi); } } Modified: projects/largeSMP/sys/powerpc/powerpc/openpic.c ============================================================================== --- projects/largeSMP/sys/powerpc/powerpc/openpic.c Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/powerpc/openpic.c Mon May 9 16:16:15 2011 (r221697) @@ -231,7 +231,7 @@ openpic_common_attach(device_t dev, uint */ void -openpic_bind(device_t dev, u_int irq, cpumask_t cpumask) +openpic_bind(device_t dev, u_int irq, cpuset_t cpumask) { struct openpic_softc *sc; @@ -240,7 +240,12 @@ openpic_bind(device_t dev, u_int irq, cp return; sc = device_get_softc(dev); - openpic_write(sc, OPENPIC_IDEST(irq), cpumask); + + /* + * XXX: openpic_write() is very special and just needs a 32 bits mask. + * For the moment, just play dirty and get the first half word. + */ + openpic_write(sc, OPENPIC_IDEST(irq), (long)cpumask & 0xffffffff); } void Modified: projects/largeSMP/sys/powerpc/powerpc/pic_if.m ============================================================================== --- projects/largeSMP/sys/powerpc/powerpc/pic_if.m Mon May 9 15:59:34 2011 (r221696) +++ projects/largeSMP/sys/powerpc/powerpc/pic_if.m Mon May 9 16:16:15 2011 (r221697) @@ -28,6 +28,7 @@ # #include +#include #include INTERFACE pic; @@ -35,7 +36,7 @@ INTERFACE pic; METHOD void bind { device_t dev; u_int irq; - cpumask_t cpumask; + cpuset_t cpumask; }; METHOD void config { From owner-svn-src-projects@FreeBSD.ORG Mon May 9 16:47:14 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FF951065672; Mon, 9 May 2011 16:47:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E0668FC1B; Mon, 9 May 2011 16:47:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49GlEUO004622; Mon, 9 May 2011 16:47:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49GlDkj004603; Mon, 9 May 2011 16:47:13 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105091647.p49GlDkj004603@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 16:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221699 - in projects/largeSMP: bin/sh contrib/top share/mk sys/dev/ath/ath_hal sys/dev/ath/ath_hal/ar5416 sys/dev/ath/ath_hal/ar9002 sys/dev/sound/usb sys/netinet sys/netipsec sys/teke... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 16:47:14 -0000 Author: attilio Date: Mon May 9 16:47:13 2011 New Revision: 221699 URL: http://svn.freebsd.org/changeset/base/221699 Log: MFC Added: projects/largeSMP/sys/teken/demo/ - copied from r221698, head/sys/teken/demo/ projects/largeSMP/sys/teken/libteken/ - copied from r221698, head/sys/teken/libteken/ projects/largeSMP/sys/teken/stress/ - copied from r221698, head/sys/teken/stress/ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote10.0 - copied unchanged from r221698, head/tools/regression/bin/sh/parser/dollar-quote10.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote11.0 - copied unchanged from r221698, head/tools/regression/bin/sh/parser/dollar-quote11.0 Deleted: projects/largeSMP/sys/teken/Makefile projects/largeSMP/sys/teken/teken_demo.c projects/largeSMP/sys/teken/teken_stress.c Modified: projects/largeSMP/bin/sh/main.c projects/largeSMP/bin/sh/parser.c projects/largeSMP/bin/sh/sh.1 projects/largeSMP/bin/sh/var.c projects/largeSMP/bin/sh/var.h projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285.h projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c projects/largeSMP/sys/dev/sound/usb/uaudio.c projects/largeSMP/sys/netinet/tcp_subr.c projects/largeSMP/sys/netipsec/key.c projects/largeSMP/sys/teken/teken.c projects/largeSMP/sys/teken/teken.h projects/largeSMP/tools/tools/ath/ath_ee_v4k_print/v4k.c projects/largeSMP/usr.sbin/jail/jail.8 Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/bin/sh/main.c ============================================================================== --- projects/largeSMP/bin/sh/main.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/bin/sh/main.c Mon May 9 16:47:13 2011 (r221699) @@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$"); int rootpid; int rootshell; struct jmploc main_handler; -int localeisutf8; +int localeisutf8, initial_localeisutf8; static void read_profile(const char *); static char *find_dot_file(char *); @@ -97,7 +97,7 @@ main(int argc, char *argv[]) char *shinit; (void) setlocale(LC_ALL, ""); - updatecharset(); + initcharset(); state = 0; if (setjmp(main_handler.loc)) { switch (exception) { Modified: projects/largeSMP/bin/sh/parser.c ============================================================================== --- projects/largeSMP/bin/sh/parser.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/bin/sh/parser.c Mon May 9 16:47:13 2011 (r221699) @@ -1219,6 +1219,29 @@ readcstyleesc(char *out) if (v == 0 || (v >= 0xd800 && v <= 0xdfff)) synerror("Bad escape sequence"); /* We really need iconv here. */ + if (initial_localeisutf8 && v > 127) { + CHECKSTRSPACE(4, out); + /* + * We cannot use wctomb() as the locale may have + * changed. + */ + if (v <= 0x7ff) { + USTPUTC(0xc0 | v >> 6, out); + USTPUTC(0x80 | (v & 0x3f), out); + return out; + } else if (v <= 0xffff) { + USTPUTC(0xe0 | v >> 12, out); + USTPUTC(0x80 | ((v >> 6) & 0x3f), out); + USTPUTC(0x80 | (v & 0x3f), out); + return out; + } else if (v <= 0x10ffff) { + USTPUTC(0xf0 | v >> 18, out); + USTPUTC(0x80 | ((v >> 12) & 0x3f), out); + USTPUTC(0x80 | ((v >> 6) & 0x3f), out); + USTPUTC(0x80 | (v & 0x3f), out); + return out; + } + } if (v > 127) v = '?'; break; Modified: projects/largeSMP/bin/sh/sh.1 ============================================================================== --- projects/largeSMP/bin/sh/sh.1 Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/bin/sh/sh.1 Mon May 9 16:47:13 2011 (r221699) @@ -463,8 +463,8 @@ The Unicode code point (eight hexadecimal digits) .El .Pp -The sequences for Unicode code points currently only provide useful results -for values below 128. +The sequences for Unicode code points are currently only useful with +UTF-8 locales. They reject code point 0 and UTF-16 surrogates. .Pp If an escape sequence would produce a byte with value 0, Modified: projects/largeSMP/bin/sh/var.c ============================================================================== --- projects/largeSMP/bin/sh/var.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/bin/sh/var.c Mon May 9 16:47:13 2011 (r221699) @@ -136,8 +136,8 @@ static const int locale_categories[7] = LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME, LC_MESSAGES, 0 }; -static struct var **hashvar(const char *); static int varequal(const char *, const char *); +static struct var *find_var(const char *, struct var ***, int *); static int localevar(const char *); /* @@ -174,20 +174,18 @@ initvar(void) struct var **vpp; for (ip = varinit ; (vp = ip->var) != NULL ; ip++) { - if ((vp->flags & VEXPORT) == 0) { - vpp = hashvar(ip->text); - vp->next = *vpp; - *vpp = vp; - vp->text = __DECONST(char *, ip->text); - vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED; - vp->func = ip->func; - } + if (find_var(ip->text, &vpp, &vp->name_len) != NULL) + continue; + vp->next = *vpp; + *vpp = vp; + vp->text = __DECONST(char *, ip->text); + vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED; + vp->func = ip->func; } /* * PS1 depends on uid */ - if ((vps1.flags & VEXPORT) == 0) { - vpp = hashvar("PS1="); + if (find_var("PS1", &vpp, &vps1.name_len) == NULL) { vps1.next = *vpp; *vpp = &vps1; vps1.text = __DECONST(char *, geteuid() ? "PS1=$ " : "PS1=# "); @@ -323,50 +321,46 @@ void setvareq(char *s, int flags) { struct var *vp, **vpp; - int len; + int nlen; if (aflag) flags |= VEXPORT; - vpp = hashvar(s); - for (vp = *vpp ; vp ; vp = vp->next) { - if (varequal(s, vp->text)) { - if (vp->flags & VREADONLY) { - len = strchr(s, '=') - s; - error("%.*s: is read only", len, s); - } - if (flags & VNOSET) - return; - INTOFF; + vp = find_var(s, &vpp, &nlen); + if (vp != NULL) { + if (vp->flags & VREADONLY) + error("%.*s: is read only", vp->name_len, s); + if (flags & VNOSET) + return; + INTOFF; - if (vp->func && (flags & VNOFUNC) == 0) - (*vp->func)(strchr(s, '=') + 1); + if (vp->func && (flags & VNOFUNC) == 0) + (*vp->func)(s + vp->name_len + 1); - if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0) - ckfree(vp->text); + if ((vp->flags & (VTEXTFIXED|VSTACK)) == 0) + ckfree(vp->text); - vp->flags &= ~(VTEXTFIXED|VSTACK|VUNSET); - vp->flags |= flags; - vp->text = s; - - /* - * We could roll this to a function, to handle it as - * a regular variable function callback, but why bother? - * - * Note: this assumes iflag is not set to 1 initially. - * As part of init(), this is called before arguments - * are looked at. - */ - if ((vp == &vmpath || (vp == &vmail && ! mpathset())) && - iflag == 1) - chkmail(1); - if ((vp->flags & VEXPORT) && localevar(s)) { - change_env(s, 1); - (void) setlocale(LC_ALL, ""); - updatecharset(); - } - INTON; - return; + vp->flags &= ~(VTEXTFIXED|VSTACK|VUNSET); + vp->flags |= flags; + vp->text = s; + + /* + * We could roll this to a function, to handle it as + * a regular variable function callback, but why bother? + * + * Note: this assumes iflag is not set to 1 initially. + * As part of init(), this is called before arguments + * are looked at. + */ + if ((vp == &vmpath || (vp == &vmail && ! mpathset())) && + iflag == 1) + chkmail(1); + if ((vp->flags & VEXPORT) && localevar(s)) { + change_env(s, 1); + (void) setlocale(LC_ALL, ""); + updatecharset(); } + INTON; + return; } /* not found */ if (flags & VNOSET) @@ -374,6 +368,7 @@ setvareq(char *s, int flags) vp = ckmalloc(sizeof (*vp)); vp->flags = flags; vp->text = s; + vp->name_len = nlen; vp->next = *vpp; vp->func = NULL; INTOFF; @@ -415,14 +410,10 @@ lookupvar(const char *name) { struct var *v; - for (v = *hashvar(name) ; v ; v = v->next) { - if (varequal(v->text, name)) { - if (v->flags & VUNSET) - return NULL; - return strchr(v->text, '=') + 1; - } - } - return NULL; + v = find_var(name, NULL, NULL); + if (v == NULL || v->flags & VUNSET) + return NULL; + return v->text + v->name_len + 1; } @@ -447,15 +438,12 @@ bltinlookup(const char *name, int doall) } if (result != NULL) return result; - for (v = *hashvar(name) ; v ; v = v->next) { - if (varequal(v->text, name)) { - if ((v->flags & VUNSET) - || (!doall && (v->flags & VEXPORT) == 0)) - return NULL; - return strchr(v->text, '=') + 1; - } - } - return NULL; + + v = find_var(name, NULL, NULL); + if (v == NULL || v->flags & VUNSET || + (!doall && (v->flags & VEXPORT) == 0)) + return NULL; + return v->text + v->name_len + 1; } @@ -529,6 +517,13 @@ updatecharset(void) localeisutf8 = !strcmp(charset, "UTF-8"); } +void +initcharset(void) +{ + updatecharset(); + initial_localeisutf8 = localeisutf8; +} + /* * Generate a list of exported variables. This routine is used to construct * the third argument to execve when executing a program. @@ -665,22 +660,18 @@ exportcmd(int argc, char **argv) if ((p = strchr(name, '=')) != NULL) { p++; } else { - vpp = hashvar(name); - for (vp = *vpp ; vp ; vp = vp->next) { - if (varequal(vp->text, name)) { - - vp->flags |= flag; - if ((vp->flags & VEXPORT) && localevar(vp->text)) { - change_env(vp->text, 1); - (void) setlocale(LC_ALL, ""); - updatecharset(); - } - goto found; + vp = find_var(name, NULL, NULL); + if (vp != NULL) { + vp->flags |= flag; + if ((vp->flags & VEXPORT) && localevar(vp->text)) { + change_env(vp->text, 1); + (void) setlocale(LC_ALL, ""); + updatecharset(); } + continue; } } setvar(name, p, flag); -found:; } } else { for (vpp = vartab ; vpp < vartab + VTABSIZE ; vpp++) { @@ -747,8 +738,7 @@ mklocal(char *name) memcpy(lvp->text, optlist, sizeof optlist); vp = NULL; } else { - vpp = hashvar(name); - for (vp = *vpp ; vp && ! varequal(vp->text, name) ; vp = vp->next); + vp = find_var(name, &vpp, NULL); if (vp == NULL) { if (strchr(name, '=')) setvareq(savestr(name), VSTRFIXED); @@ -761,7 +751,7 @@ mklocal(char *name) lvp->text = vp->text; lvp->flags = vp->flags; vp->flags |= VSTRFIXED|VTEXTFIXED; - if (strchr(name, '=')) + if (name[vp->name_len] == '=') setvareq(savestr(name), 0); } } @@ -857,55 +847,34 @@ unsetvar(const char *s) struct var **vpp; struct var *vp; - vpp = hashvar(s); - for (vp = *vpp ; vp ; vpp = &vp->next, vp = *vpp) { - if (varequal(vp->text, s)) { - if (vp->flags & VREADONLY) - return (1); - INTOFF; - if (*(strchr(vp->text, '=') + 1) != '\0') - setvar(s, nullstr, 0); - if ((vp->flags & VEXPORT) && localevar(vp->text)) { - change_env(s, 0); - setlocale(LC_ALL, ""); - updatecharset(); - } - vp->flags &= ~VEXPORT; - vp->flags |= VUNSET; - if ((vp->flags & VSTRFIXED) == 0) { - if ((vp->flags & VTEXTFIXED) == 0) - ckfree(vp->text); - *vpp = vp->next; - ckfree(vp); - } - INTON; - return (0); - } + vp = find_var(s, &vpp, NULL); + if (vp == NULL) + return (0); + if (vp->flags & VREADONLY) + return (1); + INTOFF; + if (vp->text[vp->name_len + 1] != '\0') + setvar(s, nullstr, 0); + if ((vp->flags & VEXPORT) && localevar(vp->text)) { + change_env(s, 0); + setlocale(LC_ALL, ""); + updatecharset(); } - + vp->flags &= ~VEXPORT; + vp->flags |= VUNSET; + if ((vp->flags & VSTRFIXED) == 0) { + if ((vp->flags & VTEXTFIXED) == 0) + ckfree(vp->text); + *vpp = vp->next; + ckfree(vp); + } + INTON; return (0); } /* - * Find the appropriate entry in the hash table from the name. - */ - -static struct var ** -hashvar(const char *p) -{ - unsigned int hashval; - - hashval = ((unsigned char) *p) << 4; - while (*p && *p != '=') - hashval += (unsigned char) *p++; - return &vartab[hashval % VTABSIZE]; -} - - - -/* * Returns true if the two strings specify the same varable. The first * variable name is terminated by '='; the second may be terminated by * either '=' or '\0'. @@ -922,3 +891,41 @@ varequal(const char *p, const char *q) return 1; return 0; } + +/* + * Search for a variable. + * 'name' may be terminated by '=' or a NUL. + * vppp is set to the pointer to vp, or the list head if vp isn't found + * lenp is set to the number of charactets in 'name' + */ + +static struct var * +find_var(const char *name, struct var ***vppp, int *lenp) +{ + unsigned int hashval; + int len; + struct var *vp, **vpp; + const char *p = name; + + hashval = 0; + while (*p && *p != '=') + hashval = 2 * hashval + (unsigned char)*p++; + len = p - name; + + if (lenp) + *lenp = len; + vpp = &vartab[hashval % VTABSIZE]; + if (vppp) + *vppp = vpp; + + for (vp = *vpp ; vp ; vpp = &vp->next, vp = *vpp) { + if (vp->name_len != len) + continue; + if (memcmp(vp->text, name, len) != 0) + continue; + if (vppp) + *vppp = vpp; + return vp; + } + return NULL; +} Modified: projects/largeSMP/bin/sh/var.h ============================================================================== --- projects/largeSMP/bin/sh/var.h Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/bin/sh/var.h Mon May 9 16:47:13 2011 (r221699) @@ -51,6 +51,7 @@ struct var { struct var *next; /* next entry in hash list */ int flags; /* flags are defined above */ + int name_len; /* length of name */ char *text; /* name=value */ void (*func)(const char *); /* function to be called when */ @@ -82,6 +83,8 @@ extern struct var vterm; #endif extern int localeisutf8; +/* The parser uses the locale that was in effect at startup. */ +extern int initial_localeisutf8; /* * The following macros access the values of the above variables. @@ -115,6 +118,7 @@ char *bltinlookup(const char *, int); void bltinsetlocale(void); void bltinunsetlocale(void); void updatecharset(void); +void initcharset(void); char **environment(void); int showvarscmd(int, char **); int exportcmd(int, char **); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h Mon May 9 16:47:13 2011 (r221699) @@ -205,7 +205,8 @@ typedef struct { halMbssidAggrSupport : 1, halBssidMatchSupport : 1, hal4kbSplitTransSupport : 1, - halHasRxSelfLinkedTail : 1; + halHasRxSelfLinkedTail : 1, + halSupportsFastClock5GHz : 1; /* Hardware supports 5ghz fast clock; check eeprom/channel before using */ uint32_t halWirelessModes; uint16_t halTotalQueues; uint16_t halKeyCacheSize; @@ -807,10 +808,21 @@ extern HAL_BOOL ath_ee_FillVpdTable(uint extern int16_t ath_ee_interpolate(uint16_t target, uint16_t srcLeft, uint16_t srcRight, int16_t targetLeft, int16_t targetRight); -/* Whether 5ghz fast clock is needed for Merlin and later */ +/* Whether 5ghz fast clock is needed */ +/* + * The chipset (Merlin, AR9300/later) should set the capability flag below; + * this flag simply says that the hardware can do it, not that the EEPROM + * says it can. + * + * Merlin 2.0/2.1 chips with an EEPROM version > 16 do 5ghz fast clock + * if the relevant eeprom flag is set. + * Merlin 2.0/2.1 chips with an EEPROM version <= 16 do 5ghz fast clock + * by default. + */ #define IS_5GHZ_FAST_CLOCK_EN(_ah, _c) \ (IEEE80211_IS_CHAN_5GHZ(_c) && \ - ath_hal_eepromGetFlag(ah, AR_EEP_FSTCLK_5G)) + AH_PRIVATE((_ah))->ah_caps.halSupportsFastClock5GHz && \ + ath_hal_eepromGetFlag((_ah), AR_EEP_FSTCLK_5G)) #endif /* _ATH_AH_INTERAL_H_ */ Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h Mon May 9 16:47:13 2011 (r221699) @@ -701,7 +701,7 @@ #define AR_SREV_MERLIN_20(_ah) \ (AR_SREV_MERLIN(_ah) && \ - AH_PRIVATE((_ah))->ah_macRev == AR_XSREV_REVISION_MERLIN_20) + AH_PRIVATE((_ah))->ah_macRev >= AR_XSREV_REVISION_MERLIN_20) #define AR_SREV_MERLIN_20_OR_LATER(_ah) \ ((AH_PRIVATE((_ah))->ah_macVersion > AR_XSREV_VERSION_MERLIN) || \ @@ -741,5 +741,6 @@ /* Not yet implemented chips */ #define AR_SREV_9271(_ah) 0 #define AR_SREV_9287_11_OR_LATER(_ah) 0 +#define AR_SREV_KIWI_10_OR_LATER(_ah) 0 #endif /* _DEV_ATH_AR5416REG_H */ Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c Mon May 9 16:47:13 2011 (r221699) @@ -787,8 +787,14 @@ ar9280FillCapabilityInfo(struct ath_hal pCap->halMbssidAggrSupport = AH_TRUE; pCap->hal4AddrAggrSupport = AH_TRUE; - if (AR_SREV_MERLIN_20_OR_LATER(ah)) + if (AR_SREV_MERLIN_20(ah)) { pCap->halPSPollBroken = AH_FALSE; + /* + * This just enables the support; it doesn't + * state 5ghz fast clock will always be used. + */ + pCap->halSupportsFastClock5GHz = AH_TRUE; + } pCap->halRxStbcSupport = 1; pCap->halTxStbcSupport = 1; Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285.h Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285.h Mon May 9 16:47:13 2011 (r221699) @@ -21,10 +21,10 @@ #include "ar5416/ar5416.h" enum ar9285_ant_div_comb_lna_conf { - ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2, - ATH_ANT_DIV_COMB_LNA2, - ATH_ANT_DIV_COMB_LNA1, - ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2, + ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2 = 0, + ATH_ANT_DIV_COMB_LNA2 = 1, + ATH_ANT_DIV_COMB_LNA1 = 2, + ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2 = 3, }; struct ar9285_ant_comb { Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Mon May 9 16:47:13 2011 (r221699) @@ -407,15 +407,6 @@ ar9285FillCapabilityInfo(struct ath_hal return AH_TRUE; } -/* - * Antenna selection is not (currently) done this way. - */ -HAL_BOOL -ar9285SetAntennaSwitch(struct ath_hal *ah, HAL_ANT_SETTING settings) -{ - return AH_TRUE; -} - static const char* ar9285Probe(uint16_t vendorid, uint16_t devid) { Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Mon May 9 16:47:13 2011 (r221699) @@ -263,7 +263,5 @@ ar9285InitCalHardware(struct ath_hal *ah if (! ar9285_hw_clc(ah, chan)) return AH_FALSE; - ar9285_hw_pa_cal(ah, AH_TRUE); - return AH_TRUE; } Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c Mon May 9 16:47:13 2011 (r221699) @@ -374,11 +374,19 @@ ar9285_ant_comb_scan(struct ath_hal *ah, if (! ar9285_check_div_comb(ah)) return; + if (AH5212(ah)->ah_diversity == AH_FALSE) + return; + rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) & ATH_ANT_RX_MASK; main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) & ATH_ANT_RX_MASK; +#if 0 + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main: %d, alt: %d, rx_ant_conf: %x, main_ant_conf: %x\n", + __func__, main_rssi, alt_rssi, rx_ant_conf, main_ant_conf); +#endif + /* Record packet only when alt_rssi is positive */ if (alt_rssi > 0) { antcomb->total_pkt_count++; @@ -587,6 +595,24 @@ div_comb_done: ar9285_antdiv_comb_conf_set(ah, &div_ant_conf); + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: total_pkt_count=%d\n", + __func__, antcomb->total_pkt_count); + + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main_total_rssi=%d\n", + __func__, antcomb->main_total_rssi); + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: alt_total_rssi=%d\n", + __func__, antcomb->alt_total_rssi); + + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main_rssi_avg=%d\n", + __func__, main_rssi_avg); + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: alt_alt_rssi_avg=%d\n", + __func__, alt_rssi_avg); + + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main_recv_cnt=%d\n", + __func__, antcomb->main_recv_cnt); + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: alt_recv_cnt=%d\n", + __func__, antcomb->alt_recv_cnt); + if (curr_alt_set != div_ant_conf.alt_lna_conf) HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: lna_conf: %x -> %x\n", __func__, curr_alt_set, div_ant_conf.alt_lna_conf); @@ -604,3 +630,117 @@ div_comb_done: antcomb->main_recv_cnt = 0; antcomb->alt_recv_cnt = 0; } + +/* + * Set the antenna switch to control RX antenna diversity. + * + * If a fixed configuration is used, the LNA and div bias + * settings are fixed and the antenna diversity scanning routine + * is disabled. + * + * If a variable configuration is used, a default is programmed + * in and sampling commences per RXed packet. + * + * Since this is called from ar9285SetBoardValues() to setup + * diversity, it means that after a reset or scan, any current + * software diversity combining settings will be lost and won't + * re-appear until after the first successful sample run. + * Please keep this in mind if you're seeing weird performance + * that happens to relate to scan/diversity timing. + */ +HAL_BOOL +ar9285SetAntennaSwitch(struct ath_hal *ah, HAL_ANT_SETTING settings) +{ + int regVal; + const HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + uint8_t ant_div_control1, ant_div_control2; + + if (pModal->version < 3) { + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: not supported\n", + __func__); + return AH_FALSE; /* Can't do diversity */ + } + + /* Store settings */ + AH5212(ah)->ah_antControl = settings; + AH5212(ah)->ah_diversity = (settings == HAL_ANT_VARIABLE); + + /* XXX don't fiddle if the PHY is in sleep mode or ! chan */ + + /* Begin setting the relevant registers */ + + ant_div_control1 = pModal->antdiv_ctl1; + ant_div_control2 = pModal->antdiv_ctl2; + + regVal = OS_REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); + regVal &= (~(AR_PHY_9285_ANT_DIV_CTL_ALL)); + + /* enable antenna diversity only if diversityControl == HAL_ANT_VARIABLE */ + if (settings == HAL_ANT_VARIABLE) + regVal |= SM(ant_div_control1, AR_PHY_9285_ANT_DIV_CTL); + + if (settings == HAL_ANT_VARIABLE) { + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: HAL_ANT_VARIABLE\n", + __func__); + regVal |= SM(ant_div_control2, AR_PHY_9285_ANT_DIV_ALT_LNACONF); + regVal |= SM((ant_div_control2 >> 2), AR_PHY_9285_ANT_DIV_MAIN_LNACONF); + regVal |= SM((ant_div_control1 >> 1), AR_PHY_9285_ANT_DIV_ALT_GAINTB); + regVal |= SM((ant_div_control1 >> 2), AR_PHY_9285_ANT_DIV_MAIN_GAINTB); + } else { + if (settings == HAL_ANT_FIXED_A) { + /* Diversity disabled, RX = LNA1 */ + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: HAL_ANT_FIXED_A\n", + __func__); + regVal |= SM(ATH_ANT_DIV_COMB_LNA2, AR_PHY_9285_ANT_DIV_ALT_LNACONF); + regVal |= SM(ATH_ANT_DIV_COMB_LNA1, AR_PHY_9285_ANT_DIV_MAIN_LNACONF); + regVal |= SM(AR_PHY_9285_ANT_DIV_GAINTB_0, AR_PHY_9285_ANT_DIV_ALT_GAINTB); + regVal |= SM(AR_PHY_9285_ANT_DIV_GAINTB_1, AR_PHY_9285_ANT_DIV_MAIN_GAINTB); + } + else if (settings == HAL_ANT_FIXED_B) { + /* Diversity disabled, RX = LNA2 */ + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: HAL_ANT_FIXED_B\n", + __func__); + regVal |= SM(ATH_ANT_DIV_COMB_LNA1, AR_PHY_9285_ANT_DIV_ALT_LNACONF); + regVal |= SM(ATH_ANT_DIV_COMB_LNA2, AR_PHY_9285_ANT_DIV_MAIN_LNACONF); + regVal |= SM(AR_PHY_9285_ANT_DIV_GAINTB_1, AR_PHY_9285_ANT_DIV_ALT_GAINTB); + regVal |= SM(AR_PHY_9285_ANT_DIV_GAINTB_0, AR_PHY_9285_ANT_DIV_MAIN_GAINTB); + } + } + + OS_REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal); + regVal = OS_REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); + regVal = OS_REG_READ(ah, AR_PHY_CCK_DETECT); + regVal &= (~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); + if (settings == HAL_ANT_VARIABLE) + regVal |= SM((ant_div_control1 >> 3), AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); + + OS_REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal); + regVal = OS_REG_READ(ah, AR_PHY_CCK_DETECT); + + /* + * If Diversity combining is available and the diversity setting + * is to allow variable diversity, enable it by default. + * + * This will be eventually overridden by the software antenna + * diversity logic. + * + * Note that yes, this following section overrides the above + * settings for the LNA configuration and fast-bias. + */ + if (ar9285_check_div_comb(ah) && AH5212(ah)->ah_diversity == AH_TRUE) { + // If support DivComb, set MAIN to LNA1 and ALT to LNA2 at the first beginning + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, + "%s: Enable initial settings for combined diversity\n", + __func__); + regVal = OS_REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); + regVal &= (~(AR_PHY_9285_ANT_DIV_MAIN_LNACONF | AR_PHY_9285_ANT_DIV_ALT_LNACONF)); + regVal |= (ATH_ANT_DIV_COMB_LNA1 << AR_PHY_9285_ANT_DIV_MAIN_LNACONF_S); + regVal |= (ATH_ANT_DIV_COMB_LNA2 << AR_PHY_9285_ANT_DIV_ALT_LNACONF_S); + regVal &= (~(AR_PHY_9285_FAST_DIV_BIAS)); + regVal |= (0 << AR_PHY_9285_FAST_DIV_BIAS_S); + OS_REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal); + } + + return AH_TRUE; +} Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c Mon May 9 16:47:13 2011 (r221699) @@ -237,8 +237,6 @@ ar9285SetBoardValues(struct ath_hal *ah, const MODAL_EEP4K_HEADER *pModal; uint8_t txRxAttenLocal; uint8_t ob[5], db1[5], db2[5]; - uint8_t ant_div_control1, ant_div_control2; - uint32_t regVal; pModal = &eep->modalHeader; txRxAttenLocal = 23; @@ -248,36 +246,10 @@ ar9285SetBoardValues(struct ath_hal *ah, /* Single chain for 4K EEPROM*/ ar9285SetBoardGain(ah, pModal, eep, txRxAttenLocal); - /* Initialize Ant Diversity settings from EEPROM */ - if (pModal->version >= 3) { - ant_div_control1 = pModal->antdiv_ctl1; - ant_div_control2 = pModal->antdiv_ctl2; - - regVal = OS_REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); - regVal &= (~(AR_PHY_9285_ANT_DIV_CTL_ALL)); - - regVal |= SM(ant_div_control1, - AR_PHY_9285_ANT_DIV_CTL); - regVal |= SM(ant_div_control2, - AR_PHY_9285_ANT_DIV_ALT_LNACONF); - regVal |= SM((ant_div_control2 >> 2), - AR_PHY_9285_ANT_DIV_MAIN_LNACONF); - regVal |= SM((ant_div_control1 >> 1), - AR_PHY_9285_ANT_DIV_ALT_GAINTB); - regVal |= SM((ant_div_control1 >> 2), - AR_PHY_9285_ANT_DIV_MAIN_GAINTB); - - OS_REG_WRITE(ah, AR_PHY_MULTICHAIN_GAIN_CTL, regVal); - regVal = OS_REG_READ(ah, AR_PHY_MULTICHAIN_GAIN_CTL); - regVal = OS_REG_READ(ah, AR_PHY_CCK_DETECT); - regVal &= (~AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); - regVal |= SM((ant_div_control1 >> 3), - AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV); - - OS_REG_WRITE(ah, AR_PHY_CCK_DETECT, regVal); - regVal = OS_REG_READ(ah, AR_PHY_CCK_DETECT); - } + /* Initialize Ant Diversity settings if supported */ + (void) ar9285SetAntennaSwitch(ah, AH5212(ah)->ah_antControl); + /* Configure TX power calibration */ if (pModal->version >= 2) { ob[0] = pModal->ob_0; ob[1] = pModal->ob_1; @@ -379,6 +351,7 @@ ar9285SetBoardValues(struct ath_hal *ah, if (AR_SREV_9271(ah) || AR_SREV_KITE(ah)) { uint8_t bb_desired_scale = (pModal->bb_scale_smrt_antenna & EEP_4K_BB_DESIRED_SCALE_MASK); if ((eep->baseEepHeader.txGainType == 0) && (bb_desired_scale != 0)) { + ath_hal_printf(ah, "[ath]: adjusting cck tx gain factor\n"); uint32_t pwrctrl, mask, clr; mask = (1<<0) | (1<<5) | (1<<10) | (1<<15) | (1<<20) | (1<<25); Modified: projects/largeSMP/sys/dev/sound/usb/uaudio.c ============================================================================== --- projects/largeSMP/sys/dev/sound/usb/uaudio.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/dev/sound/usb/uaudio.c Mon May 9 16:47:13 2011 (r221699) @@ -789,6 +789,46 @@ uaudio_chan_dump_ep_desc(const usb_endpo #endif +/* + * The following is a workaround for broken no-name USB audio devices + * sold by dealextreme called "3D sound". The problem is that the + * manufacturer computed wMaxPacketSize is too small to hold the + * actual data sent. In other words the device sometimes sends more + * data than it actually reports it can send in a single isochronous + * packet. + */ +static void +uaudio_record_fix_fs(usb_endpoint_descriptor_audio_t *ep, + uint32_t xps, uint32_t add) +{ + uint32_t mps; + + mps = UGETW(ep->wMaxPacketSize); + + /* + * If the device indicates it can send more data than what the + * sample rate indicates, we apply the workaround. + */ + if (mps > xps) { + + /* allow additional data */ + xps += add; + + /* check against the maximum USB 1.x length */ + if (xps > 1023) + xps = 1023; + + /* check if we should do an update */ + if (mps < xps) { + /* simply update the wMaxPacketSize field */ + USETW(ep->wMaxPacketSize, xps); + DPRINTF("Workaround: Updated wMaxPacketSize " + "from %d to %d bytes.\n", + (int)mps, (int)xps); + } + } +} + static void uaudio_chan_fill_info_sub(struct uaudio_softc *sc, struct usb_device *udev, uint32_t rate, uint8_t channels, uint8_t bit_resolution) @@ -797,7 +837,7 @@ uaudio_chan_fill_info_sub(struct uaudio_ const struct usb_audio_streaming_interface_descriptor *asid = NULL; const struct usb_audio_streaming_type1_descriptor *asf1d = NULL; const struct usb_audio_streaming_endpoint_descriptor *sed = NULL; - const usb_endpoint_descriptor_audio_t *ed1 = NULL; + usb_endpoint_descriptor_audio_t *ed1 = NULL; const usb_endpoint_descriptor_audio_t *ed2 = NULL; struct usb_config_descriptor *cd = usbd_get_config_descriptor(udev); struct usb_interface_descriptor *id; @@ -999,6 +1039,13 @@ uaudio_chan_fill_info_sub(struct uaudio_ UAUDIO_MAX_CHAN(chan->p_asf1d->bNrChannels) * chan->p_asf1d->bBitResolution) / 8); + if (ep_dir == UE_DIR_IN && + usbd_get_speed(udev) == USB_SPEED_FULL) { + uaudio_record_fix_fs(ed1, + chan->sample_size * (rate / 1000), + chan->sample_size * (rate / 4000)); + } + if (sc->sc_sndstat_valid) { sbuf_printf(&sc->sc_sndstat, "\n\t" "mode %d.%d:(%s) %dch, %d/%dbit, %s, %dHz", Modified: projects/largeSMP/sys/netinet/tcp_subr.c ============================================================================== --- projects/largeSMP/sys/netinet/tcp_subr.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/netinet/tcp_subr.c Mon May 9 16:47:13 2011 (r221699) @@ -224,7 +224,6 @@ VNET_DEFINE(uma_zone_t, sack_hole_zone); VNET_DEFINE(struct hhook_head *, tcp_hhh[HHOOK_TCP_LAST+1]); static struct inpcb *tcp_notify(struct inpcb *, int); -static void tcp_isn_tick(void *); static char * tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr, const void *ip6hdr); @@ -255,7 +254,6 @@ static VNET_DEFINE(uma_zone_t, tcpcb_zon #define V_tcpcb_zone VNET(tcpcb_zone) MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers"); -struct callout isn_callout; static struct mtx isn_mtx; #define ISN_LOCK_INIT() mtx_init(&isn_mtx, "isn_mtx", NULL, MTX_DEF) @@ -358,8 +356,6 @@ tcp_init(void) #undef TCP_MINPROTOHDR ISN_LOCK_INIT(); - callout_init(&isn_callout, CALLOUT_MPSAFE); - callout_reset(&isn_callout, hz/100, tcp_isn_tick, NULL); EVENTHANDLER_REGISTER(shutdown_pre_sync, tcp_fini, NULL, SHUTDOWN_PRI_DEFAULT); EVENTHANDLER_REGISTER(maxsockets_change, tcp_zone_change, NULL, @@ -385,7 +381,6 @@ void tcp_fini(void *xtp) { - callout_stop(&isn_callout); } /* @@ -1571,11 +1566,13 @@ tcp6_ctlinput(int cmd, struct sockaddr * #define ISN_RANDOM_INCREMENT (4096 - 1) static VNET_DEFINE(u_char, isn_secret[32]); +static VNET_DEFINE(int, isn_last); static VNET_DEFINE(int, isn_last_reseed); static VNET_DEFINE(u_int32_t, isn_offset); static VNET_DEFINE(u_int32_t, isn_offset_old); #define V_isn_secret VNET(isn_secret) +#define V_isn_last VNET(isn_last) #define V_isn_last_reseed VNET(isn_last_reseed) #define V_isn_offset VNET(isn_offset) #define V_isn_offset_old VNET(isn_offset_old) @@ -1586,6 +1583,7 @@ tcp_new_isn(struct tcpcb *tp) MD5_CTX isn_ctx; u_int32_t md5_buffer[4]; tcp_seq new_isn; + u_int32_t projected_offset; INP_WLOCK_ASSERT(tp->t_inpcb); @@ -1621,38 +1619,17 @@ tcp_new_isn(struct tcpcb *tp) new_isn = (tcp_seq) md5_buffer[0]; V_isn_offset += ISN_STATIC_INCREMENT + (arc4random() & ISN_RANDOM_INCREMENT); - new_isn += V_isn_offset; - ISN_UNLOCK(); - return (new_isn); -} - -/* - * Increment the offset to the next ISN_BYTES_PER_SECOND / 100 boundary - * to keep time flowing at a relatively constant rate. If the random - * increments have already pushed us past the projected offset, do nothing. - */ -static void -tcp_isn_tick(void *xtp) -{ - VNET_ITERATOR_DECL(vnet_iter); - u_int32_t projected_offset; - - VNET_LIST_RLOCK_NOSLEEP(); - ISN_LOCK(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); /* XXX appease INVARIANTS */ - projected_offset = - V_isn_offset_old + ISN_BYTES_PER_SECOND / 100; - + if (ticks != V_isn_last) { + projected_offset = V_isn_offset_old + + ISN_BYTES_PER_SECOND / hz * (ticks - V_isn_last); if (SEQ_GT(projected_offset, V_isn_offset)) V_isn_offset = projected_offset; - V_isn_offset_old = V_isn_offset; - CURVNET_RESTORE(); + V_isn_last = ticks; } + new_isn += V_isn_offset; ISN_UNLOCK(); - VNET_LIST_RUNLOCK_NOSLEEP(); - callout_reset(&isn_callout, hz/100, tcp_isn_tick, NULL); + return (new_isn); } /* Modified: projects/largeSMP/sys/netipsec/key.c ============================================================================== --- projects/largeSMP/sys/netipsec/key.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/netipsec/key.c Mon May 9 16:47:13 2011 (r221699) @@ -2283,6 +2283,7 @@ key_spdget(so, m, mhp) } n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid); + KEY_FREESP(&sp); if (n != NULL) { m_freem(m); return key_sendup_mbuf(so, n, KEY_SENDUP_ONE); Modified: projects/largeSMP/sys/teken/teken.c ============================================================================== --- projects/largeSMP/sys/teken/teken.c Mon May 9 16:27:39 2011 (r221698) +++ projects/largeSMP/sys/teken/teken.c Mon May 9 16:47:13 2011 (r221699) @@ -32,7 +32,6 @@ #include #include #define teken_assert(x) MPASS(x) -#define teken_printf(x,...) #else /* !(__FreeBSD__ && _KERNEL) */ #include #include @@ -40,14 +39,11 @@ #include #include #define teken_assert(x) assert(x) -#define teken_printf(x,...) do { \ - if (df != NULL) \ - fprintf(df, x, ## __VA_ARGS__); \ -} while (0) -/* debug messages */ -static FILE *df; #endif /* __FreeBSD__ && _KERNEL */ +/* debug messages */ +#define teken_printf(x,...) + /* Private flags for t_stateflags. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Mon May 9 18:53:14 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09DC5106566C; Mon, 9 May 2011 18:53:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC7688FC16; Mon, 9 May 2011 18:53:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49IrD2H008974; Mon, 9 May 2011 18:53:13 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49IrDoe008959; Mon, 9 May 2011 18:53:13 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105091853.p49IrDoe008959@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 18:53:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221710 - in projects/largeSMP: contrib/top share/mk sys/amd64/include sys/dev/ath/ath_hal/ar5416 sys/dev/ath/ath_hal/ar9002 sys/dev/bxe sys/dev/syscons sys/i386/include sys/isa sys/pc9... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 18:53:14 -0000 Author: attilio Date: Mon May 9 18:53:13 2011 New Revision: 221710 URL: http://svn.freebsd.org/changeset/base/221710 Log: MFC Modified: projects/largeSMP/sys/amd64/include/clock.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h projects/largeSMP/sys/dev/bxe/if_bxe.c projects/largeSMP/sys/dev/bxe/if_bxe.h projects/largeSMP/sys/dev/syscons/syscons.c projects/largeSMP/sys/dev/syscons/syscons.h projects/largeSMP/sys/i386/include/clock.h projects/largeSMP/sys/isa/syscons_isa.c projects/largeSMP/sys/pc98/cbus/syscons_cbus.c projects/largeSMP/sys/x86/isa/clock.c projects/largeSMP/sys/x86/x86/tsc.c Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/sys/amd64/include/clock.h ============================================================================== --- projects/largeSMP/sys/amd64/include/clock.h Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/amd64/include/clock.h Mon May 9 18:53:13 2011 (r221710) @@ -29,7 +29,6 @@ void i8254_init(void); void startrtclock(void); void init_TSC(void); -void init_TSC_tc(void); #define HAS_TIMER_SPKR 1 int timer_spkr_acquire(void); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Mon May 9 18:53:13 2011 (r221710) @@ -1296,7 +1296,8 @@ ar5416InitChainMasks(struct ath_hal *ah) { int rx_chainmask = AH5416(ah)->ah_rx_chainmask; - if (rx_chainmask) + /* Flip this for this chainmask regardless of chip */ + if (rx_chainmask == 0x5) OS_REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP, AR_PHY_SWAP_ALT_CHAIN); /* Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Mon May 9 18:53:13 2011 (r221710) @@ -401,8 +401,9 @@ ar9285FillCapabilityInfo(struct ath_hal if (AR_SREV_KITE_12_OR_LATER(ah)) pCap->halPSPollBroken = AH_FALSE; + /* Only RX STBC supported */ pCap->halRxStbcSupport = 1; - pCap->halTxStbcSupport = 1; + pCap->halTxStbcSupport = 0; return AH_TRUE; } Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c Mon May 9 18:53:13 2011 (r221710) @@ -75,24 +75,30 @@ ar9285_antdiv_comb_conf_set(struct ath_h } /* - * Check whether antenna diversity should be enabled + * Check whether combined + fast antenna diversity should be enabled. + * + * This enables software-driven RX antenna diversity based on RX + * RSSI + antenna config packet sampling. */ -int +HAL_BOOL ar9285_check_div_comb(struct ath_hal *ah) { uint8_t ant_div_ctl1; HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; const MODAL_EEP4K_HEADER *pModal = &ee->ee_base.modalHeader; + /* For now, simply disable this until it's better debugged. -adrian */ + return AH_FALSE; + if (! AR_SREV_KITE(ah)) - return 0; + return AH_FALSE; if (pModal->version < 3) - return 0; + return AH_FALSE; ant_div_ctl1 = pModal->antdiv_ctl1; if ((ant_div_ctl1 & 0x1) && ((ant_div_ctl1 >> 3) & 0x1)) - return 1; + return AH_TRUE; - return 0; + return AH_FALSE; } Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h Mon May 9 18:53:13 2011 (r221710) @@ -41,6 +41,6 @@ extern void ar9285_antdiv_comb_conf_set( struct ar9285_antcomb_conf *antconf); extern void ar9285_antdiv_comb_conf_get(struct ath_hal *ah, struct ar9285_antcomb_conf *antconf); -extern int ar9285_check_div_comb(struct ath_hal *ah); +extern HAL_BOOL ar9285_check_div_comb(struct ath_hal *ah); #endif Modified: projects/largeSMP/sys/dev/bxe/if_bxe.c ============================================================================== --- projects/largeSMP/sys/dev/bxe/if_bxe.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/bxe/if_bxe.c Mon May 9 18:53:13 2011 (r221710) @@ -3323,7 +3323,7 @@ bxe_stop_locked(struct bxe_softc *sc, in bxe_set_mac_addr_e1(sc, 0); for (i = 0; i < config->hdr.length; i++) - CAM_INVALIDATE(config->config_table[i]); + CAM_INVALIDATE(&config->config_table[i]); config->hdr.length = i; config->hdr.offset = BXE_MAX_MULTICAST * (1 + port); @@ -14254,6 +14254,8 @@ static void bxe_set_mac_addr_e1(struct bxe_softc *sc, int set) { struct mac_configuration_cmd *config; + struct mac_configuration_entry *config_table; + uint8_t *eaddr; int port; DBENTER(BXE_VERBOSE_MISC); @@ -14274,43 +14276,40 @@ bxe_set_mac_addr_e1(struct bxe_softc *sc config->hdr.reserved1 = 0; /* Program the primary MAC address. */ - config->config_table[0].cam_entry.msb_mac_addr = - ntohs(*(uint16_t *)&sc->link_params.mac_addr[0]); - config->config_table[0].cam_entry.middle_mac_addr = - ntohs(*(uint16_t *)&sc->link_params.mac_addr[2]); - config->config_table[0].cam_entry.lsb_mac_addr = - ntohs(*(uint16_t *)&sc->link_params.mac_addr[4]); - config->config_table[0].cam_entry.flags = htole16(port); + config_table = &config->config_table[0]; + eaddr = sc->link_params.mac_addr; + config_table->cam_entry.msb_mac_addr = eaddr[0] << 8 | eaddr[1]; + config_table->cam_entry.middle_mac_addr = eaddr[2] << 8 | eaddr[3]; + config_table->cam_entry.lsb_mac_addr = eaddr[4] << 8 | eaddr[5]; + config_table->cam_entry.flags = htole16(port); if (set) - config->config_table[0].target_table_entry.flags = 0; + config_table->target_table_entry.flags = 0; else - CAM_INVALIDATE(config->config_table[0]); + CAM_INVALIDATE(config_table); - /* t48 config->config_table[0].target_table_entry.client_id = 0; */ - config->config_table[0].target_table_entry.vlan_id = 0; + config_table->target_table_entry.vlan_id = 0; DBPRINT(sc, BXE_VERBOSE, "%s(): %s MAC (%04x:%04x:%04x)\n", __FUNCTION__, (set ? "Setting" : "Clearing"), - config->config_table[0].cam_entry.msb_mac_addr, - config->config_table[0].cam_entry.middle_mac_addr, - config->config_table[0].cam_entry.lsb_mac_addr); + config_table->cam_entry.msb_mac_addr, + config_table->cam_entry.middle_mac_addr, + config_table->cam_entry.lsb_mac_addr); /* Program the broadcast MAC address. */ - config->config_table[1].cam_entry.msb_mac_addr = 0xffff; - config->config_table[1].cam_entry.middle_mac_addr = 0xffff; - config->config_table[1].cam_entry.lsb_mac_addr = 0xffff; - config->config_table[1].cam_entry.flags = htole16(port); + config_table = &config->config_table[1]; + config_table->cam_entry.msb_mac_addr = 0xffff; + config_table->cam_entry.middle_mac_addr = 0xffff; + config_table->cam_entry.lsb_mac_addr = 0xffff; + config_table->cam_entry.flags = htole16(port); if (set) - config->config_table[1].target_table_entry.flags = + config_table->target_table_entry.flags = TSTORM_CAM_TARGET_TABLE_ENTRY_BROADCAST; else - CAM_INVALIDATE(config->config_table[1]); - - /*t48 config->config_table[1].target_table_entry.client_id = 0; */ - config->config_table[1].target_table_entry.vlan_id = 0; + CAM_INVALIDATE(config_table); + config_table->target_table_entry.vlan_id = 0; /* Post the command to slow path queue. */ bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0, @@ -14330,6 +14329,8 @@ static void bxe_set_mac_addr_e1h(struct bxe_softc *sc, int set) { struct mac_configuration_cmd_e1h *config; + struct mac_configuration_entry_e1h *config_table; + uint8_t *eaddr; int func, port; DBENTER(BXE_VERBOSE_MISC); @@ -14356,30 +14357,27 @@ bxe_set_mac_addr_e1h(struct bxe_softc *s config->hdr.reserved1 = 0; /* Program the primary MAC address. */ - config->config_table[0].msb_mac_addr = - ntohs(*(uint16_t *)&sc->link_params.mac_addr[0]); - config->config_table[0].middle_mac_addr = - ntohs(*(uint16_t *)&sc->link_params.mac_addr[2]); - config->config_table[0].lsb_mac_addr = - ntohs(*(uint16_t *)&sc->link_params.mac_addr[4]); - config->config_table[0].clients_bit_vector = - htole32(1 << sc->fp->cl_id); + config_table = &config->config_table[0]; + eaddr = sc->link_params.mac_addr; + config_table->msb_mac_addr = eaddr[0] << 8 | eaddr[1]; + config_table->middle_mac_addr = eaddr[2] << 8 | eaddr[3]; + config_table->lsb_mac_addr = eaddr[4] << 8 | eaddr[5]; + config_table->clients_bit_vector = htole32(1 << sc->fp->cl_id); - config->config_table[0].vlan_id = 0; - config->config_table[0].e1hov_id = htole16(sc->e1hov); + config_table->vlan_id = 0; + config_table->e1hov_id = htole16(sc->e1hov); if (set) - config->config_table[0].flags = port; + config_table->flags = port; else - config->config_table[0].flags = + config_table->flags = MAC_CONFIGURATION_ENTRY_E1H_ACTION_TYPE; DBPRINT(sc, BXE_VERBOSE_MISC, "%s(): %s MAC (%04x:%04x:%04x), E1HOV = %d, CLID = %d\n", __FUNCTION__, (set ? "Setting" : "Clearing"), - config->config_table[0].msb_mac_addr, - config->config_table[0].middle_mac_addr, - config->config_table[0].lsb_mac_addr, sc->e1hov, BP_L_ID(sc)); + config_table->msb_mac_addr, config_table->middle_mac_addr, + config_table->lsb_mac_addr, sc->e1hov, BP_L_ID(sc)); bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0, U64_HI(BXE_SP_MAPPING(sc, mac_config)), @@ -14402,7 +14400,9 @@ bxe_set_rx_mode(struct bxe_softc *sc) struct ifnet *ifp; struct ifmultiaddr *ifma; struct mac_configuration_cmd *config; + struct mac_configuration_entry *config_table; uint32_t mc_filter[MC_HASH_SIZE]; + uint8_t *maddr; uint32_t crc, bit, regidx, rx_mode; int i, old, offset, port; @@ -14431,8 +14431,8 @@ bxe_set_rx_mode(struct bxe_softc *sc) /* Enable promiscuous mode. */ rx_mode = BXE_RX_MODE_PROMISC; - } else if ((ifp->if_flags & IFF_ALLMULTI) || - (ifp->if_amcount > BXE_MAX_MULTICAST)) { + } else if (ifp->if_flags & IFF_ALLMULTI || + ifp->if_amcount > BXE_MAX_MULTICAST) { DBPRINT(sc, BXE_VERBOSE_MISC, "%s(): Enabling all multicast mode.\n", __FUNCTION__); @@ -14453,28 +14453,28 @@ bxe_set_rx_mode(struct bxe_softc *sc) TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; - - config->config_table[i].cam_entry.msb_mac_addr = - bswap16(*(uint32_t *)(LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); - config->config_table[i].cam_entry.middle_mac_addr = - bswap16(*(uint16_t *)(LLADDR((struct sockaddr_dl *)ifma->ifma_addr) + 2)); - config->config_table[i].cam_entry.lsb_mac_addr = - bswap16(*(uint16_t *)(LLADDR((struct sockaddr_dl *)ifma->ifma_addr) + 4)); - - config->config_table[i].cam_entry.flags = htole16(port); - config->config_table[i].target_table_entry.flags = 0; - config->config_table[i].target_table_entry. - clients_bit_vector = htole32(1 << BP_L_ID(sc)); - config->config_table[i].target_table_entry.vlan_id = 0; - + maddr = (uint8_t *)LLADDR( + (struct sockaddr_dl *)ifma->ifma_addr); + config_table = &config->config_table[i]; + config_table->cam_entry.msb_mac_addr = + maddr[0] << 8 | maddr[1]; + config_table->cam_entry.middle_mac_addr = + maddr[2] << 8 | maddr[3]; + config_table->cam_entry.lsb_mac_addr = + maddr[4] << 8 | maddr[5]; + config_table->cam_entry.flags = htole16(port); + config_table->target_table_entry.flags = 0; + config_table->target_table_entry. + clients_bit_vector = + htole32(1 << BP_L_ID(sc)); + config_table->target_table_entry.vlan_id = 0; i++; - DBPRINT(sc, BXE_INFO, "%s(): Setting MCAST[%d] (%04X:%04X:%04X)\n", __FUNCTION__, i, - config->config_table[i].cam_entry.msb_mac_addr, - config->config_table[i].cam_entry.middle_mac_addr, - config->config_table[i].cam_entry.lsb_mac_addr); + config_table->cam_entry.msb_mac_addr, + config_table->cam_entry.middle_mac_addr, + config_table->cam_entry.lsb_mac_addr); } IF_ADDR_UNLOCK(ifp); @@ -14484,11 +14484,11 @@ bxe_set_rx_mode(struct bxe_softc *sc) /* Invalidate any extra MC entries in the CAM. */ if (old > i) { for (; i < old; i++) { - if (CAM_IS_INVALID( - config->config_table[i])) + config_table = &config->config_table[i]; + if (CAM_IS_INVALID(config_table)) break; /* Invalidate */ - CAM_INVALIDATE(config->config_table[i]); + CAM_INVALIDATE(config_table); } } @@ -14501,7 +14501,6 @@ bxe_set_rx_mode(struct bxe_softc *sc) bxe_sp_post(sc, RAMROD_CMD_ID_ETH_SET_MAC, 0, U64_HI(BXE_SP_MAPPING(sc, mcast_config)), U64_LO(BXE_SP_MAPPING(sc, mcast_config)), 0); - } else { /* E1H */ /* Accept one or more multicasts */ memset(mc_filter, 0, 4 * MC_HASH_SIZE); Modified: projects/largeSMP/sys/dev/bxe/if_bxe.h ============================================================================== --- projects/largeSMP/sys/dev/bxe/if_bxe.h Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/bxe/if_bxe.h Mon May 9 18:53:13 2011 (r221710) @@ -1773,11 +1773,11 @@ struct bxe_softc { USTORM_ETH_ST_CONTEXT_CONFIG_BD_SB_INDEX_NUMBER)) #define CAM_IS_INVALID(x) \ - (x.target_table_entry.flags == \ + ((x)->target_table_entry.flags == \ TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE) #define CAM_INVALIDATE(x) \ - (x.target_table_entry.flags = TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE) + ((x)->target_table_entry.flags = TSTORM_CAM_TARGET_TABLE_ENTRY_ACTION_TYPE) /* Number of uint32_t elements in multicast hash array. */ #define MC_HASH_SIZE 8 Modified: projects/largeSMP/sys/dev/syscons/syscons.c ============================================================================== --- projects/largeSMP/sys/dev/syscons/syscons.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/syscons/syscons.c Mon May 9 18:53:13 2011 (r221710) @@ -104,7 +104,8 @@ static scr_stat main_console; static struct tty *main_devs[MAXCONS]; static char init_done = COLD; -static char shutdown_in_progress = FALSE; +static int shutdown_in_progress = FALSE; +static int suspend_in_progress = FALSE; static char sc_malloc = FALSE; static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */ @@ -128,6 +129,13 @@ static void none_saver(sc_softc_t *sc, static void (*current_saver)(sc_softc_t *, int) = none_saver; #endif +#ifdef SC_NO_SUSPEND_VTYSWITCH +static int sc_no_suspend_vtswitch = 1; +#else +static int sc_no_suspend_vtswitch = 0; +#endif +static int sc_susp_scr; + SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons"); SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver"); SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW, @@ -142,6 +150,9 @@ SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_re SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW|CTLFLAG_SECURE, &enable_kdbkey, 0, "enable keyboard debug"); #endif +TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch); +SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW, + &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend."); #if !defined(SC_NO_FONT_LOADING) && defined(SC_DFLT_FONT) #include "font.h" #endif @@ -170,7 +181,9 @@ static kbd_callback_func_t sckbdevent; static void scinit(int unit, int flags); static scr_stat *sc_get_stat(struct tty *tp); static void scterm(int unit, int flags); -static void scshutdown(void *arg, int howto); +static void scshutdown(void *, int); +static void scsuspend(void *); +static void scresume(void *); static u_int scgetc(sc_softc_t *sc, u_int flags); #define SCGETC_CN 1 #define SCGETC_NONBLOCK 2 @@ -518,10 +531,15 @@ sc_attach_unit(int unit, int flags) printf("\n"); } - /* register a shutdown callback for the kernel console */ - if (sc_console_unit == unit) - EVENTHANDLER_REGISTER(shutdown_pre_sync, scshutdown, - (void *)(uintptr_t)unit, SHUTDOWN_PRI_DEFAULT); + /* Register suspend/resume/shutdown callbacks for the kernel console. */ + if (sc_console_unit == unit) { + EVENTHANDLER_REGISTER(power_suspend, scsuspend, NULL, + EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER(power_resume, scresume, NULL, + EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER(shutdown_pre_sync, scshutdown, NULL, + SHUTDOWN_PRI_DEFAULT); + } for (vc = 0; vc < sc->vtys; vc++) { if (sc->dev[vc] == NULL) { @@ -1718,7 +1736,7 @@ sccnupdate(scr_stat *scp) { /* this is a cut-down version of scrn_timer()... */ - if (scp->sc->suspend_in_progress || scp->sc->font_loading_in_progress) + if (suspend_in_progress || scp->sc->font_loading_in_progress) return; if (debugger > 0 || panicstr || shutdown_in_progress) { @@ -1768,7 +1786,7 @@ scrn_timer(void *arg) return; /* don't do anything when we are performing some I/O operations */ - if (sc->suspend_in_progress || sc->font_loading_in_progress) { + if (suspend_in_progress || sc->font_loading_in_progress) { if (again) timeout(scrn_timer, sc, hz / 10); return; @@ -3007,16 +3025,64 @@ scterm(int unit, int flags) } static void -scshutdown(void *arg, int howto) +scshutdown(__unused void *arg, __unused int howto) { - /* assert(sc_console != NULL) */ - sc_touch_scrn_saver(); - if (!cold && sc_console - && sc_console->sc->cur_scp->smode.mode == VT_AUTO - && sc_console->smode.mode == VT_AUTO) - sc_switch_scr(sc_console->sc, sc_console->index); - shutdown_in_progress = TRUE; + KASSERT(sc_console != NULL, ("sc_console != NULL")); + KASSERT(sc_console->sc != NULL, ("sc_console->sc != NULL")); + KASSERT(sc_console->sc->cur_scp != NULL, + ("sc_console->sc->cur_scp != NULL")); + + sc_touch_scrn_saver(); + if (!cold && + sc_console->sc->cur_scp->index != sc_console->index && + sc_console->sc->cur_scp->smode.mode == VT_AUTO && + sc_console->smode.mode == VT_AUTO) + sc_switch_scr(sc_console->sc, sc_console->index); + shutdown_in_progress = TRUE; +} + +static void +scsuspend(__unused void *arg) +{ + int retry; + + KASSERT(sc_console != NULL, ("sc_console != NULL")); + KASSERT(sc_console->sc != NULL, ("sc_console->sc != NULL")); + KASSERT(sc_console->sc->cur_scp != NULL, + ("sc_console->sc->cur_scp != NULL")); + + sc_susp_scr = sc_console->sc->cur_scp->index; + if (sc_no_suspend_vtswitch || + sc_susp_scr == sc_console->index) { + sc_touch_scrn_saver(); + sc_susp_scr = -1; + return; + } + for (retry = 0; retry < 10; retry++) { + sc_switch_scr(sc_console->sc, sc_console->index); + if (!sc_console->sc->switch_in_progress) + break; + pause("scsuspend", hz); + } + suspend_in_progress = TRUE; +} + +static void +scresume(__unused void *arg) +{ + + KASSERT(sc_console != NULL, ("sc_console != NULL")); + KASSERT(sc_console->sc != NULL, ("sc_console->sc != NULL")); + KASSERT(sc_console->sc->cur_scp != NULL, + ("sc_console->sc->cur_scp != NULL")); + + suspend_in_progress = FALSE; + if (sc_susp_scr < 0) { + mark_all(sc_console->sc->cur_scp); + return; + } + sc_switch_scr(sc_console->sc, sc_susp_scr); } int Modified: projects/largeSMP/sys/dev/syscons/syscons.h ============================================================================== --- projects/largeSMP/sys/dev/syscons/syscons.h Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/dev/syscons/syscons.h Mon May 9 18:53:13 2011 (r221710) @@ -230,7 +230,6 @@ typedef struct sc_softc { char switch_in_progress; char write_in_progress; char blink_in_progress; - char suspend_in_progress; struct mtx video_mtx; long scrn_time_stamp; Modified: projects/largeSMP/sys/i386/include/clock.h ============================================================================== --- projects/largeSMP/sys/i386/include/clock.h Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/i386/include/clock.h Mon May 9 18:53:13 2011 (r221710) @@ -30,7 +30,6 @@ void i8254_init(void); void startrtclock(void); void timer_restore(void); void init_TSC(void); -void init_TSC_tc(void); #define HAS_TIMER_SPKR 1 int timer_spkr_acquire(void); Modified: projects/largeSMP/sys/isa/syscons_isa.c ============================================================================== --- projects/largeSMP/sys/isa/syscons_isa.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/isa/syscons_isa.c Mon May 9 18:53:13 2011 (r221710) @@ -69,17 +69,6 @@ __FBSDID("$FreeBSD$"); static devclass_t sc_devclass; static sc_softc_t main_softc; -#ifdef SC_NO_SUSPEND_VTYSWITCH -static int sc_no_suspend_vtswitch = 1; -#else -static int sc_no_suspend_vtswitch = 0; -#endif -static int sc_cur_scr; - -TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch); -SYSCTL_DECL(_hw_syscons); -SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW, - &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend."); static void scidentify(driver_t *driver, device_t parent) @@ -108,53 +97,6 @@ scattach(device_t dev) SC_AUTODETECT_KBD)); } -static int -scsuspend(device_t dev) -{ - int retry = 10; - sc_softc_t *sc; - - sc = &main_softc; - - if (sc->cur_scp == NULL) - return (0); - - if (sc->suspend_in_progress == 0) { - sc_cur_scr = sc->cur_scp->index; - if (!sc_no_suspend_vtswitch && sc_cur_scr != 0) - do { - sc_switch_scr(sc, 0); - if (!sc->switch_in_progress) - break; - pause("scsuspend", hz); - } while (retry--); - } - sc->suspend_in_progress++; - - return (0); -} - -static int -scresume(device_t dev) -{ - sc_softc_t *sc; - - sc = &main_softc; - - if (sc->cur_scp == NULL) - return (0); - - sc->suspend_in_progress--; - if (sc->suspend_in_progress == 0) { - if (!sc_no_suspend_vtswitch && sc_cur_scr != 0) - sc_switch_scr(sc, sc_cur_scr); - else - mark_all(sc->cur_scp); - } - - return (0); -} - int sc_max_unit(void) { @@ -300,8 +242,6 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), - DEVMETHOD(device_suspend, scsuspend), - DEVMETHOD(device_resume, scresume), { 0, 0 } }; @@ -312,70 +252,3 @@ static driver_t sc_driver = { }; DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0); - -static devclass_t scpm_devclass; - -static void -scpm_identify(driver_t *driver, device_t parent) -{ - - device_add_child(parent, "scpm", 0); -} - -static int -scpm_probe(device_t dev) -{ - - device_set_desc(dev, SC_DRIVER_NAME " suspend/resume"); - device_quiet(dev); - - return (BUS_PROBE_DEFAULT); -} - -static int -scpm_attach(device_t dev) -{ - - bus_generic_probe(dev); - bus_generic_attach(dev); - - return (0); -} - -static int -scpm_suspend(device_t dev) -{ - int error; - - error = bus_generic_suspend(dev); - if (error != 0) - return (error); - - return (scsuspend(dev)); -} - -static int -scpm_resume(device_t dev) -{ - - scresume(dev); - - return (bus_generic_resume(dev)); -} - -static device_method_t scpm_methods[] = { - DEVMETHOD(device_identify, scpm_identify), - DEVMETHOD(device_probe, scpm_probe), - DEVMETHOD(device_attach, scpm_attach), - DEVMETHOD(device_suspend, scpm_suspend), - DEVMETHOD(device_resume, scpm_resume), - { 0, 0 } -}; - -static driver_t scpm_driver = { - "scpm", - scpm_methods, - 0 -}; - -DRIVER_MODULE(scpm, vgapm, scpm_driver, scpm_devclass, 0, 0); Modified: projects/largeSMP/sys/pc98/cbus/syscons_cbus.c ============================================================================== --- projects/largeSMP/sys/pc98/cbus/syscons_cbus.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/pc98/cbus/syscons_cbus.c Mon May 9 18:53:13 2011 (r221710) @@ -49,17 +49,6 @@ __FBSDID("$FreeBSD$"); static devclass_t sc_devclass; static sc_softc_t main_softc; -#ifdef SC_NO_SUSPEND_VTYSWITCH -static int sc_no_suspend_vtswitch = 1; -#else -static int sc_no_suspend_vtswitch = 0; -#endif -static int sc_cur_scr; - -TUNABLE_INT("hw.syscons.sc_no_suspend_vtswitch", &sc_no_suspend_vtswitch); -SYSCTL_DECL(_hw_syscons); -SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RW, - &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend."); static void scidentify(driver_t *driver, device_t parent) @@ -87,47 +76,6 @@ scattach(device_t dev) return sc_attach_unit(device_get_unit(dev), device_get_flags(dev)); } -static int -scsuspend(device_t dev) -{ - int retry = 10; - sc_softc_t *sc; - - sc = &main_softc; - - if (sc->cur_scp == NULL) - return (0); - - sc_cur_scr = sc->cur_scp->index; - - if (sc_no_suspend_vtswitch) - return (0); - - do { - sc_switch_scr(sc, 0); - if (!sc->switch_in_progress) { - break; - } - pause("scsuspend", hz); - } while (retry--); - - return (0); -} - -static int -scresume(device_t dev) -{ - sc_softc_t *sc; - - if (sc_no_suspend_vtswitch) - return (0); - - sc = &main_softc; - sc_switch_scr(sc, sc_cur_scr); - - return (0); -} - int sc_max_unit(void) { @@ -242,8 +190,6 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), - DEVMETHOD(device_suspend, scsuspend), - DEVMETHOD(device_resume, scresume), { 0, 0 } }; Modified: projects/largeSMP/sys/x86/isa/clock.c ============================================================================== --- projects/largeSMP/sys/x86/isa/clock.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/x86/isa/clock.c Mon May 9 18:53:13 2011 (r221710) @@ -498,7 +498,6 @@ void cpu_initclocks(void) { - init_TSC_tc(); cpu_initclocks_bsp(); } Modified: projects/largeSMP/sys/x86/x86/tsc.c ============================================================================== --- projects/largeSMP/sys/x86/x86/tsc.c Mon May 9 18:46:53 2011 (r221709) +++ projects/largeSMP/sys/x86/x86/tsc.c Mon May 9 18:53:13 2011 (r221710) @@ -326,7 +326,73 @@ init_TSC(void) tsc_levels_changed, NULL, EVENTHANDLER_PRI_ANY); } -void +#ifdef SMP + +#define TSC_READ(x) \ +static void \ +tsc_read_##x(void *arg) \ +{ \ + uint32_t *tsc = arg; \ + u_int cpu = PCPU_GET(cpuid); \ + \ + tsc[cpu * 3 + x] = rdtsc32(); \ +} +TSC_READ(0) +TSC_READ(1) +TSC_READ(2) +#undef TSC_READ + +#define N 1000 + +static void +comp_smp_tsc(void *arg) +{ + uint32_t *tsc; + int32_t d1, d2; + u_int cpu = PCPU_GET(cpuid); + u_int i, j, size; + + size = (mp_maxid + 1) * 3; + for (i = 0, tsc = arg; i < N; i++, tsc += size) + CPU_FOREACH(j) { + if (j == cpu) + continue; + d1 = tsc[cpu * 3 + 1] - tsc[j * 3]; + d2 = tsc[cpu * 3 + 2] - tsc[j * 3 + 1]; + if (d1 <= 0 || d2 <= 0) { + smp_tsc = 0; + return; + } + } +} + +static int +test_smp_tsc(void) +{ + uint32_t *data, *tsc; + u_int i, size; + + if (!smp_tsc && !tsc_is_invariant) + return (-100); + size = (mp_maxid + 1) * 3; + data = malloc(sizeof(*data) * size * N, M_TEMP, M_WAITOK); + for (i = 0, tsc = data; i < N; i++, tsc += size) + smp_rendezvous(tsc_read_0, tsc_read_1, tsc_read_2, tsc); + smp_tsc = 1; /* XXX */ + smp_rendezvous(smp_no_rendevous_barrier, comp_smp_tsc, + smp_no_rendevous_barrier, data); + free(data, M_TEMP); + if (bootverbose) + printf("SMP: %sed TSC synchronization test\n", + smp_tsc ? "pass" : "fail"); + return (smp_tsc ? 800 : -100); +} + +#undef N + +#endif /* SMP */ + +static void init_TSC_tc(void) { @@ -347,26 +413,25 @@ init_TSC_tc(void) tsc_timecounter.tc_quality = -1000; if (bootverbose) printf("TSC timecounter disabled: APM enabled.\n"); + goto init; } #ifdef SMP /* - * We can not use the TSC in SMP mode unless the TSCs on all CPUs - * are somehow synchronized. Some hardware configurations do - * this, but we have no way of determining whether this is the - * case, so we do not use the TSC in multi-processor systems - * unless the user indicated (by setting kern.timecounter.smp_tsc - * to 1) that he believes that his TSCs are synchronized. + * We can not use the TSC in SMP mode unless the TSCs on all CPUs are + * synchronized. If the user is sure that the system has synchronized + * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value. */ - if (mp_ncpus > 1 && !smp_tsc) - tsc_timecounter.tc_quality = -100; + if (smp_cpus > 1) + tsc_timecounter.tc_quality = test_smp_tsc(); #endif - +init: if (tsc_freq != 0) { tsc_timecounter.tc_frequency = tsc_freq; tc_init(&tsc_timecounter); } } +SYSINIT(tsc_tc, SI_SUB_SMP, SI_ORDER_ANY, init_TSC_tc, NULL); /* * When cpufreq levels change, find out about the (new) max frequency. We From owner-svn-src-projects@FreeBSD.ORG Mon May 9 22:13:07 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4F321065675; Mon, 9 May 2011 22:13:07 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A335E8FC16; Mon, 9 May 2011 22:13:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49MD7Lc015189; Mon, 9 May 2011 22:13:07 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49MD7rH015175; Mon, 9 May 2011 22:13:07 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105092213.p49MD7rH015175@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 22:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221716 - in projects/largeSMP: share/man/man4 sys/nfs sys/sys tools/build/options tools/regression/bin/sh/parser X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 22:13:07 -0000 Author: attilio Date: Mon May 9 22:13:07 2011 New Revision: 221716 URL: http://svn.freebsd.org/changeset/base/221716 Log: Fix by hand files that aren't added automatically by svn. BIG SUCKAGE! Added: projects/largeSMP/share/man/man4/geom_map.4 (contents, props changed) projects/largeSMP/sys/nfs/nfs_kdtrace.h (contents, props changed) projects/largeSMP/sys/sys/_stdint.h (contents, props changed) projects/largeSMP/tools/build/options/WITHOUT_GPIO projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 Added: projects/largeSMP/share/man/man4/geom_map.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/share/man/man4/geom_map.4 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,179 @@ +.\" +.\" Copyright (c) 2011 Aleksandr Rybalko +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 5, 2011 +.Dt GEOM_MAP 4 +.Os +.Sh NAME +.Nm geom_map +.Nd "GEOM module that map difined items as separate partitions" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device geom_map" +.Ed +.Sh DESCRIPTION +The +.Nm +framework provides support for mapping defined parts of the media. Basicaly it +is helpful in the embedded devices where in the one continous flash are loader, +kernel and rootfs parts. The +.Nm +allows making them available as separate parts and protect loader from +overwriting. +.Pp +At boot time +.Nm +partitions listed (only with bootverbose) as: +.Bd -literal -offset indent +MAP: 0x30000, data=0x30000 "/dev/map/bootloader" +MAP: 30000x10000, data=0x10000 "/dev/map/factory" +MAP: 40000x7a0000, data=0x7a0000 "/dev/map/upgrade" +MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 +MAP: 40000x110000, data=0x110000 "/dev/map/kernel" +MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 +MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" +MAP: 7e0000x20000, data=0x20000 "/dev/map/config" +.Ed +.Pp +Also +.Nm +current configuration can be accessible with sysctl's kern.geom.conftxt, +kern.geom.confxml, kern.geom.confdot or geom map list. +.Bd -literal -offset indent +# sysctl kern.geom.conftxt +kern.geom.conftxt: 0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc +0 DISK cfid0 8388608 4 hd 0 sc 0 +1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072 +1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280 +2 UNCOMPRESS map/rootfs.uncompress 18677760 512 +1 MAP map/kernel 1114112 4 i 3 o 262144 entry 0 dsize 1114112 +1 MAP map/upgrade 7995392 4 i 2 o 262144 entry 0 dsize 7995392 +1 MAP map/factory 65536 4 i 1 o 196608 entry 0 dsize 65536 +1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608 +.Ed +.Pp +Driver configuration can be done in device hints file. List of used parameters: +.Bl -tag -width indent +.It Fa at +select media to attach +.It Fa name +name of partiton (will create device /dev/map/that_name) +.It Fa start +offset from the beginning of the parent media to start of the mapped partition. +This field can also have special value +"search:searchstart:searchstep:searchkey", where: +.Bl -tag -width indent +.It Fa searchstart +offset from the beginning of the parent media where search will be started +.It Fa searchstep +value of the increment used while searching for the partition boundary markers +.It Fa searchkey +key which will be used to find partition boundary markers. Wildcard "." char +can be used to match any char on that position +.El +.It Fa end +offset from the beginning of the parent media to end of the mapped partition. +This field can also have special value +"search:searchstart:searchstep:searchkey", look "start" for details. +.It Fa offset +offset where the data of mapped partition begins +.El +.Pp +Each record contains start address(bytes) from the media begin, size(bytes), +offset where the data of mapped partition begins, and the name of new device. +.Bd -literal -offset indent +MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" +.Ed +.Bd -literal +00150000 - begin address +00690000 - size +00000000 - data begin from zero offset +00690000 - data size +"map/rootfs" - new media will be accessible via /dev/map/rootfs dev. +.Ed +.Sh EXAMPLES +.Pp +.Bl -bullet -compact +If we need to implement layout shown above, we need to define the folowing +hints: +.Bd -literal -offset indent +hint.map.0.at="cfid0" +hint.map.0.start=0x00000000 +hint.map.0.end=0x00030000 +hint.map.0.name="bootloader" +hint.map.0.readonly=1 + +.Ed +define "/dev/map/bootloader" at disk "cfid0" starting at 0x00000000 and end +0x00030000, also marked as readonly. +.Bd -literal -offset indent +hint.map.1.at="cfid0" +hint.map.1.start=0x00030000 +hint.map.1.end=0x00040000 +hint.map.1.name="factory" + +hint.map.2.at="cfid0" +hint.map.2.start=0x00040000 +hint.map.2.end=0x007e0000 +hint.map.2.name="upgrade" + +hint.map.3.at="cfid0" +hint.map.3.name="kernel" +hint.map.3.start=0x00040000 +hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh" + +.Ed +define "/dev/map/kernel" at disk "cfid0" starting at 0x00040000, but end +position must be searched by the key ".!/bin/sh", from offset 0x00100000 to end +of media with step 0x10000. Real marker in that case is "#!/bin/sh", but "#" +terminates the line when hints file is parsed, so we need to use wildcard "." +instead of "#". +.Bd -literal -offset indent +hint.map.4.at="cfid0" +hint.map.4.name="rootfs" +hint.map.4.start="search:0x00100000:0x10000:.!/bin/sh" +hint.map.4.end=0x007e0000 + +hint.map.5.at="cfid0" +hint.map.5.start=0x007e0000 +hint.map.5.end=0x00800000 +hint.map.5.name="config" +.Ed +.El +.Sh SEE ALSO +.Xr GEOM 4 , +.Xr geom 8 , +.Xr sysctl 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An "Aleksandr Rybalko" Aq ray@ddteam.net . Added: projects/largeSMP/sys/nfs/nfs_kdtrace.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/sys/nfs/nfs_kdtrace.h Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. + * + * This software was developed at the University of Cambridge Computer + * Laboratory with support from a grant from Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NFSCLIENT_NFS_KDTRACE_H_ +#define _NFSCLIENT_NFS_KDTRACE_H_ + +#ifdef KDTRACE_HOOKS +#include + +/* + * Definitions for NFS access cache probes. + */ +extern uint32_t nfsclient_accesscache_flush_done_id; +extern uint32_t nfsclient_accesscache_get_hit_id; +extern uint32_t nfsclient_accesscache_get_miss_id; +extern uint32_t nfsclient_accesscache_load_done_id; + +#define KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp) do { \ + if (dtrace_nfsclient_accesscache_flush_done_probe != NULL) \ + (dtrace_nfsclient_accesscache_flush_done_probe)( \ + nfsclient_accesscache_flush_done_id, (vp)); \ +} while (0) + +#define KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode) do { \ + if (dtrace_nfsclient_accesscache_get_hit_probe != NULL) \ + (dtrace_nfsclient_accesscache_get_hit_probe)( \ + nfsclient_accesscache_get_hit_id, (vp), (uid), \ + (mode)); \ +} while (0) + +#define KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode) do { \ + if (dtrace_nfsclient_accesscache_get_miss_probe != NULL) \ + (dtrace_nfsclient_accesscache_get_miss_probe)( \ + nfsclient_accesscache_get_miss_id, (vp), (uid), \ + (mode)); \ +} while (0) + +#define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) do { \ + if (dtrace_nfsclient_accesscache_load_done_probe != NULL) \ + (dtrace_nfsclient_accesscache_load_done_probe)( \ + nfsclient_accesscache_load_done_id, (vp), (uid), \ + (rmode), (error)); \ +} while (0) + +/* + * Definitions for NFS attribute cache probes. + */ +extern uint32_t nfsclient_attrcache_flush_done_id; +extern uint32_t nfsclient_attrcache_get_hit_id; +extern uint32_t nfsclient_attrcache_get_miss_id; +extern uint32_t nfsclient_attrcache_load_done_id; + +#define KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp) do { \ + if (dtrace_nfsclient_attrcache_flush_done_probe != NULL) \ + (dtrace_nfsclient_attrcache_flush_done_probe)( \ + nfsclient_attrcache_flush_done_id, (vp)); \ +} while (0) + +#define KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap) do { \ + if (dtrace_nfsclient_attrcache_get_hit_probe != NULL) \ + (dtrace_nfsclient_attrcache_get_hit_probe)( \ + nfsclient_attrcache_get_hit_id, (vp), (vap)); \ +} while (0) + +#define KDTRACE_NFS_ATTRCACHE_GET_MISS(vp) do { \ + if (dtrace_nfsclient_attrcache_get_miss_probe != NULL) \ + (dtrace_nfsclient_attrcache_get_miss_probe)( \ + nfsclient_attrcache_get_miss_id, (vp)); \ +} while (0) + +#define KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error) do { \ + if (dtrace_nfsclient_attrcache_load_done_probe != NULL) \ + (dtrace_nfsclient_attrcache_load_done_probe)( \ + nfsclient_attrcache_load_done_id, (vp), (vap), \ + (error)); \ +} while (0) + +#else /* !KDTRACE_HOOKS */ + +#define KDTRACE_NFS_ACCESSCACHE_FLUSH_DONE(vp) +#define KDTRACE_NFS_ACCESSCACHE_GET_HIT(vp, uid, mode) +#define KDTRACE_NFS_ACCESSCACHE_GET_MISS(vp, uid, mode) +#define KDTRACE_NFS_ACCESSCACHE_LOAD_DONE(vp, uid, rmode, error) + +#define KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp) +#define KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap) +#define KDTRACE_NFS_ATTRCACHE_GET_MISS(vp) +#define KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error) + +#endif /* KDTRACE_HOOKS */ + +#endif /* !_NFSCLIENT_NFS_KDTRACE_H_ */ Added: projects/largeSMP/sys/sys/_stdint.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/sys/sys/_stdint.h Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2011 David E. O'Brien + * Copyright (c) 2001 Mike Barcroft + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS__STDINT_H_ +#define _SYS__STDINT_H_ + +#ifndef _INT8_T_DECLARED +typedef __int8_t int8_t; +#define _INT8_T_DECLARED +#endif + +#ifndef _INT16_T_DECLARED +typedef __int16_t int16_t; +#define _INT16_T_DECLARED +#endif + +#ifndef _INT32_T_DECLARED +typedef __int32_t int32_t; +#define _INT32_T_DECLARED +#endif + +#ifndef _INT64_T_DECLARED +typedef __int64_t int64_t; +#define _INT64_T_DECLARED +#endif + +#ifndef _UINT8_T_DECLARED +typedef __uint8_t uint8_t; +#define _UINT8_T_DECLARED +#endif + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _UINT64_T_DECLARED +typedef __uint64_t uint64_t; +#define _UINT64_T_DECLARED +#endif + +#ifndef _INTPTR_T_DECLARED +typedef __intptr_t intptr_t; +#define _INTPTR_T_DECLARED +#endif +#ifndef _UINTPTR_T_DECLARED +typedef __uintptr_t uintptr_t; +#define _UINTPTR_T_DECLARED +#endif + +#endif /* !_SYS__STDINT_H_ */ Added: projects/largeSMP/tools/build/options/WITHOUT_GPIO ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/build/options/WITHOUT_GPIO Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,4 @@ +.\" $FreeBSD: head/tools/build/options/WITHOUT_GPIO 221541 2011-05-06 19:14:06Z ru $ +Set to not build +.Xr gpioctl 8 +as part of the base system. Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,12 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote1.0 221513 2011-05-05 20:55:55Z jilles $ + +set -e + +[ $'hi' = hi ] +[ $'hi +there' = 'hi +there' ] +[ $'\"\'\\\a\b\f\t\v' = "\"'\\$(printf "\a\b\f\t\v")" ] +[ $'hi\nthere' = 'hi +there' ] +[ $'a\rb' = "$(printf "a\rb")" ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,5 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote2.0 221513 2011-05-05 20:55:55Z jilles $ + +# This depends on the ASCII character set. + +[ $'\e' = "$(printf "\033")" ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,22 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote3.0 221513 2011-05-05 20:55:55Z jilles $ + +unset LC_ALL +LC_CTYPE=en_US.ISO8859-1 +export LC_CTYPE + +e= +for i in 0 1 2 3; do + for j in 0 1 2 3 4 5 6 7; do + for k in 0 1 2 3 4 5 6 7; do + case $i$j$k in + 000) continue ;; + esac + e="$e\\$i$j$k" + done + done +done +ee=`printf "$e"` +[ "${#ee}" = 255 ] || echo length bad + +# Start a new shell so the locale change is picked up. +[ "$(${SH} -c "printf %s \$'$e'")" = "$ee" ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,19 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote4.0 221513 2011-05-05 20:55:55Z jilles $ + +unset LC_ALL +LC_CTYPE=en_US.ISO8859-1 +export LC_CTYPE + +e= +for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do + for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do + case $i$j in + 00) continue ;; + esac + e="$e\x$i$j" + done +done + +# Start a new shell so the locale change is picked up. +ee="$(${SH} -c "printf %s \$'$e'")" +[ "${#ee}" = 255 ] || echo length bad Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,12 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote5.0 221513 2011-05-05 20:55:55Z jilles $ + +# This depends on the ASCII character set. + +set -e + +[ $'\ca\cb\cc\cd\ce\cf\cg\ch\ci\cj\ck\cl\cm\cn\co\cp\cq\cr\cs\ct\cu\cv\cw\cx\cy\cz' = $'\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032' ] +[ $'\cA\cB\cC\cD\cE\cF\cG\cH\cI\cJ\cK\cL\cM\cN\cO\cP\cQ\cR\cS\cT\cU\cV\cW\cX\cY\cZ' = $'\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032' ] +[ $'\c[' = $'\033' ] +[ $'\c]' = $'\035' ] +[ $'\c^' = $'\036' ] +[ $'\c_' = $'\037' ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,5 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote6.0 221513 2011-05-05 20:55:55Z jilles $ + +# This depends on the ASCII character set. + +[ $'\c\\' = $'\034' ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,6 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote7.0 221513 2011-05-05 20:55:55Z jilles $ + +set -e + +[ $'\u0024\u0040\u0060' = '$@`' ] +[ $'\U00000024\U00000040\U00000060' = '$@`' ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,11 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote8.0 221513 2011-05-05 20:55:55Z jilles $ + +[ $'hello\0' = hello ] +[ $'hello\0world' = hello ] +[ $'hello\0'$'world' = helloworld ] +[ $'hello\000' = hello ] +[ $'hello\000world' = hello ] +[ $'hello\000'$'world' = helloworld ] +[ $'hello\x00' = hello ] +[ $'hello\x00world' = hello ] +[ $'hello\x00'$'world' = helloworld ] Added: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 Mon May 9 22:13:07 2011 (r221716) @@ -0,0 +1,8 @@ +# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote9.0 221513 2011-05-05 20:55:55Z jilles $ + +# POSIX and C99 say D800-DFFF are undefined in a universal character name. +# We reject this but many other shells expand to something that looks like +# CESU-8. + +v=$( (eval ": \$'\uD800'") 2>&1 >/dev/null) +[ $? -ne 0 ] && [ -n "$v" ] From owner-svn-src-projects@FreeBSD.ORG Mon May 9 22:29:54 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B4411065676; Mon, 9 May 2011 22:29:54 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8A5658FC27; Mon, 9 May 2011 22:29:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p49MTshf015677; Mon, 9 May 2011 22:29:54 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p49MTsvg015662; Mon, 9 May 2011 22:29:54 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105092229.p49MTsvg015662@svn.freebsd.org> From: Attilio Rao Date: Mon, 9 May 2011 22:29:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221717 - in projects/largeSMP: contrib/less contrib/top share/mk sys/dev/bge sys/dev/mii sys/vm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2011 22:29:54 -0000 Author: attilio Date: Mon May 9 22:29:54 2011 New Revision: 221717 URL: http://svn.freebsd.org/changeset/base/221717 Log: MFC Modified: projects/largeSMP/contrib/less/LICENSE projects/largeSMP/contrib/less/Makefile.aut projects/largeSMP/contrib/less/Makefile.wnm projects/largeSMP/contrib/less/NEWS projects/largeSMP/contrib/less/README projects/largeSMP/contrib/less/brac.c projects/largeSMP/contrib/less/ch.c projects/largeSMP/contrib/less/charset.c projects/largeSMP/contrib/less/charset.h projects/largeSMP/contrib/less/cmd.h projects/largeSMP/contrib/less/cmdbuf.c projects/largeSMP/contrib/less/command.c projects/largeSMP/contrib/less/configure projects/largeSMP/contrib/less/configure.ac projects/largeSMP/contrib/less/cvt.c projects/largeSMP/contrib/less/decode.c projects/largeSMP/contrib/less/defines.ds projects/largeSMP/contrib/less/defines.h.in projects/largeSMP/contrib/less/defines.o2 projects/largeSMP/contrib/less/defines.o9 projects/largeSMP/contrib/less/defines.wn projects/largeSMP/contrib/less/edit.c projects/largeSMP/contrib/less/filename.c projects/largeSMP/contrib/less/forwback.c projects/largeSMP/contrib/less/funcs.h projects/largeSMP/contrib/less/help.c projects/largeSMP/contrib/less/ifile.c projects/largeSMP/contrib/less/input.c projects/largeSMP/contrib/less/jump.c projects/largeSMP/contrib/less/less.h projects/largeSMP/contrib/less/less.hlp projects/largeSMP/contrib/less/less.man projects/largeSMP/contrib/less/less.nro projects/largeSMP/contrib/less/lessecho.c projects/largeSMP/contrib/less/lessecho.man projects/largeSMP/contrib/less/lessecho.nro projects/largeSMP/contrib/less/lesskey.c projects/largeSMP/contrib/less/lesskey.h projects/largeSMP/contrib/less/lesskey.man projects/largeSMP/contrib/less/lesskey.nro projects/largeSMP/contrib/less/lglob.h projects/largeSMP/contrib/less/line.c projects/largeSMP/contrib/less/linenum.c projects/largeSMP/contrib/less/lsystem.c projects/largeSMP/contrib/less/main.c projects/largeSMP/contrib/less/mark.c projects/largeSMP/contrib/less/mkhelp.c projects/largeSMP/contrib/less/optfunc.c projects/largeSMP/contrib/less/option.c projects/largeSMP/contrib/less/option.h projects/largeSMP/contrib/less/opttbl.c projects/largeSMP/contrib/less/os.c projects/largeSMP/contrib/less/output.c projects/largeSMP/contrib/less/pattern.c projects/largeSMP/contrib/less/pattern.h projects/largeSMP/contrib/less/pckeys.h projects/largeSMP/contrib/less/position.c projects/largeSMP/contrib/less/position.h projects/largeSMP/contrib/less/prompt.c projects/largeSMP/contrib/less/screen.c projects/largeSMP/contrib/less/scrsize.c projects/largeSMP/contrib/less/search.c projects/largeSMP/contrib/less/signal.c projects/largeSMP/contrib/less/tags.c projects/largeSMP/contrib/less/ttyin.c projects/largeSMP/contrib/less/version.c projects/largeSMP/sys/dev/bge/if_bge.c projects/largeSMP/sys/dev/mii/brgphy.c projects/largeSMP/sys/dev/mii/miidevs projects/largeSMP/sys/vm/vm_object.c Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/contrib/less/LICENSE ============================================================================== --- projects/largeSMP/contrib/less/LICENSE Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/LICENSE Mon May 9 22:29:54 2011 (r221717) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2009 Mark Nudelman +Copyright (C) 1984-2011 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: projects/largeSMP/contrib/less/Makefile.aut ============================================================================== --- projects/largeSMP/contrib/less/Makefile.aut Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/Makefile.aut Mon May 9 22:29:54 2011 (r221717) @@ -34,6 +34,14 @@ DISTFILES = \ all: help.c funcs.h ${srcdir}/configure +release: .FORCE + ${MAKE} -f Makefile.aut tagall + ${MAKE} -f Makefile.aut all + ${MAKE} -f Makefile.aut clean + ${MAKE} -f Makefile.aut dist + +.FORCE: + help.c: less.hlp mkhelp -mv -f ${srcdir}/help.c ${srcdir}/help.c.old rm -rf help.c Modified: projects/largeSMP/contrib/less/Makefile.wnm ============================================================================== --- projects/largeSMP/contrib/less/Makefile.wnm Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/Makefile.wnm Mon May 9 22:29:54 2011 (r221717) @@ -7,11 +7,11 @@ CC = cl # Normal flags CFLAGS = /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c -LDFLAGS = /subsystem:console /incremental:no /machine:I386 +LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386 # Debugging flags #CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c -#LDFLAGS = /subsystem:console /incremental:yes /debug /machine:I386 +#LDFLAGS = /nologo /subsystem:console /incremental:yes /debug /machine:I386 LD = link LIBS = user32.lib Modified: projects/largeSMP/contrib/less/NEWS ============================================================================== --- projects/largeSMP/contrib/less/NEWS Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/NEWS Mon May 9 22:29:54 2011 (r221717) @@ -12,6 +12,37 @@ ====================================================================== + Major changes between "less" versions 436 and 443 + +* Change search behavior such that when a search is given an explicit + pattern, the entire displayed screen is included in the search and + not just the portion after the target line. + +* Add -A option to change search behavior to the old way: only + the portion of the screen after the target line is searched. + +* Add %F formatting to prompt strings, replaced by the last component + of the input file. + +* Control-G while editing a command exits the command. + +* Less now exits with status 2 if control-C is pressed and -K is in effect. + +* Fix "ungetc overflow" when passing long commands via the -p option. + +* Fix bug in using line filtering via the & command + in combination with -i and -I. + +* Fix bug in handling negative arguments to the -j option. + +* Fix bug in handling %t in prompt strings. + +* Improve handling of long option names. + +* Improve percentage calculation for very large files. + +====================================================================== + Major changes between "less" versions 429 and 436 * Don't pass "-" to non-pipe LESSOPEN unless it starts with "-". Modified: projects/largeSMP/contrib/less/README ============================================================================== --- projects/largeSMP/contrib/less/README Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/README Mon May 9 22:29:54 2011 (r221717) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 436 + Less, version 443 - This is the distribution of less, version 436, released 07 Jul 2009. + This is the distribution of less, version 443, released 09 Apr 2011. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -101,6 +101,10 @@ complaints, etc., you may mail to the au Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. +(Note that the above note was originally written at a time when +"hackers" most commonly meant "enthusiastic and dedicated computer +programmers", not "persons who attempt to circumvent computer security".) + ======================================================================= Modified: projects/largeSMP/contrib/less/brac.c ============================================================================== --- projects/largeSMP/contrib/less/brac.c Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/brac.c Mon May 9 22:29:54 2011 (r221717) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2009 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: projects/largeSMP/contrib/less/ch.c ============================================================================== --- projects/largeSMP/contrib/less/ch.c Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/ch.c Mon May 9 22:29:54 2011 (r221717) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2009 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: projects/largeSMP/contrib/less/charset.c ============================================================================== --- projects/largeSMP/contrib/less/charset.c Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/charset.c Mon May 9 22:29:54 2011 (r221717) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2009 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -395,7 +395,7 @@ init_charset() binary_char(c) LWCHAR c; { - if (utf_mode) + if (utf_mode) return (is_ubin_char(c)); c &= 0377; return (chardef[c] & IS_BINARY_CHAR); @@ -817,7 +817,7 @@ static struct wchar_range ubin_table[] = { 0x000B, 0x000C} /* Cc */, { 0x000E, 0x001A} /* Cc */, { 0x001C, 0x001F} /* Cc */, - { 0x007F, 0x009F} /* Cc */, + { 0x007F, 0x009F} /* Cc */, #if 0 { 0x00AD, 0x00AD} /* Cf */, #endif Modified: projects/largeSMP/contrib/less/charset.h ============================================================================== --- projects/largeSMP/contrib/less/charset.h Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/charset.h Mon May 9 22:29:54 2011 (r221717) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2009 Mark Nudelman + * Copyright (C) 2005-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: projects/largeSMP/contrib/less/cmd.h ============================================================================== --- projects/largeSMP/contrib/less/cmd.h Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/cmd.h Mon May 9 22:29:54 2011 (r221717) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2009 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -98,6 +98,7 @@ #define EC_F_COMPLETE 17 #define EC_B_COMPLETE 18 #define EC_LITERAL 19 +#define EC_ABORT 20 #define EC_NOACTION 101 #define EC_UINVALID 102 Modified: projects/largeSMP/contrib/less/cmdbuf.c ============================================================================== --- projects/largeSMP/contrib/less/cmdbuf.c Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/cmdbuf.c Mon May 9 22:29:54 2011 (r221717) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2009 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -857,6 +857,10 @@ cmd_edit(c) case EC_LINEKILL: not_in_completion(); return (cmd_kill()); + case EC_ABORT: + not_in_completion(); + (void) cmd_kill(); + return (CC_QUIT); case EC_W_BACKSPACE: not_in_completion(); return (cmd_werase()); Modified: projects/largeSMP/contrib/less/command.c ============================================================================== --- projects/largeSMP/contrib/less/command.c Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/command.c Mon May 9 22:29:54 2011 (r221717) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2009 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -57,8 +57,6 @@ extern int shift_count; extern int oldbot; extern int forw_prompt; -static char ungot[UNGOT_SIZE]; -static char *ungotp = NULL; #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ #endif @@ -66,7 +64,8 @@ static int mca; /* The multicharacter static int search_type; /* The previous type of search */ static LINENUM number; /* The number typed by the user */ static long fraction; /* The fractional part of the number */ -static char optchar; +static struct loption *curropt; +static int opt_lower; static int optflag; static int optgetname; static POSITION bottompos; @@ -75,6 +74,13 @@ static int save_hshift; static char pipec; #endif +struct ungot { + struct ungot *ug_next; + char ug_char; +}; +static struct ungot* ungot = NULL; +static int unget_end = 0; + static void multi_search(); /* @@ -228,8 +234,8 @@ exec_mca() every_first_cmd = save(cbuf); break; case A_OPT_TOGGLE: - toggle_option(optchar, cbuf, optflag); - optchar = '\0'; + toggle_option(curropt, opt_lower, cbuf, optflag); + curropt = NULL; break; case A_F_BRACKET: match_brac(cbuf[0], cbuf[1], 1, (int) number); @@ -282,22 +288,254 @@ exec_mca() } /* - * Add a character to a multi-character command. + * Is a character an erase or kill char? */ static int -mca_char(c) +is_erase_char(c) + int c; +{ + return (c == erase_char || c == erase2_char || c == kill_char); +} + +/* + * Handle the first char of an option (after the initial dash). + */ + static int +mca_opt_first_char(c) + int c; +{ + int flag = (optflag & ~OPT_NO_PROMPT); + if (flag == OPT_NO_TOGGLE) + { + switch (c) + { + case '_': + /* "__" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } else + { + switch (c) + { + case '+': + /* "-+" = UNSET. */ + optflag = (flag == OPT_UNSET) ? + OPT_TOGGLE : OPT_UNSET; + mca_opt_toggle(); + return (MCA_MORE); + case '!': + /* "-!" = SET */ + optflag = (flag == OPT_SET) ? + OPT_TOGGLE : OPT_SET; + mca_opt_toggle(); + return (MCA_MORE); + case CONTROL('P'): + optflag ^= OPT_NO_PROMPT; + mca_opt_toggle(); + return (MCA_MORE); + case '-': + /* "--" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } + /* Char was not handled here. */ + return (NO_MCA); +} + +/* + * Add a char to a long option name. + * See if we've got a match for an option name yet. + * If so, display the complete name and stop + * accepting chars until user hits RETURN. + */ + static int +mca_opt_nonfirst_char(c) int c; { char *p; - int flag; - char buf[3]; + char *oname; + + if (curropt != NULL) + { + /* + * Already have a match for the name. + * Don't accept anything but erase/kill. + */ + if (is_erase_char(c)) + return (MCA_DONE); + return (MCA_MORE); + } + /* + * Add char to cmd buffer and try to match + * the option name. + */ + if (cmd_char(c) == CC_QUIT) + return (MCA_DONE); + p = get_cmdbuf(); + opt_lower = ASCII_IS_LOWER(p[0]); + curropt = findopt_name(&p, &oname, NULL); + if (curropt != NULL) + { + /* + * Got a match. + * Remember the option and + * display the full option name. + */ + cmd_reset(); + mca_opt_toggle(); + for (p = oname; *p != '\0'; p++) + { + c = *p; + if (!opt_lower && ASCII_IS_LOWER(c)) + c = ASCII_TO_UPPER(c); + if (cmd_char(c) != CC_OK) + return (MCA_DONE); + } + } + return (MCA_MORE); +} + +/* + * Handle a char of an option toggle command. + */ + static int +mca_opt_char(c) + int c; +{ PARG parg; + /* + * This may be a short option (single char), + * or one char of a long option name, + * or one char of the option parameter. + */ + if (curropt == NULL && len_cmdbuf() == 0) + { + int ret = mca_opt_first_char(c); + if (ret != NO_MCA) + return (ret); + } + if (optgetname) + { + /* We're getting a long option name. */ + if (c != '\n' && c != '\r') + return (mca_opt_nonfirst_char(c)); + if (curropt == NULL) + { + parg.p_string = get_cmdbuf(); + error("There is no --%s option", &parg); + return (MCA_DONE); + } + optgetname = FALSE; + cmd_reset(); + } else + { + if (is_erase_char(c)) + return (NO_MCA); + if (curropt != NULL) + /* We're getting the option parameter. */ + return (NO_MCA); + curropt = findopt(c); + if (curropt == NULL) + { + parg.p_string = propt(c); + error("There is no %s option", &parg); + return (MCA_DONE); + } + } + /* + * If the option which was entered does not take a + * parameter, toggle the option immediately, + * so user doesn't have to hit RETURN. + */ + if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || + !opt_has_param(curropt)) + { + toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + return (MCA_DONE); + } + /* + * Display a prompt appropriate for the option parameter. + */ + start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0); + return (MCA_MORE); +} + +/* + * Handle a char of a search command. + */ + static int +mca_search_char(c) + int c; +{ + int flag = 0; + + /* + * Certain characters as the first char of + * the pattern have special meaning: + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag + * @ Toggle the FIRST_FILE flag + */ + if (len_cmdbuf() > 0) + return (NO_MCA); + + switch (c) + { + case '*': + if (less_is_more) + break; + case CONTROL('E'): /* ignore END of file */ + if (mca != A_FILTER) + flag = SRCH_PAST_EOF; + break; + case '@': + if (less_is_more) + break; + case CONTROL('F'): /* FIRST file */ + if (mca != A_FILTER) + flag = SRCH_FIRST_FILE; + break; + case CONTROL('K'): /* KEEP position */ + if (mca != A_FILTER) + flag = SRCH_NO_MOVE; + break; + case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ + flag = SRCH_NO_REGEX; + break; + case CONTROL('N'): /* NOT match */ + case '!': + flag = SRCH_NO_MATCH; + break; + } + + if (flag != 0) + { + search_type ^= flag; + mca_search(); + return (MCA_MORE); + } + return (NO_MCA); +} + +/* + * Handle a character of a multi-character command. + */ + static int +mca_char(c) + int c; +{ + int ret; + switch (mca) { case 0: /* - * Not in a multicharacter command. + * We're not in a multicharacter command. */ return (NO_MCA); @@ -320,7 +558,8 @@ mca_char(c) { /* * Not part of the number. - * Treat as a normal command character. + * End the number and treat this char + * as a normal command character. */ number = cmd_int(&fraction); mca = 0; @@ -330,218 +569,26 @@ mca_char(c) break; case A_OPT_TOGGLE: - /* - * Special case for the TOGGLE_OPTION command. - * If the option letter which was entered is a - * single-char option, execute the command immediately, - * so user doesn't have to hit RETURN. - * If the first char is + or -, this indicates - * OPT_UNSET or OPT_SET respectively, instead of OPT_TOGGLE. - * "--" begins inputting a long option name. - */ - if (optchar == '\0' && len_cmdbuf() == 0) - { - flag = (optflag & ~OPT_NO_PROMPT); - if (flag == OPT_NO_TOGGLE) - { - switch (c) - { - case '_': - /* "__" = long option name. */ - optgetname = TRUE; - mca_opt_toggle(); - return (MCA_MORE); - } - } else - { - switch (c) - { - case '+': - /* "-+" = UNSET. */ - optflag = (flag == OPT_UNSET) ? - OPT_TOGGLE : OPT_UNSET; - mca_opt_toggle(); - return (MCA_MORE); - case '!': - /* "-!" = SET */ - optflag = (flag == OPT_SET) ? - OPT_TOGGLE : OPT_SET; - mca_opt_toggle(); - return (MCA_MORE); - case CONTROL('P'): - optflag ^= OPT_NO_PROMPT; - mca_opt_toggle(); - return (MCA_MORE); - case '-': - /* "--" = long option name. */ - optgetname = TRUE; - mca_opt_toggle(); - return (MCA_MORE); - } - } - } - if (optgetname) - { - /* - * We're getting a long option name. - * See if we've matched an option name yet. - * If so, display the complete name and stop - * accepting chars until user hits RETURN. - */ - struct loption *o; - char *oname; - int lc; - - if (c == '\n' || c == '\r') - { - /* - * When the user hits RETURN, make sure - * we've matched an option name, then - * pretend he just entered the equivalent - * option letter. - */ - if (optchar == '\0') - { - parg.p_string = get_cmdbuf(); - error("There is no --%s option", &parg); - return (MCA_DONE); - } - optgetname = FALSE; - cmd_reset(); - c = optchar; - } else - { - if (optchar != '\0') - { - /* - * Already have a match for the name. - * Don't accept anything but erase/kill. - */ - if (c == erase_char || - c == erase2_char || - c == kill_char) - return (MCA_DONE); - return (MCA_MORE); - } - /* - * Add char to cmd buffer and try to match - * the option name. - */ - if (cmd_char(c) == CC_QUIT) - return (MCA_DONE); - p = get_cmdbuf(); - lc = ASCII_IS_LOWER(p[0]); - o = findopt_name(&p, &oname, NULL); - if (o != NULL) - { - /* - * Got a match. - * Remember the option letter and - * display the full option name. - */ - optchar = o->oletter; - if (!lc && ASCII_IS_LOWER(optchar)) - optchar = ASCII_TO_UPPER(optchar); - cmd_reset(); - mca_opt_toggle(); - for (p = oname; *p != '\0'; p++) - { - c = *p; - if (!lc && ASCII_IS_LOWER(c)) - c = ASCII_TO_UPPER(c); - if (cmd_char(c) != CC_OK) - return (MCA_DONE); - } - } - return (MCA_MORE); - } - } else - { - if (c == erase_char || c == erase2_char || c == kill_char) - break; - if (optchar != '\0') - /* We already have the option letter. */ - break; - } - - optchar = c; - if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || - single_char_option(c)) - { - toggle_option(c, "", optflag); - return (MCA_DONE); - } - /* - * Display a prompt appropriate for the option letter. - */ - if ((p = opt_prompt(c)) == NULL) - { - buf[0] = '-'; - buf[1] = c; - buf[2] = '\0'; - p = buf; - } - start_mca(A_OPT_TOGGLE, p, (void*)NULL, 0); - return (MCA_MORE); + ret = mca_opt_char(c); + if (ret != NO_MCA) + return (ret); + break; case A_F_SEARCH: case A_B_SEARCH: case A_FILTER: - /* - * Special case for search commands. - * Certain characters as the first char of - * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag - * @ Toggle the FIRST_FILE flag - */ - if (len_cmdbuf() > 0) - /* - * Only works for the first char of the pattern. - */ - break; + ret = mca_search_char(c); + if (ret != NO_MCA) + return (ret); + break; - flag = 0; - switch (c) - { - case '*': - if (less_is_more) - break; - case CONTROL('E'): /* ignore END of file */ - if (mca != A_FILTER) - flag = SRCH_PAST_EOF; - break; - case '@': - if (less_is_more) - break; - case CONTROL('F'): /* FIRST file */ - if (mca != A_FILTER) - flag = SRCH_FIRST_FILE; - break; - case CONTROL('K'): /* KEEP position */ - if (mca != A_FILTER) - flag = SRCH_NO_MOVE; - break; - case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ - flag = SRCH_NO_REGEX; - break; - case CONTROL('N'): /* NOT match */ - case '!': - flag = SRCH_NO_MATCH; - break; - } - if (flag != 0) - { - search_type ^= flag; - mca_search(); - return (MCA_MORE); - } + default: + /* Other multicharacter command. */ break; } /* - * Any other multicharacter command - * is terminated by a newline. + * The multichar command is terminated by a newline. */ if (c == '\n' || c == '\r') { @@ -641,7 +688,7 @@ prompt() { register char *p; - if (ungotp != NULL && ungotp > ungot) + if (ungot != NULL) { /* * No prompt necessary if commands are from @@ -731,48 +778,59 @@ dispversion() public int getcc() { - if (ungotp == NULL) + if (unget_end) + { /* - * Normal case: no ungotten chars, so get one from the user. + * We have just run out of ungotten chars. */ - return (getchr()); - - if (ungotp > ungot) + unget_end = 0; + if (len_cmdbuf() == 0 || !empty_screen()) + return (getchr()); /* - * Return the next ungotten char. + * Command is incomplete, so try to complete it. */ - return (*--ungotp); + switch (mca) + { + case A_DIGIT: + /* + * We have a number but no command. Treat as #g. + */ + return ('g'); - /* - * We have just run out of ungotten chars. - */ - ungotp = NULL; - if (len_cmdbuf() == 0 || !empty_screen()) - return (getchr()); - /* - * Command is incomplete, so try to complete it. - */ - switch (mca) - { - case A_DIGIT: - /* - * We have a number but no command. Treat as #g. - */ - return ('g'); + case A_F_SEARCH: + case A_B_SEARCH: + /* + * We have "/string" but no newline. Add the \n. + */ + return ('\n'); - case A_F_SEARCH: - case A_B_SEARCH: - /* - * We have "/string" but no newline. Add the \n. - */ - return ('\n'); + default: + /* + * Some other incomplete command. Let user complete it. + */ + return (getchr()); + } + } - default: + if (ungot == NULL) + { /* - * Some other incomplete command. Let user complete it. + * Normal case: no ungotten chars, so get one from the user. */ return (getchr()); } + + /* + * Return the next ungotten char. + */ + { + struct ungot *ug = ungot; + char c = ug->ug_char; + ungot = ug->ug_next; + free(ug); + unget_end = (ungot == NULL); + return (c); + } } /* @@ -783,14 +841,11 @@ getcc() ungetcc(c) int c; { - if (ungotp == NULL) - ungotp = ungot; - if (ungotp >= ungot + sizeof(ungot)) - { - error("ungetcc overflow", NULL_PARG); - quit(QUIT_ERROR); - } - *ungotp++ = c; + struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot)); + + ug->ug_char = c; + ug->ug_next = ungot; + ungot = ug; } /* @@ -933,7 +988,7 @@ commands() mca = 0; cmd_accept(); number = 0; - optchar = '\0'; + curropt = NULL; /* * See if any signals need processing. Modified: projects/largeSMP/contrib/less/configure ============================================================================== --- projects/largeSMP/contrib/less/configure Mon May 9 22:13:07 2011 (r221716) +++ projects/largeSMP/contrib/less/configure Mon May 9 22:29:54 2011 (r221717) @@ -1,18 +1,22 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for less 1. +# Generated by GNU Autoconf 2.67 for less 1. +# # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -20,23 +24,15 @@ if test -n "${ZSH_VERSION+set}" && (emul alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; esac - fi - - -# PATH needs CR -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_nl=' ' export as_nl @@ -44,7 +40,13 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -55,7 +57,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in + case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -78,13 +80,6 @@ if test "${PATH_SEPARATOR+set}" != set; } fi -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -94,15 +89,15 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -case $0 in +case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done IFS=$as_save_IFS ;; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Tue May 10 13:48:21 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E45401065787; Tue, 10 May 2011 13:48:21 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D45408FC0C; Tue, 10 May 2011 13:48:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ADmLam046540; Tue, 10 May 2011 13:48:21 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ADmLsD046538; Tue, 10 May 2011 13:48:21 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105101348.p4ADmLsD046538@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 May 2011 13:48:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221735 - projects/largeSMP/sys/powerpc/powerpc X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 13:48:22 -0000 Author: attilio Date: Tue May 10 13:48:21 2011 New Revision: 221735 URL: http://svn.freebsd.org/changeset/base/221735 Log: Make the intended change. Modified: projects/largeSMP/sys/powerpc/powerpc/openpic.c Modified: projects/largeSMP/sys/powerpc/powerpc/openpic.c ============================================================================== --- projects/largeSMP/sys/powerpc/powerpc/openpic.c Tue May 10 13:25:42 2011 (r221734) +++ projects/largeSMP/sys/powerpc/powerpc/openpic.c Tue May 10 13:48:21 2011 (r221735) @@ -245,7 +245,7 @@ openpic_bind(device_t dev, u_int irq, cp * XXX: openpic_write() is very special and just needs a 32 bits mask. * For the moment, just play dirty and get the first half word. */ - openpic_write(sc, OPENPIC_IDEST(irq), (long)cpumask & 0xffffffff); + openpic_write(sc, OPENPIC_IDEST(irq), cpumask.__bits[0] & 0xffffffff); } void From owner-svn-src-projects@FreeBSD.ORG Tue May 10 13:49:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6E701065672; Tue, 10 May 2011 13:49:34 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D6EE98FC18; Tue, 10 May 2011 13:49:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ADnYcY046608; Tue, 10 May 2011 13:49:34 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ADnYaO046606; Tue, 10 May 2011 13:49:34 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105101349.p4ADnYaO046606@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 May 2011 13:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221736 - projects/largeSMP/usr.sbin/pmccontrol X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 13:49:35 -0000 Author: attilio Date: Tue May 10 13:49:34 2011 New Revision: 221736 URL: http://svn.freebsd.org/changeset/base/221736 Log: Avoid breaking strict-aliasing. Modified: projects/largeSMP/usr.sbin/pmccontrol/pmccontrol.c Modified: projects/largeSMP/usr.sbin/pmccontrol/pmccontrol.c ============================================================================== --- projects/largeSMP/usr.sbin/pmccontrol/pmccontrol.c Tue May 10 13:48:21 2011 (r221735) +++ projects/largeSMP/usr.sbin/pmccontrol/pmccontrol.c Tue May 10 13:49:34 2011 (r221736) @@ -141,6 +141,7 @@ pmcc_do_enable_disable(struct pmcc_op_li unsigned char *map; unsigned char op; int cpu, pmc; + size_t setsize; if ((ncpu = pmc_ncpu()) < 0) err(EX_OSERR, "Unable to determine the number of cpus"); @@ -152,8 +153,9 @@ pmcc_do_enable_disable(struct pmcc_op_li "halted"); } CPU_ZERO(&haltedcpus); + setsize = (size_t)cpusetsize; if (ncpu > 1 && sysctlbyname("machdep.hlt_cpus", &haltedcpus, - (size_t *)&cpusetsize, NULL, 0) < 0) + &setsize, NULL, 0) < 0) err(EX_OSERR, "ERROR: Cannot determine which CPUs are " "halted"); CPU_FILL(&cpumask); From owner-svn-src-projects@FreeBSD.ORG Tue May 10 13:59:33 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E44B1065672; Tue, 10 May 2011 13:59:33 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4DC978FC15; Tue, 10 May 2011 13:59:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ADxXbN046937; Tue, 10 May 2011 13:59:33 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ADxX71046935; Tue, 10 May 2011 13:59:33 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105101359.p4ADxX71046935@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 May 2011 13:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221737 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 13:59:33 -0000 Author: attilio Date: Tue May 10 13:59:33 2011 New Revision: 221737 URL: http://svn.freebsd.org/changeset/base/221737 Log: Remove strict-aliasing fixup where it is easy to avoid that as it leads to a faster implementation. Requested by: bde Modified: projects/largeSMP/sys/powerpc/include/atomic.h Modified: projects/largeSMP/sys/powerpc/include/atomic.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/atomic.h Tue May 10 13:49:34 2011 (r221736) +++ projects/largeSMP/sys/powerpc/include/atomic.h Tue May 10 13:59:33 2011 (r221737) @@ -43,31 +43,6 @@ #define wmb() mb() #define rmb() mb() -#define _ATOMIC_PUN_LTOI(FUNC) \ - static __inline void \ - atomic_##FUNC##_long(volatile u_long *p, u_long v) \ - { \ - \ - atomic_##FUNC##_int((volatile u_int *)p, (u_int)v); \ - } \ - \ - static __inline void \ - atomic_##FUNC##_acq_long(volatile u_long *p, u_long v) \ - { \ - \ - atomic_##FUNC##_acq_int((volatile u_int *)p, \ - (u_int)v); \ - } \ - \ - static __inline void \ - atomic_##FUNC##_rel_long(volatile u_long *p, u_long v) \ - { \ - \ - atomic_##FUNC##_rel_int((volatile u_int *)p, \ - (u_int)v); \ - } \ - /* _ATOMIC_PUN_LTOI */ - /* * atomic_add(p, v) * { *p += v; } @@ -97,7 +72,15 @@ /* __atomic_add_long */ #else #define __atomic_add_long(p, v, t) \ - long atomic_add not implemented + __asm __volatile( \ + "1: lwarx %0, 0, %2\n" \ + " add %0, %3, %0\n" \ + " stwcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cc", "memory") \ + /* __atomic_add_long */ #endif #define _ATOMIC_ADD(type) \ @@ -123,14 +106,13 @@ /* _ATOMIC_ADD */ _ATOMIC_ADD(int) +_ATOMIC_ADD(long) #define atomic_add_32 atomic_add_int #define atomic_add_acq_32 atomic_add_acq_int #define atomic_add_rel_32 atomic_add_rel_int #ifdef __powerpc64__ -_ATOMIC_ADD(long) - #define atomic_add_64 atomic_add_long #define atomic_add_acq_64 atomic_add_acq_long #define atomic_add_rel_64 atomic_add_rel_long @@ -139,8 +121,6 @@ _ATOMIC_ADD(long) #define atomic_add_acq_ptr atomic_add_acq_long #define atomic_add_rel_ptr atomic_add_rel_long #else -_ATOMIC_PUN_LTOI(add) - #define atomic_add_ptr atomic_add_int #define atomic_add_acq_ptr atomic_add_acq_int #define atomic_add_rel_ptr atomic_add_rel_int @@ -178,7 +158,15 @@ _ATOMIC_PUN_LTOI(add) /* __atomic_clear_long */ #else #define __atomic_clear_long(p, v, t) \ - long atomic_clear not implemented + __asm __volatile( \ + "1: lwarx %0, 0, %2\n" \ + " andc %0, %0, %3\n" \ + " stwcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cc", "memory") \ + /* __atomic_clear_long */ #endif #define _ATOMIC_CLEAR(type) \ @@ -205,14 +193,13 @@ _ATOMIC_PUN_LTOI(add) _ATOMIC_CLEAR(int) +_ATOMIC_CLEAR(long) #define atomic_clear_32 atomic_clear_int #define atomic_clear_acq_32 atomic_clear_acq_int #define atomic_clear_rel_32 atomic_clear_rel_int #ifdef __powerpc64__ -_ATOMIC_CLEAR(long) - #define atomic_clear_64 atomic_clear_long #define atomic_clear_acq_64 atomic_clear_acq_long #define atomic_clear_rel_64 atomic_clear_rel_long @@ -221,13 +208,11 @@ _ATOMIC_CLEAR(long) #define atomic_clear_acq_ptr atomic_clear_acq_long #define atomic_clear_rel_ptr atomic_clear_rel_long #else -_ATOMIC_PUN_LTOI(clear) - #define atomic_clear_ptr atomic_clear_int #define atomic_clear_acq_ptr atomic_clear_acq_int #define atomic_clear_rel_ptr atomic_clear_rel_int #endif -#undef _ATOMIC_ADD +#undef _ATOMIC_CLEAR #undef __atomic_clear_long #undef __atomic_clear_int @@ -275,7 +260,15 @@ _ATOMIC_PUN_LTOI(clear) /* __atomic_set_long */ #else #define __atomic_set_long(p, v, t) \ - long atomic_set not implemented + __asm __volatile( \ + "1: lwarx %0, 0, %2\n" \ + " or %0, %3, %0\n" \ + " stwcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cc", "memory") \ + /* __atomic_set_long */ #endif #define _ATOMIC_SET(type) \ @@ -301,14 +294,13 @@ _ATOMIC_PUN_LTOI(clear) /* _ATOMIC_SET */ _ATOMIC_SET(int) +_ATOMIC_SET(long) #define atomic_set_32 atomic_set_int #define atomic_set_acq_32 atomic_set_acq_int #define atomic_set_rel_32 atomic_set_rel_int #ifdef __powerpc64__ -_ATOMIC_SET(long) - #define atomic_set_64 atomic_set_long #define atomic_set_acq_64 atomic_set_acq_long #define atomic_set_rel_64 atomic_set_rel_long @@ -317,8 +309,6 @@ _ATOMIC_SET(long) #define atomic_set_acq_ptr atomic_set_acq_long #define atomic_set_rel_ptr atomic_set_rel_long #else -_ATOMIC_PUN_LTOI(set) - #define atomic_set_ptr atomic_set_int #define atomic_set_acq_ptr atomic_set_acq_int #define atomic_set_rel_ptr atomic_set_rel_int @@ -356,7 +346,15 @@ _ATOMIC_PUN_LTOI(set) /* __atomic_subtract_long */ #else #define __atomic_subtract_long(p, v, t) \ - long atomic_subtract not implemented + __asm __volatile( \ + "1: lwarx %0, 0, %2\n" \ + " subf %0, %3, %0\n" \ + " stwcx. %0, 0, %2\n" \ + " bne- 1b\n" \ + : "=&r" (t), "=m" (*p) \ + : "r" (p), "r" (v), "m" (*p) \ + : "cc", "memory") \ + /* __atomic_subtract_long */ #endif #define _ATOMIC_SUBTRACT(type) \ @@ -382,14 +380,13 @@ _ATOMIC_PUN_LTOI(set) /* _ATOMIC_SUBTRACT */ _ATOMIC_SUBTRACT(int) +_ATOMIC_SUBTRACT(long) #define atomic_subtract_32 atomic_subtract_int #define atomic_subtract_acq_32 atomic_subtract_acq_int #define atomic_subtract_rel_32 atomic_subtract_rel_int #ifdef __powerpc64__ -_ATOMIC_SUBTRACT(long) - #define atomic_subtract_64 atomic_subtract_long #define atomic_subtract_acq_64 atomic_subract_acq_long #define atomic_subtract_rel_64 atomic_subtract_rel_long @@ -398,8 +395,6 @@ _ATOMIC_SUBTRACT(long) #define atomic_subtract_acq_ptr atomic_subtract_acq_long #define atomic_subtract_rel_ptr atomic_subtract_rel_long #else -_ATOMIC_PUN_LTOI(subtract) - #define atomic_subtract_ptr atomic_subtract_int #define atomic_subtract_acq_ptr atomic_subtract_acq_int #define atomic_subtract_rel_ptr atomic_subtract_rel_int @@ -408,8 +403,6 @@ _ATOMIC_PUN_LTOI(subtract) #undef __atomic_subtract_long #undef __atomic_subtract_int -#undef _ATOMIC_PUN_LTOI - /* * atomic_store_rel(p, v) */ From owner-svn-src-projects@FreeBSD.ORG Tue May 10 15:54:37 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2E03106566B; Tue, 10 May 2011 15:54:37 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9F6498FC0A; Tue, 10 May 2011 15:54:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4AFsbko050647; Tue, 10 May 2011 15:54:37 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4AFsbW9050630; Tue, 10 May 2011 15:54:37 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105101554.p4AFsbW9050630@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 May 2011 15:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221742 - in projects/largeSMP: contrib/top sbin/devd share/man/man5 share/mk sys/cddl/dev/dtrace/amd64 sys/cddl/dev/dtrace/i386 sys/dev/ath/ath_hal/ar9002 sys/dev/puc sys/dev/usb sys/p... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 15:54:37 -0000 Author: attilio Date: Tue May 10 15:54:37 2011 New Revision: 221742 URL: http://svn.freebsd.org/changeset/base/221742 Log: MFC Added: projects/largeSMP/tools/build/options/WITH_CLANG - copied unchanged from r221741, head/tools/build/options/WITH_CLANG projects/largeSMP/tools/build/options/WITH_FDT - copied unchanged from r221741, head/tools/build/options/WITH_FDT Deleted: projects/largeSMP/tools/build/options/WITHOUT_OBJC Modified: projects/largeSMP/sbin/devd/devd.conf.5 projects/largeSMP/share/man/man5/src.conf.5 projects/largeSMP/share/mk/bsd.own.mk projects/largeSMP/sys/cddl/dev/dtrace/amd64/dtrace_subr.c projects/largeSMP/sys/cddl/dev/dtrace/i386/dtrace_subr.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c projects/largeSMP/sys/dev/puc/pucdata.c projects/largeSMP/sys/dev/usb/usbdevs projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c projects/largeSMP/sys/sys/systm.h projects/largeSMP/tools/build/options/makeman projects/largeSMP/usr.bin/less/defines.h projects/largeSMP/usr.bin/tip/tip/tipout.c Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/sbin/devd/devd.conf.5 ============================================================================== --- projects/largeSMP/sbin/devd/devd.conf.5 Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sbin/devd/devd.conf.5 Tue May 10 15:54:37 2011 (r221742) @@ -283,7 +283,7 @@ Hub port number (USB) Product ID (pccard/USB). .It Li release Hardware revision (USB) -.It Li serial +.It Li sernum Serial Number (USB). .It Li slot Card slot. Modified: projects/largeSMP/share/man/man5/src.conf.5 ============================================================================== --- projects/largeSMP/share/man/man5/src.conf.5 Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/share/man/man5/src.conf.5 Tue May 10 15:54:37 2011 (r221742) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. -.\" from FreeBSD: head/tools/build/options/makeman 221161 2011-04-28 11:21:49Z des +.\" from FreeBSD: head/tools/build/options/makeman 221733 2011-05-10 13:01:11Z ru .\" $FreeBSD$ -.Dd April 30, 2011 +.Dd May 10, 2011 .Dt SRC.CONF 5 .Os .Sh NAME @@ -78,9 +78,9 @@ The following list provides a name and s that can be used for source builds. .Bl -tag -width indent .It Va WITHOUT_ACCT -.\" from FreeBSD: head/tools/build/options/WITHOUT_ACCT 183242 2008-09-21 22:02:26Z sam +.\" from FreeBSD: head/tools/build/options/WITHOUT_ACCT 221540 2011-05-06 19:13:03Z ru Set to not build process accounting tools such as -.Xr ac 8 +.Xr ac 8 and .Xr accton 8 . .It Va WITHOUT_ACPI @@ -132,6 +132,8 @@ When set, it also enforces the following .It .Va WITHOUT_BIND_ETC .It +.Va WITHOUT_BIND_LIBS +.It .Va WITHOUT_BIND_LIBS_LWRES .It .Va WITHOUT_BIND_MTREE @@ -253,6 +255,15 @@ When set, it also enforces the following .It Va WITHOUT_CLANG .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG 208971 2010-06-10 06:20:26Z ed Set to not build the Clang C/C++ compiler. +.Pp +It is a default setting on +arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, powerpc/powerpc64, sparc64/sparc64 and sun4v/sparc64. +.It Va WITH_CLANG +.\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru +Set to build the Clang C/C++ compiler. +.Pp +It is a default setting on +amd64/amd64, i386/i386, pc98/i386 and powerpc/powerpc. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru Set to not build @@ -264,10 +275,6 @@ When set, it also enforces the following .Pp .Bl -item -compact .It -.Va WITHOUT_GSSAPI -(can be overridden with -.Va WITH_GSSAPI ) -.It .Va WITHOUT_KERBEROS .It .Va WITHOUT_KERBEROS_SUPPORT @@ -276,6 +283,15 @@ When set, it also enforces the following .It .Va WITHOUT_OPENSSL .El +.Pp +When set, the following options are also in effect: +.Pp +.Bl -inset -compact +.It Va WITHOUT_GSSAPI +(unless +.Va WITH_GSSAPI +is set explicitly) +.El .It Va WITHOUT_CTM .\" from FreeBSD: head/tools/build/options/WITHOUT_CTM 183242 2008-09-21 22:02:26Z sam Set to not build @@ -285,7 +301,7 @@ and related utilities. .\" from FreeBSD: head/tools/build/options/WITHOUT_CVS 156932 2006-03-21 07:50:50Z ru Set to not build CVS. .It Va WITHOUT_CXX -.\" from FreeBSD: head/tools/build/options/WITHOUT_CXX 220401 2011-04-06 20:08:23Z uqs +.\" from FreeBSD: head/tools/build/options/WITHOUT_CXX 220402 2011-04-06 20:19:07Z uqs Set to not build .Xr g++ 1 and related libraries. @@ -316,12 +332,22 @@ dynamically. Set to avoid installing examples to .Pa /usr/share/examples/ . .It Va WITHOUT_FDT -.\" from FreeBSD: head/tools/build/options/WITHOUT_FDT 218942 2011-02-22 08:20:12Z uqs -Set to not build Flattened Device Tree support as part of the base system. This -includes the device tree compiler (dtc) and libfdt support library. +.\" from FreeBSD: head/tools/build/options/WITHOUT_FDT 221539 2011-05-06 19:10:27Z ru +Set to not build Flattened Device Tree support as part of the base system. +This includes the device tree compiler (dtc) and libfdt support library. +.Pp +It is a default setting on +amd64/amd64, i386/i386, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, pc98/i386, powerpc/powerpc64, sparc64/sparc64 and sun4v/sparc64. +.It Va WITH_FDT +.\" from FreeBSD: head/tools/build/options/WITH_FDT 221730 2011-05-10 11:14:40Z ru +Set to build Flattened Device Tree support as part of the base system. +This includes the device tree compiler (dtc) and libfdt support library. +.Pp +It is a default setting on +arm/arm, arm/armeb and powerpc/powerpc. .It Va WITHOUT_FLOPPY -.\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 183306 2008-09-23 16:15:42Z sam -Set to not build or install programs +.\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru +Set to not build or install programs for operating floppy disk driver. .It Va WITHOUT_FORTH .\" from FreeBSD: head/tools/build/options/WITHOUT_FORTH 156932 2006-03-21 07:50:50Z ru @@ -367,9 +393,11 @@ Set to build some programs without optio .It Va WITHOUT_GPIB .\" from FreeBSD: head/tools/build/options/WITHOUT_GPIB 156932 2006-03-21 07:50:50Z ru Set to not build GPIB bus support. -.It Va WITH_GPIO -.\" from FreeBSD: head/tools/build/options/WITH_GPIO 213463 2010-10-05 22:26:01Z gonzo -Set to build gpioctl(8) as part of the base system. +.It Va WITHOUT_GPIO +.\" from FreeBSD: head/tools/build/options/WITHOUT_GPIO 221541 2011-05-06 19:14:06Z ru +Set to not build +.Xr gpioctl 8 +as part of the base system. .It Va WITHOUT_GROFF .\" from FreeBSD: head/tools/build/options/WITHOUT_GROFF 218941 2011-02-22 08:13:49Z uqs Set to not build @@ -398,7 +426,7 @@ It is .Em "YOUR RESPONSIBILITY" to determine if you can legally use IDEA. .It Va WITHOUT_INET -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITHOUT_INET 221266 2011-04-30 17:58:28Z bz Set to not build programs and libraries related to IPv4 networking. When set, it also enforces the following options: .Pp @@ -420,7 +448,7 @@ When set, it also enforces the following .\" from FreeBSD: head/tools/build/options/WITHOUT_INET6_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build libraries, programs, and kernel modules without IPv6 support. .It Va WITHOUT_INET_SUPPORT -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITHOUT_INET_SUPPORT 221266 2011-04-30 17:58:28Z bz Set to build libraries, programs, and kernel modules without IPv4 support. .It Va WITHOUT_INFO .\" from FreeBSD: head/tools/build/options/WITHOUT_INFO 156932 2006-03-21 07:50:50Z ru @@ -464,12 +492,17 @@ When set, it also enforces the following .Pp .Bl -item -compact .It -.Va WITHOUT_GSSAPI -(can be overridden with -.Va WITH_GSSAPI ) -.It .Va WITHOUT_KERBEROS_SUPPORT .El +.Pp +When set, the following options are also in effect: +.Pp +.Bl -inset -compact +.It Va WITHOUT_GSSAPI +(unless +.Va WITH_GSSAPI +is set explicitly) +.El .It Va WITHOUT_KERBEROS_SUPPORT .\" from FreeBSD: head/tools/build/options/WITHOUT_KERBEROS_SUPPORT 156932 2006-03-21 07:50:50Z ru Set to build some programs without Kerberos support, like @@ -525,6 +558,8 @@ When set, it also enforces the following .It .Va WITHOUT_BIND_ETC .It +.Va WITHOUT_BIND_LIBS +.It .Va WITHOUT_BIND_LIBS_LWRES .It .Va WITHOUT_BIND_MTREE @@ -551,6 +586,8 @@ When set, it also enforces the following .It .Va WITHOUT_BIND_ETC .It +.Va WITHOUT_BIND_LIBS +.It .Va WITHOUT_BIND_LIBS_LWRES .It .Va WITHOUT_BIND_MTREE @@ -597,13 +634,13 @@ and related support files. .It Va WITHOUT_MAN .\" from FreeBSD: head/tools/build/options/WITHOUT_MAN 156932 2006-03-21 07:50:50Z ru Set to not build manual pages. -When set, it also enforces the following options: +When set, the following options are also in effect: .Pp -.Bl -item -compact -.It -.Va WITHOUT_MAN_UTILS -(can be overridden with -.Va WITH_MAN_UTILS ) +.Bl -inset -compact +.It Va WITHOUT_MAN_UTILS +(unless +.Va WITH_MAN_UTILS +is set explicitly) .El .It Va WITHOUT_MAN_UTILS .\" from FreeBSD: head/tools/build/options/WITHOUT_MAN_UTILS 208322 2010-05-20 00:07:21Z jkim @@ -675,9 +712,6 @@ will not be built either if this option Set to not build .Xr ntpd 8 and related programs. -.It Va WITHOUT_OBJC -.\" from FreeBSD: head/tools/build/options/WITHOUT_OBJC 156932 2006-03-21 07:50:50Z ru -Set to not build Objective C support. .It Va WITHOUT_OPENSSH .\" from FreeBSD: head/tools/build/options/WITHOUT_OPENSSH 156932 2006-03-21 07:50:50Z ru Set to not build OpenSSH. @@ -688,16 +722,21 @@ When set, it also enforces the following .Pp .Bl -item -compact .It -.Va WITHOUT_GSSAPI -(can be overridden with -.Va WITH_GSSAPI ) -.It .Va WITHOUT_KERBEROS .It .Va WITHOUT_KERBEROS_SUPPORT .It .Va WITHOUT_OPENSSH .El +.Pp +When set, the following options are also in effect: +.Pp +.Bl -inset -compact +.It Va WITHOUT_GSSAPI +(unless +.Va WITH_GSSAPI +is set explicitly) +.El .It Va WITHOUT_PAM .\" from FreeBSD: head/tools/build/options/WITHOUT_PAM 174550 2007-12-12 16:43:17Z ru Set to not build PAM library and modules. Modified: projects/largeSMP/share/mk/bsd.own.mk ============================================================================== --- projects/largeSMP/share/mk/bsd.own.mk Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/share/mk/bsd.own.mk Tue May 10 15:54:37 2011 (r221742) @@ -297,7 +297,6 @@ __DEFAULT_YES_OPTIONS = \ BIND_MTREE \ BIND_NAMED \ BIND_UTILS \ - BINUTILS \ BLUETOOTH \ BOOT \ BSD_CPIO \ @@ -318,7 +317,6 @@ __DEFAULT_YES_OPTIONS = \ FP_LIBC \ FREEBSD_UPDATE \ GAMES \ - GCC \ GCOV \ GDB \ GNU \ @@ -394,7 +392,6 @@ __DEFAULT_NO_OPTIONS = \ BIND_LIBS \ BIND_SIGCHASE \ BIND_XML \ - GNU_CPIO \ HESIOD \ ICONV \ IDEA \ @@ -405,7 +402,7 @@ __DEFAULT_NO_OPTIONS = \ # this means that we have to test TARGET_ARCH (the buildworld case) as well # as MACHINE_ARCH (the non-buildworld case). Normally TARGET_ARCH is not # used at all in bsd.*.mk, but we have to make an exception here if we want -# to allow defaults for some things like clang and ftd to vary by target +# to allow defaults for some things like clang and fdt to vary by target # architecture. # .if defined(TARGET_ARCH) Modified: projects/largeSMP/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- projects/largeSMP/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Tue May 10 15:54:37 2011 (r221742) @@ -359,26 +359,6 @@ static uint64_t nsec_scale; #define SCALE_SHIFT 28 static void -dtrace_gethrtime_init_sync(void *arg) -{ -#ifdef CHECK_SYNC - /* - * Delay this function from returning on one - * of the CPUs to check that the synchronisation - * works. - */ - uintptr_t cpu = (uintptr_t) arg; - - if (cpu == curcpu) { - int i; - for (i = 0; i < 1000000000; i++) - tgt_cpu_tsc = rdtsc(); - tgt_cpu_tsc = 0; - } -#endif -} - -static void dtrace_gethrtime_init_cpu(void *arg) { uintptr_t cpu = (uintptr_t) arg; @@ -435,7 +415,7 @@ dtrace_gethrtime_init(void *arg) map = PCPU_GET(cpumask); CPU_OR(&map, &pc->pc_cpumask); - smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync, + smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, smp_no_rendevous_barrier, (void *)(uintptr_t) i); Modified: projects/largeSMP/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- projects/largeSMP/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/cddl/dev/dtrace/i386/dtrace_subr.c Tue May 10 15:54:37 2011 (r221742) @@ -360,26 +360,6 @@ static uint64_t nsec_scale; #define SCALE_SHIFT 28 static void -dtrace_gethrtime_init_sync(void *arg) -{ -#ifdef CHECK_SYNC - /* - * Delay this function from returning on one - * of the CPUs to check that the synchronisation - * works. - */ - uintptr_t cpu = (uintptr_t) arg; - - if (cpu == curcpu) { - int i; - for (i = 0; i < 1000000000; i++) - tgt_cpu_tsc = rdtsc(); - tgt_cpu_tsc = 0; - } -#endif -} - -static void dtrace_gethrtime_init_cpu(void *arg) { uintptr_t cpu = (uintptr_t) arg; @@ -436,7 +416,7 @@ dtrace_gethrtime_init(void *arg) map = PCPU_GET(cpumask); CPU_OR(&map, &pc->pc_cpumask); - smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync, + smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, smp_no_rendevous_barrier, (void *)(uintptr_t) i); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c Tue May 10 15:54:37 2011 (r221742) @@ -74,8 +74,33 @@ static void ar9285WriteIni(struct ath_ha static void ar9285AniSetup(struct ath_hal *ah) { - /* NB: disable ANI for reliable RIFS rx */ - ar5416AniAttach(ah, AH_NULL, AH_NULL, AH_FALSE); + /* + * These are the parameters from the AR5416 ANI code; + * they likely need quite a bit of adjustment for the + * AR9285. + */ + static const struct ar5212AniParams aniparams = { + .maxNoiseImmunityLevel = 4, /* levels 0..4 */ + .totalSizeDesired = { -55, -55, -55, -55, -62 }, + .coarseHigh = { -14, -14, -14, -14, -12 }, + .coarseLow = { -64, -64, -64, -64, -70 }, + .firpwr = { -78, -78, -78, -78, -80 }, + .maxSpurImmunityLevel = 2, + .cycPwrThr1 = { 2, 4, 6 }, + .maxFirstepLevel = 2, /* levels 0..2 */ + .firstep = { 0, 4, 8 }, + .ofdmTrigHigh = 500, + .ofdmTrigLow = 200, + .cckTrigHigh = 200, + .cckTrigLow = 100, + .rssiThrHigh = 40, + .rssiThrLow = 7, + .period = 100, + }; + /* NB: disable ANI noise immmunity for reliable RIFS rx */ + AH5416(ah)->ah_ani_function &= ~ HAL_ANI_NOISE_IMMUNITY_LEVEL; + + ar5416AniAttach(ah, &aniparams, &aniparams, AH_TRUE); } /* @@ -122,10 +147,6 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s AH5416(ah)->ah_cal.adcDcCalInitData.calData = &ar9280_adc_init_dc_cal; AH5416(ah)->ah_cal.suppCals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL; - if (AR_SREV_KITE_12_OR_LATER(ah)) - AH5416(ah)->ah_cal_initcal = ar9285InitCalHardware; - AH5416(ah)->ah_cal_pacal = ar9002_hw_pa_cal; - AH5416(ah)->ah_spurMitigate = ar9280SpurMitigate; AH5416(ah)->ah_writeIni = ar9285WriteIni; AH5416(ah)->ah_rx_chainmask = AR9285_DEFAULT_RXCHAINMASK; @@ -173,6 +194,12 @@ ar9285Attach(uint16_t devid, HAL_SOFTC s } ar5416AttachPCIE(ah); + /* Attach methods that require MAC version/revision info */ + if (AR_SREV_KITE_12_OR_LATER(ah)) + AH5416(ah)->ah_cal_initcal = ar9285InitCalHardware; + if (AR_SREV_KITE_11_OR_LATER(ah)) + AH5416(ah)->ah_cal_pacal = ar9002_hw_pa_cal; + ecode = ath_hal_v4kEepromAttach(ah); if (ecode != HAL_OK) goto bad; Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c Tue May 10 15:54:37 2011 (r221742) @@ -60,13 +60,13 @@ ar9285_hw_pa_cal(struct ath_hal *ah, HAL { 0x7838, 0 }, }; - HALDEBUG(ah, HAL_DEBUG_PERCAL, "Running PA Calibration\n"); - /* PA CAL is not needed for high power solution */ if (ath_hal_eepromGet(ah, AR_EEP_TXGAIN_TYPE, AH_NULL) == AR5416_EEP_TXGAIN_HIGH_POWER) return; + HALDEBUG(ah, HAL_DEBUG_PERCAL, "Running PA Calibration\n"); + for (i = 0; i < N(regList); i++) regList[i][1] = OS_REG_READ(ah, regList[i][0]); @@ -151,7 +151,7 @@ ar9285_hw_pa_cal(struct ath_hal *ah, HAL void ar9002_hw_pa_cal(struct ath_hal *ah, HAL_BOOL is_reset) { - if (AR_SREV_KITE_12_OR_LATER(ah)) { + if (AR_SREV_KITE_11_OR_LATER(ah)) { if (is_reset || !AH9285(ah)->pacal_info.skipcount) ar9285_hw_pa_cal(ah, is_reset); else @@ -260,7 +260,8 @@ HAL_BOOL ar9285InitCalHardware(struct ath_hal *ah, const struct ieee80211_channel *chan) { - if (! ar9285_hw_clc(ah, chan)) + if (AR_SREV_KITE(ah) && AR_SREV_KITE_10_OR_LATER(ah) && + (! ar9285_hw_clc(ah, chan))) return AH_FALSE; return AH_TRUE; Modified: projects/largeSMP/sys/dev/puc/pucdata.c ============================================================================== --- projects/largeSMP/sys/dev/puc/pucdata.c Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/dev/puc/pucdata.c Tue May 10 15:54:37 2011 (r221742) @@ -638,6 +638,12 @@ const struct puc_cfg puc_pci_devices[] = PUC_PORT_4S, 0x10, 0, 8, }, + { 0x1415, 0x9501, 0x131f, 0x2052, + "SIIG Quartet Serial 850", + DEFAULT_RCLK * 10, + PUC_PORT_4S, 0x10, 0, 8, + }, + { 0x1415, 0x9501, 0x14db, 0x2150, "Kuroutoshikou SERIAL4P-LPPCI2", DEFAULT_RCLK * 10, Modified: projects/largeSMP/sys/dev/usb/usbdevs ============================================================================== --- projects/largeSMP/sys/dev/usb/usbdevs Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/dev/usb/usbdevs Tue May 10 15:54:37 2011 (r221742) @@ -681,6 +681,7 @@ vendor HAUPPAUGE2 0x2040 Hauppauge Compu vendor TLAYTECH 0x20b9 Tlay Tech vendor ENCORE 0x203d Encore vendor PARA 0x20b8 PARA Industrial +vendor SIMTEC 0x20df Simtec Electronics vendor ERICSSON 0x2282 Ericsson vendor MOTOROLA2 0x22b8 Motorola vendor TRIPPLITE 0x2478 Tripp-Lite @@ -2513,6 +2514,9 @@ product PANASONIC TYTP50P6S 0x3900 TY-TP /* PARA Industrial products */ product PARA RT3070 0x8888 RT3070 +/* Simtec Electronics products */ +product SIMTEC ENTROPYKEY 0x0001 Entropy Key + /* Pegatron products */ product PEGATRON RT2870 0x0002 RT2870 product PEGATRON RT3070 0x000c RT3070 Modified: projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c ============================================================================== --- projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/powerpc/powerpc/intr_machdep.c Tue May 10 15:54:37 2011 (r221742) @@ -398,18 +398,22 @@ powerpc_enable_intr(void) #ifdef SMP /* Install an IPI handler. */ - for (n = 0; n < npics; n++) { - if (piclist[n].dev != root_pic) - continue; - - KASSERT(piclist[n].ipis != 0, ("%s", __func__)); - error = powerpc_setup_intr("IPI", - MAP_IRQ(piclist[n].node, piclist[n].irqs), - powerpc_ipi_handler, NULL, NULL, - INTR_TYPE_MISC | INTR_EXCL, &ipi_cookie); - if (error) { - printf("unable to setup IPI handler\n"); - return (error); + if (mp_ncpus > 1) { + for (n = 0; n < npics; n++) { + if (piclist[n].dev != root_pic) + continue; + + KASSERT(piclist[n].ipis != 0, + ("%s: SMP root PIC does not supply any IPIs", + __func__)); + error = powerpc_setup_intr("IPI", + MAP_IRQ(piclist[n].node, piclist[n].irqs), + powerpc_ipi_handler, NULL, NULL, + INTR_TYPE_MISC | INTR_EXCL, &ipi_cookie); + if (error) { + printf("unable to setup IPI handler\n"); + return (error); + } } } #endif Modified: projects/largeSMP/sys/sys/systm.h ============================================================================== --- projects/largeSMP/sys/sys/systm.h Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/sys/sys/systm.h Tue May 10 15:54:37 2011 (r221742) @@ -374,44 +374,8 @@ int alloc_unrl(struct unrhdr *uh); void free_unr(struct unrhdr *uh, u_int item); /* - * This is about as magic as it gets. fortune(1) has got similar code - * for reversing bits in a word. Who thinks up this stuff?? - * - * Yes, it does appear to be consistently faster than: - * while (i = ffs(m)) { - * m >>= i; - * bits++; - * } - * and - * while (lsb = (m & -m)) { // This is magic too - * m &= ~lsb; // or: m ^= lsb - * bits++; - * } - * Both of these latter forms do some very strange things on gcc-3.1 with - * -mcpu=pentiumpro and/or -march=pentiumpro and/or -O or -O2. - * There is probably an SSE or MMX popcnt instruction. - * - * I wonder if this should be in libkern? - * - * XXX Stop the presses! Another one: - * static __inline u_int32_t - * popcnt1(u_int32_t v) - * { - * v -= ((v >> 1) & 0x55555555); - * v = (v & 0x33333333) + ((v >> 2) & 0x33333333); - * v = (v + (v >> 4)) & 0x0F0F0F0F; - * return (v * 0x01010101) >> 24; - * } - * The downside is that it has a multiply. With a pentium3 with - * -mcpu=pentiumpro and -march=pentiumpro then gcc-3.1 will use - * an imull, and in that case it is faster. In most other cases - * it appears slightly slower. - * - * Another variant (also from fortune): - * #define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) - * #define BX_(x) ((x) - (((x)>>1)&0x77777777) \ - * - (((x)>>2)&0x33333333) \ - * - (((x)>>3)&0x11111111)) + * Population count algorithm using SWAR approach + * - "SIMD Within A Register". */ static __inline uint32_t bitcount32(uint32_t x) Copied: projects/largeSMP/tools/build/options/WITH_CLANG (from r221741, head/tools/build/options/WITH_CLANG) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/build/options/WITH_CLANG Tue May 10 15:54:37 2011 (r221742, copy of r221741, head/tools/build/options/WITH_CLANG) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build the Clang C/C++ compiler. Copied: projects/largeSMP/tools/build/options/WITH_FDT (from r221741, head/tools/build/options/WITH_FDT) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/tools/build/options/WITH_FDT Tue May 10 15:54:37 2011 (r221742, copy of r221741, head/tools/build/options/WITH_FDT) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to build Flattened Device Tree support as part of the base system. +This includes the device tree compiler (dtc) and libfdt support library. Modified: projects/largeSMP/tools/build/options/makeman ============================================================================== --- projects/largeSMP/tools/build/options/makeman Tue May 10 15:08:13 2011 (r221741) +++ projects/largeSMP/tools/build/options/makeman Tue May 10 15:54:37 2011 (r221742) @@ -2,34 +2,98 @@ # # This file is in the public domain. +set -o errexit + ident='$FreeBSD$' +t=$(mktemp -d -t makeman) +trap 'test -d $t && rm -rf $t' exit + +# +# usage: no_targets all_targets yes_targets +# +no_targets() +{ + for t1 in $1 ; do + for t2 in $2 ; do + if [ "${t1}" = "${t2}" ] ; then + continue 2 + fi + done + echo ${t1} + done +} + +show_options() +{ + ALL_TARGETS=$(echo $(make -C ../../.. targets | tail -n +2)) + rm -f $t/settings + for target in ${ALL_TARGETS} ; do + make -C ../../.. showconfig \ + SRCCONF=/dev/null __MAKE_CONF=/dev/null \ + TARGET_ARCH=${target#*/} TARGET=${target%/*} | + while read var _ val ; do + opt=${var#MK_} + case ${val} in + yes) + echo ${opt} ${target} + ;; + no) + echo ${opt} + ;; + *) + echo 'make showconfig broken' >&2 + exit 1 + ;; + esac + done > $t/settings.target + if [ -r $t/settings ] ; then + join -t\ $t/settings $t/settings.target > $t/settings.new + mv $t/settings.new $t/settings + else + mv $t/settings.target $t/settings + fi + done + + cat $t/settings | while read opt targets ; do + if [ "${targets}" = "${ALL_TARGETS}" ] ; then + echo "WITHOUT_${opt}" + elif [ -z "${targets}" ] ; then + echo "WITH_${opt}" + else + echo "WITHOUT_${opt}" $(no_targets "${ALL_TARGETS}" "${targets}") + echo "WITH_${opt} ${targets}" + fi + done +} + # -# usage: show { settings | options } ... +# usage: show { settings | with | without } ... # show() { - mode=$1; shift + mode=$1 ; shift case ${mode} in settings) yes_prefix=WITH no_prefix=WITHOUT ;; - options) - yes_prefix=WITHOUT + with) + yes_prefix=WITH no_prefix=WITH ;; + without) + yes_prefix=WITHOUT + no_prefix=WITHOUT + ;; *) - echo "internal error" >/dev/stderr + echo 'internal error' >&2 exit 1 ;; esac - ( - cd ../../.. - make "$@" showconfig SRCCONF=/dev/null __MAKE_CONF=/dev/null - ) | - while read var _ val; do + make -C ../../.. "$@" showconfig __MAKE_CONF=/dev/null | + while read var _ val ; do opt=${var#MK_} case ${val} in yes) @@ -39,7 +103,7 @@ show() echo ${no_prefix}_${opt} ;; *) - echo "make showconfig broken" >/dev/stderr + echo 'make showconfig broken' >&2 exit 1 ;; esac @@ -49,7 +113,6 @@ show() main() { - trap 'rm -f _defcfg _config _config2 _deps _deps2' exit ident=${ident#$} ident=${ident% $} fbsdid='$'FreeBSD'$' @@ -57,7 +120,7 @@ main() .\" DO NOT EDIT-- this file is automatically generated. .\" from ${ident} .\" ${fbsdid} -.Dd $(LC_TIME=C date +'%B %e, %Y') +.Dd $(echo $(LC_TIME=C date +'%B %e, %Y')) .Dt SRC.CONF 5 .Os .Sh NAME @@ -134,47 +197,70 @@ The following list provides a name and s that can be used for source builds. .Bl -tag -width indent EOF - show settings |sort >_defcfg - show options | - while read opt; do - if [ -f ${opt} ]; then - cat </dev/stderr + show settings SRCCONF=/dev/null | sort > $t/config_default + show with SRCCONF=/dev/null | sort > $t/config_WITH_ALL + show without SRCCONF=/dev/null | sort > $t/config_WITHOUT_ALL + + show_options | + while read opt targets ; do + if [ ! -f ${opt} ] ; then + echo "no description found for ${opt}, skipping" >&2 continue fi - show settings -D${opt} |sort >_config - comm -13 _defcfg _config |grep -v "^${opt}$" >_deps - if [ -s _deps ]; then - cat <_config2 - comm -13 _config _config2 >_deps2 - if [ -s _deps2 ]; then - cat < $t/src.conf + show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITH_ALL_${opt} + comm -13 $t/config_WITH_ALL $t/config_WITH_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps + elif [ "${opt%%_*}" = 'WITH' ] ; then + sed -n "/^WITHOUT${opt#WITH}$/!s/$/=/p" $t/config_WITHOUT_ALL > $t/src.conf + show settings SRCCONF=$t/src.conf -D${opt} | sort > $t/config_WITHOUT_ALL_${opt} + comm -13 $t/config_WITHOUT_ALL $t/config_WITHOUT_ALL_${opt} | sed -n "/^${opt}$/!p" > $t/deps + else + echo 'internal error' >&2 + exit 1 + fi + + if [ -s $t/deps ] ; then + echo 'When set, it also enforces the following options:' + echo '.Pp' + echo '.Bl -item -compact' + cat $t/deps | while read opt2 ; do + echo '.It' + echo ".Va ${opt2}" done - cat < $t/config_${opt} + comm -13 $t/config_default $t/config_${opt} | sed -n "/^${opt}$/!p" | + comm -13 $t/deps - > $t/deps2 + + if [ -s $t/deps2 ] ; then + if [ -s $t/deps ] ; then + echo '.Pp' + fi + echo 'When set, the following options are also in effect:' + echo '.Pp' + echo '.Bl -inset -compact' + cat $t/deps2 | while read opt2 ; do + echo ".It Va ${opt2}" + noopt=$(echo ${opt2} | sed -e's/WITH_/WITHOUT_/;t' -e's/WITHOUT_/WITH_/') + echo '(unless' + echo ".Va ${noopt}" + echo 'is set explicitly)' + done + echo '.El' + fi + twiddle >&2 done cat <= ' ' && *cp <= '~') || + any(*cp, value(EXCEPTIONS))) + putc(*cp, fscript); + } + for (cp = buf; cp < buf + cnt; cp++) { + if (!isgraph(*cp)) { + fflush(fscript); + break; + } } - for (cp = buf; cp < buf + cnt; cp++) - if ((*cp >= ' ' && *cp <= '~') || - any(*cp, value(EXCEPTIONS))) - putc(*cp, fscript); } } } From owner-svn-src-projects@FreeBSD.ORG Tue May 10 18:01:53 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B30CA106566B; Tue, 10 May 2011 18:01:53 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A20988FC14; Tue, 10 May 2011 18:01:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4AI1ron054519; Tue, 10 May 2011 18:01:53 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4AI1ruJ054507; Tue, 10 May 2011 18:01:53 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105101801.p4AI1ruJ054507@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 May 2011 18:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221744 - in projects/largeSMP: lib/libmemstat tools/build/options tools/regression/bin/sh/parser X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 18:01:53 -0000 Author: attilio Date: Tue May 10 18:01:53 2011 New Revision: 221744 URL: http://svn.freebsd.org/changeset/base/221744 Log: Sync with -CURRENT Modified: projects/largeSMP/lib/libmemstat/memstat.h projects/largeSMP/tools/build/options/WITHOUT_GPIO projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 Modified: projects/largeSMP/lib/libmemstat/memstat.h ============================================================================== --- projects/largeSMP/lib/libmemstat/memstat.h Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/lib/libmemstat/memstat.h Tue May 10 18:01:53 2011 (r221744) @@ -31,7 +31,7 @@ /* * Number of CPU slots in library-internal data structures. This should be - * at least value of MAXCPU from param.h + * at least the value of MAXCPU from param.h. */ #define MEMSTAT_MAXCPU 32 Modified: projects/largeSMP/tools/build/options/WITHOUT_GPIO ============================================================================== --- projects/largeSMP/tools/build/options/WITHOUT_GPIO Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/build/options/WITHOUT_GPIO Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -.\" $FreeBSD: head/tools/build/options/WITHOUT_GPIO 221541 2011-05-06 19:14:06Z ru $ +.\" $FreeBSD$ Set to not build .Xr gpioctl 8 as part of the base system. Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote1.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote1.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ set -e Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote2.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote2.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ # This depends on the ASCII character set. Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote3.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote3.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ unset LC_ALL LC_CTYPE=en_US.ISO8859-1 Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote4.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote4.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ unset LC_ALL LC_CTYPE=en_US.ISO8859-1 Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote5.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote5.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ # This depends on the ASCII character set. Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote6.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote6.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ # This depends on the ASCII character set. Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote7.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote7.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ set -e Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote8.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote8.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ [ $'hello\0' = hello ] [ $'hello\0world' = hello ] Modified: projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 ============================================================================== --- projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 Tue May 10 16:44:16 2011 (r221743) +++ projects/largeSMP/tools/regression/bin/sh/parser/dollar-quote9.0 Tue May 10 18:01:53 2011 (r221744) @@ -1,4 +1,4 @@ -# $FreeBSD: head/tools/regression/bin/sh/parser/dollar-quote9.0 221513 2011-05-05 20:55:55Z jilles $ +# $FreeBSD$ # POSIX and C99 say D800-DFFF are undefined in a universal character name. # We reject this but many other shells expand to something that looks like From owner-svn-src-projects@FreeBSD.ORG Tue May 10 18:19:56 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1C4D106566B; Tue, 10 May 2011 18:19:56 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A239C8FC16; Tue, 10 May 2011 18:19:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4AIJuGN055047; Tue, 10 May 2011 18:19:56 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4AIJuTq055045; Tue, 10 May 2011 18:19:56 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105101819.p4AIJuTq055045@svn.freebsd.org> From: Attilio Rao Date: Tue, 10 May 2011 18:19:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221745 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2011 18:19:56 -0000 Author: attilio Date: Tue May 10 18:19:56 2011 New Revision: 221745 URL: http://svn.freebsd.org/changeset/base/221745 Log: Fix an inversion in logic. Submitted by: marius Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Tue May 10 18:01:53 2011 (r221744) +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Tue May 10 18:19:56 2011 (r221745) @@ -532,7 +532,7 @@ cpu_ipi_stop(struct trapframe *tf) CPU_OR_ATOMIC(&stopped_cpus, &tcmask); while (!CPU_OVERLAP(&started_cpus, &tcmask)) { if (CPU_OVERLAP(&shutdown_cpus, &tcmask)) { - CPU_OR_ATOMIC(&shutdown_cpus, &tcmask); + CPU_NAND_ATOMIC(&shutdown_cpus, &tcmask); (void)intr_disable(); for (;;) ; From owner-svn-src-projects@FreeBSD.ORG Wed May 11 08:42:30 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 538DC106564A; Wed, 11 May 2011 08:42:30 +0000 (UTC) (envelope-from flz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42D648FC12; Wed, 11 May 2011 08:42:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B8gUGa081547; Wed, 11 May 2011 08:42:30 GMT (envelope-from flz@svn.freebsd.org) Received: (from flz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B8gUs0081530; Wed, 11 May 2011 08:42:30 GMT (envelope-from flz@svn.freebsd.org) Message-Id: <201105110842.p4B8gUs0081530@svn.freebsd.org> From: Florent Thoumie Date: Wed, 11 May 2011 08:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221761 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 08:42:30 -0000 Author: flz Date: Wed May 11 08:42:29 2011 New Revision: 221761 URL: http://svn.freebsd.org/changeset/base/221761 Log: portbuild: add support for per-build tweaks. From now on, people can subscribe to their exp-runs only. Modified: projects/portbuild/scripts/build projects/portbuild/scripts/buildfailure projects/portbuild/scripts/buildsuccess projects/portbuild/scripts/claim-chroot projects/portbuild/scripts/clean-chroot projects/portbuild/scripts/dopackages projects/portbuild/scripts/dosetupnode projects/portbuild/scripts/makeduds projects/portbuild/scripts/makeindex projects/portbuild/scripts/makerestr projects/portbuild/scripts/makeworld projects/portbuild/scripts/mkbindist projects/portbuild/scripts/pdispatch projects/portbuild/scripts/portbuild projects/portbuild/scripts/prunefailure projects/portbuild/scripts/setupnode Modified: projects/portbuild/scripts/build ============================================================================== --- projects/portbuild/scripts/build Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/build Wed May 11 08:42:29 2011 (r221761) @@ -544,6 +544,12 @@ if [ $# -ge 1 ]; then esac fi +if [ -n "${buildid}" ]; then + if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf + fi +fi + # Unprivileged commands case "$cmd" in list) Modified: projects/portbuild/scripts/buildfailure ============================================================================== --- projects/portbuild/scripts/buildfailure Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/buildfailure Wed May 11 08:42:29 2011 (r221761) @@ -32,6 +32,9 @@ builddir=${pbd}/${arch}/${branch}/builds . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv buildenv ${pbd} ${arch} ${branch} ${builddir} Modified: projects/portbuild/scripts/buildsuccess ============================================================================== --- projects/portbuild/scripts/buildsuccess Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/buildsuccess Wed May 11 08:42:29 2011 (r221761) @@ -26,6 +26,9 @@ builddir=${pbd}/${arch}/${branch}/builds . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv buildenv ${pbd} ${arch} ${branch} ${builddir} Modified: projects/portbuild/scripts/claim-chroot ============================================================================== --- projects/portbuild/scripts/claim-chroot Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/claim-chroot Wed May 11 08:42:29 2011 (r221761) @@ -67,6 +67,9 @@ fi . ${pbd}/${arch}/client.conf . ${pbd}/${arch}/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbd}/${arch}/portbuild.$(hostname) buildroot=${scratchdir} Modified: projects/portbuild/scripts/clean-chroot ============================================================================== --- projects/portbuild/scripts/clean-chroot Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/clean-chroot Wed May 11 08:42:29 2011 (r221761) @@ -47,6 +47,9 @@ pbd=${PORTBUILD_DATA:-/var/portbuild} . ${pbd}/${arch}/client.conf . ${pbd}/${arch}/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbd}/${arch}/portbuild.$(hostname) # directories to clean Modified: projects/portbuild/scripts/dopackages ============================================================================== --- projects/portbuild/scripts/dopackages Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/dopackages Wed May 11 08:42:29 2011 (r221761) @@ -450,6 +450,12 @@ touch ${builddir}/.active ln -sf ${pbd}/${arch}/archive/buildlogs/log.${branch}.${datestamp} \ ${builddir}/build.log +# Update build-specific portbuild.conf. +if [ -f ${pbd}/${arch}/${branch}/portbuild.conf ]; then + ln -sf ${pbd}/${arch}/${branch}/portbuild.conf ${builddir}/portbuild.conf + . ${builddir}/portbuild.conf +fi + if [ "$skipstart" = 0 ]; then # Update build Modified: projects/portbuild/scripts/dosetupnode ============================================================================== --- projects/portbuild/scripts/dosetupnode Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/dosetupnode Wed May 11 08:42:29 2011 (r221761) @@ -31,6 +31,9 @@ else echo "Invalid arch ${arch}" exit 1 fi +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv # Check for non-fatal rsync errors @@ -58,6 +61,7 @@ setup() { echo "setting up of $node started at $(date)" . ${pbd}/${arch}/portbuild.conf + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf . ${pbd}/${arch}/portbuild.${node} if [ "${buildid}" != "-" ]; then @@ -102,6 +106,14 @@ setup() { ${client_user}@${node}:${builddir}/ checkerror $? || (echo "Copying scripts to ${node} failed"; return 1) + if [ -f ${builddir}/portbuild.conf ]; then + rsync ${rsync_gzip} -e "${ssh_cmd}" -r -L -p --delete ${builddir}/portbuild.conf \ + ${client_user}@${node}:${builddir}/ + checkerror $? || (echo "Copying custom portbuild.conf to ${node} failed"; return 1) + else + echo "No custom portbuild.conf." + fi + rsync ${rsync_gzip} -e "${ssh_cmd}" -r -L -p \ ${builddir}/ports-${buildid}.tbz \ ${builddir}/ports-${buildid}.tbz.md5 \ Modified: projects/portbuild/scripts/makeduds ============================================================================== --- projects/portbuild/scripts/makeduds Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/makeduds Wed May 11 08:42:29 2011 (r221761) @@ -23,6 +23,9 @@ builddir=${pbd}/${arch}/${branch}/builds . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv # -j# to make duds Modified: projects/portbuild/scripts/makeindex ============================================================================== --- projects/portbuild/scripts/makeindex Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/makeindex Wed May 11 08:42:29 2011 (r221761) @@ -35,6 +35,9 @@ builddir=${pbd}/${arch}/${branch}/builds . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv # Set up the build env variables Modified: projects/portbuild/scripts/makerestr ============================================================================== --- projects/portbuild/scripts/makerestr Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/makerestr Wed May 11 08:42:29 2011 (r221761) @@ -20,6 +20,9 @@ target=$4 . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv builddir=${pbd}/${arch}/${branch}/builds/${buildid} Modified: projects/portbuild/scripts/makeworld ============================================================================== --- projects/portbuild/scripts/makeworld Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/makeworld Wed May 11 08:42:29 2011 (r221761) @@ -22,6 +22,9 @@ builddir=${pbd}/${arch}/${branch}/builds . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi # NB: we can't use buildenv because it sets ARCH and MACHINE_ARCH that # confuses cross-builds Modified: projects/portbuild/scripts/mkbindist ============================================================================== --- projects/portbuild/scripts/mkbindist Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/mkbindist Wed May 11 08:42:29 2011 (r221761) @@ -30,6 +30,9 @@ pbd=${PORTBUILD_DATA:-/var/portbuild} . ${pbc}/conf/server.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv Modified: projects/portbuild/scripts/pdispatch ============================================================================== --- projects/portbuild/scripts/pdispatch Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/pdispatch Wed May 11 08:42:29 2011 (r221761) @@ -21,6 +21,9 @@ pbab=${pbd}/${arch}/${branch} . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv timeout=${PDISPATCH_TIMEOUT} Modified: projects/portbuild/scripts/portbuild ============================================================================== --- projects/portbuild/scripts/portbuild Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/portbuild Wed May 11 08:42:29 2011 (r221761) @@ -68,6 +68,9 @@ nice=0 . ${pbd}/${arch}/common.conf # note: should NOT need anything from server.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbd}/${arch}/portbuild.$(hostname) . ${pbd}/scripts/buildenv Modified: projects/portbuild/scripts/prunefailure ============================================================================== --- projects/portbuild/scripts/prunefailure Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/prunefailure Wed May 11 08:42:29 2011 (r221761) @@ -32,6 +32,9 @@ shift 3 . ${pbc}/conf/server.conf . ${pbc}/conf/common.conf . ${pbd}/${arch}/portbuild.conf +if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf +fi . ${pbc}/scripts/buildenv builddir=${pbd}/${arch}/${branch}/builds/${buildid} Modified: projects/portbuild/scripts/setupnode ============================================================================== --- projects/portbuild/scripts/setupnode Wed May 11 07:39:08 2011 (r221760) +++ projects/portbuild/scripts/setupnode Wed May 11 08:42:29 2011 (r221761) @@ -97,6 +97,9 @@ postcopy() { # By now the portbuild.conf files are in place so we can source them . ${pbd}/${arch}/portbuild.conf + if [ -f ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf ]; then + . ${pbd}/${arch}/${branch}/builds/${buildid}/portbuild.conf + fi me=$(hostname) if [ -f ${pbd}/${arch}/portbuild.${me} ] ; then . ${pbd}/${arch}/portbuild.${me} From owner-svn-src-projects@FreeBSD.ORG Wed May 11 08:42:32 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07CF5106566B; Wed, 11 May 2011 08:42:32 +0000 (UTC) (envelope-from flz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EA9758FC13; Wed, 11 May 2011 08:42:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B8gVQd081591; Wed, 11 May 2011 08:42:31 GMT (envelope-from flz@svn.freebsd.org) Received: (from flz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B8gVkP081578; Wed, 11 May 2011 08:42:31 GMT (envelope-from flz@svn.freebsd.org) Message-Id: <201105110842.p4B8gVkP081578@svn.freebsd.org> From: Florent Thoumie Date: Wed, 11 May 2011 08:42:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221762 - in projects/portbuild: conf qmanager scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 08:42:32 -0000 Author: flz Date: Wed May 11 08:42:31 2011 New Revision: 221762 URL: http://svn.freebsd.org/changeset/base/221762 Log: portbuild: don't hardcode package suffix. This isn't yet perfect, but setting pkg_sufx in portbuild.conf will now be mandatory, and will set PKG_SUFX during package creation. Modified: projects/portbuild/conf/common.conf projects/portbuild/qmanager/packagebuild projects/portbuild/scripts/buildscript projects/portbuild/scripts/chopindex projects/portbuild/scripts/claim-chroot projects/portbuild/scripts/dopackages projects/portbuild/scripts/dopackagestats projects/portbuild/scripts/pdispatch projects/portbuild/scripts/portbuild projects/portbuild/scripts/prunefailure projects/portbuild/scripts/prunepkgs projects/portbuild/scripts/stats Modified: projects/portbuild/conf/common.conf ============================================================================== --- projects/portbuild/conf/common.conf Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/conf/common.conf Wed May 11 08:42:31 2011 (r221762) @@ -14,7 +14,6 @@ # LOCALBASE=/usr/local -PKGSUFFIX=.tbz ARCHS_REQUIRING_AOUT_COMPAT="i386" ARCHS_REQUIRING_LINPROCFS="amd64 i386" Modified: projects/portbuild/qmanager/packagebuild ============================================================================== --- projects/portbuild/qmanager/packagebuild Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/qmanager/packagebuild Wed May 11 08:42:31 2011 (r221762) @@ -70,6 +70,8 @@ DEBUG = False categories = {} ports = {} +pkg_sufx = None + # When a build fails we requeue it with a lower priority such that it # will never preempt a phase 1 build but will build when spare # capacity is available. @@ -164,6 +166,7 @@ class Port(object): self.descr = descr self.maintainer = maintainer self.www = www + self.sufx = pkg_sufx # Populated later self.bdep = [] @@ -325,8 +328,8 @@ they still need to know about us as depe def packagename(self, arch, branch, buildid): """ Return the path where a package may be found""" - return "%s/%s/%s/builds/%s/packages/All/%s.tbz" \ - % (pbd, arch, branch, buildid, self.name) + return "%s/%s/%s/builds/%s/packages/All/%s%s" \ + % (pbd, arch, branch, buildid, self.name, self.sufx) def is_stale(self, arch, branch, buildid): """ Does a package need to be (re)-built? @@ -377,8 +380,8 @@ def gettargets(targets): if i.endswith("-all"): cat = i.rpartition("-")[0] plist.update(p.name for p in categories[cat].ports) - elif i.rstrip(".tbz") in ports: - plist.update([ports[i.rstrip(".tbz")].name]) + elif i.rstrip(pkg_sufx) in ports: + plist.update([ports[i.rstrip(pkg_sufx)].name]) else: raise KeyError, i @@ -425,18 +428,18 @@ class worker(threading.Thread): try: runenv={'HOME':"/root", 'PATH':'/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:%s/scripts' + pbc, - 'FD':" ".join(["%s.tbz" % p.name for p in pkg.fdep]), - 'ED':" ".join(["%s.tbz" % p.name for p in pkg.edep]), - 'PD':" ".join(["%s.tbz" % p.name for p in pkg.pdep]), - 'BD':" ".join(["%s.tbz" % p.name for p in pkg.bdep]), - 'RD':" ".join(["%s.tbz" % p.name for p in pkg.rdep])} + 'FD':" ".join([p.name + p.sufx for p in pkg.fdep]), + 'ED':" ".join([p.name + p.sufx for p in pkg.edep]), + 'PD':" ".join([p.name + p.sufx for p in pkg.pdep]), + 'BD':" ".join([p.name + p.sufx for p in pkg.bdep]), + 'RD':" ".join([p.name + p.sufx for p in pkg.rdep])} for var in ["NOCLEAN", "NO_RESTRICTED", "NOPLISTCHECK", "NO_DISTFILES", "FETCH_ORIGINAL", "TRYBROKEN", "PORTBUILD_CHECKOUT", "PORTBUILD_DATA" ]: if var in os.environ: runenv[var] = os.environ.get(var) build = subprocess.Popen( ["/bin/sh", "%s/scripts/pdispatch" % pbc, self.arch, self.branch, self.buildid, self.machine, - "/tmp/%s/scripts/portbuild" % self.buildid, "%s.tbz" % pkg.name, + "/tmp/%s/scripts/portbuild" % self.buildid, pkg.name + pkg.sufx, pkg.path], env=runenv, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, bufsize=0) @@ -506,7 +509,7 @@ class worker(threading.Thread): wrk.start() def main(arch, branch, buildid, args): - global index + global index, pkg_sufx basedir=os.path.realpath(pbd+"/"+arch+"/"+branch+"/builds/"+buildid) buildid=basedir.split("/")[-1] @@ -518,6 +521,18 @@ def main(arch, branch, buildid, args): branchbase = branchbase.split(".")[ 0 ] indexfile=portsdir+"/INDEX-"+branchbase + archconfig = getConfig(pbd, arch, "portbuild.conf") + try: + branchconfig = getConfig(pbd, "%s/%s" % (arch, branch), "portbuild.conf") + archconfig.merge(branchconfig) + except: + pass + + pkg_sufx = archconfig.get('pkg_sufx') + if not pkg_sufx: + print "error: pkg_sufx not defined in portbuild.conf" + sys.exit(1) + print "[MASTER] parseindex..." index = Index(indexfile) index.parse() Modified: projects/portbuild/scripts/buildscript ============================================================================== --- projects/portbuild/scripts/buildscript Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/buildscript Wed May 11 08:42:31 2011 (r221762) @@ -51,8 +51,7 @@ add_pkg() { echo "adding dependencies" for i in $pkgs; do echo "pkg_add $i" - base=$(basename $i .tgz) - base=$(basename $base .tbz) + base=$(basename $i ${pkg_sufx}) if pkg_info -q -e $base; then echo "skipping $base, already added" else @@ -78,8 +77,7 @@ del_pkg() { unset delpkg nextpkg recursion=0 for i in $pkgs; do - base=$(basename $i .tgz) - base=$(basename $base .tbz) + base=$(basename $i ${pkg_sufx}) if [ -s /var/db/pkg/${base}/+REQUIRED_BY ]; then recursion=1 nextpkg="${base} ${nextpkg}" @@ -127,6 +125,9 @@ Z=`ident ${dir}/Makefile | grep 'FreeBSD cd $dir || exit 1 restr=$(make -V RESTRICTED) +# Inherit from environment set by portbuild. +pkg_sufx=${PKG_SUFX} + # Keep restricted distfiles in a subdirectory for extra protection # against leakage if [ ! -z "$restr" ]; then Modified: projects/portbuild/scripts/chopindex ============================================================================== --- projects/portbuild/scripts/chopindex Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/chopindex Wed May 11 08:42:31 2011 (r221762) @@ -1,6 +1,7 @@ #!/usr/bin/env python import os, sys +import re if len(sys.argv) != 3: print "%s: " % sys.argv[0] @@ -12,7 +13,7 @@ pkgdir = sys.argv[2] if not pkgdir.endswith("/All"): pkgdir = pkgdir + "/All" -packages = [pkg for (pkg, ext) in map(os.path.splitext, os.listdir(pkgdir)) if ext == ".tbz"] +packages = [pkg for (pkg, ext) in map(os.path.splitext, os.listdir(pkgdir)) if re.match('[.]t[bgx]z', ext)] index=[] pkgs=[] Modified: projects/portbuild/scripts/claim-chroot ============================================================================== --- projects/portbuild/scripts/claim-chroot Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/claim-chroot Wed May 11 08:42:31 2011 (r221762) @@ -73,7 +73,7 @@ fi . ${pbd}/${arch}/portbuild.$(hostname) buildroot=${scratchdir} -pkgname=${pkgname%.${PKGSUFFIX}} +pkgname=${pkgname%.${pkg_sufx}} chrootdir=${buildroot}/${branch}/${buildid}/chroot Modified: projects/portbuild/scripts/dopackages ============================================================================== --- projects/portbuild/scripts/dopackages Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/dopackages Wed May 11 08:42:31 2011 (r221762) @@ -226,7 +226,7 @@ generatemd5 () { echo "started generating CHECKSUM.MD5 at $(date)" cd ${builddir}/packages/All - find . -name '*.tbz' | sort | sed -e 's/^..//' | xargs md5 > CHECKSUM.MD5 + find . -name "*${pkg_sufx}" | sort | sed -e 's/^..//' | xargs md5 > CHECKSUM.MD5 echo "ended generating CHECKSUM.MD5 at $(date)" } @@ -250,7 +250,7 @@ dobuild() { echo "ended at $(date)" end=$(date +%s) echo "Build took $(date -u -j -r $((end - start)) | awk '{print $4}')" - echo $(ls -1 ${builddir}/packages/All | grep tbz | wc -l) "packages built" + echo $(ls -1 ${builddir}/packages/All | grep ${pkg_sufx} | wc -l) "packages built" echo $(wc -l ${PORTSDIR}/${INDEXFILE} | awk '{print $1}') "lines in INDEX" @@ -648,7 +648,7 @@ if [ "$skipstart" = 0 ]; then rm ${INDEXFILE}.old1 ${INDEXFILE}.1 cd ${PACKAGES}/All - sed "s,$,${PKGSUFFIX}," ${builddir}/.oldports | xargs rm -f + sed "s,$,${pkg_sufx}," ${builddir}/.oldports | xargs rm -f # XXX MCL takes an unknown period of time. # XXX MCL return value not checked. ${pbc}/scripts/prunepkgs ${PORTSDIR}/${INDEXFILE} ${PACKAGES} @@ -731,7 +731,7 @@ fi #rm -rf ${builddir}/bad #mkdir -p ${builddir}/bad #echo "checking packages" -#for i in *${PKGSUFFIX}; do +#for i in *${pkg_sufx}; do # if ! ${PKGZIPCMD} -t $i; then # echo "Warning: package $i is bad, moving to ${builddir}/bad" # # the latest link will be left behind... Modified: projects/portbuild/scripts/dopackagestats ============================================================================== --- projects/portbuild/scripts/dopackagestats Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/dopackagestats Wed May 11 08:42:31 2011 (r221762) @@ -123,7 +123,7 @@ write_row () { n_packages=0 if [ -d $directory/packages/All ]; then # MCL removed 20090808 -- this takes way too long - # n_packages=`find $directory/packages/All -name \*.tbz -or -name \*.tgz |wc -l` + # n_packages=`find $directory/packages/All -name '*.t[bgx]z' | wc -l` n_packages=`ls $directory/packages/All | grep -v CHECKSUM.MD5 | wc -l` have_packages="yes" fi Modified: projects/portbuild/scripts/pdispatch ============================================================================== --- projects/portbuild/scripts/pdispatch Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/pdispatch Wed May 11 08:42:31 2011 (r221762) @@ -2,7 +2,7 @@ # $FreeBSD: ports/Tools/portbuild/scripts/pdispatch,v 1.40 2011/01/26 10:41:53 linimon Exp $ # -# pdispatch [ ...] +# pdispatch [ ...] # # server-side script to dispatch the job to a host via the ptimeout script. @@ -50,7 +50,7 @@ if [ -z "${scp_cmd}" ]; then scp_cmd=scp fi -pkgname=$(basename $1 ${PKGSUFFIX}) +pkgname=$(basename $1 ${pkg_sufx}) if [ -z "${pkgname}" ]; then echo "null packagename" @@ -150,7 +150,7 @@ error=$? # Pull in the results of the build from the client ${scp_cmd} ${client_user}@${host}:${chroot}/tmp/${pkgname}.log ${builddir}/logs/${pkgname}.log -(${ssh_cmd} -a -n ${client_user}@${host} test -f ${chroot}/tmp/work.tbz ) && ${scp_cmd} ${client_user}@${host}:${chroot}/tmp/work.tbz ${builddir}/wrkdirs/${pkgname}.tbz +(${ssh_cmd} -a -n ${client_user}@${host} test -f ${chroot}/tmp/work.tbz ) && ${scp_cmd} ${client_user}@${host}:${chroot}/tmp/work.tbz ${builddir}/wrkdirs/${pkgname}${pkg_sufx} # XXX Set dirty flag if any of the scp's fail @@ -164,8 +164,8 @@ if [ "${error}" = 0 ]; then tar --unlink -C ${builddir} -xvf - # XXX why is this needed? - test -f ${builddir}/packages/All/${pkgname}${PKGSUFFIX} && \ - touch ${builddir}/packages/All/${pkgname}${PKGSUFFIX} + test -f ${builddir}/packages/All/${pkgname}${pkg_sufx} && \ + touch ${builddir}/packages/All/${pkgname}${pkg_sufx} if [ -f ${builddir}/errors/${pkgname}.log ]; then rm -f ${builddir}/errors/${pkgname}.log Modified: projects/portbuild/scripts/portbuild ============================================================================== --- projects/portbuild/scripts/portbuild Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/portbuild Wed May 11 08:42:31 2011 (r221762) @@ -130,7 +130,7 @@ unset __MAKE_CONF # set overrides for make.conf export BACKUP_FTP_SITE=${CLIENT_BACKUP_FTP_SITE} -pkgname=$(basename $6 ${PKGSUFFIX}) +pkgname=$(basename $6 ${pkg_sufx}) dirname=$7 shift 2 @@ -143,6 +143,7 @@ export DISTDIR=${CLIENT_DISTDIR} export LOCALBASE=${LOCALBASE} export PACKAGES=${CLIENT_PACKAGES_LOCATION} export SRC_BASE=${CLIENT_SRCBASE} +export PKG_SUFX=${pkg_sufx} # to catch missing dependencies #export DEPENDS_TARGET=/usr/bin/true Modified: projects/portbuild/scripts/prunefailure ============================================================================== --- projects/portbuild/scripts/prunefailure Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/prunefailure Wed May 11 08:42:31 2011 (r221762) @@ -74,7 +74,7 @@ while read dir name ver olddate date cou newver=$(echo $entry | awk '{print $1}') - if [ -e "${builddir}/packages/All/$newver${PKGSUFFIX}" ]; then + if [ -e "${builddir}/packages/All/$newver${pkg_sufx}" ]; then echo "$newver package exists, should not still be here!" rm -f ${pbd}/${arch}/${branch}/latest/${dir} continue Modified: projects/portbuild/scripts/prunepkgs ============================================================================== --- projects/portbuild/scripts/prunepkgs Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/prunepkgs Wed May 11 08:42:31 2011 (r221762) @@ -30,7 +30,7 @@ trap "rm -rf $tmpdir; exit 1" 1 2 3 5 10 # Check for non-package files -extras=$(find ${pkgdir} -type f \! \( -name INDEX -o -name CHECKSUM.MD5 -o -name \*.tgz -o -name \*.tbz \) ) +extras=$(find ${pkgdir} -type f \! \( -name INDEX -o -name CHECKSUM.MD5 -o -name '*.t[bgx]z' \) ) echo "==> Removing extra files" echo $extras if [ "x${extras}" != "x" ]; then @@ -42,14 +42,14 @@ fi # Check for files not present in INDEX echo "==> Removing extra package files" -find $pkgdir/All -type f -name \*.tgz -o -name \*.tbz | sed -e "s,${pkgdir}/All/,," -e 's,\.tbz$,,' -e 's,\.tgz$,,' |sort > ${tmpdir}/files +find $pkgdir/All -type f -name '*.t[bgx]z' | sed -e "s,${pkgdir}/All/,," -e 's,\.t[bgx]z$,,' |sort > ${tmpdir}/files cut -f 1 -d '|' ${index} |sort > ${tmpdir}/packages extras=$(comm -2 -3 ${tmpdir}/files ${tmpdir}/packages) echo $extras if [ "${dummy}" = "0" ]; then for i in $extras; do - rm -f $pkgdir/All/${i}.tgz $pkgdir/All/${i}.tbz + rm -f $pkgdir/All/${i}.t[bgx]z done fi Modified: projects/portbuild/scripts/stats ============================================================================== --- projects/portbuild/scripts/stats Wed May 11 08:42:29 2011 (r221761) +++ projects/portbuild/scripts/stats Wed May 11 08:42:31 2011 (r221762) @@ -15,7 +15,7 @@ branch=$1 for i in ${SUPPORTED_ARCHS}; do all=${pbd}/$i/${branch}/builds/latest/packages/All if [ -d ${all} ]; then - count=$(find ${all} -name \*.tbz -o -name \*.tgz |wc -l) + count=$(find ${all} -name '*.t[bgx]z' | wc -l) echo -n "$i: ${count} " fi done From owner-svn-src-projects@FreeBSD.ORG Wed May 11 08:42:33 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BA141065674; Wed, 11 May 2011 08:42:33 +0000 (UTC) (envelope-from flz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4BEFB8FC15; Wed, 11 May 2011 08:42:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4B8gXAh081625; Wed, 11 May 2011 08:42:33 GMT (envelope-from flz@svn.freebsd.org) Received: (from flz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4B8gXlL081623; Wed, 11 May 2011 08:42:33 GMT (envelope-from flz@svn.freebsd.org) Message-Id: <201105110842.p4B8gXlL081623@svn.freebsd.org> From: Florent Thoumie Date: Wed, 11 May 2011 08:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221763 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 08:42:33 -0000 Author: flz Date: Wed May 11 08:42:32 2011 New Revision: 221763 URL: http://svn.freebsd.org/changeset/base/221763 Log: portbuild: fix error message. Modified: projects/portbuild/scripts/dosetupnode Modified: projects/portbuild/scripts/dosetupnode ============================================================================== --- projects/portbuild/scripts/dosetupnode Wed May 11 08:42:31 2011 (r221762) +++ projects/portbuild/scripts/dosetupnode Wed May 11 08:42:32 2011 (r221763) @@ -71,7 +71,7 @@ setup() { fi cmdpath=$(cat ${pbc}/scripts/setupnode | ssh -a ${client_user}@${node} 't=$(mktemp -t setupnode); cat >$t; echo $t; chmod 755 $t') - case ${cmdpath} in /tmp/*) ;; *) echo "Failed to run dosetupnode on ${host}."; return 1;; esac + case ${cmdpath} in /tmp/*) ;; *) echo "Failed to upload or run setupnode on ${node}."; return 1;; esac client_setup="${ssh_cmd} -n ${client_user}@${node} ${cmdpath} ${pbd} ${arch} ${branch} ${buildid} ${scratchdir} \"${portsmd5}\" \"${srcmd5}\" \"${bindistmd5}\"" args="${nocopy} ${force}" From owner-svn-src-projects@FreeBSD.ORG Wed May 11 21:10:44 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2B7C1065673; Wed, 11 May 2011 21:10:43 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D83418FC0C; Wed, 11 May 2011 21:10:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4BLAhP6006268; Wed, 11 May 2011 21:10:43 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4BLAhlK006265; Wed, 11 May 2011 21:10:43 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105112110.p4BLAhlK006265@svn.freebsd.org> From: Marius Strobl Date: Wed, 11 May 2011 21:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221790 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 21:10:44 -0000 Author: marius Date: Wed May 11 21:10:43 2011 New Revision: 221790 URL: http://svn.freebsd.org/changeset/base/221790 Log: Update for the fact that pm_active and pc_cpumask were changed to cpuset_t. This now calculates pc_cpumask based on pc_cpuid itself as the former is slated for being deorbited. This branch now at least boots UP again. MP needs more things converted and the existing conversion from cpumask_t to cpuset_t still has bugs. Modified: projects/largeSMP/sys/sparc64/sparc64/genassym.c projects/largeSMP/sys/sparc64/sparc64/swtch.S Modified: projects/largeSMP/sys/sparc64/sparc64/genassym.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/genassym.c Wed May 11 20:31:27 2011 (r221789) +++ projects/largeSMP/sys/sparc64/sparc64/genassym.c Wed May 11 21:10:43 2011 (r221790) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -66,6 +67,8 @@ ASSYM(PCPU_PAGES, PCPU_PAGES); ASSYM(TAR_VPN_SHIFT, TAR_VPN_SHIFT); +ASSYM(_NCPUBITS, _NCPUBITS); + #ifdef SUN4U ASSYM(TLB_DEMAP_ALL, TLB_DEMAP_ALL); #endif Modified: projects/largeSMP/sys/sparc64/sparc64/swtch.S ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/swtch.S Wed May 11 20:31:27 2011 (r221789) +++ projects/largeSMP/sys/sparc64/sparc64/swtch.S Wed May 11 21:10:43 2011 (r221790) @@ -164,20 +164,29 @@ ENTRY(cpu_switch) * If there was no non-kernel pmap, don't try to deactivate it. */ brz,pn %l2, 3f - lduw [PCPU(CPUMASK)], %l4 + lduw [PCPU(CPUID)], %l3 /* * Mark the pmap of the last non-kernel vmspace to run as no longer * active on this CPU. */ - lduw [%l2 + PM_ACTIVE], %l3 - andn %l3, %l4, %l3 - stw %l3, [%l2 + PM_ACTIVE] + mov _NCPUBITS, %l5 + mov %g0, %y + udiv %l3, %l5, %l6 + srl %l6, 0, %l4 + sllx %l4, PTR_SHIFT, %l4 + add %l4, PM_ACTIVE, %l4 + smul %l6, %l5, %l5 + sub %l3, %l5, %l5 + mov 1, %l6 + sllx %l6, %l5, %l5 + ldx [%l2 + %l4], %l6 + andn %l6, %l5, %l6 + stx %l6, [%l2 + %l4] /* * Take away its context number. */ - lduw [PCPU(CPUID)], %l3 sllx %l3, INT_SHIFT, %l3 add %l2, PM_CONTEXT, %l4 mov -1, %l5 @@ -210,18 +219,27 @@ ENTRY(cpu_switch) /* * Set the new context number in the pmap. */ - lduw [PCPU(CPUID)], %i4 - sllx %i4, INT_SHIFT, %i4 + lduw [PCPU(CPUID)], %l3 + sllx %l3, INT_SHIFT, %i4 add %l1, PM_CONTEXT, %i5 stw %i3, [%i4 + %i5] /* * Mark the pmap as active on this CPU. */ - lduw [%l1 + PM_ACTIVE], %i4 - lduw [PCPU(CPUMASK)], %i5 - or %i4, %i5, %i4 - stw %i4, [%l1 + PM_ACTIVE] + mov _NCPUBITS, %l5 + mov %g0, %y + udiv %l3, %l5, %l6 + srl %l6, 0, %l4 + sllx %l4, PTR_SHIFT, %l4 + add %l4, PM_ACTIVE, %l4 + smul %l6, %l5, %l5 + sub %l3, %l5, %l5 + mov 1, %l6 + sllx %l6, %l5, %l5 + ldx [%l1 + %l4], %l6 + or %l6, %l5, %l6 + stx %l6, [%l1 + %l4] /* * Make note of the change in pmap. From owner-svn-src-projects@FreeBSD.ORG Wed May 11 21:15:12 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A88E01065676; Wed, 11 May 2011 21:15:12 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9986C8FC0C; Wed, 11 May 2011 21:15:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4BLFC8K006444; Wed, 11 May 2011 21:15:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4BLFCGW006442; Wed, 11 May 2011 21:15:12 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105112115.p4BLFCGW006442@svn.freebsd.org> From: Marius Strobl Date: Wed, 11 May 2011 21:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221791 - projects/largeSMP/sys/sparc64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 21:15:12 -0000 Author: marius Date: Wed May 11 21:15:12 2011 New Revision: 221791 URL: http://svn.freebsd.org/changeset/base/221791 Log: The ita_mask should include curcpu but the cpuset passed to cpu_ipi_selected() must not, otherwise we tell the CPU to IPI itself, which the sun4u CPUs don't support. For reasons unknown so far MD and MI IPI use actually still triggers that assertion though. Modified: projects/largeSMP/sys/sparc64/include/smp.h Modified: projects/largeSMP/sys/sparc64/include/smp.h ============================================================================== --- projects/largeSMP/sys/sparc64/include/smp.h Wed May 11 21:10:43 2011 (r221790) +++ projects/largeSMP/sys/sparc64/include/smp.h Wed May 11 21:15:12 2011 (r221791) @@ -222,8 +222,8 @@ ipi_tlb_context_demap(struct pmap *pm) } ita = &ipi_tlb_args; mtx_lock_spin(&ipi_mtx); - CPU_OR(&cpus, PCPU_PTR(cpumask)); ita->ita_mask = cpus; + CPU_OR(&ita->ita_mask, PCPU_PTR(cpumask)); ita->ita_pmap = pm; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, (u_long)ita); @@ -247,8 +247,8 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o } ita = &ipi_tlb_args; mtx_lock_spin(&ipi_mtx); - CPU_OR(&cpus, PCPU_PTR(cpumask)); ita->ita_mask = cpus; + CPU_OR(&ita->ita_mask, PCPU_PTR(cpumask)); ita->ita_pmap = pm; ita->ita_va = va; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_page_demap, (u_long)ita); @@ -272,8 +272,8 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ } ita = &ipi_tlb_args; mtx_lock_spin(&ipi_mtx); - CPU_OR(&cpus, PCPU_PTR(cpumask)); ita->ita_mask = cpus; + CPU_OR(&ita->ita_mask, PCPU_PTR(cpumask)); ita->ita_pmap = pm; ita->ita_start = start; ita->ita_end = end; From owner-svn-src-projects@FreeBSD.ORG Wed May 11 21:28:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC81F1065670; Wed, 11 May 2011 21:28:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 547968FC16; Wed, 11 May 2011 21:28:34 +0000 (UTC) Received: by gwb15 with SMTP id 15so407876gwb.13 for ; Wed, 11 May 2011 14:28:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=F8RAdRck6qOvJPox02N6abHcOHwu/lhoSPfINKhfCPg=; b=wPxZady4mXqmdQbfEzFcJNVD5ulNOojnDAeBIURakyeKrVGve2jQx4I+yeJd3I0LXt ejeDPsHaK8LY0tqUdA55TfdVftE5/gHHVJc5GPJntE2CuAYZLEEsQ9wrVKvWULF8MCMh GXwXyel0m1ob5ZMZm8th7nxXs0IUtNvgVz2L4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=TpuiQJEV5A6zXHgO8L5VbKir3AjJixdSWoGqQcxff8uwEZr5UtWseOomimUqu1aL56 sejYb7IYDHF1BBWKCgXth6EzZCX4Zm8mts8UPKdAz2DQU38LXF40eHeR/r3qVMMWKWr6 aQNssILgiDCHTzsSmvRbiQDMfP/nO9o+NZ1sM= MIME-Version: 1.0 Received: by 10.236.180.36 with SMTP id i24mr5418190yhm.305.1305149313527; Wed, 11 May 2011 14:28:33 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Wed, 11 May 2011 14:28:33 -0700 (PDT) In-Reply-To: <201105112115.p4BLFCGW006442@svn.freebsd.org> References: <201105112115.p4BLFCGW006442@svn.freebsd.org> Date: Wed, 11 May 2011 23:28:33 +0200 X-Google-Sender-Auth: 5ND3ANBYUljAt38wmdB-5g80A1w Message-ID: From: Attilio Rao To: Marius Strobl Content-Type: text/plain; charset=UTF-8 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221791 - projects/largeSMP/sys/sparc64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 21:28:34 -0000 2011/5/11 Marius Strobl : > Author: marius > Date: Wed May 11 21:15:12 2011 > New Revision: 221791 > URL: http://svn.freebsd.org/changeset/base/221791 Thanks a lot for your commit. I see you didn't commit yet the mp_machdep part, is that any problem with it? I also will send you a patch for disconnecting from the tree sun4v (and then possibly reaping the files). Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Wed May 11 22:05:38 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 16037106566C for ; Wed, 11 May 2011 22:05:38 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id A630D8FC08 for ; Wed, 11 May 2011 22:05:37 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p4BLoJv2041668; Wed, 11 May 2011 23:50:19 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p4BLoJ1D041667; Wed, 11 May 2011 23:50:19 +0200 (CEST) (envelope-from marius) Date: Wed, 11 May 2011 23:50:19 +0200 From: Marius Strobl To: Attilio Rao Message-ID: <20110511215019.GU92688@alchemy.franken.de> References: <201105112115.p4BLFCGW006442@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221791 - projects/largeSMP/sys/sparc64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 22:05:38 -0000 On Wed, May 11, 2011 at 11:28:33PM +0200, Attilio Rao wrote: > 2011/5/11 Marius Strobl : > > Author: marius > > Date: Wed May 11 21:15:12 2011 > > New Revision: 221791 > > URL: http://svn.freebsd.org/changeset/base/221791 > > Thanks a lot for your commit. > I see you didn't commit yet the mp_machdep part, is that any problem with it? Given that I currently don't understand how the remaining problems I'm seeing with largeSMP actually can happen I'm just using the hack of just changing the 32-bit assembler instructions into 64-bit ones assuming that _NCPUWORDS is 1 for now as I described earlier. So the properly converted mp_exception.S isn't really tested so far, which is why I haven't commited it, yet, if that's what you meant by mp_machdep part. Marius From owner-svn-src-projects@FreeBSD.ORG Thu May 12 02:00:37 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F4761065673; Thu, 12 May 2011 02:00:37 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id A8F268FC16; Thu, 12 May 2011 02:00:36 +0000 (UTC) Received: by yie12 with SMTP id 12so479134yie.13 for ; Wed, 11 May 2011 19:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=cWqj3odxt1pjv7KwThOXJ7fvTWMMvwpw8dD49YHcpbE=; b=xmMD0kOEgABAeQ6NQC9jM+JtindC8mJrlGgx9jB+wCzrD9qFyC8J4Id39rz9IMEA30 9HQ74g2sIjwRkVoPzZcgreQwfig8c75MIlbsI5W5BIBOX/Fs75p2gGaRVLiztwe+pLwM Ir2Psj3AuDIijKWfZeZVx6NAs/4NEAyqWulGo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=uIw2/y6KBQEQWS6lXbQJtVhNEVbnt/qruSbG8ov/s8a0nd2vqsl7FfTh0Z/OmcoFTo tWJCUwRJXyX5p2qlHx24TF5EWcjBg+rEw91Z5Rhc+FuF50w7S3XXK/OtNKlCV6oJaU2y O86yrcKR6X7LALNwtpnT3DQIlrebLZmMcFkA0= MIME-Version: 1.0 Received: by 10.236.180.36 with SMTP id i24mr5592527yhm.305.1305165635960; Wed, 11 May 2011 19:00:35 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Wed, 11 May 2011 19:00:35 -0700 (PDT) In-Reply-To: <20110511215019.GU92688@alchemy.franken.de> References: <201105112115.p4BLFCGW006442@svn.freebsd.org> <20110511215019.GU92688@alchemy.franken.de> Date: Thu, 12 May 2011 04:00:35 +0200 X-Google-Sender-Auth: 1wpaThzQTzFj9y3u_vOAlf3CA9o Message-ID: From: Attilio Rao To: Marius Strobl Content-Type: text/plain; charset=UTF-8 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221791 - projects/largeSMP/sys/sparc64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 02:00:37 -0000 2011/5/11 Marius Strobl : > On Wed, May 11, 2011 at 11:28:33PM +0200, Attilio Rao wrote: >> 2011/5/11 Marius Strobl : >> > Author: marius >> > Date: Wed May 11 21:15:12 2011 >> > New Revision: 221791 >> > URL: http://svn.freebsd.org/changeset/base/221791 >> >> Thanks a lot for your commit. >> I see you didn't commit yet the mp_machdep part, is that any problem with it? > > Given that I currently don't understand how the remaining problems > I'm seeing with largeSMP actually can happen I'm just using the > hack of just changing the 32-bit assembler instructions into 64-bit > ones assuming that _NCPUWORDS is 1 for now as I described earlier. > So the properly converted mp_exception.S isn't really tested so far, > which is why I haven't commited it, yet, if that's what you meant > by mp_machdep part. Yes, sorry. Could you please explain what the code you are trying to change does? Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 03:15:40 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50BE1106566B; Thu, 12 May 2011 03:15:40 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 9A28E8FC15; Thu, 12 May 2011 03:15:39 +0000 (UTC) Received: by yxl31 with SMTP id 31so498985yxl.13 for ; Wed, 11 May 2011 20:15:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=hRgRbrXckwXM70D527ti7IVlBqiwAIJ0+T75TblHywo=; b=WDojGJ1mvrrSWbYY7NIPTMdhbzUNkxG/LK9dNcryWm7dT6tTnzMw9654A270LIb7kY 3dulvHr+pbjsE8duLFRcYXhoGPTG744muqSN/wUTIQLcvQvFQpTtT654oxVFfHHIb+6c J6DyKX4whuUZ0pHpp/jdwjVlP6636V1xV66DM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=YXHqW51kNZUzRnIEBfiq4LbJ79+5sTCiOBqZrUash/2KYbasy8qYxrilqEAFrr7Xcu Hm5kVHJBaznfDOxCierhmyeWCpOHfQYEuGhkAGvwwlTScOcS+r6rTLgjDLhjT4RI3vKj CiyyXY1CvgpERAPtKlPvydPniEKf5Y5AAIdxs= MIME-Version: 1.0 Received: by 10.236.180.36 with SMTP id i24mr5635233yhm.305.1305170138772; Wed, 11 May 2011 20:15:38 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Wed, 11 May 2011 20:15:38 -0700 (PDT) In-Reply-To: <201105080039.p480doiZ021493@svn.freebsd.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 05:15:38 +0200 X-Google-Sender-Auth: zGanDpIW3NgBZIu1JyKqMk7wSHo Message-ID: From: Attilio Rao To: src-committers@freebsd.org, svn-src-projects@freebsd.org, Bruce Evans , Warner Losh , Artem Belevich , Oleksandr Tymoshenko Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 03:15:40 -0000 2011/5/8 Attilio Rao : > Author: attilio > Date: Sun May =C2=A08 00:39:49 2011 > New Revision: 221614 > URL: http://svn.freebsd.org/changeset/base/221614 > > Log: > =C2=A0All architectures define the size-bounded types (uint32_t, uint64_t= , etc.) > =C2=A0starting from base C types (int, long, etc). mips seems having the same issue, so here is my patch: http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff Please note that mips defines the 16/8 bits functions within support.S but it really hadn't do (I didn't rewrite as inline functions because I wasn't confident enough with modifying mips assembly). In this patch I removed the 8-bits operations like they aren't used anywhere and actually they weren't complete at all. I tried almost all the MIPS config file with all modules and they compile fine with this patch. I have cpumask_t -> cpuset_t conversion ready and I'd commit to this tree just after someone has tested this atomic alone. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 04:30:50 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A31F91065678; Thu, 12 May 2011 04:30:50 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 0AC3D8FC0A; Thu, 12 May 2011 04:30:49 +0000 (UTC) Received: by qwc9 with SMTP id 9so780107qwc.13 for ; Wed, 11 May 2011 21:30:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pPBJPaRhXsDLYRWYD5GH2YnSV3Lp9KaYi4pg/BokbfY=; b=OXLt5EgxEMCvpzfx9G5QXaPo3OPNfu3XONkDI+Px8I50AcUoZrI6McEWlHfIow43FU ChP8tEJDBhBtL1Bk/VqCiwyVKA8apEiybFfCglr48LPC/HG3V8gH4dfgaFoweg9b22OG A771iRXT/02lbp58BmBqmAhc/R6zv55P42pcg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mMWECCqiH1V5/mScYDQqRdhKs+t02Aoh23gd53W3xiqDDQ0ZqWIIGFfse4cPIoqNgy 8yKk1wAIHKexBMvUEP3L2HIHdHptygkxRQ6p4UBsP3YCkmOTGISyMLdHfgLBcHUqUGQQ YHKXKH5X+qRdq6gIePfsETdF0taEAIV1iuKcM= MIME-Version: 1.0 Received: by 10.229.126.129 with SMTP id c1mr7657418qcs.6.1305173038265; Wed, 11 May 2011 21:03:58 -0700 (PDT) Sender: artemb@gmail.com Received: by 10.229.95.140 with HTTP; Wed, 11 May 2011 21:03:58 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 06:03:58 +0200 X-Google-Sender-Auth: i95xhCGK4KhOn8JinVNjjfz027c Message-ID: From: Artem Belevich To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 04:30:50 -0000 On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wrote: > 2011/5/8 Attilio Rao : >> Author: attilio >> Date: Sun May =A08 00:39:49 2011 >> New Revision: 221614 >> URL: http://svn.freebsd.org/changeset/base/221614 >> >> Log: >> =A0All architectures define the size-bounded types (uint32_t, uint64_t, = etc.) >> =A0starting from base C types (int, long, etc). > > mips seems having the same issue, so here is my patch: > http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff I see at least one problem. N32 ABI is ILP32 even though it can use 64-bit registers for "long long". > #if defined(__mips_n64) || defined(__mips_n32) > static __inline void >-atomic_set_64(__volatile uint64_t *p, uint64_t v) >+atomic_set_long(__volatile u_long *p, u_long v) Using _long here would not match the assembly on N32. If you stick with your changes, then you should drop __mips_n32 from the ifdef above. You may also want to add atomic_*_longlong for n32. Actually, for o64 as we= ll. I think for mips sticking with atomic_*_ would be a better fit considering ABI zoo we potentially have to deal with. --Artem From owner-svn-src-projects@FreeBSD.ORG Thu May 12 09:29:25 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AC271065674; Thu, 12 May 2011 09:29:25 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2E5F8FC0A; Thu, 12 May 2011 09:29:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4C9TOQT029007; Thu, 12 May 2011 09:29:24 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4C9TOfJ029004; Thu, 12 May 2011 09:29:24 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105120929.p4C9TOfJ029004@svn.freebsd.org> From: Marius Strobl Date: Thu, 12 May 2011 09:29:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221805 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 09:29:25 -0000 Author: marius Date: Thu May 12 09:29:24 2011 New Revision: 221805 URL: http://svn.freebsd.org/changeset/base/221805 Log: Update for the fact that the first members of the IPI args structures and pc_cpumask were changed to cpuset_t. This now calculates the cpumask based on pc_cpuid itself as pc_cpumask is slated for being deorbited. Note that this needs r221750 to be MFC'ed in order to compile. This seems to work fine but after a few dozens of successful IPIs something suddenly adds pc_cpuid to pc_other_cpus, causing the respective assertions in mp_machdep.c to be triggered when the latter is used as the base for the targets. Modified: projects/largeSMP/sys/sparc64/sparc64/genassym.c projects/largeSMP/sys/sparc64/sparc64/mp_exception.S Modified: projects/largeSMP/sys/sparc64/sparc64/genassym.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/genassym.c Thu May 12 09:24:50 2011 (r221804) +++ projects/largeSMP/sys/sparc64/sparc64/genassym.c Thu May 12 09:29:24 2011 (r221805) @@ -164,7 +164,6 @@ ASSYM(MAXCOMLEN, MAXCOMLEN); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); -ASSYM(PC_CPUMASK, offsetof(struct pcpu, pc_cpumask)); ASSYM(PC_IRHEAD, offsetof(struct pcpu, pc_irhead)); ASSYM(PC_IRTAIL, offsetof(struct pcpu, pc_irtail)); ASSYM(PC_IRFREE, offsetof(struct pcpu, pc_irfree)); Modified: projects/largeSMP/sys/sparc64/sparc64/mp_exception.S ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/mp_exception.S Thu May 12 09:24:50 2011 (r221804) +++ projects/largeSMP/sys/sparc64/sparc64/mp_exception.S Thu May 12 09:29:24 2011 (r221805) @@ -38,9 +38,19 @@ __FBSDID("$FreeBSD$"); .register %g2, #ignore .register %g3, #ignore -#define IPI_DONE(r1, r2, r3, r4) \ - lduw [PCPU(CPUMASK)], r4 ; \ - ATOMIC_CLEAR_INT(r1, r2, r3, r4) +#define IPI_DONE(r1, r2, r3, r4, r5) \ + lduw [PCPU(CPUID)], r2 ; \ + mov _NCPUBITS, r3 ; \ + mov %g0, %y ; \ + udiv r2, r3, r4 ; \ + srl r4, 0, r5 ; \ + sllx r5, PTR_SHIFT, r5 ; \ + add r1, r5, r1 ; \ + smul r4, r3, r3 ; \ + sub r2, r3, r3 ; \ + mov 1, r4 ; \ + sllx r4, r3, r4 ; \ + ATOMIC_CLEAR_LONG(r1, r2, r3, r4) /* * Invalidate a physical page in the data cache. For UltraSPARC I and II. @@ -77,7 +87,7 @@ ENTRY(tl_ipi_spitfire_dcache_page_inval) 2: brgz,pt %g2, 1b sub %g2, %g4, %g2 - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_spitfire_dcache_page_inval) @@ -117,7 +127,7 @@ ENTRY(tl_ipi_spitfire_icache_page_inval) 2: brgz,pt %g2, 1b sub %g2, %g4, %g2 - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_spitfire_icache_page_inval) @@ -148,7 +158,7 @@ ENTRY(tl_ipi_cheetah_dcache_page_inval) blt,a,pt %xcc, 1b nop - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_cheetah_dcache_page_inval) @@ -204,7 +214,7 @@ ENTRY(tl_ipi_tlb_page_demap) stxa %g0, [%g2] ASI_IMMU_DEMAP flush %g3 - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tlb_page_demap) @@ -247,7 +257,7 @@ ENTRY(tl_ipi_tlb_range_demap) blt,a,pt %xcc, 1b nop - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tlb_range_demap) @@ -271,7 +281,7 @@ ENTRY(tl_ipi_tlb_context_demap) stxa %g0, [%g1] ASI_IMMU_DEMAP flush %g3 - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tlb_context_demap) @@ -283,7 +293,7 @@ ENTRY(tl_ipi_stick_rd) rd %asr24, %g2 stx %g2, [%g1] - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_stick_rd) @@ -295,6 +305,6 @@ ENTRY(tl_ipi_tick_rd) rd %tick, %g2 stx %g2, [%g1] - IPI_DONE(%g5, %g1, %g2, %g3) + IPI_DONE(%g5, %g1, %g2, %g3, %g4) retry END(tl_ipi_tick_rd) From owner-svn-src-projects@FreeBSD.ORG Thu May 12 09:41:53 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8DDD106566B; Thu, 12 May 2011 09:41:53 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 63B8F8FC12; Thu, 12 May 2011 09:41:53 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p4C9fqa5044341; Thu, 12 May 2011 11:41:52 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p4C9fqea044340; Thu, 12 May 2011 11:41:52 +0200 (CEST) (envelope-from marius) Date: Thu, 12 May 2011 11:41:52 +0200 From: Marius Strobl To: Attilio Rao Message-ID: <20110512094152.GV92688@alchemy.franken.de> References: <201105112115.p4BLFCGW006442@svn.freebsd.org> <20110511215019.GU92688@alchemy.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221791 - projects/largeSMP/sys/sparc64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 09:41:54 -0000 On Thu, May 12, 2011 at 04:00:35AM +0200, Attilio Rao wrote: > 2011/5/11 Marius Strobl : > > On Wed, May 11, 2011 at 11:28:33PM +0200, Attilio Rao wrote: > >> 2011/5/11 Marius Strobl : > >> > Author: marius > >> > Date: Wed May 11 21:15:12 2011 > >> > New Revision: 221791 > >> > URL: http://svn.freebsd.org/changeset/base/221791 > >> > >> Thanks a lot for your commit. > >> I see you didn't commit yet the mp_machdep part, is that any problem with it? > > > > Given that I currently don't understand how the remaining problems > > I'm seeing with largeSMP actually can happen I'm just using the > > hack of just changing the 32-bit assembler instructions into 64-bit > > ones assuming that _NCPUWORDS is 1 for now as I described earlier. > > So the properly converted mp_exception.S isn't really tested so far, > > which is why I haven't commited it, yet, if that's what you meant > > by mp_machdep part. > > Yes, sorry. > > Could you please explain what the code you are trying to change does? > It's the IPI_DONE macro which clears cpuid/cpumask in the first members of the IPI args structures (ita_mask etc) once a receiving CPU has handled the cross-call. Given that it survives the first dozens of IPIs just like the hacked version I've committed it in r221805. Note that this needs r221750 to be MFC'ed in order to compile. The only thing which I currently can think of causing the courruption of pc_other_cpus is that I'm testing with a non-largeSMP userland. Is there something which fiddles with the pcpu stuff from userland? If so we have a big problem with the upgrade path ... On the other hand given that it's always pc_cpuid which get's added to pc_other_cpus this doesn't really look like a random corruption caused by an ABI breakage or a wrong offset used etc. Marius From owner-svn-src-projects@FreeBSD.ORG Thu May 12 13:22:15 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B7D6106564A; Thu, 12 May 2011 13:22:15 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id BA2368FC1A; Thu, 12 May 2011 13:22:14 +0000 (UTC) Received: by yie12 with SMTP id 12so634359yie.13 for ; Thu, 12 May 2011 06:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=A2UIrtnYzNLA9JyvtMJTX41JU+iMaVFfoi4DTN3XKd0=; b=XPMsFmLo413iMwJq+9nEJc5ENbL4Yv0+9sMcE2A0M/8XZIauyonECCJn2HswMIGywu 3MvtoJR40nszU/M2OX/dxbFCM/seEkWxnT41hP0upRUsTKHUGIyE0P77Z7koKWiWQSKf SaQPRdqeFxS2/jZu66R3xM580/hpCQrHdwKMQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Y/KPbC9UzLFRpnpPlXE6E/+Pyrc6sG2AaDYNTDXXKvloRTnRmNC+jDda983FdxYCEZ 2pksBuQIRKHmcinR3iLTL2UqGC5PIlZpQGOnlCfbALEs/q0pY6tn2nnaO1gIHgCxDaPF i1U9BNKusZtlkEaK8JHGznCBDKwJ7IZ8cdRS0= MIME-Version: 1.0 Received: by 10.236.153.103 with SMTP id e67mr157690yhk.372.1305206534013; Thu, 12 May 2011 06:22:14 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Thu, 12 May 2011 06:22:13 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 15:22:13 +0200 X-Google-Sender-Auth: MVkdUTKdf4bPOdXH28kOqQTShxw Message-ID: From: Attilio Rao To: Artem Belevich Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 13:22:15 -0000 2011/5/12 Artem Belevich : > On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wrote: >> 2011/5/8 Attilio Rao : >>> Author: attilio >>> Date: Sun May =C2=A08 00:39:49 2011 >>> New Revision: 221614 >>> URL: http://svn.freebsd.org/changeset/base/221614 >>> >>> Log: >>> =C2=A0All architectures define the size-bounded types (uint32_t, uint64= _t, etc.) >>> =C2=A0starting from base C types (int, long, etc). >> >> mips seems having the same issue, so here is my patch: >> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff > > I see at least one problem. N32 ABI is ILP32 even though it can use > 64-bit registers for "long long". I'm sorry but this _longlong is non standard for our atomic scheme, nothing in the kernel uses it and in general I'd say to not add them if not strictly necessary. Said that, in the -CURRENT code it doesn't seem present, or I'm missing it? >> #if defined(__mips_n64) || defined(__mips_n32) >> static __inline void >>-atomic_set_64(__volatile uint64_t *p, uint64_t v) >>+atomic_set_long(__volatile u_long *p, u_long v) > > Using _long here would not match the assembly on N32. > > If you stick with your changes, then you should drop __mips_n32 from > the ifdef above. > You may also want to add atomic_*_longlong for n32. Actually, for o64 as = well. I'm not entirely sure in which way the above is different... or at least, I may have overlooked the _long support for __mips_n32... can you please elaborate a bit more? > I think for mips sticking with atomic_*_ would be a better fit > considering ABI zoo we potentially have to deal with. Actually you still have them, it is just the dipendency that changes. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 14:01:41 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6360106566B; Thu, 12 May 2011 14:01:41 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 924BF8FC1E; Thu, 12 May 2011 14:01:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4CE1fSS039769; Thu, 12 May 2011 14:01:41 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4CE1fVN039746; Thu, 12 May 2011 14:01:41 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105121401.p4CE1fVN039746@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 May 2011 14:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221810 - in projects/largeSMP: . contrib/netcat contrib/top lib lib/libprocstat lib/libutil share/mk sys/amd64/amd64 sys/amd64/conf sys/dev/ahci sys/dev/ata sys/dev/ata/chipsets sys/de... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 14:01:41 -0000 Author: attilio Date: Thu May 12 14:01:40 2011 New Revision: 221810 URL: http://svn.freebsd.org/changeset/base/221810 Log: MFC Added: projects/largeSMP/lib/libprocstat/ - copied from r221809, head/lib/libprocstat/ projects/largeSMP/lib/libutil/kinfo_getallproc.3 - copied unchanged from r221809, head/lib/libutil/kinfo_getallproc.3 projects/largeSMP/lib/libutil/kinfo_getallproc.c - copied unchanged from r221809, head/lib/libutil/kinfo_getallproc.c projects/largeSMP/lib/libutil/kinfo_getproc.3 - copied unchanged from r221809, head/lib/libutil/kinfo_getproc.3 projects/largeSMP/lib/libutil/kinfo_getproc.c - copied unchanged from r221809, head/lib/libutil/kinfo_getproc.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285an.h - copied unchanged from r221809, head/sys/dev/ath/ath_hal/ar9002/ar9285an.h projects/largeSMP/usr.bin/fstat/functions.h - copied unchanged from r221809, head/usr.bin/fstat/functions.h projects/largeSMP/usr.bin/fstat/fuser.1 - copied unchanged from r221809, head/usr.bin/fstat/fuser.1 projects/largeSMP/usr.bin/fstat/fuser.c - copied unchanged from r221809, head/usr.bin/fstat/fuser.c projects/largeSMP/usr.bin/fstat/main.c - copied unchanged from r221809, head/usr.bin/fstat/main.c Deleted: projects/largeSMP/usr.bin/fstat/cd9660.c projects/largeSMP/usr.bin/fstat/fstat.h projects/largeSMP/usr.bin/fstat/msdosfs.c projects/largeSMP/usr.bin/fstat/zfs/ projects/largeSMP/usr.bin/fstat/zfs.c Modified: projects/largeSMP/Makefile.inc1 projects/largeSMP/contrib/netcat/atomicio.c projects/largeSMP/contrib/netcat/nc.1 projects/largeSMP/contrib/netcat/netcat.c projects/largeSMP/contrib/netcat/socks.c projects/largeSMP/lib/Makefile projects/largeSMP/lib/libutil/Makefile projects/largeSMP/lib/libutil/libutil.h projects/largeSMP/sys/amd64/amd64/machdep.c projects/largeSMP/sys/amd64/conf/GENERIC projects/largeSMP/sys/dev/ahci/ahci.c projects/largeSMP/sys/dev/ata/ata-pci.h projects/largeSMP/sys/dev/ata/chipsets/ata-intel.c projects/largeSMP/sys/dev/ath/ath_hal/ah_debug.h projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_power.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416reg.h projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c projects/largeSMP/sys/dev/ichsmb/ichsmb_pci.c projects/largeSMP/sys/dev/ichwd/ichwd.c projects/largeSMP/sys/dev/ichwd/ichwd.h projects/largeSMP/sys/dev/mii/ip1000phy.c projects/largeSMP/sys/dev/sound/pci/hda/hdac.c projects/largeSMP/sys/dev/sound/pcm/dsp.c projects/largeSMP/sys/geom/geom_kern.c projects/largeSMP/sys/geom/part/g_part.c projects/largeSMP/sys/i386/conf/GENERIC projects/largeSMP/sys/kern/kern_descrip.c projects/largeSMP/sys/kern/kern_proc.c projects/largeSMP/sys/mips/conf/ADM5120 projects/largeSMP/sys/mips/conf/ALCHEMY projects/largeSMP/sys/mips/conf/AR71XX projects/largeSMP/sys/mips/conf/AR91XX_BASE projects/largeSMP/sys/mips/conf/IDT projects/largeSMP/sys/mips/conf/MALTA projects/largeSMP/sys/mips/conf/MALTA64 projects/largeSMP/sys/mips/conf/OCTEON1 projects/largeSMP/sys/mips/conf/PB92 projects/largeSMP/sys/mips/conf/QEMU projects/largeSMP/sys/mips/conf/RT305X projects/largeSMP/sys/mips/conf/SENTRY5 projects/largeSMP/sys/mips/conf/XLR projects/largeSMP/sys/mips/conf/XLR64 projects/largeSMP/sys/mips/conf/XLRN32 projects/largeSMP/sys/mips/conf/std.SWARM projects/largeSMP/sys/net80211/ieee80211_alq.c projects/largeSMP/sys/sparc64/include/asmacros.h projects/largeSMP/sys/sys/user.h projects/largeSMP/usr.bin/fstat/Makefile projects/largeSMP/usr.bin/fstat/fstat.c projects/largeSMP/usr.bin/procstat/Makefile projects/largeSMP/usr.bin/procstat/procstat.c projects/largeSMP/usr.bin/procstat/procstat.h projects/largeSMP/usr.bin/procstat/procstat_args.c projects/largeSMP/usr.bin/procstat/procstat_basic.c projects/largeSMP/usr.bin/procstat/procstat_bin.c projects/largeSMP/usr.bin/procstat/procstat_cred.c projects/largeSMP/usr.bin/procstat/procstat_files.c projects/largeSMP/usr.bin/procstat/procstat_kstack.c projects/largeSMP/usr.bin/procstat/procstat_sigs.c projects/largeSMP/usr.bin/procstat/procstat_threads.c projects/largeSMP/usr.bin/procstat/procstat_vm.c projects/largeSMP/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/Makefile.inc1 ============================================================================== --- projects/largeSMP/Makefile.inc1 Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/Makefile.inc1 Thu May 12 14:01:40 2011 (r221810) @@ -246,9 +246,10 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ + BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ - BOOTSTRAPPING=${OSRELDATE} -DNO_LINT -DNO_CPU_CFLAGS \ - -DNO_WARNS -DNO_CTF + -DNO_LINT \ + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ @@ -829,7 +830,7 @@ buildkernel: @echo "--------------------------------------------------------------" cd ${KRNLOBJDIR}/${_kernel}; \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ - ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \ + ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) @@ -1024,7 +1025,9 @@ _clang_tblgen= \ usr.bin/clang/tblgen .endif -.if ${MK_CDDL} != "no" +.if ${MK_CDDL} != "no" && \ + ${BOOTSTRAPPING} < 800038 && \ + !(${BOOTSTRAPPING} >= 700112 && ${BOOTSTRAPPING} < 799999) _dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \ lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge .endif @@ -1033,6 +1036,9 @@ _dtrace_tools= cddl/usr.bin/sgsmsg cddl/ _dtc= gnu/usr.bin/dtc .endif +# Please document (add comment) why something is in 'bootstrap-tools'. +# Try to bound the building of the bootstrap-tool to just the +# FreeBSD versions that need the tool built at this stage of the build. bootstrap-tools: .for _tool in \ ${_clang_tblgen} \ Modified: projects/largeSMP/contrib/netcat/atomicio.c ============================================================================== --- projects/largeSMP/contrib/netcat/atomicio.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/contrib/netcat/atomicio.c Thu May 12 14:01:40 2011 (r221810) @@ -1,4 +1,4 @@ -/* $OpenBSD: atomicio.c,v 1.9 2007/09/07 14:50:44 tobias Exp $ */ +/* $OpenBSD: atomicio.c,v 1.10 2011/01/08 00:47:19 jeremy Exp $ */ /* * Copyright (c) 2006 Damien Miller. All rights reserved. * Copyright (c) 2005 Anil Madhavapeddy. All rights reserved. @@ -53,7 +53,7 @@ atomicio(ssize_t (*f) (int, void *, size case -1: if (errno == EINTR) continue; - if (errno == EAGAIN) { + if ((errno == EAGAIN) || (errno == ENOBUFS)) { (void)poll(&pfd, 1, -1); continue; } Modified: projects/largeSMP/contrib/netcat/nc.1 ============================================================================== --- projects/largeSMP/contrib/netcat/nc.1 Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/contrib/netcat/nc.1 Thu May 12 14:01:40 2011 (r221810) @@ -1,4 +1,4 @@ -.\" $OpenBSD: nc.1,v 1.55 2010/07/25 07:51:39 guenther Exp $ +.\" $OpenBSD: nc.1,v 1.57 2011/01/09 22:16:46 jeremy Exp $ .\" .\" Copyright (c) 1996 David Sacerdote .\" All rights reserved. @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 25, 2010 +.Dd January 8, 2011 .Dt NC 1 .Os .Sh NAME @@ -44,7 +44,7 @@ .Op Fl O Ar length .Op Fl P Ar proxy_username .Op Fl p Ar source_port -.Op Fl s Ar source_ip_address +.Op Fl s Ar source .Op Fl T Ar ToS .Op Fl V Ar rtable .Op Fl w Ar timeout @@ -53,7 +53,7 @@ .Fl x Ar proxy_address Ns Oo : Ns .Ar port Oc .Xc Oc -.Op Ar hostname +.Op Ar destination .Op Ar port .Ek .Sh DESCRIPTION @@ -61,8 +61,10 @@ The .Nm (or .Nm netcat ) -utility is used for just about anything under the sun involving TCP -or UDP. +utility is used for just about anything under the sun involving TCP, +UDP, or +.Ux Ns -domain +sockets. It can open TCP connections, send UDP packets, listen on arbitrary TCP and UDP ports, do port scanning, and deal with both IPv4 and IPv6. @@ -175,8 +177,12 @@ instead of sequentially within a range o assigns them. .It Fl S Enables the RFC 2385 TCP MD5 signature option. -.It Fl s Ar source_ip_address +.It Fl s Ar source Specifies the IP of the interface which is used to send the packets. +For +.Ux Ns -domain +datagram sockets, specifies the local temporary socket file +to create and use so that datagrams can be received. It is an error to use this option in conjunction with the .Fl l option. @@ -201,6 +207,16 @@ Specifies to use sockets. .It Fl u Use UDP instead of the default option of TCP. +For +.Ux Ns -domain +sockets, use a datagram socket instead of a stream socket. +If a +.Ux Ns -domain +socket is used, a temporary receiving socket is created in +.Pa /tmp +unless the +.Fl s +flag is given. .It Fl V Ar rtable Set the routing table .Pq Dq FIB @@ -244,7 +260,7 @@ If the protocol is not specified, SOCKS Requests that .Nm should connect to -.Ar hostname +.Ar destination using a proxy at .Ar proxy_address and @@ -262,16 +278,22 @@ It is an error to use this option in con option. .El .Pp -.Ar hostname +.Ar destination can be a numerical IP address or a symbolic hostname (unless the .Fl n option is given). -In general, a hostname must be specified, +In general, a destination must be specified, unless the .Fl l option is given (in which case the local host is used). +For +.Ux Ns -domain +sockets, a destination is required and is the socket path to connect to +(or listen on if the +.Fl l +option is given). .Pp .Ar port can be a single integer or a range of ports. @@ -280,8 +302,7 @@ In general, a destination port must be specified, unless the .Fl U -option is given -(in which case a socket must be specified). +option is given. .Sh CLIENT/SERVER MODEL It is quite simple to build a very basic client/server model using .Nm . @@ -424,7 +445,7 @@ outgoing traffic only. .Pp Create and listen on a .Ux Ns -domain -socket: +stream socket: .Pp .Dl $ nc -lU /var/tmp/dsocket .Pp Modified: projects/largeSMP/contrib/netcat/netcat.c ============================================================================== --- projects/largeSMP/contrib/netcat/netcat.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/contrib/netcat/netcat.c Thu May 12 14:01:40 2011 (r221810) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.98 2010/07/03 04:44:51 guenther Exp $ */ +/* $OpenBSD: netcat.c,v 1.100 2011/01/09 22:16:46 jeremy Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -70,6 +70,7 @@ #define PORT_MAX 65535 #define PORT_MAX_LEN 6 +#define UNIX_DG_TMP_SOCKET_SIZE 19 /* Command Line Options */ int dflag; /* detached, no stdin */ @@ -98,6 +99,7 @@ u_int rtableid; int timeout = -1; int family = AF_UNSPEC; char *portlist[PORT_MAX+1]; +char *unix_dg_tmp_socket; void atelnet(int, unsigned char *, unsigned int); void build_ports(char *); @@ -108,6 +110,7 @@ int remote_connect(const char *, const c int socks_connect(const char *, const char *, struct addrinfo, const char *, const char *, struct addrinfo, int, const char *); int udptest(int); +int unix_bind(char *); int unix_connect(char *); int unix_listen(char *); void set_common_sockopts(int); @@ -134,6 +137,7 @@ main(int argc, char *argv[]) char *proxy; const char *errstr, *proxyhost = "", *proxyport = NULL; struct addrinfo proxyhints; + char unix_dg_tmp_socket_buf[UNIX_DG_TMP_SOCKET_SIZE]; struct option longopts[] = { { "no-tcpopt", no_argument, &FreeBSD_Oflag, 1 }, { NULL, 0, NULL, 0 } @@ -288,8 +292,6 @@ main(int argc, char *argv[]) /* Cruft to make sure options are clean, and used properly. */ if (argv[0] && !argv[1] && family == AF_UNIX) { - if (uflag) - errx(1, "cannot use -u and -U"); host = argv[0]; uport = NULL; } else if (argv[0] && !argv[1]) { @@ -312,6 +314,19 @@ main(int argc, char *argv[]) if (!lflag && kflag) errx(1, "must use -l with -k"); + /* Get name of temporary socket for unix datagram client */ + if ((family == AF_UNIX) && uflag && !lflag) { + if (sflag) { + unix_dg_tmp_socket = sflag; + } else { + strlcpy(unix_dg_tmp_socket_buf, "/tmp/nc.XXXXXXXXXX", + UNIX_DG_TMP_SOCKET_SIZE); + if (mktemp(unix_dg_tmp_socket_buf) == NULL) + err(1, "mktemp"); + unix_dg_tmp_socket = unix_dg_tmp_socket_buf; + } + } + /* Initialize addrinfo structure. */ if (family != AF_UNIX) { memset(&hints, 0, sizeof(struct addrinfo)); @@ -354,8 +369,12 @@ main(int argc, char *argv[]) int connfd; ret = 0; - if (family == AF_UNIX) - s = unix_listen(host); + if (family == AF_UNIX) { + if (uflag) + s = unix_bind(host); + else + s = unix_listen(host); + } /* Allow only one connection at a time, but stay alive. */ for (;;) { @@ -384,17 +403,21 @@ main(int argc, char *argv[]) if (rv < 0) err(1, "connect"); - connfd = s; + readwrite(s); } else { len = sizeof(cliaddr); connfd = accept(s, (struct sockaddr *)&cliaddr, &len); + readwrite(connfd); + close(connfd); } - readwrite(connfd); - close(connfd); if (family != AF_UNIX) close(s); + else if (uflag) { + if (connect(s, NULL, 0) < 0) + err(1, "connect"); + } if (!kflag) break; @@ -408,6 +431,8 @@ main(int argc, char *argv[]) } else ret = 1; + if (uflag) + unlink(unix_dg_tmp_socket); exit(ret); } else { @@ -468,18 +493,19 @@ main(int argc, char *argv[]) } /* - * unix_connect() - * Returns a socket connected to a local unix socket. Returns -1 on failure. + * unix_bind() + * Returns a unix socket bound to the given path */ int -unix_connect(char *path) +unix_bind(char *path) { struct sockaddr_un sun; int s; - if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + /* Create unix domain socket. */ + if ((s = socket(AF_UNIX, uflag ? SOCK_DGRAM : SOCK_STREAM, + 0)) < 0) return (-1); - (void)fcntl(s, F_SETFD, 1); memset(&sun, 0, sizeof(struct sockaddr_un)); sun.sun_family = AF_UNIX; @@ -490,27 +516,32 @@ unix_connect(char *path) errno = ENAMETOOLONG; return (-1); } - if (connect(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { + + if (bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { close(s); return (-1); } return (s); - } /* - * unix_listen() - * Create a unix domain socket, and listen on it. + * unix_connect() + * Returns a socket connected to a local unix socket. Returns -1 on failure. */ int -unix_listen(char *path) +unix_connect(char *path) { struct sockaddr_un sun; int s; - /* Create unix domain socket. */ - if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) - return (-1); + if (uflag) { + if ((s = unix_bind(unix_dg_tmp_socket)) < 0) + return (-1); + } else { + if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) + return (-1); + } + (void)fcntl(s, F_SETFD, 1); memset(&sun, 0, sizeof(struct sockaddr_un)); sun.sun_family = AF_UNIX; @@ -521,11 +552,24 @@ unix_listen(char *path) errno = ENAMETOOLONG; return (-1); } - - if (bind(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { + if (connect(s, (struct sockaddr *)&sun, SUN_LEN(&sun)) < 0) { close(s); return (-1); } + return (s); + +} + +/* + * unix_listen() + * Create a unix domain socket, and listen on it. + */ +int +unix_listen(char *path) +{ + int s; + if ((s = unix_bind(path)) < 0) + return (-1); if (listen(s, 5) < 0) { close(s); @@ -989,9 +1033,9 @@ usage(int ret) #else "usage: nc [-46DdhklnrStUuvz] [-I length] [-i interval] [-O length]\n" #endif - "\t [-P proxy_username] [-p source_port] [-s source_ip_address] [-T ToS]\n" + "\t [-P proxy_username] [-p source_port] [-s source] [-T ToS]\n" "\t [-V rtable] [-w timeout] [-X proxy_protocol]\n" - "\t [-x proxy_address[:port]] [hostname] [port]\n"); + "\t [-x proxy_address[:port]] [destination] [port]\n"); if (ret) exit(1); } Modified: projects/largeSMP/contrib/netcat/socks.c ============================================================================== --- projects/largeSMP/contrib/netcat/socks.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/contrib/netcat/socks.c Thu May 12 14:01:40 2011 (r221810) @@ -1,4 +1,4 @@ -/* $OpenBSD: socks.c,v 1.18 2010/04/20 07:26:35 nicm Exp $ */ +/* $OpenBSD: socks.c,v 1.19 2011/02/12 15:54:18 okan Exp $ */ /* * Copyright (c) 1999 Niklas Hallqvist. All rights reserved. @@ -222,11 +222,25 @@ socks_connect(const char *host, const ch if (cnt != wlen) err(1, "write failed (%zu/%zu)", cnt, wlen); - cnt = atomicio(read, proxyfd, buf, 10); - if (cnt != 10) - err(1, "read failed (%zu/10)", cnt); + cnt = atomicio(read, proxyfd, buf, 4); + if (cnt != 4) + err(1, "read failed (%zu/4)", cnt); if (buf[1] != 0) errx(1, "connection failed, SOCKS error %d", buf[1]); + switch (buf[3]) { + case SOCKS_IPV4: + cnt = atomicio(read, proxyfd, buf + 4, 6); + if (cnt != 6) + err(1, "read failed (%zd/6)", cnt); + break; + case SOCKS_IPV6: + cnt = atomicio(read, proxyfd, buf + 4, 18); + if (cnt != 18) + err(1, "read failed (%zd/18)", cnt); + break; + default: + errx(1, "connection failed, unsupported address type"); + } } else if (socksv == 4) { /* This will exit on lookup failure */ decode_addrport(host, port, (struct sockaddr *)&addr, Modified: projects/largeSMP/lib/Makefile ============================================================================== --- projects/largeSMP/lib/Makefile Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/lib/Makefile Thu May 12 14:01:40 2011 (r221810) @@ -92,6 +92,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libpkg} \ ${_libpmc} \ ${_libproc} \ + libprocstat \ librt \ ${_librtld_db} \ ${_libsdp} \ Modified: projects/largeSMP/lib/libutil/Makefile ============================================================================== --- projects/largeSMP/lib/libutil/Makefile Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/lib/libutil/Makefile Thu May 12 14:01:40 2011 (r221810) @@ -9,7 +9,8 @@ LIB= util SHLIB_MAJOR= 9 SRCS= _secure_path.c auth.c expand_number.c flopen.c fparseln.c gr_util.c \ - hexdump.c humanize_number.c kinfo_getfile.c kinfo_getvmmap.c kld.c \ + hexdump.c humanize_number.c kinfo_getfile.c kinfo_getfile.c \ + kinfo_getallproc.c kinfo_getproc.c kinfo_getvmmap.c kld.c \ login_auth.c login_cap.c \ login_class.c login_crypt.c login_ok.c login_times.c login_tty.c \ pidfile.c property.c pty.c pw_util.c quotafile.c realhostname.c \ @@ -29,7 +30,8 @@ MAN+= kld.3 login_auth.3 login_tty.3 pty _secure_path.3 uucplock.3 property.3 auth.3 realhostname.3 \ realhostname_sa.3 trimdomain.3 fparseln.3 humanize_number.3 \ pidfile.3 flopen.3 expand_number.3 hexdump.3 \ - kinfo_getfile.3 kinfo_getvmmap.3 quotafile.3 + kinfo_getfile.3 kinfo_getallproc.3 kinfo_getproc.3 \ + kinfo_getvmmap.3 quotafile.3 MAN+= login.conf.5 auth.conf.5 MLINKS+= kld.3 kld_isloaded.3 kld.3 kld_load.3 MLINKS+= property.3 properties_read.3 property.3 properties_free.3 Copied: projects/largeSMP/lib/libutil/kinfo_getallproc.3 (from r221809, head/lib/libutil/kinfo_getallproc.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/lib/libutil/kinfo_getallproc.3 Thu May 12 14:01:40 2011 (r221810, copy of r221809, head/lib/libutil/kinfo_getallproc.3) @@ -0,0 +1,74 @@ +.\" +.\" Copyright (c) 2009 Ulf Lilleengen +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2009 +.Os +.Dt KINFO_GETALLPROC 3 +.Sh NAME +.Nm kinfo_getallproc +.Nd function for getting process information of all processes from kernel +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In sys/types.h +.In libutil.h +.Ft struct kinfo_proc * +.Fn kinfo_getallproc "int *cntp" +.Sh DESCRIPTION +This function is used for obtaining process information of all processes from +the kernel. +.Pp +The +.Ar cntp +field is a pointer containing the number of process structures returned. +This function is a wrapper around +.Xr sysctl 3 +with the +.Dv KERN_PROC_PROC +mib. +While the kernel returns a packed structure, this function expands the +data into a fixed record format. +.Sh RETURN VALUES +On success the +.Fn kinfo_getallproc +function returns a pointer to +.Ar cntp +.Vt struct kinfo_proc +structures as defined by +.In sys/user.h . +The pointer was obtained by an internal call to +.Xr malloc 3 +and must be freed by the caller with a call to +.Xr free 3 . +On failure the +.Fn kinfo_getallproc +function returns +.Dv NULL . +.Sh SEE ALSO +.Xr free 3 , +.Xr malloc 3 , +.Xr sysctl 3 Copied: projects/largeSMP/lib/libutil/kinfo_getallproc.c (from r221809, head/lib/libutil/kinfo_getallproc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/lib/libutil/kinfo_getallproc.c Thu May 12 14:01:40 2011 (r221810, copy of r221809, head/lib/libutil/kinfo_getallproc.c) @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2009 Ulf Lilleengen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libutil.h" + + +/* + * Sort processes first by pid and then tid. + */ +static int +kinfo_proc_compare(const void *a, const void *b) +{ + int i; + + i = ((const struct kinfo_proc *)a)->ki_pid - + ((const struct kinfo_proc *)b)->ki_pid; + if (i != 0) + return (i); + i = ((const struct kinfo_proc *)a)->ki_tid - + ((const struct kinfo_proc *)b)->ki_tid; + return (i); +} + +static void +kinfo_proc_sort(struct kinfo_proc *kipp, int count) +{ + + qsort(kipp, count, sizeof(*kipp), kinfo_proc_compare); +} + +struct kinfo_proc * +kinfo_getallproc(int *cntp) +{ + struct kinfo_proc *kipp; + size_t len; + int mib[3]; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PROC; + + len = 0; + if (sysctl(mib, 3, NULL, &len, NULL, 0) < 0) + return (NULL); + + kipp = malloc(len); + if (kipp == NULL) + return (NULL); + + if (sysctl(mib, 3, kipp, &len, NULL, 0) < 0) + goto bad; + if (len % sizeof(*kipp) != 0) + goto bad; + if (kipp->ki_structsize != sizeof(*kipp)) + goto bad; + *cntp = len / sizeof(*kipp); + kinfo_proc_sort(kipp, len / sizeof(*kipp)); + return (kipp); +bad: + *cntp = 0; + free(kipp); + return (NULL); +} Copied: projects/largeSMP/lib/libutil/kinfo_getproc.3 (from r221809, head/lib/libutil/kinfo_getproc.3) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/lib/libutil/kinfo_getproc.3 Thu May 12 14:01:40 2011 (r221810, copy of r221809, head/lib/libutil/kinfo_getproc.3) @@ -0,0 +1,73 @@ +.\" +.\" Copyright (c) 2009 Ulf Lilleengen +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 9, 2009 +.Os +.Dt KINFO_GETPROC 3 +.Sh NAME +.Nm kinfo_getproc +.Nd function for getting process information from kernel +.Sh LIBRARY +.Lb libutil +.Sh SYNOPSIS +.In sys/types.h +.In libutil.h +.Ft struct kinfo_proc * +.Fn kinfo_getproc "pid_t pid" "int *cntp" +.Sh DESCRIPTION +This function is used for obtaining process information from the kernel. +.Pp +The +.Ar pid +field contains the process identifier. +This should be the a process that you have privilige to access. +This function is a wrapper around +.Xr sysctl 3 +with the +.Dv KERN_PROC_PID +mib. +While the kernel returns a packed structure, this function expands the +data into a fixed record format. +.Sh RETURN VALUES +On success the +.Fn kinfo_getproc +function returns a pointer to a +.Vt struct kinfo_proc +structure as defined by +.In sys/user.h . +The pointer was obtained by an internal call to +.Xr malloc 3 +and must be freed by the caller with a call to +.Xr free 3 . +On failure the +.Fn kinfo_getproc +function returns +.Dv NULL . +.Sh SEE ALSO +.Xr free 3 , +.Xr malloc 3 , +.Xr sysctl 3 Copied: projects/largeSMP/lib/libutil/kinfo_getproc.c (from r221809, head/lib/libutil/kinfo_getproc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/lib/libutil/kinfo_getproc.c Thu May 12 14:01:40 2011 (r221810, copy of r221809, head/lib/libutil/kinfo_getproc.c) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2009 Ulf Lilleengen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libutil.h" + +struct kinfo_proc * +kinfo_getproc(pid_t pid) +{ + struct kinfo_proc *kipp; + int mib[4]; + size_t len; + + len = 0; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = pid; + if (sysctl(mib, 4, NULL, &len, NULL, 0) < 0) + return (NULL); + + kipp = malloc(len); + if (kipp == NULL) + return (NULL); + + if (sysctl(mib, 4, kipp, &len, NULL, 0) < 0) + goto bad; + if (len != sizeof(*kipp)) + goto bad; + if (kipp->ki_structsize != sizeof(*kipp)) + goto bad; + if (kipp->ki_pid != pid) + goto bad; + return (kipp); +bad: + free(kipp); + return (NULL); +} Modified: projects/largeSMP/lib/libutil/libutil.h ============================================================================== --- projects/largeSMP/lib/libutil/libutil.h Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/lib/libutil/libutil.h Thu May 12 14:01:40 2011 (r221810) @@ -88,6 +88,7 @@ struct termios; struct winsize; struct in_addr; struct kinfo_file; +struct kinfo_proc; struct kinfo_vmentry; __BEGIN_DECLS @@ -126,6 +127,10 @@ struct kinfo_file * kinfo_getfile(pid_t _pid, int *_cntp); struct kinfo_vmentry * kinfo_getvmmap(pid_t _pid, int *_cntp); +struct kinfo_proc * + kinfo_getallproc(int *_cntp); +struct kinfo_proc * + kinfo_getproc(pid_t _pid); #ifdef _STDIO_H_ /* avoid adding new includes */ char *fparseln(FILE *, size_t *, size_t *, const char[3], int); Modified: projects/largeSMP/sys/amd64/amd64/machdep.c ============================================================================== --- projects/largeSMP/sys/amd64/amd64/machdep.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/amd64/amd64/machdep.c Thu May 12 14:01:40 2011 (r221810) @@ -1298,9 +1298,6 @@ add_smap_entry(struct bios_smap *smap, v * available physical memory in the system, then test this memory and * build the phys_avail array describing the actually-available memory. * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * * Total memory size may be set by the kernel environment variable * hw.physmem or the compile-time define MAXMEM. * Modified: projects/largeSMP/sys/amd64/conf/GENERIC ============================================================================== --- projects/largeSMP/sys/amd64/conf/GENERIC Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/amd64/conf/GENERIC Thu May 12 14:01:40 2011 (r221810) @@ -165,6 +165,7 @@ device splash # Splash screen and scre # syscons is the default console driver, resembling an SCO console device sc +options SC_PIXEL_MODE # add support for the raster text mode device agp # support several AGP chipsets Modified: projects/largeSMP/sys/dev/ahci/ahci.c ============================================================================== --- projects/largeSMP/sys/dev/ahci/ahci.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ahci/ahci.c Thu May 12 14:01:40 2011 (r221810) @@ -164,10 +164,18 @@ static struct { {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point", 0}, {0x1c058086, 0x00, "Intel Cougar Point", 0}, - {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, + {0x1e028086, 0x00, "Intel Panther Point", 0}, + {0x1e038086, 0x00, "Intel Panther Point", 0}, + {0x1e048086, 0x00, "Intel Panther Point", 0}, + {0x1e058086, 0x00, "Intel Panther Point", 0}, + {0x1e068086, 0x00, "Intel Panther Point", 0}, + {0x1e078086, 0x00, "Intel Panther Point", 0}, + {0x1e0e8086, 0x00, "Intel Panther Point", 0}, + {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, Modified: projects/largeSMP/sys/dev/ata/ata-pci.h ============================================================================== --- projects/largeSMP/sys/dev/ata/ata-pci.h Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ata/ata-pci.h Thu May 12 14:01:40 2011 (r221810) @@ -233,6 +233,19 @@ struct ata_pci_controller { #define ATA_PBG_R2 0x1d068086 #define ATA_PBG_S2 0x1d088086 +#define ATA_PPT_S1 0x1e008086 +#define ATA_PPT_S2 0x1e018086 +#define ATA_PPT_AH1 0x1e028086 +#define ATA_PPT_AH2 0x1e038086 +#define ATA_PPT_R1 0x1e048086 +#define ATA_PPT_R2 0x1e058086 +#define ATA_PPT_R3 0x1e068086 +#define ATA_PPT_R4 0x1e078086 +#define ATA_PPT_S3 0x1e088086 +#define ATA_PPT_S4 0x1e098086 +#define ATA_PPT_R5 0x1e0e8086 +#define ATA_PPT_R6 0x1e0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: projects/largeSMP/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- projects/largeSMP/sys/dev/ata/chipsets/ata-intel.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ata/chipsets/ata-intel.c Thu May 12 14:01:40 2011 (r221810) @@ -181,6 +181,18 @@ ata_intel_probe(device_t dev) { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, + { ATA_PPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_debug.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_debug.h Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_debug.h Thu May 12 14:01:40 2011 (r221810) @@ -48,6 +48,7 @@ enum { HAL_DEBUG_DFS = 0x00200000, /* DFS debugging */ HAL_DEBUG_HANG = 0x00400000, /* BB/MAC hang debugging */ + HAL_DEBUG_UNMASKABLE = 0xf0000000, /* always printed */ HAL_DEBUG_ANY = 0xffffffff }; #endif /* _ATH_AH_DEBUG_H_ */ Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h Thu May 12 14:01:40 2011 (r221810) @@ -517,7 +517,8 @@ extern void ath_hal_free(void *); extern int ath_hal_debug; #define HALDEBUG(_ah, __m, ...) \ do { \ - if (ath_hal_debug & (__m)) { \ + if ((__m) == HAL_DEBUG_UNMASKABLE || \ + (ath_hal_debug & (__m))) { \ DO_HALDEBUG((_ah), (__m), __VA_ARGS__); \ } \ } while(0); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Thu May 12 14:01:40 2011 (r221810) @@ -420,6 +420,12 @@ ar5416Detach(struct ath_hal *ah) HALASSERT(ah != AH_NULL); HALASSERT(ah->ah_magic == AR5416_MAGIC); + /* Make sure that chip is awake before writing to it */ + if (! ar5416SetPowerMode(ah, HAL_PM_AWAKE, AH_TRUE)) + HALDEBUG(ah, HAL_DEBUG_UNMASKABLE, + "%s: failed to wake up chip\n", + __func__); + ar5416AniDetach(ah); ar5212RfDetach(ah); ah->ah_disable(ah); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu May 12 12:18:01 2011 (r221809) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Thu May 12 14:01:40 2011 (r221810) @@ -241,7 +241,6 @@ ar5416InitCal(struct ath_hal *ah, const { struct ar5416PerCal *cal = &AH5416(ah)->ah_cal; HAL_CHANNEL_INTERNAL *ichan; - int i; ichan = ath_hal_checkchannel(ah, chan); HALASSERT(ichan != AH_NULL); @@ -263,33 +262,14 @@ ar5416InitCal(struct ath_hal *ah, const * higher than normal value if DC offset and noise floor cal are * triggered at the same time. */ - /* XXX this actually kicks off a NF calibration -adrian */ OS_REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF); - /* - * This sometimes takes a -lot- longer than it should. - * Just give it a bit more time. - */ - for (i = 0; i < MAX_CAL_CHECK; i++) { - if (ar5212WaitNFCalComplete(ah, 10000)) - break; - HALDEBUG(ah, HAL_DEBUG_ANY, "%s: initial NF calibration did " - "not complete in time; noisy environment (pass %d)?\n", __func__, i); - } - /* - * Although periodic and NF calibrations shouldn't run concurrently, - * this was causing the radio to not be usable on the active - * channel if the channel was busy. - * - * Instead, now simply print a warning and continue. That way if users - * report "weird crap", they should get this warning. + * This may take a while to run; make sure subsequent + * calibration routines check that this has completed + * before reading the value and triggering a subsequent + * calibration. */ - if (i >= MAX_CAL_CHECK) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu May 12 14:49:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E3D5106566B; Thu, 12 May 2011 14:49:34 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8A37D8FC19; Thu, 12 May 2011 14:49:33 +0000 (UTC) Received: by qyk27 with SMTP id 27so1101610qyk.13 for ; Thu, 12 May 2011 07:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=U9PoVfiZd3xSG2iQ2QXIjukR3XDIcMDpb+wfBjjYhYk=; b=gP64qoIlnK/bBSWX2iO5XYTkPgXnQjqcxlh3fqC/mLZx+I17UR297KQwaNxn5v0ej9 V3CCn8vRWDdK74FxWGY6FiGnIYRtO6HBV+C3rG+akZLisl7H2d1NRLDQCpwpjCOMfHGG bPD8Zp0n5VDe7LZCYQUMQKrMlM5X2m9a1JeT0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=xjTsoaNs9cZTaLMw/56wIcnyeYSmcH/7D0XRNynse5ZBtY4e0CB3VuJDR+X3xOu7Jo qaMQlMFD2RxJkuTqdImVU33nXKqJddn1rZcFbSFlLVqBHWNxPrShjuzkqVdrSfeEsmRQ PDnFJ/hL3CR3WjelwibCbttRwpP8BzsFfTitI= MIME-Version: 1.0 Received: by 10.229.27.193 with SMTP id j1mr251323qcc.82.1305211772448; Thu, 12 May 2011 07:49:32 -0700 (PDT) Sender: artemb@gmail.com Received: by 10.229.95.140 with HTTP; Thu, 12 May 2011 07:49:32 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 16:49:32 +0200 X-Google-Sender-Auth: xD_-Xtk_1auLPAlLlhrcmY-N05Q Message-ID: From: Artem Belevich To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 14:49:34 -0000 On Thu, May 12, 2011 at 3:22 PM, Attilio Rao wrote: > 2011/5/12 Artem Belevich : >> On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wrote= : >>> 2011/5/8 Attilio Rao : >>>> Author: attilio >>>> Date: Sun May =A08 00:39:49 2011 >>>> New Revision: 221614 >>>> URL: http://svn.freebsd.org/changeset/base/221614 >>>> >>>> Log: >>>> =A0All architectures define the size-bounded types (uint32_t, uint64_t= , etc.) >>>> =A0starting from base C types (int, long, etc). >>> >>> mips seems having the same issue, so here is my patch: >>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff >> >> I see at least one problem. N32 ABI is ILP32 even though it can use >> 64-bit registers for "long long". > > I'm sorry but this _longlong is non standard for our atomic scheme, > nothing in the kernel uses it and in general I'd say to not add them > if not strictly necessary. > Said that, in the -CURRENT code it doesn't seem present, or I'm missing i= t? The key is that N32 ABI does use 64-bit registers and can perform 64-bit atomic ops. Unfortunately, 64-bit type is long long or [u]int64_t. The point is that it's not *long*. > >>> #if defined(__mips_n64) || defined(__mips_n32) >>> static __inline void >>>-atomic_set_64(__volatile uint64_t *p, uint64_t v) >>>+atomic_set_long(__volatile u_long *p, u_long v) >> >> Using _long here would not match the assembly on N32. >> >> If you stick with your changes, then you should drop __mips_n32 from >> the ifdef above. >> You may also want to add atomic_*_longlong for n32. Actually, for o64 as= well. > > I'm not entirely sure in which way the above is different... or at > least, I may have overlooked the _long support for __mips_n32... can > you please elaborate a bit more? The inline assembly for atomic_set_long above uses 64-bit load/store. This is not going to work for 32-bit long in N32 ABI. > >> I think for mips sticking with atomic_*_ would be a better fit >> considering ABI zoo we potentially have to deal with. > > Actually you still have them, it is just the dipendency that changes. In the end you can do it either way, true. What I am trying to point is that atomic ops are ususally involve fair amount of assembly code where it's operand *size* is what matters, not what is the name of the scalar of that size in particular ABI. If you use type to parametrize atomic ops, then you run into the problem above -- you do need to provide different implementation for the way given type is defined in a given ABI. In other words, type maps to assembly instructions in a different way on different ABIs. --Artem From owner-svn-src-projects@FreeBSD.ORG Thu May 12 15:21:59 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3E6B106564A; Thu, 12 May 2011 15:21:59 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA1448FC16; Thu, 12 May 2011 15:21:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4CFLxX4042562; Thu, 12 May 2011 15:21:59 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4CFLxpG042561; Thu, 12 May 2011 15:21:59 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201105121521.p4CFLxpG042561@svn.freebsd.org> From: Peter Grehan Date: Thu, 12 May 2011 15:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221815 - projects/bhyve_ref X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 15:21:59 -0000 Author: grehan Date: Thu May 12 15:21:59 2011 New Revision: 221815 URL: http://svn.freebsd.org/changeset/base/221815 Log: Create a branch to contain the import of the 8.1.0-based bhyve host-based hypervisor. The code will be brought into here and effectively archived: development will continue on a HEAD-based branch. Discussed with: jhb Added: - copied from r221814, release/8.1.0/ Directory Properties: projects/bhyve_ref/ (props changed) From owner-svn-src-projects@FreeBSD.ORG Thu May 12 17:30:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56366106566B; Thu, 12 May 2011 17:30:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id B58548FC13; Thu, 12 May 2011 17:30:33 +0000 (UTC) Received: by gwb15 with SMTP id 15so768324gwb.13 for ; Thu, 12 May 2011 10:30:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=KMG5QOTeW+StcNAkyaBIhEe4Jz3AVWAyxuLgKJKLSk8=; b=KqjdC1kQp9z7aUrF8M+hvnVonV5yxllNbmjnu9/Y/e5vTTGq8ZrZdGc+kaOxG1Dhti Rg0Dd8MoIH/5RILG3MJ0gmq+QqSHm6US4iFNJWk85cuGnMW0fujbrmunxGSY10K5GBvm wRA1OqlUFXbPw++ojaSVM1hs2PHcHJxmO1OR0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=PJnazh+FntpTm85qb498QcpJf12x4RBNZzK1ckXturkUbTtlSr7IsYpoxuXzDB8y2V wd7zZ8JdK98dpQqeh0N6jeHyZ4CxMVSNkvQT6EWEiGxnuptVAELiXMiA2cOgLUhScCAN mQOtakiLRTkWWVe2WfkKILAhUPNesvd9ffqY4= MIME-Version: 1.0 Received: by 10.236.180.36 with SMTP id i24mr543541yhm.305.1305221432767; Thu, 12 May 2011 10:30:32 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Thu, 12 May 2011 10:30:32 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 19:30:32 +0200 X-Google-Sender-Auth: htVGEWqmD731UZK3oeD0lyR2xjU Message-ID: From: Attilio Rao To: Artem Belevich Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 17:30:34 -0000 2011/5/12 Artem Belevich : > On Thu, May 12, 2011 at 3:22 PM, Attilio Rao wrote: >> 2011/5/12 Artem Belevich : >>> On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wrot= e: >>>> 2011/5/8 Attilio Rao : >>>>> Author: attilio >>>>> Date: Sun May =C2=A08 00:39:49 2011 >>>>> New Revision: 221614 >>>>> URL: http://svn.freebsd.org/changeset/base/221614 >>>>> >>>>> Log: >>>>> =C2=A0All architectures define the size-bounded types (uint32_t, uint= 64_t, etc.) >>>>> =C2=A0starting from base C types (int, long, etc). >>>> >>>> mips seems having the same issue, so here is my patch: >>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff >>> >>> I see at least one problem. N32 ABI is ILP32 even though it can use >>> 64-bit registers for "long long". >> >> I'm sorry but this _longlong is non standard for our atomic scheme, >> nothing in the kernel uses it and in general I'd say to not add them >> if not strictly necessary. >> Said that, in the -CURRENT code it doesn't seem present, or I'm missing = it? > > The key is that N32 ABI does use 64-bit registers and can perform > 64-bit atomic ops. > Unfortunately, 64-bit type is long long or [u]int64_t. The point is > that it's not *long*. >> >>>> #if defined(__mips_n64) || defined(__mips_n32) >>>> static __inline void >>>>-atomic_set_64(__volatile uint64_t *p, uint64_t v) >>>>+atomic_set_long(__volatile u_long *p, u_long v) >>> >>> Using _long here would not match the assembly on N32. >>> >>> If you stick with your changes, then you should drop __mips_n32 from >>> the ifdef above. >>> You may also want to add atomic_*_longlong for n32. Actually, for o64 a= s well. >> >> I'm not entirely sure in which way the above is different... or at >> least, I may have overlooked the _long support for __mips_n32... can >> you please elaborate a bit more? > > The inline assembly for atomic_set_long above uses 64-bit load/store. > This is not going to work for 32-bit long in N32 ABI. That cames from my mips assembly ignorance, I apologize. I just gave a look at types.h and what it just I basically see is: - __mips_n32 is just the same as plain !__mips_n32 && !__mips_n64 - __mips_n64 just addes the operations for 64 bits operands Thus what I need to make sure is: - __mips_n32 (and !__mips_n32 && !__mips_n64) case work on 32 bits operand on long too - __mips_n64 works on 64 bits long operands Do you have a specifi opinion on _char/_short operands? Do you have strong feeling on the _longlong stuff? Do you think it will be useful in mips? About the last question I think that it would be more fair to use _64 directly, when possible. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 17:41:34 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 999221065670; Thu, 12 May 2011 17:41:34 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id F375A8FC12; Thu, 12 May 2011 17:41:33 +0000 (UTC) Received: by gwb15 with SMTP id 15so773925gwb.13 for ; Thu, 12 May 2011 10:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HfakOng1dUPRRsLl/XgQMBsgW/Ztk2tG0NS7lm1b02c=; b=RWQ2YE9acQLiLYrMZOtQ6sdU9WY+sEfFfvxzKz5bnZ/MBY6tUb4vUQRdHccqDYbGkY /MTSwdpPiBXSrBO5vj9ScGLmQfLNkOZF3vxORj63jDY8qz6MgQQ5YXPGkeKLfknROkNT /LZUz3DtJK5v1RNgXy+R003+6ONxQzrIJ+Q9w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=BpY1cq7mQsTGWWZcG62zMWSTZmhPLxKYko3LaCRFRkUvGGz4biufloHjnmegFOV+Hb sMbubD9oJ27yAA9rleySDBrAwqbCoIAN4ZPxo4tVa1N+7uDsIQorvc3uH/9NGxhle309 AzOgVg5TDzaeR+uSxB1CNT0Q/VwU0ykEDUaR0= MIME-Version: 1.0 Received: by 10.236.161.197 with SMTP id w45mr630979yhk.104.1305222093023; Thu, 12 May 2011 10:41:33 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Thu, 12 May 2011 10:41:32 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 19:41:32 +0200 X-Google-Sender-Auth: maDxMwkEmeMEWWCrDdjW4KzbF30 Message-ID: From: Attilio Rao To: Artem Belevich Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 17:41:34 -0000 2011/5/12 Attilio Rao : > 2011/5/12 Artem Belevich : >> On Thu, May 12, 2011 at 3:22 PM, Attilio Rao wrote= : >>> 2011/5/12 Artem Belevich : >>>> On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wro= te: >>>>> 2011/5/8 Attilio Rao : >>>>>> Author: attilio >>>>>> Date: Sun May =C2=A08 00:39:49 2011 >>>>>> New Revision: 221614 >>>>>> URL: http://svn.freebsd.org/changeset/base/221614 >>>>>> >>>>>> Log: >>>>>> =C2=A0All architectures define the size-bounded types (uint32_t, uin= t64_t, etc.) >>>>>> =C2=A0starting from base C types (int, long, etc). >>>>> >>>>> mips seems having the same issue, so here is my patch: >>>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff >>>> >>>> I see at least one problem. N32 ABI is ILP32 even though it can use >>>> 64-bit registers for "long long". >>> >>> I'm sorry but this _longlong is non standard for our atomic scheme, >>> nothing in the kernel uses it and in general I'd say to not add them >>> if not strictly necessary. >>> Said that, in the -CURRENT code it doesn't seem present, or I'm missing= it? >> >> The key is that N32 ABI does use 64-bit registers and can perform >> 64-bit atomic ops. >> Unfortunately, 64-bit type is long long or [u]int64_t. The point is >> that it's not *long*. >>> >>>>> #if defined(__mips_n64) || defined(__mips_n32) >>>>> static __inline void >>>>>-atomic_set_64(__volatile uint64_t *p, uint64_t v) >>>>>+atomic_set_long(__volatile u_long *p, u_long v) >>>> >>>> Using _long here would not match the assembly on N32. >>>> >>>> If you stick with your changes, then you should drop __mips_n32 from >>>> the ifdef above. >>>> You may also want to add atomic_*_longlong for n32. Actually, for o64 = as well. >>> >>> I'm not entirely sure in which way the above is different... or at >>> least, I may have overlooked the _long support for __mips_n32... can >>> you please elaborate a bit more? >> >> The inline assembly for atomic_set_long above uses 64-bit load/store. >> This is not going to work for 32-bit long in N32 ABI. > > That cames from my mips assembly ignorance, I apologize. > I just gave a look at types.h and what it just I basically see is: > - __mips_n32 is just the same as plain !__mips_n32 && !__mips_n64 > - __mips_n64 just addes the operations for 64 bits operands Oh, yeah, I forgot this part. - __mips_n32 should be able to crunch the _64 variants, while probabilly the !__mips_n32 && !__mips_n64 doesn't > Thus what I need to make sure is: > - __mips_n32 (and !__mips_n32 && !__mips_n64) case work on 32 bits > operand on long too > - __mips_n64 works on 64 bits long operands - That __mips_n32 also defines the _64 variants. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 20:05:15 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2BB4106566C; Thu, 12 May 2011 20:05:15 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 27A678FC16; Thu, 12 May 2011 20:05:14 +0000 (UTC) Received: by ywf7 with SMTP id 7so840712ywf.13 for ; Thu, 12 May 2011 13:05:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=5Nh1Kcky7d9GfanfqxxazLIWMP628CdVceGtbslN7aU=; b=l3zlP27SaxJKb8r1LivxNjBoMMbRlhknyZBjZDYWmRdX5SsJFgkJdfpN4LX0LAyMs1 BOTEsn2zyaophbMYvA74fzpxb1eQlrknvO5ijgE2P5GnM1CoNKU9Mfnt75ZgQbF63+Nn +ukk7gxaXeZigVgqT0IW8ALhcIU7c6hPK0nsw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=gXmtlTPijWVkpu77IaYUToPXWn6FHQU7Db1Wau2sL5bFhaUIqmDnZWN2zM6aJ4WwGA J1jTo9sqTmcM+o7cMyokWD/vDinojs116arCjbFhJyMb+xH0i1XjD5t8HC/DKZkbSkgR iNHk1zgr3fo7dt1YW8HUNZYPjhIXzdQO2kBqE= MIME-Version: 1.0 Received: by 10.236.153.161 with SMTP id f21mr769266yhk.37.1305230713492; Thu, 12 May 2011 13:05:13 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Thu, 12 May 2011 13:05:13 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 22:05:13 +0200 X-Google-Sender-Auth: nX85gUS-rJnOKTiu5kxV_7ovvpk Message-ID: From: Attilio Rao To: Artem Belevich Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 20:05:15 -0000 2011/5/12 Attilio Rao : > 2011/5/12 Attilio Rao : >> 2011/5/12 Artem Belevich : >>> On Thu, May 12, 2011 at 3:22 PM, Attilio Rao wrot= e: >>>> 2011/5/12 Artem Belevich : >>>>> On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wr= ote: >>>>>> 2011/5/8 Attilio Rao : >>>>>>> Author: attilio >>>>>>> Date: Sun May =C2=A08 00:39:49 2011 >>>>>>> New Revision: 221614 >>>>>>> URL: http://svn.freebsd.org/changeset/base/221614 >>>>>>> >>>>>>> Log: >>>>>>> =C2=A0All architectures define the size-bounded types (uint32_t, ui= nt64_t, etc.) >>>>>>> =C2=A0starting from base C types (int, long, etc). >>>>>> >>>>>> mips seems having the same issue, so here is my patch: >>>>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff >>>>> >>>>> I see at least one problem. N32 ABI is ILP32 even though it can use >>>>> 64-bit registers for "long long". >>>> >>>> I'm sorry but this _longlong is non standard for our atomic scheme, >>>> nothing in the kernel uses it and in general I'd say to not add them >>>> if not strictly necessary. >>>> Said that, in the -CURRENT code it doesn't seem present, or I'm missin= g it? >>> >>> The key is that N32 ABI does use 64-bit registers and can perform >>> 64-bit atomic ops. >>> Unfortunately, 64-bit type is long long or [u]int64_t. The point is >>> that it's not *long*. >>>> >>>>>> #if defined(__mips_n64) || defined(__mips_n32) >>>>>> static __inline void >>>>>>-atomic_set_64(__volatile uint64_t *p, uint64_t v) >>>>>>+atomic_set_long(__volatile u_long *p, u_long v) >>>>> >>>>> Using _long here would not match the assembly on N32. >>>>> >>>>> If you stick with your changes, then you should drop __mips_n32 from >>>>> the ifdef above. >>>>> You may also want to add atomic_*_longlong for n32. Actually, for o64= as well. >>>> >>>> I'm not entirely sure in which way the above is different... or at >>>> least, I may have overlooked the _long support for __mips_n32... can >>>> you please elaborate a bit more? >>> >>> The inline assembly for atomic_set_long above uses 64-bit load/store. >>> This is not going to work for 32-bit long in N32 ABI. >> >> That cames from my mips assembly ignorance, I apologize. >> I just gave a look at types.h and what it just I basically see is: >> - __mips_n32 is just the same as plain !__mips_n32 && !__mips_n64 >> - __mips_n64 just addes the operations for 64 bits operands > > Oh, yeah, I forgot this part. > - __mips_n32 should be able to crunch the _64 variants, while > probabilly the !__mips_n32 && !__mips_n64 doesn't > >> Thus what I need to make sure is: >> - __mips_n32 (and !__mips_n32 && !__mips_n64) case work on 32 bits >> operand on long too >> - __mips_n64 works on 64 bits long operands > > - That __mips_n32 also defines the _64 variants. I spoke in person with Artem and in the end I just decided to make the smallest possible subset of changes to fix the _long on 32 bits and then "completed" (as some of them already exist today) the macro converting the arguments to u_int stuff: http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff I compiled several kernels for MIPS (with sparse configurations and they all compile well). If you agree with this patch, tonight I'll commit to my tree and add the mips support for cpuset_t soon, so that it all can be tested. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 20:38:57 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C36D7106566C; Thu, 12 May 2011 20:38:57 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 192E78FC14; Thu, 12 May 2011 20:38:56 +0000 (UTC) Received: by qwc9 with SMTP id 9so1315252qwc.13 for ; Thu, 12 May 2011 13:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=HuPlVMTCshdKxhMu2+xdufhnogRaRKcl6NvhfOgKzIM=; b=VeX9edTGXKB77gSeBGxfC/zZz1Y+92ah79l9L/Bn7YfmJpsPgCd4AtsisteJZsxrcN EtCYh3IM69PawZVJtc0vKh3Rl4Wkp50/G0w/IpVx/Lw67b3QFW5dk3N/kgDuacDKbA70 aDvgvtnrRW/EG45Ndj+6MfNdj7DeGZL7IxQz0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=kClAVzEtcqOlNtjOrfVo04PNYWkt36TSKEvLX0ED3xzMZ3aQtjmrQc0xyUA942UnoW ertUXWepnm7bxbMALjT4wkBnu5FmfjHXn9WwfaRDQFXhciLKU+46srQx71vtBaMVX4Uj VI365zi8WTzJWPLnt/u03xGmSTJdnV3ooaghg= MIME-Version: 1.0 Received: by 10.229.27.193 with SMTP id j1mr591965qcc.82.1305232735939; Thu, 12 May 2011 13:38:55 -0700 (PDT) Sender: artemb@gmail.com Received: by 10.229.95.140 with HTTP; Thu, 12 May 2011 13:38:55 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 22:38:55 +0200 X-Google-Sender-Auth: T0AJitf18ptSXnc_RLDjSBrjVBg Message-ID: From: Artem Belevich To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 20:38:57 -0000 On Thu, May 12, 2011 at 10:05 PM, Attilio Rao wrote: > I spoke in person with Artem and in the end I just decided to make the > smallest possible subset of changes to fix the _long on 32 bits and > then "completed" (as some of them already exist today) the macro > converting the arguments to u_int stuff: > http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff Attilio, Let's get back for a second to the original issue you had that propted you to do atomic ops changes. If I understand you correctly, your code was passing cpuset_t* as an argument to atomic_something_long and that caused compiler to complain that cpuset_t* is not uint32_t*. Could you post definition of cpuset_t ? It's possible that compiler was actually correct. For instance, compiler would be right to complain if cpuset_t is a packed structure, even if that structure is made of a single uint32_t field. > I compiled several kernels for MIPS (with sparse configurations and > they all compile well). > > If you agree with this patch, tonight I'll commit to my tree and add > the mips support for cpuset_t soon, so that it all can be tested. The downside of this patch is that it typecasts everything. Along with potentially false positive warnings it also would force compiler to ignore real errors in the code. I'd prefer to see typecast at the caller level on as-needed basis. *If* it's needed, that is. Even that is not pretty either, especially if there are many places like that. Before we decide what's the best way to deal with this I would like to get to the bottom of the original compilation issue first. I suspect we're still missing something. If you could send me a pointer to your repository and to the steps to reproduce compilation issue, I'll take a closer look at what's happening on MIPS. -Artem From owner-svn-src-projects@FreeBSD.ORG Thu May 12 20:41:21 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB60B106566C; Thu, 12 May 2011 20:41:20 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 8B75D8FC1B; Thu, 12 May 2011 20:41:20 +0000 (UTC) Received: from [172.24.96.151] ([192.75.139.251]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p4CKXSaB057720 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 12 May 2011 14:33:30 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Thu, 12 May 2011 16:33:23 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201105080039.p480doiZ021493@svn.freebsd.org> To: Attilio Rao X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Thu, 12 May 2011 14:33:32 -0600 (MDT) Cc: src-committers@FreeBSD.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@FreeBSD.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 20:41:21 -0000 On May 12, 2011, at 4:05 PM, Attilio Rao wrote: > 2011/5/12 Attilio Rao : >> 2011/5/12 Attilio Rao : >>> 2011/5/12 Artem Belevich : >>>> On Thu, May 12, 2011 at 3:22 PM, Attilio Rao = wrote: >>>>> 2011/5/12 Artem Belevich : >>>>>> On Thu, May 12, 2011 at 5:15 AM, Attilio Rao = wrote: >>>>>>> 2011/5/8 Attilio Rao : >>>>>>>> Author: attilio >>>>>>>> Date: Sun May 8 00:39:49 2011 >>>>>>>> New Revision: 221614 >>>>>>>> URL: http://svn.freebsd.org/changeset/base/221614 >>>>>>>>=20 >>>>>>>> Log: >>>>>>>> All architectures define the size-bounded types (uint32_t, = uint64_t, etc.) >>>>>>>> starting from base C types (int, long, etc). >>>>>>>=20 >>>>>>> mips seems having the same issue, so here is my patch: >>>>>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff >>>>>>=20 >>>>>> I see at least one problem. N32 ABI is ILP32 even though it can = use >>>>>> 64-bit registers for "long long". >>>>>=20 >>>>> I'm sorry but this _longlong is non standard for our atomic = scheme, >>>>> nothing in the kernel uses it and in general I'd say to not add = them >>>>> if not strictly necessary. >>>>> Said that, in the -CURRENT code it doesn't seem present, or I'm = missing it? >>>>=20 >>>> The key is that N32 ABI does use 64-bit registers and can perform >>>> 64-bit atomic ops. >>>> Unfortunately, 64-bit type is long long or [u]int64_t. The point is >>>> that it's not *long*. >>>>>=20 >>>>>>> #if defined(__mips_n64) || defined(__mips_n32) >>>>>>> static __inline void >>>>>>> -atomic_set_64(__volatile uint64_t *p, uint64_t v) >>>>>>> +atomic_set_long(__volatile u_long *p, u_long v) >>>>>>=20 >>>>>> Using _long here would not match the assembly on N32. >>>>>>=20 >>>>>> If you stick with your changes, then you should drop __mips_n32 = from >>>>>> the ifdef above. >>>>>> You may also want to add atomic_*_longlong for n32. Actually, for = o64 as well. >>>>>=20 >>>>> I'm not entirely sure in which way the above is different... or at >>>>> least, I may have overlooked the _long support for __mips_n32... = can >>>>> you please elaborate a bit more? >>>>=20 >>>> The inline assembly for atomic_set_long above uses 64-bit = load/store. >>>> This is not going to work for 32-bit long in N32 ABI. >>>=20 >>> That cames from my mips assembly ignorance, I apologize. >>> I just gave a look at types.h and what it just I basically see is: >>> - __mips_n32 is just the same as plain !__mips_n32 && !__mips_n64 >>> - __mips_n64 just addes the operations for 64 bits operands >>=20 >> Oh, yeah, I forgot this part. >> - __mips_n32 should be able to crunch the _64 variants, while >> probabilly the !__mips_n32 && !__mips_n64 doesn't >>=20 >>> Thus what I need to make sure is: >>> - __mips_n32 (and !__mips_n32 && !__mips_n64) case work on 32 bits >>> operand on long too >>> - __mips_n64 works on 64 bits long operands >>=20 >> - That __mips_n32 also defines the _64 variants. >=20 > I spoke in person with Artem and in the end I just decided to make the > smallest possible subset of changes to fix the _long on 32 bits and > then "completed" (as some of them already exist today) the macro > converting the arguments to u_int stuff: > http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff >=20 > I compiled several kernels for MIPS (with sparse configurations and > they all compile well). >=20 > If you agree with this patch, tonight I'll commit to my tree and add > the mips support for cpuset_t soon, so that it all can be tested. This change looks good. Warner= From owner-svn-src-projects@FreeBSD.ORG Thu May 12 21:12:56 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E22FF106564A; Thu, 12 May 2011 21:12:56 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 46B6D8FC21; Thu, 12 May 2011 21:12:56 +0000 (UTC) Received: by gyg13 with SMTP id 13so866575gyg.13 for ; Thu, 12 May 2011 14:12:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=IZff8IafzEeWKVzSMzXk2DTcEM6wMV4LDn95u3Ng8DQ=; b=YI1JjREmSWfeAzPTKYyFZTYIclQecf8+Yqw7NQeMZeE3FN3tF9vdPZXljAzVCR5V5e xMIp+7XZya3PpXX4e029QxJYEMFRDBsvmGaZhzUdpPW3MxhWAyJd0oF1fzNGIlS3t0X/ dAWXbnQioRZi5er+wiOO4OSvfCypJA1UrPE0Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=RgjpRDA710+qX/Hy8+STGkfm6j60BruAcNhp6yXhdRtX+ZRsjaOF3B2F45Zd4kAs8d 5OVext/phGj5BLMYxRgDRjxmM7+rWsHz3R5gKrY4SFYodDJpG15w/mklpkGYu4lK1Q4a MNQc99uArL8jd7aUYGba0sXLpRQhj/xGnXKL8= MIME-Version: 1.0 Received: by 10.236.193.10 with SMTP id j10mr795099yhn.506.1305234775458; Thu, 12 May 2011 14:12:55 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Thu, 12 May 2011 14:12:55 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 23:12:55 +0200 X-Google-Sender-Auth: LxfHeZARQS77cRnzcWBAHGYngwY Message-ID: From: Attilio Rao To: Artem Belevich Content-Type: text/plain; charset=UTF-8 Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 21:12:57 -0000 2011/5/12 Artem Belevich : > On Thu, May 12, 2011 at 10:05 PM, Attilio Rao wrote: >> I spoke in person with Artem and in the end I just decided to make the >> smallest possible subset of changes to fix the _long on 32 bits and >> then "completed" (as some of them already exist today) the macro >> converting the arguments to u_int stuff: >> http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff > > Attilio, > > Let's get back for a second to the original issue you had that propted > you to do atomic ops changes. > If I understand you correctly, your code was passing cpuset_t* as an > argument to atomic_something_long and that caused compiler to complain > that cpuset_t* is not uint32_t*. > > Could you post definition of cpuset_t ? > > It's possible that compiler was actually correct. For instance, > compiler would be right to complain if cpuset_t is a packed structure, > even if that structure is made of a single uint32_t field. It doesn't do the atomic of cpuset_t, it does atomic of members of cpuset_t which are actually long. For example: #define CPU_OR_ATOMIC(d, s) do { \ __size_t __i; \ for (__i = 0; __i < _NCPUWORDS; __i++) \ atomic_set_long(&(d)->__bits[__i], \ (s)->__bits[__i]); \ } while (0) It is a plain C problem, uint32_t mismatches with long also on amd64, in order to demonstrate the problem check this: #include void quqa(volatile uint32_t *p) { *p = 10; } int main(void) { long d; quqa(&d); return (0); } >> I compiled several kernels for MIPS (with sparse configurations and >> they all compile well). >> >> If you agree with this patch, tonight I'll commit to my tree and add >> the mips support for cpuset_t soon, so that it all can be tested. > > The downside of this patch is that it typecasts everything. Along with > potentially false positive warnings it also would force compiler to > ignore real errors in the code. I'd prefer to see typecast at the > caller level on as-needed basis. *If* it's needed, that is. Even that > is not pretty either, especially if there are many places like that. I really think that this is what it is intended since the beginning. If you look at the current code, it already does, likely for the functions actually used in the kernel. The others may be just unused. > Before we decide what's the best way to deal with this I would like to > get to the bottom of the original compilation issue first. I suspect > we're still missing something. The atomic implementation gets messy and prototypes mismatches as exposed earlier. IMHO the real fix is completing the conversion I was doing as I don't really see a valid point against it, if not "mips does it weird, pay attention" :) I'm actually fine with whatever solution actual developers of our mips port came with, I don't have too strong feelings on that. > If you could send me a pointer to your repository and to the steps to > reproduce compilation issue, I'll take a closer look at what's > happening on MIPS. You can checkout as: svn checkout svn+ssh://svn.freebsd.org/base/projects/largeSMP/ But it doesn't already have the mips bit. If you are interested in the conversion, I can just send you patches. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Thu May 12 21:32:45 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF0CE106566C; Thu, 12 May 2011 21:32:45 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id AEB2D8FC1B; Thu, 12 May 2011 21:32:44 +0000 (UTC) Received: by wyf23 with SMTP id 23so2027159wyf.13 for ; Thu, 12 May 2011 14:32:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=qf54ax5MKYgCYUEUJu7nk7hcjwQPPnmM9XMb3kD3zOE=; b=HcWBwN+bUIwwC+4vOycvcVoCdsbB7lIAgHUNgDjwJhBjWxGpo0vntzKA+B6osswNAB GkBiBZ5niqr2Can0Kund1mnO3pS3kD517FC7TwK0Na553qroHJccinatKY7O+AdNGGhd cm5OaIvvgaTtIvUeB8aPk4YZNyl8jPAx3ZleU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=q98NUu3IkpKD+p6w5w4phegfu1ZOQxBuSbKMHUopLL7IjKbex314gx95vnHmoe7Nte QMcYQbFwV3IXSkPzl7DNdiupBXY6hWfZSor8n+iNXWAOHY9bs00TzMpdnrd1Y33LwoAx 1saXTXVQINLfHfHu9VPAuolF0FGgpy7pJaFAs= MIME-Version: 1.0 Received: by 10.216.220.150 with SMTP id o22mr684688wep.59.1305235963501; Thu, 12 May 2011 14:32:43 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.172.196 with HTTP; Thu, 12 May 2011 14:32:43 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Thu, 12 May 2011 14:32:43 -0700 X-Google-Sender-Auth: OoekfOMWM1uTkelWQoEg4U2pdH4 Message-ID: From: mdf@FreeBSD.org To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 21:32:46 -0000 On Thu, May 12, 2011 at 2:12 PM, Attilio Rao wrote: > 2011/5/12 Artem Belevich : >> On Thu, May 12, 2011 at 10:05 PM, Attilio Rao wrot= e: >>> I spoke in person with Artem and in the end I just decided to make the >>> smallest possible subset of changes to fix the _long on 32 bits and >>> then "completed" (as some of them already exist today) the macro >>> converting the arguments to u_int stuff: >>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff >> >> Attilio, >> >> Let's get back for a second to the original issue you had that propted >> you to do atomic ops changes. >> If I understand you correctly, your code was passing cpuset_t* as an >> argument to atomic_something_long and that caused compiler to complain >> that cpuset_t* is not uint32_t*. >> >> Could you post definition of cpuset_t ? >> >> It's possible that compiler was actually correct. For instance, >> compiler would be right to complain if cpuset_t is a packed structure, >> even if that structure is made of a single uint32_t field. > > It doesn't do the atomic of =A0cpuset_t, it does atomic of members of > cpuset_t which are actually long. Isn't this an argument for making it an array of u_int, even though it's marginally pessimal on amd64 and other 64-bit arches? There is guaranteed support for a int-sized (or perhaps 32-bit sized) atomic op. Cheers, matthew From owner-svn-src-projects@FreeBSD.ORG Thu May 12 22:06:40 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E088106564A; Thu, 12 May 2011 22:06:40 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id C457B8FC12; Thu, 12 May 2011 22:06:39 +0000 (UTC) Received: by gwb15 with SMTP id 15so884077gwb.13 for ; Thu, 12 May 2011 15:06:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WeNuJA3WGWJkg5+gEUzakTwV3EGarr8+DM14REdcSMM=; b=BwktMzdu4+AHxc3un969gezZ9+X8/nveFsY/0TEGSoFNxdF8h4KWBJ+NlYhvUmjVzG TsImukz+VoRzK0bAfzAl0YUPowCS7CuFzIQGqKgX/GdzWSoZ28TpinWu1Ks5JT8+C4jI r9CKqxIKlhDPzLe3tbHRMw4S2I+QlB5sL7yxo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=LTJtIUeeOFXskCMiWenK41/R9mZb+MpIeaPylMtNCrwDm8EknrV9Cv4bczx0v9CZz1 kYkT8wLkpezE/JYqT770merHG5aLzbM6NBIc7QrKGCiYb/0y0ebUfk64jr8eFij7EPNk x7SOR09uMmGY13mSz041ZVeGhKHgSw4uQTTyk= MIME-Version: 1.0 Received: by 10.236.180.36 with SMTP id i24mr842968yhm.305.1305237999027; Thu, 12 May 2011 15:06:39 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Thu, 12 May 2011 15:06:38 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Fri, 13 May 2011 00:06:38 +0200 X-Google-Sender-Auth: y8pTsF4yO_uenflwywaK3HuOM_g Message-ID: From: Attilio Rao To: mdf@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 22:06:40 -0000 2011/5/12 : > On Thu, May 12, 2011 at 2:12 PM, Attilio Rao wrote: >> 2011/5/12 Artem Belevich : >>> On Thu, May 12, 2011 at 10:05 PM, Attilio Rao wro= te: >>>> I spoke in person with Artem and in the end I just decided to make the >>>> smallest possible subset of changes to fix the _long on 32 bits and >>>> then "completed" (as some of them already exist today) the macro >>>> converting the arguments to u_int stuff: >>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff >>> >>> Attilio, >>> >>> Let's get back for a second to the original issue you had that propted >>> you to do atomic ops changes. >>> If I understand you correctly, your code was passing cpuset_t* as an >>> argument to atomic_something_long and that caused compiler to complain >>> that cpuset_t* is not uint32_t*. >>> >>> Could you post definition of cpuset_t ? >>> >>> It's possible that compiler was actually correct. For instance, >>> compiler would be right to complain if cpuset_t is a packed structure, >>> even if that structure is made of a single uint32_t field. >> >> It doesn't do the atomic of =C2=A0cpuset_t, it does atomic of members of >> cpuset_t which are actually long. > > Isn't this an argument for making it an array of u_int, even though > it's marginally pessimal on amd64 and other 64-bit arches? =C2=A0There is > guaranteed support for a int-sized (or perhaps 32-bit sized) atomic > op. > There is also guaratees for long-sized atomic operations. I'm not sure what atomic(9) says, but the truth is that long on FreeBSD always matches word boundry, so there is no problem (Bruce thinks that long actually had to be double the size of words, hence the theoretically possible difficulties for atomic operation, but actually that never was the case on FreeBSD). Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Fri May 13 04:54:02 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39089106566B; Fri, 13 May 2011 04:54:02 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 241DE8FC17; Fri, 13 May 2011 04:54:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4D4s2Y8060143; Fri, 13 May 2011 04:54:02 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4D4s24C060136; Fri, 13 May 2011 04:54:02 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201105130454.p4D4s24C060136@svn.freebsd.org> From: Peter Grehan Date: Fri, 13 May 2011 04:54:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221828 - in projects/bhyve_ref: lib lib/libvmmapi share/mk sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/modules sys/modules/vmm usr.sbin u... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 04:54:02 -0000 Author: grehan Date: Fri May 13 04:54:01 2011 New Revision: 221828 URL: http://svn.freebsd.org/changeset/base/221828 Log: Import of bhyve hypervisor and utilities, part 1. vmm.ko - kernel module for VT-x, VT-d and hypervisor control bhyve - user-space sequencer and i/o emulation vmmctl - dump of hypervisor register state libvmm - front-end to vmm.ko chardev interface bhyve was designed and implemented by Neel Natu. Thanks to the following folk from NetApp who helped to make this available: Joe CaraDonna Peter Snyder Jeff Heller Sandeep Mann Steve Miller Brian Pawlowski Added: projects/bhyve_ref/lib/libvmmapi/ projects/bhyve_ref/lib/libvmmapi/Makefile projects/bhyve_ref/lib/libvmmapi/mptable.c projects/bhyve_ref/lib/libvmmapi/mptable.h projects/bhyve_ref/lib/libvmmapi/vmmapi.c projects/bhyve_ref/lib/libvmmapi/vmmapi.h projects/bhyve_ref/lib/libvmmapi/vmmapi_freebsd.c projects/bhyve_ref/sys/amd64/include/vmm.h projects/bhyve_ref/sys/amd64/include/vmm_dev.h projects/bhyve_ref/sys/amd64/vmm/ projects/bhyve_ref/sys/amd64/vmm/amd/ projects/bhyve_ref/sys/amd64/vmm/amd/amdv.c projects/bhyve_ref/sys/amd64/vmm/intel/ projects/bhyve_ref/sys/amd64/vmm/intel/ept.c projects/bhyve_ref/sys/amd64/vmm/intel/ept.h projects/bhyve_ref/sys/amd64/vmm/intel/vmcs.c projects/bhyve_ref/sys/amd64/vmm/intel/vmcs.h projects/bhyve_ref/sys/amd64/vmm/intel/vmx.c projects/bhyve_ref/sys/amd64/vmm/intel/vmx.h projects/bhyve_ref/sys/amd64/vmm/intel/vmx_controls.h projects/bhyve_ref/sys/amd64/vmm/intel/vmx_cpufunc.h projects/bhyve_ref/sys/amd64/vmm/intel/vmx_genassym.c projects/bhyve_ref/sys/amd64/vmm/intel/vmx_msr.c projects/bhyve_ref/sys/amd64/vmm/intel/vmx_msr.h projects/bhyve_ref/sys/amd64/vmm/intel/vmx_support.S projects/bhyve_ref/sys/amd64/vmm/intel/vtd.c projects/bhyve_ref/sys/amd64/vmm/io/ projects/bhyve_ref/sys/amd64/vmm/io/iommu.c projects/bhyve_ref/sys/amd64/vmm/io/iommu.h projects/bhyve_ref/sys/amd64/vmm/io/ppt.c projects/bhyve_ref/sys/amd64/vmm/io/ppt.h projects/bhyve_ref/sys/amd64/vmm/io/vdev.c projects/bhyve_ref/sys/amd64/vmm/io/vdev.h projects/bhyve_ref/sys/amd64/vmm/io/vlapic.c projects/bhyve_ref/sys/amd64/vmm/io/vlapic.h projects/bhyve_ref/sys/amd64/vmm/vmm.c projects/bhyve_ref/sys/amd64/vmm/vmm_dev.c projects/bhyve_ref/sys/amd64/vmm/vmm_ipi.c projects/bhyve_ref/sys/amd64/vmm/vmm_ipi.h projects/bhyve_ref/sys/amd64/vmm/vmm_ktr.h projects/bhyve_ref/sys/amd64/vmm/vmm_lapic.c projects/bhyve_ref/sys/amd64/vmm/vmm_lapic.h projects/bhyve_ref/sys/amd64/vmm/vmm_mem.c projects/bhyve_ref/sys/amd64/vmm/vmm_mem.h projects/bhyve_ref/sys/amd64/vmm/vmm_msr.c projects/bhyve_ref/sys/amd64/vmm/vmm_msr.h projects/bhyve_ref/sys/amd64/vmm/vmm_stat.c projects/bhyve_ref/sys/amd64/vmm/vmm_stat.h projects/bhyve_ref/sys/amd64/vmm/vmm_support.S projects/bhyve_ref/sys/amd64/vmm/vmm_util.c projects/bhyve_ref/sys/amd64/vmm/vmm_util.h projects/bhyve_ref/sys/amd64/vmm/x86.c projects/bhyve_ref/sys/amd64/vmm/x86.h projects/bhyve_ref/sys/modules/vmm/ projects/bhyve_ref/sys/modules/vmm/Makefile projects/bhyve_ref/usr.sbin/bhyve/ projects/bhyve_ref/usr.sbin/bhyve/Makefile projects/bhyve_ref/usr.sbin/bhyve/atpic.c projects/bhyve_ref/usr.sbin/bhyve/consport.c projects/bhyve_ref/usr.sbin/bhyve/dbgport.c projects/bhyve_ref/usr.sbin/bhyve/dbgport.h projects/bhyve_ref/usr.sbin/bhyve/elcr.c projects/bhyve_ref/usr.sbin/bhyve/fbsdrun.c projects/bhyve_ref/usr.sbin/bhyve/fbsdrun.h projects/bhyve_ref/usr.sbin/bhyve/inout.c projects/bhyve_ref/usr.sbin/bhyve/inout.h projects/bhyve_ref/usr.sbin/bhyve/mevent.c projects/bhyve_ref/usr.sbin/bhyve/mevent.h projects/bhyve_ref/usr.sbin/bhyve/mevent_test.c projects/bhyve_ref/usr.sbin/bhyve/pci_emul.c projects/bhyve_ref/usr.sbin/bhyve/pci_emul.h projects/bhyve_ref/usr.sbin/bhyve/pci_hostbridge.c projects/bhyve_ref/usr.sbin/bhyve/pci_passthru.c projects/bhyve_ref/usr.sbin/bhyve/pci_virtio_block.c projects/bhyve_ref/usr.sbin/bhyve/pci_virtio_net.c projects/bhyve_ref/usr.sbin/bhyve/pit_8254.c projects/bhyve_ref/usr.sbin/bhyve/pit_8254.h projects/bhyve_ref/usr.sbin/bhyve/post.c projects/bhyve_ref/usr.sbin/bhyve/rtc.c projects/bhyve_ref/usr.sbin/bhyve/uart.c projects/bhyve_ref/usr.sbin/bhyve/virtio.h projects/bhyve_ref/usr.sbin/bhyve/xmsr.c projects/bhyve_ref/usr.sbin/bhyve/xmsr.h projects/bhyve_ref/usr.sbin/vmmctl/ projects/bhyve_ref/usr.sbin/vmmctl/Makefile projects/bhyve_ref/usr.sbin/vmmctl/sample.sh (contents, props changed) projects/bhyve_ref/usr.sbin/vmmctl/vmmctl.c Modified: projects/bhyve_ref/lib/Makefile projects/bhyve_ref/share/mk/bsd.libnames.mk projects/bhyve_ref/sys/amd64/include/specialreg.h projects/bhyve_ref/sys/modules/Makefile projects/bhyve_ref/usr.sbin/Makefile Modified: projects/bhyve_ref/lib/Makefile ============================================================================== --- projects/bhyve_ref/lib/Makefile Fri May 13 03:40:16 2011 (r221827) +++ projects/bhyve_ref/lib/Makefile Fri May 13 04:54:01 2011 (r221828) @@ -102,6 +102,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libusbhid} \ ${_libusb} \ ${_libvgl} \ + ${_libvmmapi} \ libwrap \ liby \ libz \ @@ -177,6 +178,7 @@ _libncp= libncp .endif _libsmb= libsmb _libvgl= libvgl +_libvmmapi= libvmmapi .endif .if ${MACHINE_ARCH} == "powerpc" Added: projects/bhyve_ref/lib/libvmmapi/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bhyve_ref/lib/libvmmapi/Makefile Fri May 13 04:54:01 2011 (r221828) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +LIB= vmmapi +SRCS= vmmapi.c vmmapi_freebsd.c mptable.c +INCS= vmmapi.h + +CFLAGS+= -I${.CURDIR} + +.include Added: projects/bhyve_ref/lib/libvmmapi/mptable.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bhyve_ref/lib/libvmmapi/mptable.c Fri May 13 04:54:01 2011 (r221828) @@ -0,0 +1,336 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include + +#include "vmmapi.h" +#include "mptable.h" + +#define LAPIC_PADDR (0xFEE00000) +#define LAPIC_VERSION (16) + +#define IOAPIC_PADDR (0xFEC00000) +#define IOAPIC_VERSION (0x11) + +extern int errno; + +static uint8_t +mp_compute_checksum(void *base, size_t len) +{ + uint8_t *bytes = base; + uint8_t sum = 0; + for(; len > 0; len--) { + sum += *bytes++; + } + return 256 - sum; +} + +static void +mp_build_mpfp(struct mp_floating_pointer *mpfp, vm_paddr_t mpfp_gpa) +{ + memset(mpfp, 0, sizeof(*mpfp)); + memcpy(mpfp->signature, MPFP_SIGNATURE, MPFP_SIGNATURE_LEN); + mpfp->mptable_paddr = mpfp_gpa + sizeof(*mpfp); + mpfp->specrev = MP_SPECREV; + mpfp->feature2 = 0; + mpfp->checksum = mp_compute_checksum(mpfp, sizeof(*mpfp)); +} + +static void +mp_build_mpch(struct mp_config_hdr *mpch) +{ + memset(mpch, 0, sizeof(*mpch)); + mpch->specrev = MP_SPECREV; + memcpy(mpch->signature, MPCH_SIGNATURE, MPCH_SIGNATURE_LEN); + memcpy(mpch->oemid, MPCH_OEMID, MPCH_OEMID_LEN); + memcpy(mpch->prodid, MPCH_PRODID, MPCH_PRODID_LEN); + mpch->lapic_paddr = LAPIC_PADDR; + + +} + +static void +mp_build_proc_entries(struct mpe_proc *mpep, int num_proc) +{ + int i; + + for (i = 0; i < num_proc; i++) { + memset(mpep, 0, sizeof(*mpep)); + mpep->entry_type = MP_ENTRY_PROC; + mpep->lapic_id = i; // XXX + mpep->lapic_version = LAPIC_VERSION; + mpep->proc_flags = (i == 0)?MPEP_FLAGS_BSP:0; + mpep->proc_flags |= MPEP_FLAGS_EN; + mpep->proc_signature = MPEP_SIGNATURE; + mpep->feature_flags = MPEP_FEATURES; + mpep++; + } + +} + +static void +mp_build_bus_entries(struct mpe_bus *mpeb) +{ + memset(mpeb, 0, sizeof(*mpeb)); + mpeb->entry_type = MP_ENTRY_BUS; + mpeb->busid = MPE_BUSID_ISA; + memcpy(mpeb->busname, MPE_BUSNAME_ISA, MPE_BUSNAME_LEN); + mpeb++; + + memset(mpeb, 0, sizeof(*mpeb)); + mpeb->entry_type = MP_ENTRY_BUS; + mpeb->busid = MPE_BUSID_PCI; + memcpy(mpeb->busname, MPE_BUSNAME_PCI, MPE_BUSNAME_LEN); + +} + +static void +mp_build_ioapic_entries(struct mpe_ioapic *mpei) +{ + memset(mpei, 0, sizeof(*mpei)); + mpei->entry_type = MP_ENTRY_IOAPIC; + mpei->ioapic_id = MPE_IOAPIC_ID; + mpei->ioapic_version = IOAPIC_VERSION; + mpei->ioapic_flags = MPE_IOAPIC_FLAG_EN; + mpei->ioapic_paddr = IOAPIC_PADDR; +} + +static void +mp_build_ioint_entries(struct mpe_ioint *mpeii, int num_pins) +{ + int pin; + + /* + * The following config is taken from kernel mptable.c + * mptable_parse_default_config_ints(...), for now + * just use the default config, tweek later if needed. + */ + + + /* Run through all 16 pins. */ + for (pin = 0; pin < num_pins; pin++) { + memset(mpeii, 0, sizeof(*mpeii)); + mpeii->entry_type = MP_ENTRY_IOINT; + mpeii->src_bus_id = MPE_BUSID_ISA; + mpeii->dst_apic_id = MPE_IOAPIC_ID; + + /* + * All default configs route IRQs from bus 0 to the first 16 pins + * of the first I/O APIC with an APIC ID of 2. + */ + mpeii->dst_apic_intin = pin; + switch (pin) { + case 0: + /* Pin 0 is an ExtINT pin. */ + mpeii->intr_type = MPEII_INTR_EXTINT; + break; + case 2: + /* IRQ 0 is routed to pin 2. */ + mpeii->intr_type = MPEII_INTR_INT; + mpeii->src_bus_irq = 0; + break; + case 5: + case 10: + case 11: + /* + * PCI Irqs set to level triggered. + */ + mpeii->intr_flags = MPEII_FLAGS_TRIGMODE_LEVEL; + mpeii->src_bus_id = MPE_BUSID_PCI; + default: + /* All other pins are identity mapped. */ + mpeii->intr_type = MPEII_INTR_INT; + mpeii->src_bus_irq = pin; + break; + } + mpeii++; + } + +} + +#define COPYSTR(dest, src, bytes) \ + memcpy(dest, src, bytes); \ + str[bytes] = 0; + + +static void +mptable_dump(struct mp_floating_pointer *mpfp, struct mp_config_hdr *mpch) +{ + static char str[16]; + int i; + char *cur; + + union mpe { + struct mpe_proc *proc; + struct mpe_bus *bus; + struct mpe_ioapic *ioapic; + struct mpe_ioint *ioint; + struct mpe_lint *lnit; + char *p; + }; + + union mpe mpe; + + printf(" MP Floating Pointer :\n"); + COPYSTR(str, mpfp->signature, 4); + printf(" signature: %s\n", str); + printf(" mpch paddr: %x\n", mpfp->mptable_paddr); + printf(" length: %x\n", mpfp->length); + printf(" specrec: %x\n", mpfp->specrev); + printf(" checksum: %x\n", mpfp->checksum); + printf(" feature1: %x\n", mpfp->feature1); + printf(" feature2: %x\n", mpfp->feature2); + printf(" feature3: %x\n", mpfp->feature3); + printf(" feature4: %x\n", mpfp->feature4); + + printf(" MP Configuration Header :\n"); + COPYSTR(str, mpch->signature, 4); + printf(" signature: %s\n", str); + printf(" length: %x\n", mpch->length); + printf(" specrec: %x\n", mpch->specrev); + printf(" checksum: %x\n", mpch->checksum); + COPYSTR(str, mpch->oemid, MPCH_OEMID_LEN); + printf(" oemid: %s\n", str); + COPYSTR(str, mpch->prodid, MPCH_PRODID_LEN); + printf(" prodid: %s\n", str); + printf(" oem_ptr: %x\n", mpch->oem_ptr); + printf(" oem_sz: %x\n", mpch->oem_sz); + printf(" nr_entries: %x\n", mpch->nr_entries); + printf(" apic paddr: %x\n", mpch->lapic_paddr); + printf(" ext_length: %x\n", mpch->ext_length); + printf(" ext_checksum: %x\n", mpch->ext_checksum); + + cur = (char *)mpch + sizeof(*mpch); + for (i = 0; i < mpch->nr_entries; i++) { + mpe.p = cur; + switch(*mpe.p) { + case MP_ENTRY_PROC: + printf(" MP Processor Entry :\n"); + printf(" lapic_id: %x\n", mpe.proc->lapic_id); + printf(" lapic_version: %x\n", mpe.proc->lapic_version); + printf(" proc_flags: %x\n", mpe.proc->proc_flags); + printf(" proc_signature: %x\n", mpe.proc->proc_signature); + printf(" feature_flags: %x\n", mpe.proc->feature_flags); + cur += sizeof(struct mpe_proc); + break; + case MP_ENTRY_BUS: + printf(" MP Bus Entry :\n"); + printf(" busid: %x\n", mpe.bus->busid); + COPYSTR(str, mpe.bus->busname, MPE_BUSNAME_LEN); + printf(" busname: %s\n", str); + cur += sizeof(struct mpe_bus); + break; + case MP_ENTRY_IOAPIC: + printf(" MP IOAPIC Entry :\n"); + printf(" ioapi_id: %x\n", mpe.ioapic->ioapic_id); + printf(" ioapi_version: %x\n", mpe.ioapic->ioapic_version); + printf(" ioapi_flags: %x\n", mpe.ioapic->ioapic_flags); + printf(" ioapi_paddr: %x\n", mpe.ioapic->ioapic_paddr); + cur += sizeof(struct mpe_ioapic); + break; + case MP_ENTRY_IOINT: + printf(" MP IO Interrupt Entry :\n"); + printf(" intr_type: %x\n", mpe.ioint->intr_type); + printf(" intr_flags: %x\n", mpe.ioint->intr_flags); + printf(" src_bus_id: %x\n", mpe.ioint->src_bus_id); + printf(" src_bus_irq: %x\n", mpe.ioint->src_bus_irq); + printf(" dst_apic_id: %x\n", mpe.ioint->dst_apic_id); + printf(" dst_apic_intin: %x\n", mpe.ioint->dst_apic_intin); + cur += sizeof(struct mpe_ioint); + break; + case MP_ENTRY_LINT: + printf(" MP Local Interrupt Entry :\n"); + cur += sizeof(struct mpe_lint); + break; + } + + } +} + +int +vm_build_mptable(struct vmctx *ctx, vm_paddr_t gpa, int len, int ncpu, + void *oemp, int oemsz) +{ + struct mp_config_hdr *mpch; + char *mapaddr; + char *startaddr; + int error; + + mapaddr = vm_map_memory(ctx, gpa, len); + if (mapaddr == MAP_FAILED) { + printf("%s\n", strerror(errno)); + goto err; + } + startaddr = mapaddr; + + mp_build_mpfp((struct mp_floating_pointer*) mapaddr, gpa); + mapaddr += sizeof(struct mp_floating_pointer); + + mpch = (struct mp_config_hdr*)mapaddr; + mp_build_mpch(mpch); + mapaddr += sizeof(struct mp_config_hdr); + + mp_build_proc_entries((struct mpe_proc*) mapaddr, ncpu); + mapaddr += (sizeof(struct mpe_proc)*ncpu); + mpch->nr_entries += ncpu; + + mp_build_bus_entries((struct mpe_bus*)mapaddr); + mapaddr += (sizeof(struct mpe_bus)*MPE_NUM_BUSES); + mpch->nr_entries += MPE_NUM_BUSES; +#if 0 + mp_build_ioapic_entries((struct mpe_ioapic*)mapaddr); + mapaddr += sizeof(struct mpe_ioapic); + mpch->nr_entries++; + + mp_build_ioint_entries((struct mpe_ioint*)mapaddr, MPEII_MAX_IRQ); + mapaddr += sizeof(struct mpe_ioint)*MPEII_MAX_IRQ; + mpch->nr_entries += MPEII_MAX_IRQ; + +#endif + if (oemp) { + mpch->oem_ptr = mapaddr - startaddr + gpa; + mpch->oem_sz = oemsz; + memcpy(mapaddr, oemp, oemsz); + } + mpch->length = (mapaddr) - ((char*) mpch); + mpch->checksum = mp_compute_checksum(mpch, sizeof(*mpch)); + + + // mptable_dump((struct mp_floating_pointer*)startaddr, mpch); +err: + return (error); +} Added: projects/bhyve_ref/lib/libvmmapi/mptable.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bhyve_ref/lib/libvmmapi/mptable.h Fri May 13 04:54:01 2011 (r221828) @@ -0,0 +1,171 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MPTABLE_h_ +#define _MPTABLE_h_ + +#define MP_SPECREV (4) // MP spec revision 1.1 + +/* + * MP Floating Pointer Structure + */ +#define MPFP_SIGNATURE "_MP_" +#define MPFP_SIGNATURE_LEN (4) +#define MPFP_FEATURE2 (0x80) // IMCR is present +struct mp_floating_pointer { + uint8_t signature[MPFP_SIGNATURE_LEN]; + uint32_t mptable_paddr; + uint8_t length; + uint8_t specrev; + uint8_t checksum; + uint8_t feature1; + uint8_t feature2; + uint8_t feature3; + uint8_t feature4; + uint8_t feature5; +}; + + +/* + * MP Configuration Table Header + */ +#define MPCH_SIGNATURE "PCMP" +#define MPCH_SIGNATURE_LEN (4) + +#define MPCH_OEMID "NETAPP " +#define MPCH_OEMID_LEN (8) +#define MPCH_PRODID "vFiler " +#define MPCH_PRODID_LEN (12) + +struct mp_config_hdr { + uint8_t signature[MPCH_SIGNATURE_LEN]; + uint16_t length; + uint8_t specrev; + uint8_t checksum; + uint8_t oemid[MPCH_OEMID_LEN]; + uint8_t prodid[MPCH_PRODID_LEN]; + uint32_t oem_ptr; + uint16_t oem_sz; + uint16_t nr_entries; + uint32_t lapic_paddr; + uint16_t ext_length; + uint8_t ext_checksum; + uint8_t reserved; +}; + +#define MP_ENTRY_PROC (0) +#define MP_ENTRY_BUS (1) +#define MP_ENTRY_IOAPIC (2) +#define MP_ENTRY_IOINT (3) +#define MP_ENTRY_LINT (4) + +/* + * MP Processor Entry + */ + +#define MPEP_FLAGS_EN (0x1) +#define MPEP_FLAGS_BSP (0x2) + +#define MPEP_SIG_FAMILY (6) +#define MPEP_SIG_MODEL (26) +#define MPEP_SIG_STEPPING (5) +#define MPEP_SIGNATURE ((MPEP_SIG_FAMILY << 8) | (MPEP_SIG_MODEL << 4) \ + | (MPEP_SIG_STEPPING)) + +#define MPEP_FEATURES (0xBFEBFBFF) // Value from Intel i7 CPUID + +struct mpe_proc { + uint8_t entry_type; + uint8_t lapic_id; + uint8_t lapic_version; + uint8_t proc_flags; + uint32_t proc_signature; + uint32_t feature_flags; + uint8_t reserved[8]; +}; + +/* + * MP Bus Entry + */ + +#define MPE_NUM_BUSES (2) +#define MPE_BUSNAME_LEN (6) +#define MPE_BUSID_ISA (0) +#define MPE_BUSID_PCI (1) +#define MPE_BUSNAME_ISA "ISA " +#define MPE_BUSNAME_PCI "PCI " +struct mpe_bus { + uint8_t entry_type; + uint8_t busid; + uint8_t busname[MPE_BUSNAME_LEN]; +}; + +/* + * MP IO APIC Entry + */ +#define MPE_IOAPIC_ID (2) +#define MPE_IOAPIC_FLAG_EN (1) +struct mpe_ioapic { + uint8_t entry_type; + uint8_t ioapic_id; + uint8_t ioapic_version; + uint8_t ioapic_flags; + uint32_t ioapic_paddr; + +}; + +/* + * MP IO Interrupt Assignment Entry + */ +#define MPEII_INTR_INT (0) +#define MPEII_INTR_NMI (1) +#define MPEII_INTR_SMI (2) +#define MPEII_INTR_EXTINT (3) +#define MPEII_PCI_IRQ_MASK (0x0c20U) /* IRQ 5,10,11 are PCI connected */ +#define MPEII_MAX_IRQ (16) +#define MPEII_FLAGS_TRIGMODE_LEVEL (0x3) +struct mpe_ioint { + uint8_t entry_type; + uint8_t intr_type; + uint16_t intr_flags; + uint8_t src_bus_id; + uint8_t src_bus_irq; + uint8_t dst_apic_id; + uint8_t dst_apic_intin; +}; + +/* + * MP Local Interrupt Assignment Entry + */ +struct mpe_lint { + uint8_t entry_type; +}; + +int vm_build_mptable(struct vmctx *ctxt, vm_paddr_t gpa, int len, + int ncpu, void *oemp, int oemsz); +#endif /* _MPTABLE_h_ */ Added: projects/bhyve_ref/lib/libvmmapi/vmmapi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/bhyve_ref/lib/libvmmapi/vmmapi.c Fri May 13 04:54:01 2011 (r221828) @@ -0,0 +1,647 @@ +/*- + * Copyright (c) 2011 NetApp, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "vmmapi.h" +#include "mptable.h" + +#ifndef CR4_VMXE +#define CR4_VMXE (1UL << 13) +#endif + +#define BIOS_ROM_BASE (0xf0000) +#define BIOS_ROM_SIZE (0x10000) + +struct vmctx { + int fd; + char *name; +}; + +#define CREATE(x) sysctlbyname("hw.vmm.create", NULL, NULL, (x), strlen((x))) +#define DESTROY(x) sysctlbyname("hw.vmm.destroy", NULL, NULL, (x), strlen((x))) + +static int +vm_device_open(const char *name) +{ + int fd, len; + char *vmfile; + + len = strlen("/dev/vmm/") + strlen(name) + 1; + vmfile = malloc(len); + assert(vmfile != NULL); + snprintf(vmfile, len, "/dev/vmm/%s", name); + + /* Open the device file */ + fd = open(vmfile, O_RDWR, 0); + + free(vmfile); + return (fd); +} + +int +vm_create(const char *name) +{ + + return (CREATE((char *)name)); +} + +struct vmctx * +vm_open(const char *name) +{ + struct vmctx *vm; + + vm = malloc(sizeof(struct vmctx) + strlen(name) + 1); + assert(vm != NULL); + + vm->fd = -1; + vm->name = (char *)(vm + 1); + strcpy(vm->name, name); + + if ((vm->fd = vm_device_open(vm->name)) < 0) + goto err; + + return (vm); +err: + vm_destroy(vm); + return (NULL); +} + +void +vm_destroy(struct vmctx *vm) +{ + assert(vm != NULL); + + DESTROY(vm->name); + if (vm->fd >= 0) + close(vm->fd); + free(vm); +} + +int +vm_get_memory_seg(struct vmctx *ctx, vm_paddr_t gpa, + vm_paddr_t *ret_hpa, size_t *ret_len) +{ + int error; + struct vm_memory_segment seg; + + bzero(&seg, sizeof(seg)); + seg.gpa = gpa; + error = ioctl(ctx->fd, VM_GET_MEMORY_SEG, &seg); + *ret_hpa = seg.hpa; + *ret_len = seg.len; + return (error); +} + +int +vm_setup_memory(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char **mapaddr) +{ + int error; + struct vm_memory_segment seg; + + /* + * Create and optionally map 'len' bytes of memory at guest + * physical address 'gpa' + */ + bzero(&seg, sizeof(seg)); + seg.gpa = gpa; + seg.len = len; + error = ioctl(ctx->fd, VM_MAP_MEMORY, &seg); + if (error == 0 && mapaddr != NULL) { + *mapaddr = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, + ctx->fd, gpa); + } + return (error); +} + +char * +vm_map_memory(struct vmctx *ctx, vm_paddr_t gpa, size_t len) +{ + + /* Map 'len' bytes of memory at guest physical address 'gpa' */ + return ((char *)mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, + ctx->fd, gpa)); +} + +int +vm_set_desc(struct vmctx *ctx, int vcpu, int reg, + uint64_t base, uint32_t limit, uint32_t access) +{ + int error; + struct vm_seg_desc vmsegdesc; + + bzero(&vmsegdesc, sizeof(vmsegdesc)); + vmsegdesc.cpuid = vcpu; + vmsegdesc.regnum = reg; + vmsegdesc.desc.base = base; + vmsegdesc.desc.limit = limit; + vmsegdesc.desc.access = access; + + error = ioctl(ctx->fd, VM_SET_SEGMENT_DESCRIPTOR, &vmsegdesc); + return (error); +} + +int +vm_get_desc(struct vmctx *ctx, int vcpu, int reg, + uint64_t *base, uint32_t *limit, uint32_t *access) +{ + int error; + struct vm_seg_desc vmsegdesc; + + bzero(&vmsegdesc, sizeof(vmsegdesc)); + vmsegdesc.cpuid = vcpu; + vmsegdesc.regnum = reg; + + error = ioctl(ctx->fd, VM_GET_SEGMENT_DESCRIPTOR, &vmsegdesc); + if (error == 0) { + *base = vmsegdesc.desc.base; + *limit = vmsegdesc.desc.limit; + *access = vmsegdesc.desc.access; + } + return (error); +} + +int +vm_set_register(struct vmctx *ctx, int vcpu, int reg, uint64_t val) +{ + int error; + struct vm_register vmreg; + + bzero(&vmreg, sizeof(vmreg)); + vmreg.cpuid = vcpu; + vmreg.regnum = reg; + vmreg.regval = val; + + error = ioctl(ctx->fd, VM_SET_REGISTER, &vmreg); + return (error); +} + +int +vm_get_register(struct vmctx *ctx, int vcpu, int reg, uint64_t *ret_val) +{ + int error; + struct vm_register vmreg; + + bzero(&vmreg, sizeof(vmreg)); + vmreg.cpuid = vcpu; + vmreg.regnum = reg; + + error = ioctl(ctx->fd, VM_GET_REGISTER, &vmreg); + *ret_val = vmreg.regval; + return (error); +} + +int +vm_get_pinning(struct vmctx *ctx, int vcpu, int *host_cpuid) +{ + int error; + struct vm_pin vmpin; + + bzero(&vmpin, sizeof(vmpin)); + vmpin.vm_cpuid = vcpu; + + error = ioctl(ctx->fd, VM_GET_PINNING, &vmpin); + *host_cpuid = vmpin.host_cpuid; + return (error); +} + +int +vm_set_pinning(struct vmctx *ctx, int vcpu, int host_cpuid) +{ + int error; + struct vm_pin vmpin; + + bzero(&vmpin, sizeof(vmpin)); + vmpin.vm_cpuid = vcpu; + vmpin.host_cpuid = host_cpuid; + + error = ioctl(ctx->fd, VM_SET_PINNING, &vmpin); + return (error); +} + +int +vm_run(struct vmctx *ctx, int vcpu, uint64_t rip, struct vm_exit *vmexit) +{ + int error; + struct vm_run vmrun; + + bzero(&vmrun, sizeof(vmrun)); + vmrun.cpuid = vcpu; + vmrun.rip = rip; + + error = ioctl(ctx->fd, VM_RUN, &vmrun); + bcopy(&vmrun.vm_exit, vmexit, sizeof(struct vm_exit)); + return (error); +} + +static int +vm_inject_event_real(struct vmctx *ctx, int vcpu, enum vm_event_type type, + int vector, int error_code, int error_code_valid) +{ + struct vm_event ev; + + bzero(&ev, sizeof(ev)); + ev.cpuid = vcpu; + ev.type = type; + ev.vector = vector; + ev.error_code = error_code; + ev.error_code_valid = error_code_valid; + + return (ioctl(ctx->fd, VM_INJECT_EVENT, &ev)); +} + +int +vm_inject_event(struct vmctx *ctx, int vcpu, enum vm_event_type type, + int vector) +{ + + return (vm_inject_event_real(ctx, vcpu, type, vector, 0, 0)); +} + +int +vm_inject_event2(struct vmctx *ctx, int vcpu, enum vm_event_type type, + int vector, int error_code) +{ + + return (vm_inject_event_real(ctx, vcpu, type, vector, error_code, 1)); +} + +int +vm_build_tables(struct vmctx *ctxt, int ncpu, void *oemtbl, int oemtblsz) +{ + + return (vm_build_mptable(ctxt, BIOS_ROM_BASE, BIOS_ROM_SIZE, ncpu, + oemtbl, oemtblsz)); +} + +int +vm_lapic_irq(struct vmctx *ctx, int vcpu, int vector) +{ + struct vm_lapic_irq vmirq; + + bzero(&vmirq, sizeof(vmirq)); + vmirq.cpuid = vcpu; + vmirq.vector = vector; + + return (ioctl(ctx->fd, VM_LAPIC_IRQ, &vmirq)); +} + +int +vm_inject_nmi(struct vmctx *ctx, int vcpu) +{ + struct vm_nmi vmnmi; + + bzero(&vmnmi, sizeof(vmnmi)); + vmnmi.cpuid = vcpu; + + return (ioctl(ctx->fd, VM_INJECT_NMI, &vmnmi)); +} + +int +vm_capability_name2type(const char *capname) +{ + int i; + + static struct { + const char *name; + int type; + } capstrmap[] = { + { "hlt_exit", VM_CAP_HALT_EXIT }, + { "mtrap_exit", VM_CAP_MTRAP_EXIT }, + { "pause_exit", VM_CAP_PAUSE_EXIT }, + { "unrestricted_guest", VM_CAP_UNRESTRICTED_GUEST }, + { 0 } + }; + + for (i = 0; capstrmap[i].name != NULL && capname != NULL; i++) { + if (strcmp(capstrmap[i].name, capname) == 0) + return (capstrmap[i].type); + } + + return (-1); +} + +int +vm_get_capability(struct vmctx *ctx, int vcpu, enum vm_cap_type cap, + int *retval) +{ + int error; + struct vm_capability vmcap; + + bzero(&vmcap, sizeof(vmcap)); + vmcap.cpuid = vcpu; + vmcap.captype = cap; + + error = ioctl(ctx->fd, VM_GET_CAPABILITY, &vmcap); + *retval = vmcap.capval; + return (error); +} + +int +vm_set_capability(struct vmctx *ctx, int vcpu, enum vm_cap_type cap, int val) +{ + struct vm_capability vmcap; + + bzero(&vmcap, sizeof(vmcap)); + vmcap.cpuid = vcpu; + vmcap.captype = cap; + vmcap.capval = val; + + return (ioctl(ctx->fd, VM_SET_CAPABILITY, &vmcap)); +} + +int +vm_assign_pptdev(struct vmctx *ctx, int bus, int slot, int func) +{ + struct vm_pptdev pptdev; + + bzero(&pptdev, sizeof(pptdev)); + pptdev.bus = bus; + pptdev.slot = slot; + pptdev.func = func; + + return (ioctl(ctx->fd, VM_BIND_PPTDEV, &pptdev)); +} + +int +vm_unassign_pptdev(struct vmctx *ctx, int bus, int slot, int func) +{ + struct vm_pptdev pptdev; + + bzero(&pptdev, sizeof(pptdev)); + pptdev.bus = bus; + pptdev.slot = slot; + pptdev.func = func; + + return (ioctl(ctx->fd, VM_UNBIND_PPTDEV, &pptdev)); +} + +int +vm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, + vm_paddr_t gpa, size_t len, vm_paddr_t hpa) +{ + struct vm_pptdev_mmio pptmmio; + + bzero(&pptmmio, sizeof(pptmmio)); + pptmmio.bus = bus; + pptmmio.slot = slot; + pptmmio.func = func; + pptmmio.gpa = gpa; + pptmmio.len = len; + pptmmio.hpa = hpa; + + return (ioctl(ctx->fd, VM_MAP_PPTDEV_MMIO, &pptmmio)); +} + +int +vm_setup_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, + int destcpu, int vector, int numvec) +{ + struct vm_pptdev_msi pptmsi; + + bzero(&pptmsi, sizeof(pptmsi)); + pptmsi.vcpu = vcpu; + pptmsi.bus = bus; + pptmsi.slot = slot; + pptmsi.func = func; + pptmsi.destcpu = destcpu; + pptmsi.vector = vector; + pptmsi.numvec = numvec; + + return (ioctl(ctx->fd, VM_PPTDEV_MSI, &pptmsi)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Fri May 13 05:59:07 2011 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F22F106566B; Fri, 13 May 2011 05:59:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id E1BF38FC12; Fri, 13 May 2011 05:59:06 +0000 (UTC) Received: from [192.168.14.163] ([24.114.252.233]) (authenticated bits=0) by harmony.bsdimp.com (8.14.4/8.14.3) with ESMTP id p4D5rXWf061540 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Thu, 12 May 2011 23:53:35 -0600 (MDT) (envelope-from imp@bsdimp.com) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Fri, 13 May 2011 01:53:31 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: <31ABDF1E-1D1E-4DDB-B89D-D36E9B7DDC63@bsdimp.com> References: <201105080039.p480doiZ021493@svn.freebsd.org> To: Attilio Rao X-Mailer: Apple Mail (2.1084) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (harmony.bsdimp.com [10.0.0.6]); Thu, 12 May 2011 23:53:37 -0600 (MDT) Cc: mdf@FreeBSD.org, src-committers@FreeBSD.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@FreeBSD.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 05:59:07 -0000 On May 12, 2011, at 6:06 PM, Attilio Rao wrote: > 2011/5/12 : >> On Thu, May 12, 2011 at 2:12 PM, Attilio Rao = wrote: >>> 2011/5/12 Artem Belevich : >>>> On Thu, May 12, 2011 at 10:05 PM, Attilio Rao = wrote: >>>>> I spoke in person with Artem and in the end I just decided to make = the >>>>> smallest possible subset of changes to fix the _long on 32 bits = and >>>>> then "completed" (as some of them already exist today) the macro >>>>> converting the arguments to u_int stuff: >>>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff >>>>=20 >>>> Attilio, >>>>=20 >>>> Let's get back for a second to the original issue you had that = propted >>>> you to do atomic ops changes. >>>> If I understand you correctly, your code was passing cpuset_t* as = an >>>> argument to atomic_something_long and that caused compiler to = complain >>>> that cpuset_t* is not uint32_t*. >>>>=20 >>>> Could you post definition of cpuset_t ? >>>>=20 >>>> It's possible that compiler was actually correct. For instance, >>>> compiler would be right to complain if cpuset_t is a packed = structure, >>>> even if that structure is made of a single uint32_t field. >>>=20 >>> It doesn't do the atomic of cpuset_t, it does atomic of members of >>> cpuset_t which are actually long. >>=20 >> Isn't this an argument for making it an array of u_int, even though >> it's marginally pessimal on amd64 and other 64-bit arches? There is >> guaranteed support for a int-sized (or perhaps 32-bit sized) atomic >> op. >>=20 >=20 > There is also guaratees for long-sized atomic operations. I'm not sure > what atomic(9) says, but the truth is that long on FreeBSD always > matches word boundry, so there is no problem (Bruce thinks that long > actually had to be double the size of words, hence the theoretically > possible difficulties for atomic operation, but actually that never > was the case on FreeBSD). If we can't pass a long-sized operand to the atomic_long operations, = then I'd say that's a bug. I think that the current ABI zoo on MIPS may mean that it makes sense to = define atomic_foo_32, atomic_foo_64, etc and then define atomic_long in = terms of them, such that type-safety is ensured. Since the _32/_64 = functions are defined in .S files, adding aliases based on ABI is easy = and we can just have the right prototypes in the mips atomic.h. While a = little gross in some sense, we know that we can audit things such that = it will be correct, and also optimal. This is, after all, low level = code and that code often calls for tricks to get optimal performance. Warner= From owner-svn-src-projects@FreeBSD.ORG Fri May 13 11:59:56 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DEB8106564A; Fri, 13 May 2011 11:59:56 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id B95A68FC12; Fri, 13 May 2011 11:59:55 +0000 (UTC) Received: from c122-106-158-76.carlnfd1.nsw.optusnet.com.au (c122-106-158-76.carlnfd1.nsw.optusnet.com.au [122.106.158.76]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4DBxjHr014735 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2011 21:59:47 +1000 Date: Fri, 13 May 2011 21:59:45 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh In-Reply-To: <31ABDF1E-1D1E-4DDB-B89D-D36E9B7DDC63@bsdimp.com> Message-ID: <20110513213047.P1035@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <31ABDF1E-1D1E-4DDB-B89D-D36E9B7DDC63@bsdimp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: mdf@freebsd.org, src-committers@freebsd.org, Artem Belevich , Attilio Rao , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 11:59:56 -0000 On Fri, 13 May 2011, Warner Losh wrote: > On May 12, 2011, at 6:06 PM, Attilio Rao wrote: > >> 2011/5/12 : >>> On Thu, May 12, 2011 at 2:12 PM, Attilio Rao wrote: >>>> 2011/5/12 Artem Belevich : >>>>> On Thu, May 12, 2011 at 10:05 PM, Attilio Rao wrote: >>>>>> I spoke in person with Artem and in the end I just decided to make the >>>>>> smallest possible subset of changes to fix the _long on 32 bits and >>>>>> then "completed" (as some of them already exist today) the macro >>>>>> converting the arguments to u_int stuff: >>>>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff Another reply said that it has too many casts. 1 cast would be too many for me. >>>>> Let's get back for a second to the original issue you had that propted >>>>> you to do atomic ops changes. >>>>> If I understand you correctly, your code was passing cpuset_t* as an >>>>> argument to atomic_something_long and that caused compiler to complain >>>>> that cpuset_t* is not uint32_t*. >>>>> >>>>> Could you post definition of cpuset_t ? >>>>> >>>>> It's possible that compiler was actually correct. For instance, >>>>> compiler would be right to complain if cpuset_t is a packed structure, >>>>> even if that structure is made of a single uint32_t field. >>>> >>>> It doesn't do the atomic of cpuset_t, it does atomic of members of >>>> cpuset_t which are actually long. So it has the same design bug as the fd_set API. longs are very unportable, and should be inherently slow, since long should be similar to register_t[2], so an array of longs for a bitmap should be the same speed as an array of register_t's with twice as many elements. This bug is missing for the sigset_t API. sigset_t is even closer to cpuset_t fd_set. It uses an array of uint32_t. >>> Isn't this an argument for making it an array of u_int, even though >>> it's marginally pessimal on amd64 and other 64-bit arches? There is >>> guaranteed support for a int-sized (or perhaps 32-bit sized) atomic >>> op. Yes. register_t is unfortunately not as well supported as u_int by various levels. uint32_t for sigset_t only works as well as it does since it is the same as u_int on all supported arches. OTOH, uint32_t is better than u_int (or even register_t) since it is fixed widths. You probably don't want the bitmap subtype length to be MD like it is when it is long (or register_t). This depends on how well the implementation details are hidden by the API. >> There is also guaratees for long-sized atomic operations. I'm not sure >> what atomic(9) says, but the truth is that long on FreeBSD always It says that u_long and uint64_t are supported on all arches. The former is a bug, and the latter is wrong (uint64_t is not supported on most or all 32-bit arches). >> matches word boundry, so there is no problem (Bruce thinks that long >> actually had to be double the size of words, hence the theoretically >> possible difficulties for atomic operation, but actually that never >> was the case on FreeBSD). I agree :-). > If we can't pass a long-sized operand to the atomic_long operations, then I'd say that's a bug. No, the bug is promising to support this. > > I think that the current ABI zoo on MIPS may mean that it makes sense to define atomic_foo_32, atomic_foo_64, etc and then define atomic_long in terms of them, such that type-safety is ensured. Since the _32/_64 functions are defined in .S files, adding aliases based on ABI is easy and we can just have the right prototypes in the mips atomic.h. While a little gross in some sense, we know that we can audit things such that it will be correct, and also optimal. This is, after all, low level code and that code often calls for tricks to get optimal performance. Please use a Unix editor, or at least the Unix newline character. Supporting uint64_t would be good iff uint64_t == register_t (or maybe bus_width_t), but there are some complications in getting clients to use this. Too many clients now use u_long or long. Perhaps a global substition of u_long by register_t would be a practical solutlion for these. But register_t is bogusly (signed) int32_t on i386. There is also u_register_t on at least i386. The clients are mostly using u_long or long for historical reasons. E.g., as I pointed out earlier, all the clients of atomic_fetchadd_long() only used it since it used to be the largest integral type. BSD4.4 or Net/2 or earlier has far too many longs. Someone apparently changed lots of ints to longs to support 16 bit ints, or the types were always long because ints actually were 16 bits. Using longs causes various ABI problems, and FreeBSD via mostly Lite2 via mostly NetBSD changed many of them to int32_t. But many of the old longs remain. Requiring clients to only use longs when they actually need to do so forces them to justify this use. I don't know of a single case where it is justified (after 1999, when C broke the guarante that long is the largest integral types). Using a fixed width type gives an unchanging API but breaks the automatic future and arch-dependent expansion that is given by using long. Using long used to maximize the expansion possibilities. Now it doesn't even do that. Bruce From owner-svn-src-projects@FreeBSD.ORG Fri May 13 12:17:52 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 63FAD106566B; Fri, 13 May 2011 12:17:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by mx1.freebsd.org (Postfix) with ESMTP id EF8608FC13; Fri, 13 May 2011 12:17:51 +0000 (UTC) Received: from c122-106-158-76.carlnfd1.nsw.optusnet.com.au (c122-106-158-76.carlnfd1.nsw.optusnet.com.au [122.106.158.76]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4DCHnlM027423 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2011 22:17:49 +1000 Date: Fri, 13 May 2011 22:17:49 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Artem Belevich In-Reply-To: Message-ID: <20110513220640.T1035@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, Attilio Rao , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 12:17:52 -0000 On Thu, 12 May 2011, Artem Belevich wrote: > On Thu, May 12, 2011 at 3:22 PM, Attilio Rao wrote: >> 2011/5/12 Artem Belevich : >>> On Thu, May 12, 2011 at 5:15 AM, Attilio Rao wrote: >>>> 2011/5/8 Attilio Rao : >>>> mips seems having the same issue, so here is my patch: >>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic.diff >>> >>> I see at least one problem. N32 ABI is ILP32 even though it can use >>> 64-bit registers for "long long". >> >> I'm sorry but this _longlong is non standard for our atomic scheme, >> nothing in the kernel uses it and in general I'd say to not add them >> if not strictly necessary. It also uses the long long abomination. Apart from being broken as designed, using it gives the same sorts of unportortabilities as does using long long, but slightly more so. E.g., uint64_t and even uintmax_t is plain u_long on all 64 bit arches. Thus unsigned long long on these arches is incompatable with every useful type, and using it gives mainly type mismatches. >> Said that, in the -CURRENT code it doesn't seem present, or I'm missing it? It would also be unusual in MI code, since most arches can't have it. Unlike u_long, for 32-bit arches it actually is twice the bus width like u_long should be, and is thus inherently non-atomic. > The key is that N32 ABI does use 64-bit registers and can perform > 64-bit atomic ops. > Unfortunately, 64-bit type is long long or [u]int64_t. The point is > that it's not *long*. register_t or bus_width_t or even max_atomic_t (like sig_atomic_t, except the latter shouldn't be maximal), might be the correct encoding of this capability for MI code. >> I'm not entirely sure in which way the above is different... or at >> least, I may have overlooked the _long support for __mips_n32... can >> you please elaborate a bit more? > > The inline assembly for atomic_set_long above uses 64-bit load/store. > This is not going to work for 32-bit long in N32 ABI. But does anything actually use the 64-bit capabilities in a 32-bit arch? >>> I think for mips sticking with atomic_*_ would be a better fit >>> considering ABI zoo we potentially have to deal with. >> >> Actually you still have them, it is just the dipendency that changes. MI current code can't tell whether any particular size works. Currently, it can only safely assume that size 32 works (this is documented, and so is the working of size 64, but size 64 doesn't actually work). Bruce From owner-svn-src-projects@FreeBSD.ORG Fri May 13 12:39:20 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49805106564A; Fri, 13 May 2011 12:39:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id D0DE98FC0C; Fri, 13 May 2011 12:39:19 +0000 (UTC) Received: from c122-106-158-76.carlnfd1.nsw.optusnet.com.au (c122-106-158-76.carlnfd1.nsw.optusnet.com.au [122.106.158.76]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p4DCdFVj003634 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2011 22:39:17 +1000 Date: Fri, 13 May 2011 22:39:15 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: Message-ID: <20110513221936.X1161@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 12:39:20 -0000 On Thu, 12 May 2011, Attilio Rao wrote: > 2011/5/12 Artem Belevich : >> Could you post definition of cpuset_t ? >> >> It's possible that compiler was actually correct. For instance, >> compiler would be right to complain if cpuset_t is a packed structure, >> even if that structure is made of a single uint32_t field. > > It doesn't do the atomic of cpuset_t, it does atomic of members of > cpuset_t which are actually long. > For example: > #define CPU_OR_ATOMIC(d, s) do { \ > __size_t __i; \ > for (__i = 0; __i < _NCPUWORDS; __i++) \ > atomic_set_long(&(d)->__bits[__i], \ > (s)->__bits[__i]); \ > } while (0) BTW, how can any code like this (operating on an array) be atomic enough? >> The downside of this patch is that it typecasts everything. Along with >> potentially false positive warnings it also would force compiler to >> ignore real errors in the code. I'd prefer to see typecast at the >> caller level on as-needed basis. *If* it's needed, that is. Even that >> is not pretty either, especially if there are many places like that. > > I really think that this is what it is intended since the beginning. > If you look at the current code, it already does, likely for the > functions actually used in the kernel. The others may be just unused. Maybe for the mips version, but not casting anything was intended from the beginning for the i386 version. Complete type safety without any casts is not very hard if callers are careful to only use atomic ops on supported types. Bruce From owner-svn-src-projects@FreeBSD.ORG Fri May 13 13:50:48 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB2B9106566C; Fri, 13 May 2011 13:50:48 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gw0-f54.google.com (mail-gw0-f54.google.com [74.125.83.54]) by mx1.freebsd.org (Postfix) with ESMTP id 127FE8FC17; Fri, 13 May 2011 13:50:47 +0000 (UTC) Received: by gwb15 with SMTP id 15so1100851gwb.13 for ; Fri, 13 May 2011 06:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=t663UAZ+BlHI1V/3K8bp+otgPGn7m60yUitsEvrPstk=; b=JlEPYbGrqw4TMGx+zsZvCBJ95MJeiPOsIDR5CE95DW7dTliqmarCAHfJfWw5/7dsuc u7phs2gsV7e77eFopbVBw3uwvow66pzbDxgEsYFM+mTgbGL/d9j7yBHa1tTEafNiBBDc 1vjbWdWF0s74ZfFP81gD2MQiwN/UuMiybtIcs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=dQeY6p2c/aFv4vZ0Kr0UNJWbW/D4OXfNSFpDoIj2pfqQS2uTXdVsj5ukx4uu9FIrkg ScO3gXw1hSlN9BQGT1NJJ/MmtgM4x41WYN1MND/rR5qKNqvNrVDWdc93FXkwoU058/OF CixZzQH0UEbXUwOZ5/g+meplQCj/Fu9oHB14k= MIME-Version: 1.0 Received: by 10.236.195.99 with SMTP id o63mr1361986yhn.238.1305294647325; Fri, 13 May 2011 06:50:47 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Fri, 13 May 2011 06:50:47 -0700 (PDT) In-Reply-To: <20110513221936.X1161@besplex.bde.org> References: <201105080039.p480doiZ021493@svn.freebsd.org> <20110513221936.X1161@besplex.bde.org> Date: Fri, 13 May 2011 15:50:47 +0200 X-Google-Sender-Auth: A648GAu_Ysb3poY-0XY1eWrjy_w Message-ID: From: Attilio Rao To: Bruce Evans Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Artem Belevich , src-committers@freebsd.org, Warner Losh , Oleksandr Tymoshenko Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 13:50:48 -0000 2011/5/13 Bruce Evans : > On Thu, 12 May 2011, Attilio Rao wrote: > >> 2011/5/12 Artem Belevich : > >>> Could you post definition of cpuset_t ? >>> >>> It's possible that compiler was actually correct. For instance, >>> compiler would be right to complain if cpuset_t is a packed structure, >>> even if that structure is made of a single uint32_t field. >> >> It doesn't do the atomic of =C2=A0cpuset_t, it does atomic of members of >> cpuset_t which are actually long. >> For example: >> #define CPU_OR_ATOMIC(d, s) do { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 __size_t __i; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 \ >> =C2=A0 =C2=A0 =C2=A0 for (__i =3D 0; __i < _NCPUWORDS; __i++) =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 atomic_set_long(&(d)->_= _bits[__i], =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (s)->__bi= ts[__i]); =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> } while (0) > > BTW, how can any code like this (operating on an array) be atomic enough? (Replying to similar questions once for all, because it is not the first ti= me): Protection must not be handled here, but from the callers, which know the context. Right now we have something like (for a typical, shared, cpumask_t function= s): volatile cpumask_t stoppedcpus; void f() { cpumask_t c; ... c =3D stoppedcpus; (operations on c) Whatever happens stoppedcpus may change just after read or write, then it means we use stoppedcpus and other mask objects unlocking, we just bear with races. That works right now, because we really don't preview a dynamic scheme for CPUs. They are setup at system boot and will remain like that pretty much forever. The per-cpu stuff also, is read only. The pm_active objects are protected by VM locks. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Fri May 13 13:56:12 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A43D106564A; Fri, 13 May 2011 13:56:12 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-gy0-f182.google.com (mail-gy0-f182.google.com [209.85.160.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6F4838FC14; Fri, 13 May 2011 13:56:11 +0000 (UTC) Received: by gyg13 with SMTP id 13so1102745gyg.13 for ; Fri, 13 May 2011 06:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lOrBNZlsuxin5QbH/oemIZaD+VjTa/Gr2YCiARtpbeo=; b=ogr5V2pC9dMl6uxZPTEKCTOSt27B4oaubSrHHS81Epkosju+38VnkRhBsw7o11APc8 9lbihZYW8RHNZt2AyPMukUXkAGG+3fkr/pflAqxRniVdWofNFphca8mLU1Jn2y9a7dVS i3EzJ+Tm6n0tKUhEFSHDvYMma44MM8ol9gZh4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mnJpq+DMfs1quuxah63jKwQFZ9RpZjsGDqnYknh3Nm3lPYNb0d7Bc48QlIxv4vZL4U tft8EVmCms8nQi5opO6ykCLgu4bGvdp2qErK8lhN/r9gaoj5fWm+LBnHJGsYn7+vJjgs ZvYtRoTCZJPiHtRXbhOkGHs0ZLUq0LbS4k3lw= MIME-Version: 1.0 Received: by 10.236.155.105 with SMTP id i69mr511178yhk.372.1305294969901; Fri, 13 May 2011 06:56:09 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Fri, 13 May 2011 06:56:09 -0700 (PDT) In-Reply-To: <31ABDF1E-1D1E-4DDB-B89D-D36E9B7DDC63@bsdimp.com> References: <201105080039.p480doiZ021493@svn.freebsd.org> <31ABDF1E-1D1E-4DDB-B89D-D36E9B7DDC63@bsdimp.com> Date: Fri, 13 May 2011 15:56:09 +0200 X-Google-Sender-Auth: DO0jaQQ02keA1wg3tWg6FAjjkCM Message-ID: From: Attilio Rao To: Warner Losh Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: mdf@freebsd.org, src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 13:56:12 -0000 2011/5/13 Warner Losh : > > On May 12, 2011, at 6:06 PM, Attilio Rao wrote: > >> 2011/5/12 =C2=A0: >>> On Thu, May 12, 2011 at 2:12 PM, Attilio Rao wrot= e: >>>> 2011/5/12 Artem Belevich : >>>>> On Thu, May 12, 2011 at 10:05 PM, Attilio Rao w= rote: >>>>>> I spoke in person with Artem and in the end I just decided to make t= he >>>>>> smallest possible subset of changes to fix the _long on 32 bits and >>>>>> then "completed" (as some of them already exist today) the macro >>>>>> converting the arguments to u_int stuff: >>>>>> http://www.freebsd.org/~attilio/largeSMP/mips-atomic2.diff >>>>> >>>>> Attilio, >>>>> >>>>> Let's get back for a second to the original issue you had that propte= d >>>>> you to do atomic ops changes. >>>>> If I understand you correctly, your code was passing cpuset_t* as an >>>>> argument to atomic_something_long and that caused compiler to complai= n >>>>> that cpuset_t* is not uint32_t*. >>>>> >>>>> Could you post definition of cpuset_t ? >>>>> >>>>> It's possible that compiler was actually correct. For instance, >>>>> compiler would be right to complain if cpuset_t is a packed structure= , >>>>> even if that structure is made of a single uint32_t field. >>>> >>>> It doesn't do the atomic of =C2=A0cpuset_t, it does atomic of members = of >>>> cpuset_t which are actually long. >>> >>> Isn't this an argument for making it an array of u_int, even though >>> it's marginally pessimal on amd64 and other 64-bit arches? =C2=A0There = is >>> guaranteed support for a int-sized (or perhaps 32-bit sized) atomic >>> op. >>> >> >> There is also guaratees for long-sized atomic operations. I'm not sure >> what atomic(9) says, but the truth is that long on FreeBSD always >> matches word boundry, so there is no problem (Bruce thinks that long >> actually had to be double the size of words, hence the theoretically >> possible difficulties for atomic operation, but actually that never >> was the case on FreeBSD). > > If we can't pass a long-sized operand to the atomic_long operations, then= I'd say that's a bug. > > I think that the current ABI zoo on MIPS may mean that it makes sense to = define atomic_foo_32, atomic_foo_64, etc and then define atomic_long in ter= ms of them, such that type-safety is ensured. =C2=A0Since the _32/_64 funct= ions are defined in .S files, adding aliases based on ABI is easy and we ca= n just have the right prototypes in the mips atomic.h. =C2=A0While a little= gross in some sense, we know that we can audit things such that it will be= correct, and also optimal. =C2=A0This is, after all, low level code and th= at code often calls for tricks to get optimal performance. _32 and _64 aren't defined in support.S. They were but now they are moved to atomic.h directly (they are "#if 0" in support.S now). There are several ways to fix this: - Rewrite entirely atomic.h for supporting C standard types from which derivate uintXX_t versions (that was my first attempt, which has bugs, as Artem pointed out, due to my misunderstanding of what every mips flavors need to access in terms of operations) - You can offer inline functions for offering type-pun avoidance in the _long() version - You can just crudely cast the _long() version arguments The latest is the dirtiest in my idea, but still has the smallest patchset. It is implemented in the patch I already sent here (I think we already do that, for some of the _long() versions, which are probabilly the only ones already used in mips kernel). So I'd go with the first or the third case, I'm not strongly in favor of one or another, but please just pick one. Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Fri May 13 14:57:20 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F28231065673; Fri, 13 May 2011 14:57:20 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2FEC8FC14; Fri, 13 May 2011 14:57:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DEvKM8074043; Fri, 13 May 2011 14:57:20 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DEvKxM074041; Fri, 13 May 2011 14:57:20 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105131457.p4DEvKxM074041@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 14:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221838 - projects/largeSMP/sys/ia64/ia64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 14:57:21 -0000 Author: attilio Date: Fri May 13 14:57:20 2011 New Revision: 221838 URL: http://svn.freebsd.org/changeset/base/221838 Log: Fix remaining bits that actually weren't converted by mistake. Reported by: sbruno Modified: projects/largeSMP/sys/ia64/ia64/mp_machdep.c Modified: projects/largeSMP/sys/ia64/ia64/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/ia64/ia64/mp_machdep.c Fri May 13 14:33:45 2011 (r221837) +++ projects/largeSMP/sys/ia64/ia64/mp_machdep.c Fri May 13 14:57:20 2011 (r221838) @@ -286,7 +286,7 @@ cpu_mp_add(u_int acpi_id, u_int id, u_in cpuid = (IA64_LID_GET_SAPIC_ID(ia64_get_lid()) == sapic_id) ? 0 : smp_cpus++; - KASSERT((all_cpus & (1UL << cpuid)) == 0, + KASSERT(!CPU_ISSET(cpuid, &all_cpus), ("%s: cpu%d already in CPU map", __func__, acpi_id)); if (cpuid != 0) { @@ -300,7 +300,7 @@ cpu_mp_add(u_int acpi_id, u_int id, u_in pc->pc_acpi_id = acpi_id; pc->pc_md.lid = IA64_LID_SET_SAPIC_ID(sapic_id); - all_cpus |= (1UL << pc->pc_cpuid); + CPU_SET(pc->pc_cpuid, &all_cpus); } void @@ -359,7 +359,8 @@ cpu_mp_start() SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { pc->pc_md.current_pmap = kernel_pmap; - pc->pc_other_cpus = all_cpus & ~pc->pc_cpumask; + pc->pc_other_cpus = all_cpus; + CPU_NAND(&pc->pc_other_cpus, &pc->pc_cpumask); /* The BSP is obviously running already. */ if (pc->pc_cpuid == 0) { pc->pc_md.awake = 1; From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:09:35 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D5C451065677; Fri, 13 May 2011 15:09:35 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6A038FC0C; Fri, 13 May 2011 15:09:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DF9ZWW074360; Fri, 13 May 2011 15:09:35 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DF9Zil074358; Fri, 13 May 2011 15:09:35 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105131509.p4DF9Zil074358@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 15:09:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221840 - projects/largeSMP/sys/dev/cfi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:09:35 -0000 Author: attilio Date: Fri May 13 15:09:35 2011 New Revision: 221840 URL: http://svn.freebsd.org/changeset/base/221840 Log: After rewriting powerpc atomic we decided to commit at the constraint that for _ptr operations, when not used directly with uintptr_t, we needed to manually cast. Use the cast on the _ptr version, where it actually wasn't (please note that i386 doesn't get it right, while amd64 doesn't seem to compile cfi neither in LINT, that is why it doesn't fail). Reported by: sbruno Modified: projects/largeSMP/sys/dev/cfi/cfi_dev.c Modified: projects/largeSMP/sys/dev/cfi/cfi_dev.c ============================================================================== --- projects/largeSMP/sys/dev/cfi/cfi_dev.c Fri May 13 15:06:35 2011 (r221839) +++ projects/largeSMP/sys/dev/cfi/cfi_dev.c Fri May 13 15:09:35 2011 (r221840) @@ -145,7 +145,8 @@ cfi_devopen(struct cdev *dev, int oflags sc = dev->si_drv1; /* We allow only 1 open. */ - if (!atomic_cmpset_acq_ptr(&sc->sc_opened, NULL, td->td_proc)) + if (!atomic_cmpset_acq_ptr((uintptr_t *)&sc->sc_opened, + (uintptr_t)NULL, (uintptr_t)td->td_proc)) return (EBUSY); return (0); } From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:20:58 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DD59106567B; Fri, 13 May 2011 15:20:58 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 825EE8FC0C; Fri, 13 May 2011 15:20:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DFKw6L074655; Fri, 13 May 2011 15:20:58 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DFKw3B074637; Fri, 13 May 2011 15:20:58 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105131520.p4DFKw3B074637@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 15:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221841 - in projects/largeSMP: contrib/top lib/libfetch lib/libprocstat release/powerpc share/mk sys/dev/ath sys/dev/ath/ath_hal/ar5416 sys/dev/ath/ath_hal/ar9002 sys/dev/bge sys/dev/b... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:20:58 -0000 Author: attilio Date: Fri May 13 15:20:57 2011 New Revision: 221841 URL: http://svn.freebsd.org/changeset/base/221841 Log: MFC Modified: projects/largeSMP/lib/libfetch/Makefile projects/largeSMP/lib/libfetch/common.c projects/largeSMP/lib/libfetch/file.c projects/largeSMP/lib/libfetch/ftp.c projects/largeSMP/lib/libfetch/http.c projects/largeSMP/lib/libprocstat/Makefile projects/largeSMP/lib/libprocstat/libprocstat.c projects/largeSMP/release/powerpc/mkisoimages.sh projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c projects/largeSMP/sys/dev/ath/if_ath.c projects/largeSMP/sys/dev/bge/if_bge.c projects/largeSMP/sys/dev/bge/if_bgereg.h projects/largeSMP/sys/dev/bm/if_bm.c projects/largeSMP/sys/dev/bxe/if_bxe.c projects/largeSMP/sys/dev/bxe/if_bxe.h projects/largeSMP/sys/dev/mii/atphy.c projects/largeSMP/sys/dev/mii/mii_physubr.c projects/largeSMP/sys/dev/pci/isa_pci.c projects/largeSMP/sys/dev/xen/balloon/balloon.c projects/largeSMP/sys/i386/i386/machdep.c projects/largeSMP/sys/i386/xen/clock.c projects/largeSMP/sys/i386/xen/mp_machdep.c projects/largeSMP/sys/kern/kern_clocksource.c projects/largeSMP/sys/kern/kern_synch.c projects/largeSMP/sys/kern/kern_sysctl.c projects/largeSMP/sys/kern/vfs_bio.c projects/largeSMP/sys/kern/vfs_mount.c projects/largeSMP/sys/kern/vfs_subr.c projects/largeSMP/sys/kern/vfs_vnops.c projects/largeSMP/sys/kern/vnode_if.src projects/largeSMP/sys/sys/priority.h projects/largeSMP/sys/ufs/ffs/ffs_softdep.c projects/largeSMP/usr.bin/fstat/fstat.c projects/largeSMP/usr.bin/mkuzip/mkuzip.c Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/lib/libfetch/Makefile ============================================================================== --- projects/largeSMP/lib/libfetch/Makefile Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libfetch/Makefile Fri May 13 15:20:57 2011 (r221841) @@ -26,7 +26,6 @@ LDADD= -lmd CFLAGS+= -DFTP_COMBINE_CWDS CSTD?= c99 -WARNS?= 2 SHLIB_MAJOR= 6 Modified: projects/largeSMP/lib/libfetch/common.c ============================================================================== --- projects/largeSMP/lib/libfetch/common.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libfetch/common.c Fri May 13 15:20:57 2011 (r221841) @@ -213,6 +213,7 @@ fetch_reopen(int sd) /* allocate and fill connection structure */ if ((conn = calloc(1, sizeof(*conn))) == NULL) return (NULL); + fcntl(sd, F_SETFD, FD_CLOEXEC); conn->sd = sd; ++conn->ref; return (conn); Modified: projects/largeSMP/lib/libfetch/file.c ============================================================================== --- projects/largeSMP/lib/libfetch/file.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libfetch/file.c Fri May 13 15:20:57 2011 (r221841) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -57,6 +58,7 @@ fetchXGetFile(struct url *u, struct url_ fetch_syserr(); } + fcntl(fileno(f), F_SETFD, FD_CLOEXEC); return (f); } @@ -84,6 +86,7 @@ fetchPutFile(struct url *u, const char * fetch_syserr(); } + fcntl(fileno(f), F_SETFD, FD_CLOEXEC); return (f); } Modified: projects/largeSMP/lib/libfetch/ftp.c ============================================================================== --- projects/largeSMP/lib/libfetch/ftp.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libfetch/ftp.c Fri May 13 15:20:57 2011 (r221841) @@ -127,7 +127,7 @@ unmappedaddr(struct sockaddr_in6 *sin6) !IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) return; sin4 = (struct sockaddr_in *)sin6; - addr = *(u_int32_t *)&sin6->sin6_addr.s6_addr[12]; + addr = *(u_int32_t *)(uintptr_t)&sin6->sin6_addr.s6_addr[12]; port = sin6->sin6_port; memset(sin4, 0, sizeof(struct sockaddr_in)); sin4->sin_addr.s_addr = addr; Modified: projects/largeSMP/lib/libfetch/http.c ============================================================================== --- projects/largeSMP/lib/libfetch/http.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libfetch/http.c Fri May 13 15:20:57 2011 (r221841) @@ -454,7 +454,7 @@ http_match(const char *str, const char * * Get the next header and return the appropriate symbolic code. We * need to read one line ahead for checking for a continuation line * belonging to the current header (continuation lines start with - * white space). + * white space). * * We get called with a fresh line already in the conn buffer, either * from the previous http_next_header() invocation, or, the first @@ -462,7 +462,7 @@ http_match(const char *str, const char * * * This stops when we encounter an empty line (we dont read beyond the header * area). - * + * * Note that the "headerbuf" is just a place to return the result. Its * contents are not used for the next call. This means that no cleanup * is needed when ie doing another connection, just call the cleanup when @@ -487,7 +487,7 @@ init_http_headerbuf(http_headerbuf_t *bu buf->buflen = 0; } -static void +static void clean_http_headerbuf(http_headerbuf_t *buf) { if (buf->buf) @@ -496,10 +496,10 @@ clean_http_headerbuf(http_headerbuf_t *b } /* Remove whitespace at the end of the buffer */ -static void +static void http_conn_trimright(conn_t *conn) { - while (conn->buflen && + while (conn->buflen && isspace((unsigned char)conn->buf[conn->buflen - 1])) conn->buflen--; conn->buf[conn->buflen] = '\0'; @@ -508,11 +508,11 @@ http_conn_trimright(conn_t *conn) static hdr_t http_next_header(conn_t *conn, http_headerbuf_t *hbuf, const char **p) { - int i, len; + unsigned int i, len; - /* + /* * Have to do the stripping here because of the first line. So - * it's done twice for the subsequent lines. No big deal + * it's done twice for the subsequent lines. No big deal */ http_conn_trimright(conn); if (conn->buflen == 0) @@ -527,19 +527,19 @@ http_next_header(conn_t *conn, http_head strcpy(hbuf->buf, conn->buf); hbuf->buflen = conn->buflen; - /* + /* * Fetch possible continuation lines. Stop at 1st non-continuation - * and leave it in the conn buffer - */ + * and leave it in the conn buffer + */ for (i = 0; i < HTTP_MAX_CONT_LINES; i++) { if (fetch_getln(conn) == -1) return (hdr_syserror); - /* + /* * Note: we carry on the idea from the previous version * that a pure whitespace line is equivalent to an empty * one (so it's not continuation and will be handled when - * we are called next) + * we are called next) */ http_conn_trimright(conn); if (conn->buf[0] != ' ' && conn->buf[0] != "\t"[0]) @@ -555,7 +555,7 @@ http_next_header(conn_t *conn, http_head } strcpy(hbuf->buf + hbuf->buflen, conn->buf); hbuf->buflen += conn->buflen; - } + } /* * We could check for malformed headers but we don't really care. @@ -574,12 +574,12 @@ http_next_header(conn_t *conn, http_head * [Proxy-]Authenticate header parsing */ -/* - * Read doublequote-delimited string into output buffer obuf (allocated +/* + * Read doublequote-delimited string into output buffer obuf (allocated * by caller, whose responsibility it is to ensure that it's big enough) * cp points to the first char after the initial '"' - * Handles \ quoting - * Returns pointer to the first char after the terminating double quote, or + * Handles \ quoting + * Returns pointer to the first char after the terminating double quote, or * NULL for error. */ static const char * @@ -620,7 +620,7 @@ typedef struct { int nc; /* Nonce count */ } http_auth_challenge_t; -static void +static void init_http_auth_challenge(http_auth_challenge_t *b) { b->scheme = HTTPAS_UNKNOWN; @@ -628,18 +628,18 @@ init_http_auth_challenge(http_auth_chall b->stale = b->nc = 0; } -static void +static void clean_http_auth_challenge(http_auth_challenge_t *b) { - if (b->realm) + if (b->realm) free(b->realm); - if (b->qop) + if (b->qop) free(b->qop); - if (b->nonce) + if (b->nonce) free(b->nonce); - if (b->opaque) + if (b->opaque) free(b->opaque); - if (b->algo) + if (b->algo) free(b->algo); init_http_auth_challenge(b); } @@ -652,7 +652,7 @@ typedef struct { int valid; /* We did parse an authenticate header */ } http_auth_challenges_t; -static void +static void init_http_auth_challenges(http_auth_challenges_t *cs) { int i; @@ -661,7 +661,7 @@ init_http_auth_challenges(http_auth_chal cs->count = cs->valid = 0; } -static void +static void clean_http_auth_challenges(http_auth_challenges_t *cs) { int i; @@ -675,19 +675,19 @@ clean_http_auth_challenges(http_auth_cha init_http_auth_challenges(cs); } -/* +/* * Enumeration for lexical elements. Separators will be returned as their own * ascii value */ typedef enum {HTTPHL_WORD=256, HTTPHL_STRING=257, HTTPHL_END=258, HTTPHL_ERROR = 259} http_header_lex_t; -/* +/* * Determine what kind of token comes next and return possible value * in buf, which is supposed to have been allocated big enough by - * caller. Advance input pointer and return element type. + * caller. Advance input pointer and return element type. */ -static int +static int http_header_lex(const char **cpp, char *buf) { size_t l; @@ -716,7 +716,7 @@ http_header_lex(const char **cpp, char * return (HTTPHL_WORD); } -/* +/* * Read challenges from http xxx-authenticate header and accumulate them * in the challenges list structure. * @@ -728,7 +728,7 @@ http_header_lex(const char **cpp, char * * * We support both approaches anyway */ -static int +static int http_parse_authenticate(const char *cp, http_auth_challenges_t *cs) { int ret = -1; @@ -752,7 +752,7 @@ http_parse_authenticate(const char *cp, /* Loop on challenges */ for (; cs->count < MAX_CHALLENGES; cs->count++) { - cs->challenges[cs->count] = + cs->challenges[cs->count] = malloc(sizeof(http_auth_challenge_t)); if (cs->challenges[cs->count] == NULL) { fetch_syserr(); @@ -765,14 +765,14 @@ http_parse_authenticate(const char *cp, cs->challenges[cs->count]->scheme = HTTPAS_DIGEST; } else { cs->challenges[cs->count]->scheme = HTTPAS_UNKNOWN; - /* - * Continue parsing as basic or digest may + /* + * Continue parsing as basic or digest may * follow, and the syntax is the same for * all. We'll just ignore this one when * looking at the list */ } - + /* Loop on attributes */ for (;;) { /* Key */ @@ -791,31 +791,31 @@ http_parse_authenticate(const char *cp, goto out; if (!strcasecmp(key, "realm")) - cs->challenges[cs->count]->realm = + cs->challenges[cs->count]->realm = strdup(value); else if (!strcasecmp(key, "qop")) - cs->challenges[cs->count]->qop = + cs->challenges[cs->count]->qop = strdup(value); else if (!strcasecmp(key, "nonce")) - cs->challenges[cs->count]->nonce = + cs->challenges[cs->count]->nonce = strdup(value); else if (!strcasecmp(key, "opaque")) - cs->challenges[cs->count]->opaque = + cs->challenges[cs->count]->opaque = strdup(value); else if (!strcasecmp(key, "algorithm")) - cs->challenges[cs->count]->algo = + cs->challenges[cs->count]->algo = strdup(value); else if (!strcasecmp(key, "stale")) - cs->challenges[cs->count]->stale = + cs->challenges[cs->count]->stale = strcasecmp(value, "no"); /* Else ignore unknown attributes */ /* Comma or Next challenge or End */ lex = http_header_lex(&cp, key); - /* - * If we get a word here, this is the beginning of the - * next challenge. Break the attributes loop - */ + /* + * If we get a word here, this is the beginning of the + * next challenge. Break the attributes loop + */ if (lex == HTTPHL_WORD) break; @@ -832,10 +832,10 @@ http_parse_authenticate(const char *cp, } /* End attributes loop */ } /* End challenge loop */ - /* - * Challenges max count exceeded. This really can't happen - * with normal data, something's fishy -> error - */ + /* + * Challenges max count exceeded. This really can't happen + * with normal data, something's fishy -> error + */ out: if (key) @@ -1011,16 +1011,16 @@ init_http_auth_params(http_auth_params_t s->scheme = s->realm = s->user = s->password = 0; } -static void +static void clean_http_auth_params(http_auth_params_t *s) { - if (s->scheme) + if (s->scheme) free(s->scheme); - if (s->realm) + if (s->realm) free(s->realm); - if (s->user) + if (s->user) free(s->user); - if (s->password) + if (s->password) free(s->password); init_http_auth_params(s); } @@ -1075,7 +1075,7 @@ http_authfromenv(const char *p, http_aut } ret = 0; out: - if (ret == -1) + if (ret == -1) clean_http_auth_params(parms); if (str) free(str); @@ -1083,11 +1083,11 @@ out: } -/* +/* * Digest response: the code to compute the digest is taken from the - * sample implementation in RFC2616 + * sample implementation in RFC2616 */ -#define IN +#define IN const #define OUT #define HASHLEN 16 @@ -1096,7 +1096,7 @@ typedef char HASH[HASHLEN]; typedef char HASHHEX[HASHHEXLEN+1]; static const char *hexchars = "0123456789abcdef"; -static void +static void CvtHex(IN HASH Bin, OUT HASHHEX Hex) { unsigned short i; @@ -1112,7 +1112,7 @@ CvtHex(IN HASH Bin, OUT HASHHEX Hex) }; /* calculate H(A1) as per spec */ -static void +static void DigestCalcHA1( IN char * pszAlg, IN char * pszUserName, @@ -1147,7 +1147,7 @@ DigestCalcHA1( } /* calculate request-digest/response-digest as per HTTP Digest spec */ -static void +static void DigestCalcResponse( IN HASHHEX HA1, /* H(A1) */ IN char * pszNonce, /* nonce from server */ @@ -1160,7 +1160,7 @@ DigestCalcResponse( OUT HASHHEX Response /* request-digest or response-digest */ ) { -/* DEBUG(fprintf(stderr, +/* DEBUG(fprintf(stderr, "Calc: HA1[%s] Nonce[%s] qop[%s] method[%s] URI[%s]\n", HA1, pszNonce, pszQop, pszMethod, pszDigestUri));*/ MD5_CTX Md5Ctx; @@ -1199,8 +1199,8 @@ DigestCalcResponse( CvtHex(RespHash, Response); } -/* - * Generate/Send a Digest authorization header +/* + * Generate/Send a Digest authorization header * This looks like: [Proxy-]Authorization: credentials * * credentials = "Digest" digest-response @@ -1233,10 +1233,10 @@ http_digest_auth(conn_t *conn, const cha DEBUG(fprintf(stderr, "realm/nonce not set in challenge\n")); return(-1); } - if (!c->algo) + if (!c->algo) c->algo = strdup(""); - if (asprintf(&options, "%s%s%s%s", + if (asprintf(&options, "%s%s%s%s", *c->algo? ",algorithm=" : "", c->algo, c->opaque? ",opaque=" : "", c->opaque?c->opaque:"")== -1) return (-1); @@ -1264,13 +1264,13 @@ http_digest_auth(conn_t *conn, const cha r = http_cmd(conn, "%s: Digest username=\"%s\",realm=\"%s\"," "nonce=\"%s\",uri=\"%s\",response=\"%s\"," "qop=\"auth\", cnonce=\"%s\", nc=%s%s", - hdr, parms->user, c->realm, + hdr, parms->user, c->realm, c->nonce, url->doc, digest, cnonce, noncecount, options); } else { r = http_cmd(conn, "%s: Digest username=\"%s\",realm=\"%s\"," "nonce=\"%s\",uri=\"%s\",response=\"%s\"%s", - hdr, parms->user, c->realm, + hdr, parms->user, c->realm, c->nonce, url->doc, digest, options); } if (options) @@ -1301,7 +1301,7 @@ http_basic_auth(conn_t *conn, const char } /* - * Chose the challenge to answer and call the appropriate routine to + * Chose the challenge to answer and call the appropriate routine to * produce the header. */ static int @@ -1327,16 +1327,16 @@ http_authorize(conn_t *conn, const char } /* Error if "Digest" was specified and there is no Digest challenge */ - if (!digest && (parms->scheme && + if (!digest && (parms->scheme && !strcasecmp(parms->scheme, "digest"))) { - DEBUG(fprintf(stderr, + DEBUG(fprintf(stderr, "Digest auth in env, not supported by peer\n")); return (-1); } - /* - * If "basic" was specified in the environment, or there is no Digest + /* + * If "basic" was specified in the environment, or there is no Digest * challenge, do the basic thing. Don't need a challenge for this, - * so no need to check basic!=NULL + * so no need to check basic!=NULL */ if (!digest || (parms->scheme && !strcasecmp(parms->scheme,"basic"))) return (http_basic_auth(conn,hdr,parms->user,parms->password)); @@ -1492,7 +1492,7 @@ http_request(struct url *URL, const char http_auth_challenges_t proxy_challenges; /* The following calls don't allocate anything */ - init_http_headerbuf(&headerbuf); + init_http_headerbuf(&headerbuf); init_http_auth_challenges(&server_challenges); init_http_auth_challenges(&proxy_challenges); @@ -1578,65 +1578,65 @@ http_request(struct url *URL, const char /* virtual host */ http_cmd(conn, "Host: %s", host); - /* - * Proxy authorization: we only send auth after we received - * a 407 error. We do not first try basic anyway (changed - * when support was added for digest-auth) - */ + /* + * Proxy authorization: we only send auth after we received + * a 407 error. We do not first try basic anyway (changed + * when support was added for digest-auth) + */ if (purl && proxy_challenges.valid) { http_auth_params_t aparams; init_http_auth_params(&aparams); if (*purl->user || *purl->pwd) { - aparams.user = purl->user ? + aparams.user = purl->user ? strdup(purl->user) : strdup(""); aparams.password = purl->pwd? strdup(purl->pwd) : strdup(""); - } else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && + } else if ((p = getenv("HTTP_PROXY_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { http_seterr(HTTP_NEED_PROXY_AUTH); goto ouch; } } - http_authorize(conn, "Proxy-Authorization", + http_authorize(conn, "Proxy-Authorization", &proxy_challenges, &aparams, url); clean_http_auth_params(&aparams); } - /* - * Server authorization: we never send "a priori" + /* + * Server authorization: we never send "a priori" * Basic auth, which used to be done if user/pass were * set in the url. This would be weird because we'd send the - * password in the clear even if Digest is finally to be + * password in the clear even if Digest is finally to be * used (it would have made more sense for the - * pre-digest version to do this when Basic was specified - * in the environment) - */ + * pre-digest version to do this when Basic was specified + * in the environment) + */ if (server_challenges.valid) { http_auth_params_t aparams; init_http_auth_params(&aparams); if (*url->user || *url->pwd) { - aparams.user = url->user ? + aparams.user = url->user ? strdup(url->user) : strdup(""); - aparams.password = url->pwd ? + aparams.password = url->pwd ? strdup(url->pwd) : strdup(""); - } else if ((p = getenv("HTTP_AUTH")) != NULL && + } else if ((p = getenv("HTTP_AUTH")) != NULL && *p != '\0') { if (http_authfromenv(p, &aparams) < 0) { http_seterr(HTTP_NEED_AUTH); goto ouch; } - } else if (fetchAuthMethod && + } else if (fetchAuthMethod && fetchAuthMethod(url) == 0) { - aparams.user = url->user ? + aparams.user = url->user ? strdup(url->user) : strdup(""); - aparams.password = url->pwd ? + aparams.password = url->pwd ? strdup(url->pwd) : strdup(""); } else { http_seterr(HTTP_NEED_AUTH); goto ouch; } - http_authorize(conn, "Authorization", + http_authorize(conn, "Authorization", &server_challenges, &aparams, url); clean_http_auth_params(&aparams); } @@ -1804,12 +1804,12 @@ http_request(struct url *URL, const char } while (h > hdr_end); /* we need to provide authentication */ - if (conn->err == HTTP_NEED_AUTH || + if (conn->err == HTTP_NEED_AUTH || conn->err == HTTP_NEED_PROXY_AUTH) { e = conn->err; - if ((conn->err == HTTP_NEED_AUTH && - !server_challenges.valid) || - (conn->err == HTTP_NEED_PROXY_AUTH && + if ((conn->err == HTTP_NEED_AUTH && + !server_challenges.valid) || + (conn->err == HTTP_NEED_PROXY_AUTH && !proxy_challenges.valid)) { /* 401/7 but no www/proxy-authenticate ?? */ DEBUG(fprintf(stderr, "401/7 and no auth header\n")); Modified: projects/largeSMP/lib/libprocstat/Makefile ============================================================================== --- projects/largeSMP/lib/libprocstat/Makefile Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libprocstat/Makefile Fri May 13 15:20:57 2011 (r221841) @@ -9,7 +9,6 @@ SRCS= cd9660.c \ libprocstat.c \ msdosfs.c \ ntfs.c \ - nwfs.c \ smbfs.c \ udf.c @@ -18,9 +17,14 @@ CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE SHLIB_MAJOR= 1 WITHOUT_MAN= yes +.if ${MK_NCP} != "no" +CFLAGS+= -DLIBPROCSTAT_NWFS +SRCS+= nwfs.c +.endif + # XXX This is a hack. .if ${MK_CDDL} != "no" -CFLAGS+= -DZFS +CFLAGS+= -DLIBPROCSTAT_ZFS OBJS+= zfs/zfs.o SOBJS+= zfs/zfs.So POBJS+= zfs/zfs.po Modified: projects/largeSMP/lib/libprocstat/libprocstat.c ============================================================================== --- projects/largeSMP/lib/libprocstat/libprocstat.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/lib/libprocstat/libprocstat.c Fri May 13 15:20:57 2011 (r221841) @@ -873,11 +873,13 @@ procstat_get_vnode_info_kvm(kvm_t *kd, s FSTYPE(msdosfs), FSTYPE(nfs), FSTYPE(ntfs), +#ifdef LIBPROCSTAT_NWFS FSTYPE(nwfs), +#endif FSTYPE(smbfs), FSTYPE(udf), FSTYPE(ufs), -#ifdef ZFS +#ifdef LIBPROCSTAT_ZFS FSTYPE(zfs), #endif }; Modified: projects/largeSMP/release/powerpc/mkisoimages.sh ============================================================================== --- projects/largeSMP/release/powerpc/mkisoimages.sh Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/release/powerpc/mkisoimages.sh Fri May 13 15:20:57 2011 (r221841) @@ -24,6 +24,7 @@ # into base-bits-dir as part of making the image. if [ "x$1" = "x-b" ]; then + # Apple boot code uudecode -o /tmp/hfs-boot-block.bz2 `dirname $0`/hfs-boot.bz2.uu bzip2 -d /tmp/hfs-boot-block.bz2 OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ') @@ -31,6 +32,17 @@ if [ "x$1" = "x-b" ]; then dd if=$4/boot/loader of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot" + + # pSeries/PAPR boot code + mkdir -p $4/ppc/chrp + cp $4/boot/loader $4/ppc/chrp + cat > $4/ppc/bootinfo.txt << EOF + +FreeBSD Install +FreeBSD +boot &device;:&partition;,\ppc\chrp\loader + +EOF shift else bootable="" @@ -48,3 +60,5 @@ echo "/dev/iso9660/`echo $LABEL | tr '[: makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $* rm $1/etc/fstab rm /tmp/hfs-boot-block +rm -rf $1/ppc + Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h Fri May 13 15:20:57 2011 (r221841) @@ -237,6 +237,15 @@ extern HAL_BOOL ar5416GetChipPowerLimits struct ieee80211_channel *chan); extern void ar5416GetChannelCenters(struct ath_hal *, const struct ieee80211_channel *chan, CHAN_CENTERS *centers); +extern void ar5416SetRatesArrayFromTargetPower(struct ath_hal *ah, + const struct ieee80211_channel *chan, + int16_t *ratesArray, + const CAL_TARGET_POWER_LEG *targetPowerCck, + const CAL_TARGET_POWER_LEG *targetPowerCckExt, + const CAL_TARGET_POWER_LEG *targetPowerOfdm, + const CAL_TARGET_POWER_LEG *targetPowerOfdmExt, + const CAL_TARGET_POWER_HT *targetPowerHt20, + const CAL_TARGET_POWER_HT *targetPowerHt40); extern void ar5416GetTargetPowers(struct ath_hal *ah, const struct ieee80211_channel *chan, CAL_TARGET_POWER_HT *powInfo, Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Fri May 13 15:20:57 2011 (r221841) @@ -492,8 +492,9 @@ ar5416PerCalibrationN(struct ath_hal *ah if (AH5416(ah)->ah_cal_pacal) AH5416(ah)->ah_cal_pacal(ah, AH_FALSE); - /* Do temperature compensation if the chipset needs it */ - AH5416(ah)->ah_olcTempCompensation(ah); + /* Do open-loop temperature compensation if the chipset needs it */ + if (ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) + AH5416(ah)->ah_olcTempCompensation(ah); /* * Get the value from the previous NF cal Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Fri May 13 15:20:57 2011 (r221841) @@ -202,8 +202,11 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO */ ar5416InitChainMasks(ah); - /* Setup the open-loop temperature compensation if required */ - AH5416(ah)->ah_olcInit(ah); + /* Setup the open-loop power calibration if required */ + if (ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) { + AH5416(ah)->ah_olcInit(ah); + AH5416(ah)->ah_olcTempCompensation(ah); + } /* Setup the transmit power values. */ if (!ah->ah_setTxPower(ah, chan, rfXpdGain)) { @@ -1635,6 +1638,63 @@ ar5416SetBoardValues(struct ath_hal *ah, */ /* + * Set the target power array "ratesArray" from the + * given set of target powers. + * + * This is used by the various chipset/EEPROM TX power + * setup routines. + */ +void +ar5416SetRatesArrayFromTargetPower(struct ath_hal *ah, + const struct ieee80211_channel *chan, + int16_t *ratesArray, + const CAL_TARGET_POWER_LEG *targetPowerCck, + const CAL_TARGET_POWER_LEG *targetPowerCckExt, + const CAL_TARGET_POWER_LEG *targetPowerOfdm, + const CAL_TARGET_POWER_LEG *targetPowerOfdmExt, + const CAL_TARGET_POWER_HT *targetPowerHt20, + const CAL_TARGET_POWER_HT *targetPowerHt40) +{ +#define N(a) (sizeof(a)/sizeof(a[0])) + int i; + + /* Blank the rates array, to be consistent */ + for (i = 0; i < Ar5416RateSize; i++) + ratesArray[i] = 0; + + /* Set rates Array from collected data */ + ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] = + ratesArray[rate18mb] = ratesArray[rate24mb] = targetPowerOfdm->tPow2x[0]; + ratesArray[rate36mb] = targetPowerOfdm->tPow2x[1]; + ratesArray[rate48mb] = targetPowerOfdm->tPow2x[2]; + ratesArray[rate54mb] = targetPowerOfdm->tPow2x[3]; + ratesArray[rateXr] = targetPowerOfdm->tPow2x[0]; + + for (i = 0; i < N(targetPowerHt20->tPow2x); i++) { + ratesArray[rateHt20_0 + i] = targetPowerHt20->tPow2x[i]; + } + + if (IEEE80211_IS_CHAN_2GHZ(chan)) { + ratesArray[rate1l] = targetPowerCck->tPow2x[0]; + ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck->tPow2x[1]; + ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck->tPow2x[2]; + ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck->tPow2x[3]; + } + if (IEEE80211_IS_CHAN_HT40(chan)) { + for (i = 0; i < N(targetPowerHt40->tPow2x); i++) { + ratesArray[rateHt40_0 + i] = targetPowerHt40->tPow2x[i]; + } + ratesArray[rateDupOfdm] = targetPowerHt40->tPow2x[0]; + ratesArray[rateDupCck] = targetPowerHt40->tPow2x[0]; + ratesArray[rateExtOfdm] = targetPowerOfdmExt->tPow2x[0]; + if (IEEE80211_IS_CHAN_2GHZ(chan)) { + ratesArray[rateExtCck] = targetPowerCckExt->tPow2x[0]; + } + } +#undef N +} + +/* * ar5416SetPowerPerRateTable * * Sets the transmit power in the baseband for the given @@ -1855,33 +1915,13 @@ ar5416SetPowerPerRateTable(struct ath_ha } /* end ctl mode checking */ /* Set rates Array from collected data */ - ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] = ratesArray[rate18mb] = ratesArray[rate24mb] = targetPowerOfdm.tPow2x[0]; - ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1]; - ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2]; - ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3]; - ratesArray[rateXr] = targetPowerOfdm.tPow2x[0]; - - for (i = 0; i < N(targetPowerHt20.tPow2x); i++) { - ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i]; - } - - if (IEEE80211_IS_CHAN_2GHZ(chan)) { - ratesArray[rate1l] = targetPowerCck.tPow2x[0]; - ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck.tPow2x[1]; - ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck.tPow2x[2]; - ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck.tPow2x[3]; - } - if (IEEE80211_IS_CHAN_HT40(chan)) { - for (i = 0; i < N(targetPowerHt40.tPow2x); i++) { - ratesArray[rateHt40_0 + i] = targetPowerHt40.tPow2x[i]; - } - ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0]; - ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0]; - ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0]; - if (IEEE80211_IS_CHAN_2GHZ(chan)) { - ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0]; - } - } + ar5416SetRatesArrayFromTargetPower(ah, chan, ratesArray, + &targetPowerCck, + &targetPowerCckExt, + &targetPowerOfdm, + &targetPowerOfdmExt, + &targetPowerHt20, + &targetPowerHt40); return AH_TRUE; #undef EXT_ADDITIVE #undef CTL_11A_EXT Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c Fri May 13 15:20:57 2011 (r221841) @@ -43,6 +43,12 @@ ar9280olcInit(struct ath_hal *ah) { uint32_t i; + /* Only do OLC if it's enabled for this chipset */ + if (! ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) + return; + + HALDEBUG(ah, HAL_DEBUG_RESET, "%s: Setting up TX gain tables.\n", __func__); + for (i = 0; i < AR9280_TX_GAIN_TABLE_SIZE; i++) AH9280(ah)->originalGain[i] = MS(OS_REG_READ(ah, AR_PHY_TX_GAIN_TBL1 + i * 4), AR_PHY_TX_GAIN); @@ -126,6 +132,9 @@ ar9280olcTemperatureCompensation(struct int delta, currPDADC, regval; uint8_t hpwr_5g = 0; + if (! ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) + return; + rddata = OS_REG_READ(ah, AR_PHY_TX_PWRCTRL4); currPDADC = MS(rddata, AR_PHY_TX_PWRCTRL_PD_AVG_OUT); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c Fri May 13 15:20:57 2011 (r221841) @@ -368,27 +368,32 @@ ar9285_ant_comb_scan(struct ath_hal *ah, int curr_main_set, curr_bias; int main_rssi = rs->rs_rssi_ctl[0]; int alt_rssi = rs->rs_rssi_ctl[1]; - int rx_ant_conf, main_ant_conf; + int rx_ant_conf, main_ant_conf, alt_ant_conf; HAL_BOOL short_scan = AH_FALSE; + rx_ant_conf = (rs->rs_rssi_ctl[2] >> 4) & ATH_ANT_RX_MASK; + main_ant_conf = (rs->rs_rssi_ctl[2] >> 2) & ATH_ANT_RX_MASK; + alt_ant_conf = (rs->rs_rssi_ctl[2] >> 0) & ATH_ANT_RX_MASK; + +#if 0 + HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: RSSI %d/%d, conf %x/%x, rxconf %x, LNA: %d; ANT: %d; FastDiv: %d\n", + __func__, main_rssi, alt_rssi, main_ant_conf,alt_ant_conf, rx_ant_conf, + !!(rs->rs_rssi_ctl[2] & 0x80), !!(rs->rs_rssi_ctl[2] & 0x40), !!(rs->rs_rssi_ext[2] & 0x40)); +#endif + if (! ar9285_check_div_comb(ah)) return; if (AH5212(ah)->ah_diversity == AH_FALSE) return; - rx_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_CURRENT_SHIFT) & - ATH_ANT_RX_MASK; - main_ant_conf = (rs->rs_rssi_ctl[2] >> ATH_ANT_RX_MAIN_SHIFT) & - ATH_ANT_RX_MASK; - #if 0 HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main: %d, alt: %d, rx_ant_conf: %x, main_ant_conf: %x\n", __func__, main_rssi, alt_rssi, rx_ant_conf, main_ant_conf); #endif /* Record packet only when alt_rssi is positive */ - if (alt_rssi > 0) { + if (main_rssi > 0 && alt_rssi > 0) { antcomb->total_pkt_count++; antcomb->main_total_rssi += main_rssi; antcomb->alt_total_rssi += alt_rssi; @@ -613,13 +618,13 @@ div_comb_done: HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: alt_recv_cnt=%d\n", __func__, antcomb->alt_recv_cnt); - if (curr_alt_set != div_ant_conf.alt_lna_conf) +// if (curr_alt_set != div_ant_conf.alt_lna_conf) HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: lna_conf: %x -> %x\n", __func__, curr_alt_set, div_ant_conf.alt_lna_conf); - if (curr_main_set != div_ant_conf.main_lna_conf) +// if (curr_main_set != div_ant_conf.main_lna_conf) HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: main_lna_conf: %x -> %x\n", __func__, curr_main_set, div_ant_conf.main_lna_conf); - if (curr_bias != div_ant_conf.fast_div_bias) +// if (curr_bias != div_ant_conf.fast_div_bias) HALDEBUG(ah, HAL_DEBUG_DIVERSITY, "%s: fast_div_bias: %x -> %x\n", __func__, curr_bias, div_ant_conf.fast_div_bias); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c Fri May 13 15:20:57 2011 (r221841) @@ -533,32 +533,15 @@ ar9285SetPowerPerRateTable(struct ath_ha } } /* end ctl mode checking */ - /* Set rates Array from collected data */ - ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] = ratesArray[rate18mb] = ratesArray[rate24mb] = targetPowerOfdm.tPow2x[0]; - ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1]; - ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2]; - ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3]; - ratesArray[rateXr] = targetPowerOfdm.tPow2x[0]; - - for (i = 0; i < N(targetPowerHt20.tPow2x); i++) { - ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i]; - } - - ratesArray[rate1l] = targetPowerCck.tPow2x[0]; - ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck.tPow2x[1]; - ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck.tPow2x[2]; - ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck.tPow2x[3]; - if (IEEE80211_IS_CHAN_HT40(chan)) { - for (i = 0; i < N(targetPowerHt40.tPow2x); i++) { - ratesArray[rateHt40_0 + i] = targetPowerHt40.tPow2x[i]; - } - ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0]; - ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0]; - ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0]; - if (IEEE80211_IS_CHAN_2GHZ(chan)) { - ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0]; - } - } + /* Set rates Array from collected data */ + ar5416SetRatesArrayFromTargetPower(ah, chan, ratesArray, + &targetPowerCck, + &targetPowerCckExt, + &targetPowerOfdm, + &targetPowerOfdmExt, + &targetPowerHt20, + &targetPowerHt40); + return AH_TRUE; #undef EXT_ADDITIVE #undef CTL_11G_EXT Modified: projects/largeSMP/sys/dev/ath/if_ath.c ============================================================================== --- projects/largeSMP/sys/dev/ath/if_ath.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/ath/if_ath.c Fri May 13 15:20:57 2011 (r221841) @@ -1946,17 +1946,15 @@ ath_calcrxfilter(struct ath_softc *sc) IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) rfilt |= HAL_RX_FILTER_BEACON; -#if 0 /* * Enable hardware PS-POLL RX only for hostap mode; * STA mode sends PS-POLL frames but never * receives them. */ - if (ath_hal_getcapability(ah, HAL_CAP_HAS_PSPOLL, + if (ath_hal_getcapability(sc->sc_ah, HAL_CAP_PSPOLL, 0, NULL) == HAL_OK && ic->ic_opmode == IEEE80211_M_HOSTAP) rfilt |= HAL_RX_FILTER_PSPOLL; -#endif if (sc->sc_nmeshvaps) { rfilt |= HAL_RX_FILTER_BEACON; Modified: projects/largeSMP/sys/dev/bge/if_bge.c ============================================================================== --- projects/largeSMP/sys/dev/bge/if_bge.c Fri May 13 15:09:35 2011 (r221840) +++ projects/largeSMP/sys/dev/bge/if_bge.c Fri May 13 15:20:57 2011 (r221841) @@ -171,6 +171,7 @@ static const struct bge_type { { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5717 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5718 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5719 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, @@ -299,6 +300,7 @@ static const struct bge_revision { { BGE_CHIPID_BCM5715_A3, "BCM5715 A3" }, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:21:31 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC1B0106566B; Fri, 13 May 2011 15:21:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA2638FC0C; Fri, 13 May 2011 15:21:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DFLVHW074713; Fri, 13 May 2011 15:21:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DFLVKs074711; Fri, 13 May 2011 15:21:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105131521.p4DFLVKs074711@svn.freebsd.org> From: Marius Strobl Date: Fri, 13 May 2011 15:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221842 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:21:31 -0000 Author: marius Date: Fri May 13 15:21:31 2011 New Revision: 221842 URL: http://svn.freebsd.org/changeset/base/221842 Log: When setting up pc_other_cpus for APs based on pc_allcpu clear pc_cpuid in the former rather than the latter. This gets this branch working on at least Jalapeno-class CPUs. Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Fri May 13 15:20:57 2011 (r221841) +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Fri May 13 15:21:31 2011 (r221842) @@ -470,7 +470,7 @@ cpu_mp_bootstrap(struct pcpu *pc) smp_cpus++; KASSERT(curthread != NULL, ("%s: curthread", __func__)); ocpus = all_cpus; - CPU_CLR(curcpu, &all_cpus); + CPU_CLR(curcpu, &ocpus); PCPU_SET(other_cpus, ocpus); printf("SMP: AP CPU #%d Launched!\n", curcpu); From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:22:02 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DCB01065670; Fri, 13 May 2011 15:22:02 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 99D248FC08; Fri, 13 May 2011 15:22:01 +0000 (UTC) Received: by qwc9 with SMTP id 9so1784134qwc.13 for ; Fri, 13 May 2011 08:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=sDGH916Fl09LoiO6TMnOFd2DgW3jrHGuIDb55GpW6Mc=; b=sZst6J29NQg49RKfRlWGxrgnQ5TED79SbzVBacDH1sS8XSaazv/C5n2MFuavhITOvF Pjn/0+JtAyVBR/DOdwxk1LMrqPRMIAVYAcylkGHNvndg6/rWCUWH1EazSqNVDA54guU9 jzlkw6W8f688qnT9jkHhlK48BVyPdhK3YBoPs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=rKihAHW+1w7jVlwvbvs4zS4Hzq7JAtWx7LNwusjDcUAo2P4oIsmCEvsR2Ndh3g/tt2 kOmqk0DodJIIFQKIey7Xrr/KfwvOLR64QlqFYgKWSpNPIiISovdddv2BH+JQaFb2ARUX +UoqCm+kHM1kbvz3V1PmyzG7shx80K9IZh3/0= MIME-Version: 1.0 Received: by 10.229.102.165 with SMTP id g37mr1295104qco.120.1305300120488; Fri, 13 May 2011 08:22:00 -0700 (PDT) Sender: artemb@gmail.com Received: by 10.229.95.140 with HTTP; Fri, 13 May 2011 08:22:00 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Fri, 13 May 2011 17:22:00 +0200 X-Google-Sender-Auth: irnLpmPQPh5DW94tPzSp9u-um-Y Message-ID: From: Artem Belevich To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:22:02 -0000 On Thu, May 12, 2011 at 11:12 PM, Attilio Rao wrote: >> Could you post definition of cpuset_t ? >> >> It's possible that compiler was actually correct. For instance, >> compiler would be right to complain if cpuset_t is a packed structure, >> even if that structure is made of a single uint32_t field. > > It doesn't do the atomic of =A0cpuset_t, it does atomic of members of > cpuset_t which are actually long. > For example: > #define CPU_OR_ATOMIC(d, s) do { =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0\ > =A0 =A0 =A0 =A0__size_t __i; =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 \ > =A0 =A0 =A0 =A0for (__i =3D 0; __i < _NCPUWORDS; __i++) =A0 =A0 =A0 =A0 = =A0\ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0atomic_set_long(&(d)->__bits[__i], =A0 =A0= =A0\ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(s)->__bits[__i]); =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0\ > } while (0) > > It is a plain C problem, uint32_t mismatches with long also on amd64, Ah! Indeed, that's exactly what your problem is. uint32_t is not necessarily long on all platforms which means that using atomic_*_long on uint32_t variables is not going to work, even if you shut compiler warnings up by typecasting pointers to long*. The way I see it, your options are: * add explicit atomic ops for uint32_t and uint64_t * or use long/int within cpuset_t > in order to demonstrate the problem check this: > #include > > void > quqa(volatile uint32_t *p) > { > =A0 =A0 =A0 =A0*p =3D 10; > } > > int > main(void) > { > =A0 =A0 =A0 =A0long d; > > =A0 =A0 =A0 =A0quqa(&d); > =A0 =A0 =A0 =A0return (0); > } Well, long is not uint32_t so compiler would be correct to issue a warning. > >>> I compiled several kernels for MIPS (with sparse configurations and >>> they all compile well). But now they will not work for N64 builds because the data you point to would be uint32_t, but atomic_*_long() would do 64-bit loads and stores. >>> >>> If you agree with this patch, tonight I'll commit to my tree and add >>> the mips support for cpuset_t soon, so that it all can be tested. The patch is OK as long as developer does point to correctly sized variables. Typecasts remove type checking that compiler would do, so it would be very easy to make an error that would go unnoticed until it causes issues at runtime. Your code one such case. It will compile, but will not work on MIPS/n64. > The atomic implementation gets messy and prototypes mismatches as > exposed earlier. It's not just a proto mismatch. It's a type mismatch which is a real problem. uint32_t is not necessarily the same type as long. You may get by by using atomic_*_int calls as that would happen to perform atomic op on 32-bit scalars, but you should either use types that current atomic ops support, or extend atomic API to support explicitly-sized scalar types. > IMHO the real fix is completing the conversion I was doing as I don't > really see a valid point against it, if not "mips does it weird, pay > attention" :) Mips just happens to have few ILP32/LP64 variants supported within the same include file, so it's more noticeable. The bottom line is that calling atomic_*_long on uint32_t* will not work correctly on any LP64 platform, even if the code compiles because typecasts silenced compiler warnings. Are there any fundamental objections to extending atomic API to include _32 and _64 ops? That's what atomic implementations do under the hood anyways. --Artem From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:26:46 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B9A41065675; Fri, 13 May 2011 15:26:46 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id DE63B8FC14; Fri, 13 May 2011 15:26:45 +0000 (UTC) Received: by yxl31 with SMTP id 31so1148145yxl.13 for ; Fri, 13 May 2011 08:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=+4iiz7NWQjntwhG3qZnZGjDw1LtFn6oIwumq5Yiaspg=; b=mmCgPnOp4R4a40tW/8clFjI+tDWPCX+k+IOAYE8GMvwK3KSr+ADKvjmP23DcboYPr9 MvjO6wzi63MoCo0NQkKE3nQ44rkb3pI+GVojkCpJarmHaIgDlazWHvS7VFkDjYQ04id4 xiLrlSjqLFeMqWg9PcpzpGy/2USI9h7+s6KaE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Ebguc9FX6y06JbpBkGzjlP03LfdlJj6a83Lq8uJwXaQDodRofvFwelyMtIAP56DebQ 58+qMpGFy/7Tmcho4xI5ALRZx3Vfh0E9P/fV21MYs/XDGnEHhUGm5IN6wILnO9lmOfC8 JZ5TTa/EP0S2ocHL5Ib5vbIh1L3nZlNhK5XGg= MIME-Version: 1.0 Received: by 10.236.161.197 with SMTP id w45mr1690628yhk.104.1305300405037; Fri, 13 May 2011 08:26:45 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Fri, 13 May 2011 08:26:44 -0700 (PDT) In-Reply-To: References: <201105080039.p480doiZ021493@svn.freebsd.org> Date: Fri, 13 May 2011 17:26:44 +0200 X-Google-Sender-Auth: g9QK-bU3fUBq8-LKU0v8ltVh6dE Message-ID: From: Attilio Rao To: Artem Belevich Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Oleksandr Tymoshenko , src-committers@freebsd.org, Warner Losh , Bruce Evans Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:26:46 -0000 2011/5/13 Artem Belevich : > On Thu, May 12, 2011 at 11:12 PM, Attilio Rao wrote= : >>> Could you post definition of cpuset_t ? >>> >>> It's possible that compiler was actually correct. For instance, >>> compiler would be right to complain if cpuset_t is a packed structure, >>> even if that structure is made of a single uint32_t field. >> >> It doesn't do the atomic of =C2=A0cpuset_t, it does atomic of members of >> cpuset_t which are actually long. >> For example: >> #define CPU_OR_ATOMIC(d, s) do { =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0__size_t __i; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 \ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (__i =3D 0; __i < _NCPUWORDS; __i++) =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0atomic_set_long(&= (d)->__bits[__i], =C2=A0 =C2=A0 =C2=A0\ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(s)= ->__bits[__i]); =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0\ >> } while (0) >> > >> It is a plain C problem, uint32_t mismatches with long also on amd64, > > Ah! Indeed, that's exactly what your problem is. uint32_t is not > necessarily long on all platforms which means that using atomic_*_long > on uint32_t variables is not going to work, even if you shut compiler > warnings up by typecasting pointers to long*. > > The way I see it, your options are: > * add explicit atomic ops for uint32_t and uint64_t > * or use long/int within cpuset_t > >> in order to demonstrate the problem check this: >> #include >> >> void >> quqa(volatile uint32_t *p) >> { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0*p =3D 10; >> } >> >> int >> main(void) >> { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0long d; >> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0quqa(&d); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >> } > > Well, long is not uint32_t so compiler would be correct to issue a warnin= g. > >> >>>> I compiled several kernels for MIPS (with sparse configurations and >>>> they all compile well). > > But now they will not work for N64 builds because the data you point > to would be uint32_t, but atomic_*_long() would do 64-bit loads and > stores. If you check correctly, I didn't touch the other conversion (long is not defined always the same for the 2 cases, I just modified the faulting one, the one which has the uint32_t -> long usage). I think the N64 case is fine then. > Are there any fundamental objections to extending atomic API to > include _32 and _64 ops? That's what atomic implementations do under > the hood anyways. I really don't understand your question. The atomic API already has the _32 and _64 variants. What I hoped to do is just to not rely on them in order to build standard C type versions (_int, _long, etc) in order to avoid subdle breakage as the one already reported. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:29:00 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 956ED106566B; Fri, 13 May 2011 15:29:00 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 26DE28FC18; Fri, 13 May 2011 15:28:59 +0000 (UTC) Received: by ywf7 with SMTP id 7so1145558ywf.13 for ; Fri, 13 May 2011 08:28:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ElMP4ylNG8XEH+yXgRVEJ9AqNVARznlZ5d0SORDuXlM=; b=vgsk3aAJYd4n7dYSRoVMRuQvmgtJmZlk0Ubt4C4oB34fdWp8uwiDQO0Ej36mpAbnlu lYt8W7Q12VoPkt0dW06s9EPyOAfDjxWqTi0srGilF4mxUIZ8/Mf8naEyUcVNLZZv9Lys 8pFZngeTSlvmsJwVAYTJdRBqmbLiydNP59QLQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=goylhtuUNiXG3r31qqDm+TB/LDZtljXCAY1Z6WRG8uhA5j9VcFRhSBJ1xGEnVMAcTb KiY1x6EhSpB+NFT2sclQkYBDX68W0YekKNVem7jQAFqY5gSyVqITbavFlSyjkWWaWW+R 6X0+2cSJCiX08qrX8Ehvmh5qIe3k8L03yBzKM= MIME-Version: 1.0 Received: by 10.236.136.164 with SMTP id w24mr1637104yhi.171.1305300539461; Fri, 13 May 2011 08:28:59 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.111.33 with HTTP; Fri, 13 May 2011 08:28:59 -0700 (PDT) In-Reply-To: <201105131521.p4DFLVKs074711@svn.freebsd.org> References: <201105131521.p4DFLVKs074711@svn.freebsd.org> Date: Fri, 13 May 2011 17:28:59 +0200 X-Google-Sender-Auth: xPeEz5jCLojVnwaTwxEsQkXznDI Message-ID: From: Attilio Rao To: Marius Strobl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221842 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:29:00 -0000 2011/5/13 Marius Strobl : > Author: marius > Date: Fri May 13 15:21:31 2011 > New Revision: 221842 > URL: http://svn.freebsd.org/changeset/base/221842 > > Log: > =C2=A0When setting up pc_other_cpus for APs based on pc_allcpu clear pc_c= puid > =C2=A0in the former rather than the latter. > =C2=A0This gets this branch working on at least Jalapeno-class CPUs. > > Modified: > =C2=A0projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c > > Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c =C2=A0Fri May 13 1= 5:20:57 2011 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r221841) > +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c =C2=A0Fri May 13 1= 5:21:31 2011 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r221842) > @@ -470,7 +470,7 @@ cpu_mp_bootstrap(struct pcpu *pc) > =C2=A0 =C2=A0 =C2=A0 =C2=A0smp_cpus++; > =C2=A0 =C2=A0 =C2=A0 =C2=A0KASSERT(curthread !=3D NULL, ("%s: curthread",= __func__)); > =C2=A0 =C2=A0 =C2=A0 =C2=A0ocpus =3D all_cpus; > - =C2=A0 =C2=A0 =C2=A0 CPU_CLR(curcpu, &all_cpus); > + =C2=A0 =C2=A0 =C2=A0 CPU_CLR(curcpu, &ocpus); > =C2=A0 =C2=A0 =C2=A0 =C2=A0PCPU_SET(other_cpus, ocpus); > =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("SMP: AP CPU #%d Launched!\n", curcpu); > > How idiot can I be? I watched that path like 10 times yesterday... Thanks a lot. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:43:57 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBAB81065670; Fri, 13 May 2011 15:43:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5E54E8FC12; Fri, 13 May 2011 15:43:56 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p4DFho2X052810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2011 18:43:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p4DFhnR3054943; Fri, 13 May 2011 18:43:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p4DFhnXP054942; Fri, 13 May 2011 18:43:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 May 2011 18:43:49 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20110513154349.GV48734@deviant.kiev.zoral.com.ua> References: <20110513221936.X1161@besplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xncXys66qXuJqdVV" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:43:58 -0000 --xncXys66qXuJqdVV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, May 13, 2011 at 03:50:47PM +0200, Attilio Rao wrote: > The per-cpu stuff also, is read only. The pm_active objects are > protected by VM locks. pm_active is not protected by any vm lock. It is set and cleared unlocked in the context switch code. But, the ctx switch only needs to set and clear a single bit at the time of switch, that makes the atomic operations sufficient for consistency. I had a WIP on the Intel PCID, were such protection was not enough, unfortunately. --xncXys66qXuJqdVV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3NUbUACgkQC3+MBN1Mb4gbJwCeKyYAKhfcLfcXxsdJbJ3dcjKe 1WwAnj+xlqdJ/fkHNpf4GFjFqtEAiYa1 =PXrb -----END PGP SIGNATURE----- --xncXys66qXuJqdVV-- From owner-svn-src-projects@FreeBSD.ORG Fri May 13 15:45:54 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E952106564A; Fri, 13 May 2011 15:45:54 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8658FC13; Fri, 13 May 2011 15:45:53 +0000 (UTC) Received: by vxc34 with SMTP id 34so2640407vxc.13 for ; Fri, 13 May 2011 08:45:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ZAhky7HLQlOPRwmyopySE3Wu7GXGDIplwwOyQhaGQ1o=; b=WVgPiybk/Dsob5RmoA8+so/CBuP/9vvBsp6AcDKyPO+BRPu3RagJ3jDX58rDyN+/92 Tbp2GDyPA7C4OBMTO+slFyRpeDs8v91kFl0i//qpcTNaYHX4kIIvrhlOHJdIQT5symiC 9rai8EcY+wqhe4MQPE9O3/8N2Vk+dekUU2eP0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=JHMuP7JEptpr2NbcbBEcFTwF+CubBfBZu2qcasmiQIOrsuAsJ3t9xQXRqDoo6Ub590 1bRMw7p20ZQU+jZZBjvsKHSzy+ea4igBTMHNCCsY3cJPFnHBZgFrxG0sJXSMTDQEGwFt jkXSsPXn1daqkEvHpVvVnsYXfrAV8BqiODQVs= MIME-Version: 1.0 Received: by 10.220.18.74 with SMTP id v10mr463777vca.62.1305301552626; Fri, 13 May 2011 08:45:52 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.220.201.3 with HTTP; Fri, 13 May 2011 08:45:52 -0700 (PDT) In-Reply-To: <20110513154349.GV48734@deviant.kiev.zoral.com.ua> References: <20110513221936.X1161@besplex.bde.org> <20110513154349.GV48734@deviant.kiev.zoral.com.ua> Date: Fri, 13 May 2011 17:45:52 +0200 X-Google-Sender-Auth: _CZzNBCDaBXscwQ6K30WOtFBdJg Message-ID: From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Cc: src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 15:45:54 -0000 2011/5/13 Kostik Belousov : > On Fri, May 13, 2011 at 03:50:47PM +0200, Attilio Rao wrote: >> The per-cpu stuff also, is read only. The pm_active objects are >> protected by VM locks. > > pm_active is not protected by any vm lock. It is set and cleared > unlocked in the context switch code. But, the ctx switch only needs > to set and clear a single bit at the time of switch, that makes > the atomic operations sufficient for consistency. > > I had a WIP on the Intel PCID, were such protection was not enough, > unfortunately. You are indeed right, sorry. What trouble were you having in your case, just for the sake of my curiosity, if you can share? Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Fri May 13 16:39:48 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FE77106566B; Fri, 13 May 2011 16:39:48 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 048E28FC12; Fri, 13 May 2011 16:39:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DGdlLM076493; Fri, 13 May 2011 16:39:47 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DGdlN0076491; Fri, 13 May 2011 16:39:47 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105131639.p4DGdlN0076491@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 16:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221846 - projects/largeSMP/sys/mips/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 16:39:48 -0000 Author: attilio Date: Fri May 13 16:39:47 2011 New Revision: 221846 URL: http://svn.freebsd.org/changeset/base/221846 Log: Fix the _long() rappresentation on mips by casting the long arguments to u_int for all the functions. Reviewed by: art, imp Modified: projects/largeSMP/sys/mips/include/atomic.h Modified: projects/largeSMP/sys/mips/include/atomic.h ============================================================================== --- projects/largeSMP/sys/mips/include/atomic.h Fri May 13 16:29:57 2011 (r221845) +++ projects/largeSMP/sys/mips/include/atomic.h Fri May 13 16:39:47 2011 (r221846) @@ -581,32 +581,47 @@ atomic_fetchadd_64(__volatile uint64_t * #else /* !__mips_n64 */ /* Operations on longs. */ -#define atomic_set_long atomic_set_32 -#define atomic_set_acq_long atomic_set_acq_32 -#define atomic_set_rel_long atomic_set_rel_32 -#define atomic_clear_long atomic_clear_32 -#define atomic_clear_acq_long atomic_clear_acq_32 -#define atomic_clear_rel_long atomic_clear_rel_32 -#define atomic_add_long(p, v) \ +#define atomic_set_long(p, v) \ + atomic_set_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_acq_long(p, v) \ + atomic_set_acq_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_set_rel_long(p, v) \ + atomic_set_rel_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_long(p, v) \ + atomic_clear_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_acq_long(p, v) \ + atomic_clear_acq_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_clear_rel_long(p, v) \ + atomic_clear_rel_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_long(p, v) \ atomic_add_32((volatile u_int *)(p), (u_int)(v)) -#define atomic_add_acq_long atomic_add_acq_32 -#define atomic_add_rel_long atomic_add_rel_32 -#define atomic_subtract_long(p, v) \ +#define atomic_add_acq_long(p, v) \ + atomic_add_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_add_rel_long(p, v) \ + atomic_add_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_long(p, v) \ atomic_subtract_32((volatile u_int *)(p), (u_int)(v)) -#define atomic_subtract_acq_long atomic_subtract_acq_32 -#define atomic_subtract_rel_long atomic_subtract_rel_32 -#define atomic_cmpset_long atomic_cmpset_32 -#define atomic_cmpset_acq_long(p, cmpval, newval) \ - atomic_cmpset_acq_32((volatile u_int *)(p), \ - (u_int)(cmpval), (u_int)(newval)) -#define atomic_cmpset_rel_long(p, cmpval, newval) \ - atomic_cmpset_rel_32((volatile u_int *)(p), \ - (u_int)(cmpval), (u_int)(newval)) -#define atomic_load_acq_long atomic_load_acq_32 -#define atomic_store_rel_long atomic_store_rel_32 -#define atomic_fetchadd_long(p, v) \ +#define atomic_subtract_acq_long(p, v) \ + atomic_subtract_acq_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_subtract_rel_long(p, v) \ + atomic_subtract_rel_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_cmpset_long(p, cmpval, newval) \ + atomic_cmpset_32((volatile u_int *)(p), (u_int)(cmpval), \ + (u_int)(newval)) +#define atomic_cmpset_acq_long(p, cmpval, newval) \ + atomic_cmpset_acq_32((volatile u_int *)(p), (u_int)(cmpval), \ + (u_int)(newval)) +#define atomic_cmpset_rel_long(p, cmpval, newval) \ + atomic_cmpset_rel_32((volatile u_int *)(p), (u_int)(cmpval), \ + (u_int)(newval)) +#define atomic_load_acq_long(p) \ + (u_long)atomic_load_acq_32((volatile u_int *)(p)) +#define atomic_store_rel_long(p, v) \ + atomic_store_rel_32((volatile u_int *)(p), (u_int)(v)) +#define atomic_fetchadd_long(p, v) \ atomic_fetchadd_32((volatile u_int *)(p), (u_int)(v)) -#define atomic_readandclear_long atomic_readandclear_32 +#define atomic_readandclear_long(p) \ + atomic_readandclear_32((volatile u_int *)(p)) #endif /* __mips_n64 */ From owner-svn-src-projects@FreeBSD.ORG Fri May 13 16:42:05 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCAA71065673; Fri, 13 May 2011 16:42:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB6CD8FC13; Fri, 13 May 2011 16:42:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DGg5iA076587; Fri, 13 May 2011 16:42:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DGg5Y5076577; Fri, 13 May 2011 16:42:05 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105131642.p4DGg5Y5076577@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 16:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221847 - in projects/largeSMP/sys/mips: cavium include mips rmi sibyte X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 16:42:05 -0000 Author: attilio Date: Fri May 13 16:42:05 2011 New Revision: 221847 URL: http://svn.freebsd.org/changeset/base/221847 Log: Add the cpuset_t conversion for mips. Modified: projects/largeSMP/sys/mips/cavium/octeon_mp.c projects/largeSMP/sys/mips/include/_types.h projects/largeSMP/sys/mips/include/hwfunc.h projects/largeSMP/sys/mips/include/pmap.h projects/largeSMP/sys/mips/include/smp.h projects/largeSMP/sys/mips/mips/mp_machdep.c projects/largeSMP/sys/mips/mips/pmap.c projects/largeSMP/sys/mips/rmi/xlr_machdep.c projects/largeSMP/sys/mips/sibyte/sb_scd.c Modified: projects/largeSMP/sys/mips/cavium/octeon_mp.c ============================================================================== --- projects/largeSMP/sys/mips/cavium/octeon_mp.c Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/cavium/octeon_mp.c Fri May 13 16:42:05 2011 (r221847) @@ -102,10 +102,20 @@ platform_init_ap(int cpuid) mips_wbflush(); } -cpumask_t +cpuset_t platform_cpu_mask(void) { - return (octeon_bootinfo->core_mask); + cpuset_t cpumask; + + CPU_ZERO(&cpumask); + + /* + * XXX: hack in order to simplify CPU set building, assuming that + * core_mask is 32-bits. + */ + memcpy(&cpumask, &octeon_bootinfo->core_mask, + sizeof(octeon_bootinfo->core_mask)); + return (cpumask); } struct cpu_group * Modified: projects/largeSMP/sys/mips/include/_types.h ============================================================================== --- projects/largeSMP/sys/mips/include/_types.h Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/include/_types.h Fri May 13 16:42:05 2011 (r221847) @@ -73,7 +73,6 @@ typedef unsigned long long __uint64_t; * Standard type definitions. */ typedef __int32_t __clock_t; /* clock()... */ -typedef unsigned int __cpumask_t; typedef double __double_t; typedef double __float_t; #ifdef __mips_n64 Modified: projects/largeSMP/sys/mips/include/hwfunc.h ============================================================================== --- projects/largeSMP/sys/mips/include/hwfunc.h Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/include/hwfunc.h Fri May 13 16:42:05 2011 (r221847) @@ -28,6 +28,8 @@ #ifndef _MACHINE_HWFUNC_H_ #define _MACHINE_HWFUNC_H_ +#include + struct trapframe; struct timecounter; /* @@ -91,7 +93,7 @@ extern int platform_processor_id(void); /* * Return the cpumask of available processors. */ -extern cpumask_t platform_cpu_mask(void); +extern cpuset_t platform_cpu_mask(void); /* * Return the topology of processors on this platform Modified: projects/largeSMP/sys/mips/include/pmap.h ============================================================================== --- projects/largeSMP/sys/mips/include/pmap.h Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/include/pmap.h Fri May 13 16:42:05 2011 (r221847) @@ -58,6 +58,7 @@ #ifndef LOCORE #include +#include #include #include @@ -83,7 +84,7 @@ struct pmap { pd_entry_t *pm_segtab; /* KVA of segment table */ TAILQ_HEAD(, pv_entry) pm_pvlist; /* list of mappings in * pmap */ - cpumask_t pm_active; /* active on cpus */ + cpuset_t pm_active; /* active on cpus */ struct { u_int32_t asid:ASID_BITS; /* TLB address space tag */ u_int32_t gen:ASIDGEN_BITS; /* its generation number */ Modified: projects/largeSMP/sys/mips/include/smp.h ============================================================================== --- projects/largeSMP/sys/mips/include/smp.h Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/include/smp.h Fri May 13 16:42:05 2011 (r221847) @@ -17,6 +17,8 @@ #ifdef _KERNEL +#include + #include /* @@ -33,7 +35,7 @@ void ipi_all_but_self(int ipi); void ipi_cpu(int cpu, u_int ipi); -void ipi_selected(cpumask_t cpus, int ipi); +void ipi_selected(cpuset_t cpus, int ipi); void smp_init_secondary(u_int32_t cpuid); void mpentry(void); Modified: projects/largeSMP/sys/mips/mips/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/mips/mips/mp_machdep.c Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/mips/mp_machdep.c Fri May 13 16:42:05 2011 (r221847) @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -80,15 +81,16 @@ ipi_all_but_self(int ipi) /* Send an IPI to a set of cpus. */ void -ipi_selected(cpumask_t cpus, int ipi) +ipi_selected(cpuset_t cpus, int ipi) { struct pcpu *pc; - CTR3(KTR_SMP, "%s: cpus: %x, ipi: %x\n", __func__, cpus, ipi); - SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { - if ((cpus & pc->pc_cpumask) != 0) + if (CPU_OVERLAP(&cpus, &pc->pc_cpumask)) { + CTR3(KTR_SMP, "%s: pc: %p, ipi: %x\n", __func__, pc, + ipi); ipi_send(pc, ipi); + } } } @@ -108,7 +110,7 @@ static int mips_ipi_handler(void *arg) { int cpu; - cpumask_t cpumask; + cpuset_t cpumask; u_int ipi, ipi_bitmap; int bit; @@ -148,14 +150,14 @@ mips_ipi_handler(void *arg) tlb_save(); /* Indicate we are stopped */ - atomic_set_int(&stopped_cpus, cpumask); + CPU_OR_ATOMIC(&stopped_cpus, &cpumask); /* Wait for restart */ - while ((started_cpus & cpumask) == 0) + while (!CPU_OVERLAP(&started_cpus, &cpumask)) cpu_spinwait(); - atomic_clear_int(&started_cpus, cpumask); - atomic_clear_int(&stopped_cpus, cpumask); + CPU_NAND_ATOMIC(&started_cpus, &cpumask); + CPU_NAND_ATOMIC(&stopped_cpus, &cpumask); CTR0(KTR_SMP, "IPI_STOP (restart)"); break; case IPI_PREEMPT: @@ -200,14 +202,21 @@ start_ap(int cpuid) void cpu_mp_setmaxid(void) { - cpumask_t cpumask; + cpuset_t cpumask; + int cpu, last; cpumask = platform_cpu_mask(); - mp_ncpus = bitcount32(cpumask); + mp_ncpus = 0; + last = 1; + while ((cpu = cpusetobj_ffs(&cpumask)) != 0) { + last = cpu; + mp_ncpus++; + CPU_CLR(cpu, &cpumask); + } if (mp_ncpus <= 0) mp_ncpus = 1; - mp_maxid = min(fls(cpumask), MAXCPU) - 1; + mp_maxid = min(last, MAXCPU) - 1; } void @@ -233,16 +242,16 @@ void cpu_mp_start(void) { int error, cpuid; - cpumask_t cpumask; + cpuset_t cpumask, ocpus; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); - all_cpus = 0; + CPU_ZERO(&all_cpus); cpumask = platform_cpu_mask(); - while (cpumask != 0) { - cpuid = ffs(cpumask) - 1; - cpumask &= ~(1 << cpuid); + while (!CPU_EMPTY(&cpumask)) { + cpuid = cpusetobj_ffs(&cpumask) - 1; + CPU_CLR(cpuid, &cpumask); if (cpuid >= MAXCPU) { printf("cpu_mp_start: ignoring AP #%d.\n", cpuid); @@ -257,15 +266,19 @@ cpu_mp_start(void) if (bootverbose) printf("AP #%d started!\n", cpuid); } - all_cpus |= 1 << cpuid; + CPU_SET(cpuid, &all_cpus); } - PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); + ocpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &ocpus); + PCPU_SET(other_cpus, ocpus); } void smp_init_secondary(u_int32_t cpuid) { + cpuset_t ocpus; + /* TLB */ mips_wr_wired(0); tlb_invalidate_all(); @@ -303,7 +316,9 @@ smp_init_secondary(u_int32_t cpuid) CTR1(KTR_SMP, "SMP: AP CPU #%d launched", PCPU_GET(cpuid)); /* Build our map of 'other' CPUs. */ - PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); + ocpus = all_cpus; + CPU_CLR(PCPU_GET(cpuid), &ocpus); + PCPU_SET(other_cpus, ocpus); if (bootverbose) printf("SMP: AP CPU #%d launched.\n", PCPU_GET(cpuid)); Modified: projects/largeSMP/sys/mips/mips/pmap.c ============================================================================== --- projects/largeSMP/sys/mips/mips/pmap.c Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/mips/pmap.c Fri May 13 16:42:05 2011 (r221847) @@ -471,7 +471,7 @@ pmap_create_kernel_pagetable(void) PMAP_LOCK_INIT(kernel_pmap); kernel_pmap->pm_segtab = kernel_segmap; - kernel_pmap->pm_active = ~0; + CPU_FILL(&kernel_pmap->pm_active); TAILQ_INIT(&kernel_pmap->pm_pvlist); kernel_pmap->pm_asid[0].asid = PMAP_ASID_RESERVED; kernel_pmap->pm_asid[0].gen = 0; @@ -630,10 +630,14 @@ pmap_invalidate_all_local(pmap_t pmap) tlb_invalidate_all(); return; } - if (pmap->pm_active & PCPU_GET(cpumask)) + sched_pin(); + if (CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) { + sched_unpin(); tlb_invalidate_all_user(pmap); - else + } else { + sched_unpin(); pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; + } } #ifdef SMP @@ -667,12 +671,16 @@ pmap_invalidate_page_local(pmap_t pmap, tlb_invalidate_address(pmap, va); return; } - if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) + sched_pin(); + if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) { + sched_unpin(); return; - else if (!(pmap->pm_active & PCPU_GET(cpumask))) { + } else if (!CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) { pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; + sched_unpin(); return; } + sched_unpin(); tlb_invalidate_address(pmap, va); } @@ -716,12 +724,16 @@ pmap_update_page_local(pmap_t pmap, vm_o tlb_update(pmap, va, pte); return; } - if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) + sched_pin(); + if (pmap->pm_asid[PCPU_GET(cpuid)].gen != PCPU_GET(asid_generation)) { + sched_unpin(); return; - else if (!(pmap->pm_active & PCPU_GET(cpumask))) { + } else if (!CPU_OVERLAP(&pmap->pm_active, PCPU_PTR(cpumask))) { pmap->pm_asid[PCPU_GET(cpuid)].gen = 0; + sched_unpin(); return; } + sched_unpin(); tlb_update(pmap, va, pte); } @@ -1041,7 +1053,7 @@ pmap_pinit0(pmap_t pmap) PMAP_LOCK_INIT(pmap); pmap->pm_segtab = kernel_segmap; - pmap->pm_active = 0; + CPU_ZERO(&pmap->pm_active); pmap->pm_ptphint = NULL; for (i = 0; i < MAXCPU; i++) { pmap->pm_asid[i].asid = PMAP_ASID_RESERVED; @@ -1102,7 +1114,7 @@ pmap_pinit(pmap_t pmap) ptdva = MIPS_PHYS_TO_DIRECT(VM_PAGE_TO_PHYS(ptdpg)); pmap->pm_segtab = (pd_entry_t *)ptdva; - pmap->pm_active = 0; + CPU_ZERO(&pmap->pm_active); pmap->pm_ptphint = NULL; for (i = 0; i < MAXCPU; i++) { pmap->pm_asid[i].asid = PMAP_ASID_RESERVED; @@ -2948,8 +2960,8 @@ pmap_activate(struct thread *td) oldpmap = PCPU_GET(curpmap); if (oldpmap) - atomic_clear_32(&oldpmap->pm_active, PCPU_GET(cpumask)); - atomic_set_32(&pmap->pm_active, PCPU_GET(cpumask)); + CPU_NAND_ATOMIC(&oldpmap->pm_active, PCPU_PTR(cpumask)); + CPU_OR_ATOMIC(&pmap->pm_active, PCPU_PTR(cpumask)); pmap_asid_alloc(pmap); if (td == curthread) { PCPU_SET(segbase, pmap->pm_segtab); @@ -3283,7 +3295,7 @@ pmap_kextract(vm_offset_t va) pt_entry_t *ptep; /* Is the kernel pmap initialized? */ - if (kernel_pmap->pm_active) { + if (!CPU_EMPTY(&kernel_pmap->pm_active)) { /* It's inside the virtual address range */ ptep = pmap_pte(kernel_pmap, va); if (ptep) { Modified: projects/largeSMP/sys/mips/rmi/xlr_machdep.c ============================================================================== --- projects/largeSMP/sys/mips/rmi/xlr_machdep.c Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/rmi/xlr_machdep.c Fri May 13 16:42:05 2011 (r221847) @@ -614,11 +614,17 @@ platform_processor_id(void) return (xlr_hwtid_to_cpuid[xlr_cpu_id()]); } -cpumask_t +cpuset_t platform_cpu_mask(void) { + cpuset_t cpumask; + int i, s; - return (~0U >> (32 - (xlr_ncores * xlr_threads_per_core))); + CPU_ZERO(&cpumask); + s = xlr_ncores * xlr_threads_per_core; + for (i = 0; i < s; i++) + CPU_SET(i, &cpumask); + return (cpumask); } struct cpu_group * Modified: projects/largeSMP/sys/mips/sibyte/sb_scd.c ============================================================================== --- projects/largeSMP/sys/mips/sibyte/sb_scd.c Fri May 13 16:39:47 2011 (r221846) +++ projects/largeSMP/sys/mips/sibyte/sb_scd.c Fri May 13 16:42:05 2011 (r221847) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -242,11 +243,17 @@ sb_clear_mailbox(int cpu, uint64_t val) sb_store64(regaddr, val); } -cpumask_t +cpuset_t platform_cpu_mask(void) { + cpuset_t cpumask; + int i, s; - return (~0U >> (32 - SYSREV_NUM_PROCESSORS(sb_read_sysrev()))); + CPU_ZERO(&cpumask); + s = SYSREV_NUM_PROCESSORS(sb_read_sysrev()); + for (i = 0; i < s; i++) + CPU_SET(i, &cpumask); + return (cpumask); } #endif /* SMP */ From owner-svn-src-projects@FreeBSD.ORG Fri May 13 17:50:30 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6541D106566B; Fri, 13 May 2011 17:50:30 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55EBD8FC18; Fri, 13 May 2011 17:50:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DHoUb5077993; Fri, 13 May 2011 17:50:30 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DHoUGP077991; Fri, 13 May 2011 17:50:30 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201105131750.p4DHoUGP077991@svn.freebsd.org> From: Ermal Luçi Date: Fri, 13 May 2011 17:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221848 - projects/pf/pf45/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 17:50:30 -0000 Author: eri Date: Fri May 13 17:50:30 2011 New Revision: 221848 URL: http://svn.freebsd.org/changeset/base/221848 Log: Fix typo that prevents building. Modified: projects/pf/pf45/sys/contrib/pf/net/if_pflog.h Modified: projects/pf/pf45/sys/contrib/pf/net/if_pflog.h ============================================================================== --- projects/pf/pf45/sys/contrib/pf/net/if_pflog.h Fri May 13 16:42:05 2011 (r221847) +++ projects/pf/pf45/sys/contrib/pf/net/if_pflog.h Fri May 13 17:50:30 2011 (r221848) @@ -31,7 +31,7 @@ struct pflog_softc { #ifdef __FreeBSD__ - struct ifnet *sc_ifp;i /* the interface pointer */ + struct ifnet *sc_ifp; /* the interface pointer */ #else struct ifnet sc_if; /* the interface */ #endif From owner-svn-src-projects@FreeBSD.ORG Fri May 13 19:18:16 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 69F2D106564A; Fri, 13 May 2011 19:18:16 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 18EE18FC15; Fri, 13 May 2011 19:18:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DJIFSJ080117; Fri, 13 May 2011 19:18:15 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DJIFdD080115; Fri, 13 May 2011 19:18:15 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201105131918.p4DJIFdD080115@svn.freebsd.org> From: Ermal Luçi Date: Fri, 13 May 2011 19:18:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221854 - projects/pf/pf45/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 19:18:16 -0000 Author: eri Date: Fri May 13 19:18:15 2011 New Revision: 221854 URL: http://svn.freebsd.org/changeset/base/221854 Log: Remove #ifdef not needed and unterminated by #endif Modified: projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c Modified: projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c Fri May 13 18:48:00 2011 (r221853) +++ projects/pf/pf45/sys/contrib/pf/net/pf_ioctl.c Fri May 13 19:18:15 2011 (r221854) @@ -4254,7 +4254,6 @@ hook_pf(void) pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); if (pfh_inet == NULL) return (ESRCH); /* XXX */ -#ifdef INET pfil_add_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); pfil_add_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, pfh_inet); #endif @@ -4296,7 +4295,6 @@ dehook_pf(void) pfh_inet = pfil_head_get(PFIL_TYPE_AF, AF_INET); if (pfh_inet == NULL) return (ESRCH); /* XXX */ -#ifdef INET pfil_remove_hook(pf_check_in, NULL, PFIL_IN | PFIL_WAITOK, pfh_inet); pfil_remove_hook(pf_check_out, NULL, PFIL_OUT | PFIL_WAITOK, From owner-svn-src-projects@FreeBSD.ORG Fri May 13 19:36:55 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55F37106566B; Fri, 13 May 2011 19:36:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id DC9658FC19; Fri, 13 May 2011 19:36:54 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id p4DJaoUQ068364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 13 May 2011 22:36:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id p4DJaoJc055921; Fri, 13 May 2011 22:36:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p4DJaodu055920; Fri, 13 May 2011 22:36:50 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 13 May 2011 22:36:50 +0300 From: Kostik Belousov To: Attilio Rao Message-ID: <20110513193650.GY48734@deviant.kiev.zoral.com.ua> References: <20110513221936.X1161@besplex.bde.org> <20110513154349.GV48734@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="3uxt9koO+4Cm8N9x" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: src-committers@freebsd.org, Artem Belevich , Oleksandr Tymoshenko , Bruce Evans , svn-src-projects@freebsd.org, Warner Losh Subject: Re: svn commit: r221614 - projects/largeSMP/sys/powerpc/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 19:36:55 -0000 --3uxt9koO+4Cm8N9x Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 13, 2011 at 05:45:52PM +0200, Attilio Rao wrote: > 2011/5/13 Kostik Belousov : > > On Fri, May 13, 2011 at 03:50:47PM +0200, Attilio Rao wrote: > >> The per-cpu stuff also, is read only. The pm_active objects are > >> protected by VM locks. > > > > pm_active is not protected by any vm lock. It is set and cleared > > unlocked in the context switch code. But, the ctx switch only needs > > to set and clear a single bit at the time of switch, that makes > > the atomic operations sufficient for consistency. > > > > I had a WIP on the Intel PCID, were such protection was not enough, > > unfortunately. >=20 > You are indeed right, sorry. >=20 > What trouble were you having in your case, just for the sake of my > curiosity, if you can share? PCID is a feature where the cpu tag each TLB entry with some process ID (not Unix PID). When doing context switch, reload of %cr3 does not invalidate the TLB on the core, but instead rewrite the "current ID" value to use for tag fetch and store. For each pmap, when page entry is modified, we need to clear the TLB entry on all cores (threads) that could have the mapping in TLB. So each pmap grows additional cpu set which indicates such cores. In the microbenchmark, use of PCID gives two times speed increase of context switch. I do not remember exact details right now, but I did need a NAND operation on cpu sets with both operands potentially having more then one bit active. Currently the work is stalled, I lost access to the Westmere machine for testing. --3uxt9koO+4Cm8N9x Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk3NiFIACgkQC3+MBN1Mb4j5IgCgu4wBygxLffJPbfMIZMZntHBJ cywAn3nL5gYkbGlHV6KjN+xybAaHYJCW =ruJX -----END PGP SIGNATURE----- --3uxt9koO+4Cm8N9x-- From owner-svn-src-projects@FreeBSD.ORG Fri May 13 19:56:59 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62F1A1065675; Fri, 13 May 2011 19:56:59 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 489E28FC24; Fri, 13 May 2011 19:56:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DJuxfC081020; Fri, 13 May 2011 19:56:59 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DJuxnk081014; Fri, 13 May 2011 19:56:59 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105131956.p4DJuxnk081014@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 19:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221857 - in projects/largeSMP/sys/mips: cavium include mips rmi sibyte X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 19:56:59 -0000 Author: attilio Date: Fri May 13 19:56:58 2011 New Revision: 221857 URL: http://svn.freebsd.org/changeset/base/221857 Log: Fix a brain-o in platform_cpu_mask() by just specifying a possible cpuset_t to be copied, rather than return the array. I can't rely anymore on this being a simple int/long object. Reported by: art Modified: projects/largeSMP/sys/mips/cavium/octeon_mp.c projects/largeSMP/sys/mips/include/hwfunc.h projects/largeSMP/sys/mips/mips/mp_machdep.c projects/largeSMP/sys/mips/rmi/xlr_machdep.c projects/largeSMP/sys/mips/sibyte/sb_scd.c Modified: projects/largeSMP/sys/mips/cavium/octeon_mp.c ============================================================================== --- projects/largeSMP/sys/mips/cavium/octeon_mp.c Fri May 13 19:40:02 2011 (r221856) +++ projects/largeSMP/sys/mips/cavium/octeon_mp.c Fri May 13 19:56:58 2011 (r221857) @@ -102,20 +102,18 @@ platform_init_ap(int cpuid) mips_wbflush(); } -cpuset_t -platform_cpu_mask(void) +void +platform_cpu_mask(cpuset_t *mask) { - cpuset_t cpumask; - CPU_ZERO(&cpumask); + CPU_ZERO(mask); /* * XXX: hack in order to simplify CPU set building, assuming that * core_mask is 32-bits. */ - memcpy(&cpumask, &octeon_bootinfo->core_mask, + memcpy(mask, &octeon_bootinfo->core_mask, sizeof(octeon_bootinfo->core_mask)); - return (cpumask); } struct cpu_group * Modified: projects/largeSMP/sys/mips/include/hwfunc.h ============================================================================== --- projects/largeSMP/sys/mips/include/hwfunc.h Fri May 13 19:40:02 2011 (r221856) +++ projects/largeSMP/sys/mips/include/hwfunc.h Fri May 13 19:56:58 2011 (r221857) @@ -93,7 +93,7 @@ extern int platform_processor_id(void); /* * Return the cpumask of available processors. */ -extern cpuset_t platform_cpu_mask(void); +extern void platform_cpu_mask(cpuset_t *mask); /* * Return the topology of processors on this platform Modified: projects/largeSMP/sys/mips/mips/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/mips/mips/mp_machdep.c Fri May 13 19:40:02 2011 (r221856) +++ projects/largeSMP/sys/mips/mips/mp_machdep.c Fri May 13 19:56:58 2011 (r221857) @@ -205,7 +205,7 @@ cpu_mp_setmaxid(void) cpuset_t cpumask; int cpu, last; - cpumask = platform_cpu_mask(); + platform_cpu_mask(&cpumask); mp_ncpus = 0; last = 1; while ((cpu = cpusetobj_ffs(&cpumask)) != 0) { @@ -247,7 +247,7 @@ cpu_mp_start(void) mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); CPU_ZERO(&all_cpus); - cpumask = platform_cpu_mask(); + platform_cpu_mask(&cpumask); while (!CPU_EMPTY(&cpumask)) { cpuid = cpusetobj_ffs(&cpumask) - 1; Modified: projects/largeSMP/sys/mips/rmi/xlr_machdep.c ============================================================================== --- projects/largeSMP/sys/mips/rmi/xlr_machdep.c Fri May 13 19:40:02 2011 (r221856) +++ projects/largeSMP/sys/mips/rmi/xlr_machdep.c Fri May 13 19:56:58 2011 (r221857) @@ -614,17 +614,15 @@ platform_processor_id(void) return (xlr_hwtid_to_cpuid[xlr_cpu_id()]); } -cpuset_t -platform_cpu_mask(void) +void +platform_cpu_mask(cpuset_t *mask) { - cpuset_t cpumask; int i, s; - CPU_ZERO(&cpumask); + CPU_ZERO(mask); s = xlr_ncores * xlr_threads_per_core; for (i = 0; i < s; i++) - CPU_SET(i, &cpumask); - return (cpumask); + CPU_SET(i, mask); } struct cpu_group * Modified: projects/largeSMP/sys/mips/sibyte/sb_scd.c ============================================================================== --- projects/largeSMP/sys/mips/sibyte/sb_scd.c Fri May 13 19:40:02 2011 (r221856) +++ projects/largeSMP/sys/mips/sibyte/sb_scd.c Fri May 13 19:56:58 2011 (r221857) @@ -243,17 +243,15 @@ sb_clear_mailbox(int cpu, uint64_t val) sb_store64(regaddr, val); } -cpuset_t -platform_cpu_mask(void) +void +platform_cpu_mask(cpuset_t *mask) { - cpuset_t cpumask; int i, s; - CPU_ZERO(&cpumask); + CPU_ZERO(mask); s = SYSREV_NUM_PROCESSORS(sb_read_sysrev()); for (i = 0; i < s; i++) - CPU_SET(i, &cpumask); - return (cpumask); + CPU_SET(i, mask); } #endif /* SMP */ From owner-svn-src-projects@FreeBSD.ORG Fri May 13 20:58:49 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AF291065670; Fri, 13 May 2011 20:58:49 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 47F5C8FC08; Fri, 13 May 2011 20:58:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4DKwn6e082304; Fri, 13 May 2011 20:58:49 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4DKwmX9082282; Fri, 13 May 2011 20:58:48 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105132058.p4DKwmX9082282@svn.freebsd.org> From: Attilio Rao Date: Fri, 13 May 2011 20:58:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221858 - in projects/largeSMP: bin/chmod bin/ls contrib/top lib/libc/sys share/man/man3 share/mk sys/amd64/include sys/arm/arm sys/arm/include sys/dev/md sys/dev/null sys/i386/include ... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2011 20:58:49 -0000 Author: attilio Date: Fri May 13 20:58:48 2011 New Revision: 221858 URL: http://svn.freebsd.org/changeset/base/221858 Log: MFC Modified: projects/largeSMP/bin/chmod/chmod.1 projects/largeSMP/bin/ls/ls.1 projects/largeSMP/lib/libc/sys/chmod.2 projects/largeSMP/lib/libc/sys/stat.2 projects/largeSMP/share/man/man3/Makefile projects/largeSMP/share/man/man3/queue.3 projects/largeSMP/sys/amd64/include/vmparam.h projects/largeSMP/sys/arm/arm/pmap.c projects/largeSMP/sys/arm/include/vmparam.h projects/largeSMP/sys/dev/md/md.c projects/largeSMP/sys/dev/null/null.c projects/largeSMP/sys/i386/include/vmparam.h projects/largeSMP/sys/ia64/include/vmparam.h projects/largeSMP/sys/mips/include/vmparam.h projects/largeSMP/sys/powerpc/include/vmparam.h projects/largeSMP/sys/sparc64/include/vmparam.h projects/largeSMP/sys/sun4v/include/vmparam.h projects/largeSMP/sys/sys/queue.h projects/largeSMP/sys/sys/systm.h projects/largeSMP/sys/vm/vm_kern.c projects/largeSMP/tools/tools/nanobsd/nanobsd.sh Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/bin/chmod/chmod.1 ============================================================================== --- projects/largeSMP/bin/chmod/chmod.1 Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/bin/chmod/chmod.1 Fri May 13 20:58:48 2011 (r221858) @@ -134,7 +134,7 @@ will run with effective gid set to the g See .Xr chmod 2 and -.Xr sticky 8 . +.Xr sticky 7 . .It Li 0400 Allow read by owner. .It Li 0200 @@ -325,10 +325,10 @@ option is non-standard and its use in sc .Xr umask 2 , .Xr fts 3 , .Xr setmode 3 , +.Xr sticky 7 , .Xr symlink 7 , .Xr chown 8 , -.Xr mount 8 , -.Xr sticky 8 +.Xr mount 8 .Sh STANDARDS The .Nm Modified: projects/largeSMP/bin/ls/ls.1 ============================================================================== --- projects/largeSMP/bin/ls/ls.1 Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/bin/ls/ls.1 Fri May 13 20:58:48 2011 (r221858) @@ -459,7 +459,7 @@ but not execute or search permission. (See .Xr chmod 1 or -.Xr sticky 8 . ) +.Xr sticky 7 . ) .It Sy t The sticky bit is set (mode .Li 1000 ) , @@ -467,7 +467,7 @@ and is searchable or executable. (See .Xr chmod 1 or -.Xr sticky 8 . ) +.Xr sticky 7 . ) .El .El .Pp @@ -683,9 +683,9 @@ specification. .Xr strmode 3 , .Xr termcap 5 , .Xr maclabel 7 , +.Xr sticky 7 , .Xr symlink 7 , -.Xr getfmac 8 , -.Xr sticky 8 +.Xr getfmac 8 .Sh STANDARDS With the exception of options .Fl I , g , n Modified: projects/largeSMP/lib/libc/sys/chmod.2 ============================================================================== --- projects/largeSMP/lib/libc/sys/chmod.2 Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/lib/libc/sys/chmod.2 Fri May 13 20:58:48 2011 (r221858) @@ -161,7 +161,7 @@ The sticky bit may be set by any user on a directory which the user owns or has appropriate permissions. For more details of the properties of the sticky bit, see -.Xr sticky 8 . +.Xr sticky 7 . .Pp If mode ISUID (set UID) is set on a directory, and the MNT_SUIDDIR option was used in the mount of the file system, @@ -289,7 +289,7 @@ nor a file descriptor associated with a .Xr chown 2 , .Xr open 2 , .Xr stat 2 , -.Xr sticky 8 +.Xr sticky 7 .Sh STANDARDS The .Fn chmod Modified: projects/largeSMP/lib/libc/sys/stat.2 ============================================================================== --- projects/largeSMP/lib/libc/sys/stat.2 Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/lib/libc/sys/stat.2 Fri May 13 20:58:48 2011 (r221858) @@ -401,8 +401,8 @@ nor a file descriptor associated with a .Xr fhstat 2 , .Xr statfs 2 , .Xr utimes 2 , -.Xr symlink 7 , -.Xr sticky 8 +.Xr sticky 7 , +.Xr symlink 7 .Sh STANDARDS The .Fn stat Modified: projects/largeSMP/share/man/man3/Makefile ============================================================================== --- projects/largeSMP/share/man/man3/Makefile Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/share/man/man3/Makefile Fri May 13 20:58:48 2011 (r221858) @@ -53,6 +53,7 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 LIST_INSERT_HEAD.3 \ queue.3 LIST_NEXT.3 \ queue.3 LIST_REMOVE.3 \ + queue.3 LIST_SWAP.3 \ queue.3 SLIST_EMPTY.3 \ queue.3 SLIST_ENTRY.3 \ queue.3 SLIST_FIRST.3 \ @@ -67,6 +68,7 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 SLIST_REMOVE.3 \ queue.3 SLIST_REMOVE_AFTER.3 \ queue.3 SLIST_REMOVE_HEAD.3 \ + queue.3 SLIST_SWAP.3 \ queue.3 STAILQ_CONCAT.3 \ queue.3 STAILQ_EMPTY.3 \ queue.3 STAILQ_ENTRY.3 \ @@ -84,6 +86,7 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 STAILQ_REMOVE.3 \ queue.3 STAILQ_REMOVE_AFTER.3 \ queue.3 STAILQ_REMOVE_HEAD.3 \ + queue.3 STAILQ_SWAP.3 \ queue.3 TAILQ_CONCAT.3 \ queue.3 TAILQ_EMPTY.3 \ queue.3 TAILQ_ENTRY.3 \ @@ -102,7 +105,8 @@ MLINKS+= queue.3 LIST_EMPTY.3 \ queue.3 TAILQ_LAST.3 \ queue.3 TAILQ_NEXT.3 \ queue.3 TAILQ_PREV.3 \ - queue.3 TAILQ_REMOVE.3 + queue.3 TAILQ_REMOVE.3 \ + queue.3 TAILQ_SWAP.3 MLINKS+= stdarg.3 va_arg.3 \ stdarg.3 va_copy.3 \ stdarg.3 va_end.3 \ Modified: projects/largeSMP/share/man/man3/queue.3 ============================================================================== --- projects/largeSMP/share/man/man3/queue.3 Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/share/man/man3/queue.3 Fri May 13 20:58:48 2011 (r221858) @@ -32,7 +32,7 @@ .\" @(#)queue.3 8.2 (Berkeley) 1/24/94 .\" $FreeBSD$ .\" -.Dd March 24, 2006 +.Dd May 13, 2011 .Dt QUEUE 3 .Os .Sh NAME @@ -50,6 +50,7 @@ .Nm SLIST_REMOVE_AFTER , .Nm SLIST_REMOVE_HEAD , .Nm SLIST_REMOVE , +.Nm SLIST_SWAP , .Nm STAILQ_CONCAT , .Nm STAILQ_EMPTY , .Nm STAILQ_ENTRY , @@ -67,6 +68,7 @@ .Nm STAILQ_REMOVE_AFTER , .Nm STAILQ_REMOVE_HEAD , .Nm STAILQ_REMOVE , +.Nm STAILQ_SWAP , .Nm LIST_EMPTY , .Nm LIST_ENTRY , .Nm LIST_FIRST , @@ -80,6 +82,7 @@ .Nm LIST_INSERT_HEAD , .Nm LIST_NEXT , .Nm LIST_REMOVE , +.Nm LIST_SWAP , .Nm TAILQ_CONCAT , .Nm TAILQ_EMPTY , .Nm TAILQ_ENTRY , @@ -98,7 +101,8 @@ .Nm TAILQ_LAST , .Nm TAILQ_NEXT , .Nm TAILQ_PREV , -.Nm TAILQ_REMOVE +.Nm TAILQ_REMOVE , +.Nm TAILQ_SWAP .Nd implementations of singly-linked lists, singly-linked tail queues, lists and tail queues .Sh SYNOPSIS @@ -118,6 +122,7 @@ lists and tail queues .Fn SLIST_REMOVE_AFTER "TYPE *elm" "SLIST_ENTRY NAME" .Fn SLIST_REMOVE_HEAD "SLIST_HEAD *head" "SLIST_ENTRY NAME" .Fn SLIST_REMOVE "SLIST_HEAD *head" "TYPE *elm" "TYPE" "SLIST_ENTRY NAME" +.Fn SLIST_SWAP "SLIST_HEAD *head1" "SLIST_HEAD *head2" "SLIST_ENTRY NAME" .\" .Fn STAILQ_CONCAT "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" .Fn STAILQ_EMPTY "STAILQ_HEAD *head" @@ -136,6 +141,7 @@ lists and tail queues .Fn STAILQ_REMOVE_AFTER "STAILQ_HEAD *head" "TYPE *elm" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE_HEAD "STAILQ_HEAD *head" "STAILQ_ENTRY NAME" .Fn STAILQ_REMOVE "STAILQ_HEAD *head" "TYPE *elm" "TYPE" "STAILQ_ENTRY NAME" +.Fn STAILQ_SWAP "STAILQ_HEAD *head1" "STAILQ_HEAD *head2" "STAILQ_ENTRY NAME" .\" .Fn LIST_EMPTY "LIST_HEAD *head" .Fn LIST_ENTRY "TYPE" @@ -150,6 +156,7 @@ lists and tail queues .Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME" .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME" .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME" +.Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME" .\" .Fn TAILQ_CONCAT "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TAILQ_ENTRY NAME" .Fn TAILQ_EMPTY "TAILQ_HEAD *head" @@ -170,6 +177,7 @@ lists and tail queues .Fn TAILQ_NEXT "TYPE *elm" "TAILQ_ENTRY NAME" .Fn TAILQ_PREV "TYPE *elm" "HEADNAME" "TAILQ_ENTRY NAME" .Fn TAILQ_REMOVE "TAILQ_HEAD *head" "TYPE *elm" "TAILQ_ENTRY NAME" +.Fn TAILQ_SWAP "TAILQ_HEAD *head1" "TAILQ_HEAD *head2" "TYPE" "TAILQ_ENTRY NAME" .\" .Sh DESCRIPTION These macros define and operate on four types of data structures: @@ -184,6 +192,8 @@ Insertion of a new entry after any eleme O(1) removal of an entry from the head of the list. .It Forward traversal through the list. +.It +Swawpping the contents of two lists. .El .Pp Singly-linked lists are the simplest of the four data structures @@ -402,6 +412,13 @@ The macro removes the element .Fa elm from the list. +.Pp +The macro +.Nm SLIST_SWAP +swaps the contents of +.Fa head1 +and +.Fa head2 . .Sh SINGLY-LINKED LIST EXAMPLE .Bd -literal SLIST_HEAD(slisthead, entry) head = @@ -584,6 +601,13 @@ The macro removes the element .Fa elm from the tail queue. +.Pp +The macro +.Nm STAILQ_SWAP +swaps the contents of +.Fa head1 +and +.Fa head2 . .Sh SINGLY-LINKED TAIL QUEUE EXAMPLE .Bd -literal STAILQ_HEAD(stailhead, entry) head = @@ -743,6 +767,13 @@ The macro removes the element .Fa elm from the list. +.Pp +The macro +.Nm LIST_SWAP +swaps the contents of +.Fa head1 +and +.Fa head2 . .Sh LIST EXAMPLE .Bd -literal LIST_HEAD(listhead, entry) head = @@ -942,6 +973,13 @@ The macro removes the element .Fa elm from the tail queue. +.Pp +The macro +.Nm TAILQ_SWAP +swaps the contents of +.Fa head1 +and +.Fa head2 . .Sh TAIL QUEUE EXAMPLE .Bd -literal TAILQ_HEAD(tailhead, entry) head = Modified: projects/largeSMP/sys/amd64/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/amd64/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/amd64/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -212,4 +212,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/arm/arm/pmap.c ============================================================================== --- projects/largeSMP/sys/arm/arm/pmap.c Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/arm/arm/pmap.c Fri May 13 20:58:48 2011 (r221858) @@ -3646,7 +3646,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse pte = *ptep; pg = PHYS_TO_VM_PAGE(l2pte_pa(pte)); if (pg) - pmap_modify_pv(pg, pmap, va, PVF_WIRED, wired); + pmap_modify_pv(pg, pmap, va, PVF_WIRED, wired ? PVF_WIRED : 0); vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } Modified: projects/largeSMP/sys/arm/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/arm/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/arm/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -150,4 +150,7 @@ #ifdef ARM_USE_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC #endif /* ARM_USE_SMALL_ALLOC */ + +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/dev/md/md.c ============================================================================== --- projects/largeSMP/sys/dev/md/md.c Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/dev/md/md.c Fri May 13 20:58:48 2011 (r221858) @@ -89,6 +89,8 @@ #include #include +#include + #define MD_MODVER 1 #define MD_SHUTDOWN 0x10000 /* Tell worker thread to terminate. */ @@ -205,9 +207,6 @@ struct md_s { vm_object_t object; }; -/* Used for BIO_DELETE on MD_VNODE */ -static u_char zero[PAGE_SIZE]; - static struct indir * new_indir(u_int shift) { @@ -560,7 +559,8 @@ mdstart_vnode(struct md_s *sc, struct bi * that the two cases end up having very little in common. */ if (bp->bio_cmd == BIO_DELETE) { - zerosize = sizeof(zero) - (sizeof(zero) % sc->sectorsize); + zerosize = ZERO_REGION_SIZE - + (ZERO_REGION_SIZE % sc->sectorsize); auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = (vm_ooffset_t)bp->bio_offset; @@ -573,7 +573,7 @@ mdstart_vnode(struct md_s *sc, struct bi vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); error = 0; while (auio.uio_offset < end) { - aiov.iov_base = zero; + aiov.iov_base = __DECONST(void *, zero_region); aiov.iov_len = end - auio.uio_offset; if (aiov.iov_len > zerosize) aiov.iov_len = zerosize; Modified: projects/largeSMP/sys/dev/null/null.c ============================================================================== --- projects/largeSMP/sys/dev/null/null.c Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/dev/null/null.c Fri May 13 20:58:48 2011 (r221858) @@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include +#include /* For use with destroy_dev(9). */ static struct cdev *null_dev; @@ -65,8 +67,6 @@ static struct cdevsw zero_cdevsw = { .d_flags = D_MMAP_ANON, }; -static void *zbuf; - /* ARGSUSED */ static int null_write(struct cdev *dev __unused, struct uio *uio, int flags __unused) @@ -95,10 +95,19 @@ null_ioctl(struct cdev *dev __unused, u_ static int zero_read(struct cdev *dev __unused, struct uio *uio, int flags __unused) { + void *zbuf; + ssize_t len; int error = 0; - while (uio->uio_resid > 0 && error == 0) - error = uiomove(zbuf, MIN(uio->uio_resid, PAGE_SIZE), uio); + KASSERT(uio->uio_rw == UIO_READ, + ("Can't be in %s for write", __func__)); + zbuf = __DECONST(void *, zero_region); + while (uio->uio_resid > 0 && error == 0) { + len = uio->uio_resid; + if (len > ZERO_REGION_SIZE) + len = ZERO_REGION_SIZE; + error = uiomove(zbuf, len, uio); + } return (error); } @@ -111,7 +120,6 @@ null_modevent(module_t mod __unused, int case MOD_LOAD: if (bootverbose) printf("null: \n"); - zbuf = (void *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK | M_ZERO); null_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &null_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0666, "null"); zero_dev = make_dev_credf(MAKEDEV_ETERNAL_KLD, &zero_cdevsw, 0, @@ -121,7 +129,6 @@ null_modevent(module_t mod __unused, int case MOD_UNLOAD: destroy_dev(null_dev); destroy_dev(zero_dev); - free(zbuf, M_TEMP); break; case MOD_SHUTDOWN: Modified: projects/largeSMP/sys/i386/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/i386/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/i386/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -198,4 +198,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/ia64/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/ia64/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/ia64/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -215,4 +215,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */ + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/mips/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/mips/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/mips/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -187,4 +187,6 @@ */ #define VM_NFREEORDER 9 +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/powerpc/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/powerpc/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/powerpc/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -198,4 +198,6 @@ struct pmap_physseg { #endif #endif +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/sparc64/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/sparc64/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/sparc64/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -240,4 +240,11 @@ extern vm_offset_t vm_max_kernel_address; +/* + * Older sparc64 machines have a virtually indexed L1 data cache of 16KB. + * Consequently, mapping the same physical page multiple times may have + * caching disabled. + */ +#define ZERO_REGION_SIZE PAGE_SIZE + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/sun4v/include/vmparam.h ============================================================================== --- projects/largeSMP/sys/sun4v/include/vmparam.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/sun4v/include/vmparam.h Fri May 13 20:58:48 2011 (r221858) @@ -223,4 +223,6 @@ #define UMA_MD_SMALL_ALLOC extern vm_offset_t vm_max_kernel_address; +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* !_MACHINE_VMPARAM_H_ */ Modified: projects/largeSMP/sys/sys/queue.h ============================================================================== --- projects/largeSMP/sys/sys/queue.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/sys/queue.h Fri May 13 20:58:48 2011 (r221858) @@ -99,6 +99,7 @@ * _REMOVE_AFTER + - + - * _REMOVE_HEAD + - + - * _REMOVE + + + + + * _SWAP + + + + * */ #ifdef QUEUE_MACRO_DEBUG @@ -307,18 +308,18 @@ struct { \ TRASHIT(*oldnext); \ } while (0) -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if ((STAILQ_FIRST((head)) = \ - STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ - (head)->stqh_last = &STAILQ_FIRST((head)); \ -} while (0) - #define STAILQ_REMOVE_AFTER(head, elm, field) do { \ if ((STAILQ_NEXT(elm, field) = \ STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \ (head)->stqh_last = &STAILQ_NEXT((elm), field); \ } while (0) +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if ((STAILQ_FIRST((head)) = \ + STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \ + (head)->stqh_last = &STAILQ_FIRST((head)); \ +} while (0) + #define STAILQ_SWAP(head1, head2, type) do { \ struct type *swap_first = STAILQ_FIRST(head1); \ struct type **swap_last = (head1)->stqh_last; \ Modified: projects/largeSMP/sys/sys/systm.h ============================================================================== --- projects/largeSMP/sys/sys/systm.h Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/sys/systm.h Fri May 13 20:58:48 2011 (r221858) @@ -125,6 +125,8 @@ extern char static_hints[]; /* by config extern char **kenvp; +extern const void *zero_region; /* address space maps to a zeroed page */ + /* * General function declarations. */ Modified: projects/largeSMP/sys/vm/vm_kern.c ============================================================================== --- projects/largeSMP/sys/vm/vm_kern.c Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/sys/vm/vm_kern.c Fri May 13 20:58:48 2011 (r221858) @@ -91,6 +91,9 @@ vm_map_t exec_map=0; vm_map_t pipe_map; vm_map_t buffer_map=0; +const void *zero_region; +CTASSERT((ZERO_REGION_SIZE & PAGE_MASK) == 0); + /* * kmem_alloc_nofault: * @@ -527,6 +530,32 @@ kmem_free_wakeup(map, addr, size) vm_map_unlock(map); } +static void +kmem_init_zero_region(void) +{ + vm_offset_t addr, i; + vm_page_t m; + int error; + + /* + * Map a single physical page of zeros to a larger virtual range. + * This requires less looping in places that want large amounts of + * zeros, while not using much more physical resources. + */ + addr = kmem_alloc_nofault(kernel_map, ZERO_REGION_SIZE); + m = vm_page_alloc(NULL, OFF_TO_IDX(addr - VM_MIN_KERNEL_ADDRESS), + VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO); + if ((m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + for (i = 0; i < ZERO_REGION_SIZE; i += PAGE_SIZE) + pmap_qenter(addr + i, &m, 1); + error = vm_map_protect(kernel_map, addr, addr + ZERO_REGION_SIZE, + VM_PROT_READ, TRUE); + KASSERT(error == 0, ("error=%d", error)); + + zero_region = (const void *)addr; +} + /* * kmem_init: * @@ -555,6 +584,8 @@ kmem_init(start, end) start, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); /* ... and ending with the completion of the above `insert' */ vm_map_unlock(m); + + kmem_init_zero_region(); } #ifdef DIAGNOSTIC Modified: projects/largeSMP/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- projects/largeSMP/tools/tools/nanobsd/nanobsd.sh Fri May 13 19:56:58 2011 (r221857) +++ projects/largeSMP/tools/tools/nanobsd/nanobsd.sh Fri May 13 20:58:48 2011 (r221858) @@ -418,7 +418,7 @@ populate_slice ( ) ( echo "Creating ${dev} with ${dir} (mounting on ${mnt})" newfs_part $dev $mnt $lbl cd ${dir} - find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${mnt} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${mnt} df -i ${mnt} umount ${mnt} ) @@ -567,8 +567,10 @@ create_i386_diskimage ( ) ( dd if=/dev/${MD} of=${IMG} bs=64k fi - echo "Writing out _.disk.image..." - dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + if ${do_copyout_partition} ; then + echo "Writing out _.disk.image..." + dd if=/dev/${MD}s1 of=${NANO_DISKIMGDIR}/_.disk.image bs=64k + fi mdconfig -d -u $MD trap - 1 2 15 EXIT @@ -674,7 +676,7 @@ cust_allow_ssh_root () ( cust_install_files () ( cd ${NANO_TOOLS}/Files - find . -print | grep -Ev '/(CVS|\.svn)' | cpio -dumpv ${NANO_WORLDDIR} + find . -print | grep -Ev '/(CVS|\.svn)' | cpio -Ldumpv ${NANO_WORLDDIR} ) ####################################################################### @@ -682,12 +684,18 @@ cust_install_files () ( cust_pkg () ( + # If the package directory doesn't exist, we're done. + if [ ! -d ${NANO_PACKAGE_DIR} ]; then + echo "DONE 0 packages" + return 0 + fi + # Copy packages into chroot mkdir -p ${NANO_WORLDDIR}/Pkg ( cd ${NANO_PACKAGE_DIR} find ${NANO_PACKAGE_LIST} -print | - cpio -dumpv ${NANO_WORLDDIR}/Pkg + cpio -Ldumpv ${NANO_WORLDDIR}/Pkg ) # Count & report how many we have to install @@ -758,8 +766,9 @@ pprint() { usage () { ( - echo "Usage: $0 [-biknqvw] [-c config_file]" + echo "Usage: $0 [-bfiknqvw] [-c config_file]" echo " -b suppress builds (both kernel and world)" + echo " -f suppress code slice extraction" echo " -i suppress disk image build" echo " -k suppress buildkernel" echo " -n add -DNO_CLEAN to buildworld, buildkernel, etc" @@ -778,9 +787,10 @@ do_clean=true do_kernel=true do_world=true do_image=true +do_copyout_partition=true set +e -args=`getopt bc:hiknqvw $*` +args=`getopt bc:fhiknqvw $*` if [ $? -ne 0 ] ; then usage exit 2 @@ -806,6 +816,10 @@ do shift shift ;; + -f) + do_copyout_partition=false + shift + ;; -h) usage ;; From owner-svn-src-projects@FreeBSD.ORG Sat May 14 02:28:27 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B62E510656A5; Sat, 14 May 2011 02:28:27 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 983D08FC15; Sat, 14 May 2011 02:28:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4E2SRsT089905; Sat, 14 May 2011 02:28:27 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4E2SRjB089875; Sat, 14 May 2011 02:28:27 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105140228.p4E2SRjB089875@svn.freebsd.org> From: Attilio Rao Date: Sat, 14 May 2011 02:28:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221872 - in projects/largeSMP: . contrib/top gnu/usr.bin/send-pr lib/libc/sparc64/sys lib/libdisk lib/libkvm release/doc/share/sgml release/sun4v share/man/man4 share/man/man5 share/mk... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 02:28:27 -0000 Author: attilio Date: Sat May 14 02:28:26 2011 New Revision: 221872 URL: http://svn.freebsd.org/changeset/base/221872 Log: MFC Deleted: projects/largeSMP/release/sun4v/ projects/largeSMP/sys/conf/Makefile.sun4v projects/largeSMP/sys/conf/files.sun4v projects/largeSMP/sys/conf/options.sun4v projects/largeSMP/sys/sun4v/ Modified: projects/largeSMP/Makefile projects/largeSMP/Makefile.inc1 projects/largeSMP/UPDATING projects/largeSMP/gnu/usr.bin/send-pr/categories projects/largeSMP/gnu/usr.bin/send-pr/send-pr.1 projects/largeSMP/lib/libc/sparc64/sys/Makefile.inc projects/largeSMP/lib/libc/sparc64/sys/__sparc_utrap_gen.S projects/largeSMP/lib/libdisk/Makefile projects/largeSMP/lib/libkvm/Makefile projects/largeSMP/lib/libkvm/kvm_sparc64.c projects/largeSMP/release/doc/share/sgml/release.ent projects/largeSMP/share/man/man4/ddb.4 projects/largeSMP/share/man/man5/src.conf.5 projects/largeSMP/sys/Makefile projects/largeSMP/sys/boot/Makefile projects/largeSMP/sys/boot/common/loader.8 projects/largeSMP/sys/boot/sparc64/loader/main.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/largeSMP/sys/dev/ath/ath_rate/sample/tx_schedules.h projects/largeSMP/sys/fs/ext2fs/ext2_lookup.c projects/largeSMP/sys/modules/mem/Makefile projects/largeSMP/sys/modules/uart/Makefile projects/largeSMP/sys/sparc64/sparc64/autoconf.c projects/largeSMP/sys/sparc64/sparc64/genassym.c projects/largeSMP/sys/sparc64/sparc64/mem.c projects/largeSMP/sys/sys/kdb.h projects/largeSMP/sys/sys/param.h projects/largeSMP/usr.bin/rpcinfo/rpcinfo.c projects/largeSMP/usr.sbin/bsdinstall/partedit/Makefile Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/Makefile ============================================================================== --- projects/largeSMP/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -131,7 +131,7 @@ _MAKE= PATH=${PATH} ${BINMAKE} -f Makefi # Guess machine architecture from machine type, and vice versa. .if !defined(TARGET_ARCH) && defined(TARGET) -_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/sun4v/sparc64/:S/mips/mipsel/} +_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/mips/mipsel/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} _TARGET= ${TARGET_ARCH:C/mips.*e[lb]/mips/:C/armeb/arm/} @@ -323,12 +323,11 @@ toolchains: # existing system is. # .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) -TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v +TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 TARGET_ARCHES_arm?= arm armeb TARGET_ARCHES_mips?= mipsel mipseb mips64el mips64eb mipsn32eb TARGET_ARCHES_powerpc?= powerpc powerpc64 TARGET_ARCHES_pc98?= i386 -TARGET_ARCHES_sun4v?= sparc64 .for target in ${TARGETS} TARGET_ARCHES_${target}?= ${target} .endfor Modified: projects/largeSMP/Makefile.inc1 ============================================================================== --- projects/largeSMP/Makefile.inc1 Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/Makefile.inc1 Sat May 14 02:28:26 2011 (r221872) @@ -130,7 +130,7 @@ VERSION!= uname -srp VERSION+= ${OSRELDATE} .endif -KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64 sparc64/sun4v +KNOWN_ARCHES?= amd64 arm armeb/arm i386 i386/pc98 ia64 mipsel/mips mipseb/mips mips64el/mips mips64eb/mips mipsn32el/mips mipsn32eb/mips powerpc powerpc64/powerpc sparc64 .if ${TARGET} == ${TARGET_ARCH} _t= ${TARGET} .else Modified: projects/largeSMP/UPDATING ============================================================================== --- projects/largeSMP/UPDATING Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/UPDATING Sat May 14 02:28:26 2011 (r221872) @@ -22,6 +22,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9. machines to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20110513: + Support for sun4v architecture is officially dropped + 20110430: Users of the Atheros AR71xx SoC code now need to add 'device ar71xx_pci' into their kernel configurations along with 'device pci'. Modified: projects/largeSMP/gnu/usr.bin/send-pr/categories ============================================================================== --- projects/largeSMP/gnu/usr.bin/send-pr/categories Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/gnu/usr.bin/send-pr/categories Sat May 14 02:28:26 2011 (r221872) @@ -16,7 +16,6 @@ ports powerpc sparc64 standards -sun4v threads usb www Modified: projects/largeSMP/gnu/usr.bin/send-pr/send-pr.1 ============================================================================== --- projects/largeSMP/gnu/usr.bin/send-pr/send-pr.1 Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/gnu/usr.bin/send-pr/send-pr.1 Sat May 14 02:28:26 2011 (r221872) @@ -233,9 +233,6 @@ SPARC processor specific problems. .B standards Standards conformance issues. .TP -.B sun4v -Problems specific to the SPARC sun4v architecture and processors. -.TP .B threads Problems related to threading on FreeBSD. .TP Modified: projects/largeSMP/lib/libc/sparc64/sys/Makefile.inc ============================================================================== --- projects/largeSMP/lib/libc/sparc64/sys/Makefile.inc Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/lib/libc/sparc64/sys/Makefile.inc Sat May 14 02:28:26 2011 (r221872) @@ -11,9 +11,6 @@ SRCS+= __sparc_sigtramp_setup.c \ sigcode.S CFLAGS+= -I${.CURDIR}/sparc64/fpu -.if ${MACHINE} == "sun4v" -CFLAGS+= -DSUN4V -.endif MDASM+= brk.S cerror.S exect.S pipe.S ptrace.S sbrk.S setlogin.S sigaction.S Modified: projects/largeSMP/lib/libc/sparc64/sys/__sparc_utrap_gen.S ============================================================================== --- projects/largeSMP/lib/libc/sparc64/sys/__sparc_utrap_gen.S Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/lib/libc/sparc64/sys/__sparc_utrap_gen.S Sat May 14 02:28:26 2011 (r221872) @@ -38,10 +38,6 @@ __FBSDID("$FreeBSD$"); #include "assym.s" ENTRY(__sparc_utrap_gen) -#ifdef SUN4V - save - ta %xcc, ST_FPEMU_CONTEXT -#endif sub %sp, UF_SIZEOF, %sp stx %o0, [%sp + SPOFF + CCFSZ + UF_TYPE] Modified: projects/largeSMP/lib/libdisk/Makefile ============================================================================== --- projects/largeSMP/lib/libdisk/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/lib/libdisk/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -10,11 +10,7 @@ _open_disk= open_disk.c LIB= disk SRCS= blocks.c ${_change} chunk.c create_chunk.c disk.c ${_open_disk} \ rules.c write_disk.c -.if ${MACHINE} == "sun4v" -SRCS+= write_sparc64_disk.c -.else SRCS+= write_${MACHINE}_disk.c -.endif INCS= libdisk.h Modified: projects/largeSMP/lib/libkvm/Makefile ============================================================================== --- projects/largeSMP/lib/libkvm/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/lib/libkvm/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -5,10 +5,6 @@ LIB= kvm SHLIBDIR?= /lib CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -.if ${MACHINE} == "sun4v" -CFLAGS+=-DSUN4V -.endif - .if exists(${.CURDIR}/kvm_${MACHINE_ARCH}.c) KVM_ARCH=${MACHINE_ARCH} .else Modified: projects/largeSMP/lib/libkvm/kvm_sparc64.c ============================================================================== --- projects/largeSMP/lib/libkvm/kvm_sparc64.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/lib/libkvm/kvm_sparc64.c Sat May 14 02:28:26 2011 (r221872) @@ -188,11 +188,9 @@ fail_vm: int _kvm_kvatop(kvm_t *kd, u_long va, off_t *pa) { -#if !defined(SUN4V) struct tte tte; off_t tte_off; u_long vpn; -#endif off_t pa_off; u_long pg_off; int rest; @@ -200,7 +198,6 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t pg_off = va & PAGE_MASK; if (va >= VM_MIN_DIRECT_ADDRESS) pa_off = TLB_DIRECT_TO_PHYS(va) & ~PAGE_MASK; -#if !defined(SUN4V) else { vpn = btop(va); tte_off = kd->vmst->vm_tsb_off + @@ -211,7 +208,6 @@ _kvm_kvatop(kvm_t *kd, u_long va, off_t goto invalid; pa_off = TTE_GET_PA(&tte); } -#endif rest = PAGE_SIZE - pg_off; pa_off = _kvm_find_off(kd->vmst, pa_off, rest); if (pa_off == KVM_OFF_NOTFOUND) Modified: projects/largeSMP/release/doc/share/sgml/release.ent ============================================================================== --- projects/largeSMP/release/doc/share/sgml/release.ent Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/release/doc/share/sgml/release.ent Sat May 14 02:28:26 2011 (r221872) @@ -57,7 +57,6 @@ - Modified: projects/largeSMP/share/man/man4/ddb.4 ============================================================================== --- projects/largeSMP/share/man/man4/ddb.4 Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/share/man/man4/ddb.4 Sat May 14 02:28:26 2011 (r221872) @@ -1373,7 +1373,7 @@ The kernel debugger was entered as a res sysctl being set. .It Dv kdb.enter.trapsig The kernel debugger was entered as a result of a trapsig event on the sparc64 -or sun4v platform. +platform. .It Dv kdb.enter.unionfs The kernel debugger was entered as a result of an assertion failure in the union file system. Modified: projects/largeSMP/share/man/man5/src.conf.5 ============================================================================== --- projects/largeSMP/share/man/man5/src.conf.5 Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/share/man/man5/src.conf.5 Sat May 14 02:28:26 2011 (r221872) @@ -257,7 +257,7 @@ When set, it also enforces the following Set to not build the Clang C/C++ compiler. .Pp It is a default setting on -arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, powerpc/powerpc64, sparc64/sparc64 and sun4v/sparc64. +arm/arm, arm/armeb, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_CLANG .\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru Set to build the Clang C/C++ compiler. @@ -337,7 +337,7 @@ Set to not build Flattened Device Tree s This includes the device tree compiler (dtc) and libfdt support library. .Pp It is a default setting on -amd64/amd64, i386/i386, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, pc98/i386, powerpc/powerpc64, sparc64/sparc64 and sun4v/sparc64. +amd64/amd64, i386/i386, ia64/ia64, mips/mipsel, mips/mipseb, mips/mips64el, mips/mips64eb, mips/mipsn32eb, pc98/i386, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_FDT .\" from FreeBSD: head/tools/build/options/WITH_FDT 221730 2011-05-10 11:14:40Z ru Set to build Flattened Device Tree support as part of the base system. Modified: projects/largeSMP/sys/Makefile ============================================================================== --- projects/largeSMP/sys/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -14,7 +14,7 @@ CSCOPEDIRS= boot bsm cam cddl compat con netsmb nfs nfsclient nfsserver nlm opencrypto \ pci rpc security sys ufs vm xdr ${CSCOPE_ARCHDIR} .if defined(ALL_ARCH) -CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v x86 +CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 .else CSCOPE_ARCHDIR ?= ${MACHINE} .endif Modified: projects/largeSMP/sys/boot/Makefile ============================================================================== --- projects/largeSMP/sys/boot/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/boot/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -13,7 +13,7 @@ SUBDIR+= fdt .endif # Pick the machine-dependent subdir based on the target architecture. -ADIR= ${MACHINE:S/amd64/i386/:S/sun4v/sparc64/:S/powerpc64/powerpc/} +ADIR= ${MACHINE:S/amd64/i386/:S/powerpc64/powerpc/} .if exists(${.CURDIR}/${ADIR}/.) SUBDIR+= ${ADIR} .endif Modified: projects/largeSMP/sys/boot/common/loader.8 ============================================================================== --- projects/largeSMP/sys/boot/common/loader.8 Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/boot/common/loader.8 Sat May 14 02:28:26 2011 (r221872) @@ -597,7 +597,7 @@ Modifies kernel option Limits the amount of KVM reserved for use by the buffer cache, specified in bytes. The default maximum is 200MB on i386, -and 400MB on amd64, sparc64, and sun4v. +and 400MB on amd64 and sparc64. This parameter is used to prevent the buffer cache from eating too much KVM in large-memory machine configurations. Modified: projects/largeSMP/sys/boot/sparc64/loader/main.c ============================================================================== --- projects/largeSMP/sys/boot/sparc64/loader/main.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/boot/sparc64/loader/main.c Sat May 14 02:28:26 2011 (r221872) @@ -113,13 +113,11 @@ static int map_phys(int, size_t, vm_offs static void release_phys(vm_offset_t, u_int); static int __elfN(exec)(struct preloaded_file *); static int mmu_mapin_sun4u(vm_offset_t, vm_size_t); -static int mmu_mapin_sun4v(vm_offset_t, vm_size_t); static vm_offset_t init_heap(void); static phandle_t find_bsp_sun4u(phandle_t, uint32_t); const char *cpu_cpuid_prop_sun4u(void); uint32_t cpu_get_mid_sun4u(void); static void tlb_init_sun4u(void); -static void tlb_init_sun4v(void); #ifdef LOADER_DEBUG typedef u_int64_t tte_t; @@ -129,7 +127,6 @@ static void pmap_print_tte_sun4u(tte_t, #endif static struct mmu_ops mmu_ops_sun4u = { tlb_init_sun4u, mmu_mapin_sun4u }; -static struct mmu_ops mmu_ops_sun4v = { tlb_init_sun4v, mmu_mapin_sun4v }; /* sun4u */ struct tlb_entry *dtlb_store; @@ -140,16 +137,6 @@ static int cpu_impl; static u_int dtlb_slot_max; static u_int itlb_slot_max; -/* sun4v */ -static struct tlb_entry *tlb_store; -static int is_sun4v = 0; -/* - * no direct TLB access on sun4v - * we somewhat arbitrarily declare enough - * slots to cover a 4GB AS with 4MB pages - */ -#define SUN4V_TLB_SLOT_MAX (1 << 10) - static vm_offset_t curkva = 0; static vm_offset_t heapva; @@ -568,47 +555,6 @@ mmu_mapin_sun4u(vm_offset_t va, vm_size_ return (0); } -static int -mmu_mapin_sun4v(vm_offset_t va, vm_size_t len) -{ - vm_offset_t pa, mva; - - if (va + len > curkva) - curkva = va + len; - - pa = (vm_offset_t)-1; - len += va & PAGE_MASK_4M; - va &= ~PAGE_MASK_4M; - while (len) { - if ((va >> 22) > SUN4V_TLB_SLOT_MAX) - panic("%s: trying to map more than 4GB", __func__); - if (tlb_store[va >> 22].te_pa == -1) { - /* Allocate a physical page, claim the virtual area */ - if (pa == (vm_offset_t)-1) { - pa = alloc_phys(PAGE_SIZE_4M, PAGE_SIZE_4M); - if (pa == (vm_offset_t)-1) - panic("%s: out of memory", __func__); - mva = claim_virt(va, PAGE_SIZE_4M, 0); - if (mva != va) - panic("%s: can't claim virtual page " - "(wanted %#lx, got %#lx)", - __func__, va, mva); - } - - tlb_store[va >> 22].te_pa = pa; - if (map_phys(-1, PAGE_SIZE_4M, va, pa) == -1) - printf("%s: can't map physical page\n", - __func__); - pa = (vm_offset_t)-1; - } - len -= len > PAGE_SIZE_4M ? PAGE_SIZE_4M : len; - va += PAGE_SIZE_4M; - } - if (pa != (vm_offset_t)-1) - release_phys(pa, PAGE_SIZE_4M); - return (0); -} - static vm_offset_t init_heap(void) { @@ -739,14 +685,6 @@ tlb_init_sun4u(void) panic("%s: can't allocate TLB store", __func__); } -static void -tlb_init_sun4v(void) -{ - - tlb_store = malloc(SUN4V_TLB_SLOT_MAX * sizeof(*tlb_store)); - memset(tlb_store, 0xFF, SUN4V_TLB_SLOT_MAX * sizeof(*tlb_store)); -} - int main(int (*openfirm)(void *)) { @@ -777,14 +715,7 @@ main(int (*openfirm)(void *)) if ((root = OF_peer(0)) == -1) panic("%s: can't get root phandle", __func__); OF_getprop(root, "compatible", compatible, sizeof(compatible)); - if (!strcmp(compatible, "sun4v")) { - printf("\nBooting with sun4v support.\n"); - mmu_ops = &mmu_ops_sun4v; - is_sun4v = 1; - } else { - printf("\nBooting with sun4u support.\n"); - mmu_ops = &mmu_ops_sun4u; - } + mmu_ops = &mmu_ops_sun4u; mmu_ops->tlb_init(); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c Sat May 14 02:28:26 2011 (r221872) @@ -277,7 +277,7 @@ ar5416InitCal(struct ath_hal *ah, const /* * Enable IQ, ADC Gain, ADC DC Offset Cals */ - if (AR_SREV_SOWL_10_OR_LATER(ah)) { + if (AR_SREV_HOWL(ah) || AR_SREV_SOWL_10_OR_LATER(ah)) { /* Setup all non-periodic, init time only calibrations */ /* XXX: Init DC Offset not working yet */ #if 0 Modified: projects/largeSMP/sys/dev/ath/ath_rate/sample/tx_schedules.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_rate/sample/tx_schedules.h Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/dev/ath/ath_rate/sample/tx_schedules.h Sat May 14 02:28:26 2011 (r221872) @@ -172,7 +172,7 @@ static const struct txschedule series_ha #undef H #ifdef Q -#undef Q /* sun4v bogosity */ +#undef Q #endif #define Q(_r) \ (((_r) == 1.5) ? 0 : (((_r) ==2.25) ? 1 : (((_r) == 3) ? 2 : \ Modified: projects/largeSMP/sys/fs/ext2fs/ext2_lookup.c ============================================================================== --- projects/largeSMP/sys/fs/ext2fs/ext2_lookup.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/fs/ext2fs/ext2_lookup.c Sat May 14 02:28:26 2011 (r221872) @@ -119,17 +119,11 @@ static int ext2_dirbadentry(struct vnode /* * Vnode op for reading directories. * - * The routine below assumes that the on-disk format of a directory - * is the same as that defined by . If the on-disk - * format changes, then it will be necessary to do a conversion - * from the on-disk format that read returns to the format defined - * by . - */ -/* - * this is exactly what we do here - the problem is that the conversion - * will blow up some entries by four bytes, so it can't be done in place. - * This is too bad. Right now the conversion is done entry by entry, the - * converted entry is sent via uiomove. + * This function has to convert directory entries from the on-disk + * format to the format defined by . Unfortunately, the + * conversion will blow up some entries by four bytes, so it can't be + * done in place. Instead, the conversion is done entry by entry and + * the converted entry is sent via uiomove. * * XXX allocate a buffer, convert as many entries as possible, then send * the whole buffer to uiomove Modified: projects/largeSMP/sys/modules/mem/Makefile ============================================================================== --- projects/largeSMP/sys/modules/mem/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/modules/mem/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -14,18 +14,4 @@ SRCS+= amd64_mem.c .endif SRCS+= bus_if.h device_if.h -.if ${MACHINE} == "sun4v" -SRCS+= opt_global.h - -.if defined(KERNBUILDDIR) -MKDEP= -include ${KERNBUILDDIR}/opt_global.h -.else -CFLAGS+= -include opt_global.h -MKDEP= -include opt_global.h - -opt_global.h: - echo "#define SUN4V 1" > ${.TARGET} -.endif -.endif - .include Modified: projects/largeSMP/sys/modules/uart/Makefile ============================================================================== --- projects/largeSMP/sys/modules/uart/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/modules/uart/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -14,9 +14,7 @@ SRCS= uart_bus_acpi.c ${uart_bus_ebus} u uart_dev_ns8250.c uart_dev_quicc.c uart_dev_sab82532.c \ uart_dev_z8530.c \ uart_if.c uart_if.h uart_subr.c uart_tty.c -.if ${MACHINE} == "sun4v" -SRCS+= uart_cpu_sparc64.c -.elif exists(${.CURDIR}/../../dev/uart/uart_cpu_${MACHINE}.c) +.if exists(${.CURDIR}/../../dev/uart/uart_cpu_${MACHINE}.c) SRCS+= uart_cpu_${MACHINE}.c .endif SRCS+= bus_if.h card_if.h device_if.h isa_if.h ${ofw_bus_if} pci_if.h \ Modified: projects/largeSMP/sys/sparc64/sparc64/autoconf.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/autoconf.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/sparc64/sparc64/autoconf.c Sat May 14 02:28:26 2011 (r221872) @@ -66,9 +66,6 @@ static void configure(void *dummy) { -#ifdef SUN4V - intr_restore_all(0x16); -#endif root_bus_configure(); #ifdef DEV_ISA /* Modified: projects/largeSMP/sys/sparc64/sparc64/genassym.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/genassym.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/sparc64/sparc64/genassym.c Sat May 14 02:28:26 2011 (r221872) @@ -46,18 +46,11 @@ __FBSDID("$FreeBSD$"); #ifdef SUN4U #include #endif -#ifdef SUN4V -#include -#endif #include #include #include #include #include -#ifdef SUN4V -#include -#include -#endif #include ASSYM(KERNBASE, KERNBASE); @@ -96,9 +89,6 @@ ASSYM(CSA_TICK, offsetof(struct cpu_star ASSYM(CSA_TTES, offsetof(struct cpu_start_args, csa_ttes)); ASSYM(CSA_VER, offsetof(struct cpu_start_args, csa_ver)); #endif -#ifdef SUN4V -ASSYM(CSA_CPUID, offsetof(struct cpu_start_args, csa_cpuid)); -#endif #endif #ifdef SUN4U @@ -144,20 +134,6 @@ ASSYM(TLB_DIRECT_TO_TTE_MASK, TLB_DIRECT ASSYM(TV_SIZE_BITS, TV_SIZE_BITS); #endif -#ifdef SUN4V -ASSYM(VTD_REF, VTD_REF); -ASSYM(VTD_W, VTD_W); -ASSYM(VTD_SW_W, VTD_SW_W); -ASSYM(VTD_LOCK, VTD_LOCK); - -ASSYM(THE_SHIFT, THE_SHIFT); -ASSYM(PM_HASHSCRATCH, offsetof(struct pmap, pm_hashscratch)); -ASSYM(PM_TSBSCRATCH, offsetof(struct pmap, pm_tsbscratch)); -ASSYM(PM_TSB_RA, offsetof(struct pmap, pm_tsb_ra)); -ASSYM(PM_TLBACTIVE, offsetof(struct pmap, pm_tlbactive)); -ASSYM(HASH_ENTRY_SHIFT, HASH_ENTRY_SHIFT); -#endif - ASSYM(V_INTR, offsetof(struct vmmeter, v_intr)); ASSYM(MAXCOMLEN, MAXCOMLEN); @@ -170,35 +146,6 @@ ASSYM(PC_IRFREE, offsetof(struct pcpu, p ASSYM(PC_CNT, offsetof(struct pcpu, pc_cnt)); ASSYM(PC_SIZEOF, sizeof(struct pcpu)); -#ifdef SUN4V -ASSYM(PC_CPU_Q_RA, offsetof(struct pcpu, pc_cpu_q_ra)); -ASSYM(PC_CPU_Q_SIZE, offsetof(struct pcpu, pc_cpu_q_size)); -ASSYM(PC_DEV_Q_RA, offsetof(struct pcpu, pc_dev_q_ra)); -ASSYM(PC_DEV_Q_SIZE, offsetof(struct pcpu, pc_dev_q_size)); - -ASSYM(PC_RQ_BASE, offsetof(struct pcpu, pc_rq_ra)); -ASSYM(PC_RQ_SIZE, offsetof(struct pcpu, pc_rq_size)); -ASSYM(PC_NRQ_BASE, offsetof(struct pcpu, pc_nrq_ra)); -ASSYM(PC_NRQ_SIZE, offsetof(struct pcpu, pc_nrq_size)); -ASSYM(PC_MONDO_DATA, offsetof(struct pcpu, pc_mondo_data)); -ASSYM(PC_MONDO_DATA_RA, offsetof(struct pcpu, pc_mondo_data_ra)); - -ASSYM(PC_KWBUF_FULL, offsetof(struct pcpu, pc_kwbuf_full)); -ASSYM(PC_KWBUF_SP, offsetof(struct pcpu, pc_kwbuf_sp)); -ASSYM(PC_KWBUF, offsetof(struct pcpu, pc_kwbuf)); -ASSYM(PC_PAD, offsetof(struct pcpu, pad)); -ASSYM(PC_PMAP, offsetof(struct pcpu, pc_curpmap)); -ASSYM(PC_TSBWBUF, offsetof(struct pcpu, pc_tsbwbuf)); - -ASSYM(PCB_KSTACK, offsetof(struct pcb, pcb_kstack)); -ASSYM(PCB_TSTATE, offsetof(struct pcb, pcb_tstate)); -ASSYM(PCB_TPC, offsetof(struct pcb, pcb_tpc)); -ASSYM(PCB_TNPC, offsetof(struct pcb, pcb_tnpc)); -ASSYM(PCB_TT, offsetof(struct pcb, pcb_tt)); -ASSYM(PCB_SFAR, offsetof(struct pcb, pcb_sfar)); -ASSYM(PM_TSB_MISS_COUNT, offsetof(struct pmap, pm_tsb_miss_count)); -ASSYM(PM_TSB_CAP_MISS_COUNT, offsetof(struct pmap, pm_tsb_cap_miss_count)); -#endif #ifdef SUN4U ASSYM(PC_CACHE, offsetof(struct pcpu, pc_cache)); ASSYM(PC_MID, offsetof(struct pcpu, pc_mid)); @@ -300,9 +247,6 @@ ASSYM(TF_TAR, offsetof(struct trapframe, ASSYM(TF_TYPE, offsetof(struct trapframe, tf_type)); ASSYM(TF_Y, offsetof(struct trapframe, tf_y)); #endif -#ifdef SUN4V -ASSYM(TF_ASI, offsetof(struct trapframe, tf_asi)); -#endif ASSYM(TF_TNPC, offsetof(struct trapframe, tf_tnpc)); ASSYM(TF_TPC, offsetof(struct trapframe, tf_tpc)); ASSYM(TF_TSTATE, offsetof(struct trapframe, tf_tstate)); Modified: projects/largeSMP/sys/sparc64/sparc64/mem.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/mem.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/sparc64/sparc64/mem.c Sat May 14 02:28:26 2011 (r221872) @@ -69,9 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifndef SUN4V #include -#endif #include #include #include @@ -137,18 +135,14 @@ memrw(struct cdev *dev, struct uio *uio, if (m != NULL) { if (ova == 0) { -#ifndef SUN4V if (dcache_color_ignore == 0) colors = DCACHE_COLORS; -#endif ova = kmem_alloc_wait(kernel_map, PAGE_SIZE * colors); } -#ifndef SUN4V if (colors != 1 && m->md.color != -1) va = ova + m->md.color * PAGE_SIZE; else -#endif va = ova; pmap_qenter(va, &m, 1); error = uiomove((void *)(va + off), cnt, Modified: projects/largeSMP/sys/sys/kdb.h ============================================================================== --- projects/largeSMP/sys/sys/kdb.h Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/sys/kdb.h Sat May 14 02:28:26 2011 (r221872) @@ -101,7 +101,7 @@ extern const char * volatile kdb_why; #define KDB_WHY_CAM "cam" /* CAM has entered debugger. */ #define KDB_WHY_NDIS "ndis" /* NDIS entered debugger. */ #define KDB_WHY_ACPI "acpi" /* ACPI entered debugger. */ -#define KDB_WHY_TRAPSIG "trapsig" /* Sun4v/Sparc fault. */ +#define KDB_WHY_TRAPSIG "trapsig" /* Sparc fault. */ #define KDB_WHY_POWERFAIL "powerfail" /* Powerfail NMI. */ #define KDB_WHY_MAC "mac" /* MAC Framework. */ #define KDB_WHY_POWERPC "powerpc" /* Unhandled powerpc intr. */ Modified: projects/largeSMP/sys/sys/param.h ============================================================================== --- projects/largeSMP/sys/sys/param.h Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/sys/sys/param.h Sat May 14 02:28:26 2011 (r221872) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 900036 /* Master, propagated to newvers */ +#define __FreeBSD_version 900037 /* Master, propagated to newvers */ #ifdef _KERNEL #define P_OSREL_SIGSEGV 700004 Modified: projects/largeSMP/usr.bin/rpcinfo/rpcinfo.c ============================================================================== --- projects/largeSMP/usr.bin/rpcinfo/rpcinfo.c Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/usr.bin/rpcinfo/rpcinfo.c Sat May 14 02:28:26 2011 (r221872) @@ -128,9 +128,9 @@ struct rpcbdump_short { #ifdef PORTMAP -static void ip_ping(u_short, char *, int, char **); +static void ip_ping(u_short, const char *, int, char **); static CLIENT *clnt_com_create(struct sockaddr_in *, u_long, u_long, int *, - char *); + const char *); static void pmapdump(int, char **); static void get_inet_address(struct sockaddr_in *, char *); #endif @@ -336,7 +336,7 @@ local_rpcb(u_long prog, u_long vers) #ifdef PORTMAP static CLIENT * clnt_com_create(struct sockaddr_in *addr, u_long prog, u_long vers, - int *fdp, char *trans) + int *fdp, const char *trans) { CLIENT *clnt; @@ -369,7 +369,7 @@ clnt_com_create(struct sockaddr_in *addr * version 0 calls succeeds, it tries for MAXVERS call and repeats the same. */ static void -ip_ping(u_short portnum, char *trans, int argc, char **argv) +ip_ping(u_short portnum, const char *trans, int argc, char **argv) { CLIENT *client; int fd = RPC_ANYFD; @@ -594,7 +594,7 @@ reply_proc(void *res, struct netbuf *who { char *uaddr; char hostbuf[NI_MAXHOST]; - char *hostname; + const char *hostname; struct sockaddr *sa = (struct sockaddr *)who->buf; if (getnameinfo(sa, sa->sa_len, hostbuf, NI_MAXHOST, NULL, 0, 0)) { @@ -987,15 +987,15 @@ rpcbgetstat(int argc, char **argv) #define MAXLINE 256 char linebuf[MAXLINE]; char *cp, *lp; - char *pmaphdr[] = { + const char *pmaphdr[] = { "NULL", "SET", "UNSET", "GETPORT", "DUMP", "CALLIT" }; - char *rpcb3hdr[] = { + const char *rpcb3hdr[] = { "NULL", "SET", "UNSET", "GETADDR", "DUMP", "CALLIT", "TIME", "U2T", "T2U" }; - char *rpcb4hdr[] = { + const char *rpcb4hdr[] = { "NULL", "SET", "UNSET", "GETADDR", "DUMP", "CALLIT", "TIME", "U2T", "T2U", "VERADDR", "INDRECT", "GETLIST", "GETSTAT" }; @@ -1455,7 +1455,7 @@ progping(char *netid, int argc, char **a } static void -usage() +usage(void) { fprintf(stderr, "usage: rpcinfo [-m | -s] [host]\n"); #ifdef PORTMAP @@ -1536,7 +1536,7 @@ pstatus(register CLIENT *client, u_long static CLIENT * clnt_rpcbind_create(char *host, int rpcbversnum, struct netbuf **targaddr) { - static char *tlist[3] = { + static const char *tlist[3] = { "circuit_n", "circuit_v", "datagram_v" }; int i; Modified: projects/largeSMP/usr.sbin/bsdinstall/partedit/Makefile ============================================================================== --- projects/largeSMP/usr.sbin/bsdinstall/partedit/Makefile Sat May 14 02:28:21 2011 (r221871) +++ projects/largeSMP/usr.sbin/bsdinstall/partedit/Makefile Sat May 14 02:28:26 2011 (r221872) @@ -9,9 +9,6 @@ PARTEDIT_ARCH= ${MACHINE} .if ${MACHINE} == "i386" || ${MACHINE} == "amd64" PARTEDIT_ARCH= x86 .endif -.if ${MACHINE} == "sun4v" -PARTEDIT_ARCH= sparc64 -.endif .if !exists(partedit_${PARTEDIT_ARCH}.c) PARTEDIT_ARCH= generic .endif From owner-svn-src-projects@FreeBSD.ORG Sat May 14 14:02:36 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E807106566C; Sat, 14 May 2011 14:02:36 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F8918FC14; Sat, 14 May 2011 14:02:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EE2atO005358; Sat, 14 May 2011 14:02:36 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EE2aPS005356; Sat, 14 May 2011 14:02:36 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201105141402.p4EE2aPS005356@svn.freebsd.org> From: Ermal Luçi Date: Sat, 14 May 2011 14:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221886 - projects/pf/pf45/contrib/pf/authpf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 14:02:36 -0000 Author: eri Date: Sat May 14 14:02:36 2011 New Revision: 221886 URL: http://svn.freebsd.org/changeset/base/221886 Log: Correct build on other archs. Modified: projects/pf/pf45/contrib/pf/authpf/authpf.c Modified: projects/pf/pf45/contrib/pf/authpf/authpf.c ============================================================================== --- projects/pf/pf45/contrib/pf/authpf/authpf.c Sat May 14 12:25:33 2011 (r221885) +++ projects/pf/pf45/contrib/pf/authpf/authpf.c Sat May 14 14:02:36 2011 (r221886) @@ -824,7 +824,7 @@ change_filter(int add, const char *l_use remove_stale_rulesets(); gettimeofday(&Tend, NULL); - syslog(LOG_INFO, "removed %s, user %s - duration %zu seconds", + syslog(LOG_INFO, "removed %s, user %s - duration %ju seconds", ip_src, l_user, Tend.tv_sec - Tstart.tv_sec); } return (0); From owner-svn-src-projects@FreeBSD.ORG Sat May 14 14:42:13 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 462ED1065670; Sat, 14 May 2011 14:42:13 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 371488FC16; Sat, 14 May 2011 14:42:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EEgDfs006378; Sat, 14 May 2011 14:42:13 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EEgDLV006376; Sat, 14 May 2011 14:42:13 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201105141442.p4EEgDLV006376@svn.freebsd.org> From: Ermal Luçi Date: Sat, 14 May 2011 14:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221892 - projects/pf/pf45/contrib/pf/authpf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 14:42:13 -0000 Author: eri Date: Sat May 14 14:42:12 2011 New Revision: 221892 URL: http://svn.freebsd.org/changeset/base/221892 Log: Do a cast to avoid problems with various archs. Modified: projects/pf/pf45/contrib/pf/authpf/authpf.c Modified: projects/pf/pf45/contrib/pf/authpf/authpf.c ============================================================================== --- projects/pf/pf45/contrib/pf/authpf/authpf.c Sat May 14 14:41:40 2011 (r221891) +++ projects/pf/pf45/contrib/pf/authpf/authpf.c Sat May 14 14:42:12 2011 (r221892) @@ -825,7 +825,7 @@ change_filter(int add, const char *l_use gettimeofday(&Tend, NULL); syslog(LOG_INFO, "removed %s, user %s - duration %ju seconds", - ip_src, l_user, Tend.tv_sec - Tstart.tv_sec); + ip_src, l_user, (uintmax_t)(Tend.tv_sec - Tstart.tv_sec)); } return (0); no_mem: From owner-svn-src-projects@FreeBSD.ORG Sat May 14 15:02:50 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 827E81065670; Sat, 14 May 2011 15:02:50 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7314F8FC13; Sat, 14 May 2011 15:02:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EF2oiT006910; Sat, 14 May 2011 15:02:50 GMT (envelope-from eri@svn.freebsd.org) Received: (from eri@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EF2obv006908; Sat, 14 May 2011 15:02:50 GMT (envelope-from eri@svn.freebsd.org) Message-Id: <201105141502.p4EF2obv006908@svn.freebsd.org> From: Ermal Luçi Date: Sat, 14 May 2011 15:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221895 - projects/pf/pf45/usr.sbin/ftp-proxy/ftp-proxy X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 15:02:50 -0000 Author: eri Date: Sat May 14 15:02:50 2011 New Revision: 221895 URL: http://svn.freebsd.org/changeset/base/221895 Log: Lower WARNS to allow universe to continue. Modified: projects/pf/pf45/usr.sbin/ftp-proxy/ftp-proxy/Makefile Modified: projects/pf/pf45/usr.sbin/ftp-proxy/ftp-proxy/Makefile ============================================================================== --- projects/pf/pf45/usr.sbin/ftp-proxy/ftp-proxy/Makefile Sat May 14 14:55:15 2011 (r221894) +++ projects/pf/pf45/usr.sbin/ftp-proxy/ftp-proxy/Makefile Sat May 14 15:02:50 2011 (r221895) @@ -13,6 +13,6 @@ CFLAGS+= -I${.CURDIR}/../../../sys/contr LDADD+= ${LIBEVENT} DPADD+= ${LIBEVENT} -WARNS?= 7 +WARNS?= 3 .include From owner-svn-src-projects@FreeBSD.ORG Sat May 14 17:56:13 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFCEB1065670; Sat, 14 May 2011 17:56:13 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FBCF8FC14; Sat, 14 May 2011 17:56:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EHuD3l010747; Sat, 14 May 2011 17:56:13 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EHuD97010745; Sat, 14 May 2011 17:56:13 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201105141756.p4EHuD97010745@svn.freebsd.org> From: Sean Bruno Date: Sat, 14 May 2011 17:56:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221901 - projects/largeSMP/sys/sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 17:56:13 -0000 Author: sbruno Date: Sat May 14 17:56:13 2011 New Revision: 221901 URL: http://svn.freebsd.org/changeset/base/221901 Log: Increase size of cg_count to allow us to utilize >128 CPUs. Pad cg_count and cg_children to keep the struct aligned Reviewed by: attilio@ Modified: projects/largeSMP/sys/sys/smp.h Modified: projects/largeSMP/sys/sys/smp.h ============================================================================== --- projects/largeSMP/sys/sys/smp.h Sat May 14 17:44:12 2011 (r221900) +++ projects/largeSMP/sys/sys/smp.h Sat May 14 17:56:13 2011 (r221901) @@ -35,8 +35,8 @@ struct cpu_group { struct cpu_group *cg_parent; /* Our parent group. */ struct cpu_group *cg_child; /* Optional children groups. */ cpuset_t cg_mask; /* Mask of cpus in this group. */ - int8_t cg_count; /* Count of cpus in this group. */ - int8_t cg_children; /* Number of children groups. */ + int32_t cg_count; /* Count of cpus in this group. */ + int16_t cg_children; /* Number of children groups. */ int8_t cg_level; /* Shared cache level. */ int8_t cg_flags; /* Traversal modifiers. */ }; From owner-svn-src-projects@FreeBSD.ORG Sat May 14 18:22:09 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52A74106564A; Sat, 14 May 2011 18:22:09 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 425BC8FC15; Sat, 14 May 2011 18:22:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EIM9p4011288; Sat, 14 May 2011 18:22:09 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EIM9qk011286; Sat, 14 May 2011 18:22:09 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105141822.p4EIM9qk011286@svn.freebsd.org> From: Attilio Rao Date: Sat, 14 May 2011 18:22:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221903 - projects/largeSMP/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 18:22:09 -0000 Author: attilio Date: Sat May 14 18:22:08 2011 New Revision: 221903 URL: http://svn.freebsd.org/changeset/base/221903 Log: Simplify the code here. Submitted by: jhb Modified: projects/largeSMP/sys/kern/kern_cpuset.c Modified: projects/largeSMP/sys/kern/kern_cpuset.c ============================================================================== --- projects/largeSMP/sys/kern/kern_cpuset.c Sat May 14 18:09:08 2011 (r221902) +++ projects/largeSMP/sys/kern/kern_cpuset.c Sat May 14 18:22:08 2011 (r221903) @@ -797,11 +797,7 @@ cpuset_init(void *arg) { cpuset_t mask; -#ifdef SMP mask = all_cpus; -#else - CPU_SETOF(0, &mask); -#endif if (cpuset_modify(cpuset_zero, &mask)) panic("Can't set initial cpuset mask.\n"); cpuset_zero->cs_flags |= CPU_SET_RDONLY; From owner-svn-src-projects@FreeBSD.ORG Sat May 14 18:37:24 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0A14106566C; Sat, 14 May 2011 18:37:24 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D8CE8FC0C; Sat, 14 May 2011 18:37:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EIbOIW011637; Sat, 14 May 2011 18:37:24 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EIbODA011628; Sat, 14 May 2011 18:37:24 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201105141837.p4EIbODA011628@svn.freebsd.org> From: Peter Grehan Date: Sat, 14 May 2011 18:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221905 - in projects/bhyve_ref/sys: amd64/amd64 amd64/conf amd64/include conf dev/blackhole dev/bvm kern modules modules/blackhole X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 18:37:24 -0000 Author: grehan Date: Sat May 14 18:37:24 2011 New Revision: 221905 URL: http://svn.freebsd.org/changeset/base/221905 Log: bhyve import part 2 of 2, guest kernel changes. This branch is now considered frozen: future bhyve development will take place in a branch off -CURRENT. sys/dev/bvm/bvm_console.c sys/dev/bvm/bvm_dbg.c - simple console driver/gdb debug port used for bringup. supported by user-space bhyve executable sys/conf/options.amd64 sys/amd64/amd64/minidump_machdep.c - allow NKPT to be set in the kernel config file sys/amd64/conf/GENERIC - mptable config options; bhyve user-space executable creates an mptable with number of CPUs, and optional vendor extension - add bvm console/debug - set NKPT to 512 to allow loading of large RAM disks from the loader - include kdb/gdb sys/amd64/amd64/local_apic.c sys/amd64/amd64/apic_vector.S sys/amd64/include/specialreg.h - if x2apic mode available, use MSRs to access the local APIC, otherwise fall back to 'classic' MMIO mode sys/amd64/amd64/mp_machdep.c - support AP spinup on CPU models that don't have real-mode support by overwriting the real-mode page with a message that supplies the bhyve user-space executable with enough information to start the AP directly in 64-bit mode. sys/amd64/amd64/vm_machdep.c - insert pause statements into cpu shutdown busy-wait loops sys/dev/blackhole/blackhole.c sys/modules/blackhole/Makefile - boot-time loadable module that claims all PCI bus/slot/funcs specified in an env var that are to be used for PCI passthrough sys/amd64/amd64/intr_machdep.c - allow round-robin assignment of device interrupts to CPUs to be disabled from the loader sys/amd64/include/bus.h - convert string ins/outs instructions to loops of individual in/out since bhyve doesn't support these yet sys/kern/subr_bus.c - if the device was no created with a fixed devclass, then remove it's association with the devclass it was associated with during probe. Otherwise, new drivers do not get a chance to probe/attach since the device will stay married to the first driver that it probed successfully but failed to attach. Sponsored by: NetApp, Inc. Added: projects/bhyve_ref/sys/dev/blackhole/ projects/bhyve_ref/sys/dev/blackhole/blackhole.c projects/bhyve_ref/sys/dev/bvm/ projects/bhyve_ref/sys/dev/bvm/bvm_console.c projects/bhyve_ref/sys/dev/bvm/bvm_dbg.c projects/bhyve_ref/sys/modules/blackhole/ projects/bhyve_ref/sys/modules/blackhole/Makefile Modified: projects/bhyve_ref/sys/amd64/amd64/apic_vector.S projects/bhyve_ref/sys/amd64/amd64/intr_machdep.c projects/bhyve_ref/sys/amd64/amd64/local_apic.c projects/bhyve_ref/sys/amd64/amd64/minidump_machdep.c projects/bhyve_ref/sys/amd64/amd64/mp_machdep.c projects/bhyve_ref/sys/amd64/amd64/vm_machdep.c projects/bhyve_ref/sys/amd64/conf/GENERIC projects/bhyve_ref/sys/amd64/include/bus.h projects/bhyve_ref/sys/amd64/include/specialreg.h projects/bhyve_ref/sys/conf/files.amd64 projects/bhyve_ref/sys/conf/options.amd64 projects/bhyve_ref/sys/kern/subr_bus.c projects/bhyve_ref/sys/modules/Makefile Modified: projects/bhyve_ref/sys/amd64/amd64/apic_vector.S ============================================================================== --- projects/bhyve_ref/sys/amd64/amd64/apic_vector.S Sat May 14 18:22:14 2011 (r221904) +++ projects/bhyve_ref/sys/amd64/amd64/apic_vector.S Sat May 14 18:37:24 2011 (r221905) @@ -55,7 +55,14 @@ IDTVEC(vec_name) ; \ PUSH_FRAME ; \ FAKE_MCOUNT(TF_RIP(%rsp)) ; \ movq lapic, %rdx ; /* pointer to local APIC */ \ + testq %rdx, %rdx; \ + jnz 3f; \ + movl $MSR_APIC_ISR ## index, %ecx; \ + rdmsr; \ + jmp 4f; \ +3: ; \ movl LA_ISR + 16 * (index)(%rdx), %eax ; /* load ISR */ \ +4: ; \ bsrl %eax, %eax ; /* index of highset set bit in ISR */ \ jz 2f ; \ addl $(32 * index),%eax ; \ @@ -117,6 +124,26 @@ IDTVEC(errorint) jmp doreti #ifdef SMP + +/* + * We assume that %rax is being saved/restored outside of this macro + */ +#define DO_EOI \ + movq lapic, %rax; \ + testq %rax, %rax; \ + jz 8f; \ + movl $0, LA_EOI(%rax); \ + jmp 9f; \ +8:; \ + pushq %rcx; \ + pushq %rdx; \ + xorl %edx, %edx; /* eax is already zero */ \ + movl $MSR_APIC_EOI, %ecx; \ + wrmsr; \ + popq %rdx; \ + popq %rcx; \ +9: + /* * Global address space TLB shootdown. */ @@ -128,8 +155,7 @@ IDTVEC(invltlb) movq %cr3, %rax /* invalidate the TLB */ movq %rax, %cr3 - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -148,8 +174,7 @@ IDTVEC(invlpg) movq smp_tlb_addr1, %rax invlpg (%rax) /* invalidate single page */ - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -173,8 +198,7 @@ IDTVEC(invlrng) cmpq %rax, %rdx jb 1b - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -193,8 +217,7 @@ IDTVEC(invlcache) wbinvd - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -210,9 +233,8 @@ IDTVEC(invlcache) IDTVEC(ipi_intr_bitmap_handler) PUSH_FRAME - movq lapic, %rdx - movl $0, LA_EOI(%rdx) /* End Of Interrupt to APIC */ - + DO_EOI + FAKE_MCOUNT(TF_RIP(%rsp)) call ipi_bitmap_handler @@ -227,8 +249,7 @@ IDTVEC(ipi_intr_bitmap_handler) IDTVEC(cpustop) PUSH_FRAME - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI call cpustop_handler jmp doreti @@ -241,8 +262,7 @@ IDTVEC(cpustop) IDTVEC(cpususpend) PUSH_FRAME - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI call cpususpend_handler @@ -259,7 +279,6 @@ IDTVEC(cpususpend) IDTVEC(rendezvous) PUSH_FRAME call smp_rendezvous_action - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI jmp doreti #endif /* SMP */ Modified: projects/bhyve_ref/sys/amd64/amd64/intr_machdep.c ============================================================================== --- projects/bhyve_ref/sys/amd64/amd64/intr_machdep.c Sat May 14 18:22:14 2011 (r221904) +++ projects/bhyve_ref/sys/amd64/amd64/intr_machdep.c Sat May 14 18:37:24 2011 (r221905) @@ -78,6 +78,8 @@ static STAILQ_HEAD(, pic) pics; #ifdef SMP static int assign_cpu; +static int round_robin_interrupts = 1; +TUNABLE_INT("round_robin_interrupts", &round_robin_interrupts); #endif static int intr_assign_cpu(void *arg, u_char cpu); @@ -460,6 +462,10 @@ intr_next_cpu(void) if (!assign_cpu) return (cpu_apic_ids[0]); + /* All interrupts go to the BSP if not allowed to round robin */ + if (!round_robin_interrupts) + return (cpu_apic_ids[0]); + mtx_lock_spin(&icu_lock); apic_id = cpu_apic_ids[current_cpu]; do { Modified: projects/bhyve_ref/sys/amd64/amd64/local_apic.c ============================================================================== --- projects/bhyve_ref/sys/amd64/amd64/local_apic.c Sat May 14 18:22:14 2011 (r221904) +++ projects/bhyve_ref/sys/amd64/amd64/local_apic.c Sat May 14 18:37:24 2011 (r221905) @@ -148,6 +148,7 @@ volatile lapic_t *lapic; vm_paddr_t lapic_paddr; static u_long lapic_timer_divisor, lapic_timer_period, lapic_timer_hz; static enum lapic_clock clockcoverage; +static int x2apic; static void lapic_enable(void); static void lapic_resume(struct pic *pic); @@ -156,6 +157,36 @@ static void lapic_timer_oneshot(u_int co static void lapic_timer_periodic(u_int count); static void lapic_timer_set_divisor(u_int divisor); static uint32_t lvt_mode(struct lapic *la, u_int pin, uint32_t value); +static uint32_t lapic_version(void); +static uint32_t lapic_ldr(void); +static uint32_t lapic_dfr(void); +static uint32_t lapic_lvt_lint0(void); +static void lapic_set_lvt_lint0(uint32_t value); +static uint32_t lapic_lvt_lint1(void); +static void lapic_set_lvt_lint1(uint32_t value); +static uint32_t lapic_tpr(void); +static uint32_t lapic_svr(void); +static void lapic_set_svr(uint32_t value); +static uint32_t lapic_lvt_timer(void); +static void lapic_set_lvt_timer(uint32_t value); +static uint32_t lapic_lvt_thermal(void); +static uint32_t lapic_lvt_error(void); +static void lapic_set_lvt_error(uint32_t value); +static uint32_t lapic_lvt_pcint(void); +static void lapic_set_lvt_pcint(uint32_t value); +static uint32_t lapic_esr(void); +static void lapic_set_esr(uint32_t value); +static uint32_t lapic_ccr_timer(void); +static void lapic_set_dcr_timer(uint32_t value); +static void lapic_set_icr_timer(uint32_t value); +uint32_t lapic_irr(int num); +uint32_t lapic_tmr(int num); +uint32_t lapic_isr(int num); +static uint32_t lapic_icr_lo(void); +static void lapic_set_icr_lo(uint32_t value); +static uint32_t lapic_icr_hi(void); +static void lapic_set_icr_hi(uint32_t value); +static boolean_t lapic_missing(void); struct pic lapic_pic = { .pic_resume = lapic_resume }; @@ -206,12 +237,20 @@ lvt_mode(struct lapic *la, u_int pin, ui void lapic_init(vm_paddr_t addr) { - - /* Map the local APIC and setup the spurious interrupt handler. */ - KASSERT(trunc_page(addr) == addr, - ("local APIC not aligned on a page boundary")); - lapic = pmap_mapdev(addr, sizeof(lapic_t)); - lapic_paddr = addr; + if ((cpu_feature2 & CPUID2_X2APIC) != 0 && + (rdmsr(MSR_APICBASE) & APICBASE_X2APIC) != 0) { + x2apic = 1; + if (bootverbose) + printf("Local APIC access using x2APIC MSRs\n"); + } else { + /* + * Map the local APIC and setup the spurious interrupt handler. + */ + KASSERT(trunc_page(addr) == addr, + ("local APIC not aligned on a page boundary")); + lapic = pmap_mapdev(addr, sizeof(lapic_t)); + lapic_paddr = addr; + } setidt(APIC_SPURIOUS_INT, IDTVEC(spuriousint), SDT_SYSIGT, SEL_KPL, 0); /* Perform basic initialization of the BSP's local APIC. */ @@ -276,12 +315,12 @@ lapic_dump(const char* str) printf("cpu%d %s:\n", PCPU_GET(cpuid), str); printf(" ID: 0x%08x VER: 0x%08x LDR: 0x%08x DFR: 0x%08x\n", - lapic->id, lapic->version, lapic->ldr, lapic->dfr); + lapic_id(), lapic_version(), lapic_ldr(), lapic_dfr()); printf(" lint0: 0x%08x lint1: 0x%08x TPR: 0x%08x SVR: 0x%08x\n", - lapic->lvt_lint0, lapic->lvt_lint1, lapic->tpr, lapic->svr); + lapic_lvt_lint0(), lapic_lvt_lint1(), lapic_tpr(), lapic_svr()); printf(" timer: 0x%08x therm: 0x%08x err: 0x%08x pmc: 0x%08x\n", - lapic->lvt_timer, lapic->lvt_thermal, lapic->lvt_error, - lapic->lvt_pcint); + lapic_lvt_timer(), lapic_lvt_thermal(), lapic_lvt_error(), + lapic_lvt_pcint()); } void @@ -295,7 +334,7 @@ lapic_setup(int boot) la = &lapics[lapic_id()]; KASSERT(la->la_present, ("missing APIC structure")); eflags = intr_disable(); - maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + maxlvt = (lapic_version() & APIC_VER_MAXLVT) >> MAXLVTSHIFT; /* Initialize the TPR to allow all interrupts. */ lapic_set_tpr(0); @@ -304,15 +343,15 @@ lapic_setup(int boot) lapic_enable(); /* Program LINT[01] LVT entries. */ - lapic->lvt_lint0 = lvt_mode(la, LVT_LINT0, lapic->lvt_lint0); - lapic->lvt_lint1 = lvt_mode(la, LVT_LINT1, lapic->lvt_lint1); + lapic_set_lvt_lint0(lvt_mode(la, LVT_LINT0, lapic_lvt_lint0())); + lapic_set_lvt_lint1(lvt_mode(la, LVT_LINT1, lapic_lvt_lint1())); /* Program the PMC LVT entry if present. */ if (maxlvt >= LVT_PMC) - lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); + lapic_set_lvt_pcint(lvt_mode(la, LVT_PMC, lapic_lvt_pcint())); /* Program timer LVT and setup handler. */ - lapic->lvt_timer = lvt_mode(la, LVT_TIMER, lapic->lvt_timer); + lapic_set_lvt_timer(lvt_mode(la, LVT_TIMER, lapic_lvt_timer())); if (boot) { snprintf(buf, sizeof(buf), "cpu%d: timer", PCPU_GET(cpuid)); intrcnt_add(buf, &la->la_timer_count); @@ -328,8 +367,8 @@ lapic_setup(int boot) } /* Program error LVT and clear any existing errors. */ - lapic->lvt_error = lvt_mode(la, LVT_ERROR, lapic->lvt_error); - lapic->esr = 0; + lapic_set_lvt_error(lvt_mode(la, LVT_ERROR, lapic_lvt_error())); + lapic_set_esr(0); /* XXX: Thermal LVT */ @@ -342,9 +381,9 @@ lapic_reenable_pmc(void) #ifdef HWPMC_HOOKS uint32_t value; - value = lapic->lvt_pcint; + value = lapic_lvt_pcint(); value &= ~APIC_LVT_M; - lapic->lvt_pcint = value; + lapic_set_lvt_pcint(value); #endif } @@ -355,7 +394,7 @@ lapic_update_pmc(void *dummy) struct lapic *la; la = &lapics[lapic_id()]; - lapic->lvt_pcint = lvt_mode(la, LVT_PMC, lapic->lvt_pcint); + lapic_set_lvt_pcint(lvt_mode(la, LVT_PMC, lapic_lvt_pcint())); } #endif @@ -366,11 +405,11 @@ lapic_enable_pmc(void) u_int32_t maxlvt; /* Fail if the local APIC is not present. */ - if (lapic == NULL) + if (lapic_missing()) return (0); /* Fail if the PMC LVT is not present. */ - maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + maxlvt = (lapic_version() & APIC_VER_MAXLVT) >> MAXLVTSHIFT; if (maxlvt < LVT_PMC) return (0); @@ -400,11 +439,11 @@ lapic_disable_pmc(void) u_int32_t maxlvt; /* Fail if the local APIC is not present. */ - if (lapic == NULL) + if (lapic_missing()) return; /* Fail if the PMC LVT is not present. */ - maxlvt = (lapic->version & APIC_VER_MAXLVT) >> MAXLVTSHIFT; + maxlvt = (lapic_version() & APIC_VER_MAXLVT) >> MAXLVTSHIFT; if (maxlvt < LVT_PMC) return; @@ -435,7 +474,7 @@ lapic_setup_clock(enum lapic_clock srcsd MPASS(srcsdes != LAPIC_CLOCK_NONE); /* Can't drive the timer without a local APIC. */ - if (lapic == NULL || + if (lapic_missing() || (resource_int_value("apic", 0, "clock", &i) == 0 && i == 0)) { clockcoverage = LAPIC_CLOCK_NONE; return (clockcoverage); @@ -449,7 +488,7 @@ lapic_setup_clock(enum lapic_clock srcsd lapic_timer_set_divisor(lapic_timer_divisor); lapic_timer_oneshot(APIC_TIMER_MAX_COUNT); DELAY(2000000); - value = APIC_TIMER_MAX_COUNT - lapic->ccr_timer; + value = APIC_TIMER_MAX_COUNT - lapic_ccr_timer(); if (value != APIC_TIMER_MAX_COUNT) break; lapic_timer_divisor <<= 1; @@ -509,9 +548,9 @@ lapic_disable(void) uint32_t value; /* Software disable the local APIC. */ - value = lapic->svr; + value = lapic_svr(); value &= ~APIC_SVR_SWEN; - lapic->svr = value; + lapic_set_svr(value); } static void @@ -520,10 +559,10 @@ lapic_enable(void) u_int32_t value; /* Program the spurious vector to enable the local APIC. */ - value = lapic->svr; + value = lapic_svr(); value &= ~(APIC_SVR_VECTOR | APIC_SVR_FOCUS); value |= (APIC_SVR_FEN | APIC_SVR_SWEN | APIC_SPURIOUS_INT); - lapic->svr = value; + lapic_set_svr(value); } /* Reset the local APIC on the BSP during resume. */ @@ -534,19 +573,342 @@ lapic_resume(struct pic *pic) lapic_setup(0); } +static uint32_t +lapic_version(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_VERSION)); + else + return (lapic->version); +} + +static uint32_t +lapic_ldr(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LDR)); + else + return (lapic->ldr); +} + +static uint32_t +lapic_dfr(void) +{ + + if (x2apic) + return (0xffffffff); /* DFR not available in x2APIC mode */ + else + return (lapic->dfr); +} + +static uint32_t +lapic_lvt_lint0(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LVT_LINT0)); + else + return (lapic->lvt_lint0); +} + +static void +lapic_set_lvt_lint0(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_LVT_LINT0, value); + else + lapic->lvt_lint0 = value; +} + +static uint32_t +lapic_lvt_lint1(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LVT_LINT1)); + else + return (lapic->lvt_lint1); +} + +static void +lapic_set_lvt_lint1(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_LVT_LINT1, value); + else + lapic->lvt_lint1 = value; +} + +static uint32_t +lapic_tpr(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_TPR)); + else + return (lapic->tpr); +} + +static uint32_t +lapic_svr(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_SVR)); + else + return (lapic->svr); +} + +static void +lapic_set_svr(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_SVR, value); + else + lapic->svr = value; +} + +static uint32_t +lapic_lvt_timer(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LVT_TIMER)); + else + return (lapic->lvt_timer); +} + +static void +lapic_set_lvt_timer(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_LVT_TIMER, value); + else + lapic->lvt_timer = value; +} + +static uint32_t +lapic_lvt_thermal(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LVT_THERMAL)); + else + return (lapic->lvt_thermal); +} + +static uint32_t +lapic_lvt_error(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LVT_ERROR)); + else + return (lapic->lvt_error); +} + +static void +lapic_set_lvt_error(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_LVT_ERROR, value); + else + lapic->lvt_error = value; +} + +static uint32_t +lapic_lvt_pcint(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_LVT_PCINT)); + else + return (lapic->lvt_pcint); +} + +static void +lapic_set_lvt_pcint(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_LVT_PCINT, value); + else + lapic->lvt_pcint = value; +} + +static uint32_t +lapic_esr(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_ESR)); + else + return (lapic->esr); +} + +static void +lapic_set_esr(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_ESR, value); + else + lapic->esr = value; +} + +static uint32_t +lapic_ccr_timer(void) +{ + + if (x2apic) + return (rdmsr(MSR_APIC_CCR_TIMER)); + else + return (lapic->ccr_timer); +} + +static void +lapic_set_dcr_timer(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_DCR_TIMER, value); + else + lapic->dcr_timer = value; +} + +static void +lapic_set_icr_timer(uint32_t value) +{ + + if (x2apic) + wrmsr(MSR_APIC_ICR_TIMER, value); + else + lapic->icr_timer = value; +} + +uint32_t +lapic_tmr(int num) +{ + int msr; + volatile uint32_t *regptr; + + KASSERT(num >= 0 && num < 8, ("lapic_tmr: invalid num %d", num)); + + if (x2apic) { + msr = MSR_APIC_TMR0 + num; + return (rdmsr(msr)); + } else { + regptr = &lapic->tmr0; + return (regptr[num * 4]); + } +} + +uint32_t +lapic_irr(int num) +{ + int msr; + volatile uint32_t *regptr; + + KASSERT(num >= 0 && num < 8, ("lapic_irr: invalid num %d", num)); + + if (x2apic) { + msr = MSR_APIC_IRR0 + num; + return (rdmsr(msr)); + } else { + regptr = &lapic->irr0; + return (regptr[num * 4]); + } +} + +uint32_t +lapic_isr(int num) +{ + int msr; + volatile uint32_t *regptr; + + KASSERT(num >= 0 && num < 8, ("lapic_isr: invalid num %d", num)); + + if (x2apic) { + msr = MSR_APIC_ISR0 + num; + return (rdmsr(msr)); + } else { + regptr = &lapic->isr0; + return (regptr[num * 4]); + } +} + +static uint32_t icr_hi_stashed[MAXCPU]; + +static uint32_t +lapic_icr_lo(void) +{ + + if (x2apic) + return (0); + else + return (lapic->icr_lo); +} + +static void +lapic_set_icr_lo(uint32_t value) +{ + + if (x2apic) { + wrmsr(MSR_APIC_ICR, + (uint64_t)icr_hi_stashed[curcpu] << 32 | value); + } else + lapic->icr_lo = value; +} + +static uint32_t +lapic_icr_hi(void) +{ + + if (x2apic) + return (0); + else + return (lapic->icr_hi); +} + +static void +lapic_set_icr_hi(uint32_t value) +{ + if (x2apic) + icr_hi_stashed[curcpu] = value >> APIC_ID_SHIFT; /* XXX */ + else + lapic->icr_hi = value; +} + +static boolean_t +lapic_missing(void) +{ + + if (x2apic == 0 && lapic == NULL) + return (TRUE); + else + return (FALSE); +} + int lapic_id(void) { - KASSERT(lapic != NULL, ("local APIC is not mapped")); - return (lapic->id >> APIC_ID_SHIFT); + if (x2apic) + return (rdmsr(MSR_APIC_ID)); + else + return (lapic->id >> APIC_ID_SHIFT); } int lapic_intr_pending(u_int vector) { - volatile u_int32_t *irr; - /* * The IRR registers are an array of 128-bit registers each of * which only describes 32 interrupts in the low 32 bits.. Thus, @@ -556,8 +918,7 @@ lapic_intr_pending(u_int vector) * modulus the vector by 32 to determine the individual bit to * test. */ - irr = &lapic->irr0; - return (irr[(vector / 32) * 4] & 1 << (vector % 32)); + return (lapic_irr(vector / 32) & 1 << (vector % 32)); } void @@ -713,13 +1074,19 @@ void lapic_set_tpr(u_int vector) { #ifdef CHEAP_TPR - lapic->tpr = vector; + if (x2apic) + wrmsr(MSR_APIC_TPR, vector); + else + lapic->tpr = vector; #else u_int32_t tpr; - tpr = lapic->tpr & ~APIC_TPR_PRIO; + tpr = lapic_tpr() & ~APIC_TPR_PRIO; tpr |= vector; - lapic->tpr = tpr; + if (x2apic) + wrmsr(MSR_APIC_TPR, tpr); + else + lapic->tpr = tpr; #endif } @@ -727,7 +1094,10 @@ void lapic_eoi(void) { - lapic->eoi = 0; + if (x2apic) + wrmsr(MSR_APIC_EOI, 0); + else + lapic->eoi = 0; } void @@ -819,7 +1189,7 @@ lapic_timer_set_divisor(u_int divisor) KASSERT(powerof2(divisor), ("lapic: invalid divisor %u", divisor)); KASSERT(ffs(divisor) <= sizeof(lapic_timer_divisors) / sizeof(u_int32_t), ("lapic: invalid divisor %u", divisor)); - lapic->dcr_timer = lapic_timer_divisors[ffs(divisor) - 1]; + lapic_set_dcr_timer(lapic_timer_divisors[ffs(divisor) - 1]); } static void @@ -827,11 +1197,11 @@ lapic_timer_oneshot(u_int count) { u_int32_t value; - value = lapic->lvt_timer; + value = lapic_lvt_timer(); value &= ~APIC_LVTT_TM; value |= APIC_LVTT_TM_ONE_SHOT; - lapic->lvt_timer = value; - lapic->icr_timer = count; + lapic_set_lvt_timer(value); + lapic_set_icr_timer(count); } static void @@ -839,11 +1209,11 @@ lapic_timer_periodic(u_int count) { u_int32_t value; - value = lapic->lvt_timer; + value = lapic_lvt_timer(); value &= ~APIC_LVTT_TM; value |= APIC_LVTT_TM_PERIODIC; - lapic->lvt_timer = value; - lapic->icr_timer = count; + lapic_set_lvt_timer(value); + lapic_set_icr_timer(count); } static void @@ -851,9 +1221,9 @@ lapic_timer_enable_intr(void) { u_int32_t value; - value = lapic->lvt_timer; + value = lapic_lvt_timer(); value &= ~APIC_LVT_M; - lapic->lvt_timer = value; + lapic_set_lvt_timer(value); } void @@ -867,8 +1237,8 @@ lapic_handle_error(void) * to update its value to indicate any errors that have * occurred since the previous write to the register. */ - lapic->esr = 0; - esr = lapic->esr; + lapic_set_esr(0); + esr = lapic_esr(); printf("CPU%d: local APIC error 0x%x\n", PCPU_GET(cpuid), esr); lapic_eoi(); @@ -1115,17 +1485,17 @@ DB_SHOW_COMMAND(lapic, db_show_lapic) uint32_t v; db_printf("lapic ID = %d\n", lapic_id()); - v = lapic->version; + v = lapic_version(); db_printf("version = %d.%d\n", (v & APIC_VER_VERSION) >> 4, v & 0xf); db_printf("max LVT = %d\n", (v & APIC_VER_MAXLVT) >> MAXLVTSHIFT); - v = lapic->svr; + v = lapic_svr(); db_printf("SVR = %02x (%s)\n", v & APIC_SVR_VECTOR, v & APIC_SVR_ENABLE ? "enabled" : "disabled"); - db_printf("TPR = %02x\n", lapic->tpr); + db_printf("TPR = %02x\n", lapic_tpr()); #define dump_field(prefix, index) \ - dump_mask(__XSTRING(prefix ## index), lapic->prefix ## index, \ + dump_mask(__XSTRING(prefix ## index), lapic_ ## prefix(index), \ index * 32) db_printf("In-service Interrupts:\n"); @@ -1300,7 +1670,7 @@ lapic_ipi_wait(int delay) } else incr = 1; for (x = 0; x < delay; x += incr) { - if ((lapic->icr_lo & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) + if ((lapic_icr_lo() & APIC_DELSTAT_MASK) == APIC_DELSTAT_IDLE) return (1); ia32_pause(); } @@ -1313,7 +1683,7 @@ lapic_ipi_raw(register_t icrlo, u_int de register_t value, eflags; /* XXX: Need more sanity checking of icrlo? */ - KASSERT(lapic != NULL, ("%s called too early", __func__)); + KASSERT(!lapic_missing(), ("%s called too early", __func__)); KASSERT((dest & ~(APIC_ID_MASK >> APIC_ID_SHIFT)) == 0, ("%s: invalid dest field", __func__)); KASSERT((icrlo & APIC_ICRLO_RESV_MASK) == 0, @@ -1322,17 +1692,17 @@ lapic_ipi_raw(register_t icrlo, u_int de /* Set destination in ICR HI register if it is being used. */ eflags = intr_disable(); if ((icrlo & APIC_DEST_MASK) == APIC_DEST_DESTFLD) { - value = lapic->icr_hi; + value = lapic_icr_hi(); value &= ~APIC_ID_MASK; value |= dest << APIC_ID_SHIFT; - lapic->icr_hi = value; + lapic_set_icr_hi(value); } /* Program the contents of the IPI and dispatch it. */ - value = lapic->icr_lo; + value = lapic_icr_lo(); value &= APIC_ICRLO_RESV_MASK; value |= icrlo; - lapic->icr_lo = value; + lapic_set_icr_lo(value); intr_restore(eflags); } @@ -1409,7 +1779,7 @@ lapic_ipi_vectored(u_int vector, int des printf("APIC: IPI might be stuck\n"); #else /* !needsattention */ /* Wait until mesage is sent without a timeout. */ - while (lapic->icr_lo & APIC_DELSTAT_PEND) + while (lapic_icr_lo() & APIC_DELSTAT_PEND) ia32_pause(); #endif /* needsattention */ } Modified: projects/bhyve_ref/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- projects/bhyve_ref/sys/amd64/amd64/minidump_machdep.c Sat May 14 18:22:14 2011 (r221904) +++ projects/bhyve_ref/sys/amd64/amd64/minidump_machdep.c Sat May 14 18:37:24 2011 (r221905) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_pmap.h" #include #include #include Modified: projects/bhyve_ref/sys/amd64/amd64/mp_machdep.c ============================================================================== --- projects/bhyve_ref/sys/amd64/amd64/mp_machdep.c Sat May 14 18:22:14 2011 (r221904) +++ projects/bhyve_ref/sys/amd64/amd64/mp_machdep.c Sat May 14 18:37:24 2011 (r221905) @@ -140,6 +140,26 @@ struct cpu_info { int cpu_apic_ids[MAXCPU]; int apic_cpuids[MAX_APIC_ID + 1]; +/* + * Trampoline for hypervisor direct 64-bit jump. + * + * 0 - signature for guest->host verification + * 8 - virtual address of this page + * 16 - instruction virtual address + * 24 - stack pointer virtual address + * 32 - CR3, physical address of kernel page table + * 40 - 24-byte area for null/code/data GDT entries + */ +#define MP_V64T_SIG 0xcafebabecafebabeULL +struct mp_v64tramp { + uint64_t mt_sig; + uint64_t mt_virt; + uint64_t mt_eip; + uint64_t mt_rsp; + uint64_t mt_cr3; + uint64_t mt_gdtr[3]; +}; + /* Holds pending bitmap based IPIs per CPU */ static volatile u_int cpu_ipi_pending[MAXCPU]; @@ -873,6 +893,29 @@ start_all_aps(void) bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 8; bootAP = cpu; + /* + * If running in a VM that doesn't support the unrestricted + * guest 16-bit mode, forget most of the above and create + * the data block that allows the hypervisor to direct-jump + * into 64-bit mode. Copy this over the top of the 16-bit + * bootstrap. The startup-IPI informs the hypervisor which + * physical page this data block lies in. The hypervisor + * will then use the block to initialise register state of + * the AP in an almost identical fashion to how it builds + * the BSP initial register state. + */ + if (testenv("hw.use_bvm_mptramp")) { + struct mp_v64tramp mv; + + bzero(&mv, sizeof(mv)); + mv.mt_sig = MP_V64T_SIG; + mv.mt_virt = (uint64_t) va; + mv.mt_eip = (uint64_t) init_secondary; + mv.mt_rsp = (uint64_t) bootSTK; + mv.mt_cr3 = KPML4phys; + bcopy(&mv, (void *) va, sizeof(mv)); + } + /* attempt to start the Application Processor */ if (!start_ap(apic_id)) { /* restore the warmstart vector */ Modified: projects/bhyve_ref/sys/amd64/amd64/vm_machdep.c ============================================================================== --- projects/bhyve_ref/sys/amd64/amd64/vm_machdep.c Sat May 14 18:22:14 2011 (r221904) +++ projects/bhyve_ref/sys/amd64/amd64/vm_machdep.c Sat May 14 18:37:24 2011 (r221905) @@ -507,8 +507,10 @@ cpu_reset_proxy() { cpu_reset_proxy_active = 1; - while (cpu_reset_proxy_active == 1) + while (cpu_reset_proxy_active == 1) { + ia32_pause(); ; /* Wait for other cpu to see that we've started */ + } stop_cpus((1< Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AADAC1065672; Sat, 14 May 2011 18:58:26 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 80AD98FC18; Sat, 14 May 2011 18:58:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EIwQgx012109; Sat, 14 May 2011 18:58:26 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EIwQmq012108; Sat, 14 May 2011 18:58:26 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201105141858.p4EIwQmq012108@svn.freebsd.org> From: Peter Grehan Date: Sat, 14 May 2011 18:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221906 - projects/bhyve X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 18:58:26 -0000 Author: grehan Date: Sat May 14 18:58:26 2011 New Revision: 221906 URL: http://svn.freebsd.org/changeset/base/221906 Log: Create project branch for bhyve. Added: - copied from r221905, head/ Directory Properties: projects/bhyve/ (props changed) From owner-svn-src-projects@FreeBSD.ORG Sat May 14 19:20:14 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C528106566C; Sat, 14 May 2011 19:20:14 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 783A88FC0A; Sat, 14 May 2011 19:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EJKE0i012839; Sat, 14 May 2011 19:20:14 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EJKEvT012818; Sat, 14 May 2011 19:20:14 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105141920.p4EJKEvT012818@svn.freebsd.org> From: Attilio Rao Date: Sat, 14 May 2011 19:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221910 - in projects/largeSMP: . contrib/top etc sbin/hastctl sbin/hastd share/mk sys/conf sys/dev/ath/ath_hal sys/dev/ath/ath_hal/ar5416 sys/dev/ath/ath_hal/ar9002 sys/dev/usb sys/ia6... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 19:20:14 -0000 Author: attilio Date: Sat May 14 19:20:13 2011 New Revision: 221910 URL: http://svn.freebsd.org/changeset/base/221910 Log: MFC Added: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_9287.c - copied unchanged from r221906, head/sys/dev/ath/ath_hal/ah_eeprom_9287.c projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_9287.h - copied unchanged from r221906, head/sys/dev/ath/ath_hal/ah_eeprom_9287.h projects/largeSMP/tools/regression/bin/sh/parser/heredoc10.0 - copied unchanged from r221906, head/tools/regression/bin/sh/parser/heredoc10.0 projects/largeSMP/tools/regression/bin/sh/parser/heredoc9.0 - copied unchanged from r221906, head/tools/regression/bin/sh/parser/heredoc9.0 Modified: projects/largeSMP/MAINTAINERS projects/largeSMP/etc/network.subr projects/largeSMP/sbin/hastctl/hastctl.c projects/largeSMP/sbin/hastd/primary.c projects/largeSMP/sbin/hastd/secondary.c projects/largeSMP/sbin/hastd/subr.c projects/largeSMP/sbin/hastd/subr.h projects/largeSMP/sys/conf/kern.mk projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom.h projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v1.c projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.c projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v3.c projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v4k.c projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416phy.h projects/largeSMP/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/largeSMP/sys/dev/usb/usbdevs projects/largeSMP/sys/ia64/ia64/exception.S projects/largeSMP/sys/ia64/ia64/syscall.S projects/largeSMP/sys/ia64/include/ia64_cpu.h projects/largeSMP/sys/ia64/include/pcpu.h projects/largeSMP/sys/netinet/sctp_output.c projects/largeSMP/sys/netinet/sctp_output.h projects/largeSMP/sys/netinet/tcp_input.c projects/largeSMP/sys/netinet/tcp_timewait.c projects/largeSMP/tools/tools/nanobsd/nanobsd.sh projects/largeSMP/usr.bin/fstat/fuser.1 projects/largeSMP/usr.sbin/newsyslog/newsyslog.c projects/largeSMP/usr.sbin/newsyslog/newsyslog.conf.5 Directory Properties: projects/largeSMP/ (props changed) projects/largeSMP/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/contrib/bind9/ (props changed) projects/largeSMP/contrib/binutils/ (props changed) projects/largeSMP/contrib/bzip2/ (props changed) projects/largeSMP/contrib/dialog/ (props changed) projects/largeSMP/contrib/ee/ (props changed) projects/largeSMP/contrib/expat/ (props changed) projects/largeSMP/contrib/file/ (props changed) projects/largeSMP/contrib/gcc/ (props changed) projects/largeSMP/contrib/gdb/ (props changed) projects/largeSMP/contrib/gdtoa/ (props changed) projects/largeSMP/contrib/gnu-sort/ (props changed) projects/largeSMP/contrib/groff/ (props changed) projects/largeSMP/contrib/less/ (props changed) projects/largeSMP/contrib/libpcap/ (props changed) projects/largeSMP/contrib/libstdc++/ (props changed) projects/largeSMP/contrib/llvm/ (props changed) projects/largeSMP/contrib/llvm/tools/clang/ (props changed) projects/largeSMP/contrib/ncurses/ (props changed) projects/largeSMP/contrib/netcat/ (props changed) projects/largeSMP/contrib/ntp/ (props changed) projects/largeSMP/contrib/one-true-awk/ (props changed) projects/largeSMP/contrib/openbsm/ (props changed) projects/largeSMP/contrib/openpam/ (props changed) projects/largeSMP/contrib/pf/ (props changed) projects/largeSMP/contrib/sendmail/ (props changed) projects/largeSMP/contrib/tcpdump/ (props changed) projects/largeSMP/contrib/tcsh/ (props changed) projects/largeSMP/contrib/top/ (props changed) projects/largeSMP/contrib/top/install-sh (props changed) projects/largeSMP/contrib/tzcode/stdtime/ (props changed) projects/largeSMP/contrib/tzcode/zic/ (props changed) projects/largeSMP/contrib/tzdata/ (props changed) projects/largeSMP/contrib/wpa/ (props changed) projects/largeSMP/contrib/xz/ (props changed) projects/largeSMP/crypto/openssh/ (props changed) projects/largeSMP/crypto/openssl/ (props changed) projects/largeSMP/gnu/lib/ (props changed) projects/largeSMP/gnu/usr.bin/binutils/ (props changed) projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed) projects/largeSMP/gnu/usr.bin/gdb/ (props changed) projects/largeSMP/lib/libc/ (props changed) projects/largeSMP/lib/libc/stdtime/ (props changed) projects/largeSMP/lib/libutil/ (props changed) projects/largeSMP/lib/libz/ (props changed) projects/largeSMP/sbin/ (props changed) projects/largeSMP/sbin/ipfw/ (props changed) projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed) projects/largeSMP/share/zoneinfo/ (props changed) projects/largeSMP/sys/ (props changed) projects/largeSMP/sys/amd64/include/xen/ (props changed) projects/largeSMP/sys/boot/ (props changed) projects/largeSMP/sys/boot/i386/efi/ (props changed) projects/largeSMP/sys/boot/ia64/efi/ (props changed) projects/largeSMP/sys/boot/ia64/ski/ (props changed) projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed) projects/largeSMP/sys/boot/powerpc/ofw/ (props changed) projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed) projects/largeSMP/sys/conf/ (props changed) projects/largeSMP/sys/contrib/dev/acpica/ (props changed) projects/largeSMP/sys/contrib/octeon-sdk/ (props changed) projects/largeSMP/sys/contrib/pf/ (props changed) projects/largeSMP/sys/contrib/x86emu/ (props changed) projects/largeSMP/usr.bin/calendar/ (props changed) projects/largeSMP/usr.bin/csup/ (props changed) projects/largeSMP/usr.bin/procstat/ (props changed) projects/largeSMP/usr.sbin/ndiscvt/ (props changed) projects/largeSMP/usr.sbin/zic/ (props changed) Modified: projects/largeSMP/MAINTAINERS ============================================================================== --- projects/largeSMP/MAINTAINERS Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/MAINTAINERS Sat May 14 19:20:13 2011 (r221910) @@ -108,7 +108,7 @@ linux emul emulation Please discuss chan bs{diff,patch} cperciva Pre-commit review requested. portsnap cperciva Pre-commit review requested. freebsd-update cperciva Pre-commit review requested. -openssl - No non-upstream commits should be done. +openssl benl Pre-commit review requested. sys/netgraph/bluetooth emax Pre-commit review preferred. lib/libbluetooth emax Pre-commit review preferred. lib/libsdp emax Pre-commit review preferred. Modified: projects/largeSMP/etc/network.subr ============================================================================== --- projects/largeSMP/etc/network.subr Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/etc/network.subr Sat May 14 19:20:13 2011 (r221910) @@ -1333,38 +1333,14 @@ get_default_if() # Echo decimal number $arg (single digit) in hexadecimal format. hexdigit() { - if [ $1 -lt 10 ]; then - echo $1 - else - case $1 in - 10) echo a ;; - 11) echo b ;; - 12) echo c ;; - 13) echo d ;; - 14) echo e ;; - 15) echo f ;; - esac - fi + printf '%x\n' "$1" } # hexprint arg # Echo decimal number $arg (multiple digits) in hexadecimal format. hexprint() { - local val str dig - val=$1 - str='' - dig=`hexdigit $((${val} & 15))` - str=${dig}${str} - val=$((${val} >> 4)) - - while [ ${val} -gt 0 ]; do - dig=`hexdigit $((${val} & 15))` - str=${dig}${str} - val=$((${val} >> 4)) - done - - echo ${str} + printf '%x\n' "$1" } is_wired_interface() Modified: projects/largeSMP/sbin/hastctl/hastctl.c ============================================================================== --- projects/largeSMP/sbin/hastctl/hastctl.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sbin/hastctl/hastctl.c Sat May 14 19:20:13 2011 (r221910) @@ -480,7 +480,7 @@ main(int argc, char *argv[]) cfg->hc_controladdr); } - if (drop_privs(true) != 0) + if (drop_privs(NULL) != 0) exit(EX_CONFIG); /* Send the command to the server... */ Modified: projects/largeSMP/sbin/hastd/primary.c ============================================================================== --- projects/largeSMP/sbin/hastd/primary.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sbin/hastd/primary.c Sat May 14 19:20:13 2011 (r221910) @@ -904,7 +904,7 @@ hastd_primary(struct hast_resource *res) init_ggate(res); init_environment(res); - if (drop_privs(true) != 0) { + if (drop_privs(res) != 0) { cleanup(res); exit(EX_CONFIG); } Modified: projects/largeSMP/sbin/hastd/secondary.c ============================================================================== --- projects/largeSMP/sbin/hastd/secondary.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sbin/hastd/secondary.c Sat May 14 19:20:13 2011 (r221910) @@ -436,7 +436,7 @@ hastd_secondary(struct hast_resource *re init_local(res); init_environment(); - if (drop_privs(true) != 0) + if (drop_privs(res) != 0) exit(EX_CONFIG); pjdlog_info("Privileges successfully dropped."); Modified: projects/largeSMP/sbin/hastd/subr.c ============================================================================== --- projects/largeSMP/sbin/hastd/subr.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sbin/hastd/subr.c Sat May 14 19:20:13 2011 (r221910) @@ -32,9 +32,10 @@ __FBSDID("$FreeBSD$"); #include -#include +#include #include #include +#include #include #include @@ -147,21 +148,15 @@ role2str(int role) } int -drop_privs(bool usecapsicum) +drop_privs(struct hast_resource *res) { + char jailhost[sizeof(res->hr_name) * 2]; + struct jail jailst; struct passwd *pw; uid_t ruid, euid, suid; gid_t rgid, egid, sgid; gid_t gidset[1]; - - if (usecapsicum) { - if (cap_enter() == 0) { - pjdlog_debug(1, - "Privileges successfully dropped using capsicum."); - return (0); - } - pjdlog_errno(LOG_WARNING, "Unable to sandbox using capsicum"); - } + bool capsicum, jailed; /* * According to getpwnam(3) we have to clear errno before calling the @@ -181,10 +176,34 @@ drop_privs(bool usecapsicum) return (-1); } } - if (chroot(pw->pw_dir) == -1) { - KEEP_ERRNO(pjdlog_errno(LOG_ERR, - "Unable to change root directory to %s", pw->pw_dir)); - return (-1); + + bzero(&jailst, sizeof(jailst)); + jailst.version = JAIL_API_VERSION; + jailst.path = pw->pw_dir; + if (res == NULL) { + (void)snprintf(jailhost, sizeof(jailhost), "hastctl"); + } else { + (void)snprintf(jailhost, sizeof(jailhost), "hastd: %s (%s)", + res->hr_name, role2str(res->hr_role)); + } + jailst.hostname = jailhost; + jailst.jailname = NULL; + jailst.ip4s = 0; + jailst.ip4 = NULL; + jailst.ip6s = 0; + jailst.ip6 = NULL; + if (jail(&jailst) >= 0) { + jailed = true; + } else { + jailed = false; + pjdlog_errno(LOG_WARNING, + "Unable to jail to directory to %s", pw->pw_dir); + if (chroot(pw->pw_dir) == -1) { + KEEP_ERRNO(pjdlog_errno(LOG_ERR, + "Unable to change root directory to %s", + pw->pw_dir)); + return (-1); + } } PJDLOG_VERIFY(chdir("/") == 0); gidset[0] = pw->pw_gid; @@ -205,6 +224,11 @@ drop_privs(bool usecapsicum) return (-1); } + if (res == NULL || res->hr_role != HAST_ROLE_PRIMARY) + capsicum = (cap_enter() == 0); + else + capsicum = false; + /* * Better be sure that everything succeeded. */ @@ -221,7 +245,8 @@ drop_privs(bool usecapsicum) PJDLOG_VERIFY(gidset[0] == pw->pw_gid); pjdlog_debug(1, - "Privileges successfully dropped using chroot+setgid+setuid."); + "Privileges successfully dropped using %s%s+setgid+setuid.", + capsicum ? "capsicum+" : "", jailed ? "jail" : "chroot"); return (0); } Modified: projects/largeSMP/sbin/hastd/subr.h ============================================================================== --- projects/largeSMP/sbin/hastd/subr.h Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sbin/hastd/subr.h Sat May 14 19:20:13 2011 (r221910) @@ -51,6 +51,6 @@ int snprlcat(char *str, size_t size, con int provinfo(struct hast_resource *res, bool dowrite); const char *role2str(int role); -int drop_privs(bool usecapsicum); +int drop_privs(struct hast_resource *res); #endif /* !_SUBR_H_ */ Modified: projects/largeSMP/sys/conf/kern.mk ============================================================================== --- projects/largeSMP/sys/conf/kern.mk Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/conf/kern.mk Sat May 14 19:20:13 2011 (r221910) @@ -25,11 +25,21 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # +# gcc: +# Setting -mno-mmx implies -mno-3dnow +# Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3 +# +# clang: +# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, +# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# .if ${MACHINE_CPUARCH} == "i386" .if ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 +CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse +.else +CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float +CFLAGS+= -mno-mmx -msoft-float INLINE_LIMIT?= 8000 .endif @@ -61,10 +71,23 @@ INLINE_LIMIT?= 15000 # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # +# gcc: +# Setting -mno-mmx implies -mno-3dnow +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387 +# +# clang: +# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, +# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# (-mfpmath= is not supported) +# .if ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -mcmodel=kernel -mno-red-zone \ - -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ - -msoft-float -fno-asynchronous-unwind-tables +.if ${CC:T:Mclang} != "clang" +CFLAGS+= -mno-sse +.else +CFLAGS+= -mno-aes -mno-avx +.endif +CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \ + -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom.h Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom.h Sat May 14 19:20:13 2011 (r221910) @@ -133,4 +133,5 @@ HAL_STATUS ath_hal_v1EepromAttach(struct HAL_STATUS ath_hal_legacyEepromAttach(struct ath_hal *ah); HAL_STATUS ath_hal_v14EepromAttach(struct ath_hal *ah); HAL_STATUS ath_hal_v4kEepromAttach(struct ath_hal *ah); +HAL_STATUS ath_hal_9287EepromAttach(struct ath_hal *ah); #endif /* _ATH_AH_EEPROM_H_ */ Copied: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_9287.c (from r221906, head/sys/dev/ath/ath_hal/ah_eeprom_9287.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_9287.c Sat May 14 19:20:13 2011 (r221910, copy of r221906, head/sys/dev/ath/ath_hal/ah_eeprom_9287.c) @@ -0,0 +1,405 @@ +/* + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2010 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#include "opt_ah.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_eeprom_v14.h" +#include "ah_eeprom_9287.h" + +static HAL_STATUS +v9287EepromGet(struct ath_hal *ah, int param, void *val) +{ +#define CHAN_A_IDX 0 +#define CHAN_B_IDX 1 +#define IS_VERS(op, v) ((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v)) + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP_9287_HEADER *pModal = &ee->ee_base.modalHeader; + const BASE_EEP_9287_HEADER *pBase = &ee->ee_base.baseEepHeader; + uint32_t sum; + uint8_t *macaddr; + int i; + + switch (param) { + case AR_EEP_NFTHRESH_2: + *(int16_t *)val = pModal->noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_MACADDR: /* Get MAC Address */ + sum = 0; + macaddr = val; + for (i = 0; i < 6; i++) { + macaddr[i] = pBase->macAddr[i]; + sum += pBase->macAddr[i]; + } + if (sum == 0 || sum == 0xffff*3) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n", + __func__, ath_hal_ether_sprintf(macaddr)); + return HAL_EEBADMAC; + } + return HAL_OK; + case AR_EEP_REGDMN_0: + return pBase->regDmn[0]; + case AR_EEP_REGDMN_1: + return pBase->regDmn[1]; + case AR_EEP_OPCAP: + return pBase->deviceCap; + case AR_EEP_OPMODE: + return pBase->opCapFlags; + case AR_EEP_RFSILENT: + return pBase->rfSilent; +#if 0 + case AR_EEP_OB_5: + return pModal[CHAN_A_IDX].ob; + case AR_EEP_DB_5: + return pModal[CHAN_A_IDX].db; + case AR_EEP_OB_2: + return pModal[CHAN_B_IDX].ob; + case AR_EEP_DB_2: + return pModal[CHAN_B_IDX].db; +#endif + case AR_EEP_TXMASK: + return pBase->txMask; + case AR_EEP_RXMASK: + return pBase->rxMask; +#if 0 + case AR_EEP_RXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_17) ? + pBase->rxGainType : AR5416_EEP_RXGAIN_ORIG; + case AR_EEP_TXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? + pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; +#endif + case AR_EEP_OL_PWRCTRL: + HALASSERT(val == AH_NULL); + return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; + case AR_EEP_AMODE: + return HAL_EIO; /* no 5GHz for Kiwi */ + case AR_EEP_BMODE: + case AR_EEP_GMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11G ? + HAL_OK : HAL_EIO; + case AR_EEP_32KHZCRYSTAL: + case AR_EEP_COMPRESS: + case AR_EEP_FASTFRAME: /* XXX policy decision, h/w can do it */ + case AR_EEP_WRITEPROTECT: /* NB: no write protect bit */ + HALASSERT(val == AH_NULL); + /* fall thru... */ + case AR_EEP_MAXQCU: /* NB: not in opCapFlags */ + case AR_EEP_KCENTRIES: /* NB: not in opCapFlags */ + return HAL_EIO; + case AR_EEP_AES: + case AR_EEP_BURST: + case AR_EEP_RFKILL: + case AR_EEP_TURBO5DISABLE: + case AR_EEP_TURBO2DISABLE: + HALASSERT(val == AH_NULL); + return HAL_OK; + case AR_EEP_ANTGAINMAX_2: + *(int8_t *) val = ee->ee_antennaGainMax[1]; + return HAL_OK; + case AR_EEP_PWR_TABLE_OFFSET: + *(int8_t *) val = pBase->pwrTableOffset; + return HAL_OK; + default: + HALASSERT(0); + return HAL_EINVAL; + } +#undef IS_VERS +#undef CHAN_A_IDX +#undef CHAN_B_IDX +} + +static HAL_STATUS +v9287EepromSet(struct ath_hal *ah, int param, int v) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (param) { + case AR_EEP_ANTGAINMAX_2: + ee->ee_antennaGainMax[1] = (int8_t) v; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + ee->ee_antennaGainMax[0] = (int8_t) v; + return HAL_OK; + } + return HAL_EINVAL; +} + +static HAL_BOOL +v9287EepromDiag(struct ath_hal *ah, int request, + const void *args, uint32_t argsize, void **result, uint32_t *resultsize) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (request) { + case HAL_DIAG_EEPROM: + *result = ee; + *resultsize = sizeof(HAL_EEPROM_9287); + return AH_TRUE; + } + return AH_FALSE; +} + +/* Do structure specific swaps if Eeprom format is non native to host */ +static void +eepromSwap(HAL_EEPROM_9287 *ee) +{ + uint32_t integer, i; + uint16_t word; + MODAL_EEP_9287_HEADER *pModal; + + /* convert Base Eep header */ + word = __bswap16(ee->ee_base.baseEepHeader.length); + ee->ee_base.baseEepHeader.length = word; + + word = __bswap16(ee->ee_base.baseEepHeader.checksum); + ee->ee_base.baseEepHeader.checksum = word; + + word = __bswap16(ee->ee_base.baseEepHeader.version); + ee->ee_base.baseEepHeader.version = word; + + word = __bswap16(ee->ee_base.baseEepHeader.regDmn[0]); + ee->ee_base.baseEepHeader.regDmn[0] = word; + + word = __bswap16(ee->ee_base.baseEepHeader.regDmn[1]); + ee->ee_base.baseEepHeader.regDmn[1] = word; + + word = __bswap16(ee->ee_base.baseEepHeader.rfSilent); + ee->ee_base.baseEepHeader.rfSilent = word; + + word = __bswap16(ee->ee_base.baseEepHeader.blueToothOptions); + ee->ee_base.baseEepHeader.blueToothOptions = word; + + word = __bswap16(ee->ee_base.baseEepHeader.deviceCap); + ee->ee_base.baseEepHeader.deviceCap = word; + + /* convert Modal Eep header */ + + /* only 2.4ghz here; so only one modal header entry */ + pModal = &ee->ee_base.modalHeader; + + /* XXX linux/ah_osdep.h only defines __bswap32 for BE */ + integer = __bswap32(pModal->antCtrlCommon); + pModal->antCtrlCommon = integer; + + for (i = 0; i < AR9287_MAX_CHAINS; i++) { + integer = __bswap32(pModal->antCtrlChain[i]); + pModal->antCtrlChain[i] = integer; + } + for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { + word = __bswap16(pModal->spurChans[i].spurChan); + pModal->spurChans[i].spurChan = word; + } +} + +static uint16_t +v9287EepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + HALASSERT(is2GHz == AH_TRUE); + if (is2GHz != AH_TRUE) + return 0; /* XXX ? */ + + HALASSERT(0 <= ix && ix < AR5416_EEPROM_MODAL_SPURS); + return ee->ee_base.modalHeader.spurChans[ix].spurChan; +} + +/************************************************************************** + * fbin2freq + * + * Get channel value from binary representation held in eeprom + * RETURNS: the frequency in MHz + */ +static uint16_t +fbin2freq(uint8_t fbin, HAL_BOOL is2GHz) +{ + /* + * Reserved value 0xFF provides an empty definition both as + * an fbin and as a frequency - do not convert + */ + if (fbin == AR5416_BCHAN_UNUSED) + return fbin; + return (uint16_t)((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); +} + + +/* + * Copy EEPROM Conformance Testing Limits contents + * into the allocated space + */ +/* USE CTLS from chain zero */ +#define CTL_CHAIN 0 + +static void +v9287EepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_9287 *ee) +{ + RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; + int i, j; + + HALASSERT(AR9287_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + + for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR9287_NUM_CTLS; i++) { + for (j = 0; j < NUM_EDGES; j ++) { + /* XXX Confirm this is the right thing to do when an invalid channel is stored */ + if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) { + rep[j].rdEdge = 0; + rep[j].twice_rdEdgePower = 0; + rep[j].flag = 0; + } else { + rep[j].rdEdge = fbin2freq( + ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel, + (ee->ee_base.ctlIndex[i] & CTL_MODE_M) != CTL_11A); + rep[j].twice_rdEdgePower = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_POWER); + rep[j].flag = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_FLAG) != 0; + } + } + rep += NUM_EDGES; + } + ee->ee_numCtls = i; + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Numctls = %u\n",__func__,i); +} + +/* + * Reclaim any EEPROM-related storage. + */ +static void +v9287EepromDetach(struct ath_hal *ah) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + ath_hal_free(ee); + AH_PRIVATE(ah)->ah_eeprom = AH_NULL; +} + +#define owl_get_eep_ver(_ee) \ + (((_ee)->ee_base.baseEepHeader.version >> 12) & 0xF) +#define owl_get_eep_rev(_ee) \ + (((_ee)->ee_base.baseEepHeader.version) & 0xFFF) + +HAL_STATUS +ath_hal_9287EepromAttach(struct ath_hal *ah) +{ +#define NW(a) (sizeof(a) / sizeof(uint16_t)) + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + uint16_t *eep_data, magic; + HAL_BOOL need_swap; + u_int w, off, len; + uint32_t sum; + + HALASSERT(ee == AH_NULL); + + if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s Error reading Eeprom MAGIC\n", __func__); + return HAL_EEREAD; + } + HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n", + __func__, magic); + if (magic != AR5416_EEPROM_MAGIC) { + HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n"); + return HAL_EEMAGIC; + } + + ee = ath_hal_malloc(sizeof(HAL_EEPROM_9287)); + if (ee == AH_NULL) { + /* XXX message */ + return HAL_ENOMEM; + } + + eep_data = (uint16_t *) ee; + for (w = 0; w < NW(struct ar9287_eeprom); w++) { + off = AR9287_EEP_START_LOC + w; + if (!ath_hal_eepromRead(ah, off, &eep_data[w])) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s eeprom read error at offset 0x%x\n", + __func__, off); + return HAL_EEREAD; + } + } + /* Convert to eeprom native eeprom endian format */ + if (isBigEndian()) { + for (w = 0; w < NW(HAL_EEPROM_9287); w++) + eep_data[w] = __bswap16(eep_data[w]); + } + + /* + * At this point, we're in the native eeprom endian format + * Now, determine the eeprom endian by looking at byte 26?? + */ + need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian(); + if (need_swap) { + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "Byte swap EEPROM contents.\n"); + len = __bswap16(ee->ee_base.baseEepHeader.length); + } else { + len = ee->ee_base.baseEepHeader.length; + } + len = AH_MIN(len, sizeof(HAL_EEPROM_9287)) / sizeof(uint16_t); + + /* Apply the checksum, done in native eeprom format */ + /* XXX - Need to check to make sure checksum calculation is done + * in the correct endian format. Right now, it seems it would + * cast the raw data to host format and do the calculation, which may + * not be correct as the calculation may need to be done in the native + * eeprom format + */ + sum = 0; + for (w = 0; w < len; w++) + sum ^= eep_data[w]; + /* Check CRC - Attach should fail on a bad checksum */ + if (sum != 0xffff) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM checksum 0x%x (Len=%u)\n", sum, len); + return HAL_EEBADSUM; + } + + if (need_swap) + eepromSwap(ee); /* byte swap multi-byte data */ + + /* swap words 0+2 so version is at the front */ + magic = eep_data[0]; + eep_data[0] = eep_data[2]; + eep_data[2] = magic; + + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Eeprom Version %u.%u\n", __func__, + owl_get_eep_ver(ee), owl_get_eep_rev(ee)); + + /* NB: must be after all byte swapping */ + if (owl_get_eep_ver(ee) != AR5416_EEP_VER) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM version 0x%x\n", owl_get_eep_ver(ee)); + return HAL_EEBADSUM; + } + + v9287EepromReadCTLInfo(ah, ee); /* Get CTLs */ + + AH_PRIVATE(ah)->ah_eeprom = ee; + AH_PRIVATE(ah)->ah_eeversion = ee->ee_base.baseEepHeader.version; + AH_PRIVATE(ah)->ah_eepromDetach = v9287EepromDetach; + AH_PRIVATE(ah)->ah_eepromGet = v9287EepromGet; + AH_PRIVATE(ah)->ah_eepromSet = v9287EepromSet; + AH_PRIVATE(ah)->ah_getSpurChan = v9287EepromGetSpurChan; + AH_PRIVATE(ah)->ah_eepromDiag = v9287EepromDiag; + return HAL_OK; +#undef NW +} Copied: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_9287.h (from r221906, head/sys/dev/ath/ath_hal/ah_eeprom_9287.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_9287.h Sat May 14 19:20:13 2011 (r221910, copy of r221906, head/sys/dev/ath/ath_hal/ah_eeprom_9287.h) @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2008-2009 Atheros Communications Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __AH_EEPROM_9287_H__ +#define __AH_EEPROM_9287_H__ + +#define OLC_FOR_AR9287_10_LATER (AR_SREV_9287_11_OR_LATER(ah) && \ + ah->eep_ops->get_eeprom(ah, EEP_OL_PWRCTRL)) + +#define AR9287_EEP_VER 0xE +#define AR9287_EEP_VER_MINOR_MASK 0xFFF +#define AR9287_EEP_MINOR_VER_1 0x1 +#define AR9287_EEP_MINOR_VER_2 0x2 +#define AR9287_EEP_MINOR_VER_3 0x3 +#define AR9287_EEP_MINOR_VER AR9287_EEP_MINOR_VER_3 +#define AR9287_EEP_MINOR_VER_b AR9287_EEP_MINOR_VER +#define AR9287_EEP_NO_BACK_VER AR9287_EEP_MINOR_VER_1 + +#define AR9287_EEP_START_LOC 128 +#define AR9287_HTC_EEP_START_LOC 256 +#define AR9287_NUM_2G_CAL_PIERS 3 +#define AR9287_NUM_2G_CCK_TARGET_POWERS 3 +#define AR9287_NUM_2G_20_TARGET_POWERS 3 +#define AR9287_NUM_2G_40_TARGET_POWERS 3 +#define AR9287_NUM_CTLS 12 +#define AR9287_NUM_BAND_EDGES 4 +#define AR9287_PD_GAIN_ICEPTS 1 +#define AR9287_EEPMISC_BIG_ENDIAN 0x01 +#define AR9287_EEPMISC_WOW 0x02 +#define AR9287_MAX_CHAINS 2 +#define AR9287_ANT_16S 32 + +#define AR9287_DATA_SZ 32 + +#define AR9287_PWR_TABLE_OFFSET_DB -5 + +#define AR9287_CHECKSUM_LOCATION (AR9287_EEP_START_LOC + 1) + +struct base_eep_ar9287_header { + uint16_t version; /* Swapped w/ length; check ah_eeprom_v14.h */ + uint16_t checksum; + uint16_t length; + uint8_t opCapFlags; + uint8_t eepMisc; + uint16_t regDmn[2]; + uint8_t macAddr[6]; + uint8_t rxMask; + uint8_t txMask; + uint16_t rfSilent; + uint16_t blueToothOptions; + uint16_t deviceCap; + uint32_t binBuildNumber; + uint8_t deviceType; + uint8_t openLoopPwrCntl; + int8_t pwrTableOffset; + int8_t tempSensSlope; + int8_t tempSensSlopePalOn; + uint8_t futureBase[29]; +} __packed; + +struct modal_eep_ar9287_header { + uint32_t antCtrlChain[AR9287_MAX_CHAINS]; + uint32_t antCtrlCommon; + int8_t antennaGainCh[AR9287_MAX_CHAINS]; + uint8_t switchSettling; + uint8_t txRxAttenCh[AR9287_MAX_CHAINS]; + uint8_t rxTxMarginCh[AR9287_MAX_CHAINS]; + int8_t adcDesiredSize; + uint8_t txEndToXpaOff; + uint8_t txEndToRxOn; + uint8_t txFrameToXpaOn; + uint8_t thresh62; + int8_t noiseFloorThreshCh[AR9287_MAX_CHAINS]; + uint8_t xpdGain; + uint8_t xpd; + int8_t iqCalICh[AR9287_MAX_CHAINS]; + int8_t iqCalQCh[AR9287_MAX_CHAINS]; + uint8_t pdGainOverlap; + uint8_t xpaBiasLvl; + uint8_t txFrameToDataStart; + uint8_t txFrameToPaOn; + uint8_t ht40PowerIncForPdadc; + uint8_t bswAtten[AR9287_MAX_CHAINS]; + uint8_t bswMargin[AR9287_MAX_CHAINS]; + uint8_t swSettleHt40; + uint8_t version; + uint8_t db1; + uint8_t db2; + uint8_t ob_cck; + uint8_t ob_psk; + uint8_t ob_qam; + uint8_t ob_pal_off; + uint8_t futureModal[30]; + SPUR_CHAN spurChans[AR5416_EEPROM_MODAL_SPURS]; +} __packed; + +struct cal_data_op_loop_ar9287 { + uint8_t pwrPdg[2][5]; + uint8_t vpdPdg[2][5]; + uint8_t pcdac[2][5]; + uint8_t empty[2][5]; +} __packed; + +struct cal_data_per_freq_ar9287 { + uint8_t pwrPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; + uint8_t vpdPdg[AR5416_NUM_PD_GAINS][AR9287_PD_GAIN_ICEPTS]; +} __packed; + +union cal_data_per_freq_ar9287_u { + struct cal_data_op_loop_ar9287 calDataOpen; + struct cal_data_per_freq_ar9287 calDataClose; +} __packed; + +struct cal_ctl_data_ar9287 { + CAL_CTL_EDGES ctlEdges[AR9287_MAX_CHAINS][AR9287_NUM_BAND_EDGES]; +} __packed; + +struct ar9287_eeprom { + struct base_eep_ar9287_header baseEepHeader; + uint8_t custData[AR9287_DATA_SZ]; + struct modal_eep_ar9287_header modalHeader; + uint8_t calFreqPier2G[AR9287_NUM_2G_CAL_PIERS]; + union cal_data_per_freq_ar9287_u + calPierData2G[AR9287_MAX_CHAINS][AR9287_NUM_2G_CAL_PIERS]; + CAL_TARGET_POWER_LEG + calTargetPowerCck[AR9287_NUM_2G_CCK_TARGET_POWERS]; + CAL_TARGET_POWER_LEG + calTargetPower2G[AR9287_NUM_2G_20_TARGET_POWERS]; + CAL_TARGET_POWER_HT + calTargetPower2GHT20[AR9287_NUM_2G_20_TARGET_POWERS]; + CAL_TARGET_POWER_HT + calTargetPower2GHT40[AR9287_NUM_2G_40_TARGET_POWERS]; + uint8_t ctlIndex[AR9287_NUM_CTLS]; + struct cal_ctl_data_ar9287 ctlData[AR9287_NUM_CTLS]; + uint8_t padding; +} __packed; + +typedef struct { + struct ar9287_eeprom ee_base; +#define NUM_EDGES 8 + uint16_t ee_numCtls; + RD_EDGES_POWER ee_rdEdgesPower[NUM_EDGES*AR9287_NUM_CTLS]; + /* XXX these are dynamically calculated for use by shared code */ + int8_t ee_antennaGainMax[2]; +} HAL_EEPROM_9287; + +typedef struct modal_eep_ar9287_header MODAL_EEP_9287_HEADER; +typedef struct base_eep_ar9287_header BASE_EEP_9287_HEADER; + + +#endif /* __AH_EEPROM_9287_H__ */ Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v1.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v1.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v1.c Sat May 14 19:20:13 2011 (r221910) @@ -68,7 +68,7 @@ v1EepromGet(struct ath_hal *ah, int para } } -static HAL_BOOL +static HAL_STATUS v1EepromSet(struct ath_hal *ah, int param, int v) { return HAL_EINVAL; Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v14.c Sat May 14 19:20:13 2011 (r221910) @@ -84,8 +84,10 @@ v14EepromGet(struct ath_hal *ah, int par return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; case AR_EEP_FSTCLK_5G: - return IS_VERS(>, AR5416_EEP_MINOR_VER_16) ? - pBase->fastClk5g : AH_TRUE; + /* 5ghz fastclock is always enabled for Merlin minor <= 16 */ + if (IS_VERS(<=, AR5416_EEP_MINOR_VER_16)) + return HAL_OK; + return pBase->fastClk5g ? HAL_OK : HAL_EIO; case AR_EEP_OL_PWRCTRL: HALASSERT(val == AH_NULL); return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; @@ -148,7 +150,7 @@ v14EepromGet(struct ath_hal *ah, int par #undef CHAN_B_IDX } -static HAL_BOOL +static HAL_STATUS v14EepromSet(struct ath_hal *ah, int param, int v) { HAL_EEPROM_v14 *ee = AH_PRIVATE(ah)->ah_eeprom; Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v3.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v3.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v3.c Sat May 14 19:20:13 2011 (r221910) @@ -1665,7 +1665,7 @@ legacyEepromGet(struct ath_hal *ah, int return HAL_EINVAL; } -static HAL_BOOL +static HAL_STATUS legacyEepromSet(struct ath_hal *ah, int param, int v) { HAL_EEPROM *ee = AH_PRIVATE(ah)->ah_eeprom; Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v4k.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_eeprom_v4k.c Sat May 14 19:20:13 2011 (r221910) @@ -116,7 +116,7 @@ v4kEepromGet(struct ath_hal *ah, int par #undef CHAN_B_IDX } -static HAL_BOOL +static HAL_STATUS v4kEepromSet(struct ath_hal *ah, int param, int v) { HAL_EEPROM_v4k *ee = AH_PRIVATE(ah)->ah_eeprom; Modified: projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ah_internal.h Sat May 14 19:20:13 2011 (r221910) @@ -269,7 +269,7 @@ struct ath_hal_private { uint16_t ah_eeversion; /* EEPROM version */ void (*ah_eepromDetach)(struct ath_hal *); HAL_STATUS (*ah_eepromGet)(struct ath_hal *, int, void *); - HAL_BOOL (*ah_eepromSet)(struct ath_hal *, int, int); + HAL_STATUS (*ah_eepromSet)(struct ath_hal *, int, int); uint16_t (*ah_getSpurChan)(struct ath_hal *, int, HAL_BOOL); HAL_BOOL (*ah_eepromDiag)(struct ath_hal *, int request, const void *args, uint32_t argsize, Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416.h Sat May 14 19:20:13 2011 (r221910) @@ -199,7 +199,8 @@ extern HAL_STATUS ar5416GetCapability(st extern HAL_BOOL ar5416GetDiagState(struct ath_hal *ah, int request, const void *args, uint32_t argsize, void **result, uint32_t *resultsize); -extern HAL_BOOL ar5416SetRifsDelay(struct ath_hal *ah, HAL_BOOL enable); +extern HAL_BOOL ar5416SetRifsDelay(struct ath_hal *ah, + const struct ieee80211_channel *chan, HAL_BOOL enable); extern HAL_BOOL ar5416SetPowerMode(struct ath_hal *ah, HAL_POWER_MODE mode, int setChip); Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c Sat May 14 19:20:13 2011 (r221910) @@ -367,9 +367,18 @@ typedef struct { } hal_mac_hang_check_t; HAL_BOOL -ar5416SetRifsDelay(struct ath_hal *ah, HAL_BOOL enable) +ar5416SetRifsDelay(struct ath_hal *ah, const struct ieee80211_channel *chan, + HAL_BOOL enable) { uint32_t val; + HAL_BOOL is_chan_2g = AH_FALSE; + HAL_BOOL is_ht40 = AH_FALSE; + + if (chan) + is_chan_2g = IEEE80211_IS_CHAN_2GHZ(chan); + + if (chan) + is_ht40 = IEEE80211_IS_CHAN_HT40(chan); /* Only support disabling RIFS delay for now */ HALASSERT(enable == AH_FALSE); @@ -382,6 +391,31 @@ ar5416SetRifsDelay(struct ath_hal *ah, H val &= ~AR_PHY_RIFS_INIT_DELAY; OS_REG_WRITE(ah, AR_PHY_HEAVY_CLIP_FACTOR_RIFS, val); + /* + * For Owl, RIFS RX parameters are controlled differently; + * it isn't enabled in the inivals by default. + * + * For Sowl/Howl, RIFS RX is enabled in the inivals by default; + * the following code sets them back to non-RIFS values. + * + * For > Sowl/Howl, RIFS RX can be left on by default and so + * this function shouldn't be called. + */ + if ((! AR_SREV_SOWL(ah)) && (! AR_SREV_HOWL(ah))) + return AH_TRUE; + + /* Reset search delay to default values */ + if (is_chan_2g) + if (is_ht40) + OS_REG_WRITE(ah, AR_PHY_SEARCH_START_DELAY, 0x268); + else + OS_REG_WRITE(ah, AR_PHY_SEARCH_START_DELAY, 0x134); + else + if (is_ht40) + OS_REG_WRITE(ah, AR_PHY_SEARCH_START_DELAY, 0x370); + else + OS_REG_WRITE(ah, AR_PHY_SEARCH_START_DELAY, 0x1b8); + return AH_TRUE; } Modified: projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c ============================================================================== --- projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sat May 14 19:03:54 2011 (r221909) +++ projects/largeSMP/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c Sat May 14 19:20:13 2011 (r221910) @@ -146,7 +146,7 @@ ar5416Reset(struct ath_hal *ah, HAL_OPMO /* For chips on which the RTC reset is done, save TSF before it gets cleared */ if (AR_SREV_HOWL(ah) || - (AR_SREV_MERLIN_20_OR_LATER(ah) && ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL))) + (AR_SREV_MERLIN(ah) && ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL))) tsf = ar5212GetTsf64(ah); /* Mark PHY as inactive; marked active in ar5416InitBB() */ @@ -663,7 +663,7 @@ ar5416ChipReset(struct ath_hal *ah, cons /* * Warm reset is optimistic. */ - if (AR_SREV_MERLIN_20_OR_LATER(ah) && + if (AR_SREV_MERLIN(ah) && ath_hal_eepromGetFlag(ah, AR_EEP_OL_PWRCTRL)) { if (!ar5416SetResetReg(ah, HAL_RESET_POWER_ON)) return AH_FALSE; @@ -1053,9 +1053,9 @@ ar5416SetTransmitPower(struct ath_hal *a int cck_ofdm_delta = 2; int i; for (i = 0; i < N(adj); i++) { - ratesArray[i] -= cck_ofdm_delta; - if (ratesArray[i] < 0) - ratesArray[i] = 0; + ratesArray[adj[i]] -= cck_ofdm_delta; + if (ratesArray[adj[i]] < 0) + ratesArray[adj[i]] = 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat May 14 19:36:12 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F16E9106564A; Sat, 14 May 2011 19:36:12 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E12A88FC1C; Sat, 14 May 2011 19:36:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EJaCLW013401; Sat, 14 May 2011 19:36:12 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EJaC9k013399; Sat, 14 May 2011 19:36:12 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201105141936.p4EJaC9k013399@svn.freebsd.org> From: Attilio Rao Date: Sat, 14 May 2011 19:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221912 - projects/largeSMP/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 19:36:13 -0000 Author: attilio Date: Sat May 14 19:36:12 2011 New Revision: 221912 URL: http://svn.freebsd.org/changeset/base/221912 Log: Fix a longstanding bug where only the first part of the cpumask was correctly set full. Submitted by: anonymous Modified: projects/largeSMP/sys/kern/kern_cpuset.c Modified: projects/largeSMP/sys/kern/kern_cpuset.c ============================================================================== --- projects/largeSMP/sys/kern/kern_cpuset.c Sat May 14 19:27:15 2011 (r221911) +++ projects/largeSMP/sys/kern/kern_cpuset.c Sat May 14 19:36:12 2011 (r221912) @@ -719,7 +719,7 @@ cpuset_thread0(void) * cpuset_create() due to NULL parent. */ set = uma_zalloc(cpuset_zone, M_WAITOK | M_ZERO); - set->cs_mask.__bits[0] = -1; + CPU_FILL(&set->cs_mask); LIST_INIT(&set->cs_children); LIST_INSERT_HEAD(&cpuset_ids, set, cs_link); set->cs_ref = 1; From owner-svn-src-projects@FreeBSD.ORG Sat May 14 20:35:02 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 974E41065676; Sat, 14 May 2011 20:35:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E7FA8FC18; Sat, 14 May 2011 20:35:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EKZ2IB014686; Sat, 14 May 2011 20:35:02 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EKZ2lm014664; Sat, 14 May 2011 20:35:02 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201105142035.p4EKZ2lm014664@svn.freebsd.org> From: John Baldwin Date: Sat, 14 May 2011 20:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221914 - in projects/bhyve/sys: amd64/amd64 amd64/conf amd64/include amd64/vmm amd64/vmm/io conf dev/blackhole dev/bvm kern modules modules/blackhole modules/vmm x86/include x86/x86 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 20:35:02 -0000 Author: jhb Date: Sat May 14 20:35:01 2011 New Revision: 221914 URL: http://svn.freebsd.org/changeset/base/221914 Log: First cut at porting the kernel portions of 221828 and 221905 from the BHyVe reference branch to HEAD. Added: projects/bhyve/sys/amd64/include/vmm.h - copied unchanged from r221828, projects/bhyve_ref/sys/amd64/include/vmm.h projects/bhyve/sys/amd64/include/vmm_dev.h - copied unchanged from r221828, projects/bhyve_ref/sys/amd64/include/vmm_dev.h projects/bhyve/sys/amd64/vmm/ - copied from r221828, projects/bhyve_ref/sys/amd64/vmm/ projects/bhyve/sys/dev/blackhole/ - copied from r221905, projects/bhyve_ref/sys/dev/blackhole/ projects/bhyve/sys/dev/bvm/ - copied from r221905, projects/bhyve_ref/sys/dev/bvm/ projects/bhyve/sys/modules/blackhole/ - copied from r221905, projects/bhyve_ref/sys/modules/blackhole/ projects/bhyve/sys/modules/vmm/ - copied from r221828, projects/bhyve_ref/sys/modules/vmm/ Modified: projects/bhyve/sys/amd64/amd64/apic_vector.S projects/bhyve/sys/amd64/amd64/intr_machdep.c projects/bhyve/sys/amd64/amd64/minidump_machdep.c projects/bhyve/sys/amd64/amd64/mp_machdep.c projects/bhyve/sys/amd64/amd64/vm_machdep.c projects/bhyve/sys/amd64/conf/GENERIC projects/bhyve/sys/amd64/include/specialreg.h projects/bhyve/sys/amd64/vmm/io/ppt.c projects/bhyve/sys/amd64/vmm/io/vlapic.c projects/bhyve/sys/amd64/vmm/vmm.c projects/bhyve/sys/amd64/vmm/vmm_dev.c projects/bhyve/sys/amd64/vmm/vmm_ipi.c projects/bhyve/sys/amd64/vmm/vmm_msr.c projects/bhyve/sys/conf/files.amd64 projects/bhyve/sys/conf/options.amd64 projects/bhyve/sys/kern/subr_bus.c projects/bhyve/sys/modules/Makefile projects/bhyve/sys/modules/vmm/Makefile projects/bhyve/sys/x86/include/bus.h projects/bhyve/sys/x86/x86/local_apic.c Modified: projects/bhyve/sys/amd64/amd64/apic_vector.S ============================================================================== --- projects/bhyve/sys/amd64/amd64/apic_vector.S Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/amd64/amd64/apic_vector.S Sat May 14 20:35:01 2011 (r221914) @@ -57,8 +57,15 @@ IDTVEC(vec_name) ; \ PUSH_FRAME ; \ FAKE_MCOUNT(TF_RIP(%rsp)) ; \ movq lapic, %rdx ; /* pointer to local APIC */ \ + testq %rdx, %rdx; \ + jnz 3f; \ + movl $MSR_APIC_ISR ## index, %ecx; \ + rdmsr; \ + jmp 4f; \ +3: ; \ movl LA_ISR + 16 * (index)(%rdx), %eax ; /* load ISR */ \ - bsrl %eax, %eax ; /* index of highest set bit in ISR */ \ +4: ; \ + bsrl %eax, %eax ; /* index of highset set bit in ISR */ \ jz 1f ; \ addl $(32 * index),%eax ; \ movq %rsp, %rsi ; \ @@ -129,6 +136,26 @@ IDTVEC(errorint) jmp doreti #ifdef SMP + +/* + * We assume that %rax is being saved/restored outside of this macro + */ +#define DO_EOI \ + movq lapic, %rax; \ + testq %rax, %rax; \ + jz 8f; \ + movl $0, LA_EOI(%rax); \ + jmp 9f; \ +8:; \ + pushq %rcx; \ + pushq %rdx; \ + xorl %edx, %edx; /* eax is already zero */ \ + movl $MSR_APIC_EOI, %ecx; \ + wrmsr; \ + popq %rdx; \ + popq %rcx; \ +9: + /* * Global address space TLB shootdown. */ @@ -153,8 +180,7 @@ IDTVEC(invltlb) movq %cr3, %rax /* invalidate the TLB */ movq %rax, %cr3 - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -186,8 +212,7 @@ IDTVEC(invlpg) movq smp_tlb_addr1, %rax invlpg (%rax) /* invalidate single page */ - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -224,8 +249,7 @@ IDTVEC(invlrng) cmpq %rax, %rdx jb 1b - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -252,8 +276,7 @@ IDTVEC(invlcache) wbinvd - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI lock incl smp_tlb_wait @@ -269,9 +292,8 @@ IDTVEC(invlcache) IDTVEC(ipi_intr_bitmap_handler) PUSH_FRAME - movq lapic, %rdx - movl $0, LA_EOI(%rdx) /* End Of Interrupt to APIC */ - + DO_EOI + FAKE_MCOUNT(TF_RIP(%rsp)) call ipi_bitmap_handler @@ -286,8 +308,7 @@ IDTVEC(ipi_intr_bitmap_handler) IDTVEC(cpustop) PUSH_FRAME - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI call cpustop_handler jmp doreti @@ -300,8 +321,7 @@ IDTVEC(cpustop) IDTVEC(cpususpend) PUSH_FRAME - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI call cpususpend_handler @@ -323,7 +343,6 @@ IDTVEC(rendezvous) incq (%rax) #endif call smp_rendezvous_action - movq lapic, %rax - movl $0, LA_EOI(%rax) /* End Of Interrupt to APIC */ + DO_EOI jmp doreti #endif /* SMP */ Modified: projects/bhyve/sys/amd64/amd64/intr_machdep.c ============================================================================== --- projects/bhyve/sys/amd64/amd64/intr_machdep.c Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/amd64/amd64/intr_machdep.c Sat May 14 20:35:01 2011 (r221914) @@ -78,6 +78,8 @@ static STAILQ_HEAD(, pic) pics; #ifdef SMP static int assign_cpu; +static int round_robin_interrupts = 1; +TUNABLE_INT("round_robin_interrupts", &round_robin_interrupts); #endif static int intr_assign_cpu(void *arg, u_char cpu); @@ -460,6 +462,10 @@ intr_next_cpu(void) if (!assign_cpu) return (PCPU_GET(apic_id)); + /* All interrupts go to the BSP if not allowed to round robin */ + if (!round_robin_interrupts) + return (cpu_apic_ids[0]); + mtx_lock_spin(&icu_lock); apic_id = cpu_apic_ids[current_cpu]; do { Modified: projects/bhyve/sys/amd64/amd64/minidump_machdep.c ============================================================================== --- projects/bhyve/sys/amd64/amd64/minidump_machdep.c Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/amd64/amd64/minidump_machdep.c Sat May 14 20:35:01 2011 (r221914) @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_pmap.h" #include "opt_watchdog.h" #include Modified: projects/bhyve/sys/amd64/amd64/mp_machdep.c ============================================================================== --- projects/bhyve/sys/amd64/amd64/mp_machdep.c Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/amd64/amd64/mp_machdep.c Sat May 14 20:35:01 2011 (r221914) @@ -146,6 +146,26 @@ struct cpu_info { int cpu_apic_ids[MAXCPU]; int apic_cpuids[MAX_APIC_ID + 1]; +/* + * Trampoline for hypervisor direct 64-bit jump. + * + * 0 - signature for guest->host verification + * 8 - virtual address of this page + * 16 - instruction virtual address + * 24 - stack pointer virtual address + * 32 - CR3, physical address of kernel page table + * 40 - 24-byte area for null/code/data GDT entries + */ +#define MP_V64T_SIG 0xcafebabecafebabeULL +struct mp_v64tramp { + uint64_t mt_sig; + uint64_t mt_virt; + uint64_t mt_eip; + uint64_t mt_rsp; + uint64_t mt_cr3; + uint64_t mt_gdtr[3]; +}; + /* Holds pending bitmap based IPIs per CPU */ static volatile u_int cpu_ipi_pending[MAXCPU]; @@ -948,6 +968,29 @@ start_all_aps(void) bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 8; bootAP = cpu; + /* + * If running in a VM that doesn't support the unrestricted + * guest 16-bit mode, forget most of the above and create + * the data block that allows the hypervisor to direct-jump + * into 64-bit mode. Copy this over the top of the 16-bit + * bootstrap. The startup-IPI informs the hypervisor which + * physical page this data block lies in. The hypervisor + * will then use the block to initialise register state of + * the AP in an almost identical fashion to how it builds + * the BSP initial register state. + */ + if (testenv("hw.use_bvm_mptramp")) { + struct mp_v64tramp mv; + + bzero(&mv, sizeof(mv)); + mv.mt_sig = MP_V64T_SIG; + mv.mt_virt = (uint64_t) va; + mv.mt_eip = (uint64_t) init_secondary; + mv.mt_rsp = (uint64_t) bootSTK; + mv.mt_cr3 = KPML4phys; + bcopy(&mv, (void *) va, sizeof(mv)); + } + /* attempt to start the Application Processor */ if (!start_ap(apic_id)) { /* restore the warmstart vector */ Modified: projects/bhyve/sys/amd64/amd64/vm_machdep.c ============================================================================== --- projects/bhyve/sys/amd64/amd64/vm_machdep.c Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/amd64/amd64/vm_machdep.c Sat May 14 20:35:01 2011 (r221914) @@ -514,8 +514,10 @@ cpu_reset_proxy() { cpu_reset_proxy_active = 1; - while (cpu_reset_proxy_active == 1) + while (cpu_reset_proxy_active == 1) { + ia32_pause(); ; /* Wait for other cpu to see that we've started */ + } stop_cpus((1<msi.arg[i].msg = i; error = bus_setup_intr(ppt->dev, ppt->msi.res[i], - INTR_TYPE_NET | INTR_MPSAFE | INTR_FAST, + INTR_TYPE_NET | INTR_MPSAFE, pptintr, NULL, &ppt->msi.arg[i], &ppt->msi.cookie[i]); if (error != 0) Modified: projects/bhyve/sys/amd64/vmm/io/vlapic.c ============================================================================== --- projects/bhyve_ref/sys/amd64/vmm/io/vlapic.c Fri May 13 04:54:01 2011 (r221828) +++ projects/bhyve/sys/amd64/vmm/io/vlapic.c Sat May 14 20:35:01 2011 (r221914) @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include Modified: projects/bhyve/sys/amd64/vmm/vmm.c ============================================================================== --- projects/bhyve_ref/sys/amd64/vmm/vmm.c Fri May 13 04:54:01 2011 (r221828) +++ projects/bhyve/sys/amd64/vmm/vmm.c Sat May 14 20:35:01 2011 (r221914) @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include "vmm_mem.h" @@ -160,7 +160,8 @@ vcpu_init(struct vm *vm, uint32_t vcpu_i vcpu->hostcpu = -1; vcpu->vcpuid = vcpu_id; vcpu->vlapic = vlapic_init(vm, vcpu_id); - fpugetregs(curthread, &vcpu->savefpu); + fpugetregs(curthread); + vcpu->savefpu = curthread->td_pcb->pcb_user_save; vcpu->stats = vmm_stat_alloc(); } @@ -545,7 +546,7 @@ vm_run(struct vm *vm, struct vm_run *vmr tscval = rdtsc(); pcb = PCPU_GET(curpcb); - pcb->pcb_full_iret = 1; + set_pcb_flags(pcb, PCB_FULL_IRET); vcpu->hostcpu = curcpu; Modified: projects/bhyve/sys/amd64/vmm/vmm_dev.c ============================================================================== --- projects/bhyve_ref/sys/amd64/vmm/vmm_dev.c Fri May 13 04:54:01 2011 (r221828) +++ projects/bhyve/sys/amd64/vmm/vmm_dev.c Sat May 14 20:35:01 2011 (r221914) @@ -336,7 +336,8 @@ done: } static int -vmmdev_mmap(struct cdev *cdev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +vmmdev_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) { int error; struct vmmdev_softc *sc; Modified: projects/bhyve/sys/amd64/vmm/vmm_ipi.c ============================================================================== --- projects/bhyve_ref/sys/amd64/vmm/vmm_ipi.c Fri May 13 04:54:01 2011 (r221828) +++ projects/bhyve/sys/amd64/vmm/vmm_ipi.c Sat May 14 20:35:01 2011 (r221914) @@ -99,5 +99,5 @@ vm_interrupt_hostcpu(struct vm *vm, int int hostcpu; if (vcpu_is_running(vm, vcpu, &hostcpu) && hostcpu != curcpu) - ipi_selected((cpumask_t)1 << hostcpu, ipinum); + ipi_cpu(hostcpu, ipinum); } Modified: projects/bhyve/sys/amd64/vmm/vmm_msr.c ============================================================================== --- projects/bhyve_ref/sys/amd64/vmm/vmm_msr.c Fri May 13 04:54:01 2011 (r221828) +++ projects/bhyve/sys/amd64/vmm/vmm_msr.c Sat May 14 20:35:01 2011 (r221914) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include "vmm_lapic.h" Modified: projects/bhyve/sys/conf/files.amd64 ============================================================================== --- projects/bhyve/sys/conf/files.amd64 Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/conf/files.amd64 Sat May 14 20:35:01 2011 (r221914) @@ -295,6 +295,11 @@ libkern/memset.c standard compat/x86bios/x86bios.c optional x86bios | atkbd | dpms | vesa contrib/x86emu/x86emu.c optional x86bios | atkbd | dpms | vesa # +# bvm console +# +dev/bvm/bvm_console.c optional bvmconsole +dev/bvm/bvm_dbg.c optional bvmdebug +# # x86 shared code between IA32, AMD64 and PC98 architectures # x86/acpica/OsdEnvironment.c optional acpi Modified: projects/bhyve/sys/conf/options.amd64 ============================================================================== --- projects/bhyve/sys/conf/options.amd64 Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/conf/options.amd64 Sat May 14 20:35:01 2011 (r221914) @@ -10,6 +10,7 @@ PERFMON PMAP_SHPGPERPROC opt_pmap.h MPTABLE_FORCE_HTT MP_WATCHDOG +NKPT opt_pmap.h # Options for emulators. These should only be used at config time, so # they are handled like options for static filesystems Modified: projects/bhyve/sys/kern/subr_bus.c ============================================================================== --- projects/bhyve/sys/kern/subr_bus.c Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/kern/subr_bus.c Sat May 14 20:35:01 2011 (r221914) @@ -2683,7 +2683,7 @@ device_attach(device_t dev) printf("device_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); /* Unset the class; set in device_probe_child */ - if (dev->devclass == NULL) + if ((dev->flags & DF_FIXEDCLASS) == 0) device_set_devclass(dev, NULL); device_set_driver(dev, NULL); device_sysctl_fini(dev); Modified: projects/bhyve/sys/modules/Makefile ============================================================================== --- projects/bhyve/sys/modules/Makefile Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/modules/Makefile Sat May 14 20:35:01 2011 (r221914) @@ -43,6 +43,7 @@ SUBDIR= ${_3dfx} \ ${_bxe} \ ${_bios} \ ${_bktr} \ + ${_blackhole} \ ${_bm} \ bridgestp \ bwi \ @@ -311,6 +312,7 @@ SUBDIR= ${_3dfx} \ ${_vesa} \ vge \ vkbd \ + ${_vmm} \ ${_vpo} \ vr \ vte \ @@ -541,6 +543,7 @@ _amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc +_blackhole= blackhole _bxe= bxe _cardbus= cardbus _cbb= cbb @@ -617,6 +620,7 @@ _sppp= sppp _tpm= tpm _twa= twa _vesa= vesa +_vmm= vmm _x86bios= x86bios _wi= wi _wpi= wpi Modified: projects/bhyve/sys/modules/vmm/Makefile ============================================================================== --- projects/bhyve_ref/sys/modules/vmm/Makefile Fri May 13 04:54:01 2011 (r221828) +++ projects/bhyve/sys/modules/vmm/Makefile Sat May 14 20:35:01 2011 (r221914) @@ -9,7 +9,7 @@ KMOD= vmm SRCS= device_if.h bus_if.h pci_if.h -CFLAGS+= -DVMM_KEEP_STATS +CFLAGS+= -DVMM_KEEP_STATS -DSMP CFLAGS+= -DOLD_BINUTILS CFLAGS+= -I${.CURDIR}/../../amd64/vmm CFLAGS+= -I${.CURDIR}/../../amd64/vmm/io @@ -60,7 +60,7 @@ vmx_support.o: vmx_support.S vmx_assym.s ${CC} -c -x assembler-with-cpp -DLOCORE ${CFLAGS} \ ${.IMPSRC} -o ${.TARGET} -vmx_genassym.o: vmx_genassym.c @ machine +vmx_genassym.o: vmx_genassym.c @ machine x86 ${CC} -c ${CFLAGS:N-fno-common} ${.IMPSRC} .include Modified: projects/bhyve/sys/x86/include/bus.h ============================================================================== --- projects/bhyve/sys/x86/include/bus.h Sat May 14 20:31:04 2011 (r221913) +++ projects/bhyve/sys/x86/include/bus.h Sat May 14 20:35:01 2011 (r221914) @@ -279,9 +279,13 @@ bus_space_read_multi_1(bus_space_tag_t t bus_size_t offset, u_int8_t *addr, size_t count) { - if (tag == X86_BUS_SPACE_IO) - insb(bsh + offset, addr, count); - else { + if (tag == X86_BUS_SPACE_IO) { + while (count > 0) { + *addr = inb(bsh + offset); + count--; + addr++; + } + } else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -300,9 +304,13 @@ bus_space_read_multi_2(bus_space_tag_t t bus_size_t offset, u_int16_t *addr, size_t count) { - if (tag == X86_BUS_SPACE_IO) - insw(bsh + offset, addr, count); - else { + if (tag == X86_BUS_SPACE_IO) { + while (count > 0) { + *addr = inw(bsh + offset); + count--; + addr++; + } + } else { #ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ @@ -321,9 +329,13 @@ bus_space_read_multi_4(bus_space_tag_t t bus_size_t offset, u_int32_t *addr, size_t count) { - if (tag == X86_BUS_SPACE_IO) - insl(bsh + offset, addr, count); - else { + if (tag == X86_BUS_SPACE_IO) { + while (count > 0) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat May 14 20:48:24 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E59AC106566C; Sat, 14 May 2011 20:48:24 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D108F8FC14; Sat, 14 May 2011 20:48:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4EKmObt015126; Sat, 14 May 2011 20:48:24 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4EKmOIJ015099; Sat, 14 May 2011 20:48:24 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201105142048.p4EKmOIJ015099@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 14 May 2011 20:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221915 - in projects/altix/sys: . amd64/amd64 amd64/conf amd64/include arm/arm arm/include boot boot/common boot/sparc64/loader cam/scsi cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 conf... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 20:48:25 -0000 Author: marcel Date: Sat May 14 20:48:23 2011 New Revision: 221915 URL: http://svn.freebsd.org/changeset/base/221915 Log: Merge svn+ssh://svn.freebsd.org/base/head@221894 Added: projects/altix/sys/dev/ath/ath_hal/ah_eeprom_9287.c - copied unchanged from r221894, head/sys/dev/ath/ath_hal/ah_eeprom_9287.c projects/altix/sys/dev/ath/ath_hal/ah_eeprom_9287.h - copied unchanged from r221894, head/sys/dev/ath/ath_hal/ah_eeprom_9287.h projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285an.h - copied unchanged from r221894, head/sys/dev/ath/ath_hal/ar9002/ar9285an.h projects/altix/sys/nfs/nfs_kdtrace.h - copied unchanged from r221894, head/sys/nfs/nfs_kdtrace.h projects/altix/sys/teken/demo/ - copied from r221894, head/sys/teken/demo/ projects/altix/sys/teken/libteken/ - copied from r221894, head/sys/teken/libteken/ projects/altix/sys/teken/stress/ - copied from r221894, head/sys/teken/stress/ Deleted: projects/altix/sys/conf/Makefile.sun4v projects/altix/sys/conf/files.sun4v projects/altix/sys/conf/options.sun4v projects/altix/sys/nfsclient/nfs_kdtrace.h projects/altix/sys/sun4v/ projects/altix/sys/teken/Makefile projects/altix/sys/teken/teken_demo.c projects/altix/sys/teken/teken_stress.c Modified: projects/altix/sys/Makefile projects/altix/sys/amd64/amd64/machdep.c projects/altix/sys/amd64/amd64/mp_machdep.c projects/altix/sys/amd64/conf/GENERIC projects/altix/sys/amd64/include/clock.h projects/altix/sys/amd64/include/specialreg.h projects/altix/sys/amd64/include/vmparam.h projects/altix/sys/arm/arm/pmap.c projects/altix/sys/arm/include/vmparam.h projects/altix/sys/boot/Makefile projects/altix/sys/boot/common/interp.c projects/altix/sys/boot/common/loader.8 projects/altix/sys/boot/sparc64/loader/main.c projects/altix/sys/cam/scsi/scsi_cd.c projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c projects/altix/sys/conf/kern.mk projects/altix/sys/dev/ahci/ahci.c projects/altix/sys/dev/ata/ata-pci.h projects/altix/sys/dev/ata/chipsets/ata-intel.c projects/altix/sys/dev/ath/ath_hal/ah.c projects/altix/sys/dev/ath/ath_hal/ah.h projects/altix/sys/dev/ath/ath_hal/ah_debug.h projects/altix/sys/dev/ath/ath_hal/ah_eeprom.h projects/altix/sys/dev/ath/ath_hal/ah_eeprom_v14.h projects/altix/sys/dev/ath/ath_hal/ah_internal.h projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416.h projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_ani.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_cal.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_misc.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_power.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416_reset.c projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416desc.h projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416phy.h projects/altix/sys/dev/ath/ath_hal/ar5416/ar5416reg.h projects/altix/sys/dev/ath/ath_hal/ar9001/ar9130_attach.c projects/altix/sys/dev/ath/ath_hal/ar9001/ar9160_attach.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9280_olc.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285.h projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_attach.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_cal.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_diversity.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_phy.c projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_phy.h projects/altix/sys/dev/ath/ath_hal/ar9002/ar9285_reset.c projects/altix/sys/dev/ath/ath_rate/sample/tx_schedules.h projects/altix/sys/dev/ath/if_ath.c projects/altix/sys/dev/bge/if_bge.c projects/altix/sys/dev/bge/if_bgereg.h projects/altix/sys/dev/bm/if_bm.c projects/altix/sys/dev/bxe/if_bxe.c projects/altix/sys/dev/bxe/if_bxe.h projects/altix/sys/dev/ichsmb/ichsmb_pci.c projects/altix/sys/dev/ichwd/ichwd.c projects/altix/sys/dev/ichwd/ichwd.h projects/altix/sys/dev/iwn/if_iwn.c projects/altix/sys/dev/iwn/if_iwnreg.h projects/altix/sys/dev/iwn/if_iwnvar.h projects/altix/sys/dev/md/md.c projects/altix/sys/dev/mii/atphy.c projects/altix/sys/dev/mii/brgphy.c projects/altix/sys/dev/mii/ip1000phy.c projects/altix/sys/dev/mii/mii_physubr.c projects/altix/sys/dev/mii/miidevs projects/altix/sys/dev/null/null.c projects/altix/sys/dev/pci/isa_pci.c projects/altix/sys/dev/puc/pucdata.c projects/altix/sys/dev/sound/pci/hda/hdac.c projects/altix/sys/dev/sound/pcm/dsp.c projects/altix/sys/dev/sound/usb/uaudio.c projects/altix/sys/dev/syscons/syscons.c projects/altix/sys/dev/syscons/syscons.h projects/altix/sys/dev/usb/usb_device.c projects/altix/sys/dev/usb/usbdevs projects/altix/sys/dev/xen/balloon/balloon.c projects/altix/sys/dev/xl/if_xl.c projects/altix/sys/dev/xl/if_xlreg.h projects/altix/sys/fs/ext2fs/ext2_lookup.c projects/altix/sys/fs/nfs/nfs.h projects/altix/sys/fs/nfsclient/nfs_clvfsops.c projects/altix/sys/fs/nfsserver/nfs_nfsdkrpc.c projects/altix/sys/fs/nfsserver/nfs_nfsdport.c projects/altix/sys/geom/eli/g_eli.c projects/altix/sys/geom/eli/g_eli.h projects/altix/sys/geom/eli/g_eli_ctl.c projects/altix/sys/geom/eli/g_eli_integrity.c projects/altix/sys/geom/eli/g_eli_key_cache.c projects/altix/sys/geom/geom_kern.c projects/altix/sys/geom/part/g_part.c projects/altix/sys/geom/part/g_part_apm.c projects/altix/sys/geom/part/g_part_bsd.c projects/altix/sys/geom/part/g_part_ebr.c projects/altix/sys/geom/part/g_part_mbr.c projects/altix/sys/geom/part/g_part_pc98.c projects/altix/sys/geom/part/g_part_vtoc8.c projects/altix/sys/i386/conf/GENERIC projects/altix/sys/i386/i386/machdep.c projects/altix/sys/i386/i386/mp_machdep.c projects/altix/sys/i386/include/clock.h projects/altix/sys/i386/include/specialreg.h projects/altix/sys/i386/include/vmparam.h projects/altix/sys/i386/xen/clock.c projects/altix/sys/i386/xen/mp_machdep.c projects/altix/sys/ia64/ia64/exception.S projects/altix/sys/ia64/ia64/pmap.c projects/altix/sys/ia64/ia64/syscall.S projects/altix/sys/ia64/include/ia64_cpu.h projects/altix/sys/ia64/include/pcpu.h projects/altix/sys/ia64/include/vmparam.h projects/altix/sys/ia64/isa/isa.c projects/altix/sys/isa/isa_common.c projects/altix/sys/isa/isa_common.h projects/altix/sys/isa/syscons_isa.c projects/altix/sys/kern/kern_clocksource.c projects/altix/sys/kern/kern_descrip.c projects/altix/sys/kern/kern_environment.c projects/altix/sys/kern/kern_proc.c projects/altix/sys/kern/kern_synch.c projects/altix/sys/kern/kern_sysctl.c projects/altix/sys/kern/vfs_bio.c projects/altix/sys/kern/vfs_mount.c projects/altix/sys/kern/vfs_subr.c projects/altix/sys/kern/vfs_vnops.c projects/altix/sys/kern/vnode_if.src projects/altix/sys/mips/atheros/ar71xx_gpio.c projects/altix/sys/mips/atheros/ar71xx_gpiovar.h projects/altix/sys/mips/atheros/ar724xreg.h projects/altix/sys/mips/atheros/ar91xxreg.h projects/altix/sys/mips/conf/ADM5120 projects/altix/sys/mips/conf/ALCHEMY projects/altix/sys/mips/conf/AR71XX projects/altix/sys/mips/conf/AR91XX_BASE projects/altix/sys/mips/conf/IDT projects/altix/sys/mips/conf/MALTA projects/altix/sys/mips/conf/MALTA64 projects/altix/sys/mips/conf/OCTEON1 projects/altix/sys/mips/conf/PB92 projects/altix/sys/mips/conf/QEMU projects/altix/sys/mips/conf/RT305X projects/altix/sys/mips/conf/SENTRY5 projects/altix/sys/mips/conf/XLR projects/altix/sys/mips/conf/XLR64 projects/altix/sys/mips/conf/XLRN32 projects/altix/sys/mips/conf/std.SWARM projects/altix/sys/mips/include/vmparam.h projects/altix/sys/modules/mem/Makefile projects/altix/sys/modules/uart/Makefile projects/altix/sys/net/if_tun.c projects/altix/sys/net80211/ieee80211_alq.c projects/altix/sys/netinet/ipfw/ip_dn_glue.c projects/altix/sys/netinet/ipfw/ip_dummynet.c projects/altix/sys/netinet/sctp_auth.c projects/altix/sys/netinet/sctp_auth.h projects/altix/sys/netinet/sctp_indata.c projects/altix/sys/netinet/sctp_input.c projects/altix/sys/netinet/sctp_input.h projects/altix/sys/netinet/sctp_output.c projects/altix/sys/netinet/sctp_output.h projects/altix/sys/netinet/sctp_pcb.c projects/altix/sys/netinet/sctp_timer.c projects/altix/sys/netinet/sctp_usrreq.c projects/altix/sys/netinet/sctp_var.h projects/altix/sys/netinet/sctputil.c projects/altix/sys/netinet/tcp_input.c projects/altix/sys/netinet/tcp_subr.c projects/altix/sys/netinet/tcp_timewait.c projects/altix/sys/netipsec/key.c projects/altix/sys/nfsclient/nfs_bio.c projects/altix/sys/nfsclient/nfs_kdtrace.c projects/altix/sys/nfsclient/nfs_subs.c projects/altix/sys/nfsclient/nfs_vnops.c projects/altix/sys/pc98/cbus/syscons_cbus.c projects/altix/sys/powerpc/conf/GENERIC projects/altix/sys/powerpc/include/vmparam.h projects/altix/sys/powerpc/mpc85xx/isa.c projects/altix/sys/powerpc/powermac/macio.c projects/altix/sys/powerpc/powermac/maciovar.h projects/altix/sys/powerpc/powerpc/intr_machdep.c projects/altix/sys/sparc64/include/asmacros.h projects/altix/sys/sparc64/include/vmparam.h projects/altix/sys/sparc64/isa/isa.c projects/altix/sys/sparc64/sparc64/autoconf.c projects/altix/sys/sparc64/sparc64/genassym.c projects/altix/sys/sparc64/sparc64/mem.c projects/altix/sys/sys/elf_common.h projects/altix/sys/sys/kdb.h projects/altix/sys/sys/param.h projects/altix/sys/sys/priority.h projects/altix/sys/sys/queue.h projects/altix/sys/sys/systm.h projects/altix/sys/sys/user.h projects/altix/sys/teken/teken.c projects/altix/sys/teken/teken.h projects/altix/sys/ufs/ffs/ffs_softdep.c projects/altix/sys/vm/vm_kern.c projects/altix/sys/vm/vm_object.c projects/altix/sys/x86/isa/clock.c projects/altix/sys/x86/isa/isa.c projects/altix/sys/x86/x86/tsc.c Directory Properties: projects/altix/lib/libstand/ (props changed) projects/altix/sys/ (props changed) projects/altix/sys/amd64/include/xen/ (props changed) projects/altix/sys/boot/i386/efi/ (props changed) projects/altix/sys/boot/ia64/efi/ (props changed) projects/altix/sys/boot/ia64/ski/ (props changed) projects/altix/sys/boot/powerpc/boot1.chrp/ (props changed) projects/altix/sys/boot/powerpc/ofw/ (props changed) projects/altix/sys/cddl/contrib/opensolaris/ (props changed) projects/altix/sys/conf/ (props changed) projects/altix/sys/contrib/dev/acpica/ (props changed) projects/altix/sys/contrib/octeon-sdk/ (props changed) projects/altix/sys/contrib/pf/ (props changed) projects/altix/sys/contrib/x86emu/ (props changed) projects/altix/sys/kern/subr_busdma.c (props changed) Modified: projects/altix/sys/Makefile ============================================================================== --- projects/altix/sys/Makefile Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/Makefile Sat May 14 20:48:23 2011 (r221915) @@ -14,7 +14,7 @@ CSCOPEDIRS= boot bsm cam cddl compat con netsmb nfs nfsclient nfsserver nlm opencrypto \ pci rpc security sys ufs vm xdr ${CSCOPE_ARCHDIR} .if defined(ALL_ARCH) -CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v x86 +CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86 .else CSCOPE_ARCHDIR ?= ${MACHINE} .endif Modified: projects/altix/sys/amd64/amd64/machdep.c ============================================================================== --- projects/altix/sys/amd64/amd64/machdep.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/amd64/amd64/machdep.c Sat May 14 20:48:23 2011 (r221915) @@ -1298,9 +1298,6 @@ add_smap_entry(struct bios_smap *smap, v * available physical memory in the system, then test this memory and * build the phys_avail array describing the actually-available memory. * - * If we cannot accurately determine the physical memory map, then use - * value from the 0xE801 call, and failing that, the RTC. - * * Total memory size may be set by the kernel environment variable * hw.physmem or the compile-time define MAXMEM. * Modified: projects/altix/sys/amd64/amd64/mp_machdep.c ============================================================================== --- projects/altix/sys/amd64/amd64/mp_machdep.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/amd64/amd64/mp_machdep.c Sat May 14 20:48:23 2011 (r221915) @@ -176,11 +176,34 @@ mem_range_AP_init(void) static void topo_probe_amd(void) { + int core_id_bits; + int id; /* AMD processors do not support HTT. */ - cpu_cores = (amd_feature2 & AMDID2_CMP) != 0 ? - (cpu_procinfo2 & AMDID_CMP_CORES) + 1 : 1; cpu_logical = 1; + + if ((amd_feature2 & AMDID2_CMP) == 0) { + cpu_cores = 1; + return; + } + + core_id_bits = (cpu_procinfo2 & AMDID_COREID_SIZE) >> + AMDID_COREID_SIZE_SHIFT; + if (core_id_bits == 0) { + cpu_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; + return; + } + + /* Fam 10h and newer should get here. */ + for (id = 0; id <= MAX_APIC_ID; id++) { + /* Check logical CPU availability. */ + if (!cpu_info[id].cpu_present || cpu_info[id].cpu_disabled) + continue; + /* Check if logical CPU has the same package ID. */ + if ((id >> core_id_bits) != (boot_cpu_id >> core_id_bits)) + continue; + cpu_cores++; + } } /* Modified: projects/altix/sys/amd64/conf/GENERIC ============================================================================== --- projects/altix/sys/amd64/conf/GENERIC Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/amd64/conf/GENERIC Sat May 14 20:48:23 2011 (r221915) @@ -165,6 +165,7 @@ device splash # Splash screen and scre # syscons is the default console driver, resembling an SCO console device sc +options SC_PIXEL_MODE # add support for the raster text mode device agp # support several AGP chipsets Modified: projects/altix/sys/amd64/include/clock.h ============================================================================== --- projects/altix/sys/amd64/include/clock.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/amd64/include/clock.h Sat May 14 20:48:23 2011 (r221915) @@ -29,7 +29,6 @@ void i8254_init(void); void startrtclock(void); void init_TSC(void); -void init_TSC_tc(void); #define HAS_TIMER_SPKR 1 int timer_spkr_acquire(void); Modified: projects/altix/sys/amd64/include/specialreg.h ============================================================================== --- projects/altix/sys/amd64/include/specialreg.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/amd64/include/specialreg.h Sat May 14 20:48:23 2011 (r221915) @@ -228,6 +228,8 @@ * AMD extended function 8000_0008h ecx info */ #define AMDID_CMP_CORES 0x000000ff +#define AMDID_COREID_SIZE 0x0000f000 +#define AMDID_COREID_SIZE_SHIFT 12 /* * CPUID manufacturers identifiers Modified: projects/altix/sys/amd64/include/vmparam.h ============================================================================== --- projects/altix/sys/amd64/include/vmparam.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/amd64/include/vmparam.h Sat May 14 20:48:23 2011 (r221915) @@ -212,4 +212,6 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define ZERO_REGION_SIZE (2 * 1024 * 1024) /* 2MB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: projects/altix/sys/arm/arm/pmap.c ============================================================================== --- projects/altix/sys/arm/arm/pmap.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/arm/arm/pmap.c Sat May 14 20:48:23 2011 (r221915) @@ -3646,7 +3646,7 @@ pmap_change_wiring(pmap_t pmap, vm_offse pte = *ptep; pg = PHYS_TO_VM_PAGE(l2pte_pa(pte)); if (pg) - pmap_modify_pv(pg, pmap, va, PVF_WIRED, wired); + pmap_modify_pv(pg, pmap, va, PVF_WIRED, wired ? PVF_WIRED : 0); vm_page_unlock_queues(); PMAP_UNLOCK(pmap); } Modified: projects/altix/sys/arm/include/vmparam.h ============================================================================== --- projects/altix/sys/arm/include/vmparam.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/arm/include/vmparam.h Sat May 14 20:48:23 2011 (r221915) @@ -150,4 +150,7 @@ #ifdef ARM_USE_SMALL_ALLOC #define UMA_MD_SMALL_ALLOC #endif /* ARM_USE_SMALL_ALLOC */ + +#define ZERO_REGION_SIZE (64 * 1024) /* 64KB */ + #endif /* _MACHINE_VMPARAM_H_ */ Modified: projects/altix/sys/boot/Makefile ============================================================================== --- projects/altix/sys/boot/Makefile Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/boot/Makefile Sat May 14 20:48:23 2011 (r221915) @@ -13,7 +13,7 @@ SUBDIR+= fdt .endif # Pick the machine-dependent subdir based on the target architecture. -ADIR= ${MACHINE:S/amd64/i386/:S/sun4v/sparc64/:S/powerpc64/powerpc/} +ADIR= ${MACHINE:S/amd64/i386/:S/powerpc64/powerpc/} .if exists(${.CURDIR}/${ADIR}/.) SUBDIR+= ${ADIR} .endif Modified: projects/altix/sys/boot/common/interp.c ============================================================================== --- projects/altix/sys/boot/common/interp.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/boot/common/interp.c Sat May 14 20:48:23 2011 (r221915) @@ -105,7 +105,7 @@ interact(void) /* * Read our default configuration */ - if(include("/boot/loader.rc")!=CMD_OK) + if (include("/boot/loader.rc") != CMD_OK) include("/boot/boot.conf"); printf("\n"); /* Modified: projects/altix/sys/boot/common/loader.8 ============================================================================== --- projects/altix/sys/boot/common/loader.8 Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/boot/common/loader.8 Sat May 14 20:48:23 2011 (r221915) @@ -597,7 +597,7 @@ Modifies kernel option Limits the amount of KVM reserved for use by the buffer cache, specified in bytes. The default maximum is 200MB on i386, -and 400MB on amd64, sparc64, and sun4v. +and 400MB on amd64 and sparc64. This parameter is used to prevent the buffer cache from eating too much KVM in large-memory machine configurations. Modified: projects/altix/sys/boot/sparc64/loader/main.c ============================================================================== --- projects/altix/sys/boot/sparc64/loader/main.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/boot/sparc64/loader/main.c Sat May 14 20:48:23 2011 (r221915) @@ -113,13 +113,11 @@ static int map_phys(int, size_t, vm_offs static void release_phys(vm_offset_t, u_int); static int __elfN(exec)(struct preloaded_file *); static int mmu_mapin_sun4u(vm_offset_t, vm_size_t); -static int mmu_mapin_sun4v(vm_offset_t, vm_size_t); static vm_offset_t init_heap(void); static phandle_t find_bsp_sun4u(phandle_t, uint32_t); const char *cpu_cpuid_prop_sun4u(void); uint32_t cpu_get_mid_sun4u(void); static void tlb_init_sun4u(void); -static void tlb_init_sun4v(void); #ifdef LOADER_DEBUG typedef u_int64_t tte_t; @@ -129,7 +127,6 @@ static void pmap_print_tte_sun4u(tte_t, #endif static struct mmu_ops mmu_ops_sun4u = { tlb_init_sun4u, mmu_mapin_sun4u }; -static struct mmu_ops mmu_ops_sun4v = { tlb_init_sun4v, mmu_mapin_sun4v }; /* sun4u */ struct tlb_entry *dtlb_store; @@ -140,16 +137,6 @@ static int cpu_impl; static u_int dtlb_slot_max; static u_int itlb_slot_max; -/* sun4v */ -static struct tlb_entry *tlb_store; -static int is_sun4v = 0; -/* - * no direct TLB access on sun4v - * we somewhat arbitrarily declare enough - * slots to cover a 4GB AS with 4MB pages - */ -#define SUN4V_TLB_SLOT_MAX (1 << 10) - static vm_offset_t curkva = 0; static vm_offset_t heapva; @@ -568,47 +555,6 @@ mmu_mapin_sun4u(vm_offset_t va, vm_size_ return (0); } -static int -mmu_mapin_sun4v(vm_offset_t va, vm_size_t len) -{ - vm_offset_t pa, mva; - - if (va + len > curkva) - curkva = va + len; - - pa = (vm_offset_t)-1; - len += va & PAGE_MASK_4M; - va &= ~PAGE_MASK_4M; - while (len) { - if ((va >> 22) > SUN4V_TLB_SLOT_MAX) - panic("%s: trying to map more than 4GB", __func__); - if (tlb_store[va >> 22].te_pa == -1) { - /* Allocate a physical page, claim the virtual area */ - if (pa == (vm_offset_t)-1) { - pa = alloc_phys(PAGE_SIZE_4M, PAGE_SIZE_4M); - if (pa == (vm_offset_t)-1) - panic("%s: out of memory", __func__); - mva = claim_virt(va, PAGE_SIZE_4M, 0); - if (mva != va) - panic("%s: can't claim virtual page " - "(wanted %#lx, got %#lx)", - __func__, va, mva); - } - - tlb_store[va >> 22].te_pa = pa; - if (map_phys(-1, PAGE_SIZE_4M, va, pa) == -1) - printf("%s: can't map physical page\n", - __func__); - pa = (vm_offset_t)-1; - } - len -= len > PAGE_SIZE_4M ? PAGE_SIZE_4M : len; - va += PAGE_SIZE_4M; - } - if (pa != (vm_offset_t)-1) - release_phys(pa, PAGE_SIZE_4M); - return (0); -} - static vm_offset_t init_heap(void) { @@ -739,14 +685,6 @@ tlb_init_sun4u(void) panic("%s: can't allocate TLB store", __func__); } -static void -tlb_init_sun4v(void) -{ - - tlb_store = malloc(SUN4V_TLB_SLOT_MAX * sizeof(*tlb_store)); - memset(tlb_store, 0xFF, SUN4V_TLB_SLOT_MAX * sizeof(*tlb_store)); -} - int main(int (*openfirm)(void *)) { @@ -777,14 +715,7 @@ main(int (*openfirm)(void *)) if ((root = OF_peer(0)) == -1) panic("%s: can't get root phandle", __func__); OF_getprop(root, "compatible", compatible, sizeof(compatible)); - if (!strcmp(compatible, "sun4v")) { - printf("\nBooting with sun4v support.\n"); - mmu_ops = &mmu_ops_sun4v; - is_sun4v = 1; - } else { - printf("\nBooting with sun4u support.\n"); - mmu_ops = &mmu_ops_sun4u; - } + mmu_ops = &mmu_ops_sun4u; mmu_ops->tlb_init(); Modified: projects/altix/sys/cam/scsi/scsi_cd.c ============================================================================== --- projects/altix/sys/cam/scsi/scsi_cd.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/cam/scsi/scsi_cd.c Sat May 14 20:48:23 2011 (r221915) @@ -2138,7 +2138,7 @@ cdioctl(struct disk *dp, u_long cmd, voi ("trying to do CDIOREADTOCHEADER\n")); error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, - sizeof (*th), /*sense_flags*/0); + sizeof (*th), /*sense_flags*/SF_NO_PRINT); if (error) { free(th, M_SCSICD); cam_periph_unlock(periph); Modified: projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Sat May 14 20:48:23 2011 (r221915) @@ -359,26 +359,6 @@ static uint64_t nsec_scale; #define SCALE_SHIFT 28 static void -dtrace_gethrtime_init_sync(void *arg) -{ -#ifdef CHECK_SYNC - /* - * Delay this function from returning on one - * of the CPUs to check that the synchronisation - * works. - */ - uintptr_t cpu = (uintptr_t) arg; - - if (cpu == curcpu) { - int i; - for (i = 0; i < 1000000000; i++) - tgt_cpu_tsc = rdtsc(); - tgt_cpu_tsc = 0; - } -#endif -} - -static void dtrace_gethrtime_init_cpu(void *arg) { uintptr_t cpu = (uintptr_t) arg; @@ -434,7 +414,7 @@ dtrace_gethrtime_init(void *arg) pc = pcpu_find(i); map = PCPU_GET(cpumask) | pc->pc_cpumask; - smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync, + smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, smp_no_rendevous_barrier, (void *)(uintptr_t) i); Modified: projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/cddl/dev/dtrace/i386/dtrace_subr.c Sat May 14 20:48:23 2011 (r221915) @@ -359,26 +359,6 @@ static uint64_t nsec_scale; #define SCALE_SHIFT 28 static void -dtrace_gethrtime_init_sync(void *arg) -{ -#ifdef CHECK_SYNC - /* - * Delay this function from returning on one - * of the CPUs to check that the synchronisation - * works. - */ - uintptr_t cpu = (uintptr_t) arg; - - if (cpu == curcpu) { - int i; - for (i = 0; i < 1000000000; i++) - tgt_cpu_tsc = rdtsc(); - tgt_cpu_tsc = 0; - } -#endif -} - -static void dtrace_gethrtime_init_cpu(void *arg) { uintptr_t cpu = (uintptr_t) arg; @@ -434,7 +414,7 @@ dtrace_gethrtime_init(void *arg) pc = pcpu_find(i); map = PCPU_GET(cpumask) | pc->pc_cpumask; - smp_rendezvous_cpus(map, dtrace_gethrtime_init_sync, + smp_rendezvous_cpus(map, NULL, dtrace_gethrtime_init_cpu, smp_no_rendevous_barrier, (void *)(uintptr_t) i); Modified: projects/altix/sys/conf/kern.mk ============================================================================== --- projects/altix/sys/conf/kern.mk Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/conf/kern.mk Sat May 14 20:48:23 2011 (r221915) @@ -25,11 +25,21 @@ CWARNFLAGS?= -Wall -Wredundant-decls -Wn # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # +# gcc: +# Setting -mno-mmx implies -mno-3dnow +# Setting -mno-sse implies -mno-sse2, -mno-sse3 and -mno-ssse3 +# +# clang: +# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, +# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# .if ${MACHINE_CPUARCH} == "i386" .if ${CC:T:Mclang} != "clang" -CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 +CFLAGS+= -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-sse +.else +CFLAGS+= -mno-aes -mno-avx .endif -CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float +CFLAGS+= -mno-mmx -msoft-float INLINE_LIMIT?= 8000 .endif @@ -61,10 +71,23 @@ INLINE_LIMIT?= 15000 # operations inside the kernel itself. These operations are exclusively # reserved for user applications. # +# gcc: +# Setting -mno-mmx implies -mno-3dnow +# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3 and -mfpmath=387 +# +# clang: +# Setting -mno-mmx implies -mno-3dnow, -mno-3dnowa, -mno-sse, -mno-sse2, +# -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42 +# (-mfpmath= is not supported) +# .if ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -mcmodel=kernel -mno-red-zone \ - -mfpmath=387 -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ - -msoft-float -fno-asynchronous-unwind-tables +.if ${CC:T:Mclang} != "clang" +CFLAGS+= -mno-sse +.else +CFLAGS+= -mno-aes -mno-avx +.endif +CFLAGS+= -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float \ + -fno-asynchronous-unwind-tables INLINE_LIMIT?= 8000 .endif Modified: projects/altix/sys/dev/ahci/ahci.c ============================================================================== --- projects/altix/sys/dev/ahci/ahci.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ahci/ahci.c Sat May 14 20:48:23 2011 (r221915) @@ -164,10 +164,18 @@ static struct { {0x1c038086, 0x00, "Intel Cougar Point", 0}, {0x1c048086, 0x00, "Intel Cougar Point", 0}, {0x1c058086, 0x00, "Intel Cougar Point", 0}, - {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x1d028086, 0x00, "Intel Patsburg", 0}, {0x1d048086, 0x00, "Intel Patsburg", 0}, {0x1d068086, 0x00, "Intel Patsburg", 0}, + {0x1e028086, 0x00, "Intel Panther Point", 0}, + {0x1e038086, 0x00, "Intel Panther Point", 0}, + {0x1e048086, 0x00, "Intel Panther Point", 0}, + {0x1e058086, 0x00, "Intel Panther Point", 0}, + {0x1e068086, 0x00, "Intel Panther Point", 0}, + {0x1e078086, 0x00, "Intel Panther Point", 0}, + {0x1e0e8086, 0x00, "Intel Panther Point", 0}, + {0x1e0f8086, 0x00, "Intel Panther Point", 0}, + {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE}, {0x2363197b, 0x00, "JMicron JMB363", AHCI_Q_NOFORCE}, {0x2365197b, 0x00, "JMicron JMB365", AHCI_Q_NOFORCE}, Modified: projects/altix/sys/dev/ata/ata-pci.h ============================================================================== --- projects/altix/sys/dev/ata/ata-pci.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ata/ata-pci.h Sat May 14 20:48:23 2011 (r221915) @@ -233,6 +233,19 @@ struct ata_pci_controller { #define ATA_PBG_R2 0x1d068086 #define ATA_PBG_S2 0x1d088086 +#define ATA_PPT_S1 0x1e008086 +#define ATA_PPT_S2 0x1e018086 +#define ATA_PPT_AH1 0x1e028086 +#define ATA_PPT_AH2 0x1e038086 +#define ATA_PPT_R1 0x1e048086 +#define ATA_PPT_R2 0x1e058086 +#define ATA_PPT_R3 0x1e068086 +#define ATA_PPT_R4 0x1e078086 +#define ATA_PPT_S3 0x1e088086 +#define ATA_PPT_S4 0x1e098086 +#define ATA_PPT_R5 0x1e0e8086 +#define ATA_PPT_R6 0x1e0f8086 + #define ATA_I31244 0x32008086 #define ATA_ISCH 0x811a8086 #define ATA_DH89XXCC 0x23238086 Modified: projects/altix/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- projects/altix/sys/dev/ata/chipsets/ata-intel.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ata/chipsets/ata-intel.c Sat May 14 20:48:23 2011 (r221915) @@ -181,6 +181,18 @@ ata_intel_probe(device_t dev) { ATA_PBG_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Patsburg" }, { ATA_PBG_S2, 0, INTEL_6CH2, 0, ATA_SA300, "Patsburg" }, + { ATA_PPT_S1, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S2, 0, INTEL_6CH, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_AH1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_AH2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R1, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R2, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R3, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R4, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S3, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_S4, 0, INTEL_6CH2, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R5, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, + { ATA_PPT_R6, 0, INTEL_AHCI, 0, ATA_SA300, "Panther Point" }, { ATA_I31244, 0, 0, 2, ATA_SA150, "31244" }, { ATA_ISCH, 0, 0, 1, ATA_UDMA5, "SCH" }, { ATA_DH89XXCC, 0, INTEL_AHCI, 0, ATA_SA300, "DH89xxCC" }, Modified: projects/altix/sys/dev/ath/ath_hal/ah.c ============================================================================== --- projects/altix/sys/dev/ath/ath_hal/ah.c Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ath/ath_hal/ah.c Sat May 14 20:48:23 2011 (r221915) @@ -585,19 +585,49 @@ ath_hal_getcapability(struct ath_hal *ah return HAL_ENOTSUPP; case HAL_CAP_11D: return HAL_OK; - case HAL_CAP_RXORN_FATAL: /* HAL_INT_RXORN treated as fatal */ - return AH_PRIVATE(ah)->ah_rxornIsFatal ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_HT: return pCap->halHTSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_GTXTO: + return pCap->halGTTSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_FAST_CC: + return pCap->halFastCCSupport ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_TX_CHAINMASK: /* mask of TX chains supported */ *result = pCap->halTxChainMask; return HAL_OK; case HAL_CAP_RX_CHAINMASK: /* mask of RX chains supported */ *result = pCap->halRxChainMask; return HAL_OK; + case HAL_CAP_NUM_GPIO_PINS: + *result = pCap->halNumGpioPins; + return HAL_OK; + case HAL_CAP_CST: + return pCap->halCSTSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_RTS_AGGR_LIMIT: + *result = pCap->halRtsAggrLimit; + return HAL_OK; + case HAL_CAP_4ADDR_AGGR: + return pCap->hal4AddrAggrSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_AUTO_SLEEP: + return pCap->halAutoSleepSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_MBSSID_AGGR_SUPPORT: + return pCap->halMbssidAggrSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_SPLIT_4KB_TRANS: /* hardware handles descriptors straddling 4k page boundary */ + return pCap->hal4kbSplitTransSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_REG_FLAG: + *result = AH_PRIVATE(ah)->ah_currentRDext; + return HAL_OK; + case HAL_CAP_BT_COEX: + return pCap->halBtCoexSupport ? HAL_OK : HAL_ENOTSUPP; + case HAL_CAP_HT20_SGI: + return pCap->halHTSGI20Support ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_RXTSTAMP_PREC: /* rx desc tstamp precision (bits) */ *result = pCap->halTstampPrecision; return HAL_OK; + + /* FreeBSD-specific entries for now */ + case HAL_CAP_RXORN_FATAL: /* HAL_INT_RXORN treated as fatal */ + return AH_PRIVATE(ah)->ah_rxornIsFatal ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_INTRMASK: /* mask of supported interrupts */ *result = pCap->halIntrMask; return HAL_OK; @@ -614,10 +644,6 @@ ath_hal_getcapability(struct ath_hal *ah default: return HAL_ENOTSUPP; } - case HAL_CAP_SPLIT_4KB_TRANS: /* hardware handles descriptors straddling 4k page boundary */ - return pCap->hal4kbSplitTransSupport ? HAL_OK : HAL_ENOTSUPP; - case HAL_CAP_HAS_PSPOLL: /* hardware has ps-poll support */ - return pCap->halHasPsPollSupport ? HAL_OK : HAL_ENOTSUPP; case HAL_CAP_RXDESC_SELFLINK: /* hardware supports self-linked final RX descriptors correctly */ return pCap->halHasRxSelfLinkedTail ? HAL_OK : HAL_ENOTSUPP; default: Modified: projects/altix/sys/dev/ath/ath_hal/ah.h ============================================================================== --- projects/altix/sys/dev/ath/ath_hal/ah.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ath/ath_hal/ah.h Sat May 14 20:48:23 2011 (r221915) @@ -109,21 +109,41 @@ typedef enum { HAL_CAP_TPC_ACK = 26, /* ack txpower with per-packet tpc */ HAL_CAP_TPC_CTS = 27, /* cts txpower with per-packet tpc */ HAL_CAP_11D = 28, /* 11d beacon support for changing cc */ - HAL_CAP_INTMIT = 29, /* interference mitigation */ - HAL_CAP_RXORN_FATAL = 30, /* HAL_INT_RXORN treated as fatal */ - HAL_CAP_HT = 31, /* hardware can support HT */ - HAL_CAP_TX_CHAINMASK = 32, /* mask of TX chains supported */ - HAL_CAP_RX_CHAINMASK = 33, /* mask of RX chains supported */ - HAL_CAP_RXTSTAMP_PREC = 34, /* rx desc tstamp precision (bits) */ - HAL_CAP_BB_HANG = 35, /* can baseband hang */ - HAL_CAP_MAC_HANG = 36, /* can MAC hang */ - HAL_CAP_INTRMASK = 37, /* bitmask of supported interrupts */ - HAL_CAP_BSSIDMATCH = 38, /* hardware has disable bssid match */ - HAL_CAP_STREAMS = 39, /* how many 802.11n spatial streams are available */ - HAL_CAP_SPLIT_4KB_TRANS = 40, /* hardware supports descriptors straddling a 4k page boundary */ - HAL_CAP_HAS_PSPOLL = 41, /* hardware has ps-poll support */ - HAL_CAP_RXDESC_SELFLINK = 42, /* support a self-linked tail RX descriptor */ - HAL_CAP_GTXTO = 43, /* hardware supports global tx timeout */ + + HAL_CAP_HT = 30, /* hardware can support HT */ + HAL_CAP_GTXTO = 31, /* hardware supports global tx timeout */ + HAL_CAP_FAST_CC = 32, /* hardware supports fast channel change */ + HAL_CAP_TX_CHAINMASK = 33, /* mask of TX chains supported */ + HAL_CAP_RX_CHAINMASK = 34, /* mask of RX chains supported */ + HAL_CAP_NUM_GPIO_PINS = 36, /* number of GPIO pins */ + + HAL_CAP_CST = 38, /* hardware supports carrier sense timeout */ + + HAL_CAP_RTS_AGGR_LIMIT = 42, /* aggregation limit with RTS */ + HAL_CAP_4ADDR_AGGR = 43, /* hardware is capable of 4addr aggregation */ + + HAL_CAP_AUTO_SLEEP = 48, /* hardware can go to network sleep + automatically after waking up to receive TIM */ + HAL_CAP_MBSSID_AGGR_SUPPORT = 49, /* Support for mBSSID Aggregation */ + HAL_CAP_SPLIT_4KB_TRANS = 50, /* hardware supports descriptors straddling a 4k page boundary */ + HAL_CAP_REG_FLAG = 51, /* Regulatory domain flags */ + + HAL_CAP_BT_COEX = 60, /* hardware is capable of bluetooth coexistence */ + + HAL_CAP_HT20_SGI = 96, /* hardware supports HT20 short GI */ + + HAL_CAP_RXTSTAMP_PREC = 100, /* rx desc tstamp precision (bits) */ + + /* The following are private to the FreeBSD HAL (224 onward) */ + + HAL_CAP_INTMIT = 229, /* interference mitigation */ + HAL_CAP_RXORN_FATAL = 230, /* HAL_INT_RXORN treated as fatal */ + HAL_CAP_BB_HANG = 235, /* can baseband hang */ + HAL_CAP_MAC_HANG = 236, /* can MAC hang */ + HAL_CAP_INTRMASK = 237, /* bitmask of supported interrupts */ + HAL_CAP_BSSIDMATCH = 238, /* hardware has disable bssid match */ + HAL_CAP_STREAMS = 239, /* how many 802.11n spatial streams are available */ + HAL_CAP_RXDESC_SELFLINK = 242, /* support a self-linked tail RX descriptor */ } HAL_CAPABILITY_TYPE; /* Modified: projects/altix/sys/dev/ath/ath_hal/ah_debug.h ============================================================================== --- projects/altix/sys/dev/ath/ath_hal/ah_debug.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ath/ath_hal/ah_debug.h Sat May 14 20:48:23 2011 (r221915) @@ -45,7 +45,10 @@ enum { HAL_DEBUG_GPIO = 0x00040000, /* GPIO debugging */ HAL_DEBUG_INTERRUPT = 0x00080000, /* interrupt handling */ HAL_DEBUG_DIVERSITY = 0x00100000, /* diversity debugging */ + HAL_DEBUG_DFS = 0x00200000, /* DFS debugging */ + HAL_DEBUG_HANG = 0x00400000, /* BB/MAC hang debugging */ + HAL_DEBUG_UNMASKABLE = 0xf0000000, /* always printed */ HAL_DEBUG_ANY = 0xffffffff }; #endif /* _ATH_AH_DEBUG_H_ */ Modified: projects/altix/sys/dev/ath/ath_hal/ah_eeprom.h ============================================================================== --- projects/altix/sys/dev/ath/ath_hal/ah_eeprom.h Sat May 14 20:35:01 2011 (r221914) +++ projects/altix/sys/dev/ath/ath_hal/ah_eeprom.h Sat May 14 20:48:23 2011 (r221915) @@ -133,4 +133,5 @@ HAL_STATUS ath_hal_v1EepromAttach(struct HAL_STATUS ath_hal_legacyEepromAttach(struct ath_hal *ah); HAL_STATUS ath_hal_v14EepromAttach(struct ath_hal *ah); HAL_STATUS ath_hal_v4kEepromAttach(struct ath_hal *ah); +HAL_STATUS ath_hal_9287EepromAttach(struct ath_hal *ah); #endif /* _ATH_AH_EEPROM_H_ */ Copied: projects/altix/sys/dev/ath/ath_hal/ah_eeprom_9287.c (from r221894, head/sys/dev/ath/ath_hal/ah_eeprom_9287.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/altix/sys/dev/ath/ath_hal/ah_eeprom_9287.c Sat May 14 20:48:23 2011 (r221915, copy of r221894, head/sys/dev/ath/ath_hal/ah_eeprom_9287.c) @@ -0,0 +1,405 @@ +/* + * Copyright (c) 2008 Sam Leffler, Errno Consulting + * Copyright (c) 2010 Atheros Communications, Inc. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * $FreeBSD$ + */ +#include "opt_ah.h" + +#include "ah.h" +#include "ah_internal.h" +#include "ah_eeprom_v14.h" +#include "ah_eeprom_9287.h" + +static HAL_STATUS +v9287EepromGet(struct ath_hal *ah, int param, void *val) +{ +#define CHAN_A_IDX 0 +#define CHAN_B_IDX 1 +#define IS_VERS(op, v) ((pBase->version & AR5416_EEP_VER_MINOR_MASK) op (v)) + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + const MODAL_EEP_9287_HEADER *pModal = &ee->ee_base.modalHeader; + const BASE_EEP_9287_HEADER *pBase = &ee->ee_base.baseEepHeader; + uint32_t sum; + uint8_t *macaddr; + int i; + + switch (param) { + case AR_EEP_NFTHRESH_2: + *(int16_t *)val = pModal->noiseFloorThreshCh[0]; + return HAL_OK; + case AR_EEP_MACADDR: /* Get MAC Address */ + sum = 0; + macaddr = val; + for (i = 0; i < 6; i++) { + macaddr[i] = pBase->macAddr[i]; + sum += pBase->macAddr[i]; + } + if (sum == 0 || sum == 0xffff*3) { + HALDEBUG(ah, HAL_DEBUG_ANY, "%s: bad mac address %s\n", + __func__, ath_hal_ether_sprintf(macaddr)); + return HAL_EEBADMAC; + } + return HAL_OK; + case AR_EEP_REGDMN_0: + return pBase->regDmn[0]; + case AR_EEP_REGDMN_1: + return pBase->regDmn[1]; + case AR_EEP_OPCAP: + return pBase->deviceCap; + case AR_EEP_OPMODE: + return pBase->opCapFlags; + case AR_EEP_RFSILENT: + return pBase->rfSilent; +#if 0 + case AR_EEP_OB_5: + return pModal[CHAN_A_IDX].ob; + case AR_EEP_DB_5: + return pModal[CHAN_A_IDX].db; + case AR_EEP_OB_2: + return pModal[CHAN_B_IDX].ob; + case AR_EEP_DB_2: + return pModal[CHAN_B_IDX].db; +#endif + case AR_EEP_TXMASK: + return pBase->txMask; + case AR_EEP_RXMASK: + return pBase->rxMask; +#if 0 + case AR_EEP_RXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_17) ? + pBase->rxGainType : AR5416_EEP_RXGAIN_ORIG; + case AR_EEP_TXGAIN_TYPE: + return IS_VERS(>=, AR5416_EEP_MINOR_VER_19) ? + pBase->txGainType : AR5416_EEP_TXGAIN_ORIG; +#endif + case AR_EEP_OL_PWRCTRL: + HALASSERT(val == AH_NULL); + return pBase->openLoopPwrCntl ? HAL_OK : HAL_EIO; + case AR_EEP_AMODE: + return HAL_EIO; /* no 5GHz for Kiwi */ + case AR_EEP_BMODE: + case AR_EEP_GMODE: + HALASSERT(val == AH_NULL); + return pBase->opCapFlags & AR5416_OPFLAGS_11G ? + HAL_OK : HAL_EIO; + case AR_EEP_32KHZCRYSTAL: + case AR_EEP_COMPRESS: + case AR_EEP_FASTFRAME: /* XXX policy decision, h/w can do it */ + case AR_EEP_WRITEPROTECT: /* NB: no write protect bit */ + HALASSERT(val == AH_NULL); + /* fall thru... */ + case AR_EEP_MAXQCU: /* NB: not in opCapFlags */ + case AR_EEP_KCENTRIES: /* NB: not in opCapFlags */ + return HAL_EIO; + case AR_EEP_AES: + case AR_EEP_BURST: + case AR_EEP_RFKILL: + case AR_EEP_TURBO5DISABLE: + case AR_EEP_TURBO2DISABLE: + HALASSERT(val == AH_NULL); + return HAL_OK; + case AR_EEP_ANTGAINMAX_2: + *(int8_t *) val = ee->ee_antennaGainMax[1]; + return HAL_OK; + case AR_EEP_PWR_TABLE_OFFSET: + *(int8_t *) val = pBase->pwrTableOffset; + return HAL_OK; + default: + HALASSERT(0); + return HAL_EINVAL; + } +#undef IS_VERS +#undef CHAN_A_IDX +#undef CHAN_B_IDX +} + +static HAL_BOOL +v9287EepromSet(struct ath_hal *ah, int param, int v) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (param) { + case AR_EEP_ANTGAINMAX_2: + ee->ee_antennaGainMax[1] = (int8_t) v; + return HAL_OK; + case AR_EEP_ANTGAINMAX_5: + ee->ee_antennaGainMax[0] = (int8_t) v; + return HAL_OK; + } + return HAL_EINVAL; +} + +static HAL_BOOL +v9287EepromDiag(struct ath_hal *ah, int request, + const void *args, uint32_t argsize, void **result, uint32_t *resultsize) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + switch (request) { + case HAL_DIAG_EEPROM: + *result = ee; + *resultsize = sizeof(HAL_EEPROM_9287); + return AH_TRUE; + } + return AH_FALSE; +} + +/* Do structure specific swaps if Eeprom format is non native to host */ +static void +eepromSwap(HAL_EEPROM_9287 *ee) +{ + uint32_t integer, i; + uint16_t word; + MODAL_EEP_9287_HEADER *pModal; + + /* convert Base Eep header */ + word = __bswap16(ee->ee_base.baseEepHeader.length); + ee->ee_base.baseEepHeader.length = word; + + word = __bswap16(ee->ee_base.baseEepHeader.checksum); + ee->ee_base.baseEepHeader.checksum = word; + + word = __bswap16(ee->ee_base.baseEepHeader.version); + ee->ee_base.baseEepHeader.version = word; + + word = __bswap16(ee->ee_base.baseEepHeader.regDmn[0]); + ee->ee_base.baseEepHeader.regDmn[0] = word; + + word = __bswap16(ee->ee_base.baseEepHeader.regDmn[1]); + ee->ee_base.baseEepHeader.regDmn[1] = word; + + word = __bswap16(ee->ee_base.baseEepHeader.rfSilent); + ee->ee_base.baseEepHeader.rfSilent = word; + + word = __bswap16(ee->ee_base.baseEepHeader.blueToothOptions); + ee->ee_base.baseEepHeader.blueToothOptions = word; + + word = __bswap16(ee->ee_base.baseEepHeader.deviceCap); + ee->ee_base.baseEepHeader.deviceCap = word; + + /* convert Modal Eep header */ + + /* only 2.4ghz here; so only one modal header entry */ + pModal = &ee->ee_base.modalHeader; + + /* XXX linux/ah_osdep.h only defines __bswap32 for BE */ + integer = __bswap32(pModal->antCtrlCommon); + pModal->antCtrlCommon = integer; + + for (i = 0; i < AR9287_MAX_CHAINS; i++) { + integer = __bswap32(pModal->antCtrlChain[i]); + pModal->antCtrlChain[i] = integer; + } + for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) { + word = __bswap16(pModal->spurChans[i].spurChan); + pModal->spurChans[i].spurChan = word; + } +} + +static uint16_t +v9287EepromGetSpurChan(struct ath_hal *ah, int ix, HAL_BOOL is2GHz) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + HALASSERT(is2GHz == AH_TRUE); + if (is2GHz != AH_TRUE) + return 0; /* XXX ? */ + + HALASSERT(0 <= ix && ix < AR5416_EEPROM_MODAL_SPURS); + return ee->ee_base.modalHeader.spurChans[ix].spurChan; +} + +/************************************************************************** + * fbin2freq + * + * Get channel value from binary representation held in eeprom + * RETURNS: the frequency in MHz + */ +static uint16_t +fbin2freq(uint8_t fbin, HAL_BOOL is2GHz) +{ + /* + * Reserved value 0xFF provides an empty definition both as + * an fbin and as a frequency - do not convert + */ + if (fbin == AR5416_BCHAN_UNUSED) + return fbin; + return (uint16_t)((is2GHz) ? (2300 + fbin) : (4800 + 5 * fbin)); +} + + +/* + * Copy EEPROM Conformance Testing Limits contents + * into the allocated space + */ +/* USE CTLS from chain zero */ +#define CTL_CHAIN 0 + +static void +v9287EepromReadCTLInfo(struct ath_hal *ah, HAL_EEPROM_9287 *ee) +{ + RD_EDGES_POWER *rep = ee->ee_rdEdgesPower; + int i, j; + + HALASSERT(AR9287_NUM_CTLS <= sizeof(ee->ee_rdEdgesPower)/NUM_EDGES); + + for (i = 0; ee->ee_base.ctlIndex[i] != 0 && i < AR9287_NUM_CTLS; i++) { + for (j = 0; j < NUM_EDGES; j ++) { + /* XXX Confirm this is the right thing to do when an invalid channel is stored */ + if (ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel == AR5416_BCHAN_UNUSED) { + rep[j].rdEdge = 0; + rep[j].twice_rdEdgePower = 0; + rep[j].flag = 0; + } else { + rep[j].rdEdge = fbin2freq( + ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].bChannel, + (ee->ee_base.ctlIndex[i] & CTL_MODE_M) != CTL_11A); + rep[j].twice_rdEdgePower = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_POWER); + rep[j].flag = MS(ee->ee_base.ctlData[i].ctlEdges[CTL_CHAIN][j].tPowerFlag, CAL_CTL_EDGES_FLAG) != 0; + } + } + rep += NUM_EDGES; + } + ee->ee_numCtls = i; + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "%s Numctls = %u\n",__func__,i); +} + +/* + * Reclaim any EEPROM-related storage. + */ +static void +v9287EepromDetach(struct ath_hal *ah) +{ + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + + ath_hal_free(ee); + AH_PRIVATE(ah)->ah_eeprom = AH_NULL; +} + +#define owl_get_eep_ver(_ee) \ + (((_ee)->ee_base.baseEepHeader.version >> 12) & 0xF) +#define owl_get_eep_rev(_ee) \ + (((_ee)->ee_base.baseEepHeader.version) & 0xFFF) + +HAL_STATUS +ath_hal_9287EepromAttach(struct ath_hal *ah) +{ +#define NW(a) (sizeof(a) / sizeof(uint16_t)) + HAL_EEPROM_9287 *ee = AH_PRIVATE(ah)->ah_eeprom; + uint16_t *eep_data, magic; + HAL_BOOL need_swap; + u_int w, off, len; + uint32_t sum; + + HALASSERT(ee == AH_NULL); + + if (!ath_hal_eepromRead(ah, AR5416_EEPROM_MAGIC_OFFSET, &magic)) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s Error reading Eeprom MAGIC\n", __func__); + return HAL_EEREAD; + } + HALDEBUG(ah, HAL_DEBUG_ATTACH, "%s Eeprom Magic = 0x%x\n", + __func__, magic); + if (magic != AR5416_EEPROM_MAGIC) { + HALDEBUG(ah, HAL_DEBUG_ANY, "Bad magic number\n"); + return HAL_EEMAGIC; + } + + ee = ath_hal_malloc(sizeof(HAL_EEPROM_9287)); + if (ee == AH_NULL) { + /* XXX message */ + return HAL_ENOMEM; + } + + eep_data = (uint16_t *) ee; + for (w = 0; w < NW(struct ar9287_eeprom); w++) { + off = AR9287_EEP_START_LOC + w; + if (!ath_hal_eepromRead(ah, off, &eep_data[w])) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "%s eeprom read error at offset 0x%x\n", + __func__, off); + return HAL_EEREAD; + } + } + /* Convert to eeprom native eeprom endian format */ + if (isBigEndian()) { + for (w = 0; w < NW(HAL_EEPROM_9287); w++) + eep_data[w] = __bswap16(eep_data[w]); + } + + /* + * At this point, we're in the native eeprom endian format + * Now, determine the eeprom endian by looking at byte 26?? + */ + need_swap = ((ee->ee_base.baseEepHeader.eepMisc & AR5416_EEPMISC_BIG_ENDIAN) != 0) ^ isBigEndian(); + if (need_swap) { + HALDEBUG(ah, HAL_DEBUG_ATTACH | HAL_DEBUG_EEPROM, + "Byte swap EEPROM contents.\n"); + len = __bswap16(ee->ee_base.baseEepHeader.length); + } else { + len = ee->ee_base.baseEepHeader.length; + } + len = AH_MIN(len, sizeof(HAL_EEPROM_9287)) / sizeof(uint16_t); + + /* Apply the checksum, done in native eeprom format */ + /* XXX - Need to check to make sure checksum calculation is done + * in the correct endian format. Right now, it seems it would + * cast the raw data to host format and do the calculation, which may + * not be correct as the calculation may need to be done in the native + * eeprom format + */ + sum = 0; + for (w = 0; w < len; w++) + sum ^= eep_data[w]; + /* Check CRC - Attach should fail on a bad checksum */ + if (sum != 0xffff) { + HALDEBUG(ah, HAL_DEBUG_ANY, + "Bad EEPROM checksum 0x%x (Len=%u)\n", sum, len); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Sat May 14 23:20:14 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2560106566B; Sat, 14 May 2011 23:20:14 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 925CD8FC0A; Sat, 14 May 2011 23:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4ENKE5E019158; Sat, 14 May 2011 23:20:14 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4ENKEFB019156; Sat, 14 May 2011 23:20:14 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201105142320.p4ENKEFB019156@svn.freebsd.org> From: Marius Strobl Date: Sat, 14 May 2011 23:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221932 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 23:20:14 -0000 Author: marius Date: Sat May 14 23:20:14 2011 New Revision: 221932 URL: http://svn.freebsd.org/changeset/base/221932 Log: Fix yet another inversion in the logic by applying the x86 version of this, which avoids CPU_EMPTY() in the first place. Do I get a beer or something for every inversion I find? Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Sat May 14 22:15:38 2011 (r221931) +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c Sat May 14 23:20:14 2011 (r221932) @@ -573,8 +573,8 @@ spitfire_ipi_selected(cpuset_t cpus, u_l { u_int cpu; - while (CPU_EMPTY(&cpus)) { - cpu = cpusetobj_ffs(&cpus) - 1; + while ((cpu = cpusetobj_ffs(&cpus)) != 0) { + cpu--; CPU_CLR(cpu, &cpus); spitfire_ipi_single(cpu, d0, d1, d2); } From owner-svn-src-projects@FreeBSD.ORG Sat May 14 23:30:30 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 593471065688; Sat, 14 May 2011 23:30:30 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id E2E7C8FC12; Sat, 14 May 2011 23:30:29 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p4ENUSUU058440; Sun, 15 May 2011 01:30:28 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p4ENUSlP058439; Sun, 15 May 2011 01:30:28 +0200 (CEST) (envelope-from marius) Date: Sun, 15 May 2011 01:30:28 +0200 From: Marius Strobl To: Attilio Rao Message-ID: <20110514233028.GF92688@alchemy.franken.de> References: <201105131521.p4DFLVKs074711@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221842 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 23:30:30 -0000 On Fri, May 13, 2011 at 05:28:59PM +0200, Attilio Rao wrote: > 2011/5/13 Marius Strobl : > > Author: marius > > Date: Fri May 13 15:21:31 2011 > > New Revision: 221842 > > URL: http://svn.freebsd.org/changeset/base/221842 > > > > Log: > > ??When setting up pc_other_cpus for APs based on pc_allcpu clear pc_cpuid > > ??in the former rather than the latter. > > ??This gets this branch working on at least Jalapeno-class CPUs. > > > > Modified: > > ??projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c > > > > Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c > > ============================================================================== > > --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ??Fri May 13 15:20:57 2011 ?? ?? ?? ??(r221841) > > +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ??Fri May 13 15:21:31 2011 ?? ?? ?? ??(r221842) > > @@ -470,7 +470,7 @@ cpu_mp_bootstrap(struct pcpu *pc) > > ?? ?? ?? ??smp_cpus++; > > ?? ?? ?? ??KASSERT(curthread != NULL, ("%s: curthread", __func__)); > > ?? ?? ?? ??ocpus = all_cpus; > > - ?? ?? ?? CPU_CLR(curcpu, &all_cpus); > > + ?? ?? ?? CPU_CLR(curcpu, &ocpus); > > ?? ?? ?? ??PCPU_SET(other_cpus, ocpus); > > ?? ?? ?? ??printf("SMP: AP CPU #%d Launched!\n", curcpu); > > > > > > How idiot can I be? > I watched that path like 10 times yesterday... > FYI, as of r221932 this branch now works MP on all three classes of Cheetah, Jalapeno and Spitfire CPUs. While working on this I noticed that there's a bit of room for improvement in the sparc64 IPI code, which I'll commit once this branch has been merged into head. Then I'll also add support for more than 32 CPUs in the MD part, both of which really are orthogonal to the cpuset_t conversion. Marius From owner-svn-src-projects@FreeBSD.ORG Sat May 14 23:40:38 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78C25106566B; Sat, 14 May 2011 23:40:38 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id 21ACE8FC13; Sat, 14 May 2011 23:40:37 +0000 (UTC) Received: by yxl31 with SMTP id 31so1524216yxl.13 for ; Sat, 14 May 2011 16:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=sxEip4rRqZMOIBmKlKjwlHlyHeM78dsTZBViM7QSwD8=; b=p98meL+e+zttPyMn9uYyhPkH7fpLSRjxj4SnjXf1OEYPLEBdS3OoEUFYPFZQ34ClgL Fvhn9j7Bovi0OCTaSXStYEBLv0q1ZVLMBsb2H5QWMxzgiIqJWN3apvldfrRQn5MmOovX zD3/zGWlFenELXo87eXURK9PhqFNbB/+jxVds= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=MtWWhAHLfomOufSQQnrkXdDB4pgAjXKqrPArbNuAWFTLY1xB5aRXhmixmzbCKLqabE apk0kIYTYgKPznlZUaEE4CThLOm1BCRW7oBiiYwbhCYSLk1auYHgB3qZ3bMRQQSz1mVH /kXDnJXGQOsVJa4qM5k19LWkXSG6seB7Ou0PI= MIME-Version: 1.0 Received: by 10.236.192.230 with SMTP id i66mr2876408yhn.482.1305416435899; Sat, 14 May 2011 16:40:35 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.236.103.130 with HTTP; Sat, 14 May 2011 16:40:35 -0700 (PDT) In-Reply-To: <20110514233028.GF92688@alchemy.franken.de> References: <201105131521.p4DFLVKs074711@svn.freebsd.org> <20110514233028.GF92688@alchemy.franken.de> Date: Sun, 15 May 2011 01:40:35 +0200 X-Google-Sender-Auth: CT71wIxIqRbuc3qQUGQPnFdr1E4 Message-ID: From: Attilio Rao To: Marius Strobl Content-Type: text/plain; charset=UTF-8 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r221842 - projects/largeSMP/sys/sparc64/sparc64 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 May 2011 23:40:38 -0000 2011/5/15 Marius Strobl : > On Fri, May 13, 2011 at 05:28:59PM +0200, Attilio Rao wrote: >> 2011/5/13 Marius Strobl : >> > Author: marius >> > Date: Fri May 13 15:21:31 2011 >> > New Revision: 221842 >> > URL: http://svn.freebsd.org/changeset/base/221842 >> > >> > Log: >> > ??When setting up pc_other_cpus for APs based on pc_allcpu clear pc_cpuid >> > ??in the former rather than the latter. >> > ??This gets this branch working on at least Jalapeno-class CPUs. >> > >> > Modified: >> > ??projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c >> > >> > Modified: projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c >> > ============================================================================== >> > --- projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ??Fri May 13 15:20:57 2011 ?? ?? ?? ??(r221841) >> > +++ projects/largeSMP/sys/sparc64/sparc64/mp_machdep.c ??Fri May 13 15:21:31 2011 ?? ?? ?? ??(r221842) >> > @@ -470,7 +470,7 @@ cpu_mp_bootstrap(struct pcpu *pc) >> > ?? ?? ?? ??smp_cpus++; >> > ?? ?? ?? ??KASSERT(curthread != NULL, ("%s: curthread", __func__)); >> > ?? ?? ?? ??ocpus = all_cpus; >> > - ?? ?? ?? CPU_CLR(curcpu, &all_cpus); >> > + ?? ?? ?? CPU_CLR(curcpu, &ocpus); >> > ?? ?? ?? ??PCPU_SET(other_cpus, ocpus); >> > ?? ?? ?? ??printf("SMP: AP CPU #%d Launched!\n", curcpu); >> > >> > >> >> How idiot can I be? >> I watched that path like 10 times yesterday... >> > > FYI, as of r221932 this branch now works MP on all three classes of > Cheetah, Jalapeno and Spitfire CPUs. While working on this I noticed > that there's a bit of room for improvement in the sparc64 IPI code, > which I'll commit once this branch has been merged into head. Then > I'll also add support for more than 32 CPUs in the MD part, both > of which really are orthogonal to the cpuset_t conversion. Thanks a lot for testing. You may be interested to know (as you are not at BSDCan) che this morning we booted a 128 CPUs amd machines with 8 domains level NUMA. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein