svn commit: r215663 - head/sys/i386/xen
Author: cperciva Date: Mon Nov 22 09:04:29 2010 New Revision: 215663 URL: http://svn.freebsd.org/changeset/base/215663 Log: In xen_get_timecount, return the full ns-precision time rather than rounding to 1/HZ precision. I have no idea why the rounding was introduced in the first place, but it makes FreeBSD unhappy. Modified: head/sys/i386/xen/clock.c Modified: head/sys/i386/xen/clock.c == --- head/sys/i386/xen/clock.c Mon Nov 22 08:35:06 2010(r215662) +++ head/sys/i386/xen/clock.c Mon Nov 22 09:04:29 2010(r215663) @@ -829,7 +829,7 @@ xen_get_timecount(struct timecounter *tc clk = shadow->system_timestamp + get_nsec_offset(shadow); - return (uint32_t)((clk / NS_PER_TICK) * NS_PER_TICK); + return (uint32_t)(clk); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215664 - in head/sys: compat/linux kern
Author: netchild Date: Mon Nov 22 09:06:59 2010 New Revision: 215664 URL: http://svn.freebsd.org/changeset/base/215664 Log: By using the 32-bit Linux version of Sun's Java Development Kit 1.6 on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137. This is caused by: 1. After calling exec() in multithreaded linux program threads are not destroyed and continue running. They get killed after program being executed finishes. 2. linux_exit_group doesn't return correct exit code when called not from group leader. Which happens regularly using sun jvm. The submitters fix this in a similar way to how NetBSD handles this. I took the PRs away from dchagin, who seems to be out of touch of this since a while (no response from him). The patches committed here are from [2], with some little modifications from me to the style. PR: 141439 [1], 144194 [2] Submitted by: Stefan Schmidt , gk Reviewed by: rdivacky (in april 2010) MFC after:5 days Modified: head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_misc.c head/sys/kern/kern_exit.c Modified: head/sys/compat/linux/linux_emul.c == --- head/sys/compat/linux/linux_emul.c Mon Nov 22 09:04:29 2010 (r215663) +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 09:06:59 2010 (r215664) @@ -155,7 +155,7 @@ void linux_proc_exit(void *arg __unused, struct proc *p) { struct linux_emuldata *em; - int error; + int error, shared_flags, shared_xstat; struct thread *td = FIRST_THREAD_IN_PROC(p); int *child_clear_tid; struct proc *q, *nq; @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru } EMUL_SHARED_WLOCK(&emul_shared_lock); + shared_flags = em->shared->flags; + shared_xstat = em->shared->xstat; LIST_REMOVE(em, threads); em->shared->refs--; @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { + PROC_LOCK(p); + p->p_xstat = shared_xstat; + PROC_UNLOCK(p); + } + if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; int null = 0; @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + /* Kill threads regardless of imgp->sysent value */ + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); if (__predict_false(imgp->sysent != &elf_linux_sysvec && p->p_sysent == &elf_linux_sysvec)) { struct linux_emuldata *em; @@ -334,3 +345,29 @@ linux_set_tid_address(struct thread *td, EMUL_UNLOCK(&emul_lock); return 0; } + +void +linux_kill_threads(struct thread *td, int sig) +{ + struct linux_emuldata *em, *td_em, *tmp_em; + struct proc *sp; + + td_em = em_find(td->td_proc, EMUL_DONTLOCK); + + KASSERT(td_em != NULL, ("linux_kill_threads: emuldata not found.\n")); + + EMUL_SHARED_RLOCK(&emul_shared_lock); + LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { + if (em->pid == td_em->pid) + continue; + + sp = pfind(em->pid); + if ((sp->p_flag & P_WEXIT) == 0) + psignal(sp, sig); + PROC_UNLOCK(sp); +#ifdef DEBUG + printf(LMSG("linux_kill_threads: kill PID %d\n"), em->pid); +#endif + } + EMUL_SHARED_RUNLOCK(&emul_shared_lock); +} Modified: head/sys/compat/linux/linux_emul.h == --- head/sys/compat/linux/linux_emul.h Mon Nov 22 09:04:29 2010 (r215663) +++ head/sys/compat/linux/linux_emul.h Mon Nov 22 09:06:59 2010 (r215664) @@ -31,8 +31,12 @@ #ifndef _LINUX_EMUL_H_ #define_LINUX_EMUL_H_ +#define EMUL_SHARED_HASXSTAT 0x01 + struct linux_emuldata_shared { int refs; + int flags; + int xstat; pid_t group_pid; LIST_HEAD(, linux_emuldata) threads; /* head of list of linux threads */ @@ -76,6 +80,7 @@ int linux_proc_init(struct thread *, pid void linux_proc_exit(void *, struct proc *); void linux_schedtail(void *, struct proc *); void linux_proc_exec(void *, struct proc *, struct image_params *); +void linux_kill_threads(struct thread *, int); extern struct sx emul_shared_lock; extern struct mtx emul_lock; Mo
svn commit: r215665 - head/sys/kern
Author: cperciva Date: Mon Nov 22 09:13:25 2010 New Revision: 215665 URL: http://svn.freebsd.org/changeset/base/215665 Log: In tc_windup, handle the case where the previous call to tc_windup was more than 1s earlier. Prior to this commit, the computation of th_scale * delta (which produces a 64-bit value equal to the time since the last tc_windup call in units of 2^(-64) seconds) would overflow and any complete seconds would be lost. We fix this by repeatedly converting tc_frequency units of timecounter to one seconds; this is not exactly correct, since it loses the NTP adjustment, but if we find ourselves going more than 1s at a time between clock interrupts, losing a few seconds worth of NTP adjustments is the least of our problems... Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c == --- head/sys/kern/kern_tc.c Mon Nov 22 09:06:59 2010(r215664) +++ head/sys/kern/kern_tc.c Mon Nov 22 09:13:25 2010(r215665) @@ -442,6 +442,16 @@ tc_windup(void) ncount = 0; th->th_offset_count += delta; th->th_offset_count &= th->th_counter->tc_counter_mask; + while (delta > th->th_counter->tc_frequency) { + /* Eat complete unadjusted seconds. */ + delta -= th->th_counter->tc_frequency; + th->th_offset.sec++; + } + if ((delta > th->th_counter->tc_frequency / 2) && + (th->th_scale * delta < (uint64_t)1 << 63)) { + /* The product th_scale * delta just barely overflows. */ + th->th_offset.sec++; + } bintime_addx(&th->th_offset, th->th_scale * delta); /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215666 - head/sys/compat/linux
Author: netchild Date: Mon Nov 22 09:25:32 2010 New Revision: 215666 URL: http://svn.freebsd.org/changeset/base/215666 Log: Remove trailing dot from the unimplemented futex messages to make them consistent with the syscall and ipc messages. Submitted by: arundel MFC after:3 days Modified: head/sys/compat/linux/linux_futex.c Modified: head/sys/compat/linux/linux_futex.c == --- head/sys/compat/linux/linux_futex.c Mon Nov 22 09:13:25 2010 (r215665) +++ head/sys/compat/linux/linux_futex.c Mon Nov 22 09:25:32 2010 (r215666) @@ -626,21 +626,21 @@ linux_sys_futex(struct thread *td, struc /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op LINUX_FUTEX_LOCK_PI not implemented.\n"); + "op LINUX_FUTEX_LOCK_PI not implemented\n"); return (ENOSYS); case LINUX_FUTEX_UNLOCK_PI: /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op LINUX_FUTEX_UNLOCK_PI not implemented.\n"); + "op LINUX_FUTEX_UNLOCK_PI not implemented\n"); return (ENOSYS); case LINUX_FUTEX_TRYLOCK_PI: /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op LINUX_FUTEX_TRYLOCK_PI not implemented.\n"); + "op LINUX_FUTEX_TRYLOCK_PI not implemented\n"); return (ENOSYS); case LINUX_FUTEX_REQUEUE: @@ -664,14 +664,14 @@ linux_sys_futex(struct thread *td, struc /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op FUTEX_WAIT_BITSET not implemented.\n"); + "op FUTEX_WAIT_BITSET not implemented\n"); return (ENOSYS); case LINUX_FUTEX_WAIT_REQUEUE_PI: /* not yet implemented */ linux_msg(td, "linux_sys_futex: " - "op FUTEX_WAIT_REQUEUE_PI not implemented.\n"); + "op FUTEX_WAIT_REQUEUE_PI not implemented\n"); return (ENOSYS); default: ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215664 - in head/sys: compat/linux kern
On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote: > Author: netchild > Date: Mon Nov 22 09:06:59 2010 > New Revision: 215664 > URL: http://svn.freebsd.org/changeset/base/215664 > > Log: > By using the 32-bit Linux version of Sun's Java Development Kit 1.6 > on FreeBSD (amd64), invocations of "javac" (or "java") eventually > end with the output of "Killed" and exit code 137. > > This is caused by: > 1. After calling exec() in multithreaded linux program threads are not > destroyed and continue running. They get killed after program being > executed finishes. > > 2. linux_exit_group doesn't return correct exit code when called not > from group leader. Which happens regularly using sun jvm. > > The submitters fix this in a similar way to how NetBSD handles this. > > I took the PRs away from dchagin, who seems to be out of touch of > this since a while (no response from him). > > The patches committed here are from [2], with some little modifications > from me to the style. > > PR: 141439 [1], 144194 [2] > Submitted by: Stefan Schmidt , gk > Reviewed by:rdivacky (in april 2010) > MFC after: 5 days > > Modified: > head/sys/compat/linux/linux_emul.c > head/sys/compat/linux/linux_emul.h > head/sys/compat/linux/linux_misc.c > head/sys/kern/kern_exit.c > > Modified: head/sys/compat/linux/linux_emul.c > == > --- head/sys/compat/linux/linux_emul.cMon Nov 22 09:04:29 2010 > (r215663) > +++ head/sys/compat/linux/linux_emul.cMon Nov 22 09:06:59 2010 > (r215664) > @@ -155,7 +155,7 @@ void > linux_proc_exit(void *arg __unused, struct proc *p) > { > struct linux_emuldata *em; > - int error; > + int error, shared_flags, shared_xstat; > struct thread *td = FIRST_THREAD_IN_PROC(p); > int *child_clear_tid; > struct proc *q, *nq; > @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru > } > > EMUL_SHARED_WLOCK(&emul_shared_lock); > + shared_flags = em->shared->flags; > + shared_xstat = em->shared->xstat; > LIST_REMOVE(em, threads); > > em->shared->refs--; > @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru > } else > EMUL_SHARED_WUNLOCK(&emul_shared_lock); > > + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { > + PROC_LOCK(p); > + p->p_xstat = shared_xstat; > + PROC_UNLOCK(p); > + } Why is process lock taken there ? The assignment to u_short inside the properly aligned structure is atomic on all supported architectures, and the thread that should see side-effect of assignment is the same thread that does assignment. > + > if (child_clear_tid != NULL) { > struct linux_sys_futex_args cup; > int null = 0; > @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru > if (__predict_false(imgp->sysent == &elf_linux_sysvec > && p->p_sysent != &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > + /* Kill threads regardless of imgp->sysent value */ > + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); This is better expressed by if ((p->p_sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) Regardless of this mostly cosmetic issue, this is racy. Other linux thread in the same process might do an execve(3). More, if execve(3) call fails, then you return into the process that lacks all threads except the one that called execve(3). > if (__predict_false(imgp->sysent != &elf_linux_sysvec > && p->p_sysent == &elf_linux_sysvec)) { > struct linux_emuldata *em; > @@ -334,3 +345,29 @@ linux_set_tid_address(struct thread *td, > EMUL_UNLOCK(&emul_lock); > return 0; > } > + > +void > +linux_kill_threads(struct thread *td, int sig) > +{ > + struct linux_emuldata *em, *td_em, *tmp_em; > + struct proc *sp; > + > + td_em = em_find(td->td_proc, EMUL_DONTLOCK); > + > + KASSERT(td_em != NULL, ("linux_kill_threads: emuldata not found.\n")); > + > + EMUL_SHARED_RLOCK(&emul_shared_lock); > + LIST_FOREACH_SAFE(em, &td_em->shared->threads, threads, tmp_em) { > + if (em->pid == td_em->pid) > + continue; > + > + sp = pfind(em->pid); > + if ((sp->p_flag & P_WEXIT) == 0) > + psignal(sp, sig); > + PROC_UNLOCK(sp); > +#ifdef DEBUG > + printf(LMSG("linux_kill_threads: kill PID %d\n"), em->pid); > +#endif > + } > + EMUL_SHARED_RUNLOCK(&emul_shared_lock); > +} > > Modified: head/sys/compat/linux/linux_emul.h > == > --- head/sys/compat/linux/linux_emul.h
svn commit: r215669 - head
Author: netchild Date: Mon Nov 22 09:37:52 2010 New Revision: 215669 URL: http://svn.freebsd.org/changeset/base/215669 Log: 1) Add a hint to check for duplicates with optional files. The committed text is a little bit modified to what was submitted. The code example to automate a part of this was proposed by Dmitry Morozovsky. 2) Remove trailing whitespace. Submitted by: arundel Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Mon Nov 22 09:34:38 2010(r215668) +++ head/ObsoleteFiles.inc Mon Nov 22 09:37:52 2010(r215669) @@ -13,6 +13,15 @@ # # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# Before you commit changes to this file please check if any entries in +# tools/build/mk/OptionalObsoleteFiles.inc can be removed. The following +# command tells which files are listed more than once regardless of some +# architecture specific conditionals, so you can not blindly trust the +# output: +# ( grep '+=' /usr/src/ObsoleteFiles.inc | sort -u ; \ +# grep '+=' /usr/src/tools/build/mk/OptionalObsoleteFiles.inc | sort -u) | \ +# sort | uniq -d +# # 20101112: vgonel(9) has gone to private API a while ago OLD_FILES+=usr/share/man/man9/vgonel.9.gz @@ -1634,7 +1643,7 @@ OLD_DIRS+=usr/include/c++/3.4 OLD_FILES+=usr/sbin/zfs OLD_FILES+=usr/sbin/zpool # 20070423: rc.bluetooth (examples) removed -OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth +OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth # 20070421: worm.4 removed OLD_FILES+=usr/share/man/man4/worm.4.gz # 20070417: trunk(4) renamed to lagg(4) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215671 - head/sbin/geom/class/part
Author: ae Date: Mon Nov 22 10:08:33 2010 New Revision: 215671 URL: http://svn.freebsd.org/changeset/base/215671 Log: Always dump partition labels with `gpart backup`, but `gpart restore` does restore them only when -l option is specified [1]. Make number of entries field in backup format optional. Document -l and -r options of `gpart show` action. Suggested by: pjd [1] MFC after:1 week Modified: head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/part/gpart.8 Modified: head/sbin/geom/class/part/geom_part.c == --- head/sbin/geom/class/part/geom_part.c Mon Nov 22 09:59:10 2010 (r215670) +++ head/sbin/geom/class/part/geom_part.c Mon Nov 22 10:08:33 2010 (r215671) @@ -100,10 +100,8 @@ struct g_command PUBSYM(class_commands)[ G_OPT_SENTINEL }, "[-b start] [-s size] -t type [-i index] [-l label] [-f flags] geom" }, - { "backup", 0, gpart_backup, { - { 'l', "backup_labels", NULL, G_TYPE_BOOL}, - G_OPT_SENTINEL }, - "[-l] geom" + { "backup", 0, gpart_backup, G_NULL_OPTS, + "geom" }, { "bootcode", 0, gpart_bootcode, { { 'b', GPART_PARAM_BOOTCODE, G_VAL_OPTIONAL, G_TYPE_STRING }, @@ -175,9 +173,10 @@ struct g_command PUBSYM(class_commands)[ }, { "restore", 0, gpart_restore, { { 'F', "force", NULL, G_TYPE_BOOL }, + { 'l', "restore_labels", NULL, G_TYPE_BOOL }, { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, G_OPT_SENTINEL }, - "[-F] [-f flags] provider [...]" + "[-lF] [-f flags] provider [...]" }, { "recover", 0, gpart_issue, { { 'f', "flags", GPART_FLAGS, G_TYPE_STRING }, @@ -678,7 +677,7 @@ gpart_backup(struct gctl_req *req, unsig const char *s, *scheme; off_t sector, end; off_t length, secsz; - int error, labels, i, windex, wblocks, wtype; + int error, i, windex, wblocks, wtype; if (gctl_get_int(req, "nargs") != 1) errx(EXIT_FAILURE, "Invalid number of arguments."); @@ -696,7 +695,6 @@ gpart_backup(struct gctl_req *req, unsig s = gctl_get_ascii(req, "arg0"); if (s == NULL) abort(); - labels = gctl_get_int(req, "backup_labels"); gp = find_geom(classp, s); if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); @@ -734,14 +732,12 @@ gpart_backup(struct gctl_req *req, unsig length = end - sector + 1; } s = find_provcfg(pp, "label"); - printf("%-*s %*s %*jd %*jd", + printf("%-*s %*s %*jd %*jd %s %s\n", windex, find_provcfg(pp, "index"), wtype, find_provcfg(pp, "type"), wblocks, (intmax_t)sector, - wblocks, (intmax_t)length); - if (labels && s != NULL) - printf(" %s", s); - printf(" %s\n", fmtattrib(pp)); + wblocks, (intmax_t)length, + (s != NULL) ? s: "", fmtattrib(pp)); } geom_deletetree(&mesh); } @@ -769,7 +765,7 @@ gpart_restore(struct gctl_req *req, unsi struct ggeom *gp; const char *s, *flags, *errstr, *label; char **ap, *argv[6], line[BUFSIZ], *pline; - int error, forced, i, l, nargs, created; + int error, forced, i, l, nargs, created, rl; intmax_t n; nargs = gctl_get_int(req, "nargs"); @@ -778,6 +774,7 @@ gpart_restore(struct gctl_req *req, unsi forced = gctl_get_int(req, "force"); flags = gctl_get_ascii(req, "flags"); + rl = gctl_get_int(req, "restore_labels"); s = gctl_get_ascii(req, "class"); if (s == NULL) abort(); @@ -829,19 +826,21 @@ gpart_restore(struct gctl_req *req, unsi break; l = ap - &argv[0]; label = pline = NULL; - if (l == 2) { /* create table */ + if (l == 1 || l == 2) { /* create table */ if (created) errx(EXIT_FAILURE, "Incorrect backup format."); - n = atoi(argv[1]); + if (l == 2) + n = strtoimax(argv[1], NULL, 0); for (i = 0; i < nargs; i++) { s = gctl_get_ascii(req, "arg%d", i); r = gctl_get_handle(); - n = strtoimax(argv[1], NULL, 0); gctl_ro_param(r, "class", -1, classp->lg_name); gctl_ro_param(r, "verb", -1, "create"); gctl_ro_param(r,
Re: svn commit: r215664 - in head/sys: compat/linux kern
Quoting Kostik Belousov (from Mon, 22 Nov 2010 11:31:34 +0200): On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote: Author: netchild Date: Mon Nov 22 09:06:59 2010 New Revision: 215664 URL: http://svn.freebsd.org/changeset/base/215664 Log: By using the 32-bit Linux version of Sun's Java Development Kit 1.6 on FreeBSD (amd64), invocations of "javac" (or "java") eventually end with the output of "Killed" and exit code 137. @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { + PROC_LOCK(p); + p->p_xstat = shared_xstat; + PROC_UNLOCK(p); + } Why is process lock taken there ? The assignment to u_short inside the properly aligned structure is atomic on all supported architectures, and the thread that should see side-effect of assignment is the same thread that does assignment. Change below. + if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; int null = 0; @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + /* Kill threads regardless of imgp->sysent value */ + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); This is better expressed by if ((p->p_sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) Is this OK for you? ---snip--- Index: compat/linux/linux_emul.c === --- compat/linux/linux_emul.c (Revision 215664) +++ compat/linux/linux_emul.c (Arbeitskopie) @@ -198,11 +198,8 @@ } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { - PROC_LOCK(p); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) p->p_xstat = shared_xstat; - PROC_UNLOCK(p); - } if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; @@ -265,7 +262,8 @@ if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == + SV_ABI_LINUX)) /* Kill threads regardless of imgp->sysent value */ linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); if (__predict_false(imgp->sysent != &elf_linux_sysvec ---snip--- Regardless of this mostly cosmetic issue, this is racy. Other linux thread in the same process might do an execve(3). More, if execve(3) call fails, then you return into the process that lacks all threads except the one that called execve(3). How critical is this in your opinion (relative to the issue this patch is fixing)? Do you prefer a backout or do you think the probability that the someone wins the race is low enough? Do you see a solution for the race? Bye, Alexander. -- http://www.Leidinger.net Alexander @ Leidinger.net: PGP ID = B0063FE7 http://www.FreeBSD.org netchild @ FreeBSD.org : PGP ID = 72077137 This generation doesn't have emotional baggage. We have emotional moving vans. -- Bruce Feirstein ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215664 - in head/sys: compat/linux kern
On Mon, Nov 22, 2010 at 11:13:06AM +0100, Alexander Leidinger wrote: > Quoting Kostik Belousov (from Mon, 22 Nov 2010 > 11:31:34 +0200): > > >On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote: > >>Author: netchild > >>Date: Mon Nov 22 09:06:59 2010 > >>New Revision: 215664 > >>URL: http://svn.freebsd.org/changeset/base/215664 > >> > >>Log: > >> By using the 32-bit Linux version of Sun's Java Development Kit 1.6 > >> on FreeBSD (amd64), invocations of "javac" (or "java") eventually > >> end with the output of "Killed" and exit code 137. > > > >>@@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru > >>} else > >>EMUL_SHARED_WUNLOCK(&emul_shared_lock); > >> > >>+ if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { > >>+ PROC_LOCK(p); > >>+ p->p_xstat = shared_xstat; > >>+ PROC_UNLOCK(p); > >>+ } > >Why is process lock taken there ? The assignment to u_short inside the > >properly aligned structure is atomic on all supported architectures, and > >the thread that should see side-effect of assignment is the same thread > >that does assignment. > > Change below. > > >>+ > >>if (child_clear_tid != NULL) { > >>struct linux_sys_futex_args cup; > >>int null = 0; > >>@@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru > >>if (__predict_false(imgp->sysent == &elf_linux_sysvec > >>&& p->p_sysent != &elf_linux_sysvec)) > >>linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > >>+ if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > >>+ /* Kill threads regardless of imgp->sysent value */ > >>+ linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > >This is better expressed by > > if ((p->p_sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) > > Is this OK for you? > ---snip--- > Index: compat/linux/linux_emul.c > === > --- compat/linux/linux_emul.c (Revision 215664) > +++ compat/linux/linux_emul.c (Arbeitskopie) > @@ -198,11 +198,8 @@ > } else > EMUL_SHARED_WUNLOCK(&emul_shared_lock); > > - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { > - PROC_LOCK(p); > + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) > p->p_xstat = shared_xstat; > - PROC_UNLOCK(p); > - } > > if (child_clear_tid != NULL) { > struct linux_sys_futex_args cup; > @@ -265,7 +262,8 @@ > if (__predict_false(imgp->sysent == &elf_linux_sysvec > && p->p_sysent != &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == > + SV_ABI_LINUX)) > /* Kill threads regardless of imgp->sysent value */ > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > if (__predict_false(imgp->sysent != &elf_linux_sysvec > ---snip--- Yes. > > >Regardless of this mostly cosmetic issue, this is racy. Other > >linux thread in the same process might do an execve(3). > >More, if execve(3) call fails, then you return into the process > >that lacks all threads except the one that called execve(3). > > How critical is this in your opinion (relative to the issue this patch > is fixing)? Do you prefer a backout or do you think the probability > that the someone wins the race is low enough? > > Do you see a solution for the race? I did not asked for backout, nor I am asking now. Most likely, the semantic of linux thread groups cannot be implemented by only using event handlers that linux.ko hooks now. How linux handles single-threading when doing execve(2) from multithreaded process ? pgpIriIujbv2q.pgp Description: PGP signature
Re: svn commit: r215664 - in head/sys: compat/linux kern
On (22/11/2010 11:31), Kostik Belousov wrote: > On Mon, Nov 22, 2010 at 09:07:00AM +, Alexander Leidinger wrote: > > Author: netchild > > Date: Mon Nov 22 09:06:59 2010 > > New Revision: 215664 > > URL: http://svn.freebsd.org/changeset/base/215664 > > > > Log: > > By using the 32-bit Linux version of Sun's Java Development Kit 1.6 > > on FreeBSD (amd64), invocations of "javac" (or "java") eventually > > end with the output of "Killed" and exit code 137. > > > > This is caused by: > > 1. After calling exec() in multithreaded linux program threads are not > > destroyed and continue running. They get killed after program being > > executed finishes. > > > > 2. linux_exit_group doesn't return correct exit code when called not > > from group leader. Which happens regularly using sun jvm. > > > > The submitters fix this in a similar way to how NetBSD handles this. > > > > I took the PRs away from dchagin, who seems to be out of touch of > > this since a while (no response from him). > > > > The patches committed here are from [2], with some little modifications > > from me to the style. > > > > PR: 141439 [1], 144194 [2] > > Submitted by: Stefan Schmidt , gk > > Reviewed by: rdivacky (in april 2010) > > MFC after:5 days > > > > Modified: > > head/sys/compat/linux/linux_emul.c > > head/sys/compat/linux/linux_emul.h > > head/sys/compat/linux/linux_misc.c > > head/sys/kern/kern_exit.c > > > > Modified: head/sys/compat/linux/linux_emul.c > > == > > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 09:04:29 2010 > > (r215663) > > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 09:06:59 2010 > > (r215664) > > @@ -155,7 +155,7 @@ void > > linux_proc_exit(void *arg __unused, struct proc *p) > > { > > struct linux_emuldata *em; > > - int error; > > + int error, shared_flags, shared_xstat; > > struct thread *td = FIRST_THREAD_IN_PROC(p); > > int *child_clear_tid; > > struct proc *q, *nq; > > @@ -187,6 +187,8 @@ linux_proc_exit(void *arg __unused, stru > > } > > > > EMUL_SHARED_WLOCK(&emul_shared_lock); > > + shared_flags = em->shared->flags; > > + shared_xstat = em->shared->xstat; > > LIST_REMOVE(em, threads); > > > > em->shared->refs--; > > @@ -196,6 +198,12 @@ linux_proc_exit(void *arg __unused, stru > > } else > > EMUL_SHARED_WUNLOCK(&emul_shared_lock); > > > > + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { > > + PROC_LOCK(p); > > + p->p_xstat = shared_xstat; > > + PROC_UNLOCK(p); > > + } > Why is process lock taken there ? The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, and > the thread that should see side-effect of assignment is the same thread > that does assignment. > > > + > > if (child_clear_tid != NULL) { > > struct linux_sys_futex_args cup; > > int null = 0; > > @@ -257,6 +265,9 @@ linux_proc_exec(void *arg __unused, stru > > if (__predict_false(imgp->sysent == &elf_linux_sysvec > > && p->p_sysent != &elf_linux_sysvec)) > > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > > + if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > > + /* Kill threads regardless of imgp->sysent value */ > > + linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > This is better expressed by > if ((p->p_sysent->sv_flags & SV_ABI_MASK) == SV_ABI_LINUX) > > Regardless of this mostly cosmetic issue, this is racy. Other > linux thread in the same process might do an execve(3). > More, if execve(3) call fails, then you return into the process > that lacks all threads except the one that called execve(3). execve(3) races in linuxulator are known, and that's not the only case: http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/142082 But fixing it is not easy, as you've noted in other email current hook mechanism is not good enough for it. ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215672 - head/sbin/geom/class/part
Author: ae Date: Mon Nov 22 11:24:11 2010 New Revision: 215672 URL: http://svn.freebsd.org/changeset/base/215672 Log: Add SIGINT handler to `gpart restore` action. MFC after:1 week Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c == --- head/sbin/geom/class/part/geom_part.c Mon Nov 22 10:08:33 2010 (r215671) +++ head/sbin/geom/class/part/geom_part.c Mon Nov 22 11:24:11 2010 (r215672) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,6 +62,7 @@ uint32_t PUBSYM(version) = 0; static char sstart[32]; static char ssize[32]; +volatile sig_atomic_t undo_restore; #defineGPART_AUTOFILL "*" #defineGPART_FLAGS "C" @@ -757,12 +759,19 @@ skip_line(const char *p) } static void +gpart_sighndl(int sig __unused) +{ + undo_restore = 1; +} + +static void gpart_restore(struct gctl_req *req, unsigned int fl __unused) { struct gmesh mesh; struct gclass *classp; struct gctl_req *r; struct ggeom *gp; + struct sigaction si_sa; const char *s, *flags, *errstr, *label; char **ap, *argv[6], line[BUFSIZ], *pline; int error, forced, i, l, nargs, created, rl; @@ -786,6 +795,13 @@ gpart_restore(struct gctl_req *req, unsi geom_deletetree(&mesh); errx(EXIT_FAILURE, "Class %s not found.", s); } + + sigemptyset(&si_sa.sa_mask); + si_sa.sa_flags = 0; + si_sa.sa_handler = gpart_sighndl; + if (sigaction(SIGINT, &si_sa, 0) == -1) + err(EXIT_FAILURE, "sigaction SIGINT"); + if (forced) { /* destroy existent partition table before restore */ for (i = 0; i < nargs; i++) { @@ -811,7 +827,8 @@ gpart_restore(struct gctl_req *req, unsi } } created = 0; - while (fgets(line, sizeof(line) - 1, stdin)) { + while (undo_restore == 0 && + fgets(line, sizeof(line) - 1, stdin) != NULL) { /* Format of backup entries: * * [label] ['['attrib[,attrib]']'] @@ -920,6 +937,8 @@ gpart_restore(struct gctl_req *req, unsi } } } + if (undo_restore) + goto backout; /* commit changes if needed */ if (strchr(flags, 'C') != NULL) { for (i = 0; i < nargs; i++) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215673 - head/sys/netgraph
Author: zec Date: Mon Nov 22 12:32:19 2010 New Revision: 215673 URL: http://svn.freebsd.org/changeset/base/215673 Log: Allow for MTU sizes of up to ETHER_MAX_LEN_JUMBO (i.e. 9018) bytes to be configured on ng_eiface ifnets. The default MTU remains unchanged at 1500 bytes. Mark ng_eiface ifnets as IFCAP_VLAN_MTU capable, so that the associated vlan(4) ifnets may use full-sized Ethernet MTUs (1500 bytes). MFC after:3 days Modified: head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_eiface.h Modified: head/sys/netgraph/ng_eiface.c == --- head/sys/netgraph/ng_eiface.c Mon Nov 22 11:24:11 2010 (r215672) +++ head/sys/netgraph/ng_eiface.c Mon Nov 22 12:32:19 2010 (r215673) @@ -371,6 +371,8 @@ ng_eiface_constructor(node_p node) ifp->if_ioctl = ng_eiface_ioctl; ifp->if_snd.ifq_maxlen = ifqmaxlen; ifp->if_flags = (IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST); + ifp->if_capabilities = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU; + ifp->if_capenable = IFCAP_VLAN_MTU | IFCAP_JUMBO_MTU; /* Give this node the same name as the interface (if possible) */ if (ng_name_node(node, ifp->if_xname) != 0) Modified: head/sys/netgraph/ng_eiface.h == --- head/sys/netgraph/ng_eiface.h Mon Nov 22 11:24:11 2010 (r215672) +++ head/sys/netgraph/ng_eiface.h Mon Nov 22 12:32:19 2010 (r215673) @@ -46,7 +46,7 @@ /* MTU bounds */ #define NG_EIFACE_MTU_MIN 72 -#define NG_EIFACE_MTU_MAX 2312 +#define NG_EIFACE_MTU_MAX ETHER_MAX_LEN_JUMBO #define NG_EIFACE_MTU_DEFAULT 1500 /* Netgraph commands */ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215674 - head/sbin/devd
Author: brucec Date: Mon Nov 22 12:33:48 2010 New Revision: 215674 URL: http://svn.freebsd.org/changeset/base/215674 Log: Don't generate input() since it's not used. Modified: head/sbin/devd/token.l Modified: head/sbin/devd/token.l == --- head/sbin/devd/token.l Mon Nov 22 12:32:19 2010(r215673) +++ head/sbin/devd/token.l Mon Nov 22 12:33:48 2010(r215674) @@ -38,6 +38,7 @@ int lineno = 1; #define YY_NO_UNPUT +#define YY_NO_INPUT static void update_lineno(const char *cp) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215675 - head/sys/compat/linux
Author: netchild Date: Mon Nov 22 12:42:32 2010 New Revision: 215675 URL: http://svn.freebsd.org/changeset/base/215675 Log: Do not take the process lock. The assignment to u_short inside the properly aligned structure is atomic on all supported architectures, and the thread that should see side-effect of assignment is the same thread that does assignment. Use a more appropriate conditional to detect the linux ABI. Suggested by: kib X-MFC:together with r215664 Modified: head/sys/compat/linux/linux_emul.c Modified: head/sys/compat/linux/linux_emul.c == --- head/sys/compat/linux/linux_emul.c Mon Nov 22 12:33:48 2010 (r215674) +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 12:42:32 2010 (r215675) @@ -198,11 +198,8 @@ linux_proc_exit(void *arg __unused, stru } else EMUL_SHARED_WUNLOCK(&emul_shared_lock); - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { - PROC_LOCK(p); + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) p->p_xstat = shared_xstat; - PROC_UNLOCK(p); - } if (child_clear_tid != NULL) { struct linux_sys_futex_args cup; @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent != &elf_linux_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == + SV_ABI_LINUX)) /* Kill threads regardless of imgp->sysent value */ linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); if (__predict_false(imgp->sysent != &elf_linux_sysvec ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215675 - head/sys/compat/linux
On Mon, Nov 22, 2010 at 12:42:32PM +, Alexander Leidinger wrote: > Author: netchild > Date: Mon Nov 22 12:42:32 2010 > New Revision: 215675 > URL: http://svn.freebsd.org/changeset/base/215675 > > Log: > Do not take the process lock. The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, and > the thread that should see side-effect of assignment is the same thread > that does assignment. > > Use a more appropriate conditional to detect the linux ABI. > > Suggested by: kib > X-MFC: together with r215664 > > Modified: > head/sys/compat/linux/linux_emul.c > > Modified: head/sys/compat/linux/linux_emul.c > == > --- head/sys/compat/linux/linux_emul.cMon Nov 22 12:33:48 2010 > (r215674) > +++ head/sys/compat/linux/linux_emul.cMon Nov 22 12:42:32 2010 > (r215675) > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru > if (__predict_false(imgp->sysent == &elf_linux_sysvec > && p->p_sysent != &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == > + SV_ABI_LINUX)) > /* Kill threads regardless of imgp->sysent value */ > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > if (__predict_false(imgp->sysent != &elf_linux_sysvec There are several similar comparisons around the patched one. I am still quite curious for the reason of all __predict() obfuscations that are countless in the linuxolator. We are not oblidged to emulate this aspect of Linux. pgppJsqRQLNA8.pgp Description: PGP signature
svn commit: r215676 - in head: sbin/hastd usr.bin/colldef usr.sbin/apmd usr.sbin/bluetooth/bthidd usr.sbin/bluetooth/hcsecd usr.sbin/config usr.sbin/kbdcontrol
Author: brucec Date: Mon Nov 22 14:16:22 2010 New Revision: 215676 URL: http://svn.freebsd.org/changeset/base/215676 Log: Don't generate input() since it's not used. Modified: head/sbin/hastd/Makefile head/usr.bin/colldef/Makefile head/usr.sbin/apmd/apmdlex.l head/usr.sbin/bluetooth/bthidd/lexer.l head/usr.sbin/bluetooth/hcsecd/lexer.l head/usr.sbin/config/lang.l head/usr.sbin/kbdcontrol/lex.l Modified: head/sbin/hastd/Makefile == --- head/sbin/hastd/MakefileMon Nov 22 12:42:32 2010(r215675) +++ head/sbin/hastd/MakefileMon Nov 22 14:16:22 2010(r215676) @@ -25,6 +25,7 @@ CFLAGS+=-DINET6 .endif # This is needed to have WARNS > 1. CFLAGS+=-DYY_NO_UNPUT +CFLAGS+=-DYY_NO_INPUT DPADD= ${LIBGEOM} ${LIBBSDXML} ${LIBSBUF} ${LIBL} ${LIBPTHREAD} ${LIBUTIL} LDADD= -lgeom -lbsdxml -lsbuf -ll -lpthread -lutil Modified: head/usr.bin/colldef/Makefile == --- head/usr.bin/colldef/Makefile Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.bin/colldef/Makefile Mon Nov 22 14:16:22 2010 (r215676) @@ -4,7 +4,7 @@ PROG= colldef SRCS= parse.y scan.l y.tab.h LFLAGS=-8 -i CFLAGS+=-I. -I${.CURDIR} -I${.CURDIR}/../../lib/libc/locale -CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT +CFLAGS+=-DCOLLATE_DEBUG -DYY_NO_UNPUT -DYY_NO_INPUT LDADD= -ll DPADD= ${LIBL} Modified: head/usr.sbin/apmd/apmdlex.l == --- head/usr.sbin/apmd/apmdlex.lMon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/apmd/apmdlex.lMon Nov 22 14:16:22 2010 (r215676) @@ -38,6 +38,7 @@ /* We don't need it, avoid the warning. */ #define YY_NO_UNPUT +#define YY_NO_INPUT int lineno; int first_time; Modified: head/usr.sbin/bluetooth/bthidd/lexer.l == --- head/usr.sbin/bluetooth/bthidd/lexer.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/bluetooth/bthidd/lexer.l Mon Nov 22 14:16:22 2010 (r215676) @@ -39,7 +39,7 @@ int yylex (void); %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput noinput delim [ \t\n] ws {delim}+ Modified: head/usr.sbin/bluetooth/hcsecd/lexer.l == --- head/usr.sbin/bluetooth/hcsecd/lexer.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/bluetooth/hcsecd/lexer.l Mon Nov 22 14:16:22 2010 (r215676) @@ -34,7 +34,7 @@ #include "parser.h" %} -%option yylineno noyywrap nounput +%option yylineno noyywrap nounput noinput delim [ \t\n] ws {delim}+ Modified: head/usr.sbin/config/lang.l == --- head/usr.sbin/config/lang.l Mon Nov 22 12:42:32 2010(r215675) +++ head/usr.sbin/config/lang.l Mon Nov 22 14:16:22 2010(r215676) @@ -39,6 +39,7 @@ #include "config.h" #define YY_NO_UNPUT +#define YY_NO_INPUT /* * Data for returning to previous files from include files. Modified: head/usr.sbin/kbdcontrol/lex.l == --- head/usr.sbin/kbdcontrol/lex.l Mon Nov 22 12:42:32 2010 (r215675) +++ head/usr.sbin/kbdcontrol/lex.l Mon Nov 22 14:16:22 2010 (r215676) @@ -32,6 +32,7 @@ #include "lex.h" #define YY_NO_UNPUT +#define YY_NO_INPUT %} ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215677 - head/sys/netinet
Author: zec Date: Mon Nov 22 14:16:23 2010 New Revision: 215677 URL: http://svn.freebsd.org/changeset/base/215677 Log: Remove an apparently redundant CURVNET_SET() / CURVNET_RESTORE() pair. MFC after:3 days Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c == --- head/sys/netinet/if_ether.c Mon Nov 22 14:16:22 2010(r215676) +++ head/sys/netinet/if_ether.c Mon Nov 22 14:16:23 2010(r215677) @@ -154,12 +154,10 @@ arp_ifscrub(struct ifnet *ifp, uint32_t addr4.sin_len= sizeof(addr4); addr4.sin_family = AF_INET; addr4.sin_addr.s_addr = addr; - CURVNET_SET(ifp->if_vnet); IF_AFDATA_LOCK(ifp); lla_lookup(LLTABLE(ifp), (LLE_DELETE | LLE_IFADDR), (struct sockaddr *)&addr4); IF_AFDATA_UNLOCK(ifp); - CURVNET_RESTORE(); } #endif ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215678 - head/usr.sbin/mptutil
Author: jhb Date: Mon Nov 22 14:36:04 2010 New Revision: 215678 URL: http://svn.freebsd.org/changeset/base/215678 Log: Similar to mfiutil, drop local definition of powerof2() and use version from instead. Modified: head/usr.sbin/mptutil/mpt_config.c Modified: head/usr.sbin/mptutil/mpt_config.c == --- head/usr.sbin/mptutil/mpt_config.c Mon Nov 22 14:16:23 2010 (r215677) +++ head/usr.sbin/mptutil/mpt_config.c Mon Nov 22 14:36:04 2010 (r215678) @@ -50,8 +50,6 @@ __RCSID("$FreeBSD$"); static voiddump_config(CONFIG_PAGE_RAID_VOL_0 *vol); #endif -#define powerof2(x)x)-1)&(x))==0) - static long dehumanize(const char *value) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215679 - in head: contrib/binutils/bfd contrib/binutils/binutils contrib/binutils/include/elf contrib/file contrib/gdb/gdb gnu/usr.bin/gdb/libgdb sys/compat/freebsd32 sys/kern sys/sys ...
Author: attilio Date: Mon Nov 22 14:42:13 2010 New Revision: 215679 URL: http://svn.freebsd.org/changeset/base/215679 Log: Add the ability for GDB to printout the thread name along with other thread specific informations. In order to do that, and in order to avoid KBI breakage with existing infrastructure the following semantic is implemented: - For live programs, a new member to the PT_LWPINFO is added (pl_tdname) - For cores, a new ELF note is added (NT_THRMISC) that can be used for storing thread specific, miscellaneous, informations. Right now it is just popluated with a thread name. GDB, then, retrieves the correct informations from the corefile via the BFD interface, as it groks the ELF notes and create appropriate pseudo-sections. Sponsored by: Sandvine Incorporated Tested by:gianni Discussed with: dim, kan, kib MFC after:2 weeks Modified: head/contrib/binutils/bfd/elf-bfd.h head/contrib/binutils/bfd/elf.c head/contrib/binutils/binutils/readelf.c head/contrib/binutils/include/elf/common.h head/contrib/file/readelf.h head/contrib/gdb/gdb/fbsd-proc.c head/gnu/usr.bin/gdb/libgdb/fbsd-threads.c head/sys/compat/freebsd32/freebsd32.h head/sys/kern/imgact_elf.c head/sys/kern/sys_process.c head/sys/sys/elf_common.h head/sys/sys/procfs.h head/sys/sys/ptrace.h head/usr.bin/gcore/elfcore.c Modified: head/contrib/binutils/bfd/elf-bfd.h == --- head/contrib/binutils/bfd/elf-bfd.h Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/bfd/elf-bfd.h Mon Nov 22 14:42:13 2010 (r215679) @@ -1673,6 +1673,8 @@ extern char * elfcore_write_pstatus (bfd *, char *, int *, long, int, const void *); extern char *elfcore_write_prfpreg (bfd *, char *, int *, const void *, int); +extern char *elfcore_write_thrmisc + (bfd *, char *, int *, const char *, int); extern char *elfcore_write_prxfpreg (bfd *, char *, int *, const void *, int); extern char *elfcore_write_lwpstatus Modified: head/contrib/binutils/bfd/elf.c == --- head/contrib/binutils/bfd/elf.c Mon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/bfd/elf.c Mon Nov 22 14:42:13 2010 (r215679) @@ -6316,6 +6316,12 @@ _bfd_elf_rel_vtable_reloc_fn #ifdef HAVE_SYS_PROCFS_H # include + +/* Define HAVE_THRMISC_T for consistency with other similar GNU-type stubs. */ +#undef HAVE_THRMISC_T +#if defined (THRMISC_VERSION) +#defineHAVE_THRMISC_T 1 +#endif #endif /* FIXME: this is kinda wrong, but it's what gdb wants. */ @@ -6497,6 +6503,16 @@ elfcore_grok_prxfpreg (bfd *abfd, Elf_In return elfcore_make_note_pseudosection (abfd, ".reg-xfp", note); } +#if defined (HAVE_THRMISC_T) + +static bfd_boolean +elfcore_grok_thrmisc (bfd *abfd, Elf_Internal_Note *note) +{ + return elfcore_make_note_pseudosection (abfd, ".tname", note); +} + +#endif /* defined (HAVE_THRMISC_T) */ + #if defined (HAVE_PRPSINFO_T) typedef prpsinfo_t elfcore_psinfo_t; #if defined (HAVE_PRPSINFO32_T)/* Sparc64 cross Sparc32 */ @@ -6863,6 +6879,12 @@ elfcore_grok_note (bfd *abfd, Elf_Intern return TRUE; } + +#if defined (HAVE_THRMISC_T) +case NT_THRMISC: + return elfcore_grok_thrmisc (abfd, note); +#endif + } } @@ -7245,6 +7267,22 @@ elfcore_write_prfpreg (bfd *abfd, } char * +elfcore_write_thrmisc (bfd *abfd, + char *buf, + int *bufsiz, + const char *tname, + int size) +{ +#if defined (HAVE_THRMISC_T) + char *note_name = "CORE"; + return elfcore_write_note (abfd, buf, bufsiz, +note_name, NT_THRMISC, tname, size); +#else + return buf; +#endif +} + +char * elfcore_write_prxfpreg (bfd *abfd, char *buf, int *bufsiz, Modified: head/contrib/binutils/binutils/readelf.c == --- head/contrib/binutils/binutils/readelf.cMon Nov 22 14:36:04 2010 (r215678) +++ head/contrib/binutils/binutils/readelf.cMon Nov 22 14:42:13 2010 (r215679) @@ -9908,6 +9908,7 @@ get_note_type (unsigned e_type) case NT_PSTATUS: return _("NT_PSTATUS (pstatus structure)"); case NT_FPREGS:return _("NT_FPREGS (floating point registers)"); case NT_PSINFO:return _("NT_PSINFO (psinfo structure)"); +case NT_THRMISC: return _("NT_THRMISC (thrmisc structure)"); case NT_LWPSTATUS: return _("NT_LWPSTATUS (lwpstatus_t structure)"); case NT_LWPSINFO: return _("NT_LWPSINFO (lwpsinfo_t structure)"); case NT_WIN32PSTATUS: return _("NT_WIN32PSTATUS (win32_pstatus structure)"); Modified: head/contrib/binutils/include/elf/common.h ==
svn commit: r215680 - head/lib/libpam/modules/pam_unix
Author: des Date: Mon Nov 22 14:45:16 2010 New Revision: 215680 URL: http://svn.freebsd.org/changeset/base/215680 Log: Add for ctime(), which we accidentally picked up through . Submitted by: Garrett Cooper MFC after:3 days Modified: head/lib/libpam/modules/pam_unix/pam_unix.c Modified: head/lib/libpam/modules/pam_unix/pam_unix.c == --- head/lib/libpam/modules/pam_unix/pam_unix.c Mon Nov 22 14:42:13 2010 (r215679) +++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon Nov 22 14:45:16 2010 (r215680) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215544 - head/sys/kern
On Friday, November 19, 2010 5:32:00 pm Attilio Rao wrote: > 2010/11/19 John Baldwin : > > On Friday, November 19, 2010 4:27:27 pm Attilio Rao wrote: > >> 2010/11/19 John Baldwin : > >> > On Friday, November 19, 2010 2:43:57 pm Attilio Rao wrote: > >> >> Author: attilio > >> >> Date: Fri Nov 19 19:43:56 2010 > >> >> New Revision: 215544 > >> >> URL: http://svn.freebsd.org/changeset/base/215544 > >> >> > >> >> Log: > >> >> Scan the list in reverse order for the shutdown handlers of loaded > >> >> modules. > >> >> This way, when there is a dependency between two modules, the handler > >> >> of the > >> >> latter probed runs first. > >> >> > >> >> This is a similar approach as the modules are unloaded in the same > >> >> linkerfile. > >> >> > >> >> Sponsored by: Sandvine Incorporated > >> >> Submitted by: Nima Misaghian > >> >> MFC after: 1 week > >> >> > >> >> Modified: > >> >> head/sys/kern/kern_module.c > >> >> > >> >> Modified: head/sys/kern/kern_module.c > >> >> == > >> >> --- head/sys/kern/kern_module.c Fri Nov 19 18:59:35 2010 > >> >> (r215543) > >> >> +++ head/sys/kern/kern_module.c Fri Nov 19 19:43:56 2010 > >> >> (r215544) > >> >> @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); > >> >> > >> >> static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); > >> >> > >> >> -typedef TAILQ_HEAD(, module) modulelist_t; > >> >> +typedef TAILQ_HEAD(modulelst, module) modulelist_t; > >> > > >> > Is modulelist already taken? If not, we should probably just retire > >> > 'modulelist_t' and replace it with 'struct modulelist'. > >> > >> Note that I used modulelst, not modulelist. > >> Probabilly, if you think the name may be still confusing, we can > >> pickup one another further. > > > > Yes, I'd much prefer 'modulelist' with the extra 'i' as it is more readable. > > If you go that route, I think you can drop modulelist_t since style(9) > > discourages foo_t types unless they are required by a standard. > > I think that this patch should make it? Works for me, thanks. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215544 - head/sys/kern
On Friday, November 19, 2010 5:41:00 pm Attilio Rao wrote: > 2010/11/19 John Baldwin : > > On Friday, November 19, 2010 5:03:25 pm Jung-uk Kim wrote: > >> On Friday 19 November 2010 04:46 pm, John Baldwin wrote: > >> > On Friday, November 19, 2010 4:31:44 pm Attilio Rao wrote: > >> > > 2010/11/19 John Baldwin : > >> > > > On Friday, November 19, 2010 4:09:28 pm Jung-uk Kim wrote: > >> > > >> On Friday 19 November 2010 02:43 pm, Attilio Rao wrote: > >> > > >> > Author: attilio > >> > > >> > Date: Fri Nov 19 19:43:56 2010 > >> > > >> > New Revision: 215544 > >> > > >> > URL: http://svn.freebsd.org/changeset/base/215544 > >> > > >> > > >> > > >> > Log: > >> > > >> > Scan the list in reverse order for the shutdown handlers > >> > > >> > of loaded modules. This way, when there is a dependency > >> > > >> > between two modules, the handler of the latter probed runs > >> > > >> > first. > >> > > >> > > >> > > >> > This is a similar approach as the modules are unloaded in > >> > > >> > the same linkerfile. > >> > > >> > > >> > > >> > Sponsored by: Sandvine Incorporated > >> > > >> > Submitted by: Nima Misaghian >> > > >> > dot com> MFC after:1 week > >> > > >> > >> > > >> Hmm... It is not directly related but I was thinking about > >> > > >> doing similar things for sys/kern/subr_bus.c. What do you > >> > > >> think about the attached patch? > >> > > > > >> > > > Hmm, the patches for suspend and resume that I had for this > >> > > > took the opposite order, they did suspend in forward order, but > >> > > > resume in backwards order. Like so: > >> > > > > >> > > > --- //depot/vendor/freebsd/src/sys/kern/subr_bus.c > >> > > > 2010-11-17 22:30:24.0 +++ > >> > > > //depot/user/jhb/acpipci/kern/subr_bus.c2010-11-19 > >> > > > 17:19:02.0 00 @@ -3426,9 +3429,9 @@ > >> > > >TAILQ_FOREACH(child, &dev->children, link) { > >> > > >error = DEVICE_SUSPEND(child); > >> > > >if (error) { > >> > > > - for (child2 = > >> > > > TAILQ_FIRST(&dev->children); - > >> > > > child2 && child2 != child; -child2 > >> > > > = TAILQ_NEXT(child2, link)) + for (child2 > >> > > > = TAILQ_PREV(child, device_list, link); + > >> > > > child2 != NULL; > >> > > > +child2 = TAILQ_PREV(child2, > >> > > > device_list, link)) DEVICE_RESUME(child2); > >> > > >return (error); > >> > > >} > >> > > > @@ -3447,7 +3450,7 @@ > >> > > > { > >> > > >device_tchild; > >> > > > > >> > > > - TAILQ_FOREACH(child, &dev->children, link) { > >> > > > + TAILQ_FOREACH_REVERSE(child, &dev->children, > >> > > > device_list, link) { DEVICE_RESUME(child); > >> > > >/* if resume fails, there's nothing we can > >> > > > usefully do... */ } > >> > > > > >> > > > (Likely mangled whitespace.) > >> > > > > >> > > > I couldn't convince myself which order was "more" correct for > >> > > > suspend and resume. > >> > > > >> > > Considering loading in starting point, I think suspend should go > >> > > in reverse logic and resume in the same module load logic. > >> > > So that dependent modules are suspended first and resumed after. > >> > > Don't you agree? > >> > > >> > These are devices, and the ordering here is the order of sibling > >> > devices on a given bus. That is, if you have a PCI bus with two em > >> > interfaces, does it really matter if em0 suspends before em1 vs > >> > after em1? I think it actually doesn't matter. The passes from > >> > the multipass boot probe might make some sense to order on. > >> > However, I don't think the order of siblings on a bus is meaningful > >> > for suspend and resume (which is why I've never committed the above > >> > patches). > >> > > >> > Specifically, there is no dependency relationship between siblings > >> > on a bus. Certain buses may in fact have a dependency order of > >> > sorts (vgapci0 comes to mind), but those buses should manage that. > >> > There is no generic dependency between siblings that should be > >> > encoded into subr_bus.c > >> > >> Generally siblings don't interact with each other directly, no. > >> However, some modern chipsets *do* have strong relationship. For > >> example, some chipsets reference SMB controller to get current > >> configuration, e.g., function A depends on function B on the same > >> chip. > > > > That may be true, but that is not generic to all buses and devices. > > That isn't even really generic to PCI. If there are specific instances > > where there are dependencies, the drivers for that hardware should > > manage that. If specific buses have specific orders, then they can > > manage that order explicitly in their own suspend and resume routines. > > However, I don't see a valid reason for enforcing a particular order > > among siblings for all devices. We certainly do enforce some orders > > with respect t
svn commit: r215681 - in head/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/x86emu dev/xen/xenpci
Author: jhb Date: Mon Nov 22 15:15:11 2010 New Revision: 215681 URL: http://svn.freebsd.org/changeset/base/215681 Log: Remove some bogus, self-referential mergeinfo. Modified: Directory Properties: head/sys/ (props changed) head/sys/amd64/include/xen/ (props changed) head/sys/cddl/contrib/opensolaris/ (props changed) head/sys/contrib/x86emu/ (props changed) head/sys/dev/xen/xenpci/ (props changed) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215682 - head/sys/dev/xen/xenpci
Author: jhb Date: Mon Nov 22 15:26:47 2010 New Revision: 215682 URL: http://svn.freebsd.org/changeset/base/215682 Log: Purge mergeinfo on sys/dev/xen/xenpci. The only unique mergeinfo compared to head was not useful (it came in with the merge from /user/dfr/xenhvm/7 and that mergeinfo is still present at sys/) and not worth keeping an extra set of mergeinfo around in the kernel. Modified: Directory Properties: head/sys/dev/xen/xenpci/ (props changed) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215683 - head/sys/kern
Author: attilio Date: Mon Nov 22 15:28:54 2010 New Revision: 215683 URL: http://svn.freebsd.org/changeset/base/215683 Log: Style fix. Sponsored by: Sandvine Incorporated Requested by: jhb Reviewed by: jhb MFC after:1 week X-MFC:215544 Modified: head/sys/kern/kern_module.c Modified: head/sys/kern/kern_module.c == --- head/sys/kern/kern_module.c Mon Nov 22 15:26:47 2010(r215682) +++ head/sys/kern/kern_module.c Mon Nov 22 15:28:54 2010(r215683) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_MODULE, "module", "module data structures"); -typedef TAILQ_HEAD(modulelst, module) modulelist_t; struct module { TAILQ_ENTRY(module) link; /* chain together all modules */ TAILQ_ENTRY(module) flink; /* all modules in a file */ @@ -61,7 +60,7 @@ struct module { #define MOD_EVENT(mod, type) (mod)->handler((mod), (type), (mod)->arg) -static modulelist_t modules; +static TAILQ_HEAD(modulelist, module) modules; struct sx modules_sx; static int nextid = 1; static void module_shutdown(void *, int); @@ -101,7 +100,7 @@ module_shutdown(void *arg1, int arg2) return; mtx_lock(&Giant); MOD_SLOCK; - TAILQ_FOREACH_REVERSE(mod, &modules, modulelst, link) + TAILQ_FOREACH_REVERSE(mod, &modules, modulelist, link) MOD_EVENT(mod, MOD_SHUTDOWN); MOD_SUNLOCK; mtx_unlock(&Giant); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215675 - head/sys/compat/linux
On Monday, November 22, 2010 7:51:06 am Kostik Belousov wrote: > On Mon, Nov 22, 2010 at 12:42:32PM +, Alexander Leidinger wrote: > > Author: netchild > > Date: Mon Nov 22 12:42:32 2010 > > New Revision: 215675 > > URL: http://svn.freebsd.org/changeset/base/215675 > > > > Log: > > Do not take the process lock. The assignment to u_short inside the > > properly aligned structure is atomic on all supported architectures, and > > the thread that should see side-effect of assignment is the same thread > > that does assignment. > > > > Use a more appropriate conditional to detect the linux ABI. > > > > Suggested by: kib > > X-MFC:together with r215664 > > > > Modified: > > head/sys/compat/linux/linux_emul.c > > > > Modified: head/sys/compat/linux/linux_emul.c > > == > > --- head/sys/compat/linux/linux_emul.c Mon Nov 22 12:33:48 2010 > > (r215674) > > +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 12:42:32 2010 > > (r215675) > > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru > > if (__predict_false(imgp->sysent == &elf_linux_sysvec > > && p->p_sysent != &elf_linux_sysvec)) > > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > > - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == > > + SV_ABI_LINUX)) > > /* Kill threads regardless of imgp->sysent value */ > > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > > if (__predict_false(imgp->sysent != &elf_linux_sysvec > There are several similar comparisons around the patched one. > > I am still quite curious for the reason of all __predict() obfuscations > that are countless in the linuxolator. We are not oblidged to emulate > this aspect of Linux. I think we should only have __predict() obfuscation if there is a benchmark showing an indisputable performance gain. Otherwise it is just cruft making the code hard to read. I suspect that a Linux app calling execve() is not a sufficient critical path to warrant any of these. -- John Baldwin ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215686 - head/sys/dev/mxge
Author: gallatin Date: Mon Nov 22 16:43:05 2010 New Revision: 215686 URL: http://svn.freebsd.org/changeset/base/215686 Log: Fix a TSO checksum bug on mxge(4): The Myri10GE NIC will assume all TSO frames contain partial checksum, and will emit TSO segments with bad TCP checksums if a TSO frame contains a full checksum. The mxge driver takes care to make sure that TSO is disabled when checksum offload is disabled for this reason. However, modules that modify packet contents (like pf) may end up completing a checksum on a TSO frame, leading to the NIC emitting TSO segments with bad checksums. To workaround this, restore the partial checksum in the mxge driver when we're fed a TSO frame with a full checksum. Reported by: Bob Healey MFC after:3 days Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c == --- head/sys/dev/mxge/if_mxge.c Mon Nov 22 16:10:54 2010(r215685) +++ head/sys/dev/mxge/if_mxge.c Mon Nov 22 16:43:05 2010(r215686) @@ -1855,9 +1855,20 @@ mxge_encap_tso(struct mxge_slice_state * tcp = (struct tcphdr *)((char *)ip + (ip->ip_hl << 2)); cum_len = -(ip_off + ((ip->ip_hl + tcp->th_off) << 2)); + cksum_offset = ip_off + (ip->ip_hl << 2); /* TSO implies checksum offload on this hardware */ - cksum_offset = ip_off + (ip->ip_hl << 2); + if (__predict_false((m->m_pkthdr.csum_flags & (CSUM_TCP)) == 0)) { + /* +* If packet has full TCP csum, replace it with pseudo hdr +* sum that the NIC expects, otherwise the NIC will emit +* packets with bad TCP checksums. +*/ + m->m_pkthdr.csum_flags = CSUM_TCP; + m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); + tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(IPPROTO_TCP + (m->m_pkthdr.len - cksum_offset))); + } flags = MXGEFW_FLAGS_TSO_HDR | MXGEFW_FLAGS_FIRST; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215687 - head/sys/geom
Author: jh Date: Mon Nov 22 16:47:53 2010 New Revision: 215687 URL: http://svn.freebsd.org/changeset/base/215687 Log: Use g_eventlock to protect against losing wakeups in the g_event process and replace tsleep(9) with msleep(9) which doesn't use a timeout. The previously used timeout caused the event process to wake up ten times per second on an idle system. one_event() is now called with the topology lock held and it returns with both the topology and event locks held when there are no more events in the queue. Reported by: mav, Marius Nünnerich Reviewed by: freebsd-geom Modified: head/sys/geom/geom_event.c head/sys/geom/geom_kern.c Modified: head/sys/geom/geom_event.c == --- head/sys/geom/geom_event.c Mon Nov 22 16:43:05 2010(r215686) +++ head/sys/geom/geom_event.c Mon Nov 22 16:47:53 2010(r215687) @@ -183,33 +183,27 @@ one_event(void) struct g_event *ep; struct g_provider *pp; - g_topology_lock(); - for (;;) { - mtx_lock(&g_eventlock); - TAILQ_FOREACH(pp, &g_doorstep, orphan) { - if (pp->nstart == pp->nend) - break; - } - if (pp != NULL) { - G_VALID_PROVIDER(pp); - TAILQ_REMOVE(&g_doorstep, pp, orphan); - } - mtx_unlock(&g_eventlock); - if (pp == NULL) + g_topology_assert(); + mtx_lock(&g_eventlock); + TAILQ_FOREACH(pp, &g_doorstep, orphan) { + if (pp->nstart == pp->nend) break; + } + if (pp != NULL) { + G_VALID_PROVIDER(pp); + TAILQ_REMOVE(&g_doorstep, pp, orphan); + mtx_unlock(&g_eventlock); g_orphan_register(pp); + return (1); } - mtx_lock(&g_eventlock); + ep = TAILQ_FIRST(&g_events); if (ep == NULL) { wakeup(&g_pending_events); - mtx_unlock(&g_eventlock); - g_topology_unlock(); return (0); } if (ep->flag & EV_INPROGRESS) { mtx_unlock(&g_eventlock); - g_topology_unlock(); return (1); } ep->flag |= EV_INPROGRESS; @@ -228,7 +222,6 @@ one_event(void) mtx_unlock(&g_eventlock); g_free(ep); } - g_topology_unlock(); return (1); } @@ -237,16 +230,27 @@ g_run_events() { int i; - while (one_event()) - ; - g_topology_lock(); - i = g_wither_work; - while (i) { - i = g_wither_washer(); - g_wither_work = i & 1; - i &= 2; + for (;;) { + g_topology_lock(); + while (one_event()) + ; + mtx_assert(&g_eventlock, MA_OWNED); + i = g_wither_work; + if (i) { + mtx_unlock(&g_eventlock); + while (i) { + i = g_wither_washer(); + g_wither_work = i & 1; + i &= 2; + } + g_topology_unlock(); + } else { + g_topology_unlock(); + msleep(&g_wait_event, &g_eventlock, PRIBIO | PDROP, + "-", 0); + } } - g_topology_unlock(); + /* NOTREACHED */ } void @@ -338,9 +342,12 @@ g_post_event(g_event_t *func, void *arg, } void -g_do_wither() { +g_do_wither() +{ + mtx_lock(&g_eventlock); g_wither_work = 1; + mtx_unlock(&g_eventlock); wakeup(&g_wait_event); } Modified: head/sys/geom/geom_kern.c == --- head/sys/geom/geom_kern.c Mon Nov 22 16:43:05 2010(r215686) +++ head/sys/geom/geom_kern.c Mon Nov 22 16:47:53 2010(r215687) @@ -137,10 +137,8 @@ g_event_procbody(void) thread_lock(tp); sched_prio(tp, PRIBIO); thread_unlock(tp); - for(;;) { - g_run_events(); - tsleep(&g_wait_event, PRIBIO, "-", hz/10); - } + g_run_events(); + /* NOTREACHED */ } static struct kproc_desc g_event_kp = { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215679 - in head: contrib/binutils/bfd contrib/binutils/binutils contrib/binutils/include/elf contrib/file contrib/gdb/gdb gnu/usr.bin/gdb/libgdb sys/compat/freebsd32 sys/kern sys/sys
On Mon, Nov 22, 2010 at 02:42:13PM +, Attilio Rao wrote: > Author: attilio > Date: Mon Nov 22 14:42:13 2010 > New Revision: 215679 > URL: http://svn.freebsd.org/changeset/base/215679 > > Log: > Add the ability for GDB to printout the thread name along with other > thread specific informations. This change is particularly useful if one has a heavily threaded app that uses pthread_set_name_np() to set its thread names. This is an example of the output you get with stock GDB: (gdb) info threads 12 Thread 2a4041c0 (LWP 100184) 0x29e91fe3 in memset () 11 Thread 2a404700 (LWP 100190) 0x29e2be33 in poll () 10 Thread 2a404c40 (LWP 100191) 0x29ed85e7 in _umtx_op_err () And with this change: (gdb) info threads 41 Thread 0x9d8 (LWP 100259/initial thread) 0x6a3f23ff in nanosleep () 40 Thread 0x9f48600 (LWP 100315/EventLoop) 0x6a38e427 in _umtx_op () 39 Thread 0x9f48800 (LWP 100321/ntfy) 0x6a38e427 in _umtx_op () -Ed ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215697 - in head/crypto/openssl: . apps crypto crypto/aes crypto/aes/asm crypto/asn1 crypto/bio crypto/bn crypto/cms crypto/conf crypto/des crypto/dsa crypto/ec crypto/ecdh crypto/ecds...
Author: simon Date: Mon Nov 22 18:23:44 2010 New Revision: 215697 URL: http://svn.freebsd.org/changeset/base/215697 Log: Merge OpenSSL 0.9.8p into head. Security: CVE-2010-3864 Security: http://www.openssl.org/news/secadv_20101116.txt Modified: head/crypto/openssl/CHANGES head/crypto/openssl/Configure head/crypto/openssl/FAQ head/crypto/openssl/Makefile head/crypto/openssl/NEWS head/crypto/openssl/PROBLEMS head/crypto/openssl/README head/crypto/openssl/apps/apps.c head/crypto/openssl/apps/dh.c head/crypto/openssl/apps/dhparam.c head/crypto/openssl/apps/dsaparam.c head/crypto/openssl/apps/ec.c head/crypto/openssl/apps/ecparam.c head/crypto/openssl/apps/enc.c head/crypto/openssl/apps/gendh.c head/crypto/openssl/apps/gendsa.c head/crypto/openssl/apps/genrsa.c head/crypto/openssl/apps/pkcs7.c head/crypto/openssl/apps/rand.c head/crypto/openssl/apps/s_server.c head/crypto/openssl/apps/s_socket.c head/crypto/openssl/apps/speed.c head/crypto/openssl/apps/x509.c head/crypto/openssl/crypto/aes/aes_wrap.c head/crypto/openssl/crypto/aes/asm/aes-x86_64.pl head/crypto/openssl/crypto/asn1/a_int.c head/crypto/openssl/crypto/asn1/n_pkey.c head/crypto/openssl/crypto/asn1/t_crl.c head/crypto/openssl/crypto/asn1/tasn_dec.c head/crypto/openssl/crypto/asn1/x_x509.c head/crypto/openssl/crypto/bio/b_sock.c head/crypto/openssl/crypto/bio/bf_nbio.c head/crypto/openssl/crypto/bio/bio_lib.c head/crypto/openssl/crypto/bio/bss_acpt.c head/crypto/openssl/crypto/bio/bss_sock.c head/crypto/openssl/crypto/bn/bn_exp2.c head/crypto/openssl/crypto/bn/bn_mul.c head/crypto/openssl/crypto/cms/cms_asn1.c head/crypto/openssl/crypto/conf/conf_def.c head/crypto/openssl/crypto/des/rpc_des.h head/crypto/openssl/crypto/dsa/dsa_gen.c head/crypto/openssl/crypto/dsa/dsa_ossl.c head/crypto/openssl/crypto/ec/ec2_mult.c head/crypto/openssl/crypto/ec/ec_mult.c head/crypto/openssl/crypto/ecdh/ech_lib.c head/crypto/openssl/crypto/ecdsa/ecs_lib.c head/crypto/openssl/crypto/engine/eng_list.c head/crypto/openssl/crypto/err/err_prn.c head/crypto/openssl/crypto/evp/bio_b64.c head/crypto/openssl/crypto/evp/enc_min.c head/crypto/openssl/crypto/evp/encode.c head/crypto/openssl/crypto/evp/evp_pbe.c head/crypto/openssl/crypto/hmac/hmac.c head/crypto/openssl/crypto/md32_common.h head/crypto/openssl/crypto/o_init.c head/crypto/openssl/crypto/ocsp/ocsp_ht.c head/crypto/openssl/crypto/ocsp/ocsp_prn.c head/crypto/openssl/crypto/opensslv.h head/crypto/openssl/crypto/pem/pem_lib.c head/crypto/openssl/crypto/pkcs12/p12_key.c head/crypto/openssl/crypto/pkcs12/p12_npas.c head/crypto/openssl/crypto/pkcs7/pk7_doit.c head/crypto/openssl/crypto/pkcs7/pk7_lib.c head/crypto/openssl/crypto/pkcs7/pk7_mime.c head/crypto/openssl/crypto/pqueue/pqueue.c head/crypto/openssl/crypto/rand/rand_nw.c head/crypto/openssl/crypto/rand/randfile.c head/crypto/openssl/crypto/rsa/rsa_eay.c head/crypto/openssl/crypto/x509/x509.h head/crypto/openssl/crypto/x509/x509_vfy.c head/crypto/openssl/crypto/x509/x_all.c head/crypto/openssl/crypto/x509v3/v3_ncons.c head/crypto/openssl/crypto/x509v3/v3_pci.c head/crypto/openssl/doc/apps/smime.pod head/crypto/openssl/doc/crypto/ASN1_OBJECT_new.pod head/crypto/openssl/doc/crypto/ASN1_STRING_length.pod head/crypto/openssl/doc/crypto/ASN1_STRING_new.pod head/crypto/openssl/doc/crypto/ASN1_generate_nconf.pod head/crypto/openssl/doc/crypto/BIO_f_buffer.pod head/crypto/openssl/doc/crypto/BIO_should_retry.pod head/crypto/openssl/doc/crypto/CRYPTO_set_ex_data.pod head/crypto/openssl/doc/crypto/OBJ_nid2obj.pod head/crypto/openssl/doc/crypto/PKCS7_decrypt.pod head/crypto/openssl/doc/crypto/PKCS7_encrypt.pod head/crypto/openssl/doc/crypto/PKCS7_sign.pod head/crypto/openssl/doc/crypto/PKCS7_verify.pod head/crypto/openssl/doc/crypto/SMIME_read_PKCS7.pod head/crypto/openssl/doc/crypto/SMIME_write_PKCS7.pod head/crypto/openssl/doc/crypto/X509_NAME_ENTRY_get_object.pod head/crypto/openssl/doc/crypto/X509_NAME_add_entry_by_txt.pod head/crypto/openssl/doc/crypto/X509_NAME_get_index_by_NID.pod head/crypto/openssl/doc/crypto/X509_new.pod head/crypto/openssl/doc/crypto/bn_internal.pod head/crypto/openssl/doc/crypto/ui_compat.pod head/crypto/openssl/doc/ssl/SSL_library_init.pod head/crypto/openssl/e_os.h head/crypto/openssl/engines/e_chil.c head/crypto/openssl/engines/e_cswift.c head/crypto/openssl/engines/e_ubsec.c head/crypto/openssl/fips/mkfipsscr.pl head/crypto/openssl/openssl.spec head/crypto/openssl/ssl/d1_both.c head/crypto/openssl/ssl/d1_clnt.c head/crypto/openssl/ssl/d1_enc.c head/crypto/openssl/ssl/d1_lib.c head/crypto/openssl/ssl/d1_pkt.c head/crypto/openssl/ssl/dtls1.h head/crypto/openssl/ssl/s23_clnt.c head/crypto/openssl/ssl/s23_lib.c head/crypto/openssl/ssl/s2_srvr.c head/crypto/openssl/ssl/s3_both.c head/crypto/openssl/ssl/s3_clnt.c
svn commit: r215698 - in head/secure: lib/libcrypto lib/libcrypto/man lib/libssl/man usr.bin/openssl/man
Author: simon Date: Mon Nov 22 18:29:00 2010 New Revision: 215698 URL: http://svn.freebsd.org/changeset/base/215698 Log: Regenerate manual pages for OpenSSL 0.9.8p. Modified: head/secure/lib/libcrypto/Makefile.inc head/secure/lib/libcrypto/man/ASN1_OBJECT_new.3 head/secure/lib/libcrypto/man/ASN1_STRING_length.3 head/secure/lib/libcrypto/man/ASN1_STRING_new.3 head/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3 head/secure/lib/libcrypto/man/ASN1_generate_nconf.3 head/secure/lib/libcrypto/man/BIO_ctrl.3 head/secure/lib/libcrypto/man/BIO_f_base64.3 head/secure/lib/libcrypto/man/BIO_f_buffer.3 head/secure/lib/libcrypto/man/BIO_f_cipher.3 head/secure/lib/libcrypto/man/BIO_f_md.3 head/secure/lib/libcrypto/man/BIO_f_null.3 head/secure/lib/libcrypto/man/BIO_f_ssl.3 head/secure/lib/libcrypto/man/BIO_find_type.3 head/secure/lib/libcrypto/man/BIO_new.3 head/secure/lib/libcrypto/man/BIO_push.3 head/secure/lib/libcrypto/man/BIO_read.3 head/secure/lib/libcrypto/man/BIO_s_accept.3 head/secure/lib/libcrypto/man/BIO_s_bio.3 head/secure/lib/libcrypto/man/BIO_s_connect.3 head/secure/lib/libcrypto/man/BIO_s_fd.3 head/secure/lib/libcrypto/man/BIO_s_file.3 head/secure/lib/libcrypto/man/BIO_s_mem.3 head/secure/lib/libcrypto/man/BIO_s_null.3 head/secure/lib/libcrypto/man/BIO_s_socket.3 head/secure/lib/libcrypto/man/BIO_set_callback.3 head/secure/lib/libcrypto/man/BIO_should_retry.3 head/secure/lib/libcrypto/man/BN_BLINDING_new.3 head/secure/lib/libcrypto/man/BN_CTX_new.3 head/secure/lib/libcrypto/man/BN_CTX_start.3 head/secure/lib/libcrypto/man/BN_add.3 head/secure/lib/libcrypto/man/BN_add_word.3 head/secure/lib/libcrypto/man/BN_bn2bin.3 head/secure/lib/libcrypto/man/BN_cmp.3 head/secure/lib/libcrypto/man/BN_copy.3 head/secure/lib/libcrypto/man/BN_generate_prime.3 head/secure/lib/libcrypto/man/BN_mod_inverse.3 head/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3 head/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3 head/secure/lib/libcrypto/man/BN_new.3 head/secure/lib/libcrypto/man/BN_num_bytes.3 head/secure/lib/libcrypto/man/BN_rand.3 head/secure/lib/libcrypto/man/BN_set_bit.3 head/secure/lib/libcrypto/man/BN_swap.3 head/secure/lib/libcrypto/man/BN_zero.3 head/secure/lib/libcrypto/man/CONF_modules_free.3 head/secure/lib/libcrypto/man/CONF_modules_load_file.3 head/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3 head/secure/lib/libcrypto/man/DH_generate_key.3 head/secure/lib/libcrypto/man/DH_generate_parameters.3 head/secure/lib/libcrypto/man/DH_get_ex_new_index.3 head/secure/lib/libcrypto/man/DH_new.3 head/secure/lib/libcrypto/man/DH_set_method.3 head/secure/lib/libcrypto/man/DH_size.3 head/secure/lib/libcrypto/man/DSA_SIG_new.3 head/secure/lib/libcrypto/man/DSA_do_sign.3 head/secure/lib/libcrypto/man/DSA_dup_DH.3 head/secure/lib/libcrypto/man/DSA_generate_key.3 head/secure/lib/libcrypto/man/DSA_generate_parameters.3 head/secure/lib/libcrypto/man/DSA_get_ex_new_index.3 head/secure/lib/libcrypto/man/DSA_new.3 head/secure/lib/libcrypto/man/DSA_set_method.3 head/secure/lib/libcrypto/man/DSA_sign.3 head/secure/lib/libcrypto/man/DSA_size.3 head/secure/lib/libcrypto/man/ERR_GET_LIB.3 head/secure/lib/libcrypto/man/ERR_clear_error.3 head/secure/lib/libcrypto/man/ERR_error_string.3 head/secure/lib/libcrypto/man/ERR_get_error.3 head/secure/lib/libcrypto/man/ERR_load_crypto_strings.3 head/secure/lib/libcrypto/man/ERR_load_strings.3 head/secure/lib/libcrypto/man/ERR_print_errors.3 head/secure/lib/libcrypto/man/ERR_put_error.3 head/secure/lib/libcrypto/man/ERR_remove_state.3 head/secure/lib/libcrypto/man/ERR_set_mark.3 head/secure/lib/libcrypto/man/EVP_BytesToKey.3 head/secure/lib/libcrypto/man/EVP_DigestInit.3 head/secure/lib/libcrypto/man/EVP_EncryptInit.3 head/secure/lib/libcrypto/man/EVP_OpenInit.3 head/secure/lib/libcrypto/man/EVP_PKEY_new.3 head/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3 head/secure/lib/libcrypto/man/EVP_SealInit.3 head/secure/lib/libcrypto/man/EVP_SignInit.3 head/secure/lib/libcrypto/man/EVP_VerifyInit.3 head/secure/lib/libcrypto/man/OBJ_nid2obj.3 head/secure/lib/libcrypto/man/OPENSSL_Applink.3 head/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3 head/secure/lib/libcrypto/man/OPENSSL_config.3 head/secure/lib/libcrypto/man/OPENSSL_ia32cap.3 head/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3 head/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3 head/secure/lib/libcrypto/man/PKCS12_create.3 head/secure/lib/libcrypto/man/PKCS12_parse.3 head/secure/lib/libcrypto/man/PKCS7_decrypt.3 head/secure/lib/libcrypto/man/PKCS7_encrypt.3 head/secure/lib/libcrypto/man/PKCS7_sign.3 head/secure/lib/libcrypto/man/PKCS7_verify.3 head/secure/lib/libcrypto/man/RAND_add.3 head/secure/lib/libcrypto/man/RAND_bytes.3 head/secure/lib/libcrypto/man/RAND_cleanup.3 head/secure/lib/libcrypto/man/RAND_egd.3 head/secure/lib/libcryp
svn commit: r215699 - head/sys/net80211
Author: bschmidt Date: Mon Nov 22 19:01:47 2010 New Revision: 215699 URL: http://svn.freebsd.org/changeset/base/215699 Log: The meshid element is memcpy()'ed into se_meshid if included in either beacon or probe-response frames. Fix the condition by checking for the the array's content instead of the always existing array itself. Reviewed by: rpaulo, stefanf MFC after:3 days Modified: head/sys/net80211/ieee80211_scan_sta.c Modified: head/sys/net80211/ieee80211_scan_sta.c == --- head/sys/net80211/ieee80211_scan_sta.c Mon Nov 22 18:29:00 2010 (r215698) +++ head/sys/net80211/ieee80211_scan_sta.c Mon Nov 22 19:01:47 2010 (r215699) @@ -1013,7 +1013,7 @@ match_bss(struct ieee80211vap *vap, */ if (se->se_capinfo & (IEEE80211_CAPINFO_IBSS|IEEE80211_CAPINFO_ESS)) fail |= MATCH_CAPINFO; - else if (&se->se_meshid == NULL) + else if (se->se_meshid[0] != IEEE80211_ELEMID_MESHID) fail |= MATCH_MESH_NOID; else if (ms->ms_idlen != 0 && match_id(se->se_meshid, ms->ms_id, ms->ms_idlen)) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215675 - head/sys/compat/linux
Den 22/11/2010 kl. 13.42 skrev Alexander Leidinger: > Author: netchild > Date: Mon Nov 22 12:42:32 2010 > New Revision: 215675 > URL: http://svn.freebsd.org/changeset/base/215675 > > Log: > Do not take the process lock. The assignment to u_short inside the > properly aligned structure is atomic on all supported architectures, and > the thread that should see side-effect of assignment is the same thread > that does assignment. > > Use a more appropriate conditional to detect the linux ABI. > > Suggested by:kib > X-MFC: together with r215664 > > Modified: > head/sys/compat/linux/linux_emul.c > > Modified: head/sys/compat/linux/linux_emul.c > == > --- head/sys/compat/linux/linux_emul.cMon Nov 22 12:33:48 2010 > (r215674) > +++ head/sys/compat/linux/linux_emul.cMon Nov 22 12:42:32 2010 > (r215675) > @@ -198,11 +198,8 @@ linux_proc_exit(void *arg __unused, stru > } else > EMUL_SHARED_WUNLOCK(&emul_shared_lock); > > - if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) { > - PROC_LOCK(p); > + if ((shared_flags & EMUL_SHARED_HASXSTAT) != 0) > p->p_xstat = shared_xstat; > - PROC_UNLOCK(p); > - } > > if (child_clear_tid != NULL) { > struct linux_sys_futex_args cup; > @@ -265,7 +262,8 @@ linux_proc_exec(void *arg __unused, stru > if (__predict_false(imgp->sysent == &elf_linux_sysvec > && p->p_sysent != &elf_linux_sysvec)) > linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid, 0); > - if (__predict_false(p->p_sysent == &elf_linux_sysvec)) > + if (__predict_false((p->p_sysent->sv_flags & SV_ABI_MASK) == > + SV_ABI_LINUX)) > /* Kill threads regardless of imgp->sysent value */ > linux_kill_threads(FIRST_THREAD_IN_PROC(p), SIGKILL); > if (__predict_false(imgp->sysent != &elf_linux_sysvec This breaks make buildkernel for me (8.1 RELEASE host): /usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux_emul.c: In function 'linux_proc_exec': /usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux_emul.c:265: error: dereferencing pointer to incomplete type /usr/home/erik/freebsd/head/src/sys/modules/linux/../../compat/linux/linux_emul.c:265: error: 'SV_ABI_MASK' undeclared (first use in this function) Erik
svn commit: r215701 - in head/sys: kern mips/mips mips/rmi net netgraph netinet netinet/ipfw netinet6 netipsec powerpc/aim powerpc/booke sys
Author: dim Date: Mon Nov 22 19:32:54 2010 New Revision: 215701 URL: http://svn.freebsd.org/changeset/base/215701 Log: After some off-list discussion, revert a number of changes to the DPCPU_DEFINE and VNET_DEFINE macros, as these cause problems for various people working on the affected files. A better long-term solution is still being considered. This reversal may give some modules empty set_pcpu or set_vnet sections, but these are harmless. Changes reverted: r215318 | dim | 2010-11-14 21:40:55 +0100 (Sun, 14 Nov 2010) | 4 lines Instead of unconditionally emitting .globl's for the __start_set_xxx and __stop_set_xxx symbols, only emit them when the set_vnet or set_pcpu sections are actually defined. r215317 | dim | 2010-11-14 21:38:11 +0100 (Sun, 14 Nov 2010) | 3 lines Apply the STATIC_VNET_DEFINE and STATIC_DPCPU_DEFINE macros throughout the tree. r215316 | dim | 2010-11-14 21:23:02 +0100 (Sun, 14 Nov 2010) | 2 lines Add macros to define static instances of VNET_DEFINE and DPCPU_DEFINE. Modified: head/sys/kern/kern_clock.c head/sys/kern/kern_clocksource.c head/sys/kern/sched_4bsd.c head/sys/kern/subr_pcpu.c head/sys/mips/mips/tick.c head/sys/mips/rmi/tick.c head/sys/net/flowtable.c head/sys/net/if.c head/sys/net/if_clone.c head/sys/net/if_ethersubr.c head/sys/net/if_gif.c head/sys/net/if_llatbl.c head/sys/net/if_loop.c head/sys/net/route.c head/sys/net/vnet.c head/sys/net/vnet.h head/sys/netgraph/ng_base.c head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_iface.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_pcb.c head/sys/netinet/in_rmx.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_fastfwd.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_ipsec.c head/sys/netinet/ip_mroute.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_dynamic.c head/sys/netinet/ipfw/ip_fw_nat.c head/sys/netinet/ipfw/ip_fw_pfil.c head/sys/netinet/siftr.c head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timewait.c head/sys/netinet/udp_usrreq.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6_rmx.c head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_ipsec.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/scope6.c head/sys/netinet6/send.c head/sys/netipsec/key.c head/sys/netipsec/keysock.c head/sys/netipsec/xform_esp.c head/sys/powerpc/aim/clock.c head/sys/powerpc/booke/clock.c head/sys/sys/cdefs.h head/sys/sys/linker_set.h head/sys/sys/pcpu.h Modified: head/sys/kern/kern_clock.c == --- head/sys/kern/kern_clock.c Mon Nov 22 19:02:30 2010(r215700) +++ head/sys/kern/kern_clock.c Mon Nov 22 19:32:54 2010(r215701) @@ -373,7 +373,7 @@ int profprocs; intticks; intpsratio; -STATIC_DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */ +static DPCPU_DEFINE(int, pcputicks); /* Per-CPU version of ticks. */ static int global_hardclock_run = 0; /* Modified: head/sys/kern/kern_clocksource.c == --- head/sys/kern/kern_clocksource.cMon Nov 22 19:02:30 2010 (r215700) +++ head/sys/kern/kern_clocksource.cMon Nov 22 19:32:54 2010 (r215701) @@ -135,7 +135,7 @@ struct pcpu_state { int idle; /* This CPU is in idle mode. */ }; -STATIC_DPCPU_DEFINE(struct pcpu_state, timerstate); +static DPCPU_DEFINE(struct pcpu_state, timerstate); #define FREQ2BT(freq, bt) \ { \ Modified: head/sys/kern/sched_4bsd.c == --- head/sys/kern/sched_4bsd.c Mon Nov 22 19:02:30 2010(r215700) +++ head/sys/kern/sched_4bsd.c Mon Nov 22 19:32:54 2010(r215701) @@ -161,7 +161,7 @@ struct pcpuidlestat { u_int idlecalls; u_int oldidlecalls; }; -STATIC_DPCPU_DEFINE(struct pcpuidlestat, idlestat); +static DPCPU_DEFINE(struct pcpuidlestat, idlestat); static void setup_runqs(void) Modified: head/sys/kern/subr_pcpu.c == --- head/sys/kern/subr_pcpu.c Mon Nov 22 19:02:30 2010(r215700) +++ head/sys/kern/subr_pcpu.c Mon Nov 22 19:32
svn commit: r215702 - head/sbin/routed
Author: brucec Date: Mon Nov 22 19:40:27 2010 New Revision: 215702 URL: http://svn.freebsd.org/changeset/base/215702 Log: Fix use of AND operator: should be bitwise instead of logical. Modified: head/sbin/routed/parms.c Modified: head/sbin/routed/parms.c == --- head/sbin/routed/parms.cMon Nov 22 19:32:54 2010(r215701) +++ head/sbin/routed/parms.cMon Nov 22 19:40:27 2010(r215702) @@ -876,11 +876,11 @@ check_parms(struct parm *new) if ((0 != (new->parm_int_state & GROUP_IS_SOL_OUT) && 0 != (parmp->parm_int_state & GROUP_IS_SOL_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state) - && GROUP_IS_SOL_OUT)) + & GROUP_IS_SOL_OUT)) || (0 != (new->parm_int_state & GROUP_IS_ADV_OUT) && 0 != (parmp->parm_int_state & GROUP_IS_ADV_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state) -&& GROUP_IS_ADV_OUT)) +& GROUP_IS_ADV_OUT)) || (new->parm_rdisc_pref != 0 && parmp->parm_rdisc_pref != 0 && new->parm_rdisc_pref != parmp->parm_rdisc_pref) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215703 - in head/sys: amd64/amd64 i386/i386
Author: jkim Date: Mon Nov 22 19:52:44 2010 New Revision: 215703 URL: http://svn.freebsd.org/changeset/base/215703 Log: - Disable caches and flush caches/TLBs when we update PAT as we do for MTRR. Flushing TLBs is required to ensure cache coherency according to the AMD64 architecture manual. Flushing caches is only required when changing from a cacheable memory type (WB, WP, or WT) to an uncacheable type (WC, UC, or UC-). Since this function is only used once per processor during startup, there is no need to take any shortcuts. - Leave PAT indices 0-3 at the default of WB, WT, UC-, and UC. Program 5 as WP (from default WT) and 6 as WC (from default UC-). Leave 4 and 7 at the default of WB and UC. This is to avoid transition from a cacheable memory type to an uncacheable type to minimize possible cache incoherency. Since we perform flushing caches and TLBs now, this change may not be necessary any more but we do not want to take any chances. - Remove Apple hardware specific quirks. With the above changes, it seems this hack is no longer needed. - Improve pmap_cache_bits() with an array to map PAT memory type to index. This array is initialized early from pmap_init_pat(), so that we do not need to handle special cases in the function any more. Now this function is identical on both amd64 and i386. Reviewed by: jhb Tested by:RM (reuf_m at hotmail dot com) Ryszard Czekaj (rychoo at freeshell dot net) army.of.root (army dot of dot root at googlemail dot com) MFC after:3 days Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Mon Nov 22 19:40:27 2010(r215702) +++ head/sys/amd64/amd64/pmap.c Mon Nov 22 19:52:44 2010(r215703) @@ -180,14 +180,20 @@ static vm_paddr_t dmaplimit; vm_offset_t kernel_vm_end = VM_MIN_KERNEL_ADDRESS; pt_entry_t pg_nx; -static int pat_works = 0; /* Is page attribute table sane? */ - SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, "VM/pmap parameters"); +static int pat_works = 1; +TUNABLE_INT("vm.pmap.pat_works", &pat_works); +SYSCTL_INT(_vm_pmap, OID_AUTO, pat_works, CTLFLAG_RDTUN, &pat_works, 1, +"Is page attribute table fully functional?"); + static int pg_ps_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0, "Are large page mappings enabled?"); +#definePAT_INDEX_SIZE 8 +static int pat_index[PAT_INDEX_SIZE]; /* cache mode to PAT index conversion */ + static u_int64_t KPTphys;/* phys addr of kernel level 1 */ static u_int64_t KPDphys;/* phys addr of kernel level 2 */ u_int64_t KPDPphys; /* phys addr of kernel level 3 */ @@ -608,31 +614,24 @@ pmap_bootstrap(vm_paddr_t *firstaddr) void pmap_init_pat(void) { + int pat_table[PAT_INDEX_SIZE]; uint64_t pat_msr; - char *sysenv; - static int pat_tested = 0; + u_long cr0, cr4; + int i; /* Bail if this CPU doesn't implement PAT. */ - if (!(cpu_feature & CPUID_PAT)) + if ((cpu_feature & CPUID_PAT) == 0) panic("no PAT??"); - /* -* Some Apple Macs based on nVidia chipsets cannot enter ACPI mode -* via SMI# when we use upper 4 PAT entries for unknown reason. -*/ - if (!pat_tested) { - pat_works = 1; - sysenv = getenv("smbios.system.product"); - if (sysenv != NULL) { - if (strncmp(sysenv, "MacBook5,1", 10) == 0 || - strncmp(sysenv, "MacBookPro5,5", 13) == 0 || - strncmp(sysenv, "Macmini3,1", 10) == 0 || - strncmp(sysenv, "iMac9,1", 7) == 0) - pat_works = 0; - freeenv(sysenv); - } - pat_tested = 1; - } + /* Set default PAT index table. */ + for (i = 0; i < PAT_INDEX_SIZE; i++) + pat_table[i] = -1; + pat_table[PAT_WRITE_BACK] = 0; + pat_table[PAT_WRITE_THROUGH] = 1; + pat_table[PAT_UNCACHEABLE] = 3; + pat_table[PAT_WRITE_COMBINING] = 3; + pat_table[PAT_WRITE_PROTECTED] = 3; + pat_table[PAT_UNCACHED] = 3; /* Initialize default PAT entries. */ pat_msr = PAT_VALUE(0, PAT_WRITE_BACK) | @@ -647,20 +646,48 @@ pmap_init_pat(void) if (pat_works) { /* * Leave the indices 0-3 at the default of WB, WT, UC-, and UC. -* Program 4 and 5 as WP and WC. -* Leave 6 and 7 as UC- and UC. +* Program 5 and 6 as WP and WC. +* Leave 4 and 7 as WB and UC. */ - pat_msr &= ~(PAT_MASK(4) | PAT_MASK(5)); - pat_msr
svn commit: r215704 - in head: bin/sh sbin/bsdlabel sbin/geom/class/eli sbin/geom/class/part sbin/geom/class/virstor sbin/growfs sbin/gvinum sbin/hastctl sbin/mknod usr.bin/ar usr.bin/bc
Author: brucec Date: Mon Nov 22 20:10:48 2010 New Revision: 215704 URL: http://svn.freebsd.org/changeset/base/215704 Log: Fix some more warnings found by clang. Modified: head/bin/sh/arith_lex.l head/sbin/bsdlabel/bsdlabel.c head/sbin/geom/class/eli/geom_eli.c head/sbin/geom/class/part/geom_part.c head/sbin/geom/class/virstor/geom_virstor.c head/sbin/growfs/debug.c head/sbin/gvinum/gvinum.c head/sbin/hastctl/Makefile head/sbin/mknod/mknod.c head/usr.bin/ar/acplex.l head/usr.bin/bc/scan.l Modified: head/bin/sh/arith_lex.l == --- head/bin/sh/arith_lex.l Mon Nov 22 19:52:44 2010(r215703) +++ head/bin/sh/arith_lex.l Mon Nov 22 20:10:48 2010(r215704) @@ -55,6 +55,7 @@ int yylex(void); #define YY_INPUT(buf,result,max) \ result = (*buf = *arith_buf++) ? 1 : YY_NULL; #define YY_NO_UNPUT +#define YY_NO_INPUT %} %% Modified: head/sbin/bsdlabel/bsdlabel.c == --- head/sbin/bsdlabel/bsdlabel.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/bsdlabel/bsdlabel.c Mon Nov 22 20:10:48 2010 (r215704) @@ -515,7 +515,7 @@ readlabel(int flag) f = open(specname, O_RDONLY); if (f < 0) - err(1, specname); + err(1, "%s", specname); if (is_file) get_file_parms(f); else { Modified: head/sbin/geom/class/eli/geom_eli.c == --- head/sbin/geom/class/eli/geom_eli.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/geom/class/eli/geom_eli.c Mon Nov 22 20:10:48 2010 (r215704) @@ -374,7 +374,7 @@ eli_genkey_files(struct gctl_req *req, b if (!gctl_has_param(req, argname)) return (i); - file = gctl_get_ascii(req, argname); + file = gctl_get_ascii(req, "%s", argname); assert(file != NULL); if (strcmp(file, "-") == 0) Modified: head/sbin/geom/class/part/geom_part.c == --- head/sbin/geom/class/part/geom_part.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/geom/class/part/geom_part.c Mon Nov 22 20:10:48 2010 (r215704) @@ -614,7 +614,7 @@ static int gpart_show_hasopt(struct gctl_req *req, const char *opt, const char *elt) { - if (!gctl_get_int(req, opt)) + if (!gctl_get_int(req, "%s", opt)) return (0); if (elt != NULL) Modified: head/sbin/geom/class/virstor/geom_virstor.c == --- head/sbin/geom/class/virstor/geom_virstor.c Mon Nov 22 19:52:44 2010 (r215703) +++ head/sbin/geom/class/virstor/geom_virstor.c Mon Nov 22 20:10:48 2010 (r215704) @@ -276,7 +276,7 @@ virstor_label(struct gctl_req *req) msize = secsize = 0; for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); ssize = g_get_sectorsize(name); if (ssize == 0) fprintf(stderr, "%s for %s\n", strerror(errno), name); @@ -336,7 +336,7 @@ virstor_label(struct gctl_req *req) for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); if (verbose) printf(" %s", name); @@ -417,7 +417,7 @@ virstor_label(struct gctl_req *req) /* Ok, store metadata. */ for (i = 1; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); msize = g_get_mediasize(name); ssize = g_get_sectorsize(name); @@ -434,7 +434,7 @@ virstor_label(struct gctl_req *req) if (verbose) printf("(%u chunks) ", md.chunk_count); /* Check to make sure last sector is unused */ - if ((off_t)(md.chunk_count * md.md_chunk_size) > msize-ssize) + if ((off_t)(md.chunk_count * md.md_chunk_size) > (off_t)(msize-ssize)) md.chunk_count--; md.chunk_next = 0; if (i != 1) { @@ -499,7 +499,7 @@ virstor_clear(struct gctl_req *req) } for (i = 0; i < (unsigned)nargs; i++) { snprintf(param, sizeof(param), "arg%u", i); - name = gctl_get_ascii(req, param); + name = gctl_get_ascii(req, "%s", param); error =
svn commit: r215705 - head/usr.bin/ldd
Author: brucec Date: Mon Nov 22 20:18:46 2010 New Revision: 215705 URL: http://svn.freebsd.org/changeset/base/215705 Log: hdr.elf.e_ident[EI_OSABI] is not a bitmask so '==' should been used. Reported by: Artem Belevich Modified: head/usr.bin/ldd/ldd.c Modified: head/usr.bin/ldd/ldd.c == --- head/usr.bin/ldd/ldd.c Mon Nov 22 20:10:48 2010(r215704) +++ head/usr.bin/ldd/ldd.c Mon Nov 22 20:18:46 2010(r215705) @@ -331,7 +331,7 @@ is_executable(const char *fname, int fd, return (0); } if (hdr.elf32.e_type == ET_DYN) { - if (hdr.elf32.e_ident[EI_OSABI] & ELFOSABI_FREEBSD) { + if (hdr.elf32.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { *is_shlib = 1; return (1); } @@ -373,7 +373,7 @@ is_executable(const char *fname, int fd, return (0); } if (hdr.elf.e_type == ET_DYN) { - if (hdr.elf.e_ident[EI_OSABI] & ELFOSABI_FREEBSD) { + if (hdr.elf.e_ident[EI_OSABI] == ELFOSABI_FREEBSD) { *is_shlib = 1; return (1); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215706 - head/sys/compat/linux
Author: dim Date: Mon Nov 22 20:23:18 2010 New Revision: 215706 URL: http://svn.freebsd.org/changeset/base/215706 Log: Fix linux kernel module breakage introduced in r215675, by including . Noticed by: many Pointy hat to:netchild Modified: head/sys/compat/linux/linux_emul.c Modified: head/sys/compat/linux/linux_emul.c == --- head/sys/compat/linux/linux_emul.c Mon Nov 22 20:18:46 2010 (r215705) +++ head/sys/compat/linux/linux_emul.c Mon Nov 22 20:23:18 2010 (r215706) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215707 - head/sys/compat/ndis
Author: bschmidt Date: Mon Nov 22 20:39:29 2010 New Revision: 215707 URL: http://svn.freebsd.org/changeset/base/215707 Log: Prefer pmap_extract() over pmap_kextract() as done in MmIsAddressValid(). According to the comment for MmIsAddressValid() there are issues on PAE kernels using pmap_kextract(). Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/subr_ntoskrnl.c Modified: head/sys/compat/ndis/subr_ntoskrnl.c == --- head/sys/compat/ndis/subr_ntoskrnl.cMon Nov 22 20:23:18 2010 (r215706) +++ head/sys/compat/ndis/subr_ntoskrnl.cMon Nov 22 20:39:29 2010 (r215707) @@ -2544,6 +2544,12 @@ MmUnmapLockedPages(vaddr, buf) * here, but it doesn't. */ +static uint64_t +MmGetPhysicalAddress(void *base) +{ + return (pmap_extract(kernel_map->pmap, (vm_offset_t)base)); +} + uint8_t MmIsAddressValid(vaddr) void*vaddr; @@ -4241,12 +4247,12 @@ image_patch_table ntoskrnl_functbl[] = { IMPORT_SFUNC(MmAllocateContiguousMemorySpecifyCache, 5 + 3), IMPORT_SFUNC(MmFreeContiguousMemory, 1), IMPORT_SFUNC(MmFreeContiguousMemorySpecifyCache, 3), - IMPORT_SFUNC_MAP(MmGetPhysicalAddress, pmap_kextract, 1), IMPORT_SFUNC(MmSizeOfMdl, 1), IMPORT_SFUNC(MmMapLockedPages, 2), IMPORT_SFUNC(MmMapLockedPagesSpecifyCache, 6), IMPORT_SFUNC(MmUnmapLockedPages, 2), IMPORT_SFUNC(MmBuildMdlForNonPagedPool, 1), + IMPORT_SFUNC(MmGetPhysicalAddress, 1), IMPORT_SFUNC(MmIsAddressValid, 1), IMPORT_SFUNC(MmMapIoSpace, 3 + 1), IMPORT_SFUNC(MmUnmapIoSpace, 2), ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215708 - head/sys/compat/ndis
Author: bschmidt Date: Mon Nov 22 20:46:38 2010 New Revision: 215708 URL: http://svn.freebsd.org/changeset/base/215708 Log: Resurrect amd64 support. - Many drivers on amd64 are picking system uptime, interrupt time and ticks via global data structure instead of calling functions for performance reasons. For now just patch such address so driver will not trigger page fault when trying to access such data. In future, additional callout may be added to update data in periodic intervals. - On amd64 we need to allocate "shadow space" on stack before calling any function. Submitted by: Paul B Mahol Modified: head/sys/compat/ndis/kern_windrv.c head/sys/compat/ndis/ntoskrnl_var.h head/sys/compat/ndis/subr_ntoskrnl.c head/sys/compat/ndis/winx64_wrap.S Modified: head/sys/compat/ndis/kern_windrv.c == --- head/sys/compat/ndis/kern_windrv.c Mon Nov 22 20:39:29 2010 (r215707) +++ head/sys/compat/ndis/kern_windrv.c Mon Nov 22 20:46:38 2010 (r215708) @@ -311,6 +311,24 @@ windrv_unload(mod, img, len) #define WINDRV_LOADED htonl(0x42534F44) +#ifdef __amd64__ +static void +patch_user_shared_data_address(vm_offset_t img, size_t len) +{ + unsigned long i, n, max_addr, *addr; + + n = len - sizeof(unsigned long); + max_addr = KI_USER_SHARED_DATA + sizeof(kuser_shared_data); + for (i = 0; i < n; i++) { + addr = (unsigned long *)(img + i); + if (*addr >= KI_USER_SHARED_DATA && *addr < max_addr) { + *addr -= KI_USER_SHARED_DATA; + *addr += (unsigned long)&kuser_shared_data; + } + } +} +#endif + /* * Loader routine for actual Windows driver modules, ultimately * calls the driver's DriverEntry() routine. @@ -363,6 +381,10 @@ windrv_load(mod, img, len, bustype, devl return (ENOEXEC); } +#ifdef __amd64__ + patch_user_shared_data_address(img, len); +#endif + /* Dynamically link USBD.SYS -- optional */ if (pe_get_import_descriptor(img, &imp_desc, "USBD") == 0) { if (pe_patch_imports(img, "USBD", usbd_functbl)) Modified: head/sys/compat/ndis/ntoskrnl_var.h == --- head/sys/compat/ndis/ntoskrnl_var.h Mon Nov 22 20:39:29 2010 (r215707) +++ head/sys/compat/ndis/ntoskrnl_var.h Mon Nov 22 20:46:38 2010 (r215708) @@ -605,6 +605,65 @@ struct kinterrupt { typedef struct kinterrupt kinterrupt; +struct ksystem_time { + uint32_tlow_part; + int32_t high1_time; + int32_t high2_time; +}; + +enum nt_product_type { + NT_PRODUCT_WIN_NT = 1, + NT_PRODUCT_LAN_MAN_NT, + NT_PRODUCT_SERVER +}; + +enum alt_arch_type { + STANDARD_DESIGN, + NEC98x86, + END_ALTERNATIVES +}; + +struct kuser_shared_data { + uint32_ttick_count; + uint32_ttick_count_multiplier; + volatile struct ksystem_time interrupt_time; + volatile struct ksystem_time system_time; + volatile struct ksystem_time time_zone_bias; + uint16_timage_number_low; + uint16_timage_number_high; + int16_t nt_system_root[260]; + uint32_tmax_stack_trace_depth; + uint32_tcrypto_exponent; + uint32_ttime_zone_id; + uint32_tlarge_page_min; + uint32_treserved2[7]; + enum nt_product_typent_product_type; + uint8_t product_type_is_valid; + uint32_tnt_major_version; + uint32_tnt_minor_version; + uint8_t processor_features[64]; + uint32_treserved1; + uint32_treserved3; + volatile uint32_t time_slip; + enum alt_arch_type alt_arch_type; + int64_t system_expiration_date; + uint32_tsuite_mask; + uint8_t kdbg_enabled; + volatile uint32_t active_console; + volatile uint32_t dismount_count; + uint32_tcom_plus_package; + uint32_tlast_system_rit_event_tick_count; + uint32_tnum_phys_pages; + uint8_t safe_boot_mode; + uint32_ttrace_log; + uint64_tfill0; + uint64_tsys_call[4]; + union { + volatile struct ksystem_timetick_count; + volatile uint64_t tick_count_quad; + } tick; +}; + /* * In Windows, there are Physical Device Objects (PDOs) and * Functional Device Objects (FDOs). Physical Device Objects are @@
svn commit: r215711 - head/sys/dev/mii
Author: marius Date: Mon Nov 22 20:57:44 2010 New Revision: 215711 URL: http://svn.freebsd.org/changeset/base/215711 Log: Add missing newlines. MFC after:3 days Modified: head/sys/dev/mii/mii.c Modified: head/sys/dev/mii/mii.c == --- head/sys/dev/mii/mii.c Mon Nov 22 20:52:18 2010(r215710) +++ head/sys/dev/mii/mii.c Mon Nov 22 20:57:44 2010(r215711) @@ -137,7 +137,7 @@ miibus_attach(device_t dev) free(children, M_TEMP); } if (nchildren == 0) { - device_printf(dev, "cannot get children"); + device_printf(dev, "cannot get children\n"); return (ENXIO); } ivars = device_get_ivars(dev); @@ -311,12 +311,12 @@ mii_attach(device_t dev, device_t *miibu int bmsr, first, i, nchildren, offset, phymax, phymin, rv; if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) { - printf("%s: phyloc and offloc specified", __func__); + printf("%s: phyloc and offloc specified\n", __func__); return (EINVAL); } if (offloc != MII_OFFSET_ANY && (offloc < 0 || offloc >= MII_NPHY)) { - printf("%s: ivalid offloc %d", __func__, offloc); + printf("%s: ivalid offloc %d\n", __func__, offloc); return (EINVAL); } @@ -325,7 +325,7 @@ mii_attach(device_t dev, device_t *miibu phymax = MII_NPHY - 1; } else { if (phyloc < 0 || phyloc >= MII_NPHY) { - printf("%s: ivalid phyloc %d", __func__, phyloc); + printf("%s: ivalid phyloc %d\n", __func__, phyloc); return (EINVAL); } phymin = phymax = phyloc; @@ -352,7 +352,7 @@ mii_attach(device_t dev, device_t *miibu if (ivars->ifp != ifp || ivars->ifmedia_upd != ifmedia_upd || ivars->ifmedia_sts != ifmedia_sts || ivars->mii_flags != flags) { - printf("%s: non-matching invariant", __func__); + printf("%s: non-matching invariant\n", __func__); return (EINVAL); } /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215708 - head/sys/compat/ndis
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 11/22/10 12:46, Bernhard Schmidt wrote: > Author: bschmidt > Date: Mon Nov 22 20:46:38 2010 > New Revision: 215708 > URL: http://svn.freebsd.org/changeset/base/215708 > > Log: > Resurrect amd64 support. > - Many drivers on amd64 are picking system uptime, interrupt time and ticks > via global data structure instead of calling functions for performance > reasons. For now just patch such address so driver will not trigger page > fault when trying to access such data. In future, additional callout may > be added to update data in periodic intervals. > - On amd64 we need to allocate "shadow space" on stack before calling any > function. > > Submitted by: Paul B Mahol Will this be MFC'ed? Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.16 (FreeBSD) iQEcBAEBCAAGBQJM6tuoAAoJEATO+BI/yjfByfcH/15/qNeim1VF5aUK9h6LWPM0 04dB6K3fu3oKEUNY8bD/w06lZZzTPUW/VNrm+bA6/8gKNxP4MgJunty69kmR6tEG xH67RPz/lVmCMU7zNFByFTGltZVSvyyxrsceD6ZylBaSChBV5UoKBMdDE6cOuPbR D5V/yVxlwJaJkhtoRN/GbKlEyZkDs6pGmhzSRKOptr0n4PZjpiHVlXAxhlZkpILB qITYNGvPjyL/3a3nKMz+eBVMqUofjPsDkmCvvApLQumL7FFSCvLGGHnfqe3Pl5Zq nG5ajDia1wnD2nWdbsFoADv69+T3YYhB8wHwvQ/yGV+h+5NExKjovz4l7AZyEjg= =gImO -END PGP SIGNATURE- ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215713 - head/sys/dev/mii
Author: marius Date: Mon Nov 22 21:13:42 2010 New Revision: 215713 URL: http://svn.freebsd.org/changeset/base/215713 Log: Given that unlike f.e. rgephy(4) this driver doesn't explicitly start an autonegotiation along with manual media selection and ukphy_status() also only reports flow control status when BMCR_AUTOEN is set (at least with gentbi(4) determining the flow control status results in false-positives when not set), use MIIF_NOMANPAUSE. Modified: head/sys/dev/mii/ukphy.c Modified: head/sys/dev/mii/ukphy.c == --- head/sys/dev/mii/ukphy.cMon Nov 22 21:12:20 2010(r215712) +++ head/sys/dev/mii/ukphy.cMon Nov 22 21:13:42 2010(r215713) @@ -136,6 +136,8 @@ ukphy_attach(device_t dev) sc->mii_service = ukphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215714 - head/sys/dev/mii
Author: marius Date: Mon Nov 22 21:20:11 2010 New Revision: 215714 URL: http://svn.freebsd.org/changeset/base/215714 Log: Given that unlike f.e. rgephy(4) these drivers doen't explicitly start an autonegotiation along with manual media selection and also only report flow control status when BMCR_AUTOEN is set (at least with gentbi(4) determining the flow control status results in false-positives when not set), use MIIF_NOMANPAUSE. Modified: head/sys/dev/mii/gentbi.c head/sys/dev/mii/nsgphy.c Modified: head/sys/dev/mii/gentbi.c == --- head/sys/dev/mii/gentbi.c Mon Nov 22 21:13:42 2010(r215713) +++ head/sys/dev/mii/gentbi.c Mon Nov 22 21:20:11 2010(r215714) @@ -172,6 +172,8 @@ gentbi_attach(device_t dev) sc->mii_service = gentbi_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); /* Modified: head/sys/dev/mii/nsgphy.c == --- head/sys/dev/mii/nsgphy.c Mon Nov 22 21:13:42 2010(r215713) +++ head/sys/dev/mii/nsgphy.c Mon Nov 22 21:20:11 2010(r215714) @@ -135,6 +135,8 @@ nsgphy_attach(device_t dev) sc->mii_service = nsgphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); /* ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215716 - head/sys/dev/mii
Author: marius Date: Mon Nov 22 21:24:29 2010 New Revision: 215716 URL: http://svn.freebsd.org/changeset/base/215716 Log: Add support for flow control. Obtained from:NetBSD (partially) Modified: head/sys/dev/mii/bmtphy.c head/sys/dev/mii/inphy.c head/sys/dev/mii/nsphyter.c Modified: head/sys/dev/mii/bmtphy.c == --- head/sys/dev/mii/bmtphy.c Mon Nov 22 21:22:08 2010(r215715) +++ head/sys/dev/mii/bmtphy.c Mon Nov 22 21:24:29 2010(r215716) @@ -153,6 +153,8 @@ bmtphy_attach(device_t dev) sc->mii_service = bmtphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + mii_phy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; @@ -243,7 +245,8 @@ bmtphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (aux_csr & AUX_CSR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: head/sys/dev/mii/inphy.c == --- head/sys/dev/mii/inphy.cMon Nov 22 21:22:08 2010(r215715) +++ head/sys/dev/mii/inphy.cMon Nov 22 21:24:29 2010(r215716) @@ -113,6 +113,8 @@ inphy_attach(device_t dev) sc->mii_service = inphy_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + ifmedia_add(&mii->mii_media, IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst), MII_MEDIA_100_TX, NULL); @@ -197,7 +199,8 @@ inphy_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_10_T; if (scr & SCR_FDX) - mii->mii_media_active |= IFM_FDX; + mii->mii_media_active |= + IFM_FDX | mii_phy_flowstatus(sc); else mii->mii_media_active |= IFM_HDX; } else Modified: head/sys/dev/mii/nsphyter.c == --- head/sys/dev/mii/nsphyter.c Mon Nov 22 21:22:08 2010(r215715) +++ head/sys/dev/mii/nsphyter.c Mon Nov 22 21:24:29 2010(r215716) @@ -143,6 +143,8 @@ nsphyter_attach(device_t dev) sc->mii_service = nsphyter_service; sc->mii_pdata = mii; + sc->mii_flags |= MIIF_NOMANPAUSE; + #if 1 #defineADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) @@ -242,12 +244,8 @@ nsphyter_status(struct mii_softc *sc) else mii->mii_media_active |= IFM_100_TX; if ((physts & PHYSTS_DUPLEX) != 0) -#ifdef notyet mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc); -#else - mii->mii_media_active |= IFM_FDX; -#endif else mii->mii_media_active |= IFM_HDX; } else ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215708 - head/sys/compat/ndis
On Monday 22 November 2010 22:07:52 Xin LI wrote: > On 11/22/10 12:46, Bernhard Schmidt wrote: > > Author: bschmidt > > Date: Mon Nov 22 20:46:38 2010 > > New Revision: 215708 > > URL: http://svn.freebsd.org/changeset/base/215708 > > > > Log: > > Resurrect amd64 support. > > - Many drivers on amd64 are picking system uptime, interrupt time and > > ticks via global data structure instead of calling functions for > > performance reasons. For now just patch such address so driver will not > > trigger page fault when trying to access such data. In future, additional > > callout may be added to update data in periodic intervals. > > - On amd64 we need to allocate "shadow space" on stack before calling > > any function. > > > > Submitted by: Paul B Mahol > > Will this be MFC'ed? I hope I can squeeze it in before the freeze, so yes. Given the current state of ndis on amd64 it definitely won't make things worse. -- Bernhard ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215717 - head/usr.sbin/kernbb
Author: uqs Date: Mon Nov 22 21:39:35 2010 New Revision: 215717 URL: http://svn.freebsd.org/changeset/base/215717 Log: Remove kernbb(8) from the source tree. It's been broken for several years and with all the binutils/toolchain changes in flight, it might make more sense to put efforts into dtrace and hwpmc instead. Discussed with: phk PR: bin/83558 Deleted: head/usr.sbin/kernbb/ ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215719 - head/sys/dev/pci
Author: jkim Date: Mon Nov 22 21:58:00 2010 New Revision: 215719 URL: http://svn.freebsd.org/changeset/base/215719 Log: Resume critical PCI devices (and their children) first, then everything else later. This give us better chance to catch device driver problems. Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c == --- head/sys/dev/pci/pci.c Mon Nov 22 21:43:45 2010(r215718) +++ head/sys/dev/pci/pci.c Mon Nov 22 21:58:00 2010(r215719) @@ -3022,8 +3022,35 @@ pci_resume(device_t dev) if (!device_is_attached(child)) pci_cfg_save(child, dinfo, 1); } + + /* +* Resume critical devices first, then everything else later. +*/ + for (i = 0; i < numdevs; i++) { + child = devlist[i]; + switch (pci_get_class(child)) { + case PCIC_DISPLAY: + case PCIC_MEMORY: + case PCIC_BRIDGE: + case PCIC_BASEPERIPH: + DEVICE_RESUME(child); + break; + } + } + for (i = 0; i < numdevs; i++) { + child = devlist[i]; + switch (pci_get_class(child)) { + case PCIC_DISPLAY: + case PCIC_MEMORY: + case PCIC_BRIDGE: + case PCIC_BASEPERIPH: + break; + default: + DEVICE_RESUME(child); + } + } free(devlist, M_TEMP); - return (bus_generic_resume(dev)); + return (0); } static void ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215720 - head/sys/dev/mii
Author: marius Date: Mon Nov 22 22:03:11 2010 New Revision: 215720 URL: http://svn.freebsd.org/changeset/base/215720 Log: - Also probe BCM5214 and BCM5222. - Add some DSP init code for BCM5221. The values derived from Apple's GMAC driver and the same init code also exists in Linux's sungem_phy driver. - Only read media status bits when they are valid. Obtained from:NetBSD, OpenBSD Modified: head/sys/dev/mii/bmtphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/bmtphy.c == --- head/sys/dev/mii/bmtphy.c Mon Nov 22 21:58:00 2010(r215719) +++ head/sys/dev/mii/bmtphy.c Mon Nov 22 22:03:11 2010(r215720) @@ -85,6 +85,11 @@ __FBSDID("$FreeBSD$"); static int bmtphy_probe(device_t); static int bmtphy_attach(device_t); +struct bmtphy_softc { + struct mii_softc mii_sc; + int mii_model; +}; + static device_method_t bmtphy_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bmtphy_probe), @@ -100,18 +105,21 @@ static devclass_t bmtphy_devclass; static driver_tbmtphy_driver = { "bmtphy", bmtphy_methods, - sizeof(struct mii_softc) + sizeof(struct bmtphy_softc) }; DRIVER_MODULE(bmtphy, miibus, bmtphy_driver, bmtphy_devclass, 0, 0); static int bmtphy_service(struct mii_softc *, struct mii_data *, int); static voidbmtphy_status(struct mii_softc *); +static voidbmtphy_reset(struct mii_softc *); static const struct mii_phydesc bmtphys_dp[] = { MII_PHY_DESC(BROADCOM, BCM4401), MII_PHY_DESC(BROADCOM, BCM5201), + MII_PHY_DESC(BROADCOM, BCM5214), MII_PHY_DESC(BROADCOM, BCM5221), + MII_PHY_DESC(BROADCOM, BCM5222), MII_PHY_END }; @@ -137,11 +145,13 @@ bmtphy_probe(device_t dev) static int bmtphy_attach(device_t dev) { - struct mii_softc *sc; - struct mii_attach_args *ma; - struct mii_data *mii; + struct bmtphy_softc *bsc; + struct mii_softc *sc; + struct mii_attach_args *ma; + struct mii_data *mii; - sc = device_get_softc(dev); + bsc = device_get_softc(dev); + sc = &bsc->mii_sc; ma = device_get_ivars(dev); sc->mii_dev = device_get_parent(dev); mii = ma->mii_data; @@ -155,7 +165,9 @@ bmtphy_attach(device_t dev) sc->mii_flags |= MIIF_NOMANPAUSE; - mii_phy_reset(sc); + bsc->mii_model = MII_MODEL(ma->mii_id2); + + bmtphy_reset(sc); sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; device_printf(dev, " "); @@ -196,16 +208,15 @@ bmtphy_service(struct mii_softc *sc, str /* Callback if something changed. */ mii_phy_update(sc, cmd); - return (0); } static void bmtphy_status(struct mii_softc *sc) { - struct mii_data *mii; - struct ifmedia_entry *ife; - int bmsr, bmcr, aux_csr; + struct mii_data *mii; + struct ifmedia_entry *ife; + int bmsr, bmcr, aux_csr; mii = sc->mii_pdata; ife = mii->mii_media.ifm_cur; @@ -214,7 +225,6 @@ bmtphy_status(struct mii_softc *sc) mii->mii_media_active = IFM_ETHER; bmsr = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); - aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR); if (bmsr & BMSR_LINK) mii->mii_media_status |= IFM_ACTIVE; @@ -240,6 +250,7 @@ bmtphy_status(struct mii_softc *sc) return; } + aux_csr = PHY_READ(sc, MII_BMTPHY_AUX_CSR); if (aux_csr & AUX_CSR_SPEED) mii->mii_media_active |= IFM_100_TX; else @@ -252,3 +263,32 @@ bmtphy_status(struct mii_softc *sc) } else mii->mii_media_active = ife->ifm_media; } + +static void +bmtphy_reset(struct mii_softc *sc) +{ + struct bmtphy_softc *bsc; + u_int16_t data; + + bsc = (struct bmtphy_softc *)sc; + + mii_phy_reset(sc); + + if (bsc->mii_model == MII_MODEL_BROADCOM_BCM5221) { + /* Enable shadow register mode. */ + data = PHY_READ(sc, 0x1f); + PHY_WRITE(sc, 0x1f, data | 0x0080); + + /* Enable APD (Auto PowerDetect). */ + data = PHY_READ(sc, MII_BMTPHY_AUX2); + PHY_WRITE(sc, MII_BMTPHY_AUX2, data | 0x0020); + + /* Enable clocks across APD for Auto-MDIX functionality. */ + data = PHY_READ(sc, MII_BMTPHY_INTR); + PHY_WRITE(sc, MII_BMTPHY_INTR, data | 0x0004); + + /* Disable shadow register mode. */ + data = PHY_READ(sc, 0x1f); + PHY_WRITE(sc, 0x1f, data & ~0x0080); + } +} Modified: head/sys/dev/mii/miidevs == --- head/sys/dev/mii/miidevsMon Nov 22 21:58:00 2010(r215719)
Re: svn commit: r215717 - head/usr.sbin/kernbb
On Mon Nov 22 10, Ulrich Spoerlein wrote: > Author: uqs > Date: Mon Nov 22 21:39:35 2010 > New Revision: 215717 > URL: http://svn.freebsd.org/changeset/base/215717 > > Log: > Remove kernbb(8) from the source tree. > > It's been broken for several years and with all the binutils/toolchain > changes in flight, it might make more sense to put efforts into dtrace and > hwpmc instead. thanks. :) what about the BB-profiling sections in sys/{amd64,i386}/{amd64,i386}/support.S? do they need to stay? cheers. alex > > Discussed with: phk > PR: bin/83558 > > Deleted: > head/usr.sbin/kernbb/ -- a13x ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215721 - head/sys/dev/cas
Author: marius Date: Mon Nov 22 22:06:30 2010 New Revision: 215721 URL: http://svn.freebsd.org/changeset/base/215721 Log: - Fix and enable support for flow control. - Fix compilation with CAS_DEBUG defined. Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c == --- head/sys/dev/cas/if_cas.c Mon Nov 22 22:03:11 2010(r215720) +++ head/sys/dev/cas/if_cas.c Mon Nov 22 22:06:30 2010(r215721) @@ -346,7 +346,7 @@ cas_attach(struct cas_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, - MII_PHY_ANY, MII_OFFSET_ANY, 0); + MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE); } /* * Fall back on an internal PHY if no external PHY was found. @@ -366,7 +366,7 @@ cas_attach(struct cas_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, - MII_PHY_ANY, MII_OFFSET_ANY, 0); + MII_PHY_ANY, MII_OFFSET_ANY, MIIF_DOPAUSE); } } else { /* @@ -388,7 +388,7 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE); error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, cas_mediachange, cas_mediastatus, BMSR_DEFCAPMASK, - CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); + CAS_PHYAD_EXTERNAL, MII_OFFSET_ANY, MIIF_DOPAUSE); } if (error != 0) { device_printf(sc->sc_dev, "attaching PHYs failed\n"); @@ -1093,8 +1093,7 @@ cas_init_locked(struct cas_softc *sc) /* Set the PAUSE thresholds. We use the maximum OFF threshold. */ CAS_WRITE_4(sc, CAS_RX_PTHRS, - ((111 * 64) << CAS_RX_PTHRS_XOFF_SHFT) | - ((15 * 64) << CAS_RX_PTHRS_XON_SHFT)); + (111 << CAS_RX_PTHRS_XOFF_SHFT) | (15 << CAS_RX_PTHRS_XON_SHFT)); /* RX blanking */ CAS_WRITE_4(sc, CAS_RX_BLANK, @@ -1339,7 +1338,7 @@ cas_init_regs(struct cas_softc *sc) CAS_WRITE_4(sc, CAS_MAC_PREAMBLE_LEN, 0x7); CAS_WRITE_4(sc, CAS_MAC_JAM_SIZE, 0x4); CAS_WRITE_4(sc, CAS_MAC_ATTEMPT_LIMIT, 0x10); - CAS_WRITE_4(sc, CAS_MAC_CTRL_TYPE, 0x8088); + CAS_WRITE_4(sc, CAS_MAC_CTRL_TYPE, 0x8808); /* random number seed */ CAS_WRITE_4(sc, CAS_MAC_RANDOM_SEED, @@ -1572,11 +1571,11 @@ cas_tint(struct cas_softc *sc) } #ifdef CAS_DEBUG - CTR4(KTR_CAS, "%s: CAS_TX_STATE_MACHINE %x CAS_TX_DESC_BASE %llx " + CTR5(KTR_CAS, "%s: CAS_TX_SM1 %x CAS_TX_SM2 %x CAS_TX_DESC_BASE %llx " "CAS_TX_COMP3 %x", - __func__, CAS_READ_4(sc, CAS_TX_STATE_MACHINE), - ((long long)CAS_READ_4(sc, CAS_TX_DESC_BASE_HI3) << 32) | - CAS_READ_4(sc, CAS_TX_DESC_BASE_LO3), + __func__, CAS_READ_4(sc, CAS_TX_SM1), CAS_READ_4(sc, CAS_TX_SM2), + ((long long)CAS_READ_4(sc, CAS_TX_DESC3_BASE_HI) << 32) | + CAS_READ_4(sc, CAS_TX_DESC3_BASE_LO), CAS_READ_4(sc, CAS_TX_COMP3)); #endif @@ -1638,7 +1637,7 @@ cas_rint(struct cas_softc *sc) rxhead = CAS_READ_4(sc, CAS_RX_COMP_HEAD); #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: sc->sc_rxcptr %d, sc->sc_rxdptr %d, head %d", - __func__, sc->rxcptr, sc->sc_rxdptr, rxhead); + __func__, sc->sc_rxcptr, sc->sc_rxdptr, rxhead); #endif skip = 0; CAS_CDSYNC(sc, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); @@ -1865,7 +1864,7 @@ cas_rint(struct cas_softc *sc) #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: done sc->sc_rxcptr %d, sc->sc_rxdptr %d, head %d", - __func__, sc->rxcptr, sc->sc_rxdptr, + __func__, sc->sc_rxcptr, sc->sc_rxdptr, CAS_READ_4(sc, CAS_RX_COMP_HEAD)); #endif } @@ -1988,7 +1987,7 @@ cas_intr_task(void *arg, int pending __u #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: %s: cplt %x, status %x", device_get_name(sc->sc_dev), __func__, - (status >> CAS_STATUS_TX_COMP3_SHIFT), (u_int)status); + (status >> CAS_STATUS_TX_COMP3_SHFT), (u_int)status); /* * PCS interrupts must be cleared, otherwise no traffic is passed! @@ -2100,15 +2099,15 @@ cas_watchdog(struct cas_softc *sc) #ifdef CAS_DEBUG CTR4(KTR_CAS, - "%s: CAS_RX_CONFIG %x CAS_MAC_RX_STATUS %x CAS_MAC_RX_CONFIG %x", - __func__, CAS_READ_4(sc, CAS_RX_CONFIG), + "%s: CAS_RX_CONF %x CAS_MAC_RX_STATUS %x CAS_MAC_RX_CONF %x", + __func__, CAS_READ_4(sc, CAS_RX_CONF), CAS_READ_4(
svn commit: r215722 - head/sys/dev/gem
Author: marius Date: Mon Nov 22 22:13:26 2010 New Revision: 215722 URL: http://svn.freebsd.org/changeset/base/215722 Log: - Fix and enable support for flow control. - Partially revert r172334; as it turns out the DELAYs in gem_reset_{r,t}x() are actually necessary although bus space barriers and gem_bitwait() are used, otherwise the controller may trigger an IOMMU errors on at least sparc64. This is in line with what Linux and OpenSolaris do. Modified: head/sys/dev/gem/if_gem.c Modified: head/sys/dev/gem/if_gem.c == --- head/sys/dev/gem/if_gem.c Mon Nov 22 22:06:30 2010(r215721) +++ head/sys/dev/gem/if_gem.c Mon Nov 22 22:13:26 2010(r215722) @@ -302,7 +302,7 @@ gem_attach(struct gem_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, MIIF_DOPAUSE); } /* @@ -330,7 +330,7 @@ gem_attach(struct gem_softc *sc) } error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, phy, - MII_OFFSET_ANY, 0); + MII_OFFSET_ANY, MIIF_DOPAUSE); } /* @@ -352,7 +352,7 @@ gem_attach(struct gem_softc *sc) sc->sc_flags |= GEM_SERDES; error = mii_attach(sc->sc_dev, &sc->sc_miibus, ifp, gem_mediachange, gem_mediastatus, BMSR_DEFCAPMASK, - GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, 0); + GEM_PHYAD_EXTERNAL, MII_OFFSET_ANY, MIIF_DOPAUSE); } if (error != 0) { device_printf(sc->sc_dev, "attaching PHYs failed\n"); @@ -712,6 +712,9 @@ gem_reset_rx(struct gem_softc *sc) if (!GEM_BANK1_BITWAIT(sc, GEM_RX_CONFIG, GEM_RX_CONFIG_RXDMA_EN, 0)) device_printf(sc->sc_dev, "cannot disable RX DMA\n"); + /* Wait 5ms extra. */ + DELAY(5000); + /* Finally, reset the ERX. */ GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_RX); GEM_BANK2_BARRIER(sc, GEM_RESET, 4, @@ -784,6 +787,9 @@ gem_reset_tx(struct gem_softc *sc) if (!GEM_BANK1_BITWAIT(sc, GEM_TX_CONFIG, GEM_TX_CONFIG_TXDMA_EN, 0)) device_printf(sc->sc_dev, "cannot disable TX DMA\n"); + /* Wait 5ms extra. */ + DELAY(5000); + /* Finally, reset the ETX. */ GEM_BANK2_WRITE_4(sc, GEM_RESET, GEM_RESET_TX); GEM_BANK2_BARRIER(sc, GEM_RESET, 4, @@ -1239,7 +1245,7 @@ gem_init_regs(struct gem_softc *sc) GEM_BANK1_WRITE_4(sc, GEM_MAC_PREAMBLE_LEN, 0x7); GEM_BANK1_WRITE_4(sc, GEM_MAC_JAM_SIZE, 0x4); GEM_BANK1_WRITE_4(sc, GEM_MAC_ATTEMPT_LIMIT, 0x10); - GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8088); + GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8808); /* random number seed */ GEM_BANK1_WRITE_4(sc, GEM_MAC_RANDOM_SEED, @@ -2039,14 +2045,12 @@ gem_mii_statchg(device_t dev) v = GEM_BANK1_READ_4(sc, GEM_MAC_CONTROL_CONFIG) & ~(GEM_MAC_CC_RX_PAUSE | GEM_MAC_CC_TX_PAUSE); -#ifdef notyet if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_ETH_RXPAUSE) != 0) v |= GEM_MAC_CC_RX_PAUSE; if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_ETH_TXPAUSE) != 0) v |= GEM_MAC_CC_TX_PAUSE; -#endif GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_CONFIG, v); if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_FDX) == 0 && ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r215434 - in head: sys/netinet usr.bin/netstat
On Wed, 17 Nov 2010 18:55:13 + (UTC) "George V. Neville-Neil" wrote: > Author: gnn > Date: Wed Nov 17 18:55:12 2010 > New Revision: 215434 > URL: http://svn.freebsd.org/changeset/base/215434 > > Log: > Add new, per connection, statistics for TCP, including: > Retransmitted Packets > Zero Window Advertisements > Out of Order Receives I don't know if it was this checkin that broke it, but netstat now fails to print a newline between the headers and the first line of connection data. -- Bruce Cran ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215724 - head/usr.bin/netstat
Author: gnn Date: Mon Nov 22 22:55:43 2010 New Revision: 215724 URL: http://svn.freebsd.org/changeset/base/215724 Log: Restore the (state) and \n printout when not using -T. Pointed out by: brucec@ MFC after:3 weeks Modified: head/usr.bin/netstat/inet.c Modified: head/usr.bin/netstat/inet.c == --- head/usr.bin/netstat/inet.c Mon Nov 22 22:41:43 2010(r215723) +++ head/usr.bin/netstat/inet.c Mon Nov 22 22:55:43 2010(r215724) @@ -428,13 +428,14 @@ protopr(u_long off, const char *name, in "2msl", "delack", "rcvtime", "(state)"); } - if (!xflag && !Tflag) + if (!xflag && !Tflag) { printf((Aflag && !Wflag) ? "%-5.5s %-6.6s %-6.6s %-18.18s %-18.18s" : "%-5.5s %-6.6s %-6.6s %-22.22s %-22.22s", "Proto", "Recv-Q", "Send-Q", "Local Address", "Foreign Address"); - + printf("(state)\n"); + } first = 0; } if (Lflag && so->so_qlimit == 0) ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215725 - head/sys/dev/ahci
Author: mav Date: Mon Nov 22 23:04:25 2010 New Revision: 215725 URL: http://svn.freebsd.org/changeset/base/215725 Log: Fix small typo. Submitted by: Artem Belevich Modified: head/sys/dev/ahci/ahci.c Modified: head/sys/dev/ahci/ahci.c == --- head/sys/dev/ahci/ahci.cMon Nov 22 22:55:43 2010(r215724) +++ head/sys/dev/ahci/ahci.cMon Nov 22 23:04:25 2010(r215725) @@ -858,7 +858,7 @@ ahci_ch_attach(device_t dev) ch->caps = ctlr->caps; ch->caps2 = ctlr->caps2; ch->quirks = ctlr->quirks; - ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1, + ch->numslots = ((ch->caps & AHCI_CAP_NCS) >> AHCI_CAP_NCS_SHIFT) + 1; mtx_init(&ch->mtx, "AHCI channel lock", NULL, MTX_DEF); resource_int_value(device_get_name(dev), device_get_unit(dev), "pm_level", &ch->pm_level); ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215726 - head/sys/net
Author: zec Date: Mon Nov 22 23:35:29 2010 New Revision: 215726 URL: http://svn.freebsd.org/changeset/base/215726 Log: Allow for vlan(4) ifnets to have overlapping unit numbers if they are created in separated vnets. As a side-effect of having a separated if_cloner instance for each vnet, all vlan ifnets created in a vnet will be automatically destroyed when vnet teardown is initiated. Disallow SIOCSETVLAN and SIOCGETVLAN ioctls on vlan ifnets which are associated with physical ifnets residing in parent vnets. This is an interim vlan-specific solution which will be superseded by a more generic if_cloner V_irtualization change from p4. For nooptions VIMAGE builds, this should be a no-op change. Discussed with: bz MFC after:3 days Modified: head/sys/net/if_vlan.c Modified: head/sys/net/if_vlan.c == --- head/sys/net/if_vlan.c Mon Nov 22 23:04:25 2010(r215725) +++ head/sys/net/if_vlan.c Mon Nov 22 23:35:29 2010(r215726) @@ -206,6 +206,11 @@ static void vlan_iflladdr(void *arg, st static struct if_clone vlan_cloner = IFC_CLONE_INITIALIZER(VLANNAME, NULL, IF_MAXUNIT, NULL, vlan_clone_match, vlan_clone_create, vlan_clone_destroy); +#ifdef VIMAGE +static VNET_DEFINE(struct if_clone, vlan_cloner); +#defineV_vlan_cloner VNET(vlan_cloner) +#endif + #ifndef VLAN_ARRAY #define HASH(n, m) n) >> 8) ^ ((n) >> 4) ^ (n)) & (m)) @@ -588,7 +593,9 @@ vlan_modevent(module_t mod, int type, vo vlan_input_p = vlan_input; vlan_link_state_p = vlan_link_state; vlan_trunk_cap_p = vlan_trunk_capabilities; +#ifndef VIMAGE if_clone_attach(&vlan_cloner); +#endif if (bootverbose) printf("vlan: initialized, using " #ifdef VLAN_ARRAY @@ -600,7 +607,9 @@ vlan_modevent(module_t mod, int type, vo "\n"); break; case MOD_UNLOAD: +#ifndef VIMAGE if_clone_detach(&vlan_cloner); +#endif EVENTHANDLER_DEREGISTER(ifnet_departure_event, ifdetach_tag); EVENTHANDLER_DEREGISTER(iflladdr_event, iflladdr_tag); vlan_input_p = NULL; @@ -625,6 +634,27 @@ static moduledata_t vlan_mod = { DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_vlan, 3); +#ifdef VIMAGE +static void +vnet_vlan_init(const void *unused __unused) +{ + + V_vlan_cloner = vlan_cloner; + if_clone_attach(&V_vlan_cloner); +} +VNET_SYSINIT(vnet_vlan_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, +vnet_vlan_init, NULL); + +static void +vnet_vlan_uninit(const void *unused __unused) +{ + + if_clone_detach(&V_vlan_cloner); +} +VNET_SYSUNINIT(vnet_vlan_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_FIRST, +vnet_vlan_uninit, NULL); +#endif + static struct ifnet * vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag) { @@ -1432,6 +1462,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCSETVLAN: +#ifdef VIMAGE + if (ifp->if_vnet != ifp->if_home_vnet) { + error = EPERM; + break; + } +#endif error = copyin(ifr->ifr_data, &vlr, sizeof(vlr)); if (error) break; @@ -1461,6 +1497,12 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd break; case SIOCGETVLAN: +#ifdef VIMAGE + if (ifp->if_vnet != ifp->if_home_vnet) { + error = EPERM; + break; + } +#endif bzero(&vlr, sizeof(vlr)); VLAN_LOCK(); if (TRUNK(ifv) != NULL) { ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215727 - head/bin/sh
Author: jilles Date: Mon Nov 22 23:49:06 2010 New Revision: 215727 URL: http://svn.freebsd.org/changeset/base/215727 Log: sh: Fix confusing behaviour if chdir succeeded but getcwd failed in cd -P. If getcwd fails, do not treat this as an error, but print a warning and unset PWD. This is similar to the behaviour when starting the shell in a directory whose name cannot be determined. Modified: head/bin/sh/cd.c Modified: head/bin/sh/cd.c == --- head/bin/sh/cd.cMon Nov 22 23:35:29 2010(r215726) +++ head/bin/sh/cd.cMon Nov 22 23:49:06 2010(r215727) @@ -219,10 +219,13 @@ cdphysical(char *dest) char *p; INTOFF; - if (chdir(dest) < 0 || (p = findcwd(NULL)) == NULL) { + if (chdir(dest) < 0) { INTON; return (-1); } + p = findcwd(NULL); + if (p == NULL) + out2fmt_flush("cd: warning: failed to get name of current directory\n"); updatepwd(p); INTON; return (0); @@ -304,7 +307,7 @@ updatepwd(char *dir) if (prevdir) ckfree(prevdir); prevdir = curdir; - curdir = savestr(dir); + curdir = dir ? savestr(dir) : NULL; setvar("PWD", curdir, VEXPORT); setvar("OLDPWD", prevdir, VEXPORT); } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215732 - head/sys/kern
Author: cperciva Date: Tue Nov 23 04:50:01 2010 New Revision: 215732 URL: http://svn.freebsd.org/changeset/base/215732 Log: Add parentheses for clarity. The parentheses around the two terms of the && are unnecessary but I'm leaving them in for the sake of avoiding confusion (I confuse easily). Submitted by: bde Modified: head/sys/kern/kern_tc.c Modified: head/sys/kern/kern_tc.c == --- head/sys/kern/kern_tc.c Tue Nov 23 03:53:53 2010(r215731) +++ head/sys/kern/kern_tc.c Tue Nov 23 04:50:01 2010(r215732) @@ -448,7 +448,7 @@ tc_windup(void) th->th_offset.sec++; } if ((delta > th->th_counter->tc_frequency / 2) && - (th->th_scale * delta < (uint64_t)1 << 63)) { + (th->th_scale * delta < ((uint64_t)1 << 63))) { /* The product th_scale * delta just barely overflows. */ th->th_offset.sec++; } ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r215733 - head/share/misc
Author: maxim Date: Tue Nov 23 06:31:09 2010 New Revision: 215733 URL: http://svn.freebsd.org/changeset/base/215733 Log: o NetBSD 5.1 added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree == --- head/share/misc/bsd-family-tree Tue Nov 23 04:50:01 2010 (r215732) +++ head/share/misc/bsd-family-tree Tue Nov 23 06:31:09 2010 (r215733) @@ -228,20 +228,20 @@ FreeBSD 5.2 | | | FreeBSD 7.1 | | | | | | | | |DragonFly 2.2.0 | FreeBSD 7.2 | NetBSD 5.0 OpenBSD 4.5 | - | \ | | | | - | | | | |DragonFly 2.4.0 - | | | | OpenBSD 4.6 | - | | | | | | - *--FreeBSD | | | | | - |8.0 | | | | | - | |FreeBSD | | | | - | | 7.3| | |DragonFly 2.6.0 - | | | | OpenBSD 4.7 | - | FreeBSD | | | | - |8.1 | | | | - | | | | |DragonFly 2.8.0 - | | | | OpenBSD 4.8 | - | V | | | | + | \ | ||| | + | | | |||DragonFly 2.4.0 + | | | ||OpenBSD 4.6 | + | | | ||| | + *--FreeBSD | | ||| | + |8.0 | | ||| | + | |FreeBSD | ||| | + | | 7.3| |||DragonFly 2.6.0 + | | | ||OpenBSD 4.7 | + | FreeBSD | ||| | + |8.1 | ||| | + | | | |||DragonFly 2.8.0 + | | | ||OpenBSD 4.8 | + | V | | NetBSD 5.1 | | || | | | FreeBSD 9 -current| NetBSD -current OpenBSD -current | || | | | @@ -523,6 +523,7 @@ OpenBSD 4.7 2010-05-19 [OBD] FreeBSD 8.12010-07-24 [FBD] DragonFly 2.8.02010-10-30 [DFB] OpenBSD 4.82010-11-01 [OBD] +NetBSD 5.1 2010-11-19 [NBD] Bibliography ___ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"