From owner-svn-src-user@FreeBSD.ORG Sat Jun 29 18:07:38 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 344B17E6; Sat, 29 Jun 2013 18:07:38 +0000 (UTC) (envelope-from attilio@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 246BC1F04; Sat, 29 Jun 2013 18:07:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5TI7cP6060442; Sat, 29 Jun 2013 18:07:38 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5TI7X9I060404; Sat, 29 Jun 2013 18:07:33 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201306291807.r5TI7X9I060404@svn.freebsd.org> From: Attilio Rao Date: Sat, 29 Jun 2013 18:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r252384 - in user/attilio/vmobj-readlock: bin/ed bin/sh contrib/smbfs/mount_smbfs etc etc/defaults etc/mtree include lib lib/libfetch lib/libprocstat lib/libutil rescue/rescue sbin/mdco... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Jun 2013 18:07:38 -0000 Author: attilio Date: Sat Jun 29 18:07:32 2013 New Revision: 252384 URL: http://svnweb.freebsd.org/changeset/base/252384 Log: MFC Added: user/attilio/vmobj-readlock/sys/arm/arm/generic_timer.c - copied unchanged from r252383, user/attilio/vmcontention/sys/arm/arm/generic_timer.c user/attilio/vmobj-readlock/sys/boot/fdt/dts/exynos5250-arndale.dts - copied unchanged from r252383, user/attilio/vmcontention/sys/boot/fdt/dts/exynos5250-arndale.dts user/attilio/vmobj-readlock/sys/boot/fdt/dts/exynos5250.dtsi - copied unchanged from r252383, user/attilio/vmcontention/sys/boot/fdt/dts/exynos5250.dtsi Deleted: user/attilio/vmobj-readlock/contrib/smbfs/mount_smbfs/Makefile Modified: user/attilio/vmobj-readlock/bin/ed/re.c user/attilio/vmobj-readlock/bin/sh/eval.c user/attilio/vmobj-readlock/etc/defaults/rc.conf user/attilio/vmobj-readlock/etc/mtree/BSD.include.dist user/attilio/vmobj-readlock/etc/mtree/BSD.usr.dist user/attilio/vmobj-readlock/etc/network.subr user/attilio/vmobj-readlock/include/Makefile user/attilio/vmobj-readlock/lib/Makefile user/attilio/vmobj-readlock/lib/libfetch/fetch.c user/attilio/vmobj-readlock/lib/libprocstat/Makefile user/attilio/vmobj-readlock/lib/libprocstat/common_kvm.h user/attilio/vmobj-readlock/lib/libprocstat/libprocstat.c user/attilio/vmobj-readlock/lib/libutil/login_times.c user/attilio/vmobj-readlock/rescue/rescue/Makefile user/attilio/vmobj-readlock/sbin/mdconfig/mdconfig.8 user/attilio/vmobj-readlock/sbin/mount/mount.8 user/attilio/vmobj-readlock/sbin/mount/mount.c user/attilio/vmobj-readlock/sbin/swapon/swapon.c user/attilio/vmobj-readlock/share/examples/Makefile user/attilio/vmobj-readlock/share/examples/etc/README.examples user/attilio/vmobj-readlock/share/man/man5/fstab.5 user/attilio/vmobj-readlock/share/man/man9/locking.9 user/attilio/vmobj-readlock/share/mk/bsd.libnames.mk user/attilio/vmobj-readlock/sys/arm/arm/cpufunc.c user/attilio/vmobj-readlock/sys/arm/arm/gic.c user/attilio/vmobj-readlock/sys/arm/arm/identcpu.c user/attilio/vmobj-readlock/sys/arm/include/armreg.h user/attilio/vmobj-readlock/sys/arm/include/intr.h user/attilio/vmobj-readlock/sys/conf/NOTES user/attilio/vmobj-readlock/sys/conf/files user/attilio/vmobj-readlock/sys/conf/files.amd64 user/attilio/vmobj-readlock/sys/conf/files.arm user/attilio/vmobj-readlock/sys/conf/files.i386 user/attilio/vmobj-readlock/sys/conf/files.ia64 user/attilio/vmobj-readlock/sys/conf/files.mips user/attilio/vmobj-readlock/sys/conf/files.pc98 user/attilio/vmobj-readlock/sys/conf/files.powerpc user/attilio/vmobj-readlock/sys/conf/files.sparc64 user/attilio/vmobj-readlock/sys/conf/options user/attilio/vmobj-readlock/sys/fs/ext2fs/ext2_lookup.c user/attilio/vmobj-readlock/sys/fs/smbfs/smbfs_node.c user/attilio/vmobj-readlock/sys/fs/smbfs/smbfs_vfsops.c user/attilio/vmobj-readlock/sys/fs/smbfs/smbfs_vnops.c user/attilio/vmobj-readlock/sys/kern/Make.tags.inc user/attilio/vmobj-readlock/sys/kern/kern_descrip.c user/attilio/vmobj-readlock/sys/kern/kern_synch.c user/attilio/vmobj-readlock/sys/kern/sys_generic.c user/attilio/vmobj-readlock/sys/modules/Makefile user/attilio/vmobj-readlock/sys/net80211/ieee80211_ioctl.c user/attilio/vmobj-readlock/sys/netsmb/smb_conn.c user/attilio/vmobj-readlock/sys/sys/socketvar.h user/attilio/vmobj-readlock/sys/vm/uma_core.c user/attilio/vmobj-readlock/usr.bin/Makefile user/attilio/vmobj-readlock/usr.bin/Makefile.amd64 user/attilio/vmobj-readlock/usr.bin/Makefile.i386 user/attilio/vmobj-readlock/usr.bin/Makefile.ia64 user/attilio/vmobj-readlock/usr.bin/Makefile.powerpc user/attilio/vmobj-readlock/usr.bin/Makefile.sparc64 user/attilio/vmobj-readlock/usr.bin/kdump/kdump.c user/attilio/vmobj-readlock/usr.sbin/Makefile.amd64 user/attilio/vmobj-readlock/usr.sbin/Makefile.i386 user/attilio/vmobj-readlock/usr.sbin/Makefile.ia64 user/attilio/vmobj-readlock/usr.sbin/Makefile.powerpc user/attilio/vmobj-readlock/usr.sbin/Makefile.sparc64 user/attilio/vmobj-readlock/usr.sbin/newsyslog/newsyslog.c user/attilio/vmobj-readlock/usr.sbin/pkg_install/add/extract.c user/attilio/vmobj-readlock/usr.sbin/pkg_install/create/pl.c user/attilio/vmobj-readlock/usr.sbin/pkg_install/lib/exec.c user/attilio/vmobj-readlock/usr.sbin/pw/pw_user.c Directory Properties: user/attilio/vmobj-readlock/ (props changed) user/attilio/vmobj-readlock/lib/libutil/ (props changed) user/attilio/vmobj-readlock/sbin/ (props changed) user/attilio/vmobj-readlock/sys/ (props changed) user/attilio/vmobj-readlock/sys/boot/ (props changed) user/attilio/vmobj-readlock/sys/conf/ (props changed) Modified: user/attilio/vmobj-readlock/bin/ed/re.c ============================================================================== --- user/attilio/vmobj-readlock/bin/ed/re.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/bin/ed/re.c Sat Jun 29 18:07:32 2013 (r252384) @@ -89,7 +89,7 @@ extract_pattern(int delimiter) default: break; case '[': - if ((nd = parse_char_class(++nd)) == NULL) { + if ((nd = parse_char_class(nd + 1)) == NULL) { errmsg = "unbalanced brackets ([])"; return NULL; } Modified: user/attilio/vmobj-readlock/bin/sh/eval.c ============================================================================== --- user/attilio/vmobj-readlock/bin/sh/eval.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/bin/sh/eval.c Sat Jun 29 18:07:32 2013 (r252384) @@ -589,7 +589,8 @@ evalpipe(union node *n) pip[1] = -1; if (lp->next) { if (pipe(pip) < 0) { - close(prevfd); + if (prevfd >= 0) + close(prevfd); error("Pipe call failed: %s", strerror(errno)); } } Modified: user/attilio/vmobj-readlock/etc/defaults/rc.conf ============================================================================== --- user/attilio/vmobj-readlock/etc/defaults/rc.conf Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/etc/defaults/rc.conf Sat Jun 29 18:07:32 2013 (r252384) @@ -88,7 +88,7 @@ fsck_y_enable="NO" # Set to YES to do fs fsck_y_flags="" # Additional flags for fsck -y background_fsck="YES" # Attempt to run fsck in the background where possible. background_fsck_delay="60" # Time to wait (seconds) before starting the fsck. -netfs_types="nfs:NFS oldnfs:OLDNFS" # Net filesystems. +netfs_types="nfs:NFS oldnfs:OLDNFS smbfs:SMB" # Net filesystems. extra_netfs_types="NO" # List of network extra filesystem types for delayed # mount at startup (or NO). Modified: user/attilio/vmobj-readlock/etc/mtree/BSD.include.dist ============================================================================== --- user/attilio/vmobj-readlock/etc/mtree/BSD.include.dist Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/etc/mtree/BSD.include.dist Sat Jun 29 18:07:32 2013 (r252384) @@ -176,6 +176,8 @@ .. procfs .. + smbfs + .. udf .. unionfs Modified: user/attilio/vmobj-readlock/etc/mtree/BSD.usr.dist ============================================================================== --- user/attilio/vmobj-readlock/etc/mtree/BSD.usr.dist Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/etc/mtree/BSD.usr.dist Sat Jun 29 18:07:32 2013 (r252384) @@ -309,6 +309,10 @@ srcs .. .. + smbfs + print + .. + .. sunrpc dir .. Modified: user/attilio/vmobj-readlock/etc/network.subr ============================================================================== --- user/attilio/vmobj-readlock/etc/network.subr Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/etc/network.subr Sat Jun 29 18:07:32 2013 (r252384) @@ -318,6 +318,15 @@ dhcpif() local _tmpargs _arg _tmpargs=`_ifconfig_getargs $1` + case $1 in + lo[0-9]*|\ + stf[0-9]*|\ + faith[0-9]*|\ + lp[0-9]*|\ + sl[0-9]*) + return 1 + ;; + esac if noafif $1; then return 1 fi @@ -509,7 +518,7 @@ ipv6_autoconfif() _if=$1 case $_if in - lo0|\ + lo[0-9]*|\ stf[0-9]*|\ faith[0-9]*|\ lp[0-9]*|\ Modified: user/attilio/vmobj-readlock/include/Makefile ============================================================================== --- user/attilio/vmobj-readlock/include/Makefile Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/include/Makefile Sat Jun 29 18:07:32 2013 (r252384) @@ -37,7 +37,7 @@ LHDRS= aio.h errno.h fcntl.h linker_set. syslog.h ucontext.h LDIRS= bsm cam geom net net80211 netatalk netgraph netinet netinet6 \ - netipsec ${_netipx} netnatm \ + netipsec ${_netipx} netnatm netsmb \ nfs nfsclient nfsserver \ sys vm @@ -48,7 +48,7 @@ LSUBDIRS= cam/ata cam/scsi \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/smbus \ dev/speaker dev/usb dev/utopia dev/vkbd dev/wi \ fs/devfs fs/fdescfs fs/msdosfs fs/nandfs fs/nfs fs/nullfs \ - fs/procfs fs/udf fs/unionfs \ + fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ geom/mirror geom/mountver geom/multipath geom/nop \ geom/raid geom/raid3 geom/shsec geom/stripe geom/virstor \ @@ -80,6 +80,7 @@ INCS+= iconv.h LSUBSUBDIRS+= netgraph/bluetooth/include .endif +# XXX unconditionally needed by #.if ${MK_IPX} != "no" _netipx= netipx #.endif Modified: user/attilio/vmobj-readlock/lib/Makefile ============================================================================== --- user/attilio/vmobj-readlock/lib/Makefile Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/lib/Makefile Sat Jun 29 18:07:32 2013 (r252384) @@ -102,6 +102,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_librtld_db} \ ${_libsdp} \ ${_libsm} \ + ${_libsmb} \ ${_libsmdb} \ ${_libsmutil} \ libstand \ @@ -205,6 +206,7 @@ _libypclnt= libypclnt .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_libsmb= libsmb _libvgl= libvgl _libproc= libproc _librtld_db= librtld_db @@ -216,6 +218,7 @@ _libvmmapi= libvmmapi .if ${MACHINE_CPUARCH} == "ia64" _libefi= libefi +_libsmb= libsmb .endif .if ${MACHINE_CPUARCH} == "mips" @@ -226,6 +229,11 @@ _librtld_db= librtld_db .if ${MACHINE_CPUARCH} == "powerpc" _libproc= libproc _librtld_db= librtld_db +_libsmb= libsmb +.endif + +.if ${MACHINE_CPUARCH} == "sparc64" +_libsmb= libsmb .endif .if ${MK_OPENSSL} != "no" Modified: user/attilio/vmobj-readlock/lib/libfetch/fetch.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libfetch/fetch.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/lib/libfetch/fetch.c Sat Jun 29 18:07:32 2013 (r252384) @@ -376,7 +376,7 @@ fetchParseURL(const char *URL) /* password */ if (*q == ':') - q = fetch_pctdecode(u->pwd, ++q, URL_PWDLEN); + q = fetch_pctdecode(u->pwd, q + 1, URL_PWDLEN); p++; } else { Modified: user/attilio/vmobj-readlock/lib/libprocstat/Makefile ============================================================================== --- user/attilio/vmobj-readlock/lib/libprocstat/Makefile Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/lib/libprocstat/Makefile Sat Jun 29 18:07:32 2013 (r252384) @@ -9,6 +9,7 @@ SRCS= cd9660.c \ core.c \ libprocstat.c \ msdosfs.c \ + smbfs.c \ udf.c VERSION_DEF= ${.CURDIR}/Versions.def Modified: user/attilio/vmobj-readlock/lib/libprocstat/common_kvm.h ============================================================================== --- user/attilio/vmobj-readlock/lib/libprocstat/common_kvm.h Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/lib/libprocstat/common_kvm.h Sat Jun 29 18:07:32 2013 (r252384) @@ -41,6 +41,7 @@ int devfs_filestat(kvm_t *kd, struct vno int isofs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); int msdosfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); int nfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); +int smbfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); int udf_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); int ufs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); int zfs_filestat(kvm_t *kd, struct vnode *vp, struct vnstat *vn); Modified: user/attilio/vmobj-readlock/lib/libprocstat/libprocstat.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libprocstat/libprocstat.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/lib/libprocstat/libprocstat.c Sat Jun 29 18:07:32 2013 (r252384) @@ -1220,6 +1220,7 @@ procstat_get_vnode_info_kvm(kvm_t *kd, s FSTYPE(isofs), FSTYPE(msdosfs), FSTYPE(nfs), + FSTYPE(smbfs), FSTYPE(udf), FSTYPE(ufs), #ifdef LIBPROCSTAT_ZFS Modified: user/attilio/vmobj-readlock/lib/libutil/login_times.c ============================================================================== --- user/attilio/vmobj-readlock/lib/libutil/login_times.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/lib/libutil/login_times.c Sat Jun 29 18:07:32 2013 (r252384) @@ -96,7 +96,7 @@ parse_lt(const char *str) else m.lt_start = 0; if (*p == '-') - p = parse_time(++p, &m.lt_end); + p = parse_time(p + 1, &m.lt_end); else m.lt_end = 1440; Modified: user/attilio/vmobj-readlock/rescue/rescue/Makefile ============================================================================== --- user/attilio/vmobj-readlock/rescue/rescue/Makefile Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/rescue/rescue/Makefile Sat Jun 29 18:07:32 2013 (r252384) @@ -130,6 +130,8 @@ CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv - .if ${MACHINE_CPUARCH} == "i386" CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk CRUNCH_ALIAS_bsdlabel= disklabel +#CRUNCH_PROGS+= mount_smbfs +#CRUNCH_LIBS+= -lsmb .endif .if ${MACHINE} == "pc98" Modified: user/attilio/vmobj-readlock/sbin/mdconfig/mdconfig.8 ============================================================================== --- user/attilio/vmobj-readlock/sbin/mdconfig/mdconfig.8 Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/sbin/mdconfig/mdconfig.8 Sat Jun 29 18:07:32 2013 (r252384) @@ -144,7 +144,7 @@ If both of and .Fl f options are specified, -display devices which match the two conditions. +display devices which match the two conditions. If the .Fl v option is specified, show all details. Modified: user/attilio/vmobj-readlock/sbin/mount/mount.8 ============================================================================== --- user/attilio/vmobj-readlock/sbin/mount/mount.8 Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/sbin/mount/mount.8 Sat Jun 29 18:07:32 2013 (r252384) @@ -450,6 +450,7 @@ However, for the following file system t .Cm nfs , .Cm nullfs , .Cm oldnfs , +.Cm smbfs , .Cm udf , and .Cm unionfs . @@ -544,6 +545,7 @@ support for a particular file system mig .Xr mount_msdosfs 8 , .Xr mount_nfs 8 , .Xr mount_nullfs 8 , +.Xr mount_smbfs 8 , .Xr mount_udf 8 , .Xr mount_unionfs 8 , .Xr umount 8 , Modified: user/attilio/vmobj-readlock/sbin/mount/mount.c ============================================================================== --- user/attilio/vmobj-readlock/sbin/mount/mount.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/sbin/mount/mount.c Sat Jun 29 18:07:32 2013 (r252384) @@ -143,7 +143,7 @@ use_mountprog(const char *vfstype) unsigned int i; const char *fs[] = { "cd9660", "mfs", "msdosfs", "nfs", - "nullfs", "oldnfs", "udf", "unionfs", + "nullfs", "oldnfs", "smbfs", "udf", "unionfs", NULL }; Modified: user/attilio/vmobj-readlock/sbin/swapon/swapon.c ============================================================================== --- user/attilio/vmobj-readlock/sbin/swapon/swapon.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/sbin/swapon/swapon.c Sat Jun 29 18:07:32 2013 (r252384) @@ -76,6 +76,8 @@ static int run_cmd(int *, const char *, static enum { SWAPON, SWAPOFF, SWAPCTL } orig_prog, which_prog = SWAPCTL; static int qflag; +static char aalgo_default[] = "hmac/sha256"; +static char ealgo_default[] = "aes"; int main(int argc, char **argv) @@ -319,7 +321,7 @@ swap_on_off_gbde(char *name, int doingal static const char * swap_on_off_geli(char *name, char *mntops, int doingall) { - const char *ops, *aalgo, *ealgo, *keylen_str, *sectorsize_str; + char *ops, *aalgo, *ealgo, *keylen_str, *sectorsize_str; char *dname, *p; char args[4096]; struct stat sb; @@ -337,8 +339,8 @@ swap_on_off_geli(char *name, char *mntop ops = strdup(mntops); /* Default parameters for geli(8). */ - aalgo = "hmac/sha256"; - ealgo = "aes"; + aalgo = aalgo_default; + ealgo = ealgo_default; keylen = 256; sectorsize = 4096; Modified: user/attilio/vmobj-readlock/share/examples/Makefile ============================================================================== --- user/attilio/vmobj-readlock/share/examples/Makefile Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/share/examples/Makefile Sat Jun 29 18:07:32 2013 (r252384) @@ -240,6 +240,7 @@ etc-examples: .endif .if ${SHARED} != "symlinks" +SUBDIR= smbfs .if ${MK_ATF} != "no" SUBDIR+=atf .endif Modified: user/attilio/vmobj-readlock/share/examples/etc/README.examples ============================================================================== --- user/attilio/vmobj-readlock/share/examples/etc/README.examples Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/share/examples/etc/README.examples Sat Jun 29 18:07:32 2013 (r252384) @@ -40,6 +40,7 @@ netstart - network startup script run fr network.subr - routines for network configuration scripts networks - see networks(5) newsyslog.conf - configuration for system log file rotator newsyslog(8) +nsmb.conf - smbfs lookups configuration file opieaccess - OPIE database of trusted networks pf.conf - pf(4) example configuration file pf.os - SYN fingerprint database Modified: user/attilio/vmobj-readlock/share/man/man5/fstab.5 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man5/fstab.5 Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/share/man/man5/fstab.5 Sat Jun 29 18:07:32 2013 (r252384) @@ -231,7 +231,7 @@ is an .Xr md 4 device file .Pq Do md Dc or Do md[0-9]* Dc -and +and .Dq file is specified in .Fa fs_mntopts , Modified: user/attilio/vmobj-readlock/share/man/man9/locking.9 ============================================================================== --- user/attilio/vmobj-readlock/share/man/man9/locking.9 Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/share/man/man9/locking.9 Sat Jun 29 18:07:32 2013 (r252384) @@ -33,53 +33,52 @@ .Sh DESCRIPTION The .Em FreeBSD -kernel is written to run across multiple CPUs and as such requires -several different synchronization primitives to allow the developers -to safely access and manipulate the many data types required. +kernel is written to run across multiple CPUs and as such provides +several different synchronization primitives to allow developers +to safely access and manipulate many data types. .Ss Mutexes -Mutexes (also erroneously called "sleep mutexes") are the most commonly used +Mutexes (also called "blocking mutexes") are the most commonly used synchronization primitive in the kernel. A thread acquires (locks) a mutex before accessing data shared with other threads (including interrupt threads), and releases (unlocks) it afterwards. If the mutex cannot be acquired, the thread requesting it will wait. -Mutexes are by default adaptive, meaning that +Mutexes are adaptive by default, meaning that if the owner of a contended mutex is currently running on another CPU, -then a thread attempting to acquire the mutex will briefly spin -in the hope that the owner is only briefly holding it, -and might release it shortly. -If the owner does not do so, the waiting thread proceeds to yield the processor, -allowing other threads to run. -If the owner is not currently actually running then the spin step is skipped. +then a thread attempting to acquire the mutex will spin rather than yielding +the processor. Mutexes fully support priority propagation. .Pp See .Xr mutex 9 for details. -.Ss Spin mutexes -Spin mutexes are variation of basic mutexes; the main difference between -the two is that spin mutexes never yield the processor - instead, they spin, -waiting for the thread holding the lock, -(which must be running on another CPU), to release it. -Spin mutexes disable interrupts while the held so as to not get pre-empted. -Since disabling interrupts is expensive, they are also generally slower. -Spin mutexes should be used only when necessary, e.g. to protect data shared +.Ss Spin Mutexes +Spin mutexes are a variation of basic mutexes; the main difference between +the two is that spin mutexes never block. +Instead, they spin while waiting for the lock to be released. +Note that a thread that holds a spin mutex must never yield its CPU to +avoid deadlock. +Unlike ordinary mutexes, spin mutexes disable interrupts when acquired. +Since disabling interrupts can be expensive, they are generally slower to +acquire and release. +Spin mutexes should be used only when absolutely necessary, +e.g. to protect data shared with interrupt filter code (see .Xr bus_setup_intr 9 -for details). -.Ss Pool mutexes -With most synchronization primitives, such as mutexes, programmer must -provide a piece of allocated memory to hold the primitive. +for details), +or for scheduler internals. +.Ss Mutex Pools +With most synchronization primitives, such as mutexes, the programmer must +provide memory to hold the primitive. For example, a mutex may be embedded inside the structure it protects. -Pool mutex is a variant of mutex without this requirement - to lock or unlock -a pool mutex, one uses address of the structure being protected with it, -not the mutex itself. -Pool mutexes are seldom used. +Mutex pools provide a preallocated set of mutexes to avoid this +requirement. +Note that mutexes from a pool may only be used as leaf locks. .Pp See .Xr mtx_pool 9 for details. -.Ss Reader/writer locks -Reader/writer locks allow shared access to protected data by multiple threads, +.Ss Reader/Writer Locks +Reader/writer locks allow shared access to protected data by multiple threads or exclusive access by a single thread. The threads with shared access are known as .Em readers @@ -91,26 +90,16 @@ since it may modify protected data. Reader/writer locks can be treated as mutexes (see above and .Xr mutex 9 ) with shared/exclusive semantics. -More specifically, regular mutexes can be -considered to be equivalent to a write-lock on an -.Em rw_lock. -The -.Em rw_lock -locks have priority propagation like mutexes, but priority -can be propagated only to an exclusive holder. +Reader/writer locks support priority propagation like mutexes, +but priority is propagated only to an exclusive holder. This limitation comes from the fact that shared owners are anonymous. -Another important property is that shared holders of -.Em rw_lock -can recurse, but exclusive locks are not allowed to recurse. -This ability should not be used lightly and -.Em may go away. .Pp See .Xr rwlock 9 for details. -.Ss Read-mostly locks -Mostly reader locks are similar to +.Ss Read-Mostly Locks +Read-mostly locks are similar to .Em reader/writer locks but optimized for very infrequent write locking. .Em Read-mostly @@ -122,21 +111,41 @@ data structure. See .Xr rmlock 9 for details. +.Ss Sleepable Read-Mostly Locks +Sleepable read-mostly locks are a variation on read-mostly locks. +Threads holding an exclusive lock may sleep, +but threads holding a shared lock may not. +Priority is propagated to shared owners but not to exclusive owners. .Ss Shared/exclusive locks Shared/exclusive locks are similar to reader/writer locks; the main difference -between them is that shared/exclusive locks may be held during unbounded sleep -(and may thus perform an unbounded sleep). -They are inherently less efficient than mutexes, reader/writer locks -and read-mostly locks. -They do not support priority propagation. -They should be considered to be closely related to -.Xr sleep 9 . -They could in some cases be -considered a conditional sleep. +between them is that shared/exclusive locks may be held during unbounded sleep. +Acquiring a contested shared/exclusive lock can perform an unbounded sleep. +These locks do not support priority propagation. .Pp See .Xr sx 9 for details. +.Ss Lockmanager locks +Lockmanager locks are sleepable shared/exclusive locks used mostly in +.Xr VFS 9 +.Po +as a +.Xr vnode 9 +lock +.Pc +and in the buffer cache +.Po +.Xr BUF_LOCK 9 +.Pc . +They have features other lock types do not have such as sleep +timeouts, blocking upgrades, +writer starvation avoidance, draining, and an interlock mutex, +but this makes them complicated to both use and implement; +for this reason, they should be avoided. +.Pp +See +.Xr lock 9 +for details. .Ss Counting semaphores Counting semaphores provide a mechanism for synchronizing access to a pool of resources. @@ -149,43 +158,21 @@ See .Xr sema 9 for details. .Ss Condition variables -Condition variables are used in conjunction with mutexes to wait for -conditions to occur. -A thread must hold the mutex before calling the -.Fn cv_wait* , +Condition variables are used in conjunction with locks to wait for +a condition to become true. +A thread must hold the associated lock before calling one of the +.Fn cv_wait , functions. -When a thread waits on a condition, the mutex -is atomically released before the thread yields the processor, -then reacquired before the function call returns. +When a thread waits on a condition, the lock +is atomically released before the thread yields the processor +and reacquired before the function call returns. +Condition variables may be used with blocking mutexes, +reader/writer locks, read-mostly locks, and shared/exclusive locks. .Pp See .Xr condvar 9 for details. -.Ss Giant -Giant is an instance of a mutex, with some special characteristics: -.Bl -enum -.It -It is recursive. -.It -Drivers can request that Giant be locked around them -by not marking themselves MPSAFE. -Note that infrastructure to do this is slowly going away as non-MPSAFE -drivers either became properly locked or disappear. -.It -Giant must be locked first before other locks. -.It -It is OK to hold Giant while performing unbounded sleep; in such case, -Giant will be dropped before sleeping and picked up after wakeup. -.It -There are places in the kernel that drop Giant and pick it back up -again. -Sleep locks will do this before sleeping. -Parts of the network or VM code may do this as well, depending on the -setting of a sysctl. -This means that you cannot count on Giant keeping other code from -running if your code sleeps, even if you want it to. -.El -.Ss Sleep/wakeup +.Ss Sleep/Wakeup The functions .Fn tsleep , .Fn msleep , @@ -194,7 +181,12 @@ The functions .Fn wakeup , and .Fn wakeup_one -handle event-based thread blocking. +also handle event-based thread blocking. +Unlike condition variables, +arbitrary addresses may be used as wait channels and an dedicated +structure does not need to be allocated. +However, care must be taken to ensure that wait channel addresses are +unique to an event. If a thread must wait for an external event, it is put to sleep by .Fn tsleep , .Fn msleep , @@ -214,9 +206,10 @@ the thread is being put to sleep. All threads sleeping on a single .Fa chan are woken up later by -.Fn wakeup , -often called from inside an interrupt routine, to indicate that the -resource the thread was blocking on is available now. +.Fn wakeup +.Pq often called from inside an interrupt routine +to indicate that the +event the thread was blocking on has occurred. .Pp Several of the sleep functions including .Fn msleep , @@ -232,122 +225,168 @@ includes the flag, then the lock will not be reacquired before returning. The lock is used to ensure that a condition can be checked atomically, and that the current thread can be suspended without missing a -change to the condition, or an associated wakeup. +change to the condition or an associated wakeup. In addition, all of the sleep routines will fully drop the .Va Giant mutex -(even if recursed) +.Pq even if recursed while the thread is suspended and will reacquire the .Va Giant -mutex before the function returns. +mutex +.Pq restoring any recursion +before the function returns. .Pp -See -.Xr sleep 9 -for details. -.Ss Lockmanager locks -Shared/exclusive locks, used mostly in -.Xr VFS 9 , -in particular as a -.Xr vnode 9 -lock. -They have features other lock types do not have, such as sleep timeout, -writer starvation avoidance, draining, and interlock mutex, but this makes them -complicated to implement; for this reason, they are deprecated. +The +.Fn pause +function is a special sleep function that waits for a specified +amount of time to pass before the thread resumes execution. +This sleep cannot be terminated early by either an explicit +.Fn wakeup +or a signal. .Pp See -.Xr lock 9 +.Xr sleep 9 for details. +.Ss Giant +Giant is a special mutex used to protect data structures that do not +yet have their own locks. +Since it provides semantics akin to the old +.Xr spl 9 +interface, +Giant has special characteristics: +.Bl -enum +.It +It is recursive. +.It +Drivers can request that Giant be locked around them +by not marking themselves MPSAFE. +Note that infrastructure to do this is slowly going away as non-MPSAFE +drivers either became properly locked or disappear. +.It +Giant must be locked before other non-sleepable locks. +.It +Giant is dropped during unbounded sleeps and reacquired after wakeup. +.It +There are places in the kernel that drop Giant and pick it back up +again. +Sleep locks will do this before sleeping. +Parts of the network or VM code may do this as well. +This means that you cannot count on Giant keeping other code from +running if your code sleeps, even if you want it to. +.El .Sh INTERACTIONS -The primitives interact and have a number of rules regarding how +The primitives can interact and have a number of rules regarding how they can and can not be combined. -Many of these rules are checked using the -.Xr witness 4 -code. -.Ss Bounded vs. unbounded sleep -The following primitives perform bounded sleep: - mutexes, pool mutexes, reader/writer locks and read-mostly locks. -.Pp -The following primitives may perform an unbounded sleep: -shared/exclusive locks, counting semaphores, condition variables, sleep/wakeup and lockmanager locks. -.Pp +Many of these rules are checked by +.Xr witness 4 . +.Ss Bounded vs. Unbounded Sleep +A bounded sleep +.Pq or blocking +is a sleep where the only resource needed to resume execution of a thread +is CPU time for the owner of a lock that the thread is waiting to acquire. +An unbounded sleep +.Po +often referred to as simply +.Dq sleeping +.Pc +is a sleep where a thread is waiting for an external event or for a condition +to become true. +In particular, +since there is always CPU time available, +a dependency chain of threads in bounded sleeps should always make forward +progress. +This requires that no thread in a bounded sleep is waiting for a lock held +by a thread in an unbounded sleep. +To avoid priority inversions, +a thread in a bounded sleep lends its priority to the owner of the lock +that it is waiting for. +.Pp +The following primitives perform bounded sleeps: +mutexes, reader/writer locks and read-mostly locks. +.Pp +The following primitives perform unbounded sleeps: +sleepable read-mostly locks, shared/exclusive locks, lockmanager locks, +counting semaphores, condition variables, and sleep/wakeup. +.Ss General Principles +.Bl -bullet +.It It is an error to do any operation that could result in yielding the processor while holding a spin mutex. +.It +It is an error to do any operation that could result in unbounded sleep +while holding any primitive from the 'bounded sleep' group. +For example, it is an error to try to acquire a shared/exclusive lock while +holding a mutex, or to try to allocate memory with M_WAITOK while holding a +reader/writer lock. .Pp -As a general rule, it is an error to do any operation that could result -in unbounded sleep while holding any primitive from the 'bounded sleep' group. -For example, it is an error to try to acquire shared/exclusive lock while -holding mutex, or to try to allocate memory with M_WAITOK while holding -read-write lock. -.Pp -As a special case, it is possible to call +Note that the lock passed to one of the .Fn sleep or -.Fn mtx_sleep -while holding a single mutex. -It will atomically drop that mutex and reacquire it as part of waking up. -This is often a bad idea because it generally relies on the programmer having -good knowledge of all of the call graph above the place where -.Fn mtx_sleep -is being called and assumptions the calling code has made. -Because the lock gets dropped during sleep, one must re-test all -the assumptions that were made before, all the way up the call graph to the -place where the lock was acquired. -.Pp +.Fn cv_wait +functions is dropped before the thread enters the unbounded sleep and does +not violate this rule. +.It It is an error to do any operation that could result in yielding of the processor when running inside an interrupt filter. -.Pp +.It It is an error to do any operation that could result in unbounded sleep when running inside an interrupt thread. +.El .Ss Interaction table The following table shows what you can and can not do while holding -one of the synchronization primitives discussed: -.Bl -column ".Ic xxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent -.It Em " You want:" Ta spin-mtx Ta mutex Ta rwlock Ta rmlock Ta sx Ta sleep -.It Em "You have: " Ta ------ Ta ------ Ta ------ Ta ------ Ta ------ Ta ------ -.It spin mtx Ta \&ok-1 Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-3 -.It mutex Ta \&ok Ta \&ok-1 Ta \&ok Ta \&ok Ta \&no Ta \&no-3 -.It rwlock Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok Ta \&no Ta \&no-3 -.It rmlock Ta \&ok Ta \&ok Ta \&ok Ta \&ok-2 Ta \&no-5 Ta \&no-5 -.It sx Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&no-2 Ta \&ok-4 +one of the locking primitives discussed. Note that +.Dq sleep +includes +.Fn sema_wait , +.Fn sema_timedwait , +any of the +.Fn cv_wait +functions, +and any of the +.Fn sleep +functions. +.Bl -column ".Ic xxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXXXX" ".Xr XXXXXX" -offset 3n +.It Em " You want:" Ta spin mtx Ta mutex/rw Ta rmlock Ta sleep rm Ta sx/lk Ta sleep +.It Em "You have: " Ta -------- Ta -------- Ta ------ Ta -------- Ta ------ Ta ------ +.It spin mtx Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no-1 +.It mutex/rw Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no-1 +.It rmlock Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no-1 +.It sleep rm Ta \&ok Ta \&ok Ta \&ok Ta \&ok-2 Ta \&ok-2 Ta \&ok-2/3 +.It sx Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok-3 +.It lockmgr Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok .El .Pp .Em *1 -Recursion is defined per lock. -Lock order is important. +There are calls that atomically release this primitive when going to sleep +and reacquire it on wakeup +.Po +.Fn mtx_sleep , +.Fn rw_sleep , +.Fn msleep_spin , +etc. +.Pc . .Pp .Em *2 -Readers can recurse though writers can not. -Lock order is important. +These cases are only allowed while holding a write lock on a sleepable +read-mostly lock. .Pp .Em *3 -There are calls that atomically release this primitive when going to sleep -and reacquire it on wakeup (e.g. -.Fn mtx_sleep , -.Fn rw_sleep -and -.Fn msleep_spin ) . -.Pp -.Em *4 -Though one can sleep holding an sx lock, one can also use -.Fn sx_sleep -which will atomically release this primitive when going to sleep and +Though one can sleep while holding this lock, +one can also use a +.Fn sleep +function to atomically release this primitive when going to sleep and reacquire it on wakeup. .Pp -.Em *5 -.Em Read-mostly -locks can be initialized to support sleeping while holding a write lock. -See -.Xr rmlock 9 -for details. +Note that non-blocking try operations on locks are always permitted. .Ss Context mode table The next table shows what can be used in different contexts. At this time this is a rather easy to remember table. -.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXX" -offset indent -.It Em "Context:" Ta spin mtx Ta mutex Ta sx Ta rwlock Ta rmlock Ta sleep +.Bl -column ".Ic Xxxxxxxxxxxxxxxxxxx" ".Xr XXXXXXXXX" ".Xr XXXXXXXXX" ".Xr XXXXXXX" ".Xr XXXXXXXXX" ".Xr XXXXXX" -offset 3n +.It Em "Context:" Ta spin mtx Ta mutex/rw Ta rmlock Ta sleep rm Ta sx/lk Ta sleep .It interrupt filter: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no -.It interrupt thread: Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&ok Ta \&no -.It callout: Ta \&ok Ta \&ok Ta \&no Ta \&ok Ta \&no Ta \&no -.It syscall: Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok +.It interrupt thread: Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no +.It callout: Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no +.It system call: Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok .El .Sh SEE ALSO .Xr witness 4 , Modified: user/attilio/vmobj-readlock/share/mk/bsd.libnames.mk ============================================================================== --- user/attilio/vmobj-readlock/share/mk/bsd.libnames.mk Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/share/mk/bsd.libnames.mk Sat Jun 29 18:07:32 2013 (r252384) @@ -149,6 +149,7 @@ LIBRT?= ${DESTDIR}${LIBDIR}/librt.a LIBRTLD_DB?= ${DESTDIR}${LIBDIR}/librtld_db.a LIBSBUF?= ${DESTDIR}${LIBDIR}/libsbuf.a LIBSDP?= ${DESTDIR}${LIBDIR}/libsdp.a +LIBSMB?= ${DESTDIR}${LIBDIR}/libsmb.a LIBSSH?= ${DESTDIR}${LIBDIR}/libssh.a LIBSSL?= ${DESTDIR}${LIBDIR}/libssl.a LIBSTAND?= ${DESTDIR}${LIBDIR}/libstand.a Modified: user/attilio/vmobj-readlock/sys/arm/arm/cpufunc.c ============================================================================== --- user/attilio/vmobj-readlock/sys/arm/arm/cpufunc.c Sat Jun 29 18:03:55 2013 (r252383) +++ user/attilio/vmobj-readlock/sys/arm/arm/cpufunc.c Sat Jun 29 18:07:32 2013 (r252384) @@ -1481,7 +1481,8 @@ set_cpufuncs() cputype == CPU_ID_CORTEXA8R3 || cputype == CPU_ID_CORTEXA9R1 || cputype == CPU_ID_CORTEXA9R2 || - cputype == CPU_ID_CORTEXA9R3) { + cputype == CPU_ID_CORTEXA9R3 || + cputype == CPU_ID_CORTEXA15 ) { cpufuncs = cortexa_cpufuncs; cpu_reset_needs_v4_MMU_disable = 1; /* V4 or higher */ get_cachetype_cp15(); Copied: user/attilio/vmobj-readlock/sys/arm/arm/generic_timer.c (from r252383, user/attilio/vmcontention/sys/arm/arm/generic_timer.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/attilio/vmobj-readlock/sys/arm/arm/generic_timer.c Sat Jun 29 18:07:32 2013 (r252384, copy of r252383, user/attilio/vmcontention/sys/arm/arm/generic_timer.c) @@ -0,0 +1,374 @@ +/*- + * Copyright (c) 2011 The FreeBSD Foundation + * Copyright (c) 2013 Ruslan Bukin + * All rights reserved. + * + * Based on mpcore_timer.c developed by Ben Gray + * + * 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. + * 3. The name of the company nor the name of the author may be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * 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. + */ + +/** + * Cortex-A15 (and probably A7) Generic Timer + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#define GENERIC_TIMER_CTRL_ENABLE (1 << 0) +#define GENERIC_TIMER_CTRL_INT_MASK (1 << 1) +#define GENERIC_TIMER_CTRL_INT_STAT (1 << 2) +#define GENERIC_TIMER_REG_CTRL 0 +#define GENERIC_TIMER_REG_TVAL 1 + +#define CNTPSIRQ 29 + +struct arm_tmr_softc { + struct resource *irq_res; + uint32_t clkfreq; + struct eventtimer et; +}; + +static struct arm_tmr_softc *arm_tmr_sc = NULL; + +static timecounter_get_t arm_tmr_get_timecount; + +static struct timecounter arm_tmr_timecount = { + .tc_name = "ARM MPCore Timecounter", + .tc_get_timecount = arm_tmr_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_quality = 1000, +}; + +static inline int +get_freq(void) +{ + uint32_t val; + + __asm volatile("mrc p15, 0, %0, c14, c0, 0" : "=r" (val)); + + return (val); +} + +static inline int +set_freq(uint32_t val) +{ + + __asm volatile("mcr p15, 0, %[val], c14, c0, 0" : : + [val] "r" (val)); + isb(); + + return (val); +} + + +static inline long +get_cntpct(void) +{ + uint64_t val; + + __asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (val)); + + return (val); +} + +static inline int +set_ctrl(uint32_t val) +{ + + __asm volatile("mcr p15, 0, %[val], c14, c2, 1" : : + [val] "r" (val)); + isb(); + + return (0); +} + +static inline int +set_tval(uint32_t val) +{ + + __asm volatile("mcr p15, 0, %[val], c14, c2, 0" : : + [val] "r" (val)); + isb(); + + return (0); +} + +static inline int +get_ctrl(void) +{ + uint32_t val; + + __asm volatile("mrc p15, 0, %0, c14, c2, 1" : "=r" (val)); + + return (val); +} + +static inline int +get_tval(void) +{ + uint32_t val; + + __asm volatile("mrc p15, 0, %0, c14, c2, 0" : "=r" (val)); + + return (val); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***