Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 May 2002 13:10:00 -0500
From:      Alan Cox <alc@cs.rice.edu>
To:        Doug Rabson <dfr@nlsystems.com>
Cc:        John Baldwin <jhb@FreeBSD.org>, Jeff Roberson <jroberson@chesapeake.net>, alpha@FreeBSD.org, obrien@FreeBSD.org, Andrew Gallatin <gallatin@cs.duke.edu>
Subject:   Re: gcc3 & alpha kernels
Message-ID:  <20020513181000.GA15621@cs.rice.edu>
In-Reply-To: <200205131012.38702.dfr@nlsystems.com>
References:  <XFMail.20020510235017.jhb@FreeBSD.org> <200205131012.38702.dfr@nlsystems.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Mon, May 13, 2002 at 10:12:38AM +0100, Doug Rabson wrote:
> On Saturday 11 May 2002 4:50 am, John Baldwin wrote:
> > On 11-May-2002 Alan Cox wrote:
> > > On Fri, May 10, 2002 at 08:48:37PM -0400, John Baldwin wrote:
> > >> ... I suggest that all the atomic
> > >> ops buried in the vm code be checked very carefully for these types of
> > >> short/int mismatches as well as any int/long mismatches and the like.
> > >
> > > In the MI parts of the vm, outside of _vm_object_allocate(),
> > > there is only one other use of atomic ops and that simply
> > > adds 1 to an u_int.  The rest were removed when Giant was
> > > introduced.
> >
> > Hmm.  Ok, after talking with jeff@ it is getting weirder.  I was wrong
> > at first as we are hanging on the second atomic_cmpset, not hte first
> > (printf's help).  It seems that gcc has a bug (*sigh*) in that instead of
> > usign 'zapnot' to zero extned the unsigned int it passes in, it is now
> > using addl s0,zero,s0, but addl does sign extension on its result, so now
> > we get a sign extended version to compare against.  Thus, one way of fixing
> > this is to revert Jeff's earlier fix.  However, it is arguably wrong for
> > gcc to be sign-extending the unsigned int it is passing in.
> 
> I've seen similar behaviour with gcc3 on ia64.
> 

Could you please test the following patch and let me know if it helps?  (It
converts the types of various fields and variables to unsigned.  It also
reorders two fields to reduce alignment induced padding per Andrew's
suggestion.)

Regards,
Alan

--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="vm_object.patch"

Index: vm/vm_object.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_object.c,v
retrieving revision 1.211
diff -c -r1.211 vm_object.c
*** vm/vm_object.c	6 May 2002 05:45:57 -0000	1.211
--- vm/vm_object.c	11 May 2002 17:35:15 -0000
***************
*** 146,152 ****
  
  static long object_collapses;
  static long object_bypasses;
! static int next_index;
  static uma_zone_t obj_zone;
  #define VM_OBJECTS_INIT 256
  
--- 146,152 ----
  
  static long object_collapses;
  static long object_bypasses;
! static u_int next_index;
  static uma_zone_t obj_zone;
  #define VM_OBJECTS_INIT 256
  
***************
*** 189,196 ****
  void
  _vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object)
  {
! 	static int object_hash_rand;
! 	int exp, incr;
  
  	TAILQ_INIT(&object->memq);
  	TAILQ_INIT(&object->shadow_head);
--- 189,196 ----
  void
  _vm_object_allocate(objtype_t type, vm_size_t size, vm_object_t object)
  {
! 	static u_int object_hash_rand;
! 	u_int exp, incr;
  
  	TAILQ_INIT(&object->memq);
  	TAILQ_INIT(&object->shadow_head);
Index: vm/vm_object.h
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_object.h,v
retrieving revision 1.78
diff -c -r1.78 vm_object.h
*** vm/vm_object.h	6 May 2002 00:12:47 -0000	1.78
--- vm/vm_object.h	11 May 2002 17:35:15 -0000
***************
*** 92,102 ****
  	TAILQ_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
  	TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
  	TAILQ_HEAD(, vm_page) memq;	/* list of resident pages */
- 	int generation;			/* generation ID */
  	vm_size_t size;			/* Object size */
  	int ref_count;			/* How many refs?? */
  	int shadow_count;		/* how many objects that this is a shadow for */
! 	int hash_rand;			/* (c) hash table randomizer */
  	objtype_t type;			/* type of pager */
  	u_short flags;			/* see below */
  	u_short pg_color;		/* (c) color of first page in obj */
--- 92,102 ----
  	TAILQ_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */
  	TAILQ_ENTRY(vm_object) shadow_list; /* chain of shadow objects */
  	TAILQ_HEAD(, vm_page) memq;	/* list of resident pages */
  	vm_size_t size;			/* Object size */
+ 	int generation;			/* generation ID */
  	int ref_count;			/* How many refs?? */
  	int shadow_count;		/* how many objects that this is a shadow for */
! 	u_int hash_rand;		/* (c) hash table randomizer */
  	objtype_t type;			/* type of pager */
  	u_short flags;			/* see below */
  	u_short pg_color;		/* (c) color of first page in obj */

--C7zPtVaVf+AK4Oqc--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020513181000.GA15621>