From owner-freebsd-bugs@FreeBSD.ORG Fri Oct 8 12:30:02 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 834EF106564A for ; Fri, 8 Oct 2010 12:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 458B78FC15 for ; Fri, 8 Oct 2010 12:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o98CU25F093824 for ; Fri, 8 Oct 2010 12:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o98CU29Z093821; Fri, 8 Oct 2010 12:30:02 GMT (envelope-from gnats) Resent-Date: Fri, 8 Oct 2010 12:30:02 GMT Resent-Message-Id: <201010081230.o98CU29Z093821@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Svatopluk Kraus Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66654106564A for ; Fri, 8 Oct 2010 12:26:38 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7578FC16 for ; Fri, 8 Oct 2010 12:26:38 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o98CQbCn024223 for ; Fri, 8 Oct 2010 12:26:37 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o98CQbBI024222; Fri, 8 Oct 2010 12:26:37 GMT (envelope-from nobody) Message-Id: <201010081226.o98CQbBI024222@www.freebsd.org> Date: Fri, 8 Oct 2010 12:26:37 GMT From: Svatopluk Kraus To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/151304: patch - definitions of variables tested by ASSERT_ATOMIC_LOAD_PTR X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 12:30:02 -0000 >Number: 151304 >Category: kern >Synopsis: patch - definitions of variables tested by ASSERT_ATOMIC_LOAD_PTR >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Oct 08 12:30:01 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Svatopluk Kraus >Release: current >Organization: >Environment: coldfire port >Description: A macro ASSERT_ATOMIC_LOAD_PTR() hits in colfire port I work on. It is possibly due to use of GNU GCC (4.5.1) compiler -Os option (size optimalization). The macro is applied on four places: sys/kern/kern_lock.c sys/kern/kern_mutex.c sys/kern/kern_rwlock.c sys/kern/kern_sx.c and tests entries in four structures: volatile uintptr_t lk_lock -> struct lock -> sys/sys/_lockmgr.h volatile uintptr_t mtx_lock -> struct mtx -> sys/sys/_mutex.h volatile uintptr_t rw_lock -> struct rwlock -> sys/sys/_rwlock.h volatile uintptr_t sx_lock -> struct sx -> sys/sys/_sx.h >How-To-Repeat: >Fix: I patch the entries definitions in structures by align attribute, I believe it is better than to do nothing. Moreover, it solved my problem. Patch attached with submission follows: Index: sys/sys/_rwlock.h =================================================================== --- sys/sys/_rwlock.h (revision 213567) +++ sys/sys/_rwlock.h (working copy) @@ -37,7 +37,7 @@ */ struct rwlock { struct lock_object lock_object; - volatile uintptr_t rw_lock; + volatile uintptr_t rw_lock __aligned(4); }; #endif /* !_SYS__RWLOCK_H_ */ Index: sys/sys/_sx.h =================================================================== --- sys/sys/_sx.h (revision 213567) +++ sys/sys/_sx.h (working copy) @@ -36,7 +36,7 @@ */ struct sx { struct lock_object lock_object; - volatile uintptr_t sx_lock; + volatile uintptr_t sx_lock __aligned(4); }; #endif /* !_SYS__SX_H_ */ Index: sys/sys/_lockmgr.h =================================================================== --- sys/sys/_lockmgr.h (revision 213567) +++ sys/sys/_lockmgr.h (working copy) @@ -37,7 +37,7 @@ struct lock { struct lock_object lock_object; - volatile uintptr_t lk_lock; + volatile uintptr_t lk_lock __aligned(4); u_int lk_exslpfail; int lk_timo; int lk_pri; Index: sys/sys/_mutex.h =================================================================== --- sys/sys/_mutex.h (revision 213567) +++ sys/sys/_mutex.h (working copy) @@ -35,8 +35,8 @@ * Sleep/spin mutex. */ struct mtx { - struct lock_object lock_object; /* Common lock properties. */ - volatile uintptr_t mtx_lock; /* Owner and flags. */ + struct lock_object lock_object; /* Common lock properties. */ + volatile uintptr_t mtx_lock __aligned(4); /* Owner and flags. */ }; #endif /* !_SYS__MUTEX_H_ */ >Release-Note: >Audit-Trail: >Unformatted: