From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 1 17:10:53 2013 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B43063B8; Fri, 1 Mar 2013 17:10:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A6251A4B; Fri, 1 Mar 2013 17:10:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id r21HAr82019408; Fri, 1 Mar 2013 17:10:53 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id r21HAqHR019398; Fri, 1 Mar 2013 17:10:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201303011710.r21HAqHR019398@svn.freebsd.org> From: John Baldwin Date: Fri, 1 Mar 2013 17:10:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r247556 - in stable/8/sys: dev/usb/net kern pci sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2013 17:10:53 -0000 Author: jhb Date: Fri Mar 1 17:10:52 2013 New Revision: 247556 URL: http://svnweb.freebsd.org/changeset/base/247556 Log: MFC 246037: Mark 'ticks', 'time_second', and 'time_uptime' as volatile to prevent the compiler from caching their values in tight loops. Modified: stable/8/sys/dev/usb/net/if_cdce.c stable/8/sys/kern/kern_clock.c stable/8/sys/kern/kern_tc.c stable/8/sys/pci/ncr.c stable/8/sys/sys/kernel.h stable/8/sys/sys/time.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/usb/ (props changed) stable/8/sys/kern/ (props changed) stable/8/sys/pci/ (props changed) stable/8/sys/sys/ (props changed) Modified: stable/8/sys/dev/usb/net/if_cdce.c ============================================================================== --- stable/8/sys/dev/usb/net/if_cdce.c Fri Mar 1 17:10:43 2013 (r247555) +++ stable/8/sys/dev/usb/net/if_cdce.c Fri Mar 1 17:10:52 2013 (r247556) @@ -500,6 +500,7 @@ cdce_attach(device_t dev) const struct usb_interface_descriptor *id; const struct usb_cdc_ethernet_descriptor *ued; const struct usb_config *pcfg; + uint32_t seed; int error; uint8_t i; uint8_t data_iface_no; @@ -612,8 +613,9 @@ alloc_transfers: /* fake MAC address */ device_printf(dev, "faking MAC address\n"); + seed = ticks; sc->sc_ue.ue_eaddr[0] = 0x2a; - memcpy(&sc->sc_ue.ue_eaddr[1], &ticks, sizeof(uint32_t)); + memcpy(&sc->sc_ue.ue_eaddr[1], &seed, sizeof(uint32_t)); sc->sc_ue.ue_eaddr[5] = device_get_unit(dev); } else { Modified: stable/8/sys/kern/kern_clock.c ============================================================================== --- stable/8/sys/kern/kern_clock.c Fri Mar 1 17:10:43 2013 (r247555) +++ stable/8/sys/kern/kern_clock.c Fri Mar 1 17:10:52 2013 (r247556) @@ -379,7 +379,7 @@ static void watchdog_config(void *, u_in int stathz; int profhz; int profprocs; -int ticks; +volatile int ticks; int psratio; /* @@ -461,7 +461,7 @@ void hardclock(int usermode, uintfptr_t pc) { - atomic_add_int((volatile int *)&ticks, 1); + atomic_add_int(&ticks, 1); hardclock_cpu(usermode); tc_ticktock(); /* Modified: stable/8/sys/kern/kern_tc.c ============================================================================== --- stable/8/sys/kern/kern_tc.c Fri Mar 1 17:10:43 2013 (r247555) +++ stable/8/sys/kern/kern_tc.c Fri Mar 1 17:10:52 2013 (r247556) @@ -87,8 +87,8 @@ static struct timehands *volatile timeha struct timecounter *timecounter = &dummy_timecounter; static struct timecounter *timecounters = &dummy_timecounter; -time_t time_second = 1; -time_t time_uptime = 1; +volatile time_t time_second = 1; +volatile time_t time_uptime = 1; static struct bintime boottimebin; struct timeval boottime; Modified: stable/8/sys/pci/ncr.c ============================================================================== --- stable/8/sys/pci/ncr.c Fri Mar 1 17:10:43 2013 (r247555) +++ stable/8/sys/pci/ncr.c Fri Mar 1 17:10:52 2013 (r247556) @@ -1386,7 +1386,7 @@ static char *ncr_name (ncb_p np) * Kernel variables referenced in the scripts. * THESE MUST ALL BE ALIGNED TO A 4-BYTE BOUNDARY. */ -static void *script_kvars[] = +static volatile void *script_kvars[] = { &time_second, &ticks, &ncr_cache }; static struct script script0 = { Modified: stable/8/sys/sys/kernel.h ============================================================================== --- stable/8/sys/sys/kernel.h Fri Mar 1 17:10:43 2013 (r247555) +++ stable/8/sys/sys/kernel.h Fri Mar 1 17:10:52 2013 (r247556) @@ -63,7 +63,7 @@ extern int psratio; /* ratio: prof / s extern int stathz; /* statistics clock's frequency */ extern int profhz; /* profiling clock's frequency */ extern int profprocs; /* number of process's profiling */ -extern int ticks; +extern volatile int ticks; #endif /* _KERNEL */ Modified: stable/8/sys/sys/time.h ============================================================================== --- stable/8/sys/sys/time.h Fri Mar 1 17:10:43 2013 (r247555) +++ stable/8/sys/sys/time.h Fri Mar 1 17:10:52 2013 (r247556) @@ -262,8 +262,8 @@ struct clockinfo { void inittodr(time_t base); void resettodr(void); -extern time_t time_second; -extern time_t time_uptime; +extern volatile time_t time_second; +extern volatile time_t time_uptime; extern struct timeval boottime; /*