Date: Fri, 5 Dec 2008 07:40:53 +0000 (UTC) From: Kip Macy <kmacy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r185627 - user/kmacy/HEAD_fast_multi_xmit/sys/sys Message-ID: <200812050740.mB57erB6046807@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kmacy Date: Fri Dec 5 07:40:52 2008 New Revision: 185627 URL: http://svn.freebsd.org/changeset/base/185627 Log: IFC 184756:185625 part 2 Added: user/kmacy/HEAD_fast_multi_xmit/sys/sys/osd.h Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/conf.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/cpuset.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/disklabel.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/jail.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/mbuf.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/mount.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/namei.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/param.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmc.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmclog.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/priv.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/proc.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.mk user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscallsubr.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysctl.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysent.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysproto.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/termios.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/ttydefaults.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/user.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/vimage.h user/kmacy/HEAD_fast_multi_xmit/sys/sys/vnode.h Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/buf_ring.h Fri Dec 5 07:40:52 2008 (r185627) @@ -34,28 +34,6 @@ #include <machine/cpu.h> -#if defined (__GNUC__) - #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__ - #define mb() __asm__ __volatile__ ("mfence;": : :"memory") - #define wmb() __asm__ __volatile__ ("sfence;": : :"memory") - #define rmb() __asm__ __volatile__ ("lfence;": : :"memory") - #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9 - #define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory") - #define wmb() mb() - #define rmb() mb() - #elif #cpu(sparc) || defined sparc || defined __sparc__ - #define mb() __asm__ __volatile__ ("stbar;": : :"memory") - #define wmb() mb() - #define rmb() mb() -#else - #define wmb() mb() - #define rmb() mb() - #define mb() /* XXX just to make this compile */ - #endif -#else - #error "unknown compiler" -#endif - #if defined(INVARIANTS) && !defined(DEBUG_BUFRING) #define DEBUG_BUFRING 1 #endif @@ -86,7 +64,6 @@ struct buf_ring { uint64_t _pad1[14]; #ifdef DEBUG_BUFRING struct mtx *br_lock; - uint32_t br_count; #endif void *br_ring[0]; }; @@ -124,9 +101,7 @@ buf_ring_enqueue(struct buf_ring *br, vo #ifdef DEBUG_BUFRING if (br->br_ring[prod_head] != NULL) panic("dangling value in enqueue"); - - atomic_add_int(&br->br_count, 1); -#endif +#endif br->br_ring[prod_head] = buf; wmb(); @@ -174,7 +149,6 @@ buf_ring_dequeue_mc(struct buf_ring *br) buf = br->br_ring[cons_head]; #ifdef DEBUG_BUFRING br->br_ring[cons_head] = NULL; - atomic_subtract_int(&br->br_count, 1); #endif mb(); @@ -220,7 +194,6 @@ buf_ring_dequeue_sc(struct buf_ring *br) mb(); #ifdef DEBUG_BUFRING - atomic_subtract_int(&br->br_count, 1); br->br_ring[cons_head] = NULL; if (!mtx_owned(br->br_lock)) panic("lock not held on single consumer dequeue"); @@ -275,6 +248,4 @@ struct buf_ring *buf_ring_alloc(int coun struct mtx *); void buf_ring_free(struct buf_ring *br, struct malloc_type *type); - - #endif Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/conf.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/conf.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/conf.h Fri Dec 5 07:40:52 2008 (r185627) @@ -288,6 +288,7 @@ void devfs_fpdrop(struct file *fp); /* X #define UID_ROOT 0 #define UID_BIN 3 #define UID_UUCP 66 +#define UID_NOBODY 65534 #define GID_WHEEL 0 #define GID_KMEM 2 @@ -296,6 +297,7 @@ void devfs_fpdrop(struct file *fp); /* X #define GID_BIN 7 #define GID_GAMES 13 #define GID_DIALER 68 +#define GID_NOBODY 65534 typedef void (*dev_clone_fn)(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **result); Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/cpuset.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/cpuset.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/cpuset.h Fri Dec 5 07:40:52 2008 (r185627) @@ -132,6 +132,7 @@ typedef struct _cpuset { #define CPU_WHICH_PID 2 /* Specifies a process id. */ #define CPU_WHICH_CPUSET 3 /* Specifies a set id. */ #define CPU_WHICH_IRQ 4 /* Specifies an irq #. */ +#define CPU_WHICH_JAIL 5 /* Specifies a jail id. */ /* * Reserved cpuset identifiers. @@ -168,11 +169,15 @@ struct cpuset { #define CPU_SET_RDONLY 0x0002 /* No modification allowed. */ extern cpuset_t *cpuset_root; +struct proc; +struct thread; struct cpuset *cpuset_thread0(void); struct cpuset *cpuset_ref(struct cpuset *); void cpuset_rel(struct cpuset *); int cpuset_setthread(lwpid_t id, cpuset_t *); +int cpuset_create_root(struct thread *, struct cpuset **); +int cpuset_setproc_update_set(struct proc *, struct cpuset *); #else __BEGIN_DECLS Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/disklabel.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/disklabel.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/disklabel.h Fri Dec 5 07:40:52 2008 (r185627) @@ -52,7 +52,7 @@ /* XXX these should be defined per controller (or drive) elsewhere, not here! */ #if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \ - defined(__ia64__) + defined(__ia64__) || defined(__powerpc__) #define LABELSECTOR 1 /* sector containing label */ #define LABELOFFSET 0 /* offset of label in sector */ #endif Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/jail.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/jail.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/jail.h Fri Dec 5 07:40:52 2008 (r185627) @@ -13,21 +13,74 @@ #ifndef _SYS_JAIL_H_ #define _SYS_JAIL_H_ -struct jail { +#ifdef _KERNEL +struct jail_v0 { u_int32_t version; char *path; char *hostname; u_int32_t ip_number; }; +#endif + +struct jail { + uint32_t version; + char *path; + char *hostname; + char *jailname; + uint32_t ip4s; + uint32_t ip6s; + struct in_addr *ip4; + struct in6_addr *ip6; +}; +#define JAIL_API_VERSION 2 + +/* + * For all xprison structs, always keep the pr_version an int and + * the first variable so userspace can easily distinguish them. + */ +#ifndef _KERNEL +struct xprison_v1 { + int pr_version; + int pr_id; + char pr_path[MAXPATHLEN]; + char pr_host[MAXHOSTNAMELEN]; + u_int32_t pr_ip; +}; +#endif struct xprison { int pr_version; int pr_id; + int pr_state; + cpusetid_t pr_cpusetid; char pr_path[MAXPATHLEN]; char pr_host[MAXHOSTNAMELEN]; - u_int32_t pr_ip; + char pr_name[MAXHOSTNAMELEN]; + uint32_t pr_ip4s; + uint32_t pr_ip6s; +#if 0 + /* + * sizeof(xprison) will be malloced + size needed for all + * IPv4 and IPv6 addesses. Offsets are based numbers of addresses. + */ + struct in_addr pr_ip4[]; + struct in6_addr pr_ip6[]; +#endif +}; +#define XPRISON_VERSION 3 + +static const struct prison_state { + int pr_state; + const char * state_name; +} prison_states[] = { +#define PRISON_STATE_INVALID 0 + { PRISON_STATE_INVALID, "INVALID" }, +#define PRISON_STATE_ALIVE 1 + { PRISON_STATE_ALIVE, "ALIVE" }, +#define PRISON_STATE_DYING 2 + { PRISON_STATE_DYING, "DYING" }, }; -#define XPRISON_VERSION 1 + #ifndef _KERNEL @@ -48,6 +101,12 @@ MALLOC_DECLARE(M_PRISON); #endif #endif /* _KERNEL */ +#if defined(_KERNEL) || defined(_WANT_PRISON) + +#include <sys/osd.h> + +struct cpuset; + /* * This structure describes a prison. It is pointed to by all struct * ucreds's of the inmates. pr_ref keeps track of them and is used to @@ -60,20 +119,26 @@ MALLOC_DECLARE(M_PRISON); * required to read * (d) set only during destruction of jail, no mutex needed */ -#if defined(_KERNEL) || defined(_WANT_PRISON) struct prison { LIST_ENTRY(prison) pr_list; /* (a) all prisons */ int pr_id; /* (c) prison id */ int pr_ref; /* (p) refcount */ + int pr_state; /* (p) prison state */ + int pr_nprocs; /* (p) process count */ char pr_path[MAXPATHLEN]; /* (c) chroot path */ + struct cpuset *pr_cpuset; /* (p) cpuset */ struct vnode *pr_root; /* (c) vnode to rdir */ char pr_host[MAXHOSTNAMELEN]; /* (p) jail hostname */ - u_int32_t pr_ip; /* (c) ip addr host */ + char pr_name[MAXHOSTNAMELEN]; /* (c) admin jail name */ void *pr_linux; /* (p) linux abi */ int pr_securelevel; /* (p) securelevel */ struct task pr_task; /* (d) destroy task */ struct mtx pr_mtx; - void **pr_slots; /* (p) additional data */ + struct osd pr_osd; /* (p) additional data */ + int pr_ip4s; /* (c) number of v4 IPs */ + struct in_addr *pr_ip4; /* (c) v4 IPs of jail */ + int pr_ip6s; /* (c) number of v6 IPs */ + struct in6_addr *pr_ip6; /* (c) v6 IPs of jail */ }; #endif /* _KERNEL || _WANT_PRISON */ @@ -101,6 +166,8 @@ struct ucred; struct mount; struct sockaddr; struct statfs; +struct thread; +int kern_jail(struct thread *, struct jail *); int jailed(struct ucred *cred); void getcredhostname(struct ucred *cred, char *, size_t); int prison_check(struct ucred *cred1, struct ucred *cred2); @@ -109,12 +176,23 @@ void prison_enforce_statfs(struct ucred struct statfs *sp); struct prison *prison_find(int prid); void prison_free(struct prison *pr); -u_int32_t prison_getip(struct ucred *cred); +void prison_free_locked(struct prison *pr); void prison_hold(struct prison *pr); +void prison_hold_locked(struct prison *pr); +void prison_proc_hold(struct prison *); +void prison_proc_free(struct prison *); +int prison_getip4(struct ucred *cred, struct in_addr *ia); +int prison_local_ip4(struct ucred *cred, struct in_addr *ia); +int prison_remote_ip4(struct ucred *cred, struct in_addr *ia); +int prison_check_ip4(struct ucred *cred, struct in_addr *ia); +#ifdef INET6 +int prison_getip6(struct ucred *, struct in6_addr *); +int prison_local_ip6(struct ucred *, struct in6_addr *, int); +int prison_remote_ip6(struct ucred *, struct in6_addr *); +int prison_check_ip6(struct ucred *, struct in6_addr *); +#endif int prison_if(struct ucred *cred, struct sockaddr *sa); -int prison_ip(struct ucred *cred, int flag, u_int32_t *ip); int prison_priv_check(struct ucred *cred, int priv); -void prison_remote_ip(struct ucred *cred, int flags, u_int32_t *ip); /* * Kernel jail services. Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/mbuf.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/mbuf.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/mbuf.h Fri Dec 5 07:40:52 2008 (r185627) @@ -44,6 +44,8 @@ #endif #endif +#define M_DPAD_LEN 64 + /* * Mbufs are of a single size, MSIZE (sys/param.h), which includes overhead. * An mbuf may add a single "mbuf cluster" of size MCLBYTES (also in @@ -57,6 +59,9 @@ #define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */ #define MINCLSIZE (MHLEN + 1) /* smallest amount to put in cluster */ #define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */ +#define MICLHLEN (sizeof(struct m_hdr) + sizeof(struct pkthdr) + M_DPAD_LEN + sizeof(((struct mbuf *)0)->m_ext) + sizeof(int)) +#define MICLDOFF (roundup2(MICLHLEN, 64)) +#define MICLBYTES (MCLBYTES + MICLDOFF) #ifdef _KERNEL /*- @@ -115,10 +120,12 @@ struct pkthdr { /* variables for ip and tcp reassembly */ void *header; /* pointer to packet header */ int len; /* total packet length */ + uint32_t flowid; /* packet's 4-tuple system + * flow identifier + */ /* variables for hardware checksum */ int csum_flags; /* flags regarding checksum */ int csum_data; /* data field used by csum routines */ - uint32_t flowid; /* flow identifier (not IPv6) */ u_int16_t tso_segsz; /* TSO segment size */ u_int16_t ether_vtag; /* Ethernet 802.1p+q vlan tag */ SLIST_HEAD(packet_tags, m_tag) tags; /* list of packet tags */ @@ -350,10 +357,12 @@ extern uma_zone_t zone_jumbop; extern uma_zone_t zone_jumbo9; extern uma_zone_t zone_jumbo16; extern uma_zone_t zone_ext_refcnt; +extern uma_zone_t zone_iclust; static __inline struct mbuf *m_getcl(int how, short type, int flags); static __inline struct mbuf *m_get(int how, short type); static __inline struct mbuf *m_gethdr(int how, short type); +static __inline struct mbuf *m_geticl(int how, short type, int flags); static __inline struct mbuf *m_getjcl(int how, short type, int flags, int size); static __inline struct mbuf *m_getclr(int how, short type); /* XXX */ @@ -363,6 +372,12 @@ static __inline void *m_cljget(struct m static __inline void m_chtype(struct mbuf *m, short new_type); void mb_free_ext(struct mbuf *); static __inline struct mbuf *m_last(struct mbuf *m); +void m_tag_delete_chain(struct mbuf *, + struct m_tag *); + + +int mb_iclust_init(struct mbuf *m, short type, int flags); +void mb_iclust_free(void *mem, void *arg); static __inline int m_gettype(int size) @@ -465,7 +480,18 @@ static __inline struct mbuf * m_getcl(int how, short type, int flags) { struct mb_args args; - + struct mbuf *m; + + /* First try an iclust. */ + m = uma_zalloc(zone_iclust, how); + if (m) { + if (type != MT_NOINIT) + mb_iclust_init(m, type, flags); + return (m); + } + /* + * Then fallback to the packetzone. + */ args.flags = flags; args.type = type; return ((struct mbuf *)(uma_zalloc_arg(zone_pack, &args, how))); @@ -616,6 +642,50 @@ m_last(struct mbuf *m) m = m->m_next; return (m); } +static __inline void * +m_icldata(struct mbuf *m) +{ + + return ((void *)((uintptr_t)m + MICLDOFF)); +} + +static __inline +struct mbuf * +m_geticl(int how, short type, int flags) +{ + struct mbuf *m; + + m = uma_zalloc(zone_iclust, how); + if (m && type != MT_NOINIT) + mb_iclust_init(m, type, flags); + + return (m); +} + +/* + * Determine whether an mbuf can be torn down prior to xmit or not. This + * allows the driver to avoid touching the mbuf header when cleaning + * transmit interrupts. + */ +static inline int +m_fasttest(struct mbuf *m) +{ + if (m->m_next == NULL && (m->m_flags & M_EXT) != 0 && + m->m_ext.ext_free == mb_iclust_free && *m->m_ext.ref_cnt == 1) { + if (SLIST_FIRST(&m->m_pkthdr.tags) != NULL) + m_tag_delete_chain(m, NULL); + return (1); + } + return (0); +} + +static inline void +m_fastfree(struct mbuf *m) +{ + + uma_zfree(zone_iclust, m); +} + /* * mbuf, cluster, and external object allocation macros (for compatibility @@ -865,7 +935,6 @@ struct mbuf *m_unshare(struct mbuf *, in /* Packet tag routines. */ struct m_tag *m_tag_alloc(u_int32_t, int, int, int); void m_tag_delete(struct mbuf *, struct m_tag *); -void m_tag_delete_chain(struct mbuf *, struct m_tag *); void m_tag_free_default(struct m_tag *); struct m_tag *m_tag_locate(struct mbuf *, u_int32_t, int, struct m_tag *); struct m_tag *m_tag_copy(struct m_tag *, int); Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/mount.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/mount.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/mount.h Fri Dec 5 07:40:52 2008 (r185627) @@ -453,6 +453,7 @@ struct ovfsconf { #define VFCF_LOOPBACK 0x00100000 /* aliases some other mounted FS */ #define VFCF_UNICODE 0x00200000 /* stores file names as Unicode */ #define VFCF_JAIL 0x00400000 /* can be mounted from within a jail */ +#define VFCF_DELEGADMIN 0x00800000 /* supports delegated administration */ typedef uint32_t fsctlop_t; @@ -716,6 +717,7 @@ int vfs_donmount(struct thread *td, int void vfs_getnewfsid(struct mount *); struct cdev *vfs_getrootfsid(struct mount *); struct mount *vfs_getvfs(fsid_t *); /* return vfs given fsid */ +struct mount *vfs_busyfs(fsid_t *); int vfs_modevent(module_t, int, void *); void vfs_mount_error(struct mount *, const char *, ...); void vfs_mountroot(void); /* mount our root filesystem */ Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/namei.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/namei.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/namei.h Fri Dec 5 07:40:52 2008 (r185627) @@ -66,7 +66,7 @@ struct nameidata { /* * Arguments to lookup. */ - struct vnode *ni_startdir; /* starting directory */ + struct vnode *ni_startdir; /* starting directory */ struct vnode *ni_rootdir; /* logical root directory */ struct vnode *ni_topdir; /* logical top directory */ int ni_dirfd; /* starting directory for *at functions */ @@ -149,15 +149,20 @@ struct nameidata { /* * Initialization of a nameidata structure. */ -#define NDINIT(ndp, op, flags, segflg, namep, td) \ - NDINIT_AT(ndp, op, flags, segflg, namep, AT_FDCWD, td) +#define NDINIT(ndp, op, flags, segflg, namep, td) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, td) +#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, td) +#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \ + NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, td) static __inline void -NDINIT_AT(struct nameidata *ndp, +NDINIT_ALL(struct nameidata *ndp, u_long op, u_long flags, enum uio_seg segflg, const char *namep, int dirfd, + struct vnode *startdir, struct thread *td) { ndp->ni_cnd.cn_nameiop = op; @@ -165,6 +170,7 @@ NDINIT_AT(struct nameidata *ndp, ndp->ni_segflg = segflg; ndp->ni_dirp = namep; ndp->ni_dirfd = dirfd; + ndp->ni_startdir = startdir; ndp->ni_cnd.cn_thread = td; } Added: user/kmacy/HEAD_fast_multi_xmit/sys/sys/osd.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/osd.h Fri Dec 5 07:40:52 2008 (r185627) @@ -0,0 +1,89 @@ +/*- + * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> + * 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 AUTHORS 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 AUTHORS 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_OSD_H_ +#define _SYS_OSD_H_ + +#include <sys/queue.h> + +struct osd { + u_int osd_nslots; + void **osd_slots; + LIST_ENTRY(osd) osd_next; +}; + +#ifdef _KERNEL + +#define OSD_THREAD 0 +#define OSD_JAIL 1 + +#define OSD_FIRST OSD_THREAD +#define OSD_LAST OSD_JAIL + +typedef void (*osd_destructor_t)(void *value); + +int osd_register(u_int type, osd_destructor_t destructor); +void osd_deregister(u_int type, u_int slot); + +int osd_set(u_int type, struct osd *osd, u_int slot, void *value); +void *osd_get(u_int type, struct osd *osd, u_int slot); +void osd_del(u_int type, struct osd *osd, u_int slot); + +void osd_exit(u_int type, struct osd *osd); + +#define osd_thread_register(destructor) \ + osd_register(OSD_THREAD, (destructor)) +#define osd_thread_deregister(slot) \ + osd_deregister(OSD_THREAD, (slot)) +#define osd_thread_set(td, slot, value) \ + osd_set(OSD_THREAD, &(td)->td_osd, (slot), (value)) +#define osd_thread_get(td, slot) \ + osd_get(OSD_THREAD, &(td)->td_osd, (slot)) +#define osd_thread_del(td, slot) do { \ + KASSERT((td) == curthread, ("Not curthread.")); \ + osd_del(OSD_THREAD, &(td)->td_osd, (slot)); \ +} while (0) +#define osd_thread_exit(td) \ + osd_exit(OSD_THREAD, &(td)->td_osd) + +#define osd_jail_register(destructor) \ + osd_register(OSD_JAIL, (destructor)) +#define osd_jail_deregister(slot) \ + osd_deregister(OSD_JAIL, (slot)) +#define osd_jail_set(pr, slot, value) \ + osd_set(OSD_JAIL, &(pr)->pr_osd, (slot), (value)) +#define osd_jail_get(pr, slot) \ + osd_get(OSD_JAIL, &(pr)->pr_osd, (slot)) +#define osd_jail_del(pr, slot) \ + osd_del(OSD_JAIL, &(pr)->pr_osd, (slot)) +#define osd_jail_exit(pr) \ + osd_exit(OSD_JAIL, &(pr)->pr_osd) + +#endif /* _KERNEL */ + +#endif /* !_SYS_OSD_H_ */ Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/param.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/param.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/param.h Fri Dec 5 07:40:52 2008 (r185627) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800053 /* Master, propagated to newvers */ +#define __FreeBSD_version 800057 /* Master, propagated to newvers */ #ifndef LOCORE #include <sys/types.h> @@ -92,9 +92,13 @@ #include <sys/priority.h> #endif +#ifndef FALSE #define FALSE 0 +#endif +#ifndef TRUE #define TRUE 1 #endif +#endif #ifndef _KERNEL /* Signals. */ Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmc.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmc.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmc.h Fri Dec 5 07:40:52 2008 (r185627) @@ -40,7 +40,7 @@ #define PMC_MODULE_NAME "hwpmc" #define PMC_NAME_MAX 16 /* HW counter name size */ -#define PMC_CLASS_MAX 4 /* #classes of PMCs in a system */ +#define PMC_CLASS_MAX 4 /* max #classes of PMCs per-system */ /* * Kernel<->userland API version number [MMmmpppp] @@ -55,7 +55,7 @@ * The patch version is incremented for every bug fix. */ #define PMC_VERSION_MAJOR 0x03 -#define PMC_VERSION_MINOR 0x00 +#define PMC_VERSION_MINOR 0x01 #define PMC_VERSION_PATCH 0x0000 #define PMC_VERSION (PMC_VERSION_MAJOR << 24 | \ @@ -82,6 +82,7 @@ __PMC_CPU(INTEL_PIV, 0x86, "Intel Pentium IV") \ __PMC_CPU(INTEL_CORE, 0x87, "Intel Core Solo/Duo") \ __PMC_CPU(INTEL_CORE2, 0x88, "Intel Core2") \ + __PMC_CPU(INTEL_CORE2EXTREME, 0x89, "Intel Core2 Extreme") \ __PMC_CPU(INTEL_ATOM, 0x8A, "Intel Atom") enum pmc_cputype { @@ -105,8 +106,7 @@ enum pmc_cputype { __PMC_CLASS(P6) /* Intel Pentium Pro counters */ \ __PMC_CLASS(P4) /* Intel Pentium-IV counters */ \ __PMC_CLASS(IAF) /* Intel Core2/Atom, fixed function */ \ - __PMC_CLASS(IAP1) /* Intel Core...Atom, programmable */ \ - __PMC_CLASS(IAP2) /* Intel Core...Atom, programmable */ + __PMC_CLASS(IAP) /* Intel Core...Atom, programmable */ enum pmc_class { #undef __PMC_CLASS @@ -115,7 +115,7 @@ enum pmc_class { }; #define PMC_CLASS_FIRST PMC_CLASS_TSC -#define PMC_CLASS_LAST PMC_CLASS_IAP2 +#define PMC_CLASS_LAST PMC_CLASS_IAP /* * A PMC can be in the following states: @@ -473,9 +473,10 @@ struct pmc_op_getpmcinfo { */ struct pmc_classinfo { - enum pmc_class pm_class; /* class id */ + enum pmc_class pm_class; /* class id */ uint32_t pm_caps; /* counter capabilities */ uint32_t pm_width; /* width of the PMC */ + uint32_t pm_num; /* number of PMCs in class */ }; struct pmc_op_getcpuinfo { @@ -635,7 +636,7 @@ struct pmc_target { struct pmc { LIST_HEAD(,pmc_target) pm_targets; /* list of target processes */ - LIST_ENTRY(pmc) pm_next; /* owner's list */ + LIST_ENTRY(pmc) pm_next; /* owner's list */ /* * System-wide PMCs are allocated on a CPU and are not moved @@ -679,7 +680,7 @@ struct pmc { * mode, class and the CPU# associated with the PMC. */ - pmc_id_t pm_id; /* allocated PMC id */ + pmc_id_t pm_id; /* allocated PMC id */ /* md extensions */ union pmc_md_pmc pm_md; @@ -722,7 +723,7 @@ struct pmc_targetstate { struct pmc_process { LIST_ENTRY(pmc_process) pp_next; /* hash chain */ int pp_refcnt; /* reference count */ - uint32_t pp_flags; /* flags PMC_PP_* */ + uint32_t pp_flags; /* flags PMC_PP_* */ struct proc *pp_proc; /* target thread */ struct pmc_targetstate pp_pmcs[]; /* NHWPMCs */ }; @@ -840,7 +841,6 @@ struct pmc_cpu { uint32_t pc_state; /* physical cpu number + flags */ struct pmc_samplebuffer *pc_sb; /* space for samples */ struct pmc_hw *pc_hwpmcs[]; /* 'npmc' pointers */ - /* other machine dependent fields come here */ }; #define PMC_PCPU_CPU_MASK 0x000000FF @@ -863,6 +863,48 @@ struct pmc_binding { int pb_cpu; /* if so, to which CPU */ }; + +struct pmc_mdep; + +/* + * struct pmc_classdep + * + * PMC class-dependent operations. + */ +struct pmc_classdep { + uint32_t pcd_caps; /* class capabilities */ + enum pmc_class pcd_class; /* class id */ + int pcd_num; /* number of PMCs */ + int pcd_ri; /* row index of the first PMC in class */ + int pcd_width; /* width of the PMC */ + + /* configuring/reading/writing the hardware PMCs */ + int (*pcd_config_pmc)(int _cpu, int _ri, struct pmc *_pm); + int (*pcd_get_config)(int _cpu, int _ri, struct pmc **_ppm); + int (*pcd_read_pmc)(int _cpu, int _ri, pmc_value_t *_value); + int (*pcd_write_pmc)(int _cpu, int _ri, pmc_value_t _value); + + /* pmc allocation/release */ + int (*pcd_allocate_pmc)(int _cpu, int _ri, struct pmc *_t, + const struct pmc_op_pmcallocate *_a); + int (*pcd_release_pmc)(int _cpu, int _ri, struct pmc *_pm); + + /* starting and stopping PMCs */ + int (*pcd_start_pmc)(int _cpu, int _ri); + int (*pcd_stop_pmc)(int _cpu, int _ri); + + /* description */ + int (*pcd_describe)(int _cpu, int _ri, struct pmc_info *_pi, + struct pmc **_ppmc); + + /* class-dependent initialization & finalization */ + int (*pcd_pcpu_init)(struct pmc_mdep *_md, int _cpu); + int (*pcd_pcpu_fini)(struct pmc_mdep *_md, int _cpu); + + /* machine-specific interface */ + int (*pcd_get_msr)(int _ri, uint32_t *_msr); +}; + /* * struct pmc_mdep * @@ -871,45 +913,28 @@ struct pmc_binding { struct pmc_mdep { uint32_t pmd_cputype; /* from enum pmc_cputype */ - uint32_t pmd_npmc; /* max PMCs per CPU */ - uint32_t pmd_nclass; /* # PMC classes supported */ - struct pmc_classinfo pmd_classes[PMC_CLASS_MAX]; - int pmd_nclasspmcs[PMC_CLASS_MAX]; + uint32_t pmd_npmc; /* number of PMCs per CPU */ + uint32_t pmd_nclass; /* number of PMC classes present */ /* - * Methods + * Machine dependent methods. */ - int (*pmd_init)(int _cpu); /* machine dependent initialization */ - int (*pmd_cleanup)(int _cpu); /* machine dependent cleanup */ + /* per-cpu initialization and finalization */ + int (*pmd_pcpu_init)(struct pmc_mdep *_md, int _cpu); + int (*pmd_pcpu_fini)(struct pmc_mdep *_md, int _cpu); /* thread context switch in/out */ int (*pmd_switch_in)(struct pmc_cpu *_p, struct pmc_process *_pp); int (*pmd_switch_out)(struct pmc_cpu *_p, struct pmc_process *_pp); - /* configuring/reading/writing the hardware PMCs */ - int (*pmd_config_pmc)(int _cpu, int _ri, struct pmc *_pm); - int (*pmd_get_config)(int _cpu, int _ri, struct pmc **_ppm); - int (*pmd_read_pmc)(int _cpu, int _ri, pmc_value_t *_value); - int (*pmd_write_pmc)(int _cpu, int _ri, pmc_value_t _value); - - /* pmc allocation/release */ - int (*pmd_allocate_pmc)(int _cpu, int _ri, struct pmc *_t, - const struct pmc_op_pmcallocate *_a); - int (*pmd_release_pmc)(int _cpu, int _ri, struct pmc *_pm); - - /* starting and stopping PMCs */ - int (*pmd_start_pmc)(int _cpu, int _ri); - int (*pmd_stop_pmc)(int _cpu, int _ri); - /* handle a PMC interrupt */ int (*pmd_intr)(int _cpu, struct trapframe *_tf); - int (*pmd_describe)(int _cpu, int _ri, struct pmc_info *_pi, - struct pmc **_ppmc); - - int (*pmd_get_msr)(int _ri, uint32_t *_msr); - + /* + * PMC class dependent information. + */ + struct pmc_classdep pmd_classdep[]; }; /* @@ -918,7 +943,6 @@ struct pmc_mdep { */ extern struct pmc_cpu **pmc_pcpu; -extern struct pmc_mdep *md; /* driver statistics */ extern struct pmc_op_getdriverstats pmc_stats; @@ -969,7 +993,7 @@ extern struct pmc_debugflags pmc_debugfl #define PMC_DEBUG_MIN_FND 4 /* find */ /* MODULE */ -#define PMC_DEBUG_MIN_PMH 14 /* pmc_hook */ +#define PMC_DEBUG_MIN_PMH 14 /* pmc_hook */ #define PMC_DEBUG_MIN_PMS 15 /* pmc_syscall */ /* OWN */ @@ -1002,7 +1026,7 @@ extern struct pmc_debugflags pmc_debugfl #define PMC_DEBUG_MIN_INT 13 /* interrupts */ /* CPU */ -#define PMC_DEBUG_MIN_BND 8 /* bind */ +#define PMC_DEBUG_MIN_BND 8 /* bind */ #define PMC_DEBUG_MIN_SEL 9 /* select */ /* LOG */ @@ -1023,6 +1047,7 @@ MALLOC_DECLARE(M_PMC); */ struct pmc_mdep *pmc_md_initialize(void); /* MD init function */ +void pmc_md_finalize(struct pmc_mdep *_md); /* MD fini function */ int pmc_getrowdisp(int _ri); int pmc_process_interrupt(int _cpu, struct pmc *_pm, struct trapframe *_tf, int _inuserspace); Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmclog.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmclog.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/pmclog.h Fri Dec 5 07:40:52 2008 (r185627) @@ -239,7 +239,8 @@ union pmclog_entry { /* only used to si /* * Prototypes */ -int pmclog_configure_log(struct pmc_owner *_po, int _logfd); +int pmclog_configure_log(struct pmc_mdep *_md, struct pmc_owner *_po, + int _logfd); int pmclog_deconfigure_log(struct pmc_owner *_po); int pmclog_flush(struct pmc_owner *_po); void pmclog_initialize(void); Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/priv.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/priv.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/priv.h Fri Dec 5 07:40:52 2008 (r185627) @@ -84,7 +84,7 @@ #define PRIV_CLOCK_SETTIME 17 /* Can call clock_settime. */ #define PRIV_SETTIMEOFDAY 18 /* Can call settimeofday. */ #define PRIV_SETHOSTID 19 /* Can call sethostid. */ -#define PRIV_SETDOMAINNAME 20 /* Can call setdomainname. */ +#define _PRIV_SETDOMAINNAME 20 /* Removed. */ /* * Audit subsystem privileges. @@ -268,7 +268,7 @@ #define PRIV_VFS_MKNOD_DEV 331 /* Can mknod() to create dev nodes. */ #define PRIV_VFS_MKNOD_WHT 332 /* Can mknod() to create whiteout. */ #define PRIV_VFS_MOUNT 333 /* Can mount(). */ -#define PRIV_VFS_MOUNT_OWNER 334 /* Override owner on user mounts. */ +#define PRIV_VFS_MOUNT_OWNER 334 /* Can manage other users' file systems. */ #define PRIV_VFS_MOUNT_EXPORTED 335 /* Can set MNT_EXPORTED on mount. */ #define PRIV_VFS_MOUNT_PERM 336 /* Override dev node perms at mount. */ #define PRIV_VFS_MOUNT_SUIDDIR 337 /* Can set MNT_SUIDDIR on mount. */ Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/proc.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/proc.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/proc.h Fri Dec 5 07:40:52 2008 (r185627) @@ -47,6 +47,7 @@ #include <sys/_lock.h> #include <sys/lock_profile.h> #include <sys/_mutex.h> +#include <sys/osd.h> #include <sys/priority.h> #include <sys/rtprio.h> /* XXX. */ #include <sys/runq.h> @@ -233,6 +234,7 @@ struct thread { char td_name[MAXCOMLEN + 1]; /* (*) Thread name. */ struct file *td_fpop; /* (k) file referencing cdev under op */ int td_dbgflags; /* (c) Userland debugger flags */ + struct osd td_osd; /* (k) Object specific data. */ #define td_endzero td_base_pri /* Copied during fork1() or thread_sched_upcall(). */ Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.h Fri Dec 5 07:40:52 2008 (r185627) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr + * created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed */ #define SYS_syscall 0 @@ -161,9 +161,9 @@ #define SYS_freebsd4_fstatfs 158 #define SYS_lgetfh 160 #define SYS_getfh 161 -#define SYS_getdomainname 162 -#define SYS_setdomainname 163 -#define SYS_uname 164 +#define SYS_freebsd4_getdomainname 162 +#define SYS_freebsd4_setdomainname 163 +#define SYS_freebsd4_uname 164 #define SYS_sysarch 165 #define SYS_rtprio 166 #define SYS_semsys 169 Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.mk ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.mk Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscall.mk Fri Dec 5 07:40:52 2008 (r185627) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr +# created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed MIASM = \ syscall.o \ exit.o \ @@ -113,9 +113,9 @@ MIASM = \ freebsd4_fstatfs.o \ lgetfh.o \ getfh.o \ - getdomainname.o \ - setdomainname.o \ - uname.o \ + freebsd4_getdomainname.o \ + freebsd4_setdomainname.o \ + freebsd4_uname.o \ sysarch.o \ rtprio.o \ semsys.o \ Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscallsubr.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscallsubr.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/syscallsubr.h Fri Dec 5 07:40:52 2008 (r185627) @@ -142,6 +142,7 @@ int kern_openat(struct thread *td, int f enum uio_seg pathseg, int flags, int mode); int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name); +int kern_pipe(struct thread *td, int fildes[2]); int kern_preadv(struct thread *td, int fd, struct uio *auio, off_t offset); int kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data); Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysctl.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysctl.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysctl.h Fri Dec 5 07:40:52 2008 (r185627) @@ -540,13 +540,16 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define KERN_PROC_RGID 10 /* by real group id */ #define KERN_PROC_GID 11 /* by effective group id */ #define KERN_PROC_PATHNAME 12 /* path to executable */ -#define KERN_PROC_VMMAP 13 /* VM map entries for process */ -#define KERN_PROC_FILEDESC 14 /* File descriptors for process */ +#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */ +#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */ #define KERN_PROC_KSTACK 15 /* Kernel stacks for process */ #define KERN_PROC_INC_THREAD 0x10 /* * modifier for pid, pgrp, tty, * uid, ruid, gid, rgid and proc + * This effectively uses 16-31 */ +#define KERN_PROC_VMMAP 32 /* VM map entries for process */ +#define KERN_PROC_FILEDESC 33 /* File descriptors for process */ /* * KERN_IPC identifiers Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysent.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysent.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysent.h Fri Dec 5 07:40:52 2008 (r185627) @@ -100,8 +100,22 @@ struct sysentvec { void (*sv_setregs)(struct thread *, u_long, u_long, u_long); void (*sv_fixlimit)(struct rlimit *, int); u_long *sv_maxssiz; + u_int sv_flags; }; +#define SV_ILP32 0x000100 +#define SV_LP64 0x000200 +#define SV_IA32 0x004000 +#define SV_AOUT 0x008000 + +#define SV_ABI_MASK 0xff +#define SV_CURPROC_FLAG(x) (curproc->p_sysent->sv_flags & (x)) +#define SV_CURPROC_ABI() (curproc->p_sysent->sv_flags & SV_ABI_MASK) +/* same as ELFOSABI_XXX, to prevent header pollution */ +#define SV_ABI_LINUX 3 +#define SV_ABI_FREEBSD 9 +#define SV_ABI_UNDEF 255 + #ifdef _KERNEL extern struct sysentvec aout_sysvec; extern struct sysentvec elf_freebsd_sysvec; Modified: user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysproto.h ============================================================================== --- user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysproto.h Fri Dec 5 07:40:36 2008 (r185626) +++ user/kmacy/HEAD_fast_multi_xmit/sys/sys/sysproto.h Fri Dec 5 07:40:52 2008 (r185627) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 184588 2008-11-03 10:38:00Z dfr + * created from FreeBSD: head/sys/kern/syscalls.master 184789 2008-11-09 10:45:13Z ed *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812050740.mB57erB6046807>