From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 03:17:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1EF68A56; Sun, 19 Oct 2014 03:17:04 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 85DF4DAA; Sun, 19 Oct 2014 03:17:03 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 9D27E7300A; Sun, 19 Oct 2014 05:20:38 +0200 (CEST) Date: Sun, 19 Oct 2014 05:20:38 +0200 From: Luigi Rizzo To: Adrian Chadd Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys Message-ID: <20141019032038.GA41067@onelab2.iet.unipi.it> References: <201410181936.s9IJaCwu018930@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410181936.s9IJaCwu018930@svn.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 03:17:04 -0000 On Sat, Oct 18, 2014 at 07:36:12PM +0000, Adrian Chadd wrote: > Author: adrian > Date: Sat Oct 18 19:36:11 2014 > New Revision: 273266 > URL: https://svnweb.freebsd.org/changeset/base/273266 > > Log: > Update the ULE scheduler + thread and kinfo structs to use int for cpuid > rather than u_char. > > To try and play nice with the ABI, the u_char CPU ID values are clamped > at 254. The new fields now contain the full CPU ID, or -1 for no cpu. This causes the following error with gcc: cc1: warnings being treated as errors /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c: In function 'intr_setaffinity': /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c:378: warning: comparison is always true due to limited range of data type *** Error code 1 I suppose we can use NOCPU_OLD, or cast. cheers luigi > Differential Revision: D955 > Reviewed by: jhb, kib > Sponsored by: Norse Corp, Inc. > > Modified: > head/lib/libkvm/kvm_proc.c > head/sys/compat/freebsd32/freebsd32.h > head/sys/kern/kern_proc.c > head/sys/kern/sched_ule.c > head/sys/sys/proc.h > head/sys/sys/user.h > > Modified: head/lib/libkvm/kvm_proc.c > ============================================================================== > --- head/lib/libkvm/kvm_proc.c Sat Oct 18 19:22:59 2014 (r273265) > +++ head/lib/libkvm/kvm_proc.c Sat Oct 18 19:36:11 2014 (r273266) > @@ -431,6 +431,24 @@ nopgrp: > strlcpy(kp->ki_tdname, mtd.td_name, sizeof(kp->ki_tdname)); > kp->ki_pctcpu = 0; > kp->ki_rqindex = 0; > + > + /* > + * Note: legacy fields; wraps at NO_CPU_OLD or the > + * old max CPU value as appropriate > + */ > + if (mtd.td_lastcpu == NOCPU) > + kp->ki_lastcpu_old = NOCPU_OLD; > + else if (mtd.td_lastcpu > MAXCPU_OLD) > + kp->ki_lastcpu_old = MAXCPU_OLD; > + else > + kp->ki_lastcpu_old = mtd.td_lastcpu; > + > + if (mtd.td_oncpu == NOCPU) > + kp->ki_oncpu_old = NOCPU_OLD; > + else if (mtd.td_oncpu > MAXCPU_OLD) > + kp->ki_oncpu_old = MAXCPU_OLD; > + else > + kp->ki_oncpu_old = mtd.td_oncpu; > } else { > kp->ki_stat = SZOMB; > } > > Modified: head/sys/compat/freebsd32/freebsd32.h > ============================================================================== > --- head/sys/compat/freebsd32/freebsd32.h Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/compat/freebsd32/freebsd32.h Sat Oct 18 19:36:11 2014 (r273266) > @@ -332,8 +332,8 @@ struct kinfo_proc32 { > signed char ki_nice; > char ki_lock; > char ki_rqindex; > - u_char ki_oncpu; > - u_char ki_lastcpu; > + u_char ki_oncpu_old; > + u_char ki_lastcpu_old; > char ki_tdname[TDNAMLEN+1]; > char ki_wmesg[WMESGLEN+1]; > char ki_login[LOGNAMELEN+1]; > @@ -343,6 +343,8 @@ struct kinfo_proc32 { > char ki_loginclass[LOGINCLASSLEN+1]; > char ki_sparestrings[50]; > int ki_spareints[KI_NSPARE_INT]; > + int ki_oncpu; > + int ki_lastcpu; > int ki_tracer; > int ki_flag2; > int ki_fibnum; > > Modified: head/sys/kern/kern_proc.c > ============================================================================== > --- head/sys/kern/kern_proc.c Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/kern/kern_proc.c Sat Oct 18 19:36:11 2014 (r273266) > @@ -984,6 +984,25 @@ fill_kinfo_thread(struct thread *td, str > kp->ki_wchan = td->td_wchan; > kp->ki_pri.pri_level = td->td_priority; > kp->ki_pri.pri_native = td->td_base_pri; > + > + /* > + * Note: legacy fields; clamp at the old NOCPU value and/or > + * the maximum u_char CPU value. > + */ > + if (td->td_lastcpu == NOCPU) > + kp->ki_lastcpu_old = NOCPU_OLD; > + else if (td->td_lastcpu > MAXCPU_OLD) > + kp->ki_lastcpu_old = MAXCPU_OLD; > + else > + kp->ki_lastcpu_old = td->td_lastcpu; > + > + if (td->td_oncpu == NOCPU) > + kp->ki_oncpu_old = NOCPU_OLD; > + else if (td->td_oncpu > MAXCPU_OLD) > + kp->ki_oncpu_old = MAXCPU_OLD; > + else > + kp->ki_oncpu_old = td->td_oncpu; > + > kp->ki_lastcpu = td->td_lastcpu; > kp->ki_oncpu = td->td_oncpu; > kp->ki_tdflags = td->td_flags; > @@ -1164,6 +1183,11 @@ freebsd32_kinfo_proc_out(const struct ki > CP(*ki, *ki32, ki_rqindex); > CP(*ki, *ki32, ki_oncpu); > CP(*ki, *ki32, ki_lastcpu); > + > + /* XXX TODO: wrap cpu value as appropriate */ > + CP(*ki, *ki32, ki_oncpu_old); > + CP(*ki, *ki32, ki_lastcpu_old); > + > bcopy(ki->ki_tdname, ki32->ki_tdname, TDNAMLEN + 1); > bcopy(ki->ki_wmesg, ki32->ki_wmesg, WMESGLEN + 1); > bcopy(ki->ki_login, ki32->ki_login, LOGNAMELEN + 1); > > Modified: head/sys/kern/sched_ule.c > ============================================================================== > --- head/sys/kern/sched_ule.c Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/kern/sched_ule.c Sat Oct 18 19:36:11 2014 (r273266) > @@ -90,7 +90,7 @@ dtrace_vtime_switch_func_t dtrace_vtime_ > struct td_sched { > struct runq *ts_runq; /* Run-queue we're queued on. */ > short ts_flags; /* TSF_* flags. */ > - u_char ts_cpu; /* CPU that we have affinity for. */ > + int ts_cpu; /* CPU that we have affinity for. */ > int ts_rltick; /* Real last tick, for affinity. */ > int ts_slice; /* Ticks of slice remaining. */ > u_int ts_slptime; /* Number of ticks we vol. slept */ > > Modified: head/sys/sys/proc.h > ============================================================================== > --- head/sys/sys/proc.h Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/sys/proc.h Sat Oct 18 19:36:11 2014 (r273266) > @@ -229,8 +229,8 @@ struct thread { > int td_sqqueue; /* (t) Sleepqueue queue blocked on. */ > void *td_wchan; /* (t) Sleep address. */ > const char *td_wmesg; /* (t) Reason for sleep. */ > - u_char td_lastcpu; /* (t) Last cpu we were on. */ > - u_char td_oncpu; /* (t) Which cpu we are on. */ > + int td_lastcpu; /* (t) Last cpu we were on. */ > + int td_oncpu; /* (t) Which cpu we are on. */ > volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */ > u_char td_tsqueue; /* (t) Turnstile queue blocked on. */ > short td_locks; /* (k) Count of non-spin locks. */ > @@ -601,7 +601,9 @@ struct proc { > #define p_session p_pgrp->pg_session > #define p_pgid p_pgrp->pg_id > > -#define NOCPU 0xff /* For when we aren't on a CPU. */ > +#define NOCPU (-1) /* For when we aren't on a CPU. */ > +#define NOCPU_OLD (255) > +#define MAXCPU_OLD (254) > > #define PROC_SLOCK(p) mtx_lock_spin(&(p)->p_slock) > #define PROC_SUNLOCK(p) mtx_unlock_spin(&(p)->p_slock) > > Modified: head/sys/sys/user.h > ============================================================================== > --- head/sys/sys/user.h Sat Oct 18 19:22:59 2014 (r273265) > +++ head/sys/sys/user.h Sat Oct 18 19:36:11 2014 (r273266) > @@ -84,7 +84,7 @@ > * it in two places: function fill_kinfo_proc in sys/kern/kern_proc.c and > * function kvm_proclist in lib/libkvm/kvm_proc.c . > */ > -#define KI_NSPARE_INT 6 > +#define KI_NSPARE_INT 4 > #define KI_NSPARE_LONG 12 > #define KI_NSPARE_PTR 6 > > @@ -171,8 +171,8 @@ struct kinfo_proc { > signed char ki_nice; /* Process "nice" value */ > char ki_lock; /* Process lock (prevent swap) count */ > char ki_rqindex; /* Run queue index */ > - u_char ki_oncpu; /* Which cpu we are on */ > - u_char ki_lastcpu; /* Last cpu we were on */ > + u_char ki_oncpu_old; /* Which cpu we are on (legacy) */ > + u_char ki_lastcpu_old; /* Last cpu we were on (legacy) */ > char ki_tdname[TDNAMLEN+1]; /* thread name */ > char ki_wmesg[WMESGLEN+1]; /* wchan message */ > char ki_login[LOGNAMELEN+1]; /* setlogin name */ > @@ -187,6 +187,8 @@ struct kinfo_proc { > */ > char ki_sparestrings[50]; /* spare string space */ > int ki_spareints[KI_NSPARE_INT]; /* spare room for growth */ > + int ki_oncpu; /* Which cpu we are on */ > + int ki_lastcpu; /* Last cpu we were on */ > int ki_tracer; /* Pid of tracing process */ > int ki_flag2; /* P2_* flags */ > int ki_fibnum; /* Default FIB number */ > From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 03:49:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D44CD8A; Sun, 19 Oct 2014 03:49:41 +0000 (UTC) Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [IPv6:2a00:1450:400c:c05::230]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 817CDFE0; Sun, 19 Oct 2014 03:49:40 +0000 (UTC) Received: by mail-wi0-f176.google.com with SMTP id hi2so4674447wib.3 for ; Sat, 18 Oct 2014 20:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=kkFdCSuFxh4yXQqI0QtfdwGVFn1JxN16fidWhkY2d+A=; b=o4Bh4DDUEIkM5uS6D+C1fg2ULOnMfIfuY3gmgt8rPz5GOPyoIKVkPjBxUdvQEs7cFv ji3lhPhUzhzOpgzsFvzNorfnFDoW1Z3v5/e0zr74dqKW91e79iTCQIXBOq+CNgOawc1z NvdF6SPRw2XSfM5lUrJlLiyt+r3TSkHNmVQyjuu/nv1Mf4SuUvXxj11Bwm/l931IXvX4 bcYKDddml+cJW1uyEiXn12T/vIX3f40gv5GX/BxlvqxUs4bBSGJc09gx7xbJv+indiJZ EYLtcsLJjw08lPcokH070FNr54bi74EobesY7NdL102GFtJxKjNmmWNQLisRb0icmRj4 lfhA== MIME-Version: 1.0 X-Received: by 10.180.74.4 with SMTP id p4mr9980394wiv.20.1413690578706; Sat, 18 Oct 2014 20:49:38 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 18 Oct 2014 20:49:38 -0700 (PDT) In-Reply-To: <20141019032038.GA41067@onelab2.iet.unipi.it> References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <20141019032038.GA41067@onelab2.iet.unipi.it> Date: Sat, 18 Oct 2014 20:49:38 -0700 X-Google-Sender-Auth: QxpruMivWBLyjwhLdlZkNaxz0Uk Message-ID: Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 03:49:41 -0000 On 18 October 2014 20:20, Luigi Rizzo wrote: > On Sat, Oct 18, 2014 at 07:36:12PM +0000, Adrian Chadd wrote: >> Author: adrian >> Date: Sat Oct 18 19:36:11 2014 >> New Revision: 273266 >> URL: https://svnweb.freebsd.org/changeset/base/273266 >> >> Log: >> Update the ULE scheduler + thread and kinfo structs to use int for cpuid >> rather than u_char. >> >> To try and play nice with the ABI, the u_char CPU ID values are clamped >> at 254. The new fields now contain the full CPU ID, or -1 for no cpu. > > This causes the following error with gcc: > > cc1: warnings being treated as errors > /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c: In function 'intr_setaffinity': > /usr/home/luigi/FreeBSD/head/sys/kern/kern_intr.c:378: warning: comparison is always true due to limited range of data type > *** Error code 1 > > I suppose we can use NOCPU_OLD, or cast. Hah, good catch! No, we need to convert that use of u_char to int. I'll do it when I get home. Thanks! -a From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 03:51:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 65112EDE; Sun, 19 Oct 2014 03:51:55 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A685E100; Sun, 19 Oct 2014 03:51:54 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id d1so3863715wiv.6 for ; Sat, 18 Oct 2014 20:51:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=wdV0UVTWZ/32p2aWPJpaedb3lW8yOVOw5S1+8TuN2Rc=; b=p/jxTd3iy3udHfUcJOin0lfgBjUhg2cfJSc1hjwBPzd3s62XPztPf3JAqt4a35gS6L qc1/a96PH/h1SNaRduX3RlM7cQlD4+FDhZbjnm11VPEj/9WP+T6Ur0oY2P1gmyjJPXff nrGow8SB9fus3JX7HbJrSnuG/QUOCv8+9oK8BOEaQHnL5TS+kD6kszbvY6QI7pOrPDMf ozIwFqg90eTet5g3bptS5ZYa6eBcO1QyS3vcW9hcj72J7l2OZeE8WhmsObU1Nm2YmqyQ A0xz9Uq3l00V31XuGqMIguQmGGjicdmlFxe/9GeSboo8CthcKlcnRHX+wDKeWTpqnuca 7GEQ== MIME-Version: 1.0 X-Received: by 10.180.85.201 with SMTP id j9mr10014964wiz.26.1413690712893; Sat, 18 Oct 2014 20:51:52 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 18 Oct 2014 20:51:52 -0700 (PDT) In-Reply-To: References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <20141019032038.GA41067@onelab2.iet.unipi.it> Date: Sat, 18 Oct 2014 20:51:52 -0700 X-Google-Sender-Auth: hQzyHvxEdOEgfE9vZLhhw9B2jf4 Message-ID: Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 03:51:55 -0000 .. actually, try this: adrian@testbox1:~/work/freebsd/head/src % svn diff sys/kern/ Index: sys/kern/kern_intr.c =================================================================== --- sys/kern/kern_intr.c (revision 272839) +++ sys/kern/kern_intr.c (working copy) @@ -362,8 +362,7 @@ { struct intr_event *ie; cpuset_t *mask; - u_char cpu; - int n; + int cpu, n; mask = m; cpu = NOCPU; @@ -377,7 +376,7 @@ continue; if (cpu != NOCPU) return (EINVAL); - cpu = (u_char)n; + cpu = n; } } ie = intr_lookup(irq); -a From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 04:38:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6E7B21C; Sun, 19 Oct 2014 04:38:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8120400; Sun, 19 Oct 2014 04:38:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9J4c3J8070362; Sun, 19 Oct 2014 04:38:03 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9J4c3pZ070361; Sun, 19 Oct 2014 04:38:03 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201410190438.s9J4c3pZ070361@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 19 Oct 2014 04:38:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273270 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 04:38:04 -0000 Author: adrian Date: Sun Oct 19 04:38:02 2014 New Revision: 273270 URL: https://svnweb.freebsd.org/changeset/base/273270 Log: Convert a missed u_char cpu -> int cpu. This was caught by a gcc build. Reported by: luigi Sponsored by: Norse Corp, Inc. Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Sat Oct 18 22:49:18 2014 (r273269) +++ head/sys/kern/kern_intr.c Sun Oct 19 04:38:02 2014 (r273270) @@ -362,8 +362,7 @@ intr_setaffinity(int irq, void *m) { struct intr_event *ie; cpuset_t *mask; - u_char cpu; - int n; + int cpu, n; mask = m; cpu = NOCPU; @@ -377,7 +376,7 @@ intr_setaffinity(int irq, void *m) continue; if (cpu != NOCPU) return (EINVAL); - cpu = (u_char)n; + cpu = n; } } ie = intr_lookup(irq); From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 04:38:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A99EE361; Sun, 19 Oct 2014 04:38:37 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB00A5E3; Sun, 19 Oct 2014 04:38:36 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id hi2so3885145wib.8 for ; Sat, 18 Oct 2014 21:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=5q1hVFyoU0zYqNjhfLq9xup+wRw1clGnYna6FQ87aQI=; b=xsXP3HmH0jzF4vg6bEfPTzCsS+hRyGWFfPyz9Wdk8KxI69b8rksJ2JVVyxyDI8mKby +pVDhsUm2c87at8eUlHoahboVXdUGILvE5IjtCGXoaX36pZjc+GBUVJV6GkTV7pOQ6iV 1OxvnrRs19khR1blrnRNXKqXzaB7+G7Z1q/Rc/c5GXE+1w0QbK8rhFvoeGZth1H4+Ywr H7fD5IEnj8J22X/7a1WEUrztwF9qqUBxAihbMj2fE18Iqgiwkjb8r97Us18F4/z7dwcX qQSKm5lS/DtgxDNpzT12mkZgrGoZYEb+ikYq7eh8RoNRNy8quYm7wgCbPjPktINRW392 bZlA== MIME-Version: 1.0 X-Received: by 10.180.188.41 with SMTP id fx9mr9936328wic.59.1413693514446; Sat, 18 Oct 2014 21:38:34 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Sat, 18 Oct 2014 21:38:34 -0700 (PDT) In-Reply-To: References: <201410181936.s9IJaCwu018930@svn.freebsd.org> <20141019032038.GA41067@onelab2.iet.unipi.it> Date: Sat, 18 Oct 2014 21:38:34 -0700 X-Google-Sender-Auth: fSGx6Ce1UTcL9IodKTin37i2vVU Message-ID: Subject: Re: svn commit: r273266 - in head: lib/libkvm sys/compat/freebsd32 sys/kern sys/sys From: Adrian Chadd To: Luigi Rizzo Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 04:38:37 -0000 Rebuilt, tested, committed to -HEAD. Thanks! -a On 18 October 2014 20:51, Adrian Chadd wrote: > .. actually, try this: > > adrian@testbox1:~/work/freebsd/head/src % svn diff sys/kern/ > Index: sys/kern/kern_intr.c > =================================================================== > --- sys/kern/kern_intr.c (revision 272839) > +++ sys/kern/kern_intr.c (working copy) > @@ -362,8 +362,7 @@ > { > struct intr_event *ie; > cpuset_t *mask; > - u_char cpu; > - int n; > + int cpu, n; > > mask = m; > cpu = NOCPU; > @@ -377,7 +376,7 @@ > continue; > if (cpu != NOCPU) > return (EINVAL); > - cpu = (u_char)n; > + cpu = n; > } > } > ie = intr_lookup(irq); > > > > > -a From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 06:59:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A4CF4CCC; Sun, 19 Oct 2014 06:59:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F5E8BA; Sun, 19 Oct 2014 06:59:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9J6xYlf034749; Sun, 19 Oct 2014 06:59:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9J6xXQE034746; Sun, 19 Oct 2014 06:59:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410190659.s9J6xXQE034746@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 19 Oct 2014 06:59:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273271 - in head/sys: fs/tmpfs kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 06:59:34 -0000 Author: mjg Date: Sun Oct 19 06:59:33 2014 New Revision: 273271 URL: https://svnweb.freebsd.org/changeset/base/273271 Log: Provide vfs suspension support only for filesystems which need it. Need is expressed by providing vfs_susp_clean function in vfsops. Differential Revision: D952 Reviewed by: kib (previous version) MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/kern/vfs_vnops.c head/sys/sys/mount.h Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Oct 19 04:38:02 2014 (r273270) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Sun Oct 19 06:59:33 2014 (r273271) @@ -427,6 +427,14 @@ tmpfs_sync(struct mount *mp, int waitfor } /* + * A stub created so that vfs does vn_start_write for this filesystem + */ +static void +tmpfs_susp_clean(struct mount *mp) +{ +} + +/* * tmpfs vfs operations. */ @@ -437,5 +445,6 @@ struct vfsops tmpfs_vfsops = { .vfs_statfs = tmpfs_statfs, .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, + .vfs_susp_clean = tmpfs_susp_clean, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Oct 19 04:38:02 2014 (r273270) +++ head/sys/kern/vfs_vnops.c Sun Oct 19 06:59:33 2014 (r273271) @@ -1572,6 +1572,25 @@ vn_closefile(fp, td) return (error); } +static bool +vn_suspendable_mp(struct mount *mp) +{ + + return (mp->mnt_op->vfs_susp_clean != NULL); +} + +static bool +vn_suspendable(struct vnode *vp, struct mount **mpp) +{ + + if (vp != NULL) + *mpp = vp->v_mount; + if (*mpp == NULL) + return (false); + + return (vn_suspendable_mp(*mpp)); +} + /* * Preparing to start a filesystem write operation. If the operation is * permitted, then we bump the count of operations in progress and @@ -1621,6 +1640,9 @@ vn_start_write(vp, mpp, flags) struct mount *mp; int error; + if (!vn_suspendable(vp, mpp)) + return (0); + error = 0; /* * If a vnode is provided, get and return the mount point that @@ -1667,6 +1689,9 @@ vn_start_secondary_write(vp, mpp, flags) struct mount *mp; int error; + if (!vn_suspendable(vp, mpp)) + return (0); + retry: if (vp != NULL) { if ((error = VOP_GETWRITEMOUNT(vp, mpp)) != 0) { @@ -1724,7 +1749,7 @@ void vn_finished_write(mp) struct mount *mp; { - if (mp == NULL) + if (mp == NULL || !vn_suspendable_mp(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1747,7 +1772,7 @@ void vn_finished_secondary_write(mp) struct mount *mp; { - if (mp == NULL) + if (mp == NULL || !vn_suspendable_mp(mp)) return; MNT_ILOCK(mp); MNT_REL(mp); @@ -1770,6 +1795,8 @@ vfs_write_suspend(struct mount *mp, int { int error; + MPASS(vn_suspendable_mp(mp)); + MNT_ILOCK(mp); if (mp->mnt_susp_owner == curthread) { MNT_IUNLOCK(mp); @@ -1811,6 +1838,8 @@ void vfs_write_resume(struct mount *mp, int flags) { + MPASS(vn_suspendable_mp(mp)); + MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { KASSERT(mp->mnt_susp_owner == curthread, ("mnt_susp_owner")); @@ -1844,6 +1873,7 @@ vfs_write_suspend_umnt(struct mount *mp) { int error; + MPASS(vn_suspendable_mp(mp)); KASSERT((curthread->td_pflags & TDP_IGNSUSP) == 0, ("vfs_write_suspend_umnt: recursed")); Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Sun Oct 19 04:38:02 2014 (r273270) +++ head/sys/sys/mount.h Sun Oct 19 06:59:33 2014 (r273271) @@ -754,11 +754,10 @@ vfs_statfs_t __vfs_statfs; _rc; }) #define VFS_SUSP_CLEAN(MP) do { \ - if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \ - VFS_PROLOGUE(MP); \ - (*(MP)->mnt_op->vfs_susp_clean)(MP); \ - VFS_EPILOGUE(MP); \ - } \ + MPASS(*(MP)->mnt_op->vfs_susp_clean != NULL); \ + VFS_PROLOGUE(MP); \ + (*(MP)->mnt_op->vfs_susp_clean)(MP); \ + VFS_EPILOGUE(MP); \ } while (0) #define VFS_RECLAIM_LOWERVP(MP, VP) do { \ From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 07:34:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 478112FB; Sun, 19 Oct 2014 07:34:47 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "funkthat.com", Issuer "funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0ADA43E8; Sun, 19 Oct 2014 07:34:46 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s9J7YiSE000534 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 19 Oct 2014 00:34:45 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s9J7YiE9000533; Sun, 19 Oct 2014 00:34:44 -0700 (PDT) (envelope-from jmg) Date: Sun, 19 Oct 2014 00:34:44 -0700 From: John-Mark Gurney To: Andrew Turner Subject: Re: svn commit: r273251 - in head/sys: arm/arm arm/include conf Message-ID: <20141019073444.GC82214@funkthat.com> References: <201410181338.s9IDc5NE047022@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410181338.s9IDc5NE047022@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sun, 19 Oct 2014 00:34:45 -0700 (PDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 07:34:47 -0000 Andrew Turner wrote this message on Sat, Oct 18, 2014 at 13:38 +0000: > Author: andrew > Date: Sat Oct 18 13:38:04 2014 > New Revision: 273251 > URL: https://svnweb.freebsd.org/changeset/base/273251 > > Log: > Add an elf not so kgdb detects the kernel as a FreeBSD elf file. The > ELFNOTE macro is based on one from the FreeBSD/ARM Xen tree [1]. > > Obtained from: Julien Grall [1] Thanks for committing! -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 11:06:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8C28D5E; Sun, 19 Oct 2014 11:06:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AFB1958; Sun, 19 Oct 2014 11:06:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JB6tln053762; Sun, 19 Oct 2014 11:06:55 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JB6toW053761; Sun, 19 Oct 2014 11:06:55 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410191106.s9JB6toW053761@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Sun, 19 Oct 2014 11:06:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273273 - head/contrib/openpam/lib/libpam X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:06:55 -0000 Author: des Date: Sun Oct 19 11:06:54 2014 New Revision: 273273 URL: https://svnweb.freebsd.org/changeset/base/273273 Log: Merge upstream r825: fix line continuation in whitespace Modified: head/contrib/openpam/lib/libpam/openpam_readword.c Directory Properties: head/contrib/openpam/ (props changed) Modified: head/contrib/openpam/lib/libpam/openpam_readword.c ============================================================================== --- head/contrib/openpam/lib/libpam/openpam_readword.c Sun Oct 19 08:47:27 2014 (r273272) +++ head/contrib/openpam/lib/libpam/openpam_readword.c Sun Oct 19 11:06:54 2014 (r273273) @@ -55,18 +55,35 @@ openpam_readword(FILE *f, int *lineno, s { char *word; size_t size, len; - int ch, comment, escape, quote; + int ch, escape, quote; int serrno; errno = 0; /* skip initial whitespace */ - comment = 0; - while ((ch = getc(f)) != EOF && ch != '\n') { - if (ch == '#') - comment = 1; - if (!is_lws(ch) && !comment) + escape = quote = 0; + while ((ch = getc(f)) != EOF) { + if (ch == '\n') { + /* either EOL or line continuation */ + if (!escape) + break; + if (lineno != NULL) + ++*lineno; + escape = 0; + } else if (escape) { + /* escaped something else */ + break; + } else if (ch == '#') { + /* comment: until EOL, no continuation */ + while ((ch = getc(f)) != EOF) + if (ch == '\n') + break; break; + } else if (ch == '\\') { + escape = 1; + } else if (!is_ws(ch)) { + break; + } } if (ch == EOF) return (NULL); @@ -76,7 +93,6 @@ openpam_readword(FILE *f, int *lineno, s word = NULL; size = len = 0; - escape = quote = 0; while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { if (ch == '\\' && !escape && quote != '\'') { /* escape next character */ @@ -90,7 +106,7 @@ openpam_readword(FILE *f, int *lineno, s } else if (ch == quote && !escape) { /* end quote */ quote = 0; - } else if (ch == '\n' && escape && quote != '\'') { + } else if (ch == '\n' && escape) { /* line continuation */ escape = 0; } else { From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 11:15:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05350F27; Sun, 19 Oct 2014 11:15:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5496A2E; Sun, 19 Oct 2014 11:15:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JBFJfJ058371; Sun, 19 Oct 2014 11:15:19 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JBFJxA058370; Sun, 19 Oct 2014 11:15:19 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410191115.s9JBFJxA058370@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 19 Oct 2014 11:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273274 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:15:20 -0000 Author: melifaro Date: Sun Oct 19 11:15:19 2014 New Revision: 273274 URL: https://svnweb.freebsd.org/changeset/base/273274 Log: Perform more checks on the number of tables supplied by user. Modified: head/sys/netpfil/ipfw/ip_fw_table.c Modified: head/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table.c Sun Oct 19 11:06:54 2014 (r273273) +++ head/sys/netpfil/ipfw/ip_fw_table.c Sun Oct 19 11:15:19 2014 (r273274) @@ -1489,6 +1489,21 @@ destroy_table(struct ip_fw_chain *ch, st return (0); } +static uint32_t +roundup2p(uint32_t v) +{ + + v--; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + v++; + + return (v); +} + /* * Grow tables index. * @@ -1505,8 +1520,12 @@ ipfw_resize_tables(struct ip_fw_chain *c int i, new_blocks; /* Check new value for validity */ + if (ntables == 0) + return (EINVAL); if (ntables > IPFW_TABLES_MAX) ntables = IPFW_TABLES_MAX; + /* Alight to nearest power of 2 */ + ntables = (unsigned int)roundup2p(ntables); /* Allocate new pointers */ tablestate = malloc(ntables * sizeof(struct table_info), From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 11:59:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5AB307C2; Sun, 19 Oct 2014 11:59:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4660DD65; Sun, 19 Oct 2014 11:59:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JBxIrV077543; Sun, 19 Oct 2014 11:59:18 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JBxFZh077525; Sun, 19 Oct 2014 11:59:15 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201410191159.s9JBxFZh077525@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 19 Oct 2014 11:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273276 - in head/bin/sh: . tests/parser X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 11:59:18 -0000 Author: jilles Date: Sun Oct 19 11:59:15 2014 New Revision: 273276 URL: https://svnweb.freebsd.org/changeset/base/273276 Log: sh: Allow backslash-newline continuation in more places: * directly after a $ * directly after ${ * between the characters of a multi-character operator token * within a parameter name Added: head/bin/sh/tests/parser/line-cont10.0 (contents, props changed) head/bin/sh/tests/parser/line-cont11.0 (contents, props changed) head/bin/sh/tests/parser/line-cont4.0 (contents, props changed) head/bin/sh/tests/parser/line-cont5.0 (contents, props changed) head/bin/sh/tests/parser/line-cont6.0 (contents, props changed) head/bin/sh/tests/parser/line-cont7.0 (contents, props changed) head/bin/sh/tests/parser/line-cont8.0 (contents, props changed) head/bin/sh/tests/parser/line-cont9.0 (contents, props changed) Modified: head/bin/sh/parser.c head/bin/sh/tests/parser/Makefile Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Sun Oct 19 11:31:23 2014 (r273275) +++ head/bin/sh/parser.c Sun Oct 19 11:59:15 2014 (r273276) @@ -125,6 +125,7 @@ static void consumetoken(int); static void synexpect(int) __dead2; static void synerror(const char *) __dead2; static void setprompt(int); +static int pgetc_linecont(void); static void * @@ -899,17 +900,17 @@ xxreadtoken(void) case PEOF: RETURN(TEOF); case '&': - if (pgetc() == '&') + if (pgetc_linecont() == '&') RETURN(TAND); pungetc(); RETURN(TBACKGND); case '|': - if (pgetc() == '|') + if (pgetc_linecont() == '|') RETURN(TOR); pungetc(); RETURN(TPIPE); case ';': - c = pgetc(); + c = pgetc_linecont(); if (c == ';') RETURN(TENDCASE); else if (c == '&') @@ -991,7 +992,7 @@ parseredir(char *out, int c) np = (union node *)stalloc(sizeof (struct nfile)); if (c == '>') { np->nfile.fd = 1; - c = pgetc(); + c = pgetc_linecont(); if (c == '>') np->type = NAPPEND; else if (c == '&') @@ -1004,7 +1005,7 @@ parseredir(char *out, int c) } } else { /* c == '<' */ np->nfile.fd = 0; - c = pgetc(); + c = pgetc_linecont(); if (c == '<') { if (sizeof (struct nfile) != sizeof (struct nhere)) { np = (union node *)stalloc(sizeof (struct nhere)); @@ -1013,7 +1014,7 @@ parseredir(char *out, int c) np->type = NHERE; heredoc = (struct heredoc *)stalloc(sizeof (struct heredoc)); heredoc->here = np; - if ((c = pgetc()) == '-') { + if ((c = pgetc_linecont()) == '-') { heredoc->striptabs = 1; } else { heredoc->striptabs = 0; @@ -1094,25 +1095,12 @@ parsebackq(char *out, struct nodelist ** needprompt = 0; } CHECKSTRSPACE(2, oout); - c = pgetc(); + c = pgetc_linecont(); if (c == '`') break; switch (c) { case '\\': - if ((c = pgetc()) == '\n') { - plinno++; - if (doprompt) - setprompt(2); - else - setprompt(0); - /* - * If eating a newline, avoid putting - * the newline into the new character - * stream (via the USTPUTC after the - * switch). - */ - continue; - } + c = pgetc(); if (c != '\\' && c != '`' && c != '$' && (!dblquote || c != '"')) USTPUTC('\\', oout); @@ -1507,7 +1495,7 @@ readtoken1(int firstc, char const *initi USTPUTC(c, out); --state[level].parenlevel; } else { - if (pgetc() == ')') { + if (pgetc_linecont() == ')') { if (level > 0 && state[level].category == TSTATE_ARITH) { level--; @@ -1593,9 +1581,9 @@ parsesub: { int length; int c1; - c = pgetc(); + c = pgetc_linecont(); if (c == '(') { /* $(command) or $((arith)) */ - if (pgetc() == '(') { + if (pgetc_linecont() == '(') { PARSEARITH(); } else { pungetc(); @@ -1613,7 +1601,7 @@ parsesub: { flags = 0; if (c == '{') { bracketed_name = 1; - c = pgetc(); + c = pgetc_linecont(); subtype = 0; } varname: @@ -1621,7 +1609,7 @@ varname: length = 0; do { STPUTC(c, out); - c = pgetc(); + c = pgetc_linecont(); length++; } while (!is_eof(c) && is_in_name(c)); if (length == 6 && @@ -1640,22 +1628,22 @@ varname: if (bracketed_name) { do { STPUTC(c, out); - c = pgetc(); + c = pgetc_linecont(); } while (is_digit(c)); } else { STPUTC(c, out); - c = pgetc(); + c = pgetc_linecont(); } } else if (is_special(c)) { c1 = c; - c = pgetc(); + c = pgetc_linecont(); if (subtype == 0 && c1 == '#') { subtype = VSLENGTH; if (strchr(types, c) == NULL && c != ':' && c != '#' && c != '%') goto varname; c1 = c; - c = pgetc(); + c = pgetc_linecont(); if (c1 != '}' && c == '}') { pungetc(); c = c1; @@ -1680,7 +1668,7 @@ varname: switch (c) { case ':': flags |= VSNUL; - c = pgetc(); + c = pgetc_linecont(); /*FALLTHROUGH*/ default: p = strchr(types, c); @@ -1700,7 +1688,7 @@ varname: int cc = c; subtype = c == '#' ? VSTRIMLEFT : VSTRIMRIGHT; - c = pgetc(); + c = pgetc_linecont(); if (c == cc) subtype++; else @@ -1909,6 +1897,29 @@ setprompt(int which) } } +static int +pgetc_linecont(void) +{ + int c; + + while ((c = pgetc_macro()) == '\\') { + c = pgetc(); + if (c == '\n') { + plinno++; + if (doprompt) + setprompt(2); + else + setprompt(0); + } else { + pungetc(); + /* Allow the backslash to be pushed back. */ + pushstring("\\", 1, NULL); + return (pgetc()); + } + } + return (c); +} + /* * called by editline -- any expansions to the prompt * should be added here. Modified: head/bin/sh/tests/parser/Makefile ============================================================================== --- head/bin/sh/tests/parser/Makefile Sun Oct 19 11:31:23 2014 (r273275) +++ head/bin/sh/tests/parser/Makefile Sun Oct 19 11:59:15 2014 (r273276) @@ -58,6 +58,14 @@ FILES+= heredoc12.0 FILES+= line-cont1.0 FILES+= line-cont2.0 FILES+= line-cont3.0 +FILES+= line-cont4.0 +FILES+= line-cont5.0 +FILES+= line-cont6.0 +FILES+= line-cont7.0 +FILES+= line-cont8.0 +FILES+= line-cont9.0 +FILES+= line-cont10.0 +FILES+= line-cont11.0 FILES+= no-space1.0 FILES+= no-space2.0 FILES+= only-redir1.0 Added: head/bin/sh/tests/parser/line-cont10.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont10.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,18 @@ +# $FreeBSD$ + +v=XaaaXbbbX +[ "${v\ +#\ +*\ +a}.${v\ +#\ +#\ +*\ +a}.${v\ +%\ +b\ +*}.${v\ +%\ +%\ +b\ +*}" = aaXbbbX.XbbbX.XaaaXbb.XaaaX ] Added: head/bin/sh/tests/parser/line-cont11.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont11.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +T=$(mktemp "${TMPDIR:-/tmp}/sh-test.XXXXXXXX") || exit +trap 'rm -f -- "$T"' 0 +w='#A' +# A naive pgetc_linecont() would push back two characters here, which +# fails if a new buffer is read between the two characters. +c='${w#\#}' +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +c=$c$c$c$c +printf 'v=%s\n' "$c" >"$T" +. "$T" +if [ "${#v}" != 4096 ]; then + echo "Length is bad (${#v})" + exit 3 +fi +case $v in +*[!A]*) echo "Content is bad"; exit 3 ;; +esac Added: head/bin/sh/tests/parser/line-cont4.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont4.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +v=abcd +[ "$\ +v.$\ +{v}.${\ +v}.${v\ +}" = abcd.abcd.abcd.abcd ] Added: head/bin/sh/tests/parser/line-cont5.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont5.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +bad=1 +case x in +x\ +) ;\ +; *) exit 7 +esac &\ +& bad= &\ +& : >\ +>/dev/null + +false |\ +| [ -z "$bad" ] Added: head/bin/sh/tests/parser/line-cont6.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont6.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,23 @@ +# $FreeBSD$ + +v0\ +=abc + +v=$(cat <\ +<\ +E\ +O\ +F +${v0}d +EOF +) + +w=$(cat <\ +<\ +-\ +EOF + efgh +EOF +) + +[ "$v.$w" = "abcd.efgh" ] Added: head/bin/sh/tests/parser/line-cont7.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont7.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +[ "$(\ +( +1\ ++ 1)\ +)" = 2 ] Added: head/bin/sh/tests/parser/line-cont8.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont8.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +set -- a b c d e f g h i j +[ "${1\ +0\ +}" = j ] Added: head/bin/sh/tests/parser/line-cont9.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/parser/line-cont9.0 Sun Oct 19 11:59:15 2014 (r273276) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +[ "${$\ +:\ ++\ +xyz}" = xyz ] From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 12:03:13 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B188A8E; Sun, 19 Oct 2014 12:03:13 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 426A7E16; Sun, 19 Oct 2014 12:03:11 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id PAA06395; Sun, 19 Oct 2014 15:03:04 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XfpCR-000P9z-QS; Sun, 19 Oct 2014 15:03:03 +0300 Message-ID: <5443A83F.5090807@FreeBSD.org> Date: Sun, 19 Oct 2014 15:02:07 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: "Alexander V. Chernikov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw References: <201410191115.s9JBFJxA058370@svn.freebsd.org> In-Reply-To: <201410191115.s9JBFJxA058370@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 12:03:13 -0000 On 19/10/2014 14:15, Alexander V. Chernikov wrote: > +static uint32_t > +roundup2p(uint32_t v) > +{ > + > + v--; > + v |= v >> 1; > + v |= v >> 2; > + v |= v >> 4; > + v |= v >> 8; > + v |= v >> 16; > + v++; > + > + return (v); > +} I think that on platforms where an optimized version of fls() is available that would work faster than this cool piece of bit magic. -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 16:26:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 01DCDB93; Sun, 19 Oct 2014 16:26:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DFEE0913; Sun, 19 Oct 2014 16:26:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JGQoL7030676; Sun, 19 Oct 2014 16:26:50 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JGQoul030672; Sun, 19 Oct 2014 16:26:50 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410191626.s9JGQoul030672@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Sun, 19 Oct 2014 16:26:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273278 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/beri X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 16:26:51 -0000 Author: br Date: Sun Oct 19 16:26:49 2014 New Revision: 273278 URL: https://svnweb.freebsd.org/changeset/base/273278 Log: Add driver for BERI soft processor 'ring buffer' device. Ring device provides a way for communicate to BERI peripherals such as BERI debug unit and console. Sponsored by: DARPA, AFRL Added: head/sys/arm/conf/SOCKIT-BERI (contents, props changed) head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts (contents, props changed) head/sys/dev/beri/ head/sys/dev/beri/beri_ring.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Sun Oct 19 12:11:25 2014 (r273277) +++ head/sys/arm/altera/socfpga/files.socfpga Sun Oct 19 16:26:49 2014 (r273278) @@ -21,3 +21,4 @@ arm/altera/socfpga/socfpga_mp.c option dev/dwc/if_dwc.c optional dwc dev/mmc/host/dwmmc.c optional dwmmc +dev/beri/beri_ring.c optional beri_ring Added: head/sys/arm/conf/SOCKIT-BERI ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/conf/SOCKIT-BERI Sun Oct 19 16:26:49 2014 (r273278) @@ -0,0 +1,140 @@ +# Kernel configuration for Terasic SoCKit (Altera Cyclone V SoC). +# +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: +# +# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident SOCKIT-BERI +include "../altera/socfpga/std.socfpga" + +makeoptions MODULES_OVERRIDE="" + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options HZ=100 +options SCHED_4BSD # 4BSD scheduler +options INET # InterNETworking +options INET6 # IPv6 communications protocols +options GEOM_PART_BSD # BSD partition scheme +options GEOM_PART_MBR # MBR partition scheme +options GEOM_PART_GPT # GUID partition tables +options TMPFS # Efficient memory filesystem +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B real-time extensions +options KBD_INSTALL_CDEV +options PREEMPTION +options FREEBSD_BOOT_LOADER +options VFP # vfp/neon + +options SMP + +# Debugging +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +options BREAK_TO_DEBUGGER +#options VERBOSE_SYSINIT # Enable verbose sysinit messages +options KDB +options DDB # Enable the kernel debugger +options INVARIANTS # Enable calls of extra sanity checking +options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options DIAGNOSTIC + +# NFS support +options NFSCL # Network Filesystem Client +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCLIENT + +# Uncomment this for NFS root +#options NFS_ROOT # NFS usable as /, requires NFSCL +#options BOOTP_NFSROOT +#options BOOTP_COMPAT +#options BOOTP +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 + +device mmc # mmc/sd bus +device mmcsd # mmc/sd flash cards +device dwmmc + +options ROOTDEVNAME=\"ufs:/dev/mmcsd0s4\" + +# Pseudo devices + +device loop +device random +device pty +device md +device gpio + +# USB support +options USB_HOST_ALIGN=64 # Align usb buffers to cache line size. +device usb +options USB_DEBUG +#options USB_REQ_DEBUG +#options USB_VERBOSE +#device musb +device dwcotg + +device umass +device scbus # SCSI bus (required for ATA/SCSI) +device da # Direct Access (disks) +device pass + +# Serial ports +device uart +device uart_ns8250 + +# I2C (TWSI) +device iic +device iicbus + +# SPI +device spibus + +# BERI specific +device beri_ring + +# Ethernet +device ether +device mii +device smsc +device smscphy +device dwc + +# USB ethernet support, requires miibus +device miibus +device axe # ASIX Electronics USB Ethernet +device bpf # Berkeley packet filter + +#FDT +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=socfpga-sockit-beri.dts Added: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Sun Oct 19 16:26:49 2014 (r273278) @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/dts-v1/; + +/include/ "socfpga.dtsi" + +/ { + model = "Terasic SoCKit"; + compatible = "altr,socfpga-cyclone5", "altr,socfpga"; + + /* Reserve first page for secondary CPU trampoline code */ + memreserve = < 0x00000000 0x1000 >; + + memory { + device_type = "memory"; + reg = < 0x00000000 0x40000000 >; /* 1G RAM */ + }; + + SOC: socfpga { + serial0: serial@ffc02000 { + status = "okay"; + }; + + usb1: usb@ffb40000 { + status = "okay"; + }; + + gmac1: ethernet@ff702000 { + status = "okay"; + }; + + mmc: dwmmc@ff704000 { + status = "okay"; + num-slots = <1>; + supports-highspeed; + broken-cd; + bus-frequency = <25000000>; + + slot@0 { + reg = <0>; + bus-width = <4>; + }; + }; + + beri_debug: ring@c0000000 { + compatible = "sri-cambridge,beri-ring"; + reg = <0xc0000000 0x3000>; + interrupts = < 72 73 >; + interrupt-parent = <&GIC>; + device_name = "beri_debug"; + data_size = <0x1000>; + data_read = <0x0>; + data_write = <0x1000>; + control_read = <0x2000>; + control_write = <0x2010>; + status = "okay"; + }; + + beri_console: ring@c0004000 { + compatible = "sri-cambridge,beri-ring"; + reg = <0xc0004000 0x3000>; + interrupts = < 74 75 >; + interrupt-parent = <&GIC>; + device_name = "beri_console"; + data_size = <0x1000>; + data_read = <0x0>; + data_write = <0x1000>; + control_read = <0x2000>; + control_write = <0x2010>; + status = "okay"; + }; + }; + + chosen { + bootargs = "-v"; + stdin = "serial0"; + stdout = "serial0"; + }; +}; Added: head/sys/dev/beri/beri_ring.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/beri/beri_ring.c Sun Oct 19 16:26:49 2014 (r273278) @@ -0,0 +1,529 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * SRI-Cambridge BERI soft processor <-> ARM core ring buffer. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#define READ4(_sc, _reg) \ + bus_read_4((_sc)->res[0], _reg) +#define WRITE4(_sc, _reg, _val) \ + bus_write_4((_sc)->res[0], _reg, _val) + +#define CDES_INT_EN (1 << 15) +#define CDES_CAUSE_MASK 0x3 +#define CDES_CAUSE_SHIFT 13 +#define DEVNAME_MAXLEN 256 + +typedef struct +{ + uint16_t cdes; + uint16_t interrupt_level; + uint16_t in; + uint16_t out; +} control_reg_t; + +struct beri_softc { + struct resource *res[3]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + struct cdev *cdev; + device_t dev; + void *read_ih; + void *write_ih; + struct selinfo beri_rsel; + struct mtx beri_mtx; + int opened; + + char devname[DEVNAME_MAXLEN]; + int control_read; + int control_write; + int data_read; + int data_write; + int data_size; +}; + +static struct resource_spec beri_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE }, + { -1, 0 } +}; + +static control_reg_t +get_control_reg(struct beri_softc *sc, int dir) +{ + uint32_t offset; + uint16_t dst[4]; + control_reg_t c; + uint16_t *cp; + int i; + + cp = (uint16_t *)&c; + + offset = dir ? sc->control_write : sc->control_read; + ((uint32_t *)dst)[0] = READ4(sc, offset); + ((uint32_t *)dst)[1] = READ4(sc, offset + 4); + + for (i = 0; i < 4; i++) + cp[i] = dst[3 - i]; + + return (c); +} + +static void +set_control_reg(struct beri_softc *sc, int dir, control_reg_t *c) +{ + uint32_t offset; + uint16_t src[4]; + uint16_t *cp; + int i; + + cp = (uint16_t *)c; + + for (i = 0; i < 4; i++) + src[3 - i] = cp[i]; + + offset = dir ? sc->control_write : sc->control_read; + WRITE4(sc, offset + 0, ((uint32_t *)src)[0]); + WRITE4(sc, offset + 4, ((uint32_t *)src)[1]); +} + +static int +get_stock(struct beri_softc *sc, int dir, control_reg_t *c) +{ + uint32_t fill; + + fill = (c->in - c->out + sc->data_size) % sc->data_size; + + if (dir) + return (sc->data_size - fill - 1); + else + return (fill); +} + +static void +beri_intr_write(void *arg) +{ + struct beri_softc *sc; + control_reg_t c; + + sc = arg; + + c = get_control_reg(sc, 1); + if (c.cdes & CDES_INT_EN) { + c.cdes &= ~(CDES_INT_EN); + set_control_reg(sc, 1, &c); + } + + mtx_lock(&sc->beri_mtx); + selwakeuppri(&sc->beri_rsel, PZERO + 1); + KNOTE_LOCKED(&sc->beri_rsel.si_note, 0); + mtx_unlock(&sc->beri_mtx); +} + +static void +beri_intr_read(void *arg) +{ + struct beri_softc *sc; + control_reg_t c; + + sc = arg; + + c = get_control_reg(sc, 0); + if (c.cdes & CDES_INT_EN) { + c.cdes &= ~(CDES_INT_EN); + set_control_reg(sc, 0, &c); + } + + mtx_lock(&sc->beri_mtx); + selwakeuppri(&sc->beri_rsel, PZERO + 1); + KNOTE_LOCKED(&sc->beri_rsel.si_note, 0); + mtx_unlock(&sc->beri_mtx); +} + +static int +beri_open(struct cdev *dev, int flags __unused, + int fmt __unused, struct thread *td __unused) +{ + struct beri_softc *sc; + control_reg_t c; + + sc = dev->si_drv1; + + if (sc->opened) + return (1); + + /* Setup interrupt handlers */ + if (bus_setup_intr(sc->dev, sc->res[1], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, beri_intr_read, sc, &sc->read_ih)) { + device_printf(sc->dev, "Unable to setup read intr\n"); + return (1); + } + if (bus_setup_intr(sc->dev, sc->res[2], INTR_TYPE_BIO | INTR_MPSAFE, + NULL, beri_intr_write, sc, &sc->write_ih)) { + device_printf(sc->dev, "Unable to setup write intr\n"); + return (1); + } + + sc->opened = 1; + + /* Clear write buffer */ + c = get_control_reg(sc, 1); + c.in = c.out; + c.cdes = 0; + set_control_reg(sc, 1, &c); + + /* Clear read buffer */ + c = get_control_reg(sc, 0); + c.out = c.in; + c.cdes = 0; + set_control_reg(sc, 0, &c); + + return (0); +} + +static int +beri_close(struct cdev *dev, int flags __unused, + int fmt __unused, struct thread *td __unused) +{ + struct beri_softc *sc; + + sc = dev->si_drv1; + + if (sc->opened) { + sc->opened = 0; + + /* Unsetup interrupt handlers */ + bus_teardown_intr(sc->dev, sc->res[1], sc->read_ih); + bus_teardown_intr(sc->dev, sc->res[2], sc->write_ih); + } + + return (0); +} + +static int +beri_rdwr(struct cdev *dev, struct uio *uio, int ioflag) +{ + struct beri_softc *sc; + uint32_t offset; + control_reg_t c; + uint16_t *ptr; + uint8_t *dst; + int stock; + int dir; + int amount; + int count; + + sc = dev->si_drv1; + + dir = uio->uio_rw ? 1 : 0; + + c = get_control_reg(sc, dir); + stock = get_stock(sc, dir, &c); + if (stock < uio->uio_resid) { + device_printf(sc->dev, "Err: no data/space available\n"); + return (1); + } + + amount = uio->uio_resid; + ptr = dir ? &c.in : &c.out; + count = (sc->data_size - *ptr); + + offset = dir ? sc->data_write : sc->data_read; + dst = (uint8_t *)(sc->bsh + offset); + + if (amount <= count) { + uiomove(dst + *ptr, amount, uio); + } else { + uiomove(dst + *ptr, count, uio); + uiomove(dst, (amount - count), uio); + } + + *ptr = (*ptr + amount) % sc->data_size; + set_control_reg(sc, dir, &c); + + return (0); +} + +static int +beri_kqread(struct knote *kn, long hint) +{ + struct beri_softc *sc; + control_reg_t c; + int stock; + + sc = kn->kn_hook; + + c = get_control_reg(sc, 0); + stock = get_stock(sc, 0, &c); + if (stock) { + kn->kn_data = stock; + return (1); + } + + kn->kn_data = 0; + + /* Wait at least one new byte in buffer */ + c.interrupt_level = 1; + + /* Enable interrupts */ + c.cdes |= (CDES_INT_EN); + set_control_reg(sc, 0, &c); + + return (0); +} + +static int +beri_kqwrite(struct knote *kn, long hint) +{ + struct beri_softc *sc; + control_reg_t c; + int stock; + + sc = kn->kn_hook; + + c = get_control_reg(sc, 1); + stock = get_stock(sc, 1, &c); + if (stock) { + kn->kn_data = stock; + return (1); + } + + kn->kn_data = 0; + + /* Wait at least one free position in buffer */ + c.interrupt_level = sc->data_size - 2; + + /* Enable interrupts */ + c.cdes |= (CDES_INT_EN); + set_control_reg(sc, 1, &c); + + return (0); +} + +static void +beri_kqdetach(struct knote *kn) +{ + struct beri_softc *sc; + + sc = kn->kn_hook; + + knlist_remove(&sc->beri_rsel.si_note, kn, 0); +} + +static struct filterops beri_read_filterops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = beri_kqdetach, + .f_event = beri_kqread, +}; + +static struct filterops beri_write_filterops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = beri_kqdetach, + .f_event = beri_kqwrite, +}; + +static int +beri_kqfilter(struct cdev *dev, struct knote *kn) +{ + struct beri_softc *sc; + + sc = dev->si_drv1; + + switch(kn->kn_filter) { + case EVFILT_READ: + kn->kn_fop = &beri_read_filterops; + break; + case EVFILT_WRITE: + kn->kn_fop = &beri_write_filterops; + break; + default: + return(EINVAL); + } + + kn->kn_hook = sc; + knlist_add(&sc->beri_rsel.si_note, kn, 0); + + return (0); +} + +static struct cdevsw beri_cdevsw = { + .d_version = D_VERSION, + .d_open = beri_open, + .d_close = beri_close, + .d_write = beri_rdwr, + .d_read = beri_rdwr, + .d_kqfilter = beri_kqfilter, + .d_name = "beri ring buffer", +}; + +static int +parse_fdt(struct beri_softc *sc) +{ + pcell_t dts_value[0]; + phandle_t node; + int len; + + if ((node = ofw_bus_get_node(sc->dev)) == -1) + return (ENXIO); + + /* get device name */ + if (OF_getprop(ofw_bus_get_node(sc->dev), "device_name", + &sc->devname, sizeof(sc->devname)) <= 0) { + device_printf(sc->dev, "Can't get device_name\n"); + return (ENXIO); + } + + if ((len = OF_getproplen(node, "data_size")) <= 0) + return (ENXIO); + OF_getencprop(node, "data_size", dts_value, len); + sc->data_size = dts_value[0]; + + if ((len = OF_getproplen(node, "data_read")) <= 0) + return (ENXIO); + OF_getencprop(node, "data_read", dts_value, len); + sc->data_read = dts_value[0]; + + if ((len = OF_getproplen(node, "data_write")) <= 0) + return (ENXIO); + OF_getencprop(node, "data_write", dts_value, len); + sc->data_write = dts_value[0]; + + if ((len = OF_getproplen(node, "control_read")) <= 0) + return (ENXIO); + OF_getencprop(node, "control_read", dts_value, len); + sc->control_read = dts_value[0]; + + if ((len = OF_getproplen(node, "control_write")) <= 0) + return (ENXIO); + OF_getencprop(node, "control_write", dts_value, len); + sc->control_write = dts_value[0]; + + return (0); +} + +static int +beri_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "sri-cambridge,beri-ring")) + return (ENXIO); + + device_set_desc(dev, "SRI-Cambridge BERI ring buffer"); + return (BUS_PROBE_DEFAULT); +} + +static int +beri_attach(device_t dev) +{ + struct beri_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, beri_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + if (parse_fdt(sc)) { + device_printf(sc->dev, "Can't get FDT values\n"); + return (ENXIO); + } + + sc->cdev = make_dev(&beri_cdevsw, 0, UID_ROOT, GID_WHEEL, + S_IRWXU, "%s", sc->devname); + if (sc->cdev == NULL) { + device_printf(dev, "Failed to create character device.\n"); + return (ENXIO); + } + + sc->cdev->si_drv1 = sc; + + mtx_init(&sc->beri_mtx, "beri_mtx", NULL, MTX_DEF); + knlist_init_mtx(&sc->beri_rsel.si_note, &sc->beri_mtx); + + return (0); +} + +static device_method_t beri_methods[] = { + DEVMETHOD(device_probe, beri_probe), + DEVMETHOD(device_attach, beri_attach), + { 0, 0 } +}; + +static driver_t beri_driver = { + "beri_ring", + beri_methods, + sizeof(struct beri_softc), +}; + +static devclass_t beri_devclass; + +DRIVER_MODULE(beri_ring, simplebus, beri_driver, beri_devclass, 0, 0); From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 16:46:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 570B915A; Sun, 19 Oct 2014 16:46:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4289DB2A; Sun, 19 Oct 2014 16:46:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JGkbaC039875; Sun, 19 Oct 2014 16:46:37 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JGkanV039873; Sun, 19 Oct 2014 16:46:36 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201410191646.s9JGkanV039873@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Sun, 19 Oct 2014 16:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273279 - in head/sys/cam: ata scsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 16:46:37 -0000 Author: gnn Date: Sun Oct 19 16:46:36 2014 New Revision: 273279 URL: https://svnweb.freebsd.org/changeset/base/273279 Log: Add new quirks for the latest Samsung SSD, model 850. Submitted by: sbruno MFC after: 2 weeks Modified: head/sys/cam/ata/ata_da.c head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/ata/ata_da.c ============================================================================== --- head/sys/cam/ata/ata_da.c Sun Oct 19 16:26:49 2014 (r273278) +++ head/sys/cam/ata/ata_da.c Sun Oct 19 16:46:36 2014 (r273279) @@ -457,6 +457,14 @@ static struct ada_quirk_entry ada_quirk_ { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7WD*", "*" }, /*quirks*/ADA_Q_4K }, + { + /* + * Samsung 850 SSDs + * 4k optimised + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Samsung SSD 850*", "*" }, + /*quirks*/ADA_Q_4K + }, { /* * Samsung PM853T Series SSDs Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Sun Oct 19 16:26:49 2014 (r273278) +++ head/sys/cam/scsi/scsi_da.c Sun Oct 19 16:46:36 2014 (r273279) @@ -1132,6 +1132,14 @@ static struct da_quirk_entry da_quirk_ta { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7WD*", "*" }, /*quirks*/DA_Q_4K }, + { + /* + * Samsung 850 SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "Samsung SSD 850*", "*" }, + /*quirks*/DA_Q_4K + }, { /* * Samsung PM853T Series SSDs From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 17:29:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8A30C52; Sun, 19 Oct 2014 17:29:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4AA0F7C; Sun, 19 Oct 2014 17:29:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JHTj81059213; Sun, 19 Oct 2014 17:29:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JHTjM5059212; Sun, 19 Oct 2014 17:29:45 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410191729.s9JHTjM5059212@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sun, 19 Oct 2014 17:29:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273280 - head/sys/dev/cxgb/common X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 17:29:45 -0000 Author: np Date: Sun Oct 19 17:29:44 2014 New Revision: 273280 URL: https://svnweb.freebsd.org/changeset/base/273280 Log: cxgb(4): reset the PHY if it generates an interrupt for no apparent reason. MFC after: 1 week Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c Modified: head/sys/dev/cxgb/common/cxgb_ael1002.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_ael1002.c Sun Oct 19 16:46:36 2014 (r273279) +++ head/sys/dev/cxgb/common/cxgb_ael1002.c Sun Oct 19 17:29:44 2014 (r273280) @@ -1345,8 +1345,10 @@ static int ael2005_intr_handler(struct c return ret; ret |= cause; - if (!ret) + if (!ret) { + (void) ael2005_reset(phy, 0); ret |= cphy_cause_link_change; + } return ret; } From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 17:55:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3A8632D; Sun, 19 Oct 2014 17:55:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF7C72B1; Sun, 19 Oct 2014 17:55:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JHt42R072810; Sun, 19 Oct 2014 17:55:04 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JHt4DM072809; Sun, 19 Oct 2014 17:55:04 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410191755.s9JHt4DM072809@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Sun, 19 Oct 2014 17:55:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273281 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 17:55:04 -0000 Author: rpaulo Date: Sun Oct 19 17:55:04 2014 New Revision: 273281 URL: https://svnweb.freebsd.org/changeset/base/273281 Log: Style changes as pointed out by stas@. MFC after: 1 week Modified: head/sys/arm/ti/ti_wdt.c Modified: head/sys/arm/ti/ti_wdt.c ============================================================================== --- head/sys/arm/ti/ti_wdt.c Sun Oct 19 17:29:44 2014 (r273280) +++ head/sys/arm/ti/ti_wdt.c Sun Oct 19 17:55:04 2014 (r273281) @@ -98,12 +98,14 @@ DRIVER_MODULE(ti_wdt, simplebus, ti_wdt_ static volatile __inline uint32_t ti_wdt_reg_read(struct ti_wdt_softc *sc, uint32_t reg) { + return (bus_space_read_4(sc->sc_bt, sc->sc_bh, reg)); } static __inline void ti_wdt_reg_write(struct ti_wdt_softc *sc, uint32_t reg, uint32_t val) { + bus_space_write_4(sc->sc_bt, sc->sc_bh, reg, val); } @@ -113,14 +115,15 @@ ti_wdt_reg_write(struct ti_wdt_softc *sc static __inline void ti_wdt_reg_wait(struct ti_wdt_softc *sc, uint32_t bit) { + while (ti_wdt_reg_read(sc, TI_WDT_WWPS) & bit) DELAY(10); - } static __inline void ti_wdt_disable(struct ti_wdt_softc *sc) { + DPRINTF("disabling watchdog %p\n", sc); ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xAAAA); ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); @@ -131,6 +134,7 @@ ti_wdt_disable(struct ti_wdt_softc *sc) static __inline void ti_wdt_enable(struct ti_wdt_softc *sc) { + DPRINTF("enabling watchdog %p\n", sc); ti_wdt_reg_write(sc, TI_WDT_WSPR, 0xBBBB); ti_wdt_reg_wait(sc, TI_W_PEND_WSPR); From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 18:31:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7555A907; Sun, 19 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 60D7D7C5; Sun, 19 Oct 2014 18:31:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JIVCUb091020; Sun, 19 Oct 2014 18:31:12 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JIVCk5091019; Sun, 19 Oct 2014 18:31:12 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410191831.s9JIVCk5091019@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 19 Oct 2014 18:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273282 - head/sys/dev/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 18:31:12 -0000 Author: ian Date: Sun Oct 19 18:31:11 2014 New Revision: 273282 URL: https://svnweb.freebsd.org/changeset/base/273282 Log: Fail to probe on simplebus nodes that lack a "ranges" property. Increasingly, FDT data has the "simple-bus" compatible string on nodes that have children, but we wouldn't consider them to be busses. If the node lacks a ranges property then we will fail to attach successfully, so fail to probe as well. Modified: head/sys/dev/fdt/simplebus.c Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Sun Oct 19 17:55:04 2014 (r273281) +++ head/sys/dev/fdt/simplebus.c Sun Oct 19 18:31:11 2014 (r273282) @@ -133,7 +133,13 @@ simplebus_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "simple-bus") && + /* + * FDT data puts a "simple-bus" compatible string on many things that + * have children but aren't really busses in our world. Without a + * ranges property we will fail to attach, so just fail to probe too. + */ + if (!(ofw_bus_is_compatible(dev, "simple-bus") && + ofw_bus_has_prop(dev, "ranges")) && (ofw_bus_get_type(dev) == NULL || strcmp(ofw_bus_get_type(dev), "soc") != 0)) return (ENXIO); From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 18:41:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4A0EDB9A; Sun, 19 Oct 2014 18:41:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3621E94C; Sun, 19 Oct 2014 18:41:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JIfNY6094292; Sun, 19 Oct 2014 18:41:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JIfNkl094291; Sun, 19 Oct 2014 18:41:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410191841.s9JIfNkl094291@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 19 Oct 2014 18:41:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273283 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 18:41:23 -0000 Author: ian Date: Sun Oct 19 18:41:22 2014 New Revision: 273283 URL: https://svnweb.freebsd.org/changeset/base/273283 Log: Attach this driver during BUS_PASS_BUS and move the cpu init code to a bus_new_pass() handler so it doesn't happen until BUS_PASS_CPU. This allows the anatop driver to outbid the generic simplebus driver (which the FDT data describes as compatible). Some day when we handle power regulators, this driver may actually become a functional simplebus and attach the regulators as children, as described in the FDT data. Modified: head/sys/arm/freescale/imx/imx6_anatop.c Modified: head/sys/arm/freescale/imx/imx6_anatop.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_anatop.c Sun Oct 19 18:31:11 2014 (r273282) +++ head/sys/arm/freescale/imx/imx6_anatop.c Sun Oct 19 18:41:22 2014 (r273283) @@ -98,6 +98,7 @@ struct imx6_anatop_softc { uint32_t cpu_maxmv; uint32_t cpu_maxmhz_hw; boolean_t cpu_overclock_enable; + boolean_t cpu_init_done; uint32_t refosc_mhz; void *temp_intrhand; uint32_t temp_high_val; @@ -623,6 +624,31 @@ intr_setup(void *arg) config_intrhook_disestablish(&sc->intr_setup_hook); } +static void +imx6_anatop_new_pass(device_t dev) +{ + struct imx6_anatop_softc *sc; + const int cpu_init_pass = BUS_PASS_CPU + BUS_PASS_ORDER_MIDDLE; + + /* + * We attach during BUS_PASS_BUS (because some day we will be a + * simplebus that has regulator devices as children), but some of our + * init work cannot be done until BUS_PASS_CPU (we rely on other devices + * that attach on the CPU pass). + */ + sc = device_get_softc(dev); + if (!sc->cpu_init_done && bus_current_pass >= cpu_init_pass) { + sc->cpu_init_done = true; + cpufreq_initialize(sc); + initialize_tempmon(sc); + if (bootverbose) { + device_printf(sc->dev, "CPU %uMHz @ %umV\n", + sc->cpu_curmhz, sc->cpu_curmv); + } + } + bus_generic_new_pass(dev); +} + static int imx6_anatop_detach(device_t dev) { @@ -666,13 +692,13 @@ imx6_anatop_attach(device_t dev) imx6_anatop_write_4(IMX6_ANALOG_PMU_MISC0_SET, IMX6_ANALOG_PMU_MISC0_SELFBIASOFF); - cpufreq_initialize(sc); - initialize_tempmon(sc); + /* + * Some day, when we're ready to deal with the actual anatop regulators + * that are described in fdt data as children of this "bus", this would + * be the place to invoke a simplebus helper routine to instantiate the + * children from the fdt data. + */ - if (bootverbose) { - device_printf(sc->dev, "CPU %uMHz @ %umV\n", sc->cpu_curmhz, - sc->cpu_curmv); - } err = 0; out: @@ -715,6 +741,9 @@ static device_method_t imx6_anatop_metho DEVMETHOD(device_attach, imx6_anatop_attach), DEVMETHOD(device_detach, imx6_anatop_detach), + /* Bus interface */ + DEVMETHOD(bus_new_pass, imx6_anatop_new_pass), + DEVMETHOD_END }; @@ -727,5 +756,7 @@ static driver_t imx6_anatop_driver = { static devclass_t imx6_anatop_devclass; EARLY_DRIVER_MODULE(imx6_anatop, simplebus, imx6_anatop_driver, - imx6_anatop_devclass, 0, 0, BUS_PASS_CPU + BUS_PASS_ORDER_FIRST + 1); + imx6_anatop_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); +EARLY_DRIVER_MODULE(imx6_anatop, ofwbus, imx6_anatop_driver, + imx6_anatop_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 20:23:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 12A88BF4; Sun, 19 Oct 2014 20:23:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E719A1DE; Sun, 19 Oct 2014 20:23:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKNW8J043740; Sun, 19 Oct 2014 20:23:32 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKNWwU043736; Sun, 19 Oct 2014 20:23:32 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410192023.s9JKNWwU043736@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 19 Oct 2014 20:23:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273284 - in head: lib/libkvm sys/arm/arm sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:23:33 -0000 Author: andrew Date: Sun Oct 19 20:23:31 2014 New Revision: 273284 URL: https://svnweb.freebsd.org/changeset/base/273284 Log: Allow libkvm to get the kernel va to pa delta without the need for physaddr. This should allow for a kernel where PHYSADDR and KERNPHYSADDR are both undefined. For now libkvm will use the old method of reading physaddr and kernaddr to allow it to work with old kernels. This could be removed in the future when enough time has passed. Differential Revision: https://reviews.freebsd.org/D939 MFC after: 1 week Modified: head/lib/libkvm/kvm_arm.c head/sys/arm/arm/dump_machdep.c head/sys/sys/elf_common.h Modified: head/lib/libkvm/kvm_arm.c ============================================================================== --- head/lib/libkvm/kvm_arm.c Sun Oct 19 18:41:22 2014 (r273283) +++ head/lib/libkvm/kvm_arm.c Sun Oct 19 20:23:31 2014 (r273284) @@ -132,8 +132,10 @@ _kvm_initvtop(kvm_t *kd) u_long kernbase, physaddr, pa; pd_entry_t *l1pt; Elf32_Ehdr *ehdr; + Elf32_Phdr *phdr; size_t hdrsz; char minihdr[8]; + int found, i; if (!kd->rawdump) { if (pread(kd->pmfd, &minihdr, 8, 0) == 8) { @@ -158,19 +160,33 @@ _kvm_initvtop(kvm_t *kd) hdrsz = ehdr->e_phoff + ehdr->e_phentsize * ehdr->e_phnum; if (_kvm_maphdrs(kd, hdrsz) == -1) return (-1); - nl[0].n_name = "kernbase"; - nl[1].n_name = NULL; - if (kvm_nlist(kd, nl) != 0) - kernbase = KERNBASE; - else - kernbase = nl[0].n_value; - nl[0].n_name = "physaddr"; - if (kvm_nlist(kd, nl) != 0) { - _kvm_err(kd, kd->program, "couldn't get phys addr"); - return (-1); + phdr = (Elf32_Phdr *)((uint8_t *)ehdr + ehdr->e_phoff); + found = 0; + for (i = 0; i < ehdr->e_phnum; i++) { + if (phdr[i].p_type == PT_DUMP_DELTA) { + kernbase = phdr[i].p_vaddr; + physaddr = phdr[i].p_paddr; + found = 1; + break; + } + } + + nl[1].n_name = NULL; + if (!found) { + nl[0].n_name = "kernbase"; + if (kvm_nlist(kd, nl) != 0) + kernbase = KERNBASE; + else + kernbase = nl[0].n_value; + + nl[0].n_name = "physaddr"; + if (kvm_nlist(kd, nl) != 0) { + _kvm_err(kd, kd->program, "couldn't get phys addr"); + return (-1); + } + physaddr = nl[0].n_value; } - physaddr = nl[0].n_value; nl[0].n_name = "kernel_l1pa"; if (kvm_nlist(kd, nl) != 0) { _kvm_err(kd, kd->program, "bad namelist"); Modified: head/sys/arm/arm/dump_machdep.c ============================================================================== --- head/sys/arm/arm/dump_machdep.c Sun Oct 19 18:41:22 2014 (r273283) +++ head/sys/arm/arm/dump_machdep.c Sun Oct 19 20:23:31 2014 (r273284) @@ -245,6 +245,29 @@ cb_dumphdr(struct md_pa *mdp, int seqnr, return (error); } +/* + * Add a header to be used by libkvm to get the va to pa delta + */ +static int +dump_os_header(struct dumperinfo *di) +{ + Elf_Phdr phdr; + int error; + + bzero(&phdr, sizeof(phdr)); + phdr.p_type = PT_DUMP_DELTA; + phdr.p_flags = PF_R; /* XXX */ + phdr.p_offset = 0; + phdr.p_vaddr = KERNVIRTADDR; + phdr.p_paddr = pmap_kextract(KERNVIRTADDR); + phdr.p_filesz = 0; + phdr.p_memsz = 0; + phdr.p_align = PAGE_SIZE; + + error = buf_write(di, (char*)&phdr, sizeof(phdr)); + return (error); +} + static int cb_size(struct md_pa *mdp, int seqnr, void *arg) { @@ -308,7 +331,7 @@ dumpsys(struct dumperinfo *di) /* Calculate dump size. */ dumpsize = 0L; - ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize); + ehdr.e_phnum = foreach_chunk(cb_size, &dumpsize) + 1; hdrsz = ehdr.e_phoff + ehdr.e_phnum * ehdr.e_phentsize; fileofs = MD_ALIGN(hdrsz); dumpsize += fileofs; @@ -325,7 +348,7 @@ dumpsys(struct dumperinfo *di) mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize, di->blocksize); printf("Dumping %llu MB (%d chunks)\n", (long long)dumpsize >> 20, - ehdr.e_phnum); + ehdr.e_phnum - 1); /* Dump leader */ error = dump_write(di, &kdh, 0, dumplo, sizeof(kdh)); @@ -340,6 +363,8 @@ dumpsys(struct dumperinfo *di) /* Dump program headers */ error = foreach_chunk(cb_dumphdr, di); + if (error >= 0) + error = dump_os_header(di); if (error < 0) goto fail; buf_flush(di); Modified: head/sys/sys/elf_common.h ============================================================================== --- head/sys/sys/elf_common.h Sun Oct 19 18:41:22 2014 (r273283) +++ head/sys/sys/elf_common.h Sun Oct 19 20:23:31 2014 (r273284) @@ -340,6 +340,8 @@ typedef struct { #define PT_GNU_EH_FRAME 0x6474e550 #define PT_GNU_STACK 0x6474e551 #define PT_GNU_RELRO 0x6474e552 +#define PT_DUMP_DELTA 0x6fb5d000 /* va->pa map for kernel dumps + (currently arm). */ #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* describes the stack segment */ From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 20:47:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C3702F64; Sun, 19 Oct 2014 20:47:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFE0F3D7; Sun, 19 Oct 2014 20:47:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKl05R053377; Sun, 19 Oct 2014 20:47:00 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKl0bx053373; Sun, 19 Oct 2014 20:47:00 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410192047.s9JKl0bx053373@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 19 Oct 2014 20:47:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273285 - in head: . etc/rc.d X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:47:00 -0000 Author: hrs Date: Sun Oct 19 20:46:59 2014 New Revision: 273285 URL: https://svnweb.freebsd.org/changeset/base/273285 Log: - Honer MK_KERBEROS for Heimdal rc.d scripts. - Add rc.c/kerberos to OLD_FILES. Modified: head/ObsoleteFiles.inc head/etc/rc.d/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sun Oct 19 20:23:31 2014 (r273284) +++ head/ObsoleteFiles.inc Sun Oct 19 20:46:59 2014 (r273285) @@ -48,6 +48,8 @@ OLD_FILES+=etc/rc.d/hv_kvpd # 20140917: libnv was accidentally being installed to /usr/lib instead of /lib OLD_LIBS+=usr/lib/libnv.a OLD_LIBS+=usr/lib/libnv.so.0 +# 20140829: rc.d/kerberos removed +OLD_FILES+=etc/rc.d/kerberos # 20140814: libopie version bump OLD_LIBS+=usr/lib/libopie.so.7 OLD_LIBS+=usr/lib32/libopie.so.7 Modified: head/etc/rc.d/Makefile ============================================================================== --- head/etc/rc.d/Makefile Sun Oct 19 20:23:31 2014 (r273284) +++ head/etc/rc.d/Makefile Sun Oct 19 20:46:59 2014 (r273285) @@ -70,12 +70,12 @@ FILES= DAEMON \ iscsictl \ iscsid \ jail \ - kadmind \ - kdc \ - kfd \ + ${_kadmind} \ + ${_kdc} \ + ${_kfd} \ kld \ kldxref \ - kpasswdd \ + ${_kpasswdd} \ ldconfig \ local \ localpkg \ @@ -181,6 +181,13 @@ _casperd= casperd _nscd= nscd .endif +.if ${MK_KERBEROS} != "no" +_kadmind= kadmind +_kdc= kdc +_kfd= kfd +_kpasswdd= kpasswdd +.endif + .if ${MK_OFED} != "no" _opensm= opensm .endif From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 20:56:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DDFA4A2; Sun, 19 Oct 2014 20:56:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49ACA69B; Sun, 19 Oct 2014 20:56:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JKu6sY057994; Sun, 19 Oct 2014 20:56:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JKu6cY057993; Sun, 19 Oct 2014 20:56:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410192056.s9JKu6cY057993@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 19 Oct 2014 20:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273287 - head/sys/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 20:56:06 -0000 Author: andrew Date: Sun Oct 19 20:56:05 2014 New Revision: 273287 URL: https://svnweb.freebsd.org/changeset/base/273287 Log: Only build the ARM tranpoline when KERNPHYSADDR is defined as it is otherwise unneeded in armv6 kernels. MFC after: 1 week Modified: head/sys/conf/Makefile.arm Modified: head/sys/conf/Makefile.arm ============================================================================== --- head/sys/conf/Makefile.arm Sun Oct 19 20:54:04 2014 (r273286) +++ head/sys/conf/Makefile.arm Sun Oct 19 20:56:05 2014 (r273287) @@ -77,6 +77,7 @@ FILES_CPU_FUNC = \ $S/$M/$M/cpufunc_asm_pj4b.S $S/$M/$M/cpufunc_asm_armv6.S \ $S/$M/$M/cpufunc_asm_armv7.S +.if defined(KERNPHYSADDR) KERNEL_EXTRA=trampoline KERNEL_EXTRA_INSTALL=kernel.gz.tramp trampoline: ${KERNEL_KO}.tramp @@ -121,6 +122,7 @@ ${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$ ${KERNEL_KO}.gz.tramp.bin rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \ inflate-tramp.o tmphack.S +.endif %BEFORE_DEPEND From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 21:03:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AE680AFB; Sun, 19 Oct 2014 21:03:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A6B6873; Sun, 19 Oct 2014 21:03:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JL3hLr062500; Sun, 19 Oct 2014 21:03:43 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JL3hKj062499; Sun, 19 Oct 2014 21:03:43 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201410192103.s9JL3hKj062499@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 19 Oct 2014 21:03:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273288 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 21:03:43 -0000 Author: andrew Date: Sun Oct 19 21:03:42 2014 New Revision: 273288 URL: https://svnweb.freebsd.org/changeset/base/273288 Log: Allow the armv6 kernel to be build with PHYSADDR undefined. The kernel will now find the virtual to physical mapping for libkvm to use at runtime. This makes PHYSADDR redundant, however keep it around to give everyone a chance to update their libkvm. MFC after: 1 week Modified: head/sys/arm/arm/locore.S Modified: head/sys/arm/arm/locore.S ============================================================================== --- head/sys/arm/arm/locore.S Sun Oct 19 20:56:05 2014 (r273287) +++ head/sys/arm/arm/locore.S Sun Oct 19 21:03:42 2014 (r273288) @@ -42,6 +42,18 @@ __FBSDID("$FreeBSD$"); +/* + * Sanity check the configuration. + * FLASHADDR and LOADERRAMADDR depend on PHYSADDR in some cases. + * ARMv4 and ARMv5 make assumptions on where they are loaded. + * + * TODO: Fix the ARMv4/v5 case. + */ +#if (defined(FLASHADDR) || defined(LOADERRAMADDR) || !defined(_ARM_ARCH_6)) && \ + !defined(PHYSADDR) +#error PHYSADDR must be defined for this configuration +#endif + /* What size should this really be ? It is only used by initarm() */ #define INIT_ARM_STACK_SIZE (2048 * 4) @@ -54,15 +66,21 @@ __FBSDID("$FreeBSD$"); CPWAIT_BRANCH /* branch to next insn */ /* - * This is for kvm_mkdb, and should be the address of the beginning + * This is for libkvm, and should be the address of the beginning * of the kernel text segment (not necessarily the same as kernbase). + * + * These are being phased out. Newer copies of libkvm don't need these + * values as the information is added to the core file by inspecting + * the running kernel. */ .text .align 0 +#ifdef PHYSADDR .globl kernbase .set kernbase,KERNBASE .globl physaddr .set physaddr,PHYSADDR +#endif /* * On entry for FreeBSD boot ABI: From owner-svn-src-head@FreeBSD.ORG Sun Oct 19 23:13:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C1CEDF6; Sun, 19 Oct 2014 23:13:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47E14694; Sun, 19 Oct 2014 23:13:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9JNDHgM026656; Sun, 19 Oct 2014 23:13:17 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9JNDHh9026655; Sun, 19 Oct 2014 23:13:17 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201410192313.s9JNDHh9026655@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Sun, 19 Oct 2014 23:13:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273293 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2014 23:13:17 -0000 Author: gnn Date: Sun Oct 19 23:13:16 2014 New Revision: 273293 URL: https://svnweb.freebsd.org/changeset/base/273293 Log: Update the TCP structure used by DTrace to show the smoothed RTT. This will allow similar functionality to SIFTR to be built with DTrace. Submitted by: Grenville Armitage MFC after: 2 weeks Modified: head/cddl/lib/libdtrace/tcp.d Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Sun Oct 19 23:05:18 2014 (r273292) +++ head/cddl/lib/libdtrace/tcp.d Sun Oct 19 23:13:16 2014 (r273293) @@ -116,6 +116,7 @@ typedef struct tcpsinfo { uint32_t tcps_rto; /* round-trip timeout, msec */ uint32_t tcps_mss; /* max segment size */ int tcps_retransmit; /* retransmit send event, boolean */ + int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ } tcpsinfo_t; /* @@ -200,6 +201,7 @@ translator tcpsinfo_t < struct tcpcb *p tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */ tcps_mss = p == NULL ? -1 : p->t_maxseg; tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; + tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ }; #pragma D binding "1.6.3" translator From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 00:27:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E55B1B47; Mon, 20 Oct 2014 00:27:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0E93CA5; Mon, 20 Oct 2014 00:27:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K0RfWU062462; Mon, 20 Oct 2014 00:27:41 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K0RegN062458; Mon, 20 Oct 2014 00:27:40 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410200027.s9K0RegN062458@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 20 Oct 2014 00:27:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273295 - in head/sbin: ping ping6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 00:27:42 -0000 Author: hrs Date: Mon Oct 20 00:27:40 2014 New Revision: 273295 URL: https://svnweb.freebsd.org/changeset/base/273295 Log: WARNS=3 and style fixes. No functionality change. Modified: head/sbin/ping/Makefile head/sbin/ping/ping.c head/sbin/ping6/Makefile head/sbin/ping6/ping6.c Modified: head/sbin/ping/Makefile ============================================================================== --- head/sbin/ping/Makefile Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping/Makefile Mon Oct 20 00:27:40 2014 (r273295) @@ -7,7 +7,7 @@ PROG= ping MAN= ping.8 BINOWN= root BINMODE=4555 -WARNS?= 2 +WARNS?= 3 DPADD= ${LIBM} LDADD= -lm Modified: head/sbin/ping/ping.c ============================================================================== --- head/sbin/ping/ping.c Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping/ping.c Mon Oct 20 00:27:40 2014 (r273295) @@ -122,7 +122,7 @@ struct tv32 { }; /* various options */ -int options; +static int options; #define F_FLOOD 0x0001 #define F_INTERVAL 0x0002 #define F_NUMERIC 0x0004 @@ -157,52 +157,52 @@ int options; * to 8192 for complete accuracy... */ #define MAX_DUP_CHK (8 * 128) -int mx_dup_ck = MAX_DUP_CHK; -char rcvd_tbl[MAX_DUP_CHK / 8]; +static int mx_dup_ck = MAX_DUP_CHK; +static char rcvd_tbl[MAX_DUP_CHK / 8]; -struct sockaddr_in whereto; /* who to ping */ -int datalen = DEFDATALEN; -int maxpayload; -int ssend; /* send socket file descriptor */ -int srecv; /* receive socket file descriptor */ -u_char outpackhdr[IP_MAXPACKET], *outpack; -char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */ -char BSPACE = '\b'; /* characters written for flood */ -char DOT = '.'; -char *hostname; -char *shostname; -int ident; /* process id to identify our packets */ -int uid; /* cached uid for micro-optimization */ -u_char icmp_type = ICMP_ECHO; -u_char icmp_type_rsp = ICMP_ECHOREPLY; -int phdr_len = 0; -int send_len; +static struct sockaddr_in whereto; /* who to ping */ +static int datalen = DEFDATALEN; +static int maxpayload; +static int ssend; /* send socket file descriptor */ +static int srecv; /* receive socket file descriptor */ +static u_char outpackhdr[IP_MAXPACKET], *outpack; +static char BBELL = '\a'; /* characters written for MISSED and AUDIBLE */ +static char BSPACE = '\b'; /* characters written for flood */ +static char DOT = '.'; +static char *hostname; +static char *shostname; +static int ident; /* process id to identify our packets */ +static int uid; /* cached uid for micro-optimization */ +static u_char icmp_type = ICMP_ECHO; +static u_char icmp_type_rsp = ICMP_ECHOREPLY; +static int phdr_len = 0; +static int send_len; /* counters */ -long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ -long npackets; /* max packets to transmit */ -long nreceived; /* # of packets we got back */ -long nrepeats; /* number of duplicates */ -long ntransmitted; /* sequence # for outbound packets = #sent */ -long snpackets; /* max packets to transmit in one sweep */ -long snreceived; /* # of packets we got back in this sweep */ -long sntransmitted; /* # of packets we sent in this sweep */ -int sweepmax; /* max value of payload in sweep */ -int sweepmin = 0; /* start value of payload in sweep */ -int sweepincr = 1; /* payload increment in sweep */ -int interval = 1000; /* interval between packets, ms */ -int waittime = MAXWAIT; /* timeout for each packet */ -long nrcvtimeout = 0; /* # of packets we got back after waittime */ +static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ +static long npackets; /* max packets to transmit */ +static long nreceived; /* # of packets we got back */ +static long nrepeats; /* number of duplicates */ +static long ntransmitted; /* sequence # for outbound packets = #sent */ +static long snpackets; /* max packets to transmit in one sweep */ +static long sntransmitted; /* # of packets we sent in this sweep */ +static int sweepmax; /* max value of payload in sweep */ +static int sweepmin = 0; /* start value of payload in sweep */ +static int sweepincr = 1; /* payload increment in sweep */ +static int interval = 1000; /* interval between packets, ms */ +static int waittime = MAXWAIT; /* timeout for each packet */ +static long nrcvtimeout = 0; /* # of packets we got back after waittime */ /* timing */ -int timing; /* flag to do timing */ -double tmin = 999999999.0; /* minimum round trip time */ -double tmax = 0.0; /* maximum round trip time */ -double tsum = 0.0; /* sum of all times, for doing average */ -double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ - -volatile sig_atomic_t finish_up; /* nonzero if we've been told to finish up */ -volatile sig_atomic_t siginfo_p; +static int timing; /* flag to do timing */ +static double tmin = 999999999.0; /* minimum round trip time */ +static double tmax = 0.0; /* maximum round trip time */ +static double tsum = 0.0; /* sum of all times, for doing average */ +static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ + +/* nonzero if we've been told to finish up */ +static volatile sig_atomic_t finish_up; +static volatile sig_atomic_t siginfo_p; #ifdef HAVE_LIBCAPSICUM static cap_channel_t *capdns; @@ -1150,7 +1150,8 @@ pr_pack(char *buf, int cc, struct sockad #endif tp = (const char *)tp + phdr_len; - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= + sizeof(tv1)) { /* Copy to avoid alignment problems: */ memcpy(&tv32, tp, sizeof(tv32)); tv1.tv_sec = ntohl(tv32.tv32_sec); Modified: head/sbin/ping6/Makefile ============================================================================== --- head/sbin/ping6/Makefile Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping6/Makefile Mon Oct 20 00:27:40 2014 (r273295) @@ -5,7 +5,7 @@ MAN= ping6.8 CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS \ -DHAVE_ARC4RANDOM -WARNS?= 2 +WARNS?= 3 BINOWN= root BINMODE=4555 Modified: head/sbin/ping6/ping6.c ============================================================================== --- head/sbin/ping6/ping6.c Mon Oct 20 00:22:08 2014 (r273294) +++ head/sbin/ping6/ping6.c Mon Oct 20 00:27:40 2014 (r273295) @@ -205,84 +205,83 @@ u_int options; * to 8192 for complete accuracy... */ #define MAX_DUP_CHK (8 * 8192) -int mx_dup_ck = MAX_DUP_CHK; -char rcvd_tbl[MAX_DUP_CHK / 8]; +static int mx_dup_ck = MAX_DUP_CHK; +static char rcvd_tbl[MAX_DUP_CHK / 8]; -struct sockaddr_in6 dst; /* who to ping6 */ -struct sockaddr_in6 src; /* src addr of this packet */ -socklen_t srclen; -int datalen = DEFDATALEN; -int s; /* socket file descriptor */ -u_char outpack[MAXPACKETLEN]; -char BSPACE = '\b'; /* characters written for flood */ -char BBELL = '\a'; /* characters written for AUDIBLE */ -char DOT = '.'; -char *hostname; -int ident; /* process id to identify our packets */ -u_int8_t nonce[8]; /* nonce field for node information */ -int hoplimit = -1; /* hoplimit */ -int pathmtu = 0; /* path MTU for the destination. 0 = unspec. */ -u_char *packet = NULL; +static struct sockaddr_in6 dst; /* who to ping6 */ +static struct sockaddr_in6 src; /* src addr of this packet */ +static socklen_t srclen; +static size_t datalen = DEFDATALEN; +static int s; /* socket file descriptor */ +static u_char outpack[MAXPACKETLEN]; +static char BSPACE = '\b'; /* characters written for flood */ +static char BBELL = '\a'; /* characters written for AUDIBLE */ +static char DOT = '.'; +static char *hostname; +static int ident; /* process id to identify our packets */ +static u_int8_t nonce[8]; /* nonce field for node information */ +static int hoplimit = -1; /* hoplimit */ +static u_char *packet = NULL; /* counters */ -long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ -long npackets; /* max packets to transmit */ -long nreceived; /* # of packets we got back */ -long nrepeats; /* number of duplicates */ -long ntransmitted; /* sequence # for outbound packets = #sent */ -int interval = 1000; /* interval between packets in ms */ -int waittime = MAXWAIT; /* timeout for each packet */ -long nrcvtimeout = 0; /* # of packets we got back after waittime */ +static long nmissedmax; /* max value of ntransmitted - nreceived - 1 */ +static long npackets; /* max packets to transmit */ +static long nreceived; /* # of packets we got back */ +static long nrepeats; /* number of duplicates */ +static long ntransmitted; /* sequence # for outbound packets = #sent */ +static int interval = 1000; /* interval between packets in ms */ +static int waittime = MAXWAIT; /* timeout for each packet */ +static long nrcvtimeout = 0; /* # of packets we got back after waittime */ /* timing */ -int timing; /* flag to do timing */ -double tmin = 999999999.0; /* minimum round trip time */ -double tmax = 0.0; /* maximum round trip time */ -double tsum = 0.0; /* sum of all times, for doing average */ -double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ +static int timing; /* flag to do timing */ +static double tmin = 999999999.0; /* minimum round trip time */ +static double tmax = 0.0; /* maximum round trip time */ +static double tsum = 0.0; /* sum of all times, for doing average */ +static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */ /* for node addresses */ -u_short naflags; +static u_short naflags; /* for ancillary data(advanced API) */ -struct msghdr smsghdr; -struct iovec smsgiov; -char *scmsg = 0; +static struct msghdr smsghdr; +static struct iovec smsgiov; +static char *scmsg = 0; -volatile sig_atomic_t seenint; +static volatile sig_atomic_t seenint; #ifdef SIGINFO -volatile sig_atomic_t seeninfo; +static volatile sig_atomic_t seeninfo; #endif int main(int, char *[]); -void fill(char *, char *); -int get_hoplim(struct msghdr *); -int get_pathmtu(struct msghdr *); -struct in6_pktinfo *get_rcvpktinfo(struct msghdr *); -void onsignal(int); -void onint(int); -size_t pingerlen(void); -int pinger(void); -const char *pr_addr(struct sockaddr *, int); -void pr_icmph(struct icmp6_hdr *, u_char *); -void pr_iph(struct ip6_hdr *); -void pr_suptypes(struct icmp6_nodeinfo *, size_t); -void pr_nodeaddr(struct icmp6_nodeinfo *, int); -int myechoreply(const struct icmp6_hdr *); -int mynireply(const struct icmp6_nodeinfo *); -char *dnsdecode(const u_char **, const u_char *, const u_char *, - char *, size_t); -void pr_pack(u_char *, int, struct msghdr *); -void pr_exthdrs(struct msghdr *); -void pr_ip6opt(void *, size_t); -void pr_rthdr(void *, size_t); -int pr_bitrange(u_int32_t, int, int); -void pr_retip(struct ip6_hdr *, u_char *); -void summary(void); -void tvsub(struct timeval *, struct timeval *); -int setpolicy(int, char *); -char *nigroup(char *, int); -void usage(void); +static void fill(char *, char *); +static int get_hoplim(struct msghdr *); +static int get_pathmtu(struct msghdr *); +static struct in6_pktinfo *get_rcvpktinfo(struct msghdr *); +static void onsignal(int); +static void onint(int); +static size_t pingerlen(void); +static int pinger(void); +static const char *pr_addr(struct sockaddr *, int); +static void pr_icmph(struct icmp6_hdr *, u_char *); +static void pr_iph(struct ip6_hdr *); +static void pr_suptypes(struct icmp6_nodeinfo *, size_t); +static void pr_nodeaddr(struct icmp6_nodeinfo *, int); +static int myechoreply(const struct icmp6_hdr *); +static int mynireply(const struct icmp6_nodeinfo *); +static char *dnsdecode(const u_char **, const u_char *, const u_char *, + char *, size_t); +static void pr_pack(u_char *, int, struct msghdr *); +static void pr_exthdrs(struct msghdr *); +static void pr_ip6opt(void *, size_t); +static void pr_rthdr(void *, size_t); +static int pr_bitrange(u_int32_t, int, int); +static void pr_retip(struct ip6_hdr *, u_char *); +static void summary(void); +static void tvsub(struct timeval *, struct timeval *); +static int setpolicy(int, char *); +static char *nigroup(char *, int); +static void usage(void); int main(int argc, char *argv[]) @@ -390,9 +389,9 @@ main(int argc, char *argv[]) errno = 0; e = NULL; lsockbufsize = strtoul(optarg, &e, 10); - sockbufsize = lsockbufsize; + sockbufsize = (int)lsockbufsize; if (errno || !*optarg || *e || - sockbufsize != lsockbufsize) + lsockbufsize > INT_MAX) errx(1, "invalid socket buffer size"); #else errx(1, @@ -751,7 +750,7 @@ main(int argc, char *argv[]) *((int *)&nonce[i]) = rand(); #else memset(nonce, 0, sizeof(nonce)); - for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t)) + for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t)) *((u_int32_t *)&nonce[i]) = arc4random(); #endif optval = 1; @@ -1009,7 +1008,7 @@ main(int argc, char *argv[]) #if defined(SO_SNDBUF) && defined(SO_RCVBUF) if (sockbufsize) { - if (datalen > sockbufsize) + if (datalen > (size_t)sockbufsize) warnx("you need -b to increase socket buffer size"); if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize, sizeof(sockbufsize)) < 0) @@ -1222,7 +1221,7 @@ main(int argc, char *argv[]) exit(nreceived == 0 ? 2 : 0); } -void +static void onsignal(int sig) { @@ -1247,7 +1246,7 @@ onsignal(int sig) * of the data portion are used to hold a UNIX "timeval" struct in VAX * byte-order, to compute the round-trip time. */ -size_t +static size_t pingerlen(void) { size_t l; @@ -1266,7 +1265,7 @@ pingerlen(void) return l; } -int +static int pinger(void) { struct icmp6_hdr *icp; @@ -1381,7 +1380,7 @@ pinger(void) return(0); } -int +static int myechoreply(const struct icmp6_hdr *icp) { if (ntohs(icp->icmp6_id) == ident) @@ -1390,7 +1389,7 @@ myechoreply(const struct icmp6_hdr *icp) return 0; } -int +static int mynireply(const struct icmp6_nodeinfo *nip) { if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t), @@ -1401,7 +1400,7 @@ mynireply(const struct icmp6_nodeinfo *n return 0; } -char * +static char * dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf, size_t bufsiz) /*base for compressed name*/ @@ -1445,7 +1444,7 @@ dnsdecode(const u_char **sp, const u_cha while (i-- > 0 && cp < ep) { l = snprintf(cresult, sizeof(cresult), isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); - if (l >= sizeof(cresult) || l < 0) + if ((size_t)l >= sizeof(cresult) || l < 0) return NULL; if (strlcat(buf, cresult, bufsiz) >= bufsiz) return NULL; /*result overrun*/ @@ -1468,7 +1467,7 @@ dnsdecode(const u_char **sp, const u_cha * which arrive ('tis only fair). This permits multiple copies of this * program to be run without having intermingled output (or statistics!). */ -void +static void pr_pack(u_char *buf, int cc, struct msghdr *mhdr) { #define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c) @@ -1500,7 +1499,7 @@ pr_pack(u_char *buf, int cc, struct msgh } from = (struct sockaddr *)mhdr->msg_name; fromlen = mhdr->msg_namelen; - if (cc < sizeof(struct icmp6_hdr)) { + if (cc < (int)sizeof(struct icmp6_hdr)) { if (options & F_VERBOSE) warnx("packet too short (%d bytes) from %s", cc, pr_addr(from, fromlen)); @@ -1754,7 +1753,7 @@ pr_pack(u_char *buf, int cc, struct msgh #undef safeputc } -void +static void pr_exthdrs(struct msghdr *mhdr) { ssize_t bufsize; @@ -1792,7 +1791,7 @@ pr_exthdrs(struct msghdr *mhdr) } #ifdef USE_RFC2292BIS -void +static void pr_ip6opt(void *extbuf, size_t bufsize) { struct ip6_hbh *ext; @@ -1855,7 +1854,7 @@ pr_ip6opt(void *extbuf, size_t bufsize) } #else /* !USE_RFC2292BIS */ /* ARGSUSED */ -void +static void pr_ip6opt(void *extbuf, size_t bufsize __unused) { putchar('\n'); @@ -1864,7 +1863,7 @@ pr_ip6opt(void *extbuf, size_t bufsize _ #endif /* USE_RFC2292BIS */ #ifdef USE_RFC2292BIS -void +static void pr_rthdr(void *extbuf, size_t bufsize) { struct in6_addr *in6; @@ -1921,7 +1920,7 @@ pr_rthdr(void *extbuf, size_t bufsize) #else /* !USE_RFC2292BIS */ /* ARGSUSED */ -void +static void pr_rthdr(void *extbuf, size_t bufsize __unused) { putchar('\n'); @@ -1929,7 +1928,7 @@ pr_rthdr(void *extbuf, size_t bufsize __ } #endif /* USE_RFC2292BIS */ -int +static int pr_bitrange(u_int32_t v, int soff, int ii) { int off; @@ -1975,7 +1974,7 @@ pr_bitrange(u_int32_t v, int soff, int i return ii; } -void +static void pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen) /* ni->qtype must be SUPTYPES */ { @@ -2041,7 +2040,7 @@ pr_suptypes(struct icmp6_nodeinfo *ni, s } } -void +static void pr_nodeaddr(struct icmp6_nodeinfo *ni, int nilen) /* ni->qtype must be NODEADDR */ { @@ -2107,7 +2106,7 @@ pr_nodeaddr(struct icmp6_nodeinfo *ni, i } } -int +static int get_hoplim(struct msghdr *mhdr) { struct cmsghdr *cm; @@ -2126,7 +2125,7 @@ get_hoplim(struct msghdr *mhdr) return(-1); } -struct in6_pktinfo * +static struct in6_pktinfo * get_rcvpktinfo(struct msghdr *mhdr) { struct cmsghdr *cm; @@ -2145,7 +2144,7 @@ get_rcvpktinfo(struct msghdr *mhdr) return(NULL); } -int +static int get_pathmtu(struct msghdr *mhdr) { #ifdef IPV6_RECVPATHMTU @@ -2205,7 +2204,7 @@ get_pathmtu(struct msghdr *mhdr) * Subtract 2 timeval structs: out = out - in. Out is assumed to * be >= in. */ -void +static void tvsub(struct timeval *out, struct timeval *in) { if ((out->tv_usec -= in->tv_usec) < 0) { @@ -2220,7 +2219,7 @@ tvsub(struct timeval *out, struct timeva * SIGINT handler. */ /* ARGSUSED */ -void +static void onint(int notused __unused) { /* @@ -2235,7 +2234,7 @@ onint(int notused __unused) * summary -- * Print out statistics. */ -void +static void summary(void) { @@ -2285,7 +2284,7 @@ static const char *nircode[] = { * pr_icmph -- * Print a descriptive string about an ICMP header. */ -void +static void pr_icmph(struct icmp6_hdr *icp, u_char *end) { char ntop_buf[INET6_ADDRSTRLEN]; @@ -2515,7 +2514,7 @@ pr_icmph(struct icmp6_hdr *icp, u_char * * pr_iph -- * Print an IP6 header. */ -void +static void pr_iph(struct ip6_hdr *ip6) { u_int32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK; @@ -2543,7 +2542,7 @@ pr_iph(struct ip6_hdr *ip6) * Return an ascii host address as a dotted quad and optionally with * a hostname. */ -const char * +static const char * pr_addr(struct sockaddr *addr, int addrlen) { static char buf[NI_MAXHOST]; @@ -2562,13 +2561,13 @@ pr_addr(struct sockaddr *addr, int addrl * pr_retip -- * Dump some info on a returned (via ICMPv6) IPv6 packet. */ -void +static void pr_retip(struct ip6_hdr *ip6, u_char *end) { u_char *cp = (u_char *)ip6, nh; int hlen; - if (end - (u_char *)ip6 < sizeof(*ip6)) { + if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { printf("IP6"); goto trunc; } @@ -2642,7 +2641,7 @@ pr_retip(struct ip6_hdr *ip6, u_char *en return; } -void +static void fill(char *bp, char *patp) { int ii, jj, kk; @@ -2661,7 +2660,7 @@ fill(char *bp, char *patp) /* xxx */ if (ii > 0) for (kk = 0; - kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii); + (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; kk += ii) for (jj = 0; jj < ii; ++jj) bp[jj + kk] = pat[jj]; @@ -2675,7 +2674,7 @@ fill(char *bp, char *patp) #ifdef IPSEC #ifdef IPSEC_POLICY_IPSEC -int +static int setpolicy(int so __unused, char *policy) { char *buf; @@ -2696,7 +2695,7 @@ setpolicy(int so __unused, char *policy) #endif #endif -char * +static char * nigroup(char *name, int nig_oldmcprefix) { char *p; @@ -2755,7 +2754,7 @@ nigroup(char *name, int nig_oldmcprefix) return strdup(hbuf); } -void +static void usage(void) { (void)fprintf(stderr, From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 01:52:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A742236; Mon, 20 Oct 2014 01:52:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26CB16CB; Mon, 20 Oct 2014 01:52:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K1qIpX003933; Mon, 20 Oct 2014 01:52:18 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K1qIF0003932; Mon, 20 Oct 2014 01:52:18 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410200152.s9K1qIF0003932@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 20 Oct 2014 01:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273298 - head/sys/boot/fdt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 01:52:18 -0000 Author: ian Date: Mon Oct 20 01:52:17 2014 New Revision: 273298 URL: https://svnweb.freebsd.org/changeset/base/273298 Log: The U-Boot README says fdt_addr_r is the right env var for fdt data loaded into ram, but vendors also use fdtaddr and fdt_addr. Check the recommended variable first and fall back to the others. Modified: head/sys/boot/fdt/fdt_loader_cmd.c Modified: head/sys/boot/fdt/fdt_loader_cmd.c ============================================================================== --- head/sys/boot/fdt/fdt_loader_cmd.c Mon Oct 20 01:45:40 2014 (r273297) +++ head/sys/boot/fdt/fdt_loader_cmd.c Mon Oct 20 01:52:17 2014 (r273298) @@ -310,10 +310,13 @@ fdt_setup_fdtp() /* * If the U-boot environment contains a variable giving the address of a - * valid blob in memory, use it. Board vendors use both fdtaddr and - * fdt_addr names. + * valid blob in memory, use it. The U-boot README says the right + * variable for fdt data loaded into ram is fdt_addr_r, so try that + * first. Board vendors also use both fdtaddr and fdt_addr names. */ - s = ub_env_get("fdtaddr"); + s = ub_env_get("fdt_addr_r"); + if (s == NULL) + s = ub_env_get("fdtaddr"); if (s == NULL) s = ub_env_get("fdt_addr"); if (s != NULL && *s != '\0') { From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 04:14:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3D18532B; Mon, 20 Oct 2014 04:14:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A42136C; Mon, 20 Oct 2014 04:14:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9K4EaIC070560; Mon, 20 Oct 2014 04:14:36 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9K4Eal4070559; Mon, 20 Oct 2014 04:14:36 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201410200414.s9K4Eal4070559@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Mon, 20 Oct 2014 04:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273301 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 04:14:36 -0000 Author: hrs Date: Mon Oct 20 04:14:35 2014 New Revision: 273301 URL: https://svnweb.freebsd.org/changeset/base/273301 Log: Fix a typo. Spotted by: O. Hartmann Modified: head/etc/rc.firewall Modified: head/etc/rc.firewall ============================================================================== --- head/etc/rc.firewall Mon Oct 20 03:17:48 2014 (r273300) +++ head/etc/rc.firewall Mon Oct 20 04:14:35 2014 (r273301) @@ -498,7 +498,8 @@ case ${firewall_type} in ${fwcmd} add pass udp from $i to me ${j%/[Uu][Dd][Pp]} ;; *[0-9A-Za-z]) - echo "Consider using tcp/$j in firewall_myservices." > /dev/stderr + echo "Consider using ${j}/tcp in firewall_myservices." \ + > /dev/stderr ${fwcmd} add pass tcp from $i to me $j ;; *) From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 05:27:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 381C4DB6; Mon, 20 Oct 2014 05:27:54 +0000 (UTC) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 39E32B17; Mon, 20 Oct 2014 05:27:52 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id E3BE3D65279; Mon, 20 Oct 2014 16:27:43 +1100 (AEDT) Date: Mon, 20 Oct 2014 16:27:42 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hiroki Sato Subject: Re: svn commit: r273295 - in head/sbin: ping ping6 In-Reply-To: <201410200027.s9K0RegN062458@svn.freebsd.org> Message-ID: <20141020140848.D935@besplex.bde.org> References: <201410200027.s9K0RegN062458@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=p19h3T3XEtIjB1ijwaYA:9 a=H8qqUDbkyOKwVUSl:21 a=CjuIK1q_8ugA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 05:27:54 -0000 On Mon, 20 Oct 2014, Hiroki Sato wrote: > Log: > WARNS=3 and style fixes. No functionality change. > ... > Modified: head/sbin/ping/ping.c > ============================================================================== > --- head/sbin/ping/ping.c Mon Oct 20 00:22:08 2014 (r273294) > +++ head/sbin/ping/ping.c Mon Oct 20 00:27:40 2014 (r273295) > ... > @@ -1150,7 +1150,8 @@ pr_pack(char *buf, int cc, struct sockad > #endif > tp = (const char *)tp + phdr_len; > > - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { > + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= > + sizeof(tv1)) { > /* Copy to avoid alignment problems: */ > memcpy(&tv32, tp, sizeof(tv32)); > tv1.tv_sec = ntohl(tv32.tv32_sec); This breaks the warning, and breaks the code on exotic (unsupported) where it used to work accidentally. The code was already broken on non-exotic arches. We returned earlier for for runt packets, but this only guarantees that cc >= ICMP_MINLEN. When cc equals ICMP_MINLEN or is only a little larger, the subtractions give a negative value with type int (*). On all supported arches, size_t has the same or higher rank than int, so C's broken "value-preserving" promotion rules apply, and the small negative int is promoted to a huge unsigned value. This compares >= the small size_t value, so garbage beyond the end of the packet is used as a timestamp. On exotic arches where size_t has lower rank than int, the small size_t value was promoted to int, so the code worked. Casting the int breaks this. It is a downcast to an unsigned type, so the small negative int becomes a not so huge unsigned value. Then the promotion rules convert both sides to int for the comparision. This is a strictly upwards conversion, so it doesn't change the values. The LHS remains not so huge, and the RHS remains small. Since all the values are small before the type errors, even the not so huge value on the LHS is >= the small value on the RHS, so again garbage beyond the end of the packet is used as a timestamp. The easiest fix is to cast the size_t to int instead of the reverse. (*) That the subtractions give an int depends on the unobvious point that ICMP_MINLEN has type int. ICMP_MINLEN is not in POSIX and is not documented or even referenced in any man page. Fortunately it is not defined using sizeof(), so it doesn't suffer from the promotion bugs. It is relatively obvious that we avoided foot-shooting for the other terms in the expression -- both cc and phdrlen have type int. Foot-shooting is implemented for CMSG_LEN() and cmsg_len, which are used in a similar but simpler and correct comparision nearby. CMESG_LEN() is also not in POSIX and is not documented in any man page, but it is used in examples in man pages. It happens to be defined using an expression involving sizeof(), so it has type size_t except on exotic arches. This gives the usual promotion bugs. The examples are of the form cmsg_len = CMSG_LEN(). cmsg_len is usually a member of struct cmsghdr. cmsg_len is in POSIX and is well documented there if not in some man page. It has type socklen_t. socklen_t is also in POSIX and is very well documented there if not in some man page. POSIX allows but doesn't require the foot shooting and notes portability problems. It notes that old BSD didn't have socklen_t and used plain int instead. Other systems were apparently broken and used a foot-shooting type. So POSIX allows the foot-shooting. It specifies that socklen_t is an integer type of width at least 32 bits, and notes that the 32nd bit is unusable in portable code. Old BSD includes 4.4BSD- Lite2. FreeBSD broke this and implemented both the foot shooting and incompatibility with old BSD by making socklen_t an unsigned 32-bit type (uint32_t) as not required by POSIX. This is ABI-compatible in practice since the 32nd bit is not useful. socklen_t is not the same as size_t on 64-bit arches, so the type of cmsg_len is not even bug for bug compatible with the type of CMSG_MSG() and doesn't even guarantee the foot shooting on these arches -- it gets promoted to (signed) int64_t in some contexts, while size_t stays unsigned. In future arches, socklen_t might remain as 32 for ABI compatibility (32 bits is more than enough for buffer bloat), while plain int expands to 64 bits (except ABI compatibilty will impede that more strongly). Then the promotion bugs will move. > Modified: head/sbin/ping6/ping6.c > ============================================================================== > --- head/sbin/ping6/ping6.c Mon Oct 20 00:22:08 2014 (r273294) > +++ head/sbin/ping6/ping6.c Mon Oct 20 00:27:40 2014 (r273295) > @@ -205,84 +205,83 @@ u_int options; > * to 8192 for complete accuracy... > */ > #define MAX_DUP_CHK (8 * 8192) > -int mx_dup_ck = MAX_DUP_CHK; > -char rcvd_tbl[MAX_DUP_CHK / 8]; > +static int mx_dup_ck = MAX_DUP_CHK; > +static char rcvd_tbl[MAX_DUP_CHK / 8]; > > -struct sockaddr_in6 dst; /* who to ping6 */ > -struct sockaddr_in6 src; /* src addr of this packet */ > -socklen_t srclen; Old code like ping uses plain int for almost everything except where the broken ABI requires an unsigned type like socklen_t. > -int datalen = DEFDATALEN; > -int s; /* socket file descriptor */ > ... > +static u_int8_t nonce[8]; /* nonce field for node information */ This uses the deprecated nonstandard spelling of uint8_t. I also don't like use of fixed-width types when not necessary. Using fixed-width types for networking code is technically correct and necessary, but most networking code just uses u_char and hacks like n_long. POSIX now requires u_char to be the same as uint8_t, so changes like this are not necessary. > -void pr_suptypes(struct icmp6_nodeinfo *, size_t); The size_t foot-shooting is used a lot in prototypes. It is probably not needed for ABI compatibilty. > @@ -390,9 +389,9 @@ main(int argc, char *argv[]) > errno = 0; > e = NULL; > lsockbufsize = strtoul(optarg, &e, 10); > - sockbufsize = lsockbufsize; > + sockbufsize = (int)lsockbufsize; > if (errno || !*optarg || *e || > - sockbufsize != lsockbufsize) > + lsockbufsize > INT_MAX) > errx(1, "invalid socket buffer size"); I don't like warnings about hackish but correct code like the previous version of the above. Does the compiler actually complain about comparing ints with unsigned longs for equality? If you are going to change the range check, then rearrange the code. It was arranged to set sockbufsize before the value is known to fit so that non-fitting values can be checked. With range checking on the original value, it is more natural to not do the assignment until after the check has passed. Then the cast should be unnecessary since a smart compiler would see from the range check that the assignment can't overflow. > @@ -751,7 +750,7 @@ main(int argc, char *argv[]) > *((int *)&nonce[i]) = rand(); > #else > memset(nonce, 0, sizeof(nonce)); > - for (i = 0; i < sizeof(nonce); i += sizeof(u_int32_t)) > + for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t)) > *((u_int32_t *)&nonce[i]) = arc4random(); > #endif > optval = 1; Casting sizeof() limits to int instead of the other way is correct, but it is a compiler bug to warn about simple code like the above. `i' has a very limited scope and obviously cannot be negative. > @@ -1009,7 +1008,7 @@ main(int argc, char *argv[]) > > #if defined(SO_SNDBUF) && defined(SO_RCVBUF) > if (sockbufsize) { > - if (datalen > sockbufsize) > + if (datalen > (size_t)sockbufsize) datalen was broken to have the foot-shooting (its type was changed from int to size_t). This is collateral. In ping4, datalen still has type int. In ping4, datalen is is initialized more or less correctly using code like the new code above for sockbufsize but better (use strtoul(), and range-check the value before assigning it). In ping6, the initialization of datalen is unchanged and more broken than before. datalen is assigned to directly from strtol(); then the overflowed value is checked. strtol() at least matched the sign of datalen. I'm suprised that you don't get a warning for the 'datalen <= 0' range check now. This is now an obfuscated way of writing 'datalen == 0'. Compilers apparently only warn about 'datalen < 0'. ping4 also has better error messages ("invalid packet size: `%s'" instead of "illegal datalen value -- %s"). BTW, I don't like compilers warning about checks of the form (datalen >= 0 && datalen <= MAX) or "fixing" these warnings by removing the datalen >= 0 check. datalen might be a typedefed type that might be signed. Careful code must check for negative values. This has no runtime cost if type happens to be unsigned, and no runtime cost on many arches even if it is unsigned. Removing the check breaks this careful code. > @@ -1445,7 +1444,7 @@ dnsdecode(const u_char **sp, const u_cha > while (i-- > 0 && cp < ep) { > l = snprintf(cresult, sizeof(cresult), > isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); > - if (l >= sizeof(cresult) || l < 0) > + if ((size_t)l >= sizeof(cresult) || l < 0) > return NULL; > if (strlcat(buf, cresult, bufsiz) >= bufsiz) > return NULL; /*result overrun*/ The conversion is backwards. snprintf() is hard to use. Almost no code uses it as carefully as the above. l < 0 probably can't happen in the above. But if you are willing to cast to unsigned, then you can fold the l < 0 check into the other check. snprintf() returns -1 on error, and casting that to size_t gives a huge unsigned value that looks like the non-error of the bufer being too small. "Fixing" warnings by applying size_t casts usually gives this check unintentionally. > @@ -1468,7 +1467,7 @@ dnsdecode(const u_char **sp, const u_cha > * which arrive ('tis only fair). This permits multiple copies of this > * program to be run without having intermingled output (or statistics!). > */ > -void > +static void > pr_pack(u_char *buf, int cc, struct msghdr *mhdr) > { > #define safeputc(c) printf((isprint((c)) ? "%c" : "\\%03o"), c) > @@ -1500,7 +1499,7 @@ pr_pack(u_char *buf, int cc, struct msgh > } > from = (struct sockaddr *)mhdr->msg_name; > fromlen = mhdr->msg_namelen; > - if (cc < sizeof(struct icmp6_hdr)) { > + if (cc < (int)sizeof(struct icmp6_hdr)) { > if (options & F_VERBOSE) > warnx("packet too short (%d bytes) from %s", cc, > pr_addr(from, fromlen)); Correct. > @@ -2562,13 +2561,13 @@ pr_addr(struct sockaddr *addr, int addrl > * pr_retip -- > * Dump some info on a returned (via ICMPv6) IPv6 packet. > */ > -void > +static void > pr_retip(struct ip6_hdr *ip6, u_char *end) > { > u_char *cp = (u_char *)ip6, nh; > int hlen; > > - if (end - (u_char *)ip6 < sizeof(*ip6)) { > + if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { > printf("IP6"); > goto trunc; > } Backwards. The RHS should be cast to ptrdiff_t. Pointer difference are only required to work up to 64K, but that is enough for the size of small objects. If ip6 is somehow larger than end, the unsigned comparsion gives foot-shooting as usual. The pointer difference is then negative; this gets promoted to a huge unsigned value which looks like enough space. > @@ -2642,7 +2641,7 @@ pr_retip(struct ip6_hdr *ip6, u_char *en > return; > } > > -void > +static void > fill(char *bp, char *patp) > { > int ii, jj, kk; > @@ -2661,7 +2660,7 @@ fill(char *bp, char *patp) > /* xxx */ > if (ii > 0) > for (kk = 0; > - kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii); > + (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; > kk += ii) > for (jj = 0; jj < ii; ++jj) > bp[jj + kk] = pat[jj]; Backwards. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 07:33:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 85F6F221; Mon, 20 Oct 2014 07:33:04 +0000 (UTC) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.allbsd.org", Issuer "RapidSSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B098AC; Mon, 20 Oct 2014 07:33:02 +0000 (UTC) Received: from alph.d.allbsd.org ([IPv6:2001:2f0:104:e010:862b:2bff:febc:8956]) (authenticated bits=56) by mail.allbsd.org (8.14.9/8.14.8) with ESMTP id s9K7WdPF007750 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 20 Oct 2014 16:32:50 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.8/8.14.8) with ESMTP id s9K7WcQA094172; Mon, 20 Oct 2014 16:32:39 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Mon, 20 Oct 2014 16:29:07 +0900 (JST) Message-Id: <20141020.162907.106891462107570268.hrs@allbsd.org> To: brde@optusnet.com.au Subject: Re: svn commit: r273295 - in head/sbin: ping ping6 From: Hiroki Sato In-Reply-To: <20141020140848.D935@besplex.bde.org> References: <201410200027.s9K0RegN062458@svn.freebsd.org> <20141020140848.D935@besplex.bde.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.6 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mail.allbsd.org [IPv6:2001:2f0:104:e001::32]); Mon, 20 Oct 2014 16:32:56 +0900 (JST) X-Spam-Status: No, score=-97.8 required=13.0 tests=CONTENT_TYPE_PRESENT, RDNS_NONE,SPF_SOFTFAIL,T_FRT_STOCK2,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 07:33:04 -0000 ----Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)-- Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Oct_20_16_29_07_2014_483)--" Content-Transfer-Encoding: 7bit ----Next_Part(Mon_Oct_20_16_29_07_2014_483)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi Bruce, Thank you for your review. I fixed lines you pointed out and attached a patch candidate. I will show each change line by line in this email, too: Bruce Evans wrote in <20141020140848.D935@besplex.bde.org>: br> > - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { br> > + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= br> > + sizeof(tv1)) { br> > /* Copy to avoid alignment problems: */ br> > memcpy(&tv32, tp, sizeof(tv32)); br> > tv1.tv_sec = ntohl(tv32.tv32_sec); br> br> This breaks the warning, and breaks the code on exotic (unsupported) br> where it used to work accidentally. The code was already broken on br> non-exotic arches. - if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= - sizeof(tv1)) { + if (cc - ICMP_MINLEN - phdr_len >= (int)sizeof(tv1)) { br> > -struct sockaddr_in6 dst; /* who to ping6 */ br> > -struct sockaddr_in6 src; /* src addr of this packet */ br> > -socklen_t srclen; br> br> Old code like ping uses plain int for almost everything except where br> the broken ABI requires an unsigned type like socklen_t. -static socklen_t srclen; -static size_t datalen = DEFDATALEN; +static int srclen; +static int datalen = DEFDATALEN; br> > +static u_int8_t nonce[8]; /* nonce field for node information */ br> br> This uses the deprecated nonstandard spelling of uint8_t. s/u_int_{8,16,32}_t/uint_{8,16,32}_t/ in various places. br> > -void pr_suptypes(struct icmp6_nodeinfo *, size_t); s/size_t/int/ br> > - sockbufsize = lsockbufsize; br> > + sockbufsize = (int)lsockbufsize; br> > if (errno || !*optarg || *e || br> > - sockbufsize != lsockbufsize) br> > + lsockbufsize > INT_MAX) br> > errx(1, "invalid socket buffer size"); br> I don't like warnings about hackish but correct code like the previous br> version of the above. Does the compiler actually complain about br> comparing br> ints with unsigned longs for equality? Yes, this part caused the following warning: /usr/src/head/sbin/ping6/ping6.c:395:20: error: comparison of integers of different signs: 'int' and 'u_long' (aka 'unsigned long') [-Werror,-Wsign-compare] sockbufsize != lsockbufsize) br> If you are going to change the range check, then rearrange the code. br> It br> was arranged to set sockbufsize before the value is known to fit so br> that br> non-fitting values can be checked. With range checking on the br> br> original br> value, it is more natural to not do the assignment until after the br> check has passed. Then the cast should be unnecessary since a smart br> compiler would see from the range check that the assignment can't br> overflow. - lsockbufsize = strtoul(optarg, &e, 10); - sockbufsize = (int)lsockbufsize; - if (errno || !*optarg || *e || - lsockbufsize > INT_MAX) + ultmp = strtoul(optarg, &e, 10); + if (errno || !*optarg || *e || ultmp > INT_MAX) errx(1, "invalid socket buffer size"); + sockbufsize = ultmp; br> > - if (l >= sizeof(cresult) || l < 0) br> > + if ((size_t)l >= sizeof(cresult) || l < 0) br> br> The conversion is backwards. br> - if ((size_t)l >= sizeof(cresult) || l < 0) + if (l >= (int)sizeof(cresult) || l < 0) br> > - if (end - (u_char *)ip6 < sizeof(*ip6)) { br> > + if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { br> > printf("IP6"); br> > goto trunc; br> > } br> br> Backwards. The RHS should be cast to ptrdiff_t. Pointer difference br> are only required to work up to 64K, but that is enough for the size br> of small objects. - if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { + if (end - (u_char *)ip6 < (ptrdiff_t)sizeof(*ip6)) { br> > - kk <= MAXDATALEN - (8 + sizeof(struct tv32) + ii); br> > + (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; - (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; + kk <= MAXDATALEN - 8 + (int)sizeof(struct tv32) + ii; -- Hiroki ----Next_Part(Mon_Oct_20_16_29_07_2014_483)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ping6.c_20141020-1.diff" Index: ping6.c =================================================================== --- ping6.c (revision 273295) +++ ping6.c (working copy) @@ -122,6 +122,7 @@ #include #include #include +#include #include #include #include @@ -136,8 +137,8 @@ #include struct tv32 { - u_int32_t tv32_sec; - u_int32_t tv32_usec; + uint32_t tv32_sec; + uint32_t tv32_usec; }; #define MAXPACKETLEN 131072 @@ -210,8 +211,8 @@ static struct sockaddr_in6 dst; /* who to ping6 */ static struct sockaddr_in6 src; /* src addr of this packet */ -static socklen_t srclen; -static size_t datalen = DEFDATALEN; +static int srclen; +static int datalen = DEFDATALEN; static int s; /* socket file descriptor */ static u_char outpack[MAXPACKETLEN]; static char BSPACE = '\b'; /* characters written for flood */ @@ -219,7 +220,7 @@ static char DOT = '.'; static char *hostname; static int ident; /* process id to identify our packets */ -static u_int8_t nonce[8]; /* nonce field for node information */ +static u_char nonce[8]; /* nonce field for node information */ static int hoplimit = -1; /* hoplimit */ static u_char *packet = NULL; @@ -265,17 +266,17 @@ static const char *pr_addr(struct sockaddr *, int); static void pr_icmph(struct icmp6_hdr *, u_char *); static void pr_iph(struct ip6_hdr *); -static void pr_suptypes(struct icmp6_nodeinfo *, size_t); +static void pr_suptypes(struct icmp6_nodeinfo *, int); static void pr_nodeaddr(struct icmp6_nodeinfo *, int); static int myechoreply(const struct icmp6_hdr *); static int mynireply(const struct icmp6_nodeinfo *); static char *dnsdecode(const u_char **, const u_char *, const u_char *, - char *, size_t); + char *, int); static void pr_pack(u_char *, int, struct msghdr *); static void pr_exthdrs(struct msghdr *); -static void pr_ip6opt(void *, size_t); -static void pr_rthdr(void *, size_t); -static int pr_bitrange(u_int32_t, int, int); +static void pr_ip6opt(void *, int); +static void pr_rthdr(void *, int); +static int pr_bitrange(uint32_t, int, int); static void pr_retip(struct ip6_hdr *, u_char *); static void summary(void); static void tvsub(struct timeval *, struct timeval *); @@ -303,7 +304,6 @@ /* For control (ancillary) data received from recvmsg() */ struct cmsghdr cm[CONTROLLEN]; #if defined(SO_SNDBUF) && defined(SO_RCVBUF) - u_long lsockbufsize; int sockbufsize = 0; #endif int usepktinfo = 0; @@ -316,7 +316,7 @@ char *policy_out = NULL; #endif double t; - u_long alarmtimeout; + u_long alarmtimeout, ultmp; size_t rthlen; #ifdef IPV6_USE_MIN_MTU int mflag = 0; @@ -388,11 +388,10 @@ #if defined(SO_SNDBUF) && defined(SO_RCVBUF) errno = 0; e = NULL; - lsockbufsize = strtoul(optarg, &e, 10); - sockbufsize = (int)lsockbufsize; - if (errno || !*optarg || *e || - lsockbufsize > INT_MAX) + ultmp = strtoul(optarg, &e, 10); + if (errno || !*optarg || *e || ultmp > INT_MAX) errx(1, "invalid socket buffer size"); + sockbufsize = ultmp; #else errx(1, "-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported"); @@ -522,14 +521,15 @@ options |= F_SRCADDR; break; case 's': /* size of packet to send */ - datalen = strtol(optarg, &e, 10); - if (datalen <= 0 || *optarg == '\0' || *e != '\0') - errx(1, "illegal datalen value -- %s", optarg); - if (datalen > MAXDATALEN) { - errx(1, - "datalen value too large, maximum is %d", + ultmp = strtoul(optarg, &e, 10); + if (*e || e == optarg) + errx(EX_USAGE, "invalid packet size: `%s'", + optarg); + if (ultmp > MAXDATALEN) + errx(EX_USAGE, + "packetsize too large, maximum is %d", MAXDATALEN); - } + datalen = ultmp; break; case 't': options &= ~F_NOUSERDATA; @@ -718,7 +718,7 @@ errx(1, "-f and -i incompatible options"); if ((options & F_NOUSERDATA) == 0) { - if (datalen >= sizeof(struct tv32)) { + if (datalen >= (int)sizeof(struct tv32)) { /* we can time transfer */ timing = 1; } else @@ -746,12 +746,12 @@ gettimeofday(&seed, NULL); srand((unsigned int)(seed.tv_sec ^ seed.tv_usec ^ (long)ident)); memset(nonce, 0, sizeof(nonce)); - for (i = 0; i < sizeof(nonce); i += sizeof(int)) + for (i = 0; i < (int)sizeof(nonce); i += sizeof(int)) *((int *)&nonce[i]) = rand(); #else memset(nonce, 0, sizeof(nonce)); - for (i = 0; i < (int)sizeof(nonce); i += sizeof(u_int32_t)) - *((u_int32_t *)&nonce[i]) = arc4random(); + for (i = 0; i < (int)sizeof(nonce); i += sizeof(uint32_t)) + *((uint32_t *)&nonce[i]) = arc4random(); #endif optval = 1; if (options & F_DONTFRAG) @@ -1008,7 +1008,7 @@ #if defined(SO_SNDBUF) && defined(SO_RCVBUF) if (sockbufsize) { - if (datalen > (size_t)sockbufsize) + if (datalen > sockbufsize) warnx("you need -b to increase socket buffer size"); if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &sockbufsize, sizeof(sockbufsize)) < 0) @@ -1292,7 +1292,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr, sizeof(dst.sin6_addr)); @@ -1307,7 +1307,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); cc = ICMP6_NIQLEN; datalen = 0; @@ -1319,7 +1319,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); memcpy(&outpack[ICMP6_NIQLEN], &dst.sin6_addr, sizeof(dst.sin6_addr)); @@ -1334,7 +1334,7 @@ memcpy(nip->icmp6_ni_nonce, nonce, sizeof(nip->icmp6_ni_nonce)); - *(u_int16_t *)nip->icmp6_ni_nonce = ntohs(seq); + *(uint16_t *)nip->icmp6_ni_nonce = ntohs(seq); cc = ICMP6_NIQLEN; datalen = 0; } else { @@ -1392,9 +1392,9 @@ static int mynireply(const struct icmp6_nodeinfo *nip) { - if (memcmp(nip->icmp6_ni_nonce + sizeof(u_int16_t), - nonce + sizeof(u_int16_t), - sizeof(nonce) - sizeof(u_int16_t)) == 0) + if (memcmp(nip->icmp6_ni_nonce + sizeof(uint16_t), + nonce + sizeof(uint16_t), + sizeof(nonce) - sizeof(uint16_t)) == 0) return 1; else return 0; @@ -1402,7 +1402,7 @@ static char * dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf, - size_t bufsiz) + int bufsiz) /*base for compressed name*/ { int i; @@ -1419,7 +1419,7 @@ while (cp < ep) { i = *cp; if (i == 0 || cp != *sp) { - if (strlcat((char *)buf, ".", bufsiz) >= bufsiz) + if ((int)strlcat((char *)buf, ".", bufsiz) >= bufsiz) return NULL; /*result overrun*/ } if (i == 0) @@ -1435,7 +1435,7 @@ if (dnsdecode(&comp, cp, base, cresult, sizeof(cresult)) == NULL) return NULL; - if (strlcat(buf, cresult, bufsiz) >= bufsiz) + if ((int)strlcat(buf, cresult, bufsiz) >= bufsiz) return NULL; /*result overrun*/ break; } else if ((i & 0x3f) == i) { @@ -1444,9 +1444,10 @@ while (i-- > 0 && cp < ep) { l = snprintf(cresult, sizeof(cresult), isprint(*cp) ? "%c" : "\\%03o", *cp & 0xff); - if ((size_t)l >= sizeof(cresult) || l < 0) + if (l >= (int)sizeof(cresult) || l < 0) return NULL; - if (strlcat(buf, cresult, bufsiz) >= bufsiz) + if ((int)strlcat(buf, cresult, bufsiz) >= + bufsiz) return NULL; /*result overrun*/ cp++; } @@ -1485,7 +1486,7 @@ int dupflag; size_t off; int oldfqdn; - u_int16_t seq; + uint16_t seq; char dnsname[MAXDNAME + 1]; (void)gettimeofday(&tv, NULL); @@ -1591,7 +1592,7 @@ } } } else if (icp->icmp6_type == ICMP6_NI_REPLY && mynireply(ni)) { - seq = ntohs(*(u_int16_t *)ni->icmp6_ni_nonce); + seq = ntohs(*(uint16_t *)ni->icmp6_ni_nonce); ++nreceived; if (TST(seq % mx_dup_ck)) { ++nrepeats; @@ -1792,16 +1793,16 @@ #ifdef USE_RFC2292BIS static void -pr_ip6opt(void *extbuf, size_t bufsize) +pr_ip6opt(void *extbuf, int bufsize) { struct ip6_hbh *ext; int currentlen; - u_int8_t type; + u_char type; socklen_t extlen, len; void *databuf; size_t offset; - u_int16_t value2; - u_int32_t value4; + uint16_t value2; + uint32_t value4; ext = (struct ip6_hbh *)extbuf; extlen = (ext->ip6h_len + 1) * 8; @@ -1812,7 +1813,7 @@ * Bounds checking on the ancillary data buffer: * subtract the size of a cmsg structure from the buffer size. */ - if (bufsize < (extlen + CMSG_SPACE(0))) { + if (bufsize < (int)(extlen + CMSG_SPACE(0))) { extlen = bufsize - CMSG_SPACE(0); warnx("options truncated, showing only %u (total=%u)", (unsigned int)(extlen / 8 - 1), @@ -1835,7 +1836,7 @@ offset = inet6_opt_get_val(databuf, offset, &value4, sizeof(value4)); printf(" Jumbo Payload Opt: Length %u\n", - (u_int32_t)ntohl(value4)); + (uint32_t)ntohl(value4)); break; case IP6OPT_ROUTER_ALERT: offset = 0; @@ -1864,7 +1865,7 @@ #ifdef USE_RFC2292BIS static void -pr_rthdr(void *extbuf, size_t bufsize) +pr_rthdr(void *extbuf, int bufsize) { struct in6_addr *in6; char ntopbuf[INET6_ADDRSTRLEN]; @@ -1892,7 +1893,7 @@ * dividend is not evenly divisible by the divisor */ rthsize = (rh->ip6r_len + 1) * 8; - if (bufsize < (rthsize + CMSG_SPACE(0))) { + if (bufsize < (int)(rthsize + CMSG_SPACE(0))) { origsegs = segments; size0 = inet6_rth_space(IPV6_RTHDR_TYPE_0, 0); size1 = inet6_rth_space(IPV6_RTHDR_TYPE_0, 1); @@ -1929,7 +1930,7 @@ #endif /* USE_RFC2292BIS */ static int -pr_bitrange(u_int32_t v, int soff, int ii) +pr_bitrange(uint32_t v, int soff, int ii) { int off; int i; @@ -1975,16 +1976,16 @@ } static void -pr_suptypes(struct icmp6_nodeinfo *ni, size_t nilen) +pr_suptypes(struct icmp6_nodeinfo *ni, int nilen) /* ni->qtype must be SUPTYPES */ { size_t clen; - u_int32_t v; + uint32_t v; const u_char *cp, *end; - u_int16_t cur; + uint16_t cur; struct cbit { - u_int16_t words; /*32bit count*/ - u_int16_t skip; + uint16_t words; /*32bit count*/ + uint16_t skip; } cbit; #define MAXQTYPES (1 << 16) size_t off; @@ -2027,7 +2028,7 @@ for (off = 0; off < clen; off += sizeof(v)) { memcpy(&v, cp + off, sizeof(v)); - v = (u_int32_t)ntohl(v); + v = (uint32_t)ntohl(v); b = pr_bitrange(v, (int)(cur + off * 8), b); } /* flush the remaining bits */ @@ -2072,16 +2073,16 @@ * by the length of the data, but note that the detection algorithm * is incomplete. We assume the latest draft by default. */ - if (nilen % (sizeof(u_int32_t) + sizeof(struct in6_addr)) == 0) + if (nilen % (sizeof(uint32_t) + sizeof(struct in6_addr)) == 0) withttl = 1; while (nilen > 0) { - u_int32_t ttl; + uint32_t ttl; if (withttl) { /* XXX: alignment? */ - ttl = (u_int32_t)ntohl(*(u_int32_t *)cp); - cp += sizeof(u_int32_t); - nilen -= sizeof(u_int32_t); + ttl = (uint32_t)ntohl(*(uint32_t *)cp); + cp += sizeof(uint32_t); + nilen -= sizeof(uint32_t); } if (inet_ntop(AF_INET6, cp, ntop_buf, sizeof(ntop_buf)) == @@ -2358,7 +2359,7 @@ break; } (void)printf("pointer = 0x%02x\n", - (u_int32_t)ntohl(icp->icmp6_pptr)); + (uint32_t)ntohl(icp->icmp6_pptr)); pr_retip((struct ip6_hdr *)(icp + 1), end); break; case ICMP6_ECHO_REQUEST: @@ -2517,8 +2518,8 @@ static void pr_iph(struct ip6_hdr *ip6) { - u_int32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK; - u_int8_t tc; + uint32_t flow = ip6->ip6_flow & IPV6_FLOWLABEL_MASK; + u_char tc; char ntop_buf[INET6_ADDRSTRLEN]; tc = *(&ip6->ip6_vfc + 1); /* XXX */ @@ -2527,7 +2528,7 @@ printf("Vr TC Flow Plen Nxt Hlim\n"); printf(" %1x %02x %05x %04x %02x %02x\n", - (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (u_int32_t)ntohl(flow), + (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (uint32_t)ntohl(flow), ntohs(ip6->ip6_plen), ip6->ip6_nxt, ip6->ip6_hlim); if (!inet_ntop(AF_INET6, &ip6->ip6_src, ntop_buf, sizeof(ntop_buf))) strlcpy(ntop_buf, "?", sizeof(ntop_buf)); @@ -2567,7 +2568,7 @@ u_char *cp = (u_char *)ip6, nh; int hlen; - if ((size_t)(end - (u_char *)ip6) < sizeof(*ip6)) { + if (end - (u_char *)ip6 < (ptrdiff_t)sizeof(*ip6)) { printf("IP6"); goto trunc; } @@ -2660,7 +2661,7 @@ /* xxx */ if (ii > 0) for (kk = 0; - (size_t)kk <= MAXDATALEN - 8 + sizeof(struct tv32) + ii; + kk <= MAXDATALEN - 8 + (int)sizeof(struct tv32) + ii; kk += ii) for (jj = 0; jj < ii; ++jj) bp[jj + kk] = pat[jj]; @@ -2701,8 +2702,8 @@ char *p; char *q; MD5_CTX ctxt; - u_int8_t digest[16]; - u_int8_t c; + u_char digest[16]; + u_char c; size_t l; char hbuf[NI_MAXHOST]; struct in6_addr in6; ----Next_Part(Mon_Oct_20_16_29_07_2014_483)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ping.c_20141020-1.diff" Index: ping.c =================================================================== --- ping.c (revision 273295) +++ ping.c (working copy) @@ -1150,8 +1150,7 @@ #endif tp = (const char *)tp + phdr_len; - if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= - sizeof(tv1)) { + if (cc - ICMP_MINLEN - phdr_len >= (int)sizeof(tv1)) { /* Copy to avoid alignment problems: */ memcpy(&tv32, tp, sizeof(tv32)); tv1.tv_sec = ntohl(tv32.tv32_sec); ----Next_Part(Mon_Oct_20_16_29_07_2014_483)---- ----Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlREucQACgkQTyzT2CeTzy0jVgCdGyvQeygiqdT6YEwEeLjZNu3b vlQAn0B5WipasyJUBlhUvaN+KfxKpgE5 =KA1u -----END PGP SIGNATURE----- ----Security_Multipart0(Mon_Oct_20_16_29_08_2014_920)---- From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 11:21:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D80AA6D; Mon, 20 Oct 2014 11:21:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EDDC1663; Mon, 20 Oct 2014 11:21:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KBL7ud096350; Mon, 20 Oct 2014 11:21:07 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KBL7JH096349; Mon, 20 Oct 2014 11:21:07 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410201121.s9KBL7JH096349@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 20 Oct 2014 11:21:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273327 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 11:21:08 -0000 Author: melifaro Date: Mon Oct 20 11:21:07 2014 New Revision: 273327 URL: https://svnweb.freebsd.org/changeset/base/273327 Log: Use copyout() directly instead of updating various fields before/after each sooptcopyout() call. Found by: luigi Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Oct 20 08:59:30 2014 (r273326) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Mon Oct 20 11:21:07 2014 (r273327) @@ -2535,30 +2535,33 @@ ipfw_del_sopt_handler(struct ipfw_sopt_h static int ipfw_flush_sopt_data(struct sockopt_data *sd) { -#define RULE_MAXSIZE (512*sizeof(u_int32_t)) + struct sockopt *sopt; int error; size_t sz; - if ((sz = sd->koff) == 0) + sz = sd->koff; + if (sz == 0) return (0); - if (sd->sopt->sopt_dir == SOPT_GET) { - error = sooptcopyout(sd->sopt, sd->kbuf, sz); + sopt = sd->sopt; + + if (sopt->sopt_dir == SOPT_GET) { + error = copyout(sd->kbuf, sopt->sopt_val, sz); if (error != 0) return (error); } memset(sd->kbuf, 0, sd->ksize); - sd->ktotal += sd->koff; + sd->ktotal += sz; sd->koff = 0; if (sd->ktotal + sd->ksize < sd->valsize) sd->kavail = sd->ksize; else sd->kavail = sd->valsize - sd->ktotal; - /* Update sopt buffer */ - sd->sopt->sopt_valsize = sd->ktotal; - sd->sopt->sopt_val = sd->sopt_val + sd->ktotal; + /* Update sopt buffer data */ + sopt->sopt_valsize = sd->ktotal; + sopt->sopt_val = sd->sopt_val + sd->ktotal; return (0); } From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 12:47:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FE7C788; Mon, 20 Oct 2014 12:47:29 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id A6214F17; Mon, 20 Oct 2014 12:47:28 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 4B05A4240CA; Mon, 20 Oct 2014 23:47:19 +1100 (AEDT) Date: Mon, 20 Oct 2014 23:47:18 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Hiroki Sato Subject: Re: svn commit: r273295 - in head/sbin: ping ping6 In-Reply-To: <20141020.162907.106891462107570268.hrs@allbsd.org> Message-ID: <20141020204324.K913@besplex.bde.org> References: <201410200027.s9K0RegN062458@svn.freebsd.org> <20141020140848.D935@besplex.bde.org> <20141020.162907.106891462107570268.hrs@allbsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=dMCfxopb c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=p_RFkTfqcLTqdni3OYcA:9 a=yIE4LVJX8x7CMHjK:21 a=RrRjPvj0TDJZaVYh:21 a=cR5uNpvTFSLpZS-F:21 a=CjuIK1q_8ugA:10 a=oZ2IPoelaH8A:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, brde@optusnet.com.au X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 12:47:29 -0000 On Mon, 20 Oct 2014, Hiroki Sato wrote: > Thank you for your review. I fixed lines you pointed out and > attached a patch candidate. I will show each change line by line in > this email, too: Thanks. > Bruce Evans wrote > in <20141020140848.D935@besplex.bde.org>: > > br> > - if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { > br> > + if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= > br> > + sizeof(tv1)) { > br> > /* Copy to avoid alignment problems: */ > br> > memcpy(&tv32, tp, sizeof(tv32)); > br> > tv1.tv_sec = ntohl(tv32.tv32_sec); > br> > br> This breaks the warning, and breaks the code on exotic (unsupported) > br> where it used to work accidentally. The code was already broken on > br> non-exotic arches. > > - if ((size_t)(cc - ICMP_MINLEN - phdr_len) >= > - sizeof(tv1)) { > + if (cc - ICMP_MINLEN - phdr_len >= (int)sizeof(tv1)) { I tested this. I couldn't get it to fail, but noticed another type error and re-noticed associated style bugs. The packet format is a network 32+32-bit timeval, and that is what is copied, but the bounds check is for a host timeval. On i386, network timeval == host timeval so there is no problem. On other 32-bit systems with 32+32-bit timevals, ntohl() fixes up the byte order if necessary. But on N-bit systems with >64-bit timevals, ping -s 8 is broken. It should send a 32+32-bit timeval but either doesn't send it or can't receive it. Such systems include: - most 64-bit systems. All supported ones. Most have a 64-bit time_t, and if they didn't then all supported ones have 64-bit longs so a timeval would consist of a 32-bit time_t, 32 bits of padding, and a 64-bit long. ping -s 15 doesn't work on these systems, but ping -s 16 does. - 32-bit systems with 64-bit time_t. All supported ones have only 32-bit 32-bit longs and probably have no padding, so they have 96-bit time_t and ping -s 12 would work. ping -s 8 worked on i386 in my simple tests because phdr_len is normally 0 (I don't know how to make it nonzero). The full packet size is then 36. This consists of hlen = 20, ICMP_MINLEN = 8, phdr_len = 0, and a payload consisting of the network 8-byte timeval. The style bugs here are that there is a macro TIMEVAL_LEN that is used in some places to obfuscate the problem. I don't know much about networking but have hacked on ping a bit and have old code with comments about this: % diff -u2 ping.c~ ping.c *** ping.c~ Sat Apr 10 12:10:59 2004 --- ping.c Sat Apr 10 12:11:00 2004 % @@ -93,4 +93,9 @@ % % #define INADDR_LEN ((int)sizeof(in_addr_t)) % +/* % + * XXX this macro used to hide the details of the packet layout, but it now % + * just obfuscates timevals and is not even consistently used for the size % + * of a timeval. % + */ % #define TIMEVAL_LEN ((int)sizeof(struct timeval)) % #define MASK_LEN (ICMP_MASKLEN - ICMP_MINLEN) The obfuscation has increased in -current. The above is broken since it uses host timevals. This has been fixed in -current by replacing 'timeval' by 'tv32', but that increases the obfuscation because the macro still looks like it is for a host timeval. Note that the macro already has a cast to int in it (presumably to fix warnings), so changing the patch to use it will fix both problems. But I don't like the obfuscation of that. It is good practice to use sizeof(var) instead of sizeof(typedef_name) like the code does now. This gives a better chance of applying sizeof() to the right variable although that is not done now. It was done in the old version that was broken by using host timevals. That version was consistently broken -- it didn't have tv2, and it both the sizeof and the copy were done on tv1. Further review showed that TIMEVAL_LEN is used a lot and is clearer than '(int)sizeof(struct tv32)' all over. Just rename it to something like NTIMEVAL_LEN so that it is clear that it is for a network timeval. Grepping for sizeof shows just one place where sizeof() is applied to struct timeval. This allocates space for a message. I think this should use struct tv32 too, but allocating more space than is needed and sending a larger message than needed is fairly harmless. Only 6 out of 32 lines have the style bug of following sizeof by a space. All of these also have the style bug of not parenthesizing the arg. ping6.c doesn't have TIMEVAL, and also doesn't seem to have the bug -- ping6 -s 8 works on freefall. > br> > +static u_int8_t nonce[8]; /* nonce field for node information */ > br> > br> This uses the deprecated nonstandard spelling of uint8_t. > > s/u_int_{8,16,32}_t/uint_{8,16,32}_t/ in various places. I don't like changing old code like that. Makes it hard to see important changes. You actually changed u_int8_t to u_char. > br> > - sockbufsize = lsockbufsize; > br> > + sockbufsize = (int)lsockbufsize; > br> > if (errno || !*optarg || *e || > br> > - sockbufsize != lsockbufsize) > br> > + lsockbufsize > INT_MAX) > br> > errx(1, "invalid socket buffer size"); > > br> I don't like warnings about hackish but correct code like the previous > br> version of the above. Does the compiler actually complain about > br> comparing > br> ints with unsigned longs for equality? > > Yes, this part caused the following warning: > > /usr/src/head/sbin/ping6/ping6.c:395:20: error: comparison of integers of > different signs: 'int' and 'u_long' (aka 'unsigned long') > [-Werror,-Wsign-compare] > sockbufsize != lsockbufsize) ping has much better args handling than ping6. wollman changed it from sloppy atoi()s to reasonable strtoul()s in 1997. strtoul() is easier to use than usual because most of the args have a lower limit of 0 and an upper limit of less than ULONG_MAX so simple range checks work. The methods of setting errno to 0 before the call and checking it afterwards are never needed or used. Most cases seem to be correct. ping6 was apparently fixed separatlely, not as well, and never merged. It uses errno or strtoul() only in the code quoted above. It mostly uses strtol() with the base restricted to 10 instead of strtoul() with the base unrestricted as in ping. Most cases are broken using the technique of assigning the long result to an int variable before checking it. % Index: ping6.c % =================================================================== % --- ping6.c (revision 273295) % +++ ping6.c (working copy) % @@ -136,8 +137,8 @@ % #include % % struct tv32 { % - u_int32_t tv32_sec; % - u_int32_t tv32_usec; % + uint32_t tv32_sec; % + uint32_t tv32_usec; % }; tv32 actually consists of a 32-bit time_t and a 32-bit long. The first is signed on all supported arches. The second is always signed. This is surely harmless. There are lots of type puns no matter how this is declared. The host values started as signed, but are usually nonnegative so there is no problem. Even htonl() to a host time_t or long is a type error. It depends on 2's complement to work, but you get that using int32_t. % @@ -316,7 +316,7 @@ % char *policy_out = NULL; % #endif % double t; % - u_long alarmtimeout; % + u_long alarmtimeout, ultmp; % size_t rthlen; % #ifdef IPV6_USE_MIN_MTU % int mflag = 0; u_long is a bogus type for the alarm timeout. alarm() takes a u_int arg. ping.c has this bug too. All the alarmtimeout code in ping.c was obviously not cleaned up by Wollman in 1997, since has a different style and lower quality. u_long is used here mainly to assign the result of alarmtimeout directly to it, instead of using ultmp like almost everywhere else. Other style bugs include using excessive parentheses not checking for null operands in the usual way (this is only a style bug since null operands give an out-of-range operand of 0) and a bogus ULONG_MAX check (this is only a style bug since ULONG_MAX fails a correct range check later). Other bugs include not checking for garbage after the operand. Implementing these bugs takes about 50% more code (mainly to duplicate the err() message). That was for the arg parsing of alarmtimeout. Then when it is used, it is bogusly cast to int. The prototype would convert it to the correct type, u_int. Compilers should warn about either or none of the the explicit conversion to int or the prototype's conversion to u_int, depending on the warning level and whether thay can see that the range checking ensures that that the value always fits in an int. % @@ -388,11 +388,10 @@ % #if defined(SO_SNDBUF) && defined(SO_RCVBUF) % errno = 0; This can probably be removed too. % e = NULL; This was nonsense and can certainly be removed. The endptr parameter in the strtol() family is output-only. % - lsockbufsize = strtoul(optarg, &e, 10); % - sockbufsize = (int)lsockbufsize; % - if (errno || !*optarg || *e || % - lsockbufsize > INT_MAX) % + ultmp = strtoul(optarg, &e, 10); % + if (errno || !*optarg || *e || ultmp > INT_MAX) % errx(1, "invalid socket buffer size"); % + sockbufsize = ultmp; Compare with 1997 ping code. It is similar after removing errno. Other differences: - ping spells the endptr variable ep - ping doesn't limit the base to 10 - ping orders the test with *ep first - both use the boolean test for the non-boolean *ep, but only ping6 uses it for !*optarg. Anyway, the !*optarg test is broken. It only detects empty strings, while the correct test ep == optarg that is used by ping detects other garbage like strings consisting of only leading whitespace (maybe followed by a sign). % #else % errx(1, % "-b option ignored: SO_SNDBUF/SO_RCVBUF socket options not supported"); % @@ -522,14 +521,15 @@ % options |= F_SRCADDR; % break; % case 's': /* size of packet to send */ % - datalen = strtol(optarg, &e, 10); % - if (datalen <= 0 || *optarg == '\0' || *e != '\0') % - errx(1, "illegal datalen value -- %s", optarg); % - if (datalen > MAXDATALEN) { % - errx(1, % - "datalen value too large, maximum is %d", % + ultmp = strtoul(optarg, &e, 10); % + if (*e || e == optarg) % + errx(EX_USAGE, "invalid packet size: `%s'", % + optarg); % + if (ultmp > MAXDATALEN) % + errx(EX_USAGE, % + "packetsize too large, maximum is %d", % MAXDATALEN); % - } % + datalen = ultmp; % break; Here you seem to have mostly copied ping. ping requires privileges for sizes larger than DEFDATALEN. In the privileged case it is broken by not having a bounds check. In the unprivileged case, its error is EPERM, while the error is always EX_USAGE in the above. I don't like the restriction for ping. Is inet6 so much different that it doesn't need the restriction? I think inet4 never needed it after about 1990 in the US and a bit later here when anyone could afford a system for spamming the internet. Anyone could exercise the winping bug, but such bugs should have been fixed by now. The separate context-dependent messages in the above and in ping are not very useful. The first one is often incorrect. It says that the packet size is invalid, but the size has not been checked yet. Only the format of the arg has been checked. The second message is missing a space in "packet size" and has a grammar error (comman splice) in the above only. ping.c's second message also prints the value that is too large (this is more than echoing the arg, since it removes leading spaces and converts -1 to a huge u_long value). I wouldn't try hard to generate correct context-sensitive messages for all types of errors from strto*(). % @@ -718,7 +718,7 @@ % errx(1, "-f and -i incompatible options"); % % if ((options & F_NOUSERDATA) == 0) { % - if (datalen >= sizeof(struct tv32)) { % + if (datalen >= (int)sizeof(struct tv32)) { Another use for TIMEVAL_LEN. % @@ -1419,7 +1419,7 @@ % while (cp < ep) { % i = *cp; % if (i == 0 || cp != *sp) { % - if (strlcat((char *)buf, ".", bufsiz) >= bufsiz) % + if ((int)strlcat((char *)buf, ".", bufsiz) >= bufsiz) % return NULL; /*result overrun*/ % } % if (i == 0) I don't like strlcat() and haven't thought about code like this much. It returns size_t where snprintf() returns int. This causes them to have the opposite sign extension and possibly representability problems. I think the case is safe because all possible return values are small. % @@ -1812,7 +1813,7 @@ % * Bounds checking on the ancillary data buffer: % * subtract the size of a cmsg structure from the buffer size. % */ % - if (bufsize < (extlen + CMSG_SPACE(0))) { % + if (bufsize < (int)(extlen + CMSG_SPACE(0))) { % extlen = bufsize - CMSG_SPACE(0); % warnx("options truncated, showing only %u (total=%u)", % (unsigned int)(extlen / 8 - 1), Oops, it wasn't such a good idea to change bufsize from size_t. Now it interacts badly with strlcat() and CMSG*(). % @@ -1835,7 +1836,7 @@ % offset = inet6_opt_get_val(databuf, offset, % &value4, sizeof(value4)); % printf(" Jumbo Payload Opt: Length %u\n", % - (u_int32_t)ntohl(value4)); % + (uint32_t)ntohl(value4)); This case is bogus. ntohl() already returns uint32_t, so the cast has no effect. However it is only accidental that uint32_t matches the format arg. The correct cast is to u_int, but it is painful to fix all the print formats that have this bug (similarly for signed int). % @@ -2027,7 +2028,7 @@ % % for (off = 0; off < clen; off += sizeof(v)) { % memcpy(&v, cp + off, sizeof(v)); % - v = (u_int32_t)ntohl(v); % + v = (uint32_t)ntohl(v); This bogus cast has no effect at all. ntohl() returning uint32_t has been in POSIX since at least 2001, and BSD always assumed 32-bit longs so it didn't need this cast before 2001. % @@ -2072,16 +2073,16 @@ % * by the length of the data, but note that the detection algorithm % * is incomplete. We assume the latest draft by default. % */ % - if (nilen % (sizeof(u_int32_t) + sizeof(struct in6_addr)) == 0) % + if (nilen % (sizeof(uint32_t) + sizeof(struct in6_addr)) == 0) % withttl = 1; % while (nilen > 0) { % - u_int32_t ttl; % + uint32_t ttl; % % if (withttl) { % /* XXX: alignment? */ % - ttl = (u_int32_t)ntohl(*(u_int32_t *)cp); % - cp += sizeof(u_int32_t); % - nilen -= sizeof(u_int32_t); % + ttl = (uint32_t)ntohl(*(uint32_t *)cp); % + cp += sizeof(uint32_t); % + nilen -= sizeof(uint32_t); Lots more bogus casts. Why spell 4 as sizeof(uint32_t)? Spelling it as sizeof(var), where var is the uint32_t variable copied to would be a more useful spelling. % @@ -2527,7 +2528,7 @@ % % printf("Vr TC Flow Plen Nxt Hlim\n"); % printf(" %1x %02x %05x %04x %02x %02x\n", % - (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (u_int32_t)ntohl(flow), % + (ip6->ip6_vfc & IPV6_VERSION_MASK) >> 4, tc, (uint32_t)ntohl(flow), % ntohs(ip6->ip6_plen), ip6->ip6_nxt, ip6->ip6_hlim); % if (!inet_ntop(AF_INET6, &ip6->ip6_src, ntop_buf, sizeof(ntop_buf))) % strlcpy(ntop_buf, "?", sizeof(ntop_buf)); Looks like most of the bogus casts were from a time when ntohl() returned long on some systems, but instead of fixing the format to match the type, the type was broken to match the format. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 13:18:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78B062BC; Mon, 20 Oct 2014 13:18:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6594C2E1; Mon, 20 Oct 2014 13:18:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KDIrhx054145; Mon, 20 Oct 2014 13:18:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KDIqhN054143; Mon, 20 Oct 2014 13:18:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410201318.s9KDIqhN054143@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 20 Oct 2014 13:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273328 - in head/sys/dev/ata: . chipsets X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 13:18:53 -0000 Author: mav Date: Mon Oct 20 13:18:52 2014 New Revision: 273328 URL: https://svnweb.freebsd.org/changeset/base/273328 Log: Add another PCI ID for JMB368 PATA controller. MFC after: 1 week Modified: head/sys/dev/ata/ata-pci.h head/sys/dev/ata/chipsets/ata-jmicron.c Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Mon Oct 20 11:21:07 2014 (r273327) +++ head/sys/dev/ata/ata-pci.h Mon Oct 20 13:18:52 2014 (r273328) @@ -306,6 +306,7 @@ struct ata_pci_controller { #define ATA_JMB365 0x2365197b #define ATA_JMB366 0x2366197b #define ATA_JMB368 0x2368197b +#define ATA_JMB368_2 0x0368197b #define ATA_MARVELL_ID 0x11ab #define ATA_M88SX5040 0x504011ab Modified: head/sys/dev/ata/chipsets/ata-jmicron.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-jmicron.c Mon Oct 20 11:21:07 2014 (r273327) +++ head/sys/dev/ata/chipsets/ata-jmicron.c Mon Oct 20 13:18:52 2014 (r273328) @@ -71,6 +71,7 @@ ata_jmicron_probe(device_t dev) { ATA_JMB365, 0, 1, 2, ATA_UDMA6, "JMB365" }, { ATA_JMB366, 0, 2, 2, ATA_UDMA6, "JMB366" }, { ATA_JMB368, 0, 0, 1, ATA_UDMA6, "JMB368" }, + { ATA_JMB368_2, 0, 0, 1, ATA_UDMA6, "JMB368" }, { 0, 0, 0, 0, 0, 0}}; char buffer[64]; From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 13:36:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9568D60E; Mon, 20 Oct 2014 13:36:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 81F2E6BE; Mon, 20 Oct 2014 13:36:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KDarfa063376; Mon, 20 Oct 2014 13:36:53 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KDarfB063375; Mon, 20 Oct 2014 13:36:53 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410201336.s9KDarfB063375@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 20 Oct 2014 13:36:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273329 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 13:36:53 -0000 Author: loos Date: Mon Oct 20 13:36:52 2014 New Revision: 273329 URL: https://svnweb.freebsd.org/changeset/base/273329 Log: Add another wakeup() after actually set the bus as free. This fix a race where the threads waiting for the bus would wake up early and still see bus as busy. While here, give a better description to wmesg for the two use cases we have (bus and io waiting). MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:18:52 2014 (r273328) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 13:36:52 2014 (r273329) @@ -395,7 +395,7 @@ bcm_bsc_transfer(device_t dev, struct ii /* If the controller is busy wait until it is available. */ while (sc->sc_flags & BCM_I2C_BUSY) - mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", 0); + mtx_sleep(dev, &sc->sc_mtx, 0, "bscbusw", 0); /* Now we have control over the BSC controller. */ sc->sc_flags = BCM_I2C_BUSY; @@ -439,7 +439,7 @@ bcm_bsc_transfer(device_t dev, struct ii BCM_BSC_CTRL_ST | read | intr); /* Wait for the transaction to complete. */ - err = mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", hz); + err = mtx_sleep(dev, &sc->sc_mtx, 0, "bsciow", hz); /* Check if we have a timeout or an I2C error. */ if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) { @@ -452,6 +452,9 @@ bcm_bsc_transfer(device_t dev, struct ii /* Clean the controller flags. */ sc->sc_flags = 0; + /* Wake up the threads waiting for bus. */ + wakeup(dev); + BCM_BSC_UNLOCK(sc); return (err); From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 14:25:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A1ED6EB; Mon, 20 Oct 2014 14:25:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6686AF94; Mon, 20 Oct 2014 14:25:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KEPOJr086700; Mon, 20 Oct 2014 14:25:24 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KEPOWx086699; Mon, 20 Oct 2014 14:25:24 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201410201425.s9KEPOWx086699@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Mon, 20 Oct 2014 14:25:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273330 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 14:25:24 -0000 Author: dumbbell Date: Mon Oct 20 14:25:23 2014 New Revision: 273330 URL: https://svnweb.freebsd.org/changeset/base/273330 Log: vt(4): Refuse to load a font if hw.vga.textmode is selected Before, the font was loaded and the window size recalculated, giving an unusable terminal, even if the actual font didn't change. Reported by: beeessdee@ruggedinbox.com MFC after: 3 days Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Oct 20 13:36:52 2014 (r273329) +++ head/sys/dev/vt/vt_core.c Mon Oct 20 14:25:23 2014 (r273330) @@ -2207,6 +2207,9 @@ skip_thunk: case PIO_VFONT: { struct vt_font *vf; + if (vd->vd_flags & VDF_TEXTMODE) + return (ENOTSUP); + error = vtfont_load((void *)data, &vf); if (error != 0) return (error); From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 14:42:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B3F51F8; Mon, 20 Oct 2014 14:42:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 14D492F8; Mon, 20 Oct 2014 14:42:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KEgixT096175; Mon, 20 Oct 2014 14:42:44 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KEggqt096167; Mon, 20 Oct 2014 14:42:42 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410201442.s9KEggqt096167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Mon, 20 Oct 2014 14:42:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 14:42:44 -0000 Author: bryanv Date: Mon Oct 20 14:42:42 2014 New Revision: 273331 URL: https://svnweb.freebsd.org/changeset/base/273331 Log: Add vxlan interface vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in a UDP packet. This implementation is based on RFC7348. Currently, the IPv6 support is not fully compliant with the specification: we should be able to receive UPDv6 packets with a zero checksum, but we need to support RFC6935 first. Patches for this should come soon. Encapsulation protocols such as vxlan emphasize the need for the FreeBSD network stack to support batching, GRO, and GSO. Each frame has to make two trips through the network stack, and each frame will be at most MTU sized. Performance suffers accordingly. Some latest generation NICs have begun to support vxlan HW offloads that we should also take advantage of. VIMAGE support should also be added soon. Differential Revision: https://reviews.freebsd.org/D384 Reviewed by: gnn Relnotes: yes Added: head/sbin/ifconfig/ifvxlan.c (contents, props changed) head/share/man/man4/vxlan.4 (contents, props changed) head/sys/modules/if_vxlan/ head/sys/modules/if_vxlan/Makefile (contents, props changed) head/sys/net/if_vxlan.c (contents, props changed) head/sys/net/if_vxlan.h (contents, props changed) Modified: head/sbin/ifconfig/Makefile head/sbin/ifconfig/ifconfig.8 head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/modules/Makefile head/sys/sys/priv.h Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Mon Oct 20 14:25:23 2014 (r273330) +++ head/sbin/ifconfig/Makefile Mon Oct 20 14:42:42 2014 (r273331) @@ -30,6 +30,7 @@ SRCS+= ifmac.c # MAC support SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support SRCS+= iffib.c # non-default FIB support SRCS+= ifvlan.c # SIOC[GS]ETVLAN support +SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:25:23 2014 (r273330) +++ head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:42:42 2014 (r273331) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd October 1, 2014 +.Dd October 20, 2014 .Dt IFCONFIG 8 .Os .Sh NAME @@ -2541,6 +2541,76 @@ argument is useless and hence deprecated .El .Pp The following parameters are used to configure +.Xr vxlan 4 +interfaces. +.Bl -tag -width indent +.It Cm vni Ar identifier +This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the +virtual network segment membership of the interface. +.It Cm local Ar address +The source address used in the encapsulating IPv4/IPv6 header. +The address should already be assigned to an existing interface. +When the interface is configured in unicast mode, the listening socket +is bound to this address. +.It Cm remote Ar address +The interface can be configured in a unicast, or point-to-point, mode +to create a tunnel between two hosts. +This is the IP address of the remote end of the tunnel. +.It Cm group Ar address +The interface can be configured in a multicast mode +to create a virtual network of hosts. +This is the IP multicast group address the interface will join. +.It Cm localport Ar port +The port number the interface will listen on. +The default port number is 4789. +.It Cm remoteport Ar port +The destination port number used in the encapsulating IPv4/IPv6 header. +The remote host should be listening on this port. +The default port number is 4789. +Note some other implementations, such as Linux, +do not default to the IANA assigned port, +but instead listen on port 8472. +.It Cm portrange Ar low high +The range of source ports used in the encapsulating IPv4/IPv6 header. +The port selected within the range is based on a hash of the inner frame. +A range is useful to provide entropy within the outer IP header +for more effective load balancing. +The default range is between the +.Xr sysctl 8 +variables +.Va net.inet.ip.portrange.first +and +.Va net.inet.ip.portrange.last +.It Cm timeout Ar timeout +The maximum time, in seconds, before an entry in the forwarding table +is pruned. +The default is 1200 seconds (20 minutes). +.It Cm maxaddr Ar max +The maximum number of entries in the forwarding table. +The default is 2000. +.It Cm vxlandev Ar dev +When the interface is configured in multicast mode, the +.Cm dev +interface is used to transmit IP multicast packets. +.It Cm ttl Ar ttl +The TTL used in the encapsulating IPv4/IPv6 header. +The default is 64. +.It Cm learn +The source IP address and inner source Ethernet MAC address of +received packets are used to dynamically populate the forwarding table. +When in multicast mode, an entry in the forwarding table allows the +interface to send the frame directly to the remote host instead of +broadcasting the frame to the multicast group. +This is the default. +.It Fl learn +The forwarding table is not populated by recevied packets. +.It Cm flush +Delete all dynamically-learned addresses from the forwarding table. +.It Cm flushall +Delete all addresses, including static addresses, from the forwarding table. +.El +.Pp +The following parameters are used to configure .Xr carp 4 protocol on an interface: .Bl -tag -width indent @@ -2745,6 +2815,7 @@ tried to alter an interface's configurat .Xr pfsync 4 , .Xr polling 4 , .Xr vlan 4 , +.Xr vxlan 4 , .Xr devd.conf 5 , .\" .Xr eon 5 , .Xr devd 8 , Added: head/sbin/ifconfig/ifvxlan.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ifconfig/ifvxlan.c Mon Oct 20 14:42:42 2014 (r273331) @@ -0,0 +1,648 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ifconfig.h" + +static struct ifvxlanparam params = { + .vxlp_vni = VXLAN_VNI_MAX, +}; + +static int +get_val(const char *cp, u_long *valp) +{ + char *endptr; + u_long val; + + errno = 0; + val = strtoul(cp, &endptr, 0); + if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE) + return (-1); + + *valp = val; + return (0); +} + +static int +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) +{ + struct ifdrv ifd; + + bzero(&ifd, sizeof(ifd)); + + strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = op; + ifd.ifd_len = argsize; + ifd.ifd_data = arg; + + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); +} + +static int +vxlan_exists(int sock) +{ + struct ifvxlancfg cfg; + + bzero(&cfg, sizeof(cfg)); + + return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) != -1); +} + +static void +vxlan_status(int s) +{ + struct ifvxlancfg cfg; + char src[NI_MAXHOST], dst[NI_MAXHOST]; + char srcport[NI_MAXSERV], dstport[NI_MAXSERV]; + struct sockaddr *lsa, *rsa; + int vni, mc, ipv6; + + bzero(&cfg, sizeof(cfg)); + + if (do_cmd(s, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) < 0) + return; + + vni = cfg.vxlc_vni; + lsa = &cfg.vxlc_local_sa.sa; + rsa = &cfg.vxlc_remote_sa.sa; + ipv6 = rsa->sa_family == AF_INET6; + + /* Just report nothing if the network identity isn't set yet. */ + if (vni >= VXLAN_VNI_MAX) + return; + + if (getnameinfo(lsa, lsa->sa_len, src, sizeof(src), + srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) + src[0] = srcport[0] = '\0'; + if (getnameinfo(rsa, rsa->sa_len, dst, sizeof(dst), + dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) + dst[0] = dstport[0] = '\0'; + + if (!ipv6) { + struct sockaddr_in *sin = (struct sockaddr_in *)rsa; + mc = IN_MULTICAST(ntohl(sin->sin_addr.s_addr)); + } else { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rsa; + mc = IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr); + } + + printf("\tvxlan vni %d", vni); + printf(" local %s%s%s:%s", ipv6 ? "[" : "", src, ipv6 ? "]" : "", + srcport); + printf(" %s %s%s%s:%s", mc ? "group" : "remote", ipv6 ? "[" : "", + dst, ipv6 ? "]" : "", dstport); + + if (verbose) { + printf("\n\t\tconfig: "); + printf("%slearning portrange %d-%d ttl %d", + cfg.vxlc_learn ? "" : "no", cfg.vxlc_port_min, + cfg.vxlc_port_max, cfg.vxlc_ttl); + printf("\n\t\tftable: "); + printf("cnt %d max %d timeout %d", + cfg.vxlc_ftable_cnt, cfg.vxlc_ftable_max, + cfg.vxlc_ftable_timeout); + } + + putchar('\n'); +} + +#define _LOCAL_ADDR46 \ + (VXLAN_PARAM_WITH_LOCAL_ADDR4 | VXLAN_PARAM_WITH_LOCAL_ADDR6) +#define _REMOTE_ADDR46 \ + (VXLAN_PARAM_WITH_REMOTE_ADDR4 | VXLAN_PARAM_WITH_REMOTE_ADDR6) + +static void +vxlan_check_params(void) +{ + + if ((params.vxlp_with & _LOCAL_ADDR46) == _LOCAL_ADDR46) + errx(1, "cannot specify both local IPv4 and IPv6 addresses"); + if ((params.vxlp_with & _REMOTE_ADDR46) == _REMOTE_ADDR46) + errx(1, "cannot specify both remote IPv4 and IPv6 addresses"); + if ((params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR4 && + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR6) || + (params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR6 && + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR4)) + errx(1, "cannot mix IPv4 and IPv6 addresses"); +} + +#undef _LOCAL_ADDR46 +#undef _REMOTE_ADDR46 + +static void +vxlan_cb(int s, void *arg) +{ + +} + +static void +vxlan_create(int s, struct ifreq *ifr) +{ + + vxlan_check_params(); + + ifr->ifr_data = (caddr_t) ¶ms; + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) + err(1, "SIOCIFCREATE2"); +} + +static +DECL_CMD_FUNC(setvxlan_vni, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val >= VXLAN_VNI_MAX) + errx(1, "invalid network identifier: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_VNI; + params.vxlp_vni = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_vni = val; + + if (do_cmd(s, VXLAN_CMD_SET_VNI, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_VNI"); +} + +static +DECL_CMD_FUNC(setvxlan_local, addr, d) +{ + struct ifvxlancmd cmd; + struct addrinfo *ai; + struct sockaddr *sa; + int error; + + bzero(&cmd, sizeof(cmd)); + + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) + errx(1, "error in parsing local address string: %s", + gai_strerror(error)); + + sa = ai->ai_addr; + + switch (ai->ai_family) { +#ifdef INET + case AF_INET: { + struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr; + + if (IN_MULTICAST(ntohl(addr.s_addr))) + errx(1, "local address cannot be multicast"); + + cmd.vxlcmd_sa.in4.sin_family = AF_INET; + cmd.vxlcmd_sa.in4.sin_addr = addr; + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + + if (IN6_IS_ADDR_MULTICAST(addr)) + errx(1, "local address cannot be multicast"); + + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; + cmd.vxlcmd_sa.in6.sin6_addr = *addr; + break; + } +#endif + default: + errx(1, "local address %s not supported", addr); + } + + freeaddrinfo(ai); + + if (!vxlan_exists(s)) { + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4; + params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr; + } else { + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6; + params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + } + return; + } + + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_ADDR, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_LOCAL_ADDR"); +} + +static +DECL_CMD_FUNC(setvxlan_remote, addr, d) +{ + struct ifvxlancmd cmd; + struct addrinfo *ai; + struct sockaddr *sa; + int error; + + bzero(&cmd, sizeof(cmd)); + + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) + errx(1, "error in parsing remote address string: %s", + gai_strerror(error)); + + sa = ai->ai_addr; + + switch (ai->ai_family) { +#ifdef INET + case AF_INET: { + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + + if (IN_MULTICAST(ntohl(addr.s_addr))) + errx(1, "remote address cannot be multicast"); + + cmd.vxlcmd_sa.in4.sin_family = AF_INET; + cmd.vxlcmd_sa.in4.sin_addr = addr; + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + + if (IN6_IS_ADDR_MULTICAST(addr)) + errx(1, "remote address cannot be multicast"); + + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; + cmd.vxlcmd_sa.in6.sin6_addr = *addr; + break; + } +#endif + default: + errx(1, "remote address %s not supported", addr); + } + + freeaddrinfo(ai); + + if (!vxlan_exists(s)) { + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; + } else { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + } + return; + } + + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); +} + +static +DECL_CMD_FUNC(setvxlan_group, addr, d) +{ + struct ifvxlancmd cmd; + struct addrinfo *ai; + struct sockaddr *sa; + int error; + + bzero(&cmd, sizeof(cmd)); + + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) + errx(1, "error in parsing group address string: %s", + gai_strerror(error)); + + sa = ai->ai_addr; + + switch (ai->ai_family) { +#ifdef INET + case AF_INET: { + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; + + if (!IN_MULTICAST(ntohl(addr.s_addr))) + errx(1, "group address must be multicast"); + + cmd.vxlcmd_sa.in4.sin_family = AF_INET; + cmd.vxlcmd_sa.in4.sin_addr = addr; + break; + } +#endif +#ifdef INET6 + case AF_INET6: { + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; + + if (!IN6_IS_ADDR_MULTICAST(addr)) + errx(1, "group address must be multicast"); + + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; + cmd.vxlcmd_sa.in6.sin6_addr = *addr; + break; + } +#endif + default: + errx(1, "group address %s not supported", addr); + } + + freeaddrinfo(ai); + + if (!vxlan_exists(s)) { + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; + } else { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; + } + return; + } + + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); +} + +static +DECL_CMD_FUNC(setvxlan_local_port, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) + errx(1, "invalid local port: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_PORT; + params.vxlp_local_port = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_port = val; + + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_PORT, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_LOCAL_PORT"); +} + +static +DECL_CMD_FUNC(setvxlan_remote_port, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) + errx(1, "invalid remote port: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_PORT; + params.vxlp_remote_port = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_port = val; + + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_PORT, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_REMOTE_PORT"); +} + +static +DECL_CMD_FUNC2(setvxlan_port_range, arg1, arg2) +{ + struct ifvxlancmd cmd; + u_long min, max; + + if (get_val(arg1, &min) < 0 || min >= UINT16_MAX) + errx(1, "invalid port range minimum: %s", arg1); + if (get_val(arg2, &max) < 0 || max >= UINT16_MAX) + errx(1, "invalid port range maximum: %s", arg2); + if (max < min) + errx(1, "invalid port range"); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_PORT_RANGE; + params.vxlp_min_port = min; + params.vxlp_max_port = max; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_port_min = min; + cmd.vxlcmd_port_max = max; + + if (do_cmd(s, VXLAN_CMD_SET_PORT_RANGE, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_PORT_RANGE"); +} + +static +DECL_CMD_FUNC(setvxlan_timeout, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) + errx(1, "invalid timeout value: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_TIMEOUT; + params.vxlp_ftable_timeout = val & 0xFFFFFFFF; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_ftable_timeout = val & 0xFFFFFFFF; + + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_TIMEOUT, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_FTABLE_TIMEOUT"); +} + +static +DECL_CMD_FUNC(setvxlan_maxaddr, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) + errx(1, "invalid maxaddr value: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_MAX; + params.vxlp_ftable_max = val & 0xFFFFFFFF; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_ftable_max = val & 0xFFFFFFFF; + + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_MAX, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_FTABLE_MAX"); +} + +static +DECL_CMD_FUNC(setvxlan_dev, arg, d) +{ + struct ifvxlancmd cmd; + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_MULTICAST_IF; + strlcpy(params.vxlp_mc_ifname, arg, + sizeof(params.vxlp_mc_ifname)); + return; + } + + bzero(&cmd, sizeof(cmd)); + strlcpy(cmd.vxlcmd_ifname, arg, sizeof(cmd.vxlcmd_ifname)); + + if (do_cmd(s, VXLAN_CMD_SET_MULTICAST_IF, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_MULTICAST_IF"); +} + +static +DECL_CMD_FUNC(setvxlan_ttl, arg, d) +{ + struct ifvxlancmd cmd; + u_long val; + + if (get_val(arg, &val) < 0 || val > 256) + errx(1, "invalid TTL value: %s", arg); + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_TTL; + params.vxlp_ttl = val; + return; + } + + bzero(&cmd, sizeof(cmd)); + cmd.vxlcmd_ttl = val; + + if (do_cmd(s, VXLAN_CMD_SET_TTL, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_TTL"); +} + +static +DECL_CMD_FUNC(setvxlan_learn, arg, d) +{ + struct ifvxlancmd cmd; + + if (!vxlan_exists(s)) { + params.vxlp_with |= VXLAN_PARAM_WITH_LEARN; + params.vxlp_learn = d; + return; + } + + bzero(&cmd, sizeof(cmd)); + if (d != 0) + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_LEARN; + + if (do_cmd(s, VXLAN_CMD_SET_LEARN, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_SET_LEARN"); +} + +static void +setvxlan_flush(const char *val, int d, int s, const struct afswtch *afp) +{ + struct ifvxlancmd cmd; + + bzero(&cmd, sizeof(cmd)); + if (d != 0) + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_FLUSH_ALL; + + if (do_cmd(s, VXLAN_CMD_FLUSH, &cmd, sizeof(cmd), 1) < 0) + err(1, "VXLAN_CMD_FLUSH"); +} + +static struct cmd vxlan_cmds[] = { + + DEF_CLONE_CMD_ARG("vni", setvxlan_vni), + DEF_CLONE_CMD_ARG("local", setvxlan_local), + DEF_CLONE_CMD_ARG("remote", setvxlan_remote), + DEF_CLONE_CMD_ARG("group", setvxlan_group), + DEF_CLONE_CMD_ARG("localport", setvxlan_local_port), + DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port), + DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range), + DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout), + DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr), + DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev), + DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl), + DEF_CLONE_CMD("learn", 1, setvxlan_learn), + DEF_CLONE_CMD("-learn", 0, setvxlan_learn), + + DEF_CMD_ARG("vni", setvxlan_vni), + DEF_CMD_ARG("local", setvxlan_local), + DEF_CMD_ARG("remote", setvxlan_remote), + DEF_CMD_ARG("group", setvxlan_group), + DEF_CMD_ARG("localport", setvxlan_local_port), + DEF_CMD_ARG("remoteport", setvxlan_remote_port), + DEF_CMD_ARG2("portrange", setvxlan_port_range), + DEF_CMD_ARG("timeout", setvxlan_timeout), + DEF_CMD_ARG("maxaddr", setvxlan_maxaddr), + DEF_CMD_ARG("vxlandev", setvxlan_dev), + DEF_CMD_ARG("ttl", setvxlan_ttl), + DEF_CMD("learn", 1, setvxlan_learn), + DEF_CMD("-learn", 0, setvxlan_learn), + + DEF_CMD("flush", 0, setvxlan_flush), + DEF_CMD("flushall", 1, setvxlan_flush), +}; + +static struct afswtch af_vxlan = { + .af_name = "af_vxlan", + .af_af = AF_UNSPEC, + .af_other_status = vxlan_status, +}; + +static __constructor void +vxlan_ctor(void) +{ +#define N(a) (sizeof(a) / sizeof(a[0])) + size_t i; + + for (i = 0; i < N(vxlan_cmds); i++) + cmd_register(&vxlan_cmds[i]); + af_register(&af_vxlan); + callback_register(vxlan_cb, NULL); + clone_setdefcallback("vxlan", vxlan_create); +#undef N +} Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Mon Oct 20 14:25:23 2014 (r273330) +++ head/share/man/man4/Makefile Mon Oct 20 14:42:42 2014 (r273331) @@ -567,6 +567,7 @@ MAN= aac.4 \ ${_virtio_scsi.4} \ vkbd.4 \ vlan.4 \ + vxlan.4 \ ${_vmx.4} \ vpo.4 \ vr.4 \ @@ -743,6 +744,7 @@ MLINKS+=urndis.4 if_urndis.4 MLINKS+=${_urtw.4} ${_if_urtw.4} MLINKS+=vge.4 if_vge.4 MLINKS+=vlan.4 if_vlan.4 +MLINKS+=vxlan.4 if_vxlan.4 MLINKS+=${_vmx.4} ${_if_vmx.4} MLINKS+=vpo.4 imm.4 MLINKS+=vr.4 if_vr.4 Added: head/share/man/man4/vxlan.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/vxlan.4 Mon Oct 20 14:42:42 2014 (r273331) @@ -0,0 +1,235 @@ +.\" Copyright (c) 2014 Bryan Venteicher +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 20, 2014 +.Dt VXLAN 4 +.Os +.Sh NAME +.Nm vxlan +.Nd "Virtual eXtensible LAN interface" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device vxlan" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_vxlan_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver creates a virtual tunnel endpoint in a +.Nm +segment. +A +.Nm +segment is a virtual Layer 2 (Ethernet) network that is overlaid +in a Layer 3 (IP/UDP) network. +.Nm +is analogous to +.Xr vlan 4 +but is designed to be better suited for large, multiple tenant +data center environments. +.Pp +Each +.Nm +interface is created at runtime using interface cloning. +This is most easily done with the +.Xr ifconfig 8 +.Cm create +command or using the +.Va cloned_interfaces +variable in +.Xr rc.conf 5 . +The interface may be removed with the +.Xr ifconfig 8 +.Cm destroy +command. +.Pp +The +.Nm +driver creates a pseudo Ethernet network interface +that supports the usual network +.Xr ioctl 2 Ns s +and is thus can be used with +.Xr ifconfig 8 +like any other Ethernet interface. +The +.Nm +interface encapsulates the Ethernet frame +by prepending IP/UDP and +.Nm +headers. +Thus, the encapsulated (inner) frame is able to transmitted +over a routed, Layer 3 network to the remote host. +.Pp +The +.Nm +interface may be configured in either unicast or multicast mode. +When in unicast mode, +the interface creates a tunnel to a single remote host, +and all traffic is transmitted to that host. +When in multicast mode, +the interface joins an IP multicast group, +and receives packets sent to the group address, +and transmits packets to either the multicast group address, +or directly the remote host if there is an appropriate +forwarding table entry. +.Pp +When the +.Nm +interface is brought up, a +.Xr UDP 4 +.Xr socket 9 +is created based on the configuration, +such as the local address for unicast mode or +the group address for multicast mode, +and the listening (local) port number. +Since multiple +.Nm +interfaces may be created that either +use the same local address +or join the same group address, +and use the same port, +the driver may share a socket among multiple interfaces. +However, each interface within a socket must belong to +a unique +.Nm +segment. +The analogous +.Xr vlan 4 +configuration would be a physical interface configured as +the parent device for multiple VLAN interfaces, each with +a unique VLAN tag. +Each +.Nm +segment is identified by a 24-bit value in the +.Nm +header called the +.Dq VXLAN Network Identifier , +or VNI. +.Pp +When configured with the +.Xr ifconfig 8 +.Cm learn +parameter, the interface dynamically creates forwarding table entries +from received packets. +An entry in the forwarding table maps the inner source MAC address +to the outer remote IP address. +During transmit, the interface attempts to lookup an entry for +the encapsulated destination MAC address. +If an entry is found, the IP address in the entry is used to directly +transmit the encapsulated frame to the destination. +Otherwise, when configured in multicast mode, +the interface must flood the frame to all hosts in the group. +The maximum number of entries in the table is configurable with the +.Xr ifconfig 8 +.Cm maxaddr +command. +Stale entries in the table periodically pruned. +The timeout is configurable with the +.Xr ifconfig 8 +.Cm timeout +command. +The table may be viewed with the +.Xr sysctl 8 +.Cm net.link.vlxan.N.ftable.dump +command. +.Sh MTU +Since the +.Nm +interface encapsulates the Ethernet frame with an IP, UDP, and +.Nm +header, the resulting frame may be larger than the MTU of the +physical network. +The +.Nm +specification recommends the physical network MTU be configured +to use jumbo frames to accommodate the encapsulated frame size. +Alternatively, the +.Xr ifconfig 8 +.Cm mtu +command may be used to reduce the MTU size on the +.Nm +interface to allow the encapsulated frame to fit in the +current MTU of the physical network. +.Sh EXAMPLES +Create a +.Nm +interface in unicast mode +with the +.Cm local +tunnel address of 192.168.100.1, +and the +.Cm remote +tunnel address of 192.168.100.2. +.Bd -literal -offset indent +ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2 +.Ed +.Pp +Create a +.Nm +interface in multicast mode, +with the +.Cm local +address of 192.168.10.95, +and the +.Cm group +address of 224.0.2.6. +The em0 interface will be used to transmit multicast packets. +.Bd -literal -offset indent +ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0 +.Ed +.Pp +Once created, the +.Nm +interface can be configured with +.Xr ifconfig 8 . +.Sh SEE ALSO +.Xr ifconfig 8 , +.Xr inet 4 , +.Xr inet 6 , +.Xr sysctl 8 , +.Xr vlan 8 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 14:48:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C74F74B1; Mon, 20 Oct 2014 14:48:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3B67364; Mon, 20 Oct 2014 14:48:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KEmKiV096977; Mon, 20 Oct 2014 14:48:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KEmKIe096976; Mon, 20 Oct 2014 14:48:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410201448.s9KEmKIe096976@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 20 Oct 2014 14:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273332 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 14:48:20 -0000 Author: emaste Date: Mon Oct 20 14:48:20 2014 New Revision: 273332 URL: https://svnweb.freebsd.org/changeset/base/273332 Log: Add vtfontcvt(8) cross-reference to vt(4) man page Reported by: beeessdee@ruggedinbox.com MFC after: 3 days Modified: head/share/man/man4/vt.4 Modified: head/share/man/man4/vt.4 ============================================================================== --- head/share/man/man4/vt.4 Mon Oct 20 14:42:42 2014 (r273331) +++ head/share/man/man4/vt.4 Mon Oct 20 14:48:20 2014 (r273332) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 16, 2014 +.Dd October 20, 2014 .Dt "VIRTUAL TERMINALS" 4 .Os .Sh NAME @@ -273,7 +273,8 @@ on a black background, or black on a bri .Xr getty 8 , .Xr kbdmux 8 , .Xr kldload 8 , -.Xr moused 8 +.Xr moused 8 , +.Xr vtfontcvt 8 .Sh HISTORY The .Nm From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 15:41:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88750430; Mon, 20 Oct 2014 15:41:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74C34D2B; Mon, 20 Oct 2014 15:41:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KFfCnh026039; Mon, 20 Oct 2014 15:41:12 GMT (envelope-from pluknet@FreeBSD.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KFfCkl026038; Mon, 20 Oct 2014 15:41:12 GMT (envelope-from pluknet@FreeBSD.org) Message-Id: <201410201541.s9KFfCkl026038@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pluknet set sender to pluknet@FreeBSD.org using -f From: Sergey Kandaurov Date: Mon, 20 Oct 2014 15:41:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273333 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 15:41:12 -0000 Author: pluknet Date: Mon Oct 20 15:41:11 2014 New Revision: 273333 URL: https://svnweb.freebsd.org/changeset/base/273333 Log: Mac OS X 10.10 added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Mon Oct 20 14:48:20 2014 (r273332) +++ head/share/misc/bsd-family-tree Mon Oct 20 15:41:11 2014 (r273333) @@ -315,6 +315,8 @@ FreeBSD 5.2 | | | FreeBSD | | | | | 9.3 | | | | | | | | DragonFly 3.8.2 + | Mac OS X | | | + | 10.10 | | | | | | | | | | | | | | | | | | @@ -653,6 +655,7 @@ DragonFly 3.8.1 2014-06-16 [DFB] DragonFly 3.6.3 2014-06-17 [DFB] FreeBSD 9.3 2014-07-05 [FBD] DragonFly 3.8.2 2014-08-08 [DFB] +Mac OS X 10.10 2014-10-16 [APL] Bibliography ------------------------ From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 16:57:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 711D8455; Mon, 20 Oct 2014 16:57:37 +0000 (UTC) Received: from mail-wi0-x233.google.com (mail-wi0-x233.google.com [IPv6:2a00:1450:400c:c05::233]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 623E5A26; Mon, 20 Oct 2014 16:57:36 +0000 (UTC) Received: by mail-wi0-f179.google.com with SMTP id d1so6937562wiv.6 for ; Mon, 20 Oct 2014 09:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=xr9kvgSjVpnMCf9MHIfwEmvaZteCTqcI8Wfxsim6Ol0=; b=PGXDoRoKBnj9UJVQGnHhjYP2zeW5rP5XF/pBLcStfAXUJfbrwghNx8WL//YSmFu1bC UEHnrILfrNj4grL59Q7rqg7DKcMytPJVv2mrgtBS0ndjcca37Yr1pJ52WAt2Fe/ibBe9 Mb8IVaOpTIR6Reodxn0mXGFsS2gzfU8h3FLIzaJo6acvFnHzJWHfp5Uet4SCIEj87y0h crMmh3XJXaP1CFWuVGPm4BUSdZAeGPSKX5eB2q4QyuWxs3EdIGAudeGQ5nW3f7EB+L/C fhuJVm/r+5ZooMyIUNuoSbSBRBIzAJebBmxiHCdnSjRSHz6+FmcISvN1GmJI9MZerH9s gqig== MIME-Version: 1.0 X-Received: by 10.181.27.197 with SMTP id ji5mr21926514wid.26.1413824254651; Mon, 20 Oct 2014 09:57:34 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Mon, 20 Oct 2014 09:57:34 -0700 (PDT) In-Reply-To: <201410201442.s9KEggqt096167@svn.freebsd.org> References: <201410201442.s9KEggqt096167@svn.freebsd.org> Date: Mon, 20 Oct 2014 09:57:34 -0700 X-Google-Sender-Auth: EY5K7_D4ZFnyPkVQRcDMC57CIZ8 Message-ID: Subject: Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys From: Adrian Chadd To: Bryan Venteicher Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 16:57:37 -0000 Hi, Can you please create a PR that says something like "review vxlan code for RSS after de-capsulation" and assign it to me? I'm going to have to insert a hash recalculation after decapsulation but I'm too busy at the moment to do it. Thanks, -a On 20 October 2014 07:42, Bryan Venteicher wrote: > Author: bryanv > Date: Mon Oct 20 14:42:42 2014 > New Revision: 273331 > URL: https://svnweb.freebsd.org/changeset/base/273331 > > Log: > Add vxlan interface > > vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in > a UDP packet. This implementation is based on RFC7348. > > Currently, the IPv6 support is not fully compliant with the specification: > we should be able to receive UPDv6 packets with a zero checksum, but we > need to support RFC6935 first. Patches for this should come soon. > > Encapsulation protocols such as vxlan emphasize the need for the FreeBSD > network stack to support batching, GRO, and GSO. Each frame has to make > two trips through the network stack, and each frame will be at most MTU > sized. Performance suffers accordingly. > > Some latest generation NICs have begun to support vxlan HW offloads that > we should also take advantage of. VIMAGE support should also be added soon. > > Differential Revision: https://reviews.freebsd.org/D384 > Reviewed by: gnn > Relnotes: yes > > Added: > head/sbin/ifconfig/ifvxlan.c (contents, props changed) > head/share/man/man4/vxlan.4 (contents, props changed) > head/sys/modules/if_vxlan/ > head/sys/modules/if_vxlan/Makefile (contents, props changed) > head/sys/net/if_vxlan.c (contents, props changed) > head/sys/net/if_vxlan.h (contents, props changed) > Modified: > head/sbin/ifconfig/Makefile > head/sbin/ifconfig/ifconfig.8 > head/share/man/man4/Makefile > head/sys/conf/NOTES > head/sys/conf/files > head/sys/modules/Makefile > head/sys/sys/priv.h > > Modified: head/sbin/ifconfig/Makefile > ============================================================================== > --- head/sbin/ifconfig/Makefile Mon Oct 20 14:25:23 2014 (r273330) > +++ head/sbin/ifconfig/Makefile Mon Oct 20 14:42:42 2014 (r273331) > @@ -30,6 +30,7 @@ SRCS+= ifmac.c # MAC support > SRCS+= ifmedia.c # SIOC[GS]IFMEDIA support > SRCS+= iffib.c # non-default FIB support > SRCS+= ifvlan.c # SIOC[GS]ETVLAN support > +SRCS+= ifvxlan.c # VXLAN support > SRCS+= ifgre.c # GRE keys etc > SRCS+= ifgif.c # GIF reversed header workaround > > > Modified: head/sbin/ifconfig/ifconfig.8 > ============================================================================== > --- head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:25:23 2014 (r273330) > +++ head/sbin/ifconfig/ifconfig.8 Mon Oct 20 14:42:42 2014 (r273331) > @@ -28,7 +28,7 @@ > .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > .\" $FreeBSD$ > .\" > -.Dd October 1, 2014 > +.Dd October 20, 2014 > .Dt IFCONFIG 8 > .Os > .Sh NAME > @@ -2541,6 +2541,76 @@ argument is useless and hence deprecated > .El > .Pp > The following parameters are used to configure > +.Xr vxlan 4 > +interfaces. > +.Bl -tag -width indent > +.It Cm vni Ar identifier > +This value is a 24-bit VXLAN Network Identifier (VNI) that identifies the > +virtual network segment membership of the interface. > +.It Cm local Ar address > +The source address used in the encapsulating IPv4/IPv6 header. > +The address should already be assigned to an existing interface. > +When the interface is configured in unicast mode, the listening socket > +is bound to this address. > +.It Cm remote Ar address > +The interface can be configured in a unicast, or point-to-point, mode > +to create a tunnel between two hosts. > +This is the IP address of the remote end of the tunnel. > +.It Cm group Ar address > +The interface can be configured in a multicast mode > +to create a virtual network of hosts. > +This is the IP multicast group address the interface will join. > +.It Cm localport Ar port > +The port number the interface will listen on. > +The default port number is 4789. > +.It Cm remoteport Ar port > +The destination port number used in the encapsulating IPv4/IPv6 header. > +The remote host should be listening on this port. > +The default port number is 4789. > +Note some other implementations, such as Linux, > +do not default to the IANA assigned port, > +but instead listen on port 8472. > +.It Cm portrange Ar low high > +The range of source ports used in the encapsulating IPv4/IPv6 header. > +The port selected within the range is based on a hash of the inner frame. > +A range is useful to provide entropy within the outer IP header > +for more effective load balancing. > +The default range is between the > +.Xr sysctl 8 > +variables > +.Va net.inet.ip.portrange.first > +and > +.Va net.inet.ip.portrange.last > +.It Cm timeout Ar timeout > +The maximum time, in seconds, before an entry in the forwarding table > +is pruned. > +The default is 1200 seconds (20 minutes). > +.It Cm maxaddr Ar max > +The maximum number of entries in the forwarding table. > +The default is 2000. > +.It Cm vxlandev Ar dev > +When the interface is configured in multicast mode, the > +.Cm dev > +interface is used to transmit IP multicast packets. > +.It Cm ttl Ar ttl > +The TTL used in the encapsulating IPv4/IPv6 header. > +The default is 64. > +.It Cm learn > +The source IP address and inner source Ethernet MAC address of > +received packets are used to dynamically populate the forwarding table. > +When in multicast mode, an entry in the forwarding table allows the > +interface to send the frame directly to the remote host instead of > +broadcasting the frame to the multicast group. > +This is the default. > +.It Fl learn > +The forwarding table is not populated by recevied packets. > +.It Cm flush > +Delete all dynamically-learned addresses from the forwarding table. > +.It Cm flushall > +Delete all addresses, including static addresses, from the forwarding table. > +.El > +.Pp > +The following parameters are used to configure > .Xr carp 4 > protocol on an interface: > .Bl -tag -width indent > @@ -2745,6 +2815,7 @@ tried to alter an interface's configurat > .Xr pfsync 4 , > .Xr polling 4 , > .Xr vlan 4 , > +.Xr vxlan 4 , > .Xr devd.conf 5 , > .\" .Xr eon 5 , > .Xr devd 8 , > > Added: head/sbin/ifconfig/ifvxlan.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sbin/ifconfig/ifvxlan.c Mon Oct 20 14:42:42 2014 (r273331) > @@ -0,0 +1,648 @@ > +/*- > + * Copyright (c) 2014, Bryan Venteicher > + * All rights reserved. > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice unmodified, this list of conditions, and the following > + * disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR > + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES > + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. > + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, > + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT > + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, > + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY > + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT > + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF > + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "ifconfig.h" > + > +static struct ifvxlanparam params = { > + .vxlp_vni = VXLAN_VNI_MAX, > +}; > + > +static int > +get_val(const char *cp, u_long *valp) > +{ > + char *endptr; > + u_long val; > + > + errno = 0; > + val = strtoul(cp, &endptr, 0); > + if (cp[0] == '\0' || endptr[0] != '\0' || errno == ERANGE) > + return (-1); > + > + *valp = val; > + return (0); > +} > + > +static int > +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > +{ > + struct ifdrv ifd; > + > + bzero(&ifd, sizeof(ifd)); > + > + strlcpy(ifd.ifd_name, ifr.ifr_name, sizeof(ifd.ifd_name)); > + ifd.ifd_cmd = op; > + ifd.ifd_len = argsize; > + ifd.ifd_data = arg; > + > + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > +} > + > +static int > +vxlan_exists(int sock) > +{ > + struct ifvxlancfg cfg; > + > + bzero(&cfg, sizeof(cfg)); > + > + return (do_cmd(sock, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) != -1); > +} > + > +static void > +vxlan_status(int s) > +{ > + struct ifvxlancfg cfg; > + char src[NI_MAXHOST], dst[NI_MAXHOST]; > + char srcport[NI_MAXSERV], dstport[NI_MAXSERV]; > + struct sockaddr *lsa, *rsa; > + int vni, mc, ipv6; > + > + bzero(&cfg, sizeof(cfg)); > + > + if (do_cmd(s, VXLAN_CMD_GET_CONFIG, &cfg, sizeof(cfg), 0) < 0) > + return; > + > + vni = cfg.vxlc_vni; > + lsa = &cfg.vxlc_local_sa.sa; > + rsa = &cfg.vxlc_remote_sa.sa; > + ipv6 = rsa->sa_family == AF_INET6; > + > + /* Just report nothing if the network identity isn't set yet. */ > + if (vni >= VXLAN_VNI_MAX) > + return; > + > + if (getnameinfo(lsa, lsa->sa_len, src, sizeof(src), > + srcport, sizeof(srcport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) > + src[0] = srcport[0] = '\0'; > + if (getnameinfo(rsa, rsa->sa_len, dst, sizeof(dst), > + dstport, sizeof(dstport), NI_NUMERICHOST | NI_NUMERICSERV) != 0) > + dst[0] = dstport[0] = '\0'; > + > + if (!ipv6) { > + struct sockaddr_in *sin = (struct sockaddr_in *)rsa; > + mc = IN_MULTICAST(ntohl(sin->sin_addr.s_addr)); > + } else { > + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)rsa; > + mc = IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr); > + } > + > + printf("\tvxlan vni %d", vni); > + printf(" local %s%s%s:%s", ipv6 ? "[" : "", src, ipv6 ? "]" : "", > + srcport); > + printf(" %s %s%s%s:%s", mc ? "group" : "remote", ipv6 ? "[" : "", > + dst, ipv6 ? "]" : "", dstport); > + > + if (verbose) { > + printf("\n\t\tconfig: "); > + printf("%slearning portrange %d-%d ttl %d", > + cfg.vxlc_learn ? "" : "no", cfg.vxlc_port_min, > + cfg.vxlc_port_max, cfg.vxlc_ttl); > + printf("\n\t\tftable: "); > + printf("cnt %d max %d timeout %d", > + cfg.vxlc_ftable_cnt, cfg.vxlc_ftable_max, > + cfg.vxlc_ftable_timeout); > + } > + > + putchar('\n'); > +} > + > +#define _LOCAL_ADDR46 \ > + (VXLAN_PARAM_WITH_LOCAL_ADDR4 | VXLAN_PARAM_WITH_LOCAL_ADDR6) > +#define _REMOTE_ADDR46 \ > + (VXLAN_PARAM_WITH_REMOTE_ADDR4 | VXLAN_PARAM_WITH_REMOTE_ADDR6) > + > +static void > +vxlan_check_params(void) > +{ > + > + if ((params.vxlp_with & _LOCAL_ADDR46) == _LOCAL_ADDR46) > + errx(1, "cannot specify both local IPv4 and IPv6 addresses"); > + if ((params.vxlp_with & _REMOTE_ADDR46) == _REMOTE_ADDR46) > + errx(1, "cannot specify both remote IPv4 and IPv6 addresses"); > + if ((params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR4 && > + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR6) || > + (params.vxlp_with & VXLAN_PARAM_WITH_LOCAL_ADDR6 && > + params.vxlp_with & VXLAN_PARAM_WITH_REMOTE_ADDR4)) > + errx(1, "cannot mix IPv4 and IPv6 addresses"); > +} > + > +#undef _LOCAL_ADDR46 > +#undef _REMOTE_ADDR46 > + > +static void > +vxlan_cb(int s, void *arg) > +{ > + > +} > + > +static void > +vxlan_create(int s, struct ifreq *ifr) > +{ > + > + vxlan_check_params(); > + > + ifr->ifr_data = (caddr_t) ¶ms; > + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > + err(1, "SIOCIFCREATE2"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_vni, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val >= VXLAN_VNI_MAX) > + errx(1, "invalid network identifier: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_VNI; > + params.vxlp_vni = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_vni = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_VNI, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_VNI"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_local, addr, d) > +{ > + struct ifvxlancmd cmd; > + struct addrinfo *ai; > + struct sockaddr *sa; > + int error; > + > + bzero(&cmd, sizeof(cmd)); > + > + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) > + errx(1, "error in parsing local address string: %s", > + gai_strerror(error)); > + > + sa = ai->ai_addr; > + > + switch (ai->ai_family) { > +#ifdef INET > + case AF_INET: { > + struct in_addr addr = ((struct sockaddr_in *) sa)->sin_addr; > + > + if (IN_MULTICAST(ntohl(addr.s_addr))) > + errx(1, "local address cannot be multicast"); > + > + cmd.vxlcmd_sa.in4.sin_family = AF_INET; > + cmd.vxlcmd_sa.in4.sin_addr = addr; > + break; > + } > +#endif > +#ifdef INET6 > + case AF_INET6: { > + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; > + > + if (IN6_IS_ADDR_MULTICAST(addr)) > + errx(1, "local address cannot be multicast"); > + > + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; > + cmd.vxlcmd_sa.in6.sin6_addr = *addr; > + break; > + } > +#endif > + default: > + errx(1, "local address %s not supported", addr); > + } > + > + freeaddrinfo(ai); > + > + if (!vxlan_exists(s)) { > + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { > + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR4; > + params.vxlp_local_in4 = cmd.vxlcmd_sa.in4.sin_addr; > + } else { > + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_ADDR6; > + params.vxlp_local_in6 = cmd.vxlcmd_sa.in6.sin6_addr; > + } > + return; > + } > + > + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_ADDR, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_LOCAL_ADDR"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_remote, addr, d) > +{ > + struct ifvxlancmd cmd; > + struct addrinfo *ai; > + struct sockaddr *sa; > + int error; > + > + bzero(&cmd, sizeof(cmd)); > + > + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) > + errx(1, "error in parsing remote address string: %s", > + gai_strerror(error)); > + > + sa = ai->ai_addr; > + > + switch (ai->ai_family) { > +#ifdef INET > + case AF_INET: { > + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; > + > + if (IN_MULTICAST(ntohl(addr.s_addr))) > + errx(1, "remote address cannot be multicast"); > + > + cmd.vxlcmd_sa.in4.sin_family = AF_INET; > + cmd.vxlcmd_sa.in4.sin_addr = addr; > + break; > + } > +#endif > +#ifdef INET6 > + case AF_INET6: { > + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; > + > + if (IN6_IS_ADDR_MULTICAST(addr)) > + errx(1, "remote address cannot be multicast"); > + > + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; > + cmd.vxlcmd_sa.in6.sin6_addr = *addr; > + break; > + } > +#endif > + default: > + errx(1, "remote address %s not supported", addr); > + } > + > + freeaddrinfo(ai); > + > + if (!vxlan_exists(s)) { > + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; > + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; > + } else { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; > + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; > + } > + return; > + } > + > + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_group, addr, d) > +{ > + struct ifvxlancmd cmd; > + struct addrinfo *ai; > + struct sockaddr *sa; > + int error; > + > + bzero(&cmd, sizeof(cmd)); > + > + if ((error = getaddrinfo(addr, NULL, NULL, &ai)) != 0) > + errx(1, "error in parsing group address string: %s", > + gai_strerror(error)); > + > + sa = ai->ai_addr; > + > + switch (ai->ai_family) { > +#ifdef INET > + case AF_INET: { > + struct in_addr addr = ((struct sockaddr_in *)sa)->sin_addr; > + > + if (!IN_MULTICAST(ntohl(addr.s_addr))) > + errx(1, "group address must be multicast"); > + > + cmd.vxlcmd_sa.in4.sin_family = AF_INET; > + cmd.vxlcmd_sa.in4.sin_addr = addr; > + break; > + } > +#endif > +#ifdef INET6 > + case AF_INET6: { > + struct in6_addr *addr = &((struct sockaddr_in6 *)sa)->sin6_addr; > + > + if (!IN6_IS_ADDR_MULTICAST(addr)) > + errx(1, "group address must be multicast"); > + > + cmd.vxlcmd_sa.in6.sin6_family = AF_INET6; > + cmd.vxlcmd_sa.in6.sin6_addr = *addr; > + break; > + } > +#endif > + default: > + errx(1, "group address %s not supported", addr); > + } > + > + freeaddrinfo(ai); > + > + if (!vxlan_exists(s)) { > + if (cmd.vxlcmd_sa.sa.sa_family == AF_INET) { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR4; > + params.vxlp_remote_in4 = cmd.vxlcmd_sa.in4.sin_addr; > + } else { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_ADDR6; > + params.vxlp_remote_in6 = cmd.vxlcmd_sa.in6.sin6_addr; > + } > + return; > + } > + > + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_ADDR, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_REMOTE_ADDR"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_local_port, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) > + errx(1, "invalid local port: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_LOCAL_PORT; > + params.vxlp_local_port = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_port = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_LOCAL_PORT, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_LOCAL_PORT"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_remote_port, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val >= UINT16_MAX) > + errx(1, "invalid remote port: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_REMOTE_PORT; > + params.vxlp_remote_port = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_port = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_REMOTE_PORT, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_REMOTE_PORT"); > +} > + > +static > +DECL_CMD_FUNC2(setvxlan_port_range, arg1, arg2) > +{ > + struct ifvxlancmd cmd; > + u_long min, max; > + > + if (get_val(arg1, &min) < 0 || min >= UINT16_MAX) > + errx(1, "invalid port range minimum: %s", arg1); > + if (get_val(arg2, &max) < 0 || max >= UINT16_MAX) > + errx(1, "invalid port range maximum: %s", arg2); > + if (max < min) > + errx(1, "invalid port range"); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_PORT_RANGE; > + params.vxlp_min_port = min; > + params.vxlp_max_port = max; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_port_min = min; > + cmd.vxlcmd_port_max = max; > + > + if (do_cmd(s, VXLAN_CMD_SET_PORT_RANGE, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_PORT_RANGE"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_timeout, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) > + errx(1, "invalid timeout value: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_TIMEOUT; > + params.vxlp_ftable_timeout = val & 0xFFFFFFFF; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_ftable_timeout = val & 0xFFFFFFFF; > + > + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_TIMEOUT, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_FTABLE_TIMEOUT"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_maxaddr, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || (val & ~0xFFFFFFFF) != 0) > + errx(1, "invalid maxaddr value: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_FTABLE_MAX; > + params.vxlp_ftable_max = val & 0xFFFFFFFF; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_ftable_max = val & 0xFFFFFFFF; > + > + if (do_cmd(s, VXLAN_CMD_SET_FTABLE_MAX, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_FTABLE_MAX"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_dev, arg, d) > +{ > + struct ifvxlancmd cmd; > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_MULTICAST_IF; > + strlcpy(params.vxlp_mc_ifname, arg, > + sizeof(params.vxlp_mc_ifname)); > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + strlcpy(cmd.vxlcmd_ifname, arg, sizeof(cmd.vxlcmd_ifname)); > + > + if (do_cmd(s, VXLAN_CMD_SET_MULTICAST_IF, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_MULTICAST_IF"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_ttl, arg, d) > +{ > + struct ifvxlancmd cmd; > + u_long val; > + > + if (get_val(arg, &val) < 0 || val > 256) > + errx(1, "invalid TTL value: %s", arg); > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_TTL; > + params.vxlp_ttl = val; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + cmd.vxlcmd_ttl = val; > + > + if (do_cmd(s, VXLAN_CMD_SET_TTL, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_TTL"); > +} > + > +static > +DECL_CMD_FUNC(setvxlan_learn, arg, d) > +{ > + struct ifvxlancmd cmd; > + > + if (!vxlan_exists(s)) { > + params.vxlp_with |= VXLAN_PARAM_WITH_LEARN; > + params.vxlp_learn = d; > + return; > + } > + > + bzero(&cmd, sizeof(cmd)); > + if (d != 0) > + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_LEARN; > + > + if (do_cmd(s, VXLAN_CMD_SET_LEARN, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_SET_LEARN"); > +} > + > +static void > +setvxlan_flush(const char *val, int d, int s, const struct afswtch *afp) > +{ > + struct ifvxlancmd cmd; > + > + bzero(&cmd, sizeof(cmd)); > + if (d != 0) > + cmd.vxlcmd_flags |= VXLAN_CMD_FLAG_FLUSH_ALL; > + > + if (do_cmd(s, VXLAN_CMD_FLUSH, &cmd, sizeof(cmd), 1) < 0) > + err(1, "VXLAN_CMD_FLUSH"); > +} > + > +static struct cmd vxlan_cmds[] = { > + > + DEF_CLONE_CMD_ARG("vni", setvxlan_vni), > + DEF_CLONE_CMD_ARG("local", setvxlan_local), > + DEF_CLONE_CMD_ARG("remote", setvxlan_remote), > + DEF_CLONE_CMD_ARG("group", setvxlan_group), > + DEF_CLONE_CMD_ARG("localport", setvxlan_local_port), > + DEF_CLONE_CMD_ARG("remoteport", setvxlan_remote_port), > + DEF_CLONE_CMD_ARG2("portrange", setvxlan_port_range), > + DEF_CLONE_CMD_ARG("timeout", setvxlan_timeout), > + DEF_CLONE_CMD_ARG("maxaddr", setvxlan_maxaddr), > + DEF_CLONE_CMD_ARG("vxlandev", setvxlan_dev), > + DEF_CLONE_CMD_ARG("ttl", setvxlan_ttl), > + DEF_CLONE_CMD("learn", 1, setvxlan_learn), > + DEF_CLONE_CMD("-learn", 0, setvxlan_learn), > + > + DEF_CMD_ARG("vni", setvxlan_vni), > + DEF_CMD_ARG("local", setvxlan_local), > + DEF_CMD_ARG("remote", setvxlan_remote), > + DEF_CMD_ARG("group", setvxlan_group), > + DEF_CMD_ARG("localport", setvxlan_local_port), > + DEF_CMD_ARG("remoteport", setvxlan_remote_port), > + DEF_CMD_ARG2("portrange", setvxlan_port_range), > + DEF_CMD_ARG("timeout", setvxlan_timeout), > + DEF_CMD_ARG("maxaddr", setvxlan_maxaddr), > + DEF_CMD_ARG("vxlandev", setvxlan_dev), > + DEF_CMD_ARG("ttl", setvxlan_ttl), > + DEF_CMD("learn", 1, setvxlan_learn), > + DEF_CMD("-learn", 0, setvxlan_learn), > + > + DEF_CMD("flush", 0, setvxlan_flush), > + DEF_CMD("flushall", 1, setvxlan_flush), > +}; > + > +static struct afswtch af_vxlan = { > + .af_name = "af_vxlan", > + .af_af = AF_UNSPEC, > + .af_other_status = vxlan_status, > +}; > + > +static __constructor void > +vxlan_ctor(void) > +{ > +#define N(a) (sizeof(a) / sizeof(a[0])) > + size_t i; > + > + for (i = 0; i < N(vxlan_cmds); i++) > + cmd_register(&vxlan_cmds[i]); > + af_register(&af_vxlan); > + callback_register(vxlan_cb, NULL); > + clone_setdefcallback("vxlan", vxlan_create); > +#undef N > +} > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Mon Oct 20 14:25:23 2014 (r273330) > +++ head/share/man/man4/Makefile Mon Oct 20 14:42:42 2014 (r273331) > @@ -567,6 +567,7 @@ MAN= aac.4 \ > ${_virtio_scsi.4} \ > vkbd.4 \ > vlan.4 \ > + vxlan.4 \ > ${_vmx.4} \ > vpo.4 \ > vr.4 \ > @@ -743,6 +744,7 @@ MLINKS+=urndis.4 if_urndis.4 > MLINKS+=${_urtw.4} ${_if_urtw.4} > MLINKS+=vge.4 if_vge.4 > MLINKS+=vlan.4 if_vlan.4 > +MLINKS+=vxlan.4 if_vxlan.4 > MLINKS+=${_vmx.4} ${_if_vmx.4} > MLINKS+=vpo.4 imm.4 > MLINKS+=vr.4 if_vr.4 > > Added: head/share/man/man4/vxlan.4 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/vxlan.4 Mon Oct 20 14:42:42 2014 (r273331) > @@ -0,0 +1,235 @@ > +.\" Copyright (c) 2014 Bryan Venteicher > +.\" All rights reserved. > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above copyright > +.\" notice, this list of conditions and the following disclaimer in the > +.\" documentation and/or other materials provided with the distribution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > +.\" SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd October 20, 2014 > +.Dt VXLAN 4 > +.Os > +.Sh NAME > +.Nm vxlan > +.Nd "Virtual eXtensible LAN interface" > +.Sh SYNOPSIS > +To compile this driver into the kernel, > +place the following line in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device vxlan" > +.Ed > +.Pp > +Alternatively, to load the driver as a > +module at boot time, place the following line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +if_vxlan_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver creates a virtual tunnel endpoint in a > +.Nm > +segment. > +A > +.Nm > +segment is a virtual Layer 2 (Ethernet) network that is overlaid > +in a Layer 3 (IP/UDP) network. > +.Nm > +is analogous to > +.Xr vlan 4 > +but is designed to be better suited for large, multiple tenant > +data center environments. > +.Pp > +Each > +.Nm > +interface is created at runtime using interface cloning. > +This is most easily done with the > +.Xr ifconfig 8 > +.Cm create > +command or using the > +.Va cloned_interfaces > +variable in > +.Xr rc.conf 5 . > +The interface may be removed with the > +.Xr ifconfig 8 > +.Cm destroy > +command. > +.Pp > +The > +.Nm > +driver creates a pseudo Ethernet network interface > +that supports the usual network > +.Xr ioctl 2 Ns s > +and is thus can be used with > +.Xr ifconfig 8 > +like any other Ethernet interface. > +The > +.Nm > +interface encapsulates the Ethernet frame > +by prepending IP/UDP and > +.Nm > +headers. > +Thus, the encapsulated (inner) frame is able to transmitted > +over a routed, Layer 3 network to the remote host. > +.Pp > +The > +.Nm > +interface may be configured in either unicast or multicast mode. > +When in unicast mode, > +the interface creates a tunnel to a single remote host, > +and all traffic is transmitted to that host. > +When in multicast mode, > +the interface joins an IP multicast group, > +and receives packets sent to the group address, > +and transmits packets to either the multicast group address, > +or directly the remote host if there is an appropriate > +forwarding table entry. > +.Pp > +When the > +.Nm > +interface is brought up, a > +.Xr UDP 4 > +.Xr socket 9 > +is created based on the configuration, > +such as the local address for unicast mode or > +the group address for multicast mode, > +and the listening (local) port number. > +Since multiple > +.Nm > +interfaces may be created that either > +use the same local address > +or join the same group address, > +and use the same port, > +the driver may share a socket among multiple interfaces. > +However, each interface within a socket must belong to > +a unique > +.Nm > +segment. > +The analogous > +.Xr vlan 4 > +configuration would be a physical interface configured as > +the parent device for multiple VLAN interfaces, each with > +a unique VLAN tag. > +Each > +.Nm > +segment is identified by a 24-bit value in the > +.Nm > +header called the > +.Dq VXLAN Network Identifier , > +or VNI. > +.Pp > +When configured with the > +.Xr ifconfig 8 > +.Cm learn > +parameter, the interface dynamically creates forwarding table entries > +from received packets. > +An entry in the forwarding table maps the inner source MAC address > +to the outer remote IP address. > +During transmit, the interface attempts to lookup an entry for > +the encapsulated destination MAC address. > +If an entry is found, the IP address in the entry is used to directly > +transmit the encapsulated frame to the destination. > +Otherwise, when configured in multicast mode, > +the interface must flood the frame to all hosts in the group. > +The maximum number of entries in the table is configurable with the > +.Xr ifconfig 8 > +.Cm maxaddr > +command. > +Stale entries in the table periodically pruned. > +The timeout is configurable with the > +.Xr ifconfig 8 > +.Cm timeout > +command. > +The table may be viewed with the > +.Xr sysctl 8 > +.Cm net.link.vlxan.N.ftable.dump > +command. > +.Sh MTU > +Since the > +.Nm > +interface encapsulates the Ethernet frame with an IP, UDP, and > +.Nm > +header, the resulting frame may be larger than the MTU of the > +physical network. > +The > +.Nm > +specification recommends the physical network MTU be configured > +to use jumbo frames to accommodate the encapsulated frame size. > +Alternatively, the > +.Xr ifconfig 8 > +.Cm mtu > +command may be used to reduce the MTU size on the > +.Nm > +interface to allow the encapsulated frame to fit in the > +current MTU of the physical network. > +.Sh EXAMPLES > +Create a > +.Nm > +interface in unicast mode > +with the > +.Cm local > +tunnel address of 192.168.100.1, > +and the > +.Cm remote > +tunnel address of 192.168.100.2. > +.Bd -literal -offset indent > +ifconfig vxlan create vni 108 local 192.168.100.1 remote 192.168.100.2 > +.Ed > +.Pp > +Create a > +.Nm > +interface in multicast mode, > +with the > +.Cm local > +address of 192.168.10.95, > +and the > +.Cm group > +address of 224.0.2.6. > +The em0 interface will be used to transmit multicast packets. > +.Bd -literal -offset indent > +ifconfig vxlan create vni 42 local 192.168.10.95 group 224.0.2.6 vxlandev em0 > +.Ed > +.Pp > +Once created, the > +.Nm > +interface can be configured with > +.Xr ifconfig 8 . > +.Sh SEE ALSO > +.Xr ifconfig 8 , > +.Xr inet 4 , > +.Xr inet 6 , > +.Xr sysctl 8 , > +.Xr vlan 8 > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 17:04:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FC7D70A; Mon, 20 Oct 2014 17:04:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE96CB18; Mon, 20 Oct 2014 17:04:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KH45df080152; Mon, 20 Oct 2014 17:04:05 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KH44wX079917; Mon, 20 Oct 2014 17:04:04 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410201704.s9KH44wX079917@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Mon, 20 Oct 2014 17:04:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273334 - in head/sys: boot/common kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 17:04:06 -0000 Author: marcel Date: Mon Oct 20 17:04:03 2014 New Revision: 273334 URL: https://svnweb.freebsd.org/changeset/base/273334 Log: Fully support constructors for the purpose of code coverage analysis. This involves: 1. Have the loader pass the start and size of the .ctors section to the kernel in 2 new metadata elements. 2. Have the linker backends look for and record the start and size of the .ctors section in dynamically loaded modules. 3. Have the linker backends call the constructors as part of the final work of initializing preloaded or dynamically loaded modules. Note that LLVM appends the priority of the constructors to the name of the .ctors section. Not so when compiling with GCC. The code currently works for GCC and not for LLVM. Submitted by: Dmitry Mikulin Obtained from: Juniper Networks, Inc. Modified: head/sys/boot/common/load_elf.c head/sys/kern/kern_linker.c head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/kern/subr_prof.c head/sys/sys/linker.h Modified: head/sys/boot/common/load_elf.c ============================================================================== --- head/sys/boot/common/load_elf.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/boot/common/load_elf.c Mon Oct 20 17:04:03 2014 (r273334) @@ -240,6 +240,7 @@ __elfN(loadimage)(struct preloaded_file Elf_Ehdr *ehdr; Elf_Phdr *phdr, *php; Elf_Shdr *shdr; + char *shstr; int ret; vm_offset_t firstaddr; vm_offset_t lastaddr; @@ -248,6 +249,7 @@ __elfN(loadimage)(struct preloaded_file Elf_Addr ssym, esym; Elf_Dyn *dp; Elf_Addr adp; + Elf_Addr ctors; int ndp; int symstrindex; int symtabindex; @@ -383,10 +385,11 @@ __elfN(loadimage)(struct preloaded_file lastaddr = roundup(lastaddr, sizeof(long)); /* - * Now grab the symbol tables. This isn't easy if we're reading a - * .gz file. I think the rule is going to have to be that you must - * strip a file to remove symbols before gzipping it so that we do not - * try to lseek() on it. + * Get the section headers. We need this for finding the .ctors + * section as well as for loading any symbols. Both may be hard + * to do if reading from a .gz file as it involves seeking. I + * think the rule is going to have to be that you must strip a + * file to remove symbols before gzipping it. */ chunk = ehdr->e_shnum * ehdr->e_shentsize; if (chunk == 0 || ehdr->e_shoff == 0) @@ -399,6 +402,33 @@ __elfN(loadimage)(struct preloaded_file } file_addmetadata(fp, MODINFOMD_SHDR, chunk, shdr); + /* + * Read the section string table and look for the .ctors section. + * We need to tell the kernel where it is so that it can call the + * ctors. + */ + chunk = shdr[ehdr->e_shstrndx].sh_size; + if (chunk) { + shstr = alloc_pread(ef->fd, shdr[ehdr->e_shstrndx].sh_offset, chunk); + if (shstr) { + for (i = 0; i < ehdr->e_shnum; i++) { + if (strcmp(shstr + shdr[i].sh_name, ".ctors") != 0) + continue; + ctors = shdr[i].sh_addr; + file_addmetadata(fp, MODINFOMD_CTORS_ADDR, sizeof(ctors), + &ctors); + size = shdr[i].sh_size; + file_addmetadata(fp, MODINFOMD_CTORS_SIZE, sizeof(size), + &size); + break; + } + free(shstr); + } + } + + /* + * Now load any symbols. + */ symtabindex = -1; symstrindex = -1; for (i = 0; i < ehdr->e_shnum; i++) { Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/kern_linker.c Mon Oct 20 17:04:03 2014 (r273334) @@ -573,6 +573,8 @@ linker_make_file(const char *pathname, l lf = (linker_file_t)kobj_create((kobj_class_t)lc, M_LINKER, M_WAITOK); if (lf == NULL) return (NULL); + lf->ctors_addr = 0; + lf->ctors_size = 0; lf->refs = 1; lf->userrefs = 0; lf->flags = 0; Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/link_elf.c Mon Oct 20 17:04:03 2014 (r273334) @@ -331,6 +331,22 @@ link_elf_error(const char *filename, con printf("kldload: %s: %s\n", filename, s); } +static void +link_elf_invoke_ctors(caddr_t addr, size_t size) +{ + void (**ctor)(void); + size_t i, cnt; + + if (addr == NULL || size == 0) + return; + cnt = size / sizeof(*ctor); + ctor = (void *)addr; + for (i = 0; i < cnt; i++) { + if (ctor[i] != NULL) + (*ctor[i])(); + } +} + /* * Actions performed after linking/loading both the preloaded kernel and any * modules; whether preloaded or dynamicly loaded. @@ -360,6 +376,8 @@ link_elf_link_common_finish(linker_file_ GDB_STATE(RT_CONSISTENT); #endif + /* Invoke .ctors */ + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); return (0); } @@ -367,6 +385,8 @@ static void link_elf_init(void* arg) { Elf_Dyn *dp; + Elf_Addr *ctors_addrp; + Elf_Size *ctors_sizep; caddr_t modptr, baseptr, sizeptr; elf_file_t ef; char *modname; @@ -408,6 +428,15 @@ link_elf_init(void* arg) sizeptr = preload_search_info(modptr, MODINFO_SIZE); if (sizeptr != NULL) linker_kernel_file->size = *(size_t *)sizeptr; + ctors_addrp = (Elf_Addr *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_ADDR); + ctors_sizep = (Elf_Size *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_SIZE); + if (ctors_addrp != NULL && ctors_sizep != NULL) { + linker_kernel_file->ctors_addr = ef->address + + *ctors_addrp; + linker_kernel_file->ctors_size = *ctors_sizep; + } } (void)link_elf_preload_parse_symbols(ef); @@ -635,6 +664,8 @@ static int link_elf_link_preload(linker_class_t cls, const char* filename, linker_file_t *result) { + Elf_Addr *ctors_addrp; + Elf_Size *ctors_sizep; caddr_t modptr, baseptr, sizeptr, dynptr; char *type; elf_file_t ef; @@ -675,6 +706,15 @@ link_elf_link_preload(linker_class_t cls lf->address = ef->address; lf->size = *(size_t *)sizeptr; + ctors_addrp = (Elf_Addr *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_ADDR); + ctors_sizep = (Elf_Size *)preload_search_info(modptr, + MODINFO_METADATA | MODINFOMD_CTORS_SIZE); + if (ctors_addrp != NULL && ctors_sizep != NULL) { + lf->ctors_addr = ef->address + *ctors_addrp; + lf->ctors_size = *ctors_sizep; + } + error = parse_dynamic(ef); if (error == 0) error = parse_dpcpu(ef); @@ -734,11 +774,14 @@ link_elf_load_file(linker_class_t cls, c Elf_Shdr *shdr; int symtabindex; int symstrindex; + int shstrindex; int symcnt; int strcnt; + char *shstrs; shdr = NULL; lf = NULL; + shstrs = NULL; NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, td); flags = FREAD; @@ -977,12 +1020,31 @@ link_elf_load_file(linker_class_t cls, c &resid, td); if (error != 0) goto out; + + /* Read section string table */ + shstrindex = hdr->e_shstrndx; + if (shstrindex != 0 && shdr[shstrindex].sh_type == SHT_STRTAB && + shdr[shstrindex].sh_size != 0) { + nbytes = shdr[shstrindex].sh_size; + shstrs = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO); + error = vn_rdwr(UIO_READ, nd.ni_vp, (caddr_t)shstrs, nbytes, + shdr[shstrindex].sh_offset, UIO_SYSSPACE, IO_NODELOCKED, + td->td_ucred, NOCRED, &resid, td); + if (error) + goto out; + } + symtabindex = -1; symstrindex = -1; for (i = 0; i < hdr->e_shnum; i++) { if (shdr[i].sh_type == SHT_SYMTAB) { symtabindex = i; symstrindex = shdr[i].sh_link; + } else if (shstrs != NULL && shdr[i].sh_name != 0 && + strcmp(shstrs + shdr[i].sh_name, ".ctors") == 0) { + /* Record relocated address and size of .ctors. */ + lf->ctors_addr = mapbase + shdr[i].sh_addr - base_vaddr; + lf->ctors_size = shdr[i].sh_size; } } if (symtabindex < 0 || symstrindex < 0) @@ -1027,6 +1089,8 @@ out: free(shdr, M_LINKER); if (firstpage != NULL) free(firstpage, M_LINKER); + if (shstrs != NULL) + free(shstrs, M_LINKER); return (error); } Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/link_elf_obj.c Mon Oct 20 17:04:03 2014 (r273334) @@ -363,6 +363,10 @@ link_elf_link_preload(linker_class_t cls vnet_data_copy(vnet_data, shdr[i].sh_size); ef->progtab[pb].addr = vnet_data; #endif + } else if (ef->progtab[pb].name != NULL && + !strcmp(ef->progtab[pb].name, ".ctors")) { + lf->ctors_addr = ef->progtab[pb].addr; + lf->ctors_size = shdr[i].sh_size; } /* Update all symbol values with the offset. */ @@ -408,6 +412,22 @@ out: return (error); } +static void +link_elf_invoke_ctors(caddr_t addr, size_t size) +{ + void (**ctor)(void); + size_t i, cnt; + + if (addr == NULL || size == 0) + return; + cnt = size / sizeof(*ctor); + ctor = (void *)addr; + for (i = 0; i < cnt; i++) { + if (ctor[i] != NULL) + (*ctor[i])(); + } +} + static int link_elf_link_preload_finish(linker_file_t lf) { @@ -424,6 +444,8 @@ link_elf_link_preload_finish(linker_file if (error) return (error); + /* Invoke .ctors */ + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); return (0); } @@ -727,10 +749,14 @@ link_elf_load_file(linker_class_t cls, c alignmask = shdr[i].sh_addralign - 1; mapbase += alignmask; mapbase &= ~alignmask; - if (ef->shstrtab && shdr[i].sh_name != 0) + if (ef->shstrtab != NULL && shdr[i].sh_name != 0) { ef->progtab[pb].name = ef->shstrtab + shdr[i].sh_name; - else if (shdr[i].sh_type == SHT_PROGBITS) + if (!strcmp(ef->progtab[pb].name, ".ctors")) { + lf->ctors_addr = (caddr_t)mapbase; + lf->ctors_size = shdr[i].sh_size; + } + } else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; else ef->progtab[pb].name = "<>"; @@ -860,6 +886,9 @@ link_elf_load_file(linker_class_t cls, c if (error) goto out; + /* Invoke .ctors */ + link_elf_invoke_ctors(lf->ctors_addr, lf->ctors_size); + *result = lf; out: Modified: head/sys/kern/subr_prof.c ============================================================================== --- head/sys/kern/subr_prof.c Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/kern/subr_prof.c Mon Oct 20 17:04:03 2014 (r273334) @@ -540,50 +540,3 @@ out: stopprofclock(p); PROC_UNLOCK(p); } - -#if (defined(__amd64__) || defined(__i386__)) && \ - defined(__GNUCLIKE_CTOR_SECTION_HANDLING) -/* - * Support for "--test-coverage --profile-arcs" in GCC. - * - * We need to call all the functions in the .ctor section, in order - * to get all the counter-arrays strung into a list. - * - * XXX: the .ctors call __bb_init_func which is located in over in - * XXX: i386/i386/support.s for historical reasons. There is probably - * XXX: no reason for that to be assembler anymore, but doing it right - * XXX: in MI C code requires one to reverse-engineer the type-selection - * XXX: inside GCC. Have fun. - * - * XXX: Worrisome perspective: Calling the .ctors may make C++ in the - * XXX: kernel feasible. Don't. - */ -typedef void (*ctor_t)(void); -extern ctor_t _start_ctors, _stop_ctors; - -static void -tcov_init(void *foo __unused) -{ - ctor_t *p, q; - - for (p = &_start_ctors; p < &_stop_ctors; p++) { - q = *p; - q(); - } -} - -SYSINIT(tcov_init, SI_SUB_KPROF, SI_ORDER_SECOND, tcov_init, NULL); - -/* - * GCC contains magic to recognize calls to for instance execve() and - * puts in calls to this function to preserve the profile counters. - * XXX: Put zinging punchline here. - */ -void __bb_fork_func(void); -void -__bb_fork_func(void) -{ -} - -#endif - Modified: head/sys/sys/linker.h ============================================================================== --- head/sys/sys/linker.h Mon Oct 20 15:41:11 2014 (r273333) +++ head/sys/sys/linker.h Mon Oct 20 17:04:03 2014 (r273334) @@ -79,6 +79,8 @@ struct linker_file { int id; /* unique id */ caddr_t address; /* load address */ size_t size; /* size of file */ + caddr_t ctors_addr; /* address of .ctors */ + size_t ctors_size; /* size of .ctors */ int ndeps; /* number of dependencies */ linker_file_t* deps; /* list of dependencies */ STAILQ_HEAD(, common_symbol) common; /* list of common symbols */ @@ -211,6 +213,8 @@ void *linker_hwpmc_list_objects(void); #define MODINFOMD_KERNEND 0x0008 /* kernend */ #endif #define MODINFOMD_SHDR 0x0009 /* section header table */ +#define MODINFOMD_CTORS_ADDR 0x000a /* address of .ctors */ +#define MODINFOMD_CTORS_SIZE 0x000b /* size of .ctors */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 17:53:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB1086C0; Mon, 20 Oct 2014 17:53:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7EB6D5; Mon, 20 Oct 2014 17:53:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KHrn5J009501; Mon, 20 Oct 2014 17:53:49 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KHrnaG009500; Mon, 20 Oct 2014 17:53:49 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410201753.s9KHrnaG009500@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 17:53:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273335 - head/sys/fs/unionfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 17:53:50 -0000 Author: mjg Date: Mon Oct 20 17:53:49 2014 New Revision: 273335 URL: https://svnweb.freebsd.org/changeset/base/273335 Log: unionfs: hold mount interlock while manipulating mnt_flag This is for consistency with other filesystems. Modified: head/sys/fs/unionfs/union_vfsops.c Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:04:03 2014 (r273334) +++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) @@ -290,12 +290,14 @@ unionfs_domount(struct mount *mp) return (error); } + MNT_ILOCK(mp); /* * Check mnt_flag */ if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) mp->mnt_flag |= MNT_LOCAL; + MNT_IUNLOCK(mp); /* * Get new fsid From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 18:00:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E731D983; Mon, 20 Oct 2014 18:00:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C81F9128; Mon, 20 Oct 2014 18:00:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KI0qja010951; Mon, 20 Oct 2014 18:00:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KI0pKK010940; Mon, 20 Oct 2014 18:00:51 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410201800.s9KI0pKK010940@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 18:00:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273336 - in head/sys: fs/nullfs fs/tmpfs fs/unionfs kern sys ufs/ffs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:00:53 -0000 Author: mjg Date: Mon Oct 20 18:00:50 2014 New Revision: 273336 URL: https://svnweb.freebsd.org/changeset/base/273336 Log: Provide vfs suspension support only for filesystems which need it, take two. nullfs and unionfs need to request suspension if underlying filesystem(s) use it. Utilize mnt_kern_flag for this purpose. This is a fixup for 273271. No strong objections from: kib Pointy hat to: mjg MFC after: 2 weeks Modified: head/sys/fs/nullfs/null_vfsops.c head/sys/fs/tmpfs/tmpfs_vfsops.c head/sys/fs/unionfs/union_vfsops.c head/sys/kern/vfs_vnops.c head/sys/sys/mount.h head/sys/ufs/ffs/ffs_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/fs/nullfs/null_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -198,6 +198,8 @@ nullfs_mount(struct mount *mp) MNTK_EXTENDED_SHARED); } mp->mnt_kern_flag |= MNTK_LOOKUP_EXCL_DOTDOT; + mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & + MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); mp->mnt_data = xmp; vfs_getnewfsid(mp); Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -255,6 +255,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; + mp->mnt_kern_flag |= MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); mp->mnt_data = tmp; @@ -427,14 +428,6 @@ tmpfs_sync(struct mount *mp, int waitfor } /* - * A stub created so that vfs does vn_start_write for this filesystem - */ -static void -tmpfs_susp_clean(struct mount *mp) -{ -} - -/* * tmpfs vfs operations. */ @@ -445,6 +438,5 @@ struct vfsops tmpfs_vfsops = { .vfs_statfs = tmpfs_statfs, .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, - .vfs_susp_clean = tmpfs_susp_clean, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); Modified: head/sys/fs/unionfs/union_vfsops.c ============================================================================== --- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -297,6 +297,13 @@ unionfs_domount(struct mount *mp) if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) mp->mnt_flag |= MNT_LOCAL; + + /* + * Check mnt_kern_flag + */ + if ((ump->um_lowervp->v_mount->mnt_flag & MNTK_SUSPENDABLE) || + (ump->um_uppervp->v_mount->mnt_flag & MNTK_SUSPENDABLE)) + mp->mnt_kern_flag |= MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); /* Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/kern/vfs_vnops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -1576,7 +1576,7 @@ static bool vn_suspendable_mp(struct mount *mp) { - return (mp->mnt_op->vfs_susp_clean != NULL); + return ((mp->mnt_kern_flag & MNTK_SUSPENDABLE) != 0); } static bool Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/sys/mount.h Mon Oct 20 18:00:50 2014 (r273336) @@ -361,7 +361,7 @@ void __mnt_vnode_markerfree_act #define MNTK_SUSPEND 0x08000000 /* request write suspension */ #define MNTK_SUSPEND2 0x04000000 /* block secondary writes */ #define MNTK_SUSPENDED 0x10000000 /* write operations are suspended */ -#define MNTK_UNUSED25 0x20000000 /* --available-- */ +#define MNTK_SUSPENDABLE 0x20000000 /* writes can be suspended */ #define MNTK_LOOKUP_SHARED 0x40000000 /* FS supports shared lock lookups */ #define MNTK_NOKNOTE 0x80000000 /* Don't send KNOTEs from VOP hooks */ @@ -754,10 +754,11 @@ vfs_statfs_t __vfs_statfs; _rc; }) #define VFS_SUSP_CLEAN(MP) do { \ - MPASS(*(MP)->mnt_op->vfs_susp_clean != NULL); \ - VFS_PROLOGUE(MP); \ - (*(MP)->mnt_op->vfs_susp_clean)(MP); \ - VFS_EPILOGUE(MP); \ + if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \ + VFS_PROLOGUE(MP); \ + (*(MP)->mnt_op->vfs_susp_clean)(MP); \ + VFS_EPILOGUE(MP); \ + } \ } while (0) #define VFS_RECLAIM_LOWERVP(MP, VP) do { \ Modified: head/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) +++ head/sys/ufs/ffs/ffs_vfsops.c Mon Oct 20 18:00:50 2014 (r273336) @@ -1055,7 +1055,7 @@ ffs_mountfs(devvp, mp, td) */ MNT_ILOCK(mp); mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_EXTENDED_SHARED | - MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS; + MNTK_NO_IOPF | MNTK_UNMAPPED_BUFS | MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); #ifdef UFS_EXTATTR #ifdef UFS_EXTATTR_AUTOSTART From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 18:04:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4321CC33; Mon, 20 Oct 2014 18:04:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F1151E3; Mon, 20 Oct 2014 18:04:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KI4LRH014772; Mon, 20 Oct 2014 18:04:21 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KI4LmG014771; Mon, 20 Oct 2014 18:04:21 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410201804.s9KI4LmG014771@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Mon, 20 Oct 2014 18:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273337 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:04:21 -0000 Author: loos Date: Mon Oct 20 18:04:20 2014 New Revision: 273337 URL: https://svnweb.freebsd.org/changeset/base/273337 Log: Fix the mtx_sleep() error checking, catch all errors and not only EWOULDBLOCK. Do not print any message at errors. The errors are properly sent to upper layers which should be able to deal with it, including printing the errors when they need to. The error message was quite annoying while scanning the i2c bus. MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 18:00:50 2014 (r273336) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Mon Oct 20 18:04:20 2014 (r273337) @@ -441,12 +441,11 @@ bcm_bsc_transfer(device_t dev, struct ii /* Wait for the transaction to complete. */ err = mtx_sleep(dev, &sc->sc_mtx, 0, "bsciow", hz); - /* Check if we have a timeout or an I2C error. */ - if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) { - device_printf(sc->sc_dev, "I2C error\n"); + /* Check for errors. */ + if (err != 0 && (sc->sc_flags & BCM_I2C_ERROR)) err = EIO; + if (err != 0) break; - } } /* Clean the controller flags. */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 18:07:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5D6CDF2; Mon, 20 Oct 2014 18:07:14 +0000 (UTC) Received: from vlakno.cz (mail.vlakno.cz [91.217.96.224]) by mx1.freebsd.org (Postfix) with ESMTP id 89177208; Mon, 20 Oct 2014 18:07:14 +0000 (UTC) Received: by vlakno.cz (Postfix, from userid 1002) id 729331D95A3C; Mon, 20 Oct 2014 20:00:02 +0200 (CEST) Date: Mon, 20 Oct 2014 20:00:02 +0200 From: Roman Divacky To: Marcel Moolenaar Subject: Re: svn commit: r273334 - in head/sys: boot/common kern sys Message-ID: <20141020180002.GA85946@vlakno.cz> References: <201410201704.s9KH44wX079917@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410201704.s9KH44wX079917@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:07:14 -0000 > Note that LLVM appends the priority of the constructors to the name of > the .ctors section. Not so when compiling with GCC. The code currently > works for GCC and not for LLVM. Uhm? LLVM here creates ".ctors" section, nothing is appended. Can you be more specific on what you're seing? Roman From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 18:09:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2DC4CF52; Mon, 20 Oct 2014 18:09:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ED01216; Mon, 20 Oct 2014 18:09:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KI9YIP015614; Mon, 20 Oct 2014 18:09:34 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KI9YQu015608; Mon, 20 Oct 2014 18:09:34 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410201809.s9KI9YQu015608@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Mon, 20 Oct 2014 18:09:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273338 - in head/sys: amd64/amd64 sys x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:09:35 -0000 Author: neel Date: Mon Oct 20 18:09:33 2014 New Revision: 273338 URL: https://svnweb.freebsd.org/changeset/base/273338 Log: Merge from projects/bhyve_svm all the changes outside vmm.ko or bhyve utilities: Add support for AMD's nested page tables in pmap.c: - Provide the correct bit mask for various bit fields in a PTE (e.g. valid bit) for a pmap of type PT_RVI. - Add a function 'pmap_type_guest(pmap)' that returns TRUE if the pmap is of type PT_EPT or PT_RVI. Add CPU_SET_ATOMIC_ACQ(num, cpuset): This is used when activating a vcpu in the nested pmap. Using the 'acquire' variant guarantees that the load of the 'pm_eptgen' will happen only after the vcpu is activated in 'pm_active'. Add defines for various AMD-specific MSRs. Submitted by: Anish Gupta (akgupt3@gmail.com) Modified: head/sys/amd64/amd64/pmap.c head/sys/sys/bitset.h head/sys/sys/cpuset.h head/sys/x86/include/specialreg.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/amd64/amd64/pmap.c Mon Oct 20 18:09:33 2014 (r273338) @@ -146,6 +146,13 @@ __FBSDID("$FreeBSD$"); #endif static __inline boolean_t +pmap_type_guest(pmap_t pmap) +{ + + return ((pmap->pm_type == PT_EPT) || (pmap->pm_type == PT_RVI)); +} + +static __inline boolean_t pmap_emulate_ad_bits(pmap_t pmap) { @@ -159,6 +166,7 @@ pmap_valid_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_V; break; case PT_EPT: @@ -181,6 +189,7 @@ pmap_rw_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_RW; break; case PT_EPT: @@ -205,6 +214,7 @@ pmap_global_bit(pmap_t pmap) case PT_X86: mask = X86_PG_G; break; + case PT_RVI: case PT_EPT: mask = 0; break; @@ -222,6 +232,7 @@ pmap_accessed_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_A; break; case PT_EPT: @@ -244,6 +255,7 @@ pmap_modified_bit(pmap_t pmap) switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = X86_PG_M; break; case PT_EPT: @@ -1103,6 +1115,7 @@ pmap_swap_pat(pmap_t pmap, pt_entry_t en switch (pmap->pm_type) { case PT_X86: + case PT_RVI: /* Verify that both PAT bits are not set at the same time */ KASSERT((entry & x86_pat_bits) != x86_pat_bits, ("Invalid PAT bits in entry %#lx", entry)); @@ -1138,6 +1151,7 @@ pmap_cache_bits(pmap_t pmap, int mode, b switch (pmap->pm_type) { case PT_X86: + case PT_RVI: /* The PAT bit is different for PTE's and PDE's. */ pat_flag = is_pde ? X86_PG_PDE_PAT : X86_PG_PTE_PAT; @@ -1172,6 +1186,7 @@ pmap_cache_mask(pmap_t pmap, boolean_t i switch (pmap->pm_type) { case PT_X86: + case PT_RVI: mask = is_pde ? X86_PG_PDE_CACHE : X86_PG_PTE_CACHE; break; case PT_EPT: @@ -1198,6 +1213,7 @@ pmap_update_pde_store(pmap_t pmap, pd_en switch (pmap->pm_type) { case PT_X86: break; + case PT_RVI: case PT_EPT: /* * XXX @@ -1233,7 +1249,7 @@ pmap_update_pde_invalidate(pmap_t pmap, { pt_entry_t PG_G; - if (pmap->pm_type == PT_EPT) + if (pmap_type_guest(pmap)) return; KASSERT(pmap->pm_type == PT_X86, @@ -1347,7 +1363,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off cpuset_t other_cpus; u_int cpuid; - if (pmap->pm_type == PT_EPT) { + if (pmap_type_guest(pmap)) { pmap_invalidate_ept(pmap); return; } @@ -1425,7 +1441,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of vm_offset_t addr; u_int cpuid; - if (pmap->pm_type == PT_EPT) { + if (pmap_type_guest(pmap)) { pmap_invalidate_ept(pmap); return; } @@ -1484,7 +1500,7 @@ pmap_invalidate_all(pmap_t pmap) uint64_t cr3; u_int cpuid; - if (pmap->pm_type == PT_EPT) { + if (pmap_type_guest(pmap)) { pmap_invalidate_ept(pmap); return; } @@ -1606,7 +1622,7 @@ pmap_update_pde(pmap_t pmap, vm_offset_t cpuid = PCPU_GET(cpuid); other_cpus = all_cpus; CPU_CLR(cpuid, &other_cpus); - if (pmap == kernel_pmap || pmap->pm_type == PT_EPT) + if (pmap == kernel_pmap || pmap_type_guest(pmap)) active = all_cpus; else { active = pmap->pm_active; @@ -1644,6 +1660,7 @@ pmap_invalidate_page(pmap_t pmap, vm_off if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active)) invlpg(va); break; + case PT_RVI: case PT_EPT: pmap->pm_eptgen++; break; @@ -1663,6 +1680,7 @@ pmap_invalidate_range(pmap_t pmap, vm_of for (addr = sva; addr < eva; addr += PAGE_SIZE) invlpg(addr); break; + case PT_RVI: case PT_EPT: pmap->pm_eptgen++; break; @@ -1680,6 +1698,7 @@ pmap_invalidate_all(pmap_t pmap) if (pmap == kernel_pmap || !CPU_EMPTY(&pmap->pm_active)) invltlb(); break; + case PT_RVI: case PT_EPT: pmap->pm_eptgen++; break; Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/sys/bitset.h Mon Oct 20 18:09:33 2014 (r273338) @@ -135,6 +135,10 @@ atomic_set_long(&(p)->__bits[__bitset_word(_s, n)], \ __bitset_mask((_s), n)) +#define BIT_SET_ATOMIC_ACQ(_s, n, p) \ + atomic_set_acq_long(&(p)->__bits[__bitset_word(_s, n)], \ + __bitset_mask((_s), n)) + /* Convenience functions catering special cases. */ #define BIT_AND_ATOMIC(_s, d, s) do { \ __size_t __i; \ Modified: head/sys/sys/cpuset.h ============================================================================== --- head/sys/sys/cpuset.h Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/sys/cpuset.h Mon Oct 20 18:09:33 2014 (r273338) @@ -55,6 +55,7 @@ #define CPU_NAND(d, s) BIT_NAND(CPU_SETSIZE, d, s) #define CPU_CLR_ATOMIC(n, p) BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) #define CPU_SET_ATOMIC(n, p) BIT_SET_ATOMIC(CPU_SETSIZE, n, p) +#define CPU_SET_ATOMIC_ACQ(n, p) BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p) #define CPU_AND_ATOMIC(n, p) BIT_AND_ATOMIC(CPU_SETSIZE, n, p) #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Mon Oct 20 18:04:20 2014 (r273337) +++ head/sys/x86/include/specialreg.h Mon Oct 20 18:09:33 2014 (r273338) @@ -81,6 +81,7 @@ #define EFER_LME 0x000000100 /* Long mode enable (R/W) */ #define EFER_LMA 0x000000400 /* Long mode active (R) */ #define EFER_NXE 0x000000800 /* PTE No-Execute bit enable (R/W) */ +#define EFER_SVM 0x000001000 /* SVM enable bit for AMD, reserved for Intel */ /* * Intel Extended Features registers @@ -783,8 +784,21 @@ #define MSR_IORRMASK1 0xc0010019 #define MSR_TOP_MEM 0xc001001a /* boundary for ram below 4G */ #define MSR_TOP_MEM2 0xc001001d /* boundary for ram above 4G */ +#define MSR_NB_CFG1 0xc001001f /* NB configuration 1 */ +#define MSR_P_STATE_LIMIT 0xc0010061 /* P-state Current Limit Register */ +#define MSR_P_STATE_CONTROL 0xc0010062 /* P-state Control Register */ +#define MSR_P_STATE_STATUS 0xc0010063 /* P-state Status Register */ +#define MSR_P_STATE_CONFIG(n) (0xc0010064 + (n)) /* P-state Config */ +#define MSR_SMM_ADDR 0xc0010112 /* SMM TSEG base address */ +#define MSR_SMM_MASK 0xc0010113 /* SMM TSEG address mask */ +#define MSR_IC_CFG 0xc0011021 /* Instruction Cache Configuration */ #define MSR_K8_UCODE_UPDATE 0xc0010020 /* update microcode */ #define MSR_MC0_CTL_MASK 0xc0010044 +#define MSR_VM_CR 0xc0010114 /* SVM: feature control */ +#define MSR_VM_HSAVE_PA 0xc0010117 /* SVM: host save area address */ + +/* MSR_VM_CR related */ +#define VM_CR_SVMDIS 0x10 /* SVM: disabled by BIOS */ /* VIA ACE crypto featureset: for via_feature_rng */ #define VIA_HAS_RNG 1 /* cpu has RNG */ From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 18:39:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E97E983F; Mon, 20 Oct 2014 18:39:20 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5D64802; Mon, 20 Oct 2014 18:39:20 +0000 (UTC) Received: from djonathan-sslvpn-nc.jnpr.net ([66.129.239.11]) (authenticated bits=0) by mail.xcllnt.net (8.14.9/8.14.9) with ESMTP id s9KIdD4L010262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Oct 2014 11:39:13 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: svn commit: r273334 - in head/sys: boot/common kern sys From: Marcel Moolenaar In-Reply-To: <20141020180002.GA85946@vlakno.cz> Date: Mon, 20 Oct 2014 11:39:07 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201410201704.s9KH44wX079917@svn.freebsd.org> <20141020180002.GA85946@vlakno.cz> To: Roman Divacky X-Mailer: Apple Mail (2.1990.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Marcel Moolenaar , src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 18:39:21 -0000 > On Oct 20, 2014, at 11:00 AM, Roman Divacky = wrote: >=20 >> Note that LLVM appends the priority of the constructors to the name = of >> the .ctors section. Not so when compiling with GCC. The code = currently >> works for GCC and not for LLVM. >=20 > Uhm? LLVM here creates ".ctors" section, nothing is appended. Can you = be more > specific on what you're seing? Go to a module build directory (I picked uart) and build on amd64: % make DEBUG_FLAGS=3D"-ftest-coverage -fprofile-arcs" Check with objdump: % objdump -x /usr/obj/usr/src/sys/modules/uart/uart.ko | grep ctors 16 .ctors.65535 00000080 0000000000000000 0000000000000000 00020320 = 2**3 0000000000000000 l d .ctors.65535 0000000000000000 .ctors.65535 RELOCATION RECORDS FOR [.ctors.65535]: As you can see, the section is not called .ctors, but it's called .ctors.$((65536-priority)). The priority suffix is removed as part of linking, but on amd64, kernel modules are relocatables... FYI, --=20 Marcel Moolenaar marcel@xcllnt.net From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 20:10:45 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E799B91A for ; Mon, 20 Oct 2014 20:10:45 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B214A277 for ; Mon, 20 Oct 2014 20:10:45 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by gateway2.nyi.internal (Postfix) with ESMTP id 03EB320945 for ; Mon, 20 Oct 2014 16:10:43 -0400 (EDT) Received: from web6 ([10.202.2.216]) by compute6.internal (MEProxy); Mon, 20 Oct 2014 16:10:44 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=pgkbJF81e+6GKJ4yW9TwHi+XOfs=; b=jWJG SOl4I+hQ3kzWA6fnwHB0/VgRyDZwS5EpQvOGuV+PSuR7G24KLvckwg6ufccwSZI+ W7GzbfMkYlG4IFgf7v5pJ0Bnzd7N5ORkBzf/DGR9HZcSFffrnsyQE7r2yhC5NwP6 EH2XPhgSRycnKkTeQBdlwqv5Ic17YqfI5s0YcEM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=pgkbJF81e+6GKJ4yW9TwHi+X Ofs=; b=g52J5mVm7senD11MQCeCiWHKmRUvC61sVpMEwKTx27IENejNxKB/P3hk E5Kalls2s9XeESR3MgUEt5YO9UhSpfl+4MuA6Oy69xn+3liOrksy3pYzqUX9OS+y JnP/x87YPJD/88hWaEHu9ua/jTTN7TPJegDiHFguF49iLx5ZH3o= Received: by web6.nyi.internal (Postfix, from userid 99) id BCE3648D60; Mon, 20 Oct 2014 16:10:43 -0400 (EDT) Message-Id: <1413835843.3284180.181238849.236EFDEE@webmail.messagingengine.com> X-Sasl-Enc: J98mwy4wHPZgD8b9QvPHFWRa5OaTyvZ+IFaJO1eM754W 1413835843 From: Bruce Simpson To: Andriy Gapon , "Alexander V. Chernikov" , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-e69fc525 In-Reply-To: <5443A83F.5090807@FreeBSD.org> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw Date: Mon, 20 Oct 2014 21:10:43 +0100 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 20:10:46 -0000 On Sun, 19 Oct 2014, at 13:02, Andriy Gapon wrote: > I think that on platforms where an optimized version of fls() is > available that > would work faster than this cool piece of bit magic. This is a common enough idiom that perhaps a macro should be added: sys/param.h: #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ #define powerof2(x) ((((x)-1)&(x))==0) sys/amd64/amd64/mp_machdep.c: /* * Round up to the next power of two, if necessary, and then * take log2. * Returns -1 if argument is zero. */ static __inline int mask_width(u_int x) { return (fls(x << (1 - powerof2(x))) - 1); } -- BMS (sent via webmail) From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 20:21:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6FC68D79; Mon, 20 Oct 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C15C3CD; Mon, 20 Oct 2014 20:21:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KKLfH8082670; Mon, 20 Oct 2014 20:21:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KKLfNJ082669; Mon, 20 Oct 2014 20:21:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410202021.s9KKLfNJ082669@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 20 Oct 2014 20:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273342 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 20:21:41 -0000 Author: markj Date: Mon Oct 20 20:21:40 2014 New Revision: 273342 URL: https://svnweb.freebsd.org/changeset/base/273342 Log: Fix a typo from r189544, which replaced unp_global_rwlock with unp_list_lock and unp_link_rwlock. MFC after: 3 days Modified: head/sys/kern/subr_witness.c Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Mon Oct 20 18:58:45 2014 (r273341) +++ head/sys/kern/subr_witness.c Mon Oct 20 20:21:40 2014 (r273342) @@ -528,7 +528,7 @@ static struct witness_order_list_entry o /* * UNIX Domain Sockets */ - { "unp_global_rwlock", &lock_class_rw }, + { "unp_link_rwlock", &lock_class_rw }, { "unp_list_lock", &lock_class_mtx_sleep }, { "unp", &lock_class_mtx_sleep }, { "so_snd", &lock_class_mtx_sleep }, From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 21:57:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 211DC6CB; Mon, 20 Oct 2014 21:57:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D6D9FFA; Mon, 20 Oct 2014 21:57:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KLvO1r026575; Mon, 20 Oct 2014 21:57:24 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KLvO4S026574; Mon, 20 Oct 2014 21:57:24 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410202157.s9KLvO4S026574@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 21:57:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273344 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 21:57:25 -0000 Author: mjg Date: Mon Oct 20 21:57:24 2014 New Revision: 273344 URL: https://svnweb.freebsd.org/changeset/base/273344 Log: filedesc: plug 2 write-only variables Reported by: Coverity CID: 1245745, 1245746 Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Mon Oct 20 21:53:51 2014 (r273343) +++ head/sys/kern/kern_descrip.c Mon Oct 20 21:57:24 2014 (r273344) @@ -3138,7 +3138,6 @@ export_vnode_to_sb(struct vnode *vp, int int kern_proc_filedesc_out(struct proc *p, struct sbuf *sb, ssize_t maxlen) { - struct thread *td; struct file *fp; struct filedesc *fdp; struct export_fd_buf *efbuf; @@ -3146,7 +3145,6 @@ kern_proc_filedesc_out(struct proc *p, int error, i; cap_rights_t rights; - td = curthread; PROC_LOCK_ASSERT(p, MA_OWNED); /* ktrace vnode */ @@ -3301,12 +3299,10 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE struct kinfo_ofile *okif; struct kinfo_file *kif; struct filedesc *fdp; - struct thread *td; int error, i, *name; struct file *fp; struct proc *p; - td = curthread; name = (int *)arg1; error = pget((pid_t)name[0], PGET_CANDEBUG | PGET_NOTWEXIT, &p); if (error != 0) From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 22:37:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ACB81696 for ; Mon, 20 Oct 2014 22:37:26 +0000 (UTC) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F98467A for ; Mon, 20 Oct 2014 22:37:26 +0000 (UTC) Received: by mail-pd0-f174.google.com with SMTP id y13so101pdi.33 for ; Mon, 20 Oct 2014 15:37:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=IcJDyxRs42Qf60onFy97BQ/tuycHav1WbBhSobu0JWM=; b=OG/aJTEH087ftQhcd20m200HJBhCyQFjIvUTRcwhOSVRrHcglovzJ5udCtuzbDHiSV LmUeZPYCDbjQEUD6taJ3N1jooSht51tIItIq56FdtWRpq+hRoUnt45W6OD5HRhEiixUQ ZrR1f2NFU82HkZniFbgUVjNI0oqyrzU1GQFRSX04yCu8+T4dP/xFEVJsJmzfANKYzoZ5 Af03RRnmfjYHrmAa8N4nzKv4TPSMuWxv++C56F1AdU/JEzENjwoYEuzJcS+/+ybIbP0+ /WlXR/eedSo70RYD84p++u8zPGrR1TAkhdu8IXEyvpMtO7neCnWuW++Ivjz7gHfsGgQe KqfQ== X-Gm-Message-State: ALoCoQnz7+PmDEyJYkk3t3s9UI1alisY9Qaca3LZnehMnkiMDXbU6MP6jASiTcIeXxKulle8cvQd MIME-Version: 1.0 X-Received: by 10.68.125.164 with SMTP id mr4mr13992101pbb.78.1413844631828; Mon, 20 Oct 2014 15:37:11 -0700 (PDT) Sender: andy@fud.org.nz Received: by 10.70.109.175 with HTTP; Mon, 20 Oct 2014 15:37:11 -0700 (PDT) In-Reply-To: <201410201442.s9KEggqt096167@svn.freebsd.org> References: <201410201442.s9KEggqt096167@svn.freebsd.org> Date: Tue, 21 Oct 2014 11:37:11 +1300 X-Google-Sender-Auth: Cb6N57Z7Q8cDHOZIyW7J09hAnPo Message-ID: Subject: Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys From: Andrew Thompson To: Bryan Venteicher Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:37:26 -0000 On 21 October 2014 03:42, Bryan Venteicher wrote: > Author: bryanv > Date: Mon Oct 20 14:42:42 2014 > New Revision: 273331 > URL: https://svnweb.freebsd.org/changeset/base/273331 > > Log: > Add vxlan interface > > vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in > a UDP packet. This implementation is based on RFC7348. > > Currently, the IPv6 support is not fully compliant with the > specification: > we should be able to receive UPDv6 packets with a zero checksum, but we > need to support RFC6935 first. Patches for this should come soon. > > Given it is self contained new code is it a 10.1 MFC candidate? Andrew From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 22:52:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E24D898; Mon, 20 Oct 2014 22:52:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4AB3F864; Mon, 20 Oct 2014 22:52:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KMqGw8054193; Mon, 20 Oct 2014 22:52:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KMqGA0054192; Mon, 20 Oct 2014 22:52:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410202252.s9KMqGA0054192@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 20 Oct 2014 22:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273351 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:52:16 -0000 Author: mjg Date: Mon Oct 20 22:52:15 2014 New Revision: 273351 URL: https://svnweb.freebsd.org/changeset/base/273351 Log: Plug unnecessary binvp NULL initialization and test. Reported by: Coverity CID: 1018889 Modified: head/sys/kern/kern_exec.c Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Mon Oct 20 22:22:39 2014 (r273350) +++ head/sys/kern/kern_exec.c Mon Oct 20 22:52:15 2014 (r273351) @@ -348,7 +348,7 @@ do_execve(td, args, mac_p) struct vnode *tracevp = NULL; struct ucred *tracecred = NULL; #endif - struct vnode *textvp = NULL, *binvp = NULL; + struct vnode *textvp = NULL, *binvp; cap_rights_t rights; int credential_changing; int textset; @@ -422,7 +422,7 @@ interpret: if (error) goto exec_fail; - binvp = nd.ni_vp; + binvp = nd.ni_vp; imgp->vp = binvp; } else { AUDIT_ARG_FD(args->fd); @@ -839,7 +839,7 @@ done1: */ if (textvp != NULL) vrele(textvp); - if (binvp && error != 0) + if (error != 0) vrele(binvp); #ifdef KTRACE if (tracevp != NULL) From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 22:53:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BEC69D6; Mon, 20 Oct 2014 22:53:04 +0000 (UTC) Received: from mail-ie0-x22a.google.com (mail-ie0-x22a.google.com [IPv6:2607:f8b0:4001:c03::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2DC9D86A; Mon, 20 Oct 2014 22:53:04 +0000 (UTC) Received: by mail-ie0-f170.google.com with SMTP id rd18so38118iec.1 for ; Mon, 20 Oct 2014 15:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=hm1Yiu++0X0NxMtVVx5fVu87SS3l6l/hRUSI/zaITEQ=; b=aVC8NtvaeNn6Iz5sm6SwqSmai59BO1FMqyJPxS/tYWXMSw3Liwvsao8/k76lNPq3eJ 6pBpW2GjYoKiM10jRrzIwQ5eNqtpwmO3ommMcUqwF6KVmvAXtN1NeMAd/9rJhA/gK76I hdLOEN8Z2s8NKh+Nez40Gw7yzJzMw8NdVqu6D6hsicH/1feMidMLWLn3bxgb4GPmz5W7 uTUa7Av4BUWcfh4EXZV2t+t0lswruzHXBpK/Ft6/qjwXjs+vmeY44t4BOdK2AxSlglDm lawB5LOn4Vw4AnWm/Iq7cXTalDuOUPpt/4kBYQwt+Xl1Tpk/wUDizeMLVu+IEyzzU/4h Sreg== X-Received: by 10.42.121.17 with SMTP id h17mr5134642icr.75.1413845583450; Mon, 20 Oct 2014 15:53:03 -0700 (PDT) MIME-Version: 1.0 Sender: mr.kodiak@gmail.com Received: by 10.64.86.230 with HTTP; Mon, 20 Oct 2014 15:52:33 -0700 (PDT) In-Reply-To: References: <201410201442.s9KEggqt096167@svn.freebsd.org> From: Bryan Venteicher Date: Mon, 20 Oct 2014 17:52:33 -0500 X-Google-Sender-Auth: cIOwY7Hnx7TQ3jCmILPTCLHmXgg Message-ID: Subject: Re: svn commit: r273331 - in head: sbin/ifconfig share/man/man4 sys/conf sys/modules sys/modules/if_vxlan sys/net sys/sys To: Andrew Thompson Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , Bryan Venteicher , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:53:04 -0000 On Mon, Oct 20, 2014 at 5:37 PM, Andrew Thompson wrote: > > > On 21 October 2014 03:42, Bryan Venteicher wrote: > >> Author: bryanv >> Date: Mon Oct 20 14:42:42 2014 >> New Revision: 273331 >> URL: https://svnweb.freebsd.org/changeset/base/273331 >> >> Log: >> Add vxlan interface >> >> vxlan creates a virtual LAN by encapsulating the inner Ethernet frame in >> a UDP packet. This implementation is based on RFC7348. >> >> Currently, the IPv6 support is not fully compliant with the >> specification: >> we should be able to receive UPDv6 packets with a zero checksum, but we >> need to support RFC6935 first. Patches for this should come soon. >> >> > > Given it is self contained new code is it a 10.1 MFC candidate? > > > I hope to merge vxlan to 10-STABLE in a couple of months, but need to determine how to handle prerequisite commit r272886. There's ways without it - use a mbuf tag and a reserved field in the inpcb - but it would be nice if that commit is MFC'able. https://svnweb.freebsd.org/base?view=revision&revision=272886 > Andrew > > From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 22:55:18 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 186DAC09; Mon, 20 Oct 2014 22:55:18 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 7C90F87F; Mon, 20 Oct 2014 22:55:15 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id BAA29258; Tue, 21 Oct 2014 01:55:13 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XgLr5-00017B-ST; Tue, 21 Oct 2014 01:55:13 +0300 Message-ID: <54459294.2090904@FreeBSD.org> Date: Tue, 21 Oct 2014 01:54:12 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Steven Hartland , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269407 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys References: <201408012316.s71NGnBh071036@svn.freebsd.org> In-Reply-To: <201408012316.s71NGnBh071036@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 22:55:18 -0000 On 02/08/2014 02:16, Steven Hartland wrote: > Author: smh > Date: Fri Aug 1 23:16:48 2014 > New Revision: 269407 > URL: http://svnweb.freebsd.org/changeset/base/269407 > > Log: > Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods > > This prevents recursion of vdev_queue_io_done as per r265321 but > using a different method as recommended on the openzfs list. > > We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead > of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods. > > zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns > ZIO_PIPELINE_STOP to ensure future changes don't reintroduce > ZIO_PIPELINE_CONTINUE returns. Steve, it seems that the issue is applicable to OpenZFS in general, but unfortunately, as far as I can see, it's been applied only to FreeBSD. Now, I see the following bug report and a proposed fix: https://www.illumos.org/projects/illumos-gate//issues/5244 https://reviews.csiden.org/r/119/ I am not 100% sure, but it seems that those upstream changes could fix the problem that you've found. What do you think? Thanks! > Cleanup flow in vdev_geom_io_start while I'm here. > > Also fix some cases not using SET_ERROR(..) > > MFC after: 2 weeks > X-MFC-With: r265321 > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h Fri Aug 1 23:16:48 2014 (r269407) > @@ -208,7 +208,6 @@ enum zio_flag { > ZIO_FLAG_NOPWRITE = 1 << 26, > ZIO_FLAG_REEXECUTED = 1 << 27, > ZIO_FLAG_DELEGATED = 1 << 28, > - ZIO_FLAG_QUEUE_IO_DONE = 1 << 29, > }; > > #define ZIO_FLAG_MUSTSUCCEED 0 > @@ -363,7 +362,7 @@ typedef struct zio_transform { > struct zio_transform *zt_next; > } zio_transform_t; > > -typedef int zio_pipe_stage_t(zio_t **ziop); > +typedef int zio_pipe_stage_t(zio_t *zio); > > /* > * The io_reexecute flags are distinct from io_flags because the child must > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -684,7 +684,7 @@ vdev_disk_io_intr(buf_t *bp) > * Rather than teach the rest of the stack about other error > * possibilities (EFAULT, etc), we normalize the error value here. > */ > - zio->io_error = (geterror(bp) != 0 ? EIO : 0); > + zio->io_error = (geterror(bp) != 0 ? SET_ERROR(EIO) : 0); > > if (zio->io_error == 0 && bp->b_resid != 0) > zio->io_error = SET_ERROR(EIO); > @@ -730,15 +730,17 @@ vdev_disk_io_start(zio_t *zio) > * Nothing to be done here but return failure. > */ > if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) { > - zio->io_error = ENXIO; > - return (ZIO_PIPELINE_CONTINUE); > + zio->io_error = SET_ERROR(ENXIO); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > if (zio->io_type == ZIO_TYPE_IOCTL) { > /* XXPOLICY */ > if (!vdev_readable(vd)) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > switch (zio->io_cmd) { > @@ -790,7 +792,8 @@ vdev_disk_io_start(zio_t *zio) > zio->io_error = SET_ERROR(ENOTSUP); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > vb = kmem_alloc(sizeof (vdev_buf_t), KM_SLEEP); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -164,7 +164,8 @@ vdev_file_io_start(zio_t *zio) > > if (!vdev_readable(vd)) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > vf = vd->vdev_tsd; > @@ -180,7 +181,8 @@ vdev_file_io_start(zio_t *zio) > zio->io_error = SET_ERROR(ENOTSUP); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > zio->io_error = vn_rdwr(zio->io_type == ZIO_TYPE_READ ? > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -749,7 +749,7 @@ vdev_geom_io_intr(struct bio *bp) > vd = zio->io_vd; > zio->io_error = bp->bio_error; > if (zio->io_error == 0 && bp->bio_resid != 0) > - zio->io_error = EIO; > + zio->io_error = SET_ERROR(EIO); > > switch(zio->io_error) { > case ENOTSUP: > @@ -803,37 +803,38 @@ vdev_geom_io_start(zio_t *zio) > /* XXPOLICY */ > if (!vdev_readable(vd)) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > - } > - > - switch (zio->io_cmd) { > - case DKIOCFLUSHWRITECACHE: > - if (zfs_nocacheflush || vdev_geom_bio_flush_disable) > - break; > - if (vd->vdev_nowritecache) { > + } else { > + switch (zio->io_cmd) { > + case DKIOCFLUSHWRITECACHE: > + if (zfs_nocacheflush || vdev_geom_bio_flush_disable) > + break; > + if (vd->vdev_nowritecache) { > + zio->io_error = SET_ERROR(ENOTSUP); > + break; > + } > + goto sendreq; > + default: > zio->io_error = SET_ERROR(ENOTSUP); > - break; > } > - goto sendreq; > - default: > - zio->io_error = SET_ERROR(ENOTSUP); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > case ZIO_TYPE_FREE: > - if (vdev_geom_bio_delete_disable) > - return (ZIO_PIPELINE_CONTINUE); > - > if (vd->vdev_notrim) { > zio->io_error = SET_ERROR(ENOTSUP); > - return (ZIO_PIPELINE_CONTINUE); > + } else if (!vdev_geom_bio_delete_disable) { > + goto sendreq; > } > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > sendreq: > cp = vd->vdev_tsd; > if (cp == NULL) { > zio->io_error = SET_ERROR(ENXIO); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > bp = g_alloc_bio(); > bp->bio_caller1 = zio; > @@ -852,14 +853,11 @@ sendreq: > bp->bio_length = zio->io_size; > break; > case ZIO_TYPE_IOCTL: > - if (zio->io_cmd == DKIOCFLUSHWRITECACHE) { > - bp->bio_cmd = BIO_FLUSH; > - bp->bio_flags |= BIO_ORDERED; > - bp->bio_data = NULL; > - bp->bio_offset = cp->provider->mediasize; > - bp->bio_length = 0; > - break; > - } > + bp->bio_cmd = BIO_FLUSH; > + bp->bio_flags |= BIO_ORDERED; > + bp->bio_data = NULL; > + bp->bio_offset = cp->provider->mediasize; > + bp->bio_length = 0; > break; > } > bp->bio_done = vdev_geom_io_intr; > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -450,7 +450,8 @@ vdev_mirror_io_start(zio_t *zio) > zio->io_type, zio->io_priority, 0, > vdev_mirror_scrub_done, mc)); > } > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > /* > * For normal reads just pick one child. > @@ -477,7 +478,8 @@ vdev_mirror_io_start(zio_t *zio) > c++; > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > static int > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -71,7 +71,8 @@ static int > vdev_missing_io_start(zio_t *zio) > { > zio->io_error = SET_ERROR(ENOTSUP); > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > /* ARGSUSED */ > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -796,25 +796,14 @@ vdev_queue_io_done(zio_t *zio) > > vq->vq_io_complete_ts = gethrtime(); > > - if (zio->io_flags & ZIO_FLAG_QUEUE_IO_DONE) { > - /* > - * Executing from a previous vdev_queue_io_done so > - * to avoid recursion we just unlock and return. > - */ > - mutex_exit(&vq->vq_lock); > - return; > - } > - > while ((nio = vdev_queue_io_to_issue(vq)) != NULL) { > mutex_exit(&vq->vq_lock); > - nio->io_flags |= ZIO_FLAG_QUEUE_IO_DONE; > if (nio->io_done == vdev_queue_agg_io_done) { > zio_nowait(nio); > } else { > zio_vdev_io_reissue(nio); > zio_execute(nio); > } > - nio->io_flags &= ~ZIO_FLAG_QUEUE_IO_DONE; > mutex_enter(&vq->vq_lock); > } > > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -1755,7 +1755,9 @@ vdev_raidz_io_start(zio_t *zio) > zio->io_type, zio->io_priority, 0, > vdev_raidz_child_done, rc)); > } > - return (ZIO_PIPELINE_CONTINUE); > + > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > if (zio->io_type == ZIO_TYPE_WRITE) { > @@ -1787,7 +1789,8 @@ vdev_raidz_io_start(zio_t *zio) > ZIO_FLAG_NODATA | ZIO_FLAG_OPTIONAL, NULL, NULL)); > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > ASSERT(zio->io_type == ZIO_TYPE_READ); > @@ -1827,7 +1830,8 @@ vdev_raidz_io_start(zio_t *zio) > } > } > > - return (ZIO_PIPELINE_CONTINUE); > + zio_interrupt(zio); > + return (ZIO_PIPELINE_STOP); > } > > > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Aug 1 23:06:38 2014 (r269406) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Fri Aug 1 23:16:48 2014 (r269407) > @@ -1038,9 +1038,8 @@ zio_shrink(zio_t *zio, uint64_t size) > */ > > static int > -zio_read_bp_init(zio_t **ziop) > +zio_read_bp_init(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (BP_GET_COMPRESS(bp) != ZIO_COMPRESS_OFF && > @@ -1073,9 +1072,8 @@ zio_read_bp_init(zio_t **ziop) > } > > static int > -zio_write_bp_init(zio_t **ziop) > +zio_write_bp_init(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > zio_prop_t *zp = &zio->io_prop; > enum zio_compress compress = zp->zp_compress; > @@ -1255,9 +1253,8 @@ zio_write_bp_init(zio_t **ziop) > } > > static int > -zio_free_bp_init(zio_t **ziop) > +zio_free_bp_init(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (zio->io_child_type == ZIO_CHILD_LOGICAL) { > @@ -1340,10 +1337,8 @@ zio_taskq_member(zio_t *zio, zio_taskq_t > } > > static int > -zio_issue_async(zio_t **ziop) > +zio_issue_async(zio_t *zio) > { > - zio_t *zio = *ziop; > - > zio_taskq_dispatch(zio, ZIO_TASKQ_ISSUE, B_FALSE); > > return (ZIO_PIPELINE_STOP); > @@ -1411,7 +1406,7 @@ zio_execute(zio_t *zio) > } > > zio->io_stage = stage; > - rv = zio_pipeline[highbit64(stage) - 1](&zio); > + rv = zio_pipeline[highbit64(stage) - 1](zio); > > if (rv == ZIO_PIPELINE_STOP) > return; > @@ -1845,9 +1840,8 @@ zio_gang_tree_issue(zio_t *pio, zio_gang > } > > static int > -zio_gang_assemble(zio_t **ziop) > +zio_gang_assemble(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > ASSERT(BP_IS_GANG(bp) && zio->io_gang_leader == NULL); > @@ -1861,9 +1855,8 @@ zio_gang_assemble(zio_t **ziop) > } > > static int > -zio_gang_issue(zio_t **ziop) > +zio_gang_issue(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (zio_wait_for_children(zio, ZIO_CHILD_GANG, ZIO_WAIT_DONE)) > @@ -1997,9 +1990,8 @@ zio_write_gang_block(zio_t *pio) > * writes) and as a result is mutually exclusive with dedup. > */ > static int > -zio_nop_write(zio_t **ziop) > +zio_nop_write(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > blkptr_t *bp_orig = &zio->io_bp_orig; > zio_prop_t *zp = &zio->io_prop; > @@ -2070,9 +2062,8 @@ zio_ddt_child_read_done(zio_t *zio) > } > > static int > -zio_ddt_read_start(zio_t **ziop) > +zio_ddt_read_start(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > ASSERT(BP_GET_DEDUP(bp)); > @@ -2114,9 +2105,8 @@ zio_ddt_read_start(zio_t **ziop) > } > > static int > -zio_ddt_read_done(zio_t **ziop) > +zio_ddt_read_done(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > > if (zio_wait_for_children(zio, ZIO_CHILD_DDT, ZIO_WAIT_DONE)) > @@ -2284,9 +2274,8 @@ zio_ddt_ditto_write_done(zio_t *zio) > } > > static int > -zio_ddt_write(zio_t **ziop) > +zio_ddt_write(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > blkptr_t *bp = zio->io_bp; > uint64_t txg = zio->io_txg; > @@ -2397,9 +2386,8 @@ zio_ddt_write(zio_t **ziop) > ddt_entry_t *freedde; /* for debugging */ > > static int > -zio_ddt_free(zio_t **ziop) > +zio_ddt_free(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > blkptr_t *bp = zio->io_bp; > ddt_t *ddt = ddt_select(spa, bp); > @@ -2424,9 +2412,8 @@ zio_ddt_free(zio_t **ziop) > * ========================================================================== > */ > static int > -zio_dva_allocate(zio_t **ziop) > +zio_dva_allocate(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > metaslab_class_t *mc = spa_normal_class(spa); > blkptr_t *bp = zio->io_bp; > @@ -2468,19 +2455,16 @@ zio_dva_allocate(zio_t **ziop) > } > > static int > -zio_dva_free(zio_t **ziop) > +zio_dva_free(zio_t *zio) > { > - zio_t *zio = *ziop; > - > metaslab_free(zio->io_spa, zio->io_bp, zio->io_txg, B_FALSE); > > return (ZIO_PIPELINE_CONTINUE); > } > > static int > -zio_dva_claim(zio_t **ziop) > +zio_dva_claim(zio_t *zio) > { > - zio_t *zio = *ziop; > int error; > > error = metaslab_claim(zio->io_spa, zio->io_bp, zio->io_txg); > @@ -2574,12 +2558,12 @@ zio_free_zil(spa_t *spa, uint64_t txg, b > * ========================================================================== > */ > static int > -zio_vdev_io_start(zio_t **ziop) > +zio_vdev_io_start(zio_t *zio) > { > - zio_t *zio = *ziop; > vdev_t *vd = zio->io_vd; > uint64_t align; > spa_t *spa = zio->io_spa; > + int ret; > > ASSERT(zio->io_error == 0); > ASSERT(zio->io_child_error[ZIO_CHILD_VDEV] == 0); > @@ -2690,7 +2674,6 @@ zio_vdev_io_start(zio_t **ziop) > case ZIO_TYPE_FREE: > if ((zio = vdev_queue_io(zio)) == NULL) > return (ZIO_PIPELINE_STOP); > - *ziop = zio; > > if (!vdev_accessible(vd, zio)) { > zio->io_error = SET_ERROR(ENXIO); > @@ -2710,13 +2693,15 @@ zio_vdev_io_start(zio_t **ziop) > return (ZIO_PIPELINE_STOP); > } > > - return (vd->vdev_ops->vdev_op_io_start(zio)); > + ret = vd->vdev_ops->vdev_op_io_start(zio); > + ASSERT(ret == ZIO_PIPELINE_STOP); > + > + return (ret); > } > > static int > -zio_vdev_io_done(zio_t **ziop) > +zio_vdev_io_done(zio_t *zio) > { > - zio_t *zio = *ziop; > vdev_t *vd = zio->io_vd; > vdev_ops_t *ops = vd ? vd->vdev_ops : &vdev_mirror_ops; > boolean_t unexpected_error = B_FALSE; > @@ -2794,9 +2779,8 @@ zio_vsd_default_cksum_report(zio_t *zio, > } > > static int > -zio_vdev_io_assess(zio_t **ziop) > +zio_vdev_io_assess(zio_t *zio) > { > - zio_t *zio = *ziop; > vdev_t *vd = zio->io_vd; > > if (zio_wait_for_children(zio, ZIO_CHILD_VDEV, ZIO_WAIT_DONE)) > @@ -2911,9 +2895,8 @@ zio_vdev_io_bypass(zio_t *zio) > * ========================================================================== > */ > static int > -zio_checksum_generate(zio_t **ziop) > +zio_checksum_generate(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > enum zio_checksum checksum; > > @@ -2943,9 +2926,8 @@ zio_checksum_generate(zio_t **ziop) > } > > static int > -zio_checksum_verify(zio_t **ziop) > +zio_checksum_verify(zio_t *zio) > { > - zio_t *zio = *ziop; > zio_bad_cksum_t info; > blkptr_t *bp = zio->io_bp; > int error; > @@ -3016,9 +2998,8 @@ zio_worst_error(int e1, int e2) > * ========================================================================== > */ > static int > -zio_ready(zio_t **ziop) > +zio_ready(zio_t *zio) > { > - zio_t *zio = *ziop; > blkptr_t *bp = zio->io_bp; > zio_t *pio, *pio_next; > > @@ -3075,9 +3056,8 @@ zio_ready(zio_t **ziop) > } > > static int > -zio_done(zio_t **ziop) > +zio_done(zio_t *zio) > { > - zio_t *zio = *ziop; > spa_t *spa = zio->io_spa; > zio_t *lio = zio->io_logical; > blkptr_t *bp = zio->io_bp; > -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 23:32:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0D9BC529; Mon, 20 Oct 2014 23:32:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE2DFC03; Mon, 20 Oct 2014 23:32:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KNWYgF073285; Mon, 20 Oct 2014 23:32:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KNWYiQ073284; Mon, 20 Oct 2014 23:32:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410202332.s9KNWYiQ073284@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 20 Oct 2014 23:32:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273352 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 23:32:35 -0000 Author: ian Date: Mon Oct 20 23:32:34 2014 New Revision: 273352 URL: https://svnweb.freebsd.org/changeset/base/273352 Log: The imx6 hardware is fast enough to make good use of however much timecounter resolution is available, so ask for a 1 GHz frequency. It won't actually get one that fast, but that'll get the fastest available clock and use a divisor of 1 (probably 132 or 66mhz on current hardware). Modified: head/sys/arm/freescale/imx/imx_gpt.c Modified: head/sys/arm/freescale/imx/imx_gpt.c ============================================================================== --- head/sys/arm/freescale/imx/imx_gpt.c Mon Oct 20 22:52:15 2014 (r273351) +++ head/sys/arm/freescale/imx/imx_gpt.c Mon Oct 20 23:32:34 2014 (r273352) @@ -95,7 +95,7 @@ struct imx_gpt_softc *imx_gpt_sc = NULL; static const int imx_gpt_delay_count = 78; /* Try to divide down an available fast clock to this frequency. */ -#define TARGET_FREQUENCY 10000000 +#define TARGET_FREQUENCY 1000000000 /* Don't try to set an event timer period smaller than this. */ #define MIN_ET_PERIOD 10LLU From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 23:34:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBC52681; Mon, 20 Oct 2014 23:34:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8A34C14; Mon, 20 Oct 2014 23:34:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9KNYl5G073602; Mon, 20 Oct 2014 23:34:47 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9KNYlAp073601; Mon, 20 Oct 2014 23:34:47 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410202334.s9KNYlAp073601@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 20 Oct 2014 23:34:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273353 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 23:34:48 -0000 Author: ian Date: Mon Oct 20 23:34:47 2014 New Revision: 273353 URL: https://svnweb.freebsd.org/changeset/base/273353 Log: Attach the imx6 CCM driver during BUS_PASS_CPU. It controls the clocks for most on-chip devices and needs to be available before other drivers start attaching and asking to have their clocks enabled. Modified: head/sys/arm/freescale/imx/imx6_ccm.c Modified: head/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ccm.c Mon Oct 20 23:32:34 2014 (r273352) +++ head/sys/arm/freescale/imx/imx6_ccm.c Mon Oct 20 23:34:47 2014 (r273353) @@ -261,5 +261,6 @@ static driver_t ccm_driver = { static devclass_t ccm_devclass; -DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0); +EARLY_DRIVER_MODULE(ccm, simplebus, ccm_driver, ccm_devclass, 0, 0, + BUS_PASS_CPU + BUS_PASS_ORDER_EARLY); From owner-svn-src-head@FreeBSD.ORG Mon Oct 20 23:43:17 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBEA6869; Mon, 20 Oct 2014 23:43:17 +0000 (UTC) Received: from smtp1.multiplay.co.uk (smtp1.multiplay.co.uk [85.236.96.35]) by mx1.freebsd.org (Postfix) with ESMTP id 801F0CD8; Mon, 20 Oct 2014 23:43:17 +0000 (UTC) Received: by smtp1.multiplay.co.uk (Postfix, from userid 65534) id 4757F20E70899; Mon, 20 Oct 2014 23:43:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.multiplay.co.uk X-Spam-Level: X-Spam-Status: No, score=0.1 required=8.0 tests=AWL,BAYES_00,RDNS_DYNAMIC autolearn=no version=3.3.1 Received: from [10.10.1.68] (82-69-141-170.dsl.in-addr.zen.co.uk [82.69.141.170]) by smtp1.multiplay.co.uk (Postfix) with ESMTP id 95B1220E7088A; Mon, 20 Oct 2014 23:43:13 +0000 (UTC) Message-ID: <54459E1D.1040401@freebsd.org> Date: Tue, 21 Oct 2014 00:43:25 +0100 From: Steven Hartland User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Andriy Gapon , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r269407 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys References: <201408012316.s71NGnBh071036@svn.freebsd.org> <54459294.2090904@FreeBSD.org> In-Reply-To: <54459294.2090904@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Oct 2014 23:43:17 -0000 On 20/10/2014 23:54, Andriy Gapon wrote: > On 02/08/2014 02:16, Steven Hartland wrote: >> Author: smh >> Date: Fri Aug 1 23:16:48 2014 >> New Revision: 269407 >> URL: http://svnweb.freebsd.org/changeset/base/269407 >> >> Log: >> Don't return ZIO_PIPELINE_CONTINUE from vdev_op_io_start methods >> >> This prevents recursion of vdev_queue_io_done as per r265321 but >> using a different method as recommended on the openzfs list. >> >> We now use zio_interrupt(zio) and return ZIO_PIPELINE_STOP instead >> of returning ZIO_PIPELINE_CONTINUE from vdev_*_io_start methods. >> >> zio_vdev_io_start now ASSERTS the that vdev_op_io_start returns >> ZIO_PIPELINE_STOP to ensure future changes don't reintroduce >> ZIO_PIPELINE_CONTINUE returns. > > Steve, > > it seems that the issue is applicable to OpenZFS in general, but unfortunately, > as far as I can see, it's been applied only to FreeBSD. > > Now, I see the following bug report and a proposed fix: > https://www.illumos.org/projects/illumos-gate//issues/5244 > https://reviews.csiden.org/r/119/ > > I am not 100% sure, but it seems that those upstream changes could fix the > problem that you've found. > > What do you think? Yep very similar change overall. The only real difference is they changed the vdev_op_io_start call to a void and return stop direct from zio_vdev_io_start. The result should be identical and it will be easy to merge the upstream change when it gets committed. Shame that wasn't suggested when I posted my suggested patch ;-) Regards Steve From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 01:06:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 30C2C7F6; Tue, 21 Oct 2014 01:06:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DD41663; Tue, 21 Oct 2014 01:06:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L16wvB016765; Tue, 21 Oct 2014 01:06:58 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L16wXd016764; Tue, 21 Oct 2014 01:06:58 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410210106.s9L16wXd016764@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 21 Oct 2014 01:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273356 - head/sys/amd64/amd64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:06:59 -0000 Author: neel Date: Tue Oct 21 01:06:58 2014 New Revision: 273356 URL: https://svnweb.freebsd.org/changeset/base/273356 Log: Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT misconfiguration VM-exit. An EPT misconfiguration is triggered when the processor encounters a PTE that is writable but not readable (WR=10). On processors that require A/D bit emulation PG_M and PG_A map to EPT_PG_WRITE and EPT_PG_READ respectively. If the PTE is updated as in the following code snippet: *pte |= PG_M; *pte |= PG_A; then it is possible for another processor to observe the PTE after the PG_M (aka EPT_PG_WRITE) bit is set but before PG_A (aka EPT_PG_READ) bit is set. This will trigger an EPT misconfiguration VM-exit on the other processor. Reported by: rodrigc Reviewed by: grehan MFC after: 3 days Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 21 00:07:37 2014 (r273355) +++ head/sys/amd64/amd64/pmap.c Tue Oct 21 01:06:58 2014 (r273356) @@ -6810,9 +6810,19 @@ retry: if (ftype == VM_PROT_WRITE) { if ((*pte & PG_RW) == 0) goto done; - *pte |= PG_M; + /* + * Set the modified and accessed bits simultaneously. + * + * Intel EPT PTEs that do software emulation of A/D bits map + * PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE respectively. + * An EPT misconfiguration is triggered if the PTE is writable + * but not readable (WR=10). This is avoided by setting PG_A + * and PG_M simultaneously. + */ + *pte |= PG_M | PG_A; + } else { + *pte |= PG_A; } - *pte |= PG_A; /* try to promote the mapping */ if (va < VM_MAXUSER_ADDRESS) From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 01:31:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1BA5DE8; Tue, 21 Oct 2014 01:31:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDFA7914; Tue, 21 Oct 2014 01:31:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1VOBp029699; Tue, 21 Oct 2014 01:31:24 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1VOA5029698; Tue, 21 Oct 2014 01:31:24 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201410210131.s9L1VOA5029698@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Tue, 21 Oct 2014 01:31:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273359 - head/sys/dev/re X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:31:25 -0000 Author: yongari Date: Tue Oct 21 01:31:24 2014 New Revision: 273359 URL: https://svnweb.freebsd.org/changeset/base/273359 Log: It seems multicast filtering of RTL8168F does not work. Workaround the silicon bug by accepting any multicast packets. PR: 193488 MFC After: 1 week Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Tue Oct 21 01:15:43 2014 (r273358) +++ head/sys/dev/re/if_re.c Tue Oct 21 01:31:24 2014 (r273359) @@ -703,6 +703,12 @@ re_set_rxmode(struct rl_softc *sc) rxfilt |= RL_RXCFG_RX_MULTI; } + if (sc->rl_hwrev->rl_rev == RL_HWREV_8168F) { + /* Disable multicast filtering due to silicon bug. */ + hashes[0] = 0xffffffff; + hashes[1] = 0xffffffff; + } + done: CSR_WRITE_4(sc, RL_MAR0, hashes[0]); CSR_WRITE_4(sc, RL_MAR4, hashes[1]); From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 01:34:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 433BAF5A; Tue, 21 Oct 2014 01:34:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F84A933; Tue, 21 Oct 2014 01:34:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L1YJxL030562; Tue, 21 Oct 2014 01:34:19 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L1YJnM030561; Tue, 21 Oct 2014 01:34:19 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410210134.s9L1YJnM030561@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 21 Oct 2014 01:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273360 - head/tools/tools/cxgbetool X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:34:19 -0000 Author: np Date: Tue Oct 21 01:34:18 2014 New Revision: 273360 URL: https://svnweb.freebsd.org/changeset/base/273360 Log: cxgbetool: Catch up with r185979. One of MAP_ANON, MAP_PRIVATE, MAP_SHARED, or MAP_STACK must be specified. This fixes the "loadfw" subcommand. MFC after: 1 week Modified: head/tools/tools/cxgbetool/cxgbetool.c Modified: head/tools/tools/cxgbetool/cxgbetool.c ============================================================================== --- head/tools/tools/cxgbetool/cxgbetool.c Tue Oct 21 01:31:24 2014 (r273359) +++ head/tools/tools/cxgbetool/cxgbetool.c Tue Oct 21 01:34:18 2014 (r273360) @@ -1462,7 +1462,7 @@ loadfw(int argc, const char *argv[]) } data.len = st.st_size; - data.data = mmap(0, data.len, PROT_READ, 0, fd, 0); + data.data = mmap(0, data.len, PROT_READ, MAP_PRIVATE, fd, 0); if (data.data == MAP_FAILED) { warn("mmap"); close(fd); From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 01:38:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4260150; Tue, 21 Oct 2014 01:38:43 +0000 (UTC) Received: from mail-pd0-x232.google.com (mail-pd0-x232.google.com [IPv6:2607:f8b0:400e:c02::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C4A395A; Tue, 21 Oct 2014 01:38:43 +0000 (UTC) Received: by mail-pd0-f178.google.com with SMTP id y10so242892pdj.37 for ; Mon, 20 Oct 2014 18:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ZVZJggY3Dz2LxC1xnlxRot7XCip4teiRcClL0Dpkx68=; b=pDfKrYFRd4ZigwoHPJk8uuVor11F7lz3jtTZ98P6SjeoB1/1+XMB0K7W1lAIk4TzJx kX7m9A0pIJt73GfDF2QGmq5fC+mw83ZaOneBxrUbg3PjGi8Z3zfSsC4TQKm7hsO03/3H 1ZQT8qINMqzCreLLRZFP6BpLI0iIMrYndWpNoEY7X+7TTzohZaWqgVhNytqN88NvLcXG XhgLmux2d64nhg9mfXJduXKcy4mc0p7S8PMukl3dTitYSD97tWOuiNgE2E3djfrKCTXY GKqhuV3P2ZVGmsHyAGmNIXncGWvSwJV0bFP8n9uO3giHL7vE9N60f3xMK7QaEmEGxlpP CFtA== X-Received: by 10.67.1.39 with SMTP id bd7mr14857785pad.57.1413855523018; Mon, 20 Oct 2014 18:38:43 -0700 (PDT) Received: from [10.192.166.0] (stargate.chelsio.com. [67.207.112.58]) by mx.google.com with ESMTPSA id zq13sm10369664pab.44.2014.10.20.18.38.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Oct 2014 18:38:41 -0700 (PDT) Sender: Navdeep Parhar Message-ID: <5445B920.4070005@FreeBSD.org> Date: Mon, 20 Oct 2014 18:38:40 -0700 From: Navdeep Parhar User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273360 - head/tools/tools/cxgbetool References: <201410210134.s9L1YJnM030561@svn.freebsd.org> In-Reply-To: <201410210134.s9L1YJnM030561@svn.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 01:38:43 -0000 On 10/20/14 18:34, Navdeep Parhar wrote: > Author: np > Date: Tue Oct 21 01:34:18 2014 > New Revision: 273360 > URL: https://svnweb.freebsd.org/changeset/base/273360 > > Log: > cxgbetool: Catch up with r185979. One of MAP_ANON, MAP_PRIVATE, > MAP_SHARED, or MAP_STACK must be specified. Sorry, I meant r271635. (185979 isn't a random number in case you're wondering -- it's the mercurial changelog number for r271635 in my workspace). Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 04:30:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E78D5842; Tue, 21 Oct 2014 04:30:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D37CCBAC; Tue, 21 Oct 2014 04:30:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L4U06L011622; Tue, 21 Oct 2014 04:30:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L4U0eU011621; Tue, 21 Oct 2014 04:30:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410210430.s9L4U0eU011621@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 21 Oct 2014 04:30:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273365 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 04:30:01 -0000 Author: markj Date: Tue Oct 21 04:30:00 2014 New Revision: 273365 URL: https://svnweb.freebsd.org/changeset/base/273365 Log: Fix a few small bugs in the DTrace USDT rules: * anchor search strings appropriately, * use .ALLSRC to pass the full path to the D script to dtrace(1), * don't insert the auto-generated header into SRCS - it doesn't accomplish anything, and we end up having to remove it from OBJS anyway. Reviewed by: rpaulo Differential Revision: https://reviews.freebsd.org/D978 MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/bsd.dep.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Tue Oct 21 02:41:40 2014 (r273364) +++ head/share/mk/bsd.dep.mk Tue Oct 21 04:30:00 2014 (r273365) @@ -132,20 +132,17 @@ CFLAGS+= -I${.OBJDIR} DHDRS+= ${_D}.h ${_D}.h: ${_DSRC} ${DTRACE} -xnolibs -h -s ${.ALLSRC} -SRCS:= ${SRCS:S/${_DSRC}/${_D}.h/} +SRCS:= ${SRCS:S/^${_DSRC}$//} OBJS+= ${_D}.o CLEANFILES+= ${_D}.h ${_D}.o -${_D}.o: ${_D}.h ${OBJS:S/${_D}.o//} - ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ - ${OBJS:S/${_D}.o//} +${_D}.o: ${_DSRC} ${OBJS:S/^${_D}.o$//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC} .if defined(LIB) CLEANFILES+= ${_D}.So ${_D}.po -${_D}.So: ${_D}.h ${SOBJS:S/${_D}.So//} - ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ - ${SOBJS:S/${_D}.So//} -${_D}.po: ${_D}.h ${POBJS:S/${_D}.po//} - ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.CURDIR}/${_DSRC} \ - ${POBJS:S/${_D}.po//} +${_D}.So: ${_DSRC} ${SOBJS:S/^${_D}.So$//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC} +${_D}.po: ${_DSRC} ${POBJS:S/^${_D}.po$//} + ${DTRACE} -xnolibs -G -o ${.TARGET} -s ${.ALLSRC} .endif .endfor .endfor From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 05:19:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 329F22CD; Tue, 21 Oct 2014 05:19:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1EA43FA6; Tue, 21 Oct 2014 05:19:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L5J81g034934; Tue, 21 Oct 2014 05:19:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L5J8iu034933; Tue, 21 Oct 2014 05:19:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410210519.s9L5J8iu034933@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 21 Oct 2014 05:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273370 - head/cddl/lib/libdtrace X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:19:09 -0000 Author: markj Date: Tue Oct 21 05:19:08 2014 New Revision: 273370 URL: https://svnweb.freebsd.org/changeset/base/273370 Log: Correct the calculation of tcps_rto in the struct tcpcb -> tcpsinfo_t translator. Submitted by: Grenville Armitage MFC after: 1 week Modified: head/cddl/lib/libdtrace/tcp.d Modified: head/cddl/lib/libdtrace/tcp.d ============================================================================== --- head/cddl/lib/libdtrace/tcp.d Tue Oct 21 04:55:55 2014 (r273369) +++ head/cddl/lib/libdtrace/tcp.d Tue Oct 21 05:19:08 2014 (r273370) @@ -198,7 +198,7 @@ translator tcpsinfo_t < struct tcpcb *p tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh; tcps_sack_fack = p == NULL ? 0 : p->snd_fack; tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata; - tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */ + tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz; tcps_mss = p == NULL ? -1 : p->t_maxseg; tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 05:44:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 33242935; Tue, 21 Oct 2014 05:44:02 +0000 (UTC) Received: from mail-lb0-x22f.google.com (mail-lb0-x22f.google.com [IPv6:2a00:1450:4010:c04::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 438DF2EE; Tue, 21 Oct 2014 05:44:01 +0000 (UTC) Received: by mail-lb0-f175.google.com with SMTP id u10so363271lbd.20 for ; Mon, 20 Oct 2014 22:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=5fA8LYp8CF2kJE8aFTLhrD74NqKqjqm98aTP4VxZUaM=; b=jFjMFXxJAv3FkXzlYpdSWVM5hdBmsj6WI66z1WsyRP16jSStsBnVJ19CC+ykOewtEZ +q+k+ac2wd7TiIcUvMKKJUFDf75z3zNcc0ogg10eJz6dKHcbJgOc//fLXbpQN5ACS1tH p8yOZwwtkVBm1Rntj9su8N3mQXLHGg2pnz9jYj+vFkjuOv+nekHX3eWP/82C062eHWA6 SLc7yB9NMUOcQ52kuQ+Vnms6JzBi4H+X1RU4iCkhaJ5UYg4xagO05LIbM25aHBHTZRMq FxAz38oCv3ydS4uN6lMAuNcPBRGMM3AbgCek2xEqYbQ4tN+QHiQtfHiPno4Qn4xrIhI0 Vn6w== MIME-Version: 1.0 X-Received: by 10.112.147.225 with SMTP id tn1mr32059159lbb.37.1413870239164; Mon, 20 Oct 2014 22:43:59 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.112.131.66 with HTTP; Mon, 20 Oct 2014 22:43:59 -0700 (PDT) In-Reply-To: <201410210106.s9L16wXd016764@svn.freebsd.org> References: <201410210106.s9L16wXd016764@svn.freebsd.org> Date: Mon, 20 Oct 2014 22:43:59 -0700 X-Google-Sender-Auth: fOktHhb-SLwq2XolSZUGJZRyU4A Message-ID: Subject: Re: svn commit: r273356 - head/sys/amd64/amd64 From: Craig Rodrigues To: src-committers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:44:02 -0000 Hi, Just to add some background to this fix, in the https://jenkins.freebsd.org cluster, we are using several bhyve VM's to host the environment for doing builds and tests. We are hammering on the VM's quite nicely. We found one problem where the bhyve binary would crash. Neel looked at the problem, and came up with this fix. Thanks, Neel! -- Craig On Mon, Oct 20, 2014 at 6:06 PM, Neel Natu wrote: > Author: neel > Date: Tue Oct 21 01:06:58 2014 > New Revision: 273356 > URL: https://svnweb.freebsd.org/changeset/base/273356 > > Log: > Fix a race in pmap_emulate_accessed_dirty() that could trigger a EPT > misconfiguration VM-exit. > > An EPT misconfiguration is triggered when the processor encounters a PTE > that is writable but not readable (WR=10). On processors that require A/D > bit emulation PG_M and PG_A map to EPT_PG_WRITE and EPT_PG_READ > respectively. > > If the PTE is updated as in the following code snippet: > *pte |= PG_M; > *pte |= PG_A; > then it is possible for another processor to observe the PTE after the > PG_M > (aka EPT_PG_WRITE) bit is set but before PG_A (aka EPT_PG_READ) bit is > set. > > This will trigger an EPT misconfiguration VM-exit on the other processor. > > Reported by: rodrigc > Reviewed by: grehan > MFC after: 3 days > > Modified: > head/sys/amd64/amd64/pmap.c > > Modified: head/sys/amd64/amd64/pmap.c > > ============================================================================== > --- head/sys/amd64/amd64/pmap.c Tue Oct 21 00:07:37 2014 (r273355) > +++ head/sys/amd64/amd64/pmap.c Tue Oct 21 01:06:58 2014 (r273356) > @@ -6810,9 +6810,19 @@ retry: > if (ftype == VM_PROT_WRITE) { > if ((*pte & PG_RW) == 0) > goto done; > - *pte |= PG_M; > + /* > + * Set the modified and accessed bits simultaneously. > + * > + * Intel EPT PTEs that do software emulation of A/D bits > map > + * PG_A and PG_M to EPT_PG_READ and EPT_PG_WRITE > respectively. > + * An EPT misconfiguration is triggered if the PTE is > writable > + * but not readable (WR=10). This is avoided by setting > PG_A > + * and PG_M simultaneously. > + */ > + *pte |= PG_M | PG_A; > + } else { > + *pte |= PG_A; > } > - *pte |= PG_A; > > /* try to promote the mapping */ > if (va < VM_MAXUSER_ADDRESS) > > From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 05:45:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A16AEAA3; Tue, 21 Oct 2014 05:45:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8DB0330B; Tue, 21 Oct 2014 05:45:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L5jwKo048500; Tue, 21 Oct 2014 05:45:58 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L5jwbP048499; Tue, 21 Oct 2014 05:45:58 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410210545.s9L5jwbP048499@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Tue, 21 Oct 2014 05:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273371 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:45:58 -0000 Author: bryanv Date: Tue Oct 21 05:45:57 2014 New Revision: 273371 URL: https://svnweb.freebsd.org/changeset/base/273371 Log: Use the size of the Ethernet address, not the entire header, when copying into forwarding entry. Reported by: Coverity CID: 1248849 Modified: head/sys/net/if_vxlan.c Modified: head/sys/net/if_vxlan.c ============================================================================== --- head/sys/net/if_vxlan.c Tue Oct 21 05:19:08 2014 (r273370) +++ head/sys/net/if_vxlan.c Tue Oct 21 05:45:57 2014 (r273371) @@ -716,7 +716,7 @@ vxlan_ftable_entry_init(struct vxlan_sof fe->vxlfe_flags = flags; fe->vxlfe_expire = time_uptime + sc->vxl_ftable_timeout; - memcpy(fe->vxlfe_mac, mac, ETHER_HDR_LEN); + memcpy(fe->vxlfe_mac, mac, ETHER_ADDR_LEN); vxlan_sockaddr_copy(&fe->vxlfe_raddr, sa); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 07:10:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C176EBB4; Tue, 21 Oct 2014 07:10:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A9F7FCD3; Tue, 21 Oct 2014 07:10:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7AjL9086943; Tue, 21 Oct 2014 07:10:45 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7Ai8S086934; Tue, 21 Oct 2014 07:10:44 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201410210710.s9L7Ai8S086934@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 21 Oct 2014 07:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273375 - in head: sys/amd64/include sys/amd64/vmm sys/amd64/vmm/amd sys/amd64/vmm/intel sys/amd64/vmm/io sys/modules/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:10:46 -0000 Author: neel Date: Tue Oct 21 07:10:43 2014 New Revision: 273375 URL: https://svnweb.freebsd.org/changeset/base/273375 Log: Merge projects/bhyve_svm into HEAD. After this change bhyve supports AMD processors with the SVM/AMD-V hardware extensions. More details available here: https://lists.freebsd.org/pipermail/freebsd-virtualization/2014-October/002905.html Submitted by: Anish Gupta (akgupt3@gmail.com) Tested by: Benjamin Perrault (ben.perrault@gmail.com) Tested by: Willem Jan Withagen (wjw@digiware.nl) Added: - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_genassym.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_msr.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_msr.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm_support.S - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.c - copied unchanged from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/vmcb.h Directory Properties: head/sys/amd64/vmm/amd/npt.c (props changed) head/sys/amd64/vmm/amd/npt.h (props changed) head/sys/amd64/vmm/amd/svm.c (props changed) head/sys/amd64/vmm/amd/svm.h (props changed) head/sys/amd64/vmm/amd/svm_genassym.c (props changed) head/sys/amd64/vmm/amd/svm_msr.c (props changed) head/sys/amd64/vmm/amd/svm_msr.h (props changed) head/sys/amd64/vmm/amd/svm_softc.h (props changed) head/sys/amd64/vmm/amd/svm_support.S (props changed) head/sys/amd64/vmm/amd/vmcb.c (props changed) head/sys/amd64/vmm/amd/vmcb.h (props changed) Modified: head/sys/amd64/include/vmm.h head/sys/amd64/include/vmm_instruction_emul.h head/sys/amd64/vmm/amd/amdv.c head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/io/vlapic.c head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_instruction_emul.c head/sys/amd64/vmm/x86.c head/sys/modules/vmm/Makefile head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyve/xmsr.c head/usr.sbin/bhyvectl/bhyvectl.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Tue Oct 21 06:25:41 2014 (r273374) +++ head/sys/amd64/include/vmm.h Tue Oct 21 07:10:43 2014 (r273375) @@ -487,6 +487,7 @@ enum vm_exitcode { VM_EXITCODE_TASK_SWITCH, VM_EXITCODE_MONITOR, VM_EXITCODE_MWAIT, + VM_EXITCODE_SVM, VM_EXITCODE_MAX }; @@ -564,6 +565,14 @@ struct vm_exit { int inst_type; int inst_error; } vmx; + /* + * SVM specific payload. + */ + struct { + uint64_t exitcode; + uint64_t exitinfo1; + uint64_t exitinfo2; + } svm; struct { uint32_t code; /* ecx value */ uint64_t wval; Modified: head/sys/amd64/include/vmm_instruction_emul.h ============================================================================== --- head/sys/amd64/include/vmm_instruction_emul.h Tue Oct 21 06:25:41 2014 (r273374) +++ head/sys/amd64/include/vmm_instruction_emul.h Tue Oct 21 07:10:43 2014 (r273375) @@ -93,7 +93,7 @@ int vmm_fetch_instruction(struct vm *vm, int vmm_gla2gpa(struct vm *vm, int vcpuid, struct vm_guest_paging *paging, uint64_t gla, int prot, uint64_t *gpa); -void vie_init(struct vie *vie); +void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); /* * Decode the instruction fetched into 'vie' so it can be emulated. Modified: head/sys/amd64/vmm/amd/amdv.c ============================================================================== --- head/sys/amd64/vmm/amd/amdv.c Tue Oct 21 06:25:41 2014 (r273374) +++ head/sys/amd64/vmm/amd/amdv.c Tue Oct 21 07:10:43 2014 (r273375) @@ -38,149 +38,6 @@ __FBSDID("$FreeBSD$"); #include "io/iommu.h" static int -amdv_init(int ipinum) -{ - - printf("amdv_init: not implemented\n"); - return (ENXIO); -} - -static int -amdv_cleanup(void) -{ - - printf("amdv_cleanup: not implemented\n"); - return (ENXIO); -} - -static void -amdv_resume(void) -{ -} - -static void * -amdv_vminit(struct vm *vm, struct pmap *pmap) -{ - - printf("amdv_vminit: not implemented\n"); - return (NULL); -} - -static int -amdv_vmrun(void *arg, int vcpu, register_t rip, struct pmap *pmap, - void *rptr, void *sptr) -{ - - printf("amdv_vmrun: not implemented\n"); - return (ENXIO); -} - -static void -amdv_vmcleanup(void *arg) -{ - - printf("amdv_vmcleanup: not implemented\n"); - return; -} - -static int -amdv_getreg(void *arg, int vcpu, int regnum, uint64_t *retval) -{ - - printf("amdv_getreg: not implemented\n"); - return (EINVAL); -} - -static int -amdv_setreg(void *arg, int vcpu, int regnum, uint64_t val) -{ - - printf("amdv_setreg: not implemented\n"); - return (EINVAL); -} - -static int -amdv_getdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) -{ - - printf("amdv_get_desc: not implemented\n"); - return (EINVAL); -} - -static int -amdv_setdesc(void *vmi, int vcpu, int num, struct seg_desc *desc) -{ - - printf("amdv_get_desc: not implemented\n"); - return (EINVAL); -} - -static int -amdv_getcap(void *arg, int vcpu, int type, int *retval) -{ - - printf("amdv_getcap: not implemented\n"); - return (EINVAL); -} - -static int -amdv_setcap(void *arg, int vcpu, int type, int val) -{ - - printf("amdv_setcap: not implemented\n"); - return (EINVAL); -} - -static struct vmspace * -amdv_vmspace_alloc(vm_offset_t min, vm_offset_t max) -{ - - printf("amdv_vmspace_alloc: not implemented\n"); - return (NULL); -} - -static void -amdv_vmspace_free(struct vmspace *vmspace) -{ - - printf("amdv_vmspace_free: not implemented\n"); - return; -} - -static struct vlapic * -amdv_vlapic_init(void *arg, int vcpuid) -{ - - panic("amdv_vlapic_init: not implmented"); -} - -static void -amdv_vlapic_cleanup(void *arg, struct vlapic *vlapic) -{ - - panic("amdv_vlapic_cleanup: not implemented"); -} - -struct vmm_ops vmm_ops_amd = { - amdv_init, - amdv_cleanup, - amdv_resume, - amdv_vminit, - amdv_vmrun, - amdv_vmcleanup, - amdv_getreg, - amdv_setreg, - amdv_getdesc, - amdv_setdesc, - amdv_getcap, - amdv_setcap, - amdv_vmspace_alloc, - amdv_vmspace_free, - amdv_vlapic_init, - amdv_vlapic_cleanup, -}; - -static int amd_iommu_init(void) { Copied: head/sys/amd64/vmm/amd/npt.c (from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/npt.c Tue Oct 21 07:10:43 2014 (r273375, copy of r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.c) @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "npt.h" + +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, npt, CTLFLAG_RW, NULL, NULL); + +static int npt_flags; +SYSCTL_INT(_hw_vmm_npt, OID_AUTO, pmap_flags, CTLFLAG_RD, + &npt_flags, 0, NULL); + +#define NPT_IPIMASK 0xFF + +/* + * AMD nested page table init. + */ +int +svm_npt_init(int ipinum) +{ + int enable_superpage = 1; + + npt_flags = ipinum & NPT_IPIMASK; + TUNABLE_INT_FETCH("hw.vmm.npt.enable_superpage", &enable_superpage); + if (enable_superpage) + npt_flags |= PMAP_PDE_SUPERPAGE; + + return (0); +} + +static int +npt_pinit(pmap_t pmap) +{ + + return (pmap_pinit_type(pmap, PT_RVI, npt_flags)); +} + +struct vmspace * +svm_npt_alloc(vm_offset_t min, vm_offset_t max) +{ + + return (vmspace_alloc(min, max, npt_pinit)); +} + +void +svm_npt_free(struct vmspace *vmspace) +{ + + vmspace_free(vmspace); +} Copied: head/sys/amd64/vmm/amd/npt.h (from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/npt.h Tue Oct 21 07:10:43 2014 (r273375, copy of r273369, projects/bhyve_svm/sys/amd64/vmm/amd/npt.h) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SVM_NPT_H_ +#define _SVM_NPT_H_ + +int svm_npt_init(int ipinum); +struct vmspace *svm_npt_alloc(vm_offset_t min, vm_offset_t max); +void svm_npt_free(struct vmspace *vmspace); + +#endif /* _SVM_NPT_H_ */ Copied: head/sys/amd64/vmm/amd/svm.c (from r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/vmm/amd/svm.c Tue Oct 21 07:10:43 2014 (r273375, copy of r273369, projects/bhyve_svm/sys/amd64/vmm/amd/svm.c) @@ -0,0 +1,2092 @@ +/*- + * Copyright (c) 2013, Anish Gupta (akgupt3@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "vmm_lapic.h" +#include "vmm_stat.h" +#include "vmm_ktr.h" +#include "vmm_ioport.h" +#include "vatpic.h" +#include "vlapic.h" +#include "vlapic_priv.h" + +#include "x86.h" +#include "vmcb.h" +#include "svm.h" +#include "svm_softc.h" +#include "svm_msr.h" +#include "npt.h" + +SYSCTL_DECL(_hw_vmm); +SYSCTL_NODE(_hw_vmm, OID_AUTO, svm, CTLFLAG_RW, NULL, NULL); + +/* + * SVM CPUID function 0x8000_000A, edx bit decoding. + */ +#define AMD_CPUID_SVM_NP BIT(0) /* Nested paging or RVI */ +#define AMD_CPUID_SVM_LBR BIT(1) /* Last branch virtualization */ +#define AMD_CPUID_SVM_SVML BIT(2) /* SVM lock */ +#define AMD_CPUID_SVM_NRIP_SAVE BIT(3) /* Next RIP is saved */ +#define AMD_CPUID_SVM_TSC_RATE BIT(4) /* TSC rate control. */ +#define AMD_CPUID_SVM_VMCB_CLEAN BIT(5) /* VMCB state caching */ +#define AMD_CPUID_SVM_FLUSH_BY_ASID BIT(6) /* Flush by ASID */ +#define AMD_CPUID_SVM_DECODE_ASSIST BIT(7) /* Decode assist */ +#define AMD_CPUID_SVM_PAUSE_INC BIT(10) /* Pause intercept filter. */ +#define AMD_CPUID_SVM_PAUSE_FTH BIT(12) /* Pause filter threshold */ + +#define VMCB_CACHE_DEFAULT (VMCB_CACHE_ASID | \ + VMCB_CACHE_IOPM | \ + VMCB_CACHE_I | \ + VMCB_CACHE_TPR | \ + VMCB_CACHE_CR2 | \ + VMCB_CACHE_CR | \ + VMCB_CACHE_DT | \ + VMCB_CACHE_SEG | \ + VMCB_CACHE_NP) + +static uint32_t vmcb_clean = VMCB_CACHE_DEFAULT; +SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_RDTUN, &vmcb_clean, + 0, NULL); + +static MALLOC_DEFINE(M_SVM, "svm", "svm"); +static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); + +/* Per-CPU context area. */ +extern struct pcpu __pcpu[]; + +static uint32_t svm_feature; /* AMD SVM features. */ +SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RD, &svm_feature, 0, + "SVM features advertised by CPUID.8000000AH:EDX"); + +static int disable_npf_assist; +SYSCTL_INT(_hw_vmm_svm, OID_AUTO, disable_npf_assist, CTLFLAG_RWTUN, + &disable_npf_assist, 0, NULL); + +/* Maximum ASIDs supported by the processor */ +static uint32_t nasid; +SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, num_asids, CTLFLAG_RD, &nasid, 0, + "Number of ASIDs supported by this processor"); + +/* Current ASID generation for each host cpu */ +static struct asid asid[MAXCPU]; + +/* + * SVM host state saved area of size 4KB for each core. + */ +static uint8_t hsave[MAXCPU][PAGE_SIZE] __aligned(PAGE_SIZE); + +static VMM_STAT_AMD(VCPU_EXITINTINFO, "VM exits during event delivery"); +static VMM_STAT_AMD(VCPU_INTINFO_INJECTED, "Events pending at VM entry"); +static VMM_STAT_AMD(VMEXIT_VINTR, "VM exits due to interrupt window"); + +static int svm_setreg(void *arg, int vcpu, int ident, uint64_t val); + +static __inline int +flush_by_asid(void) +{ + + return (svm_feature & AMD_CPUID_SVM_FLUSH_BY_ASID); +} + +static __inline int +decode_assist(void) +{ + + return (svm_feature & AMD_CPUID_SVM_DECODE_ASSIST); +} + +static void +svm_disable(void *arg __unused) +{ + uint64_t efer; + + efer = rdmsr(MSR_EFER); + efer &= ~EFER_SVM; + wrmsr(MSR_EFER, efer); +} + +/* + * Disable SVM on all CPUs. + */ +static int +svm_cleanup(void) +{ + + smp_rendezvous(NULL, svm_disable, NULL, NULL); + return (0); +} + +/* + * Verify that all the features required by bhyve are available. + */ +static int +check_svm_features(void) +{ + u_int regs[4]; + + /* CPUID Fn8000_000A is for SVM */ + do_cpuid(0x8000000A, regs); + svm_feature = regs[3]; + + printf("SVM: Revision %d\n", regs[0] & 0xFF); + printf("SVM: NumASID %u\n", regs[1]); + + nasid = regs[1]; + KASSERT(nasid > 1, ("Insufficient ASIDs for guests: %#x", nasid)); + + printf("SVM: Features 0x%b\n", svm_feature, + "\020" + "\001NP" /* Nested paging */ + "\002LbrVirt" /* LBR virtualization */ + "\003SVML" /* SVM lock */ + "\004NRIPS" /* NRIP save */ + "\005TscRateMsr" /* MSR based TSC rate control */ + "\006VmcbClean" /* VMCB clean bits */ + "\007FlushByAsid" /* Flush by ASID */ + "\010DecodeAssist" /* Decode assist */ + "\011" + "\012" + "\013PauseFilter" + "\014" + "\015PauseFilterThreshold" + "\016AVIC" + ); + + /* bhyve requires the Nested Paging feature */ + if (!(svm_feature & AMD_CPUID_SVM_NP)) { + printf("SVM: Nested Paging feature not available.\n"); + return (ENXIO); + } + + /* bhyve requires the NRIP Save feature */ + if (!(svm_feature & AMD_CPUID_SVM_NRIP_SAVE)) { + printf("SVM: NRIP Save feature not available.\n"); + return (ENXIO); + } + + return (0); +} + +static void +svm_enable(void *arg __unused) +{ + uint64_t efer; + + efer = rdmsr(MSR_EFER); + efer |= EFER_SVM; + wrmsr(MSR_EFER, efer); + + wrmsr(MSR_VM_HSAVE_PA, vtophys(hsave[curcpu])); +} + +/* + * Return 1 if SVM is enabled on this processor and 0 otherwise. + */ +static int +svm_available(void) +{ + uint64_t msr; + + /* Section 15.4 Enabling SVM from APM2. */ + if ((amd_feature2 & AMDID2_SVM) == 0) { + printf("SVM: not available.\n"); + return (0); + } + + msr = rdmsr(MSR_VM_CR); + if ((msr & VM_CR_SVMDIS) != 0) { + printf("SVM: disabled by BIOS.\n"); + return (0); + } + + return (1); +} + +static int +svm_init(int ipinum) +{ + int error, cpu; + + if (!svm_available()) + return (ENXIO); + + error = check_svm_features(); + if (error) + return (error); + + vmcb_clean &= VMCB_CACHE_DEFAULT; + + for (cpu = 0; cpu < MAXCPU; cpu++) { + /* + * Initialize the host ASIDs to their "highest" valid values. + * + * The next ASID allocation will rollover both 'gen' and 'num' + * and start off the sequence at {1,1}. + */ + asid[cpu].gen = ~0UL; + asid[cpu].num = nasid - 1; + } + + svm_msr_init(); + svm_npt_init(ipinum); + + /* Enable SVM on all CPUs */ + smp_rendezvous(NULL, svm_enable, NULL, NULL); + + return (0); +} + +static void +svm_restore(void) +{ + + svm_enable(NULL); +} + +/* Pentium compatible MSRs */ +#define MSR_PENTIUM_START 0 +#define MSR_PENTIUM_END 0x1FFF +/* AMD 6th generation and Intel compatible MSRs */ +#define MSR_AMD6TH_START 0xC0000000UL +#define MSR_AMD6TH_END 0xC0001FFFUL +/* AMD 7th and 8th generation compatible MSRs */ +#define MSR_AMD7TH_START 0xC0010000UL +#define MSR_AMD7TH_END 0xC0011FFFUL + +/* + * Get the index and bit position for a MSR in permission bitmap. + * Two bits are used for each MSR: lower bit for read and higher bit for write. + */ +static int +svm_msr_index(uint64_t msr, int *index, int *bit) +{ + uint32_t base, off; + + *index = -1; + *bit = (msr % 4) * 2; + base = 0; + + if (msr >= MSR_PENTIUM_START && msr <= MSR_PENTIUM_END) { + *index = msr / 4; + return (0); + } + + base += (MSR_PENTIUM_END - MSR_PENTIUM_START + 1); + if (msr >= MSR_AMD6TH_START && msr <= MSR_AMD6TH_END) { + off = (msr - MSR_AMD6TH_START); + *index = (off + base) / 4; + return (0); + } + + base += (MSR_AMD6TH_END - MSR_AMD6TH_START + 1); + if (msr >= MSR_AMD7TH_START && msr <= MSR_AMD7TH_END) { + off = (msr - MSR_AMD7TH_START); + *index = (off + base) / 4; + return (0); + } + + return (EINVAL); +} + +/* + * Allow vcpu to read or write the 'msr' without trapping into the hypervisor. + */ +static void +svm_msr_perm(uint8_t *perm_bitmap, uint64_t msr, bool read, bool write) +{ + int index, bit, error; + + error = svm_msr_index(msr, &index, &bit); + KASSERT(error == 0, ("%s: invalid msr %#lx", __func__, msr)); + KASSERT(index >= 0 && index < SVM_MSR_BITMAP_SIZE, + ("%s: invalid index %d for msr %#lx", __func__, index, msr)); + KASSERT(bit >= 0 && bit <= 6, ("%s: invalid bit position %d " + "msr %#lx", __func__, bit, msr)); + + if (read) + perm_bitmap[index] &= ~(1UL << bit); + + if (write) + perm_bitmap[index] &= ~(2UL << bit); +} + +static void +svm_msr_rw_ok(uint8_t *perm_bitmap, uint64_t msr) +{ + + svm_msr_perm(perm_bitmap, msr, true, true); +} + +static void +svm_msr_rd_ok(uint8_t *perm_bitmap, uint64_t msr) +{ + + svm_msr_perm(perm_bitmap, msr, true, false); +} + +static __inline int +svm_get_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask) +{ + struct vmcb_ctrl *ctrl; + + KASSERT(idx >=0 && idx < 5, ("invalid intercept index %d", idx)); + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + return (ctrl->intercept[idx] & bitmask ? 1 : 0); +} + +static __inline void +svm_set_intercept(struct svm_softc *sc, int vcpu, int idx, uint32_t bitmask, + int enabled) +{ + struct vmcb_ctrl *ctrl; + uint32_t oldval; + + KASSERT(idx >=0 && idx < 5, ("invalid intercept index %d", idx)); + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + oldval = ctrl->intercept[idx]; + + if (enabled) + ctrl->intercept[idx] |= bitmask; + else + ctrl->intercept[idx] &= ~bitmask; + + if (ctrl->intercept[idx] != oldval) { + svm_set_dirty(sc, vcpu, VMCB_CACHE_I); + VCPU_CTR3(sc->vm, vcpu, "intercept[%d] modified " + "from %#x to %#x", idx, oldval, ctrl->intercept[idx]); + } +} + +static __inline void +svm_disable_intercept(struct svm_softc *sc, int vcpu, int off, uint32_t bitmask) +{ + + svm_set_intercept(sc, vcpu, off, bitmask, 0); +} + +static __inline void +svm_enable_intercept(struct svm_softc *sc, int vcpu, int off, uint32_t bitmask) +{ + + svm_set_intercept(sc, vcpu, off, bitmask, 1); +} + +static void +vmcb_init(struct svm_softc *sc, int vcpu, uint64_t iopm_base_pa, + uint64_t msrpm_base_pa, uint64_t np_pml4) +{ + struct vmcb_ctrl *ctrl; + struct vmcb_state *state; + uint32_t mask; + int n; + + ctrl = svm_get_vmcb_ctrl(sc, vcpu); + state = svm_get_vmcb_state(sc, vcpu); + + ctrl->iopm_base_pa = iopm_base_pa; + ctrl->msrpm_base_pa = msrpm_base_pa; + + /* Enable nested paging */ + ctrl->np_enable = 1; + ctrl->n_cr3 = np_pml4; + + /* + * Intercept accesses to the control registers that are not shadowed + * in the VMCB - i.e. all except cr0, cr2, cr3, cr4 and cr8. + */ + for (n = 0; n < 16; n++) { + mask = (BIT(n) << 16) | BIT(n); + if (n == 0 || n == 2 || n == 3 || n == 4 || n == 8) + svm_disable_intercept(sc, vcpu, VMCB_CR_INTCPT, mask); + else + svm_enable_intercept(sc, vcpu, VMCB_CR_INTCPT, mask); + } + + /* Intercept Machine Check exceptions. */ + svm_enable_intercept(sc, vcpu, VMCB_EXC_INTCPT, BIT(IDT_MC)); + + /* Intercept various events (for e.g. I/O, MSR and CPUID accesses) */ + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_IO); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_MSR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_CPUID); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INTR); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_INIT); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_NMI); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_SMI); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, VMCB_INTCPT_SHUTDOWN); + svm_enable_intercept(sc, vcpu, VMCB_CTRL1_INTCPT, + VMCB_INTCPT_FERR_FREEZE); + + /* + * From section "Canonicalization and Consistency Checks" in APMv2 + * the VMRUN intercept bit must be set to pass the consistency check. + */ + svm_enable_intercept(sc, vcpu, VMCB_CTRL2_INTCPT, VMCB_INTCPT_VMRUN); + + /* + * The ASID will be set to a non-zero value just before VMRUN. + */ + ctrl->asid = 0; + + /* + * Section 15.21.1, Interrupt Masking in EFLAGS + * Section 15.21.2, Virtualizing APIC.TPR + * + * This must be set for %rflag and %cr8 isolation of guest and host. + */ + ctrl->v_intr_masking = 1; + + /* Enable Last Branch Record aka LBR for debugging */ + ctrl->lbr_virt_en = 1; + state->dbgctl = BIT(0); + + /* EFER_SVM must always be set when the guest is executing */ + state->efer = EFER_SVM; + + /* Set up the PAT to power-on state */ + state->g_pat = PAT_VALUE(0, PAT_WRITE_BACK) | + PAT_VALUE(1, PAT_WRITE_THROUGH) | + PAT_VALUE(2, PAT_UNCACHED) | + PAT_VALUE(3, PAT_UNCACHEABLE) | + PAT_VALUE(4, PAT_WRITE_BACK) | + PAT_VALUE(5, PAT_WRITE_THROUGH) | + PAT_VALUE(6, PAT_UNCACHED) | + PAT_VALUE(7, PAT_UNCACHEABLE); +} + +/* + * Initialize a virtual machine. + */ +static void * +svm_vminit(struct vm *vm, pmap_t pmap) +{ + struct svm_softc *svm_sc; + struct svm_vcpu *vcpu; + vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; + int i; + + svm_sc = malloc(sizeof (struct svm_softc), M_SVM, M_WAITOK | M_ZERO); + svm_sc->vm = vm; + svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4); + + /* + * Intercept read and write accesses to all MSRs. + */ + memset(svm_sc->msr_bitmap, 0xFF, sizeof(svm_sc->msr_bitmap)); + + /* + * Access to the following MSRs is redirected to the VMCB when the + * guest is executing. Therefore it is safe to allow the guest to + * read/write these MSRs directly without hypervisor involvement. + */ + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_GSBASE); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_FSBASE); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_KGSBASE); + + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_STAR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_LSTAR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_CSTAR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SF_MASK); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SYSENTER_CS_MSR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SYSENTER_ESP_MSR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_SYSENTER_EIP_MSR); + svm_msr_rw_ok(svm_sc->msr_bitmap, MSR_PAT); + + svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_TSC); + + /* + * Intercept writes to make sure that the EFER_SVM bit is not cleared. + */ + svm_msr_rd_ok(svm_sc->msr_bitmap, MSR_EFER); + + /* Intercept access to all I/O ports. */ + memset(svm_sc->iopm_bitmap, 0xFF, sizeof(svm_sc->iopm_bitmap)); + + iopm_pa = vtophys(svm_sc->iopm_bitmap); + msrpm_pa = vtophys(svm_sc->msr_bitmap); + pml4_pa = svm_sc->nptp; + for (i = 0; i < VM_MAXCPU; i++) { + vcpu = svm_get_vcpu(svm_sc, i); + vcpu->lastcpu = NOCPU; + vcpu->vmcb_pa = vtophys(&vcpu->vmcb); + vmcb_init(svm_sc, i, iopm_pa, msrpm_pa, pml4_pa); + svm_msr_guest_init(svm_sc, i); + } + return (svm_sc); +} + +static int +svm_cpl(struct vmcb_state *state) +{ + + /* + * From APMv2: + * "Retrieve the CPL from the CPL field in the VMCB, not + * from any segment DPL" + */ + return (state->cpl); +} + +static enum vm_cpu_mode +svm_vcpu_mode(struct vmcb *vmcb) +{ + struct vmcb_segment seg; + struct vmcb_state *state; + int error; + + state = &vmcb->state; + + if (state->efer & EFER_LMA) { + error = vmcb_seg(vmcb, VM_REG_GUEST_CS, &seg); + KASSERT(error == 0, ("%s: vmcb_seg(cs) error %d", __func__, + error)); + + /* + * Section 4.8.1 for APM2, check if Code Segment has + * Long attribute set in descriptor. + */ + if (seg.attrib & VMCB_CS_ATTRIB_L) + return (CPU_MODE_64BIT); + else + return (CPU_MODE_COMPATIBILITY); + } else if (state->cr0 & CR0_PE) { + return (CPU_MODE_PROTECTED); + } else { + return (CPU_MODE_REAL); + } +} + +static enum vm_paging_mode +svm_paging_mode(uint64_t cr0, uint64_t cr4, uint64_t efer) +{ + + if ((cr0 & CR0_PG) == 0) + return (PAGING_MODE_FLAT); + if ((cr4 & CR4_PAE) == 0) + return (PAGING_MODE_32); + if (efer & EFER_LME) + return (PAGING_MODE_64); + else + return (PAGING_MODE_PAE); +} + +/* + * ins/outs utility routines + */ +static uint64_t +svm_inout_str_index(struct svm_regctx *regs, int in) +{ + uint64_t val; + + val = in ? regs->sctx_rdi : regs->sctx_rsi; + + return (val); +} + +static uint64_t +svm_inout_str_count(struct svm_regctx *regs, int rep) +{ + uint64_t val; + + val = rep ? regs->sctx_rcx : 1; + + return (val); +} + +static void +svm_inout_str_seginfo(struct svm_softc *svm_sc, int vcpu, int64_t info1, + int in, struct vm_inout_str *vis) +{ + int error, s; + + if (in) { + vis->seg_name = VM_REG_GUEST_ES; + } else { + /* The segment field has standard encoding */ + s = (info1 >> 10) & 0x7; + vis->seg_name = vm_segment_name(s); + } + + error = vmcb_getdesc(svm_sc, vcpu, vis->seg_name, &vis->seg_desc); + KASSERT(error == 0, ("%s: svm_getdesc error %d", __func__, error)); +} + +static int +svm_inout_str_addrsize(uint64_t info1) +{ + uint32_t size; + + size = (info1 >> 7) & 0x7; + switch (size) { + case 1: + return (2); /* 16 bit */ + case 2: + return (4); /* 32 bit */ + case 4: + return (8); /* 64 bit */ + default: + panic("%s: invalid size encoding %d", __func__, size); + } +} + +static void *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 07:24:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 481DDE60; Tue, 21 Oct 2014 07:24:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3460EE4C; Tue, 21 Oct 2014 07:24:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7Ox54095483; Tue, 21 Oct 2014 07:24:59 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7OwNe095481; Tue, 21 Oct 2014 07:24:58 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410210724.s9L7OwNe095481@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Tue, 21 Oct 2014 07:24:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273376 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:24:59 -0000 Author: kevlo Date: Tue Oct 21 07:24:58 2014 New Revision: 273376 URL: https://svnweb.freebsd.org/changeset/base/273376 Log: Add the Intel BayTrail USB device which needs port routing for USB 3.0. Tested on the BayTrail E3845 platform. Reviewed by: hselasky Modified: head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Tue Oct 21 07:10:43 2014 (r273375) +++ head/sys/dev/usb/controller/ehci_pci.c Tue Oct 21 07:24:58 2014 (r273376) @@ -120,6 +120,8 @@ ehci_pci_match(device_t self) case 0x43961002: return ("AMD SB7x0/SB8x0/SB9x0 USB 2.0 controller"); + case 0x0f348086: + return ("Intel BayTrail USB 2.0 controller"); case 0x1d268086: return ("Intel Patsburg USB 2.0 controller"); case 0x1d2d8086: Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Tue Oct 21 07:10:43 2014 (r273375) +++ head/sys/dev/usb/controller/xhci_pci.c Tue Oct 21 07:24:58 2014 (r273376) @@ -102,6 +102,8 @@ xhci_pci_match(device_t self) case 0x10421b21: return ("ASMedia ASM1042 USB 3.0 controller"); + case 0x0f358086: + return ("Intel Intel BayTrail USB 3.0 controller"); case 0x9c318086: case 0x1e318086: return ("Intel Panther Point USB 3.0 controller"); @@ -244,6 +246,7 @@ xhci_pci_attach(device_t self) /* On Intel chipsets reroute ports from EHCI to XHCI controller. */ switch (pci_get_devid(self)) { + case 0x0f358086: /* BayTrail */ case 0x9c318086: /* Panther Point */ case 0x1e318086: /* Panther Point */ case 0x8c318086: /* Lynx Point */ From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 07:31:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 09B83FFE; Tue, 21 Oct 2014 07:31:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5FC9F09; Tue, 21 Oct 2014 07:31:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7VQU8097046; Tue, 21 Oct 2014 07:31:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7VMww096983; Tue, 21 Oct 2014 07:31:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410210731.s9L7VMww096983@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 07:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273377 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cam/scsi sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace sys/compat/ndis sys/dev/acpi_support sys/de... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:31:27 -0000 Author: hselasky Date: Tue Oct 21 07:31:21 2014 New Revision: 273377 URL: https://svnweb.freebsd.org/changeset/base/273377 Log: Fix multiple incorrect SYSCTL arguments in the kernel: - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies Modified: head/share/man/man9/Makefile head/share/man/man9/sysctl.9 head/sys/amd64/amd64/fpu.c head/sys/arm/arm/busdma_machdep-v6.c head/sys/arm/arm/busdma_machdep.c head/sys/cam/scsi/scsi_sa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/dev/dtrace/dtrace_sysctl.c head/sys/compat/ndis/kern_ndis.c head/sys/dev/acpi_support/acpi_asus.c head/sys/dev/acpi_support/acpi_asus_wmi.c head/sys/dev/acpi_support/acpi_hp.c head/sys/dev/acpi_support/acpi_ibm.c head/sys/dev/acpi_support/acpi_rapidstart.c head/sys/dev/acpi_support/acpi_sony.c head/sys/dev/bxe/bxe.c head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/hatm/if_hatm.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/ixl/if_ixl.c head/sys/dev/mpr/mpr.c head/sys/dev/mps/mps.c head/sys/dev/mrsas/mrsas.c head/sys/dev/mrsas/mrsas.h head/sys/dev/mxge/if_mxge.c head/sys/dev/oce/oce_sysctl.c head/sys/dev/qlxgb/qla_os.c head/sys/dev/qlxgbe/ql_os.c head/sys/dev/rt/if_rt.c head/sys/dev/sound/pci/hda/hdaa.c head/sys/dev/vxge/vxge.c head/sys/dev/xen/netfront/netfront.c head/sys/fs/devfs/devfs_devs.c head/sys/fs/fuse/fuse_main.c head/sys/fs/fuse/fuse_vfsops.c head/sys/geom/geom_kern.c head/sys/kern/kern_cpuset.c head/sys/kern/kern_descrip.c head/sys/kern/kern_mib.c head/sys/kern/kern_synch.c head/sys/kern/subr_devstat.c head/sys/kern/subr_kdb.c head/sys/kern/subr_uio.c head/sys/kern/vfs_cache.c head/sys/mips/mips/busdma_machdep.c head/sys/net80211/ieee80211_ht.c head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_superg.c head/sys/netgraph/bluetooth/common/ng_bluetooth.c head/sys/netgraph/ng_base.c head/sys/netgraph/ng_socket.c head/sys/netinet/cc/cc_chd.c head/sys/netinet/tcp_timer.c head/sys/netipsec/ipsec.h head/sys/netpfil/pf/pf.c head/sys/ofed/drivers/net/mlx4/mlx4_en.h head/sys/powerpc/powermac/fcu.c head/sys/powerpc/powermac/smu.c head/sys/powerpc/powerpc/cpu.c head/sys/sys/sysctl.h head/sys/vm/memguard.c head/sys/vm/vm_kern.c head/sys/x86/x86/busdma_bounce.c Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Tue Oct 21 07:24:58 2014 (r273376) +++ head/share/man/man9/Makefile Tue Oct 21 07:31:21 2014 (r273377) @@ -1499,6 +1499,7 @@ MLINKS+=sysctl.9 SYSCTL_DECL.9 \ sysctl.9 SYSCTL_ADD_ROOT_NODE.9 \ sysctl.9 SYSCTL_ADD_STRING.9 \ sysctl.9 SYSCTL_ADD_STRUCT.9 \ + sysctl.9 SYSCTL_ADD_UAUTO.9 \ sysctl.9 SYSCTL_ADD_UINT.9 \ sysctl.9 SYSCTL_ADD_ULONG.9 \ sysctl.9 SYSCTL_ADD_UQUAD.9 \ Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Tue Oct 21 07:24:58 2014 (r273376) +++ head/share/man/man9/sysctl.9 Tue Oct 21 07:31:21 2014 (r273377) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2014 +.Dd October 20, 2014 .Dt SYSCTL 9 .Os .Sh NAME @@ -39,6 +39,7 @@ .Nm SYSCTL_ADD_ROOT_NODE , .Nm SYSCTL_ADD_STRING , .Nm SYSCTL_ADD_STRUCT , +.Nm SYSCTL_ADD_UAUTO , .Nm SYSCTL_ADD_UINT , .Nm SYSCTL_ADD_ULONG , .Nm SYSCTL_ADD_UQUAD , @@ -82,7 +83,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "long *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -128,7 +128,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "quad_t *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -181,7 +180,6 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "unsigned long *ptr" -.Fa "intptr_t val" .Fa "const char *descr" .Fc .Ft struct sysctl_oid * @@ -192,7 +190,16 @@ .Fa "const char *name" .Fa "int ctlflags" .Fa "u_quad_t *ptr" -.Fa "intptr_t val" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * +.Fo SYSCTL_ADD_UAUTO +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "void *ptr" .Fa "const char *descr" .Fc .Ft struct sysctl_oid_list * @@ -283,13 +290,13 @@ For string type OIDs a length of zero me will be used to get the length of the string at each access to the OID. .It Fa ptr Pointer to sysctl variable or string data. -For sysctl values the pointer can be NULL which means the OID is read-only and the returned value should be taken from the +For sysctl values the pointer can be SYSCTL_NULL_XXX_PTR which means the OID is read-only and the returned value should be taken from the .Fa val argument. .It Fa val If the .Fa ptr -argument is NULL, gives the constant value returned by this OID. +argument is SYSCTL_NULL_XXX_PTR, gives the constant value returned by this OID. Else this argument is not used. .It Fa struct_type Name of structure type. @@ -424,8 +431,9 @@ Dynamic nodes are created using one of t .Fn SYSCTL_ADD_ROOT_NODE , .Fn SYSCTL_ADD_STRING , .Fn SYSCTL_ADD_STRUCT , +.Fn SYSCTL_ADD_UAUTO , .Fn SYSCTL_ADD_UINT , -.Fn SYSCTL_ADD_ULONG +.Fn SYSCTL_ADD_ULONG , or .Fn SYSCTL_UQUAD functions. @@ -521,10 +529,10 @@ Examples of integer, opaque, string, and .Bd -literal -offset indent /* * Example of a constant integer value. Notice that the control - * flags are CTLFLAG_RD, the variable pointer is NULL, and the - * value is declared. + * flags are CTLFLAG_RD, the variable pointer is SYSCTL_NULL_INT_PTR, + * and the value is declared. */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, NULL, +SYSCTL_INT(_debug_sizeof, OID_AUTO, bio, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, sizeof(struct bio), "sizeof(struct bio)"); /* Modified: head/sys/amd64/amd64/fpu.c ============================================================================== --- head/sys/amd64/amd64/fpu.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/amd64/amd64/fpu.c Tue Oct 21 07:31:21 2014 (r273377) @@ -130,7 +130,7 @@ CTASSERT(sizeof(struct pcb) % XSAVE_AREA static void fpu_clean_state(void); SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD, - NULL, 1, "Floating point instructions executed in hardware"); + SYSCTL_NULL_INT_PTR, 1, "Floating point instructions executed in hardware"); int use_xsave; /* non-static for cpu_switch.S */ uint64_t xsave_mask; /* the same */ Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/arm/arm/busdma_machdep-v6.c Tue Oct 21 07:31:21 2014 (r273377) @@ -1525,9 +1525,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } Modified: head/sys/arm/arm/busdma_machdep.c ============================================================================== --- head/sys/arm/arm/busdma_machdep.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/arm/arm/busdma_machdep.c Tue Oct 21 07:31:21 2014 (r273377) @@ -1346,9 +1346,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/cam/scsi/scsi_sa.c Tue Oct 21 07:31:21 2014 (r273377) @@ -1487,13 +1487,13 @@ sasysctlinit(void *context, int pending) goto bailout; SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "allow_io_split", CTLTYPE_INT | CTLFLAG_RDTUN | CTLFLAG_NOFETCH, + OID_AUTO, "allow_io_split", CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &softc->allow_io_split, 0, "Allow Splitting I/O"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "maxio", CTLTYPE_INT | CTLFLAG_RD, + OID_AUTO, "maxio", CTLFLAG_RD, &softc->maxio, 0, "Maximum I/O size"); SYSCTL_ADD_INT(&softc->sysctl_ctx, SYSCTL_CHILDREN(softc->sysctl_tree), - OID_AUTO, "cpi_maxio", CTLTYPE_INT | CTLFLAG_RD, + OID_AUTO, "cpi_maxio", CTLFLAG_RD, &softc->cpi_maxio, 0, "Maximum Controller I/O size"); bailout: Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c Tue Oct 21 07:31:21 2014 (r273377) @@ -67,8 +67,8 @@ #include "zfs_comutil.h" /* Used by fstat(1). */ -SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, 0, sizeof(znode_t), - "sizeof(znode_t)"); +SYSCTL_INT(_debug_sizeof, OID_AUTO, znode, CTLFLAG_RD, + SYSCTL_NULL_INT_PTR, sizeof(znode_t), "sizeof(znode_t)"); /* * Define ZNODE_STATS to turn on statistic gathering. By default, it is only Modified: head/sys/cddl/dev/dtrace/dtrace_sysctl.c ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/cddl/dev/dtrace/dtrace_sysctl.c Tue Oct 21 07:31:21 2014 (r273377) @@ -86,8 +86,8 @@ SYSCTL_NODE(_kern, OID_AUTO, dtrace, CTL SYSCTL_INT(_kern_dtrace, OID_AUTO, memstr_max, CTLFLAG_RW, &dtrace_memstr_max, 0, "largest allowed argument to memstr(), 0 indicates no limit"); -SYSCTL_LONG(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW, +SYSCTL_QUAD(_kern_dtrace, OID_AUTO, dof_maxsize, CTLFLAG_RW, &dtrace_dof_maxsize, 0, "largest allowed DOF table"); -SYSCTL_LONG(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, +SYSCTL_QUAD(_kern_dtrace, OID_AUTO, helper_actions_max, CTLFLAG_RW, &dtrace_helper_actions_max, 0, "maximum number of allowed helper actions"); Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/compat/ndis/kern_ndis.c Tue Oct 21 07:31:21 2014 (r273377) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #define NDIS_DUMMY_PATH "\\\\some\\bogus\\path" +#define NDIS_FLAG_RDONLY 1 static void ndis_status_func(ndis_handle, ndis_status, void *, uint32_t); static void ndis_statusdone_func(ndis_handle); @@ -326,48 +327,48 @@ ndis_create_sysctls(arg) * We qualify as the latter. */ ndis_add_sysctl(sc, "Environment", - "Windows environment", "1", CTLFLAG_RD); + "Windows environment", "1", NDIS_FLAG_RDONLY); /* NDIS version should be 5.1. */ ndis_add_sysctl(sc, "NdisVersion", - "NDIS API Version", "0x00050001", CTLFLAG_RD); + "NDIS API Version", "0x00050001", NDIS_FLAG_RDONLY); /* * Some miniport drivers rely on the existence of the SlotNumber, * NetCfgInstanceId and DriverDesc keys. */ - ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", CTLFLAG_RD); + ndis_add_sysctl(sc, "SlotNumber", "Slot Numer", "01", NDIS_FLAG_RDONLY); ndis_add_sysctl(sc, "NetCfgInstanceId", "NetCfgInstanceId", - "{12345678-1234-5678-CAFE0-123456789ABC}", CTLFLAG_RD); + "{12345678-1234-5678-CAFE0-123456789ABC}", NDIS_FLAG_RDONLY); ndis_add_sysctl(sc, "DriverDesc", "Driver Description", - "NDIS Network Adapter", CTLFLAG_RD); + "NDIS Network Adapter", NDIS_FLAG_RDONLY); /* Bus type (PCI, PCMCIA, etc...) */ sprintf(buf, "%d", (int)sc->ndis_iftype); - ndis_add_sysctl(sc, "BusType", "Bus Type", buf, CTLFLAG_RD); + ndis_add_sysctl(sc, "BusType", "Bus Type", buf, NDIS_FLAG_RDONLY); if (sc->ndis_res_io != NULL) { sprintf(buf, "0x%lx", rman_get_start(sc->ndis_res_io)); ndis_add_sysctl(sc, "IOBaseAddress", - "Base I/O Address", buf, CTLFLAG_RD); + "Base I/O Address", buf, NDIS_FLAG_RDONLY); } if (sc->ndis_irq != NULL) { sprintf(buf, "%lu", rman_get_start(sc->ndis_irq)); ndis_add_sysctl(sc, "InterruptNumber", - "Interrupt Number", buf, CTLFLAG_RD); + "Interrupt Number", buf, NDIS_FLAG_RDONLY); } return (0); } int -ndis_add_sysctl(arg, key, desc, val, flag) +ndis_add_sysctl(arg, key, desc, val, flag_rdonly) void *arg; char *key; char *desc; char *val; - int flag; + int flag_rdonly; { struct ndis_softc *sc; struct ndis_cfglist *cfg; @@ -392,13 +393,21 @@ ndis_add_sysctl(arg, key, desc, val, fla TAILQ_INSERT_TAIL(&sc->ndis_cfglist_head, cfg, link); - cfg->ndis_oid = - SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), - OID_AUTO, cfg->ndis_cfg.nc_cfgkey, flag, - cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), - cfg->ndis_cfg.nc_cfgdesc); - + if (flag_rdonly != 0) { + cfg->ndis_oid = + SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), + OID_AUTO, cfg->ndis_cfg.nc_cfgkey, CTLFLAG_RD, + cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), + cfg->ndis_cfg.nc_cfgdesc); + } else { + cfg->ndis_oid = + SYSCTL_ADD_STRING(device_get_sysctl_ctx(sc->ndis_dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(sc->ndis_dev)), + OID_AUTO, cfg->ndis_cfg.nc_cfgkey, CTLFLAG_RW, + cfg->ndis_cfg.nc_val, sizeof(cfg->ndis_cfg.nc_val), + cfg->ndis_cfg.nc_cfgdesc); + } return (0); } Modified: head/sys/dev/acpi_support/acpi_asus.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_asus.c Tue Oct 21 07:31:21 2014 (r273377) @@ -465,43 +465,39 @@ static struct { char *name; char *description; int method; - int flags; + int flag_anybody; } acpi_asus_sysctls[] = { { .name = "lcd_backlight", .method = ACPI_ASUS_METHOD_LCD, .description = "state of the lcd backlight", - .flags = CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY + .flag_anybody = 1 }, { .name = "lcd_brightness", .method = ACPI_ASUS_METHOD_BRN, .description = "brightness of the lcd panel", - .flags = CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY + .flag_anybody = 1 }, { .name = "video_output", .method = ACPI_ASUS_METHOD_DISP, .description = "display output state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "camera", .method = ACPI_ASUS_METHOD_CAMERA, .description = "internal camera state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cardreader", .method = ACPI_ASUS_METHOD_CARDRD, .description = "internal card reader state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .method = ACPI_ASUS_METHOD_WLAN, .description = "wireless lan state", - .flags = CTLTYPE_INT | CTLFLAG_RW }, { .name = NULL } @@ -741,12 +737,21 @@ acpi_asus_attach(device_t dev) if (!acpi_asus_sysctl_init(sc, acpi_asus_sysctls[i].method)) continue; - SYSCTL_ADD_PROC(&sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_asus_sysctls[i].name, - acpi_asus_sysctls[i].flags, - sc, i, acpi_asus_sysctl, "I", - acpi_asus_sysctls[i].description); + if (acpi_asus_sysctls[i].flag_anybody != 0) { + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY, + sc, i, acpi_asus_sysctl, "I", + acpi_asus_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(&sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_asus_sysctl, "I", + acpi_asus_sysctls[i].description); + } } /* Attach leds */ Modified: head/sys/dev/acpi_support/acpi_asus_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_asus_wmi.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_asus_wmi.c Tue Oct 21 07:31:21 2014 (r273377) @@ -119,163 +119,139 @@ static struct { char *name; int dev_id; char *description; - int access; + int flag_rdonly; } acpi_asus_wmi_sysctls[] = { { .name = "hw_switch", .dev_id = ASUS_WMI_DEVID_HW_SWITCH, .description = "hw_switch", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wireless_led", .dev_id = ASUS_WMI_DEVID_WIRELESS_LED, .description = "Wireless LED control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cwap", .dev_id = ASUS_WMI_DEVID_CWAP, .description = "Alt+F2 function", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .dev_id = ASUS_WMI_DEVID_WLAN, .description = "WLAN power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bluetooth", .dev_id = ASUS_WMI_DEVID_BLUETOOTH, .description = "Bluetooth power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "gps", .dev_id = ASUS_WMI_DEVID_GPS, .description = "GPS power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wimax", .dev_id = ASUS_WMI_DEVID_WIMAX, .description = "WiMAX power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan3g", .dev_id = ASUS_WMI_DEVID_WWAN3G, .description = "WWAN-3G power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "uwb", .dev_id = ASUS_WMI_DEVID_UWB, .description = "UWB power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led1", .dev_id = ASUS_WMI_DEVID_LED1, .description = "LED1 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led2", .dev_id = ASUS_WMI_DEVID_LED2, .description = "LED2 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led3", .dev_id = ASUS_WMI_DEVID_LED3, .description = "LED3 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led4", .dev_id = ASUS_WMI_DEVID_LED4, .description = "LED4 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led5", .dev_id = ASUS_WMI_DEVID_LED5, .description = "LED5 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "led6", .dev_id = ASUS_WMI_DEVID_LED6, .description = "LED6 control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "backlight", .dev_id = ASUS_WMI_DEVID_BACKLIGHT, .description = "LCD backlight on/off control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "brightness", .dev_id = ASUS_WMI_DEVID_BRIGHTNESS, .description = "LCD backlight brightness control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "kbd_backlight", .dev_id = ASUS_WMI_DEVID_KBD_BACKLIGHT, .description = "Keyboard backlight brightness control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "light_sensor", .dev_id = ASUS_WMI_DEVID_LIGHT_SENSOR, .description = "Ambient light sensor", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "camera", .dev_id = ASUS_WMI_DEVID_CAMERA, .description = "Camera power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "cardreader", .dev_id = ASUS_WMI_DEVID_CARDREADER, .description = "Cardreader power control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "touchpad", .dev_id = ASUS_WMI_DEVID_TOUCHPAD, .description = "Touchpad control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "touchpad_led", .dev_id = ASUS_WMI_DEVID_TOUCHPAD_LED, .description = "Touchpad LED control", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "themperature", .dev_id = ASUS_WMI_DEVID_THERMAL_CTRL, .description = "Temperature (C)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_speed", .dev_id = ASUS_WMI_DEVID_FAN_CTRL, .description = "Fan speed (0-3)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "processor_state", .dev_id = ASUS_WMI_DEVID_PROCESSOR_STATE, - .description = "Processor state", - .access = CTLTYPE_INT | CTLFLAG_RW + .flag_rdonly = 1 }, { NULL, 0, NULL, 0 } }; @@ -449,12 +425,21 @@ next: break; } - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_asus_wmi_sysctls[i].name, - acpi_asus_wmi_sysctls[i].access, - sc, i, acpi_asus_wmi_sysctl, "I", - acpi_asus_wmi_sysctls[i].description); + if (acpi_asus_wmi_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_wmi_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_asus_wmi_sysctl, "I", + acpi_asus_wmi_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_asus_wmi_sysctls[i].name, + CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_asus_wmi_sysctl, "I", + acpi_asus_wmi_sysctls[i].description); + } } ACPI_SERIAL_END(asus_wmi); Modified: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- head/sys/dev/acpi_support/acpi_hp.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_hp.c Tue Oct 21 07:31:21 2014 (r273377) @@ -152,135 +152,123 @@ static struct { char *name; int method; char *description; - int access; + int flag_rdonly; } acpi_hp_sysctls[] = { { .name = "wlan_enabled", .method = ACPI_HP_METHOD_WLAN_ENABLED, .description = "Enable/Disable WLAN (WiFi)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan_radio", .method = ACPI_HP_METHOD_WLAN_RADIO, .description = "WLAN radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wlan_on_air", .method = ACPI_HP_METHOD_WLAN_ON_AIR, .description = "WLAN radio ready to use (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wlan_enable_if_radio_on", .method = ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON, .description = "Enable WLAN if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan_disable_if_radio_off", .method = ACPI_HP_METHOD_WLAN_DISABLE_IF_RADIO_OFF, .description = "Disable WLAN if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_enabled", .method = ACPI_HP_METHOD_BLUETOOTH_ENABLED, .description = "Enable/Disable Bluetooth", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_radio", .method = ACPI_HP_METHOD_BLUETOOTH_RADIO, .description = "Bluetooth radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "bt_on_air", .method = ACPI_HP_METHOD_BLUETOOTH_ON_AIR, .description = "Bluetooth radio ready to use" " (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "bt_enable_if_radio_on", .method = ACPI_HP_METHOD_BLUETOOTH_ENABLE_IF_RADIO_ON, .description = "Enable bluetooth if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bt_disable_if_radio_off", .method = ACPI_HP_METHOD_BLUETOOTH_DISABLE_IF_RADIO_OFF, .description = "Disable bluetooth if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_enabled", .method = ACPI_HP_METHOD_WWAN_ENABLED, .description = "Enable/Disable WWAN (UMTS)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_radio", .method = ACPI_HP_METHOD_WWAN_RADIO, .description = "WWAN radio status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wwan_on_air", .method = ACPI_HP_METHOD_WWAN_ON_AIR, .description = "WWAN radio ready to use (enabled and radio)", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "wwan_enable_if_radio_on", .method = ACPI_HP_METHOD_WWAN_ENABLE_IF_RADIO_ON, .description = "Enable WWAN if radio is turned on", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wwan_disable_if_radio_off", .method = ACPI_HP_METHOD_WWAN_DISABLE_IF_RADIO_OFF, .description = "Disable WWAN if radio is turned off", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "als_enabled", .method = ACPI_HP_METHOD_ALS, .description = "Enable/Disable ALS (Ambient light sensor)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "display", .method = ACPI_HP_METHOD_DISPLAY, .description = "Display status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "hdd_temperature", .method = ACPI_HP_METHOD_HDDTEMP, .description = "HDD temperature", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "is_docked", .method = ACPI_HP_METHOD_DOCK, .description = "Docking station status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "cmi_detail", .method = ACPI_HP_METHOD_CMI_DETAIL, .description = "Details shown in CMI output " "(cat /dev/hpcmi)", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "verbose", .method = ACPI_HP_METHOD_VERBOSE, .description = "Verbosity level", - .access = CTLTYPE_INT | CTLFLAG_RW }, { NULL, 0, NULL, 0 } @@ -560,11 +548,19 @@ acpi_hp_attach(device_t dev) sc->was_wwan_on_air = arg; } - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_hp_sysctls[i].name, acpi_hp_sysctls[i].access, - sc, i, acpi_hp_sysctl, "I", - acpi_hp_sysctls[i].description); + if (acpi_hp_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_hp_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_hp_sysctl, "I", + acpi_hp_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_hp_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_hp_sysctl, "I", + acpi_hp_sysctls[i].description); + } } ACPI_SERIAL_END(hp); Modified: head/sys/dev/acpi_support/acpi_ibm.c ============================================================================== --- head/sys/dev/acpi_support/acpi_ibm.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_ibm.c Tue Oct 21 07:31:21 2014 (r273377) @@ -192,79 +192,70 @@ static struct { char *name; int method; char *description; - int access; + int flag_rdonly; } acpi_ibm_sysctls[] = { { .name = "events", .method = ACPI_IBM_METHOD_EVENTS, .description = "ACPI events enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "eventmask", .method = ACPI_IBM_METHOD_EVENTMASK, .description = "ACPI eventmask", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "hotkey", .method = ACPI_IBM_METHOD_HOTKEY, .description = "Key Status", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "lcd_brightness", .method = ACPI_IBM_METHOD_BRIGHTNESS, .description = "LCD Brightness", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "volume", .method = ACPI_IBM_METHOD_VOLUME, .description = "Volume", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "mute", .method = ACPI_IBM_METHOD_MUTE, .description = "Mute", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "thinklight", .method = ACPI_IBM_METHOD_THINKLIGHT, .description = "Thinklight enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "bluetooth", .method = ACPI_IBM_METHOD_BLUETOOTH, .description = "Bluetooth enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "wlan", .method = ACPI_IBM_METHOD_WLAN, .description = "WLAN enable", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_speed", .method = ACPI_IBM_METHOD_FANSPEED, .description = "Fan speed", - .access = CTLTYPE_INT | CTLFLAG_RD + .flag_rdonly = 1 }, { .name = "fan_level", .method = ACPI_IBM_METHOD_FANLEVEL, .description = "Fan level", - .access = CTLTYPE_INT | CTLFLAG_RW }, { .name = "fan", .method = ACPI_IBM_METHOD_FANSTATUS, .description = "Fan enable", - .access = CTLTYPE_INT | CTLFLAG_RW }, { NULL, 0, NULL, 0 } @@ -415,11 +406,19 @@ acpi_ibm_attach(device_t dev) if (!acpi_ibm_sysctl_init(sc, acpi_ibm_sysctls[i].method)) continue; - SYSCTL_ADD_PROC(sc->sysctl_ctx, - SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, - acpi_ibm_sysctls[i].name, acpi_ibm_sysctls[i].access, - sc, i, acpi_ibm_sysctl, "I", - acpi_ibm_sysctls[i].description); + if (acpi_ibm_sysctls[i].flag_rdonly != 0) { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_ibm_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RD, + sc, i, acpi_ibm_sysctl, "I", + acpi_ibm_sysctls[i].description); + } else { + SYSCTL_ADD_PROC(sc->sysctl_ctx, + SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, + acpi_ibm_sysctls[i].name, CTLTYPE_INT | CTLFLAG_RW, + sc, i, acpi_ibm_sysctl, "I", + acpi_ibm_sysctls[i].description); + } } /* Hook up thermal node */ @@ -483,15 +482,10 @@ acpi_ibm_resume(device_t dev) for (int i = 0; acpi_ibm_sysctls[i].name != NULL; i++) { int val; - if ((acpi_ibm_sysctls[i].access & CTLFLAG_RD) == 0) { - continue; - } - val = acpi_ibm_sysctl_get(sc, i); - if ((acpi_ibm_sysctls[i].access & CTLFLAG_WR) == 0) { + if (acpi_ibm_sysctls[i].flag_rdonly != 0) continue; - } acpi_ibm_sysctl_set(sc, i, val); } Modified: head/sys/dev/acpi_support/acpi_rapidstart.c ============================================================================== --- head/sys/dev/acpi_support/acpi_rapidstart.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_rapidstart.c Tue Oct 21 07:31:21 2014 (r273377) @@ -84,12 +84,21 @@ acpi_rapidstart_attach(device_t dev) sc->sysctl_ctx = device_get_sysctl_ctx(dev); sc->sysctl_tree = device_get_sysctl_tree(dev); for (i = 0 ; acpi_rapidstart_oids[i].nodename != NULL; i++){ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - i, acpi_rapidstart_oids[i].nodename , CTLTYPE_INT | - ((acpi_rapidstart_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), - dev, i, sysctl_acpi_rapidstart_gen_handler, "I", - acpi_rapidstart_oids[i].comment); + if (acpi_rapidstart_oids[i].setmethod != NULL) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename, + CTLTYPE_INT | CTLFLAG_RW, + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } else { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_rapidstart_oids[i].nodename, + CTLTYPE_INT | CTLFLAG_RD, + dev, i, sysctl_acpi_rapidstart_gen_handler, "I", + acpi_rapidstart_oids[i].comment); + } } return (0); } Modified: head/sys/dev/acpi_support/acpi_sony.c ============================================================================== --- head/sys/dev/acpi_support/acpi_sony.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/acpi_support/acpi_sony.c Tue Oct 21 07:31:21 2014 (r273377) @@ -132,13 +132,22 @@ acpi_sony_attach(device_t dev) sc = device_get_softc(dev); acpi_GetInteger(acpi_get_handle(dev), ACPI_SONY_GET_PID, &sc->pid); device_printf(dev, "PID %x\n", sc->pid); - for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++){ - SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - i, acpi_sony_oids[i].nodename , CTLTYPE_INT | - ((acpi_sony_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD), - dev, i, sysctl_acpi_sony_gen_handler, "I", - acpi_sony_oids[i].comment); + for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++) { + if (acpi_sony_oids[i].setmethod != NULL) { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_sony_oids[i].nodename , + CTLTYPE_INT | CTLFLAG_RW, + dev, i, sysctl_acpi_sony_gen_handler, "I", + acpi_sony_oids[i].comment); + } else { + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + i, acpi_sony_oids[i].nodename , + CTLTYPE_INT | CTLFLAG_RD, + dev, i, sysctl_acpi_sony_gen_handler, "I", + acpi_sony_oids[i].comment); + } } return (0); } Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/bxe/bxe.c Tue Oct 21 07:31:21 2014 (r273377) @@ -16216,7 +16216,7 @@ bxe_add_sysctls(struct bxe_softc *sc) "version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bc_version", - CTLFLAG_RD, &sc->devinfo.bc_ver_str, 0, + CTLFLAG_RD, sc->devinfo.bc_ver_str, 0, "bootcode version"); snprintf(sc->fw_ver_str, sizeof(sc->fw_ver_str), "%d.%d.%d.%d", @@ -16225,7 +16225,7 @@ bxe_add_sysctls(struct bxe_softc *sc) BCM_5710_FW_REVISION_VERSION, BCM_5710_FW_ENGINEERING_VERSION); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "fw_version", - CTLFLAG_RD, &sc->fw_ver_str, 0, + CTLFLAG_RD, sc->fw_ver_str, 0, "firmware version"); snprintf(sc->mf_mode_str, sizeof(sc->mf_mode_str), "%s", @@ -16235,7 +16235,7 @@ bxe_add_sysctls(struct bxe_softc *sc) (sc->devinfo.mf_info.mf_mode == MULTI_FUNCTION_AFEX) ? "MF-AFEX" : "Unknown")); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mf_mode", - CTLFLAG_RD, &sc->mf_mode_str, 0, + CTLFLAG_RD, sc->mf_mode_str, 0, "multifunction mode"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "mf_vnics", @@ -16243,7 +16243,7 @@ bxe_add_sysctls(struct bxe_softc *sc) "multifunction vnics per port"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "mac_addr", - CTLFLAG_RD, &sc->mac_addr_str, 0, + CTLFLAG_RD, sc->mac_addr_str, 0, "mac address"); snprintf(sc->pci_link_str, sizeof(sc->pci_link_str), "%s x%d", @@ -16253,12 +16253,12 @@ bxe_add_sysctls(struct bxe_softc *sc) "???GT/s"), sc->devinfo.pcie_link_width); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pci_link", - CTLFLAG_RD, &sc->pci_link_str, 0, + CTLFLAG_RD, sc->pci_link_str, 0, "pci link status"); sc->debug = bxe_debug; - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "debug", - CTLFLAG_RW, &sc->debug, 0, + SYSCTL_ADD_ULONG(ctx, children, OID_AUTO, "debug", + CTLFLAG_RW, &sc->debug, "debug logging mode"); sc->rx_budget = bxe_rx_budget; Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Tue Oct 21 07:24:58 2014 (r273376) +++ head/sys/dev/cxgb/cxgb_sge.c Tue Oct 21 07:31:21 2014 (r273377) @@ -3365,7 +3365,7 @@ t3_add_attach_sysctls(adapter_t *sc) /* random information */ SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "firmware_version", - CTLFLAG_RD, &sc->fw_version, + CTLFLAG_RD, sc->fw_version, 0, "firmware version"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "hw_revision", @@ -3373,7 +3373,7 @@ t3_add_attach_sysctls(adapter_t *sc) 0, "chip model"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 07:49:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E13DD644; Tue, 21 Oct 2014 07:49:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDF92D7; Tue, 21 Oct 2014 07:49:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L7nYIK005488; Tue, 21 Oct 2014 07:49:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L7nY4v005487; Tue, 21 Oct 2014 07:49:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410210749.s9L7nY4v005487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 07:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273378 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:49:35 -0000 Author: hselasky Date: Tue Oct 21 07:49:34 2014 New Revision: 273378 URL: https://svnweb.freebsd.org/changeset/base/273378 Log: Fix minor typo in currently unused macro. MFC after: 3 days Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Tue Oct 21 07:31:21 2014 (r273377) +++ head/sys/sys/sysctl.h Tue Oct 21 07:49:34 2014 (r273378) @@ -378,7 +378,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e }) /* Oid for a quad. The pointer must be non NULL. */ -#define SYSCTL_NULL_QUAD_PTR ((int64_T *)NULL) +#define SYSCTL_NULL_QUAD_PTR ((int64_t *)NULL) #define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \ SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 07:54:50 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCD727FC; Tue, 21 Oct 2014 07:54:50 +0000 (UTC) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id AB7A91A3; Tue, 21 Oct 2014 07:54:49 +0000 (UTC) Received: from [192.168.0.106] (cpc14-cmbg15-2-0-cust307.5-4.cable.virginm.net [82.26.1.52]) (authenticated bits=0) by theravensnest.org (8.14.9/8.14.9) with ESMTP id s9L7si0O099321 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 21 Oct 2014 07:54:46 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc14-cmbg15-2-0-cust307.5-4.cable.virginm.net [82.26.1.52] claimed to be [192.168.0.106] Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw From: David Chisnall In-Reply-To: <5443A83F.5090807@FreeBSD.org> Date: Tue, 21 Oct 2014 08:54:35 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <6FEB1269-2A8D-48A7-A18E-2EAB9961EDA6@FreeBSD.org> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> To: Andriy Gapon X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, "Alexander V. Chernikov" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 07:54:51 -0000 On 19 Oct 2014, at 13:02, Andriy Gapon wrote: > I think that on platforms where an optimized version of fls() is = available that > would work faster than this cool piece of bit magic. If you're lucky, the compiler's idiom recogniser will spot this. You're = generally better off using the builtins though, because then the = compiler will expand them to something sensible (hopefully - old = versions of gcc did horribly inefficient things for bswap and clz on = platforms without native support). David From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 09:14:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4983DF30; Tue, 21 Oct 2014 09:14:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A586CA7; Tue, 21 Oct 2014 09:14:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9L9EJSu047213; Tue, 21 Oct 2014 09:14:19 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9L9EHtm047206; Tue, 21 Oct 2014 09:14:17 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410210914.s9L9EHtm047206@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 21 Oct 2014 09:14:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273380 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 09:14:19 -0000 Author: br Date: Tue Oct 21 09:14:16 2014 New Revision: 273380 URL: https://svnweb.freebsd.org/changeset/base/273380 Log: Add driver for Micrel KSZ9021 Gigabit Ethernet Transceiver (PHY). Sponsored by: DARPA, AFRL Added: head/sys/dev/mii/micphy.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/arm/conf/SOCKIT head/sys/arm/conf/SOCKIT-BERI head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts head/sys/boot/fdt/dts/arm/socfpga-sockit.dts head/sys/dev/mii/miidevs Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/arm/altera/socfpga/files.socfpga Tue Oct 21 09:14:16 2014 (r273380) @@ -20,5 +20,6 @@ arm/altera/socfpga/socfpga_rstmgr.c sta arm/altera/socfpga/socfpga_mp.c optional smp dev/dwc/if_dwc.c optional dwc +dev/mii/micphy.c optional micphy dev/mmc/host/dwmmc.c optional dwmmc dev/beri/beri_ring.c optional beri_ring Modified: head/sys/arm/conf/SOCKIT ============================================================================== --- head/sys/arm/conf/SOCKIT Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/arm/conf/SOCKIT Tue Oct 21 09:14:16 2014 (r273380) @@ -125,6 +125,7 @@ device mii device smsc device smscphy device dwc +device micphy # USB ethernet support, requires miibus device miibus Modified: head/sys/arm/conf/SOCKIT-BERI ============================================================================== --- head/sys/arm/conf/SOCKIT-BERI Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/arm/conf/SOCKIT-BERI Tue Oct 21 09:14:16 2014 (r273380) @@ -128,6 +128,7 @@ device mii device smsc device smscphy device dwc +device micphy # USB ethernet support, requires miibus device miibus Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Tue Oct 21 09:14:16 2014 (r273380) @@ -57,6 +57,15 @@ gmac1: ethernet@ff702000 { status = "okay"; + + rxd0-skew-ps = <0>; + rxd1-skew-ps = <0>; + rxd2-skew-ps = <0>; + rxd3-skew-ps = <0>; + txen-skew-ps = <0>; + txc-skew-ps = <2600>; + rxdv-skew-ps = <0>; + rxc-skew-ps = <2000>; }; mmc: dwmmc@ff704000 { @@ -69,7 +78,7 @@ slot@0 { reg = <0>; bus-width = <4>; - }; + }; }; beri_debug: ring@c0000000 { Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit.dts Tue Oct 21 09:14:16 2014 (r273380) @@ -57,6 +57,15 @@ gmac1: ethernet@ff702000 { status = "okay"; + + rxd0-skew-ps = <0>; + rxd1-skew-ps = <0>; + rxd2-skew-ps = <0>; + rxd3-skew-ps = <0>; + txen-skew-ps = <0>; + txc-skew-ps = <2600>; + rxdv-skew-ps = <0>; + rxc-skew-ps = <2000>; }; mmc: dwmmc@ff704000 { @@ -69,7 +78,7 @@ slot@0 { reg = <0>; bus-width = <4>; - }; + }; }; }; Added: head/sys/dev/mii/micphy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mii/micphy.c Tue Oct 21 09:14:16 2014 (r273380) @@ -0,0 +1,215 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Micrel KSZ9021 Gigabit Ethernet Transceiver + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include "miidevs.h" + +#include "miibus_if.h" + +#include +#include +#include +#include + +#define MII_KSZPHY_EXTREG 0x0b +#define KSZPHY_EXTREG_WRITE (1 << 15) +#define MII_KSZPHY_EXTREG_WRITE 0x0c +#define MII_KSZPHY_EXTREG_READ 0x0d +#define MII_KSZPHY_CLK_CONTROL_PAD_SKEW 0x104 +#define MII_KSZPHY_RX_DATA_PAD_SKEW 0x105 +#define MII_KSZPHY_TX_DATA_PAD_SKEW 0x106 + +#define PS_TO_REG(p) (p / 200) + +static int micphy_probe(device_t); +static int micphy_attach(device_t); +static int micphy_service(struct mii_softc *, struct mii_data *, int); + +static device_method_t micphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, micphy_probe), + DEVMETHOD(device_attach, micphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD_END +}; + +static devclass_t micphy_devclass; + +static driver_t micphy_driver = { + "micphy", + micphy_methods, + sizeof(struct mii_softc) +}; + +DRIVER_MODULE(micphy, miibus, micphy_driver, micphy_devclass, 0, 0); + +static const struct mii_phydesc micphys[] = { + MII_PHY_DESC(MICREL, KSZ9021), + MII_PHY_END +}; + +static const struct mii_phy_funcs micphy_funcs = { + micphy_service, + ukphy_status, + mii_phy_reset +}; + +static void micphy_write(struct mii_softc *sc, uint32_t reg, uint32_t val) +{ + + PHY_WRITE(sc, MII_KSZPHY_EXTREG, KSZPHY_EXTREG_WRITE | reg); + PHY_WRITE(sc, MII_KSZPHY_EXTREG_WRITE, val); +} + +static int +ksz9021_load_values(struct mii_softc *sc, phandle_t node, uint32_t reg, + char *field1, char *field2, + char *field3, char *field4) +{ + pcell_t dts_value[1]; + int len; + int val; + + val = 0; + + if ((len = OF_getproplen(node, field1)) > 0) { + OF_getencprop(node, field1, dts_value, len); + val = PS_TO_REG(dts_value[0]); + } + + if ((len = OF_getproplen(node, field2)) > 0) { + OF_getencprop(node, field2, dts_value, len); + val |= PS_TO_REG(dts_value[0]) << 4; + } + + if ((len = OF_getproplen(node, field3)) > 0) { + OF_getencprop(node, field3, dts_value, len); + val |= PS_TO_REG(dts_value[0]) << 8; + } + + if ((len = OF_getproplen(node, field4)) > 0) { + OF_getencprop(node, field4, dts_value, len); + val |= PS_TO_REG(dts_value[0]) << 12; + } + + micphy_write(sc, reg, val); + + return (0); +} + +static int +micphy_probe(device_t dev) +{ + + return (mii_phy_dev_probe(dev, micphys, BUS_PROBE_DEFAULT)); +} + +static int +micphy_attach(device_t dev) +{ + struct mii_softc *sc; + phandle_t node; + device_t miibus; + device_t parent; + + sc = device_get_softc(dev); + + mii_phy_dev_attach(dev, MIIF_NOMANPAUSE, &micphy_funcs, 1); + mii_phy_setmedia(sc); + + miibus = device_get_parent(dev); + parent = device_get_parent(miibus); + + if ((node = ofw_bus_get_node(parent)) == -1) + return (ENXIO); + + ksz9021_load_values(sc, node, MII_KSZPHY_CLK_CONTROL_PAD_SKEW, + "txen-skew-ps", "txc-skew-ps", + "rxdv-skew-ps", "rxc-skew-ps"); + + ksz9021_load_values(sc, node, MII_KSZPHY_RX_DATA_PAD_SKEW, + "rxd0-skew-ps", "rxd1-skew-ps", + "rxd2-skew-ps", "rxd3-skew-ps"); + + ksz9021_load_values(sc, node, MII_KSZPHY_TX_DATA_PAD_SKEW, + "txd0-skew-ps", "txd1-skew-ps", + "txd2-skew-ps", "txd3-skew-ps"); + + return (0); +} + +static int +micphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + + switch (cmd) { + case MII_POLLSTAT: + break; + + case MII_MEDIACHG: + mii_phy_setmedia(sc); + break; + + case MII_TICK: + if (mii_phy_tick(sc) == EJUSTRETURN) + return (0); + break; + } + + /* Update the media status. */ + PHY_STATUS(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Tue Oct 21 08:24:12 2014 (r273379) +++ head/sys/dev/mii/miidevs Tue Oct 21 09:14:16 2014 (r273380) @@ -62,6 +62,7 @@ oui INTEL 0x00aa00 Intel Corporation oui JMICRON 0x00d831 JMicron Technologies oui LEVEL1 0x00207b Level 1 oui MARVELL 0x005043 Marvell Semiconductor +oui MICREL 0x0010a1 Micrel oui MYSON 0x00c0b4 Myson Technology oui NATSEMI 0x080017 National Semiconductor oui PMCSIERRA 0x00e004 PMC-Sierra @@ -274,6 +275,9 @@ model MARVELL E1000_3 0x0003 Marvell 88 model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +/* Micrel PHYs */ +model MICREL KSZ9021 0x0021 Micrel KSZ9021 10/100/1000 PHY + /* Myson Technology PHYs */ model xxMYSON MTD972 0x0000 MTD972 10/100 media interface model MYSON MTD803 0x0000 MTD803 3-in-1 media interface From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 10:19:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2716CC6E; Tue, 21 Oct 2014 10:19:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12E2A405; Tue, 21 Oct 2014 10:19:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LAJk5B075854; Tue, 21 Oct 2014 10:19:46 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LAJkv9075848; Tue, 21 Oct 2014 10:19:46 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211019.s9LAJkv9075848@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 10:19:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273381 - in head: contrib/libcxxrt lib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 10:19:47 -0000 Author: bapt Date: Tue Oct 21 10:19:45 2014 New Revision: 273381 URL: https://svnweb.freebsd.org/changeset/base/273381 Log: Add support for __cxa_throw_bad_array_new_length in libcxxrt It is required for use with newer g++49 Differential Revision: https://reviews.freebsd.org/D982 Reviewed by: theraven Approved by: theraven MFC after: 3 weeks Modified: head/contrib/libcxxrt/auxhelper.cc head/contrib/libcxxrt/stdexcept.cc head/contrib/libcxxrt/stdexcept.h head/lib/libcxxrt/Version.map Modified: head/contrib/libcxxrt/auxhelper.cc ============================================================================== --- head/contrib/libcxxrt/auxhelper.cc Tue Oct 21 09:14:16 2014 (r273380) +++ head/contrib/libcxxrt/auxhelper.cc Tue Oct 21 10:19:45 2014 (r273381) @@ -75,3 +75,8 @@ extern "C" void __cxa_deleted_virtual() { abort(); } + +extern "C" void __cxa_throw_bad_array_new_length() +{ + throw std::bad_array_new_length(); +} Modified: head/contrib/libcxxrt/stdexcept.cc ============================================================================== --- head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 09:14:16 2014 (r273380) +++ head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 10:19:45 2014 (r273381) @@ -82,5 +82,13 @@ const char* bad_typeid::what() const thr return "std::bad_typeid"; } +bad_array_new_length::bad_array_new_length() throw() {} +bad_array_new_length::~bad_array_new_length() {} +bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {} +bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw() +{ + return *this; +} + } // namespace std Modified: head/contrib/libcxxrt/stdexcept.h ============================================================================== --- head/contrib/libcxxrt/stdexcept.h Tue Oct 21 09:14:16 2014 (r273380) +++ head/contrib/libcxxrt/stdexcept.h Tue Oct 21 10:19:45 2014 (r273381) @@ -81,6 +81,15 @@ namespace std virtual const char* what() const throw(); }; + class bad_array_new_length: public exception + { + public: + bad_array_new_length() throw(); + bad_array_new_length(const bad_array_new_length&) throw(); + bad_array_new_length& operator=(const bad_array_new_length&) throw(); + virtual ~bad_array_new_length(); + virtual const char *what() const throw(); + }; } // namespace std Modified: head/lib/libcxxrt/Version.map ============================================================================== --- head/lib/libcxxrt/Version.map Tue Oct 21 09:14:16 2014 (r273380) +++ head/lib/libcxxrt/Version.map Tue Oct 21 10:19:45 2014 (r273381) @@ -26,6 +26,7 @@ CXXABI_1.3 { __cxa_pure_virtual; __cxa_rethrow; __cxa_throw; + __cxa_throw_bad_array_new_length; __cxa_type_match; __cxa_vec_cctor; __cxa_vec_cleanup; @@ -273,6 +274,9 @@ CXXRT_1.0 { "std::bad_alloc::bad_alloc(std::bad_alloc const&)"; "std::bad_alloc::bad_alloc()"; "std::bad_alloc::operator=(std::bad_alloc const&)"; + "std::bad_array_new_length::bad_array_new_length(std::bad_array_new_length const&)"; + "std::bad_array_new_length::bad_array_new_length()"; + "std::bad_array_new_length::operator=(std::bad_array_new_length const&)"; }; __cxa_allocate_dependent_exception; @@ -307,6 +311,7 @@ GLIBCXX_3.4 { "std::bad_typeid::~bad_typeid()"; "std::exception::~exception()"; "std::bad_alloc::~bad_alloc()"; + "std::bad_array_new_length::~bad_array_new_length()"; "std::exception::what() const"; @@ -320,17 +325,20 @@ GLIBCXX_3.4 { "vtable for std::bad_typeid"; "vtable for std::exception"; "vtable for std::type_info"; + "vtable for std::bad_array_new_length"; "typeinfo for std::bad_alloc"; "typeinfo for std::bad_typeid"; "typeinfo for std::bad_cast"; "typeinfo for std::exception"; "typeinfo for std::type_info"; + "typeinfo for std::bad_array_new_length"; "typeinfo name for std::bad_alloc"; "typeinfo name for std::bad_typeid"; "typeinfo name for std::bad_cast"; "typeinfo name for std::exception"; "typeinfo name for std::type_info"; + "typeinfo name for std::bad_array_new_length"; }; }; @@ -340,6 +348,7 @@ GLIBCXX_3.4.9 { "std::bad_typeid::what() const"; "std::bad_cast::what() const"; "std::bad_alloc::what() const"; + "std::bad_array_new_length::what() const"; }; } GLIBCXX_3.4; From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 12:06:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94CC7FD5; Tue, 21 Oct 2014 12:06:02 +0000 (UTC) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 161CF1A7; Tue, 21 Oct 2014 12:06:01 +0000 (UTC) Received: from c122-106-147-133.carlnfd1.nsw.optusnet.com.au (c122-106-147-133.carlnfd1.nsw.optusnet.com.au [122.106.147.133]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 90136421FB2; Tue, 21 Oct 2014 23:05:59 +1100 (AEDT) Date: Tue, 21 Oct 2014 23:05:58 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Chisnall Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw In-Reply-To: <6FEB1269-2A8D-48A7-A18E-2EAB9961EDA6@FreeBSD.org> Message-ID: <20141021203956.C1228@besplex.bde.org> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> <6FEB1269-2A8D-48A7-A18E-2EAB9961EDA6@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=fvDlOjIf c=1 sm=1 tr=0 a=7NqvjVvQucbO2RlWB8PEog==:117 a=PO7r1zJSAAAA:8 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=6I5d2MoRAAAA:8 a=MolaBozWl2p_9SFP6FgA:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" , Andriy Gapon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 12:06:02 -0000 On Tue, 21 Oct 2014, David Chisnall wrote: > On 19 Oct 2014, at 13:02, Andriy Gapon wrote: > >> I think that on platforms where an optimized version of fls() is available that >> would work faster than this cool piece of bit magic. Even a lightly optimized naive linear search might work faster. The fancy method has about 7 dependent operations, while the naive method has about 32 independent operations. > If you're lucky, the compiler's idiom recogniser will spot this. You're generally better off using the builtins though, because then the compiler will expand them to something sensible (hopefully - old versions of gcc did horribly inefficient things for bswap and clz on platforms without native support). No one cared when cperciva optimized fls() using a lookup table and I investigated 11 different method to show that neither the builtins nor the lookup table were especially good (or bad). On i386, the best portable method is to use ilogb() (floating point). The next best is to use floating point directly. These methods are not the fastest, except probably for 64 bits on i386, but they are quite fast and fairly portable. Not all systems have fls() in libc, and FreeBSD has only pessimized implementations there. I just ran my benchmark on ref11-i386 and got the following: % UNIFORM/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % UNIFORM/CPUFUNC_FFS: 0.12 real 0.11 user 0.00 sys % UNIFORM/LIBMET0_FFS: 0.11 real 0.09 user 0.00 sys % UNIFORM/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % UNIFORM/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % UNIFORM/CPUFUNC_FLS: 0.12 real 0.10 user 0.01 sys % UNIFORM/ILOGMET_FLS: 0.14 real 0.13 user 0.00 sys % UNIFORM/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % UNIFORM/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % UNIFORM/LIBMET0_FLS: 1.63 real 1.61 user 0.00 sys % UNIFORM/LIBMETH_FLS: 1.61 real 1.60 user 0.00 sys Several bit patterns are tested, to try to see if there are cache effects. The builtin is now clearly fastest. (On old Athlon64 in 32-bit mode with gcc, it loses to floating point: @ UNIFORM/BUILTIN_FFS: 0.22 real 0.22 user 0.00 sys @ UNIFORM/ILOGMET_FLS: 0.17 real 0.17 user 0.00 sys), but even in the benchmark that spends 100% of its time doing ffs(), the speedup from using the builtin vs the next best is only 20%. Only the pessimized libc methods are very slow. Programs like ministat are intentionally not used. It takes long enough to read the results of 55 simple tests. 44 more follow: % RANDBIT/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % RANDBIT/CPUFUNC_FFS: 0.12 real 0.12 user 0.00 sys % RANDBIT/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % RANDBIT/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % RANDBIT/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % RANDBIT/CPUFUNC_FLS: 0.12 real 0.11 user 0.00 sys % RANDBIT/ILOGMET_FLS: 0.14 real 0.13 user 0.00 sys % RANDBIT/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % RANDBIT/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % RANDBIT/LIBMET0_FLS: 1.25 real 1.24 user 0.00 sys % RANDBIT/LIBMETH_FLS: 1.24 real 1.24 user 0.00 sys % ALLZERO/BUILTIN_FFS: 0.08 real 0.07 user 0.00 sys % ALLZERO/CPUFUNC_FFS: 0.05 real 0.04 user 0.00 sys % ALLZERO/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % ALLZERO/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % ALLZERO/LUTMETH_FFS: 0.05 real 0.04 user 0.00 sys % ALLZERO/CPUFUNC_FLS: 0.05 real 0.04 user 0.00 sys % ALLZERO/ILOGMET_FLS: 0.07 real 0.06 user 0.00 sys % ALLZERO/ILOGBME_FLS: 0.05 real 0.03 user 0.00 sys % ALLZERO/ILOGBM0_FLS: 0.05 real 0.04 user 0.00 sys % ALLZERO/LIBMET0_FLS: 0.18 real 0.17 user 0.00 sys % ALLZERO/LIBMETH_FLS: 0.20 real 0.20 user 0.00 sys % ALLONE_/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % ALLONE_/CPUFUNC_FFS: 0.12 real 0.12 user 0.00 sys % ALLONE_/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % ALLONE_/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % ALLONE_/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % ALLONE_/CPUFUNC_FLS: 0.12 real 0.12 user 0.00 sys % ALLONE_/ILOGMET_FLS: 0.10 real 0.09 user 0.00 sys % ALLONE_/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % ALLONE_/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % ALLONE_/LIBMET0_FLS: 0.20 real 0.19 user 0.00 sys % ALLONE_/LIBMETH_FLS: 0.20 real 0.19 user 0.00 sys % ALLLAST/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % ALLLAST/CPUFUNC_FFS: 0.13 real 0.11 user 0.00 sys % ALLLAST/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys % ALLLAST/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys % ALLLAST/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys % ALLLAST/CPUFUNC_FLS: 0.13 real 0.12 user 0.00 sys % ALLLAST/ILOGMET_FLS: 0.07 real 0.06 user 0.00 sys % ALLLAST/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys % ALLLAST/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys % ALLLAST/LIBMET0_FLS: 1.57 real 1.55 user 0.00 sys % ALLLAST/LIBMETH_FLS: 1.57 real 1.56 user 0.00 sys Part of the program with the methods: % #if defined(CPUFUNC_FFS) || defined(CPUFUNC_FLS) % #define _KERNEL /* now needed to get non-builtin */ % #include % /* MI library versions: */ % #elif ILOGBM0_FLS % #include "/usr/src/lib/msun/src/s_ilogb.c" % #elif LIBMET0_FLS % #include "/usr/src/lib/libc/string/ffs.c" % #elif LIBMET0_FFS % #include "/usr/src/lib/libc/string/fls.c" % #endif % % static int ffslut32[32]; % % static inline int % ilog_fls(int x) % { % union { % float fvalue; % uint32_t uvalue; % } u; % % if (x <= 0) % return (x == 0 ? 0 : 32); % u.fvalue = x; % return ((u.uvalue >> 23) - 127 + 1); % } This is like the libm (fdlibm/FreeBSD ilogb()) with minor optimizations and de-obfuscations. It might be too sloppy to be correct. % static inline int % ilogb_fls(int x) % { % return (x == 0 ? 0 : ilogbf(x) + 1); % } The portable FP method. % % static inline int % lut_ffs(int mask) % { % return (mask ? ffslut32[(((mask & (-mask)) * 0x0FB9AC52) >> 27) + 16] : 0); % } cperciva's lookup table method. It is not simply examining 8 nybbles using a lookup table of size 16. % ... % #ifdef BUILTIN_FFS % v = __builtin_ffs(z[i]); % #elif CPUFUNC_FFS % v = ffs(z[i]); % #elif CPUFUNC_FLS % v = fls(z[i]); % #elif ILOGMET_FLS % v = ilog_fls(z[i]); % #elif ILOGBME_FLS % v = ilogb_fls(z[i]); % #elif ILOGBM0_FLS % v = ilogb_fls(z[i]); % #elif LIBMET0_FFS % v = ffs(z[i]); % #elif LIBMET0_FLS % v = fls(z[i]); % #elif LIBMETH_FFS % v = ffs(z[i]); % #elif LIBMETH_FLS % v = fls(z[i]); % #elif LUTMETH_FFS % v = lut_ffs(z[i]); % #else % #error "No method" % ; % #endif Further comments on the methods: % RANDBIT/BUILTIN_FFS: 0.08 real 0.08 user 0.00 sys % RANDBIT/CPUFUNC_FFS: 0.12 real 0.12 user 0.00 sys CPUFUNC_* is the kernel version. On amd64, it is #defined'ed as the builtin, but ffsll() (bletch) still uses old methods. (Apart from using the long long abomination, ffsll() and flsll() shouldn't exist in the kernel. They are used approximately once, in code that can be written better without them.) This is on i386. i386 kernel ffs() still uses my 1994 de-pessimization for gcc-2. This is now slower than the builtin. Even the current amd64 methods are similar except for ffs(). There is a problem converting the result of bsf*/bsr* to ffs*()/fls*(). Efficiently. gcc-2 used a method with a badly-placed branch, and I changed FreeBSD to use a less badly-placed branch. Branches were much more important with no branch prediction or caches in 1994. Now they don't matter if they are correctly predicted. The tests try to get them mispredicted but are probably defeated by the prediction being too smart. % RANDBIT/LIBMET0_FFS: 0.11 real 0.10 user 0.00 sys LIBMET0 is #including the libc source. It is a naive linear search but is optimized well, but apparently not to the same code as the builtin. % RANDBIT/LIBMETH_FFS: 0.11 real 0.10 user 0.00 sys LIBMETH is a function call to libc. Statically linked of course. Other CFLAGS are -O -march=athlon-xp. Not the right arch. clang gives excessive optimizations with -O so -O2 would make little difference. % RANDBIT/LUTMETH_FFS: 0.10 real 0.09 user 0.00 sys cperciva's lookup table method. Only implemented for ffs(). % RANDBIT/CPUFUNC_FLS: 0.12 real 0.11 user 0.00 sys Same time as CPUFUNC_FFS. No test for BUILTIN_FLS since the kernel didn't have it when this was written. % RANDBIT/ILOGMET_FLS: 0.14 real 0.13 user 0.00 sys Direct FP method is now not the fastest. % RANDBIT/ILOGBME_FLS: 0.23 real 0.23 user 0.00 sys Function call FP method never was the fastest. % RANDBIT/ILOGBM0_FLS: 0.23 real 0.23 user 0.00 sys Function call FP method with the function code exposed in the same compilation unit -- makes no difference. % RANDBIT/LIBMET0_FLS: 1.25 real 1.24 user 0.00 sys % RANDBIT/LIBMETH_FLS: 1.24 real 1.24 user 0.00 sys As for LIBMETH*_FLS, except now the naive linear search in the libc source is not optimized well. Summary: use the simple naive libc source and wait for the compiler to catch up for fls() and other functions. The slowness of LIBMET0 relative to the builtin is just due to it making function calls. Here is a disassembly of ffs.o: % 00000000 : % 0: 0f bc 44 24 04 bsf 0x4(%esp),%eax % 5: 74 03 je a % 7: 40 inc %eax % 8: c3 ret % 9: 90 nop % % 0000000a : % a: 31 c0 xor %eax,%eax % c: c3 ret (Why does it align to merely an even boundary?) Disassembly of fls.o shows a naive loop. Quite good code for the inner loop. Now there is alignment to a 16-byte boundary and almost half of the function's size is for padding. Disassembly of ffsl.o shows a naive loop. ffsl() is not optimized although it is essentially the same as ffs(). ffsll() is of course fully pessimized. You could write a much faster one using 2 ffs()'s and that would be good enough for a portable library. Splitting up can handle any number of bits. On amd64, even ffs.o uses the naive loop. The optimization is not in the copmpiler at all. Someone just wrote ffs.S for i386 only. This and many other machine-dependent optimizations shouldn't exist. You can write them better using builtins. The weird even alignment is now easy to explain. The alignment statement was written in 1993 when .align 2 meant 4-byte alignment. (I forget when this changed, but checked the FreeBSD-1 sources where I documented what .align 2 meant and changed all the hard-coded .align 2's to use either the ALIGN macro or the ALIGN_TEXT macro. ALIGN_TEXT hard-codes a fill byte. FreeBSD still uses these macros but spells .align as .p2align of course. Plain .align is too unportable to use for anything. The fill byte shouldn't be hard-coded but still is.) Optimizing string functions is so important that the i386 optimizations are still not so good ones for original i386's, with minor unimprovements from the drift in .align. Most still use .align 2. The exceptions are a couple of wide char functions which use .p2align 2 and also .p2align 4. Even in the kernel where the alignment statements are macro-ized, it is practically impossible to do alignment as well as compilers. There are too many special cases (depending on the arch and code context). Here is (most of) the code produced for ffs(x) { return __builtin_ffs(x); }: with default CFLAGS except for -O -fomit-frame-pointer: % .align 16, 0x90 % ffs: # @ffs % movl 4(%esp), %eax % testl %eax, %eax % je .LBB0_2 % bsfl %eax, %eax % incl %eax % .LBB0_2: # %entry % ret It does nothing special, and produces the same code that I wrote in the inline asm in 1994. Here is the libc code again: % 00000000 : % 0: 0f bc 44 24 04 bsf 0x4(%esp),%eax % 5: 74 03 je a % 7: 40 inc %eax % 8: c3 ret % 9: 90 nop % % 0000000a : % a: 31 c0 xor %eax,%eax % c: c3 ret This is pessimized by doing a less-predictable branch, later. This was not so bad in 1994. Modern CPUs can start working on the bsfl in parallel to testing the value. They can probably also predict the branch and thus not really care about the order. The branch is because I forgot to optimize for an arch that supports cmove. Compiling with -march=core2 gives: movl 4(%esp), %ecx bsfl %ecx, %eax incl %ecx testl %ecx, %ecx cmovel %ecx, %eax ret This explains another 10-20% of the speed of the builtin vs libc asm. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 12:52:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84BB2B5A; Tue, 21 Oct 2014 12:52:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71678908; Tue, 21 Oct 2014 12:52:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LCq2uJ053287; Tue, 21 Oct 2014 12:52:02 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LCq2R5053286; Tue, 21 Oct 2014 12:52:02 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211252.s9LCq2R5053286@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 12:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273382 - head/contrib/libcxxrt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 12:52:02 -0000 Author: bapt Date: Tue Oct 21 12:52:01 2014 New Revision: 273382 URL: https://svnweb.freebsd.org/changeset/base/273382 Log: Fix build by marking the new functions as weak This is a temporary fix Modified: head/contrib/libcxxrt/stdexcept.cc Modified: head/contrib/libcxxrt/stdexcept.cc ============================================================================== --- head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 10:19:45 2014 (r273381) +++ head/contrib/libcxxrt/stdexcept.cc Tue Oct 21 12:52:01 2014 (r273382) @@ -82,13 +82,23 @@ const char* bad_typeid::what() const thr return "std::bad_typeid"; } +__attribute__((weak)) bad_array_new_length::bad_array_new_length() throw() {} +__attribute__((weak)) bad_array_new_length::~bad_array_new_length() {} +__attribute__((weak)) bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {} +__attribute__((weak)) bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw() { return *this; } +__attribute__((weak)) +const char *bad_array_new_length::what() const throw() +{ + return "std::bad_array_new_length"; +} + } // namespace std From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 16:16:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4450EA2A; Tue, 21 Oct 2014 16:16:09 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9856223; Tue, 21 Oct 2014 16:16:08 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9LGG2qS070638 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Oct 2014 19:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9LGG2qS070638 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9LGG2HA070637; Tue, 21 Oct 2014 19:16:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 21 Oct 2014 19:16:02 +0300 From: Konstantin Belousov To: Hans Petter Selasky Subject: Re: svn commit: r273377 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cam/scsi sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace sys/compat/ndis sys/dev/acpi_support sys/de... Message-ID: <20141021161602.GD1877@kib.kiev.ua> References: <201410210731.s9L7VMww096983@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410210731.s9L7VMww096983@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 16:16:09 -0000 On Tue, Oct 21, 2014 at 07:31:22AM +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Tue Oct 21 07:31:21 2014 > New Revision: 273377 > URL: https://svnweb.freebsd.org/changeset/base/273377 > > Log: > Fix multiple incorrect SYSCTL arguments in the kernel: > > - Wrong integer type was specified. > > - Wrong or missing "access" specifier. The "access" specifier > sometimes included the SYSCTL type, which it should not, except for > procedural SYSCTL nodes. > > - Logical OR where binary OR was expected. > > - Properly assert the "access" argument passed to all SYSCTL macros, > using the CTASSERT macro. This applies to both static- and dynamically > created SYSCTLs. > > - Properly assert the the data type for both static and dynamic > SYSCTLs. In the case of static SYSCTLs we only assert that the data > pointed to by the SYSCTL data pointer has the correct size, hence > there is no easy way to assert types in the C language outside a > C-function. > > - Rewrote some code which doesn't pass a constant "access" specifier > when creating dynamic SYSCTL nodes, which is now a requirement. > > - Updated "EXAMPLES" section in SYSCTL manual page. > > MFC after: 3 days > Sponsored by: Mellanox Technologies > > Modified: > head/share/man/man9/Makefile > head/share/man/man9/sysctl.9 > head/sys/amd64/amd64/fpu.c > head/sys/arm/arm/busdma_machdep-v6.c > head/sys/arm/arm/busdma_machdep.c > head/sys/cam/scsi/scsi_sa.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c > head/sys/cddl/dev/dtrace/dtrace_sysctl.c > head/sys/compat/ndis/kern_ndis.c > head/sys/dev/acpi_support/acpi_asus.c > head/sys/dev/acpi_support/acpi_asus_wmi.c > head/sys/dev/acpi_support/acpi_hp.c > head/sys/dev/acpi_support/acpi_ibm.c > head/sys/dev/acpi_support/acpi_rapidstart.c > head/sys/dev/acpi_support/acpi_sony.c > head/sys/dev/bxe/bxe.c > head/sys/dev/cxgb/cxgb_sge.c > head/sys/dev/cxgbe/t4_main.c > head/sys/dev/e1000/if_em.c > head/sys/dev/e1000/if_igb.c > head/sys/dev/e1000/if_lem.c > head/sys/dev/hatm/if_hatm.c > head/sys/dev/ixgbe/ixgbe.c > head/sys/dev/ixgbe/ixv.c > head/sys/dev/ixl/if_ixl.c > head/sys/dev/mpr/mpr.c > head/sys/dev/mps/mps.c > head/sys/dev/mrsas/mrsas.c > head/sys/dev/mrsas/mrsas.h > head/sys/dev/mxge/if_mxge.c > head/sys/dev/oce/oce_sysctl.c > head/sys/dev/qlxgb/qla_os.c > head/sys/dev/qlxgbe/ql_os.c > head/sys/dev/rt/if_rt.c > head/sys/dev/sound/pci/hda/hdaa.c > head/sys/dev/vxge/vxge.c > head/sys/dev/xen/netfront/netfront.c > head/sys/fs/devfs/devfs_devs.c > head/sys/fs/fuse/fuse_main.c > head/sys/fs/fuse/fuse_vfsops.c > head/sys/geom/geom_kern.c > head/sys/kern/kern_cpuset.c > head/sys/kern/kern_descrip.c > head/sys/kern/kern_mib.c > head/sys/kern/kern_synch.c > head/sys/kern/subr_devstat.c > head/sys/kern/subr_kdb.c > head/sys/kern/subr_uio.c > head/sys/kern/vfs_cache.c > head/sys/mips/mips/busdma_machdep.c > head/sys/net80211/ieee80211_ht.c > head/sys/net80211/ieee80211_hwmp.c > head/sys/net80211/ieee80211_mesh.c > head/sys/net80211/ieee80211_superg.c > head/sys/netgraph/bluetooth/common/ng_bluetooth.c > head/sys/netgraph/ng_base.c > head/sys/netgraph/ng_socket.c > head/sys/netinet/cc/cc_chd.c > head/sys/netinet/tcp_timer.c > head/sys/netipsec/ipsec.h > head/sys/netpfil/pf/pf.c > head/sys/ofed/drivers/net/mlx4/mlx4_en.h > head/sys/powerpc/powermac/fcu.c > head/sys/powerpc/powermac/smu.c > head/sys/powerpc/powerpc/cpu.c > head/sys/sys/sysctl.h > head/sys/vm/memguard.c > head/sys/vm/vm_kern.c > head/sys/x86/x86/busdma_bounce.c This seems to break at least PowerPC 64bit, or some bits were not committed. I have to add the following change to compile GENERIC64 kernel, otherwise I get cc1: warnings being treated as errors /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c: In function 'alloc_bounce_zone': /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c:1030: warning: initialization from incompatible pointer type *** [busdma_machdep.o] Error code 1 OTOH, I did not verified that 32bit PowerPC kernel is compilable with the change applied. diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index e35ecec..b58a91b 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -1027,9 +1027,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 17:17:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6DE72C9E; Tue, 21 Oct 2014 17:17:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59DBFB10; Tue, 21 Oct 2014 17:17:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHHfR9079284; Tue, 21 Oct 2014 17:17:41 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHHfmF079283; Tue, 21 Oct 2014 17:17:41 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410211717.s9LHHfmF079283@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Tue, 21 Oct 2014 17:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273388 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:17:41 -0000 Author: jmg Date: Tue Oct 21 17:17:40 2014 New Revision: 273388 URL: https://svnweb.freebsd.org/changeset/base/273388 Log: spell out the arguments.. the + *offsetp does not belong w/ the type, move it outside the .Fn macro... Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Tue Oct 21 16:44:03 2014 (r273387) +++ head/share/man/man9/mbuf.9 Tue Oct 21 17:17:40 2014 (r273388) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 5, 2014 +.Dd October 21, 2014 .Dt MBUF 9 .Os .\" @@ -738,15 +738,16 @@ the offset in the data region of the to the data contained in the returned mbuf is stored in .Fa *offsetp . If -.Fa offp +.Fa offsetp is NULL, the region may be accessed using .Fn mtod mbuf type . If -.Fa offp +.Fa offsetp is non-NULL, the region may be accessed using -.Fn mtod mbuf uint8_t + *offsetp . +.Fn mtod mbuf uint8_t ++ *offsetp. The region of the mbuf chain between its beginning and -.Fa off +.Fa offset is not modified, therefore it is safe to hold pointers to data within this region before calling .Fn m_pulldown . From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 17:56:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3DE1178B; Tue, 21 Oct 2014 17:56:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0FAAFF14; Tue, 21 Oct 2014 17:56:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHu64p098074; Tue, 21 Oct 2014 17:56:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHu6Q9098073; Tue, 21 Oct 2014 17:56:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211756.s9LHu6Q9098073@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 17:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273389 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:56:07 -0000 Author: ngie Date: Tue Oct 21 17:56:06 2014 New Revision: 273389 URL: https://svnweb.freebsd.org/changeset/base/273389 Log: Port lib/libc/gen/t_siginfo to FreeBSD - mcontext_t on FreeBSD doesn't have a __gregs field (it's split out on FreeBSD into separate fields). In order to avoid muddying the test code with MD code, the debugging trace info has not been implemented - FreeBSD does not implement the si_stime and si_utime fields in siginfo_t, so omit the debugging code that dumps the values - sys/inttypes.h doesn't exist on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Tue Oct 21 17:17:40 2014 (r273388) +++ head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Tue Oct 21 17:56:06 2014 (r273389) @@ -29,7 +29,9 @@ #include #include +#if defined(__NetBSD__) #include +#endif #include #include #include @@ -86,9 +88,11 @@ sig_debug(int signo, siginfo_t *info, uc printf("uc_stack %p %lu 0x%x\n", ctx->uc_stack.ss_sp, (unsigned long)ctx->uc_stack.ss_size, ctx->uc_stack.ss_flags); +#if defined(__NetBSD__) for (i = 0; i < __arraycount(ctx->uc_mcontext.__gregs); i++) printf("uc_mcontext.greg[%d] 0x%lx\n", i, (long)ctx->uc_mcontext.__gregs[i]); +#endif } } @@ -141,8 +145,10 @@ sigchild_action(int signo, siginfo_t *in printf("si_uid=%d\n", info->si_uid); printf("si_pid=%d\n", info->si_pid); printf("si_status=%d\n", info->si_status); +#if defined(__NetBSD__) printf("si_utime=%lu\n", (unsigned long int)info->si_utime); printf("si_stime=%lu\n", (unsigned long int)info->si_stime); +#endif } ATF_REQUIRE_EQ(info->si_code, code); ATF_REQUIRE_EQ(info->si_signo, SIGCHLD); From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 17:57:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 358138DF; Tue, 21 Oct 2014 17:57:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 21843F2C; Tue, 21 Oct 2014 17:57:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHvDOj098248; Tue, 21 Oct 2014 17:57:13 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHvCMS098247; Tue, 21 Oct 2014 17:57:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211757.s9LHvCMS098247@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 17:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273390 - head/contrib/netbsd-tests/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:57:13 -0000 Author: ngie Date: Tue Oct 21 17:57:12 2014 New Revision: 273390 URL: https://svnweb.freebsd.org/changeset/base/273390 Log: libutil.h is required for fparseln on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c Modified: head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c Tue Oct 21 17:56:06 2014 (r273389) +++ head/contrib/netbsd-tests/lib/libc/stdlib/h_getopt.c Tue Oct 21 17:57:12 2014 (r273390) @@ -34,6 +34,9 @@ #include #include #include +#if defined(__FreeBSD__) +#include +#endif #define WS "\t\n " #define debug 0 From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 17:58:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F8BCA3A; Tue, 21 Oct 2014 17:58:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7BC4AF3C; Tue, 21 Oct 2014 17:58:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHwsiM098479; Tue, 21 Oct 2014 17:58:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHwsph098478; Tue, 21 Oct 2014 17:58:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211758.s9LHwsph098478@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 17:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273391 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:58:54 -0000 Author: ngie Date: Tue Oct 21 17:58:53 2014 New Revision: 273391 URL: https://svnweb.freebsd.org/changeset/base/273391 Log: Add missing #include for sys/stat.h for fchmod Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_access.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_access.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_access.c Tue Oct 21 17:57:12 2014 (r273390) +++ head/contrib/netbsd-tests/lib/libc/sys/t_access.c Tue Oct 21 17:58:53 2014 (r273391) @@ -40,6 +40,10 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/ #include +#if defined(__FreeBSD__) +#include +#endif + static const char path[] = "access"; static const int mode[4] = { R_OK, W_OK, X_OK, F_OK }; From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 17:59:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9882AB74; Tue, 21 Oct 2014 17:59:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A23F3F; Tue, 21 Oct 2014 17:59:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LHxS8M098605; Tue, 21 Oct 2014 17:59:28 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LHxSqh098604; Tue, 21 Oct 2014 17:59:28 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410211759.s9LHxSqh098604@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Tue, 21 Oct 2014 17:59:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273392 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 17:59:28 -0000 Author: jmg Date: Tue Oct 21 17:59:27 2014 New Revision: 273392 URL: https://svnweb.freebsd.org/changeset/base/273392 Log: it is not cast to a pointer of the specified type, it is cast to the specified type... mtod(m, uint8_t) does not work, mtod(m, uint8_t *) does work.. Modified: head/share/man/man9/mbuf.9 Modified: head/share/man/man9/mbuf.9 ============================================================================== --- head/share/man/man9/mbuf.9 Tue Oct 21 17:58:53 2014 (r273391) +++ head/share/man/man9/mbuf.9 Tue Oct 21 17:59:27 2014 (r273392) @@ -355,7 +355,7 @@ developer with common utilities. Convert an .Fa mbuf pointer to a data pointer. -The macro expands to the data pointer cast to the pointer of the specified +The macro expands to the data pointer cast to the specified .Fa type . .Sy Note : It is advisable to ensure that there is enough contiguous data in From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 18:00:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76AE2CD6; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 626D2FE1; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI0uul002554; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI0u5u002553; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211800.s9LI0u5u002553@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273393 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:00:56 -0000 Author: ngie Date: Tue Oct 21 18:00:55 2014 New Revision: 273393 URL: https://svnweb.freebsd.org/changeset/base/273393 Log: Port t_write to FreeBSD - Mark the signo variable for the signal handle __unused - Use limits.h instead of sys/syslimits.h (the latter does not exist on FreeBSD) Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_write.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_write.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_write.c Tue Oct 21 17:59:27 2014 (r273392) +++ head/contrib/netbsd-tests/lib/libc/sys/t_write.c Tue Oct 21 18:00:55 2014 (r273393) @@ -32,7 +32,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ __RCSID("$NetBSD: t_write.c,v 1.2 2011/10/19 16:19:30 jruoho Exp $"); #include +#if defined(__NetBSD__) #include +#endif #include #include @@ -43,13 +45,21 @@ __RCSID("$NetBSD: t_write.c,v 1.2 2011/1 #include #include +#if defined(__FreeBSD__) +#include +#endif + static void sighandler(int); static bool fail = false; static const char *path = "write"; static void +#if defined(__FreeBSD__) +sighandler(int signo __unused) +#else sighandler(int signo) +#endif { fail = false; } From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 18:00:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ECCA2CD9; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BFC14FE2; Tue, 21 Oct 2014 18:00:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI0unX002566; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI0uDe002565; Tue, 21 Oct 2014 18:00:56 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201410211800.s9LI0uDe002565@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Tue, 21 Oct 2014 18:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273394 - head/sys/dev/ixl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:00:57 -0000 Author: jimharris Date: Tue Oct 21 18:00:56 2014 New Revision: 273394 URL: https://svnweb.freebsd.org/changeset/base/273394 Log: ixl: remove i40e_register_x710_int.h This file is not used by the FreeBSD ixl driver. Submitted by: Eric Joyner MFC after: 3 days Deleted: head/sys/dev/ixl/i40e_register_x710_int.h From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 18:01:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E75C6F5E; Tue, 21 Oct 2014 18:01:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3290FF3; Tue, 21 Oct 2014 18:01:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI1bFq002731; Tue, 21 Oct 2014 18:01:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI1bm8002730; Tue, 21 Oct 2014 18:01:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211801.s9LI1bm8002730@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273395 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:01:38 -0000 Author: ngie Date: Tue Oct 21 18:01:37 2014 New Revision: 273395 URL: https://svnweb.freebsd.org/changeset/base/273395 Log: Mark osi __unused so this compiles cleanly on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Tue Oct 21 18:00:56 2014 (r273394) +++ head/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c Tue Oct 21 18:01:37 2014 (r273395) @@ -38,7 +38,11 @@ static timer_t t; static bool fail = true; static void +#if defined(__FreeBSD__) +timer_signal_handler(int signo, siginfo_t *si, void *osi __unused) +#else timer_signal_handler(int signo, siginfo_t *si, void *osi) +#endif { timer_t *tp; From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 18:06:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E5D6A1C3; Tue, 21 Oct 2014 18:06:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D1A51CB; Tue, 21 Oct 2014 18:06:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LI64OO003434; Tue, 21 Oct 2014 18:06:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LI64hf003433; Tue, 21 Oct 2014 18:06:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211806.s9LI64hf003433@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:06:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273396 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:06:05 -0000 Author: ngie Date: Tue Oct 21 18:06:04 2014 New Revision: 273396 URL: https://svnweb.freebsd.org/changeset/base/273396 Log: unlink("/") fails with EISDIR instead of EBUSY on FreeBSD; test for that instead Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Tue Oct 21 18:01:37 2014 (r273395) +++ head/contrib/netbsd-tests/lib/libc/sys/t_unlink.c Tue Oct 21 18:06:04 2014 (r273396) @@ -85,7 +85,11 @@ ATF_TC_BODY(unlink_err, tc) (void)memset(buf, 'x', sizeof(buf)); errno = 0; +#if defined(__FreeBSD__) + ATF_REQUIRE_ERRNO(EISDIR, unlink("/") == -1); +#else ATF_REQUIRE_ERRNO(EBUSY, unlink("/") == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, unlink(buf) == -1); From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 18:10:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6C4E4A7; Tue, 21 Oct 2014 18:10:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2C4110A; Tue, 21 Oct 2014 18:10:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LIA516004253; Tue, 21 Oct 2014 18:10:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LIA5Mb004252; Tue, 21 Oct 2014 18:10:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410211810.s9LIA5Mb004252@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 18:10:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273397 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 18:10:05 -0000 Author: ngie Date: Tue Oct 21 18:10:05 2014 New Revision: 273397 URL: https://svnweb.freebsd.org/changeset/base/273397 Log: Port t_chroot to FreeBSD - Add missing #include sys/stat.h for mkdir(2) - Omit the fchroot(2) tests because the support is not present on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c Tue Oct 21 18:06:04 2014 (r273396) +++ head/contrib/netbsd-tests/lib/libc/sys/t_chroot.c Tue Oct 21 18:10:05 2014 (r273397) @@ -42,6 +42,10 @@ __RCSID("$NetBSD: t_chroot.c,v 1.1 2011/ #include #include +#ifdef __FreeBSD__ +#include +#endif + ATF_TC(chroot_basic); ATF_TC_HEAD(chroot_basic, tc) { @@ -167,6 +171,7 @@ ATF_TC_BODY(chroot_perm, tc) atf_tc_fail("chroot(2) succeeded as unprivileged user"); } +#ifdef __NetBSD__ ATF_TC(fchroot_basic); ATF_TC_HEAD(fchroot_basic, tc) { @@ -298,6 +303,7 @@ ATF_TC_BODY(fchroot_perm, tc) if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) atf_tc_fail("fchroot(2) succeeded as unprivileged user"); } +#endif ATF_TP_ADD_TCS(tp) { @@ -305,9 +311,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, chroot_basic); ATF_TP_ADD_TC(tp, chroot_err); ATF_TP_ADD_TC(tp, chroot_perm); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, fchroot_basic); ATF_TP_ADD_TC(tp, fchroot_err); ATF_TP_ADD_TC(tp, fchroot_perm); +#endif return atf_no_error(); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 19:02:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8A27161E; Tue, 21 Oct 2014 19:02:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B32E987; Tue, 21 Oct 2014 19:02:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJ2SvP031964; Tue, 21 Oct 2014 19:02:28 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJ2RoA031960; Tue, 21 Oct 2014 19:02:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410211902.s9LJ2RoA031960@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 19:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273400 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:02:28 -0000 Author: mjg Date: Tue Oct 21 19:02:26 2014 New Revision: 273400 URL: https://svnweb.freebsd.org/changeset/base/273400 Log: Rename sysctl_lock and _unlock to sysctl_xlock and _xunlock. Modified: head/sys/kern/kern_linker.c head/sys/kern/kern_sysctl.c head/sys/kern/vfs_init.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/kern/kern_linker.c Tue Oct 21 19:02:26 2014 (r273400) @@ -292,10 +292,10 @@ linker_file_register_sysctls(linker_file return; sx_xunlock(&kld_sx); - sysctl_lock(); + sysctl_xlock(); for (oidp = start; oidp < stop; oidp++) sysctl_register_oid(*oidp); - sysctl_unlock(); + sysctl_xunlock(); sx_xlock(&kld_sx); } @@ -313,10 +313,10 @@ linker_file_unregister_sysctls(linker_fi return; sx_xunlock(&kld_sx); - sysctl_lock(); + sysctl_xlock(); for (oidp = start; oidp < stop; oidp++) sysctl_unregister_oid(*oidp); - sysctl_unlock(); + sysctl_xunlock(); sx_xlock(&kld_sx); } Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:02:26 2014 (r273400) @@ -126,14 +126,14 @@ sysctl_find_oidname(const char *name, st * Order by number in each list. */ void -sysctl_lock(void) +sysctl_xlock(void) { SYSCTL_XLOCK(); } void -sysctl_unlock(void) +sysctl_xunlock(void) { SYSCTL_XUNLOCK(); Modified: head/sys/kern/vfs_init.c ============================================================================== --- head/sys/kern/vfs_init.c Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/kern/vfs_init.c Tue Oct 21 19:02:26 2014 (r273400) @@ -291,7 +291,7 @@ vfs_register(struct vfsconf *vfc) * preserved by re-registering the oid after modifying its * number. */ - sysctl_lock(); + sysctl_xlock(); SLIST_FOREACH(oidp, SYSCTL_CHILDREN(&sysctl___vfs), oid_link) { if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) { sysctl_unregister_oid(oidp); @@ -300,7 +300,7 @@ vfs_register(struct vfsconf *vfc) break; } } - sysctl_unlock(); + sysctl_xunlock(); return (0); } Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Tue Oct 21 19:00:32 2014 (r273399) +++ head/sys/sys/sysctl.h Tue Oct 21 19:02:26 2014 (r273400) @@ -770,8 +770,8 @@ int userland_sysctl(struct thread *td, i size_t *retval, int flags); int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req); -void sysctl_lock(void); -void sysctl_unlock(void); +void sysctl_xlock(void); +void sysctl_xunlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); struct sbuf; From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 19:05:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B78179D; Tue, 21 Oct 2014 19:05:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87B029A2; Tue, 21 Oct 2014 19:05:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJ5jlf032493; Tue, 21 Oct 2014 19:05:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJ5jDb032492; Tue, 21 Oct 2014 19:05:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410211905.s9LJ5jDb032492@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 19:05:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273401 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:05:45 -0000 Author: mjg Date: Tue Oct 21 19:05:44 2014 New Revision: 273401 URL: https://svnweb.freebsd.org/changeset/base/273401 Log: Implement shared locking for sysctl. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:02:26 2014 (r273400) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:05:44 2014 (r273401) @@ -91,6 +91,10 @@ static struct sx sysctlmemlock; #define SYSCTL_XLOCK() sx_xlock(&sysctllock) #define SYSCTL_XUNLOCK() sx_xunlock(&sysctllock) +#define SYSCTL_SLOCK() sx_slock(&sysctllock) +#define SYSCTL_SUNLOCK() sx_sunlock(&sysctllock) +#define SYSCTL_XLOCKED() sx_xlocked(&sysctllock) +#define SYSCTL_ASSERT_LOCKED() sx_assert(&sysctllock, SA_LOCKED) #define SYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED) #define SYSCTL_INIT() sx_init(&sysctllock, "sysctl lock") #define SYSCTL_SLEEP(ch, wmesg, timo) \ @@ -106,12 +110,35 @@ static int sysctl_remove_oid_locked(stru static int sysctl_old_kernel(struct sysctl_req *, const void *, size_t); static int sysctl_new_kernel(struct sysctl_req *, void *, size_t); +static void +sysctl_lock(bool xlock) +{ + + if (xlock) + SYSCTL_XLOCK(); + else + SYSCTL_SLOCK(); +} + +static bool +sysctl_unlock(void) +{ + bool xlocked; + + xlocked = SYSCTL_XLOCKED(); + if (xlocked) + SYSCTL_XUNLOCK(); + else + SYSCTL_SUNLOCK(); + return (xlocked); +} + static struct sysctl_oid * sysctl_find_oidname(const char *name, struct sysctl_oid_list *list) { struct sysctl_oid *oidp; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); SLIST_FOREACH(oidp, list, oid_link) { if (strcmp(oidp->oid_name, name) == 0) { return (oidp); @@ -144,9 +171,10 @@ sysctl_root_handler_locked(struct sysctl struct sysctl_req *req) { int error; + bool xlocked; - oid->oid_running++; - SYSCTL_XUNLOCK(); + atomic_add_int(&oid->oid_running, 1); + xlocked = sysctl_unlock(); if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_lock(&Giant); @@ -154,9 +182,9 @@ sysctl_root_handler_locked(struct sysctl if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_unlock(&Giant); - SYSCTL_XLOCK(); - oid->oid_running--; - if (oid->oid_running == 0 && (oid->oid_kind & CTLFLAG_DYING) != 0) + sysctl_lock(xlocked); + if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 && + (oid->oid_kind & CTLFLAG_DYING) != 0) wakeup(&oid->oid_running); return (error); @@ -852,7 +880,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_ { struct sysctl_oid *oidp; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); *len = level; SLIST_FOREACH(oidp, lsp, oid_link) { *next = oidp->oid_number; @@ -939,7 +967,7 @@ name2oid(char *name, int *oid, int *len, struct sysctl_oid_list *lsp = &sysctl__children; char *p; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); for (*len = 0; *len < CTL_MAXNAME;) { p = strsep(&name, "."); @@ -1364,9 +1392,9 @@ kernel_sysctl(struct thread *td, int *na req.newfunc = sysctl_new_kernel; req.lock = REQ_UNWIRED; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); @@ -1498,7 +1526,7 @@ sysctl_find_oid(int *name, u_int namelen struct sysctl_oid *oid; int indx; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); lsp = &sysctl__children; indx = 0; while (indx < CTL_MAXNAME) { @@ -1545,7 +1573,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) struct sysctl_oid *oid; int error, indx, lvl; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); if (error) @@ -1729,9 +1757,9 @@ userland_sysctl(struct thread *td, int * for (;;) { req.oldidx = 0; req.newidx = 0; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); if (error != EAGAIN) break; kern_yield(PRI_USER); From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 19:36:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 084CD1AB; Tue, 21 Oct 2014 19:36:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E87E7CB9; Tue, 21 Oct 2014 19:36:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJaKVp047639; Tue, 21 Oct 2014 19:36:20 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJaKjq047638; Tue, 21 Oct 2014 19:36:20 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410211936.s9LJaKjq047638@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 19:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273402 - head/sys/dev/hyperv/storvsc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:36:21 -0000 Author: gjb Date: Tue Oct 21 19:36:20 2014 New Revision: 273402 URL: https://svnweb.freebsd.org/changeset/base/273402 Log: Fix an issue where a FreeBSD virtual machine provisioned in the Microsoft Azure service does not recognize the second attached disk on the system. Submitted by: kyliel@Microsoft Patched by: weh@Microsoft PR: 194376 MFC after: 3 days X-MFC-10.1: yes, ASAP Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 19:05:44 2014 (r273401) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Oct 21 19:36:20 2014 (r273402) @@ -75,7 +75,7 @@ __FBSDID("$FreeBSD$"); #define STORVSC_MAX_IO_REQUESTS (STORVSC_MAX_LUNS_PER_TARGET * 2) #define BLKVSC_MAX_IDE_DISKS_PER_TARGET (1) #define BLKVSC_MAX_IO_REQUESTS STORVSC_MAX_IO_REQUESTS -#define STORVSC_MAX_TARGETS (1) +#define STORVSC_MAX_TARGETS (2) struct storvsc_softc; @@ -584,7 +584,6 @@ hv_storvsc_on_iocompletion(struct storvs vm_srb = &vstor_packet->u.vm_srb; - request->sense_info_len = 0; if (((vm_srb->scsi_status & 0xFF) == SCSI_STATUS_CHECK_COND) && (vm_srb->srb_status & SRB_STATUS_AUTOSENSE_VALID)) { /* Autosense data available */ From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 19:45:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6775973B; Tue, 21 Oct 2014 19:45:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53A27DC2; Tue, 21 Oct 2014 19:45:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJj9mu052534; Tue, 21 Oct 2014 19:45:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJj9Y3052533; Tue, 21 Oct 2014 19:45:09 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410211945.s9LJj9Y3052533@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 19:45:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273403 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:45:09 -0000 Author: mjg Date: Tue Oct 21 19:45:08 2014 New Revision: 273403 URL: https://svnweb.freebsd.org/changeset/base/273403 Log: Make sysctl name2oid shared-locked as well. This is a follow-up to r273401. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:36:20 2014 (r273402) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:45:08 2014 (r273403) @@ -1021,9 +1021,9 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR p [req->newlen] = '\0'; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = name2oid(p, oid, &len, &op); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); free(p, M_SYSCTL); From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 19:56:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 054D8BC1; Tue, 21 Oct 2014 19:56:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2919EF5; Tue, 21 Oct 2014 19:56:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJujwT057778; Tue, 21 Oct 2014 19:56:45 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJujEY057776; Tue, 21 Oct 2014 19:56:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211956.s9LJujEY057776@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 19:56:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273404 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:56:46 -0000 Author: bapt Date: Tue Oct 21 19:56:45 2014 New Revision: 273404 URL: https://svnweb.freebsd.org/changeset/base/273404 Log: The dependencies are computed with CC even if sources are C++, when building when building with an external gcc, we want to be able to pass the path to the libc++ headers so dependencies are correctly computed for C++ source files. Add a DEPFLAGS for that purpose Reviewed by: imp Modified: head/share/mk/bsd.dep.mk Modified: head/share/mk/bsd.dep.mk ============================================================================== --- head/share/mk/bsd.dep.mk Tue Oct 21 19:45:08 2014 (r273403) +++ head/share/mk/bsd.dep.mk Tue Oct 21 19:56:45 2014 (r273404) @@ -49,7 +49,7 @@ GTAGSFLAGS?= -o HTAGSFLAGS?= .if ${CC} != "cc" -MKDEPCMD?= CC='${CC}' mkdep +MKDEPCMD?= CC='${CC} ${DEPFLAGS}' mkdep .else MKDEPCMD?= mkdep .endif From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 19:58:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5DD71DFF; Tue, 21 Oct 2014 19:58:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A327F15; Tue, 21 Oct 2014 19:58:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LJwOWw058062; Tue, 21 Oct 2014 19:58:24 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LJwOX4058061; Tue, 21 Oct 2014 19:58:24 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410211958.s9LJwOX4058061@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 19:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273405 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 19:58:24 -0000 Author: bapt Date: Tue Oct 21 19:58:23 2014 New Revision: 273405 URL: https://svnweb.freebsd.org/changeset/base/273405 Log: When using an external toolchain note that gcc 4.8+ supports C++11 Submitted by: imp Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk ============================================================================== --- head/share/mk/bsd.compiler.mk Tue Oct 21 19:56:45 2014 (r273404) +++ head/share/mk/bsd.compiler.mk Tue Oct 21 19:58:23 2014 (r273405) @@ -42,7 +42,8 @@ COMPILER_VERSION!=echo ${_v:M[1-9].[0-9] .endif .undef _v -.if ${COMPILER_TYPE} == "clang" +.if ${COMPILER_TYPE} == "clang" || \ + (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800) COMPILER_FEATURES= c++11 .else COMPILER_FEATURES= From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:00:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5C224F61; Tue, 21 Oct 2014 20:00:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 483C9FB8; Tue, 21 Oct 2014 20:00:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LK0oao061586; Tue, 21 Oct 2014 20:00:50 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LK0oQn061585; Tue, 21 Oct 2014 20:00:50 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212000.s9LK0oQn061585@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273406 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:00:50 -0000 Author: bapt Date: Tue Oct 21 20:00:49 2014 New Revision: 273406 URL: https://svnweb.freebsd.org/changeset/base/273406 Log: Always use libc++ as the default c++ stack when building with an external gcc 4.8+ While here disable building gcc from base when using gcc 4.8+ Reviewed by: imp Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Oct 21 19:58:23 2014 (r273405) +++ head/share/mk/src.opts.mk Tue Oct 21 20:00:49 2014 (r273406) @@ -358,4 +358,12 @@ MK_${vv:H}:= ${MK_${vv:T}} MK_LLDB:= no .endif +# gcc 4.8 and newer supports libc++, so suppress gnuc++ in that case. +# while in theory we could build it with that, we don't want to do +# that since it creates too much confusion for too little gain. +.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 40800 +MK_GNUCXX:=no +MK_GCC:=no .endif + +.endif # !target(____) From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:04:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D83BF198; Tue, 21 Oct 2014 20:04:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C48ABFD5; Tue, 21 Oct 2014 20:04:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LK45wx062616; Tue, 21 Oct 2014 20:04:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LK45Hc062615; Tue, 21 Oct 2014 20:04:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212004.s9LK45Hc062615@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:04:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273407 - head/lib/libc++ X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:04:06 -0000 Author: bapt Date: Tue Oct 21 20:04:05 2014 New Revision: 273407 URL: https://svnweb.freebsd.org/changeset/base/273407 Log: When using an external gcc 4.8+ and not building libstdc++ then create in the objectdir a fake libstdc++.so and libstdc++.a which is a symlink on libc++ that allow g++ to satisfy its links dependencies in the least hackish way. Please note that this hacky libstds++ never get installed on the final system Reviewed by: imp Modified: head/lib/libc++/Makefile Modified: head/lib/libc++/Makefile ============================================================================== --- head/lib/libc++/Makefile Tue Oct 21 20:00:49 2014 (r273406) +++ head/lib/libc++/Makefile Tue Oct 21 20:04:05 2014 (r273407) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + LIBCXXRTDIR= ${.CURDIR}/../../contrib/libcxxrt HDRDIR= ${.CURDIR}/../../contrib/libc++/include SRCDIR= ${.CURDIR}/../../contrib/libc++/src @@ -192,4 +194,14 @@ EXT+= ${HDRDIR}/ext/${hdr} .endfor EXTDIR= ${CXXINCLUDEDIR}/ext +.if ${MK_GNUCXX} == "no" && ${COMPILER_TYPE} == "gcc" +CLEANFILES+= libstdc++.so libstdc++.a + +afterinstall: + ln -sf ${DESTDIR}${LIBDIR}/lib${LIB}.so \ + ${.OBJDIR}/libstdc++.so + ln -sf ${DESTDIR}${LIBDIR}/lib${LIB}.a \ + ${.OBJDIR}/libstdc++.a +.endif + .include From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:07:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C96D732D; Tue, 21 Oct 2014 20:07:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5E722B; Tue, 21 Oct 2014 20:07:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LK7F1r063116; Tue, 21 Oct 2014 20:07:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LK7F5F063115; Tue, 21 Oct 2014 20:07:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212007.s9LK7F5F063115@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273408 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:07:15 -0000 Author: bapt Date: Tue Oct 21 20:07:15 2014 New Revision: 273408 URL: https://svnweb.freebsd.org/changeset/base/273408 Log: Make the external toolchain support grows to the knowleged of XXFLAGS for C++ dedicated flags and DEPFLAGS for mkdep flags Pass the path to the libc++ headers in both, enforce the gnu++11 standard in the XXFLAGS to satisfy libc++ requirements pass the libc++ objectdir as a location where to find libraries so it can find libstdc++.so and libstdc++.A Reviewed by: imp Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 21 20:04:05 2014 (r273407) +++ head/Makefile.inc1 Tue Oct 21 20:07:15 2014 (r273408) @@ -323,7 +323,8 @@ X${BINUTIL}?= ${CROSS_BINUTILS_PREFIX}${ X${BINUTIL}?= ${${BINUTIL}} .endif .endfor -WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS}" \ +WMAKEENV+= CC="${XCC} ${XFLAGS}" CXX="${XCXX} ${XFLAGS} ${XXFLAGS}" \ + DEPFLAGS="${DEPFLAGS}" \ CPP="${XCPP} ${XFLAGS}" \ AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ @@ -351,6 +352,8 @@ TARGET_ABI= gnueabi .endif .if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc XFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib +XXFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 -std=gnu++11 -L${WORLDTMP}/../lib/libc++ +DEPFLAGS+= -I${WORLDTMP}/usr/include/c++/v1 .else TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:11:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D904B5AC; Tue, 21 Oct 2014 20:11:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C548CC3; Tue, 21 Oct 2014 20:11:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKB5q3066442; Tue, 21 Oct 2014 20:11:05 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKB58Y066441; Tue, 21 Oct 2014 20:11:05 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212011.s9LKB58Y066441@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 20:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273409 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:11:06 -0000 Author: bapt Date: Tue Oct 21 20:11:05 2014 New Revision: 273409 URL: https://svnweb.freebsd.org/changeset/base/273409 Log: Do not make ld(1) warnings fatal anymore, binutils behaviour has changed over the time and gnu.warnings.symbol are now being fatal preventing building world. in the futur we want to investigate only making the gnu.warning.symbol non fatal Reviewed by: imp Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 21 20:07:15 2014 (r273408) +++ head/share/mk/bsd.lib.mk Tue Oct 21 20:11:05 2014 (r273409) @@ -207,7 +207,7 @@ _LIBS+= ${SHLIB_NAME} SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) -SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel +SOLINKOPTS+= -Wl,--no-fatal-warnings -Wl,--warn-shared-textrel .endif .if target(beforelinking) From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:17:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C16C1743; Tue, 21 Oct 2014 20:17:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADBB1191; Tue, 21 Oct 2014 20:17:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKH5T3068451; Tue, 21 Oct 2014 20:17:05 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKH5Ic068450; Tue, 21 Oct 2014 20:17:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410212017.s9LKH5Ic068450@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Tue, 21 Oct 2014 20:17:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273410 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:17:05 -0000 Author: ngie Date: Tue Oct 21 20:17:05 2014 New Revision: 273410 URL: https://svnweb.freebsd.org/changeset/base/273410 Log: Add sys/socket.h #include for bind(2), et al Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_connect.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_connect.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_connect.c Tue Oct 21 20:11:05 2014 (r273409) +++ head/contrib/netbsd-tests/lib/libc/sys/t_connect.c Tue Oct 21 20:17:05 2014 (r273410) @@ -36,6 +36,10 @@ #include +#ifdef __FreeBSD__ +#include +#endif + ATF_TC(connect_low_port); ATF_TC_HEAD(connect_low_port, tc) { From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:29:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C71021A; Tue, 21 Oct 2014 20:29:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 892972E6; Tue, 21 Oct 2014 20:29:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKThdi074338; Tue, 21 Oct 2014 20:29:43 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKThT2074337; Tue, 21 Oct 2014 20:29:43 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410212029.s9LKThT2074337@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 21 Oct 2014 20:29:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273417 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:29:43 -0000 Author: imp Date: Tue Oct 21 20:29:42 2014 New Revision: 273417 URL: https://svnweb.freebsd.org/changeset/base/273417 Log: You aren't allowed to test WITH_xxx or WITHOUT_xxx here, so remove it. Even if you were allowed to test for it, the test makes no sense as it always results in adding -DWITH_ATF unless WITH_ATF was already defined. But if MK_ATF != no, then we know it was defined. This, in turn, caused tools/build/options/makemake always think WITH_ATF is the default, which removed control of that from sys.conf.mk. To get the intent of the deleted comment, another mechanism is required, assuming that the intent of that comment is desirable. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 21 20:21:27 2014 (r273416) +++ head/Makefile.inc1 Tue Oct 21 20:29:42 2014 (r273417) @@ -1561,12 +1561,7 @@ gnu/lib/libsupc++__L: gnu/lib/libstdc++_ lib/libgeom__L: lib/libexpat__L -.if defined(WITH_ATF) || ${MK_TESTS} != "no" -.if !defined(WITH_ATF) -# Ensure that the ATF libraries will be built during make libraries, even -# though they will have WITHOUT_TESTS -MAKE+= -DWITH_ATF -.endif +.if ${MK_TESTS} != "no" _lib_atf= lib/atf .endif From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:29:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F38DC3DD; Tue, 21 Oct 2014 20:29:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E03662E7; Tue, 21 Oct 2014 20:29:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKTp71074410; Tue, 21 Oct 2014 20:29:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKTpP5074409; Tue, 21 Oct 2014 20:29:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410212029.s9LKTpP5074409@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 21 Oct 2014 20:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273418 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:29:52 -0000 Author: imp Date: Tue Oct 21 20:29:51 2014 New Revision: 273418 URL: https://svnweb.freebsd.org/changeset/base/273418 Log: Generate both userland and kernel option settings for showconfig. PR: 191920 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Oct 21 20:29:42 2014 (r273417) +++ head/Makefile.inc1 Tue Oct 21 20:29:51 2014 (r273418) @@ -1886,7 +1886,8 @@ check-old: check-old-files check-old-lib # showconfig - show build configuration. # showconfig: - @${MAKE} -n -f src.opts.mk -V dummy -dg1 2>&1 | grep ^MK_ | sort + @(${MAKE} -n -f ${.CURDIR}/sys/conf/kern.opts.mk -V dummy -dg1; \ + ${MAKE} -n -f ${.CURDIR}/share/mk/src.opts.mk -V dummy -dg1) 2>&1 | grep ^MK_ | sort -u .if !empty(KRNLOBJDIR) && !empty(KERNCONF) DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}/ From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:29:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CDE574B4; Tue, 21 Oct 2014 20:29:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BAE362EA; Tue, 21 Oct 2014 20:29:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKTrQg074467; Tue, 21 Oct 2014 20:29:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKTrNp074466; Tue, 21 Oct 2014 20:29:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410212029.s9LKTrNp074466@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 21 Oct 2014 20:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273419 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:29:53 -0000 Author: imp Date: Tue Oct 21 20:29:53 2014 New Revision: 273419 URL: https://svnweb.freebsd.org/changeset/base/273419 Log: For the kernel, we have USB_GADGET_EXAMPLES as defaults to yes. For userland defaults to no. This caused issues for the automated option documenation script. Turns out, this isn't used in userland at all, so just remove it from here. Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Oct 21 20:29:51 2014 (r273418) +++ head/share/mk/src.opts.mk Tue Oct 21 20:29:53 2014 (r273419) @@ -169,8 +169,7 @@ __DEFAULT_NO_OPTIONS = \ OPENSSH_NONE_CIPHER \ SHARED_TOOLCHAIN \ SORT_THREADS \ - SVN \ - USB_GADGET_EXAMPLES + SVN # # Default behaviour of some options depends on the architecture. Unfortunately From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:41:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C179489D; Tue, 21 Oct 2014 20:41:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD2B75F9; Tue, 21 Oct 2014 20:41:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKfKod082079; Tue, 21 Oct 2014 20:41:20 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKfKWr082078; Tue, 21 Oct 2014 20:41:20 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410212041.s9LKfKWr082078@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 20:41:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273420 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:41:21 -0000 Author: emaste Date: Tue Oct 21 20:41:19 2014 New Revision: 273420 URL: https://svnweb.freebsd.org/changeset/base/273420 Log: Regenerate after r273418 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Tue Oct 21 20:29:53 2014 (r273419) +++ head/share/man/man5/src.conf.5 Tue Oct 21 20:41:19 2014 (r273420) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd October 16, 2014 +.Dd October 21, 2014 .Dt SRC.CONF 5 .Os .Sh NAME @@ -211,10 +211,10 @@ Set to build the Clang C/C++ compiler du It is a default setting on amd64/amd64, arm/arm, arm/armv6, arm/armv6hf, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. .It Va WITHOUT_CLANG_BOOTSTRAP -.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +.\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. -You must enable wither gcc or clang bootstrap to be able to build the system, -unless an alternative compiiler is provided via +You must enable either gcc or clang bootstrap to be able to build the system, +unless an alternative compiler is provided via XCC. .Pp It is a default setting on @@ -404,6 +404,12 @@ program to be built and installed as fma .\" from FreeBSD: head/tools/build/options/WITHOUT_FMTREE 261299 2014-01-30 21:37:43Z brooks Set to not build and install .Pa /usr/sbin/fmtree . +.It Va WITHOUT_FORMAT_EXTENSIONS +.\" from FreeBSD: head/tools/build/options/WITHOUT_FORMAT_EXTENSIONS 250658 2013-05-15 13:04:10Z brooks +Set to not enable +.Fl fformat-extensions +when compiling the kernel. +Also disables all format checking. .It Va WITHOUT_FORTH .\" from FreeBSD: head/tools/build/options/WITHOUT_FORTH 156932 2006-03-21 07:50:50Z ru Set to build bootloaders without Forth support. @@ -432,10 +438,10 @@ Set to build and install gcc and g++. It is a default setting on arm/armeb, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. .It Va WITHOUT_GCC_BOOTSTRAP -.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp +.\" from FreeBSD: head/tools/build/options/WITHOUT_GCC_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build gcc and g++ as part of the bootstrap process. -You must enable wither gcc or clang bootstrap to be able to build the system, -unless an alternative compiiler is provided via +You must enable either gcc or clang bootstrap to be able to build the system, +unless an alternative compiler is provided via XCC. .Pp It is a default setting on @@ -613,6 +619,12 @@ Set to build some programs without Kerbe .Xr sshd 8 , and .Xr telnetd 8 . +.It Va WITHOUT_KERNEL_SYMBOLS +.\" from FreeBSD: head/tools/build/options/WITHOUT_KERNEL_SYMBOLS 222189 2011-05-22 18:23:17Z imp +Set to not install kernel symbol files. +.Bf -symbolic +This option is recommended for those people who have small root partitions. +.Ef .It Va WITHOUT_KVM .\" from FreeBSD: head/tools/build/options/WITHOUT_KVM 174550 2007-12-12 16:43:17Z ru Set to not build the @@ -1077,9 +1089,6 @@ and related programs. .It Va WITHOUT_USB .\" from FreeBSD: head/tools/build/options/WITHOUT_USB 156932 2006-03-21 07:50:50Z ru Set to not build USB-related programs and libraries. -.It Va WITH_USB_GADGET_EXAMPLES -.\" from FreeBSD: head/tools/build/options/WITH_USB_GADGET_EXAMPLES 254919 2013-08-26 17:15:56Z antoine -Set to build USB gadget kernel modules. .It Va WITHOUT_UTMPX .\" from FreeBSD: head/tools/build/options/WITHOUT_UTMPX 231530 2012-02-11 20:28:42Z ed Set to not build user accounting tools such as From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:44:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E0AE1B66; Tue, 21 Oct 2014 20:44:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCF2F6B2; Tue, 21 Oct 2014 20:44:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LKiX0n083656; Tue, 21 Oct 2014 20:44:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LKiXNk083655; Tue, 21 Oct 2014 20:44:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201410212044.s9LKiXNk083655@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 21 Oct 2014 20:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273421 - head/tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:44:34 -0000 Author: emaste Date: Tue Oct 21 20:44:33 2014 New Revision: 273421 URL: https://svnweb.freebsd.org/changeset/base/273421 Log: Fix typo in src option description Modified: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT Modified: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT ============================================================================== --- head/tools/build/options/WITHOUT_GNU_GREP_COMPAT Tue Oct 21 20:41:19 2014 (r273420) +++ head/tools/build/options/WITHOUT_GNU_GREP_COMPAT Tue Oct 21 20:44:33 2014 (r273421) @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set this option to omit the gnu extentions to grep from being included in +Set this option to omit the gnu extensions to grep from being included in BSD grep. From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 20:44:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E6FDCA4; Tue, 21 Oct 2014 20:44:54 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44D7D6BC; Tue, 21 Oct 2014 20:44:54 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id C3B6D1FE023; Tue, 21 Oct 2014 22:44:42 +0200 (CEST) Message-ID: <5446C5BF.6080508@selasky.org> Date: Tue, 21 Oct 2014 22:44:47 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Konstantin Belousov Subject: Re: svn commit: r273377 - in head: share/man/man9 sys/amd64/amd64 sys/arm/arm sys/cam/scsi sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/dev/dtrace sys/compat/ndis sys/dev/acpi_support sys/de... References: <201410210731.s9L7VMww096983@svn.freebsd.org> <20141021161602.GD1877@kib.kiev.ua> In-Reply-To: <20141021161602.GD1877@kib.kiev.ua> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 20:44:54 -0000 On 10/21/14 18:16, Konstantin Belousov wrote: > On Tue, Oct 21, 2014 at 07:31:22AM +0000, Hans Petter Selasky wrote: >> Author: hselasky >> Date: Tue Oct 21 07:31:21 2014 >> New Revision: 273377 >> URL: https://svnweb.freebsd.org/changeset/base/273377 >> >> Log: >> Fix multiple incorrect SYSCTL arguments in the kernel: >> >> - Wrong integer type was specified. >> >> - Wrong or missing "access" specifier. The "access" specifier >> sometimes included the SYSCTL type, which it should not, except for >> procedural SYSCTL nodes. >> >> - Logical OR where binary OR was expected. >> >> - Properly assert the "access" argument passed to all SYSCTL macros, >> using the CTASSERT macro. This applies to both static- and dynamically >> created SYSCTLs. >> >> - Properly assert the the data type for both static and dynamic >> SYSCTLs. In the case of static SYSCTLs we only assert that the data >> pointed to by the SYSCTL data pointer has the correct size, hence >> there is no easy way to assert types in the C language outside a >> C-function. >> >> - Rewrote some code which doesn't pass a constant "access" specifier >> when creating dynamic SYSCTL nodes, which is now a requirement. >> >> - Updated "EXAMPLES" section in SYSCTL manual page. >> >> MFC after: 3 days >> Sponsored by: Mellanox Technologies >> >> Modified: >> head/share/man/man9/Makefile >> head/share/man/man9/sysctl.9 >> head/sys/amd64/amd64/fpu.c >> head/sys/arm/arm/busdma_machdep-v6.c >> head/sys/arm/arm/busdma_machdep.c >> head/sys/cam/scsi/scsi_sa.c >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c >> head/sys/cddl/dev/dtrace/dtrace_sysctl.c >> head/sys/compat/ndis/kern_ndis.c >> head/sys/dev/acpi_support/acpi_asus.c >> head/sys/dev/acpi_support/acpi_asus_wmi.c >> head/sys/dev/acpi_support/acpi_hp.c >> head/sys/dev/acpi_support/acpi_ibm.c >> head/sys/dev/acpi_support/acpi_rapidstart.c >> head/sys/dev/acpi_support/acpi_sony.c >> head/sys/dev/bxe/bxe.c >> head/sys/dev/cxgb/cxgb_sge.c >> head/sys/dev/cxgbe/t4_main.c >> head/sys/dev/e1000/if_em.c >> head/sys/dev/e1000/if_igb.c >> head/sys/dev/e1000/if_lem.c >> head/sys/dev/hatm/if_hatm.c >> head/sys/dev/ixgbe/ixgbe.c >> head/sys/dev/ixgbe/ixv.c >> head/sys/dev/ixl/if_ixl.c >> head/sys/dev/mpr/mpr.c >> head/sys/dev/mps/mps.c >> head/sys/dev/mrsas/mrsas.c >> head/sys/dev/mrsas/mrsas.h >> head/sys/dev/mxge/if_mxge.c >> head/sys/dev/oce/oce_sysctl.c >> head/sys/dev/qlxgb/qla_os.c >> head/sys/dev/qlxgbe/ql_os.c >> head/sys/dev/rt/if_rt.c >> head/sys/dev/sound/pci/hda/hdaa.c >> head/sys/dev/vxge/vxge.c >> head/sys/dev/xen/netfront/netfront.c >> head/sys/fs/devfs/devfs_devs.c >> head/sys/fs/fuse/fuse_main.c >> head/sys/fs/fuse/fuse_vfsops.c >> head/sys/geom/geom_kern.c >> head/sys/kern/kern_cpuset.c >> head/sys/kern/kern_descrip.c >> head/sys/kern/kern_mib.c >> head/sys/kern/kern_synch.c >> head/sys/kern/subr_devstat.c >> head/sys/kern/subr_kdb.c >> head/sys/kern/subr_uio.c >> head/sys/kern/vfs_cache.c >> head/sys/mips/mips/busdma_machdep.c >> head/sys/net80211/ieee80211_ht.c >> head/sys/net80211/ieee80211_hwmp.c >> head/sys/net80211/ieee80211_mesh.c >> head/sys/net80211/ieee80211_superg.c >> head/sys/netgraph/bluetooth/common/ng_bluetooth.c >> head/sys/netgraph/ng_base.c >> head/sys/netgraph/ng_socket.c >> head/sys/netinet/cc/cc_chd.c >> head/sys/netinet/tcp_timer.c >> head/sys/netipsec/ipsec.h >> head/sys/netpfil/pf/pf.c >> head/sys/ofed/drivers/net/mlx4/mlx4_en.h >> head/sys/powerpc/powermac/fcu.c >> head/sys/powerpc/powermac/smu.c >> head/sys/powerpc/powerpc/cpu.c >> head/sys/sys/sysctl.h >> head/sys/vm/memguard.c >> head/sys/vm/vm_kern.c >> head/sys/x86/x86/busdma_bounce.c > > This seems to break at least PowerPC 64bit, or some bits were not > committed. I have to add the following change to compile GENERIC64 > kernel, otherwise I get > > cc1: warnings being treated as errors > /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c: In function 'alloc_bounce_zone': > /usr/home/kostik/work/build/bsd/DEV/src/sys/powerpc/powerpc/busdma_machdep.c:1030: warning: initialization from incompatible pointer type > *** [busdma_machdep.o] Error code 1 > > OTOH, I did not verified that 32bit PowerPC kernel is compilable with > the change applied. > > diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c > index e35ecec..b58a91b 100644 > --- a/sys/powerpc/powerpc/busdma_machdep.c > +++ b/sys/powerpc/powerpc/busdma_machdep.c > @@ -1027,9 +1027,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) > SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), > SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, > "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); > - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), > + SYSCTL_ADD_ULONG(busdma_sysctl_tree(bz), > SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, > - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); > + "alignment", CTLFLAG_RD, &bz->alignment, ""); > > return (0); > } > > It think it is better to have it UAUTO, so that the macro will choose 32-bit or 64-bit. Sorry for the breakage. Thought that universe had passed. Will fix it shortly. --HPS From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:03:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5B79E166; Tue, 21 Oct 2014 21:03:50 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 15AAD8E2; Tue, 21 Oct 2014 21:03:50 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.82 (FreeBSD)) (envelope-from ) id 1Xggai-0000nD-JK; Wed, 22 Oct 2014 01:03:40 +0400 Date: Wed, 22 Oct 2014 01:03:40 +0400 From: Slawa Olhovchenkov To: Mateusz Guzik Subject: Re: svn commit: r273335 - head/sys/fs/unionfs Message-ID: <20141021210340.GA2178@zxy.spb.ru> References: <201410201753.s9KHrnaG009500@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410201753.s9KHrnaG009500@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:03:50 -0000 On Mon, Oct 20, 2014 at 05:53:49PM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Mon Oct 20 17:53:49 2014 > New Revision: 273335 > URL: https://svnweb.freebsd.org/changeset/base/273335 > > Log: > unionfs: hold mount interlock while manipulating mnt_flag > > This is for consistency with other filesystems. Can you check interoperability unionfs with zfs and devfs? I have crashed unionfs with zfs. unionfs with devfs need double devfs mount. > Modified: > head/sys/fs/unionfs/union_vfsops.c > > Modified: head/sys/fs/unionfs/union_vfsops.c > ============================================================================== > --- head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:04:03 2014 (r273334) > +++ head/sys/fs/unionfs/union_vfsops.c Mon Oct 20 17:53:49 2014 (r273335) > @@ -290,12 +290,14 @@ unionfs_domount(struct mount *mp) > return (error); > } > > + MNT_ILOCK(mp); > /* > * Check mnt_flag > */ > if ((ump->um_lowervp->v_mount->mnt_flag & MNT_LOCAL) && > (ump->um_uppervp->v_mount->mnt_flag & MNT_LOCAL)) > mp->mnt_flag |= MNT_LOCAL; > + MNT_IUNLOCK(mp); > > /* > * Get new fsid > _______________________________________________ > svn-src-all@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:04:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 149042A4; Tue, 21 Oct 2014 21:04:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00A038E7; Tue, 21 Oct 2014 21:04:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL4iKR093313; Tue, 21 Oct 2014 21:04:44 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL4iaZ093312; Tue, 21 Oct 2014 21:04:44 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410212104.s9LL4iaZ093312@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 21 Oct 2014 21:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273423 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:04:45 -0000 Author: hselasky Date: Tue Oct 21 21:04:44 2014 New Revision: 273423 URL: https://svnweb.freebsd.org/changeset/base/273423 Log: Use the UAUTO SYSCTL type for exporting the bounce zone alignment, because the variable size depends on the build type. Reported by: kib @ MFC after: 3 days Modified: head/sys/powerpc/powerpc/busdma_machdep.c Modified: head/sys/powerpc/powerpc/busdma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/busdma_machdep.c Tue Oct 21 20:51:22 2014 (r273422) +++ head/sys/powerpc/powerpc/busdma_machdep.c Tue Oct 21 21:04:44 2014 (r273423) @@ -1027,9 +1027,9 @@ alloc_bounce_zone(bus_dma_tag_t dmat) SYSCTL_ADD_STRING(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, "lowaddr", CTLFLAG_RD, bz->lowaddrid, 0, ""); - SYSCTL_ADD_INT(busdma_sysctl_tree(bz), + SYSCTL_ADD_UAUTO(busdma_sysctl_tree(bz), SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO, - "alignment", CTLFLAG_RD, &bz->alignment, 0, ""); + "alignment", CTLFLAG_RD, &bz->alignment, ""); return (0); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:08:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B807044C; Tue, 21 Oct 2014 21:08:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4FD591B; Tue, 21 Oct 2014 21:08:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL8kxU093928; Tue, 21 Oct 2014 21:08:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL8kIa093927; Tue, 21 Oct 2014 21:08:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212108.s9LL8kIa093927@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 21:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273424 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:08:46 -0000 Author: mjg Date: Tue Oct 21 21:08:45 2014 New Revision: 273424 URL: https://svnweb.freebsd.org/changeset/base/273424 Log: Mark some more sysctl stuff shared-locked and MPSAFE. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Tue Oct 21 21:04:44 2014 (r273423) +++ head/sys/kern/kern_sysctl.c Tue Oct 21 21:08:45 2014 (r273424) @@ -755,7 +755,7 @@ sysctl_sysctl_debug_dump_node(struct sys int k; struct sysctl_oid *oidp; - SYSCTL_ASSERT_XLOCKED(); + SYSCTL_ASSERT_LOCKED(); SLIST_FOREACH(oidp, l, oid_link) { for (k=0; ktd, PRIV_SYSCTL_DEBUG); if (error) return (error); - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); sysctl_sysctl_debug_dump_node(&sysctl__children, 0); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (ENOENT); } -SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD, +SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, 0, 0, sysctl_sysctl_debug, "-", ""); #endif @@ -820,7 +820,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) struct sysctl_oid_list *lsp = &sysctl__children, *lsp2; char buf[10]; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); while (namelen) { if (!lsp) { snprintf(buf,sizeof(buf),"%d",*name); @@ -863,7 +863,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) } error = SYSCTL_OUT(req, "", 1); out: - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (error); } @@ -871,7 +871,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return name data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD | CTLFLAG_CAPRD, +static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, ""); static int @@ -944,9 +944,9 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) struct sysctl_oid_list *lsp = &sysctl__children; int newoid[CTL_MAXNAME]; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); i = sysctl_sysctl_next_ls(lsp, name, namelen, newoid, &j, 1, &oid); - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); if (i) return (ENOENT); error = SYSCTL_OUT(req, newoid, j * sizeof (int)); @@ -957,7 +957,7 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return next data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_CAPRD, +static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_next, ""); static int @@ -1048,7 +1048,7 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS struct sysctl_oid *oid; int error; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) goto out; @@ -1062,7 +1062,7 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS goto out; error = SYSCTL_OUT(req, oid->oid_fmt, strlen(oid->oid_fmt) + 1); out: - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (error); } @@ -1076,7 +1076,7 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_AR struct sysctl_oid *oid; int error; - SYSCTL_XLOCK(); + SYSCTL_SLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) goto out; @@ -1087,11 +1087,11 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_AR } error = SYSCTL_OUT(req, oid->oid_descr, strlen(oid->oid_descr) + 1); out: - SYSCTL_XUNLOCK(); + SYSCTL_SUNLOCK(); return (error); } -static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_CAPRD, +static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, sysctl_sysctl_oiddescr, ""); /* From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:09:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4952A59A; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 364F292A; Tue, 21 Oct 2014 21:09:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LL9td9094347; Tue, 21 Oct 2014 21:09:55 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LL9tCB094346; Tue, 21 Oct 2014 21:09:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212109.s9LL9tCB094346@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 21:09:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273426 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:09:55 -0000 Author: bapt Date: Tue Oct 21 21:09:54 2014 New Revision: 273426 URL: https://svnweb.freebsd.org/changeset/base/273426 Log: older binutils does not know about --no-fatal-warnings Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 21 21:09:54 2014 (r273425) +++ head/share/mk/bsd.lib.mk Tue Oct 21 21:09:54 2014 (r273426) @@ -207,7 +207,7 @@ _LIBS+= ${SHLIB_NAME} SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) -SOLINKOPTS+= -Wl,--no-fatal-warnings -Wl,--warn-shared-textrel +SOLINKOPTS+= -Wl,--warn-shared-textrel .endif .if target(beforelinking) From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:17:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1FCD6A4; Tue, 21 Oct 2014 21:17:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0CB11C87; Tue, 21 Oct 2014 21:17:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLHiCw099030; Tue, 21 Oct 2014 21:17:44 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLHis1099029; Tue, 21 Oct 2014 21:17:44 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212117.s9LLHis1099029@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 21:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273428 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:17:45 -0000 Author: bapt Date: Tue Oct 21 21:17:44 2014 New Revision: 273428 URL: https://svnweb.freebsd.org/changeset/base/273428 Log: Revert r273426 r273409 A solution that work with both new and old binutils should be investigated Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Oct 21 21:11:25 2014 (r273427) +++ head/share/mk/bsd.lib.mk Tue Oct 21 21:17:44 2014 (r273428) @@ -207,7 +207,7 @@ _LIBS+= ${SHLIB_NAME} SOLINKOPTS= -shared -Wl,-x .if !defined(ALLOW_SHARED_TEXTREL) -SOLINKOPTS+= -Wl,--warn-shared-textrel +SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel .endif .if target(beforelinking) From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:27:14 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A517361D; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 917E9F4F; Tue, 21 Oct 2014 21:27:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLREto003940; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLREDw003939; Tue, 21 Oct 2014 21:27:14 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212127.s9LLREDw003939@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 21:27:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273430 - head/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:27:14 -0000 Author: mjg Date: Tue Oct 21 21:27:13 2014 New Revision: 273430 URL: https://svnweb.freebsd.org/changeset/base/273430 Log: tmpfs: allow shared file lookups Tested by: pho Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 21 21:27:13 2014 (r273429) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Tue Oct 21 21:27:13 2014 (r273430) @@ -255,7 +255,7 @@ tmpfs_mount(struct mount *mp) MNT_ILOCK(mp); mp->mnt_flag |= MNT_LOCAL; - mp->mnt_kern_flag |= MNTK_SUSPENDABLE; + mp->mnt_kern_flag |= MNTK_LOOKUP_SHARED | MNTK_SUSPENDABLE; MNT_IUNLOCK(mp); mp->mnt_data = tmp; From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:29:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82AC58CC; Tue, 21 Oct 2014 21:29:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F248F6C; Tue, 21 Oct 2014 21:29:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLTLWA004326; Tue, 21 Oct 2014 21:29:21 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLTL7Y004325; Tue, 21 Oct 2014 21:29:21 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212129.s9LLTL7Y004325@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 21:29:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273431 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:29:21 -0000 Author: mjg Date: Tue Oct 21 21:29:20 2014 New Revision: 273431 URL: https://svnweb.freebsd.org/changeset/base/273431 Log: Take the lock shared in linker_search_symbol_name. This helps sysctl kern.proc.stack. Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Tue Oct 21 21:27:13 2014 (r273430) +++ head/sys/kern/kern_linker.c Tue Oct 21 21:29:20 2014 (r273431) @@ -986,9 +986,9 @@ linker_search_symbol_name(caddr_t value, { int error; - sx_xlock(&kld_sx); + sx_slock(&kld_sx); error = linker_debug_search_symbol_name(value, buf, buflen, offset); - sx_xunlock(&kld_sx); + sx_sunlock(&kld_sx); return (error); } From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:32:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7EF14B6B; Tue, 21 Oct 2014 21:32:44 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 3F764C4; Tue, 21 Oct 2014 21:32:42 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 4D9057300B; Tue, 21 Oct 2014 23:36:21 +0200 (CEST) Date: Tue, 21 Oct 2014 23:36:21 +0200 From: Luigi Rizzo To: Andriy Gapon Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw Message-ID: <20141021213621.GA70907@onelab2.iet.unipi.it> References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5443A83F.5090807@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:32:44 -0000 On Sun, Oct 19, 2014 at 03:02:07PM +0300, Andriy Gapon wrote: > On 19/10/2014 14:15, Alexander V. Chernikov wrote: > > +static uint32_t > > +roundup2p(uint32_t v) > > +{ > > + > > + v--; > > + v |= v >> 1; > > + v |= v >> 2; > > + v |= v >> 4; > > + v |= v >> 8; > > + v |= v >> 16; > > + v++; > > + > > + return (v); > > +} > > I think that on platforms where an optimized version of fls() is available that > would work faster than this cool piece of bit magic. This code is not performance critical. I wouldn't bother optimizing it. Rather, since this code must be platform independent, I'd like to give it a name that does not conflict with any builtin. cheers luigi > From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:37:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9CFBBF57; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 869D813A; Tue, 21 Oct 2014 21:37:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLbtY4008919; Tue, 21 Oct 2014 21:37:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLbtvb008918; Tue, 21 Oct 2014 21:37:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201410212137.s9LLbtvb008918@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 21 Oct 2014 21:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273432 - head/sys/sys stable/10/sys/sys stable/8/sys/sys stable/9/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:37:55 -0000 Author: gjb Date: Tue Oct 21 21:37:53 2014 New Revision: 273432 URL: https://svnweb.freebsd.org/changeset/base/273432 Log: Bump __FreeBSD_version to track SA-14:20, SA-14:21, SA-14:22, SA-14:23 Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/param.h Changes in other areas also in this revision: Modified: stable/10/sys/sys/param.h stable/8/sys/sys/param.h stable/9/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Oct 21 21:29:20 2014 (r273431) +++ head/sys/sys/param.h Tue Oct 21 21:37:53 2014 (r273432) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100039 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100040 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:40:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C1F61548; Tue, 21 Oct 2014 21:40:48 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CDBA1F7; Tue, 21 Oct 2014 21:40:48 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 059AA25D3A91; Tue, 21 Oct 2014 21:40:44 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 30386C76FD8; Tue, 21 Oct 2014 21:40:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id CCBEGO7UnBRc; Tue, 21 Oct 2014 21:40:42 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6] (orange-tun0-ula.sbone.de [IPv6:fde9:577b:c1a9:4420:cabc:c8ff:fe8b:4fe6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id E11BDC76FD0; Tue, 21 Oct 2014 21:40:40 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273400 - in head/sys: kern sys From: "Bjoern A. Zeeb" In-Reply-To: <201410211902.s9LJ2RoA031960@svn.freebsd.org> Date: Tue, 21 Oct 2014 21:40:38 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <50143173-0319-45C0-A00E-AD2AA303C65D@FreeBSD.org> References: <201410211902.s9LJ2RoA031960@svn.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:40:48 -0000 On 21 Oct 2014, at 19:02 , Mateusz Guzik wrote: > Author: mjg > Date: Tue Oct 21 19:02:26 2014 > New Revision: 273400 > URL: https://svnweb.freebsd.org/changeset/base/273400 >=20 > Log: > Rename sysctl_lock and _unlock to sysctl_xlock and _xunlock. You are perfectly describing what you are doing, but I=92d also like to = understand the =93why?=94 >=20 > Modified: > head/sys/kern/kern_linker.c > head/sys/kern/kern_sysctl.c > head/sys/kern/vfs_init.c > head/sys/sys/sysctl.h >=20 > Modified: head/sys/kern/kern_linker.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_linker.c Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/kern/kern_linker.c Tue Oct 21 19:02:26 2014 = (r273400) > @@ -292,10 +292,10 @@ linker_file_register_sysctls(linker_file > return; >=20 > sx_xunlock(&kld_sx); > - sysctl_lock(); > + sysctl_xlock(); > for (oidp =3D start; oidp < stop; oidp++) > sysctl_register_oid(*oidp); > - sysctl_unlock(); > + sysctl_xunlock(); > sx_xlock(&kld_sx); > } >=20 > @@ -313,10 +313,10 @@ linker_file_unregister_sysctls(linker_fi > return; >=20 > sx_xunlock(&kld_sx); > - sysctl_lock(); > + sysctl_xlock(); > for (oidp =3D start; oidp < stop; oidp++) > sysctl_unregister_oid(*oidp); > - sysctl_unlock(); > + sysctl_xunlock(); > sx_xlock(&kld_sx); > } >=20 >=20 > Modified: head/sys/kern/kern_sysctl.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_sysctl.c Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/kern/kern_sysctl.c Tue Oct 21 19:02:26 2014 = (r273400) > @@ -126,14 +126,14 @@ sysctl_find_oidname(const char *name, st > * Order by number in each list. > */ > void > -sysctl_lock(void) > +sysctl_xlock(void) > { >=20 > SYSCTL_XLOCK(); > } >=20 > void > -sysctl_unlock(void) > +sysctl_xunlock(void) > { >=20 > SYSCTL_XUNLOCK(); >=20 > Modified: head/sys/kern/vfs_init.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/vfs_init.c Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/kern/vfs_init.c Tue Oct 21 19:02:26 2014 = (r273400) > @@ -291,7 +291,7 @@ vfs_register(struct vfsconf *vfc) > * preserved by re-registering the oid after modifying its > * number. > */ > - sysctl_lock(); > + sysctl_xlock(); > SLIST_FOREACH(oidp, SYSCTL_CHILDREN(&sysctl___vfs), oid_link) { > if (strcmp(oidp->oid_name, vfc->vfc_name) =3D=3D 0) { > sysctl_unregister_oid(oidp); > @@ -300,7 +300,7 @@ vfs_register(struct vfsconf *vfc) > break; > } > } > - sysctl_unlock(); > + sysctl_xunlock(); >=20 > return (0); > } >=20 > Modified: head/sys/sys/sysctl.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/sys/sysctl.h Tue Oct 21 19:00:32 2014 = (r273399) > +++ head/sys/sys/sysctl.h Tue Oct 21 19:02:26 2014 = (r273400) > @@ -770,8 +770,8 @@ int userland_sysctl(struct thread *td, i > size_t *retval, int flags); > int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid = **noid, > int *nindx, struct sysctl_req *req); > -void sysctl_lock(void); > -void sysctl_unlock(void); > +void sysctl_xlock(void); > +void sysctl_xunlock(void); > int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); >=20 > struct sbuf; >=20 =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:45:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAB0E9AB; Tue, 21 Oct 2014 21:45:51 +0000 (UTC) Received: from mail-wi0-x234.google.com (mail-wi0-x234.google.com [IPv6:2a00:1450:400c:c05::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D8A06243; Tue, 21 Oct 2014 21:45:50 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id em10so3014790wid.7 for ; Tue, 21 Oct 2014 14:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=RkOG8y7w89EITJN7pOIqRao8Lhk+iGtje5MJ9SYLDn8=; b=e2IQyItaotFkBgSgLKA5taJaGWkUSxTU+G8MjKDeEZPj58JyMqRshH3IJCpjy17dNo 2DmJSNhGpEWLRysPhKUQmYVnIhZEPJ6O4p/R2y1kDvxiGzd9h11Dpb/IgNkb/vbrcXaQ 7qPjXqqA6G0A3HCNSL2fh1jVYEYA2PzcFvwsoOIliUCIlqxC8m9iHA7+q3l+AWAWfF+7 9d6hS321HeYGibrVD7NDXh0UYWVpsBm+Y7N2+tx/q4AhY2qzhDYheY2FJk1mrIiha8gh Srp6o5awIolTjJz5+s5vpGErAlo4jX1sDZRkOTkd9ZmhPFhL1Gd2Nq/sCvOV3nOezeGY 68Ng== X-Received: by 10.194.246.230 with SMTP id xz6mr44920235wjc.3.1413927949156; Tue, 21 Oct 2014 14:45:49 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id h8sm371235wjs.43.2014.10.21.14.45.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 21 Oct 2014 14:45:48 -0700 (PDT) Date: Tue, 21 Oct 2014 23:45:45 +0200 From: Mateusz Guzik To: "Bjoern A. Zeeb" Subject: Re: svn commit: r273400 - in head/sys: kern sys Message-ID: <20141021214545.GC28763@dft-labs.eu> References: <201410211902.s9LJ2RoA031960@svn.freebsd.org> <50143173-0319-45C0-A00E-AD2AA303C65D@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <50143173-0319-45C0-A00E-AD2AA303C65D@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:45:52 -0000 On Tue, Oct 21, 2014 at 09:40:38PM +0000, Bjoern A. Zeeb wrote: > > On 21 Oct 2014, at 19:02 , Mateusz Guzik wrote: > > > Author: mjg > > Date: Tue Oct 21 19:02:26 2014 > > New Revision: 273400 > > URL: https://svnweb.freebsd.org/changeset/base/273400 > > > > Log: > > Rename sysctl_lock and _unlock to sysctl_xlock and _xunlock. > > You are perfectly describing what you are doing, but I’d also like to understand the “why?†> First off, these function do lock sysctl exclusively, so I find this to be a better suited name. In https://svnweb.freebsd.org/base?view=revision&revision=273401 I added shared locking to sysctl and this change "coincidently" freed up a nice name for a functions which remember previous lock type and lock it the same way later. -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:47:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A215DC47; Tue, 21 Oct 2014 21:47:36 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 62E24269; Tue, 21 Oct 2014 21:47:36 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 82730A252; Tue, 21 Oct 2014 21:47:35 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 8E3EE548B; Tue, 21 Oct 2014 23:47:23 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Luigi Rizzo Subject: Re: svn commit: r273274 - head/sys/netpfil/ipfw References: <201410191115.s9JBFJxA058370@svn.freebsd.org> <5443A83F.5090807@FreeBSD.org> <20141021213621.GA70907@onelab2.iet.unipi.it> Date: Tue, 21 Oct 2014 23:47:23 +0200 In-Reply-To: <20141021213621.GA70907@onelab2.iet.unipi.it> (Luigi Rizzo's message of "Tue, 21 Oct 2014 23:36:21 +0200") Message-ID: <86lho914es.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, "Alexander V. Chernikov" , Andriy Gapon X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:47:36 -0000 Luigi Rizzo writes: > This code is not performance critical. I wouldn't bother optimizing it. So just use fls() or flsl(). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 21:49:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB5DEDDD; Tue, 21 Oct 2014 21:49:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B774627B; Tue, 21 Oct 2014 21:49:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LLn74r014072; Tue, 21 Oct 2014 21:49:07 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LLn7HU014071; Tue, 21 Oct 2014 21:49:07 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201410212149.s9LLn7HU014071@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 21 Oct 2014 21:49:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273434 - head/contrib/libc++/src X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 21:49:07 -0000 Author: bapt Date: Tue Oct 21 21:49:06 2014 New Revision: 273434 URL: https://svnweb.freebsd.org/changeset/base/273434 Log: Do not define bad_array_new_length::bad_array_new_length in libc++ anymore when used in combinaison with libcxxrt since it is now defined there already. This fixes building world Modified: head/contrib/libc++/src/new.cpp Modified: head/contrib/libc++/src/new.cpp ============================================================================== --- head/contrib/libc++/src/new.cpp Tue Oct 21 21:44:24 2014 (r273433) +++ head/contrib/libc++/src/new.cpp Tue Oct 21 21:49:06 2014 (r273434) @@ -192,8 +192,6 @@ bad_alloc::what() const _NOEXCEPT #endif // !__GLIBCXX__ -#endif //LIBCXXRT - bad_array_new_length::bad_array_new_length() _NOEXCEPT { } @@ -202,6 +200,8 @@ bad_array_new_length::~bad_array_new_len { } +#endif //LIBCXXRT + const char* bad_array_length::what() const _NOEXCEPT { From owner-svn-src-head@FreeBSD.ORG Tue Oct 21 23:08:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A7A7C7; Tue, 21 Oct 2014 23:08:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04183C66; Tue, 21 Oct 2014 23:08:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9LN8lku052002; Tue, 21 Oct 2014 23:08:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9LN8lm6051999; Tue, 21 Oct 2014 23:08:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410212308.s9LN8lm6051999@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 21 Oct 2014 23:08:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273436 - in head/sys: i386/ibcs2 kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 23:08:48 -0000 Author: mjg Date: Tue Oct 21 23:08:46 2014 New Revision: 273436 URL: https://svnweb.freebsd.org/changeset/base/273436 Log: Eliminate unnecessary memory allocation in sys_getgroups and its ibcs2 counterpart. Modified: head/sys/i386/ibcs2/ibcs2_misc.c head/sys/kern/kern_prot.c head/sys/sys/syscallsubr.h Modified: head/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_misc.c Tue Oct 21 23:07:30 2014 (r273435) +++ head/sys/i386/ibcs2/ibcs2_misc.c Tue Oct 21 23:08:46 2014 (r273436) @@ -659,33 +659,28 @@ ibcs2_getgroups(td, uap) struct thread *td; struct ibcs2_getgroups_args *uap; { + struct ucred *cred; ibcs2_gid_t *iset; - gid_t *gp; u_int i, ngrp; int error; - if (uap->gidsetsize < td->td_ucred->cr_ngroups) { - if (uap->gidsetsize == 0) - ngrp = 0; - else - return (EINVAL); - } else - ngrp = td->td_ucred->cr_ngroups; - gp = malloc(ngrp * sizeof(*gp), M_TEMP, M_WAITOK); - error = kern_getgroups(td, &ngrp, gp); - if (error) + cred = td->td_ucred; + ngrp = cred->cr_ngroups; + + if (uap->gidsetsize == 0) { + error = 0; goto out; - if (uap->gidsetsize > 0) { - iset = malloc(ngrp * sizeof(*iset), M_TEMP, M_WAITOK); - for (i = 0; i < ngrp; i++) - iset[i] = (ibcs2_gid_t)gp[i]; - error = copyout(iset, uap->gidset, ngrp * sizeof(ibcs2_gid_t)); - free(iset, M_TEMP); } - if (error == 0) - td->td_retval[0] = ngrp; + if (uap->gidsetsize < ngrp) + return (EINVAL); + + iset = malloc(ngrp * sizeof(*iset), M_TEMP, M_WAITOK); + for (i = 0; i < ngrp; i++) + iset[i] = (ibcs2_gid_t)cred->cr_groups[i]; + error = copyout(iset, uap->gidset, ngrp * sizeof(ibcs2_gid_t)); + free(iset, M_TEMP); out: - free(gp, M_TEMP); + td->td_retval[0] = ngrp; return (error); } Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Tue Oct 21 23:07:30 2014 (r273435) +++ head/sys/kern/kern_prot.c Tue Oct 21 23:08:46 2014 (r273436) @@ -303,45 +303,24 @@ struct getgroups_args { int sys_getgroups(struct thread *td, register struct getgroups_args *uap) { - gid_t *groups; + struct ucred *cred; u_int ngrp; int error; - if (uap->gidsetsize < td->td_ucred->cr_ngroups) { - if (uap->gidsetsize == 0) - ngrp = 0; - else - return (EINVAL); - } else - ngrp = td->td_ucred->cr_ngroups; - groups = malloc(ngrp * sizeof(*groups), M_TEMP, M_WAITOK); - error = kern_getgroups(td, &ngrp, groups); - if (error) - goto out; - if (uap->gidsetsize > 0) - error = copyout(groups, uap->gidset, ngrp * sizeof(gid_t)); - if (error == 0) - td->td_retval[0] = ngrp; -out: - free(groups, M_TEMP); - return (error); -} - -int -kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups) -{ - struct ucred *cred; - cred = td->td_ucred; - if (*ngrp == 0) { - *ngrp = cred->cr_ngroups; - return (0); + ngrp = cred->cr_ngroups; + + if (uap->gidsetsize == 0) { + error = 0; + goto out; } - if (*ngrp < cred->cr_ngroups) + if (uap->gidsetsize < ngrp) return (EINVAL); - *ngrp = cred->cr_ngroups; - bcopy(cred->cr_groups, groups, *ngrp * sizeof(gid_t)); - return (0); + + error = copyout(cred->cr_groups, uap->gidset, ngrp * sizeof(gid_t)); +out: + td->td_retval[0] = ngrp; + return (error); } #ifndef _SYS_SYSPROTO_H_ Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Tue Oct 21 23:07:30 2014 (r273435) +++ head/sys/sys/syscallsubr.h Tue Oct 21 23:08:46 2014 (r273436) @@ -109,7 +109,6 @@ int kern_getdirentries(struct thread *td long *basep, ssize_t *residp, enum uio_seg bufseg); int kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, enum uio_seg bufseg, int flags); -int kern_getgroups(struct thread *td, u_int *ngrp, gid_t *groups); int kern_getitimer(struct thread *, u_int, struct itimerval *); int kern_getppid(struct thread *); int kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 00:07:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C7DDE9D; Wed, 22 Oct 2014 00:07:06 +0000 (UTC) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "troutmask.apl.washington.edu", Issuer "troutmask.apl.washington.edu" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A41025F; Wed, 22 Oct 2014 00:07:06 +0000 (UTC) Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.9/8.14.9) with ESMTP id s9M070P8093931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Oct 2014 17:07:00 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.9/8.14.9/Submit) id s9M070BA093930; Tue, 21 Oct 2014 17:07:00 -0700 (PDT) (envelope-from sgk) Date: Tue, 21 Oct 2014 17:07:00 -0700 From: Steve Kargl To: Baptiste Daroussin Subject: Re: svn commit: r273406 - head/share/mk Message-ID: <20141022000700.GA93912@troutmask.apl.washington.edu> References: <201410212000.s9LK0oQn061585@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410212000.s9LK0oQn061585@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 00:07:06 -0000 On Tue, Oct 21, 2014 at 08:00:50PM +0000, Baptiste Daroussin wrote: > Author: bapt > Date: Tue Oct 21 20:00:49 2014 > New Revision: 273406 > URL: https://svnweb.freebsd.org/changeset/base/273406 > > Log: > Always use libc++ as the default c++ stack when building with an external gcc 4.8+ > While here disable building gcc from base when using gcc 4.8+ > > Reviewed by: imp Are you sure that this works? There are some (well-known?) incompatibilities between libc++ and libstdc++. By work, I mean a resulting binary actually functions as expected. -- steve From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 00:23:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 100292A5; Wed, 22 Oct 2014 00:23:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFF6E62D; Wed, 22 Oct 2014 00:23:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M0Nild089977; Wed, 22 Oct 2014 00:23:44 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M0NiBX089974; Wed, 22 Oct 2014 00:23:44 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410220023.s9M0NiBX089974@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 22 Oct 2014 00:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273441 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 00:23:45 -0000 Author: mjg Date: Wed Oct 22 00:23:43 2014 New Revision: 273441 URL: https://svnweb.freebsd.org/changeset/base/273441 Log: filedesc: cleanup setugidsafety a little Rename it to fdsetugidsafety for consistency with other functions. There is no need to take filedesc lock if not closing any files. The loop has to verify each file and we are guaranteed fdtable has space for at least 20 fds. As such there is no need to check fd_lastfile. While here tidy up is_unsafe. Modified: head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Tue Oct 21 23:57:31 2014 (r273440) +++ head/sys/kern/kern_descrip.c Wed Oct 22 00:23:43 2014 (r273441) @@ -2078,23 +2078,23 @@ fdescfree(struct thread *td) * Since setugidsafety calls this only for fd 0, 1 and 2, this check is * sufficient. We also don't check for setugidness since we know we are. */ -static int +static bool is_unsafe(struct file *fp) { - if (fp->f_type == DTYPE_VNODE) { - struct vnode *vp = fp->f_vnode; + struct vnode *vp; - if ((vp->v_vflag & VV_PROCDEP) != 0) - return (1); - } - return (0); + if (fp->f_type != DTYPE_VNODE) + return (false); + + vp = fp->f_vnode; + return ((vp->v_vflag & VV_PROCDEP) != 0); } /* * Make this setguid thing safe, if at all possible. */ void -setugidsafety(struct thread *td) +fdsetugidsafety(struct thread *td) { struct filedesc *fdp; struct file *fp; @@ -2102,12 +2102,10 @@ setugidsafety(struct thread *td) fdp = td->td_proc->p_fd; KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared")); - FILEDESC_XLOCK(fdp); - for (i = 0; i <= fdp->fd_lastfile; i++) { - if (i > 2) - break; + for (i = 0; i <= 2; i++) { fp = fdp->fd_ofiles[i].fde_file; if (fp != NULL && is_unsafe(fp)) { + FILEDESC_XLOCK(fdp); knote_fdclose(td, i); /* * NULL-out descriptor prior to close to avoid @@ -2116,10 +2114,8 @@ setugidsafety(struct thread *td) fdfree(fdp, i); FILEDESC_XUNLOCK(fdp); (void) closef(fp, td); - FILEDESC_XLOCK(fdp); } } - FILEDESC_XUNLOCK(fdp); } /* Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Tue Oct 21 23:57:31 2014 (r273440) +++ head/sys/kern/kern_exec.c Wed Oct 22 00:23:43 2014 (r273441) @@ -695,7 +695,7 @@ interpret: */ PROC_UNLOCK(p); VOP_UNLOCK(imgp->vp, 0); - setugidsafety(td); + fdsetugidsafety(td); error = fdcheckstd(td); if (error != 0) goto done1; Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Tue Oct 21 23:57:31 2014 (r273440) +++ head/sys/sys/filedesc.h Wed Oct 22 00:23:43 2014 (r273441) @@ -148,6 +148,7 @@ int fdallocn(struct thread *td, int minf int fdcheckstd(struct thread *td); void fdclose(struct filedesc *fdp, struct file *fp, int idx, struct thread *td); void fdcloseexec(struct thread *td); +void fdsetugidsafety(struct thread *td); struct filedesc *fdcopy(struct filedesc *fdp); void fdunshare(struct thread *td); void fdescfree(struct thread *td); @@ -159,7 +160,6 @@ struct filedesc_to_leader * int getvnode(struct filedesc *fdp, int fd, cap_rights_t *rightsp, struct file **fpp); void mountcheckdirs(struct vnode *olddp, struct vnode *newdp); -void setugidsafety(struct thread *td); /* Return a referenced file from an unlocked descriptor. */ int fget_unlocked(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 00:58:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 77FEB6CE; Wed, 22 Oct 2014 00:58:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 638A9912; Wed, 22 Oct 2014 00:58:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M0wpUg004577; Wed, 22 Oct 2014 00:58:51 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M0wpug004576; Wed, 22 Oct 2014 00:58:51 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410220058.s9M0wpug004576@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 22 Oct 2014 00:58:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273442 - head/contrib/elftoolchain/libelf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 00:58:51 -0000 Author: marcel Date: Wed Oct 22 00:58:50 2014 New Revision: 273442 URL: https://svnweb.freebsd.org/changeset/base/273442 Log: GCC for PowerPC does not align .note sections to 4 bytes. When running ctfmerge on its objects, libelf asserts as it expects .note sections to be 4-byte aligned. Change that expectation. Approved by: jkoshy@ Obtained from: Juniper Networks, Inc. Modified: head/contrib/elftoolchain/libelf/libelf_align.c Modified: head/contrib/elftoolchain/libelf/libelf_align.c ============================================================================== --- head/contrib/elftoolchain/libelf/libelf_align.c Wed Oct 22 00:23:43 2014 (r273441) +++ head/contrib/elftoolchain/libelf/libelf_align.c Wed Oct 22 00:58:50 2014 (r273442) @@ -109,7 +109,7 @@ static struct align falign[ELF_T_NUM] = [ELF_T_LWORD] = FALIGN(8,8), [ELF_T_MOVE] = FALIGN(8,8), [ELF_T_MOVEP] = UNSUPPORTED(), - [ELF_T_NOTE] = FALIGN(4,4), + [ELF_T_NOTE] = FALIGN(1,1), [ELF_T_OFF] = FALIGN(4,8), [ELF_T_PHDR] = FALIGN(4,8), [ELF_T_REL] = FALIGN(4,8), From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:04:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00956897; Wed, 22 Oct 2014 01:04:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E05779DF; Wed, 22 Oct 2014 01:04:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M14G6f008814; Wed, 22 Oct 2014 01:04:16 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M14Gq8008813; Wed, 22 Oct 2014 01:04:16 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410220104.s9M14Gq8008813@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 22 Oct 2014 01:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273443 - head/contrib/elftoolchain/libelf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:04:17 -0000 Author: marcel Date: Wed Oct 22 01:04:16 2014 New Revision: 273443 URL: https://svnweb.freebsd.org/changeset/base/273443 Log: Fix the conversion macro for .note sections, broken in the case the ELF file's byte order is not the native byte order. The bug is that the variables holding the name and description size are used (natively) after having been byte-swapped. The fix is to calculate sz from them just prior to byte-swapping. Approved by: jkoshy@ Obtained from: Juniper Networks, Inc. Modified: head/contrib/elftoolchain/libelf/libelf_convert.m4 Modified: head/contrib/elftoolchain/libelf/libelf_convert.m4 ============================================================================== --- head/contrib/elftoolchain/libelf/libelf_convert.m4 Wed Oct 22 00:58:50 2014 (r273442) +++ head/contrib/elftoolchain/libelf/libelf_convert.m4 Wed Oct 22 01:04:16 2014 (r273443) @@ -947,6 +947,11 @@ _libelf_cvt_NOTE_tom(char *dst, size_t d READ_WORD(src, descsz); READ_WORD(src, type); + sz = namesz; + ROUNDUP2(sz, 4); + sz += descsz; + ROUNDUP2(sz, 4); + /* Translate. */ SWAP_WORD(namesz); SWAP_WORD(descsz); @@ -962,11 +967,6 @@ _libelf_cvt_NOTE_tom(char *dst, size_t d dst += sizeof(Elf_Note); count -= hdrsz; - ROUNDUP2(namesz, 4); - ROUNDUP2(descsz, 4); - - sz = namesz + descsz; - if (count < sz || dsz < sz) /* Buffers are too small. */ return (0); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:09:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 45D89A87; Wed, 22 Oct 2014 01:09:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1849AA0A; Wed, 22 Oct 2014 01:09:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M197og009522; Wed, 22 Oct 2014 01:09:07 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M197wU009521; Wed, 22 Oct 2014 01:09:07 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410220109.s9M197wU009521@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 22 Oct 2014 01:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273444 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:09:08 -0000 Author: mjg Date: Wed Oct 22 01:09:07 2014 New Revision: 273444 URL: https://svnweb.freebsd.org/changeset/base/273444 Log: Avoid crdup when possible in kern_accessat. While here tidy up a little. Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Oct 22 01:04:16 2014 (r273443) +++ head/sys/kern/vfs_syscalls.c Wed Oct 22 01:09:07 2014 (r273444) @@ -2064,7 +2064,7 @@ int kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg, int flag, int amode) { - struct ucred *cred, *tmpcred; + struct ucred *cred, *usecred; struct vnode *vp; struct nameidata nd; cap_rights_t rights; @@ -2075,31 +2075,33 @@ kern_accessat(struct thread *td, int fd, /* * Create and modify a temporary credential instead of one that - * is potentially shared. + * is potentially shared (if we need one). */ - if (!(flag & AT_EACCESS)) { - cred = td->td_ucred; - tmpcred = crdup(cred); - tmpcred->cr_uid = cred->cr_ruid; - tmpcred->cr_groups[0] = cred->cr_rgid; - td->td_ucred = tmpcred; + cred = td->td_ucred; + if ((flag & AT_EACCESS) == 0 && + ((cred->cr_uid != cred->cr_ruid || + cred->cr_rgid != cred->cr_groups[0]))) { + usecred = crdup(cred); + usecred->cr_uid = cred->cr_ruid; + usecred->cr_groups[0] = cred->cr_rgid; + td->td_ucred = usecred; } else - cred = tmpcred = td->td_ucred; + usecred = cred; AUDIT_ARG_VALUE(amode); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, pathseg, path, fd, cap_rights_init(&rights, CAP_FSTAT), td); if ((error = namei(&nd)) != 0) - goto out1; + goto out; vp = nd.ni_vp; - error = vn_access(vp, amode, tmpcred, td); + error = vn_access(vp, amode, usecred, td); NDFREE(&nd, NDF_ONLY_PNBUF); vput(vp); -out1: - if (!(flag & AT_EACCESS)) { +out: + if (usecred != cred) { td->td_ucred = cred; - crfree(tmpcred); + crfree(usecred); } return (error); } From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:25:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4174CD93; Wed, 22 Oct 2014 01:25:17 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 01594B8F; Wed, 22 Oct 2014 01:25:16 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id C5BEDA5C8; Wed, 22 Oct 2014 01:25:14 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id DB6FE54BC; Wed, 22 Oct 2014 03:25:02 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Warner Losh Subject: Re: svn commit: r273417 - head References: <201410212029.s9LKThT2074337@svn.freebsd.org> Date: Wed, 22 Oct 2014 03:25:02 +0200 In-Reply-To: <201410212029.s9LKThT2074337@svn.freebsd.org> (Warner Losh's message of "Tue, 21 Oct 2014 20:29:43 +0000 (UTC)") Message-ID: <86d29k28wh.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:25:17 -0000 Warner Losh writes: > Author: imp > Date: Tue Oct 21 20:29:42 2014 > New Revision: 273417 > URL: https://svnweb.freebsd.org/changeset/base/273417 > > Log: > You aren't allowed to test WITH_xxx or WITHOUT_xxx here, so remove it. > Even if you were allowed to test for it, the test makes no sense as it > always results in adding -DWITH_ATF unless WITH_ATF was already > defined. But if MK_ATF !=3D no, then we know it was defined. This, in > turn, caused tools/build/options/makemake always think WITH_ATF is the > default, which removed control of that from sys.conf.mk. >=20=20=20 > To get the intent of the deleted comment, another mechanism is > required, assuming that the intent of that comment is desirable. This broke the paralell build. It prevents building lib/atf entirely in stage 4.3, so the programs in libexec/atf have nothing to link against unless lib/atf just happens to get built before libexec/atf. That almost never happens: lib and libexec are built in paralell, and lib/atf is one of the last items in lib whereas libexec/atf is one of the first items in libexec. (on a side note, libatf doesn't need to be in _prebuild_libs, since no other library depend on it) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:35:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0FCD117A; Wed, 22 Oct 2014 01:35:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F086AC79; Wed, 22 Oct 2014 01:35:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1ZU8q022934; Wed, 22 Oct 2014 01:35:30 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1ZUfR022933; Wed, 22 Oct 2014 01:35:30 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410220135.s9M1ZUfR022933@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 22 Oct 2014 01:35:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273445 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:35:31 -0000 Author: imp Date: Wed Oct 22 01:35:30 2014 New Revision: 273445 URL: https://svnweb.freebsd.org/changeset/base/273445 Log: Add defines for various FIRST PARTY DMA SEND subcommands. Modified: head/sys/sys/ata.h Modified: head/sys/sys/ata.h ============================================================================== --- head/sys/sys/ata.h Wed Oct 22 01:09:07 2014 (r273444) +++ head/sys/sys/ata.h Wed Oct 22 01:35:30 2014 (r273445) @@ -372,6 +372,10 @@ struct ata_params { #define ATA_WRITE_FPDMA_QUEUED 0x61 /* write DMA NCQ */ #define ATA_NCQ_NON_DATA 0x63 /* NCQ non-data command */ #define ATA_SEND_FPDMA_QUEUED 0x64 /* send DMA NCQ */ +#define ATA_SFPDMA_DSM 0x00 /* Data set management */ +#define ATA_SFPDMA_DSM_TRIM 0x01 /* Set trim bit in auxilary */ +#define ATA_SFPDMA_HYBRID_EVICT 0x01 /* Hybrid Evict */ +#define ATA_SFPDMA_WLDMA 0x02 /* Write Log DMA EXT */ #define ATA_RECV_FPDMA_QUEUED 0x65 /* recieve DMA NCQ */ #define ATA_SEP_ATTN 0x67 /* SEP request */ #define ATA_SEEK 0x70 /* seek */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:37:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8642B302; Wed, 22 Oct 2014 01:37:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7244BC9B; Wed, 22 Oct 2014 01:37:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1bXVg023210; Wed, 22 Oct 2014 01:37:33 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1bXuh023209; Wed, 22 Oct 2014 01:37:33 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410220137.s9M1bXuh023209@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Wed, 22 Oct 2014 01:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273446 - head/sys/x86/isa X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:37:33 -0000 Author: marcel Date: Wed Oct 22 01:37:32 2014 New Revision: 273446 URL: https://svnweb.freebsd.org/changeset/base/273446 Log: Virtual machines can easily have more than 16 option ROMs and when that happens, we happily access our resource array out of bounds. Make sure we stay within the MAX_ROMS limit. While here, bump MAX_ROMS from 16 to 32 to minimize the chance of leaving option ROMs unaccounted for. Obtained from: Juniper Networks, Inc. Modified: head/sys/x86/isa/orm.c Modified: head/sys/x86/isa/orm.c ============================================================================== --- head/sys/x86/isa/orm.c Wed Oct 22 01:35:30 2014 (r273445) +++ head/sys/x86/isa/orm.c Wed Oct 22 01:37:32 2014 (r273446) @@ -58,7 +58,7 @@ static struct isa_pnp_id orm_ids[] = { { 0, NULL }, }; -#define MAX_ROMS 16 +#define MAX_ROMS 32 struct orm_softc { int rnum; @@ -97,7 +97,7 @@ orm_identify(driver_t* driver, device_t isa_set_vendorid(child, ORM_ID); sc = device_get_softc(child); sc->rnum = 0; - while (chunk < IOMEM_END) { + while (sc->rnum < MAX_ROMS && chunk < IOMEM_END) { bus_set_resource(child, SYS_RES_MEMORY, sc->rnum, chunk, IOMEM_STEP); rid = sc->rnum; From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:53:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7C1A5C7; Wed, 22 Oct 2014 01:53:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4014E13; Wed, 22 Oct 2014 01:53:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M1r1X9031828; Wed, 22 Oct 2014 01:53:01 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M1r14B031827; Wed, 22 Oct 2014 01:53:01 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410220153.s9M1r14B031827@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 22 Oct 2014 01:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273447 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:53:01 -0000 Author: mjg Date: Wed Oct 22 01:53:00 2014 New Revision: 273447 URL: https://svnweb.freebsd.org/changeset/base/273447 Log: Reduce nesting in vn_access. No functional changes. Modified: head/sys/kern/vfs_syscalls.c Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Wed Oct 22 01:37:32 2014 (r273446) +++ head/sys/kern/vfs_syscalls.c Wed Oct 22 01:53:00 2014 (r273447) @@ -1994,23 +1994,23 @@ vn_access(vp, user_flags, cred, td) int error; /* Flags == 0 means only check for existence. */ - error = 0; - if (user_flags) { - accmode = 0; - if (user_flags & R_OK) - accmode |= VREAD; - if (user_flags & W_OK) - accmode |= VWRITE; - if (user_flags & X_OK) - accmode |= VEXEC; + if (user_flags == 0) + return (0); + + accmode = 0; + if (user_flags & R_OK) + accmode |= VREAD; + if (user_flags & W_OK) + accmode |= VWRITE; + if (user_flags & X_OK) + accmode |= VEXEC; #ifdef MAC - error = mac_vnode_check_access(cred, vp, accmode); - if (error != 0) - return (error); + error = mac_vnode_check_access(cred, vp, accmode); + if (error != 0) + return (error); #endif - if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) - error = VOP_ACCESS(vp, accmode, cred, td); - } + if ((accmode & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) + error = VOP_ACCESS(vp, accmode, cred, td); return (error); } From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 01:56:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBA1C772 for ; Wed, 22 Oct 2014 01:56:19 +0000 (UTC) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 894B7E2C for ; Wed, 22 Oct 2014 01:56:19 +0000 (UTC) Received: by mail-pa0-f45.google.com with SMTP id lj1so2627602pab.18 for ; Tue, 21 Oct 2014 18:56:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=4hjhXCq9e8nyFHZB5fXIi0xJ0bKWonGe8lPSTyvctRc=; b=RVxc6fQPN/0OxqimYmiSYuL8xAXb7CHZJxGU0U3C9m/wvt2wt5jKwjnKW9gQEJzI5S +Dfky8C01eKfJlvAYexCy8omuAg2HoHQkSfIquvXMNjyRlXHqfECgjbL7AITVdjnmOvR NkUIAkKnlf1togXhYZNqGb1KVx81DFJULLuiIfkHnxbdeU6oMHovaI90RBjPqVncLO9i SDbPCT3Z41lK5Aw6OSV7eeulyogn0qD6+0k6rbhAYuUbDqqHW7/crAFQltx7+jSszfvu DjW54yEXMRiwWT+8togG6btdn50VlWSdb1rVLvLq4YU1cYXDOZ64BPM/Wtk8NO4fhOZ/ RL0w== X-Gm-Message-State: ALoCoQkbmfXmAQyslHMW3YYeOmpoIf/3roTB8qTuJ5AFK9Dcw7/CL/wyxpOdgkWR4gbN+5Pzo9NL X-Received: by 10.66.139.106 with SMTP id qx10mr466599pab.138.1413942578011; Tue, 21 Oct 2014 18:49:38 -0700 (PDT) Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id kv10sm636385pab.23.2014.10.21.18.49.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 18:49:37 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273417 - head From: Warner Losh In-Reply-To: <86d29k28wh.fsf@nine.des.no> Date: Tue, 21 Oct 2014 19:49:33 -0600 Message-Id: <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 01:56:19 -0000 --Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 21, 2014, at 7:25 PM, Dag-Erling Sm=F8rgrav wrote: > Warner Losh writes: >> Author: imp >> Date: Tue Oct 21 20:29:42 2014 >> New Revision: 273417 >> URL: https://svnweb.freebsd.org/changeset/base/273417 >>=20 >> Log: >> You aren't allowed to test WITH_xxx or WITHOUT_xxx here, so remove = it. >> Even if you were allowed to test for it, the test makes no sense as = it >> always results in adding -DWITH_ATF unless WITH_ATF was already >> defined. But if MK_ATF !=3D no, then we know it was defined. This, = in >> turn, caused tools/build/options/makemake always think WITH_ATF is = the >> default, which removed control of that from sys.conf.mk. >>=20 >> To get the intent of the deleted comment, another mechanism is >> required, assuming that the intent of that comment is desirable. >=20 > This broke the paralell build. It prevents building lib/atf entirely = in > stage 4.3, so the programs in libexec/atf have nothing to link against > unless lib/atf just happens to get built before libexec/atf. That > almost never happens: lib and libexec are built in paralell, and = lib/atf > is one of the last items in lib whereas libexec/atf is one of the = first > items in libexec. >=20 > (on a side note, libatf doesn't need to be in _prebuild_libs, since no > other library depend on it) Yea, it was AFU. I=92ll fix this. I think we need to have a = MK_TESTS_SUPPORT that builds the libatf stuff when yes, and omits it when no, since we = don=92t want the tests building when we=92re building the 4.3 stage. Warner > DES > --=20 > Dag-Erling Sm=F8rgrav - des@des.no --Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJURw0uAAoJEGwc0Sh9sBEAkrgP/R5+U6/6T8k04jHhvPK8FKxy kwJ2yJcGpO3jCo0ky9xDLmtdA5bu0mSkSnG9peCE4pYhRZsWpBptXHOyf8Wd45m1 qnHLci3uPAyW7qy2RqZuQN/XNMr274wtbS3J1O2HURGi17pUT2PNJaJagP0ppZ2Y vP/923VRA9TuyuPifYXEO+QdmuEExrJy2ATfzqI40nulFXahGsm0BEY1+RqhBP6o tUu1S8ZrsXKKZBsSclFHync+WIDntPHSMMYQDmhiTNvqoLWFhBMKcNuEGSiOd1J7 6DgdBuGn+BmcjXovpGysZYMqaahz8+OFbEDEfPh4ADv1sL/JGEauDV5/kY12kOLX Ds9arPAbdAyi6xbLSZf4heTQ7Cc4oB3R08DqD0ATWb5bF7/gDXxR4MgVsNUq4hiH gnYmoBwsc0OKr5r83FjWSabUnPqvSLlNDqdhXY8YDMmbTVsep9VKQ8zHXoAcL+37 fk/QR/UU2llEy9hhDj1/0LBLMxz449w8ybQmIqRLz7Ghe3HYC2VSVIl9Z4KecGxG CF2/uTF9yU4TzToB+GBe8Tlc6qdziiERge6k8rNp9KArXz1fb0Cjq36HakGbUFNu 5KqzZ3pbWfNwcIRmMmhp5cfFWZx183VNxNsWY6FeCz8yItOfdOjek0gmkY8yBSmY BTKVIY7Hls7i1AcERrow =Rt/o -----END PGP SIGNATURE----- --Apple-Mail=_DB67DB47-1D9A-4BF9-97CB-4EFE6631F24D-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 03:32:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE5A9321; Wed, 22 Oct 2014 03:32:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA984A3C; Wed, 22 Oct 2014 03:32:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M3WREp078883; Wed, 22 Oct 2014 03:32:27 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M3WRhf078882; Wed, 22 Oct 2014 03:32:27 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410220332.s9M3WRhf078882@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Wed, 22 Oct 2014 03:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273448 - head/sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 03:32:28 -0000 Author: kevlo Date: Wed Oct 22 03:32:27 2014 New Revision: 273448 URL: https://svnweb.freebsd.org/changeset/base/273448 Log: Fix the kernel panic in hostap mode. rvp->beacon_mbuf was NULL in run_update_beacon(). PR: 189405 Submitted by: Gabor Simon MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_run.c Modified: head/sys/dev/usb/wlan/if_run.c ============================================================================== --- head/sys/dev/usb/wlan/if_run.c Wed Oct 22 01:53:00 2014 (r273447) +++ head/sys/dev/usb/wlan/if_run.c Wed Oct 22 03:32:27 2014 (r273448) @@ -4913,6 +4913,12 @@ run_update_beacon(struct ieee80211vap *v } setbit(rvp->bo.bo_flags, item); + if (rvp->beacon_mbuf == NULL) { + rvp->beacon_mbuf = ieee80211_beacon_alloc(vap->iv_bss, + &rvp->bo); + if (rvp->beacon_mbuf == NULL) + return; + } ieee80211_beacon_update(vap->iv_bss, &rvp->bo, rvp->beacon_mbuf, mcast); i = RUN_CMDQ_GET(&sc->cmdq_store); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 03:39:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E55B64F8; Wed, 22 Oct 2014 03:39:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6B05A75; Wed, 22 Oct 2014 03:39:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M3dC35079736; Wed, 22 Oct 2014 03:39:12 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M3dCKZ079733; Wed, 22 Oct 2014 03:39:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201410220339.s9M3dCKZ079733@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 22 Oct 2014 03:39:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273449 - in head: . lib share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 03:39:13 -0000 Author: imp Date: Wed Oct 22 03:39:11 2014 New Revision: 273449 URL: https://svnweb.freebsd.org/changeset/base/273449 Log: My previous commit exposed an issue as it fixed a different issue. lib/atf isn't a prereq_lib, since it isn't required for other libraries to build. Remove it. The old kludge of always building it had effectively been retired. Since we don't want to build the libraries with the tests when we're bootstrapping, invent MK_TESTS_SUPPORT which normally defaults to the current MK_TESTS value, except when explicitly defined. Make lib/atf depend on it being yes. When building the libraries set MK_TESTS to no, and MK_TESTS_SUPPORT to the current value of MK_TESTS so that later stages of the build work correctly. This should fix (and does for me) people's issues with parallel builds racing between lib/atf and libexec/atf. Since lib/atf is built during the libraries phase, the race disappears. Modified: head/Makefile.inc1 head/lib/Makefile head/share/mk/src.opts.mk Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 22 03:32:27 2014 (r273448) +++ head/Makefile.inc1 Wed Oct 22 03:39:11 2014 (r273449) @@ -574,7 +574,7 @@ _libraries: @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; \ ${WMAKE} -DNO_FSCHG MK_HTML=no MK_INFO=no -DNO_LINT MK_MAN=no \ - MK_PROFILE=no MK_TESTS=no libraries + MK_PROFILE=no MK_TESTS=no MK_TESTS_SUPPORT=${MK_TESTS} libraries _depend: @echo @echo "--------------------------------------------------------------" @@ -1535,7 +1535,6 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \ ${_kerberos5_lib_libroken} \ ${_kerberos5_lib_libwind} \ - ${_lib_atf} \ lib/libbz2 ${_libcom_err} lib/libcrypt \ lib/libelf lib/libexpat \ ${_lib_libgssapi} \ @@ -1561,10 +1560,6 @@ gnu/lib/libsupc++__L: gnu/lib/libstdc++_ lib/libgeom__L: lib/libexpat__L -.if ${MK_TESTS} != "no" -_lib_atf= lib/atf -.endif - .if ${MK_LIBTHR} != "no" _lib_libthr= lib/libthr .endif Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Oct 22 03:32:27 2014 (r273448) +++ head/lib/Makefile Wed Oct 22 03:39:11 2014 (r273449) @@ -276,8 +276,10 @@ _libsmutil= libsmutil _libtelnet= libtelnet .endif -.if ${MK_TESTS} != "no" +.if ${MK_TESTS_SUPPORT} != "no" _atf= atf +.endif +.if ${MK_TESTS} != "no" _tests= tests .endif Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Oct 22 03:32:27 2014 (r273448) +++ head/share/mk/src.opts.mk Wed Oct 22 03:39:11 2014 (r273449) @@ -330,6 +330,7 @@ MK_CLANG_FULL:= no KVM \ NETGRAPH \ PAM \ + TESTS \ WIRELESS .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} == "no" MK_${var}_SUPPORT:= no From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 04:04:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7A17DA46 for ; Wed, 22 Oct 2014 04:04:28 +0000 (UTC) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B008CE1 for ; Wed, 22 Oct 2014 04:04:27 +0000 (UTC) Received: by mail-pa0-f50.google.com with SMTP id kx10so2798469pab.23 for ; Tue, 21 Oct 2014 21:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:content-type:mime-version:subject :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=UKL7Pw1CooRwnsAwCAIZKCCN1lxStyopluZRRHuuWfg=; b=lxTe9AvugseD5sc2OHYr4k1pY8LR6iwkveriEZDoRoz5W0ET6kLP1383Q5drtVUFsT 5HFTf92pUVcBTFsMXpr3pgIaRVevSNwAnNo9wuHbRQQvI9lZIARBR4A+8jgCGVpJLCmg LSpUW2JSAJPPn8UOQOAK3K8siLVquzcbrpxhQ/vRAQu9AaEnjFI6EHK4dwhDojRTaj5I sBynFOQ3ddDwA8cVvKxveXbonjDUSluhyFYjM7Q6wfzVAlzM6+E8lvbFWDy+ZlknFZXl pEPC6W1gdyWvghm+6lPIolVcD9CnW0iyr6A3UY4vzCu5PH/bttlNo0exyO9hClL0njpv 4CUg== X-Gm-Message-State: ALoCoQnOTVpBbOqNBNmKiowWMIG9ggeC3mpTOaoV5ueznVQa2L9jzjUULSiMEg8viq1j59kNbRLv X-Received: by 10.68.135.33 with SMTP id pp1mr16069593pbb.120.1413950233498; Tue, 21 Oct 2014 20:57:13 -0700 (PDT) Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id nz1sm785819pdb.11.2014.10.21.20.57.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 21 Oct 2014 20:57:12 -0700 (PDT) Sender: Warner Losh From: Warner Losh X-Google-Original-From: Warner Losh Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273406 - head/share/mk In-Reply-To: <20141022000700.GA93912@troutmask.apl.washington.edu> Date: Tue, 21 Oct 2014 21:57:10 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: <0F22C339-BE2C-42ED-805C-559744F30684@gmail.com> References: <201410212000.s9LK0oQn061585@svn.freebsd.org> <20141022000700.GA93912@troutmask.apl.washington.edu> To: Steve Kargl X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, Baptiste Daroussin , src-committers , svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 04:04:28 -0000 On Oct 21, 2014, at 6:07 PM, Steve Kargl = wrote: > On Tue, Oct 21, 2014 at 08:00:50PM +0000, Baptiste Daroussin wrote: >> Author: bapt >> Date: Tue Oct 21 20:00:49 2014 >> New Revision: 273406 >> URL: https://svnweb.freebsd.org/changeset/base/273406 >>=20 >> Log: >> Always use libc++ as the default c++ stack when building with an = external gcc 4.8+ >> While here disable building gcc from base when using gcc 4.8+ >>=20 >> Reviewed by: imp >=20 >=20 > Are you sure that this works? There are some (well-known?) > incompatibilities between libc++ and libstdc++. By work, > I mean a resulting binary actually functions as expected. This is just for the build. And just to work around hard coded library = names in g++. The ABIs that are used turn out to be the same since all the headers are = from libc++ not libstdc++. Warner From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 04:16:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9838C58; Wed, 22 Oct 2014 04:16:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 964D4DBA; Wed, 22 Oct 2014 04:16:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M4GAN1098113; Wed, 22 Oct 2014 04:16:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M4GAJA098112; Wed, 22 Oct 2014 04:16:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410220416.s9M4GAJA098112@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 22 Oct 2014 04:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273452 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 04:16:10 -0000 Author: mjg Date: Wed Oct 22 04:16:09 2014 New Revision: 273452 URL: https://svnweb.freebsd.org/changeset/base/273452 Log: Plug unnecessary PRS_NEW check in kern_procctl. pfind does not return processes in such state. Modified: head/sys/kern/sys_process.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Wed Oct 22 04:09:47 2014 (r273451) +++ head/sys/kern/sys_process.c Wed Oct 22 04:16:09 2014 (r273452) @@ -1373,10 +1373,7 @@ kern_procctl(struct thread *td, idtype_t error = ESRCH; break; } - if (p->p_state == PRS_NEW) - error = ESRCH; - else - error = p_cansee(td, p); + error = p_cansee(td, p); if (error == 0) error = kern_procctl_single(td, p, com, data); PROC_UNLOCK(p); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 05:21:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B7CF21D; Wed, 22 Oct 2014 05:21:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CE5D3D7; Wed, 22 Oct 2014 05:21:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M5LbuR029340; Wed, 22 Oct 2014 05:21:37 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M5LbGK029337; Wed, 22 Oct 2014 05:21:37 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201410220521.s9M5LbGK029337@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Wed, 22 Oct 2014 05:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273453 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 05:21:38 -0000 Author: luigi Date: Wed Oct 22 05:21:36 2014 New Revision: 273453 URL: https://svnweb.freebsd.org/changeset/base/273453 Log: remove/fix old code for building ipfw and dummynet in userspace Modified: head/sys/netpfil/ipfw/ip_dn_io.c head/sys/netpfil/ipfw/ip_fw_private.h head/sys/netpfil/ipfw/ip_fw_sockopt.c Modified: head/sys/netpfil/ipfw/ip_dn_io.c ============================================================================== --- head/sys/netpfil/ipfw/ip_dn_io.c Wed Oct 22 04:16:09 2014 (r273452) +++ head/sys/netpfil/ipfw/ip_dn_io.c Wed Oct 22 05:21:36 2014 (r273453) @@ -283,7 +283,7 @@ mq_append(struct mq *q, struct mbuf *m) *m_new = *m; // copy m_new->m_flags &= ~M_STACK; m_new->__m_extbuf = p; // point to new buffer - pkt_copy(m->__m_extbuf, p, m->__m_extlen); + _pkt_copy(m->__m_extbuf, p, m->__m_extlen); m_new->m_data = p + ofs; m = m_new; } Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Wed Oct 22 04:16:09 2014 (r273452) +++ head/sys/netpfil/ipfw/ip_fw_private.h Wed Oct 22 05:21:36 2014 (r273453) @@ -354,29 +354,6 @@ struct ipfw_ifc { }; /* Macro for working with various counters */ -#ifdef USERSPACE -#define IPFW_INC_RULE_COUNTER(_cntr, _bytes) do { \ - (_cntr)->pcnt++; \ - (_cntr)->bcnt += _bytes; \ - (_cntr)->timestamp = time_uptime; \ - } while (0) - -#define IPFW_INC_DYN_COUNTER(_cntr, _bytes) do { \ - (_cntr)->pcnt++; \ - (_cntr)->bcnt += _bytes; \ - } while (0) - -#define IPFW_ZERO_RULE_COUNTER(_cntr) do { \ - (_cntr)->pcnt = 0; \ - (_cntr)->bcnt = 0; \ - (_cntr)->timestamp = 0; \ - } while (0) - -#define IPFW_ZERO_DYN_COUNTER(_cntr) do { \ - (_cntr)->pcnt = 0; \ - (_cntr)->bcnt = 0; \ - } while (0) -#else #define IPFW_INC_RULE_COUNTER(_cntr, _bytes) do { \ counter_u64_add((_cntr)->cntr, 1); \ counter_u64_add((_cntr)->cntr + 1, _bytes); \ @@ -399,7 +376,6 @@ struct ipfw_ifc { (_cntr)->pcnt = 0; \ (_cntr)->bcnt = 0; \ } while (0) -#endif #define TARG_VAL(ch, k, f) ((struct table_value *)((ch)->valuestate))[k].f #define IP_FW_ARG_TABLEARG(ch, a, f) \ Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Oct 22 04:16:09 2014 (r273452) +++ head/sys/netpfil/ipfw/ip_fw_sockopt.c Wed Oct 22 05:21:36 2014 (r273453) @@ -152,8 +152,6 @@ static struct ipfw_sopt_handler scodes[] * static variables followed by global ones */ -#ifndef USERSPACE - static VNET_DEFINE(uma_zone_t, ipfw_cntr_zone); #define V_ipfw_cntr_zone VNET(ipfw_cntr_zone) @@ -191,35 +189,6 @@ free_rule(struct ip_fw *rule) uma_zfree(V_ipfw_cntr_zone, rule->cntr); free(rule, M_IPFW); } -#else -void -ipfw_init_counters() -{ -} - -void -ipfw_destroy_counters() -{ -} - -struct ip_fw * -ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rulesize) -{ - struct ip_fw *rule; - - rule = malloc(rulesize, M_IPFW, M_WAITOK | M_ZERO); - - return (rule); -} - -static void -free_rule(struct ip_fw *rule) -{ - - free(rule, M_IPFW); -} - -#endif /* From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 06:53:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32162F02; Wed, 22 Oct 2014 06:53:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1ED30DB2; Wed, 22 Oct 2014 06:53:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M6rtnD072118; Wed, 22 Oct 2014 06:53:55 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M6rt7b072117; Wed, 22 Oct 2014 06:53:55 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410220653.s9M6rt7b072117@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Wed, 22 Oct 2014 06:53:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273454 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 06:53:56 -0000 Author: jmg Date: Wed Oct 22 06:53:55 2014 New Revision: 273454 URL: https://svnweb.freebsd.org/changeset/base/273454 Log: fix spelling of DEFAULT in comments... Modified: head/share/mk/bsd.mkopt.mk Modified: head/share/mk/bsd.mkopt.mk ============================================================================== --- head/share/mk/bsd.mkopt.mk Wed Oct 22 05:21:36 2014 (r273453) +++ head/share/mk/bsd.mkopt.mk Wed Oct 22 06:53:55 2014 (r273454) @@ -4,11 +4,11 @@ # Generic mechanism to deal with WITH and WITHOUT options and turn # them into MK_ options. # -# For each option FOO in __DEFUALT_YES_OPTIONS, MK_FOO is set to +# For each option FOO in __DEFAULT_YES_OPTIONS, MK_FOO is set to # "yes", unless WITHOUT_FOO is defined, in which case it is set to # "no". # -# For each option FOO in __DEFUALT_NO_OPTIONS, MK_FOO is set to "no", +# For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no", # unless WITH_FOO is defined, in which case it is set to "yes". # # If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 07:16:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A0C13CA; Wed, 22 Oct 2014 07:16:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45BA3F9F; Wed, 22 Oct 2014 07:16:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M7GlWN082134; Wed, 22 Oct 2014 07:16:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M7GleB082133; Wed, 22 Oct 2014 07:16:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410220716.s9M7GleB082133@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 22 Oct 2014 07:16:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273455 - head/sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 07:16:47 -0000 Author: hselasky Date: Wed Oct 22 07:16:46 2014 New Revision: 273455 URL: https://svnweb.freebsd.org/changeset/base/273455 Log: Allow overspecification of SYSCTL type in external kernel modules. PR: 194523 MFC after: 3 days Modified: head/sys/sys/sysctl.h Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Wed Oct 22 06:53:55 2014 (r273454) +++ head/sys/sys/sysctl.h Wed Oct 22 07:16:46 2014 (r273455) @@ -123,6 +123,13 @@ struct ctlname { #ifdef _KERNEL #include +#ifdef KLD_MODULE +/* XXX allow overspecification of type in external kernel modules */ +#define SYSCTL_CT_ASSERT_MASK CTLTYPE +#else +#define SYSCTL_CT_ASSERT_MASK 0 +#endif + #define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \ intptr_t arg2, struct sysctl_req *req @@ -268,24 +275,28 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID_RAW(sysctl___##name, &sysctl__children, \ nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \ handler, "N", descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) /* This constructs a node from which other oids can hang. */ #define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \ SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE) #define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \ ({ \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", __DESCR(descr)); \ }) #define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \ ({ \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \ sysctl_add_oid(ctx, &sysctl__children, nbr, name, \ CTLTYPE_NODE|(access), \ NULL, 0, handler, "N", __DESCR(descr)); \ @@ -295,12 +306,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ arg, len, sysctl_handle_string, "A", descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING) #define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \ ({ \ char *__arg = (arg); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ __arg, len, sysctl_handle_string, "A", __DESCR(descr)); \ }) @@ -311,13 +324,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_int, "I", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ CTASSERT(sizeof(int) == sizeof(*(ptr))) #define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ int *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_int, "I", __DESCR(descr)); \ @@ -329,13 +344,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_int, "IU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT);\ CTASSERT(sizeof(unsigned) == sizeof(*(ptr))) #define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \ ({ \ unsigned *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \ __ptr, val, sysctl_handle_int, "IU", __DESCR(descr)); \ @@ -347,13 +364,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_long, "L", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG);\ CTASSERT(sizeof(long) == sizeof(*(ptr))) #define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ long *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_long, "L", __DESCR(descr)); \ @@ -365,13 +384,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_long, "LU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \ CTASSERT(sizeof(unsigned long) == sizeof(*(ptr))) #define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ unsigned long *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)); \ @@ -383,13 +404,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "Q", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ CTASSERT(sizeof(int64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ int64_t *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr)); \ @@ -400,13 +423,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ ptr, val, sysctl_handle_64, "QU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ CTASSERT(sizeof(uint64_t) == sizeof(*(ptr))) #define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ uint64_t *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr)); \ @@ -438,14 +463,16 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ CTASSERT(sizeof(counter_u64_t) == sizeof(*(ptr))); \ CTASSERT(sizeof(uint64_t) == sizeof(**(ptr))) #define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ counter_u64_t *__ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \ @@ -455,11 +482,13 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e #define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \ SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ ptr, len, sysctl_handle_opaque, fmt, descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) #define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr) \ ({ \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)); \ }) @@ -469,11 +498,13 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \ ptr, sizeof(struct type), sysctl_handle_opaque, \ "S," #type, descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) #define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \ ({ \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \ (ptr), sizeof(struct type), \ sysctl_handle_opaque, "S," #type, __DESCR(descr)); \ @@ -497,12 +528,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ (ptr), 0, sysctl_handle_uma_zone_max, "I", descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) #define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ - uma_zone_t __ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + uma_zone_t __ptr = (ptr); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \ __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr)); \ @@ -513,12 +546,14 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e SYSCTL_OID(parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ (ptr), 0, sysctl_handle_uma_zone_cur, "I", descr); \ - CTASSERT(((access) & CTLTYPE) == 0) + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) #define SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr) \ ({ \ uma_zone_t __ptr = (ptr); \ - CTASSERT(((access) & CTLTYPE) == 0); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \ sysctl_add_oid(ctx, parent, nbr, name, \ CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \ __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr)); \ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 07:50:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B05EECFC; Wed, 22 Oct 2014 07:50:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9D096364; Wed, 22 Oct 2014 07:50:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M7oKGS097488; Wed, 22 Oct 2014 07:50:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M7oKDw097487; Wed, 22 Oct 2014 07:50:20 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410220750.s9M7oKDw097487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 22 Oct 2014 07:50:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273456 - head/sys/dev/usb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 07:50:20 -0000 Author: hselasky Date: Wed Oct 22 07:50:19 2014 New Revision: 273456 URL: https://svnweb.freebsd.org/changeset/base/273456 Log: Actually change the USB_PORT_ROOT_RESET_DELAY definition as stated in the r241987 commit message, instead of having users locally overriding the value using tunables in /boot/loader.conf . Found by: Adam Parco Discussed with: Nick Hibma Modified: head/sys/dev/usb/usb.h Modified: head/sys/dev/usb/usb.h ============================================================================== --- head/sys/dev/usb/usb.h Wed Oct 22 07:16:46 2014 (r273455) +++ head/sys/dev/usb/usb.h Wed Oct 22 07:50:19 2014 (r273456) @@ -113,7 +113,7 @@ MALLOC_DECLARE(M_USBHC); /* Allow for marginal and non-conforming devices. */ #define USB_PORT_RESET_DELAY 50 /* ms */ -#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */ +#define USB_PORT_ROOT_RESET_DELAY 200 /* ms */ #define USB_PORT_RESET_RECOVERY 250 /* ms */ #define USB_PORT_POWERUP_DELAY 300 /* ms */ #define USB_PORT_RESUME_DELAY (20*2) /* ms */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 07:51:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BBA56E5D; Wed, 22 Oct 2014 07:51:38 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48A085F0; Wed, 22 Oct 2014 07:51:38 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9M7pWvW087002 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Oct 2014 10:51:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9M7pWvW087002 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9M7pVku087001; Wed, 22 Oct 2014 10:51:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 22 Oct 2014 10:51:31 +0300 From: Konstantin Belousov To: Mateusz Guzik Subject: Re: svn commit: r273441 - in head/sys: kern sys Message-ID: <20141022075131.GG1877@kib.kiev.ua> References: <201410220023.s9M0NiBX089974@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410220023.s9M0NiBX089974@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 07:51:38 -0000 On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote: > Author: mjg > Date: Wed Oct 22 00:23:43 2014 > New Revision: 273441 > URL: https://svnweb.freebsd.org/changeset/base/273441 > > Log: > filedesc: cleanup setugidsafety a little > > Rename it to fdsetugidsafety for consistency with other functions. > > There is no need to take filedesc lock if not closing any files. > > The loop has to verify each file and we are guaranteed fdtable has space > for at least 20 fds. As such there is no need to check fd_lastfile. ^^^^^^^^^^^^^^^^^^^^^^^^ * > > While here tidy up is_unsafe. > > Modified: > head/sys/kern/kern_descrip.c > head/sys/kern/kern_exec.c > head/sys/sys/filedesc.h > > Modified: head/sys/kern/kern_descrip.c > ============================================================================== > --- head/sys/kern/kern_descrip.c Tue Oct 21 23:57:31 2014 (r273440) > +++ head/sys/kern/kern_descrip.c Wed Oct 22 00:23:43 2014 (r273441) > @@ -2078,23 +2078,23 @@ fdescfree(struct thread *td) > * Since setugidsafety calls this only for fd 0, 1 and 2, this check is > * sufficient. We also don't check for setugidness since we know we are. > */ > -static int > +static bool > is_unsafe(struct file *fp) > { > - if (fp->f_type == DTYPE_VNODE) { > - struct vnode *vp = fp->f_vnode; > + struct vnode *vp; > > - if ((vp->v_vflag & VV_PROCDEP) != 0) > - return (1); > - } > - return (0); > + if (fp->f_type != DTYPE_VNODE) > + return (false); > + > + vp = fp->f_vnode; > + return ((vp->v_vflag & VV_PROCDEP) != 0); > } > > /* > * Make this setguid thing safe, if at all possible. > */ > void > -setugidsafety(struct thread *td) > +fdsetugidsafety(struct thread *td) > { > struct filedesc *fdp; > struct file *fp; > @@ -2102,12 +2102,10 @@ setugidsafety(struct thread *td) > > fdp = td->td_proc->p_fd; > KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared")); > - FILEDESC_XLOCK(fdp); > - for (i = 0; i <= fdp->fd_lastfile; i++) { > - if (i > 2) > - break; > + for (i = 0; i <= 2; i++) { [*] This requires an assert. > fp = fdp->fd_ofiles[i].fde_file; > if (fp != NULL && is_unsafe(fp)) { > + FILEDESC_XLOCK(fdp); > knote_fdclose(td, i); > /* > * NULL-out descriptor prior to close to avoid From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 08:26:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id ADBBD77F; Wed, 22 Oct 2014 08:26:28 +0000 (UTC) Received: from mail-wi0-x236.google.com (mail-wi0-x236.google.com [IPv6:2a00:1450:400c:c05::236]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C03779DF; Wed, 22 Oct 2014 08:26:27 +0000 (UTC) Received: by mail-wi0-f182.google.com with SMTP id bs8so615336wib.15 for ; Wed, 22 Oct 2014 01:26:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=dRixs16r4CTRcqYSSFqe3Zms82+v2/8ly47PwkAxYYQ=; b=K6GHpcag/TOVzbNjyHccSoyge1t6ZvLFZbh6waqoTQ4H+tDq1k9ReXAAUWAw76d8xB +zoWGeLKV+VZGKlSK43YLKcW7D8N/+K+b4WYZwtbV+vE7AUlhuQqplyaX69IXMW3kfEz 2DrA/7M0bdO0S/KcQkXrI8yShMZrlk/C+06gpfUrz9W9TEtviqMlkCzmJm5LqT6mSJs3 wFsXV/tu8WqbGALEAoz2YHyJL8utV7RzLY0MLOilCdUmS8i90crZTBE5i/p1NDIplavT v61X9Eaxqeo2vHjPgLQjOaRV9TBbldK3ZecfiObKnq4gGZR2ZjxcPZltpfAquQfGlVEJ ZziQ== X-Received: by 10.194.76.70 with SMTP id i6mr49953380wjw.13.1413966385112; Wed, 22 Oct 2014 01:26:25 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id bi7sm1055877wib.17.2014.10.22.01.26.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 22 Oct 2014 01:26:24 -0700 (PDT) Date: Wed, 22 Oct 2014 10:26:21 +0200 From: Mateusz Guzik To: Konstantin Belousov Subject: Re: svn commit: r273441 - in head/sys: kern sys Message-ID: <20141022082621.GB4393@dft-labs.eu> References: <201410220023.s9M0NiBX089974@svn.freebsd.org> <20141022075131.GG1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20141022075131.GG1877@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 08:26:28 -0000 On Wed, Oct 22, 2014 at 10:51:31AM +0300, Konstantin Belousov wrote: > On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote: > > Author: mjg > > Date: Wed Oct 22 00:23:43 2014 > > New Revision: 273441 > > URL: https://svnweb.freebsd.org/changeset/base/273441 > > > > Log: > > filedesc: cleanup setugidsafety a little > > > > Rename it to fdsetugidsafety for consistency with other functions. > > > > There is no need to take filedesc lock if not closing any files. > > > > The loop has to verify each file and we are guaranteed fdtable has space > > for at least 20 fds. As such there is no need to check fd_lastfile. > ^^^^^^^^^^^^^^^^^^^^^^^^ * > [..] > > fdp = td->td_proc->p_fd; > > KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared")); > > - FILEDESC_XLOCK(fdp); > > - for (i = 0; i <= fdp->fd_lastfile; i++) { > > - if (i > 2) > > - break; > > + for (i = 0; i <= 2; i++) { > [*] This requires an assert. > I was considering adding one, but failed to come up with anything good. Ideally we would compile-time assert that NDFILE is at least 3, but that seems weirdly circumventable by sufficient accident. MPASS(fdp->fd_nfiles > 3) does not guarantee we wont run into trouble, has a potential to help. Any suggestions? -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 08:41:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 47DC6C1C; Wed, 22 Oct 2014 08:41:44 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD40EB77; Wed, 22 Oct 2014 08:41:43 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9M8fcYp002654 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 22 Oct 2014 11:41:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9M8fcYp002654 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9M8fca1002653; Wed, 22 Oct 2014 11:41:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 22 Oct 2014 11:41:38 +0300 From: Konstantin Belousov To: Mateusz Guzik Subject: Re: svn commit: r273441 - in head/sys: kern sys Message-ID: <20141022084138.GI1877@kib.kiev.ua> References: <201410220023.s9M0NiBX089974@svn.freebsd.org> <20141022075131.GG1877@kib.kiev.ua> <20141022082621.GB4393@dft-labs.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20141022082621.GB4393@dft-labs.eu> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 08:41:44 -0000 On Wed, Oct 22, 2014 at 10:26:21AM +0200, Mateusz Guzik wrote: > On Wed, Oct 22, 2014 at 10:51:31AM +0300, Konstantin Belousov wrote: > > On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote: > > > Author: mjg > > > Date: Wed Oct 22 00:23:43 2014 > > > New Revision: 273441 > > > URL: https://svnweb.freebsd.org/changeset/base/273441 > > > > > > Log: > > > filedesc: cleanup setugidsafety a little > > > > > > Rename it to fdsetugidsafety for consistency with other functions. > > > > > > There is no need to take filedesc lock if not closing any files. > > > > > > The loop has to verify each file and we are guaranteed fdtable has space > > > for at least 20 fds. As such there is no need to check fd_lastfile. > > ^^^^^^^^^^^^^^^^^^^^^^^^ * > > > [..] > > > fdp = td->td_proc->p_fd; > > > KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared")); > > > - FILEDESC_XLOCK(fdp); > > > - for (i = 0; i <= fdp->fd_lastfile; i++) { > > > - if (i > 2) > > > - break; > > > + for (i = 0; i <= 2; i++) { > > [*] This requires an assert. > > > > I was considering adding one, but failed to come up with anything good. > > Ideally we would compile-time assert that NDFILE is at least 3, but that > seems weirdly circumventable by sufficient accident. > > MPASS(fdp->fd_nfiles > 3) does not guarantee we wont run into trouble, > has a potential to help. What troubles do you mean ? Also, why > 3, and not >= 3 ? Old code used fd_lastfile, which, for purpose of the assert, is also fine. From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 08:54:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E4F6F08; Wed, 22 Oct 2014 08:54:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 71311D4D; Wed, 22 Oct 2014 08:54:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M8sBTI028913; Wed, 22 Oct 2014 08:54:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M8sBXx028911; Wed, 22 Oct 2014 08:54:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410220854.s9M8sBXx028911@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 22 Oct 2014 08:54:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273457 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 08:54:11 -0000 Author: mav Date: Wed Oct 22 08:54:10 2014 New Revision: 273457 URL: https://svnweb.freebsd.org/changeset/base/273457 Log: Document sort_io_queue sysctls/tunables. MFC after: 1 week Modified: head/share/man/man4/ada.4 head/share/man/man4/da.4 Modified: head/share/man/man4/ada.4 ============================================================================== --- head/share/man/man4/ada.4 Wed Oct 22 07:50:19 2014 (r273456) +++ head/share/man/man4/ada.4 Wed Oct 22 08:54:10 2014 (r273457) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 21, 2014 +.Dd October 22, 2014 .Dt ADA 4 .Os .Sh NAME @@ -123,6 +123,13 @@ seconds. This variable determines whether to spin-down disks when shutting down. Set to 1 to enable spin-down, 0 to disable. The default is currently enabled. +.It Va kern.cam.sort_io_queue +.It Va kern.cam.ada. Ns Ar X Ns Va .sort_io_queue +.Pp +These variables determine whether request queue should be sorted trying +to optimize head seeks. +Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is. +The default is sorting enabled for HDDs and disabled SSDs. .It Va kern.cam.ada.read_ahead .It Va kern.cam.ada. Ns Ar X Ns Va .read_ahead .It Va kern.cam.ada.write_cache Modified: head/share/man/man4/da.4 ============================================================================== --- head/share/man/man4/da.4 Wed Oct 22 07:50:19 2014 (r273456) +++ head/share/man/man4/da.4 Wed Oct 22 08:54:10 2014 (r273457) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 8, 2012 +.Dd October 22, 2014 .Dt DA 4 .Os .Sh NAME @@ -150,6 +150,13 @@ This variable determines how long the driver will wait before timing out an outstanding command. The units for this value are seconds, and the default is currently 60 seconds. +.It Va kern.cam.sort_io_queue +.It Va kern.cam.da. Ns Ar X Ns Va .sort_io_queue +.Pp +These variables determine whether request queue should be sorted trying +to optimize head seeks. +Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is. +The default is sorting enabled for HDDs and disabled for SSDs. .It kern.cam.da.%d.minimum_cmd_size .Pp This variable determines what the minimum READ/WRITE CDB size is for a From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 08:56:58 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3C1E1303; Wed, 22 Oct 2014 08:56:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29368D8D; Wed, 22 Oct 2014 08:56:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M8uwQC029560; Wed, 22 Oct 2014 08:56:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M8uwqI029559; Wed, 22 Oct 2014 08:56:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410220856.s9M8uwqI029559@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 22 Oct 2014 08:56:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273458 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 08:56:58 -0000 Author: mjg Date: Wed Oct 22 08:56:57 2014 New Revision: 273458 URL: https://svnweb.freebsd.org/changeset/base/273458 Log: filedesc assert that table size is at least 3 in fdsetugidsafety Requested by: kib Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Oct 22 08:54:10 2014 (r273457) +++ head/sys/kern/kern_descrip.c Wed Oct 22 08:56:57 2014 (r273458) @@ -2102,6 +2102,7 @@ fdsetugidsafety(struct thread *td) fdp = td->td_proc->p_fd; KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared")); + MPASS(fdp->fd_nfiles >= 3); for (i = 0; i <= 2; i++) { fp = fdp->fd_ofiles[i].fde_file; if (fp != NULL && is_unsafe(fp)) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 08:58:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A68FA4C7; Wed, 22 Oct 2014 08:58:28 +0000 (UTC) Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [IPv6:2a00:1450:400c:c00::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C23DBDB5; Wed, 22 Oct 2014 08:58:27 +0000 (UTC) Received: by mail-wg0-f44.google.com with SMTP id y10so3156071wgg.27 for ; Wed, 22 Oct 2014 01:58:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=DOX3P5uD40Taj1iZ9KXr+TMZ2hOfO02rwENraiQWRr0=; b=NPGmGAShXbEDknhyHDqippbxxzvryWpnmkT+476SYVZicosYiTF0hs12CDNjT6gAHR dsNdEQqY5nN4bH9LNbHWrDlfAH3I2JHKyhLmhDIKffwdspO32SHipDp+xCayT2KPO6vk GnCqLXAdoegytz3sOygVi0mXg2HRySm7rXbLo4LHXAB32E96XQINSxC+Roxpsv/3RhH/ DHHtD/xy7Heg2bnM6kCI+y+swDzMpJukLPSHjwpjya3HuT2c4KEpGoVnKWUohu2OEIXT hi1FMNP4wl/n3z5+MP6jbIH6ox8+i3+IFO7ysPctTTfY+Ydl4w0DLeU9k3fW0GBvP119 FD2A== X-Received: by 10.180.88.68 with SMTP id be4mr4125727wib.36.1413968305812; Wed, 22 Oct 2014 01:58:25 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id j20sm11947570wjn.0.2014.10.22.01.58.24 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 22 Oct 2014 01:58:25 -0700 (PDT) Date: Wed, 22 Oct 2014 10:58:21 +0200 From: Mateusz Guzik To: Konstantin Belousov Subject: Re: svn commit: r273441 - in head/sys: kern sys Message-ID: <20141022085821.GC4393@dft-labs.eu> References: <201410220023.s9M0NiBX089974@svn.freebsd.org> <20141022075131.GG1877@kib.kiev.ua> <20141022082621.GB4393@dft-labs.eu> <20141022084138.GI1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20141022084138.GI1877@kib.kiev.ua> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 08:58:28 -0000 On Wed, Oct 22, 2014 at 11:41:38AM +0300, Konstantin Belousov wrote: > On Wed, Oct 22, 2014 at 10:26:21AM +0200, Mateusz Guzik wrote: > > On Wed, Oct 22, 2014 at 10:51:31AM +0300, Konstantin Belousov wrote: > > > On Wed, Oct 22, 2014 at 12:23:44AM +0000, Mateusz Guzik wrote: > > > > Author: mjg > > > > Date: Wed Oct 22 00:23:43 2014 > > > > New Revision: 273441 > > > > URL: https://svnweb.freebsd.org/changeset/base/273441 > > > > > > > > Log: > > > > filedesc: cleanup setugidsafety a little > > > > > > > > Rename it to fdsetugidsafety for consistency with other functions. > > > > > > > > There is no need to take filedesc lock if not closing any files. > > > > > > > > The loop has to verify each file and we are guaranteed fdtable has space > > > > for at least 20 fds. As such there is no need to check fd_lastfile. > > > ^^^^^^^^^^^^^^^^^^^^^^^^ * > > > > > [..] > > > > fdp = td->td_proc->p_fd; > > > > KASSERT(fdp->fd_refcnt == 1, ("the fdtable should not be shared")); > > > > - FILEDESC_XLOCK(fdp); > > > > - for (i = 0; i <= fdp->fd_lastfile; i++) { > > > > - if (i > 2) > > > > - break; > > > > + for (i = 0; i <= 2; i++) { > > > [*] This requires an assert. > > > > > > > I was considering adding one, but failed to come up with anything good. > > > > Ideally we would compile-time assert that NDFILE is at least 3, but that > > seems weirdly circumventable by sufficient accident. > > > > MPASS(fdp->fd_nfiles > 3) does not guarantee we wont run into trouble, > > has a potential to help. > What troubles do you mean ? Also, why > 3, and not >= 3 ? Oops, yeah, that should have been >= 3. I mean this kind of assertion is standard "will catch offenders, if they happen to execute it" as opposed to making sure such offenders are not possible to exist in the first place. I committed this MAPSS, if I come up with something better I'll update the code. > Old code used fd_lastfile, which, for purpose of the assert, is also > fine. fd_lastfile denotes the biggest fd currently in use, so it cannot be used in an assertion. -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 08:59:25 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B7E5C61D; Wed, 22 Oct 2014 08:59:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A2EAADC8; Wed, 22 Oct 2014 08:59:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M8xPg3029905; Wed, 22 Oct 2014 08:59:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M8xOBO029895; Wed, 22 Oct 2014 08:59:24 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410220859.s9M8xOBO029895@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 08:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273459 - in head/usr.sbin: ctld iscsid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 08:59:25 -0000 Author: trasz Date: Wed Oct 22 08:59:23 2014 New Revision: 273459 URL: https://svnweb.freebsd.org/changeset/base/273459 Log: Untangle iSCSI authentication code by splitting off the CHAP implementation. Reviewed by: mav@ MFC after: 1 month Sponsored by: The FreeBSD Foundation Added: head/usr.sbin/ctld/chap.c (contents, props changed) head/usr.sbin/iscsid/chap.c (contents, props changed) Modified: head/usr.sbin/ctld/Makefile head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/login.c head/usr.sbin/iscsid/Makefile head/usr.sbin/iscsid/iscsid.h head/usr.sbin/iscsid/login.c Modified: head/usr.sbin/ctld/Makefile ============================================================================== --- head/usr.sbin/ctld/Makefile Wed Oct 22 08:56:57 2014 (r273458) +++ head/usr.sbin/ctld/Makefile Wed Oct 22 08:59:23 2014 (r273459) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= ctld -SRCS= ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h +SRCS= chap.c ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../sys/cam/ctl Added: head/usr.sbin/ctld/chap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ctld/chap.c Wed Oct 22 08:59:23 2014 (r273459) @@ -0,0 +1,386 @@ +/*- + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "ctld.h" + +static void +chap_compute_md5(const char id, const char *secret, + const void *challenge, size_t challenge_len, void *response, + size_t response_len) +{ + MD5_CTX ctx; + int rv; + + assert(response_len == MD5_DIGEST_LENGTH); + + MD5_Init(&ctx); + MD5_Update(&ctx, &id, sizeof(id)); + MD5_Update(&ctx, secret, strlen(secret)); + MD5_Update(&ctx, challenge, challenge_len); + rv = MD5_Final(response, &ctx); + if (rv != 1) + log_errx(1, "MD5_Final"); +} + +static int +chap_hex2int(const char hex) +{ + switch (hex) { + case '0': + return (0x00); + case '1': + return (0x01); + case '2': + return (0x02); + case '3': + return (0x03); + case '4': + return (0x04); + case '5': + return (0x05); + case '6': + return (0x06); + case '7': + return (0x07); + case '8': + return (0x08); + case '9': + return (0x09); + case 'a': + case 'A': + return (0x0a); + case 'b': + case 'B': + return (0x0b); + case 'c': + case 'C': + return (0x0c); + case 'd': + case 'D': + return (0x0d); + case 'e': + case 'E': + return (0x0e); + case 'f': + case 'F': + return (0x0f); + default: + return (-1); + } +} + +/* + * XXX: Review this _carefully_. + */ +static int +chap_hex2bin(const char *hex, void **binp, size_t *bin_lenp) +{ + int i, hex_len, nibble; + bool lo = true; /* As opposed to 'hi'. */ + char *bin; + size_t bin_off, bin_len; + + if (strncasecmp(hex, "0x", strlen("0x")) != 0) { + log_warnx("malformed variable, should start with \"0x\""); + return (-1); + } + + hex += strlen("0x"); + hex_len = strlen(hex); + if (hex_len < 1) { + log_warnx("malformed variable; doesn't contain anything " + "but \"0x\""); + return (-1); + } + + bin_len = hex_len / 2 + hex_len % 2; + bin = calloc(bin_len, 1); + if (bin == NULL) + log_err(1, "calloc"); + + bin_off = bin_len - 1; + for (i = hex_len - 1; i >= 0; i--) { + nibble = chap_hex2int(hex[i]); + if (nibble < 0) { + log_warnx("malformed variable, invalid char \"%c\"", + hex[i]); + free(bin); + return (-1); + } + + assert(bin_off < bin_len); + if (lo) { + bin[bin_off] = nibble; + lo = false; + } else { + bin[bin_off] |= nibble << 4; + bin_off--; + lo = true; + } + } + + *binp = bin; + *bin_lenp = bin_len; + return (0); +} + +static char * +chap_bin2hex(const char *bin, size_t bin_len) +{ + unsigned char *hex, *tmp, ch; + size_t hex_len; + size_t i; + + hex_len = bin_len * 2 + 3; /* +2 for "0x", +1 for '\0'. */ + hex = malloc(hex_len); + if (hex == NULL) + log_err(1, "malloc"); + + tmp = hex; + tmp += sprintf(tmp, "0x"); + for (i = 0; i < bin_len; i++) { + ch = bin[i]; + tmp += sprintf(tmp, "%02x", ch); + } + + return (hex); +} + +struct chap * +chap_new(void) +{ + struct chap *chap; + int rv; + + chap = calloc(sizeof(*chap), 1); + if (chap == NULL) + log_err(1, "calloc"); + + /* + * Generate the challenge. + */ + rv = RAND_bytes(chap->chap_challenge, sizeof(chap->chap_challenge)); + if (rv != 1) { + log_errx(1, "RAND_bytes failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + } + rv = RAND_bytes(&chap->chap_id, sizeof(chap->chap_id)); + if (rv != 1) { + log_errx(1, "RAND_bytes failed: %s", + ERR_error_string(ERR_get_error(), NULL)); + } + + return (chap); +} + +char * +chap_get_id(const struct chap *chap) +{ + char *chap_i; + int ret; + + ret = asprintf(&chap_i, "%d", chap->chap_id); + if (ret < 0) + log_err(1, "asprintf"); + + return (chap_i); +} + +char * +chap_get_challenge(const struct chap *chap) +{ + char *chap_c; + + chap_c = chap_bin2hex(chap->chap_challenge, + sizeof(chap->chap_challenge)); + + return (chap_c); +} + +static int +chap_receive_bin(struct chap *chap, void *response, size_t response_len) +{ + + if (response_len != sizeof(chap->chap_response)) { + log_debugx("got CHAP response with invalid length; " + "got %zd, should be %zd", + response_len, sizeof(chap->chap_response)); + return (1); + } + + memcpy(chap->chap_response, response, response_len); + return (0); +} + +int +chap_receive(struct chap *chap, const char *response) +{ + void *response_bin; + size_t response_bin_len; + int error; + + error = chap_hex2bin(response, &response_bin, &response_bin_len); + if (error != 0) { + log_debugx("got incorrectly encoded CHAP response \"%s\"", + response); + return (1); + } + + error = chap_receive_bin(chap, response_bin, response_bin_len); + free(response_bin); + + return (error); +} + +int +chap_authenticate(struct chap *chap, const char *secret) +{ + char expected_response[MD5_DIGEST_LENGTH]; + + chap_compute_md5(chap->chap_id, secret, + chap->chap_challenge, sizeof(chap->chap_challenge), + expected_response, sizeof(expected_response)); + + if (memcmp(chap->chap_response, + expected_response, sizeof(expected_response)) != 0) { + return (-1); + } + + return (0); +} + +void +chap_delete(struct chap *chap) +{ + + free(chap); +} + +struct rchap * +rchap_new(const char *secret) +{ + struct rchap *rchap; + + rchap = calloc(sizeof(*rchap), 1); + if (rchap == NULL) + log_err(1, "calloc"); + + rchap->rchap_secret = checked_strdup(secret); + + return (rchap); +} + +static void +rchap_receive_bin(struct rchap *rchap, const unsigned char id, + const void *challenge, size_t challenge_len) +{ + + rchap->rchap_id = id; + rchap->rchap_challenge = calloc(challenge_len, 1); + if (rchap->rchap_challenge == NULL) + log_err(1, "calloc"); + memcpy(rchap->rchap_challenge, challenge, challenge_len); + rchap->rchap_challenge_len = challenge_len; +} + +int +rchap_receive(struct rchap *rchap, const char *id, const char *challenge) +{ + unsigned char id_bin; + void *challenge_bin; + size_t challenge_bin_len; + + int error; + + id_bin = strtoul(id, NULL, 10); + + error = chap_hex2bin(challenge, &challenge_bin, &challenge_bin_len); + if (error != 0) { + log_debugx("got incorrectly encoded CHAP challenge \"%s\"", + challenge); + return (1); + } + + rchap_receive_bin(rchap, id_bin, challenge_bin, challenge_bin_len); + free(challenge_bin); + + return (0); +} + +static void +rchap_get_response_bin(struct rchap *rchap, + void **responsep, size_t *response_lenp) +{ + void *response_bin; + size_t response_bin_len = MD5_DIGEST_LENGTH; + + response_bin = calloc(response_bin_len, 1); + if (response_bin == NULL) + log_err(1, "calloc"); + + chap_compute_md5(rchap->rchap_id, rchap->rchap_secret, + rchap->rchap_challenge, rchap->rchap_challenge_len, + response_bin, response_bin_len); + + *responsep = response_bin; + *response_lenp = response_bin_len; +} + +char * +rchap_get_response(struct rchap *rchap) +{ + void *response; + size_t response_len; + char *chap_r; + + rchap_get_response_bin(rchap, &response, &response_len); + chap_r = chap_bin2hex(response, response_len); + free(response); + + return (chap_r); +} + +void +rchap_delete(struct rchap *rchap) +{ + + free(rchap->rchap_secret); + free(rchap->rchap_challenge); + free(rchap); +} Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Wed Oct 22 08:56:57 2014 (r273458) +++ head/usr.sbin/ctld/ctld.h Wed Oct 22 08:59:23 2014 (r273459) @@ -39,6 +39,7 @@ #include #include #include +#include #define DEFAULT_CONFIG_PATH "/etc/ctl.conf" #define DEFAULT_PIDFILE "/var/run/ctld.pid" @@ -207,6 +208,35 @@ struct keys { size_t keys_data_len; }; +#define CHAP_CHALLENGE_LEN 1024 + +struct chap { + unsigned char chap_id; + char chap_challenge[CHAP_CHALLENGE_LEN]; + char chap_response[MD5_DIGEST_LENGTH]; +}; + +struct rchap { + char *rchap_secret; + unsigned char rchap_id; + void *rchap_challenge; + size_t rchap_challenge_len; +}; + +struct chap *chap_new(void); +char *chap_get_id(const struct chap *chap); +char *chap_get_challenge(const struct chap *chap); +int chap_receive(struct chap *chap, const char *response); +int chap_authenticate(struct chap *chap, + const char *secret); +void chap_delete(struct chap *chap); + +struct rchap *rchap_new(const char *secret); +int rchap_receive(struct rchap *rchap, + const char *id, const char *challenge); +char *rchap_get_response(struct rchap *rchap); +void rchap_delete(struct rchap *rchap); + struct conf *conf_new(void); struct conf *conf_new_from_file(const char *path); struct conf *conf_new_from_kernel(void); Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Wed Oct 22 08:56:57 2014 (r273458) +++ head/usr.sbin/ctld/login.c Wed Oct 22 08:59:23 2014 (r273459) @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include -#include #include "ctld.h" #include "iscsi_proto.h" @@ -229,150 +226,6 @@ login_list_prefers(const char *list, return (-1); } -static int -login_hex2int(const char hex) -{ - switch (hex) { - case '0': - return (0x00); - case '1': - return (0x01); - case '2': - return (0x02); - case '3': - return (0x03); - case '4': - return (0x04); - case '5': - return (0x05); - case '6': - return (0x06); - case '7': - return (0x07); - case '8': - return (0x08); - case '9': - return (0x09); - case 'a': - case 'A': - return (0x0a); - case 'b': - case 'B': - return (0x0b); - case 'c': - case 'C': - return (0x0c); - case 'd': - case 'D': - return (0x0d); - case 'e': - case 'E': - return (0x0e); - case 'f': - case 'F': - return (0x0f); - default: - return (-1); - } -} - -/* - * XXX: Review this _carefully_. - */ -static int -login_hex2bin(const char *hex, char **binp, size_t *bin_lenp) -{ - int i, hex_len, nibble; - bool lo = true; /* As opposed to 'hi'. */ - char *bin; - size_t bin_off, bin_len; - - if (strncasecmp(hex, "0x", strlen("0x")) != 0) { - log_warnx("malformed variable, should start with \"0x\""); - return (-1); - } - - hex += strlen("0x"); - hex_len = strlen(hex); - if (hex_len < 1) { - log_warnx("malformed variable; doesn't contain anything " - "but \"0x\""); - return (-1); - } - - bin_len = hex_len / 2 + hex_len % 2; - bin = calloc(bin_len, 1); - if (bin == NULL) - log_err(1, "calloc"); - - bin_off = bin_len - 1; - for (i = hex_len - 1; i >= 0; i--) { - nibble = login_hex2int(hex[i]); - if (nibble < 0) { - log_warnx("malformed variable, invalid char \"%c\"", - hex[i]); - return (-1); - } - - assert(bin_off < bin_len); - if (lo) { - bin[bin_off] = nibble; - lo = false; - } else { - bin[bin_off] |= nibble << 4; - bin_off--; - lo = true; - } - } - - *binp = bin; - *bin_lenp = bin_len; - return (0); -} - -static char * -login_bin2hex(const char *bin, size_t bin_len) -{ - unsigned char *hex, *tmp, ch; - size_t hex_len; - size_t i; - - hex_len = bin_len * 2 + 3; /* +2 for "0x", +1 for '\0'. */ - hex = malloc(hex_len); - if (hex == NULL) - log_err(1, "malloc"); - - tmp = hex; - tmp += sprintf(tmp, "0x"); - for (i = 0; i < bin_len; i++) { - ch = bin[i]; - tmp += sprintf(tmp, "%02x", ch); - } - - return (hex); -} - -static void -login_compute_md5(const char id, const char *secret, - const void *challenge, size_t challenge_len, void *response, - size_t response_len) -{ - MD5_CTX ctx; - int rv; - - assert(response_len == MD5_DIGEST_LENGTH); - - MD5_Init(&ctx); - MD5_Update(&ctx, &id, sizeof(id)); - MD5_Update(&ctx, secret, strlen(secret)); - MD5_Update(&ctx, challenge, challenge_len); - rv = MD5_Final(response, &ctx); - if (rv != 1) - log_errx(1, "MD5_Final"); -} - -#define LOGIN_CHALLENGE_LEN 1024 - static struct pdu * login_receive_chap_a(struct connection *conn) { @@ -400,21 +253,21 @@ login_receive_chap_a(struct connection * } static void -login_send_chap_c(struct pdu *request, const unsigned char id, - const void *challenge, const size_t challenge_len) +login_send_chap_c(struct pdu *request, struct chap *chap) { struct pdu *response; struct keys *response_keys; - char *chap_c, chap_i[4]; + char *chap_c, *chap_i; - chap_c = login_bin2hex(challenge, challenge_len); - snprintf(chap_i, sizeof(chap_i), "%d", id); + chap_c = chap_get_challenge(chap); + chap_i = chap_get_id(chap); response = login_new_response(request); response_keys = keys_new(); keys_add(response_keys, "CHAP_A", "5"); keys_add(response_keys, "CHAP_I", chap_i); keys_add(response_keys, "CHAP_C", chap_c); + free(chap_i); free(chap_c); keys_save(response_keys, response); pdu_send(response); @@ -423,15 +276,12 @@ login_send_chap_c(struct pdu *request, c } static struct pdu * -login_receive_chap_r(struct connection *conn, - struct auth_group *ag, const unsigned char id, const void *challenge, - const size_t challenge_len, const struct auth **cap) +login_receive_chap_r(struct connection *conn, struct auth_group *ag, + struct chap *chap, const struct auth **authp) { struct pdu *request; struct keys *request_keys; const char *chap_n, *chap_r; - char *response_bin, expected_response_bin[MD5_DIGEST_LENGTH]; - size_t response_bin_len; const struct auth *auth; int error; @@ -449,7 +299,7 @@ login_receive_chap_r(struct connection * login_send_error(request, 0x02, 0x07); log_errx(1, "received CHAP Login PDU without CHAP_R"); } - error = login_hex2bin(chap_r, &response_bin, &response_bin_len); + error = chap_receive(chap, chap_r); if (error != 0) { login_send_error(request, 0x02, 0x07); log_errx(1, "received CHAP Login PDU with malformed CHAP_R"); @@ -469,21 +319,17 @@ login_receive_chap_r(struct connection * assert(auth->a_secret != NULL); assert(strlen(auth->a_secret) > 0); - login_compute_md5(id, auth->a_secret, challenge, - challenge_len, expected_response_bin, - sizeof(expected_response_bin)); - if (memcmp(response_bin, expected_response_bin, - sizeof(expected_response_bin)) != 0) { + error = chap_authenticate(chap, auth->a_secret); + if (error != 0) { login_send_error(request, 0x02, 0x01); log_errx(1, "CHAP authentication failed for user \"%s\"", auth->a_user); } keys_delete(request_keys); - free(response_bin); - *cap = auth; + *authp = auth; return (request); } @@ -494,10 +340,9 @@ login_send_chap_success(struct pdu *requ struct pdu *response; struct keys *request_keys, *response_keys; struct iscsi_bhs_login_response *bhslr2; + struct rchap *rchap; const char *chap_i, *chap_c; - char *chap_r, *challenge, response_bin[MD5_DIGEST_LENGTH]; - size_t challenge_len; - unsigned char id; + char *chap_r; int error; response = login_new_response(request); @@ -530,21 +375,18 @@ login_send_chap_success(struct pdu *requ "is not set", auth->a_user); } - id = strtoul(chap_i, NULL, 10); - error = login_hex2bin(chap_c, &challenge, &challenge_len); + log_debugx("performing mutual authentication as user \"%s\"", + auth->a_mutual_user); + + rchap = rchap_new(auth->a_mutual_secret); + error = rchap_receive(rchap, chap_i, chap_c); if (error != 0) { login_send_error(request, 0x02, 0x07); log_errx(1, "received CHAP Login PDU with malformed " - "CHAP_C"); + "CHAP_I or CHAP_C"); } - - log_debugx("performing mutual authentication as user \"%s\"", - auth->a_mutual_user); - login_compute_md5(id, auth->a_mutual_secret, challenge, - challenge_len, response_bin, sizeof(response_bin)); - - chap_r = login_bin2hex(response_bin, - sizeof(response_bin)); + chap_r = rchap_get_response(rchap); + rchap_delete(rchap); response_keys = keys_new(); keys_add(response_keys, "CHAP_N", auth->a_mutual_user); keys_add(response_keys, "CHAP_R", chap_r); @@ -564,10 +406,8 @@ static void login_chap(struct connection *conn, struct auth_group *ag) { const struct auth *auth; + struct chap *chap; struct pdu *request; - char challenge_bin[LOGIN_CHALLENGE_LEN]; - unsigned char id; - int rv; /* * Receive CHAP_A PDU. @@ -578,34 +418,21 @@ login_chap(struct connection *conn, stru /* * Generate the challenge. */ - rv = RAND_bytes(challenge_bin, sizeof(challenge_bin)); - if (rv != 1) { - login_send_error(request, 0x03, 0x02); - log_errx(1, "RAND_bytes failed: %s", - ERR_error_string(ERR_get_error(), NULL)); - } - rv = RAND_bytes(&id, sizeof(id)); - if (rv != 1) { - login_send_error(request, 0x03, 0x02); - log_errx(1, "RAND_bytes failed: %s", - ERR_error_string(ERR_get_error(), NULL)); - } + chap = chap_new(); /* * Send the challenge. */ log_debugx("sending CHAP_C, binary challenge size is %zd bytes", - sizeof(challenge_bin)); - login_send_chap_c(request, id, challenge_bin, - sizeof(challenge_bin)); + sizeof(chap->chap_challenge)); + login_send_chap_c(request, chap); pdu_delete(request); /* * Receive CHAP_N/CHAP_R PDU and authenticate. */ log_debugx("waiting for CHAP_N/CHAP_R"); - request = login_receive_chap_r(conn, ag, id, challenge_bin, - sizeof(challenge_bin), &auth); + request = login_receive_chap_r(conn, ag, chap, &auth); /* * Yay, authentication succeeded! @@ -614,6 +441,7 @@ login_chap(struct connection *conn, stru "transitioning to Negotiation Phase", auth->a_user); login_send_chap_success(request, auth); pdu_delete(request); + chap_delete(chap); } static void Modified: head/usr.sbin/iscsid/Makefile ============================================================================== --- head/usr.sbin/iscsid/Makefile Wed Oct 22 08:56:57 2014 (r273458) +++ head/usr.sbin/iscsid/Makefile Wed Oct 22 08:59:23 2014 (r273459) @@ -1,7 +1,7 @@ # $FreeBSD$ PROG= iscsid -SRCS= discovery.c iscsid.c keys.c log.c login.c pdu.c +SRCS= chap.c discovery.c iscsid.c keys.c log.c login.c pdu.c CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys/cam CFLAGS+= -I${.CURDIR}/../../sys/dev/iscsi Added: head/usr.sbin/iscsid/chap.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/iscsid/chap.c Wed Oct 22 08:59:23 2014 (r273459) @@ -0,0 +1,386 @@ +/*- + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Edward Tomasz Napierala under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "iscsid.h" + +static void +chap_compute_md5(const char id, const char *secret, + const void *challenge, size_t challenge_len, void *response, + size_t response_len) +{ + MD5_CTX ctx; + int rv; + + assert(response_len == MD5_DIGEST_LENGTH); + + MD5_Init(&ctx); + MD5_Update(&ctx, &id, sizeof(id)); + MD5_Update(&ctx, secret, strlen(secret)); + MD5_Update(&ctx, challenge, challenge_len); + rv = MD5_Final(response, &ctx); + if (rv != 1) + log_errx(1, "MD5_Final"); +} + +static int +chap_hex2int(const char hex) +{ + switch (hex) { + case '0': + return (0x00); + case '1': + return (0x01); + case '2': + return (0x02); + case '3': + return (0x03); + case '4': + return (0x04); + case '5': + return (0x05); + case '6': + return (0x06); + case '7': + return (0x07); + case '8': + return (0x08); + case '9': + return (0x09); + case 'a': + case 'A': + return (0x0a); + case 'b': + case 'B': + return (0x0b); + case 'c': + case 'C': + return (0x0c); + case 'd': + case 'D': + return (0x0d); + case 'e': + case 'E': + return (0x0e); + case 'f': + case 'F': + return (0x0f); + default: + return (-1); + } +} + +/* + * XXX: Review this _carefully_. + */ +static int +chap_hex2bin(const char *hex, void **binp, size_t *bin_lenp) +{ + int i, hex_len, nibble; + bool lo = true; /* As opposed to 'hi'. */ + char *bin; + size_t bin_off, bin_len; + + if (strncasecmp(hex, "0x", strlen("0x")) != 0) { + log_warnx("malformed variable, should start with \"0x\""); + return (-1); + } + + hex += strlen("0x"); + hex_len = strlen(hex); + if (hex_len < 1) { + log_warnx("malformed variable; doesn't contain anything " + "but \"0x\""); + return (-1); + } + + bin_len = hex_len / 2 + hex_len % 2; + bin = calloc(bin_len, 1); + if (bin == NULL) + log_err(1, "calloc"); + + bin_off = bin_len - 1; + for (i = hex_len - 1; i >= 0; i--) { + nibble = chap_hex2int(hex[i]); + if (nibble < 0) { + log_warnx("malformed variable, invalid char \"%c\"", + hex[i]); + free(bin); + return (-1); + } + + assert(bin_off < bin_len); + if (lo) { + bin[bin_off] = nibble; + lo = false; + } else { + bin[bin_off] |= nibble << 4; + bin_off--; + lo = true; + } + } + + *binp = bin; + *bin_lenp = bin_len; + return (0); +} + +static char * +chap_bin2hex(const char *bin, size_t bin_len) +{ + unsigned char *hex, *tmp, ch; + size_t hex_len; + size_t i; + + hex_len = bin_len * 2 + 3; /* +2 for "0x", +1 for '\0'. */ + hex = malloc(hex_len); + if (hex == NULL) + log_err(1, "malloc"); + + tmp = hex; + tmp += sprintf(tmp, "0x"); + for (i = 0; i < bin_len; i++) { + ch = bin[i]; + tmp += sprintf(tmp, "%02x", ch); + } + + return (hex); +} + +struct chap * +chap_new(void) +{ + struct chap *chap; + int rv; + + chap = calloc(sizeof(*chap), 1); + if (chap == NULL) + log_err(1, "calloc"); + + /* + * Generate the challenge. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 09:17:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC1D1EDE; Wed, 22 Oct 2014 09:17:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 969FEFEC; Wed, 22 Oct 2014 09:17:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M9HKES039433; Wed, 22 Oct 2014 09:17:20 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M9HHUo039414; Wed, 22 Oct 2014 09:17:17 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410220917.s9M9HHUo039414@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 09:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273464 - in head: usr.bin/iscsictl usr.sbin/ctladm usr.sbin/ctld usr.sbin/iscsid X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 09:17:20 -0000 Author: trasz Date: Wed Oct 22 09:17:17 2014 New Revision: 273464 URL: https://svnweb.freebsd.org/changeset/base/273464 Log: Whitespace fixes. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.bin/iscsictl/Makefile head/usr.bin/iscsictl/iscsictl.c head/usr.sbin/ctladm/Makefile head/usr.sbin/ctladm/ctladm.c head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/kernel.c head/usr.sbin/ctld/keys.c head/usr.sbin/ctld/login.c head/usr.sbin/ctld/parse.y head/usr.sbin/iscsid/keys.c head/usr.sbin/iscsid/login.c Modified: head/usr.bin/iscsictl/Makefile ============================================================================== --- head/usr.bin/iscsictl/Makefile Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.bin/iscsictl/Makefile Wed Oct 22 09:17:17 2014 (r273464) @@ -6,7 +6,7 @@ CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys/dev/iscsi MAN= iscsictl.8 -DPADD= ${LIBCAM} ${LIBUTIL} +DPADD= ${LIBCAM} ${LIBUTIL} LDADD= -lcam -lutil YFLAGS+= -v Modified: head/usr.bin/iscsictl/iscsictl.c ============================================================================== --- head/usr.bin/iscsictl/iscsictl.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.bin/iscsictl/iscsictl.c Wed Oct 22 09:17:17 2014 (r273464) @@ -172,7 +172,7 @@ valid_iscsi_name(const char *name) for (i = strlen("iqn."); name[i] != '\0'; i++) { /* * XXX: We should verify UTF-8 normalisation, as defined - * by 3.2.6.2: iSCSI Name Encoding. + * by 3.2.6.2: iSCSI Name Encoding. */ if (isalnum(name[i])) continue; Modified: head/usr.sbin/ctladm/Makefile ============================================================================== --- head/usr.sbin/ctladm/Makefile Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctladm/Makefile Wed Oct 22 09:17:17 2014 (r273464) @@ -2,12 +2,12 @@ PROG= ctladm SRCS= ctladm.c util.c ctl_util.c ctl_scsi_all.c -.PATH: ${.CURDIR}/../../sys/cam/ctl +.PATH: ${.CURDIR}/../../sys/cam/ctl SDIR= ${.CURDIR}/../../sys CFLAGS+= -I${SDIR} # This is necessary because of these warnings: # warning: cast increases required alignment of target type -# The solution is to either upgrade the compiler (preferred), or do void +# The solution is to either upgrade the compiler (preferred), or do void # pointer gymnastics to get around the warning. For now, disable the # warning instead of doing the void pointer workaround. .if ${MACHINE_CPUARCH} == "arm" Modified: head/usr.sbin/ctladm/ctladm.c ============================================================================== --- head/usr.sbin/ctladm/ctladm.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctladm/ctladm.c Wed Oct 22 09:17:17 2014 (r273464) @@ -148,7 +148,7 @@ typedef enum { CTLADM_ARG_ONOFFLINE = 0x0080000, CTLADM_ARG_ONESHOT = 0x0100000, CTLADM_ARG_TIMEOUT = 0x0200000, - CTLADM_ARG_INITIATOR = 0x0400000, + CTLADM_ARG_INITIATOR = 0x0400000, CTLADM_ARG_NOCOPY = 0x0800000, CTLADM_ARG_NEED_TL = 0x1000000 } ctladm_cmdargs; @@ -237,7 +237,7 @@ static int cctl_sync_cache(int fd, int t int argc, char **argv, char *combinedopt); static int cctl_start_stop(int fd, int target, int lun, int iid, int retries, int start, int argc, char **argv, char *combinedopt); -static int cctl_mode_sense(int fd, int target, int lun, int iid, int retries, +static int cctl_mode_sense(int fd, int target, int lun, int iid, int retries, int argc, char **argv, char *combinedopt); static int cctl_read_capacity(int fd, int target, int lun, int iid, int retries, int argc, char **argv, @@ -258,7 +258,7 @@ static int cctl_req_sense(int fd, int ta static int cctl_persistent_reserve_in(int fd, int target, int lun, int initiator, int argc, char **argv, char *combinedopt, int retry_count); -static int cctl_persistent_reserve_out(int fd, int target, int lun, +static int cctl_persistent_reserve_out(int fd, int target, int lun, int initiator, int argc, char **argv, char *combinedopt, int retry_count); static int cctl_create_lun(int fd, int argc, char **argv, char *combinedopt); @@ -394,7 +394,7 @@ retry: cmd_latency = ts.tv_sec * 1000; if (ts.tv_nsec > 0) cmd_latency += ts.tv_nsec / 1000000; - + fprintf(stdout, "LUN %jd tag 0x%04x%s%s%s%s%s: %s. CDB: %s " "(%0.0Lf ms)\n", (intmax_t)entry->lun_num, entry->tag_num, @@ -622,7 +622,7 @@ cctl_port(int fd, int argc, char **argv, case 'o': if (port_mode != CCTL_PORT_MODE_NONE) goto bailout_badarg; - + if (strcasecmp(optarg, "on") == 0) port_mode = CCTL_PORT_MODE_ON; else if (strcasecmp(optarg, "off") == 0) @@ -1041,7 +1041,7 @@ static struct ctladm_opts cctl_err_patte }; static int -cctl_error_inject(int fd, uint32_t target, uint32_t lun, int argc, char **argv, +cctl_error_inject(int fd, uint32_t target, uint32_t lun, int argc, char **argv, char *combinedopt) { int retval = 0; @@ -1206,12 +1206,12 @@ cctl_error_inject(int fd, uint32_t targe if (fd_sense == 1) { ssize_t amt_read; int amt_to_read = sense_len; - u_int8_t *buf_ptr = (uint8_t *)&err_desc.custom_sense; + u_int8_t *buf_ptr = (uint8_t *)&err_desc.custom_sense; for (amt_read = 0; amt_to_read > 0; amt_read = read(STDIN_FILENO, buf_ptr, amt_to_read)) { if (amt_read == -1) { - warn("error reading sense data from stdin"); + warn("error reading sense data from stdin"); retval = 1; goto bailout; } @@ -1617,7 +1617,7 @@ cctl_startup_shutdown(int fd, int target } if (ooa_info.status != CTL_OOA_SUCCESS) { - printf("%s CTL_CHECK_OOA returned status %d\n", + printf("%s CTL_CHECK_OOA returned status %d\n", scsi_path, ooa_info.status); continue; } @@ -1629,7 +1629,7 @@ cctl_startup_shutdown(int fd, int target continue; } } - + ctl_scsi_start_stop(/*io*/ io, /*start*/(command == CTLADM_CMD_STARTUP) ? 1 : 0, @@ -1682,7 +1682,7 @@ cctl_sync_cache(int fd, int target, int int retval; uint64_t our_lba = 0; uint32_t our_block_count = 0; - int reladr = 0, immed = 0; + int reladr = 0, immed = 0; int c; id.id = iid; @@ -1830,7 +1830,7 @@ bailout: } static int -cctl_mode_sense(int fd, int target, int lun, int iid, int retries, +cctl_mode_sense(int fd, int target, int lun, int iid, int retries, int argc, char **argv, char *combinedopt) { union ctl_io *io; @@ -2048,8 +2048,8 @@ bailout: } static int -cctl_read_capacity(int fd, int target, int lun, int iid, int retries, - int argc, char **argv, char *combinedopt) +cctl_read_capacity(int fd, int target, int lun, int iid, int retries, + int argc, char **argv, char *combinedopt) { union ctl_io *io; struct ctl_id id; @@ -2518,7 +2518,7 @@ cctl_tur(int fd, int target, int lun, in } static int -cctl_get_inquiry(int fd, int target, int lun, int iid, int retries, +cctl_get_inquiry(int fd, int target, int lun, int iid, int retries, char *path_str, int path_len, struct scsi_inquiry_data *inq_data) { @@ -2669,7 +2669,7 @@ cctl_report_target_port_group(int fd, in dataptr = (uint8_t *)malloc(datalen); if (dataptr == NULL) { warn("%s: can't allocate %d bytes", __func__, datalen); - retval = 1; + retval = 1; goto bailout; } @@ -2737,7 +2737,7 @@ cctl_inquiry_vpd_devid(int fd, int targe dataptr = (uint8_t *)malloc(datalen); if (dataptr == NULL) { warn("%s: can't allocate %d bytes", __func__, datalen); - retval = 1; + retval = 1; goto bailout; } @@ -2784,7 +2784,7 @@ bailout: } static int -cctl_persistent_reserve_in(int fd, int target, int lun, int initiator, +cctl_persistent_reserve_in(int fd, int target, int lun, int initiator, int argc, char **argv, char *combinedopt, int retry_count) { @@ -2827,7 +2827,7 @@ cctl_persistent_reserve_in(int fd, int t dataptr = (uint8_t *)malloc(datalen); if (dataptr == NULL) { warn("%s: can't allocate %d bytes", __func__, datalen); - retval = 1; + retval = 1; goto bailout; } @@ -2890,8 +2890,8 @@ bailout: } static int -cctl_persistent_reserve_out(int fd, int target, int lun, int initiator, - int argc, char **argv, char *combinedopt, +cctl_persistent_reserve_out(int fd, int target, int lun, int initiator, + int argc, char **argv, char *combinedopt, int retry_count) { union ctl_io *io; @@ -3835,7 +3835,7 @@ struct cctl_lun_nv { }; /* - * Backend LUN information. + * Backend LUN information. */ struct cctl_lun { uint64_t lun_id; @@ -3951,7 +3951,7 @@ cctl_end_element(void *user_data, const } else if (strcmp(name, "lun") == 0) { devlist->cur_lun = NULL; } else if (strcmp(name, "ctllunlist") == 0) { - + /* Nothing. */ } else { struct cctl_lun_nv *nv; @@ -4216,7 +4216,7 @@ cctl_end_pelement(void *user_data, const } else if (strcmp(name, "targ_port") == 0) { portlist->cur_port = NULL; } else if (strcmp(name, "ctlportlist") == 0) { - + /* Nothing. */ } else { struct cctl_lun_nv *nv; @@ -4575,7 +4575,7 @@ main(int argc, char **argv) } if (cmdargs & CTLADM_ARG_NEED_TL) { - if ((argc < 3) + if ((argc < 3) || (!isdigit(argv[2][0]))) { warnx("option %s requires a target:lun argument", argv[1]); @@ -4802,12 +4802,12 @@ main(int argc, char **argv) retval = cctl_dump_structs(fd, cmdargs); break; case CTLADM_CMD_PRES_IN: - retval = cctl_persistent_reserve_in(fd, target, lun, initid, + retval = cctl_persistent_reserve_in(fd, target, lun, initid, argc, argv, combinedopt, retries); break; case CTLADM_CMD_PRES_OUT: - retval = cctl_persistent_reserve_out(fd, target, lun, initid, + retval = cctl_persistent_reserve_out(fd, target, lun, initid, argc, argv, combinedopt, retries); break; Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctld/ctld.c Wed Oct 22 09:17:17 2014 (r273464) @@ -255,7 +255,7 @@ auth_new_chap_mutual(struct auth_group * if (ag->ag_name != NULL) log_warnx("cannot mix \"chap-mutual\" authentication " "with other types for auth-group \"%s\"", - ag->ag_name); + ag->ag_name); else log_warnx("cannot mix \"chap-mutual\" authentication " "with other types for target \"%s\"", @@ -754,7 +754,7 @@ valid_iscsi_name(const char *name) for (i = strlen("iqn."); name[i] != '\0'; i++) { /* * XXX: We should verify UTF-8 normalisation, as defined - * by 3.2.6.2: iSCSI Name Encoding. + * by 3.2.6.2: iSCSI Name Encoding. */ if (isalnum(name[i])) continue; @@ -1281,10 +1281,10 @@ conf_apply(struct conf *oldconf, struct /* * XXX: If target or lun removal fails, we should somehow "move" - * the old lun or target into newconf, so that subsequent - * conf_apply() would try to remove them again. That would - * be somewhat hairy, though, and lun deletion failures don't - * really happen, so leave it as it is for now. + * the old lun or target into newconf, so that subsequent + * conf_apply() would try to remove them again. That would + * be somewhat hairy, though, and lun deletion failures don't + * really happen, so leave it as it is for now. */ TAILQ_FOREACH_SAFE(oldtarg, &oldconf->conf_targets, t_next, tmptarg) { /* Modified: head/usr.sbin/ctld/kernel.c ============================================================================== --- head/usr.sbin/ctld/kernel.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctld/kernel.c Wed Oct 22 09:17:17 2014 (r273464) @@ -105,7 +105,7 @@ struct cctl_lun_nv { }; /* - * Backend LUN information. + * Backend LUN information. */ struct cctl_lun { uint64_t lun_id; @@ -237,7 +237,7 @@ cctl_end_element(void *user_data, const } else if (strcmp(name, "lun") == 0) { devlist->cur_lun = NULL; } else if (strcmp(name, "ctllunlist") == 0) { - + /* Nothing. */ } else { struct cctl_lun_nv *nv; @@ -342,7 +342,7 @@ cctl_end_pelement(void *user_data, const } else if (strcmp(name, "targ_port") == 0) { devlist->cur_port = NULL; } else if (strcmp(name, "ctlportlist") == 0) { - + /* Nothing. */ } else { struct cctl_lun_nv *nv; Modified: head/usr.sbin/ctld/keys.c ============================================================================== --- head/usr.sbin/ctld/keys.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctld/keys.c Wed Oct 22 09:17:17 2014 (r273464) @@ -116,7 +116,7 @@ keys_save(struct keys *keys, struct pdu for (i = 0; i < KEYS_MAX; i++) { if (keys->keys_names[i] == NULL) break; - /* + /* * +1 for '=', +1 for '\0'. */ len += strlen(keys->keys_names[i]) + Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctld/login.c Wed Oct 22 09:17:17 2014 (r273464) @@ -640,7 +640,7 @@ login_negotiate(struct connection *conn, if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", + keys_add_int(response_keys, "TargetPortalGroupTag", conn->conn_portal->p_portal_group->pg_tag); } @@ -852,7 +852,7 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", + keys_add_int(response_keys, "TargetPortalGroupTag", conn->conn_portal->p_portal_group->pg_tag); } keys_save(response_keys, response); @@ -903,7 +903,7 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", + keys_add_int(response_keys, "TargetPortalGroupTag", conn->conn_portal->p_portal_group->pg_tag); } keys_save(response_keys, response); Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/ctld/parse.y Wed Oct 22 09:17:17 2014 (r273464) @@ -625,7 +625,7 @@ lun_device_id: DEVICE_ID STR lun_option: OPTION STR STR { struct lun_option *clo; - + clo = lun_option_new(lun, $2, $3); free($2); free($3); Modified: head/usr.sbin/iscsid/keys.c ============================================================================== --- head/usr.sbin/iscsid/keys.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/iscsid/keys.c Wed Oct 22 09:17:17 2014 (r273464) @@ -117,7 +117,7 @@ keys_save(struct keys *keys, struct pdu for (i = 0; i < KEYS_MAX; i++) { if (keys->keys_names[i] == NULL) break; - /* + /* * +1 for '=', +1 for '\0'. */ len += strlen(keys->keys_names[i]) + Modified: head/usr.sbin/iscsid/login.c ============================================================================== --- head/usr.sbin/iscsid/login.c Wed Oct 22 09:12:20 2014 (r273463) +++ head/usr.sbin/iscsid/login.c Wed Oct 22 09:17:17 2014 (r273464) @@ -182,7 +182,7 @@ kernel_modify(const struct connection *c * be much more complicated: we would need to keep "dependencies" * for sessions, so that, in case described in draft and using draft * terminology, we would have three sessions: one for discovery, - * one for initial target portal, and one for redirect portal. + * one for initial target portal, and one for redirect portal. * This would allow us to "backtrack" on connection failure, * as described in draft. */ @@ -756,8 +756,8 @@ login(struct connection *conn) * to parse things such as TargetAlias. * * XXX: This is somewhat ugly. We should have a way to apply - * all the keys to the session and use that by default - * instead of discarding them. + * all the keys to the session and use that by default + * instead of discarding them. */ if (strcmp(response_keys->keys_names[i], "AuthMethod") == 0) continue; From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 09:40:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BE76411; Wed, 22 Oct 2014 09:40:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F4B5378; Wed, 22 Oct 2014 09:40:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9M9elYL051412; Wed, 22 Oct 2014 09:40:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9M9el6V051411; Wed, 22 Oct 2014 09:40:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410220940.s9M9el6V051411@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 09:40:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273465 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 09:40:47 -0000 Author: trasz Date: Wed Oct 22 09:40:46 2014 New Revision: 273465 URL: https://svnweb.freebsd.org/changeset/base/273465 Log: Fix ctld(8) to not show the "auth-group not assigned to any target" warning for auth-groups assigned to a portal-group. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctld.c Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Wed Oct 22 09:17:17 2014 (r273464) +++ head/usr.sbin/ctld/ctld.c Wed Oct 22 09:40:46 2014 (r273465) @@ -1164,7 +1164,7 @@ conf_verify(struct conf *conf) struct portal_group *pg; struct target *targ; struct lun *lun; - bool found_lun; + bool found; int error; if (conf->conf_pidfile_path == NULL) @@ -1181,14 +1181,14 @@ conf_verify(struct conf *conf) "default"); assert(targ->t_portal_group != NULL); } - found_lun = false; + found = false; TAILQ_FOREACH(lun, &targ->t_luns, l_next) { error = conf_verify_lun(lun); if (error != 0) return (error); - found_lun = true; + found = true; } - if (!found_lun) { + if (!found) { log_warnx("no LUNs defined for target \"%s\"", targ->t_name); } @@ -1219,11 +1219,20 @@ conf_verify(struct conf *conf) else assert(ag->ag_target == NULL); + found = false; TAILQ_FOREACH(targ, &conf->conf_targets, t_next) { - if (targ->t_auth_group == ag) + if (targ->t_auth_group == ag) { + found = true; break; + } + } + TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) { + if (pg->pg_discovery_auth_group == ag) { + found = true; + break; + } } - if (targ == NULL && ag->ag_name != NULL && + if (!found && ag->ag_name != NULL && strcmp(ag->ag_name, "default") != 0 && strcmp(ag->ag_name, "no-authentication") != 0 && strcmp(ag->ag_name, "no-access") != 0) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 09:48:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 98364644; Wed, 22 Oct 2014 09:48:44 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 5AFF43FD; Wed, 22 Oct 2014 09:48:44 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id AD366AC72; Wed, 22 Oct 2014 09:48:42 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 0431654FD; Wed, 22 Oct 2014 11:48:31 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Warner Losh Subject: Re: svn commit: r273417 - head References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> Date: Wed, 22 Oct 2014 11:48:30 +0200 In-Reply-To: <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> (Warner Losh's message of "Tue, 21 Oct 2014 19:49:33 -0600") Message-ID: <86iojco2oh.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 09:48:44 -0000 Warner Losh writes: > I=E2=80=99ll fix this. I think we need to have a MK_TESTS_SUPPORT that bu= ilds > the libatf stuff when yes, and omits it when no, since we don=E2=80=99t w= ant > the tests building when we=E2=80=99re building the 4.3 stage. I agree, bundling everything under MK_TESTS does not make much sense. Automake has the same bug ("make check" will both build the tests and run them, and while you can rerun the tests without rebuilding them ("make recheck"), there is no way to build them without running them. I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though. The test framework is probably useful on its own. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 09:58:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9EE58A27 for ; Wed, 22 Oct 2014 09:58:42 +0000 (UTC) Received: from mail-qg0-f43.google.com (mail-qg0-f43.google.com [209.85.192.43]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5A4D7796 for ; Wed, 22 Oct 2014 09:58:42 +0000 (UTC) Received: by mail-qg0-f43.google.com with SMTP id j107so2242350qga.16 for ; Wed, 22 Oct 2014 02:58:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=X8LxzuTyJZMOHbM0feoqjQVZd3eBQRKy7anwcIDsmwk=; b=ak0I4gJkp8PR9TRNxKmmsjACrsGY4LbX7XODudxOItC/RxkDKXux4LylraGjIQdrmk p+Upq2LFHTAh589ISUc6oTGbgqIxG+IxE1h+6wqdQpesjPX6+aNqZeIMV5TwlFk083aK dc6/hmNpK+4jpz/fP+NW46cbNrM8wBR5mlS1Vojj+Swo3QjymZxvgHIAwO5lNMpJB4K9 7WPhf3pgWcZlR5v5UnS9V/LZWxNTacFylB60G9loNkoWqxRbS68zFENc0fBx7Kc0d9BB SVIVOyLtGES8JvIqDnpz5v0jYiLj3txwhQvdSZ54t4b5aR7ZQUhWAAlv/HOnHYdN1OD1 LLHw== X-Gm-Message-State: ALoCoQlpNkTb/tE9ovZI/JvaVzOXFaM6Kc9FhkiJJ67sLaycASjx0y3urR8+91R0gWZSiCvUIOzf X-Received: by 10.224.61.7 with SMTP id r7mr54975239qah.9.1413971921057; Wed, 22 Oct 2014 02:58:41 -0700 (PDT) MIME-Version: 1.0 Sender: jmmv@meroh.net Received: by 10.96.75.134 with HTTP; Wed, 22 Oct 2014 02:58:20 -0700 (PDT) X-Originating-IP: [2620:0:1040:404:e8f9:fd1a:c493:d286] In-Reply-To: <201410211756.s9LHu6Q9098073@svn.freebsd.org> References: <201410211756.s9LHu6Q9098073@svn.freebsd.org> From: Julio Merino Date: Wed, 22 Oct 2014 10:58:20 +0100 X-Google-Sender-Auth: Z4gI8vO2UrPvJvPbDf5C6eIrruA Message-ID: Subject: Re: svn commit: r273389 - head/contrib/netbsd-tests/lib/libc/gen To: Garrett Cooper Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 09:58:42 -0000 On Tue, Oct 21, 2014 at 6:56 PM, Garrett Cooper wrote: > Modified: head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c > ============================================================================== > --- head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Tue Oct 21 17:17:40 2014 (r273388) > +++ head/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c Tue Oct 21 17:56:06 2014 (r273389) > @@ -29,7 +29,9 @@ > #include > #include > > +#if defined(__NetBSD__) Every time I see this (and checks for __FreeBSD__ as well), I can't stop wondering... "why bother?" This codebase lives in the FreeBSD source tree so it should be able to assume it is being built on FreeBSD. The only thing these ifdefs achieve is bloat, because there is no way their code paths will ever be executed (and thus it's guaranteed that they will rot over time). The differences between NetBSD and FreeBSD can easily be checked by diffing the vendor branch with the contrib tree. (Plus #ifdefs based on __*BSD__ macros are usually wrong because they don't account for OS release differences and thus they will certainly also break over time.) From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 10:53:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 05B42612; Wed, 22 Oct 2014 10:53:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E6045E6D; Wed, 22 Oct 2014 10:53:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MArPfl085918; Wed, 22 Oct 2014 10:53:25 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MArPrd085917; Wed, 22 Oct 2014 10:53:25 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410221053.s9MArPrd085917@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 10:53:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273466 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 10:53:26 -0000 Author: trasz Date: Wed Oct 22 10:53:25 2014 New Revision: 273466 URL: https://svnweb.freebsd.org/changeset/base/273466 Log: Remove spurious empty line. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 09:40:46 2014 (r273465) +++ head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 10:53:25 2014 (r273466) @@ -109,7 +109,6 @@ A setting of 0 disables the timeout. .El .Ss auth-group Context .Bl -tag -width indent - .It Ic auth-type Ar type Sets the authentication type. Type can be either From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 11:06:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11E1B9B7; Wed, 22 Oct 2014 11:06:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1C09F94; Wed, 22 Oct 2014 11:06:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MB65rm091060; Wed, 22 Oct 2014 11:06:05 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MB65bq091059; Wed, 22 Oct 2014 11:06:05 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410221106.s9MB65bq091059@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 11:06:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273467 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 11:06:06 -0000 Author: trasz Date: Wed Oct 22 11:06:05 2014 New Revision: 273467 URL: https://svnweb.freebsd.org/changeset/base/273467 Log: Comment out parts about iSER; it's not implemented. Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 10:53:25 2014 (r273466) +++ head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 11:06:05 2014 (r273467) @@ -55,7 +55,7 @@ file is: .No portal-group Ar name No { .Dl listen Ar address -.Dl listen-iser Ar address +.\".Dl listen-iser Ar address .Dl discovery-auth-group Ar name .Dl ... } @@ -174,9 +174,9 @@ may be used to permit discovery without authentication. .It Ic listen Ar address An IPv4 or IPv6 address and port to listen on for incoming connections. -.It Ic listen-iser Ar address -An IPv4 or IPv6 address and port to listen on for incoming connections -using iSER (iSCSI over RDMA) protocol. +.\".It Ic listen-iser Ar address +.\"An IPv4 or IPv6 address and port to listen on for incoming connections +.\"using iSER (iSCSI over RDMA) protocol. .El .Ss target Context .Bl -tag -width indent From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 11:09:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6A8FAB4D; Wed, 22 Oct 2014 11:09:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56FADFBA; Wed, 22 Oct 2014 11:09:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MB94KE091570; Wed, 22 Oct 2014 11:09:04 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MB94br091569; Wed, 22 Oct 2014 11:09:04 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410221109.s9MB94br091569@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 11:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273468 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 11:09:04 -0000 Author: trasz Date: Wed Oct 22 11:09:03 2014 New Revision: 273468 URL: https://svnweb.freebsd.org/changeset/base/273468 Log: Remove misleading statement. Bump date. MFC after: 1 month Sponsored by: FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 11:06:05 2014 (r273467) +++ head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 11:09:03 2014 (r273468) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2014 +.Dd October 22, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -157,13 +157,7 @@ address. .It Ic discovery-auth-group Ar name Assign a previously defined authentication group to the portal group, to be used for target discovery. -By default, portal groups that do not specify their own auth settings, -using clauses such as -.Sy chap -or -.Sy initiator-name , -are assigned -predefined +By default, portal groups are assigned predefined .Sy auth-group .Qq Ar default , which denies discovery. From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 11:30:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7D6421CB; Wed, 22 Oct 2014 11:30:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68B2B299; Wed, 22 Oct 2014 11:30:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MBU5sA001469; Wed, 22 Oct 2014 11:30:05 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MBU4bB001380; Wed, 22 Oct 2014 11:30:04 GMT (envelope-from br@FreeBSD.org) Message-Id: <201410221130.s9MBU4bB001380@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Wed, 22 Oct 2014 11:30:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273469 - in head/sys: arm/altera/socfpga arm/conf boot/fdt/dts/arm dev/beri X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 11:30:05 -0000 Author: br Date: Wed Oct 22 11:30:03 2014 New Revision: 273469 URL: https://svnweb.freebsd.org/changeset/base/273469 Log: Provide a character device allowing us to access BERI memory regions. Sponsored by: DARPA, AFRL Added: head/sys/dev/beri/beri_mem.c (contents, props changed) Modified: head/sys/arm/altera/socfpga/files.socfpga head/sys/arm/conf/SOCKIT-BERI head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Modified: head/sys/arm/altera/socfpga/files.socfpga ============================================================================== --- head/sys/arm/altera/socfpga/files.socfpga Wed Oct 22 11:09:03 2014 (r273468) +++ head/sys/arm/altera/socfpga/files.socfpga Wed Oct 22 11:30:03 2014 (r273469) @@ -22,4 +22,7 @@ arm/altera/socfpga/socfpga_mp.c option dev/dwc/if_dwc.c optional dwc dev/mii/micphy.c optional micphy dev/mmc/host/dwmmc.c optional dwmmc + +# BERI specific dev/beri/beri_ring.c optional beri_ring +dev/beri/beri_mem.c optional beri_mem Modified: head/sys/arm/conf/SOCKIT-BERI ============================================================================== --- head/sys/arm/conf/SOCKIT-BERI Wed Oct 22 11:09:03 2014 (r273468) +++ head/sys/arm/conf/SOCKIT-BERI Wed Oct 22 11:30:03 2014 (r273469) @@ -121,6 +121,7 @@ device spibus # BERI specific device beri_ring +device beri_mem # Ethernet device ether Modified: head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Wed Oct 22 11:09:03 2014 (r273468) +++ head/sys/boot/fdt/dts/arm/socfpga-sockit-beri.dts Wed Oct 22 11:30:03 2014 (r273469) @@ -81,6 +81,12 @@ }; }; + beri_mem: mem@d0000000 { + compatible = "sri-cambridge,beri-mem"; + reg = <0xd0000000 0x10000000>; + status = "okay"; + }; + beri_debug: ring@c0000000 { compatible = "sri-cambridge,beri-ring"; reg = <0xc0000000 0x3000>; Added: head/sys/dev/beri/beri_mem.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/beri/beri_mem.c Wed Oct 22 11:30:03 2014 (r273469) @@ -0,0 +1,186 @@ +/*- + * Copyright (c) 2014 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * BERI memory interface. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +struct beri_mem_softc { + struct resource *res[1]; + struct cdev *mem_cdev; + device_t dev; + int mem_size; + int mem_start; +}; + +static struct resource_spec beri_mem_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int +mem_open(struct cdev *dev, int flags __unused, + int fmt __unused, struct thread *td __unused) +{ + struct beri_mem_softc *sc; + + sc = dev->si_drv1; + + return (0); +} + +static int +mem_close(struct cdev *dev, int flags __unused, + int fmt __unused, struct thread *td __unused) +{ + struct beri_mem_softc *sc; + + sc = dev->si_drv1; + + return (0); +} + +static int +mem_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, + struct thread *td) +{ + + return (0); +} + +static int +mem_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, + vm_memattr_t *memattr) +{ + struct beri_mem_softc *sc; + + sc = dev->si_drv1; + + if (offset < sc->mem_size) { + *paddr = sc->mem_start + offset; + return (0); + } + + return (EINVAL); +} + +static struct cdevsw mem_cdevsw = { + .d_version = D_VERSION, + .d_open = mem_open, + .d_close = mem_close, + .d_ioctl = mem_ioctl, + .d_mmap = mem_mmap, + .d_name = "BERI memory", +}; + +static int +beri_mem_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "sri-cambridge,beri-mem")) + return (ENXIO); + + device_set_desc(dev, "BERI memory"); + return (BUS_PROBE_DEFAULT); +} + +static int +beri_mem_attach(device_t dev) +{ + struct beri_mem_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, beri_mem_spec, sc->res)) { + device_printf(dev, "could not allocate resources\n"); + return (ENXIO); + } + + /* Memory info */ + sc->mem_size = rman_get_size(sc->res[0]); + sc->mem_start = rman_get_start(sc->res[0]); + + sc->mem_cdev = make_dev(&mem_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0600, "beri_mem"); + + if (sc->mem_cdev == NULL) { + device_printf(dev, "Failed to create character device.\n"); + return (ENXIO); + } + + sc->mem_cdev->si_drv1 = sc; + + return (0); +} + +static device_method_t beri_mem_methods[] = { + DEVMETHOD(device_probe, beri_mem_probe), + DEVMETHOD(device_attach, beri_mem_attach), + { 0, 0 } +}; + +static driver_t beri_mem_driver = { + "beri_mem", + beri_mem_methods, + sizeof(struct beri_mem_softc), +}; + +static devclass_t beri_mem_devclass; + +DRIVER_MODULE(beri_mem, simplebus, beri_mem_driver, beri_mem_devclass, 0, 0); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 11:30:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7F0E3FA; Wed, 22 Oct 2014 11:30:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4423359; Wed, 22 Oct 2014 11:30:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MBUvfZ002608; Wed, 22 Oct 2014 11:30:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MBUv4B002607; Wed, 22 Oct 2014 11:30:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410221130.s9MBUv4B002607@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 22 Oct 2014 11:30:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273470 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 11:30:57 -0000 Author: trasz Date: Wed Oct 22 11:30:56 2014 New Revision: 273470 URL: https://svnweb.freebsd.org/changeset/base/273470 Log: Fix ctl.conf example to use proper paths to ZVOLs. Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 11:30:03 2014 (r273469) +++ head/usr.sbin/ctld/ctl.conf.5 Wed Oct 22 11:30:56 2014 (r273470) @@ -313,7 +313,7 @@ target iqn.2012-06.com.example:target0 { alias "Example target" auth-group no-authentication lun 0 { - path /dev/zvol/example_0 + path /dev/zvol/tank/example_0 blocksize 4096 size 4G } @@ -322,7 +322,7 @@ target iqn.2012-06.com.example:target0 { target iqn.2012-06.com.example:target3 { chap chapuser chapsecret lun 0 { - path /dev/zvol/example_3 + path /dev/zvol/tank/example_3 } } @@ -330,10 +330,10 @@ target iqn.2012-06.com.example:target2 { auth-group example2 portal-group example2 lun 0 { - path /dev/zvol/example2_0 + path /dev/zvol/tank/example2_0 } lun 1 { - path /dev/zvol/example2_1 + path /dev/zvol/tank/example2_1 option foo bar } } From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 14:02:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1462EBA7 for ; Wed, 22 Oct 2014 14:02:55 +0000 (UTC) Received: from mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D5081CF7 for ; Wed, 22 Oct 2014 14:02:54 +0000 (UTC) Received: by mail-pa0-f41.google.com with SMTP id rd3so1766655pab.28 for ; Wed, 22 Oct 2014 07:02:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=sat6zkkGpXLQy7xiyndxI8Ds3eZ3JbviEt+jaT+Egl8=; b=lqP+Rc8SQDNNEyVMJC2XwuiH1Eem92tND77hcysQZVNJe9ygJUG5fdn1/ZszrsMb5c K44WdLGicte9Kdy/m1coqakk4i/HEjTf/OGE/7qblao4BZft3qfkO3xz7M8wxhMytpYB okehtUJi/bQaGHMP5ax2MBG+4QcCF9lECo1LN3I8AiDMhITJQ7sjUbpsmlgsIlN5LVin 2R2B79AKW7Fb5sWJLe1p8nWvcmfkZ6XypY4rxiFSLNDZDoYn2JbiHwXh9pZzfuuxdEN6 uuzjimrGO3eri1EnTMc3Ygovdmd/v6rSZlsEpPEQY/Ri9kzNZtGN9AJ7Eg9YXlgOiMOx 2dnQ== X-Gm-Message-State: ALoCoQlBuq+wOQuyORgsLXjrZwIpXfTJGFGJGKlMPbo1mesJAUycJkxaD68Rx9NruWB8AM1TAbaT X-Received: by 10.70.109.139 with SMTP id hs11mr23218016pdb.83.1413986573849; Wed, 22 Oct 2014 07:02:53 -0700 (PDT) Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id ps7sm14315509pbb.73.2014.10.22.07.02.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 07:02:53 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273417 - head From: Warner Losh In-Reply-To: <86iojco2oh.fsf@nine.des.no> Date: Wed, 22 Oct 2014 08:02:49 -0600 Message-Id: <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 14:02:55 -0000 --Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 22, 2014, at 3:48 AM, Dag-Erling Sm=F8rgrav wrote: > Warner Losh writes: >> I=92ll fix this. I think we need to have a MK_TESTS_SUPPORT that = builds >> the libatf stuff when yes, and omits it when no, since we don=92t = want >> the tests building when we=92re building the 4.3 stage. >=20 > I agree, bundling everything under MK_TESTS does not make much sense. > Automake has the same bug ("make check" will both build the tests and > run them, and while you can rerun the tests without rebuilding them > ("make recheck"), there is no way to build them without running them. >=20 > I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though. The > test framework is probably useful on its own. That would be a nicer name, but then we=92d lose the automatic setting = when MK_TESTS is enabled (unless we add another special case, which is the opposite = direction that I want to go in). How strongly do you feel that=92s a better name? Warner --Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUR7kKAAoJEGwc0Sh9sBEAK9MP/A/zrxF7PUIfpQq98M9UM2ky K/0Vjjc/mOPBNCBirkE2HG+J+QRmjZ5O23+J9E+AWCCz7+ucPVT3T0vanx8pHm4W x3bTAJvE76W8KKpPQyCQEgN7ZiK/PdNIB9mqWwOqExLzZ7MCUdIDQK7Bi01WnPbs aMYFEMP9md/cu7HX90TkAhzjn0awK6zOYeHx1fGonTce0WhQvSsPHeUX0IobVwbP 85TuLXOiEKezC1wJn1MhzW6XfplVY2kPNgfQ6oAw0U0pqBghUQpymbFemezScqOG ELPMUlNLvchyrL8T0rlIpYeuOX9zlCLBsu3jWMkwSNqVBFktl+eD/SwWOOu1Bj8X xBcH50sD7Me4bITsaUZ9nHcdKpXdThqlGwzfop/b1fuYgBUsXiNUebBtYuL8gQKP HVL4wCTBy2levCqd0rm0G4WLXq2hsmCEpBASPhkR4K6L1m5mKw2DWAXnWieOnX8S snXuJ5h3cULEST8fZqbdh6/u23/ka+mFRh4FRIk+5sjjMHQ2IMpdyJC8Yz/D1GEI 795T4bpFm6MIyD0JeZ6eNYS1PMq2Zp/qXoUYGgcA97kiseQLYoUqiOpUKd24AVqX R1PbhO/QTrkf8J5O763DIH6ABTrdO0Uhhbl8FqZBLW1YA6vHkV3jNTfiJscvM7uV M6yA9ztaAJXOp1suyvia =smAw -----END PGP SIGNATURE----- --Apple-Mail=_4C5EC1F4-95DC-4993-BAC2-200E4D0B9CA3-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 14:57:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20C1596B; Wed, 22 Oct 2014 14:57:45 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id D3774391; Wed, 22 Oct 2014 14:57:44 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 2D13DA104; Wed, 22 Oct 2014 14:57:43 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 9351B5540; Wed, 22 Oct 2014 16:57:31 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Warner Losh Subject: Re: svn commit: r273417 - head References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> Date: Wed, 22 Oct 2014 16:57:31 +0200 In-Reply-To: <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> (Warner Losh's message of "Wed, 22 Oct 2014 08:02:49 -0600") Message-ID: <86mw8ocftw.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 14:57:45 -0000 Warner Losh writes: > Dag-Erling Sm=C3=B8rgrav writes: > > I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though. > > The test framework is probably useful on its own. > That would be a nicer name, but then we=E2=80=99d lose the automatic sett= ing > when MK_TESTS is enabled (unless we add another special case, which is > the opposite direction that I want to go in). How strongly do you feel > that=E2=80=99s a better name? Is _SUPPORT magic? I didn't know. I guess MK_TESTS_SUPPORT is good enough, especially if it's on by default. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 15:00:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F2ACAE9; Wed, 22 Oct 2014 15:00:08 +0000 (UTC) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC4003C7; Wed, 22 Oct 2014 15:00:07 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id hz1so3841304pad.36 for ; Wed, 22 Oct 2014 08:00:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=9//D4wVFweLOhmwC9MuhOTrwyP4o/yEAGs66bPDundQ=; b=X4eOwZUsTXL0+3ij+p9SLW/Ml3Dbp8/rOpVtnqaPi9WoHR2j/uakki4JsXrbBY3GHU vxuyjHQ8U1JdsndgRcN39kmepyrqXYae4qmY2CTjU4vAcw/FA/iW7ZL0Ot/QBn1GJ29V fm4sxXTktcrgybhuVhRShk8o8NBEUrPkFzNlQEQM3c1BEp/SB3ps6h6YWGF8HAVvZzgX 4Xdq/k6vdjj/oLZpO1CTDhx/eqfiKnuphoonsHugDVN6cKX9I7UogJ9d8bGYYp8b2ZQD XudOqtiFYvJ99XaoxpyJVc7vGJIGtSU/Kv6iPASuSr8sW92PDPU/Ig+YNbhwMdX36E3M xhbA== MIME-Version: 1.0 X-Received: by 10.66.66.229 with SMTP id i5mr4290688pat.137.1413990007308; Wed, 22 Oct 2014 08:00:07 -0700 (PDT) Received: by 10.70.9.132 with HTTP; Wed, 22 Oct 2014 08:00:07 -0700 (PDT) In-Reply-To: <86mw8ocftw.fsf@nine.des.no> References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> <86mw8ocftw.fsf@nine.des.no> Date: Wed, 22 Oct 2014 11:00:07 -0400 Message-ID: Subject: Re: svn commit: r273417 - head From: Benjamin Kaduk To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Warner Losh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 15:00:08 -0000 On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=C3=B8rgrav wro= te: > Is _SUPPORT magic? I didn't know. I guess MK_TESTS_SUPPORT is good > enough, especially if it's on by default. Even if it is magic, is that really the kind of magic we want to be keeping around? -Ben From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 15:34:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 48B3E4D6; Wed, 22 Oct 2014 15:34:56 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1535CA0D; Wed, 22 Oct 2014 15:34:55 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Xgxw0-000GVl-V9; Wed, 22 Oct 2014 15:34:49 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9MFYlEr065775; Wed, 22 Oct 2014 09:34:47 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18G2GRRiDn9pPSKqPgeI0D8 X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273417 - head From: Ian Lepore To: Benjamin Kaduk In-Reply-To: References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> <86mw8ocftw.fsf@nine.des.no> Content-Type: text/plain; charset="ISO-8859-1" Date: Wed, 22 Oct 2014 09:34:46 -0600 Message-ID: <1413992086.12052.548.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by ilsoft.org id s9MFYlEr065775 Cc: "svn-src-head@freebsd.org" , Dag-Erling =?ISO-8859-1?Q?Sm=F8rgrav?= , "svn-src-all@freebsd.org" , src-committers , Warner Losh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 15:34:56 -0000 On Wed, 2014-10-22 at 11:00 -0400, Benjamin Kaduk wrote: > On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=F8rgrav wr= ote: >=20 > > Is _SUPPORT magic? I didn't know. I guess MK_TESTS_SUPPORT is good > > enough, especially if it's on by default. >=20 >=20 > Even if it is magic, is that really the kind of magic we want to be kee= ping > around? >=20 > -Ben I didn't really think of it as magic so much as analogous to INVARIANTS vs INVARIANTS_SUPPORT in kernel config. -- Ian From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 15:37:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7B5466C3; Wed, 22 Oct 2014 15:37:33 +0000 (UTC) Received: from mail-pd0-x22a.google.com (mail-pd0-x22a.google.com [IPv6:2607:f8b0:400e:c02::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DF17A35; Wed, 22 Oct 2014 15:37:33 +0000 (UTC) Received: by mail-pd0-f170.google.com with SMTP id z10so3762573pdj.1 for ; Wed, 22 Oct 2014 08:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WnTsoWhQEyHnDEzuddaW1UO5JBSTDlaBcJM5o4zuPiU=; b=GyY2+Y91Y+zO1YMULBK5Th7xiprMQxvoOlvbawH8tKizg6yWkayQa/xwGXQJJHkqem eOWv0+nhEX52wNOZJPhDsF99cFDHCHoY6VXnzZGL0YWL0Lm0zrcQbKdmArRnxNerlLyX NAnVssQ2ZA2LGae07QUnJlBvoZHwxOcPTI6MhYupicGYA8+SoJaUXkoqGXOC6IOyqW48 pYVKeLFICtv5xVUNmtnLvkTevHnk4yFc7P/2Pq4tVSLIkj/tF6DIev0UUFtgOGZX6swi 6CKk2ifZnVBfRwLZ/dtdwEuFg6bbQC1S53za1W9ZypKQi2ZWls0LZK4030CyEqDkXMHF yVcw== MIME-Version: 1.0 X-Received: by 10.66.66.167 with SMTP id g7mr43773201pat.66.1413992252915; Wed, 22 Oct 2014 08:37:32 -0700 (PDT) Received: by 10.70.9.132 with HTTP; Wed, 22 Oct 2014 08:37:32 -0700 (PDT) In-Reply-To: <1413992086.12052.548.camel@revolution.hippie.lan> References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> <86mw8ocftw.fsf@nine.des.no> <1413992086.12052.548.camel@revolution.hippie.lan> Date: Wed, 22 Oct 2014 11:37:32 -0400 Message-ID: Subject: Re: svn commit: r273417 - head From: Benjamin Kaduk To: Ian Lepore Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Warner Losh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 15:37:33 -0000 On Wed, Oct 22, 2014 at 11:34 AM, Ian Lepore wrote: > On Wed, 2014-10-22 at 11:00 -0400, Benjamin Kaduk wrote: > > On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=C3=B8rgrav > wrote: > > > > > Is _SUPPORT magic? I didn't know. I guess MK_TESTS_SUPPORT is good > > > enough, especially if it's on by default. > > > > > > Even if it is magic, is that really the kind of magic we want to be > keeping > > around? > > > > -Ben > > I didn't really think of it as magic so much as analogous to INVARIANTS > vs INVARIANTS_SUPPORT in kernel config. > I can put INVARIANTS but not INVARIANTS_SUPPORT in my kernel config ... and it gives me a somewhat inscrutable build error. I didn't get the impression that's what's going on with MK_TESTS... -Ben From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 16:39:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E81E74B6 for ; Wed, 22 Oct 2014 16:39:44 +0000 (UTC) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B443416E for ; Wed, 22 Oct 2014 16:39:44 +0000 (UTC) Received: by mail-pa0-f46.google.com with SMTP id fa1so4006712pad.19 for ; Wed, 22 Oct 2014 09:39:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=3+ux8ZSz7IquOYVSr2XrpQpyJoG8YhoRBVnc0PLKEKw=; b=ED5LxogWNyc4374ubkrO3yxhBzY95Dho7xc955Knve9k6d9BZaO8DdLFN3D141yM2I ZCK8uPNU3mv7KKhh1hrYOvJ1yGdWLkW+go17kCWLknD+huR/bc8W9ShtE224VKoB7k8k nkka+nSSWf9oaUcCyvAWFeoys18dRbU/lQh5sEpDcLy84o4/PAhtOXPCR/iNfmdl903M vpn9FkuVW46FeTnlILd8FDzRn2+630+PDTzNal/7t8i2N0nXJZNyymVHC7G2DS6LYa/M VUg9Uzh/MY4OMVysR/j2ncKu1RmGPM2SIuiZc9DUHuZR0FHrMlrAYJCEeWtqsj0/Zv+a +9Wg== X-Gm-Message-State: ALoCoQlN+f2hM92n20MLny1WgBJAW/t9/MiUf7f+vU9YLV3UE0wkM4XtEO5kOqJlTp4EHVlGhELw X-Received: by 10.70.109.139 with SMTP id hs11mr24129565pdb.83.1413995978305; Wed, 22 Oct 2014 09:39:38 -0700 (PDT) Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id wr8sm14596553pbc.52.2014.10.22.09.39.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 09:39:37 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273417 - head From: Warner Losh In-Reply-To: <86mw8ocftw.fsf@nine.des.no> Date: Wed, 22 Oct 2014 10:39:33 -0600 Message-Id: <37EBD040-32F3-4096-B036-E93B51FCDBBD@bsdimp.com> References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> <86mw8ocftw.fsf@nine.des.no> To: =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 16:39:45 -0000 --Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 22, 2014, at 8:57 AM, Dag-Erling Sm=F8rgrav wrote: > Warner Losh writes: >> Dag-Erling Sm=F8rgrav writes: >>> I would prefer calling this MK_ATF than MK_TESTS_SUPPORT, though. >>> The test framework is probably useful on its own. >> That would be a nicer name, but then we=92d lose the automatic = setting >> when MK_TESTS is enabled (unless we add another special case, which = is >> the opposite direction that I want to go in). How strongly do you = feel >> that=92s a better name? >=20 > Is _SUPPORT magic? I didn't know. I guess MK_TESTS_SUPPORT is good > enough, especially if it's on by default. It is magic. Though one can replicate similar magic with MK_TESTS and = MK_ATF if one wanted to do so (there=92s a second list of defaults based on = settings that have unrelated names), though that list is much smaller and used in much more = obscure areas of the system. Warner --Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUR93FAAoJEGwc0Sh9sBEAmMIP/28CtvJpbHmSxaHSti+ZXvHW pB7uxlUVFDWq84qY9OQXSwsBNx4oSHnZUc9Q9p+f8WYLJ1j5/4Q63mPA+yxA8aPq /L/o5IS/D/asbYTKqzaCYfSlE9tDCzshDHgrGl1WJjFckw6NvW0p4MH0/ZFJIEO+ jPgarWruiurxPRybjY8mlX7ZwcJEpkclGcH9aVHsIxFy5ZpBC+3UfrwyFjm1lUhU bPmlXlGzLi14cSuWvRDqhyBx9+N33/KRzSE+DX4V78oj7uaU+kJ4Z3qVzdRt5pfB +D+KgJgWrc1uLB9hIpUCLWTjczFJTp0mrB7oeBxa5dZreglF+5bomMP1iVFeY0mJ Ycr0VqCz8SSyOncqODD11iNhZkxgELdX3SA58L2FUFL8JuXCr/L8DR6X30z2KVC8 qkZjhfg5vimbXitF8jUyNfdAv3lne5QciAgpYzebXQF6f3zxTZ8ZFkB3wBJerbVN 1OfaLeHR+puZL46DH5Igzh90Lf1eHCcCzRir8PJVG7kYO6skHB4MJ5aoyYfLJJhL hD0ZBvGd+GLhlsKFbx7x2EXeYrsLufm3WcTxNlsLzn1p2ODjjhGK3vPotqdC8gnb ExexFfXJYJASZryic3IZhlSoqi8w+Zb5ni7cfKJr/6Hj3MKge9bpdwy8aBUxX9Qh S70P3fLoUfbrYMMcWa22 =8RsM -----END PGP SIGNATURE----- --Apple-Mail=_686944A9-1466-4C08-B7C8-5669BA822739-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 16:42:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 72BC07C8 for ; Wed, 22 Oct 2014 16:42:57 +0000 (UTC) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E330232 for ; Wed, 22 Oct 2014 16:42:56 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id rd3so3353607pab.27 for ; Wed, 22 Oct 2014 09:42:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=IjZYzXCQjMl8oyI2tn4PXeln+f8v+UEAKeosrIYo3UU=; b=h0r5C+W9ChGkz0vcEU//OoJ8DFQpgWriANefOpKi2MWEeOvkH9OnajclzdV1VJ9eMr nPZm1LK69alHIIQG/Z6Pa6cuJ+sSb4XBMt3nmagxBFNSwEAeFjLhA8dduQiXwNPXvN60 ihUY9odSRpGR6S+pudizgVS1WEh+2zusMrkXVB1VV6g2okDCnVOtyY8aNgN7+5h2FDb8 w7D5DojFEd0pzquQh+xDh63gTwpHCCr2oZm8VbLK/PU1m9eIiGUqlgPn1zr1w90Tz5Xg BIK7wfvGP2xDcaz4w2UJ1fU/nZpb4H4cIJGhAv5U1VUPNyMshfaQGPIrdVdk9THtkEkA yTaw== X-Gm-Message-State: ALoCoQl/wl31ydgWCIKCoLRX7VR0CShrKqNKY6NVdVvF118OlmM89QaHNnlAIKzjivdYxc7MvwZN X-Received: by 10.70.65.37 with SMTP id u5mr43590455pds.93.1413996170034; Wed, 22 Oct 2014 09:42:50 -0700 (PDT) Received: from macintosh-c42c033c0b73.corp.netflix.com (dc1-prod.netflix.com. [69.53.236.251]) by mx.google.com with ESMTPSA id df1sm14637176pbb.2.2014.10.22.09.42.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Oct 2014 09:42:49 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273417 - head From: Warner Losh In-Reply-To: Date: Wed, 22 Oct 2014 10:42:45 -0600 Message-Id: <0B9A1629-8DE1-4798-B4C7-8CE4A02C187F@bsdimp.com> References: <201410212029.s9LKThT2074337@svn.freebsd.org> <86d29k28wh.fsf@nine.des.no> <22788EC4-3BDF-40F3-ACAC-FA686ED21154@bsdimp.com> <86iojco2oh.fsf@nine.des.no> <6287010D-9C54-4167-9784-84134080A419@bsdimp.com> <86mw8ocftw.fsf@nine.des.no> To: Benjamin Kaduk X-Mailer: Apple Mail (2.1878.6) Cc: "svn-src-head@freebsd.org" , =?iso-8859-1?Q?Dag-Erling_Sm=F8rgrav?= , "svn-src-all@freebsd.org" , src-committers X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 16:42:57 -0000 --Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Oct 22, 2014, at 9:00 AM, Benjamin Kaduk wrote: > On Wed, Oct 22, 2014 at 10:57 AM, Dag-Erling Sm=F8rgrav = wrote: > Is _SUPPORT magic? I didn't know. I guess MK_TESTS_SUPPORT is good > enough, especially if it's on by default. >=20 > Even if it is magic, is that really the kind of magic we want to be = keeping around? We have it for about a dozen other areas that are very similar to this = case: BZIP2 GNU INET INET6 KERBEROS KVM NETGRAPH PAM TESTS WIRELESS It is a regularized part of the system. By contrast we have only two = cases where the names aren=92t related in a regular way: GSSAPI/KERBEROS MAN_UTILS/MAN So if you=92d like to propose a better framework for dealing, please be = my guest. Hell, I may even support that because I didn=92t come up with the current system. = However, inventing something new vs using the current convention dictates that we follow = the current conventions. Warner --Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUR96FAAoJEGwc0Sh9sBEAYmIQAJTbmHRPYgbtEEsqETRfgzow Tg6+ToQyfcAZCq9azeaFwxx7j7nlJvl7hR/irw/wWOJK0UXcjvqsYJFovKVH1nkQ mkQHn+WcRgyQvK+tyqbWhjxH8WpVnLLXQaOuRff7/ph9P2OS+pKSmzNnPdY7Hwkk n5VMoK65F5wBkp8G/kalpMIk+jGfohNFiSnb4e+DwYv/O68n7hWmCzxrPGFFW0Mi gHT+4777VWp/jRC8ITWMyXU/Rh8VWHmxEdyJBUldUKJq7BI9QbP5ZW5Ir442V6oO DOq4Ncf7amSQq10jSHA1Jg8TBmGLmSOyicjq00o4lM4DGg8wwiHq4/3hTiw200ho uam2BKak0ncnaFU4yNT7q3YDQ8Uly0Zs/xCeHUIAwkd7bz4k1HyDWLGaVN8o1Jdl nmqEA/3MBMbU+VzDFYBmKw4KjESh5klsLbiVIcXCB03we9WA/kelbbyvDnMMwI/g R8l3NB332rAPa3vBNdj+Kfp8QOb1iO1EmctWCQUeu5/LI56nnxbCFA/B/oELXGiE y9qWyN1tDNswzoWmK30MoauRCvTtuJqHZCcfqfZOpI4E+71HAamILrzFubsCYuNx iIiNYup+sR0sX2E2h478oyDbBNylZgbPh3TvF3J7uCi/+d3Fn7xwideBJDkBu4Qh tIvg2A0xe05zpSAoAkh1 =eoFX -----END PGP SIGNATURE----- --Apple-Mail=_4CE33535-E98D-46AA-82B4-1FC49EA960BA-- From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 16:49:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B87F292A; Wed, 22 Oct 2014 16:49:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A51DE281; Wed, 22 Oct 2014 16:49:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGn1s8050313; Wed, 22 Oct 2014 16:49:01 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGn1Sf050311; Wed, 22 Oct 2014 16:49:01 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221649.s9MGn1Sf050311@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 16:49:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273472 - head/sys/x86/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 16:49:01 -0000 Author: royger Date: Wed Oct 22 16:49:00 2014 New Revision: 273472 URL: https://svnweb.freebsd.org/changeset/base/273472 Log: xen: fix usage of kern_getenv in PVH code The value returned by kern_getenv should be freed using freeenv. Reported by: Coverity CID: 1248852 Sponsored by: Citrix Systems R&D Modified: head/sys/x86/xen/pv.c Modified: head/sys/x86/xen/pv.c ============================================================================== --- head/sys/x86/xen/pv.c Wed Oct 22 13:50:38 2014 (r273471) +++ head/sys/x86/xen/pv.c Wed Oct 22 16:49:00 2014 (r273472) @@ -306,11 +306,14 @@ static void xen_pv_set_boothowto(void) { int i; + char *env; /* get equivalents from the environment */ for (i = 0; howto_names[i].ev != NULL; i++) { - if (kern_getenv(howto_names[i].ev) != NULL) + if ((env = kern_getenv(howto_names[i].ev)) != NULL) { boothowto |= howto_names[i].mask; + freeenv(env); + } } } From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 16:51:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 27EDEAA3; Wed, 22 Oct 2014 16:51:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1468F2BF; Wed, 22 Oct 2014 16:51:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGpqoj053476; Wed, 22 Oct 2014 16:51:52 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGpq0b053474; Wed, 22 Oct 2014 16:51:52 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221651.s9MGpq0b053474@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 16:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273473 - in head/sys: x86/xen xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 16:51:53 -0000 Author: royger Date: Wed Oct 22 16:51:52 2014 New Revision: 273473 URL: https://svnweb.freebsd.org/changeset/base/273473 Log: xen: allow to register event channels without handlers This is needed by the event channel user-space device, that requires registering event channels without unmasking them. intr_add_handler will unconditionally unmask the event channel, so we avoid calling it if no filter/handler is provided, and then the user will be in charge of calling it when ready. In order to do this, we need to change the opaque type xen_intr_handle_t to contain the event channel port instead of the opaque cookie returned by intr_add_handler, since now registration of event channels without handlers are allowed. The cookie will now be stored inside of the private xenisrc struct. Also, introduce a new function called xen_intr_add_handler that allows adding a filter/handler after the event channel has been registered. Sponsored by: Citrix Systems R&D x86/xen/xen_intr.c: - Leave the event channel without a handler if no filter/handler is provided to xen_intr_bind_isrc. - Don't perform an evtchn_mask_port, intr_add_handler will already do it. - Change the opaque type xen_intr_handle_t to contain a pointer to the event channel port number, and make the necessary changes to related functions. - Introduce a new function called xen_intr_add_handler that can be used to add filter/handlers to an event channel after registration. xen/xen_intr.h: - Add prototype of xen_intr_add_handler. Modified: head/sys/x86/xen/xen_intr.c head/sys/xen/xen_intr.h Modified: head/sys/x86/xen/xen_intr.c ============================================================================== --- head/sys/x86/xen/xen_intr.c Wed Oct 22 16:49:00 2014 (r273472) +++ head/sys/x86/xen/xen_intr.c Wed Oct 22 16:51:52 2014 (r273473) @@ -110,10 +110,11 @@ DPCPU_DEFINE(struct xen_intr_pcpu_data, DPCPU_DECLARE(struct vcpu_info *, vcpu_info); -#define is_valid_evtchn(x) ((x) != 0) - #define XEN_EEXIST 17 /* Xen "already exists" error */ #define XEN_ALLOCATE_VECTOR 0 /* Allocate a vector for this event channel */ +#define XEN_INVALID_EVTCHN 0 /* Invalid event channel */ + +#define is_valid_evtchn(x) ((x) != XEN_INVALID_EVTCHN) struct xenisrc { struct intsrc xi_intsrc; @@ -123,6 +124,7 @@ struct xenisrc { evtchn_port_t xi_port; int xi_pirq; int xi_virq; + void *xi_cookie; u_int xi_close:1; /* close on unbind? */ u_int xi_shared:1; /* Shared with other domains. */ u_int xi_activehi:1; @@ -365,6 +367,7 @@ xen_intr_release_isrc(struct xenisrc *is isrc->xi_cpu = 0; isrc->xi_type = EVTCHN_TYPE_UNBOUND; isrc->xi_port = 0; + isrc->xi_cookie = NULL; mtx_unlock(&xen_intr_isrc_lock); return (0); } @@ -419,17 +422,26 @@ xen_intr_bind_isrc(struct xenisrc **isrc xen_intr_port_to_isrc[local_port] = isrc; mtx_unlock(&xen_intr_isrc_lock); - error = intr_add_handler(device_get_nameunit(intr_owner), - isrc->xi_vector, filter, handler, arg, - flags|INTR_EXCL, port_handlep); + /* Assign the opaque handler (the event channel port) */ + *port_handlep = &isrc->xi_port; + + if (filter == NULL && handler == NULL) { + /* + * No filter/handler provided, leave the event channel + * masked and without a valid handler, the caller is + * in charge of setting that up. + */ + *isrcp = isrc; + return (0); + } + + error = xen_intr_add_handler(intr_owner, filter, handler, arg, flags, + *port_handlep); if (error != 0) { - device_printf(intr_owner, - "xen_intr_bind_irq: intr_add_handler failed\n"); xen_intr_release_isrc(isrc); return (error); } *isrcp = isrc; - evtchn_unmask_port(local_port); return (0); } @@ -446,13 +458,16 @@ xen_intr_bind_isrc(struct xenisrc **isrc static struct xenisrc * xen_intr_isrc(xen_intr_handle_t handle) { - struct intr_handler *ih; + evtchn_port_t port; + + if (handle == NULL) + return (NULL); - ih = handle; - if (ih == NULL || ih->ih_event == NULL) + port = *(evtchn_port_t *)handle; + if (!is_valid_evtchn(port) || port >= NR_EVENT_CHANNELS) return (NULL); - return (ih->ih_event->ie_source); + return (xen_intr_port_to_isrc[port]); } /** @@ -1446,22 +1461,24 @@ xen_intr_describe(xen_intr_handle_t port va_start(ap, fmt); vsnprintf(descr, sizeof(descr), fmt, ap); va_end(ap); - return (intr_describe(isrc->xi_vector, port_handle, descr)); + return (intr_describe(isrc->xi_vector, isrc->xi_cookie, descr)); } void xen_intr_unbind(xen_intr_handle_t *port_handlep) { - struct intr_handler *handler; struct xenisrc *isrc; - handler = *port_handlep; + KASSERT(port_handlep != NULL, + ("NULL xen_intr_handle_t passed to xen_intr_unbind")); + + isrc = xen_intr_isrc(*port_handlep); *port_handlep = NULL; - isrc = xen_intr_isrc(handler); if (isrc == NULL) return; - intr_remove_handler(handler); + if (isrc->xi_cookie != NULL) + intr_remove_handler(isrc->xi_cookie); xen_intr_release_isrc(isrc); } @@ -1492,6 +1509,29 @@ xen_intr_port(xen_intr_handle_t handle) return (isrc->xi_port); } +int +xen_intr_add_handler(device_t dev, driver_filter_t filter, + driver_intr_t handler, void *arg, enum intr_type flags, + xen_intr_handle_t handle) +{ + struct xenisrc *isrc; + int error; + + isrc = xen_intr_isrc(handle); + if (isrc == NULL || isrc->xi_cookie != NULL) + return (EINVAL); + + error = intr_add_handler(device_get_nameunit(dev), isrc->xi_vector, + filter, handler, arg, flags|INTR_EXCL, &isrc->xi_cookie); + if (error != 0) { + device_printf(dev, + "xen_intr_add_handler: intr_add_handler failed: %d\n", + error); + } + + return (error); +} + #ifdef DDB static const char * xen_intr_print_type(enum evtchn_type type) Modified: head/sys/xen/xen_intr.h ============================================================================== --- head/sys/xen/xen_intr.h Wed Oct 22 16:49:00 2014 (r273472) +++ head/sys/xen/xen_intr.h Wed Oct 22 16:51:52 2014 (r273473) @@ -246,4 +246,23 @@ int xen_register_msi(device_t dev, int v */ int xen_release_msi(int vector); +/** + * Bind an event channel port with a handler + * + * \param dev The device making this bind request. + * \param filter An interrupt filter handler. Specify NULL + * to always dispatch to the ithread handler. + * \param handler An interrupt ithread handler. Optional (can + * specify NULL) if all necessary event actions + * are performed by filter. + * \param arg Argument to present to both filter and handler. + * \param irqflags Interrupt handler flags. See sys/bus.h. + * \param handle Opaque handle used to manage this registration. + * + * \returns 0 on success, otherwise an errno. + */ +int xen_intr_add_handler(device_t dev, driver_filter_t filter, + driver_intr_t handler, void *arg, enum intr_type flags, + xen_intr_handle_t handle); + #endif /* _XEN_INTR_H_ */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 16:57:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 41DEBC83; Wed, 22 Oct 2014 16:57:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CEB939F; Wed, 22 Oct 2014 16:57:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGvCs4054780; Wed, 22 Oct 2014 16:57:12 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGvBES054777; Wed, 22 Oct 2014 16:57:11 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221657.s9MGvBES054777@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 16:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273474 - in head/sys: conf dev/xen/evtchn xen/evtchn X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 16:57:12 -0000 Author: royger Date: Wed Oct 22 16:57:11 2014 New Revision: 273474 URL: https://svnweb.freebsd.org/changeset/base/273474 Log: xen: import a proper event channel user-space device The user-space event channel device is used by applications to receive and send event channel interrupts. This device is based on the Linux evtchn device. Sponsored by: Citrix Systems R&D xen/evtchn/evtchn_dev.c: - Remove the old event channel device, which was already disabled in the build system. dev/xen/evtchn/evtchn_dev.c: - Import a new event channel device based on the one present in Linux. - This device allows the following operations: - Bind VIRQ event channels (ioctl). - Bind regular event channels (ioctl). - Create and bind new event channels (ioctl). - Unbind event channels (ioctl). - Send notifications to event channels (ioctl). - Reset the device shared memory ring (ioctl). - Unmask event channels (write). - Receive event channel upcalls (read). - The new code is MP safe, and can be used concurrently. conf/files: - Add the new device to the build system. Added: head/sys/dev/xen/evtchn/ head/sys/dev/xen/evtchn/evtchn_dev.c (contents, props changed) Deleted: head/sys/xen/evtchn/evtchn_dev.c Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Oct 22 16:51:52 2014 (r273473) +++ head/sys/conf/files Wed Oct 22 16:57:11 2014 (r273474) @@ -2647,6 +2647,7 @@ dev/xen/pvcpu/pvcpu.c optional xen | xe dev/xen/xenstore/xenstore.c optional xen | xenhvm dev/xen/xenstore/xenstore_dev.c optional xen | xenhvm dev/xen/xenstore/xenstored_dev.c optional xen | xenhvm +dev/xen/evtchn/evtchn_dev.c optional xen | xenhvm dev/xl/if_xl.c optional xl pci dev/xl/xlphy.c optional xl pci fs/autofs/autofs.c optional autofs Added: head/sys/dev/xen/evtchn/evtchn_dev.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xen/evtchn/evtchn_dev.c Wed Oct 22 16:57:11 2014 (r273474) @@ -0,0 +1,607 @@ +/****************************************************************************** + * evtchn.c + * + * Driver for receiving and demuxing event-channel signals. + * + * Copyright (c) 2004-2005, K A Fraser + * Multi-process extensions Copyright (c) 2004, Steven Smith + * FreeBSD port Copyright (c) 2014, Roger Pau Monné + * Fetched from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git + * File: drivers/xen/evtchn.c + * Git commit: 0dc0064add422bc0ef5165ebe9ece3052bbd457d + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation; or, when distributed + * separately from the Linux kernel or incorporated into other + * software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include + +MALLOC_DEFINE(M_EVTCHN, "evtchn_dev", "Xen event channel user-space device"); + +struct user_evtchn; + +static int evtchn_cmp(struct user_evtchn *u1, struct user_evtchn *u2); + +RB_HEAD(evtchn_tree, user_evtchn); + +struct per_user_data { + struct mtx bind_mutex; /* serialize bind/unbind operations */ + struct evtchn_tree evtchns; + + /* Notification ring, accessed via /dev/xen/evtchn. */ +#define EVTCHN_RING_SIZE (PAGE_SIZE / sizeof(evtchn_port_t)) +#define EVTCHN_RING_MASK(_i) ((_i)&(EVTCHN_RING_SIZE-1)) + evtchn_port_t *ring; + unsigned int ring_cons, ring_prod, ring_overflow; + struct sx ring_cons_mutex; /* protect against concurrent readers */ + struct mtx ring_prod_mutex; /* product against concurrent interrupts */ + struct selinfo ev_rsel; +}; + +struct user_evtchn { + RB_ENTRY(user_evtchn) node; + struct per_user_data *user; + evtchn_port_t port; + xen_intr_handle_t handle; + bool enabled; +}; + +RB_GENERATE_STATIC(evtchn_tree, user_evtchn, node, evtchn_cmp); + +static device_t evtchn_dev; + +static d_read_t evtchn_read; +static d_write_t evtchn_write; +static d_ioctl_t evtchn_ioctl; +static d_poll_t evtchn_poll; +static d_open_t evtchn_open; + +static void evtchn_release(void *arg); + +static struct cdevsw evtchn_devsw = { + .d_version = D_VERSION, + .d_open = evtchn_open, + .d_read = evtchn_read, + .d_write = evtchn_write, + .d_ioctl = evtchn_ioctl, + .d_poll = evtchn_poll, + .d_name = "evtchn", +}; + +/*------------------------- Red-black tree helpers ---------------------------*/ +static int +evtchn_cmp(struct user_evtchn *u1, struct user_evtchn *u2) +{ + + return (u1->port - u2->port); +} + +static struct user_evtchn * +find_evtchn(struct per_user_data *u, evtchn_port_t port) +{ + struct user_evtchn tmp = { + .port = port, + }; + + return (RB_FIND(evtchn_tree, &u->evtchns, &tmp)); +} + +/*--------------------------- Interrupt handlers -----------------------------*/ +static int +evtchn_filter(void *arg) +{ + struct user_evtchn *evtchn; + + evtchn = arg; + + if (!evtchn->enabled && bootverbose) { + device_printf(evtchn_dev, + "Received upcall for disabled event channel %d\n", + evtchn->port); + } + + evtchn_mask_port(evtchn->port); + evtchn->enabled = false; + + return (FILTER_SCHEDULE_THREAD); +} + +static void +evtchn_interrupt(void *arg) +{ + struct user_evtchn *evtchn; + struct per_user_data *u; + + evtchn = arg; + u = evtchn->user; + + /* + * Protect against concurrent events using this handler + * on different CPUs. + */ + mtx_lock(&u->ring_prod_mutex); + if ((u->ring_prod - u->ring_cons) < EVTCHN_RING_SIZE) { + u->ring[EVTCHN_RING_MASK(u->ring_prod)] = evtchn->port; + wmb(); /* Ensure ring contents visible */ + if (u->ring_cons == u->ring_prod++) { + wakeup(u); + selwakeup(&u->ev_rsel); + } + } else + u->ring_overflow = 1; + mtx_unlock(&u->ring_prod_mutex); +} + +/*------------------------- Character device methods -------------------------*/ +static int +evtchn_open(struct cdev *dev, int flag, int otyp, struct thread *td) +{ + struct per_user_data *u; + int error; + + u = malloc(sizeof(*u), M_EVTCHN, M_WAITOK | M_ZERO); + u->ring = malloc(PAGE_SIZE, M_EVTCHN, M_WAITOK | M_ZERO); + + /* Initialize locks */ + mtx_init(&u->bind_mutex, "evtchn_bind_mutex", NULL, MTX_DEF); + sx_init(&u->ring_cons_mutex, "evtchn_ringc_sx"); + mtx_init(&u->ring_prod_mutex, "evtchn_ringp_mutex", NULL, MTX_DEF); + + /* Initialize red-black tree. */ + RB_INIT(&u->evtchns); + + /* Assign the allocated per_user_data to this open instance. */ + error = devfs_set_cdevpriv(u, evtchn_release); + if (error != 0) { + mtx_destroy(&u->bind_mutex); + mtx_destroy(&u->ring_prod_mutex); + sx_destroy(&u->ring_cons_mutex); + free(u->ring, M_EVTCHN); + free(u, M_EVTCHN); + } + + return (error); +} + +static void +evtchn_release(void *arg) +{ + struct per_user_data *u; + struct user_evtchn *evtchn, *tmp; + + u = arg; + + seldrain(&u->ev_rsel); + + RB_FOREACH_SAFE(evtchn, evtchn_tree, &u->evtchns, tmp) { + xen_intr_unbind(&evtchn->handle); + + RB_REMOVE(evtchn_tree, &u->evtchns, evtchn); + free(evtchn, M_EVTCHN); + } + + mtx_destroy(&u->bind_mutex); + mtx_destroy(&u->ring_prod_mutex); + sx_destroy(&u->ring_cons_mutex); + free(u->ring, M_EVTCHN); + free(u, M_EVTCHN); +} + +static int +evtchn_read(struct cdev *dev, struct uio *uio, int ioflag) +{ + int error, count; + unsigned int c, p, bytes1 = 0, bytes2 = 0; + struct per_user_data *u; + + error = devfs_get_cdevpriv((void **)&u); + if (error != 0) + return (EINVAL); + + /* Whole number of ports. */ + count = uio->uio_resid; + count &= ~(sizeof(evtchn_port_t)-1); + + if (count == 0) + return (0); + + if (count > PAGE_SIZE) + count = PAGE_SIZE; + + sx_xlock(&u->ring_cons_mutex); + for (;;) { + error = EFBIG; + if (u->ring_overflow) + goto unlock_out; + + c = u->ring_cons; + p = u->ring_prod; + if (c != p) + break; + + if (ioflag & IO_NDELAY) { + sx_xunlock(&u->ring_cons_mutex); + return (EWOULDBLOCK); + } + + error = sx_sleep(u, &u->ring_cons_mutex, PCATCH, "evtchw", 0); + if ((error != 0) && (error != EWOULDBLOCK)) + return (error); + } + + /* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */ + if (((c ^ p) & EVTCHN_RING_SIZE) != 0) { + bytes1 = (EVTCHN_RING_SIZE - EVTCHN_RING_MASK(c)) * + sizeof(evtchn_port_t); + bytes2 = EVTCHN_RING_MASK(p) * sizeof(evtchn_port_t); + } else { + bytes1 = (p - c) * sizeof(evtchn_port_t); + bytes2 = 0; + } + + /* Truncate chunks according to caller's maximum byte count. */ + if (bytes1 > count) { + bytes1 = count; + bytes2 = 0; + } else if ((bytes1 + bytes2) > count) { + bytes2 = count - bytes1; + } + + error = EFAULT; + rmb(); /* Ensure that we see the port before we copy it. */ + + if (uiomove(&u->ring[EVTCHN_RING_MASK(c)], bytes1, uio) || + ((bytes2 != 0) && uiomove(&u->ring[0], bytes2, uio))) + goto unlock_out; + + u->ring_cons += (bytes1 + bytes2) / sizeof(evtchn_port_t); + error = 0; + +unlock_out: + sx_xunlock(&u->ring_cons_mutex); + return (error); +} + +static int +evtchn_write(struct cdev *dev, struct uio *uio, int ioflag) +{ + int error, i, count; + evtchn_port_t *kbuf; + struct per_user_data *u; + + error = devfs_get_cdevpriv((void **)&u); + if (error != 0) + return (EINVAL); + + kbuf = malloc(PAGE_SIZE, M_EVTCHN, M_WAITOK); + if (kbuf == NULL) + return (ENOMEM); + + count = uio->uio_resid; + /* Whole number of ports. */ + count &= ~(sizeof(evtchn_port_t)-1); + + error = 0; + if (count == 0) + goto out; + + if (count > PAGE_SIZE) + count = PAGE_SIZE; + + error = uiomove(kbuf, count, uio); + if (error != 0) + goto out; + + mtx_lock(&u->bind_mutex); + + for (i = 0; i < (count/sizeof(evtchn_port_t)); i++) { + evtchn_port_t port = kbuf[i]; + struct user_evtchn *evtchn; + + evtchn = find_evtchn(u, port); + if (evtchn && !evtchn->enabled) { + evtchn->enabled = true; + evtchn_unmask_port(evtchn->port); + } + } + + mtx_unlock(&u->bind_mutex); + error = 0; + +out: + free(kbuf, M_EVTCHN); + return (error); +} + +static inline int +evtchn_bind_user_port(struct per_user_data *u, struct user_evtchn *evtchn) +{ + int error; + + evtchn->port = xen_intr_port(evtchn->handle); + evtchn->user = u; + evtchn->enabled = true; + mtx_lock(&u->bind_mutex); + RB_INSERT(evtchn_tree, &u->evtchns, evtchn); + mtx_unlock(&u->bind_mutex); + error = xen_intr_add_handler(evtchn_dev, evtchn_filter, + evtchn_interrupt, evtchn, INTR_TYPE_MISC | INTR_MPSAFE, + evtchn->handle); + if (error != 0) { + xen_intr_unbind(&evtchn->handle); + mtx_lock(&u->bind_mutex); + RB_REMOVE(evtchn_tree, &u->evtchns, evtchn); + mtx_unlock(&u->bind_mutex); + free(evtchn, M_EVTCHN); + } + return (error); +} + +static int +evtchn_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg, + int mode, struct thread *td __unused) +{ + struct per_user_data *u; + int error; + + error = devfs_get_cdevpriv((void **)&u); + if (error != 0) + return (EINVAL); + + switch (cmd) { + case IOCTL_EVTCHN_BIND_VIRQ: { + struct ioctl_evtchn_bind_virq *bind; + struct user_evtchn *evtchn; + + evtchn = malloc(sizeof(*evtchn), M_EVTCHN, M_WAITOK | M_ZERO); + + bind = (struct ioctl_evtchn_bind_virq *)arg; + + error = xen_intr_bind_virq(evtchn_dev, bind->virq, 0, + NULL, NULL, NULL, 0, &evtchn->handle); + if (error != 0) { + free(evtchn, M_EVTCHN); + break; + } + error = evtchn_bind_user_port(u, evtchn); + if (error != 0) + break; + bind->port = evtchn->port; + break; + } + + case IOCTL_EVTCHN_BIND_INTERDOMAIN: { + struct ioctl_evtchn_bind_interdomain *bind; + struct user_evtchn *evtchn; + + evtchn = malloc(sizeof(*evtchn), M_EVTCHN, M_WAITOK | M_ZERO); + + bind = (struct ioctl_evtchn_bind_interdomain *)arg; + + error = xen_intr_bind_remote_port(evtchn_dev, + bind->remote_domain, bind->remote_port, NULL, + NULL, NULL, 0, &evtchn->handle); + if (error != 0) { + free(evtchn, M_EVTCHN); + break; + } + error = evtchn_bind_user_port(u, evtchn); + if (error != 0) + break; + bind->port = evtchn->port; + break; + } + + case IOCTL_EVTCHN_BIND_UNBOUND_PORT: { + struct ioctl_evtchn_bind_unbound_port *bind; + struct user_evtchn *evtchn; + + evtchn = malloc(sizeof(*evtchn), M_EVTCHN, M_WAITOK | M_ZERO); + + bind = (struct ioctl_evtchn_bind_unbound_port *)arg; + + error = xen_intr_alloc_and_bind_local_port(evtchn_dev, + bind->remote_domain, NULL, NULL, NULL, 0, &evtchn->handle); + if (error != 0) { + free(evtchn, M_EVTCHN); + break; + } + error = evtchn_bind_user_port(u, evtchn); + if (error != 0) + break; + bind->port = evtchn->port; + break; + } + + case IOCTL_EVTCHN_UNBIND: { + struct ioctl_evtchn_unbind *unbind; + struct user_evtchn *evtchn; + + unbind = (struct ioctl_evtchn_unbind *)arg; + + mtx_lock(&u->bind_mutex); + evtchn = find_evtchn(u, unbind->port); + if (evtchn == NULL) { + error = ENOTCONN; + break; + } + + xen_intr_unbind(&evtchn->handle); + RB_REMOVE(evtchn_tree, &u->evtchns, evtchn); + mtx_unlock(&u->bind_mutex); + free(evtchn, M_EVTCHN); + error = 0; + break; + } + + case IOCTL_EVTCHN_NOTIFY: { + struct ioctl_evtchn_notify *notify; + struct user_evtchn *evtchn; + + notify = (struct ioctl_evtchn_notify *)arg; + + mtx_lock(&u->bind_mutex); + evtchn = find_evtchn(u, notify->port); + if (evtchn == NULL) { + error = ENOTCONN; + break; + } + + xen_intr_signal(evtchn->handle); + mtx_unlock(&u->bind_mutex); + error = 0; + break; + } + + case IOCTL_EVTCHN_RESET: { + /* Initialise the ring to empty. Clear errors. */ + sx_xlock(&u->ring_cons_mutex); + mtx_lock(&u->ring_prod_mutex); + u->ring_cons = u->ring_prod = u->ring_overflow = 0; + mtx_unlock(&u->ring_prod_mutex); + sx_xunlock(&u->ring_cons_mutex); + error = 0; + break; + } + + case FIONBIO: + case FIOASYNC: + /* Handled in an upper layer */ + error = 0; + break; + + default: + error = ENOTTY; + break; + } + + return (error); +} + +static int +evtchn_poll(struct cdev *dev, int events, struct thread *td) +{ + struct per_user_data *u; + int error, mask; + + error = devfs_get_cdevpriv((void **)&u); + if (error != 0) + return (POLLERR); + + /* we can always write */ + mask = events & (POLLOUT | POLLWRNORM); + + mtx_lock(&u->ring_prod_mutex); + if (events & (POLLIN | POLLRDNORM)) { + if (u->ring_cons != u->ring_prod) { + mask |= events & (POLLIN | POLLRDNORM); + } else { + /* Record that someone is waiting */ + selrecord(td, &u->ev_rsel); + } + } + mtx_unlock(&u->ring_prod_mutex); + + return (mask); +} + +/*------------------ Private Device Attachment Functions --------------------*/ +static void +evtchn_identify(driver_t *driver, device_t parent) +{ + + KASSERT((xen_domain()), + ("Trying to attach evtchn device on non Xen domain")); + + evtchn_dev = BUS_ADD_CHILD(parent, 0, "evtchn", 0); + if (evtchn_dev == NULL) + panic("unable to attach evtchn user-space device"); +} + +static int +evtchn_probe(device_t dev) +{ + + device_set_desc(dev, "Xen event channel user-space device"); + return (BUS_PROBE_NOWILDCARD); +} + +static int +evtchn_attach(device_t dev) +{ + + make_dev_credf(MAKEDEV_ETERNAL, &evtchn_devsw, 0, NULL, UID_ROOT, + GID_WHEEL, 0600, "xen/evtchn"); + return (0); +} + +/*-------------------- Private Device Attachment Data -----------------------*/ +static device_method_t evtchn_methods[] = { + DEVMETHOD(device_identify, evtchn_identify), + DEVMETHOD(device_probe, evtchn_probe), + DEVMETHOD(device_attach, evtchn_attach), + + DEVMETHOD_END +}; + +static driver_t evtchn_driver = { + "evtchn", + evtchn_methods, + 0, +}; + +devclass_t evtchn_devclass; + +DRIVER_MODULE(evtchn, xenpv, evtchn_driver, evtchn_devclass, 0, 0); +MODULE_DEPEND(evtchn, xenpv, 1, 1, 1); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 16:58:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C136ADDC; Wed, 22 Oct 2014 16:58:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A48153B7; Wed, 22 Oct 2014 16:58:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MGwr6C055017; Wed, 22 Oct 2014 16:58:53 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MGwr0L055016; Wed, 22 Oct 2014 16:58:53 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221658.s9MGwr0L055016@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 16:58:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273475 - head/sys/xen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 16:58:53 -0000 Author: royger Date: Wed Oct 22 16:58:52 2014 New Revision: 273475 URL: https://svnweb.freebsd.org/changeset/base/273475 Log: xen: add a Xen to BSD error translation Since Xen and FreeBSD error codes are completely different add a translation layer in order to convert Xen error codes into native FreeBSD error codes. This will be used by the privcmd device, which needs to return the hypercall errors into user-space. Sponsored by: Citrix Systems R&D xen/error.h: - Import Xen error codes. - Create a table to map Xen error codes into FreeBSD native error codes. - Create an inline function that performs the translation. Added: head/sys/xen/error.h (contents, props changed) Added: head/sys/xen/error.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/error.h Wed Oct 22 16:58:52 2014 (r273475) @@ -0,0 +1,305 @@ +/*- + * Copyright (c) 2014 Roger Pau Monné . + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __XEN_ERROR_H__ +#define __XEN_ERROR_H__ + +/* List of Xen error codes */ +#define XEN_EPERM 1 /* Operation not permitted */ +#define XEN_ENOENT 2 /* No such file or directory */ +#define XEN_ESRCH 3 /* No such process */ +#define XEN_EINTR 4 /* Interrupted system call */ +#define XEN_EIO 5 /* I/O error */ +#define XEN_ENXIO 6 /* No such device or address */ +#define XEN_E2BIG 7 /* Arg list too long */ +#define XEN_ENOEXEC 8 /* Exec format error */ +#define XEN_EBADF 9 /* Bad file number */ +#define XEN_ECHILD 10 /* No child processes */ +#define XEN_EAGAIN 11 /* Try again */ +#define XEN_ENOMEM 12 /* Out of memory */ +#define XEN_EACCES 13 /* Permission denied */ +#define XEN_EFAULT 14 /* Bad address */ +#define XEN_ENOTBLK 15 /* Block device required */ +#define XEN_EBUSY 16 /* Device or resource busy */ +#define XEN_EEXIST 17 /* File exists */ +#define XEN_EXDEV 18 /* Cross-device link */ +#define XEN_ENODEV 19 /* No such device */ +#define XEN_ENOTDIR 20 /* Not a directory */ +#define XEN_EISDIR 21 /* Is a directory */ +#define XEN_EINVAL 22 /* Invalid argument */ +#define XEN_ENFILE 23 /* File table overflow */ +#define XEN_EMFILE 24 /* Too many open files */ +#define XEN_ENOTTY 25 /* Not a typewriter */ +#define XEN_ETXTBSY 26 /* Text file busy */ +#define XEN_EFBIG 27 /* File too large */ +#define XEN_ENOSPC 28 /* No space left on device */ +#define XEN_ESPIPE 29 /* Illegal seek */ +#define XEN_EROFS 30 /* Read-only file system */ +#define XEN_EMLINK 31 /* Too many links */ +#define XEN_EPIPE 32 /* Broken pipe */ +#define XEN_EDOM 33 /* Math argument out of domain of func */ +#define XEN_ERANGE 34 /* Math result not representable */ +#define XEN_EDEADLK 35 /* Resource deadlock would occur */ +#define XEN_ENAMETOOLONG 36 /* File name too long */ +#define XEN_ENOLCK 37 /* No record locks available */ +#define XEN_ENOSYS 38 /* Function not implemented */ +#define XEN_ENOTEMPTY 39 /* Directory not empty */ +#define XEN_ELOOP 40 /* Too many symbolic links encountered */ +#define XEN_ENOMSG 42 /* No message of desired type */ +#define XEN_EIDRM 43 /* Identifier removed */ +#define XEN_ECHRNG 44 /* Channel number out of range */ +#define XEN_EL2NSYNC 45 /* Level 2 not synchronized */ +#define XEN_EL3HLT 46 /* Level 3 halted */ +#define XEN_EL3RST 47 /* Level 3 reset */ +#define XEN_ELNRNG 48 /* Link number out of range */ +#define XEN_EUNATCH 49 /* Protocol driver not attached */ +#define XEN_ENOCSI 50 /* No CSI structure available */ +#define XEN_EL2HLT 51 /* Level 2 halted */ +#define XEN_EBADE 52 /* Invalid exchange */ +#define XEN_EBADR 53 /* Invalid request descriptor */ +#define XEN_EXFULL 54 /* Exchange full */ +#define XEN_ENOANO 55 /* No anode */ +#define XEN_EBADRQC 56 /* Invalid request code */ +#define XEN_EBADSLT 57 /* Invalid slot */ +#define XEN_EBFONT 59 /* Bad font file format */ +#define XEN_ENOSTR 60 /* Device not a stream */ +#define XEN_ENODATA 61 /* No data available */ +#define XEN_ETIME 62 /* Timer expired */ +#define XEN_ENOSR 63 /* Out of streams resources */ +#define XEN_ENONET 64 /* Machine is not on the network */ +#define XEN_ENOPKG 65 /* Package not installed */ +#define XEN_EREMOTE 66 /* Object is remote */ +#define XEN_ENOLINK 67 /* Link has been severed */ +#define XEN_EADV 68 /* Advertise error */ +#define XEN_ESRMNT 69 /* Srmount error */ +#define XEN_ECOMM 70 /* Communication error on send */ +#define XEN_EPROTO 71 /* Protocol error */ +#define XEN_EMULTIHOP 72 /* Multihop attempted */ +#define XEN_EDOTDOT 73 /* RFS specific error */ +#define XEN_EBADMSG 74 /* Not a data message */ +#define XEN_EOVERFLOW 75 /* Value too large for defined data type */ +#define XEN_ENOTUNIQ 76 /* Name not unique on network */ +#define XEN_EBADFD 77 /* File descriptor in bad state */ +#define XEN_EREMCHG 78 /* Remote address changed */ +#define XEN_ELIBACC 79 /* Can not access a needed shared library */ +#define XEN_ELIBBAD 80 /* Accessing a corrupted shared library */ +#define XEN_ELIBSCN 81 /* .lib section in a.out corrupted */ +#define XEN_ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define XEN_ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define XEN_EILSEQ 84 /* Illegal byte sequence */ +#define XEN_ERESTART 85 /* Interrupted system call should be restarted */ +#define XEN_ESTRPIPE 86 /* Streams pipe error */ +#define XEN_EUSERS 87 /* Too many users */ +#define XEN_ENOTSOCK 88 /* Socket operation on non-socket */ +#define XEN_EDESTADDRREQ 89 /* Destination address required */ +#define XEN_EMSGSIZE 90 /* Message too long */ +#define XEN_EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define XEN_ENOPROTOOPT 92 /* Protocol not available */ +#define XEN_EPROTONOSUPPORT 93 /* Protocol not supported */ +#define XEN_ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define XEN_EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define XEN_EPFNOSUPPORT 96 /* Protocol family not supported */ +#define XEN_EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define XEN_EADDRINUSE 98 /* Address already in use */ +#define XEN_EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define XEN_ENETDOWN 100 /* Network is down */ +#define XEN_ENETUNREACH 101 /* Network is unreachable */ +#define XEN_ENETRESET 102 /* Network dropped connection because of reset */ +#define XEN_ECONNABORTED 103 /* Software caused connection abort */ +#define XEN_ECONNRESET 104 /* Connection reset by peer */ +#define XEN_ENOBUFS 105 /* No buffer space available */ +#define XEN_EISCONN 106 /* Transport endpoint is already connected */ +#define XEN_ENOTCONN 107 /* Transport endpoint is not connected */ +#define XEN_ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define XEN_ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define XEN_ETIMEDOUT 110 /* Connection timed out */ +#define XEN_ECONNREFUSED 111 /* Connection refused */ +#define XEN_EHOSTDOWN 112 /* Host is down */ +#define XEN_EHOSTUNREACH 113 /* No route to host */ +#define XEN_EALREADY 114 /* Operation already in progress */ +#define XEN_EINPROGRESS 115 /* Operation now in progress */ +#define XEN_ESTALE 116 /* Stale NFS file handle */ +#define XEN_EUCLEAN 117 /* Structure needs cleaning */ +#define XEN_ENOTNAM 118 /* Not a XENIX named type file */ +#define XEN_ENAVAIL 119 /* No XENIX semaphores available */ +#define XEN_EISNAM 120 /* Is a named type file */ +#define XEN_EREMOTEIO 121 /* Remote I/O error */ +#define XEN_EDQUOT 122 /* Quota exceeded */ + +#define XEN_ENOMEDIUM 123 /* No medium found */ +#define XEN_EMEDIUMTYPE 124 /* Wrong medium type */ + +/* Translation table */ +static int xen_errors[] = +{ + [XEN_EPERM] = EPERM, + [XEN_ENOENT] = ENOENT, + [XEN_ESRCH] = ESRCH, + [XEN_EINTR] = EINTR, + [XEN_EIO] = EIO, + [XEN_ENXIO] = ENXIO, + [XEN_E2BIG] = E2BIG, + [XEN_ENOEXEC] = ENOEXEC, + [XEN_EBADF] = EBADF, + [XEN_ECHILD] = ECHILD, + [XEN_EAGAIN] = EAGAIN, + [XEN_ENOMEM] = ENOMEM, + [XEN_EACCES] = EACCES, + [XEN_EFAULT] = EFAULT, + [XEN_ENOTBLK] = ENOTBLK, + [XEN_EBUSY] = EBUSY, + [XEN_EEXIST] = EEXIST, + [XEN_EXDEV] = EXDEV, + [XEN_ENODEV] = ENODEV, + [XEN_ENOTDIR] = ENOTDIR, + [XEN_EISDIR] = EISDIR, + [XEN_EINVAL] = EINVAL, + [XEN_ENFILE] = ENFILE, + [XEN_EMFILE] = EMFILE, + [XEN_ENOTTY] = ENOTTY, + [XEN_ETXTBSY] = ETXTBSY, + [XEN_EFBIG] = EFBIG, + [XEN_ENOSPC] = ENOSPC, + [XEN_ESPIPE] = ESPIPE, + [XEN_EROFS] = EROFS, + [XEN_EMLINK] = EMLINK, + [XEN_EPIPE] = EPIPE, + [XEN_EDOM] = EDOM, + [XEN_ERANGE] = ERANGE, + [XEN_EDEADLK] = EDEADLK, + [XEN_ENAMETOOLONG] = ENAMETOOLONG, + [XEN_ENOLCK] = ENOLCK, + [XEN_ENOSYS] = ENOSYS, + [XEN_ENOTEMPTY] = ENOTEMPTY, + [XEN_ELOOP] = ELOOP, + [XEN_ENOMSG] = ENOMSG, + [XEN_EIDRM] = EIDRM, + [XEN_ECHRNG] = ERANGE, + [XEN_EL2NSYNC] = EFAULT, + [XEN_EL3HLT] = EFAULT, + [XEN_EL3RST] = EFAULT, + [XEN_ELNRNG] = ERANGE, + [XEN_EUNATCH] = ENODEV, + [XEN_ENOCSI] = ENODEV, + [XEN_EL2HLT] = EFAULT, + [XEN_EBADE] = ERANGE, + [XEN_EBADR] = EINVAL, + [XEN_EXFULL] = ENOBUFS, + [XEN_ENOANO] = EINVAL, + [XEN_EBADRQC] = EINVAL, + [XEN_EBADSLT] = EINVAL, + [XEN_EBFONT] = EFAULT, + [XEN_ENOSTR] = EINVAL, + [XEN_ENODATA] = ENOENT, + [XEN_ETIME] = ETIMEDOUT, + [XEN_ENOSR] = EFAULT, + [XEN_ENONET] = ENETDOWN, + [XEN_ENOPKG] = EINVAL, + [XEN_EREMOTE] = EREMOTE, + [XEN_ENOLINK] = ENOLINK, + [XEN_EADV] = EFAULT, + [XEN_ESRMNT] = EFAULT, + [XEN_ECOMM] = EFAULT, + [XEN_EPROTO] = EPROTO, + [XEN_EMULTIHOP] = EMULTIHOP, + [XEN_EDOTDOT] = EFAULT, + [XEN_EBADMSG] = EBADMSG, + [XEN_EOVERFLOW] = EOVERFLOW, + [XEN_ENOTUNIQ] = EADDRINUSE, + [XEN_EBADFD] = EBADF, + [XEN_EREMCHG] = EHOSTDOWN, + [XEN_ELIBACC] = EFAULT, + [XEN_ELIBBAD] = EFAULT, + [XEN_ELIBSCN] = EFAULT, + [XEN_ELIBMAX] = EFAULT, + [XEN_ELIBEXEC] = EFAULT, + [XEN_EILSEQ] = EILSEQ, + [XEN_ERESTART] = EAGAIN, + [XEN_ESTRPIPE] = EPIPE, + [XEN_EUSERS] = EUSERS, + [XEN_ENOTSOCK] = ENOTSOCK, + [XEN_EDESTADDRREQ] = EDESTADDRREQ, + [XEN_EMSGSIZE] = EMSGSIZE, + [XEN_EPROTOTYPE] = EPROTOTYPE, + [XEN_ENOPROTOOPT] = ENOPROTOOPT, + [XEN_EPROTONOSUPPORT] = EPROTONOSUPPORT, + [XEN_ESOCKTNOSUPPORT] = ESOCKTNOSUPPORT, + [XEN_EOPNOTSUPP] = EOPNOTSUPP, + [XEN_EPFNOSUPPORT] = EPFNOSUPPORT, + [XEN_EAFNOSUPPORT] = EAFNOSUPPORT, + [XEN_EADDRINUSE] = EADDRINUSE, + [XEN_EADDRNOTAVAIL] = EADDRNOTAVAIL, + [XEN_ENETDOWN] = ENETDOWN, + [XEN_ENETUNREACH] = ENETUNREACH, + [XEN_ENETRESET] = ENETRESET, + [XEN_ECONNABORTED] = ECONNABORTED, + [XEN_ECONNRESET] = ECONNRESET, + [XEN_ENOBUFS] = ENOBUFS, + [XEN_EISCONN] = EISCONN, + [XEN_ENOTCONN] = ENOTCONN, + [XEN_ESHUTDOWN] = ESHUTDOWN, + [XEN_ETOOMANYREFS] = ETOOMANYREFS, + [XEN_ETIMEDOUT] = ETIMEDOUT, + [XEN_ECONNREFUSED] = ECONNREFUSED, + [XEN_EHOSTDOWN] = EHOSTDOWN, + [XEN_EHOSTUNREACH] = EHOSTUNREACH, + [XEN_EALREADY] = EALREADY, + [XEN_EINPROGRESS] = EINPROGRESS, + [XEN_ESTALE] = ESTALE, + [XEN_EUCLEAN] = EFAULT, + [XEN_ENOTNAM] = EFAULT, + [XEN_ENAVAIL] = EFAULT, + [XEN_EISNAM] = EFAULT, + [XEN_EREMOTEIO] = EIO, + [XEN_EDQUOT] = EDQUOT, + [XEN_ENOMEDIUM] = ENOENT, + [XEN_EMEDIUMTYPE] = ENOENT, +}; + +static inline int +xen_translate_error(int error) +{ + int bsd_error; + + KASSERT((error < 0), ("Value is not a valid Xen error code")); + + if (-error >= nitems(xen_errors)) { + /* + * We received an error value that cannot be translated, + * return EINVAL. + */ + return (EINVAL); + } + + bsd_error = xen_errors[-error]; + KASSERT((bsd_error != 0), ("Unknown Xen error code")); + + return (bsd_error); +} + +#endif /* !__XEN_ERROR_H__ */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 17:07:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6A469129; Wed, 22 Oct 2014 17:07:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54852688; Wed, 22 Oct 2014 17:07:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MH7NBq059811; Wed, 22 Oct 2014 17:07:23 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MH7LJe059801; Wed, 22 Oct 2014 17:07:21 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221707.s9MH7LJe059801@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 17:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273476 - in head/sys: amd64/include/xen conf dev/xen/privcmd i386/include/xen x86/xen xen xen/interface X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 17:07:23 -0000 Author: royger Date: Wed Oct 22 17:07:20 2014 New Revision: 273476 URL: https://svnweb.freebsd.org/changeset/base/273476 Log: xen: implement the privcmd user-space device This device is only attached to priviledged domains, and allows the toolstack to interact with Xen. The two functions of the privcmd interface is to allow the execution of hypercalls from user-space, and the mapping of foreign domain memory. Sponsored by: Citrix Systems R&D i386/include/xen/hypercall.h: amd64/include/xen/hypercall.h: - Introduce a function to make generic hypercalls into Xen. xen/interface/xen.h: xen/interface/memory.h: - Import the new hypercall XENMEM_add_to_physmap_range used by auto-translated guests to map memory from foreign domains. dev/xen/privcmd/privcmd.c: - This device has the following functions: - Allow user-space applications to make hypercalls into Xen. - Allow user-space applications to map memory from foreign domains, this is accomplished using the newly introduced hypercall (XENMEM_add_to_physmap_range). xen/privcmd.h: - Public ioctl interface for the privcmd device. x86/xen/hvm.c: - Remove declaration of hypercall_page, now it's declared in hypercall.h. conf/files: - Add the privcmd device to the build process. Added: head/sys/dev/xen/privcmd/ head/sys/dev/xen/privcmd/privcmd.c (contents, props changed) head/sys/xen/privcmd.h (contents, props changed) Modified: head/sys/amd64/include/xen/hypercall.h head/sys/conf/files head/sys/i386/include/xen/hypercall.h head/sys/x86/xen/hvm.c head/sys/xen/interface/memory.h head/sys/xen/interface/xen.h Modified: head/sys/amd64/include/xen/hypercall.h ============================================================================== --- head/sys/amd64/include/xen/hypercall.h Wed Oct 22 16:58:52 2014 (r273475) +++ head/sys/amd64/include/xen/hypercall.h Wed Oct 22 17:07:20 2014 (r273476) @@ -45,6 +45,8 @@ # error "please don't include this file directly" #endif +extern char *hypercall_page; + #define __STR(x) #x #define STR(x) __STR(x) #define ENOXENSYS 38 @@ -134,6 +136,26 @@ __res; \ }) +static inline int +privcmd_hypercall(long op, long a1, long a2, long a3, long a4, long a5) +{ + int __res; + long __ign1, __ign2, __ign3; + register long __arg4 __asm__("r10") = (long)(a4); + register long __arg5 __asm__("r8") = (long)(a5); + long __call = (long)&hypercall_page + (op * 32); + + __asm__ volatile ( + "call *%[call]" + : "=a" (__res), "=D" (__ign1), "=S" (__ign2), + "=d" (__ign3), "+r" (__arg4), "+r" (__arg5) + : "1" ((long)(a1)), "2" ((long)(a2)), + "3" ((long)(a3)), [call] "a" (__call) + : "memory" ); + + return (__res); +} + static inline int __must_check HYPERVISOR_set_trap_table( const trap_info_t *table) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Oct 22 16:58:52 2014 (r273475) +++ head/sys/conf/files Wed Oct 22 17:07:20 2014 (r273476) @@ -2648,6 +2648,7 @@ dev/xen/xenstore/xenstore.c optional xen dev/xen/xenstore/xenstore_dev.c optional xen | xenhvm dev/xen/xenstore/xenstored_dev.c optional xen | xenhvm dev/xen/evtchn/evtchn_dev.c optional xen | xenhvm +dev/xen/privcmd/privcmd.c optional xen | xenhvm dev/xl/if_xl.c optional xl pci dev/xl/xlphy.c optional xl pci fs/autofs/autofs.c optional autofs Added: head/sys/dev/xen/privcmd/privcmd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xen/privcmd/privcmd.c Wed Oct 22 17:07:20 2014 (r273476) @@ -0,0 +1,414 @@ +/* + * Copyright (c) 2014 Roger Pau Monné + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +MALLOC_DEFINE(M_PRIVCMD, "privcmd_dev", "Xen privcmd user-space device"); + +struct privcmd_map { + vm_object_t mem; + vm_size_t size; + struct resource *pseudo_phys_res; + int pseudo_phys_res_id; + vm_paddr_t phys_base_addr; + boolean_t mapped; + int *errs; +}; + +static d_ioctl_t privcmd_ioctl; +static d_mmap_single_t privcmd_mmap_single; + +static struct cdevsw privcmd_devsw = { + .d_version = D_VERSION, + .d_ioctl = privcmd_ioctl, + .d_mmap_single = privcmd_mmap_single, + .d_name = "privcmd", +}; + +static int privcmd_pg_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color); +static void privcmd_pg_dtor(void *handle); +static int privcmd_pg_fault(vm_object_t object, vm_ooffset_t offset, + int prot, vm_page_t *mres); + +static struct cdev_pager_ops privcmd_pg_ops = { + .cdev_pg_fault = privcmd_pg_fault, + .cdev_pg_ctor = privcmd_pg_ctor, + .cdev_pg_dtor = privcmd_pg_dtor, +}; + +static device_t privcmd_dev = NULL; + +/*------------------------- Privcmd Pager functions --------------------------*/ +static int +privcmd_pg_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color) +{ + + return (0); +} + +static void +privcmd_pg_dtor(void *handle) +{ + struct xen_remove_from_physmap rm = { .domid = DOMID_SELF }; + struct privcmd_map *map = handle; + int error; + vm_size_t i; + vm_page_t m; + + /* + * Remove the mappings from the used pages. This will remove the + * underlying p2m bindings in Xen second stage translation. + */ + if (map->mapped == true) { + VM_OBJECT_WLOCK(map->mem); +retry: + for (i = 0; i < map->size; i++) { + m = vm_page_lookup(map->mem, i); + if (m == NULL) + continue; + if (vm_page_sleep_if_busy(m, "pcmdum")) + goto retry; + cdev_pager_free_page(map->mem, m); + } + VM_OBJECT_WUNLOCK(map->mem); + + for (i = 0; i < map->size; i++) { + rm.gpfn = atop(map->phys_base_addr) + i; + HYPERVISOR_memory_op(XENMEM_remove_from_physmap, &rm); + } + free(map->errs, M_PRIVCMD); + } + + vm_phys_fictitious_unreg_range(map->phys_base_addr, + map->phys_base_addr + map->size * PAGE_SIZE); + + error = bus_release_resource(privcmd_dev, SYS_RES_MEMORY, + map->pseudo_phys_res_id, map->pseudo_phys_res); + KASSERT(error == 0, ("Unable to release memory resource: %d", error)); + + free(map, M_PRIVCMD); +} + +static int +privcmd_pg_fault(vm_object_t object, vm_ooffset_t offset, + int prot, vm_page_t *mres) +{ + struct privcmd_map *map = object->handle; + vm_pindex_t pidx; + vm_page_t page, oldm; + + if (map->mapped != true) + return (VM_PAGER_FAIL); + + pidx = OFF_TO_IDX(offset); + if (pidx >= map->size || map->errs[pidx] != 0) + return (VM_PAGER_FAIL); + + page = PHYS_TO_VM_PAGE(map->phys_base_addr + offset); + if (page == NULL) + return (VM_PAGER_FAIL); + + KASSERT((page->flags & PG_FICTITIOUS) != 0, + ("not fictitious %p", page)); + KASSERT(page->wire_count == 1, ("wire_count not 1 %p", page)); + KASSERT(vm_page_busied(page) == 0, ("page %p is busy", page)); + + if (*mres != NULL) { + oldm = *mres; + vm_page_lock(oldm); + vm_page_free(oldm); + vm_page_unlock(oldm); + *mres = NULL; + } + + vm_page_insert(page, object, pidx); + page->valid = VM_PAGE_BITS_ALL; + vm_page_xbusy(page); + *mres = page; + return (VM_PAGER_OK); +} + +/*----------------------- Privcmd char device methods ------------------------*/ +static int +privcmd_mmap_single(struct cdev *cdev, vm_ooffset_t *offset, vm_size_t size, + vm_object_t *object, int nprot) +{ + struct privcmd_map *map; + int error; + + map = malloc(sizeof(*map), M_PRIVCMD, M_WAITOK | M_ZERO); + + map->size = OFF_TO_IDX(size); + map->pseudo_phys_res_id = 0; + + map->pseudo_phys_res = bus_alloc_resource(privcmd_dev, SYS_RES_MEMORY, + &map->pseudo_phys_res_id, 0, ~0, size, RF_ACTIVE); + if (map->pseudo_phys_res == NULL) { + free(map, M_PRIVCMD); + return (ENOMEM); + } + + map->phys_base_addr = rman_get_start(map->pseudo_phys_res); + + error = vm_phys_fictitious_reg_range(map->phys_base_addr, + map->phys_base_addr + size, VM_MEMATTR_DEFAULT); + if (error) { + bus_release_resource(privcmd_dev, SYS_RES_MEMORY, + map->pseudo_phys_res_id, map->pseudo_phys_res); + free(map, M_PRIVCMD); + return (error); + } + + map->mem = cdev_pager_allocate(map, OBJT_MGTDEVICE, &privcmd_pg_ops, + size, nprot, *offset, NULL); + if (map->mem == NULL) { + bus_release_resource(privcmd_dev, SYS_RES_MEMORY, + map->pseudo_phys_res_id, map->pseudo_phys_res); + free(map, M_PRIVCMD); + return (ENOMEM); + } + + *object = map->mem; + + return (0); +} + +static int +privcmd_ioctl(struct cdev *dev, unsigned long cmd, caddr_t arg, + int mode, struct thread *td) +{ + int error, i; + + switch (cmd) { + case IOCTL_PRIVCMD_HYPERCALL: { + struct ioctl_privcmd_hypercall *hcall; + + hcall = (struct ioctl_privcmd_hypercall *)arg; + + error = privcmd_hypercall(hcall->op, hcall->arg[0], + hcall->arg[1], hcall->arg[2], hcall->arg[3], hcall->arg[4]); + if (error >= 0) { + hcall->retval = error; + error = 0; + } else { + error = xen_translate_error(error); + hcall->retval = 0; + } + break; + } + case IOCTL_PRIVCMD_MMAPBATCH: { + struct ioctl_privcmd_mmapbatch *mmap; + vm_map_t map; + vm_map_entry_t entry; + vm_object_t mem; + vm_pindex_t index; + vm_prot_t prot; + boolean_t wired; + struct xen_add_to_physmap_range add; + xen_ulong_t *idxs; + xen_pfn_t *gpfns; + int *errs; + struct privcmd_map *umap; + + mmap = (struct ioctl_privcmd_mmapbatch *)arg; + + if ((mmap->num == 0) || + ((mmap->addr & PAGE_MASK) != 0)) { + error = EINVAL; + break; + } + + map = &td->td_proc->p_vmspace->vm_map; + error = vm_map_lookup(&map, mmap->addr, VM_PROT_NONE, &entry, + &mem, &index, &prot, &wired); + if (error != KERN_SUCCESS) { + error = EINVAL; + break; + } + if ((entry->start != mmap->addr) || + (entry->end != mmap->addr + (mmap->num * PAGE_SIZE))) { + vm_map_lookup_done(map, entry); + error = EINVAL; + break; + } + vm_map_lookup_done(map, entry); + if ((mem->type != OBJT_MGTDEVICE) || + (mem->un_pager.devp.ops != &privcmd_pg_ops)) { + error = EINVAL; + break; + } + umap = mem->handle; + + add.domid = DOMID_SELF; + add.space = XENMAPSPACE_gmfn_foreign; + add.size = mmap->num; + add.foreign_domid = mmap->dom; + + idxs = malloc(sizeof(*idxs) * mmap->num, M_PRIVCMD, + M_WAITOK | M_ZERO); + gpfns = malloc(sizeof(*gpfns) * mmap->num, M_PRIVCMD, + M_WAITOK | M_ZERO); + errs = malloc(sizeof(*errs) * mmap->num, M_PRIVCMD, + M_WAITOK | M_ZERO); + + set_xen_guest_handle(add.idxs, idxs); + set_xen_guest_handle(add.gpfns, gpfns); + set_xen_guest_handle(add.errs, errs); + + error = copyin(&mmap->arr[0], idxs, + sizeof(idxs[0]) * mmap->num); + if (error != 0) + goto mmap_out; + + for (i = 0; i < mmap->num; i++) + gpfns[i] = atop(umap->phys_base_addr + i * PAGE_SIZE); + + error = HYPERVISOR_memory_op(XENMEM_add_to_physmap_range, &add); + if (error) { + error = xen_translate_error(error); + goto mmap_out; + } + + for (i = 0; i < mmap->num; i++) { + if (errs[i] != 0) + errs[i] = xen_translate_error(errs[i]); + } + + /* + * Save errs, so we know which pages have been + * successfully mapped. + */ + umap->errs = errs; + umap->mapped = true; + + error = copyout(errs, &mmap->err[0], + sizeof(errs[0]) * mmap->num); + +mmap_out: + free(idxs, M_PRIVCMD); + free(gpfns, M_PRIVCMD); + if (!umap->mapped) + free(errs, M_PRIVCMD); + + break; + } + + default: + error = ENOSYS; + break; + } + + return (error); +} + +/*------------------ Private Device Attachment Functions --------------------*/ +static void +privcmd_identify(driver_t *driver, device_t parent) +{ + + KASSERT(xen_domain(), + ("Trying to attach privcmd device on non Xen domain")); + + if (BUS_ADD_CHILD(parent, 0, "privcmd", 0) == NULL) + panic("unable to attach privcmd user-space device"); +} + +static int +privcmd_probe(device_t dev) +{ + + privcmd_dev = dev; + device_set_desc(dev, "Xen privileged interface user-space device"); + return (BUS_PROBE_NOWILDCARD); +} + +static int +privcmd_attach(device_t dev) +{ + + make_dev_credf(MAKEDEV_ETERNAL, &privcmd_devsw, 0, NULL, UID_ROOT, + GID_WHEEL, 0600, "xen/privcmd"); + return (0); +} + +/*-------------------- Private Device Attachment Data -----------------------*/ +static device_method_t privcmd_methods[] = { + DEVMETHOD(device_identify, privcmd_identify), + DEVMETHOD(device_probe, privcmd_probe), + DEVMETHOD(device_attach, privcmd_attach), + + DEVMETHOD_END +}; + +static driver_t privcmd_driver = { + "privcmd", + privcmd_methods, + 0, +}; + +devclass_t privcmd_devclass; + +DRIVER_MODULE(privcmd, xenpv, privcmd_driver, privcmd_devclass, 0, 0); +MODULE_DEPEND(privcmd, xenpv, 1, 1, 1); Modified: head/sys/i386/include/xen/hypercall.h ============================================================================== --- head/sys/i386/include/xen/hypercall.h Wed Oct 22 16:58:52 2014 (r273475) +++ head/sys/i386/include/xen/hypercall.h Wed Oct 22 17:07:20 2014 (r273476) @@ -34,6 +34,8 @@ #include #include +extern char *hypercall_page; + #define __STR(x) #x #define STR(x) __STR(x) #define ENOXENSYS 38 @@ -115,6 +117,24 @@ (type)__res; \ }) +static inline long +privcmd_hypercall(long op, long a1, long a2, long a3, long a4, long a5) +{ + long __res, __ign1, __ign2, __ign3, __ign4, __ign5, __call; + + __call = (long)&hypercall_page + (op * 32); + __asm__ volatile ( + "call *%[call]" + : "=a" (__res), "=b" (__ign1), "=c" (__ign2), + "=d" (__ign3), "=S" (__ign4), "=D" (__ign5) + : "1" ((long)(a1)), "2" ((long)(a2)), + "3" ((long)(a3)), "4" ((long)(a4)), + "5" ((long)(a5)), [call] "a" (__call) + : "memory" ); + + return __res; +} + static inline int HYPERVISOR_set_trap_table( trap_info_t *table) Modified: head/sys/x86/xen/hvm.c ============================================================================== --- head/sys/x86/xen/hvm.c Wed Oct 22 16:58:52 2014 (r273475) +++ head/sys/x86/xen/hvm.c Wed Oct 22 17:07:20 2014 (r273476) @@ -97,8 +97,6 @@ DPCPU_DEFINE(struct vcpu_info, vcpu_loca DPCPU_DEFINE(struct vcpu_info *, vcpu_info); /*------------------ Hypervisor Access Shared Memory Regions -----------------*/ -/** Hypercall table accessed via HYPERVISOR_*_op() methods. */ -extern char *hypercall_page; shared_info_t *HYPERVISOR_shared_info; start_info_t *HYPERVISOR_start_info; Modified: head/sys/xen/interface/memory.h ============================================================================== --- head/sys/xen/interface/memory.h Wed Oct 22 16:58:52 2014 (r273475) +++ head/sys/xen/interface/memory.h Wed Oct 22 17:07:20 2014 (r273476) @@ -198,6 +198,14 @@ struct xen_machphys_mapping { typedef struct xen_machphys_mapping xen_machphys_mapping_t; DEFINE_XEN_GUEST_HANDLE(xen_machphys_mapping_t); +#define XENMAPSPACE_shared_info 0 /* shared info page */ +#define XENMAPSPACE_grant_table 1 /* grant table page */ +#define XENMAPSPACE_gmfn 2 /* GMFN */ +#define XENMAPSPACE_gmfn_range 3 /* GMFN range, XENMEM_add_to_physmap only. */ +#define XENMAPSPACE_gmfn_foreign 4 /* GMFN from another dom, + * XENMEM_add_to_physmap_range only. + */ + /* * Sets the GPFN at which a particular page appears in the specified guest's * pseudophysical address space. @@ -248,6 +256,31 @@ DEFINE_XEN_GUEST_HANDLE(xen_remove_from_ /*** REMOVED ***/ /*#define XENMEM_translate_gpfn_list 8*/ +#define XENMEM_add_to_physmap_range 23 +struct xen_add_to_physmap_range { + /* IN */ + /* Which domain to change the mapping for. */ + domid_t domid; + uint16_t space; /* => enum phys_map_space */ + + /* Number of pages to go through */ + uint16_t size; + domid_t foreign_domid; /* IFF gmfn_foreign */ + + /* Indexes into space being mapped. */ + XEN_GUEST_HANDLE(xen_ulong_t) idxs; + + /* GPFN in domid where the source mapping page should appear. */ + XEN_GUEST_HANDLE(xen_pfn_t) gpfns; + + /* OUT */ + + /* Per index error code. */ + XEN_GUEST_HANDLE(int) errs; +}; +typedef struct xen_add_to_physmap_range xen_add_to_physmap_range_t; +DEFINE_XEN_GUEST_HANDLE(xen_add_to_physmap_range_t); + /* * Returns the pseudo-physical memory map as it was when the domain * was started (specified by XENMEM_set_memory_map). Modified: head/sys/xen/interface/xen.h ============================================================================== --- head/sys/xen/interface/xen.h Wed Oct 22 16:58:52 2014 (r273475) +++ head/sys/xen/interface/xen.h Wed Oct 22 17:07:20 2014 (r273476) @@ -51,6 +51,7 @@ DEFINE_XEN_GUEST_HANDLE(void); DEFINE_XEN_GUEST_HANDLE(uint64_t); DEFINE_XEN_GUEST_HANDLE(xen_pfn_t); +DEFINE_XEN_GUEST_HANDLE(xen_ulong_t); #endif /* Added: head/sys/xen/privcmd.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/xen/privcmd.h Wed Oct 22 17:07:20 2014 (r273476) @@ -0,0 +1,58 @@ +/****************************************************************************** + * privcmd.h + * + * Interface to /proc/xen/privcmd. + * + * Copyright (c) 2003-2005, K A Fraser + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation; or, when distributed + * separately from the Linux kernel or incorporated into other + * software packages, subject to the following license: + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this source file (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, + * merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * $FreeBSD$ + */ + +#ifndef __XEN_PRIVCMD_H__ +#define __XEN_PRIVCMD_H__ + +struct ioctl_privcmd_hypercall +{ + unsigned long op; /* hypercall number */ + unsigned long arg[5]; /* arguments */ + long retval; /* return value */ +}; + +struct ioctl_privcmd_mmapbatch { + int num; /* number of pages to populate */ + domid_t dom; /* target domain */ + unsigned long addr; /* virtual address */ + const xen_pfn_t *arr; /* array of mfns */ + int *err; /* array of error codes */ +}; + +#define IOCTL_PRIVCMD_HYPERCALL \ + _IOWR('E', 0, struct ioctl_privcmd_hypercall) +#define IOCTL_PRIVCMD_MMAPBATCH \ + _IOWR('E', 1, struct ioctl_privcmd_mmapbatch) + +#endif /* !__XEN_PRIVCMD_H__ */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 17:09:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68DD932F; Wed, 22 Oct 2014 17:09:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3BF3F6A7; Wed, 22 Oct 2014 17:09:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MH9DX7060189; Wed, 22 Oct 2014 17:09:13 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MH9DWc060188; Wed, 22 Oct 2014 17:09:13 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410221709.s9MH9DWc060188@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Wed, 22 Oct 2014 17:09:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273477 - head/sys/dev/xen/netback X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 17:09:13 -0000 Author: royger Date: Wed Oct 22 17:09:12 2014 New Revision: 273477 URL: https://svnweb.freebsd.org/changeset/base/273477 Log: netback: change xnb naming convention Current FreeBSD netback names the interface with xnb, but this is not suitable for usage with the Xen toolstack, which expects something similar to . In order to solve this, change the netback naming convention to use xnb.. Sponsored by: Citrix Systems R&D dev/xen/netback/netback.c: - Change netback to use the nomenclature stated above. Modified: head/sys/dev/xen/netback/netback.c Modified: head/sys/dev/xen/netback/netback.c ============================================================================== --- head/sys/dev/xen/netback/netback.c Wed Oct 22 17:07:20 2014 (r273476) +++ head/sys/dev/xen/netback/netback.c Wed Oct 22 17:09:12 2014 (r273477) @@ -511,6 +511,9 @@ struct xnb_softc { /** The size of the global kva pool. */ int kva_size; + + /** Name of the interface */ + char if_name[IFNAMSIZ]; }; /*---------------------------- Debugging functions ---------------------------*/ @@ -1201,6 +1204,7 @@ create_netdev(device_t dev) struct ifnet *ifp; struct xnb_softc *xnb; int err = 0; + uint32_t handle; xnb = device_get_softc(dev); mtx_init(&xnb->sc_lock, "xnb_softc", "xen netback softc lock", MTX_DEF); @@ -1225,11 +1229,24 @@ create_netdev(device_t dev) */ bzero(&xnb->mac[0], sizeof(xnb->mac)); + /* The interface will be named using the following nomenclature: + * + * xnb. + * + * Where handle is the oder of the interface referred to the guest. + */ + err = xs_scanf(XST_NIL, xenbus_get_node(xnb->dev), "handle", NULL, + "%" PRIu32, &handle); + if (err != 0) + return (err); + snprintf(xnb->if_name, IFNAMSIZ, "xnb%" PRIu16 ".%" PRIu32, + xenbus_get_otherend_id(dev), handle); + if (err == 0) { /* Set up ifnet structure */ ifp = xnb->xnb_ifp = if_alloc(IFT_ETHER); ifp->if_softc = xnb; - if_initname(ifp, "xnb", device_get_unit(dev)); + if_initname(ifp, xnb->if_name, IF_DUNIT_NONE); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_ioctl = xnb_ioctl; ifp->if_output = ether_output; From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 18:11:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 03AB7FF3; Wed, 22 Oct 2014 18:11:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4A74D9C; Wed, 22 Oct 2014 18:11:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MIBAUE089986; Wed, 22 Oct 2014 18:11:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MIBAlb089985; Wed, 22 Oct 2014 18:11:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410221811.s9MIBAlb089985@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 22 Oct 2014 18:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273478 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 18:11:11 -0000 Author: ngie Date: Wed Oct 22 18:11:10 2014 New Revision: 273478 URL: https://svnweb.freebsd.org/changeset/base/273478 Log: Fix linking static test binaries with atf.test.mk Check for -static in LDFLAGS or LDFLAGS., then pass in the appropriate dependency (LIBATF or LDATF) This unbreaks the build with some of the NetBSD tests that need to be compiled statically Reviewed by: imp, jmmv Phabric: D991 Sponsored by: EMC / Isilon Storage Division Modified: head/share/mk/atf.test.mk Modified: head/share/mk/atf.test.mk ============================================================================== --- head/share/mk/atf.test.mk Wed Oct 22 17:09:12 2014 (r273477) +++ head/share/mk/atf.test.mk Wed Oct 22 18:11:10 2014 (r273478) @@ -71,7 +71,11 @@ BINDIR.${_T}= ${TESTSDIR} MAN.${_T}?= # empty SRCS.${_T}?= ${_T}.c DPADD.${_T}+= ${LIBATF_C} +.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static) LDADD.${_T}+= ${LDATF_C} +.else +LDADD.${_T}+= ${LIBATF_C} +.endif USEPRIVATELIB+= atf-c TEST_INTERFACE.${_T}= atf .endfor @@ -85,7 +89,11 @@ BINDIR.${_T}= ${TESTSDIR} MAN.${_T}?= # empty SRCS.${_T}?= ${_T}${CXX_SUFFIX:U.cc} DPADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} +.if empty(LDFLAGS:M-static) && empty(LDFLAGS.${_T}:M-static) LDADD.${_T}+= ${LDATF_CXX} ${LDATF_C} +.else +LDADD.${_T}+= ${LIBATF_CXX} ${LIBATF_C} +.endif USEPRIVATELIB+= atf-c++ TEST_INTERFACE.${_T}= atf .endfor From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 18:55:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D20C0A79; Wed, 22 Oct 2014 18:55:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BEB2F276; Wed, 22 Oct 2014 18:55:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MItaLp011461; Wed, 22 Oct 2014 18:55:36 GMT (envelope-from luigi@FreeBSD.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MIta3H011460; Wed, 22 Oct 2014 18:55:36 GMT (envelope-from luigi@FreeBSD.org) Message-Id: <201410221855.s9MIta3H011460@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: luigi set sender to luigi@FreeBSD.org using -f From: Luigi Rizzo Date: Wed, 22 Oct 2014 18:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273479 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 18:55:36 -0000 Author: luigi Date: Wed Oct 22 18:55:36 2014 New Revision: 273479 URL: https://svnweb.freebsd.org/changeset/base/273479 Log: since we cast a pointer, use the correct signedness (this was already in, and got lost in a recent update). Modified: head/sys/net/radix.c Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Wed Oct 22 18:11:10 2014 (r273478) +++ head/sys/net/radix.c Wed Oct 22 18:55:36 2014 (r273479) @@ -528,7 +528,7 @@ rn_addmask(void *n_arg, struct radix_nod R_Zalloc(x, struct radix_node *, RADIX_MAX_KEY_LEN + 2 * sizeof (*x)); if ((saved_x = x) == 0) return (0); - netmask = cp = (caddr_t)(x + 2); + netmask = cp = (unsigned char *)(x + 2); bcopy(addmask_key, cp, mlen); x = rn_insert(cp, maskhead, &maskduplicated, x); if (maskduplicated) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 18:55:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20E8CBB7; Wed, 22 Oct 2014 18:55:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D972279; Wed, 22 Oct 2014 18:55:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MItiiI011522; Wed, 22 Oct 2014 18:55:44 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MItixN011521; Wed, 22 Oct 2014 18:55:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410221855.s9MItixN011521@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 22 Oct 2014 18:55:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273480 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 18:55:45 -0000 Author: np Date: Wed Oct 22 18:55:44 2014 New Revision: 273480 URL: https://svnweb.freebsd.org/changeset/base/273480 Log: cxgbe/iw_cxgbe: wake up waiters after flushing the qp. Obtained from: Chelsio Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/qp.c Wed Oct 22 18:55:36 2014 (r273479) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.c Wed Oct 22 18:55:44 2014 (r273480) @@ -1359,9 +1359,9 @@ err: qhp->ep = NULL; set_state(qhp, C4IW_QP_STATE_ERROR); free = 1; - wake_up(&qhp->wait); BUG_ON(!ep); flush_qp(qhp); + wake_up(&qhp->wait); out: mutex_unlock(&qhp->mutex); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 20:47:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2BFFF339; Wed, 22 Oct 2014 20:47:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1ADAFB8; Wed, 22 Oct 2014 20:47:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MKlB7j062992; Wed, 22 Oct 2014 20:47:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MKlBut062991; Wed, 22 Oct 2014 20:47:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201410222047.s9MKlBut062991@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 22 Oct 2014 20:47:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273481 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 20:47:12 -0000 Author: rmacklem Date: Wed Oct 22 20:47:11 2014 New Revision: 273481 URL: https://svnweb.freebsd.org/changeset/base/273481 Log: Clip the settings for the NFS rsize, wsize mount options to a power of 2. For non-power of 2 settings, intermittent page faults have been reported. Although the bug that causes these page faults/crashes has not been identified, it does not appear to occur when rsize, wsize is a power of 2. Reported by: tcberner@gmail.com MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 18:55:44 2014 (r273480) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 20:47:11 2014 (r273481) @@ -552,7 +552,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, const char *hostname, struct ucred *cred, struct thread *td) { - int s; + int i, s; int adjsock; char *p; @@ -621,18 +621,36 @@ nfs_decode_args(struct mount *mp, struct if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) { nmp->nm_wsize = argp->wsize; - /* Round down to multiple of blocksize */ - nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1); - if (nmp->nm_wsize <= 0) - nmp->nm_wsize = NFS_FABLKSIZE; + /* + * Clip at the power of 2 below the size. There is an + * issue (not isolated) that causes intermittent page + * faults if this is not done. + */ + i = NFS_FABLKSIZE; + for (;;) { + if (i * 2 > nmp->nm_wsize) { + nmp->nm_wsize = i; + break; + } + i *= 2; + } } if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) { nmp->nm_rsize = argp->rsize; - /* Round down to multiple of blocksize */ - nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1); - if (nmp->nm_rsize <= 0) - nmp->nm_rsize = NFS_FABLKSIZE; + /* + * Clip at the power of 2 below the size. There is an + * issue (not isolated) that causes intermittent page + * faults if this is not done. + */ + i = NFS_FABLKSIZE; + for (;;) { + if (i * 2 > nmp->nm_rsize) { + nmp->nm_rsize = i; + break; + } + i *= 2; + } } if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 21:04:55 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44E077AD; Wed, 22 Oct 2014 21:04:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25318221; Wed, 22 Oct 2014 21:04:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ML4t5S072851; Wed, 22 Oct 2014 21:04:55 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ML4sWx072849; Wed, 22 Oct 2014 21:04:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410222104.s9ML4sWx072849@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Wed, 22 Oct 2014 21:04:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273482 - in head/lib/libnetbsd: netinet sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 21:04:55 -0000 Author: ngie Date: Wed Oct 22 21:04:54 2014 New Revision: 273482 URL: https://svnweb.freebsd.org/changeset/base/273482 Log: The NetBSD libc tests use several definitions/macros that aren't available in FreeBSD Add the missing compat definitions/macros to lib/libnetbsd so the testcases can be compiled with libnetbsd without having to invent ad hoc #define's, or having to convert things over to FreeBSD idioms Reviewed by: brooks Phabric: D993 Sponsored by: EMC / Isilon Storage Division Added: head/lib/libnetbsd/netinet/ head/lib/libnetbsd/netinet/in.h (contents, props changed) Modified: head/lib/libnetbsd/sys/cdefs.h Added: head/lib/libnetbsd/netinet/in.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libnetbsd/netinet/in.h Wed Oct 22 21:04:54 2014 (r273482) @@ -0,0 +1,72 @@ +/* $FreeBSD$ */ + +/* + * Copyright (c) 1982, 1986, 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)in.h 8.3 (Berkeley) 1/3/94 + */ + +#ifndef _LIBNETBSD_NETINET_IN_H_ +#define _LIBNETBSD_NETINET_IN_H_ + +#include_next + +/* + * Local port number conventions: + * + * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root), + * unless a kernel is compiled with IPNOPRIVPORTS defined. + * + * When a user does a bind(2) or connect(2) with a port number of zero, + * a non-conflicting local port address is chosen. + * + * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although + * that is settable by sysctl(3); net.inet.ip.anonportmin and + * net.inet.ip.anonportmax respectively. + * + * A user may set the IPPROTO_IP option IP_PORTRANGE to change this + * default assignment range. + * + * The value IP_PORTRANGE_DEFAULT causes the default behavior. + * + * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT, + * and exists only for FreeBSD compatibility purposes. + * + * The value IP_PORTRANGE_LOW changes the range to the "low" are + * that is (by convention) restricted to privileged processes. + * This convention is based on "vouchsafe" principles only. + * It is only secure if you trust the remote host to restrict these ports. + * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX. + */ + +#define IPPORT_ANONMIN 49152 +#define IPPORT_ANONMAX 65535 +#define IPPORT_RESERVEDMIN 600 +#define IPPORT_RESERVEDMAX (IPPORT_RESERVED-1) + +#endif Modified: head/lib/libnetbsd/sys/cdefs.h ============================================================================== --- head/lib/libnetbsd/sys/cdefs.h Wed Oct 22 20:47:11 2014 (r273481) +++ head/lib/libnetbsd/sys/cdefs.h Wed Oct 22 21:04:54 2014 (r273482) @@ -42,6 +42,28 @@ #endif /* + * The __CONCAT macro is used to concatenate parts of symbol names, e.g. + * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. + * The __CONCAT macro is a bit tricky -- make sure you don't put spaces + * in between its arguments. __CONCAT can also concatenate double-quoted + * strings produced by the __STRING macro, but this only works with ANSI C. + */ + +#define ___STRING(x) __STRING(x) +#define ___CONCAT(x,y) __CONCAT(x,y) + +/* + * The following macro is used to remove const cast-away warnings + * from gcc -Wcast-qual; it should be used with caution because it + * can hide valid errors; in particular most valid uses are in + * situations where the API requires it, not to cast away string + * constants. We don't use *intptr_t on purpose here and we are + * explicit about unsigned long so that we don't have additional + * dependencies. + */ +#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a)) + +/* * Return the number of elements in a statically-allocated array, * __x. */ From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 21:20:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 11DF5E0; Wed, 22 Oct 2014 21:20:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1279608; Wed, 22 Oct 2014 21:20:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MLKbMO080216; Wed, 22 Oct 2014 21:20:37 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MLKb6E080215; Wed, 22 Oct 2014 21:20:37 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410222120.s9MLKb6E080215@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Wed, 22 Oct 2014 21:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273483 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 21:20:38 -0000 Author: melifaro Date: Wed Oct 22 21:20:37 2014 New Revision: 273483 URL: https://svnweb.freebsd.org/changeset/base/273483 Log: Rename log2 to tal_log2. Submitted by: luigi Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c Modified: head/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table_algo.c Wed Oct 22 21:04:54 2014 (r273482) +++ head/sys/netpfil/ipfw/ip_fw_table_algo.c Wed Oct 22 21:20:37 2014 (r273483) @@ -954,7 +954,7 @@ static int ta_lookup_chash_64(struct tab static int chash_parse_opts(struct chash_cfg *cfg, char *data); static void ta_print_chash_config(void *ta_state, struct table_info *ti, char *buf, size_t bufsize); -static int log2(uint32_t v); +static int ta_log2(uint32_t v); static int ta_init_chash(struct ip_fw_chain *ch, void **ta_state, struct table_info *ti, char *data, uint8_t tflags); static void ta_destroy_chash(void *ta_state, struct table_info *ti); @@ -1248,7 +1248,7 @@ ta_print_chash_config(void *ta_state, st } static int -log2(uint32_t v) +ta_log2(uint32_t v) { uint32_t r; @@ -1300,7 +1300,7 @@ ta_init_chash(struct ip_fw_chain *ch, vo ti->xstate = cfg->head6; /* Store data depending on v6 mask length */ - hsize = log2(cfg->size4) << 8 | log2(cfg->size6); + hsize = ta_log2(cfg->size4) << 8 | ta_log2(cfg->size6); if (cfg->mask6 == 64) { ti->data = (32 - cfg->mask4) << 24 | (128 - cfg->mask6) << 16| hsize; @@ -1838,7 +1838,7 @@ ta_modify_chash(void *ta_state, struct t /* Update lower 32 bits with new values */ ti->data &= 0xFFFFFFFF00000000; - ti->data |= log2(cfg->size4) << 8 | log2(cfg->size6); + ti->data |= ta_log2(cfg->size4) << 8 | ta_log2(cfg->size6); } /* From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 21:57:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 87C75BC0; Wed, 22 Oct 2014 21:57:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58EADA3D; Wed, 22 Oct 2014 21:57:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MLva71098618; Wed, 22 Oct 2014 21:57:36 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MLvaLD098617; Wed, 22 Oct 2014 21:57:36 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201410222157.s9MLvaLD098617@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 22 Oct 2014 21:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273485 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 21:57:36 -0000 Author: rmacklem Date: Wed Oct 22 21:57:35 2014 New Revision: 273485 URL: https://svnweb.freebsd.org/changeset/base/273485 Log: Revert r273481 so it can be recoded using fls(), which some feel will make it more readable. Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 21:45:12 2014 (r273484) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 21:57:35 2014 (r273485) @@ -552,7 +552,7 @@ static void nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp, const char *hostname, struct ucred *cred, struct thread *td) { - int i, s; + int s; int adjsock; char *p; @@ -621,36 +621,18 @@ nfs_decode_args(struct mount *mp, struct if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) { nmp->nm_wsize = argp->wsize; - /* - * Clip at the power of 2 below the size. There is an - * issue (not isolated) that causes intermittent page - * faults if this is not done. - */ - i = NFS_FABLKSIZE; - for (;;) { - if (i * 2 > nmp->nm_wsize) { - nmp->nm_wsize = i; - break; - } - i *= 2; - } + /* Round down to multiple of blocksize */ + nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1); + if (nmp->nm_wsize <= 0) + nmp->nm_wsize = NFS_FABLKSIZE; } if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) { nmp->nm_rsize = argp->rsize; - /* - * Clip at the power of 2 below the size. There is an - * issue (not isolated) that causes intermittent page - * faults if this is not done. - */ - i = NFS_FABLKSIZE; - for (;;) { - if (i * 2 > nmp->nm_rsize) { - nmp->nm_rsize = i; - break; - } - i *= 2; - } + /* Round down to multiple of blocksize */ + nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1); + if (nmp->nm_rsize <= 0) + nmp->nm_rsize = NFS_FABLKSIZE; } if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) { From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 22:27:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD16D23C; Wed, 22 Oct 2014 22:27:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9824BCCC; Wed, 22 Oct 2014 22:27:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MMRqQb012947; Wed, 22 Oct 2014 22:27:52 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MMRqCI012946; Wed, 22 Oct 2014 22:27:52 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201410222227.s9MMRqCI012946@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 22 Oct 2014 22:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273486 - head/sys/fs/nfsclient X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 22:27:52 -0000 Author: rmacklem Date: Wed Oct 22 22:27:51 2014 New Revision: 273486 URL: https://svnweb.freebsd.org/changeset/base/273486 Log: Clip the settings for the NFS rsize, wsize mount options to a power of 2. For non-power of 2 settings, intermittent page faults have been reported. Although the bug that causes these page faults/crashes has not been identified, it does not appear to occur when rsize, wsize is a power of 2. Reported by: tcberner@gmail.com MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 21:57:35 2014 (r273485) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 22:27:51 2014 (r273486) @@ -621,17 +621,27 @@ nfs_decode_args(struct mount *mp, struct if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) { nmp->nm_wsize = argp->wsize; - /* Round down to multiple of blocksize */ - nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1); - if (nmp->nm_wsize <= 0) + /* + * Clip at the power of 2 below the size. There is an + * issue (not isolated) that causes intermittent page + * faults if this is not done. + */ + if (nmp->nm_wsize > NFS_FABLKSIZE) + nmp->nm_wsize = 1 << (fls(nmp->nm_wsize) - 1); + else nmp->nm_wsize = NFS_FABLKSIZE; } if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) { nmp->nm_rsize = argp->rsize; - /* Round down to multiple of blocksize */ - nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1); - if (nmp->nm_rsize <= 0) + /* + * Clip at the power of 2 below the size. There is an + * issue (not isolated) that causes intermittent page + * faults if this is not done. + */ + if (nmp->nm_rsize > NFS_FABLKSIZE) + nmp->nm_rsize = 1 << (fls(nmp->nm_rsize) - 1); + else nmp->nm_rsize = NFS_FABLKSIZE; } From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 22:32:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D7809415; Wed, 22 Oct 2014 22:32:41 +0000 (UTC) Received: from mail-ie0-x22b.google.com (mail-ie0-x22b.google.com [IPv6:2607:f8b0:4001:c03::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89EEED7B; Wed, 22 Oct 2014 22:32:41 +0000 (UTC) Received: by mail-ie0-f171.google.com with SMTP id x19so3888400ier.2 for ; Wed, 22 Oct 2014 15:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=eCH+hfnryxpP9QEc2ew1qOgnNWHU4TllKoDTlxp03nQ=; b=t9atySkb7NX/0Oz/Ktc/XxhEo9AQ7I5AslWg5eXMDt9+L3C8ALSP2lO/VttvxA0odf 2D9rhff1oh8IT9HEeMIFOk013TLwpCiSHQu1DUz1KyMgYc07Q4PAP6kpLpfnEbKN6jOv zfylJRNdzPyac6N7EZjRyivBFV5WffmfpBd4H0hcMw5C//F9Hu9MrZ/7GjrT3otukDsX f+GT0E2fKDS7ZUkP6/UeQJT4YaLJ1/9s/T5x0CMjLhl+HDDSh5i/LIzYcCZRj7fThppP 9B4IUz0ydwAGrbKlZVYO91iihyApOH0Cb4SsnsZUfwv/rRb1X0+CFtR2Y3jjucfdoVGP tNIw== X-Received: by 10.43.153.131 with SMTP id la3mr7086907icc.38.1414017160960; Wed, 22 Oct 2014 15:32:40 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.29.132 with HTTP; Wed, 22 Oct 2014 15:32:20 -0700 (PDT) In-Reply-To: <201410222047.s9MKlBut062991@svn.freebsd.org> References: <201410222047.s9MKlBut062991@svn.freebsd.org> From: Ed Maste Date: Wed, 22 Oct 2014 18:32:20 -0400 X-Google-Sender-Auth: hTFXJzmWe54MBh9QCt3XeeeH2UM Message-ID: Subject: Re: svn commit: r273481 - head/sys/fs/nfsclient To: Rick Macklem Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 22:32:42 -0000 On 22 October 2014 16:47, Rick Macklem wrote: > Author: rmacklem > Date: Wed Oct 22 20:47:11 2014 > New Revision: 273481 > URL: https://svnweb.freebsd.org/changeset/base/273481 > > Log: > Clip the settings for the NFS rsize, wsize mount options > to a power of 2. For what it's worth, I fixed a similar issue in r248500 a while back. It was an NFS bug and resulted in data corruption instead of a crash. Anyhow, it appears these cases are not well tested so it does seem reasonable to avoid them. -Ed From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 23:35:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 50AF3F89; Wed, 22 Oct 2014 23:35:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 22348368; Wed, 22 Oct 2014 23:35:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNZXrw045168; Wed, 22 Oct 2014 23:35:33 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNZW62045167; Wed, 22 Oct 2014 23:35:32 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201410222335.s9MNZW62045167@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Wed, 22 Oct 2014 23:35:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273487 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 23:35:33 -0000 Author: cperciva Date: Wed Oct 22 23:35:32 2014 New Revision: 273487 URL: https://svnweb.freebsd.org/changeset/base/273487 Log: Avoid leaking data from the kernel environment: When we convert the initial static environment to a dynamic one, zero the static environment buffer, and zero individual values when kern_unsetenv and freeenv are called. Tested by: kmoore (VM memory dump + grep) Tested by: cperciva (kernel panic dump + grep) Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Wed Oct 22 22:27:51 2014 (r273486) +++ head/sys/kern/kern_environment.c Wed Oct 22 23:35:32 2014 (r273487) @@ -224,7 +224,7 @@ init_static_kenv(char *buf, size_t len) static void init_dynamic_kenv(void *data __unused) { - char *cp; + char *cp, *cpnext; size_t len; int i; @@ -232,7 +232,8 @@ init_dynamic_kenv(void *data __unused) M_WAITOK | M_ZERO); i = 0; if (kern_envp && *kern_envp != '\0') { - for (cp = kern_envp; cp != NULL; cp = kernenv_next(cp)) { + for (cp = kern_envp; cp != NULL; cp = cpnext) { + cpnext = kernenv_next(cp); len = strlen(cp) + 1; if (len > KENV_MNAMELEN + 1 + KENV_MVALLEN + 1) { printf( @@ -243,6 +244,7 @@ init_dynamic_kenv(void *data __unused) if (i < KENV_SIZE) { kenvp[i] = malloc(len, M_KENV, M_WAITOK); strcpy(kenvp[i++], cp); + memset(cp, 0, strlen(cp)); } else printf( "WARNING: too many kenv strings, ignoring %s\n", @@ -260,8 +262,10 @@ void freeenv(char *env) { - if (dynamic_kenv) + if (dynamic_kenv) { + memset(env, 0, strlen(env)); free(env, M_KENV); + } } /* @@ -437,6 +441,7 @@ kern_unsetenv(const char *name) kenvp[i++] = kenvp[j]; kenvp[i] = NULL; mtx_unlock(&kenv_lock); + memset(oldenv, 0, strlen(oldenv)); free(oldenv, M_KENV); return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 23:35:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76F6814A; Wed, 22 Oct 2014 23:35:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6293C36B; Wed, 22 Oct 2014 23:35:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNZvh2045252; Wed, 22 Oct 2014 23:35:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNZvVY045251; Wed, 22 Oct 2014 23:35:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410222335.s9MNZvVY045251@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 22 Oct 2014 23:35:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273488 - head/usr.sbin/pciconf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 23:35:57 -0000 Author: markj Date: Wed Oct 22 23:35:56 2014 New Revision: 273488 URL: https://svnweb.freebsd.org/changeset/base/273488 Log: Fix some buglets in the error-handling of getdevice(). In particular, report an error if the argument to pciconf -a doesn't have a unit number, rather than triggering an assertion failure. PR: 194506 Reported by: Anthony Cornehl Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/pciconf/pciconf.c Modified: head/usr.sbin/pciconf/pciconf.c ============================================================================== --- head/usr.sbin/pciconf/pciconf.c Wed Oct 22 23:35:32 2014 (r273487) +++ head/usr.sbin/pciconf/pciconf.c Wed Oct 22 23:35:56 2014 (r273488) @@ -662,16 +662,16 @@ getdevice(const char *name) * find the start of the unit. */ if (name[0] == '\0') - err(1, "Empty device name"); + errx(1, "Empty device name"); cp = strchr(name, '\0'); assert(cp != NULL && cp != name); cp--; while (cp != name && isdigit(cp[-1])) cp--; - if (cp == name) + if (cp == name || !isdigit(*cp)) errx(1, "Invalid device name"); if ((size_t)(cp - name) + 1 > sizeof(patterns[0].pd_name)) - errx(1, "Device name i2s too long"); + errx(1, "Device name is too long"); memcpy(patterns[0].pd_name, name, cp - name); patterns[0].pd_unit = strtol(cp, &cp, 10); assert(*cp == '\0'); From owner-svn-src-head@FreeBSD.ORG Wed Oct 22 23:41:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 02C083E1; Wed, 22 Oct 2014 23:41:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E240B63D; Wed, 22 Oct 2014 23:41:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9MNfFXw048413; Wed, 22 Oct 2014 23:41:15 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9MNfFDA048412; Wed, 22 Oct 2014 23:41:15 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201410222341.s9MNfFDA048412@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Wed, 22 Oct 2014 23:41:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273489 - head/sys/geom/eli X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2014 23:41:16 -0000 Author: cperciva Date: Wed Oct 22 23:41:15 2014 New Revision: 273489 URL: https://svnweb.freebsd.org/changeset/base/273489 Log: Populate the GELI passphrase cache with the kern.geom.eli.passphrase variable (if any) provided in the boot environment. Unset it from the kernel environment after doing this, so that the passphrase is no longer present in kernel memory once we enter userland. This will make it possible to provide a GELI passphrase via the boot loader; FreeBSD's loader does not yet do this, but GRUB (and PCBSD) will have support for this soon. Tested by: kmoore Modified: head/sys/geom/eli/g_eli.c Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Wed Oct 22 23:35:56 2014 (r273488) +++ head/sys/geom/eli/g_eli.c Wed Oct 22 23:41:15 2014 (r273489) @@ -93,6 +93,25 @@ SYSCTL_UINT(_kern_geom_eli, OID_AUTO, bo &g_eli_boot_passcache, 0, "Passphrases are cached during boot process for possible reuse"); static void +fetch_loader_passphrase(void * dummy) +{ + char * env_passphrase; + + KASSERT(dynamic_kenv, ("need dynamic kenv")); + + if ((env_passphrase = kern_getenv("kern.geom.eli.passphrase")) != NULL) { + /* Extract passphrase from the environment. */ + strlcpy(cached_passphrase, env_passphrase, + sizeof(cached_passphrase)); + freeenv(env_passphrase); + + /* Wipe the passphrase from the environment. */ + kern_unsetenv("kern.geom.eli.passphrase"); + } +} +SYSINIT(geli_fetch_loader_passphrase, SI_SUB_KMEM + 1, SI_ORDER_ANY, + fetch_loader_passphrase, NULL); +static void zero_boot_passcache(void * dummy) { From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 00:00:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 10275B0A for ; Thu, 23 Oct 2014 00:00:50 +0000 (UTC) Received: from o1.l99.sendgrid.net (o1.l99.sendgrid.net [198.37.153.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD7BB7DB for ; Thu, 23 Oct 2014 00:00:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=from:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=DumTvoMgN4sSl70WrpidNnKVxQ8=; b=b6ibMXOf+SviYXqKOO vxF3rl9QFoVlCme9P/yT15gWkkoa4l8D/j7IMtzD9RLMNHL2AfgbkM8/tWpp3m/M A4Uw6SFcXffElkylKl+7hvQx9+ZPggb4gIIRnvHZ17p33iE8qFZtgjICCfWZoyiE j/Krg8GI+YpfP0HKMKrCPHaf4= Received: by filter0129p1mdw1.sendgrid.net with SMTP id filter0129p1mdw1.8883.5448452A13 2014-10-23 00:00:42.897067955 +0000 UTC Received: from mail.tarsnap.com (unknown [10.100.60.108]) by ismtpd-031.iad1.sendgrid.net (SG) with ESMTP id 1493a4e2f50.2832.2f7f90 for ; Thu, 23 Oct 2014 00:00:42 +0000 (GMT) Received: (qmail 45542 invoked from network); 23 Oct 2014 00:00:42 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 23 Oct 2014 00:00:42 -0000 Received: (qmail 9678 invoked from network); 23 Oct 2014 00:00:31 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 23 Oct 2014 00:00:31 -0000 Message-ID: <5448451E.1040104@freebsd.org> Date: Wed, 22 Oct 2014 17:00:30 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273487 - head/sys/kern References: <201410222335.s9MNZW62045167@svn.freebsd.org> In-Reply-To: <201410222335.s9MNZW62045167@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SG-EID: EvYvoie/qnEezyq2t4eRKjDm9X7ZKbCMt75WvXA+XNHAPMBJawNGSNgGz0f0adk33OBLbcki2H6LaumHuBKLRk+mZb+CgzT1RUzsH1oKm8T60qRJqxtKdS1luRa4XTqa6bWl+0LLP+JNEINMp1omhQgaYcmDDtmdRvljQy2U2snNovoCN8dor39EeLh6HphF X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 00:00:50 -0000 On 10/22/14 16:35, Colin Percival wrote: > Author: cperciva > Date: Wed Oct 22 23:35:32 2014 > New Revision: 273487 > URL: https://svnweb.freebsd.org/changeset/base/273487 > > Log: > Avoid leaking data from the kernel environment: When we convert the > initial static environment to a dynamic one, zero the static environment > buffer, and zero individual values when kern_unsetenv and freeenv are > called. Forgot to add, this will not be MFCed, since it would break KBI to zero out the static environment when kernel modules could conceivably have pointers into it. Colin Percival From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 00:31:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DAA21F4; Thu, 23 Oct 2014 00:31:26 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6D1EA74; Thu, 23 Oct 2014 00:31:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0VQwG073536; Thu, 23 Oct 2014 00:31:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0VQCf073535; Thu, 23 Oct 2014 00:31:26 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410230031.s9N0VQCf073535@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 00:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273493 - in head/contrib/xz: . po X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 00:31:27 -0000 Author: delphij Date: Thu Oct 23 00:31:26 2014 New Revision: 273493 URL: https://svnweb.freebsd.org/changeset/base/273493 Log: MFV r273492: remove gettext files. Deleted: head/contrib/xz/po/ Modified: head/contrib/xz/FREEBSD-Xlist Directory Properties: head/contrib/xz/ (props changed) Modified: head/contrib/xz/FREEBSD-Xlist ============================================================================== --- head/contrib/xz/FREEBSD-Xlist Thu Oct 23 00:09:16 2014 (r273492) +++ head/contrib/xz/FREEBSD-Xlist Thu Oct 23 00:31:26 2014 (r273493) @@ -30,6 +30,7 @@ lib/ m4/ macosx/ makefile.am +po/ src/*/*.rc src/liblzma/liblzma.pc.in src/scripts/ From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 00:40:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD30A849; Thu, 23 Oct 2014 00:40:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A68FAB66; Thu, 23 Oct 2014 00:40:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N0evwc076895; Thu, 23 Oct 2014 00:40:57 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N0ev3u076892; Thu, 23 Oct 2014 00:40:57 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410230040.s9N0ev3u076892@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 00:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273498 - in head/contrib/xz: . src/liblzma/api/lzma src/liblzma/check src/liblzma/lzma src/xz X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 00:40:57 -0000 Author: delphij Date: Thu Oct 23 00:40:56 2014 New Revision: 273498 URL: https://svnweb.freebsd.org/changeset/base/273498 Log: MFV r273494: xz 5.0.7. MFC after: 2 weeks Modified: head/contrib/xz/ChangeLog head/contrib/xz/THANKS head/contrib/xz/TODO head/contrib/xz/src/liblzma/api/lzma/block.h head/contrib/xz/src/liblzma/api/lzma/version.h head/contrib/xz/src/liblzma/check/crc32_fast.c head/contrib/xz/src/liblzma/check/sha256.c head/contrib/xz/src/liblzma/lzma/lzma_encoder_presets.c head/contrib/xz/src/xz/coder.c head/contrib/xz/src/xz/signals.c head/contrib/xz/src/xz/suffix.c Directory Properties: head/contrib/xz/ (props changed) Modified: head/contrib/xz/ChangeLog ============================================================================== --- head/contrib/xz/ChangeLog Thu Oct 23 00:40:40 2014 (r273497) +++ head/contrib/xz/ChangeLog Thu Oct 23 00:40:56 2014 (r273498) @@ -1,6 +1,337 @@ +commit 495aaf3a5b7200a5d2bf449bbbcc0e18834607af +Author: Lasse Collin +Date: 2014-09-20 20:44:32 +0300 + + Bump version and soname for 5.0.7. + + src/liblzma/Makefile.am | 2 +- + src/liblzma/api/lzma/version.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit ac6c8921d1d8d2d749d5c97f9a0b0594cc863cea +Author: Lasse Collin +Date: 2014-09-20 20:43:29 +0300 + + Update NEWS for 5.0.7. + + NEWS | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +commit d1b0276aafd441a3d4db9dfd5dd9880e9f834d49 +Author: Lasse Collin +Date: 2014-09-20 20:21:18 +0300 + + liblzma: Fix invalid Libs.private value in liblzma.pc. + + src/liblzma/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit cac72956b1e56788182ac14bfb25519636afd503 +Author: Lasse Collin +Date: 2014-09-20 19:42:56 +0300 + + liblzma: Fix a portability problem in Makefile.am. + + POSIX supports $< only in inference rules (suffix rules). + Using it elsewhere is a GNU make extension and doesn't + work e.g. with OpenBSD make. + + Thanks to Christian Weisgerber for the patch. + + src/liblzma/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 2cdf0875dedca3e89b02ad5ac8aa1109f902ae11 +Author: Lasse Collin +Date: 2014-09-14 19:35:45 +0300 + + Bump version and soname for 5.0.6. + + src/liblzma/Makefile.am | 2 +- + src/liblzma/api/lzma/version.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +commit 0168b6c8fbc88cae61b1f5fb41d6c33c9e127967 +Author: Lasse Collin +Date: 2014-09-14 19:33:46 +0300 + + Update NEWS for 5.0.6. + + NEWS | 7 +++++++ + 1 file changed, 7 insertions(+) + +commit 13337714e89d002af7af48d6853f977de985d7de +Author: Lasse Collin +Date: 2014-06-13 19:21:54 +0300 + + xzgrep: List xzgrep_expected_output in tests/Makefile.am. + + tests/Makefile.am | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +commit ccc728d8290c0464c7af62790b1c5528eceaae35 +Author: Lasse Collin +Date: 2014-06-13 18:58:22 +0300 + + xzgrep: Improve the test script. + + Now it should be close to the functionality of the original + version by Pavel Raiskup. + + tests/Makefile.am | 3 ++- + tests/test_scripts.sh | 24 ++++++++++++++---------- + tests/xzgrep_expected_output | 39 +++++++++++++++++++++++++++++++++++++++ + 3 files changed, 55 insertions(+), 11 deletions(-) + +commit 948f5865fe65061e215baa8ed63be570bae152ea +Author: Lasse Collin +Date: 2014-06-11 21:03:25 +0300 + + xzgrep: Add a test for the previous fix. + + This is a simplified version of Pavel Raiskup's + original patch. + + tests/test_scripts.sh | 26 ++++++++++++++++++++++---- + 1 file changed, 22 insertions(+), 4 deletions(-) + +commit 64228d0d5cd75af31e5c330cc3a792016413fabf +Author: Lasse Collin +Date: 2014-06-11 20:43:28 +0300 + + xzgrep: exit 0 when at least one file matches. + + Mimic the original grep behavior and return exit_success when + at least one xz compressed file matches given pattern. + + Original bugreport: + https://bugzilla.redhat.com/show_bug.cgi?id=1108085 + + Thanks to Pavel Raiskup for the patch. + + src/scripts/xzgrep.in | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +commit 98d3368ef4bff0face78d6932f2156730c8cb658 +Author: Lasse Collin +Date: 2014-04-25 17:53:42 +0300 + + Build: Fix the combination of --disable-xzdec --enable-lzmadec. + + In this case "make install" could fail if the man page directory + didn't already exist at the destination. If it did exist, a + dangling symlink was created there. Now the link is omitted + instead. This isn't the best fix but it's better than the old + behavior. + + src/xzdec/Makefile.am | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +commit ba3b5dd082db2cb5973e877a74221d739c663fb4 +Author: Lasse Collin +Date: 2014-04-25 17:44:26 +0300 + + Build: Add --disable-doc to configure. + + INSTALL | 6 ++++++ + Makefile.am | 2 ++ + configure.ac | 6 ++++++ + 3 files changed, 14 insertions(+) + +commit 3d4575f2367fe8f1f2dcacba014e6c0aef388535 +Author: Lasse Collin +Date: 2014-04-24 18:06:24 +0300 + + Update INSTALL. + + Add a note about failing "make check". The source of + the problem should be fixed in libtool (if it really is + a libtool bug and not mine) but I'm unable to spend time + on that for now. Thanks to Nelson H. F. Beebe for reporting + the issue. + + Add a note about a possible need to run "ldconfig" after + "make install". + + INSTALL | 25 +++++++++++++++++++++++++ + 1 file changed, 25 insertions(+) + +commit b9f0584e3eff421eadbb6604de0b0b40bf87e129 +Author: Lasse Collin +Date: 2014-04-09 17:26:10 +0300 + + xz: Rename a variable to avoid a namespace collision on Solaris. + + I don't know the details but I have an impression that there's + no problem in practice if using GCC since people have built xz + with GCC (without patching xz), but renaming the variable cannot + hurt either. + + Thanks to Mark Ashley. + + src/xz/signals.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +commit cc41bcaf77c9c27ec09ef033fb3300e994e828e6 +Author: Lasse Collin +Date: 2014-04-26 08:45:49 +0300 + + xz: Fix a comment. + + src/xz/coder.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit e34025d666852839388f997d076e3577847dd10f +Author: Lasse Collin +Date: 2014-01-12 16:44:52 +0200 + + liblzma: Avoid C99 compound literal arrays. + + MSVC 2013 doesn't like them. Maybe they aren't so good + for readability either since many aren't used to them. + + src/liblzma/lzma/lzma_encoder_presets.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +commit 0b6168974f1fac3a06157039235b66e4161b9b42 +Author: Lasse Collin +Date: 2014-01-12 12:50:30 +0200 + + liblzma: Remove a useless C99ism from sha256.c. + + Unsurprisingly it makes no difference in compiled output. + + src/liblzma/check/sha256.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit 41e436076cfdcccc7e853de73b0d56b3d6d42053 +Author: Lasse Collin +Date: 2014-01-12 12:17:08 +0200 + + xz: Fix use of wrong variable. + + Since the only call to suffix_set() uses optarg + as the argument, fixing this bug doesn't change + the behavior of the program. + + src/xz/suffix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit c33efefd4ef0931e5795e13725d4bd2203571ce0 +Author: Lasse Collin +Date: 2014-04-26 08:37:00 +0300 + + Fix typos in comments. + + src/liblzma/check/crc32_fast.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +commit e560c82f1f5693d88db9dc71f656436135f17595 +Author: Lasse Collin +Date: 2013-11-26 18:20:16 +0200 + + Update THANKS. + + THANKS | 1 + + 1 file changed, 1 insertion(+) + +commit 05192b32e553eac5dfbd646b6102d10187f29a05 +Author: Lasse Collin +Date: 2013-11-26 18:20:09 +0200 + + liblzma: Document the need for block->check for lzma_block_header_decode(). + + Thanks to Tomer Chachamu. + + src/liblzma/api/lzma/block.h | 3 +++ + 1 file changed, 3 insertions(+) + +commit 0f35eafe51db7b1eb0711bc8cc829ea6896b34f4 +Author: Lasse Collin +Date: 2013-10-26 12:47:04 +0300 + + Update TODO. + + TODO | 4 ---- + 1 file changed, 4 deletions(-) + +commit fc9eaf81d718488b052e5c65f9d6f08acc858873 +Author: Lasse Collin +Date: 2013-09-11 14:40:35 +0300 + + Build: Remove a comment about Automake 1.10 from configure.ac. + + The previous commit supports silent rules and that requires + Automake 1.11. + + configure.ac | 2 -- + 1 file changed, 2 deletions(-) + +commit 090c69dda59e00fc86d0792879bd921bb1156029 +Author: Lasse Collin +Date: 2013-09-09 20:37:03 +0300 + + Build: Create liblzma.pc in a src/liblzma/Makefile.am. + + Previously it was done in configure, but doing that goes + against the Autoconf manual. Autoconf requires that it is + possible to override e.g. prefix after running configure + and that doesn't work correctly if liblzma.pc is created + by configure. + + A potential downside of this change is that now e.g. + libdir in liblzma.pc is a standalone string instead of + being defined via ${prefix}, so if one overrides prefix + when running pkg-config the libdir won't get the new value. + I don't know if this matters in practice. + + Thanks to Vincent Torri. + + configure.ac | 1 - + src/liblzma/Makefile.am | 20 ++++++++++++++++++++ + 2 files changed, 20 insertions(+), 1 deletion(-) + +commit 1f35331332273de01c46897cafdb37f8e6e285db +Author: Anders F Bjorklund +Date: 2013-08-02 15:59:46 +0200 + + macosx: separate liblzma package + + macosx/build.sh | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +commit 1415f1d94644f28e07d544bc1e06b0636081abee +Author: Anders F Bjorklund +Date: 2013-08-02 15:58:44 +0200 + + macosx: set minimum to leopard + + macosx/build.sh | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +commit 41913949b93414a21ae9fb1a8e9b7cdde8b37f98 +Author: Anders F Bjorklund +Date: 2011-08-07 13:13:30 +0200 + + move configurables into variables + + macosx/build.sh | 25 ++++++++++++++++++------- + 1 file changed, 18 insertions(+), 7 deletions(-) + +commit 3dffda33f47dc220bb1738564fe02effa9da4c8e +Author: Lasse Collin +Date: 2013-07-15 14:08:02 +0300 + + Build: Fix the detection of missing CRC32. + + Thanks to Vincent Torri. + + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit b69900ed0b2f914fc6c0a180dcb522dbe5b80ea7 Author: Lasse Collin -Date: Sun Jun 30 18:02:27 2013 +0300 +Date: 2013-06-30 18:02:27 +0300 Man pages: Use similar syntax for synopsis as in xz. @@ -10,38 +341,56 @@ Date: Sun Jun 30 18:02:27 2013 +0300 didn't mention these man pages in his bug report, but it's nice to be consistent. + src/lzmainfo/lzmainfo.1 | 4 ++-- + src/scripts/xzmore.1 | 6 +++--- + src/xzdec/xzdec.1 | 10 +++++----- + 3 files changed, 10 insertions(+), 10 deletions(-) + commit cf4a1e1879d89be314ef3c064bd2656ea452f87e Author: Lasse Collin -Date: Sun Jun 30 15:55:09 2013 +0300 +Date: 2013-06-30 15:55:09 +0300 Update NEWS for 5.0.5. + NEWS | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 52 insertions(+) + commit cb94bb6d1f34e1e93c2d634ea9c3b7dfb3981d05 Author: Lasse Collin -Date: Sun Jun 30 15:54:38 2013 +0300 +Date: 2013-06-30 15:54:38 +0300 Bump version and soname for 5.0.5. + src/liblzma/Makefile.am | 2 +- + src/liblzma/api/lzma/version.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + commit b7dee202d5b041ccae028d0c5433b83cecbe9e5d Author: Lasse Collin -Date: Fri Jun 28 23:56:17 2013 +0300 +Date: 2013-06-28 23:56:17 +0300 xz: Fix return value type in io_write_buf(). It didn't affect the behavior of the code since -1 becomes true anyway. + src/xz/file_io.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 265e7b44d804b47373f10b7da28350db7611cea6 Author: Lasse Collin -Date: Fri Jun 28 18:46:13 2013 +0300 +Date: 2013-06-28 18:46:13 +0300 xz: Remove an outdated NetBSD-specific comment. Nowadays errno == EFTYPE is documented in open(2). + src/xz/file_io.c | 4 ---- + 1 file changed, 4 deletions(-) + commit 78c2f8db902195468b8249c432252a6b281db836 Author: Lasse Collin -Date: Fri Jun 28 18:09:47 2013 +0300 +Date: 2013-06-28 18:09:47 +0300 xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls. @@ -51,9 +400,12 @@ Date: Fri Jun 28 18:09:47 2013 +0300 F_SETFL is always 0 (at least accorinding to fcntl(2) from man-pages 3.51). + src/xz/file_io.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + commit 91750dff8f2c654ff636f12a2acdffe5492374b3 Author: Lasse Collin -Date: Fri Jun 28 17:36:47 2013 +0300 +Date: 2013-06-28 17:36:47 +0300 xz: Fix use of wrong variable in a fcntl() call. @@ -69,9 +421,12 @@ Date: Fri Jun 28 17:36:47 2013 +0300 indicate when the flags should be restored instead of relying on a special value in stdout_flags. + src/xz/file_io.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + commit e11888a79a4a77a69afde60445880d44f63d01aa Author: Lasse Collin -Date: Wed Jun 26 13:30:57 2013 +0300 +Date: 2013-06-26 13:30:57 +0300 xz: Check the value of lzma_stream_flags.version in --list. @@ -80,9 +435,12 @@ Date: Wed Jun 26 13:30:57 2013 +0300 then this check becomes important and will stop the old xz from trying to parse files that it won't understand. + src/xz/list.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + commit f39ddd88f3222219ada88998cf30abfdd3e0e96c Author: Lasse Collin -Date: Wed Jun 26 12:17:00 2013 +0300 +Date: 2013-06-26 12:17:00 +0300 Build: Require Automake 1.12 and use serial-tests option. @@ -95,9 +453,12 @@ Date: Wed Jun 26 12:17:00 2013 +0300 in XZ Utils but they hide the progress output from test_compress.sh. + configure.ac | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + commit cb84e278027a90e9827a6f4d3bb0b4d4744a2fbb Author: Lasse Collin -Date: Sun Jun 23 17:36:47 2013 +0300 +Date: 2013-06-23 17:36:47 +0300 xz: Validate Uncompressed Size from Block Header in list.c. @@ -107,23 +468,32 @@ Date: Sun Jun 23 17:36:47 2013 +0300 show such files as corrupt instead of showing the Uncompressed Size from Index. + src/xz/list.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + commit f01780fce454c7489f7dcbf806299b50da5f51b7 Author: Lasse Collin -Date: Wed Jun 26 10:58:58 2013 +0300 +Date: 2013-06-26 10:58:58 +0300 Update THANKS. + THANKS | 2 ++ + 1 file changed, 2 insertions(+) + commit d98ede7d700b892e32d9c2f46563b6ebc566786d Author: Lasse Collin -Date: Fri Jun 21 22:04:45 2013 +0300 +Date: 2013-06-21 22:04:45 +0300 xz: Make the man page more friendly to doclifter. Thanks to Eric S. Raymond. + src/xz/xz.1 | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + commit 19b447b64b3f520cd5b11429000b092f7c76709b Author: Lasse Collin -Date: Fri Jun 21 21:54:59 2013 +0300 +Date: 2013-06-21 21:54:59 +0300 xz: A couple of man page fixes. @@ -133,9 +503,12 @@ Date: Fri Jun 21 21:54:59 2013 +0300 Thanks to DevHC who reported these issues on IRC to me on 2012-12-14. + src/xz/xz.1 | 35 +++++++++++++++++++++++------------ + 1 file changed, 23 insertions(+), 12 deletions(-) + commit 45edf2966fc9a4d2eae8f84b2fa027fb4fa1df8b Author: Lasse Collin -Date: Fri Jun 21 21:50:26 2013 +0300 +Date: 2013-06-21 21:50:26 +0300 xz: Fix interaction between preset and custom filter chains. @@ -158,15 +531,22 @@ Date: Fri Jun 21 21:50:26 2013 +0300 Thanks to Conley Moorhous. + src/xz/coder.c | 35 +++++++++++++++++++++-------------- + 1 file changed, 21 insertions(+), 14 deletions(-) + commit b065984e5a9272eb50bc0c6d3731e6199c0ae8a8 Author: Lasse Collin -Date: Fri Apr 8 17:53:05 2011 +0300 +Date: 2011-04-08 17:53:05 +0300 xz: Change size_t to uint32_t in a few places. + src/xz/coder.c | 6 +++--- + src/xz/coder.h | 2 +- + 2 files changed, 4 insertions(+), 4 deletions(-) + commit 32be621f52f2e1686db88baa7b01dc1ae338f426 Author: Lasse Collin -Date: Sat Apr 27 22:07:46 2013 +0300 +Date: 2013-04-27 22:07:46 +0300 Build: Use -Wvla with GCC if supported. @@ -175,9 +555,12 @@ Date: Sat Apr 27 22:07:46 2013 +0300 future either to stay compatible with C11 without requiring any optional C11 features. + configure.ac | 1 + + 1 file changed, 1 insertion(+) + commit efb07cfba65e9e05984c02cd796c1b0338ce04dc Author: Lasse Collin -Date: Mon Apr 15 19:29:09 2013 +0300 +Date: 2013-04-15 19:29:09 +0300 xzdec: Improve the --help message. @@ -189,23 +572,32 @@ Date: Mon Apr 15 19:29:09 2013 +0300 because I find it easier to spot the ignored vs. non-ignored options from the list that way. + src/xzdec/xzdec.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + commit e3c8be13699e2813f5e2879d8187444b46d82d89 Author: Lasse Collin -Date: Fri Apr 5 19:25:40 2013 +0300 +Date: 2013-04-05 19:25:40 +0300 Update THANKS. + THANKS | 2 ++ + 1 file changed, 2 insertions(+) + commit ad8282efe483612f6b5544f9a0d2e4914fb2532a Author: Jeff Bastian -Date: Wed Apr 3 13:59:17 2013 +0200 +Date: 2013-04-03 13:59:17 +0200 xzgrep: make the '-h' option to be --no-filename equivalent * src/scripts/xzgrep.in: Accept the '-h' option in argument parsing. + src/scripts/xzgrep.in | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 9271a3eb0e022b23e8712154be851d0afe4c02e4 Author: Lasse Collin -Date: Fri Apr 5 19:34:09 2013 +0300 +Date: 2013-04-05 19:34:09 +0300 liblzma: Be less picky in lzma_alone_decoder(). @@ -231,9 +623,14 @@ Date: Fri Apr 5 19:34:09 2013 +0300 src/liblzma/common/alone_decoder.c src/liblzma/common/alone_decoder.h + src/liblzma/common/alone_decoder.c | 22 ++++++++++++++-------- + src/liblzma/common/alone_decoder.h | 5 +++-- + src/liblzma/common/auto_decoder.c | 2 +- + 3 files changed, 18 insertions(+), 11 deletions(-) + commit 211b931cee58626c1d2e021810cb108cb5cbc10f Author: Lasse Collin -Date: Tue Mar 5 19:14:50 2013 +0200 +Date: 2013-03-05 19:14:50 +0200 Avoid unneeded use of awk in xzless. @@ -243,9 +640,12 @@ Date: Tue Mar 5 19:14:50 2013 +0200 Thanks to Ariel P for the patch. + src/scripts/xzless.in | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + commit 9f62fd9605eade23b62b07a235d1f02156f7a5c6 Author: Jonathan Nieder -Date: Mon Nov 19 00:10:10 2012 -0800 +Date: 2012-11-19 00:10:10 -0800 xzless: Make "less -V" parsing more robust @@ -282,46 +682,66 @@ Date: Mon Nov 19 00:10:10 2012 -0800 Reported-by: Jörg-Volker Peetz Signed-off-by: Jonathan Nieder + src/scripts/xzless.in | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + commit 1d05980f5b5c2c94d833001daccacce4a466876e Author: Lasse Collin -Date: Wed Oct 3 15:54:24 2012 +0300 +Date: 2012-10-03 15:54:24 +0300 xz: Fix the note about --rsyncable on the man page. + src/xz/xz.1 | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + commit fb68497333598688d309a92838d91fd560f7e9f0 Author: Lasse Collin -Date: Fri Sep 28 20:11:09 2012 +0300 +Date: 2012-09-28 20:11:09 +0300 xz: Improve handling of failed realloc in xrealloc. Thanks to Jim Meyering. + src/xz/util.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + commit 75013db6d4d63c195bd8b8d45729b4be0665a812 Author: Lasse Collin -Date: Sat Dec 15 20:01:02 2012 +0200 +Date: 2012-12-15 20:01:02 +0200 A few typo fixes to comments and the xz man page. Thanks to Jim Meyering. + configure.ac | 2 +- + src/liblzma/check/sha256.c | 1 - + src/xz/xz.1 | 4 ++-- + 3 files changed, 3 insertions(+), 4 deletions(-) + commit e44b21839b1dcbac5097be39b87dd2ddb6e114fd Author: Lasse Collin -Date: Thu Aug 2 17:13:30 2012 +0300 +Date: 2012-08-02 17:13:30 +0300 Build: Bump gettext version requirement to 0.18. Otherwise too old version of m4/lib-link.m4 gets included when autoreconf -fi is run. + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit fd3dbb23ca7e75a7a888d7e897c381dc06308307 Author: Lasse Collin -Date: Thu Jul 5 07:36:28 2012 +0300 +Date: 2012-07-05 07:36:28 +0300 Tests: Remove tests/test_block.c that had gotten committed accidentally. + tests/test_block.c | 52 ---------------------------------------------------- + 1 file changed, 52 deletions(-) + commit 05a735d279d74af437c31f25f69aded4713c1a3d Author: Lasse Collin -Date: Thu Jul 5 07:33:35 2012 +0300 +Date: 2012-07-05 07:33:35 +0300 Build: Include macosx/build.sh in the distribution. @@ -329,55 +749,81 @@ Date: Thu Jul 5 07:33:35 2012 +0300 few people have seen it since it hasn't been included in the release tarballs. :-( + Makefile.am | 1 + + 1 file changed, 1 insertion(+) + commit 4e6d62793b5e7b87edcc93c7ded072c1ecd94173 Author: Lasse Collin -Date: Thu Jul 5 07:24:45 2012 +0300 +Date: 2012-07-05 07:24:45 +0300 Docs: Fix the name LZMA Utils -> XZ Utils in debug/README. + debug/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit dd95b5e7614baf1f07a1316b5106bd616a9efa79 Author: Lasse Collin -Date: Thu Jul 5 07:23:17 2012 +0300 +Date: 2012-07-05 07:23:17 +0300 Include debug/translation.bash in the distribution. Also fix the script name mentioned in README. + README | 4 ++-- + debug/Makefile.am | 3 +++ + 2 files changed, 5 insertions(+), 2 deletions(-) + commit 20778053a07eb90c159c1377ca8dc05a90fd530b Author: Lasse Collin -Date: Fri Jun 22 14:36:16 2012 +0300 +Date: 2012-06-22 14:36:16 +0300 xz: Update man page date to match the latest update. + src/xz/xz.1 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 2cefa84af676da37d7e9c466d55d46c67ab00c22 Author: Lasse Collin -Date: Fri Jun 22 10:25:43 2012 +0300 +Date: 2012-06-22 10:25:43 +0300 Bump version and soname for 5.0.4. + src/liblzma/Makefile.am | 2 +- + src/liblzma/api/lzma/version.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + commit 433fec191a17e45690809e54146ea7a773f54cff Author: Lasse Collin -Date: Fri Jun 22 10:25:09 2012 +0300 +Date: 2012-06-22 10:25:09 +0300 Update NEWS for 5.0.4. + NEWS | 25 +++++++++++++++++++------ + 1 file changed, 19 insertions(+), 6 deletions(-) + commit 711fa680f552a4003df73b37e6dc4d6e00b47bcd Author: Lasse Collin -Date: Mon Jun 18 21:27:47 2012 +0300 +Date: 2012-06-18 21:27:47 +0300 Docs: Language fix to 01_compress_easy.c. Thanks to Jonathan Nieder. + doc/examples/01_compress_easy.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 3d7ab1dc61a75c560828be5df96598388b771456 Author: Lasse Collin -Date: Thu Jun 14 20:15:30 2012 +0300 +Date: 2012-06-14 20:15:30 +0300 Fix the top-level Makefile.am for the new example programs. + Makefile.am | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + commit ef8b8e5f111469b5bc005975f7abb9abbd372b25 Author: Lasse Collin -Date: Thu Jun 14 10:52:33 2012 +0300 +Date: 2012-06-14 10:52:33 +0300 Docs: Add new example programs. @@ -385,9 +831,16 @@ Date: Thu Jun 14 10:52:33 2012 +0300 human-readable error messages. More tutorial-like examples are needed but these are a start. + doc/examples/00_README.txt | 27 ++++ + doc/examples/01_compress_easy.c | 297 ++++++++++++++++++++++++++++++++++++++ + doc/examples/02_decompress.c | 287 ++++++++++++++++++++++++++++++++++++ + doc/examples/03_compress_custom.c | 193 +++++++++++++++++++++++++ + doc/examples/Makefile | 23 +++ + 5 files changed, 827 insertions(+) + commit 75c149bc8045a26f8bc719cb8ed20668dab79091 Author: Lasse Collin -Date: Thu Jun 14 10:33:27 2012 +0300 +Date: 2012-06-14 10:33:27 +0300 Docs: Move xz_pipe_comp.c and xz_pipe_decomp.c to doc/examples_old. @@ -395,49 +848,73 @@ Date: Thu Jun 14 10:33:27 2012 +0300 copied the decompressor bug from xz_pipe_decomp.c he has an example how to easily fix it. + doc/examples/xz_pipe_comp.c | 127 -------------------------------------- + doc/examples/xz_pipe_decomp.c | 123 ------------------------------------ + doc/examples_old/xz_pipe_comp.c | 127 ++++++++++++++++++++++++++++++++++++++ + doc/examples_old/xz_pipe_decomp.c | 123 ++++++++++++++++++++++++++++++++++++ + 4 files changed, 250 insertions(+), 250 deletions(-) + commit 456307ebf947a5f50bd995d617b99c1215572308 Author: Lasse Collin -Date: Thu Jun 14 10:33:01 2012 +0300 +Date: 2012-06-14 10:33:01 +0300 Docs: Fix a bug in xz_pipe_decomp.c example program. + doc/examples/xz_pipe_decomp.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + commit 4c310b8a29bc257e6ccbd2310f12f258678f3fef Author: Lasse Collin -Date: Thu May 31 15:53:25 2012 +0300 +Date: 2012-05-31 15:53:25 +0300 Translations: Update the Italian translation. Thanks to Milo Casagrande. + po/it.po | 311 ++++++++++++++++++++++++++++++--------------------------------- + 1 file changed, 146 insertions(+), 165 deletions(-) + commit ec32b79366dc47a55ea877589df9e8509ba113a7 Author: Lasse Collin -Date: Wed May 30 23:15:07 2012 +0300 +Date: 2012-05-30 23:15:07 +0300 Translations: Update the French translation. Thanks to Adrien Nader. + po/fr.po | 237 +++++++++++++++++++++++++++++++-------------------------------- + 1 file changed, 118 insertions(+), 119 deletions(-) + commit dd06f40e4dd7649525e4f28d890dc238a3aa37e5 Author: Lasse Collin -Date: Tue May 29 22:26:27 2012 +0300 +Date: 2012-05-29 22:26:27 +0300 Translations: Update the German translation. + po/de.po | 169 ++++++++++++++++++++++++++++++++++----------------------------- + 1 file changed, 91 insertions(+), 78 deletions(-) + commit c66808d1f55d0149ed57c536cc9b52e9c8b583bc Author: Lasse Collin -Date: Tue May 29 22:12:57 2012 +0300 +Date: 2012-05-29 22:12:57 +0300 Translations: Update Polish translation. + po/pl.po | 150 ++++++++++++++++++++++++++++++++++----------------------------- + 1 file changed, 82 insertions(+), 68 deletions(-) + commit 556c22dfed195c1466b298183b850d6c28544900 Author: Lasse Collin -Date: Tue May 29 13:10:36 2012 +0300 +Date: 2012-05-29 13:10:36 +0300 Preliminary NEWS for 5.0.4. + NEWS | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + commit dd13b66bf582f49d3aec36e3410ff8541b7506da Author: Lasse Collin -Date: Mon May 28 20:42:11 2012 +0300 +Date: 2012-05-28 20:42:11 +0300 liblzma: Fix possibility of incorrect LZMA_BUF_ERROR. @@ -465,21 +942,32 @@ Date: Mon May 28 20:42:11 2012 +0300 A similar bug was fixed in XZ Embedded on 2011-09-19. + src/liblzma/simple/simple_coder.c | 2 +- + tests/Makefile.am | 4 +- + tests/test_bcj_exact_size.c | 112 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 116 insertions(+), 2 deletions(-) + commit a0223bf796fdaad51a11ad02c4195c694849cc78 Author: Lasse Collin -Date: Mon May 28 15:38:32 2012 +0300 +Date: 2012-05-28 15:38:32 +0300 Update THANKS. + THANKS | 1 + + 1 file changed, 1 insertion(+) + commit 86e57e4bfefe3fd8e13615c41604165bb2359501 Author: Lasse Collin -Date: Mon May 28 15:37:43 2012 +0300 +Date: 2012-05-28 15:37:43 +0300 xz: Don't show a huge number in -vv when memory limit is disabled. + src/xz/message.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + commit 13e44a94da19d1ef14832ff12d3877a6fd2c54c0 Author: Lasse Collin -Date: Sun May 27 22:30:17 2012 +0300 +Date: 2012-05-27 22:30:17 +0300 xz: Document the "summary" lines of --robot -lvv. @@ -487,30 +975,43 @@ Date: Sun May 27 22:30:17 2012 +0300 The new columns added in the master branch aren't necessarily stable yet. + src/xz/xz.1 | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + commit 2f90345e13ab8fea4de45a4f1caa73ebc63a62e7 Author: Lasse Collin -Date: Sun May 27 21:53:20 2012 +0300 +Date: 2012-05-27 21:53:20 +0300 xz: Fix output of verbose --robot --list modes. It printed the filename in "filename (x/y)" format which it obviously shouldn't do in robot mode. + src/xz/message.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 8d4864f53ffae5d862c691a0b334a6b69bc5366e Author: Lasse Collin -Date: Thu May 10 21:15:17 2012 +0300 +Date: 2012-05-10 21:15:17 +0300 Update THANKS. + THANKS | 1 + + 1 file changed, 1 insertion(+) + commit 35e9c58abb0ce3993da844aaeaa3e7231cd2be8f Author: Lasse Collin -Date: Thu May 10 21:14:16 2012 +0300 +Date: 2012-05-10 21:14:16 +0300 Docs: Cleanup line wrapping a bit. + README | 12 ++++++------ + doc/history.txt | 49 +++++++++++++++++++++++++------------------------ + 2 files changed, 31 insertions(+), 30 deletions(-) + commit 532b3e4c568a228309b56f95c13435fd078dbe02 Author: Benno Schulenberg -Date: Tue Mar 13 22:04:04 2012 +0100 +Date: 2012-03-13 22:04:04 +0100 Fix a few typos and add some missing articles in some documents. @@ -518,42 +1019,64 @@ Date: Tue Mar 13 22:04:04 2012 +0100 Signed-off-by: Benno Schulenberg + AUTHORS | 6 +++--- + README | 42 ++++++++++++++++++++--------------------- + doc/faq.txt | 24 ++++++++++++------------ + doc/history.txt | 58 ++++++++++++++++++++++++++++----------------------------- + 4 files changed, 65 insertions(+), 65 deletions(-) + commit afb6ce8c82ffef8f2505a3759da72a733c7b0b8f Author: Lasse Collin -Date: Sun Apr 29 11:51:25 2012 +0300 +Date: 2012-04-29 11:51:25 +0300 Windows: Update notes about static linking with MSVC. + windows/README-Windows.txt | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + commit 7c3ba2ed5c3c878d4a14ca549b46dbff60c6d565 Author: Lasse Collin -Date: Thu Apr 19 15:25:26 2012 +0300 +Date: 2012-04-19 15:25:26 +0300 liblzma: Remove outdated comments. + src/liblzma/simple/simple_coder.c | 3 --- + src/liblzma/simple/simple_private.h | 3 +-- + 2 files changed, 1 insertion(+), 5 deletions(-) + commit f55db9c187651094f43881c49db2b2d9ffee6b80 Author: Lasse Collin -Date: Thu Apr 19 14:17:52 2012 +0300 +Date: 2012-04-19 14:17:52 +0300 DOS: Link against DJGPP's libemu to support FPU emulation. This way xz should work on 386SX and 486SX. Floating point only is needed for verbose output in xz. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 01:22:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E53AB8A3; Thu, 23 Oct 2014 01:22:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C5A56F86; Thu, 23 Oct 2014 01:22:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N1MV6j099026; Thu, 23 Oct 2014 01:22:31 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N1MUX4099021; Thu, 23 Oct 2014 01:22:30 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410230122.s9N1MUX4099021@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 01:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273507 - head/usr.bin/gzip X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 01:22:32 -0000 Author: delphij Date: Thu Oct 23 01:22:29 2014 New Revision: 273507 URL: https://svnweb.freebsd.org/changeset/base/273507 Log: Sync with NetBSD. MFC after: 2 weeks Modified: head/usr.bin/gzip/Makefile head/usr.bin/gzip/gzip.1 head/usr.bin/gzip/gzip.c head/usr.bin/gzip/zmore head/usr.bin/gzip/zmore.1 Modified: head/usr.bin/gzip/Makefile ============================================================================== --- head/usr.bin/gzip/Makefile Thu Oct 23 01:09:01 2014 (r273506) +++ head/usr.bin/gzip/Makefile Thu Oct 23 01:22:29 2014 (r273507) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.16 2011/06/21 13:25:45 joerg Exp $ +# $NetBSD: Makefile,v 1.18 2013/11/13 11:12:24 pettai Exp $ # $FreeBSD$ .include @@ -21,7 +21,8 @@ SCRIPTS= gzexe zdiff zforce zmore znew MLINKS+= gzip.1 gunzip.1 \ gzip.1 gzcat.1 \ gzip.1 zcat.1 \ - zdiff.1 zcmp.1 + zdiff.1 zcmp.1 \ + zmore.1 zless.1 LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip \ ${BINDIR}/gzip ${BINDIR}/gzcat \ Modified: head/usr.bin/gzip/gzip.1 ============================================================================== --- head/usr.bin/gzip/gzip.1 Thu Oct 23 01:09:01 2014 (r273506) +++ head/usr.bin/gzip/gzip.1 Thu Oct 23 01:22:29 2014 (r273507) @@ -1,4 +1,4 @@ -.\" $NetBSD: gzip.1,v 1.21 2011/06/19 02:22:36 christos Exp $ +.\" $NetBSD: gzip.1,v 1.23 2014/03/18 18:20:45 riastradh Exp $ .\" .\" Copyright (c) 1997, 2003, 2004 Matthew R. Green .\" All rights reserved. Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Thu Oct 23 01:09:01 2014 (r273506) +++ head/usr.bin/gzip/gzip.c Thu Oct 23 01:22:29 2014 (r273507) @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.105 2011/08/30 23:06:00 joerg Exp $ */ +/* $NetBSD: gzip.c,v 1.106 2014/10/18 08:33:30 snj Exp $ */ /*- * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green @@ -158,7 +158,7 @@ static suffixes_t suffixes[] = { #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) #define SUFFIX_MAXLEN 30 -static const char gzip_version[] = "FreeBSD gzip 20111009"; +static const char gzip_version[] = "FreeBSD gzip 20141022"; #ifndef SMALL static const char gzip_copyright[] = \ @@ -1769,7 +1769,7 @@ handle_stdout(void) return; } #endif - /* If stdin is a file use it's mtime, otherwise use current time */ + /* If stdin is a file use its mtime, otherwise use current time */ ret = fstat(STDIN_FILENO, &sb); #ifndef SMALL @@ -2110,7 +2110,7 @@ static void display_license(void) { - fprintf(stderr, "%s (based on NetBSD gzip 20111009)\n", gzip_version); + fprintf(stderr, "%s (based on NetBSD gzip 20141018)\n", gzip_version); fprintf(stderr, "%s\n", gzip_copyright); exit(0); } Modified: head/usr.bin/gzip/zmore ============================================================================== --- head/usr.bin/gzip/zmore Thu Oct 23 01:09:01 2014 (r273506) +++ head/usr.bin/gzip/zmore Thu Oct 23 01:22:29 2014 (r273507) @@ -1,7 +1,8 @@ #!/bin/sh - # -# $NetBSD: zmore,v 1.3 2004/03/29 09:59:42 wiz Exp $ -# $OpenBSD: zmore,v 1.4 2003/07/29 07:42:45 otto Exp $ +# $NetBSD: zmore,v 1.5 2013/12/06 13:33:15 pettai Exp $ +# +# $OpenBSD: zmore,v 1.6 2008/08/20 09:22:02 mpf Exp $ # #- # Copyright (c) 2003 Todd C. Miller @@ -42,15 +43,21 @@ while test $# -ne 0; do esac done +if [ `basename $0` = "zless" ] ; then + pager=${PAGER-less} +else + pager=${PAGER-more} +fi + # No files means read from stdin if [ $# -eq 0 ]; then - gzip -cdfq 2>&1 | ${PAGER-more} $flags + gzip -cdfq 2>&1 | $pager $flags exit 0 fi oterm=`stty -g 2>/dev/null` while test $# -ne 0; do - gzip -cdfq "$1" 2>&1 | ${PAGER-more} $flags + gzip -cdfq "$1" 2>&1 | $pager $flags prev="$1" shift if tty -s && test -n "$oterm" -a $# -gt 0; then Modified: head/usr.bin/gzip/zmore.1 ============================================================================== --- head/usr.bin/gzip/zmore.1 Thu Oct 23 01:09:01 2014 (r273506) +++ head/usr.bin/gzip/zmore.1 Thu Oct 23 01:22:29 2014 (r273507) @@ -1,5 +1,5 @@ -.\" $NetBSD: zmore.1,v 1.3 2003/12/28 12:47:52 wiz Exp $ -.\" $OpenBSD: zmore.1,v 1.3 2003/06/23 21:00:48 deraadt Exp $ +.\" $NetBSD: zmore.1,v 1.4 2013/11/12 21:58:37 pettai Exp $ +.\" $OpenBSD: zmore.1,v 1.10 2009/08/16 09:41:08 sobrado Exp $ .\" .\" Copyright (c) 2003 Todd C. Miller .\" @@ -20,16 +20,20 @@ .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" .\" $FreeBSD$ -.Dd February 6, 2011 +.Dd October 22, 2014 .Dt ZMORE 1 .Os .Sh NAME -.Nm zmore +.Nm zmore , +.Nm zless .Nd view compressed files .Sh SYNOPSIS .Nm zmore .Op Ar flags -.Op Ar file ... +.Op Ar +.Nm zless +.Op Ar flags +.Op Ar .Sh DESCRIPTION .Nm is a filter that allows the viewing of files compressed with Lempel-Ziv @@ -51,6 +55,14 @@ that are specified are passed to the use .Pa /usr/bin/more by default). .Pp +.Nm zless +is equivalent to +.Nm zmore +but uses +.Xr less 1 +as a pager instead of +.Xr more 1 . +.Pp When multiple files are specified, .Nm will pause at the end of each file and present the following prompt to the user: @@ -86,7 +98,11 @@ style compression since there is no suff Program used to display files. If unset, .Pa /usr/bin/more -is used. +is used +.Pq Nm zmore +or +.Pa /usr/bin/less +.Pq Nm zless . .El .Sh SEE ALSO .Xr compress 1 , From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 03:13:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B534D336; Thu, 23 Oct 2014 03:13:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 874B5CDC; Thu, 23 Oct 2014 03:13:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N3DFYO051390; Thu, 23 Oct 2014 03:13:15 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N3DF4B051389; Thu, 23 Oct 2014 03:13:15 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410230313.s9N3DF4B051389@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 23 Oct 2014 03:13:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273514 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 03:13:15 -0000 Author: ian Date: Thu Oct 23 03:13:14 2014 New Revision: 273514 URL: https://svnweb.freebsd.org/changeset/base/273514 Log: Unconditionally enable the clocks for all imx6 devices that we have drivers for, or that are required to run the chip (such as busses). Turn off all the devices we don't yet have drivers for. Some day we will have a fully functional imx6 clock driver so that we can manage clocks based on fdt data. This will have to do until then. Modified: head/sys/arm/freescale/imx/imx6_ccm.c Modified: head/sys/arm/freescale/imx/imx6_ccm.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_ccm.c Thu Oct 23 02:53:57 2014 (r273513) +++ head/sys/arm/freescale/imx/imx6_ccm.c Thu Oct 23 03:13:14 2014 (r273514) @@ -76,6 +76,28 @@ WR4(struct ccm_softc *sc, bus_size_t off bus_write_4(sc->mem_res, off, val); } +/* + * Until we have a fully functional ccm driver which implements the fdt_clock + * interface, use the age-old workaround of unconditionally enabling the clocks + * for devices we might need to use. The SoC defaults to most clocks enabled, + * but the rom boot code and u-boot disable a few of them. We turn on only + * what's needed to run the chip plus devices we have drivers for, and turn off + * devices we don't yet have drivers for. (Note that USB is not turned on here + * because that is one we do when the driver asks for it.) + */ +static void +ccm_init_gates(struct ccm_softc *sc) +{ + /* Turns on... */ + WR4(sc, CCM_CCGR0, 0x0000003f); /* ahpbdma, aipstz 1 & 2 busses */ + WR4(sc, CCM_CCGR1, 0x00300c00); /* gpt, enet */ + WR4(sc, CCM_CCGR2, 0x0fffffc0); /* ipmux & ipsync (bridges), iomux, i2c */ + WR4(sc, CCM_CCGR3, 0x3ff00000); /* DDR memory controller */ + WR4(sc, CCM_CCGR4, 0x0000f300); /* pl301 bus crossbar */ + WR4(sc, CCM_CCGR5, 0x0f000000); /* uarts */ + WR4(sc, CCM_CCGR6, 0x000000cc); /* usdhc 1 & 3 */ +} + static int ccm_detach(device_t dev) { @@ -130,6 +152,8 @@ ccm_attach(device_t dev) reg = (reg & ~CCM_CLPCR_LPM_MASK) | CCM_CLPCR_LPM_RUN; WR4(sc, CCM_CLPCR, reg); + ccm_init_gates(sc); + err = 0; out: From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 04:47:34 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6804FF6D; Thu, 23 Oct 2014 04:47:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 520636C1; Thu, 23 Oct 2014 04:47:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N4lYcE092853; Thu, 23 Oct 2014 04:47:34 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N4lXih092846; Thu, 23 Oct 2014 04:47:33 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201410230447.s9N4lXih092846@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Thu, 23 Oct 2014 04:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273515 - in head: share/man/man4 sys/dev/virtio/console sys/modules/virtio sys/modules/virtio/console X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 04:47:34 -0000 Author: bryanv Date: Thu Oct 23 04:47:32 2014 New Revision: 273515 URL: https://svnweb.freebsd.org/changeset/base/273515 Log: Add VirtIO console driver Support for the multiport feature is mostly implemented, but currently disabled due to some potential races in the hot plug code paths. Requested by: marcel MFC after: 1 month Relnotes: yes Added: head/share/man/man4/virtio_console.4 (contents, props changed) head/sys/dev/virtio/console/ head/sys/dev/virtio/console/virtio_console.c (contents, props changed) head/sys/dev/virtio/console/virtio_console.h (contents, props changed) head/sys/modules/virtio/console/ head/sys/modules/virtio/console/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/share/man/man4/virtio.4 head/sys/modules/virtio/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Oct 23 03:13:14 2014 (r273514) +++ head/share/man/man4/Makefile Thu Oct 23 04:47:32 2014 (r273515) @@ -563,6 +563,7 @@ MAN= aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ @@ -814,6 +815,7 @@ _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_console.4=virtio_console.4 _virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 Modified: head/share/man/man4/virtio.4 ============================================================================== --- head/share/man/man4/virtio.4 Thu Oct 23 03:13:14 2014 (r273514) +++ head/share/man/man4/virtio.4 Thu Oct 23 04:47:32 2014 (r273515) @@ -85,6 +85,7 @@ device driver. .Sh SEE ALSO .Xr virtio_balloon 4 , .Xr virtio_blk 4 , +.Xr virtio_console 4 , .Xr virtio_scsi 4 , .Xr vtnet 4 .Sh HISTORY Added: head/share/man/man4/virtio_console.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/virtio_console.4 Thu Oct 23 04:47:32 2014 (r273515) @@ -0,0 +1,66 @@ +.\" Copyright (c) 2014 Bryan Venteicher +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 22, 2014 +.Dt VIRTIO_CONSOLE 4 +.Os +.Sh NAME +.Nm virtio_console +.Nd VirtIO Console driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device virtio_console" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +virtio_console_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +device driver provides support for VirtIO console devices. +.Pp +The console device may have one or more ports. +Each port is similar to a simple serial interface, and +each port is accessible through +.Xr tty 4 . +.Sh FILES +.Bl -tag -width ".Pa /dev/ttyV?.??" -compact +.It Pa /dev/ttyV?.?? +.Sh SEE ALSO +.Xr tty 4 +.Xr virtio 4 +.Sh HISTORY +The +.Nm +driver was written by +.An Bryan Venteicher Aq bryanv@FreeBSD.org . Added: head/sys/dev/virtio/console/virtio_console.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/virtio/console/virtio_console.c Thu Oct 23 04:47:32 2014 (r273515) @@ -0,0 +1,1238 @@ +/*- + * Copyright (c) 2014, Bryan Venteicher + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Driver for VirtIO console devices. */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include "virtio_if.h" + +#define VTCON_MAX_PORTS 1 +#define VTCON_TTY_PREFIX "V" +#define VTCON_BULK_BUFSZ 128 + +struct vtcon_softc; + +struct vtcon_port { + struct vtcon_softc *vtcport_sc; + TAILQ_ENTRY(vtcon_port) vtcport_next; + struct mtx vtcport_mtx; + int vtcport_id; + struct tty *vtcport_tty; + struct virtqueue *vtcport_invq; + struct virtqueue *vtcport_outvq; + char vtcport_name[16]; +}; + +#define VTCON_PORT_MTX(_port) &(_port)->vtcport_mtx +#define VTCON_PORT_LOCK_INIT(_port) \ + mtx_init(VTCON_PORT_MTX((_port)), (_port)->vtcport_name, NULL, MTX_DEF) +#define VTCON_PORT_LOCK(_port) mtx_lock(VTCON_PORT_MTX((_port))) +#define VTCON_PORT_UNLOCK(_port) mtx_unlock(VTCON_PORT_MTX((_port))) +#define VTCON_PORT_LOCK_DESTROY(_port) mtx_destroy(VTCON_PORT_MTX((_port))) +#define VTCON_PORT_LOCK_ASSERT(_port) \ + mtx_assert(VTCON_PORT_MTX((_port)), MA_OWNED) +#define VTCON_PORT_LOCK_ASSERT_NOTOWNED(_port) \ + mtx_assert(VTCON_PORT_MTX((_port)), MA_NOTOWNED) + +struct vtcon_softc { + device_t vtcon_dev; + struct mtx vtcon_mtx; + uint64_t vtcon_features; + uint32_t vtcon_flags; +#define VTCON_FLAG_DETACHED 0x0001 +#define VTCON_FLAG_SIZE 0x0010 +#define VTCON_FLAG_MULTIPORT 0x0020 + + struct task vtcon_ctrl_task; + struct virtqueue *vtcon_ctrl_rxvq; + struct virtqueue *vtcon_ctrl_txvq; + + uint32_t vtcon_max_ports; + TAILQ_HEAD(, vtcon_port) + vtcon_ports; + + /* + * Ports can be added and removed during runtime, but we have + * to allocate all the virtqueues during attach. This array is + * indexed by the port ID. + */ + struct vtcon_port_extra { + struct vtcon_port *port; + struct virtqueue *invq; + struct virtqueue *outvq; + } *vtcon_portsx; +}; + +#define VTCON_MTX(_sc) &(_sc)->vtcon_mtx +#define VTCON_LOCK_INIT(_sc, _name) \ + mtx_init(VTCON_MTX((_sc)), (_name), NULL, MTX_DEF) +#define VTCON_LOCK(_sc) mtx_lock(VTCON_MTX((_sc))) +#define VTCON_UNLOCK(_sc) mtx_unlock(VTCON_MTX((_sc))) +#define VTCON_LOCK_DESTROY(_sc) mtx_destroy(VTCON_MTX((_sc))) +#define VTCON_LOCK_ASSERT(_sc) mtx_assert(VTCON_MTX((_sc)), MA_OWNED) +#define VTCON_LOCK_ASSERT_NOTOWNED(_sc) \ + mtx_assert(VTCON_MTX((_sc)), MA_NOTOWNED) + +#define VTCON_ASSERT_VALID_PORTID(_sc, _id) \ + KASSERT((_id) >= 0 && (_id) < (_sc)->vtcon_max_ports, \ + ("%s: port ID %d out of range", __func__, _id)) + +#define VTCON_FEATURES 0 + +static struct virtio_feature_desc vtcon_feature_desc[] = { + { VIRTIO_CONSOLE_F_SIZE, "ConsoleSize" }, + { VIRTIO_CONSOLE_F_MULTIPORT, "MultiplePorts" }, + + { 0, NULL } +}; + +static int vtcon_modevent(module_t, int, void *); + +static int vtcon_probe(device_t); +static int vtcon_attach(device_t); +static int vtcon_detach(device_t); +static int vtcon_config_change(device_t); + +static void vtcon_negotiate_features(struct vtcon_softc *); +static int vtcon_alloc_virtqueues(struct vtcon_softc *); +static void vtcon_read_config(struct vtcon_softc *, + struct virtio_console_config *); + +static void vtcon_determine_max_ports(struct vtcon_softc *, + struct virtio_console_config *); +static void vtcon_deinit_ports(struct vtcon_softc *); +static void vtcon_stop(struct vtcon_softc *); + +static void vtcon_ctrl_rx_vq_intr(void *); +static int vtcon_ctrl_enqueue_msg(struct vtcon_softc *, + struct virtio_console_control *); +static int vtcon_ctrl_add_msg(struct vtcon_softc *); +static void vtcon_ctrl_readd_msg(struct vtcon_softc *, + struct virtio_console_control *); +static int vtcon_ctrl_populate(struct vtcon_softc *); +static void vtcon_ctrl_send_msg(struct vtcon_softc *, + struct virtio_console_control *control); +static void vtcon_ctrl_send_event(struct vtcon_softc *, uint32_t, + uint16_t, uint16_t); +static int vtcon_ctrl_init(struct vtcon_softc *); +static void vtcon_ctrl_drain(struct vtcon_softc *); +static void vtcon_ctrl_deinit(struct vtcon_softc *); +static void vtcon_ctrl_port_add_event(struct vtcon_softc *, int); +static void vtcon_ctrl_port_remove_event(struct vtcon_softc *, int); +static void vtcon_ctrl_port_console_event(struct vtcon_softc *, int); +static void vtcon_ctrl_port_open_event(struct vtcon_softc *, int); +static void vtcon_ctrl_process_msg(struct vtcon_softc *, + struct virtio_console_control *); +static void vtcon_ctrl_task_cb(void *, int); + +static int vtcon_port_add_inbuf(struct vtcon_port *); +static void vtcon_port_readd_inbuf(struct vtcon_port *, void *); +static int vtcon_port_populate(struct vtcon_port *); +static void vtcon_port_destroy(struct vtcon_port *); +static int vtcon_port_create(struct vtcon_softc *, int, + struct vtcon_port **); +static void vtcon_port_drain_inbufs(struct vtcon_port *); +static void vtcon_port_teardown(struct vtcon_port *, int); +static void vtcon_port_change_size(struct vtcon_port *, uint16_t, + uint16_t); +static void vtcon_port_enable_intr(struct vtcon_port *); +static void vtcon_port_disable_intr(struct vtcon_port *); +static void vtcon_port_intr(struct vtcon_port *); +static void vtcon_port_in_vq_intr(void *); +static void vtcon_port_put(struct vtcon_port *, void *, int); +static void vtcon_port_send_ctrl_msg(struct vtcon_port *, uint16_t, + uint16_t); +static struct vtcon_port *vtcon_port_lookup_by_id(struct vtcon_softc *, int); + +static int vtcon_tty_open(struct tty *); +static void vtcon_tty_close(struct tty *); +static void vtcon_tty_outwakeup(struct tty *); +static void vtcon_tty_free(void *); + +static void vtcon_get_console_size(struct vtcon_softc *, uint16_t *, + uint16_t *); + +static void vtcon_enable_interrupts(struct vtcon_softc *); +static void vtcon_disable_interrupts(struct vtcon_softc *); + +static int vtcon_pending_free; + +static struct ttydevsw vtcon_tty_class = { + .tsw_flags = 0, + .tsw_open = vtcon_tty_open, + .tsw_close = vtcon_tty_close, + .tsw_outwakeup = vtcon_tty_outwakeup, + .tsw_free = vtcon_tty_free, +}; + +static device_method_t vtcon_methods[] = { + /* Device methods. */ + DEVMETHOD(device_probe, vtcon_probe), + DEVMETHOD(device_attach, vtcon_attach), + DEVMETHOD(device_detach, vtcon_detach), + + /* VirtIO methods. */ + DEVMETHOD(virtio_config_change, vtcon_config_change), + + DEVMETHOD_END +}; + +static driver_t vtcon_driver = { + "vtcon", + vtcon_methods, + sizeof(struct vtcon_softc) +}; +static devclass_t vtcon_devclass; + +DRIVER_MODULE(virtio_console, virtio_pci, vtcon_driver, vtcon_devclass, + vtcon_modevent, 0); +MODULE_VERSION(virtio_console, 1); +MODULE_DEPEND(virtio_console, virtio, 1, 1, 1); + +static int +vtcon_modevent(module_t mod, int type, void *unused) +{ + int error; + + switch (type) { + case MOD_LOAD: + error = 0; + break; + case MOD_QUIESCE: + case MOD_UNLOAD: + error = vtcon_pending_free != 0 ? EBUSY : 0; + /* error = EOPNOTSUPP; */ + break; + case MOD_SHUTDOWN: + error = 0; + break; + default: + error = EOPNOTSUPP; + break; + } + + return (error); +} + +static int +vtcon_probe(device_t dev) +{ + + if (virtio_get_device_type(dev) != VIRTIO_ID_CONSOLE) + return (ENXIO); + + device_set_desc(dev, "VirtIO Console Adapter"); + + return (BUS_PROBE_DEFAULT); +} + +static int +vtcon_attach(device_t dev) +{ + struct vtcon_softc *sc; + struct virtio_console_config concfg; + int error; + + sc = device_get_softc(dev); + sc->vtcon_dev = dev; + + VTCON_LOCK_INIT(sc, device_get_nameunit(dev)); + TASK_INIT(&sc->vtcon_ctrl_task, 0, vtcon_ctrl_task_cb, sc); + TAILQ_INIT(&sc->vtcon_ports); + + virtio_set_feature_desc(dev, vtcon_feature_desc); + vtcon_negotiate_features(sc); + + if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_SIZE)) + sc->vtcon_flags |= VTCON_FLAG_SIZE; + if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_MULTIPORT)) + sc->vtcon_flags |= VTCON_FLAG_MULTIPORT; + + vtcon_read_config(sc, &concfg); + vtcon_determine_max_ports(sc, &concfg); + + error = vtcon_alloc_virtqueues(sc); + if (error) { + device_printf(dev, "cannot allocate virtqueues\n"); + goto fail; + } + + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) + error = vtcon_ctrl_init(sc); + else + error = vtcon_port_create(sc, 0, NULL); + if (error) + goto fail; + + error = virtio_setup_intr(dev, INTR_TYPE_TTY); + if (error) { + device_printf(dev, "cannot setup virtqueue interrupts\n"); + goto fail; + } + + vtcon_enable_interrupts(sc); + + vtcon_ctrl_send_event(sc, VIRTIO_CONSOLE_BAD_ID, + VIRTIO_CONSOLE_DEVICE_READY, 1); + +fail: + if (error) + vtcon_detach(dev); + + return (error); +} + +static int +vtcon_detach(device_t dev) +{ + struct vtcon_softc *sc; + + sc = device_get_softc(dev); + + VTCON_LOCK(sc); + sc->vtcon_flags |= VTCON_FLAG_DETACHED; + if (device_is_attached(dev)) + vtcon_stop(sc); + VTCON_UNLOCK(sc); + + taskqueue_drain(taskqueue_thread, &sc->vtcon_ctrl_task); + + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) + vtcon_ctrl_deinit(sc); + + vtcon_deinit_ports(sc); + + VTCON_LOCK_DESTROY(sc); + + return (0); +} + +static int +vtcon_config_change(device_t dev) +{ + struct vtcon_softc *sc; + struct vtcon_port *port; + uint16_t cols, rows; + + sc = device_get_softc(dev); + + /* + * With the multiport feature, all configuration changes are + * done through control virtqueue events. This is a spurious + * interrupt. + */ + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) + return (0); + + if (sc->vtcon_flags & VTCON_FLAG_SIZE) { + /* + * For now, assume the first (only) port is the 'console'. + * Note QEMU does not implement this feature yet. + */ + VTCON_LOCK(sc); + if ((port = vtcon_port_lookup_by_id(sc, 0)) != NULL) { + vtcon_get_console_size(sc, &cols, &rows); + vtcon_port_change_size(port, cols, rows); + } + VTCON_UNLOCK(sc); + } + + return (0); +} + +static void +vtcon_negotiate_features(struct vtcon_softc *sc) +{ + device_t dev; + uint64_t features; + + dev = sc->vtcon_dev; + features = VTCON_FEATURES; + + sc->vtcon_features = virtio_negotiate_features(dev, features); +} + +#define VTCON_GET_CONFIG(_dev, _feature, _field, _cfg) \ + if (virtio_with_feature(_dev, _feature)) { \ + virtio_read_device_config(_dev, \ + offsetof(struct virtio_console_config, _field), \ + &(_cfg)->_field, sizeof((_cfg)->_field)); \ + } + +static void +vtcon_read_config(struct vtcon_softc *sc, struct virtio_console_config *concfg) +{ + device_t dev; + + dev = sc->vtcon_dev; + + bzero(concfg, sizeof(struct virtio_console_config)); + + /* Read the configuration if the feature was negotiated. */ + VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, cols, concfg); + VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, rows, concfg); + VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_MULTIPORT, max_nr_ports, concfg); +} + +#undef VTCON_GET_CONFIG + +static int +vtcon_alloc_virtqueues(struct vtcon_softc *sc) +{ + device_t dev; + struct vq_alloc_info *info; + struct vtcon_port_extra *portx; + int i, idx, portidx, nvqs, error; + + dev = sc->vtcon_dev; + + sc->vtcon_portsx = malloc(sizeof(struct vtcon_port_extra) * + sc->vtcon_max_ports, M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc->vtcon_portsx == NULL) + return (ENOMEM); + + nvqs = sc->vtcon_max_ports * 2; + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) + nvqs += 2; + + info = malloc(sizeof(struct vq_alloc_info) * nvqs, M_TEMP, M_NOWAIT); + if (info == NULL) + return (ENOMEM); + + for (i = 0, idx = 0, portidx = 0; i < nvqs / 2; i++, idx+=2) { + + if (i == 1) { + /* The control virtqueues are after the first port. */ + VQ_ALLOC_INFO_INIT(&info[idx], 0, + vtcon_ctrl_rx_vq_intr, sc, &sc->vtcon_ctrl_rxvq, + "%s-control rx", device_get_nameunit(dev)); + VQ_ALLOC_INFO_INIT(&info[idx+1], 0, + NULL, sc, &sc->vtcon_ctrl_txvq, + "%s-control tx", device_get_nameunit(dev)); + continue; + } + + portx = &sc->vtcon_portsx[portidx]; + + VQ_ALLOC_INFO_INIT(&info[idx], 0, vtcon_port_in_vq_intr, + portx, &portx->invq, "%s-port%d in", + device_get_nameunit(dev), portidx); + VQ_ALLOC_INFO_INIT(&info[idx+1], 0, NULL, + NULL, &portx->outvq, "%s-port%d out", + device_get_nameunit(dev), portidx); + + portidx++; + } + + error = virtio_alloc_virtqueues(dev, 0, nvqs, info); + free(info, M_TEMP); + + return (error); +} + +static void +vtcon_determine_max_ports(struct vtcon_softc *sc, + struct virtio_console_config *concfg) +{ + + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) { + sc->vtcon_max_ports = + min(concfg->max_nr_ports, VTCON_MAX_PORTS); + if (sc->vtcon_max_ports == 0) + sc->vtcon_max_ports = 1; + } else + sc->vtcon_max_ports = 1; +} + +static void +vtcon_deinit_ports(struct vtcon_softc *sc) +{ + struct vtcon_port *port, *tmp; + + TAILQ_FOREACH_SAFE(port, &sc->vtcon_ports, vtcport_next, tmp) { + vtcon_port_teardown(port, 1); + } + + if (sc->vtcon_portsx != NULL) { + free(sc->vtcon_portsx, M_DEVBUF); + sc->vtcon_portsx = NULL; + } +} + +static void +vtcon_stop(struct vtcon_softc *sc) +{ + + vtcon_disable_interrupts(sc); + virtio_stop(sc->vtcon_dev); +} + +static void +vtcon_ctrl_rx_vq_intr(void *xsc) +{ + struct vtcon_softc *sc; + + sc = xsc; + + /* + * Some events require us to potentially block, but it easier + * to just defer all event handling to a seperate thread. + */ + taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task); +} + +static int +vtcon_ctrl_enqueue_msg(struct vtcon_softc *sc, + struct virtio_console_control *control) +{ + struct sglist_seg segs[1]; + struct sglist sg; + struct virtqueue *vq; + int error __unused; + + vq = sc->vtcon_ctrl_rxvq; + + sglist_init(&sg, 1, segs); + error = sglist_append(&sg, control, sizeof(*control)); + KASSERT(error == 0 && sg.sg_nseg == 1, + ("%s: error %d adding control msg to sglist", __func__, error)); + + return (virtqueue_enqueue(vq, control, &sg, 0, 1)); +} + +static int +vtcon_ctrl_add_msg(struct vtcon_softc *sc) +{ + struct virtio_console_control *control; + int error; + + control = malloc(sizeof(*control), M_DEVBUF, M_ZERO | M_NOWAIT); + if (control == NULL) + return (ENOMEM); + + error = vtcon_ctrl_enqueue_msg(sc, control); + if (error) + free(control, M_DEVBUF); + + return (error); +} + +static void +vtcon_ctrl_readd_msg(struct vtcon_softc *sc, + struct virtio_console_control *control) +{ + int error; + + bzero(control, sizeof(*control)); + + error = vtcon_ctrl_enqueue_msg(sc, control); + KASSERT(error == 0, + ("%s: cannot requeue control buffer %d", __func__, error)); +} + +static int +vtcon_ctrl_populate(struct vtcon_softc *sc) +{ + struct virtqueue *vq; + int nbufs, error; + + vq = sc->vtcon_ctrl_rxvq; + error = ENOSPC; + + for (nbufs = 0; !virtqueue_full(vq); nbufs++) { + error = vtcon_ctrl_add_msg(sc); + if (error) + break; + } + + if (nbufs > 0) { + virtqueue_notify(vq); + /* + * EMSGSIZE signifies the virtqueue did not have enough + * entries available to hold the last buf. This is not + * an error. + */ + if (error == EMSGSIZE) + error = 0; + } + + return (error); +} + +static void +vtcon_ctrl_send_msg(struct vtcon_softc *sc, + struct virtio_console_control *control) +{ + struct sglist_seg segs[1]; + struct sglist sg; + struct virtqueue *vq; + int error; + + vq = sc->vtcon_ctrl_txvq; + KASSERT(virtqueue_empty(vq), + ("%s: virtqueue is not emtpy", __func__)); + + sglist_init(&sg, 1, segs); + error = sglist_append(&sg, control, sizeof(*control)); + KASSERT(error == 0 && sg.sg_nseg == 1, + ("%s: error %d adding control msg to sglist", __func__, error)); + + error = virtqueue_enqueue(vq, control, &sg, 1, 0); + if (error == 0) { + virtqueue_notify(vq); + virtqueue_poll(vq, NULL); + } +} + +static void +vtcon_ctrl_send_event(struct vtcon_softc *sc, uint32_t portid, uint16_t event, + uint16_t value) +{ + struct virtio_console_control control; + + if ((sc->vtcon_flags & VTCON_FLAG_MULTIPORT) == 0) + return; + + control.id = portid; + control.event = event; + control.value = value; + + vtcon_ctrl_send_msg(sc, &control); +} + +static int +vtcon_ctrl_init(struct vtcon_softc *sc) +{ + int error; + + error = vtcon_ctrl_populate(sc); + + return (error); +} + +static void +vtcon_ctrl_drain(struct vtcon_softc *sc) +{ + struct virtio_console_control *control; + struct virtqueue *vq; + int last; + + vq = sc->vtcon_ctrl_rxvq; + last = 0; + + if (vq == NULL) + return; + + while ((control = virtqueue_drain(vq, &last)) != NULL) + free(control, M_DEVBUF); +} + +static void +vtcon_ctrl_deinit(struct vtcon_softc *sc) +{ + + vtcon_ctrl_drain(sc); +} + +static void +vtcon_ctrl_port_add_event(struct vtcon_softc *sc, int id) +{ + device_t dev; + struct vtcon_port *port; + int error; + + dev = sc->vtcon_dev; + + if (vtcon_port_lookup_by_id(sc, id) != NULL) { + device_printf(dev, "%s: adding port %d, but already exists\n", + __func__, id); + return; + } + + error = vtcon_port_create(sc, id, &port); + if (error) { + device_printf(dev, "%s: cannot create port %d: %d\n", + __func__, id, error); + return; + } + + vtcon_port_send_ctrl_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); +} + +static void +vtcon_ctrl_port_remove_event(struct vtcon_softc *sc, int id) +{ + device_t dev; + struct vtcon_port *port; + + dev = sc->vtcon_dev; + + port = vtcon_port_lookup_by_id(sc, id); + if (port == NULL) { + device_printf(dev, "%s: remove port %d, but does not exist\n", + __func__, id); + return; + } + + vtcon_port_teardown(port, 1); +} + +static void +vtcon_ctrl_port_console_event(struct vtcon_softc *sc, int id) +{ + device_t dev; + + dev = sc->vtcon_dev; + + /* + * BMV: I don't think we need to do anything. + */ + device_printf(dev, "%s: port %d console event\n", __func__, id); +} + +static void +vtcon_ctrl_port_open_event(struct vtcon_softc *sc, int id) +{ + device_t dev; + struct vtcon_port *port; + + dev = sc->vtcon_dev; + + port = vtcon_port_lookup_by_id(sc, id); + if (port == NULL) { + device_printf(dev, "%s: open port %d, but does not exist\n", + __func__, id); + return; + } + + vtcon_port_enable_intr(port); +} + +static void +vtcon_ctrl_process_msg(struct vtcon_softc *sc, + struct virtio_console_control *control) +{ + device_t dev; + int id; + + dev = sc->vtcon_dev; + id = control->id; + + if (id < 0 || id >= sc->vtcon_max_ports) { + device_printf(dev, "%s: invalid port ID %d\n", __func__, id); + return; + } + + switch (control->event) { + case VIRTIO_CONSOLE_PORT_ADD: + vtcon_ctrl_port_add_event(sc, id); + break; + + case VIRTIO_CONSOLE_PORT_REMOVE: + vtcon_ctrl_port_remove_event(sc, id); + break; + + case VIRTIO_CONSOLE_CONSOLE_PORT: + vtcon_ctrl_port_console_event(sc, id); + break; + + case VIRTIO_CONSOLE_RESIZE: + break; + + case VIRTIO_CONSOLE_PORT_OPEN: + vtcon_ctrl_port_open_event(sc, id); + break; + + case VIRTIO_CONSOLE_PORT_NAME: + break; + } +} + +static void +vtcon_ctrl_task_cb(void *xsc, int pending) +{ + struct vtcon_softc *sc; + struct virtqueue *vq; + struct virtio_console_control *control; + + sc = xsc; + vq = sc->vtcon_ctrl_rxvq; + + VTCON_LOCK(sc); + while ((sc->vtcon_flags & VTCON_FLAG_DETACHED) == 0) { + control = virtqueue_dequeue(vq, NULL); + if (control == NULL) + break; + + VTCON_UNLOCK(sc); + vtcon_ctrl_process_msg(sc, control); + VTCON_LOCK(sc); + vtcon_ctrl_readd_msg(sc, control); + } + VTCON_UNLOCK(sc); + + if (virtqueue_enable_intr(vq) != 0) + taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task); +} + +static int +vtcon_port_enqueue_inbuf(struct vtcon_port *port, void *buf, size_t len) +{ + struct sglist_seg segs[1]; + struct sglist sg; + struct virtqueue *vq; + int error; + + vq = port->vtcport_invq; + + sglist_init(&sg, 1, segs); + error = sglist_append(&sg, buf, len); + KASSERT(error == 0 && sg.sg_nseg == 1, + ("%s: error %d adding buffer to sglist", __func__, error)); + + return (virtqueue_enqueue(vq, buf, &sg, 0, 1)); +} + +static int +vtcon_port_add_inbuf(struct vtcon_port *port) +{ + void *buf; + int error; + + buf = malloc(VTCON_BULK_BUFSZ, M_DEVBUF, M_ZERO | M_NOWAIT); + if (buf == NULL) + return (ENOMEM); + + error = vtcon_port_enqueue_inbuf(port, buf, VTCON_BULK_BUFSZ); + if (error) + free(buf, M_DEVBUF); + + return (error); +} + +static void +vtcon_port_readd_inbuf(struct vtcon_port *port, void *buf) +{ + int error __unused; + + error = vtcon_port_enqueue_inbuf(port, buf, VTCON_BULK_BUFSZ); + KASSERT(error == 0, + ("%s: cannot requeue input buffer %d", __func__, error)); +} + +static int +vtcon_port_populate(struct vtcon_port *port) +{ + struct virtqueue *vq; + int nbufs, error; + + vq = port->vtcport_invq; + error = ENOSPC; + + for (nbufs = 0; !virtqueue_full(vq); nbufs++) { + error = vtcon_port_add_inbuf(port); + if (error) + break; + } + + if (nbufs > 0) { + virtqueue_notify(vq); + /* + * EMSGSIZE signifies the virtqueue did not have enough + * entries available to hold the last buf. This is not + * an error. + */ + if (error == EMSGSIZE) + error = 0; + } + + return (error); +} + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 05:46:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B83DADAA; Thu, 23 Oct 2014 05:46:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4B32C04; Thu, 23 Oct 2014 05:46:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N5kBJK020244; Thu, 23 Oct 2014 05:46:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N5kBDB020243; Thu, 23 Oct 2014 05:46:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230546.s9N5kBDB020243@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 05:46:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273516 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 05:46:11 -0000 Author: ngie Date: Thu Oct 23 05:46:10 2014 New Revision: 273516 URL: https://svnweb.freebsd.org/changeset/base/273516 Log: Add netinet/in.h for struct sockaddr_in Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_stat.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_stat.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_stat.c Thu Oct 23 04:47:32 2014 (r273515) +++ head/contrib/netbsd-tests/lib/libc/sys/t_stat.c Thu Oct 23 05:46:10 2014 (r273516) @@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_stat.c,v 1.4 2012/03 #include +#if defined(__FreeBSD__) +#include +#endif + static const char *path = "stat"; ATF_TC_WITH_CLEANUP(stat_chflags); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 05:58:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D02CEA; Thu, 23 Oct 2014 05:58:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 19E95CC9; Thu, 23 Oct 2014 05:58:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N5w2gt025123; Thu, 23 Oct 2014 05:58:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N5w2Ts025122; Thu, 23 Oct 2014 05:58:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230558.s9N5w2Ts025122@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 05:58:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273517 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 05:58:03 -0000 Author: ngie Date: Thu Oct 23 05:58:02 2014 New Revision: 273517 URL: https://svnweb.freebsd.org/changeset/base/273517 Log: Expect getgroups_err to fail on FreeBSD PR: 189941 Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c Thu Oct 23 05:46:10 2014 (r273516) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getgroups.c Thu Oct 23 05:58:02 2014 (r273517) @@ -57,6 +57,9 @@ ATF_TC_BODY(getgroups_err, tc) errno = 0; +#if defined(__FreeBSD__) + atf_tc_expect_fail("Reported as kern/189941"); +#endif ATF_REQUIRE(getgroups(-1, gidset) == -1); ATF_REQUIRE(errno == EINVAL); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 06:18:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 15E90987; Thu, 23 Oct 2014 06:18:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBAC9ED8; Thu, 23 Oct 2014 06:18:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6ISV6035129; Thu, 23 Oct 2014 06:18:28 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6ISU6035128; Thu, 23 Oct 2014 06:18:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230618.s9N6ISU6035128@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 06:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273520 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 06:18:29 -0000 Author: ngie Date: Thu Oct 23 06:18:28 2014 New Revision: 273520 URL: https://svnweb.freebsd.org/changeset/base/273520 Log: Port t_pipe2.c to FreeBSD - Omit the pipe2_nosigpipe testcase on FreeBSD (FreeBSD doesn't have O_NOSIGPIPE). - Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)". - Save and restore the resource limit on the number of files (RLIMIT_NOFILE). In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c Thu Oct 23 06:13:42 2014 (r273519) +++ head/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c Thu Oct 23 06:18:28 2014 (r273520) @@ -53,7 +53,11 @@ run(int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); +#if defined(__FreeBSD__) + closefrom(3); +#else ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1); +#endif ATF_REQUIRE(pipe2(fd, flags) == 0); @@ -76,6 +80,7 @@ run(int flags) ATF_REQUIRE((fcntl(fd[1], F_GETFL) & O_NONBLOCK) == 0); } +#if !defined(__FreeBSD__) if (flags & O_NOSIGPIPE) { ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) != 0); ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) != 0); @@ -83,6 +88,7 @@ run(int flags) ATF_REQUIRE(fcntl(fd[0], F_GETNOSIGPIPE) == 0); ATF_REQUIRE(fcntl(fd[1], F_GETNOSIGPIPE) == 0); } +#endif ATF_REQUIRE(close(fd[0]) != -1); ATF_REQUIRE(close(fd[1]) != -1); @@ -110,9 +116,14 @@ ATF_TC_BODY(pipe2_consume, tc) { struct rlimit rl; int err, filedes[2]; +#if defined(__FreeBSD__) + int old; + closefrom(4); +#else err = fcntl(4, F_CLOSEM); ATF_REQUIRE(err == 0); +#endif err = getrlimit(RLIMIT_NOFILE, &rl); ATF_REQUIRE(err == 0); @@ -121,12 +132,19 @@ ATF_TC_BODY(pipe2_consume, tc) * file descriptor limit in the middle of a pipe2() call - i.e. * before the call only a single descriptor may be openend. */ +#if defined(__FreeBSD__) + old = rl.rlim_cur; +#endif rl.rlim_cur = 4; err = setrlimit(RLIMIT_NOFILE, &rl); ATF_REQUIRE(err == 0); err = pipe2(filedes, O_CLOEXEC); ATF_REQUIRE(err == -1); +#if defined(__FreeBSD__) + rl.rlim_cur = old; + err = setrlimit(RLIMIT_NOFILE, &rl); +#endif } ATF_TC(pipe2_nonblock); @@ -151,6 +169,7 @@ ATF_TC_BODY(pipe2_cloexec, tc) run(O_CLOEXEC); } +#if defined(__NetBSD__) ATF_TC(pipe2_nosigpipe); ATF_TC_HEAD(pipe2_nosigpipe, tc) { @@ -161,6 +180,7 @@ ATF_TC_BODY(pipe2_nosigpipe, tc) { run(O_NOSIGPIPE); } +#endif ATF_TC(pipe2_einval); ATF_TC_HEAD(pipe2_einval, tc) @@ -181,7 +201,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, pipe2_consume); ATF_TP_ADD_TC(tp, pipe2_nonblock); ATF_TP_ADD_TC(tp, pipe2_cloexec); +#if defined(__NetBSD__) ATF_TP_ADD_TC(tp, pipe2_nosigpipe); +#endif ATF_TP_ADD_TC(tp, pipe2_einval); return atf_no_error(); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 06:21:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 82D55B14; Thu, 23 Oct 2014 06:21:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F2D1F80; Thu, 23 Oct 2014 06:21:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6LBuo038918; Thu, 23 Oct 2014 06:21:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6LBcn038913; Thu, 23 Oct 2014 06:21:11 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230621.s9N6LBcn038913@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 06:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273521 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 06:21:11 -0000 Author: ngie Date: Thu Oct 23 06:21:10 2014 New Revision: 273521 URL: https://svnweb.freebsd.org/changeset/base/273521 Log: Convert "fcntl(n, F_CLOSEM)" to "closefrom(n)" Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c Thu Oct 23 06:18:28 2014 (r273520) +++ head/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c Thu Oct 23 06:21:10 2014 (r273521) @@ -63,7 +63,11 @@ run(int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); +#ifdef __FreeBSD__ + closefrom(3); +#else ATF_REQUIRE(fcntl(3, F_CLOSEM) != -1); +#endif ATF_REQUIRE(socketpair(AF_UNIX, SOCK_DGRAM | flags, 0, fd) == 0); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 06:24:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 49D36DF9; Thu, 23 Oct 2014 06:24:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 363AAFB5; Thu, 23 Oct 2014 06:24:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6Obc3039506; Thu, 23 Oct 2014 06:24:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6Obiq039505; Thu, 23 Oct 2014 06:24:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230624.s9N6Obiq039505@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 06:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273522 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 06:24:37 -0000 Author: ngie Date: Thu Oct 23 06:24:36 2014 New Revision: 273522 URL: https://svnweb.freebsd.org/changeset/base/273522 Log: - Mark unused parameters __unused in handler - Call sigqueue with getpid() instead of 0 -- the latter idiom appears to only be valid on NetBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c Thu Oct 23 06:21:10 2014 (r273521) +++ head/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c Thu Oct 23 06:24:36 2014 (r273522) @@ -46,7 +46,11 @@ static void handler(int, siginfo_t *, vo static int value; static void +#if defined(__FreeBSD__) +handler(int signo __unused, siginfo_t *info __unused, void *data __unused) +#else handler(int signo, siginfo_t *info, void *data) +#endif { value = info->si_value.sival_int; kill(0, SIGINFO); @@ -72,7 +76,15 @@ ATF_TC_BODY(sigqueue_basic, tc) sv.sival_int = VALUE; +#if defined(__FreeBSD__) + /* + * From kern_sig.c: + * Specification says sigqueue can only send signal to single process. + */ + if (sigqueue(getpid(), SIGUSR1, sv) != 0) +#else if (sigqueue(0, SIGUSR1, sv) != 0) +#endif atf_tc_fail("sigqueue failed"); sched_yield(); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 06:25:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E323EF43; Thu, 23 Oct 2014 06:25:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CFC89FBF; Thu, 23 Oct 2014 06:25:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6PqcJ039728; Thu, 23 Oct 2014 06:25:52 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6PqK2039727; Thu, 23 Oct 2014 06:25:52 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230625.s9N6PqK2039727@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 06:25:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273523 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 06:25:53 -0000 Author: ngie Date: Thu Oct 23 06:25:52 2014 New Revision: 273523 URL: https://svnweb.freebsd.org/changeset/base/273523 Log: Add limits.h #include for LINE_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_link.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_link.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_link.c Thu Oct 23 06:24:36 2014 (r273522) +++ head/contrib/netbsd-tests/lib/libc/sys/t_link.c Thu Oct 23 06:25:52 2014 (r273523) @@ -41,6 +41,10 @@ __RCSID("$NetBSD: t_link.c,v 1.2 2014/04 #include #include +#ifdef __FreeBSD__ +#include +#endif + static const char *getpath(void); static char path[] = "link"; static const char *pathl; From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 06:35:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A744257; Thu, 23 Oct 2014 06:35:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07154128; Thu, 23 Oct 2014 06:35:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6ZJKH044428; Thu, 23 Oct 2014 06:35:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6ZJq5044427; Thu, 23 Oct 2014 06:35:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230635.s9N6ZJq5044427@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 06:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273524 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 06:35:20 -0000 Author: ngie Date: Thu Oct 23 06:35:19 2014 New Revision: 273524 URL: https://svnweb.freebsd.org/changeset/base/273524 Log: Add sys/socket.h #include for struct sockaddr_in Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_listen.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_listen.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_listen.c Thu Oct 23 06:25:52 2014 (r273523) +++ head/contrib/netbsd-tests/lib/libc/sys/t_listen.c Thu Oct 23 06:35:19 2014 (r273524) @@ -36,6 +36,10 @@ #include #include +#if defined(__FreeBSD__) +#include +#endif + static const char *path = "listen"; ATF_TC_WITH_CLEANUP(listen_err); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 06:42:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E95E950F; Thu, 23 Oct 2014 06:42:54 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC32D207; Thu, 23 Oct 2014 06:42:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N6gseY048918; Thu, 23 Oct 2014 06:42:54 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N6gsN6048917; Thu, 23 Oct 2014 06:42:54 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230642.s9N6gsN6048917@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 06:42:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273525 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 06:42:55 -0000 Author: ngie Date: Thu Oct 23 06:42:53 2014 New Revision: 273525 URL: https://svnweb.freebsd.org/changeset/base/273525 Log: Port t_mmap.c to FreeBSD - Add needed headers for the testcases - Omit mmap_block on non-NetBSD OSes - Use "security.bsd.map_at_zero" instead of "vm.user_va0_disable" Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Thu Oct 23 06:35:19 2014 (r273524) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mmap.c Thu Oct 23 06:42:53 2014 (r273525) @@ -72,7 +72,15 @@ __RCSID("$NetBSD: t_mmap.c,v 1.7 2012/06 #include #include #include +#ifdef __NetBSD__ #include +#endif + +#ifdef __FreeBSD__ +#include +#include +#include +#endif static long page = 0; static char path[] = "mmap"; @@ -155,6 +163,7 @@ map_sighandler(int signo) _exit(signo); } +#ifdef __NetBSD__ ATF_TC(mmap_block); ATF_TC_HEAD(mmap_block, tc) { @@ -199,6 +208,7 @@ ATF_TC_BODY(mmap_block, tc) ATF_REQUIRE(munmap(map, 4096) == 0); } +#endif ATF_TC(mmap_err); ATF_TC_HEAD(mmap_err, tc) @@ -468,8 +478,15 @@ ATF_TC_BODY(mmap_va0, tc) * Make an anonymous fixed mapping at zero address. If the address * is restricted as noted in security(7), the syscall should fail. */ +#ifdef __FreeBSD__ + if (sysctlbyname("security.bsd.map_at_zero", &val, &len, NULL, 0) != 0) + atf_tc_fail("failed to read security.bsd.map_at_zero"); + val = !val; /* 1 == enable map at zero */ +#endif +#ifdef __NetBSD__ if (sysctlbyname("vm.user_va0_disable", &val, &len, NULL, 0) != 0) atf_tc_fail("failed to read vm.user_va0_disable"); +#endif map = mmap(NULL, page, PROT_EXEC, flags, -1, 0); map_check(map, val); @@ -492,7 +509,9 @@ ATF_TP_ADD_TCS(tp) page = sysconf(_SC_PAGESIZE); ATF_REQUIRE(page >= 0); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, mmap_block); +#endif ATF_TP_ADD_TC(tp, mmap_err); ATF_TP_ADD_TC(tp, mmap_loan); ATF_TP_ADD_TC(tp, mmap_prot_1); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 07:05:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0B29575C; Thu, 23 Oct 2014 07:05:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EBD093E3; Thu, 23 Oct 2014 07:05:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N75ES0058529; Thu, 23 Oct 2014 07:05:14 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N75E6U058528; Thu, 23 Oct 2014 07:05:14 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230705.s9N75E6U058528@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 07:05:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273526 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 07:05:15 -0000 Author: ngie Date: Thu Oct 23 07:05:14 2014 New Revision: 273526 URL: https://svnweb.freebsd.org/changeset/base/273526 Log: Omit the pollts testcases on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_poll.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_poll.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_poll.c Thu Oct 23 06:42:53 2014 (r273525) +++ head/contrib/netbsd-tests/lib/libc/sys/t_poll.c Thu Oct 23 07:05:14 2014 (r273526) @@ -233,6 +233,7 @@ ATF_TC_BODY(poll_err, tc) ATF_REQUIRE_ERRNO(EINVAL, poll(&pfd, 1, -2) == -1); } +#if !defined(__FreeBSD__) ATF_TC(pollts_basic); ATF_TC_HEAD(pollts_basic, tc) { @@ -377,6 +378,7 @@ ATF_TC_BODY(pollts_sigmask, tc) ATF_REQUIRE_EQ(close(fd), 0); } +#endif ATF_TP_ADD_TCS(tp) { @@ -384,9 +386,11 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, poll_3way); ATF_TP_ADD_TC(tp, poll_basic); ATF_TP_ADD_TC(tp, poll_err); +#if !defined(__FreeBSD__) ATF_TP_ADD_TC(tp, pollts_basic); ATF_TP_ADD_TC(tp, pollts_err); ATF_TP_ADD_TC(tp, pollts_sigmask); +#endif return atf_no_error(); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 07:07:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 154DB8E1; Thu, 23 Oct 2014 07:07:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 01AD23FE; Thu, 23 Oct 2014 07:07:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N77ZTs058842; Thu, 23 Oct 2014 07:07:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N77ZXL058841; Thu, 23 Oct 2014 07:07:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230707.s9N77ZXL058841@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 07:07:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273527 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 07:07:36 -0000 Author: ngie Date: Thu Oct 23 07:07:35 2014 New Revision: 273527 URL: https://svnweb.freebsd.org/changeset/base/273527 Log: Omit all of the testcases as revoke(2) is only implemented on devfs(5) Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Thu Oct 23 07:05:14 2014 (r273526) +++ head/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Thu Oct 23 07:07:35 2014 (r273527) @@ -58,6 +58,9 @@ ATF_TC_BODY(revoke_basic, tc) size_t i, n; int *buf; +#if defined(__FreeBSD__) + atf_tc_skip("revoke(2) is only implemented for devfs(5)."); +#endif (void)memset(&res, 0, sizeof(struct rlimit)); (void)getrlimit(RLIMIT_NOFILE, &res); @@ -113,6 +116,9 @@ ATF_TC_BODY(revoke_err, tc) errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, revoke(buf) == -1); +#if defined(__FreeBSD__) + atf_tc_skip("revoke(2) is only implemented for devfs(5)."); +#endif errno = 0; ATF_REQUIRE_ERRNO(EPERM, revoke("/etc/passwd") == -1); @@ -133,6 +139,9 @@ ATF_TC_BODY(revoke_perm, tc) int fd, sta; pid_t pid; +#if defined(__FreeBSD__) + atf_tc_skip("revoke(2) is only implemented for devfs(5)."); +#endif pw = getpwnam("nobody"); fd = open(path, O_RDWR | O_CREAT, 0600); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 07:11:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CA740A60; Thu, 23 Oct 2014 07:11:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6D2F68B; Thu, 23 Oct 2014 07:11:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7BxfS062866; Thu, 23 Oct 2014 07:11:59 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7Bx1r062865; Thu, 23 Oct 2014 07:11:59 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230711.s9N7Bx1r062865@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 07:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273528 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 07:11:59 -0000 Author: ngie Date: Thu Oct 23 07:11:58 2014 New Revision: 273528 URL: https://svnweb.freebsd.org/changeset/base/273528 Log: Mark signo __unused in handler(..) Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c Thu Oct 23 07:07:35 2014 (r273527) +++ head/contrib/netbsd-tests/lib/libc/sys/t_nanosleep.c Thu Oct 23 07:11:58 2014 (r273528) @@ -45,7 +45,11 @@ __RCSID("$NetBSD: t_nanosleep.c,v 1.3 20 #include static void +#if defined(__FreeBSD__) +handler(int signo __unused) +#else handler(int signo) +#endif { /* Nothing. */ } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 07:20:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9C28FC81; Thu, 23 Oct 2014 07:20:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EE677A4; Thu, 23 Oct 2014 07:20:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7KaTg064606; Thu, 23 Oct 2014 07:20:36 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7KadE064605; Thu, 23 Oct 2014 07:20:36 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230720.s9N7KadE064605@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 07:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273529 - head/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 07:20:36 -0000 Author: ngie Date: Thu Oct 23 07:20:35 2014 New Revision: 273529 URL: https://svnweb.freebsd.org/changeset/base/273529 Log: - Omit the poll testcases on FreeBSD (they require pollts) - Add necessary headers for the testcases Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c Modified: head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c Thu Oct 23 07:11:58 2014 (r273528) +++ head/contrib/netbsd-tests/lib/libc/gen/t_sleep.c Thu Oct 23 07:20:35 2014 (r273529) @@ -49,6 +49,11 @@ #define KEVNT_TIMEOUT 10300 /* measured in milli-seconds */ #define FUZZ (40 * MILLION) /* scheduling fuzz accepted - 40 ms */ +#ifdef __FreeBSD__ +#include +#include +#endif + /* * Timer notes * @@ -78,7 +83,9 @@ static volatile int sig; int sleeptest(int (*)(struct timespec *, struct timespec *), bool, bool); int do_nanosleep(struct timespec *, struct timespec *); int do_select(struct timespec *, struct timespec *); +#ifdef __NetBSD__ int do_poll(struct timespec *, struct timespec *); +#endif int do_sleep(struct timespec *, struct timespec *); int do_kevent(struct timespec *, struct timespec *); void sigalrm(int); @@ -116,6 +123,7 @@ do_select(struct timespec *delay, struct return ret; } +#ifdef __NetBSD__ int do_poll(struct timespec *delay, struct timespec *remain) { @@ -129,6 +137,7 @@ do_poll(struct timespec *delay, struct t ret = 0; return ret; } +#endif int do_sleep(struct timespec *delay, struct timespec *remain) @@ -210,6 +219,7 @@ ATF_TC_BODY(select, tc) sleeptest(do_select, true, true); } +#ifdef __NetBSD__ ATF_TC(poll); ATF_TC_HEAD(poll, tc) { @@ -223,6 +233,7 @@ ATF_TC_BODY(poll, tc) sleeptest(do_poll, true, true); } +#endif ATF_TC(sleep); ATF_TC_HEAD(sleep, tc) @@ -329,7 +340,9 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, nanosleep); ATF_TP_ADD_TC(tp, select); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, poll); +#endif ATF_TP_ADD_TC(tp, sleep); ATF_TP_ADD_TC(tp, kevent); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 07:22:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34593DDC; Thu, 23 Oct 2014 07:22:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 210917BB; Thu, 23 Oct 2014 07:22:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7MIrs067801; Thu, 23 Oct 2014 07:22:18 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7MIqL067800; Thu, 23 Oct 2014 07:22:18 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230722.s9N7MIqL067800@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 07:22:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273530 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 07:22:19 -0000 Author: ngie Date: Thu Oct 23 07:22:18 2014 New Revision: 273530 URL: https://svnweb.freebsd.org/changeset/base/273530 Log: Add limits.h #include for INT_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c Thu Oct 23 07:20:35 2014 (r273529) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msgctl.c Thu Oct 23 07:22:18 2014 (r273530) @@ -46,6 +46,10 @@ __RCSID("$NetBSD: t_msgctl.c,v 1.4 2014/ #include #include +#ifdef __FreeBSD__ +#include +#endif + #define MSG_KEY 12345689 #define MSG_MTYPE_1 0x41 From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 07:54:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BD118D9; Thu, 23 Oct 2014 07:54:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6803BAC2; Thu, 23 Oct 2014 07:54:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N7slQd082118; Thu, 23 Oct 2014 07:54:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N7slW1082117; Thu, 23 Oct 2014 07:54:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230754.s9N7slW1082117@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 07:54:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273533 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 07:54:47 -0000 Author: ngie Date: Thu Oct 23 07:54:46 2014 New Revision: 273533 URL: https://svnweb.freebsd.org/changeset/base/273533 Log: Use /truncate_test.root_owned instead of /usr/bin/fpr as fpr does not exist on FreeBSD truncate_test.root_owned will be generated at build time and owned by root In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c Thu Oct 23 07:37:48 2014 (r273532) +++ head/contrib/netbsd-tests/lib/libc/sys/t_truncate.c Thu Oct 23 07:54:46 2014 (r273533) @@ -40,6 +40,10 @@ __RCSID("$NetBSD: t_truncate.c,v 1.2 201 #include #include +#ifdef __FreeBSD__ +#include +#endif + static const char path[] = "truncate"; static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 }; @@ -149,6 +153,9 @@ ATF_TC_HEAD(truncate_err, tc) ATF_TC_BODY(truncate_err, tc) { +#ifndef __NetBSD__ + char buf[PATH_MAX]; +#endif errno = 0; ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1); @@ -160,7 +167,13 @@ ATF_TC_BODY(truncate_err, tc) ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1); errno = 0; +#ifdef __NetBSD__ ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1); +#else + snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned", + atf_tc_get_config_var(tc, "srcdir")); + ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1); +#endif } ATF_TP_ADD_TCS(tp) From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:00:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94293A8A; Thu, 23 Oct 2014 08:00:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80AECAFF; Thu, 23 Oct 2014 08:00:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N80073082881; Thu, 23 Oct 2014 08:00:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8006Q082880; Thu, 23 Oct 2014 08:00:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230800.s9N8006Q082880@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273534 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:00:00 -0000 Author: ngie Date: Thu Oct 23 07:59:59 2014 New Revision: 273534 URL: https://svnweb.freebsd.org/changeset/base/273534 Log: - Mark sig/signo __unused - Do not provide a relative path via #include "h_macros.h" Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c Thu Oct 23 07:54:46 2014 (r273533) +++ head/contrib/netbsd-tests/lib/libc/sys/t_sigaction.c Thu Oct 23 07:59:59 2014 (r273534) @@ -42,12 +42,20 @@ __RCSID("$NetBSD: t_sigaction.c,v 1.2 20 #include #include +#ifdef __NetBSD__ #include "../../../h_macros.h" +#else +#include "h_macros.h" +#endif static bool handler_called = false; static void +#ifdef __FreeBSD__ +handler(int signo __unused) +#else handler(int signo) +#endif { handler_called = true; } @@ -80,7 +88,11 @@ wait_and_check_child(const pid_t pid, co } static void +#ifdef __FreeBSD__ +catch(int sig __unused) +#else catch(int sig) +#endif { return; } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:05:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C5C5EC5B; Thu, 23 Oct 2014 08:05:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9891EBD5; Thu, 23 Oct 2014 08:05:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N854Rn087006; Thu, 23 Oct 2014 08:05:04 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N854dD087005; Thu, 23 Oct 2014 08:05:04 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230805.s9N854dD087005@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:05:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273535 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:05:04 -0000 Author: ngie Date: Thu Oct 23 08:05:03 2014 New Revision: 273535 URL: https://svnweb.freebsd.org/changeset/base/273535 Log: - Omit setrlimit_nthr testcase on FreeBSD (requires lwp.h, et al) - Expect overflow with rlim_max at INT64_MAX, not UINT64_MAX (rlim_t is int64_t on FreeBSD) In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Thu Oct 23 07:59:59 2014 (r273534) +++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Thu Oct 23 08:05:03 2014 (r273535) @@ -39,7 +39,9 @@ __RCSID("$NetBSD: t_setrlimit.c,v 1.4 20 #include #include #include +#ifdef __NetBSD__ #include +#endif #include #include #include @@ -438,6 +440,7 @@ ATF_TC_BODY(setrlimit_nproc, tc) atf_tc_fail("RLIMIT_NPROC not enforced"); } +#ifdef __NetBSD__ ATF_TC(setrlimit_nthr); ATF_TC_HEAD(setrlimit_nthr, tc) { @@ -474,6 +477,7 @@ ATF_TC_BODY(setrlimit_nthr, tc) makecontext(&c, func, 1, &lwpid); ATF_CHECK_ERRNO(EAGAIN, _lwp_create(&c, 0, &lwpid) == -1); } +#endif ATF_TC(setrlimit_perm); ATF_TC_HEAD(setrlimit_perm, tc) @@ -494,7 +498,11 @@ ATF_TC_BODY(setrlimit_perm, tc) ATF_REQUIRE(getrlimit(rlimit[i], &res) == 0); +#ifdef __FreeBSD__ + if (res.rlim_max == INT64_MAX) /* Overflow. */ +#else if (res.rlim_max == UINT64_MAX) /* Overflow. */ +#endif continue; errno = 0; @@ -516,7 +524,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, setrlimit_nofile_2); ATF_TP_ADD_TC(tp, setrlimit_nproc); ATF_TP_ADD_TC(tp, setrlimit_perm); +#ifdef __FreeBSD__ ATF_TP_ADD_TC(tp, setrlimit_nthr); +#endif return atf_no_error(); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:05:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 41F18D9E; Thu, 23 Oct 2014 08:05:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E77EBDD; Thu, 23 Oct 2014 08:05:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N85mma087128; Thu, 23 Oct 2014 08:05:48 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N85mTr087127; Thu, 23 Oct 2014 08:05:48 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230805.s9N85mTr087127@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:05:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273536 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:05:48 -0000 Author: ngie Date: Thu Oct 23 08:05:47 2014 New Revision: 273536 URL: https://svnweb.freebsd.org/changeset/base/273536 Log: Add limits.h #include for SSIZE_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c Thu Oct 23 08:05:03 2014 (r273535) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msgsnd.c Thu Oct 23 08:05:47 2014 (r273536) @@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/ #include #include +#if defined(__FreeBSD__) +#include +#endif + #define MSG_KEY 1234 #define MSG_MTYPE_1 0x41 #define MSG_MTYPE_2 0x42 From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:06:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1A96CEEE; Thu, 23 Oct 2014 08:06:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 071A5BED; Thu, 23 Oct 2014 08:06:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N86Yrk087285; Thu, 23 Oct 2014 08:06:34 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N86Y06087284; Thu, 23 Oct 2014 08:06:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230806.s9N86Y06087284@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:06:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273537 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:06:35 -0000 Author: ngie Date: Thu Oct 23 08:06:34 2014 New Revision: 273537 URL: https://svnweb.freebsd.org/changeset/base/273537 Log: Add limits.h #include for SSIZE_MAX Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c Thu Oct 23 08:05:47 2014 (r273536) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msgrcv.c Thu Oct 23 08:06:34 2014 (r273537) @@ -47,6 +47,10 @@ __RCSID("$NetBSD: t_msgrcv.c,v 1.3 2013/ #include #include +#if defined(__FreeBSD__) +#include +#endif + #define MSG_KEY 1234 #define MSG_MTYPE_1 0x41 #define MSG_MTYPE_2 0x42 From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:12:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7BE8115D; Thu, 23 Oct 2014 08:12:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 684FCCBF; Thu, 23 Oct 2014 08:12:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N8CW2D091594; Thu, 23 Oct 2014 08:12:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8CW1n091593; Thu, 23 Oct 2014 08:12:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230812.s9N8CW1n091593@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273538 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:12:32 -0000 Author: ngie Date: Thu Oct 23 08:12:31 2014 New Revision: 273538 URL: https://svnweb.freebsd.org/changeset/base/273538 Log: Fix a typo (__FreeBSD__ -> __NetBSD__ when omitting setrlimit_nthr) Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Thu Oct 23 08:06:34 2014 (r273537) +++ head/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Thu Oct 23 08:12:31 2014 (r273538) @@ -524,7 +524,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, setrlimit_nofile_2); ATF_TP_ADD_TC(tp, setrlimit_nproc); ATF_TP_ADD_TC(tp, setrlimit_perm); -#ifdef __FreeBSD__ +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, setrlimit_nthr); #endif From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:13:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1975C2A6; Thu, 23 Oct 2014 08:13:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 05A81CCA; Thu, 23 Oct 2014 08:13:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N8D7Qp091714; Thu, 23 Oct 2014 08:13:07 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8D7RV091713; Thu, 23 Oct 2014 08:13:07 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230813.s9N8D7RV091713@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273539 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:13:08 -0000 Author: ngie Date: Thu Oct 23 08:13:07 2014 New Revision: 273539 URL: https://svnweb.freebsd.org/changeset/base/273539 Log: Mark signum __unused Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_select.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_select.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_select.c Thu Oct 23 08:12:31 2014 (r273538) +++ head/contrib/netbsd-tests/lib/libc/sys/t_select.c Thu Oct 23 08:13:07 2014 (r273539) @@ -47,13 +47,21 @@ static sig_atomic_t keep_going = 1; static void +#ifdef __FreeBSD__ +sig_handler(int signum __unused) +#else sig_handler(int signum) +#endif { keep_going = 0; } static void +#ifdef __FreeBSD__ +sigchld(int signum __unused) +#else sigchld(int signum) +#endif { } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 08:29:10 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B15BD651; Thu, 23 Oct 2014 08:29:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DADBDF2; Thu, 23 Oct 2014 08:29:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9N8TAww097071; Thu, 23 Oct 2014 08:29:10 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9N8TABZ097070; Thu, 23 Oct 2014 08:29:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410230829.s9N8TABZ097070@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Thu, 23 Oct 2014 08:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273540 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 08:29:10 -0000 Author: ngie Date: Thu Oct 23 08:29:09 2014 New Revision: 273540 URL: https://svnweb.freebsd.org/changeset/base/273540 Log: Omit the mprotect_exec testcase on FreeBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c Thu Oct 23 08:13:07 2014 (r273539) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c Thu Oct 23 08:29:09 2014 (r273540) @@ -44,7 +44,9 @@ __RCSID("$NetBSD: t_mprotect.c,v 1.3 201 #include +#ifdef __NetBSD__ #include "../common/exec_prot.h" +#endif static long page = 0; static int pax_global = -1; @@ -160,6 +162,7 @@ ATF_TC_BODY(mprotect_err, tc) ATF_REQUIRE(errno == EINVAL); } +#ifdef __NetBSD__ ATF_TC(mprotect_exec); ATF_TC_HEAD(mprotect_exec, tc) { @@ -242,6 +245,7 @@ ATF_TC_BODY(mprotect_exec, tc) break; } } +#endif ATF_TC(mprotect_pax); ATF_TC_HEAD(mprotect_pax, tc) @@ -351,7 +355,9 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, mprotect_access); ATF_TP_ADD_TC(tp, mprotect_err); +#ifdef __NetBSD__ ATF_TP_ADD_TC(tp, mprotect_exec); +#endif ATF_TP_ADD_TC(tp, mprotect_pax); ATF_TP_ADD_TC(tp, mprotect_write); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 11:01:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 919E87E7; Thu, 23 Oct 2014 11:01:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 723A5269; Thu, 23 Oct 2014 11:01:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NB1ogI072303; Thu, 23 Oct 2014 11:01:50 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NB1oRf072302; Thu, 23 Oct 2014 11:01:50 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410231101.s9NB1oRf072302@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 23 Oct 2014 11:01:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273541 - head/sbin/ifconfig X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 11:01:50 -0000 Author: melifaro Date: Thu Oct 23 11:01:49 2014 New Revision: 273541 URL: https://svnweb.freebsd.org/changeset/base/273541 Log: Show SFP+/QSFP memory map dump on higher verbose levels. Sponsored by: Yandex LLC MFC after: 1 week Modified: head/sbin/ifconfig/sfp.c Modified: head/sbin/ifconfig/sfp.c ============================================================================== --- head/sbin/ifconfig/sfp.c Thu Oct 23 08:29:09 2014 (r273540) +++ head/sbin/ifconfig/sfp.c Thu Oct 23 11:01:49 2014 (r273541) @@ -67,6 +67,9 @@ struct i2c_info { int chip_id; }; +static void dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off, + uint8_t len); + struct _nv { int v; const char *n; @@ -327,6 +330,9 @@ get_sfp_transceiver_class(struct i2c_inf const char *tech_class; uint8_t code; + unsigned char qbuf[8]; + ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (caddr_t)qbuf); + /* Check 10G Ethernet/IB first */ ii->f(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, (caddr_t)&code); tech_class = find_zero_bit(eth_10g, code, 1); @@ -662,6 +668,30 @@ read_i2c_generic(struct i2c_info *ii, ui } static void +dump_i2c_data(struct i2c_info *ii, uint8_t addr, uint8_t off, uint8_t len) +{ + unsigned char buf[16]; + int i, read; + + while (len > 0) { + memset(buf, 0, sizeof(buf)); + read = (len > sizeof(buf)) ? sizeof(buf) : len; + ii->f(ii, addr, off, read, buf); + if (ii->error != 0) { + fprintf(stderr, "Error reading i2c info\n"); + return; + } + + printf("\t"); + for (i = 0; i < read; i++) + printf("%02X ", buf[i]); + printf("\n"); + len -= read; + off += read; + } +} + +static void print_qsfp_status(struct i2c_info *ii, int verbose) { char buf[80], buf2[40], buf3[40]; @@ -703,6 +733,13 @@ print_qsfp_status(struct i2c_info *ii, i printf("\tlane %d: RX: %s TX: %s\n", i, buf, buf2); } } + + if (verbose > 2) { + printf("\n\tSFF8436 DUMP (0xA0 128..255 range):\n"); + dump_i2c_data(ii, SFF_8436_BASE, 128, 128); + printf("\n\tSFF8436 DUMP (0xA0 0..81 range):\n"); + dump_i2c_data(ii, SFF_8436_BASE, 0, 82); + } } static void @@ -730,12 +767,12 @@ print_sfp_status(struct i2c_info *ii, in get_sfp_connector(ii, buf3, sizeof(buf3)); if (ii->error == 0) printf("\tplugged: %s %s (%s)\n", buf, buf2, buf3); - if (verbose > 2) - printf_sfp_transceiver_descr(ii, buf, sizeof(buf)); print_sfp_vendor(ii, buf, sizeof(buf)); if (ii->error == 0) printf("\t%s\n", buf); + if (verbose > 5) + printf_sfp_transceiver_descr(ii, buf, sizeof(buf)); /* * Request current measurements iff they are provided: */ @@ -747,6 +784,11 @@ print_sfp_status(struct i2c_info *ii, in get_sfp_tx_power(ii, buf2, sizeof(buf2)); printf("\tRX: %s TX: %s\n", buf, buf2); } + + if (verbose > 2) { + printf("\n\tSFF8472 DUMP (0xA0 0..127 range):\n"); + dump_i2c_data(ii, SFF_8472_BASE, 0, 128); + } } void From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 12:02:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E1B0818; Thu, 23 Oct 2014 12:02:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50608B62; Thu, 23 Oct 2014 12:02:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NC2SEN002288; Thu, 23 Oct 2014 12:02:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NC2SRB002287; Thu, 23 Oct 2014 12:02:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410231202.s9NC2SRB002287@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 23 Oct 2014 12:02:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273543 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 12:02:28 -0000 Author: trasz Date: Thu Oct 23 12:02:27 2014 New Revision: 273543 URL: https://svnweb.freebsd.org/changeset/base/273543 Log: Clean up (refactor) discovery a little; no functional changes. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/discovery.c Modified: head/usr.sbin/ctld/discovery.c ============================================================================== --- head/usr.sbin/ctld/discovery.c Thu Oct 23 11:12:27 2014 (r273542) +++ head/usr.sbin/ctld/discovery.c Thu Oct 23 12:02:27 2014 (r273543) @@ -160,7 +160,7 @@ logout_new_response(struct pdu *request) } static void -discovery_add_target(struct keys *response_keys, struct target *targ) +discovery_add_target(struct keys *response_keys, const struct target *targ) { struct portal *portal; char *buf; @@ -206,9 +206,12 @@ discovery(struct connection *conn) { struct pdu *request, *response; struct keys *request_keys, *response_keys; - struct target *targ; + const struct portal_group *pg; + const struct target *targ; const char *send_targets; + pg = conn->conn_portal->p_portal_group; + log_debugx("beginning discovery session; waiting for Text PDU"); request = text_receive(conn); request_keys = keys_new(); @@ -222,11 +225,8 @@ discovery(struct connection *conn) response_keys = keys_new(); if (strcmp(send_targets, "All") == 0) { - TAILQ_FOREACH(targ, - &conn->conn_portal->p_portal_group->pg_conf->conf_targets, - t_next) { - if (targ->t_portal_group != - conn->conn_portal->p_portal_group) { + TAILQ_FOREACH(targ, &pg->pg_conf->conf_targets, t_next) { + if (targ->t_portal_group != pg) { log_debugx("not returning target \"%s\"; " "belongs to a different portal group", targ->t_name); @@ -235,8 +235,7 @@ discovery(struct connection *conn) discovery_add_target(response_keys, targ); } } else { - targ = target_find(conn->conn_portal->p_portal_group->pg_conf, - send_targets); + targ = target_find(pg->pg_conf, send_targets); if (targ == NULL) { log_debugx("initiator requested information on unknown " "target \"%s\"; returning nothing", send_targets); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 12:38:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 38813F2B; Thu, 23 Oct 2014 12:38:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2329EEA8; Thu, 23 Oct 2014 12:38:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NCc7Go017248; Thu, 23 Oct 2014 12:38:07 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NCc6ux017244; Thu, 23 Oct 2014 12:38:06 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201410231238.s9NCc6ux017244@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Thu, 23 Oct 2014 12:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273544 - in head: sys/dev/vt sys/sys usr.sbin/vidcontrol X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 12:38:07 -0000 Author: dumbbell Date: Thu Oct 23 12:38:05 2014 New Revision: 273544 URL: https://svnweb.freebsd.org/changeset/base/273544 Log: vt(4): Add PIO_VFONT_DEFAULT ioctl to restore the default builtin font To restore the default font using vidcontrol(1), use the "-f" flag without an argument: vidcontrol -f < /dev/ttyv0 PR: 193910 Differential Revision: https://reviews.freebsd.org/D971 Submitted by: Marcin Cieslak Reviewed by: ray@, emaste@ Approved by: ray@ MFC after: 1 week Modified: head/sys/dev/vt/vt_core.c head/sys/sys/consio.h head/usr.sbin/vidcontrol/vidcontrol.1 head/usr.sbin/vidcontrol/vidcontrol.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Thu Oct 23 12:02:27 2014 (r273543) +++ head/sys/dev/vt/vt_core.c Thu Oct 23 12:38:05 2014 (r273544) @@ -2218,6 +2218,11 @@ skip_thunk: vtfont_unref(vf); return (error); } + case PIO_VFONT_DEFAULT: { + /* Reset to default font. */ + error = vt_change_font(vw, &vt_font_default); + return (error); + } case GIO_SCRNMAP: { scrmap_t *sm = (scrmap_t *)data; Modified: head/sys/sys/consio.h ============================================================================== --- head/sys/sys/consio.h Thu Oct 23 12:02:27 2014 (r273543) +++ head/sys/sys/consio.h Thu Oct 23 12:38:05 2014 (r273544) @@ -239,6 +239,7 @@ typedef struct vfnt vfnt_t; #define GIO_FONT8x16 _IOR('c', 69, fnt16_t) #define PIO_VFONT _IOW('c', 70, vfnt_t) #define GIO_VFONT _IOR('c', 71, vfnt_t) +#define PIO_VFONT_DEFAULT _IO('c', 72) /* get video mode information */ struct colors { Modified: head/usr.sbin/vidcontrol/vidcontrol.1 ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.1 Thu Oct 23 12:02:27 2014 (r273543) +++ head/usr.sbin/vidcontrol/vidcontrol.1 Thu Oct 23 12:38:05 2014 (r273544) @@ -26,9 +26,11 @@ .Op Fl c Ar appearance .Oo .Fl f +.Oo .Op Ar size .Ar file .Oc +.Oc .Op Fl g Ar geometry .Op Fl h Ar size .Op Fl i Cm adapter | mode @@ -136,8 +138,10 @@ The latter is actually a simulation. Print out current output screen map. .It Xo .Fl f +.Oo .Op Ar size .Ar file +.Oc .Xc Load font .Ar file @@ -158,6 +162,14 @@ may be omitted, in this case .Nm will try to guess it from the size of font file. .Pp +When using +.Xr vt 4 +both +.Ar size +and +.Ar font +can be omitted, and the default font will be loaded. +.Pp Note that older video cards, such as MDA and CGA, do not support software font. See also Modified: head/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- head/usr.sbin/vidcontrol/vidcontrol.c Thu Oct 23 12:02:27 2014 (r273543) +++ head/usr.sbin/vidcontrol/vidcontrol.c Thu Oct 23 12:38:05 2014 (r273544) @@ -197,7 +197,7 @@ usage(void) { if (vt4_mode) fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", -"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [size] file]", +"usage: vidcontrol [-CHPpx] [-b color] [-c appearance] [-f [[size] file]]", " [-g geometry] [-h size] [-i adapter | mode]", " [-M char] [-m on | off] [-r foreground background]", " [-S on | off] [-s number] [-T xterm | cons25] [-t N | off]", @@ -409,6 +409,19 @@ load_vt4mappingtable(unsigned int nmappi return (t); } +/* + * Set the default vt font. + */ + +static void +load_default_vt4font(void) +{ + if (ioctl(0, PIO_VFONT_DEFAULT) == -1) { + revert(); + errc(1, errno, "loading default vt font"); + } +} + static int load_vt4font(FILE *f) { @@ -1328,7 +1341,7 @@ main(int argc, char **argv) dumpopt = DUMP_FBF; termmode = NULL; if (vt4_mode) - opts = "b:Cc:f:g:h:Hi:M:m:pPr:S:s:T:t:x"; + opts = "b:Cc:fg:h:Hi:M:m:pPr:S:s:T:t:x"; else opts = "b:Cc:df:g:h:Hi:l:LM:m:pPr:S:s:T:t:x"; @@ -1349,15 +1362,23 @@ main(int argc, char **argv) print_scrnmap(); break; case 'f': - type = optarg; - font = nextarg(argc, argv, &optind, 'f', 0); + optarg = nextarg(argc, argv, &optind, 'f', 0); + if (optarg != NULL) { + font = nextarg(argc, argv, &optind, 'f', 0); + + if (font == NULL) { + type = NULL; + font = optarg; + } else + type = optarg; - if (font == NULL) { - type = NULL; - font = optarg; - } + load_font(type, font); + } else { + if (!vt4_mode) + usage(); /* Switch syscons to ROM? */ - load_font(type, font); + load_default_vt4font(); + } break; case 'g': if (sscanf(optarg, "%dx%d", From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 13:47:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 16751162; Thu, 23 Oct 2014 13:47:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0261093A; Thu, 23 Oct 2014 13:47:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NDlJna050464; Thu, 23 Oct 2014 13:47:19 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NDlJkP050463; Thu, 23 Oct 2014 13:47:19 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410231347.s9NDlJkP050463@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 23 Oct 2014 13:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273546 - head/sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 13:47:20 -0000 Author: loos Date: Thu Oct 23 13:47:19 2014 New Revision: 273546 URL: https://svnweb.freebsd.org/changeset/base/273546 Log: Fix a bug where some DTS layouts could cause the premature ending of the search (i.e. without returning any result) and you would end up with a random MAC address. Change the search algorithm to a recursive one to ensure that all the nodes on DTS will be verified. The previous algorithm could not keep up if the DTS has too many sub-nodes. While here, fix the punctuation on comments. Modified: head/sys/dev/usb/net/if_smsc.c Modified: head/sys/dev/usb/net/if_smsc.c ============================================================================== --- head/sys/dev/usb/net/if_smsc.c Thu Oct 23 13:32:01 2014 (r273545) +++ head/sys/dev/usb/net/if_smsc.c Thu Oct 23 13:47:19 2014 (r273546) @@ -1556,57 +1556,56 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd } #ifdef FDT +static phandle_t +smsc_fdt_find_eth_node(phandle_t start) +{ + phandle_t child, node; + + /* Traverse through entire tree to find usb ethernet nodes. */ + for (node = OF_child(start); node != 0; node = OF_peer(node)) { + if (fdt_is_compatible(node, "net,ethernet") && + fdt_is_compatible(node, "usb,device")) + return (node); + child = smsc_fdt_find_eth_node(node); + if (child != 0) + return (child); + } + + return (0); +} + /** - * Get MAC address from FDT blob. Firmware or loader should fill - * mac-address or local-mac-address property Returns 0 if MAC address - * obtained, error code otherwise + * Get MAC address from FDT blob. Firmware or loader should fill + * mac-address or local-mac-address property. Returns 0 if MAC address + * obtained, error code otherwise. */ static int smsc_fdt_find_mac(unsigned char *mac) { - phandle_t child, parent, root; + phandle_t node, root; int len; root = OF_finddevice("/"); - len = 0; - parent = root; - - /* Traverse through entire tree to find nodes usb ethernet nodes */ - for (child = OF_child(parent); child != 0; child = OF_peer(child)) { - - /* Find a 'leaf'. Start the search from this node. */ - while (OF_child(child)) { - parent = child; - child = OF_child(child); - } - - if (fdt_is_compatible(child, "net,ethernet") && - fdt_is_compatible(child, "usb,device")) { + node = smsc_fdt_find_eth_node(root); + if (node != 0) { - /* Check if there is property */ - if ((len = OF_getproplen(child, "local-mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(child, "local-mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } - - if ((len = OF_getproplen(child, "mac-address")) > 0) { - if (len != ETHER_ADDR_LEN) - return (EINVAL); - - OF_getprop(child, "mac-address", mac, - ETHER_ADDR_LEN); - return (0); - } + /* Check if there is property */ + if ((len = OF_getproplen(node, "local-mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "local-mac-address", mac, + ETHER_ADDR_LEN); + return (0); } - if (OF_peer(child) == 0) { - /* No more siblings. */ - child = parent; - parent = OF_parent(child); + if ((len = OF_getproplen(node, "mac-address")) > 0) { + if (len != ETHER_ADDR_LEN) + return (EINVAL); + + OF_getprop(node, "mac-address", mac, + ETHER_ADDR_LEN); + return (0); } } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 14:29:53 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6D1EAF54; Thu, 23 Oct 2014 14:29:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59D43DA8; Thu, 23 Oct 2014 14:29:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NETrmL070031; Thu, 23 Oct 2014 14:29:53 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NETr9Y070030; Thu, 23 Oct 2014 14:29:53 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410231429.s9NETr9Y070030@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 23 Oct 2014 14:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273547 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 14:29:53 -0000 Author: ae Date: Thu Oct 23 14:29:52 2014 New Revision: 273547 URL: https://svnweb.freebsd.org/changeset/base/273547 Log: Move if_get_counter initialization from if_attach into if_alloc. Also, initialize all counters before ifnet will become available in the system. This fixes possible access to uninitialized ifned fields. PR: 194550 Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Thu Oct 23 13:47:19 2014 (r273546) +++ head/sys/net/if.c Thu Oct 23 14:29:52 2014 (r273547) @@ -467,11 +467,10 @@ if_alloc(u_char type) ifq_init(&ifp->if_snd, ifp); refcount_init(&ifp->if_refcount, 1); /* Index reference. */ - ifnet_setbyindex(ifp->if_index, ifp); - for (int i = 0; i < IFCOUNTERS; i++) ifp->if_counters[i] = counter_u64_alloc(M_WAITOK); - + ifp->if_get_counter = if_get_counter_default; + ifnet_setbyindex(ifp->if_index, ifp); return (ifp); } @@ -674,9 +673,6 @@ if_attach_internal(struct ifnet *ifp, in ifp->if_qflush = if_qflush; } - if (ifp->if_get_counter == NULL) - ifp->if_get_counter = if_get_counter_default; - if (!vmove) { #ifdef MAC mac_ifnet_create(ifp); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 15:16:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5E642A64; Thu, 23 Oct 2014 15:16:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F37735E; Thu, 23 Oct 2014 15:16:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NFGgfE093149; Thu, 23 Oct 2014 15:16:42 GMT (envelope-from emax@FreeBSD.org) Received: (from emax@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NFGfqq093145; Thu, 23 Oct 2014 15:16:41 GMT (envelope-from emax@FreeBSD.org) Message-Id: <201410231516.s9NFGfqq093145@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emax set sender to emax@FreeBSD.org using -f From: Maksim Yevmenkin Date: Thu, 23 Oct 2014 15:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273548 - head/usr.bin/bluetooth/rfcomm_sppd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 15:16:42 -0000 Author: emax Date: Thu Oct 23 15:16:40 2014 New Revision: 273548 URL: https://svnweb.freebsd.org/changeset/base/273548 Log: Change the code to use the openpty(3) API which uses the pts(4) driver instead of the pty(4) driver. PR: 184597 Submitted by: tobias.rehbein MFC after: 2 weeks Modified: head/usr.bin/bluetooth/rfcomm_sppd/Makefile head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c Modified: head/usr.bin/bluetooth/rfcomm_sppd/Makefile ============================================================================== --- head/usr.bin/bluetooth/rfcomm_sppd/Makefile Thu Oct 23 14:29:52 2014 (r273547) +++ head/usr.bin/bluetooth/rfcomm_sppd/Makefile Thu Oct 23 15:16:40 2014 (r273548) @@ -6,6 +6,6 @@ SRCS= rfcomm_sppd.c rfcomm_sdp.c WARNS?= 2 DPADD= ${LIBBLUETOOTH} ${LIBSDP} -LDADD= -lbluetooth -lsdp +LDADD= -lbluetooth -lsdp -lutil .include Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 ============================================================================== --- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 Thu Oct 23 14:29:52 2014 (r273547) +++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.1 Thu Oct 23 15:16:40 2014 (r273548) @@ -33,10 +33,9 @@ .Nd RFCOMM Serial Port Profile daemon .Sh SYNOPSIS .Nm -.Op Fl bhS +.Op Fl bhtS .Fl a Ar address .Fl c Ar channel -.Op Fl t Ar tty .Sh DESCRIPTION The .Nm @@ -53,7 +52,7 @@ Once connection is established, the .Nm utility provides access to the server's remote serial port via stdin/stdout or via -.Xr pty 4 +.Xr pts 4 interface if .Fl t option was specified. @@ -72,8 +71,7 @@ daemon. If .Fl t options was specified, -the server side of the virtual serial port is attached to the pseudo-terminal -.Ar tty . +the server side of the virtual serial port is attached to a pseudo-terminal. Otherwise the virtual serial port is attached to the stdin/stdout. .Nm should be run as root in order to communicate with @@ -146,24 +144,22 @@ Display usage message and exit. .It Fl S Server mode; see .Sx DESCRIPTION . -.It Fl t Ar tty -Slave pseudo tty name. +.It Fl t +Use slave pseudo tty. If not set stdin/stdout will be used. This option is required if .Fl b option was specified. .El .Sh FILES -.Bl -tag -width ".Pa /dev/tty[p-sP-S][0-9a-v]" -compact -.It Pa /dev/pty[p-sP-S][0-9a-v] -master pseudo terminals -.It Pa /dev/tty[p-sP-S][0-9a-v] +.Bl -tag -width ".Pa /dev/pts/[num]" -compact +.It Pa /dev/pts/[num] slave pseudo terminals .El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES -.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t /dev/ttyp1" +.Dl "rfcomm_sppd -a 00:01:02:03:04:05 -c 1 -t" .Pp Will start the .Nm @@ -171,13 +167,17 @@ utility and open RFCOMM connection to th .Li 00:01:02:03:04:05 and channel .Li 1 . -Once the connection has been established, -.Pa /dev/ttyp1 +Once the connection has been established, a +.Xr pts 4 can be used to talk to the remote serial port on the server. +.Nm +prints the name of the +.Xr pts 4 +to use on stdout. .Sh SEE ALSO .Xr bluetooth 3 , .Xr ng_btsocket 4 , -.Xr pty 4 , +.Xr pts 4 , .Xr rfcomm_pppd 8 , .Xr sdpd 8 .Sh AUTHORS Modified: head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c ============================================================================== --- head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c Thu Oct 23 14:29:52 2014 (r273547) +++ head/usr.bin/bluetooth/rfcomm_sppd/rfcomm_sppd.c Thu Oct 23 15:16:40 2014 (r273548) @@ -32,6 +32,7 @@ */ #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include #include +#include #define SPPD_IDENT "rfcomm_sppd" #define SPPD_BUFFER_SIZE 1024 @@ -58,7 +60,7 @@ int rfcomm_channel_lookup (bdaddr_t con bdaddr_t const *remote, int service, int *channel, int *error); -static int sppd_ttys_open (char const *tty, int *amaster, int *aslave); +static int sppd_ttys_open (char **tty, int *amaster, int *aslave); static int sppd_read (int fd, char *buffer, int size); static int sppd_write (int fd, char *buffer, int size); static void sppd_sighandler (int s); @@ -74,7 +76,8 @@ main(int argc, char *argv[]) struct sockaddr_rfcomm ra; bdaddr_t addr; int n, background, channel, service, - s, amaster, aslave, fd, doserver; + s, amaster, aslave, fd, doserver, + dopty; fd_set rfd; char *tty = NULL, *ep = NULL, buf[SPPD_BUFFER_SIZE]; @@ -82,9 +85,10 @@ main(int argc, char *argv[]) background = channel = 0; service = SDP_SERVICE_CLASS_SERIAL_PORT; doserver = 0; + dopty = 0; /* Parse command line options */ - while ((n = getopt(argc, argv, "a:bc:t:hS")) != -1) { + while ((n = getopt(argc, argv, "a:bc:thS")) != -1) { switch (n) { case 'a': /* BDADDR */ if (!bt_aton(optarg, &addr)) { @@ -130,11 +134,8 @@ main(int argc, char *argv[]) background = 1; break; - case 't': /* Slave TTY name */ - if (optarg[0] != '/') - asprintf(&tty, "%s%s", _PATH_DEV, optarg); - else - tty = optarg; + case 't': /* Open pseudo TTY */ + dopty = 1; break; case 'S': @@ -173,18 +174,18 @@ main(int argc, char *argv[]) err(1, "Could not sigaction(SIGCHLD)"); /* Open TTYs */ - if (tty == NULL) { + if (dopty) { + if (sppd_ttys_open(&tty, &amaster, &aslave) < 0) + exit(1); + + fd = amaster; + } else { if (background) usage(); amaster = STDIN_FILENO; fd = STDOUT_FILENO; - } else { - if (sppd_ttys_open(tty, &amaster, &aslave) < 0) - exit(1); - - fd = amaster; - } + } /* Open RFCOMM connection */ @@ -287,6 +288,10 @@ main(int argc, char *argv[]) openlog(SPPD_IDENT, LOG_NDELAY|LOG_PERROR|LOG_PID, LOG_DAEMON); syslog(LOG_INFO, "Starting on %s...", (tty != NULL)? tty : "stdin/stdout"); + /* Print used tty on stdout for wrappers to pick up */ + if (!background) + fprintf(stdout, "%s\n", tty); + for (done = 0; !done; ) { FD_ZERO(&rfd); FD_SET(amaster, &rfd); @@ -359,70 +364,20 @@ main(int argc, char *argv[]) /* Open TTYs */ static int -sppd_ttys_open(char const *tty, int *amaster, int *aslave) +sppd_ttys_open(char **tty, int *amaster, int *aslave) { - char pty[PATH_MAX], *slash; - struct group *gr = NULL; - gid_t ttygid; + char pty[PATH_MAX]; struct termios tio; - /* - * Construct master PTY name. The slave tty name must be less then - * PATH_MAX characters in length, must contain '/' character and - * must not end with '/'. - */ - - if (strlen(tty) >= sizeof(pty)) { - syslog(LOG_ERR, "Slave tty name is too long"); - return (-1); - } - - strlcpy(pty, tty, sizeof(pty)); - slash = strrchr(pty, '/'); - if (slash == NULL || slash[1] == '\0') { - syslog(LOG_ERR, "Invalid slave tty name (%s)", tty); - return (-1); - } - - slash[1] = 'p'; - - if (strcmp(pty, tty) == 0) { - syslog(LOG_ERR, "Master and slave tty are the same (%s)", tty); - return (-1); - } - - if ((*amaster = open(pty, O_RDWR, 0)) < 0) { - syslog(LOG_ERR, "Could not open(%s). %s", pty, strerror(errno)); - return (-1); - } - - /* - * Slave TTY - */ - - if ((gr = getgrnam("tty")) != NULL) - ttygid = gr->gr_gid; - else - ttygid = -1; - - (void) chown(tty, getuid(), ttygid); - (void) chmod(tty, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP); - (void) revoke(tty); + cfmakeraw(&tio); - if ((*aslave = open(tty, O_RDWR, 0)) < 0) { - syslog(LOG_ERR, "Could not open(%s). %s", tty, strerror(errno)); - close(*amaster); + if (openpty(amaster, aslave, pty, &tio, NULL) == -1) { + syslog(LOG_ERR, "Could not openpty(). %s", strerror(errno)); return (-1); } - /* - * Make slave TTY raw - */ - - cfmakeraw(&tio); - - if (tcsetattr(*aslave, TCSANOW, &tio) < 0) { - syslog(LOG_ERR, "Could not tcsetattr(). %s", strerror(errno)); + if ((*tty = strdup(pty)) == NULL) { + syslog(LOG_ERR, "Could not strdup(). %s", strerror(errno)); close(*aslave); close(*amaster); return (-1); @@ -496,7 +451,7 @@ usage(void) "\t-a address Peer address (required in client mode)\n" \ "\t-b Run in background\n" \ "\t-c channel RFCOMM channel to connect to or listen on\n" \ -"\t-t tty TTY name (required in background mode)\n" \ +"\t-t use slave pseudo tty (required in background mode)\n" \ "\t-S Server mode\n" \ "\t-h Display this message\n", SPPD_IDENT); exit(255); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 15:35:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EB564545; Thu, 23 Oct 2014 15:35:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8D7481C; Thu, 23 Oct 2014 15:35:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NFZleo002657; Thu, 23 Oct 2014 15:35:47 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NFZlbn002656; Thu, 23 Oct 2014 15:35:47 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410231535.s9NFZlbn002656@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 23 Oct 2014 15:35:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273549 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 15:35:48 -0000 Author: mjg Date: Thu Oct 23 15:35:47 2014 New Revision: 273549 URL: https://svnweb.freebsd.org/changeset/base/273549 Log: Avoid taking the lock in selfdfree when not needed. Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014 (r273548) +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014 (r273549) @@ -1600,10 +1600,11 @@ static void selfdfree(struct seltd *stp, struct selfd *sfp) { STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); - mtx_lock(sfp->sf_mtx); - if (sfp->sf_si) + if (sfp->sf_si != NULL) { + mtx_lock(sfp->sf_mtx); TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); - mtx_unlock(sfp->sf_mtx); + mtx_unlock(sfp->sf_mtx); + } uma_zfree(selfd_zone, sfp); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 17:24:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14C817B2; Thu, 23 Oct 2014 17:24:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0139E38F; Thu, 23 Oct 2014 17:24:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NHOoZ8053726; Thu, 23 Oct 2014 17:24:50 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NHOoTe053725; Thu, 23 Oct 2014 17:24:50 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201410231724.s9NHOoTe053725@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Thu, 23 Oct 2014 17:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273550 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 17:24:51 -0000 Author: jmg Date: Thu Oct 23 17:24:50 2014 New Revision: 273550 URL: https://svnweb.freebsd.org/changeset/base/273550 Log: minor updates to make it more explicit that when using fpu_kern_thread, you don't need to use fpu_kern_enter/_leave... Reviewed by: kib Modified: head/share/man/man9/fpu_kern.9 Modified: head/share/man/man9/fpu_kern.9 ============================================================================== --- head/share/man/man9/fpu_kern.9 Thu Oct 23 15:35:47 2014 (r273549) +++ head/share/man/man9/fpu_kern.9 Thu Oct 23 17:24:50 2014 (r273550) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2014 +.Dd October 23, 2014 .Dt FPU_KERN 9 .Os .Sh NAME @@ -157,12 +157,17 @@ There are no errors defined for the func .Pp The .Fn fpu_kern_thread -function provides an optimization for threads which never leave to +function enables an optimization for threads which never leave to the usermode. -Such thread can reuse the usermode save area for the FPU state, -which is allowed by the function call. -There is no flags defined for the function, and no error states +The current thread will reuse the usermode save area for the kernel FPU state +instead of requiring an explicitly allocated context. +There are no flags defined for the function, and no error states that the function returns. +Once this function has been called, neither +.Fn fpu_kern_enter +nor +.Fn fpu_kern_leave +is required to be called and the fpu is available for use in the calling thread. .Pp The .Fn is_fpu_kern_thread From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:03:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B722C1E3; Thu, 23 Oct 2014 18:03:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A38639D8; Thu, 23 Oct 2014 18:03:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NI3SAd072972; Thu, 23 Oct 2014 18:03:28 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NI3SrO072971; Thu, 23 Oct 2014 18:03:28 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410231803.s9NI3SrO072971@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Thu, 23 Oct 2014 18:03:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273551 - head/sys/dev/puc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:03:28 -0000 Author: rpaulo Date: Thu Oct 23 18:03:27 2014 New Revision: 273551 URL: https://svnweb.freebsd.org/changeset/base/273551 Log: puc(4): add an entry for the Oxford Semiconductor OXPCIe952 1S1P card. Submitted by: Alex Burlyga MFC after: 1 week Modified: head/sys/dev/puc/pucdata.c Modified: head/sys/dev/puc/pucdata.c ============================================================================== --- head/sys/dev/puc/pucdata.c Thu Oct 23 17:24:50 2014 (r273550) +++ head/sys/dev/puc/pucdata.c Thu Oct 23 18:03:27 2014 (r273551) @@ -839,6 +839,13 @@ const struct puc_cfg puc_pci_devices[] = * */ + { 0x1415, 0xc11b, 0xffff, 0, + "Oxford Semiconductor OXPCIe952 1S1P", + DEFAULT_RCLK * 0x22, + PUC_PORT_NONSTANDARD, 0x10, 0, -1, + .config_function = puc_config_oxford_pcie + }, + { 0x1415, 0xc138, 0xffff, 0, "Oxford Semiconductor OXPCIe952 UARTs", DEFAULT_RCLK * 0x22, From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:23:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7C880698; Thu, 23 Oct 2014 18:23:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 68FD3BF7; Thu, 23 Oct 2014 18:23:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NINpmP082634; Thu, 23 Oct 2014 18:23:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NINpXD082633; Thu, 23 Oct 2014 18:23:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410231823.s9NINpXD082633@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 Oct 2014 18:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273552 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:23:51 -0000 Author: delphij Date: Thu Oct 23 18:23:50 2014 New Revision: 273552 URL: https://svnweb.freebsd.org/changeset/base/273552 Log: Test if 'env' is NULL before doing memset() and strlen(), the caller may pass NULL to freeenv(). Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Thu Oct 23 18:03:27 2014 (r273551) +++ head/sys/kern/kern_environment.c Thu Oct 23 18:23:50 2014 (r273552) @@ -262,7 +262,7 @@ void freeenv(char *env) { - if (dynamic_kenv) { + if (dynamic_kenv && env != NULL) { memset(env, 0, strlen(env)); free(env, M_KENV); } From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:38:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DCCB7C08; Thu, 23 Oct 2014 18:38:21 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B630CD37; Thu, 23 Oct 2014 18:38:21 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8D8B3B98D; Thu, 23 Oct 2014 14:38:20 -0400 (EDT) From: John Baldwin To: Marcel Moolenaar Subject: Re: svn commit: r273446 - head/sys/x86/isa Date: Thu, 23 Oct 2014 11:43:03 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410220137.s9M1bXuh023209@svn.freebsd.org> In-Reply-To: <201410220137.s9M1bXuh023209@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201410231143.03527.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Oct 2014 14:38:20 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:38:22 -0000 On Tuesday, October 21, 2014 9:37:33 pm Marcel Moolenaar wrote: > Author: marcel > Date: Wed Oct 22 01:37:32 2014 > New Revision: 273446 > URL: https://svnweb.freebsd.org/changeset/base/273446 > > Log: > Virtual machines can easily have more than 16 option ROMs and > when that happens, we happily access our resource array out of > bounds. Make sure we stay within the MAX_ROMS limit. > While here, bump MAX_ROMS from 16 to 32 to minimize the chance > of leaving option ROMs unaccounted for. > > Obtained from: Juniper Networks, Inc. The res[] array should just go away entirely. This driver never gets detached, so its detach routine can get removed. sc->rnum can become a local variable in attach, the arrays can be axed, and the entire softc should be empty. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:38:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF2BBD58; Thu, 23 Oct 2014 18:38:24 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89C6AD3A; Thu, 23 Oct 2014 18:38:24 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7F604B9B1; Thu, 23 Oct 2014 14:38:23 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r273401 - head/sys/kern Date: Thu, 23 Oct 2014 12:14:03 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410211905.s9LJ5jDb032492@svn.freebsd.org> In-Reply-To: <201410211905.s9LJ5jDb032492@svn.freebsd.org> MIME-Version: 1.0 Message-Id: <201410231214.04027.jhb@freebsd.org> Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Oct 2014 14:38:23 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:38:24 -0000 On Tuesday, October 21, 2014 3:05:45 pm Mateusz Guzik wrote: > Author: mjg > Date: Tue Oct 21 19:05:44 2014 > New Revision: 273401 > URL: https://svnweb.freebsd.org/changeset/base/273401 > > Log: > Implement shared locking for sysctl. A bit more detail in this message was warranted. We had some shared locking in the past (r192125) but it was subsequently reverted (r216060). In particular, explaining how you fixed the part of 216060 that caused the shared locking to be reverted would have answered Bjoern's earlier question as well. It's important that log messages not only explain what they are doing, but why they are doing so. (For exmaple, it would have been nice if 216060 had explained why it was reverting the shared locking in its log message, but it didn't. :( ) I think that you fixed the issues by a combination of using sysctl_lock/unlock to handle shared vs exclusive locking for the caller and you used atomic ops on the running count (previously the xlock allowed use of non-atomic ops on the running count). sysctl_root() is now only called with a shared lock held, so you should change its assertion accordingly. sysctl_register_oid() is still called with the xlock held, so you can't remove the sysctl_lock() stuff from sysctl_root_handler_locked() entirely. OTOH, there is a stale comment in kern_sysctl.c about having a public sysctl_lock/unlock API that you can just remove. Also, given that sysctl_lock/unlock are only used in sysctl_root_handler_locked(), I would probably remove them and just inline them in the one place they are needed. Finally, getting pre-commit review is fairly easy these days with phabricator and would allow you to have had all these things noted and addressed before it went into the tree. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:38:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBA34EA2; Thu, 23 Oct 2014 18:38:30 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A40A0D3C; Thu, 23 Oct 2014 18:38:30 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B9B0FB9B9; Thu, 23 Oct 2014 14:38:29 -0400 (EDT) From: John Baldwin To: Mateusz Guzik Subject: Re: svn commit: r273549 - head/sys/kern Date: Thu, 23 Oct 2014 14:38:09 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410231535.s9NFZlbn002656@svn.freebsd.org> In-Reply-To: <201410231535.s9NFZlbn002656@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201410231438.09220.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Oct 2014 14:38:29 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:38:30 -0000 On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: > Author: mjg > Date: Thu Oct 23 15:35:47 2014 > New Revision: 273549 > URL: https://svnweb.freebsd.org/changeset/base/273549 > > Log: > Avoid taking the lock in selfdfree when not needed. > > Modified: > head/sys/kern/sys_generic.c > > Modified: head/sys/kern/sys_generic.c > ============================================================================== > --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014 (r273548) > +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014 (r273549) > @@ -1600,10 +1600,11 @@ static void > selfdfree(struct seltd *stp, struct selfd *sfp) > { > STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); > - mtx_lock(sfp->sf_mtx); > - if (sfp->sf_si) > + if (sfp->sf_si != NULL) { > + mtx_lock(sfp->sf_mtx); > TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); > - mtx_unlock(sfp->sf_mtx); > + mtx_unlock(sfp->sf_mtx); > + } > uma_zfree(selfd_zone, sfp); How do you ensure that the value you read for sf_si here is up to date? In particular, if a thread is selecting on multiple fds and one awakens it, another fd can invoke selwakeup() while the thread is in seltdclear(). In that case, you might see a stale value of sf_si and not realize it is cleared by the selwakeup() after you get the lock and you will invoke TAILQ_REMOVE an extra time. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 18:45:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C915A2D7; Thu, 23 Oct 2014 18:45:19 +0000 (UTC) Received: from mail-lb0-x22a.google.com (mail-lb0-x22a.google.com [IPv6:2a00:1450:4010:c04::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8CD1EE19; Thu, 23 Oct 2014 18:45:18 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id u10so1367774lbd.15 for ; Thu, 23 Oct 2014 11:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=mK9rRkxKSYXy5OMwSTUojabY/90Ayj2J4+LPMWXZ4iQ=; b=Lqxw0PkxqwXdzSkFGGoMUB09yGsvnzsYXSieULDR7O1eXrffhVOEeeQaRKT4MqbOQz Etd2OINiDXtKPGd4fco03IVAOJMrLLQI1xEhXuUtLoMSh6wsYVe7O14N3KBB7fYmf8Bm HltHkojEvSGouYUhzjaA072nctiK9T9tRh1snzxSURUxK8P6En5ApsixCpGCGV1mBo2W Xy2sWmiO2NfOjujQa2MP0mgX6nKY0Y65bpJB2NqxF8mI99BrgOGoU/NYEK2YYg9RfBXv gRnsUdww0hHGSo5r5kY4M/VhY8amcMpgB9J31oiEFKw3mCUOYlJWbSF6c8Lwimw6PznI dStA== X-Received: by 10.112.26.71 with SMTP id j7mr5248609lbg.96.1414089916366; Thu, 23 Oct 2014 11:45:16 -0700 (PDT) Received: from [192.168.1.14] (aefx165.neoplus.adsl.tpnet.pl. [79.186.153.165]) by mx.google.com with ESMTPSA id i6sm1046976laf.47.2014.10.23.11.45.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 Oct 2014 11:45:15 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r273549 - head/sys/kern From: =?utf-8?Q?Edward_Tomasz_Napiera=C5=82a?= X-Mailer: iPhone Mail (12A405) In-Reply-To: <201410231438.09220.jhb@freebsd.org> Date: Thu, 23 Oct 2014 20:45:13 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org> References: <201410231535.s9NFZlbn002656@svn.freebsd.org> <201410231438.09220.jhb@freebsd.org> To: John Baldwin Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 18:45:20 -0000 Dnia 23 pa=C5=BA 2014 o godz. 20:38 John Baldwin napisa=C5= =82(a): >> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: >> Author: mjg >> Date: Thu Oct 23 15:35:47 2014 >> New Revision: 273549 >> URL: https://svnweb.freebsd.org/changeset/base/273549 >>=20 >> Log: >> Avoid taking the lock in selfdfree when not needed. >>=20 >> Modified: >> head/sys/kern/sys_generic.c >>=20 >> Modified: head/sys/kern/sys_generic.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D >> --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014 (r273548) >> +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014 (r273549) >> @@ -1600,10 +1600,11 @@ static void >> selfdfree(struct seltd *stp, struct selfd *sfp) >> { >> STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); >> - mtx_lock(sfp->sf_mtx); >> - if (sfp->sf_si) >> + if (sfp->sf_si !=3D NULL) { >> + mtx_lock(sfp->sf_mtx); >> TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); >> - mtx_unlock(sfp->sf_mtx); >> + mtx_unlock(sfp->sf_mtx); >> + } >> uma_zfree(selfd_zone, sfp); >=20 > How do you ensure that the value you read for sf_si here is up to date? I= n=20 > particular, if a thread is selecting on multiple fds and one awakens it, > another fd can invoke selwakeup() while the thread is in seltdclear(). > In that case, you might see a stale value of sf_si and not realize it is=20= > cleared by the selwakeup() after you get the lock and you will invoke > TAILQ_REMOVE an extra time. FWIW, I've just hit a panic in selfdfree(). From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 19:06:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DB7F7E1A; Thu, 23 Oct 2014 19:06:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7B14107; Thu, 23 Oct 2014 19:06:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NJ68rT002295; Thu, 23 Oct 2014 19:06:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NJ68CJ002294; Thu, 23 Oct 2014 19:06:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410231906.s9NJ68CJ002294@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 23 Oct 2014 19:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273555 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 19:06:09 -0000 Author: mjg Date: Thu Oct 23 19:06:08 2014 New Revision: 273555 URL: https://svnweb.freebsd.org/changeset/base/273555 Log: In selfdfree re-evaulate sf_si after takin the lock. Otherwise we can race with doselwakeup. This is a fixup to r273549 Reviewed by: jhb Reported by: everyone and their dog Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Thu Oct 23 18:50:44 2014 (r273554) +++ head/sys/kern/sys_generic.c Thu Oct 23 19:06:08 2014 (r273555) @@ -1602,7 +1602,8 @@ selfdfree(struct seltd *stp, struct self STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); if (sfp->sf_si != NULL) { mtx_lock(sfp->sf_mtx); - TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); + if (sfp->sf_si != NULL) + TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); mtx_unlock(sfp->sf_mtx); } uma_zfree(selfd_zone, sfp); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 19:39:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE2919EC; Thu, 23 Oct 2014 19:39:42 +0000 (UTC) Received: from mail-wg0-x22d.google.com (mail-wg0-x22d.google.com [IPv6:2a00:1450:400c:c00::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B546F674; Thu, 23 Oct 2014 19:39:41 +0000 (UTC) Received: by mail-wg0-f45.google.com with SMTP id m15so1862546wgh.4 for ; Thu, 23 Oct 2014 12:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Jt4GdNFdJE99PJ4v+Tr6XZLqOzIQ3jxebHMupbTIlmk=; b=swBU3LeRGG8UK/kLLdhwx2iiT0TdvtCxf3S2vFvu6Dw35kmTe0Ndl90tJzXlXPniGa VSEp+o77VjCsuAL1cV39HzM7wbiO8P7GCzrxPo321payZLo0Ta5DFSiTSPzGKcdAL+CG yDo2XrTZ+XNlRRsYeNWU/6mRwHWq6UALGTyMbNnU57WwpODgmJWwE+Cs6s5Ncs54a59A S1ROwRG5Co+IGCvrns8oq2qvFTwxef788Wov+JXEKMS4acBrFTPM6ev6KGFU4lNGTYqL l1VheNHD+yb3uz8xpt05uLAavwX7/SnA1wMVW8qjdUsApF8M6Sh17EXnnm+/LbwWHorO vy1Q== MIME-Version: 1.0 X-Received: by 10.194.216.162 with SMTP id or2mr7720803wjc.68.1414093180007; Thu, 23 Oct 2014 12:39:40 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.216.106.136 with HTTP; Thu, 23 Oct 2014 12:39:39 -0700 (PDT) In-Reply-To: <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org> References: <201410231535.s9NFZlbn002656@svn.freebsd.org> <201410231438.09220.jhb@freebsd.org> <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org> Date: Thu, 23 Oct 2014 12:39:39 -0700 X-Google-Sender-Auth: CGL1LT6XCY4oV3jnlEifwmswfDY Message-ID: Subject: Re: svn commit: r273549 - head/sys/kern From: Adrian Chadd To: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Mateusz Guzik , John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 19:39:43 -0000 Please back this out; it looks like the lock is protecting sf_si. -adrian On 23 October 2014 11:45, Edward Tomasz Napiera=C5=82a = wrote: > Dnia 23 pa=C5=BA 2014 o godz. 20:38 John Baldwin napisa= =C5=82(a): > >>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: >>> Author: mjg >>> Date: Thu Oct 23 15:35:47 2014 >>> New Revision: 273549 >>> URL: https://svnweb.freebsd.org/changeset/base/273549 >>> >>> Log: >>> Avoid taking the lock in selfdfree when not needed. >>> >>> Modified: >>> head/sys/kern/sys_generic.c >>> >>> Modified: head/sys/kern/sys_generic.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >>> --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014 (r273548= ) >>> +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014 (r273549= ) >>> @@ -1600,10 +1600,11 @@ static void >>> selfdfree(struct seltd *stp, struct selfd *sfp) >>> { >>> STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); >>> - mtx_lock(sfp->sf_mtx); >>> - if (sfp->sf_si) >>> + if (sfp->sf_si !=3D NULL) { >>> + mtx_lock(sfp->sf_mtx); >>> TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); >>> - mtx_unlock(sfp->sf_mtx); >>> + mtx_unlock(sfp->sf_mtx); >>> + } >>> uma_zfree(selfd_zone, sfp); >> >> How do you ensure that the value you read for sf_si here is up to date? = In >> particular, if a thread is selecting on multiple fds and one awakens it, >> another fd can invoke selwakeup() while the thread is in seltdclear(). >> In that case, you might see a stale value of sf_si and not realize it is >> cleared by the selwakeup() after you get the lock and you will invoke >> TAILQ_REMOVE an extra time. > > FWIW, I've just hit a panic in selfdfree(). > > From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 20:43:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B23D2851; Thu, 23 Oct 2014 20:43:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 848D1E10; Thu, 23 Oct 2014 20:43:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NKhHdO050194; Thu, 23 Oct 2014 20:43:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NKhHxI050192; Thu, 23 Oct 2014 20:43:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410232043.s9NKhHxI050192@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 Oct 2014 20:43:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273557 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 20:43:17 -0000 Author: jhb Date: Thu Oct 23 20:43:16 2014 New Revision: 273557 URL: https://svnweb.freebsd.org/changeset/base/273557 Log: Use a static callout to drive key_timehandler() instead of timeout(). While here, make key_timehandler() private to key.c. Submitted by: bz (2) Tested by: bz Modified: head/sys/netipsec/key.c head/sys/netipsec/key.h Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Thu Oct 23 20:01:55 2014 (r273556) +++ head/sys/netipsec/key.c Thu Oct 23 20:43:16 2014 (r273557) @@ -410,6 +410,10 @@ struct sadb_msghdr { int extlen[SADB_EXT_MAX + 1]; }; +#ifndef IPSEC_DEBUG2 +static struct callout key_timer; +#endif + static struct secasvar *key_allocsa_policy __P((const struct secasindex *)); static void key_freesp_so __P((struct secpolicy **)); static struct secasvar *key_do_allocsa_policy __P((struct secashead *, u_int)); @@ -4525,8 +4529,8 @@ key_flush_spacq(time_t now) * and do to remove or to expire. * XXX: year 2038 problem may remain. */ -void -key_timehandler(void) +static void +key_timehandler(void *arg) { VNET_ITERATOR_DECL(vnet_iter); time_t now = time_second; @@ -4544,7 +4548,7 @@ key_timehandler(void) #ifndef IPSEC_DEBUG2 /* do exchange to tick time !! */ - (void)timeout((void *)key_timehandler, (void *)0, hz); + callout_schedule(&key_timer, hz); #endif /* IPSEC_DEBUG2 */ } @@ -7769,7 +7773,8 @@ key_init(void) SPACQ_LOCK_INIT(); #ifndef IPSEC_DEBUG2 - timeout((void *)key_timehandler, (void *)0, hz); + callout_init(&key_timer, CALLOUT_MPSAFE); + callout_reset(&key_timer, hz, key_timehandler, NULL); #endif /*IPSEC_DEBUG2*/ /* initialize key statistics */ Modified: head/sys/netipsec/key.h ============================================================================== --- head/sys/netipsec/key.h Thu Oct 23 20:01:55 2014 (r273556) +++ head/sys/netipsec/key.h Thu Oct 23 20:43:16 2014 (r273557) @@ -97,7 +97,6 @@ extern struct secpolicy *key_msg2sp __P( extern struct mbuf *key_sp2msg __P((struct secpolicy *)); extern int key_ismyaddr __P((struct sockaddr *)); extern int key_spdacquire __P((struct secpolicy *)); -extern void key_timehandler __P((void)); extern u_long key_random __P((void)); extern void key_randomfill __P((void *, size_t)); extern void key_freereg __P((struct socket *)); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 20:44:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6981999E; Thu, 23 Oct 2014 20:44:03 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E2A7E18; Thu, 23 Oct 2014 20:44:03 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 7D0AFB98D; Thu, 23 Oct 2014 16:44:01 -0400 (EDT) From: John Baldwin To: Adrian Chadd Subject: Re: svn commit: r273549 - head/sys/kern Date: Thu, 23 Oct 2014 16:32:52 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410231535.s9NFZlbn002656@svn.freebsd.org> <20E7F407-9DC5-4A59-BC1C-7B868C31EF52@FreeBSD.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201410231632.53172.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 23 Oct 2014 16:44:01 -0400 (EDT) Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Edward Tomasz =?utf-8?q?Napiera=C5=82a?= , Mateusz Guzik X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 20:44:03 -0000 On Thursday, October 23, 2014 3:39:39 pm Adrian Chadd wrote: > Please back this out; it looks like the lock is protecting sf_si. The followup fix should be fine. The lock does indeed protect sf_si, but t= he value can only transition from non-NULL to NULL at this point, so if it is =3D=3D= NULL without the lock, it is safe to assume it has already been cleared. > -adrian >=20 > On 23 October 2014 11:45, Edward Tomasz Napiera=C5=82a wrote: > > Dnia 23 pa=C5=BA 2014 o godz. 20:38 John Baldwin napi= sa=C5=82(a): > > > >>> On Thursday, October 23, 2014 11:35:47 am Mateusz Guzik wrote: > >>> Author: mjg > >>> Date: Thu Oct 23 15:35:47 2014 > >>> New Revision: 273549 > >>> URL: https://svnweb.freebsd.org/changeset/base/273549 > >>> > >>> Log: > >>> Avoid taking the lock in selfdfree when not needed. > >>> > >>> Modified: > >>> head/sys/kern/sys_generic.c > >>> > >>> Modified: head/sys/kern/sys_generic.c > >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > >>> --- head/sys/kern/sys_generic.c Thu Oct 23 15:16:40 2014 (r2735= 48) > >>> +++ head/sys/kern/sys_generic.c Thu Oct 23 15:35:47 2014 (r2735= 49) > >>> @@ -1600,10 +1600,11 @@ static void > >>> selfdfree(struct seltd *stp, struct selfd *sfp) > >>> { > >>> STAILQ_REMOVE(&stp->st_selq, sfp, selfd, sf_link); > >>> - mtx_lock(sfp->sf_mtx); > >>> - if (sfp->sf_si) > >>> + if (sfp->sf_si !=3D NULL) { > >>> + mtx_lock(sfp->sf_mtx); > >>> TAILQ_REMOVE(&sfp->sf_si->si_tdlist, sfp, sf_threads); > >>> - mtx_unlock(sfp->sf_mtx); > >>> + mtx_unlock(sfp->sf_mtx); > >>> + } > >>> uma_zfree(selfd_zone, sfp); > >> > >> How do you ensure that the value you read for sf_si here is up to date= ? In > >> particular, if a thread is selecting on multiple fds and one awakens i= t, > >> another fd can invoke selwakeup() while the thread is in seltdclear(). > >> In that case, you might see a stale value of sf_si and not realize it = is > >> cleared by the selwakeup() after you get the lock and you will invoke > >> TAILQ_REMOVE an extra time. > > > > FWIW, I've just hit a panic in selfdfree(). > > > > >=20 >=20 =2D-=20 John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 21:02:41 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17AB27C; Thu, 23 Oct 2014 21:02:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04250C4; Thu, 23 Oct 2014 21:02:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NL2eWA059694; Thu, 23 Oct 2014 21:02:40 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NL2edr059693; Thu, 23 Oct 2014 21:02:40 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201410232102.s9NL2edr059693@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 23 Oct 2014 21:02:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273558 - head/sys/i386/i386 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 21:02:41 -0000 Author: alc Date: Thu Oct 23 21:02:40 2014 New Revision: 273558 URL: https://svnweb.freebsd.org/changeset/base/273558 Log: Under PAE ULONG is insufficient for representing the physical memory size. Use QUAD for "hw.physmem" so that a physical memory size greater than 4 GB can be specified from the boot loader. Modified: head/sys/i386/i386/machdep.c Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Oct 23 20:43:16 2014 (r273557) +++ head/sys/i386/i386/machdep.c Thu Oct 23 21:02:40 2014 (r273558) @@ -2463,10 +2463,10 @@ static void getmemsize(int first) { int has_smap, off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest; + u_long memtest; vm_paddr_t physmap[PHYSMAP_SIZE]; pt_entry_t *pte; - quad_t dcons_addr, dcons_size; + quad_t dcons_addr, dcons_size, physmem_tunable; #ifndef XEN int hasbrokenint12, i, res; u_int extmem; @@ -2650,7 +2650,7 @@ physmap_done: Maxmem = MAXMEM / 4; #endif - if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) + if (TUNABLE_QUAD_FETCH("hw.physmem", &physmem_tunable)) Maxmem = atop(physmem_tunable); /* From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 22:21:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1C91A185; Thu, 23 Oct 2014 22:21:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E2B1DAE0; Thu, 23 Oct 2014 22:21:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMLMBQ098173; Thu, 23 Oct 2014 22:21:22 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMLMvV098172; Thu, 23 Oct 2014 22:21:22 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410232221.s9NMLMvV098172@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 23 Oct 2014 22:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273561 - head/sys/arm/freescale/imx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:21:23 -0000 Author: ian Date: Thu Oct 23 22:21:22 2014 New Revision: 273561 URL: https://svnweb.freebsd.org/changeset/base/273561 Log: Install a temporary workaround to avoid problems in fdt data with linux's workaround for an imx6 chip erratum. Linux works around the bug with changes in fdt data that we can't currently handle, so to enable running with standard vendor-supplied fdt data, this watches for an attempt to map the gpio1_6 interrupt and remaps it back to the standard ethernet interrupt. This can be undone when the intrng project is completed and our gpio drivers can also be interrupt controllers. Modified: head/sys/arm/freescale/imx/imx6_machdep.c Modified: head/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- head/sys/arm/freescale/imx/imx6_machdep.c Thu Oct 23 21:38:54 2014 (r273560) +++ head/sys/arm/freescale/imx/imx6_machdep.c Thu Oct 23 22:21:22 2014 (r273561) @@ -54,8 +54,39 @@ struct fdt_fixup_entry fdt_fixup_table[] { NULL, NULL } }; +static uint32_t gpio1_node; + +/* + * Work around the linux workaround for imx6 erratum 006687, in which some + * ethernet interrupts don't go to the GPC and thus won't wake the system from + * Wait mode. We don't use Wait mode (which halts the GIC, leaving only GPC + * interrupts able to wake the system), so we don't experience the bug at all. + * The linux workaround is to reconfigure GPIO1_6 as the ENET interrupt by + * writing magic values to an undocumented IOMUX register, then letting the gpio + * interrupt driver notify the ethernet driver. We'll be able to do all that + * (even though we don't need to) once the INTRNG project is committed and the + * imx_gpio driver becomes an interrupt driver. Until then, this crazy little + * workaround watches for requests to map an interrupt 6 with the interrupt + * controller node referring to gpio1, and it substitutes the proper ffec + * interrupt number. + */ +static int +imx6_decode_fdt(uint32_t iparent, uint32_t *intr, int *interrupt, + int *trig, int *pol) +{ + + if (fdt32_to_cpu(intr[0]) == 6 && + OF_node_from_xref(iparent) == gpio1_node) { + *interrupt = 150; + *trig = INTR_TRIGGER_CONFORM; + *pol = INTR_POLARITY_CONFORM; + return (0); + } + return (gic_decode_fdt(iparent, intr, interrupt, trig, pol)); +} + fdt_pic_decode_t fdt_pic_table[] = { - &gic_decode_fdt, + &imx6_decode_fdt, NULL }; @@ -84,6 +115,9 @@ void platform_late_init(void) { + /* Cache the gpio1 node handle for imx6_decode_fdt() workaround code. */ + gpio1_node = OF_node_from_xref( + OF_finddevice("/soc/aips-bus@02000000/gpio@0209c000")); } /* From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 22:30:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E70CB533; Thu, 23 Oct 2014 22:30:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CF055B52; Thu, 23 Oct 2014 22:30:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMUIfA099846; Thu, 23 Oct 2014 22:30:18 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMUF54099829; Thu, 23 Oct 2014 22:30:15 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232230.s9NMUF54099829@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 22:30:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273562 - in head/contrib/libxo: . bin build doc libxo m4 packaging tests tests/core tests/core/saved tests/xo tests/xo/saved xo xohtml xohtml/external xolint X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:30:19 -0000 Author: marcel Date: Thu Oct 23 22:30:14 2014 New Revision: 273562 URL: https://svnweb.freebsd.org/changeset/base/273562 Log: Import libxo 0.1.4 Obtained from: https://github.com/Juniper/libxo Sponsored by: Juniper Networks, Inc. Added: head/contrib/libxo/ head/contrib/libxo/.gitignore head/contrib/libxo/.travis.yml head/contrib/libxo/Copyright head/contrib/libxo/LICENSE head/contrib/libxo/Makefile.am (contents, props changed) head/contrib/libxo/README.md head/contrib/libxo/bin/ head/contrib/libxo/bin/Makefile.am (contents, props changed) head/contrib/libxo/bin/Zaliases head/contrib/libxo/bin/setup.sh (contents, props changed) head/contrib/libxo/build/ head/contrib/libxo/build/.create head/contrib/libxo/configure.ac head/contrib/libxo/doc/ head/contrib/libxo/doc/Makefile.am (contents, props changed) head/contrib/libxo/doc/libxo.txt (contents, props changed) head/contrib/libxo/install-sh (contents, props changed) head/contrib/libxo/libxo/ head/contrib/libxo/libxo-config.in (contents, props changed) head/contrib/libxo/libxo/Makefile.am (contents, props changed) head/contrib/libxo/libxo/gen-wide.sh (contents, props changed) head/contrib/libxo/libxo/libxo.3 (contents, props changed) head/contrib/libxo/libxo/libxo.c (contents, props changed) head/contrib/libxo/libxo/xo.h (contents, props changed) head/contrib/libxo/libxo/xo_attr.3 (contents, props changed) head/contrib/libxo/libxo/xo_create.3 (contents, props changed) head/contrib/libxo/libxo/xo_emit.3 (contents, props changed) head/contrib/libxo/libxo/xo_err.3 (contents, props changed) head/contrib/libxo/libxo/xo_finish.3 (contents, props changed) head/contrib/libxo/libxo/xo_flush.3 (contents, props changed) head/contrib/libxo/libxo/xo_format.5 (contents, props changed) head/contrib/libxo/libxo/xo_no_setlocale.3 (contents, props changed) head/contrib/libxo/libxo/xo_open_container.3 (contents, props changed) head/contrib/libxo/libxo/xo_open_list.3 (contents, props changed) head/contrib/libxo/libxo/xo_parse_args.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_allocator.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_flags.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_info.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_options.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_style.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_writer.3 (contents, props changed) head/contrib/libxo/libxo/xoconfig.h.in (contents, props changed) head/contrib/libxo/libxo/xoversion.h.in (contents, props changed) head/contrib/libxo/m4/ head/contrib/libxo/m4/libtool.m4 head/contrib/libxo/m4/ltoptions.m4 head/contrib/libxo/m4/ltsugar.m4 head/contrib/libxo/m4/ltversion.m4 head/contrib/libxo/m4/lt~obsolete.m4 head/contrib/libxo/packaging/ head/contrib/libxo/packaging/libxo.pc.in (contents, props changed) head/contrib/libxo/packaging/libxo.spec.in (contents, props changed) head/contrib/libxo/tests/ head/contrib/libxo/tests/Makefile.am (contents, props changed) head/contrib/libxo/tests/core/ head/contrib/libxo/tests/core/Makefile.am (contents, props changed) head/contrib/libxo/tests/core/saved/ head/contrib/libxo/tests/core/saved/test_01.H.err head/contrib/libxo/tests/core/saved/test_01.H.out head/contrib/libxo/tests/core/saved/test_01.HIPx.err head/contrib/libxo/tests/core/saved/test_01.HIPx.out head/contrib/libxo/tests/core/saved/test_01.HP.err head/contrib/libxo/tests/core/saved/test_01.HP.out head/contrib/libxo/tests/core/saved/test_01.J.err head/contrib/libxo/tests/core/saved/test_01.J.out head/contrib/libxo/tests/core/saved/test_01.JP.err head/contrib/libxo/tests/core/saved/test_01.JP.out head/contrib/libxo/tests/core/saved/test_01.T.err head/contrib/libxo/tests/core/saved/test_01.T.out head/contrib/libxo/tests/core/saved/test_01.X.err head/contrib/libxo/tests/core/saved/test_01.X.out head/contrib/libxo/tests/core/saved/test_01.XP.err head/contrib/libxo/tests/core/saved/test_01.XP.out head/contrib/libxo/tests/core/saved/test_01.err head/contrib/libxo/tests/core/saved/test_01.out head/contrib/libxo/tests/core/saved/test_02.H.err head/contrib/libxo/tests/core/saved/test_02.H.out head/contrib/libxo/tests/core/saved/test_02.HIPx.err head/contrib/libxo/tests/core/saved/test_02.HIPx.out head/contrib/libxo/tests/core/saved/test_02.HP.err head/contrib/libxo/tests/core/saved/test_02.HP.out head/contrib/libxo/tests/core/saved/test_02.J.err head/contrib/libxo/tests/core/saved/test_02.J.out head/contrib/libxo/tests/core/saved/test_02.JP.err head/contrib/libxo/tests/core/saved/test_02.JP.out head/contrib/libxo/tests/core/saved/test_02.T.err head/contrib/libxo/tests/core/saved/test_02.T.out head/contrib/libxo/tests/core/saved/test_02.X.err head/contrib/libxo/tests/core/saved/test_02.X.out head/contrib/libxo/tests/core/saved/test_02.XP.err head/contrib/libxo/tests/core/saved/test_02.XP.out head/contrib/libxo/tests/core/saved/test_02.err head/contrib/libxo/tests/core/saved/test_02.out head/contrib/libxo/tests/core/saved/test_03.H.err head/contrib/libxo/tests/core/saved/test_03.H.out head/contrib/libxo/tests/core/saved/test_03.HIPx.err head/contrib/libxo/tests/core/saved/test_03.HIPx.out head/contrib/libxo/tests/core/saved/test_03.HP.err head/contrib/libxo/tests/core/saved/test_03.HP.out head/contrib/libxo/tests/core/saved/test_03.J.err head/contrib/libxo/tests/core/saved/test_03.J.out head/contrib/libxo/tests/core/saved/test_03.JP.err head/contrib/libxo/tests/core/saved/test_03.JP.out head/contrib/libxo/tests/core/saved/test_03.T.err head/contrib/libxo/tests/core/saved/test_03.T.out head/contrib/libxo/tests/core/saved/test_03.X.err head/contrib/libxo/tests/core/saved/test_03.X.out head/contrib/libxo/tests/core/saved/test_03.XP.err head/contrib/libxo/tests/core/saved/test_03.XP.out head/contrib/libxo/tests/core/saved/test_03.err head/contrib/libxo/tests/core/saved/test_03.out head/contrib/libxo/tests/core/saved/test_04.H.err head/contrib/libxo/tests/core/saved/test_04.H.out head/contrib/libxo/tests/core/saved/test_04.HIPx.err head/contrib/libxo/tests/core/saved/test_04.HIPx.out head/contrib/libxo/tests/core/saved/test_04.HP.err head/contrib/libxo/tests/core/saved/test_04.HP.out head/contrib/libxo/tests/core/saved/test_04.J.err head/contrib/libxo/tests/core/saved/test_04.J.out head/contrib/libxo/tests/core/saved/test_04.JP.err head/contrib/libxo/tests/core/saved/test_04.JP.out head/contrib/libxo/tests/core/saved/test_04.T.err head/contrib/libxo/tests/core/saved/test_04.T.out head/contrib/libxo/tests/core/saved/test_04.X.err head/contrib/libxo/tests/core/saved/test_04.X.out head/contrib/libxo/tests/core/saved/test_04.XP.err head/contrib/libxo/tests/core/saved/test_04.XP.out head/contrib/libxo/tests/core/saved/test_05.H.err head/contrib/libxo/tests/core/saved/test_05.H.out head/contrib/libxo/tests/core/saved/test_05.HIPx.err head/contrib/libxo/tests/core/saved/test_05.HIPx.out head/contrib/libxo/tests/core/saved/test_05.HP.err head/contrib/libxo/tests/core/saved/test_05.HP.out head/contrib/libxo/tests/core/saved/test_05.J.err head/contrib/libxo/tests/core/saved/test_05.J.out (contents, props changed) head/contrib/libxo/tests/core/saved/test_05.JP.err head/contrib/libxo/tests/core/saved/test_05.JP.out head/contrib/libxo/tests/core/saved/test_05.T.err head/contrib/libxo/tests/core/saved/test_05.T.out (contents, props changed) head/contrib/libxo/tests/core/saved/test_05.X.err head/contrib/libxo/tests/core/saved/test_05.X.out head/contrib/libxo/tests/core/saved/test_05.XP.err head/contrib/libxo/tests/core/saved/test_05.XP.out head/contrib/libxo/tests/core/saved/test_06.H.err head/contrib/libxo/tests/core/saved/test_06.H.out head/contrib/libxo/tests/core/saved/test_06.HIPx.err head/contrib/libxo/tests/core/saved/test_06.HIPx.out head/contrib/libxo/tests/core/saved/test_06.HP.err head/contrib/libxo/tests/core/saved/test_06.HP.out head/contrib/libxo/tests/core/saved/test_06.J.err head/contrib/libxo/tests/core/saved/test_06.J.out head/contrib/libxo/tests/core/saved/test_06.JP.err head/contrib/libxo/tests/core/saved/test_06.JP.out head/contrib/libxo/tests/core/saved/test_06.T.err head/contrib/libxo/tests/core/saved/test_06.T.out head/contrib/libxo/tests/core/saved/test_06.X.err head/contrib/libxo/tests/core/saved/test_06.X.out head/contrib/libxo/tests/core/saved/test_06.XP.err head/contrib/libxo/tests/core/saved/test_06.XP.out head/contrib/libxo/tests/core/saved/test_07.H.err head/contrib/libxo/tests/core/saved/test_07.H.out head/contrib/libxo/tests/core/saved/test_07.HIPx.err head/contrib/libxo/tests/core/saved/test_07.HIPx.out head/contrib/libxo/tests/core/saved/test_07.HP.err head/contrib/libxo/tests/core/saved/test_07.HP.out head/contrib/libxo/tests/core/saved/test_07.J.err head/contrib/libxo/tests/core/saved/test_07.J.out head/contrib/libxo/tests/core/saved/test_07.JP.err head/contrib/libxo/tests/core/saved/test_07.JP.out head/contrib/libxo/tests/core/saved/test_07.T.err head/contrib/libxo/tests/core/saved/test_07.T.out (contents, props changed) head/contrib/libxo/tests/core/saved/test_07.X.err head/contrib/libxo/tests/core/saved/test_07.X.out head/contrib/libxo/tests/core/saved/test_07.XP.err head/contrib/libxo/tests/core/saved/test_07.XP.out head/contrib/libxo/tests/core/test_01.c (contents, props changed) head/contrib/libxo/tests/core/test_02.c (contents, props changed) head/contrib/libxo/tests/core/test_03.c (contents, props changed) head/contrib/libxo/tests/core/test_04.c (contents, props changed) head/contrib/libxo/tests/core/test_05.c (contents, props changed) head/contrib/libxo/tests/core/test_06.c (contents, props changed) head/contrib/libxo/tests/core/test_07.c (contents, props changed) head/contrib/libxo/tests/xo/ head/contrib/libxo/tests/xo/Makefile.am (contents, props changed) head/contrib/libxo/tests/xo/saved/ head/contrib/libxo/tests/xo/saved/xo_01.H.err head/contrib/libxo/tests/xo/saved/xo_01.H.out head/contrib/libxo/tests/xo/saved/xo_01.HIPx.err head/contrib/libxo/tests/xo/saved/xo_01.HIPx.out head/contrib/libxo/tests/xo/saved/xo_01.HP.err head/contrib/libxo/tests/xo/saved/xo_01.HP.out head/contrib/libxo/tests/xo/saved/xo_01.J.err head/contrib/libxo/tests/xo/saved/xo_01.J.out head/contrib/libxo/tests/xo/saved/xo_01.JP.err head/contrib/libxo/tests/xo/saved/xo_01.JP.out head/contrib/libxo/tests/xo/saved/xo_01.T.err head/contrib/libxo/tests/xo/saved/xo_01.T.out head/contrib/libxo/tests/xo/saved/xo_01.X.err head/contrib/libxo/tests/xo/saved/xo_01.X.out head/contrib/libxo/tests/xo/saved/xo_01.XP.err head/contrib/libxo/tests/xo/saved/xo_01.XP.out head/contrib/libxo/tests/xo/xo_01.sh (contents, props changed) head/contrib/libxo/warnings.mk (contents, props changed) head/contrib/libxo/xo/ head/contrib/libxo/xo/Makefile.am (contents, props changed) head/contrib/libxo/xo/xo.1 (contents, props changed) head/contrib/libxo/xo/xo.c (contents, props changed) head/contrib/libxo/xohtml/ head/contrib/libxo/xohtml/external/ head/contrib/libxo/xohtml/external/jquery.js head/contrib/libxo/xohtml/external/jquery.qtip.css (contents, props changed) head/contrib/libxo/xohtml/external/jquery.qtip.js head/contrib/libxo/xohtml/xohtml.css (contents, props changed) head/contrib/libxo/xohtml/xohtml.js head/contrib/libxo/xohtml/xohtml.sh.in (contents, props changed) head/contrib/libxo/xolint/ head/contrib/libxo/xolint/Makefile.am (contents, props changed) head/contrib/libxo/xolint/xolint.1 (contents, props changed) head/contrib/libxo/xolint/xolint.pl (contents, props changed) Added: head/contrib/libxo/.gitignore ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/.gitignore Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,43 @@ +# Object files +*.o + +# Libraries +*.lib +*.a + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.app + +*~ +*.orig + +aclocal.m4 +ar-lib +autom4te.cache +build +compile +config.guess +config.h.in +config.sub +depcomp +ltmain.sh +missing + +Makefile.in +configure +.DS_Store + +xoconfig.h.in + +.gdbinit +.gdbinit.local +xtest +xtest.dSYM +tests/w Added: head/contrib/libxo/.travis.yml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/.travis.yml Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,12 @@ +language: c + +script: printenv && uname -a && /bin/sh ./bin/setup.sh && cd build && ../configure --enable-warnings && make && sudo make install && make test + +notifications: + recipients: + - libslax-noise@googlegroups.com + +branches: + only: + - master + - develop Added: head/contrib/libxo/Copyright ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/Copyright Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,23 @@ +Copyright (c) 2014 Juniper Networks, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. Added: head/contrib/libxo/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/LICENSE Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,23 @@ +Copyright (c) 2014, Juniper Networks +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: head/contrib/libxo/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/Makefile.am Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,102 @@ +# +# $Id$ +# +# Copyright 2014, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = libxo xo xolint tests doc +bin_SCRIPTS=libxo-config +dist_doc_DATA = Copyright + +EXTRA_DIST = \ + libxo-config.in \ + warnings.mk \ + README.md \ + INSTALL.md \ + packaging/libxo.spec + +.PHONY: test tests + +test tests: + @(cd tests ; ${MAKE} test) + +errors: + @(cd tests/errors ; ${MAKE} test) + +docs: + @(cd doc ; ${MAKE} docs) + + +DIST_FILES_DIR = ~/Dropbox/dist-files/ +GH_PAGES_DIR = gh-pages/ +PACKAGE_FILE = ${PACKAGE_TARNAME}-${PACKAGE_VERSION}.tar.gz + +upload: dist upload-docs + @echo "Remember to run:" + @echo " gt tag ${PACKAGE_VERSION}" + +upload-docs: docs + @echo "Uploading libxo-manual.html ... " + @-[ -d ${GH_PAGES_DIR} ] \ + && echo "Updating manual on gh-pages ..." \ + && cp doc/libxo-manual.html ${GH_PAGES_DIR} \ + && (cd ${GH_PAGES_DIR} \ + && git commit -m 'new docs' \ + libxo-manual.html \ + && git push origin gh-pages ) ; true + +pkgconfigdir=$(libdir)/pkgconfig +pkgconfig_DATA = packaging/${PACKAGE_NAME}.pc + +get-wiki: + git clone https://github.com/Juniper/${PACKAGE_NAME}.wiki.git wiki + +get-gh-pages: + git clone https://github.com/Juniper/${PACKAGE_NAME}.git \ + gh-pages -b gh-pages + +UPDATE_PACKAGE_FILE = \ + -e "s;__SHA1__;$$SHA1;" \ + -e "s;__SHA256__;SHA256 (textproc/${PACKAGE_FILE}) = $$SHA256;" \ + -e "s;__SIZE__;SIZE (textproc/${PACKAGE_FILE}) = $$SIZE;" + +GH_PACKAGING_DIR = packaging/${PACKAGE_VERSION} +GH_PAGES_PACKAGE_DIR = ${GH_PAGES_DIR}/${GH_PACKAGING_DIR} + +packages: + @-[ -d ${GH_PAGES_DIR} ] && set -x \ + && echo "Updating packages on gh-pages ..." \ + && SHA1="`openssl sha1 ${PACKAGE_FILE} | awk '{print $$2}'`" \ + && SHA256="`openssl sha256 ${PACKAGE_FILE} | awk '{print $$2}'`" \ + && SIZE="`ls -l ${PACKAGE_FILE} | awk '{print $$5}'`" \ + && mkdir -p ${GH_PAGES_PACKAGE_DIR}/freebsd \ + && echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb ..." \ + && sed ${UPDATE_PACKAGE_FILE} \ + packaging/${PACKAGE_NAME}.rb.base \ + > ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.rb \ + && echo "... ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec ..." \ + && cp packaging/${PACKAGE_NAME}.spec \ + ${GH_PAGES_PACKAGE_DIR}/${PACKAGE_NAME}.spec \ + && echo "... ${GH_PAGES_PACKAGE_DIR}/freebsd ..." \ + && sed ${UPDATE_PACKAGE_FILE} \ + ${srcdir}/packaging/freebsd/distinfo.base \ + > ${GH_PAGES_PACKAGE_DIR}/freebsd/distinfo \ + && cp ${srcdir}/packaging/freebsd/pkg-descr \ + ${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-descr \ + && cp ${srcdir}/packaging/freebsd/pkg-plist \ + ${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-plist \ + && cp ${srcdir}/packaging/freebsd/pkg-plist \ + ${GH_PAGES_PACKAGE_DIR}/freebsd/pkg-plist \ + && cp packaging/freebsd/port-Makefile \ + ${GH_PAGES_PACKAGE_DIR}/freebsd/Makefile \ + && (cd ${GH_PAGES_DIR} \ + && git add ${GH_PACKAGING_DIR} \ + && git commit -m 'new packaging data' \ + ${GH_PACKAGING_DIR} \ + && git push origin gh-pages ) ; true Added: head/contrib/libxo/README.md ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/README.md Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,62 @@ +libxo +===== + +libxo - A Library for Generating Text, XML, JSON, and HTML Output + +The libxo library allows an application to generate text, XML, JSON, +and HTML output using a common set of function calls. The application +decides at run time which output style should be produced. The +application calls a function "xo_emit" to product output that is +described in a format string. A "field descriptor" tells libxo what +the field is and what it means. + +``` + xo_emit(" {:lines/%7ju/%ju} {:words/%7ju/%ju} " + "{:characters/%7ju/%ju}{d:filename/%s}\n", + linect, wordct, charct, file); +``` + +Output can then be generated in various style, using the "--libxo" +option: + +``` + % wc /etc/motd + 25 165 1140 /etc/motd + % wc --libxo xml,pretty,warn /etc/motd + + + /etc/motd + 25 + 165 + 1140 + + + % wc --libxo json,pretty,warn /etc/motd + { + "wc": { + "file": [ + { + "filename": "/etc/motd", + "lines": 25, + "words": 165, + "characters": 1140 + } + ] + } + } + % wc --libxo html,pretty,warn /etc/motd +
+
+
25
+
+
165
+
+
1140
+
+
/etc/motd
+
+``` + +View the beautiful documentation at: + +http://juniper.github.io/libxo/libxo-manual.html Added: head/contrib/libxo/bin/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/bin/Makefile.am Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,29 @@ +# +# Copyright 2013, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + +ACLOCAL_AMFLAGS = -I m4 + +EXTRA_DIST = gt setup.sh + +GT_INSTALL_DIR = ${prefix}/bin +GT_INSTALL_FILES = gt + +install-data-hook: + @echo "Installing gt ... " + @-mkdir -p ${GT_INSTALL_DIR} + @for file in ${GT_INSTALL_FILES} ; do \ + if [ -f $$file ]; then \ + rfile=$$file ; \ + else \ + rfile=${srcdir}/$$file ; \ + fi ; \ + mdir=${GT_INSTALL_DIR}/ ; \ + mkdir -p $$mdir ; \ + cp $$rfile $$mdir/ ; \ + done + @${CHMOD} a+x ${GT_INSTALL_DIR}/gt Added: head/contrib/libxo/bin/Zaliases ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/bin/Zaliases Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,24 @@ +set top_src=`pwd` +alias Zautoreconf "(cd $top_src ; autoreconf --install)" + +set opts=' \ +--with-libslax-prefix=/Users/phil/work/root \ +--enable-debug \ +--enable-warnings \ +--enable-printflike \ +--prefix ${HOME}/work/root \ +' +set opts=`echo $opts` + +setenv CONFIGURE_OPTS "$opts" +setenv ADB_PATH $top_src/build/libxo/.libs + +alias Zconfigure "(cd $top_src/build; ../configure $opts)" +alias Zbuild "(cd $top_src/build; make \!* )" +alias mi "(cd $top_src/build; make && make install); ." + +mkdir -p build +cd build + + +alias xx 'cc -I.. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Werror -Waggregate-return -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wformat -Wimplicit -Wmissing-declarations -Wnested-externs -Wparentheses -Wreturn-type -Wshadow -Wswitch -Wtrigraphs -Wuninitialized -Wunused -Wwrite-strings -fno-inline-functions-called-once -g -O2 -o xtest -DUNIT_TEST libxo.c' Added: head/contrib/libxo/bin/setup.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/bin/setup.sh Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,31 @@ +# +# Copyright 2013, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + + +if [ ! -f configure ]; then + vers=`autoreconf --version | head -1` + echo "Using" $vers + + autoreconf --install + + if [ ! -f configure ]; then + echo "Failed to create configure script" + exit 1 + fi +fi + +echo "Creating build directory ..." +mkdir build + +echo "Setup is complete. To build libslax:" + +echo " 1) Type 'cd build ; ../configure' to configure libslax" +echo " 2) Type 'make' to build libslax" +echo " 3) Type 'make install' to install libslax" + +exit 0 Added: head/contrib/libxo/build/.create ============================================================================== Added: head/contrib/libxo/configure.ac ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/configure.ac Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,263 @@ +# +# $Id$ +# +# See ./INSTALL for more info +# + +# +# Release numbering: even numbered dot releases are official ones, and +# odd numbers are development ones. The svn version of this file will +# only (ONLY!) ever (EVER!) contain odd numbers, so I'll always know if +# a particular user has the dist or svn release. +# + +AC_PREREQ(2.2) +AC_INIT([libxo], [0.1.4], [phil@juniper.net]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability]) + +# Support silent build rules. Requires at least automake-1.11. +# Disable with "configure --disable-silent-rules" or "make V=1" +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +AC_PROG_CC +AM_PROG_AR +AC_PROG_INSTALL +AC_CONFIG_MACRO_DIR([m4]) +AC_PROG_LN_S + +# Must be after AC_PROG_AR +LT_INIT([dlopen shared]) + +AC_PATH_PROG(BASENAME, basename, /usr/bin/basename) +AC_PATH_PROG(BISON, bison, /usr/bin/bison) +AC_PATH_PROG(CAT, cat, /bin/cat) +AC_PATH_PROG(CHMOD, chmod, /bin/chmod) +AC_PATH_PROG(CP, cp, /bin/cp) +AC_PATH_PROG(DIFF, diff, /usr/bin/diff) +AC_PATH_PROG(MKDIR, mkdir, /bin/mkdir) +AC_PATH_PROG(MV, mv, /bin/mv) +AC_PATH_PROG(RM, rm, /bin/rm) +AC_PATH_PROG(SED, sed, /bin/sed) + +AC_STDC_HEADERS + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_INLINE +AC_TYPE_SIZE_T + +# Checks for library functions. +AC_FUNC_ALLOCA +AC_FUNC_MALLOC +AC_FUNC_REALLOC +AC_CHECK_FUNCS([bzero memmove strchr strcspn strerror strspn]) +AC_CHECK_FUNCS([sranddev srand strlcpy]) +AC_CHECK_FUNCS([fdopen getrusage]) +AC_CHECK_FUNCS([gettimeofday ctime]) +AC_CHECK_FUNCS([getpass]) +AC_CHECK_FUNCS([sysctlbyname]) +AC_CHECK_FUNCS([flock]) +AC_CHECK_FUNCS([asprintf]) + +AC_CHECK_HEADERS([dlfcn.h]) +AC_CHECK_HEADERS([tzfile.h]) +AC_CHECK_HEADERS([stdtime/tzfile.h]) +AC_CHECK_FUNCS([dlfunc]) + +AC_CHECK_HEADERS([sys/time.h]) +AC_CHECK_HEADERS([ctype.h errno.h stdio.h stdlib.h]) +AC_CHECK_HEADERS([string.h sys/param.h unistd.h ]) +AC_CHECK_HEADERS([sys/sysctl.h]) + +AC_CHECK_LIB([crypto], [MD5_Init]) +AM_CONDITIONAL([HAVE_LIBCRYPTO], [test "$HAVE_LIBCRYPTO" != "no"]) + +dnl +dnl Some packages need to be checked against version numbers so we +dnl define a function here for later use +dnl +AC_DEFUN([VERSION_TO_NUMBER], +[`$1 | sed -e 's/lib.* //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`]) + +LIBSLAX_CONFIG_PREFIX="" +LIBSLAX_SRC="" + +AC_ARG_WITH(libslax-prefix, + [ --with-libslax-prefix=[PFX] Specify location of libslax config], + LIBSLAX_CONFIG_PREFIX=$withval +) + +AC_MSG_CHECKING(for libslax) +if test "x$LIBSLAX_CONFIG_PREFIX" != "x" +then + SLAX_CONFIG=${LIBSLAX_CONFIG_PREFIX}/bin/slax-config +else + SLAX_CONFIG=slax-config +fi + +dnl +dnl make sure slax-config is executable, +dnl test version and init our variables +dnl + +if ${SLAX_CONFIG} --libs > /dev/null 2>&1 +then + LIBSLAX_VERSION=`$SLAX_CONFIG --version` + SLAX_BINDIR="`$SLAX_CONFIG --bindir | head -1`" + SLAX_OXTRADOCDIR="`$SLAX_CONFIG --oxtradoc | head -1`" + AC_MSG_RESULT($LIBSLAX_VERSION found) +else + LIBSLAX_VERSION= + SLAX_BINDIR= + SLAX_OXTRADOCDIR= + AC_MSG_RESULT([no]) +fi + +AC_SUBST(SLAX_BINDIR) +AC_SUBST(SLAX_OXTRADOCDIR) + +AC_MSG_CHECKING([whether to build with warnings]) +AC_ARG_ENABLE([warnings], + [ --enable-warnings Turn on compiler warnings], + [LIBXO_WARNINGS=$enableval], + [LIBXO_WARNINGS=no]) +AC_MSG_RESULT([$LIBXO_WARNINGS]) +AM_CONDITIONAL([LIBXO_WARNINGS_HIGH], [test "$LIBXO_WARNINGS" != "no"]) + +AC_MSG_CHECKING([whether to build with debugging]) +AC_ARG_ENABLE([debug], + [ --enable-debug Turn on debugging], + [LIBXO_DEBUG=yes; AC_DEFINE([LIBXO_DEBUG], [1], [Enable debugging])], + [LIBXO_DEBUG=no]) +AC_MSG_RESULT([$LIBXO_DEBUG]) +AM_CONDITIONAL([LIBXO_DEBUG], [test "$LIBXO_DEBUG" != "no"]) + +AC_CHECK_LIB([m], [lrint]) +AM_CONDITIONAL([HAVE_LIBM], [test "$HAVE_LIBM" != "no"]) + +AC_MSG_CHECKING([compiler for gcc]) +HAVE_GCC=no +if test "${CC}" != ""; then + HAVE_GCC=`${CC} --version 2>&1 | grep GCC` + if test "${HAVE_GCC}" != ""; then + HAVE_GCC=yes + else + HAVE_GCC=no + fi +fi +AC_MSG_RESULT([$HAVE_GCC]) +AM_CONDITIONAL([HAVE_GCC], [test "$HAVE_GCC" = "yes"]) + +AC_MSG_CHECKING([whether to build with printflike]) +AC_ARG_ENABLE([printflike], + [ --enable-printflike Enable use of GCC __printflike attribute], + [HAVE_PRINTFLIKE=yes; + AC_DEFINE([HAVE_PRINTFLIKE], [1], [Support printflike])], + [HAVE_PRINTFLIKE=no]) +AC_MSG_RESULT([$HAVE_PRINTFLIKE]) +AM_CONDITIONAL([HAVE_PRINTFLIKE], [test "$HAVE_PRINTFLIKE" != ""]) + +AC_MSG_CHECKING([whether to build with LIBXO_OPTIONS]) +AC_ARG_ENABLE([libxo-options], + [ --disable-libxo-options Turn off support for LIBXO_OPTIONS], + [LIBXO_OPTS=$enableval], + [LIBXO_OPTS=yes]) +AC_MSG_RESULT([$LIBXO_OPTS]) +AM_CONDITIONAL([NO_LIBXO_OPTIONS], [test "$LIBXO_OPTS" != "yes"]) + + +case $host_os in + darwin*) + LIBTOOL=glibtool + ;; + Linux*|linux*) + CFLAGS="-D_GNU_SOURCE $CFLAGS" + LDFLAGS=-ldl + ;; + cygwin*|CYGWIN*) + LDFLAGS=-no-undefined + ;; +esac + +case $prefix in + NONE) + prefix=/usr/local + ;; +esac + +XO_LIBS=-lxo +XO_SRCDIR=${srcdir} +XO_LIBDIR=${libdir} +XO_BINDIR=${bindir} +XO_INCLUDEDIR=${includedir} + +AC_SUBST(XO_SRCDIR) +AC_SUBST(XO_LIBDIR) +AC_SUBST(XO_BINDIR) +AC_SUBST(XO_INCLUDEDIR) + +AC_ARG_WITH(share-dir, + [ --with-share-dir=[DIR] Specify location of shared files], + [XO_SHAREDIR=$withval], + [XO_SHAREDIR=$datarootdir/libxo] +) +XO_SHAREDIR=`echo $XO_SHAREDIR | sed "s;\\${prefix};$prefix;"` +AC_SUBST(XO_SHAREDIR) + +dnl for the spec file +RELDATE=`date +'%Y-%m-%d%n'` +AC_SUBST(RELDATE) + +AC_MSG_RESULT(Using configure dir $ac_abs_confdir) + +if test -d $ac_abs_confdir/.git ; then + extra=`git branch | awk '/\*/ { print $2 }'` + if test "$extra" != "" -a "$extra" != "master" + then + LIBXO_VERSION_EXTRA="-git-$extra" + fi +fi + +LIBXO_VERSION=$PACKAGE_VERSION +LIBXO_VERSION_NUMBER=VERSION_TO_NUMBER(echo $PACKAGE_VERSION) +AC_SUBST(LIBXO_VERSION) +AC_SUBST(LIBXO_VERSION_NUMBER) +AC_SUBST(LIBXO_VERSION_EXTRA) + +AC_CONFIG_HEADERS([libxo/xoconfig.h]) +AC_CONFIG_FILES([ + Makefile + libxo-config + xohtml/xohtml.sh + libxo/Makefile + libxo/xoversion.h + xo/Makefile + xolint/Makefile + packaging/libxo.pc + doc/Makefile + tests/Makefile + tests/core/Makefile + tests/xo/Makefile + packaging/libxo.spec +]) +AC_OUTPUT + +AC_MSG_NOTICE([summary of build options: + + libxo version: ${VERSION} ${LIBXO_VERSION_EXTRA} + host type: ${host} / ${host_os} + install prefix: ${prefix} + srcdir: ${XO_SRCDIR} + libdir: ${XO_LIBDIR} + bindir: ${XO_BINDIR} + includedir: ${XO_INCLUDEDIR} + share dir: ${XO_SHAREDIR} + + compiler: ${CC} (${HAVE_GCC:-no}) + compiler flags: ${CFLAGS} + library types: Shared=${enable_shared}, Static=${enable_static} + + warnings: ${LIBXO_WARNINGS:-no} + debug: ${LIBXO_DEBUG:-no} + printf-like: ${HAVE_PRINTFLIKE:-no} + libxo-options: ${LIBXO_OPTS:-no} +]) Added: head/contrib/libxo/doc/Makefile.am ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/doc/Makefile.am Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,65 @@ +# +# $Id$ +# +# Copyright 2014, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or otherwise +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. + +OXTRADOC_DIR = ${SLAX_OXTRADOCDIR} +OXTRADOC_PREFIX = ${OXTRADOC_DIR} +OXTRADOC = ${OXTRADOC_DIR}/oxtradoc +SLAXPROC_BINDIR = ${SLAX_BINDIR} + +XML2RFC = ${OXTRADOC_DIR}/xml2rfc.tcl +XML2HTMLDIR = ${OXTRADOC_DIR} +XML2HTMLBIN = ${XML2HTMLDIR}/rfc2629-to-html.slax +SLAXPROC = ${SLAX_BINDIR}/slaxproc + +SLAXPROC_ARGS = \ + -a oxtradoc-dir ${OXTRADOC_DIR} \ + -a oxtradoc-install-dir ${OXTRADOC_DIR} \ + -a anchor-prefix docs + +SLAXPROC_ARGS_INLINE = \ + -a oxtradoc-inline yes + +SLAXPROC_ARGS += ${SLAXPROC_ARGS_INLINE} + +XML2HTML = \ + ${SLAXPROC} -g -e -I ${OXTRADOC_DIR} -I . \ + ${SLAXPROC_ARGS} \ + ${XML2HTMLBIN} + +OX_ARGS = -P ${OXTRADOC_PREFIX} -L ${OXTRADOC_PREFIX} +OX_ARGS += -S ${SLAXPROC} -p doc +OX_CMD = ${PERL} ${PERLOPTS} ${OXTRADOC} ${OX_ARGS} +OXTRADOC_CMD = ${OX_CMD} + + +OUTPUT = libxo-manual +INPUT = libxo.txt + +EXTRA_DIST = \ + ${INPUT} \ + ${OUTPUT}.html \ + ${OUTPUT}.txt + +doc docs: ${OUTPUT}.txt ${OUTPUT}.html + +${OUTPUT}.txt: ${INPUT} ${OXTRADOC} xolint.txt + ${OXTRADOC_CMD} -m text -o $@ $< + +${OUTPUT}.html: ${INPUT} ${OXTRADOC} ${XML2HTMLBIN} xolint.txt + ${OXTRADOC_CMD} -m html -o $@ $< + +xolint.txt: ${top_srcdir}/xolint/xolint.pl + perl ${top_srcdir}/xolint/xolint.pl -D > xolint.txt + +CLEANFILES = \ +${OUTPUT}.xml \ +${OUTPUT}.txt \ +${OUTPUT}.fxml \ +${OUTPUT}.html Added: head/contrib/libxo/doc/libxo.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/doc/libxo.txt Thu Oct 23 22:30:14 2014 (r273562) @@ -0,0 +1,2400 @@ +# +# Copyright (c) 2014, Juniper Networks, Inc. +# All rights reserved. +# This SOFTWARE is licensed under the LICENSE provided in the +# ../Copyright file. By downloading, installing, copying, or +# using the SOFTWARE, you agree to be bound by the terms of that +# LICENSE. +# Phil Shafer, July 2014 +# + +* libxo + +libxo - A Library for Generating Text, XML, JSON, and HTML Output + +You live in the present, but you want to live in the future. You'd +love a flying car, but need to get to work today. You want to support +features like XML, JSON, and HTML rendering to allow integration with +NETCONF, REST, and web browsers, but you need to make text output for +command line users. And you don't want multiple code paths that can't +help but get out of sync. None of this "if (xml) {... } else {...}" +logic. And ifdefs are right out. But you'd really, really like all +the fancy features that modern encoding formats can provide. + +The libxo library allows an application to generate text, XML, JSON, +and HTML output using a common set of function calls. The application +decides at run time which output style should be produced. The +application calls a function "xo_emit" to product output that is +described in a format string. A "field descriptor" tells libxo what +the field is and what it means. Each field descriptor is placed in +braces with a printf-like format string: + + xo_emit(" {:lines/%7ju} {:words/%7ju} " + "{:characters/%7ju}{d:filename/%s}\n", + linect, wordct, charct, file); + +Each field can have a role, with the 'value' role being the default, +and the role tells libxo how and when to render that field. Output +can then be generated in various style, using the "--libxo" option: + + % wc /etc/motd + 25 165 1140 /etc/motd + % wc --libxo xml,pretty,warn /etc/motd + + + /etc/motd + 25 + 165 + 1140 + + + % wc --libxo json,pretty,warn /etc/motd + { + "wc": { + "file": [ + { + "filename": "/etc/motd", + "lines": 25, + "words": 165, + "characters": 1140 + } + ] + } + } + % wc --libxo html,pretty,warn /etc/motd +
+
+
25
+
+
165
+
+
1140
+
+
/etc/motd
+
+ +** Getting libxo + +libxo lives on github as: + + https://github.com/Juniper/libxo + +The latest release of libxo is available at: + + https://github.com/Juniper/libxo/releases + +We are following the branching scheme from +^http://nvie.com/posts/a-successful-git-branching-model/^ +which means we will do development under the "develop" branch, and +release from the master. To clone a developer tree, run the following +command: + + git clone https://github.com/Juniper/libxo.git -b develop + +We're using semantic release numbering. + +* Overview + +Most unix commands emit text output aimed at humans. It is designed +to be parsed and understood by a user. Humans are gifted at extracted +details and pattern matching. Often programmers need to extract +information from this human-oriented output. Programmers use tools +like grep, awk, and regular expressions to ferret out the pieces of +information they need. Such solutions are fragile and require +updates when output contents change or evolve, requiring testing and +validation. + +Modern tool developers favors encoding schemes like XML and JSON, +which allow trivial parsing and extraction of data. Such formats are +simple, well understood, hierarchical, easily parsed, and often +integrate easier with common tools and environments. + +In addition, modern reality means that more output ends up in web +browsers than in terminals, making HTML output valuable. + +libxo allows a single set of function calls in source code to generate +traditional text output, as well as XML and JSON formatted data. HTML +can also be generated; "
" elements surround the traditional text +output, with attributes that detail how to render the data. + +A single libxo function call in source code is all that's required: + + xo_emit("Connecting to {:host}.{:domain}...\n", host, domain); + + Text: + Connection to my-box.example.com... + XML: + my-box + example.com + JSON: + "host": my-box", + "domain": "example.com" + +For brevity, the HTML output is emitted. + +** Encoding Styles + +There are four encoding styles supported by libxo: TEXT, HTML, JSON, +and XML. JSON and XML are suitable for encoding data, while TEXT and +HTML are suited for display to the user. TEXT output can be display +on a terminal session, allowing compatibility with traditional usage. +HTML can be matched with a small CSS file to permit rendering in any +HTML5 browser. XML output is suitable for tools like XPath and +protocols like NETCONF. JSON output can be used for RESTful APIs. + +*** Text Output + +Most traditional programs generate text output on standard output, +with contents like: + + 36 ./src + 40 ./bin + 90 . + +In this example (taken from du source code), the code to generate this +data might look like: + + printf("%d\t%s\n", num_blocks, path); + +Simple, direct, obvious. But it's only making text output. Imagine +using a single code path to make text, XML, JSON or HTML, deciding at +run time which to generate. + +libxo expands on the idea of printf format strings to make a single +format containing instructions for creating multiple output styles: + + xo_emit("{:blocks/%d}\t{:path/%s}\n", num_blocks, path); + +This line will generate the same text output as the earlier printf +call, but also has enough information to generate XML, JSON, and HTML. + +The following sections introduce the other formats. + +*** XML Output + +XML output consists of a hierarchical set of elements, each encoded +with a start tag and an end tag. The element should be named for data +value that it is encoding: + + + 36 + ./src + + + 40 + ./bin + + + 90 + . + + +XML is a W3C standard for encoding data. See w3c.org/TR/xml for +additional information. + +*** JSON Output + +JSON output consists of a hierarchical set of objects and lists, each +encoded with a quoted name, a colon, and a value. If the value is a +string, it must be quoted, but numbers are not quoted. Objects are +encoded using braces; lists are encoded using square brackets. +Data inside objects and lists is separated using commas: + + items: [ + { "blocks": 36, "path" : "./src" }, + { "blocks": 40, "path" : "./bin" }, + { "blocks": 90, "path" : "./" } + ] + +*** HTML Output + +HTML output is designed to allow the output to be rendered in a web +browser with minimal effort. Each piece of output data is rendered +inside a
element, with a class name related to the role of the +data. By using a small set of class attribute values, a CSS +stylesheet can render the HTML into rich text that mirrors the +traditional text content. + +Additional attributes can be enabled to provide more details about the +data, including data type, description, and an XPath location. + +
+
36
+
+
./src
+
+
+
40
+
+
./bin
+
+
+
90
+
+
./
+
+ +** Format Strings @format-strings@ + +libxo uses format strings to control the rendering of data into the +various output styles. Each format string contains a set of zero or +more field descriptions, which describe independent data fields. Each +field description contains a set of modifiers, a content string, and +zero, one, or two format descriptors. The modifiers tell libxo what +the field is and how to treat it, while the format descriptors are +formatting instructions using printf-style format strings, telling +libxo how to format the field. The field description is placed inside +a set of braces, with a colon (":") after the modifiers and a slash +("/") before each format descriptors. Text may be intermixed with +field descriptions within the format string. + +The field description is given as follows: + + '{' [ role | modifier ]* ':' [ content ] + [ '/' field-format [ '/' encoding-format ]] '}' + +The role describes the function of the field, while the modifiers +enable optional behaviors. The contents, field-format, and +encoding-format are used in varying ways, based on the role. These +are described in the following sections. + +In the following example, three field descriptors appear. The first +is a padding field containing three spaces of padding, the second is a +label ("In stock"), and the third is a value field ("in-stock"). The +in-stock field has a "%u" format that will parse the next argument +passed to the xo_emit function as an unsigned integer. + + xo_emit("{P: }{Lwc:In stock}{:in-stock/%u}\n", 65); + +This single line of code can generate text (" In stock: 65\n"), XML +("65"), JSON ('"in-stock": 6'), or HTML (too +lengthy to be listed here). + +*** Modifier Roles + +Modifiers are optional, and indicate the role and formatting of the +content. The roles are listed below; only one role is permitted: + +|---+--------------+-------------------------------------------------| +| M | Name | Description | +|---+--------------+-------------------------------------------------| +| D | decoration | Field is non-text (e.g. colon, comma) | +| E | error | Field is an error message | +| L | label | Field is text that prefixes a value | +| N | note | Field is text that follows a value | +| P | padding | Field is spaces needed for vertical alignment | +| T | title | Field is a title value for headings | +| U | units | Field is the units for the previous value field | *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 22:33:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B8D856D2; Thu, 23 Oct 2014 22:33:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9A2BFC10; Thu, 23 Oct 2014 22:33:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMXSke003781; Thu, 23 Oct 2014 22:33:28 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMXSHW003779; Thu, 23 Oct 2014 22:33:28 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232233.s9NMXSHW003779@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 22:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273563 - head/contrib/libxo/libxo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:33:28 -0000 Author: marcel Date: Thu Oct 23 22:33:27 2014 New Revision: 273563 URL: https://svnweb.freebsd.org/changeset/base/273563 Log: Add generated headers xoversion.h and xoconfig.h. These are the result of configuring the source tree: % automake --add-missing % autoconf % ./configure Added: head/contrib/libxo/libxo/xoconfig.h (contents, props changed) head/contrib/libxo/libxo/xoversion.h (contents, props changed) Added: head/contrib/libxo/libxo/xoconfig.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/libxo/xoconfig.h Thu Oct 23 22:33:27 2014 (r273563) @@ -0,0 +1,199 @@ +/* libxo/xoconfig.h. Generated from xoconfig.h.in by configure. */ +/* libxo/xoconfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the `asprintf' function. */ +#define HAVE_ASPRINTF 1 + +/* Define to 1 if you have the `bzero' function. */ +#define HAVE_BZERO 1 + +/* Define to 1 if you have the `ctime' function. */ +#define HAVE_CTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlfunc' function. */ +#define HAVE_DLFUNC 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `fdopen' function. */ +#define HAVE_FDOPEN 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `getpass' function. */ +#define HAVE_GETPASS 1 + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#define HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Support printflike */ +/* #undef HAVE_PRINTFLIKE */ + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `srand' function. */ +#define HAVE_SRAND 1 + +/* Define to 1 if you have the `sranddev' function. */ +#define HAVE_SRANDDEV 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDTIME_TZFILE_H */ + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strcspn' function. */ +#define HAVE_STRCSPN 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strspn' function. */ +#define HAVE_STRSPN 1 + +/* Define to 1 if you have the `sysctlbyname' function. */ +#define HAVE_SYSCTLBYNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SYSCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TZFILE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Enable debugging */ +/* #undef LIBXO_DEBUG */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "libxo" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "phil@juniper.net" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libxo" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libxo 0.1.4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libxo" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.1.4" + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1.4" + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ Added: head/contrib/libxo/libxo/xoversion.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libxo/libxo/xoversion.h Thu Oct 23 22:33:27 2014 (r273563) @@ -0,0 +1,38 @@ +/* + * $Id$ + * + * Copyright (c) 2014, Juniper Networks, Inc. + * All rights reserved. + * This SOFTWARE is licensed under the LICENSE provided in the + * ../Copyright file. By downloading, installing, copying, or otherwise + * using the SOFTWARE, you agree to be bound by the terms of that + * LICENSE. + * + * xoversion.h -- compile time constants for libxo + * NOTE: This file is generated from xoversion.h.in. + */ + +#ifndef LIBXO_XOVERSION_H +#define LIBXO_XOVERSION_H + +/** + * The version string + */ +#define LIBXO_VERSION "0.1.4" + +/** + * The version number + */ +#define LIBXO_VERSION_NUMBER 1004 + +/** + * The version number as a string + */ +#define LIBXO_VERSION_STRING "1004" + +/** + * The version number extra info as a string + */ +#define LIBXO_VERSION_EXTRA "" + +#endif /* LIBXO_XOVERSION_H */ From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 22:42:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32BEA956; Thu, 23 Oct 2014 22:42:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1F6A2D00; Thu, 23 Oct 2014 22:42:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NMguni008310; Thu, 23 Oct 2014 22:42:56 GMT (envelope-from des@FreeBSD.org) Received: (from des@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NMguV9008309; Thu, 23 Oct 2014 22:42:56 GMT (envelope-from des@FreeBSD.org) Message-Id: <201410232242.s9NMguV9008309@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: des set sender to des@FreeBSD.org using -f From: Dag-Erling Smørgrav Date: Thu, 23 Oct 2014 22:42:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273564 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:42:57 -0000 Author: des Date: Thu Oct 23 22:42:56 2014 New Revision: 273564 URL: https://svnweb.freebsd.org/changeset/base/273564 Log: In all cases except CTLTYPE_STRING, penv is NULL here, so passing it indiscriminately to printf() and freeenv() is incorrect. Add a NULL check before freeenv(); as for printf(), we could use req.newptr instead, but we'd have to select the correct format string based on the type, and that's too much work for an error message, so just remove it. Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Oct 23 22:33:27 2014 (r273563) +++ head/sys/kern/kern_sysctl.c Thu Oct 23 22:42:56 2014 (r273564) @@ -280,11 +280,10 @@ sysctl_load_tunable_by_oid_locked(struct } error = sysctl_root_handler_locked(oidp, oidp->oid_arg1, oidp->oid_arg2, &req); - if (error != 0) { - printf("Setting sysctl '%s' to '%s' failed: %d\n", - path, penv, error); - } - freeenv(penv); + if (error != 0) + printf("Setting sysctl %s failed: %d\n", path, error); + if (penv != NULL) + freeenv(penv); } void From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 22:47:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 927DCAEC; Thu, 23 Oct 2014 22:47:28 +0000 (UTC) Received: from smtp.des.no (smtp.des.no [194.63.250.102]) by mx1.freebsd.org (Postfix) with ESMTP id 55FB8D26; Thu, 23 Oct 2014 22:47:28 +0000 (UTC) Received: from nine.des.no (smtp.des.no [194.63.250.102]) by smtp-int.des.no (Postfix) with ESMTP id 41001A205; Thu, 23 Oct 2014 22:47:27 +0000 (UTC) Received: by nine.des.no (Postfix, from userid 1001) id 58563102C3; Fri, 24 Oct 2014 00:47:16 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Xin LI Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> Date: Fri, 24 Oct 2014 00:47:16 +0200 In-Reply-To: <201410231823.s9NINpXD082633@svn.freebsd.org> (Xin LI's message of "Thu, 23 Oct 2014 18:23:51 +0000 (UTC)") Message-ID: <86egtyz9mz.fsf@nine.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 22:47:28 -0000 Xin LI writes: > Log: > Test if 'env' is NULL before doing memset() and strlen(), > the caller may pass NULL to freeenv(). If this is in response to a panic in early boot, the real bug is elsewhere (see r273564). Adding a NULL check here only hides it. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:12:31 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0446B1EB; Thu, 23 Oct 2014 23:12:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4C5EFBC; Thu, 23 Oct 2014 23:12:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNCUZK022379; Thu, 23 Oct 2014 23:12:30 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNCUxU022378; Thu, 23 Oct 2014 23:12:30 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410232312.s9NNCUxU022378@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 23 Oct 2014 23:12:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273566 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:12:31 -0000 Author: loos Date: Thu Oct 23 23:12:30 2014 New Revision: 273566 URL: https://svnweb.freebsd.org/changeset/base/273566 Log: Provide a working GPIOBUS_IVAR() macro for FDT systems. Modified: head/sys/dev/gpio/gpiobusvar.h Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:11:04 2014 (r273565) +++ head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:12:30 2014 (r273566) @@ -41,7 +41,12 @@ #include "gpio_if.h" +#ifdef FDT +#define GPIOBUS_IVAR(d) (struct gpiobus_ivar *) \ + &((struct ofw_gpiobus_devinfo *)device_get_ivars(d))->opd_dinfo +#else #define GPIOBUS_IVAR(d) (struct gpiobus_ivar *) device_get_ivars(d) +#endif #define GPIOBUS_SOFTC(d) (struct gpiobus_softc *) device_get_softc(d) #define GPIOBUS_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define GPIOBUS_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:14:24 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E9C133C; Thu, 23 Oct 2014 23:14:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A478FC7; Thu, 23 Oct 2014 23:14:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNEOrc022666; Thu, 23 Oct 2014 23:14:24 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNENYh022661; Thu, 23 Oct 2014 23:14:23 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232314.s9NNENYh022661@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 23:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273567 - in head: etc/mtree lib lib/libxo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:14:24 -0000 Author: marcel Date: Thu Oct 23 23:14:23 2014 New Revision: 273567 URL: https://svnweb.freebsd.org/changeset/base/273567 Log: Hook libxo to the build. Sponsored by: Juniper Networks, Inc. Added: head/lib/libxo/ head/lib/libxo/Makefile (contents, props changed) Modified: head/etc/mtree/BSD.include.dist head/lib/Makefile Modified: head/etc/mtree/BSD.include.dist ============================================================================== --- head/etc/mtree/BSD.include.dist Thu Oct 23 23:12:30 2014 (r273566) +++ head/etc/mtree/BSD.include.dist Thu Oct 23 23:14:23 2014 (r273567) @@ -249,6 +249,8 @@ .. libmilter .. + libxo + .. lzma .. machine Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Thu Oct 23 23:12:30 2014 (r273566) +++ head/lib/Makefile Thu Oct 23 23:14:23 2014 (r273567) @@ -106,6 +106,7 @@ SUBDIR= ${SUBDIR_ORDERED} \ ${_libvgl} \ ${_libvmmapi} \ libwrap \ + libxo \ liby \ ${_libypclnt} \ libz \ Added: head/lib/libxo/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libxo/Makefile Thu Oct 23 23:14:23 2014 (r273567) @@ -0,0 +1,36 @@ +# $FreeBSD$ + +LIBXO= ${.CURDIR:H:H}/contrib/libxo + +.PATH: ${LIBXO}/libxo + +LIB= xo +SHLIB_MAJOR=0 + +SRCS= libxo.c + +CFLAGS+=-I${LIBXO}/libxo + +INCS= xo.h +INCSDIR=${INCLUDEDIR}/libxo + +MAN+= libxo.3 +MAN+= xo_attr.3 \ + xo_create.3 \ + xo_emit.3 \ + xo_err.3 \ + xo_finish.3 \ + xo_flush.3 \ + xo_no_setlocale.3 \ + xo_open_container.3 \ + xo_open_list.3 \ + xo_parse_args.3 \ + xo_set_allocator.3 \ + xo_set_flags.3 \ + xo_set_info.3 \ + xo_set_options.3 \ + xo_set_style.3 \ + xo_set_writer.3 +MAN+= xo_format.5 + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:16:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DE9E64F0; Thu, 23 Oct 2014 23:16:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4CDDFDF; Thu, 23 Oct 2014 23:16:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNGMZG022995; Thu, 23 Oct 2014 23:16:22 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNGMO1022993; Thu, 23 Oct 2014 23:16:22 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201410232316.s9NNGMO1022993@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Thu, 23 Oct 2014 23:16:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273568 - in head/usr.bin: . xo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:16:23 -0000 Author: marcel Date: Thu Oct 23 23:16:21 2014 New Revision: 273568 URL: https://svnweb.freebsd.org/changeset/base/273568 Log: Hook xo(1) to the build -- it's like echo, but uses libxo to support emitting machine-readable output. Sponsored by: Juniper Networks, Inc. Added: head/usr.bin/xo/ head/usr.bin/xo/Makefile (contents, props changed) Modified: head/usr.bin/Makefile Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Thu Oct 23 23:14:23 2014 (r273567) +++ head/usr.bin/Makefile Thu Oct 23 23:16:21 2014 (r273568) @@ -196,6 +196,7 @@ SUBDIR= alias \ xargs \ xinstall \ ${_xlint} \ + xo \ ${_xstr} \ xz \ xzdec \ Added: head/usr.bin/xo/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/xo/Makefile Thu Oct 23 23:16:21 2014 (r273568) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +LIBXO= ${.CURDIR:H:H}/contrib/libxo + +.PATH: ${LIBXO}/xo + +PROG= xo +MAN= xo.1 + +# XXX For xoversion.h +CFLAGS+=-I${LIBXO}/libxo + +DPADD= ${LIBXO} +LDADD= -lxo + +.include From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:19:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 061596CB; Thu, 23 Oct 2014 23:19:06 +0000 (UTC) Received: from anubis.delphij.net (anubis.delphij.net [IPv6:2001:470:1:117::25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "anubis.delphij.net", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DFC6DA; Thu, 23 Oct 2014 23:19:05 +0000 (UTC) Received: from zeta.ixsystems.com (unknown [12.229.62.2]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by anubis.delphij.net (Postfix) with ESMTPSA id 80CF4155B6; Thu, 23 Oct 2014 16:19:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphij.net; s=anubis; t=1414106345; x=1414120745; bh=gFPx6W3mB0z0cvggR1pOM7gAxuJu1PamOT00C1uIPZc=; h=Date:From:Reply-To:To:CC:Subject:References:In-Reply-To; b=PWpGVGL9a3Snc79Okr93U84Vzz89+A3zM9D5ZrPWRFPfuJx875IkrCHa5+jGBBI0W e1u3DMwwEb5ThOTWKxQZtUav427vVb3i/GCO5BSBeFYeps5eRC7IZd0D8t+EIuoIuP bslROPNZSmfxBUlVcxf/REo6jZcYPvuc708XBuOc= Message-ID: <54498CE9.1090000@delphij.net> Date: Thu, 23 Oct 2014 16:19:05 -0700 From: Xin Li Reply-To: d@delphij.net Organization: The FreeBSD Project MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , Xin LI Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> In-Reply-To: <86egtyz9mz.fsf@nine.des.no> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:19:06 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 10/23/14 15:47, Dag-Erling Smørgrav wrote: > Xin LI writes: >> Log: Test if 'env' is NULL before doing memset() and strlen(), >> the caller may pass NULL to freeenv(). > > If this is in response to a panic in early boot, the real bug is > elsewhere (see r273564). Adding a NULL check here only hides it. Yes that would fix it. Does this look good to you? Index: sys/kern/kern_environment.c =================================================================== - --- sys/kern/kern_environment.c (revision 273564) +++ sys/kern/kern_environment.c (working copy) @@ -262,7 +262,8 @@ void freeenv(char *env) { - - if (dynamic_kenv && env != NULL) { + MPASS(env != NULL); + if (dynamic_kenv) { memset(env, 0, strlen(env)); free(env, M_KENV); } Cheers, - -- Xin LI https://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0 iQIcBAEBCgAGBQJUSYzoAAoJEJW2GBstM+nsSnYP/i4boJtEHPzOiJceF0x1OW+h /Jn/ewoZh5itogPuGBcXB0QSNZIoQjH3x8Puv6S+bgfGwP6oXtWGpFHeH1EXtu0N pUqaft3VP8d/8+QeM0l5GSrYWverDZM0FpwnhWC0L/+0Fen52pseLGJIYGmG0Z80 vBxiRokXmNtC467tgu5upSSXDftEu9RFsWPCtuTr2yP+RZYC98hdSTl2EufA0L3Z ih46Iz+zIYcQt7ziryQ0nblGSuQy+AucqPa/0/fs9mSpqd0+fSphR+nd62P60yC4 mDUB093mMl/PhZY5IrfoU1DTxDdUJNoGc1wNdzKqsbxTbjpMJMeWr6dHX2pni8Ki MCR+Hh6aMxC+P0g2n5cCmTTff8ghRXSW0/pSluJjyPALmYHXCUdnXWAj59hkbpUA O6wOtth4rLi0ZcGPT4hNKu5bm+BvhQ4EEKjomB+WzZUmUL+/H8xoin2xEaItMs6T uDaZqaknRACr5+TFuwVbBP77QOZ9i9EcqBIMOSkNw1E0NqdGLxTwud8IQCqMAONJ ZHrwNOCM91sLk4ohjrPNzZzY3IXostBzRNNJQvFEXQJhbxJvQM3CDcr/QOoMajN2 1VWMbxrONgcyi8RTC8PvOgxRN36SFBJP0rxhrn465xGpAWsZ9M28sOWmKk2O4yhB LHZuuMYanWSQ0+SYJrGT =eSq9 -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:20:05 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B32681A; Thu, 23 Oct 2014 23:20:05 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 84A0468; Thu, 23 Oct 2014 23:20:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNK5wM023563; Thu, 23 Oct 2014 23:20:05 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9NNK4fV023557; Thu, 23 Oct 2014 23:20:04 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410232320.s9NNK4fV023557@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 23 Oct 2014 23:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273569 - head/sys/dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:20:05 -0000 Author: loos Date: Thu Oct 23 23:20:04 2014 New Revision: 273569 URL: https://svnweb.freebsd.org/changeset/base/273569 Log: Move the duplicated code to a single function. No functional changes. Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/gpiobus.c Thu Oct 23 23:20:04 2014 (r273569) @@ -99,6 +99,34 @@ gpiobus_print_pins(struct gpiobus_ivar * printf("%d", range_start); } +int +gpiobus_init_softc(device_t dev) +{ + struct gpiobus_softc *sc; + + sc = GPIOBUS_SOFTC(dev); + sc->sc_busdev = dev; + sc->sc_dev = device_get_parent(dev); + + if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0) + return (ENXIO); + + KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); + + /* Pins = GPIO_PIN_MAX() + 1 */ + sc->sc_npins++; + + sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->sc_pins_mapped == NULL) + return (ENOMEM); + + /* Initialize the bus lock. */ + GPIOBUS_LOCK_INIT(sc); + + return (0); +} + static int gpiobus_parse_pins(struct gpiobus_softc *sc, device_t child, int mask) { @@ -163,30 +191,11 @@ gpiobus_probe(device_t dev) static int gpiobus_attach(device_t dev) { - struct gpiobus_softc *sc = GPIOBUS_SOFTC(dev); - int res; - - sc->sc_busdev = dev; - sc->sc_dev = device_get_parent(dev); - res = GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins); - if (res) - return (ENXIO); - - KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); - - /* - * Increase to get number of pins - */ - sc->sc_npins++; - - sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (!sc->sc_pins_mapped) - return (ENOMEM); + int err; - /* init bus lock */ - GPIOBUS_LOCK_INIT(sc); + err = gpiobus_init_softc(dev); + if (err != 0) + return (err); /* * Get parent's pins and mark them as unmapped Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/gpiobusvar.h Thu Oct 23 23:20:04 2014 (r273569) @@ -89,6 +89,7 @@ gpio_map_gpios(device_t bus, phandle_t d device_t ofw_gpiobus_add_fdt_child(device_t, phandle_t); #endif void gpiobus_print_pins(struct gpiobus_ivar *); +int gpiobus_init_softc(device_t); extern driver_t gpiobus_driver; Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Thu Oct 23 23:16:21 2014 (r273568) +++ head/sys/dev/gpio/ofw_gpiobus.c Thu Oct 23 23:20:04 2014 (r273569) @@ -264,33 +264,13 @@ ofw_gpiobus_probe(device_t dev) static int ofw_gpiobus_attach(device_t dev) { - struct gpiobus_softc *sc; + int err; phandle_t child; - sc = GPIOBUS_SOFTC(dev); - sc->sc_busdev = dev; - sc->sc_dev = device_get_parent(dev); - - /* Read the pin max. value */ - if (GPIO_PIN_MAX(sc->sc_dev, &sc->sc_npins) != 0) - return (ENXIO); - - KASSERT(sc->sc_npins != 0, ("GPIO device with no pins")); - - /* - * Increase to get number of pins. - */ - sc->sc_npins++; - - sc->sc_pins_mapped = malloc(sizeof(int) * sc->sc_npins, M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (!sc->sc_pins_mapped) - return (ENOMEM); - - /* Init the bus lock. */ - GPIOBUS_LOCK_INIT(sc); - + err = gpiobus_init_softc(dev); + if (err != 0) + return (err); + bus_generic_probe(dev); bus_enumerate_hinted_children(dev); From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:21:39 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6AAA6998; Thu, 23 Oct 2014 23:21:39 +0000 (UTC) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7BB2E128; Thu, 23 Oct 2014 23:21:38 +0000 (UTC) Received: by mail-wi0-f178.google.com with SMTP id q5so58175wiv.17 for ; Thu, 23 Oct 2014 16:21:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=gOjDjSZv/BoE3yO/hSVF785WlGnHPFhm4pbLOTwpMxE=; b=YTKEf6u2B9toWU2kAIMw8/cUzrFmQGJhJZmuA1cqPxbi8Lh5TPcuM3zKkAbmcaCIli GXL0evYYHESxkQ1eKZVDt1nO9HTM3KCb2+8YTgEs8SOw9CnJ34i06Zn5wexckplI2atw zUWJ2ifJIiFiB2ttEJTfmX7MZtSK0aOYUBPS5UGbtlwPzCJhOpwCQIHaAFIHeri0RLwV L3Jl9xpGv+AZVVYJqwJmwJYVN/j1BfZwKgl3sKSE7VPvsKjmvEpyKVd4Pr/affTyqp/I WgIJXclhnMsf+jMbdnSPktNL8dORNyeGrop0DONiA0dSuShSG4rIoPMmBLY7gtlu9SOu 5YhQ== X-Received: by 10.180.90.230 with SMTP id bz6mr131404wib.67.1414106496819; Thu, 23 Oct 2014 16:21:36 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id ei1sm98378wib.20.2014.10.23.16.21.35 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 16:21:35 -0700 (PDT) Date: Fri, 24 Oct 2014 01:21:33 +0200 From: Mateusz Guzik To: d@delphij.net Subject: Re: svn commit: r273552 - head/sys/kern Message-ID: <20141023232133.GA11222@dft-labs.eu> References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> <54498CE9.1090000@delphij.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <54498CE9.1090000@delphij.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, Dag-Erling =?utf-8?B?U23DuHJncmF2?= , svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:21:39 -0000 On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > On 10/23/14 15:47, Dag-Erling Smørgrav wrote: > > Xin LI writes: > >> Log: Test if 'env' is NULL before doing memset() and strlen(), > >> the caller may pass NULL to freeenv(). > > > > If this is in response to a panic in early boot, the real bug is > > elsewhere (see r273564). Adding a NULL check here only hides it. > > Yes that would fix it. Does this look good to you? > > Index: sys/kern/kern_environment.c > =================================================================== > - --- sys/kern/kern_environment.c (revision 273564) > +++ sys/kern/kern_environment.c (working copy) > @@ -262,7 +262,8 @@ void > freeenv(char *env) > { > > - - if (dynamic_kenv && env != NULL) { > + MPASS(env != NULL); > + if (dynamic_kenv) { > memset(env, 0, strlen(env)); > free(env, M_KENV); > } > There are at least 80 consumers of this function. Unless someone is up to reviewing them all, can we go with a warning + backtrace for the time being? -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Thu Oct 23 23:31:08 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 08867C60 for ; Thu, 23 Oct 2014 23:31:08 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DC4D020F for ; Thu, 23 Oct 2014 23:31:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.9/8.14.9) with ESMTP id s9NNV77x043357 for ; Thu, 23 Oct 2014 23:31:07 GMT (envelope-from bdrewery@freefall.freebsd.org) Received: (from bdrewery@localhost) by freefall.freebsd.org (8.14.9/8.14.9/Submit) id s9NNV79g043353 for svn-src-head@freebsd.org; Thu, 23 Oct 2014 23:31:07 GMT (envelope-from bdrewery) Received: (qmail 81128 invoked from network); 23 Oct 2014 18:31:03 -0500 Received: from unknown (HELO ?10.10.0.24?) (freebsd@shatow.net@10.10.0.24) by sweb.xzibition.com with ESMTPA; 23 Oct 2014 18:31:03 -0500 Message-ID: <54498FB0.5000703@FreeBSD.org> Date: Thu, 23 Oct 2014 18:30:56 -0500 From: Bryan Drewery Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Mateusz Guzik , d@delphij.net Subject: Re: svn commit: r273552 - head/sys/kern References: <201410231823.s9NINpXD082633@svn.freebsd.org> <86egtyz9mz.fsf@nine.des.no> <54498CE9.1090000@delphij.net> <20141023232133.GA11222@dft-labs.eu> In-Reply-To: <20141023232133.GA11222@dft-labs.eu> OpenPGP: id=6E4697CF; url=http://www.shatow.net/bryan/bryan2.asc Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul" Cc: svn-src-head@freebsd.org, =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= , svn-src-all@freebsd.org, src-committers@freebsd.org, Xin LI X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2014 23:31:08 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/23/2014 6:21 PM, Mateusz Guzik wrote: > On Thu, Oct 23, 2014 at 04:19:05PM -0700, Xin Li wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> On 10/23/14 15:47, Dag-Erling Sm=C3=B8rgrav wrote: >>> Xin LI writes: >>>> Log: Test if 'env' is NULL before doing memset() and strlen(),=20 >>>> the caller may pass NULL to freeenv(). >>> >>> If this is in response to a panic in early boot, the real bug is=20 >>> elsewhere (see r273564). Adding a NULL check here only hides it. >> >> Yes that would fix it. Does this look good to you? >> >> Index: sys/kern/kern_environment.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> - --- sys/kern/kern_environment.c (revision 273564) >> +++ sys/kern/kern_environment.c (working copy) >> @@ -262,7 +262,8 @@ void >> freeenv(char *env) >> { >> >> - - if (dynamic_kenv && env !=3D NULL) { >> + MPASS(env !=3D NULL); >> + if (dynamic_kenv) { >> memset(env, 0, strlen(env)); >> free(env, M_KENV); >> } >> >=20 > There are at least 80 consumers of this function. Unless someone is up > to reviewing them all, can we go with a warning + backtrace for the tim= e > being? >=20 My DEBUG_WARN could be used for that. I had not committed yet, but it is ready. --=20 Regards, Bryan Drewery --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) iQEcBAEBAgAGBQJUSY+wAAoJEDXXcbtuRpfPJHAH/jKdxCxKy6ZT1o6RmOewNVvK DUmzobU4xHIdcQTBsH0cYNukedKKtxFPzVR7dos2G1r8+u8Evwb4MSi8nhq2a6Mz iH8MAsLIxUYzUEC+kRDkcerzZPvymyx9yE2mELJ07V6Qmkyb9/AKgVu0eGud3kfn XK+sBlIJiNJwzUjK0B0H5Cjud6gVzsm8bZf2BnTfi+BKJV1TQhL6eCDctWcyklFC TPr8a19j78MzO+j4RTN/dVRejJBLy+5RuXUVMdTx+o6cIHKGzbNVvdgDWcPl/Ny5 bx5jXvc02FNEVwwVx/AcATItqtOkxRfLEJuzuV2es2FL3ceH5/yj9Z4jcG2aGGo= =yP/f -----END PGP SIGNATURE----- --BpuAxd8XErTmXqHgr9QiaQ1DTUtlGhPul-- From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 03:33:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E1D3EAE2; Fri, 24 Oct 2014 03:33:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B40CCC6C; Fri, 24 Oct 2014 03:33:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3X1ZW046068; Fri, 24 Oct 2014 03:33:01 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3X1GA046067; Fri, 24 Oct 2014 03:33:01 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201410240333.s9O3X1GA046067@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 24 Oct 2014 03:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273570 - head/sys/cddl/dev/fbt/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:33:02 -0000 Author: jhibbits Date: Fri Oct 24 03:33:01 2014 New Revision: 273570 URL: https://svnweb.freebsd.org/changeset/base/273570 Log: Three updates to PowerPC FBT: * Use a constant to define the number of stack frames in a probe exception. * Only allow function symbols in powerpc64 ('.' prefixed) * Set the fbtp_roffset for return probes, so the correct dtrace_probe call is made. MFC after: 1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Thu Oct 23 23:20:04 2014 (r273569) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) @@ -48,6 +48,7 @@ #define FBT_ENTRY "entry" #define FBT_RETURN "return" +#define FBT_AFRAMES 7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) @@ -116,9 +117,17 @@ fbt_provide_module_function(linker_file_ int j; uint32_t *instr, *limit; - /* PowerPC64 uses '.' prefixes on symbol names, ignore it. */ +#ifdef __powerpc64__ + /* + * PowerPC64 uses '.' prefixes on symbol names, ignore it, but only + * allow symbols with the '.' prefix, so that we don't get the function + * descriptor instead. + */ if (name[0] == '.') name++; + else + return (0); +#endif if (strncmp(name, "dtrace_", 7) == 0 && strncmp(name, "dtrace_safe_", 12) != 0) { @@ -147,7 +156,7 @@ fbt_provide_module_function(linker_file_ fbt = malloc(sizeof (fbt_probe_t), M_FBT, M_WAITOK | M_ZERO); fbt->fbtp_name = name; fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_ENTRY, 7, fbt); + name, FBT_ENTRY, FBT_AFRAMES, fbt); fbt->fbtp_patchpoint = instr; fbt->fbtp_ctl = lf; fbt->fbtp_loadcnt = lf->loadcnt; @@ -210,7 +219,7 @@ again: if (retfbt == NULL) { fbt->fbtp_id = dtrace_probe_create(fbt_id, modname, - name, FBT_RETURN, 7, fbt); + name, FBT_RETURN, FBT_AFRAMES, fbt); } else { retfbt->fbtp_next = fbt; fbt->fbtp_id = retfbt->fbtp_id; @@ -229,6 +238,9 @@ again: else fbt->fbtp_rval = DTRACE_INVOP_JUMP; + fbt->fbtp_roffset = + (uintptr_t)((uint8_t *)instr - (uint8_t *)symval->value); + fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)]; From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 03:34:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D76FAC40; Fri, 24 Oct 2014 03:34:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3AD6C82; Fri, 24 Oct 2014 03:34:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3YLLr046261; Fri, 24 Oct 2014 03:34:21 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3YLxn046260; Fri, 24 Oct 2014 03:34:21 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201410240334.s9O3YLxn046260@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 24 Oct 2014 03:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273571 - head/sys/cddl/dev/fbt/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:34:22 -0000 Author: jhibbits Date: Fri Oct 24 03:34:21 2014 New Revision: 273571 URL: https://svnweb.freebsd.org/changeset/base/273571 Log: Whitespace X-MFC-with: r273570 MFC after: 1 week Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Modified: head/sys/cddl/dev/fbt/powerpc/fbt_isa.c ============================================================================== --- head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:33:01 2014 (r273570) +++ head/sys/cddl/dev/fbt/powerpc/fbt_isa.c Fri Oct 24 03:34:21 2014 (r273571) @@ -48,7 +48,7 @@ #define FBT_ENTRY "entry" #define FBT_RETURN "return" -#define FBT_AFRAMES 7 +#define FBT_AFRAMES 7 int fbt_invop(uintptr_t addr, uintptr_t *stack, uintptr_t rval) From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 03:42:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1AEB8DE2; Fri, 24 Oct 2014 03:42:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07001D3D; Fri, 24 Oct 2014 03:42:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3gboZ050615; Fri, 24 Oct 2014 03:42:37 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3gbQ1050614; Fri, 24 Oct 2014 03:42:37 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240342.s9O3gbQ1050614@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 03:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273572 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:42:38 -0000 Author: ngie Date: Fri Oct 24 03:42:37 2014 New Revision: 273572 URL: https://svnweb.freebsd.org/changeset/base/273572 Log: - Ignore EINVAL check with mknod(path, S_IFCHR, -1) as the testcase is always executed on a non-devfs filesystem - Expect mknod(path, S_IFREG, 0) to fail on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Fri Oct 24 03:34:21 2014 (r273571) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mknod.c Fri Oct 24 03:42:37 2014 (r273572) @@ -58,8 +58,15 @@ ATF_TC_BODY(mknod_err, tc) (void)memset(buf, 'x', sizeof(buf)); +#ifndef __FreeBSD__ + /* + * As of FreeBSD 6.0 device nodes may be created in regular file systems but + * such nodes cannot be used to access devices. As a result an invalid dev + * argument is unchecked. + */ errno = 0; ATF_REQUIRE_ERRNO(EINVAL, mknod(path, S_IFCHR, -1) == -1); +#endif errno = 0; ATF_REQUIRE_ERRNO(ENAMETOOLONG, mknod(buf, S_IFCHR, 0) == -1); @@ -166,6 +173,9 @@ ATF_TC_BODY(mknod_stat, tc) (void)memset(&st, 0, sizeof(struct stat)); +#ifdef __FreeBSD__ + atf_tc_expect_fail("mknod does not allow S_IFREG"); +#endif ATF_REQUIRE(mknod(path, S_IFREG, 0) == 0); ATF_REQUIRE(stat(path, &st) == 0); From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 03:53:50 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C7EC2150; Fri, 24 Oct 2014 03:53:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B3860E0A; Fri, 24 Oct 2014 03:53:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O3robp055417; Fri, 24 Oct 2014 03:53:50 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O3roYD055416; Fri, 24 Oct 2014 03:53:50 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240353.s9O3roYD055416@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 03:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273574 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 03:53:50 -0000 Author: ngie Date: Fri Oct 24 03:53:49 2014 New Revision: 273574 URL: https://svnweb.freebsd.org/changeset/base/273574 Log: - Test for EINVAL requirement when passing an invalid flag in to msync(2) - Expect ENOMEM instead of EFAULT when msync'ing a previously munmap'ed region on FreeBSD Submitted by: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_msync.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Fri Oct 24 03:48:54 2014 (r273573) +++ head/contrib/netbsd-tests/lib/libc/sys/t_msync.c Fri Oct 24 03:53:49 2014 (r273574) @@ -170,8 +170,15 @@ ATF_TC_BODY(msync_err, tc) /* * Test that invalid flags error out. */ +#ifdef __FreeBSD__ + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", -1) != NULL); + errno = 0; + ATF_REQUIRE_ERRNO(EINVAL, msync_sync("error", INT_MAX) != NULL); +#else ATF_REQUIRE(msync_sync("error", -1) != NULL); ATF_REQUIRE(msync_sync("error", INT_MAX) != NULL); +#endif errno = 0; @@ -185,7 +192,11 @@ ATF_TC_BODY(msync_err, tc) (void)munmap(map, page); ATF_REQUIRE(msync(map, page, MS_SYNC) != 0); +#ifdef __FreeBSD__ + ATF_REQUIRE(errno == ENOMEM); +#else ATF_REQUIRE(errno == EFAULT); +#endif } ATF_TC(msync_invalidate); From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 04:01:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 31DB7302; Fri, 24 Oct 2014 04:01:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1277BEC3; Fri, 24 Oct 2014 04:01:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O41Eie059946; Fri, 24 Oct 2014 04:01:14 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O41EBE059945; Fri, 24 Oct 2014 04:01:14 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201410240401.s9O41EBE059945@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 24 Oct 2014 04:01:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273575 - head/usr.bin/vmstat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 04:01:15 -0000 Author: mckusick Date: Fri Oct 24 04:01:14 2014 New Revision: 273575 URL: https://svnweb.freebsd.org/changeset/base/273575 Log: Fix formatting of vmstat (1) so that it looks cleaner on standard 80 column displays. In particular it wraps far less often. Submitted by: Andy Kosela PR: 191976 Modified: head/usr.bin/vmstat/vmstat.c Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Fri Oct 24 03:53:49 2014 (r273574) +++ head/usr.bin/vmstat/vmstat.c Fri Oct 24 04:01:14 2014 (r273575) @@ -767,22 +767,26 @@ dovmstat(unsigned int interval, int reps fill_vmmeter(&sum); fill_vmtotal(&total); - (void)printf("%2d %1d %1d", + (void)printf("%1d %1d %1d", total.t_rq - 1, total.t_dw + total.t_pw, total.t_sw); #define vmstat_pgtok(a) ((a) * (sum.v_page_size >> 10)) #define rate(x) (((x) * rate_adj + halfuptime) / uptime) /* round */ if (hflag) { + printf(""); + prthuman(total.t_avm * (u_int64_t)sum.v_page_size, 5); printf(" "); - prthuman(total.t_avm * (u_int64_t)sum.v_page_size, 7); - printf(" "); - prthuman(total.t_free * (u_int64_t)sum.v_page_size, 6); + prthuman(total.t_free * (u_int64_t)sum.v_page_size, 5); printf(" "); + (void)printf("%5lu ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } else { - printf(" %7d ", vmstat_pgtok(total.t_avm)); - printf(" %6d ", vmstat_pgtok(total.t_free)); + printf(" %7d", vmstat_pgtok(total.t_avm)); + printf(" %7d ", vmstat_pgtok(total.t_free)); + (void)printf("%4lu ", + (unsigned long)rate(sum.v_vm_faults - + osum.v_vm_faults)); } - (void)printf("%5lu ", - (unsigned long)rate(sum.v_vm_faults - osum.v_vm_faults)); (void)printf("%3lu ", (unsigned long)rate(sum.v_reactivated - osum.v_reactivated)); (void)printf("%3lu ", @@ -793,10 +797,10 @@ dovmstat(unsigned int interval, int reps (osum.v_swapout + osum.v_vnodeout))); (void)printf("%5lu ", (unsigned long)rate(sum.v_tfree - osum.v_tfree)); - (void)printf("%3lu ", + (void)printf("%4lu ", (unsigned long)rate(sum.v_pdpages - osum.v_pdpages)); devstats(); - (void)printf("%4lu %4lu %4lu", + (void)printf("%4lu %5lu %5lu", (unsigned long)rate(sum.v_intr - osum.v_intr), (unsigned long)rate(sum.v_syscall - osum.v_syscall), (unsigned long)rate(sum.v_swtch - osum.v_swtch)); @@ -824,35 +828,43 @@ dovmstat(unsigned int interval, int reps } static void -printhdr(int maxid, u_long cpumask) +printhdr(int ncpus, u_long cpumask) { int i, num_shown; num_shown = (num_selected < maxshowdevs) ? num_selected : maxshowdevs; - (void)printf(" procs memory page%*s", 19, ""); + if (hflag) { + (void)printf("procs memory page%*s ", 19, ""); + } else { + (void)printf("procs memory page%*s ", 19, ""); + } if (num_shown > 1) - (void)printf(" disks %*s", num_shown * 4 - 7, ""); + (void)printf(" disks %*s", num_shown * 4 - 7, ""); else if (num_shown == 1) - (void)printf("disk"); - (void)printf(" faults "); + (void)printf(" disk"); + (void)printf(" faults "); if (Pflag) { - for (i = 0; i <= maxid; i++) { + for (i = 0; i < ncpus; i++) { if (cpumask & (1ul << i)) - printf("cpu%-2d ", i); + printf(" cpu%d ", i); } printf("\n"); } else - printf("cpu\n"); - (void)printf(" r b w avm fre flt re pi po fr sr "); + printf(" cpu\n"); + if (hflag) { + (void)printf("r b w avm fre flt re pi po fr sr "); + } else { + (void)printf("r b w avm fre flt re pi po fr sr "); + } for (i = 0; i < num_devices; i++) if ((dev_select[i].selected) && (dev_select[i].selected <= maxshowdevs)) (void)printf("%c%c%d ", dev_select[i].device_name[0], dev_select[i].device_name[1], dev_select[i].unit_number); - (void)printf(" in sy cs"); + (void)printf(" in sy cs"); if (Pflag) { - for (i = 0; i <= maxid; i++) { + for (i = 0; i < ncpus; i++) { if (cpumask & (1ul << i)) printf(" us sy id"); } @@ -982,7 +994,8 @@ dosum(void) (void)printf("%9u intransit blocking page faults\n", sum.v_intrans); (void)printf("%9u total VM faults taken\n", sum.v_vm_faults); (void)printf("%9u page faults requiring I/O\n", sum.v_io_faults); - (void)printf("%9u pages affected by kernel thread creation\n", sum.v_kthreadpages); + (void)printf("%9u pages affected by kernel thread creation\n", + sum.v_kthreadpages); (void)printf("%9u pages affected by fork()\n", sum.v_forkpages); (void)printf("%9u pages affected by vfork()\n", sum.v_vforkpages); (void)printf("%9u pages affected by rfork()\n", sum.v_rforkpages); @@ -1124,7 +1137,8 @@ pcpustats(int ncpus, u_long cpumask, int continue; for (state = 0; state < CPUSTATES; ++state) { tmp = cur_cp_times[i * CPUSTATES + state]; - cur_cp_times[i * CPUSTATES + state] -= last_cp_times[i * CPUSTATES + state]; + cur_cp_times[i * CPUSTATES + state] -= last_cp_times[i * + CPUSTATES + state]; last_cp_times[i * CPUSTATES + state] = tmp; } } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 05:39:33 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 24DAB142; Fri, 24 Oct 2014 05:39:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB8BA97A; Fri, 24 Oct 2014 05:39:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O5dWpk002151; Fri, 24 Oct 2014 05:39:32 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O5dWWK002150; Fri, 24 Oct 2014 05:39:32 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201410240539.s9O5dWWK002150@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Fri, 24 Oct 2014 05:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273576 - head/sys/dev/uart X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 05:39:33 -0000 Author: araujo (ports committer) Date: Fri Oct 24 05:39:32 2014 New Revision: 273576 URL: https://svnweb.freebsd.org/changeset/base/273576 Log: Fix a leaked Storage Variable. Phabric: D981 Submitted by: myself Reported by: Coverity CID: 1248848 Reworked by: kevlo Reviewed by: marcel, davide, ray, kevlo Approved by: marcel, kevlo Modified: head/sys/dev/uart/uart_subr.c Modified: head/sys/dev/uart/uart_subr.c ============================================================================== --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014 (r273575) +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014 (r273576) @@ -196,7 +196,7 @@ out: int uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) { - const char *spec; + const char *cp, *spec; bus_addr_t addr = ~0U; int error; @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev * port (resp). */ if (devtype == UART_DEV_CONSOLE) - spec = kern_getenv("hw.uart.console"); + cp = kern_getenv("hw.uart.console"); else if (devtype == UART_DEV_DBGPORT) - spec = kern_getenv("hw.uart.dbgport"); + cp = kern_getenv("hw.uart.dbgport"); else - spec = NULL; - if (spec == NULL) + cp = NULL; + if (cp == NULL) return (ENXIO); /* Set defaults. */ @@ -232,6 +232,7 @@ uart_getenv(int devtype, struct uart_dev di->parity = UART_PARITY_NONE; /* Parse the attributes. */ + spec = cp; while (1) { switch (uart_parse_tag(&spec)) { case UART_TAG_BR: @@ -267,14 +268,18 @@ uart_getenv(int devtype, struct uart_dev di->bas.rclk = uart_parse_long(&spec); break; default: + freeenv(__DECONST(char *, cp)); return (EINVAL); } if (*spec == '\0') break; - if (*spec != ',') + if (*spec != ',') { + freeenv(__DECONST(char *, cp)); return (EINVAL); + } spec++; } + freeenv(__DECONST(char *, cp)); /* * If we still have an invalid address, the specification must be From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 05:58:26 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71E293D5; Fri, 24 Oct 2014 05:58:26 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 928D5B1C; Fri, 24 Oct 2014 05:58:25 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id n3so361943wiv.14 for ; Thu, 23 Oct 2014 22:58:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=sYr2SRa/Bolm+OozhGB3tM0eX7Amlyr9vL6FhS5Rc04=; b=iUp0GTZLPY2aeXc5X4YqJok2o43ArV0EIDlqOS95gBEKwGVNXAFmmp8Ypmm6nypKr+ 9a/XNpRGRwyKpGp3nHocRTYU7CEP8BTPvCypJ3pYbERRHniJfkBmB/6vly3zICFnKMye Ar2vBxko7E+/fS1lLz7VKBCoQHKGv0h1UqxtXnnyWY7DapEN1ORQjWNPM4PKAbtyjj5B PUItDaphJyBJDrE9JYbwp7/hSbhMwyjkQLx55l8b2eru1KvzolO9IBJ2/lMKMVsV3Rgl Cmm8syraUWvhOgfwOqtshXSF6DpmoMwaHkpF2OoFphkZ3KWXCXsNuLwjOtD3fgPfnDPV PqQg== X-Received: by 10.180.72.243 with SMTP id g19mr1761433wiv.64.1414130303862; Thu, 23 Oct 2014 22:58:23 -0700 (PDT) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id fx2sm4405222wjb.37.2014.10.23.22.58.22 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 22:58:23 -0700 (PDT) Date: Fri, 24 Oct 2014 07:58:20 +0200 From: Mateusz Guzik To: Marcelo Araujo Subject: Re: svn commit: r273576 - head/sys/dev/uart Message-ID: <20141024055820.GI11222@dft-labs.eu> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201410240539.s9O5dWWK002150@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 05:58:26 -0000 On Fri, Oct 24, 2014 at 05:39:32AM +0000, Marcelo Araujo wrote: > Author: araujo (ports committer) > Date: Fri Oct 24 05:39:32 2014 > New Revision: 273576 > URL: https://svnweb.freebsd.org/changeset/base/273576 > > Log: > Fix a leaked Storage Variable. > > int > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) > { > - const char *spec; > + const char *cp, *spec; > bus_addr_t addr = ~0U; > int error; > > @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev > * port (resp). > */ > if (devtype == UART_DEV_CONSOLE) > - spec = kern_getenv("hw.uart.console"); > + cp = kern_getenv("hw.uart.console"); > else if (devtype == UART_DEV_DBGPORT) > - spec = kern_getenv("hw.uart.dbgport"); > + cp = kern_getenv("hw.uart.dbgport"); > else > - spec = NULL; > - if (spec == NULL) > + cp = NULL; > + if (cp == NULL) > return (ENXIO); [..] > default: > + freeenv(__DECONST(char *, cp)); > return (EINVAL); > } > if (*spec == '\0') > break; > - if (*spec != ',') > + if (*spec != ',') { > + freeenv(__DECONST(char *, cp)); > return (EINVAL); > + } > spec++; > } > + freeenv(__DECONST(char *, cp)); > Why not 'char *cp;'? That would avoid __DECONST entirely and would not require spec to change type. There are some cosmetics around that may be worth fixing (e.g. if, else-if instead of switch, while (1) instead of for (;;)). -- Mateusz Guzik From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 06:27:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2012A86; Fri, 24 Oct 2014 06:27:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D321FDC0; Fri, 24 Oct 2014 06:27:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O6RkH2025269; Fri, 24 Oct 2014 06:27:46 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O6Rjre025263; Fri, 24 Oct 2014 06:27:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410240627.s9O6Rjre025263@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 24 Oct 2014 06:27:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273577 - in head/sys/dev/hyperv: netvsc stordisengage storvsc utilities X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:27:47 -0000 Author: delphij Date: Fri Oct 24 06:27:45 2014 New Revision: 273577 URL: https://svnweb.freebsd.org/changeset/base/273577 Log: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_VENDOR or 0 for in-tree driver. This change was verified by Microsoft. Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c head/sys/dev/hyperv/utilities/hv_util.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Oct 24 06:27:45 2014 (r273577) @@ -218,7 +218,7 @@ netvsc_probe(device_t dev) if (bootverbose) printf("Netvsc probe... DONE \n"); - return (0); + return (BUS_PROBE_DEFAULT); } return (ENXIO); Modified: head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c ============================================================================== --- head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c Fri Oct 24 06:27:45 2014 (r273577) @@ -116,7 +116,7 @@ hv_ata_pci_probe(device_t dev) device_set_desc(dev, "Hyper-V ATA storage disengage driver"); - return (BUS_PROBE_VENDOR); + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Fri Oct 24 06:27:45 2014 (r273577) @@ -689,14 +689,14 @@ storvsc_probe(device_t dev) if(bootverbose) device_printf(dev, "Enlightened ATA/IDE detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; } else if(bootverbose) device_printf(dev, "Emulated ATA/IDE set (hw.ata.disk_enable set)\n"); break; case DRIVER_STORVSC: if(bootverbose) device_printf(dev, "Enlightened SCSI device detected\n"); - ret = 0; + ret = BUS_PROBE_DEFAULT; break; default: ret = ENXIO; Modified: head/sys/dev/hyperv/utilities/hv_util.c ============================================================================== --- head/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 05:39:32 2014 (r273576) +++ head/sys/dev/hyperv/utilities/hv_util.c Fri Oct 24 06:27:45 2014 (r273577) @@ -378,7 +378,7 @@ hv_util_probe(device_t dev) const char *p = vmbus_get_type(dev); if (service_table[i].enabled && !memcmp(p, &service_table[i].guid, sizeof(hv_guid))) { device_set_softc(dev, (void *) (&service_table[i])); - rtn_value = 0; + rtn_value = BUS_PROBE_DEFAULT; } } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 06:53:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1D1EBF04; Fri, 24 Oct 2014 06:53:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09708FF2; Fri, 24 Oct 2014 06:53:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O6r65d038886; Fri, 24 Oct 2014 06:53:06 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O6r6ls038885; Fri, 24 Oct 2014 06:53:06 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240653.s9O6r6ls038885@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 06:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273578 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:53:07 -0000 Author: ngie Date: Fri Oct 24 06:53:06 2014 New Revision: 273578 URL: https://svnweb.freebsd.org/changeset/base/273578 Log: - Add inttypes.h and stdint.h in lieu of int_limits.h from NetBSD - Use #include "h_macros.h" instead of relative path analog Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Fri Oct 24 06:27:45 2014 (r273577) +++ head/contrib/netbsd-tests/lib/libc/sys/t_clock_gettime.c Fri Oct 24 06:53:06 2014 (r273578) @@ -63,7 +63,9 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1. #include #include +#if defined(__NetBSD__) #include +#endif #include #include @@ -73,7 +75,13 @@ __RCSID("$NetBSD: t_clock_gettime.c,v 1. #include #include +#if defined(__NetBSD__) #include "../../../h_macros.h" +#else +#include +#include +#include "h_macros.h" +#endif #define MINPOSDIFF 15000000 /* 15 ms for now */ #define TIMEOUT 5 From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 06:57:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 95E2928F; Fri, 24 Oct 2014 06:57:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82452B9; Fri, 24 Oct 2014 06:57:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O6vHcA039447; Fri, 24 Oct 2014 06:57:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O6vHtY039446; Fri, 24 Oct 2014 06:57:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410240657.s9O6vHtY039446@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 06:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273579 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:57:17 -0000 Author: ngie Date: Fri Oct 24 06:57:16 2014 New Revision: 273579 URL: https://svnweb.freebsd.org/changeset/base/273579 Log: - Mark signo __unused in the signal handler function - Effectively #if 0 out some code that does not fail on FreeBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 06:53:06 2014 (r273578) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 06:57:16 2014 (r273579) @@ -47,7 +47,11 @@ static void sighandler(int); static const size_t maxiter = 2000; static void +#if defined(__FreeBSD__) +sighandler(int signo __unused) +#else sighandler(int signo) +#endif { /* Nothing. */ } @@ -168,7 +172,9 @@ ATF_TC_BODY(getrusage_utime_zero, tc) * * See also (duplicate) PR port-amd64/41734. */ +#if defined(__NetBSD__) atf_tc_expect_fail("PR kern/30115"); +#endif for (i = 0; i < maxiter; i++) { @@ -182,7 +188,9 @@ ATF_TC_BODY(getrusage_utime_zero, tc) atf_tc_fail("zero user time from getrusage(2)"); } +#if defined(__NetBSD__) atf_tc_fail("anticipated error did not occur"); +#endif } ATF_TP_ADD_TCS(tp) From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 06:59:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26970464; Fri, 24 Oct 2014 06:59:37 +0000 (UTC) Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [IPv6:2a00:1450:400c:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60451CF; Fri, 24 Oct 2014 06:59:36 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id n3so466657wiv.8 for ; Thu, 23 Oct 2014 23:59:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=GvRd4uRzKNVj1sDS+uteuC9QbBhzjlQynKPPTOvDti0=; b=nYJt7vbRLykSWBZRB1oM4iTSCxSHorpBEhhABR41y5hNIdFQVy+SETatsH05BpdxXG 2I3jkPiTWHIN9MmXT0L4vR8jJ8D8KrrOtwSirdmD1UWVuz9VY3mdkd/VpndLyA7BIPGs KiotisVL86QLH7fxCs/9YRz7TYXRjreSjtAuVWoP6bD0aMJRdY2loYIeRHTsDSr7r1YV hDjDyrc0ucRXjguBDWMIcizF0wKq5LB1/E7Ulc26Fbzz4aEmqBnWi4DRime5a3gmhOdi zunohGM7PPrrLX4uYEoK2f9FEbLYKh7pLWBaljB+5JuacB5asY0Wsax5EzXVu3m9f9bI NUPA== MIME-Version: 1.0 X-Received: by 10.194.157.137 with SMTP id wm9mr2634213wjb.5.1414133974707; Thu, 23 Oct 2014 23:59:34 -0700 (PDT) Received: by 10.216.159.193 with HTTP; Thu, 23 Oct 2014 23:59:34 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <20141024055820.GI11222@dft-labs.eu> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> <20141024055820.GI11222@dft-labs.eu> Date: Fri, 24 Oct 2014 14:59:34 +0800 Message-ID: Subject: Re: svn commit: r273576 - head/sys/dev/uart From: Marcelo Araujo To: Mateusz Guzik Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 06:59:37 -0000 2014-10-24 13:58 GMT+08:00 Mateusz Guzik : > On Fri, Oct 24, 2014 at 05:39:32AM +0000, Marcelo Araujo wrote: > > Author: araujo (ports committer) > > Date: Fri Oct 24 05:39:32 2014 > > New Revision: 273576 > > URL: https://svnweb.freebsd.org/changeset/base/273576 > > > > Log: > > Fix a leaked Storage Variable. > > > > int > > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class > *class) > > { > > - const char *spec; > > + const char *cp, *spec; > > bus_addr_t addr = ~0U; > > int error; > > > > @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev > > * port (resp). > > */ > > if (devtype == UART_DEV_CONSOLE) > > - spec = kern_getenv("hw.uart.console"); > > + cp = kern_getenv("hw.uart.console"); > > else if (devtype == UART_DEV_DBGPORT) > > - spec = kern_getenv("hw.uart.dbgport"); > > + cp = kern_getenv("hw.uart.dbgport"); > > else > > - spec = NULL; > > - if (spec == NULL) > > + cp = NULL; > > + if (cp == NULL) > > return (ENXIO); > [..] > > default: > > + freeenv(__DECONST(char *, cp)); > > return (EINVAL); > > } > > if (*spec == '\0') > > break; > > - if (*spec != ',') > > + if (*spec != ',') { > > + freeenv(__DECONST(char *, cp)); > > return (EINVAL); > > + } > > spec++; > > } > > + freeenv(__DECONST(char *, cp)); > > > > Why not 'char *cp;'? That would avoid __DECONST entirely and would not > require spec to change type. > Well, it might be possible to use 'char *cp', however as I'm not aware of all uart implementation, I just followed the previous 'spec' declaration type that is a constant too. I'm gonna take a look on it, to check if there is any backward to only use 'char *cp'. > > There are some cosmetics around that may be worth fixing (e.g. if, > else-if instead of switch, while (1) instead of for (;;)). > Yes, that for sure makes sense and it is worth. Thanks to point all of these things. Best Regards, -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 09:49:00 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BF4C6B5; Fri, 24 Oct 2014 09:49:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 777A339C; Fri, 24 Oct 2014 09:49:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9O9n0Wx019504; Fri, 24 Oct 2014 09:49:00 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9O9mxNP019487; Fri, 24 Oct 2014 09:48:59 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201410240948.s9O9mxNP019487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Fri, 24 Oct 2014 09:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273582 - in head/sys/amd64: amd64 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 09:49:00 -0000 Author: royger Date: Fri Oct 24 09:48:58 2014 New Revision: 273582 URL: https://svnweb.freebsd.org/changeset/base/273582 Log: amd64: make uiomove_fromphys functional for pages not mapped by the DMAP Place the code introduced in r268660 into a separate function that can be called from uiomove_fromphys. Instead of pre-allocating two KVA pages use vmem_alloc to allocate them on demand when needed. This prevents blocking if a page fault is taken while physical addresses from outside the DMAP are used, since the lock is now removed. Also introduce a safety catch in PHYS_TO_DMAP and DMAP_TO_PHYS. Sponsored by: Citrix Systems R&D Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D947 amd64/amd64/pmap.c: - Factor out the code to deal with non DMAP addresses from pmap_copy_pages and place it in pmap_map_io_transient. - Change the code to use vmem_alloc instead of a set of pre-allocated pages. - Use pmap_qenter and don't pin the thread if there can be page faults. amd64/amd64/uio_machdep.c: - Use pmap_map_io_transient in order to correctly deal with physical addresses not covered by the DMAP. amd64/include/pmap.h: - Add the prototypes for the new functions. amd64/include/vmparam.h: - Add safety catches to make sure PHYS_TO_DMAP and DMAP_TO_PHYS are only used with addresses covered by the DMAP. Modified: head/sys/amd64/amd64/pmap.c head/sys/amd64/amd64/uio_machdep.c head/sys/amd64/include/pmap.h head/sys/amd64/include/vmparam.h Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/amd64/pmap.c Fri Oct 24 09:48:58 2014 (r273582) @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -402,11 +403,6 @@ SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_sav CTLFLAG_MPSAFE, NULL, 0, pmap_pcid_save_cnt_proc, "QU", "Count of saved TLB context on switch"); -/* pmap_copy_pages() over non-DMAP */ -static struct mtx cpage_lock; -static vm_offset_t cpage_a; -static vm_offset_t cpage_b; - /* * Crashdump maps. */ @@ -1072,10 +1068,6 @@ pmap_init(void) M_WAITOK | M_ZERO); for (i = 0; i < pv_npg; i++) TAILQ_INIT(&pv_table[i].pv_list); - - mtx_init(&cpage_lock, "cpage", NULL, MTX_DEF); - cpage_a = kva_alloc(PAGE_SIZE); - cpage_b = kva_alloc(PAGE_SIZE); } static SYSCTL_NODE(_vm_pmap, OID_AUTO, pde, CTLFLAG_RD, 0, @@ -5056,66 +5048,24 @@ pmap_copy_pages(vm_page_t ma[], vm_offse vm_offset_t b_offset, int xfersize) { void *a_cp, *b_cp; - vm_page_t m_a, m_b; - vm_paddr_t p_a, p_b; - pt_entry_t *pte; - vm_offset_t a_pg_offset, b_pg_offset; + vm_page_t pages[2]; + vm_offset_t vaddr[2], a_pg_offset, b_pg_offset; int cnt; - boolean_t pinned; + boolean_t mapped; - /* - * NB: The sequence of updating a page table followed by accesses - * to the corresponding pages used in the !DMAP case is subject to - * the situation described in the "AMD64 Architecture Programmer's - * Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special - * Coherency Considerations". Therefore, issuing the INVLPG right - * after modifying the PTE bits is crucial. - */ - pinned = FALSE; while (xfersize > 0) { a_pg_offset = a_offset & PAGE_MASK; - m_a = ma[a_offset >> PAGE_SHIFT]; - p_a = m_a->phys_addr; + pages[0] = ma[a_offset >> PAGE_SHIFT]; b_pg_offset = b_offset & PAGE_MASK; - m_b = mb[b_offset >> PAGE_SHIFT]; - p_b = m_b->phys_addr; + pages[1] = mb[b_offset >> PAGE_SHIFT]; cnt = min(xfersize, PAGE_SIZE - a_pg_offset); cnt = min(cnt, PAGE_SIZE - b_pg_offset); - if (__predict_false(p_a < DMAP_MIN_ADDRESS || - p_a > DMAP_MIN_ADDRESS + dmaplimit)) { - mtx_lock(&cpage_lock); - sched_pin(); - pinned = TRUE; - pte = vtopte(cpage_a); - *pte = p_a | X86_PG_A | X86_PG_V | - pmap_cache_bits(kernel_pmap, m_a->md.pat_mode, 0); - invlpg(cpage_a); - a_cp = (char *)cpage_a + a_pg_offset; - } else { - a_cp = (char *)PHYS_TO_DMAP(p_a) + a_pg_offset; - } - if (__predict_false(p_b < DMAP_MIN_ADDRESS || - p_b > DMAP_MIN_ADDRESS + dmaplimit)) { - if (!pinned) { - mtx_lock(&cpage_lock); - sched_pin(); - pinned = TRUE; - } - pte = vtopte(cpage_b); - *pte = p_b | X86_PG_A | X86_PG_M | X86_PG_RW | - X86_PG_V | pmap_cache_bits(kernel_pmap, - m_b->md.pat_mode, 0); - invlpg(cpage_b); - b_cp = (char *)cpage_b + b_pg_offset; - } else { - b_cp = (char *)PHYS_TO_DMAP(p_b) + b_pg_offset; - } + mapped = pmap_map_io_transient(pages, vaddr, 2, FALSE); + a_cp = (char *)vaddr[0] + a_pg_offset; + b_cp = (char *)vaddr[1] + b_pg_offset; bcopy(a_cp, b_cp, cnt); - if (__predict_false(pinned)) { - sched_unpin(); - mtx_unlock(&cpage_lock); - pinned = FALSE; - } + if (__predict_false(mapped)) + pmap_unmap_io_transient(pages, vaddr, 2, FALSE); a_offset += cnt; b_offset += cnt; xfersize -= cnt; @@ -6901,6 +6851,107 @@ done: *num = idx; } +/** + * Get the kernel virtual address of a set of physical pages. If there are + * physical addresses not covered by the DMAP perform a transient mapping + * that will be removed when calling pmap_unmap_io_transient. + * + * \param page The pages the caller wishes to obtain the virtual + * address on the kernel memory map. + * \param vaddr On return contains the kernel virtual memory address + * of the pages passed in the page parameter. + * \param count Number of pages passed in. + * \param can_fault TRUE if the thread using the mapped pages can take + * page faults, FALSE otherwise. + * + * \returns TRUE if the caller must call pmap_unmap_io_transient when + * finished or FALSE otherwise. + * + */ +boolean_t +pmap_map_io_transient(vm_page_t page[], vm_offset_t vaddr[], int count, + boolean_t can_fault) +{ + vm_paddr_t paddr; + boolean_t needs_mapping; + pt_entry_t *pte; + int cache_bits, error, i; + + /* + * Allocate any KVA space that we need, this is done in a separate + * loop to prevent calling vmem_alloc while pinned. + */ + needs_mapping = FALSE; + for (i = 0; i < count; i++) { + paddr = VM_PAGE_TO_PHYS(page[i]); + if (__predict_false(paddr >= dmaplimit)) { + error = vmem_alloc(kernel_arena, PAGE_SIZE, + M_BESTFIT | M_WAITOK, &vaddr[i]); + KASSERT(error == 0, ("vmem_alloc failed: %d", error)); + needs_mapping = TRUE; + } else { + vaddr[i] = PHYS_TO_DMAP(paddr); + } + } + + /* Exit early if everything is covered by the DMAP */ + if (!needs_mapping) + return (FALSE); + + /* + * NB: The sequence of updating a page table followed by accesses + * to the corresponding pages used in the !DMAP case is subject to + * the situation described in the "AMD64 Architecture Programmer's + * Manual Volume 2: System Programming" rev. 3.23, "7.3.1 Special + * Coherency Considerations". Therefore, issuing the INVLPG right + * after modifying the PTE bits is crucial. + */ + if (!can_fault) + sched_pin(); + for (i = 0; i < count; i++) { + paddr = VM_PAGE_TO_PHYS(page[i]); + if (paddr >= dmaplimit) { + if (can_fault) { + /* + * Slow path, since we can get page faults + * while mappings are active don't pin the + * thread to the CPU and instead add a global + * mapping visible to all CPUs. + */ + pmap_qenter(vaddr[i], &page[i], 1); + } else { + pte = vtopte(vaddr[i]); + cache_bits = pmap_cache_bits(kernel_pmap, + page[i]->md.pat_mode, 0); + pte_store(pte, paddr | X86_PG_RW | X86_PG_V | + cache_bits); + invlpg(vaddr[i]); + } + } + } + + return (needs_mapping); +} + +void +pmap_unmap_io_transient(vm_page_t page[], vm_offset_t vaddr[], int count, + boolean_t can_fault) +{ + vm_paddr_t paddr; + int i; + + if (!can_fault) + sched_unpin(); + for (i = 0; i < count; i++) { + paddr = VM_PAGE_TO_PHYS(page[i]); + if (paddr >= dmaplimit) { + if (can_fault) + pmap_qremove(vaddr[i], 1); + vmem_free(kernel_arena, vaddr[i], PAGE_SIZE); + } + } +} + #include "opt_ddb.h" #ifdef DDB #include Modified: head/sys/amd64/amd64/uio_machdep.c ============================================================================== --- head/sys/amd64/amd64/uio_machdep.c Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/amd64/uio_machdep.c Fri Oct 24 09:48:58 2014 (r273582) @@ -61,10 +61,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offs struct thread *td = curthread; struct iovec *iov; void *cp; - vm_offset_t page_offset; + vm_offset_t page_offset, vaddr; size_t cnt; int error = 0; int save = 0; + boolean_t mapped; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove_fromphys: mode")); @@ -72,6 +73,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs ("uiomove_fromphys proc")); save = td->td_pflags & TDP_DEADLKTREAT; td->td_pflags |= TDP_DEADLKTREAT; + mapped = FALSE; while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; cnt = iov->iov_len; @@ -84,8 +86,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offs cnt = n; page_offset = offset & PAGE_MASK; cnt = min(cnt, PAGE_SIZE - page_offset); - cp = (char *)PHYS_TO_DMAP(ma[offset >> PAGE_SHIFT]->phys_addr) + - page_offset; + if (uio->uio_segflg != UIO_NOCOPY) { + mapped = pmap_map_io_transient( + &ma[offset >> PAGE_SHIFT], &vaddr, 1, TRUE); + cp = (char *)vaddr + page_offset; + } switch (uio->uio_segflg) { case UIO_USERSPACE: maybe_yield(); @@ -105,6 +110,11 @@ uiomove_fromphys(vm_page_t ma[], vm_offs case UIO_NOCOPY: break; } + if (__predict_false(mapped)) { + pmap_unmap_io_transient(&ma[offset >> PAGE_SHIFT], + &vaddr, 1, TRUE); + mapped = FALSE; + } iov->iov_base = (char *)iov->iov_base + cnt; iov->iov_len -= cnt; uio->uio_resid -= cnt; @@ -113,6 +123,9 @@ uiomove_fromphys(vm_page_t ma[], vm_offs n -= cnt; } out: + if (__predict_false(mapped)) + pmap_unmap_io_transient(&ma[offset >> PAGE_SHIFT], &vaddr, 1, + TRUE); if (save == 0) td->td_pflags &= ~TDP_DEADLKTREAT; return (error); Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/include/pmap.h Fri Oct 24 09:48:58 2014 (r273582) @@ -397,6 +397,8 @@ void pmap_invalidate_cache_pages(vm_page void pmap_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva, boolean_t force); void pmap_get_mapping(pmap_t pmap, vm_offset_t va, uint64_t *ptr, int *num); +boolean_t pmap_map_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); +void pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t); #endif /* _KERNEL */ #endif /* !LOCORE */ Modified: head/sys/amd64/include/vmparam.h ============================================================================== --- head/sys/amd64/include/vmparam.h Fri Oct 24 07:50:34 2014 (r273581) +++ head/sys/amd64/include/vmparam.h Fri Oct 24 09:48:58 2014 (r273582) @@ -175,8 +175,18 @@ #define VM_MAX_ADDRESS UPT_MAX_ADDRESS #define VM_MIN_ADDRESS (0) -#define PHYS_TO_DMAP(x) ((x) | DMAP_MIN_ADDRESS) -#define DMAP_TO_PHYS(x) ((x) & ~DMAP_MIN_ADDRESS) +#define PHYS_TO_DMAP(x) ({ \ + KASSERT((x) < dmaplimit, \ + ("physical address %#jx not covered by the DMAP", \ + (uintmax_t)x)); \ + (x) | DMAP_MIN_ADDRESS; }) + +#define DMAP_TO_PHYS(x) ({ \ + KASSERT((x) < (DMAP_MIN_ADDRESS + dmaplimit) && \ + (x) >= DMAP_MIN_ADDRESS, \ + ("virtual address %#jx not covered by the DMAP", \ + (uintmax_t)x)); \ + (x) & ~DMAP_MIN_ADDRESS; }) /* * How many physical pages per kmem arena virtual page. From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 11:34:56 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9D59F5B; Fri, 24 Oct 2014 11:34:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95D273D9; Fri, 24 Oct 2014 11:34:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OBYurX070575; Fri, 24 Oct 2014 11:34:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OBYujj070574; Fri, 24 Oct 2014 11:34:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241134.s9OBYujj070574@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 11:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273583 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 11:34:56 -0000 Author: trasz Date: Fri Oct 24 11:34:55 2014 New Revision: 273583 URL: https://svnweb.freebsd.org/changeset/base/273583 Log: Tidy up the login code; no functional changes. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Fri Oct 24 09:48:58 2014 (r273582) +++ head/usr.sbin/ctld/login.c Fri Oct 24 11:34:55 2014 (r273583) @@ -672,6 +672,7 @@ login(struct connection *conn) struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; struct auth_group *ag; + struct portal_group *pg; const char *initiator_name, *initiator_alias, *session_type, *target_name, *auth_method; @@ -688,6 +689,8 @@ login(struct connection *conn) log_errx(1, "received Login PDU with non-zero TSIH"); } + pg = conn->conn_portal->p_portal_group; + memcpy(conn->conn_initiator_isid, bhslr->bhslr_isid, sizeof(conn->conn_initiator_isid)); @@ -741,9 +744,7 @@ login(struct connection *conn) log_errx(1, "received Login PDU without TargetName"); } - conn->conn_target = - target_find(conn->conn_portal->p_portal_group->pg_conf, - target_name); + conn->conn_target = target_find(pg->pg_conf, target_name); if (conn->conn_target == NULL) { login_send_error(request, 0x02, 0x03); log_errx(1, "requested target \"%s\" not found", @@ -760,14 +761,14 @@ login(struct connection *conn) log_debugx("initiator requests to connect " "to target \"%s\"; auth-group \"%s\"", conn->conn_target->t_name, - conn->conn_target->t_auth_group->ag_name); + ag->ag_name); } else { log_debugx("initiator requests to connect " "to target \"%s\"", conn->conn_target->t_name); } } else { assert(conn->conn_session_type == CONN_SESSION_TYPE_DISCOVERY); - ag = conn->conn_portal->p_portal_group->pg_discovery_auth_group; + ag = pg->pg_discovery_auth_group; if (ag->ag_name != NULL) { log_debugx("initiator requests " "discovery session; auth-group \"%s\"", ag->ag_name); @@ -837,8 +838,7 @@ login(struct connection *conn) response = login_new_response(request); bhslr2 = (struct iscsi_bhs_login_response *)response->pdu_bhs; bhslr2->bhslr_flags |= BHSLR_FLAGS_TRANSIT; - login_set_nsg(response, - BHSLR_STAGE_OPERATIONAL_NEGOTIATION); + login_set_nsg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); response_keys = keys_new(); /* * Required by Linux initiator. @@ -852,8 +852,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); pdu_send(response); @@ -903,8 +903,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 11:40:11 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E11E524A; Fri, 24 Oct 2014 11:40:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD04F611; Fri, 24 Oct 2014 11:40:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OBeAeN071920; Fri, 24 Oct 2014 11:40:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OBeAaX071917; Fri, 24 Oct 2014 11:40:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241140.s9OBeAaX071917@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 11:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273584 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 11:40:11 -0000 Author: trasz Date: Fri Oct 24 11:40:09 2014 New Revision: 273584 URL: https://svnweb.freebsd.org/changeset/base/273584 Log: Make the initiator-name and initiator-portal checks a little nicer. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/login.c Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Fri Oct 24 11:34:55 2014 (r273583) +++ head/usr.sbin/ctld/ctld.c Fri Oct 24 11:40:09 2014 (r273584) @@ -318,6 +318,18 @@ auth_name_find(const struct auth_group * return (NULL); } +int +auth_name_check(const struct auth_group *ag, const char *initiator_name) +{ + if (!auth_name_defined(ag)) + return (0); + + if (auth_name_find(ag, initiator_name) == NULL) + return (1); + + return (0); +} + const struct auth_portal * auth_portal_new(struct auth_group *ag, const char *portal) { @@ -430,6 +442,19 @@ next: return (NULL); } +int +auth_portal_check(const struct auth_group *ag, const struct sockaddr_storage *sa) +{ + + if (!auth_portal_defined(ag)) + return (0); + + if (auth_portal_find(ag, sa) == NULL) + return (1); + + return (0); +} + struct auth_group * auth_group_new(struct conf *conf, const char *name) { Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Fri Oct 24 11:34:55 2014 (r273583) +++ head/usr.sbin/ctld/ctld.h Fri Oct 24 11:40:09 2014 (r273584) @@ -263,12 +263,16 @@ const struct auth_name *auth_name_new(st bool auth_name_defined(const struct auth_group *ag); const struct auth_name *auth_name_find(const struct auth_group *ag, const char *initiator_name); +int auth_name_check(const struct auth_group *ag, + const char *initiator_name); const struct auth_portal *auth_portal_new(struct auth_group *ag, const char *initiator_portal); bool auth_portal_defined(const struct auth_group *ag); const struct auth_portal *auth_portal_find(const struct auth_group *ag, const struct sockaddr_storage *sa); +int auth_portal_check(const struct auth_group *ag, + const struct sockaddr_storage *sa); struct portal_group *portal_group_new(struct conf *conf, const char *name); void portal_group_delete(struct portal_group *pg); Modified: head/usr.sbin/ctld/login.c ============================================================================== --- head/usr.sbin/ctld/login.c Fri Oct 24 11:34:55 2014 (r273583) +++ head/usr.sbin/ctld/login.c Fri Oct 24 11:40:09 2014 (r273584) @@ -780,28 +780,15 @@ login(struct connection *conn) /* * Enforce initiator-name and initiator-portal. */ - if (auth_name_defined(ag)) { - if (auth_name_find(ag, initiator_name) == NULL) { - login_send_error(request, 0x02, 0x02); - log_errx(1, "initiator does not match allowed " - "initiator names"); - } - log_debugx("initiator matches allowed initiator names"); - } else { - log_debugx("auth-group does not define initiator name " - "restrictions"); + if (auth_name_check(ag, initiator_name) != 0) { + login_send_error(request, 0x02, 0x02); + log_errx(1, "initiator does not match allowed initiator names"); } - if (auth_portal_defined(ag)) { - if (auth_portal_find(ag, &conn->conn_initiator_sa) == NULL) { - login_send_error(request, 0x02, 0x02); - log_errx(1, "initiator does not match allowed " - "initiator portals"); - } - log_debugx("initiator matches allowed initiator portals"); - } else { - log_debugx("auth-group does not define initiator portal " - "restrictions"); + if (auth_portal_check(ag, &conn->conn_initiator_sa) != 0) { + login_send_error(request, 0x02, 0x02); + log_errx(1, "initiator does not match allowed " + "initiator portals"); } /* From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 12:30:44 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 76E11EA7; Fri, 24 Oct 2014 12:30:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62892BE5; Fri, 24 Oct 2014 12:30:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OCUiP3096570; Fri, 24 Oct 2014 12:30:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OCUio2096569; Fri, 24 Oct 2014 12:30:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201410241230.s9OCUio2096569@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 24 Oct 2014 12:30:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273585 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 12:30:44 -0000 Author: trasz Date: Fri Oct 24 12:30:43 2014 New Revision: 273585 URL: https://svnweb.freebsd.org/changeset/base/273585 Log: Improve ctld.conf example. MFC after: 1 month Sponsored by: The FreeBSD Foundation Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Fri Oct 24 11:40:09 2014 (r273584) +++ head/usr.sbin/ctld/ctl.conf.5 Fri Oct 24 12:30:43 2014 (r273585) @@ -295,18 +295,25 @@ configuration file. .Bd -literal pidfile /var/run/ctld.pid -auth-group example2 { +auth-group ag0 { chap-mutual "user" "secret" "mutualuser" "mutualsecret" chap-mutual "user2" "secret2" "mutualuser" "mutualsecret" initiator-portal 192.168.1.1/16 } -portal-group example2 { +auth-group ag1 { + auth-type none + initiator-name "iqn.2012-06.com.example:initiatorhost1" + initiator-name "iqn.2012-06.com.example:initiatorhost2" + initiator-portal 192.168.1.1/24 + initiator-portal [2001:db8::de:ef] +} + +portal-group pg0 { discovery-auth-group no-authentication - listen 127.0.0.1 - listen 0.0.0.0:3261 - listen [::]:3261 - listen [fe80::be:ef] + listen 0.0.0.0:3260 + listen [::]:3260 + listen [fe80::be:ef]:3261 } target iqn.2012-06.com.example:target0 { @@ -319,16 +326,16 @@ target iqn.2012-06.com.example:target0 { } } -target iqn.2012-06.com.example:target3 { +target iqn.2012-06.com.example:target1 { chap chapuser chapsecret lun 0 { - path /dev/zvol/tank/example_3 + path /dev/zvol/tank/example_1 } } target iqn.2012-06.com.example:target2 { - auth-group example2 - portal-group example2 + auth-group ag0 + portal-group pg0 lun 0 { path /dev/zvol/tank/example2_0 } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 13:29:13 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BD972EFB; Fri, 24 Oct 2014 13:29:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A920C286; Fri, 24 Oct 2014 13:29:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ODTDUt022692; Fri, 24 Oct 2014 13:29:13 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ODTDK7022691; Fri, 24 Oct 2014 13:29:13 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410241329.s9ODTDK7022691@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 13:29:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273586 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:29:13 -0000 Author: melifaro Date: Fri Oct 24 13:29:12 2014 New Revision: 273586 URL: https://svnweb.freebsd.org/changeset/base/273586 Log: Fix displaying non-contiguous netmasks. Found by: ae Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Fri Oct 24 12:30:43 2014 (r273585) +++ head/sbin/ipfw/ipfw2.c Fri Oct 24 13:29:12 2014 (r273586) @@ -1225,9 +1225,10 @@ print_ip(struct buf_pr *bp, struct forma else { /* numeric IP followed by some kind of mask */ ia = (struct in_addr *)&a[0]; bprintf(bp, "%s", inet_ntoa(*ia)); - if (mb < 0) - bprintf(bp, ":%s", inet_ntoa(*ia ) ); - else if (mb < 32) + if (mb < 0) { + ia = (struct in_addr *)&a[1]; + bprintf(bp, ":%s", inet_ntoa(*ia)); + } else if (mb < 32) bprintf(bp, "/%d", mb); } if (len > 1) From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 13:34:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C11973B4; Fri, 24 Oct 2014 13:34:23 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ACDF63F8; Fri, 24 Oct 2014 13:34:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ODYNQ4026916; Fri, 24 Oct 2014 13:34:23 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ODYNGX026913; Fri, 24 Oct 2014 13:34:23 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201410241334.s9ODYNGX026913@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 24 Oct 2014 13:34:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273587 - in head/sys: net netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:34:23 -0000 Author: ae Date: Fri Oct 24 13:34:22 2014 New Revision: 273587 URL: https://svnweb.freebsd.org/changeset/base/273587 Log: Remove redundant check and m_pullup() call. Modified: head/sys/net/if_gif.c head/sys/netinet/in_gif.c head/sys/netinet6/in6_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Fri Oct 24 13:29:12 2014 (r273586) +++ head/sys/net/if_gif.c Fri Oct 24 13:34:22 2014 (r273587) @@ -400,8 +400,6 @@ gif_transmit(struct ifnet *ifp, struct m case AF_LINK: proto = IPPROTO_ETHERIP; M_PREPEND(m, sizeof(struct etherip_header), M_NOWAIT); - if (m != NULL && m->m_len < sizeof(struct etherip_header)) - m = m_pullup(m, sizeof(struct etherip_header)); if (m == NULL) { error = ENOBUFS; goto err; Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Fri Oct 24 13:29:12 2014 (r273586) +++ head/sys/netinet/in_gif.c Fri Oct 24 13:34:22 2014 (r273587) @@ -103,8 +103,6 @@ in_gif_output(struct ifnet *ifp, struct len += ETHERIP_ALIGN; #endif M_PREPEND(m, len, M_NOWAIT); - if (m != NULL && m->m_len < len) - m = m_pullup(m, len); if (m == NULL) return (ENOBUFS); #ifndef __NO_STRICT_ALIGNMENT Modified: head/sys/netinet6/in6_gif.c ============================================================================== --- head/sys/netinet6/in6_gif.c Fri Oct 24 13:29:12 2014 (r273586) +++ head/sys/netinet6/in6_gif.c Fri Oct 24 13:34:22 2014 (r273587) @@ -111,8 +111,6 @@ in6_gif_output(struct ifnet *ifp, struct len += ETHERIP_ALIGN; #endif M_PREPEND(m, len, M_NOWAIT); - if (m != NULL && m->m_len < len) - m = m_pullup(m, len); if (m == NULL) return (ENOBUFS); #ifndef __NO_STRICT_ALIGNMENT From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 13:57:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CC52AF4; Fri, 24 Oct 2014 13:57:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28311874; Fri, 24 Oct 2014 13:57:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ODvG4F036740; Fri, 24 Oct 2014 13:57:16 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ODvGvh036739; Fri, 24 Oct 2014 13:57:16 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410241357.s9ODvGvh036739@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 13:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273588 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 13:57:16 -0000 Author: melifaro Date: Fri Oct 24 13:57:15 2014 New Revision: 273588 URL: https://svnweb.freebsd.org/changeset/base/273588 Log: Bump default dynamic limit to 16k entries. Print better log message when limit is hit. PR: 193300 Submitted by: me at nileshgr.com Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c Modified: head/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Oct 24 13:34:22 2014 (r273587) +++ head/sys/netpfil/ipfw/ip_fw_dynamic.c Fri Oct 24 13:57:15 2014 (r273588) @@ -592,8 +592,9 @@ add_dyn_rule(struct ipfw_flow_id *id, in if (r == NULL) { if (last_log != time_uptime) { last_log = time_uptime; - log(LOG_DEBUG, "ipfw: %s: Cannot allocate rule\n", - __func__); + log(LOG_DEBUG, + "ipfw: Cannot allocate dynamic state, " + "consider increasing net.inet.ip.fw.dyn_max\n"); } return NULL; } @@ -1385,7 +1386,7 @@ ipfw_dyn_init(struct ip_fw_chain *chain) V_dyn_keepalive = 1; /* do send keepalives */ V_dyn_keepalive_last = time_uptime; - V_dyn_max = 4096; /* max # of dynamic rules */ + V_dyn_max = 16384; /* max # of dynamic rules */ V_ipfw_dyn_rule_zone = uma_zcreate("IPFW dynamic rule", sizeof(ipfw_dyn_rule), NULL, NULL, NULL, NULL, From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 15:36:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 803E3788; Fri, 24 Oct 2014 15:36:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53863382; Fri, 24 Oct 2014 15:36:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OFaWFR084486; Fri, 24 Oct 2014 15:36:32 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OFaVoA084483; Fri, 24 Oct 2014 15:36:31 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201410241536.s9OFaVoA084483@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 24 Oct 2014 15:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273589 - in head: share/man/man4 sys/dev/usb sys/dev/usb/wlan X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 15:36:32 -0000 Author: kevlo Date: Fri Oct 24 15:36:30 2014 New Revision: 273589 URL: https://svnweb.freebsd.org/changeset/base/273589 Log: Add D-Link DWA-123 rev D1 and Elecom WDC-150SU2M. Modified: head/share/man/man4/urtwn.4 head/sys/dev/usb/usbdevs head/sys/dev/usb/wlan/if_urtwn.c Modified: head/share/man/man4/urtwn.4 ============================================================================== --- head/share/man/man4/urtwn.4 Fri Oct 24 13:57:15 2014 (r273588) +++ head/share/man/man4/urtwn.4 Fri Oct 24 15:36:30 2014 (r273589) @@ -14,7 +14,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 3, 2014 +.Dd October 24, 2014 .Dt URTWN 4 .Os .Sh NAME @@ -89,9 +89,11 @@ IEEE 802.11b/g/n wireless network adapte .It Alfa AWUS036NHR v2 .It ASUS USB-N10 NANO .It Belkin F7D1102 Surf Wireless Micro +.It D-Link DWA-123 rev D1 .It D-Link DWA-125 rev D1 .It D-Link DWA-131 .It Edimax EW-7811Un +.It Elecom WDC-150SU2M .It Netgear WNA1000M .It Realtek RTL8192CU .It Realtek RTL8188CUS Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Oct 24 13:57:15 2014 (r273588) +++ head/sys/dev/usb/usbdevs Fri Oct 24 15:36:30 2014 (r273589) @@ -1596,6 +1596,7 @@ product DLINK DUBE100C1 0x1a02 DUB-E100 product DLINK DSB650TX4 0x200c 10/100 Ethernet product DLINK DWL120E 0x3200 DWL-120 rev E product DLINK DWA125D1 0x330f DWA-125 rev D1 +product DLINK DWA123D1 0x3310 DWA-123 rev D1 product DLINK DWL122 0x3700 DWL-122 product DLINK DWLG120 0x3701 DWL-G120 product DLINK DWL120F 0x3702 DWL-120 rev F @@ -1708,6 +1709,7 @@ product ELECOM MOUSE29UO 0x0002 mouse 29 product ELECOM LDUSBTX0 0x200c LD-USB/TX product ELECOM LDUSBTX1 0x4002 LD-USB/TX product ELECOM LDUSBLTX 0x4005 LD-USBL/TX +product ELECOM WDC150SU2M 0x4008 WDC-150SU2M product ELECOM LDUSBTX2 0x400b LD-USB/TX product ELECOM LDUSB20 0x4010 LD-USB20 product ELECOM UCSGT 0x5003 UC-SGT Modified: head/sys/dev/usb/wlan/if_urtwn.c ============================================================================== --- head/sys/dev/usb/wlan/if_urtwn.c Fri Oct 24 13:57:15 2014 (r273588) +++ head/sys/dev/usb/wlan/if_urtwn.c Fri Oct 24 15:36:30 2014 (r273589) @@ -153,7 +153,9 @@ static const STRUCT_USB_HOST_ID urtwn_de URTWN_DEV(TRENDNET, RTL8192CU), URTWN_DEV(ZYXEL, RTL8192CU), /* URTWN_RTL8188E */ + URTWN_RTL8188E_DEV(DLINK, DWA123D1), URTWN_RTL8188E_DEV(DLINK, DWA125D1), + URTWN_RTL8188E_DEV(ELECOM, WDC150SU2M), URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV), URTWN_RTL8188E_DEV(REALTEK, RTL8188EU), #undef URTWN_RTL8188E_DEV From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 15:44:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5F47BAF7; Fri, 24 Oct 2014 15:44:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4B51D672; Fri, 24 Oct 2014 15:44:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OFiUf9088924; Fri, 24 Oct 2014 15:44:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OFiUZP088923; Fri, 24 Oct 2014 15:44:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201410241544.s9OFiUZP088923@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 24 Oct 2014 15:44:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273590 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 15:44:30 -0000 Author: ian Date: Fri Oct 24 15:44:29 2014 New Revision: 273590 URL: https://svnweb.freebsd.org/changeset/base/273590 Log: Accept the documented FDT compatible string for the PL310 cache controller as well as the non-standard string we've been using for a couple years. Modified: head/sys/arm/arm/pl310.c Modified: head/sys/arm/arm/pl310.c ============================================================================== --- head/sys/arm/arm/pl310.c Fri Oct 24 15:36:30 2014 (r273589) +++ head/sys/arm/arm/pl310.c Fri Oct 24 15:44:29 2014 (r273590) @@ -84,6 +84,12 @@ static uint32_t g_ways_assoc; static struct pl310_softc *pl310_softc; +static struct ofw_compat_data compat_data[] = { + {"arm,pl310", true}, /* Non-standard, FreeBSD. */ + {"arm,pl310-cache", true}, + {NULL, false} +}; + void pl310_print_config(struct pl310_softc *sc) { @@ -422,8 +428,7 @@ pl310_probe(device_t dev) if (!ofw_bus_status_okay(dev)) return (ENXIO); - - if (!ofw_bus_is_compatible(dev, "arm,pl310")) + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) return (ENXIO); device_set_desc(dev, "PL310 L2 cache controller"); return (0); From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 16:07:32 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AC33117D; Fri, 24 Oct 2014 16:07:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E2ED8F9; Fri, 24 Oct 2014 16:07:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OG7Wrb099196; Fri, 24 Oct 2014 16:07:32 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OG7WrR099195; Fri, 24 Oct 2014 16:07:32 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410241607.s9OG7WrR099195@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 16:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273591 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 16:07:32 -0000 Author: ngie Date: Fri Oct 24 16:07:31 2014 New Revision: 273591 URL: https://svnweb.freebsd.org/changeset/base/273591 Log: Correct my previous commit: - getrusage_utime_back succeeds reliably on FreeBSD - getrusage_utime_zero passes/fails in a seemingly non-deterministic manner. Skip it for now (and fix it later) In the initial port of this testcase to FreeBSD, the results failed reliably in the same manner as it does on NetBSD Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 15:44:29 2014 (r273590) +++ head/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c Fri Oct 24 16:07:31 2014 (r273591) @@ -133,7 +133,9 @@ ATF_TC_BODY(getrusage_utime_back, tc) /* * Test that two consecutive calls are sane. */ +#ifdef __NetBSD__ atf_tc_expect_fail("PR kern/30115"); +#endif for (i = 0; i < maxiter; i++) { @@ -152,7 +154,9 @@ ATF_TC_BODY(getrusage_utime_back, tc) atf_tc_fail("user time went backwards"); } +#ifdef __NetBSD__ atf_tc_fail("anticipated error did not occur"); +#endif } ATF_TC(getrusage_utime_zero); @@ -166,15 +170,18 @@ ATF_TC_BODY(getrusage_utime_zero, tc) struct rusage ru; size_t i; +#ifdef __FreeBSD__ + atf_tc_skip("this testcase passes/fails sporadically on FreeBSD/i386 " + "@ r273153 (at least)"); +#endif + /* * Test that getrusage(2) does not return * zero user time for the calling process. * * See also (duplicate) PR port-amd64/41734. */ -#if defined(__NetBSD__) atf_tc_expect_fail("PR kern/30115"); -#endif for (i = 0; i < maxiter; i++) { @@ -188,9 +195,7 @@ ATF_TC_BODY(getrusage_utime_zero, tc) atf_tc_fail("zero user time from getrusage(2)"); } -#if defined(__NetBSD__) atf_tc_fail("anticipated error did not occur"); -#endif } ATF_TP_ADD_TCS(tp) From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 16:18:17 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63BFC8CC; Fri, 24 Oct 2014 16:18:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F7FAA55; Fri, 24 Oct 2014 16:18:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OGIHiZ004617; Fri, 24 Oct 2014 16:18:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OGIHAJ004616; Fri, 24 Oct 2014 16:18:17 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410241618.s9OGIHAJ004616@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Fri, 24 Oct 2014 16:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273592 - head/contrib/netbsd-tests/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 16:18:17 -0000 Author: ngie Date: Fri Oct 24 16:18:16 2014 New Revision: 273592 URL: https://svnweb.freebsd.org/changeset/base/273592 Log: - Add sys/types.h for the APIs in sys/sysctl.h - Poke at VM_MIN_ADDRESS in machine/vmparam.h because FreeBSD doesn't have a vm.minaddress sysctl analog - Expect ENOMEM instead of EAGAIN in mlock_limits - Provide mlock an mmap'ed page twice to simulate MAP_WIRED on NetBSD In collaboration with: pho Sponsored by: EMC / Isilon Storage Division Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Modified: head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Fri Oct 24 16:07:31 2014 (r273591) +++ head/contrib/netbsd-tests/lib/libc/sys/t_mlock.c Fri Oct 24 16:18:16 2014 (r273592) @@ -31,6 +31,9 @@ #include __RCSID("$NetBSD: t_mlock.c,v 1.5 2014/02/26 20:49:26 martin Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -43,6 +46,11 @@ __RCSID("$NetBSD: t_mlock.c,v 1.5 2014/0 #include #include +#ifdef __FreeBSD__ +#define _KMEMUSER +#include +#endif + static long page = 0; ATF_TC(mlock_clip); @@ -79,16 +87,25 @@ ATF_TC_HEAD(mlock_err, tc) ATF_TC_BODY(mlock_err, tc) { +#ifdef __NetBSD__ unsigned long vmin = 0; size_t len = sizeof(vmin); +#endif void *invalid_ptr; int null_errno = ENOMEM; /* error expected for NULL */ +#ifdef __FreeBSD__ +#ifdef VM_MIN_ADDRESS + if ((uintptr_t)VM_MIN_ADDRESS > 0) + null_errno = EINVAL; /* NULL is not inside user VM */ +#endif +#else if (sysctlbyname("vm.minaddress", &vmin, &len, NULL, 0) != 0) atf_tc_fail("failed to read vm.minaddress"); if (vmin > 0) null_errno = EINVAL; /* NULL is not inside user VM */ +#endif errno = 0; ATF_REQUIRE_ERRNO(null_errno, mlock(NULL, page) == -1); @@ -156,7 +173,17 @@ ATF_TC_BODY(mlock_limits, tc) errno = 0; +#ifdef __FreeBSD__ + /* + * NetBSD doesn't conform to POSIX with ENOMEM requirement; + * FreeBSD does. + * + * See: NetBSD PR # kern/48962 for more details. + */ + if (mlock(buf, i) != -1 || errno != ENOMEM) { +#else if (mlock(buf, i) != -1 || errno != EAGAIN) { +#endif (void)munlock(buf, i); _exit(EXIT_FAILURE); } @@ -181,7 +208,11 @@ ATF_TC_HEAD(mlock_mmap, tc) ATF_TC_BODY(mlock_mmap, tc) { +#ifdef __NetBSD__ static const int flags = MAP_ANON | MAP_PRIVATE | MAP_WIRED; +#else + static const int flags = MAP_ANON | MAP_PRIVATE; +#endif void *buf; /* @@ -191,6 +222,13 @@ ATF_TC_BODY(mlock_mmap, tc) buf = mmap(NULL, page, PROT_READ | PROT_WRITE, flags, -1, 0); ATF_REQUIRE(buf != MAP_FAILED); +#ifdef __FreeBSD__ + /* + * The duplicate mlock call is added to ensure that the call works + * as described above without MAP_WIRED support. + */ + ATF_REQUIRE(mlock(buf, page) == 0); +#endif ATF_REQUIRE(mlock(buf, page) == 0); ATF_REQUIRE(munlock(buf, page) == 0); ATF_REQUIRE(munmap(buf, page) == 0); @@ -202,7 +240,11 @@ ATF_TC_BODY(mlock_mmap, tc) buf = mmap(NULL, page, PROT_NONE, flags, -1, 0); ATF_REQUIRE(buf != MAP_FAILED); +#ifdef __FreeBSD__ + ATF_REQUIRE_ERRNO(ENOMEM, mlock(buf, page) != 0); +#else ATF_REQUIRE(mlock(buf, page) != 0); +#endif ATF_REQUIRE(munmap(buf, page) == 0); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 16:39:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CE71C31A; Fri, 24 Oct 2014 16:39:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0B24CA9; Fri, 24 Oct 2014 16:39:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OGd21v016325; Fri, 24 Oct 2014 16:39:02 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OGd2xC016324; Fri, 24 Oct 2014 16:39:02 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201410241639.s9OGd2xC016324@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 24 Oct 2014 16:39:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273593 - head/sys/ofed/drivers/net/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 16:39:02 -0000 Author: hselasky Date: Fri Oct 24 16:39:01 2014 New Revision: 273593 URL: https://svnweb.freebsd.org/changeset/base/273593 Log: Update the network interface baudrate integer according to the actual line rate. Submitted by: jhb @ MFC after: 1 week Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Oct 24 16:18:16 2014 (r273592) +++ head/sys/ofed/drivers/net/mlx4/en_netdev.c Fri Oct 24 16:39:01 2014 (r273593) @@ -970,6 +970,9 @@ static void mlx4_en_do_set_rx_mode(struc /* Important note: the following call for if_link_state_change * is needed for interface up scenario (start port, link state * change) */ + /* update netif baudrate */ + priv->dev->if_baudrate = + IF_Mbps(priv->port_state.link_speed); if_link_state_change(priv->dev, LINK_STATE_UP); en_dbg(HW, priv, "Link Up\n"); } @@ -1186,6 +1189,9 @@ static void mlx4_en_linkstate(struct wor if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) { en_info(priv, "Link Down\n"); if_link_state_change(priv->dev, LINK_STATE_DOWN); + /* update netif baudrate */ + priv->dev->if_baudrate = 0; + /* make sure the port is up before notifying the OS. * This is tricky since we get here on INIT_PORT and * in such case we can't tell the OS the port is up. @@ -1193,6 +1199,10 @@ static void mlx4_en_linkstate(struct wor * in set_rx_mode. * */ } else if (priv->port_up && (linkstate == MLX4_DEV_EVENT_PORT_UP)){ + if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) + en_info(priv, "Query port failed\n"); + priv->dev->if_baudrate = + IF_Mbps(priv->port_state.link_speed); en_info(priv, "Link Up\n"); if_link_state_change(priv->dev, LINK_STATE_UP); } @@ -1978,7 +1988,6 @@ int mlx4_en_init_netdev(struct mlx4_en_d dev->if_softc = priv; if_initname(dev, "mlxen", atomic_fetchadd_int(&mlx4_en_unit, 1)); dev->if_mtu = ETHERMTU; - dev->if_baudrate = 1000000000; dev->if_init = mlx4_en_open; dev->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; dev->if_ioctl = mlx4_en_ioctl; From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 17:06:57 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 183C3F6B; Fri, 24 Oct 2014 17:06:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0458CF8E; Fri, 24 Oct 2014 17:06:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OH6uUH033900; Fri, 24 Oct 2014 17:06:56 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OH6uOd033898; Fri, 24 Oct 2014 17:06:56 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201410241706.s9OH6uOd033898@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 24 Oct 2014 17:06:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273594 - head/sbin/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 17:06:57 -0000 Author: melifaro Date: Fri Oct 24 17:06:56 2014 New Revision: 273594 URL: https://svnweb.freebsd.org/changeset/base/273594 Log: Fix documentation issue. PR: 194581 Submitted by: madpilot Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Fri Oct 24 16:39:01 2014 (r273593) +++ head/sbin/ipfw/ipfw.8 Fri Oct 24 17:06:56 2014 (r273594) @@ -2014,7 +2014,7 @@ Shows generic table information and algo The following lookup algorithms are supported: .Bl -tag -width indent .It Ar algo-desc : algo-name | "algo-name algo-data" -.It Ar algo-name: Ar addr:radix | addr:hash | iface:arrray | number:array | flow:hash +.It Ar algo-name: Ar addr:radix | addr:hash | iface:array | number:array | flow:hash .It Cm addr:radix Separate Radix trees for IPv4 and IPv6, the same way as the routing table (see .Xr route 4 ) . @@ -2030,7 +2030,7 @@ Assume /32 and /128 masks by default. Search removes host bits (according to mask) from supplied address and checks resulting key in appropriate hash. Mostly optimized for /64 and byte-ranged IPv6 masks. -.It Cm iface:arrray +.It Cm iface:array Array storing sorted indexes for entries which are presented in the system. Optimized for very fast lookup. .It Cm number:array From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 18:39:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B29891B; Fri, 24 Oct 2014 18:39:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C884BB7; Fri, 24 Oct 2014 18:39:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OIdG65077142; Fri, 24 Oct 2014 18:39:16 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OIdG0E077139; Fri, 24 Oct 2014 18:39:16 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410241839.s9OIdG0E077139@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 18:39:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273598 - in head: include sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 18:39:16 -0000 Author: rpaulo Date: Fri Oct 24 18:39:15 2014 New Revision: 273598 URL: https://svnweb.freebsd.org/changeset/base/273598 Log: HPET: create /dev/hpetN as a way to access HPET from userland. In some cases, TSC is broken and special applications might benefit from memory mapping HPET and reading the registers to count time. Most often the main HPET counter is 32-bit only[1], so this only gives the application a 300 second window based on the default HPET interval. Other applications, such as Intel's DPDK, expect /dev/hpet to be present and use it to count time as well. Although we have an almost userland version of gettimeofday() which uses rdtsc in userland, it's not always possible to use it, depending on how broken the multi-socket hardware is. Install the acpi_hpet.h so that applications can use the HPET register definitions. [1] I haven't found a system where HPET's main counter uses more than 32 bit. There seems to be a discrepancy in the Intel documentation (claiming it's a 64-bit counter) and the actual implementation (a 32-bit counter in a 64-bit memory area). MFC after: 1 week Relnotes: yes Modified: head/include/Makefile head/sys/dev/acpica/acpi_hpet.c Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Fri Oct 24 17:40:32 2014 (r273597) +++ head/include/Makefile Fri Oct 24 18:39:15 2014 (r273598) @@ -159,6 +159,8 @@ copies: cd ${.CURDIR}/../sys/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ + ${DESTDIR}${INCLUDEDIR}/dev/acpica cd ${.CURDIR}/../sys/dev/agp; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ ${DESTDIR}${INCLUDEDIR}/dev/agp @@ -243,7 +245,7 @@ symlinks: done .endfor cd ${.CURDIR}/../sys/dev/acpica; \ - for h in acpiio.h; do \ + for h in acpiio.h acpi_hpet.h; do \ ln -fs ../../../../sys/dev/acpica/$$h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ done Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) @@ -35,11 +35,13 @@ __FBSDID("$FreeBSD$"); #include "opt_apic.h" #endif #include +#include #include #include #include #include #include +#include #include #include #include @@ -106,6 +108,23 @@ struct hpet_softc { char name[8]; } t[32]; int num_timers; + struct cdev *pdev; + int mmap_allow; + int mmap_allow_write; + int devinuse; +}; + +static d_open_t hpet_open; +static d_close_t hpet_close; +static d_mmap_t hpet_mmap; + +static struct cdevsw hpet_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_TRACKCLOSE, + .d_name = "hpet", + .d_open = hpet_open, + .d_close = hpet_close, + .d_mmap = hpet_mmap, }; static u_int hpet_get_timecount(struct timecounter *tc); @@ -317,6 +336,47 @@ hpet_find_irq_rid(device_t dev, u_long s } } +static int +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) +{ + struct hpet_softc *sc; + + sc = cdev->si_drv1; + if (!sc->mmap_allow) + return (EPERM); + if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) + return (EBUSY); + else + return (0); +} + +static int +hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) +{ + struct hpet_softc *sc; + + sc = cdev->si_drv1; + sc->devinuse = 0; + + return (0); +} + +static int +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, + int nprot, vm_memattr_t *memattr) +{ + struct hpet_softc *sc; + + sc = cdev->si_drv1; + if (offset > rman_get_size(sc->mem_res)) + return (EINVAL); + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) + return (EPERM); + *paddr = rman_get_start(sc->mem_res) + offset; + + return (0); +} + /* Discover the HPET via the ACPI table of the same name. */ static void hpet_identify(driver_t *driver, device_t parent) @@ -701,6 +761,26 @@ hpet_attach(device_t dev) maxhpetet++; } } + + sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0600, "hpet%d", device_get_unit(dev)); + if (sc->pdev) { + sc->pdev->si_drv1 = sc; + sc->mmap_allow = 1; + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", + &sc->mmap_allow); + sc->mmap_allow_write = 1; + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", + &sc->mmap_allow_write); + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "mmap_allow", + CTLFLAG_RW, &sc->mmap_allow, 0, + "Allow userland to memory map HPET"); + } else + device_printf(dev, "could not create /dev/hpet%d\n", + device_get_unit(dev)); + return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 18:47:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 733DAC45; Fri, 24 Oct 2014 18:47:02 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1DF05C9A; Fri, 24 Oct 2014 18:47:02 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3959CB968; Fri, 24 Oct 2014 14:47:00 -0400 (EDT) From: John Baldwin To: Marcelo Araujo Subject: Re: svn commit: r273576 - head/sys/dev/uart Date: Fri, 24 Oct 2014 12:14:48 -0400 Message-ID: <235737869.CpTJALnJpW@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410240539.s9O5dWWK002150@svn.freebsd.org> References: <201410240539.s9O5dWWK002150@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 24 Oct 2014 14:47:00 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 18:47:02 -0000 On Friday, October 24, 2014 05:39:32 AM Marcelo Araujo wrote: > Author: araujo (ports committer) > Date: Fri Oct 24 05:39:32 2014 > New Revision: 273576 > URL: https://svnweb.freebsd.org/changeset/base/273576 > > Log: > Fix a leaked Storage Variable. > > Phabric: D981 > Submitted by: myself > Reported by: Coverity > CID: 1248848 > Reworked by: kevlo > Reviewed by: marcel, davide, ray, kevlo > Approved by: marcel, kevlo > > Modified: > head/sys/dev/uart/uart_subr.c > > Modified: head/sys/dev/uart/uart_subr.c > ============================================================================== > --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014 (r273575) > +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014 (r273576) > @@ -196,7 +196,7 @@ out: > int > uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class) > { > - const char *spec; > + const char *cp, *spec; Dropping const here is preferable to using __DECONST() for the freeenv() calls. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:04:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 702931A5; Fri, 24 Oct 2014 19:04:09 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4763EE5C; Fri, 24 Oct 2014 19:04:09 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 56A94B945; Fri, 24 Oct 2014 15:04:08 -0400 (EDT) From: John Baldwin To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Date: Fri, 24 Oct 2014 15:03:52 -0400 Message-ID: <21470251.4Nq3ilUAWE@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410241839.s9OIdG0E077139@svn.freebsd.org> References: <201410241839.s9OIdG0E077139@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 24 Oct 2014 15:04:08 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:04:09 -0000 On Friday, October 24, 2014 06:39:16 PM Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 24 18:39:15 2014 > New Revision: 273598 > URL: https://svnweb.freebsd.org/changeset/base/273598 > > Log: > HPET: create /dev/hpetN as a way to access HPET from userland. > > In some cases, TSC is broken and special applications might benefit > from memory mapping HPET and reading the registers to count time. > Most often the main HPET counter is 32-bit only[1], so this only gives > the application a 300 second window based on the default HPET > interval. > Other applications, such as Intel's DPDK, expect /dev/hpet to be > present and use it to count time as well. > > Although we have an almost userland version of gettimeofday() which > uses rdtsc in userland, it's not always possible to use it, depending > on how broken the multi-socket hardware is. > > Install the acpi_hpet.h so that applications can use the HPET register > definitions. > > [1] I haven't found a system where HPET's main counter uses more than > 32 bit. There seems to be a discrepancy in the Intel documentation > (claiming it's a 64-bit counter) and the actual implementation (a > 32-bit counter in a 64-bit memory area). > > MFC after: 1 week > Relnotes: yes > > Modified: > head/include/Makefile > head/sys/dev/acpica/acpi_hpet.c > > Modified: head/sys/dev/acpica/acpi_hpet.c > ============================================================================== > --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) > +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) > +static struct cdevsw hpet_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_TRACKCLOSE, > + .d_name = "hpet", > + .d_open = hpet_open, > + .d_close = hpet_close, D_TRACKCLOSE isn't really reliable, and in this case it probably isn't what you want anyway (you want last close I think). If a process opens /dev/hpetN and then forks a child that calls closefrom() and then exec, close() from Closefrom() will invoke hpet_close() and clear devinuse even though the parent is still using it. Removing D_TRACKCLOSE would defer hpet_close() until all references to the fd were dropped. Alternatively, you might consider dropping the devinuse stuff entirely if you don't need it. It doesn't prevent the fd from being shared with child processes across fork(). -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:06:05 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D71D3349; Fri, 24 Oct 2014 19:06:05 +0000 (UTC) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 8A35DE78; Fri, 24 Oct 2014 19:06:03 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id WAA12100; Fri, 24 Oct 2014 22:06:01 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1XhkBU-0006Tv-UP; Fri, 24 Oct 2014 22:06:00 +0300 Message-ID: <544AA2E1.7000508@FreeBSD.org> Date: Fri, 24 Oct 2014 22:05:05 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Rui Paulo , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica References: <201410241839.s9OIdG0E077139@svn.freebsd.org> In-Reply-To: <201410241839.s9OIdG0E077139@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:06:06 -0000 On 24/10/2014 21:39, Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 24 18:39:15 2014 > New Revision: 273598 > URL: https://svnweb.freebsd.org/changeset/base/273598 > > Log: > HPET: create /dev/hpetN as a way to access HPET from userland. > > In some cases, TSC is broken and special applications might benefit > from memory mapping HPET and reading the registers to count time. > Most often the main HPET counter is 32-bit only[1], so this only gives > the application a 300 second window based on the default HPET > interval. > Other applications, such as Intel's DPDK, expect /dev/hpet to be > present and use it to count time as well. Does this device attempt to play nice with eventtimer infrastructure that may use the same timer? > Although we have an almost userland version of gettimeofday() which > uses rdtsc in userland, it's not always possible to use it, depending > on how broken the multi-socket hardware is. > > Install the acpi_hpet.h so that applications can use the HPET register > definitions. > > [1] I haven't found a system where HPET's main counter uses more than > 32 bit. There seems to be a discrepancy in the Intel documentation > (claiming it's a 64-bit counter) and the actual implementation (a > 32-bit counter in a 64-bit memory area). > > MFC after: 1 week > Relnotes: yes > > Modified: > head/include/Makefile > head/sys/dev/acpica/acpi_hpet.c > > Modified: head/include/Makefile > ============================================================================== > --- head/include/Makefile Fri Oct 24 17:40:32 2014 (r273597) > +++ head/include/Makefile Fri Oct 24 18:39:15 2014 (r273598) > @@ -159,6 +159,8 @@ copies: > cd ${.CURDIR}/../sys/dev/acpica; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica > + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ > + ${DESTDIR}${INCLUDEDIR}/dev/acpica > cd ${.CURDIR}/../sys/dev/agp; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ > ${DESTDIR}${INCLUDEDIR}/dev/agp > @@ -243,7 +245,7 @@ symlinks: > done > .endfor > cd ${.CURDIR}/../sys/dev/acpica; \ > - for h in acpiio.h; do \ > + for h in acpiio.h acpi_hpet.h; do \ > ln -fs ../../../../sys/dev/acpica/$$h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ > done > > Modified: head/sys/dev/acpica/acpi_hpet.c > ============================================================================== > --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) > +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) > @@ -35,11 +35,13 @@ __FBSDID("$FreeBSD$"); > #include "opt_apic.h" > #endif > #include > +#include > #include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -106,6 +108,23 @@ struct hpet_softc { > char name[8]; > } t[32]; > int num_timers; > + struct cdev *pdev; > + int mmap_allow; > + int mmap_allow_write; > + int devinuse; > +}; > + > +static d_open_t hpet_open; > +static d_close_t hpet_close; > +static d_mmap_t hpet_mmap; > + > +static struct cdevsw hpet_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_TRACKCLOSE, > + .d_name = "hpet", > + .d_open = hpet_open, > + .d_close = hpet_close, > + .d_mmap = hpet_mmap, > }; > > static u_int hpet_get_timecount(struct timecounter *tc); > @@ -317,6 +336,47 @@ hpet_find_irq_rid(device_t dev, u_long s > } > } > > +static int > +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (!sc->mmap_allow) > + return (EPERM); > + if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) > + return (EBUSY); > + else > + return (0); > +} > + > +static int > +hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + sc->devinuse = 0; > + > + return (0); > +} > + > +static int > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > + int nprot, vm_memattr_t *memattr) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (offset > rman_get_size(sc->mem_res)) > + return (EINVAL); > + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > + return (EPERM); > + *paddr = rman_get_start(sc->mem_res) + offset; > + > + return (0); > +} > + > /* Discover the HPET via the ACPI table of the same name. */ > static void > hpet_identify(driver_t *driver, device_t parent) > @@ -701,6 +761,26 @@ hpet_attach(device_t dev) > maxhpetet++; > } > } > + > + sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, > + 0600, "hpet%d", device_get_unit(dev)); > + if (sc->pdev) { > + sc->pdev->si_drv1 = sc; > + sc->mmap_allow = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", > + &sc->mmap_allow); > + sc->mmap_allow_write = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", > + &sc->mmap_allow_write); > + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, "mmap_allow", > + CTLFLAG_RW, &sc->mmap_allow, 0, > + "Allow userland to memory map HPET"); > + } else > + device_printf(dev, "could not create /dev/hpet%d\n", > + device_get_unit(dev)); > + > return (0); > } > > -- Andriy Gapon From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:18:40 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D0108666; Fri, 24 Oct 2014 19:18:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC88DFA8; Fri, 24 Oct 2014 19:18:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJIeij095755; Fri, 24 Oct 2014 19:18:40 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJIev4095754; Fri, 24 Oct 2014 19:18:40 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410241918.s9OJIev4095754@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 24 Oct 2014 19:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273599 - head/sys/arm/arm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:18:40 -0000 Author: loos Date: Fri Oct 24 19:18:39 2014 New Revision: 273599 URL: https://svnweb.freebsd.org/changeset/base/273599 Log: Fix a bug where DMA maps created with bus_dmamap_create() won't increment the map count and without being able to keep track of the current map allocation, bus_dma_tag_destroy() will fail to proceed and will return EBUSY even after all the maps have been correctly destroyed with bus_dmamap_destroy(). Found while testing the detach method of a NIC. Tested on: BBB (am335x) Reviewed by: cognet, ian MFC after: 1 week Modified: head/sys/arm/arm/busdma_machdep-v6.c Modified: head/sys/arm/arm/busdma_machdep-v6.c ============================================================================== --- head/sys/arm/arm/busdma_machdep-v6.c Fri Oct 24 18:39:15 2014 (r273598) +++ head/sys/arm/arm/busdma_machdep-v6.c Fri Oct 24 19:18:39 2014 (r273599) @@ -719,6 +719,8 @@ bus_dmamap_create(bus_dma_tag_t dmat, in if (map->flags & DMAMAP_COHERENT) atomic_add_32(&maps_coherent, 1); atomic_add_32(&maps_total, 1); + dmat->map_count++; + return (0); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:20:23 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C5E77C3; Fri, 24 Oct 2014 19:20:23 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 146DDFB6; Fri, 24 Oct 2014 19:20:22 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9OJKGKn043108 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Oct 2014 22:20:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9OJKGKn043108 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9OJKGmq043107; Fri, 24 Oct 2014 22:20:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Oct 2014 22:20:16 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Message-ID: <20141024192016.GD1877@kib.kiev.ua> References: <201410241839.s9OIdG0E077139@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201410241839.s9OIdG0E077139@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:20:23 -0000 On Fri, Oct 24, 2014 at 06:39:16PM +0000, Rui Paulo wrote: > Author: rpaulo > Date: Fri Oct 24 18:39:15 2014 > New Revision: 273598 > URL: https://svnweb.freebsd.org/changeset/base/273598 > > Log: > HPET: create /dev/hpetN as a way to access HPET from userland. > > In some cases, TSC is broken and special applications might benefit > from memory mapping HPET and reading the registers to count time. > Most often the main HPET counter is 32-bit only[1], so this only gives > the application a 300 second window based on the default HPET > interval. > Other applications, such as Intel's DPDK, expect /dev/hpet to be > present and use it to count time as well. > > Although we have an almost userland version of gettimeofday() which > uses rdtsc in userland, it's not always possible to use it, depending > on how broken the multi-socket hardware is. Yes, and hpet userland mapping would be better handled through the same fake-vdso framework. As designed, it has discriminator to inform userspace about algorithm, and can happilly utilize HPET timecounter automatically mapped by kernel into the process address space. > > Install the acpi_hpet.h so that applications can use the HPET register > definitions. > > [1] I haven't found a system where HPET's main counter uses more than > 32 bit. There seems to be a discrepancy in the Intel documentation > (claiming it's a 64-bit counter) and the actual implementation (a > 32-bit counter in a 64-bit memory area). > > MFC after: 1 week > Relnotes: yes > > Modified: > head/include/Makefile > head/sys/dev/acpica/acpi_hpet.c > > Modified: head/include/Makefile > ============================================================================== > --- head/include/Makefile Fri Oct 24 17:40:32 2014 (r273597) > +++ head/include/Makefile Fri Oct 24 18:39:15 2014 (r273598) > @@ -159,6 +159,8 @@ copies: > cd ${.CURDIR}/../sys/dev/acpica; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica > + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ > + ${DESTDIR}${INCLUDEDIR}/dev/acpica > cd ${.CURDIR}/../sys/dev/agp; \ > ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 agpreg.h \ > ${DESTDIR}${INCLUDEDIR}/dev/agp > @@ -243,7 +245,7 @@ symlinks: > done > .endfor > cd ${.CURDIR}/../sys/dev/acpica; \ > - for h in acpiio.h; do \ > + for h in acpiio.h acpi_hpet.h; do \ > ln -fs ../../../../sys/dev/acpica/$$h \ > ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ > done > > Modified: head/sys/dev/acpica/acpi_hpet.c > ============================================================================== > --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 17:40:32 2014 (r273597) > +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 18:39:15 2014 (r273598) > @@ -35,11 +35,13 @@ __FBSDID("$FreeBSD$"); > #include "opt_apic.h" > #endif > #include > +#include > #include > #include > #include > #include > #include > +#include > #include > #include > #include > @@ -106,6 +108,23 @@ struct hpet_softc { > char name[8]; > } t[32]; > int num_timers; > + struct cdev *pdev; > + int mmap_allow; > + int mmap_allow_write; > + int devinuse; > +}; > + > +static d_open_t hpet_open; > +static d_close_t hpet_close; > +static d_mmap_t hpet_mmap; > + > +static struct cdevsw hpet_cdevsw = { > + .d_version = D_VERSION, > + .d_flags = D_TRACKCLOSE, > + .d_name = "hpet", > + .d_open = hpet_open, > + .d_close = hpet_close, > + .d_mmap = hpet_mmap, > }; > > static u_int hpet_get_timecount(struct timecounter *tc); > @@ -317,6 +336,47 @@ hpet_find_irq_rid(device_t dev, u_long s > } > } > > +static int > +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (!sc->mmap_allow) > + return (EPERM); > + if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) > + return (EBUSY); This is extra-weird. The devinuse business disallows simultaneous opens, which prevents other process from opening and mapping. But if the original caller does mmap and close, second process now is allowed to open and mmap. That said, why do you need this devinuse at all ? > + else > + return (0); > +} > + > +static int > +hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + sc->devinuse = 0; > + > + return (0); > +} > + > +static int > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > + int nprot, vm_memattr_t *memattr) > +{ > + struct hpet_softc *sc; > + > + sc = cdev->si_drv1; > + if (offset > rman_get_size(sc->mem_res)) > + return (EINVAL); > + if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > + return (EPERM); > + *paddr = rman_get_start(sc->mem_res) + offset; What is the memattr for the backing page ? Is it set to non-cached mode somehow ? I was not able to find place where would this happen. > + > + return (0); > +} > + > /* Discover the HPET via the ACPI table of the same name. */ > static void > hpet_identify(driver_t *driver, device_t parent) > @@ -701,6 +761,26 @@ hpet_attach(device_t dev) > maxhpetet++; > } > } > + > + sc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, > + 0600, "hpet%d", device_get_unit(dev)); > + if (sc->pdev) { > + sc->pdev->si_drv1 = sc; > + sc->mmap_allow = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", > + &sc->mmap_allow); > + sc->mmap_allow_write = 1; > + TUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", > + &sc->mmap_allow_write); > + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), > + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > + OID_AUTO, "mmap_allow", > + CTLFLAG_RW, &sc->mmap_allow, 0, > + "Allow userland to memory map HPET"); Why is mmap_allow is per-instance, while mmap_allow_write taken from the global tunable ? > + } else > + device_printf(dev, "could not create /dev/hpet%d\n", > + device_get_unit(dev)); > + > return (0); > } > From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:33:16 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9741BDF; Fri, 24 Oct 2014 19:33:16 +0000 (UTC) Received: from st11p02mm-asmtp001.mac.com (st11p02mm-asmtp001.mac.com [17.172.220.236]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 85A591FF; Fri, 24 Oct 2014 19:33:15 +0000 (UTC) Received: from st11p02mm-spool002.mac.com ([17.172.220.247]) by st11p02mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTP id <0NDY00JY0RN68T20@st11p02mm-asmtp001.mac.com>; Fri, 24 Oct 2014 19:33:08 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-24_06:2014-10-24,2014-10-24,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410240163 MIME-version: 1.0 Received: from localhost ([17.172.220.161]) by st11p02mm-spool002.mac.com (Oracle Communications Messaging Server 7u4-27.08(7.0.4.27.7) 64bit (built Aug 22 2013)) with ESMTP id <0NDY00FD7RN7A660@st11p02mm-spool002.mac.com>; Fri, 24 Oct 2014 19:33:07 +0000 (GMT) To: Konstantin Belousov From: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Date: Fri, 24 Oct 2014 19:33:07 +0000 (GMT) X-Mailer: iCloud MailClient14G39 MailServer14G.17174 X-Originating-IP: [12.218.212.178] Message-id: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:33:16 -0000 On Oct 24, 2014, at 12:20 PM, Konstantin Belousov wr= ote:=0A=0AOn Fri, Oct 24, 2014 at 06:39:16PM +0000, Rui Paulo wrote:=0A> A= uthor: rpaulo=0A> Date: Fri Oct 24 18:39:15 2014=0A> New Revision: 273598=0A= > URL: https://svnweb.freebsd.org/changeset/base/273598=0A> =0A> Log:=0A> = HPET: create /dev/hpetN as a way to access HPET from userland.=0A> =0A> In= some cases, TSC is broken and special applications might benefit=0A> from= memory mapping HPET and reading the registers to count time.=0A> Most oft= en the main HPET counter is 32-bit only[1], so this only gives=0A> the app= lication a 300 second window based on the default HPET=0A> interval.=0A> O= ther applications, such as Intel's DPDK, expect /dev/hpet to be=0A> presen= t and use it to count time as well.=0A> =0A> Although we have an almost us= erland version of gettimeofday() which=0A> uses rdtsc in userland, it's no= t always possible to use it, depending=0A> on how broken the multi-socket = hardware is.=0AYes, and hpet userland mapping would be better handled thro= ugh the same=0Afake-vdso framework. As designed, it has discriminator to i= nform=0Auserspace about algorithm, and can happilly utilize HPET timecount= er=0Aautomatically mapped by kernel into the process address space.=0A=C2=A0= =0AI'm aware of that, but I found the vdso a bit confusing and decided to = work on that later.=0A=0A> +static int=0A> +hpet_open(struct cdev *cdev, i= nt oflags, int devtype, struct thread *td)=0A> +{=0A> + =C2=A0 =C2=A0 =C2=A0= struct hpet_softc *sc;=0A> +=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0sc =3D cdev-= >si_drv1;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (!sc->mmap_allow)=0A> + =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0return (EPERM);=0A> + =C2=A0 =C2=A0 =C2=A0if (= atomic_cmpset_32(&sc->devinuse, 0, 1) =3D=3D 0)=0A> + =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0return (EBUSY);=0AThis is extra-weird.=0AThe devinuse= business disallows simultaneous opens, which prevents=0Aother process fro= m opening and mapping. But if the original caller=0Adoes mmap and close, s= econd process now is allowed to open and mmap.=0A=0AThat said, why do you = need this devinuse at all ?=0A=C2=A0=0AHmm, I wanted to avoid multiple mma= p's, but that doesn't work like you said. =C2=A0I may just remove this res= triction.=C2=A0=0A=0A> +static int=0A> +hpet_mmap(struct cdev *cdev, vm_oo= ffset_t offset, vm_paddr_t *paddr,=0A> + int nprot, vm_memattr_t *memattr)= =0A> +{=0A> + =C2=A0 =C2=A0struct hpet_softc *sc;=0A> +=0A> + =C2=A0 =C2=A0= sc =3D cdev->si_drv1;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (offset > rman_g= et_size(sc->mem_res))=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0return (EINVAL);=0A> + =C2=A0 =C2=A0if (!sc->mmap_allow_write && (n= prot & PROT_WRITE))=0A> + =C2=A0 =C2=A0 =C2=A0return (EPERM);=0A> + =C2=A0= =C2=A0 =C2=A0*paddr =3D rman_get_start(sc->mem_res) + offset;=0AWhat is t= he memattr for the backing page ? Is it set to non-cached=0Amode somehow ?= I was not able to find place where would this happen.=0A=C2=A0=0AI expect= it to be set to non-cached since it's a device anyway, but I don't know w= here it is. =C2=A0During my testing, I did not see any problems with cache= d values, though.=0A=0A> + =C2=A0sc->pdev =3D make_dev(&hpet_cdevsw, 0, UI= D_ROOT, GID_WHEEL,=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 0600, "hpet%d", devic= e_get_unit(dev));=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0if (sc->pdev) {=0A> + =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sc->pdev->si_drv1 =3D = sc;=0A> + =C2=A0 =C2=A0 =C2=A0sc->mmap_allow =3D 1;=0A> + =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TUNABLE_INT_FETCH("hw.acpi.hpet.mmap= _allow",=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &sc->mmap_allow);= =0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sc->mmap_allow_write =3D 1= ;=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0TUNABLE_INT_FETCH("hw.acp= i.hpet.mmap_allow_write",=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 &sc->mmap_allow_write);=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),=0A> + =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 SYSCTL_CHILDREN(devic= e_get_sysctl_tree(dev)),=0A> + =C2=A0 =C2=A0 =C2=A0 OID_AUTO, "mmap_allow"= ,=0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 CTLFLAG_RW, &sc->mmap_allow, 0,= =0A> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Allow user= land to memory map HPET");=0AWhy is mmap_allow is per-instance, while mmap= _allow_write taken from=0Athe global tunable ?=0A=C2=A0=0AAre you asking w= hy there's no sysctl for it?= From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:45:08 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3065A372; Fri, 24 Oct 2014 19:45:08 +0000 (UTC) Received: from st11p02mm-asmtp002.mac.com (st11p02mm-asmtpout002.mac.com [17.172.220.237]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EC39C359; Fri, 24 Oct 2014 19:45:07 +0000 (UTC) Received: from st11p02mm-spool002.mac.com ([17.172.220.247]) by st11p02mm-asmtp002.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTP id <0NDY000M1S70XD80@st11p02mm-asmtp002.mac.com>; Fri, 24 Oct 2014 19:45:01 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-24_06:2014-10-24,2014-10-24,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410240166 MIME-version: 1.0 Received: from localhost ([17.172.220.161]) by st11p02mm-spool002.mac.com (Oracle Communications Messaging Server 7u4-27.08(7.0.4.27.7) 64bit (built Aug 22 2013)) with ESMTP id <0NDY00FYTS70A660@st11p02mm-spool002.mac.com>; Fri, 24 Oct 2014 19:45:00 +0000 (GMT) To: Andriy Gapon From: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Date: Fri, 24 Oct 2014 19:45:00 +0000 (GMT) X-Mailer: iCloud MailClient14G39 MailServer14G.17174 X-Originating-IP: [12.218.212.178] Message-id: <2f9b110c-2681-4e3d-b9e0-5ca0eb2763f9@me.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.18-1 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Rui Paulo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:45:08 -0000 On Oct 24, 2014, at 12:06 PM, Andriy Gapon wrote:=0A=0AO= n 24/10/2014 21:39, Rui Paulo wrote:=0A> Author: rpaulo=0A> Date: Fri Oct = 24 18:39:15 2014=0A> New Revision: 273598=0A> URL: https://svnweb.freebsd.= org/changeset/base/273598=0A> =0A> Log:=0A> HPET: create /dev/hpetN as a w= ay to access HPET from userland.=0A> =0A> In some cases, TSC is broken and= special applications might benefit=0A> from memory mapping HPET and readi= ng the registers to count time.=0A> Most often the main HPET counter is 32= -bit only[1], so this only gives=0A> the application a 300 second window b= ased on the default HPET=0A> interval.=0A> Other applications, such as Int= el's DPDK, expect /dev/hpet to be=0A> present and use it to count time as = well.=0A=0ADoes this device attempt to play nice with eventtimer infrastru= cture that may=0Ause the same timer?=0A=C2=A0=0ANo. =C2=A0That's up to the= userland applications and that's why I implemented the read-only restrict= ion.= From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:45:52 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AF7CB4B4; Fri, 24 Oct 2014 19:45:52 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A0EF361; Fri, 24 Oct 2014 19:45:52 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9OJjkbs049020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Oct 2014 22:45:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9OJjkbs049020 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9OJjkgY049019; Fri, 24 Oct 2014 22:45:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Oct 2014 22:45:46 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Message-ID: <20141024194546.GE1877@kib.kiev.ua> References: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:45:52 -0000 On Fri, Oct 24, 2014 at 07:33:07PM +0000, Rui Paulo wrote: > On Oct 24, 2014, at 12:20 PM, Konstantin Belousov wrote: > > On Fri, Oct 24, 2014 at 06:39:16PM +0000, Rui Paulo wrote: > > Author: rpaulo > > Date: Fri Oct 24 18:39:15 2014 > > New Revision: 273598 > > URL: https://svnweb.freebsd.org/changeset/base/273598 > > > > Log: > > HPET: create /dev/hpetN as a way to access HPET from userland. > > > > In some cases, TSC is broken and special applications might benefit > > from memory mapping HPET and reading the registers to count time. > > Most often the main HPET counter is 32-bit only[1], so this only gives > > the application a 300 second window based on the default HPET > > interval. > > Other applications, such as Intel's DPDK, expect /dev/hpet to be > > present and use it to count time as well. > > > > Although we have an almost userland version of gettimeofday() which > > uses rdtsc in userland, it's not always possible to use it, depending > > on how broken the multi-socket hardware is. > Yes, and hpet userland mapping would be better handled through the same > fake-vdso framework. As designed, it has discriminator to inform > userspace about algorithm, and can happilly utilize HPET timecounter > automatically mapped by kernel into the process address space. > š > I'm aware of that, but I found the vdso a bit confusing and decided to work on that later. > > > +static int > > +hpet_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) > > +{ > > + š š šstruct hpet_softc *sc; > > + > > + š š š šsc = cdev->si_drv1; > > + š š š šif (!sc->mmap_allow) > > + š š š š šreturn (EPERM); > > + š š šif (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) > > + š š š š š šreturn (EBUSY); > This is extra-weird. > The devinuse business disallows simultaneous opens, which prevents > other process from opening and mapping. But if the original caller > does mmap and close, second process now is allowed to open and mmap. > > That said, why do you need this devinuse at all ? > š > Hmm, I wanted to avoid multiple mmap's, but that doesn't work like you said. šI may just remove this restriction.š > This is probably best. > > +static int > > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > > + int nprot, vm_memattr_t *memattr) > > +{ > > + š šstruct hpet_softc *sc; > > + > > + š šsc = cdev->si_drv1; > > + š š š šif (offset > rman_get_size(sc->mem_res)) > > + š š š š š š š šreturn (EINVAL); > > + š šif (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > > + š š šreturn (EPERM); > > + š š š*paddr = rman_get_start(sc->mem_res) + offset; > What is the memattr for the backing page ? Is it set to non-cached > mode somehow ? I was not able to find place where would this happen. > š > I expect it to be set to non-cached since it's a device anyway, but I don't know where it is. šDuring my testing, I did not see any problems with cached values, though. > I am not claiming that it is wrong, only that I do not see an easy reason why it is right. Just printing the *memattr would provide the confidence. > > + šsc->pdev = make_dev(&hpet_cdevsw, 0, UID_ROOT, GID_WHEEL, > > + š š š š 0600, "hpet%d", device_get_unit(dev)); > > + š š š šif (sc->pdev) { > > + š š š š š š š šsc->pdev->si_drv1 = sc; > > + š š šsc->mmap_allow = 1; > > + š š š š š š š šTUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow", > > + š š š š š š &sc->mmap_allow); > > + š š š š š šsc->mmap_allow_write = 1; > > + š š š š š šTUNABLE_INT_FETCH("hw.acpi.hpet.mmap_allow_write", > > + š š š š š š š š &sc->mmap_allow_write); > > + š š š š š š š šSYSCTL_ADD_INT(device_get_sysctl_ctx(dev), > > + š š š š š š š š SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), > > + š š š OID_AUTO, "mmap_allow", > > + š š š š š CTLFLAG_RW, &sc->mmap_allow, 0, > > + š š š š š š š š "Allow userland to memory map HPET"); > Why is mmap_allow is per-instance, while mmap_allow_write taken from > the global tunable ? > š > Are you asking why there's no sysctl for it? IMO the allow-write must be controllable per-instance, or just managed by /dev/hpet* unix permissions. Having one global knob, which is consulted at the module load, is not flexible. What is the use-case for writing to HPET page ? To manually micro-adjust the timer ? Then, you probably want to disable write for instance used by system timecounter or eventtimer, but allow for HPET utilized by other consumers. From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:55:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 890B66CD; Fri, 24 Oct 2014 19:55:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 750AB63E; Fri, 24 Oct 2014 19:55:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJtp6G014245; Fri, 24 Oct 2014 19:55:51 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJtnbm014234; Fri, 24 Oct 2014 19:55:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410241955.s9OJtnbm014234@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Oct 2014 19:55:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273601 - head/lib/libc/gen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:55:51 -0000 Author: jhb Date: Fri Oct 24 19:55:49 2014 New Revision: 273601 URL: https://svnweb.freebsd.org/changeset/base/273601 Log: Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). Modified: head/lib/libc/gen/sem_destroy.3 head/lib/libc/gen/sem_getvalue.3 head/lib/libc/gen/sem_init.3 head/lib/libc/gen/sem_open.3 head/lib/libc/gen/sem_post.3 head/lib/libc/gen/sem_timedwait.3 head/lib/libc/gen/sem_wait.3 Modified: head/lib/libc/gen/sem_destroy.3 ============================================================================== --- head/lib/libc/gen/sem_destroy.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_destroy.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -67,8 +67,7 @@ There are currently threads blocked on t points to. .El .Sh SEE ALSO -.Xr sem_init 3 , -.Xr sem 4 +.Xr sem_init 3 .Sh STANDARDS The .Fn sem_destroy Modified: head/lib/libc/gen/sem_getvalue.3 ============================================================================== --- head/lib/libc/gen/sem_getvalue.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_getvalue.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -65,8 +65,7 @@ points to an invalid semaphore. .Sh SEE ALSO .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_getvalue Modified: head/lib/libc/gen/sem_init.3 ============================================================================== --- head/lib/libc/gen/sem_init.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_init.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -93,8 +93,7 @@ Memory allocation error. .Xr sem_getvalue 3 , .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_init Modified: head/lib/libc/gen/sem_open.3 ============================================================================== --- head/lib/libc/gen/sem_open.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_open.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -210,8 +210,7 @@ The named semaphore does not exist. .Xr sem_getvalue 3 , .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_open , Modified: head/lib/libc/gen/sem_post.3 ============================================================================== --- head/lib/libc/gen/sem_post.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_post.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -69,8 +69,7 @@ points to an invalid semaphore. .Sh SEE ALSO .Xr sem_getvalue 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_post Modified: head/lib/libc/gen/sem_timedwait.3 ============================================================================== --- head/lib/libc/gen/sem_timedwait.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_timedwait.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -108,8 +108,7 @@ A signal interrupted this function. .Sh SEE ALSO .Xr sem_post 3 , .Xr sem_trywait 3 , -.Xr sem_wait 3 , -.Xr sem 4 +.Xr sem_wait 3 .Sh STANDARDS The .Fn sem_timedwait Modified: head/lib/libc/gen/sem_wait.3 ============================================================================== --- head/lib/libc/gen/sem_wait.3 Fri Oct 24 19:38:05 2014 (r273600) +++ head/lib/libc/gen/sem_wait.3 Fri Oct 24 19:55:49 2014 (r273601) @@ -92,8 +92,7 @@ The semaphore value was zero, and thus c .Sh SEE ALSO .Xr sem_getvalue 3 , .Xr sem_post 3 , -.Xr sem_timedwait 3 , -.Xr sem 4 +.Xr sem_timedwait 3 .Sh STANDARDS The .Fn sem_wait From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:58:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 60C1984B; Fri, 24 Oct 2014 19:58:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 330AA658; Fri, 24 Oct 2014 19:58:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJw1qK014546; Fri, 24 Oct 2014 19:58:01 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJw1em014545; Fri, 24 Oct 2014 19:58:01 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410241958.s9OJw1em014545@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 19:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273602 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:58:01 -0000 Author: rpaulo Date: Fri Oct 24 19:58:00 2014 New Revision: 273602 URL: https://svnweb.freebsd.org/changeset/base/273602 Log: HPET: avoid handling the multiple file-descriptor case. It had two bugs: one where mmap was still allowed and another where D_TRACKCLOSE doesn't handle all cases. Thanks to jhb and kib for pointing them out. MFC after: 1 week Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 19:55:49 2014 (r273601) +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 19:58:00 2014 (r273602) @@ -111,19 +111,15 @@ struct hpet_softc { struct cdev *pdev; int mmap_allow; int mmap_allow_write; - int devinuse; }; static d_open_t hpet_open; -static d_close_t hpet_close; static d_mmap_t hpet_mmap; static struct cdevsw hpet_cdevsw = { .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE, .d_name = "hpet", .d_open = hpet_open, - .d_close = hpet_close, .d_mmap = hpet_mmap, }; @@ -344,24 +340,11 @@ hpet_open(struct cdev *cdev, int oflags, sc = cdev->si_drv1; if (!sc->mmap_allow) return (EPERM); - if (atomic_cmpset_32(&sc->devinuse, 0, 1) == 0) - return (EBUSY); else return (0); } static int -hpet_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) -{ - struct hpet_softc *sc; - - sc = cdev->si_drv1; - sc->devinuse = 0; - - return (0); -} - -static int hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) { @@ -378,7 +361,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_ } /* Discover the HPET via the ACPI table of the same name. */ -static void +static void hpet_identify(driver_t *driver, device_t parent) { ACPI_TABLE_HPET *hpet; @@ -710,8 +693,8 @@ hpet_attach(device_t dev) #ifdef DEV_APIC if ((t->caps & HPET_TCAP_FSB_INT_DEL) && t->irq >= 0) { uint64_t addr; - uint32_t data; - + uint32_t data; + if (PCIB_MAP_MSI( device_get_parent(device_get_parent(dev)), dev, t->irq, &addr, &data) == 0) { @@ -825,8 +808,8 @@ hpet_resume(device_t dev) #ifdef DEV_APIC if (t->irq >= 0 && (sc->legacy_route == 0 || i >= 2)) { uint64_t addr; - uint32_t data; - + uint32_t data; + if (PCIB_MAP_MSI( device_get_parent(device_get_parent(dev)), dev, t->irq, &addr, &data) == 0) { @@ -897,7 +880,7 @@ hpet_remap_intr(device_t dev, device_t c struct hpet_softc *sc = device_get_softc(dev); struct hpet_timer *t; uint64_t addr; - uint32_t data; + uint32_t data; int error, i; for (i = 0; i < sc->num_timers; i++) { From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 19:58:27 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7C16989; Fri, 24 Oct 2014 19:58:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA96765E; Fri, 24 Oct 2014 19:58:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OJwRJx014666; Fri, 24 Oct 2014 19:58:27 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OJwPpd014649; Fri, 24 Oct 2014 19:58:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410241958.s9OJwPpd014649@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Oct 2014 19:58:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273603 - in head/sys: amd64/conf arm/conf conf i386/conf pc98/conf powerpc/conf sparc64/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 19:58:28 -0000 Author: jhb Date: Fri Oct 24 19:58:24 2014 New Revision: 273603 URL: https://svnweb.freebsd.org/changeset/base/273603 Log: Add COMPAT_FREEBSD9 and COMPAT_FREEBSD10 options to wrap code that provides compatability for FreeBSD 9.x and 10.x binaries. Enable these options in kernel configs that enable other COMPAT_FREEBSD options. Modified: head/sys/amd64/conf/GENERIC head/sys/arm/conf/ATMEL head/sys/conf/NOTES head/sys/conf/options head/sys/i386/conf/GENERIC head/sys/i386/conf/XEN head/sys/pc98/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/sparc64/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/amd64/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -53,6 +53,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support Modified: head/sys/arm/conf/ATMEL ============================================================================== --- head/sys/arm/conf/ATMEL Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/arm/conf/ATMEL Fri Oct 24 19:58:24 2014 (r273603) @@ -60,6 +60,8 @@ options GEOM_LABEL # Provides labeliza options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/conf/NOTES Fri Oct 24 19:58:24 2014 (r273603) @@ -351,6 +351,12 @@ options COMPAT_FREEBSD6 # Enable FreeBSD7 compatibility syscalls options COMPAT_FREEBSD7 +# Enable FreeBSD9 compatibility syscalls +options COMPAT_FREEBSD9 + +# Enable FreeBSD10 compatibility syscalls +options COMPAT_FREEBSD10 + # # These three options provide support for System V Interface # Definition-style interprocess communication, in the form of shared Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/conf/options Fri Oct 24 19:58:24 2014 (r273603) @@ -83,6 +83,8 @@ COMPAT_FREEBSD4 opt_compat.h COMPAT_FREEBSD5 opt_compat.h COMPAT_FREEBSD6 opt_compat.h COMPAT_FREEBSD7 opt_compat.h +COMPAT_FREEBSD9 opt_compat.h +COMPAT_FREEBSD10 opt_compat.h COMPILING_LINT opt_global.h COMPRESS_USER_CORES opt_core.h CY_PCI_FASTINTR Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/i386/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -54,6 +54,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support Modified: head/sys/i386/conf/XEN ============================================================================== --- head/sys/i386/conf/XEN Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/i386/conf/XEN Fri Oct 24 19:58:24 2014 (r273603) @@ -36,6 +36,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options KTRACE # ktrace(1) support options STACK # stack(9) support options SYSVSHM # SYSV-style shared memory Modified: head/sys/pc98/conf/GENERIC ============================================================================== --- head/sys/pc98/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/pc98/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -51,6 +51,8 @@ options COMPAT_FREEBSD4 # Compatible w options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options EPSON_BOUNCEDMA # use bounce buffer for 15-16M #options EPSON_MEMWIN # EPSON memory window support Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/powerpc/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -59,6 +59,8 @@ options COMPAT_FREEBSD4 #Keep this for options COMPAT_FREEBSD5 #Compatible with FreeBSD5 options COMPAT_FREEBSD6 #Compatible with FreeBSD6 options COMPAT_FREEBSD7 #Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support Modified: head/sys/powerpc/conf/GENERIC64 ============================================================================== --- head/sys/powerpc/conf/GENERIC64 Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/powerpc/conf/GENERIC64 Fri Oct 24 19:58:24 2014 (r273603) @@ -59,6 +59,8 @@ options COMPAT_FREEBSD32 #Compatible wi options COMPAT_FREEBSD5 #Compatible with FreeBSD5 options COMPAT_FREEBSD6 #Compatible with FreeBSD6 options COMPAT_FREEBSD7 #Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 #Delay (in ms) before probing SCSI options KTRACE #ktrace(1) syscall trace support options STACK #stack(9) support Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Fri Oct 24 19:58:00 2014 (r273602) +++ head/sys/sparc64/conf/GENERIC Fri Oct 24 19:58:24 2014 (r273603) @@ -51,6 +51,8 @@ options GEOM_LABEL # Provides labeliza options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options COMPAT_FREEBSD6 # Compatible with FreeBSD6 options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options COMPAT_FREEBSD9 # Compatible with FreeBSD9 +options COMPAT_FREEBSD10 # Compatible with FreeBSD10 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 20:02:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5914BB07; Fri, 24 Oct 2014 20:02:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43CC6765; Fri, 24 Oct 2014 20:02:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OK2kuJ018824; Fri, 24 Oct 2014 20:02:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OK2i3w018818; Fri, 24 Oct 2014 20:02:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410242002.s9OK2i3w018818@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 Oct 2014 20:02:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273604 - in head: include lib/libc/gen sys/kern sys/sys usr.bin/truss X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 20:02:46 -0000 Author: jhb Date: Fri Oct 24 20:02:44 2014 New Revision: 273604 URL: https://svnweb.freebsd.org/changeset/base/273604 Log: The current POSIX semaphore implementation stores the _has_waiters flag in a separate word from the _count. This does not permit both items to be updated atomically in a portable manner. As a result, sem_post() must always perform a system call to safely clear _has_waiters. This change removes the _has_waiters field and instead uses the high bit of _count as the _has_waiters flag. A new umtx object type (_usem2) and two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to implement these semantics. The older operations are still supported under the COMPAT_FREEBSD9/10 options. The POSIX semaphore API in libc has been updated to use the new implementation. Note that the new implementation is not compatible with the previous implementation. However, this only affects static binaries (which cannot be helped by symbol versioning). Binaries using a dynamic libc will continue to work fine. SEM_MAGIC has been bumped so that mismatched binaries will error rather than corrupting a shared semaphore. In addition, a padding field has been added to sem_t so that it remains the same size. Differential Revision: https://reviews.freebsd.org/D961 Reported by: adrian Reviewed by: kib, jilles (earlier version) Sponsored by: Norse Modified: head/include/semaphore.h head/lib/libc/gen/sem_new.c head/sys/kern/kern_umtx.c head/sys/sys/_umtx.h head/sys/sys/umtx.h head/usr.bin/truss/syscalls.c Modified: head/include/semaphore.h ============================================================================== --- head/include/semaphore.h Fri Oct 24 19:58:24 2014 (r273603) +++ head/include/semaphore.h Fri Oct 24 20:02:44 2014 (r273604) @@ -38,7 +38,8 @@ struct _sem { __uint32_t _magic; - struct _usem _kern; + struct _usem2 _kern; + __uint32_t _padding; /* Preserve structure size */ }; typedef struct _sem sem_t; Modified: head/lib/libc/gen/sem_new.c ============================================================================== --- head/lib/libc/gen/sem_new.c Fri Oct 24 19:58:24 2014 (r273603) +++ head/lib/libc/gen/sem_new.c Fri Oct 24 20:02:44 2014 (r273604) @@ -61,7 +61,9 @@ __weak_reference(_sem_unlink, sem_unlink __weak_reference(_sem_wait, sem_wait); #define SEM_PREFIX "/tmp/SEMD" -#define SEM_MAGIC ((u_int32_t)0x73656d31) +#define SEM_MAGIC ((u_int32_t)0x73656d32) + +_Static_assert(SEM_VALUE_MAX <= USEM_MAX_COUNT, "SEM_VALUE_MAX too large"); struct sem_nameinfo { int open_count; @@ -131,7 +133,6 @@ _sem_init(sem_t *sem, int pshared, unsig bzero(sem, sizeof(sem_t)); sem->_magic = SEM_MAGIC; sem->_kern._count = (u_int32_t)value; - sem->_kern._has_waiters = 0; sem->_kern._flags = pshared ? USYNC_PROCESS_SHARED : 0; return (0); } @@ -212,7 +213,6 @@ _sem_open(const char *name, int flags, . sem_t tmp; tmp._magic = SEM_MAGIC; - tmp._kern._has_waiters = 0; tmp._kern._count = value; tmp._kern._flags = USYNC_PROCESS_SHARED | SEM_NAMED; if (_write(fd, &tmp, sizeof(tmp)) != sizeof(tmp)) @@ -332,18 +332,18 @@ _sem_getvalue(sem_t * __restrict sem, in if (sem_check_validity(sem) != 0) return (-1); - *sval = (int)sem->_kern._count; + *sval = (int)USEM_COUNT(sem->_kern._count); return (0); } static __inline int -usem_wake(struct _usem *sem) +usem_wake(struct _usem2 *sem) { - return _umtx_op(sem, UMTX_OP_SEM_WAKE, 0, NULL, NULL); + return _umtx_op(sem, UMTX_OP_SEM2_WAKE, 0, NULL, NULL); } static __inline int -usem_wait(struct _usem *sem, const struct timespec *abstime) +usem_wait(struct _usem2 *sem, const struct timespec *abstime) { struct _umtx_time *tm_p, timeout; size_t tm_size; @@ -358,7 +358,7 @@ usem_wait(struct _usem *sem, const struc tm_p = &timeout; tm_size = sizeof(timeout); } - return _umtx_op(sem, UMTX_OP_SEM_WAIT, 0, + return _umtx_op(sem, UMTX_OP_SEM2_WAIT, 0, (void *)tm_size, __DECONST(void*, tm_p)); } @@ -370,7 +370,7 @@ _sem_trywait(sem_t *sem) if (sem_check_validity(sem) != 0) return (-1); - while ((val = sem->_kern._count) > 0) { + while (USEM_COUNT(val = sem->_kern._count) > 0) { if (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1)) return (0); } @@ -390,7 +390,7 @@ _sem_timedwait(sem_t * __restrict sem, retval = 0; _pthread_testcancel(); for (;;) { - while ((val = sem->_kern._count) > 0) { + while (USEM_COUNT(val = sem->_kern._count) > 0) { if (atomic_cmpset_acq_int(&sem->_kern._count, val, val - 1)) return (0); } @@ -439,9 +439,10 @@ _sem_post(sem_t *sem) do { count = sem->_kern._count; - if (count + 1 > SEM_VALUE_MAX) + if (USEM_COUNT(count) + 1 > SEM_VALUE_MAX) return (EOVERFLOW); - } while(!atomic_cmpset_rel_int(&sem->_kern._count, count, count+1)); - (void)usem_wake(&sem->_kern); + } while (!atomic_cmpset_rel_int(&sem->_kern._count, count, count + 1)); + if (count & USEM_HAS_WAITERS) + usem_wake(&sem->_kern); return (0); } Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Fri Oct 24 19:58:24 2014 (r273603) +++ head/sys/kern/kern_umtx.c Fri Oct 24 20:02:44 2014 (r273604) @@ -2710,6 +2710,7 @@ out: return (error); } +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) static int do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time *timeout) { @@ -2731,7 +2732,7 @@ do_sem_wait(struct thread *td, struct _u umtxq_busy(&uq->uq_key); umtxq_insert(uq); umtxq_unlock(&uq->uq_key); - casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); + casuword32(&sem->_has_waiters, 0, 1); count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); if (count != 0) { umtxq_lock(&uq->uq_key); @@ -2761,7 +2762,7 @@ do_sem_wait(struct thread *td, struct _u } /* - * Signal a userland condition variable. + * Signal a userland semaphore. */ static int do_sem_wake(struct thread *td, struct _usem *sem) @@ -2795,6 +2796,119 @@ do_sem_wake(struct thread *td, struct _u umtx_key_release(&key); return (error); } +#endif + +static int +do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time *timeout) +{ + struct abs_timeout timo; + struct umtx_q *uq; + uint32_t count, flags; + int error; + + uq = td->td_umtxq; + flags = fuword32(&sem->_flags); + error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &uq->uq_key); + if (error != 0) + return (error); + + if (timeout != NULL) + abs_timeout_init2(&timo, timeout); + + umtxq_lock(&uq->uq_key); + umtxq_busy(&uq->uq_key); + umtxq_insert(uq); + umtxq_unlock(&uq->uq_key); + count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); + if (count == -1) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + for (;;) { + if (USEM_COUNT(count) != 0) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (0); + } + if (count == USEM_HAS_WAITERS) + break; + count = casuword32(&sem->_count, 0, USEM_HAS_WAITERS); + if (count == -1) { + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (EFAULT); + } + if (count == 0) + break; + } + umtxq_lock(&uq->uq_key); + umtxq_unbusy(&uq->uq_key); + + error = umtxq_sleep(uq, "usem", timeout == NULL ? NULL : &timo); + + if ((uq->uq_flags & UQF_UMTXQ) == 0) + error = 0; + else { + umtxq_remove(uq); + /* A relative timeout cannot be restarted. */ + if (error == ERESTART && timeout != NULL && + (timeout->_flags & UMTX_ABSTIME) == 0) + error = EINTR; + } + umtxq_unlock(&uq->uq_key); + umtx_key_release(&uq->uq_key); + return (error); +} + +/* + * Signal a userland semaphore. + */ +static int +do_sem2_wake(struct thread *td, struct _usem2 *sem) +{ + struct umtx_key key; + int error, cnt; + uint32_t count, flags; + + flags = fuword32(&sem->_flags); + if ((error = umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), &key)) != 0) + return (error); + umtxq_lock(&key); + umtxq_busy(&key); + cnt = umtxq_count(&key); + if (cnt > 0) { + umtxq_signal(&key, 1); + + /* + * If this was the last sleeping thread, clear the waiters + * flag in _count. + */ + if (cnt == 1) { + umtxq_unlock(&key); + count = fuword32(&sem->_count); + while (count != -1 && count & USEM_HAS_WAITERS) + count = casuword32(&sem->_count, count, + count & ~USEM_HAS_WAITERS); + if (count == -1) + error = EFAULT; + umtxq_lock(&key); + } + } + umtxq_unbusy(&key); + umtxq_unlock(&key); + umtx_key_release(&key); + return (error); +} inline int umtx_copyin_timeout(const void *addr, struct timespec *tsp) @@ -3066,6 +3180,7 @@ __umtx_op_rw_unlock(struct thread *td, s return do_rw_unlock(td, uap->obj); } +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) static int __umtx_op_sem_wait(struct thread *td, struct _umtx_op_args *uap) { @@ -3090,6 +3205,7 @@ __umtx_op_sem_wake(struct thread *td, st { return do_sem_wake(td, uap->obj); } +#endif static int __umtx_op_wake2_umutex(struct thread *td, struct _umtx_op_args *uap) @@ -3097,6 +3213,31 @@ __umtx_op_wake2_umutex(struct thread *td return do_wake2_umutex(td, uap->obj, uap->val); } +static int +__umtx_op_sem2_wait(struct thread *td, struct _umtx_op_args *uap) +{ + struct _umtx_time *tm_p, timeout; + int error; + + /* Allow a null timespec (wait forever). */ + if (uap->uaddr2 == NULL) + tm_p = NULL; + else { + error = umtx_copyin_umtx_time( + uap->uaddr2, (size_t)uap->uaddr1, &timeout); + if (error != 0) + return (error); + tm_p = &timeout; + } + return (do_sem2_wait(td, uap->obj, tm_p)); +} + +static int +__umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap) +{ + return do_sem2_wake(td, uap->obj); +} + typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args *uap); static _umtx_op_func op_table[] = { @@ -3119,10 +3260,17 @@ static _umtx_op_func op_table[] = { __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ __umtx_op_wait_umutex, /* UMTX_OP_MUTEX_WAIT */ __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) __umtx_op_sem_wait, /* UMTX_OP_SEM_WAIT */ __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ +#else + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ +#endif __umtx_op_nwake_private, /* UMTX_OP_NWAKE_PRIVATE */ - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_sem2_wait, /* UMTX_OP_SEM2_WAIT */ + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ }; int @@ -3320,6 +3468,7 @@ __umtx_op_wait_uint_private_compat32(str return do_wait(td, uap->obj, uap->val, tm_p, 1, 1); } +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) static int __umtx_op_sem_wait_compat32(struct thread *td, struct _umtx_op_args *uap) { @@ -3338,6 +3487,26 @@ __umtx_op_sem_wait_compat32(struct threa } return (do_sem_wait(td, uap->obj, tm_p)); } +#endif + +static int +__umtx_op_sem2_wait_compat32(struct thread *td, struct _umtx_op_args *uap) +{ + struct _umtx_time *tm_p, timeout; + int error; + + /* Allow a null timespec (wait forever). */ + if (uap->uaddr2 == NULL) + tm_p = NULL; + else { + error = umtx_copyin_umtx_time32(uap->uaddr2, + (size_t)uap->uaddr1, &timeout); + if (error != 0) + return (error); + tm_p = &timeout; + } + return (do_sem2_wait(td, uap->obj, tm_p)); +} static int __umtx_op_nwake_private32(struct thread *td, struct _umtx_op_args *uap) @@ -3385,10 +3554,17 @@ static _umtx_op_func op_table_compat32[] __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ __umtx_op_wait_umutex_compat32, /* UMTX_OP_MUTEX_WAIT */ __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) __umtx_op_sem_wait_compat32, /* UMTX_OP_SEM_WAIT */ __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ +#else + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ +#endif __umtx_op_nwake_private32, /* UMTX_OP_NWAKE_PRIVATE */ - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ + __umtx_op_sem2_wait_compat32, /* UMTX_OP_SEM2_WAIT */ + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ }; int Modified: head/sys/sys/_umtx.h ============================================================================== --- head/sys/sys/_umtx.h Fri Oct 24 19:58:24 2014 (r273603) +++ head/sys/sys/_umtx.h Fri Oct 24 20:02:44 2014 (r273604) @@ -61,6 +61,11 @@ struct _usem { __uint32_t _flags; }; +struct _usem2 { + volatile __uint32_t _count; /* Waiters flag in high bit. */ + __uint32_t _flags; +}; + struct _umtx_time { struct timespec _timeout; __uint32_t _flags; Modified: head/sys/sys/umtx.h ============================================================================== --- head/sys/sys/umtx.h Fri Oct 24 19:58:24 2014 (r273603) +++ head/sys/sys/umtx.h Fri Oct 24 20:02:44 2014 (r273604) @@ -52,6 +52,11 @@ /* _usem flags */ #define SEM_NAMED 0x0002 +/* _usem2 count field */ +#define USEM_HAS_WAITERS 0x80000000U +#define USEM_MAX_COUNT 0x7fffffffU +#define USEM_COUNT(c) ((c) & USEM_MAX_COUNT) + /* op code for _umtx_op */ #define UMTX_OP_RESERVED0 0 #define UMTX_OP_RESERVED1 1 @@ -72,11 +77,13 @@ #define UMTX_OP_WAKE_PRIVATE 16 #define UMTX_OP_MUTEX_WAIT 17 #define UMTX_OP_MUTEX_WAKE 18 /* deprecated */ -#define UMTX_OP_SEM_WAIT 19 -#define UMTX_OP_SEM_WAKE 20 +#define UMTX_OP_SEM_WAIT 19 /* deprecated */ +#define UMTX_OP_SEM_WAKE 20 /* deprecated */ #define UMTX_OP_NWAKE_PRIVATE 21 #define UMTX_OP_MUTEX_WAKE2 22 -#define UMTX_OP_MAX 23 +#define UMTX_OP_SEM2_WAIT 23 +#define UMTX_OP_SEM2_WAKE 24 +#define UMTX_OP_MAX 25 /* Flags for UMTX_OP_CV_WAIT */ #define CVWAIT_CHECK_UNPARKING 0x01 Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Fri Oct 24 19:58:24 2014 (r273603) +++ head/usr.bin/truss/syscalls.c Fri Oct 24 20:02:44 2014 (r273604) @@ -424,6 +424,7 @@ static struct xlat umtx_ops[] = { X(UMTX_OP_WAIT_UINT_PRIVATE) X(UMTX_OP_WAKE_PRIVATE) X(UMTX_OP_MUTEX_WAIT) X(UMTX_OP_MUTEX_WAKE) X(UMTX_OP_SEM_WAIT) X(UMTX_OP_SEM_WAKE) X(UMTX_OP_NWAKE_PRIVATE) X(UMTX_OP_MUTEX_WAKE2) + X(UMTX_OP_SEM2_WAIT) X(UMTX_OP_SEM2_WAKE) XEND }; From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 20:29:15 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B5DA3A5; Fri, 24 Oct 2014 20:29:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C3C59C7; Fri, 24 Oct 2014 20:29:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OKTFsD029035; Fri, 24 Oct 2014 20:29:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OKTF5D029034; Fri, 24 Oct 2014 20:29:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201410242029.s9OKTF5D029034@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 Oct 2014 20:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273605 - head/lib/libc/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 20:29:15 -0000 Author: markj Date: Fri Oct 24 20:29:14 2014 New Revision: 273605 URL: https://svnweb.freebsd.org/changeset/base/273605 Log: Eliminate conf_lock and instead rely on the NSS write lock to protect NSS configuration state. As a side effect, this fixes a race condition which can occur if multiple threads call nsdispatch(3) concurrently before nsswitch.conf has been parsed. Previously, the thread holding conf_lock could cause other threads to return from nss_configure() before nsswitch.conf had been parsed, forcing them to fall back to the default sources for their NSS methods. Reviewed by: jhb Differential Revision: https://reviews.freebsd.org/D994 MFC after: 1 month Sponsored by: EMC / Isilon Storage Division Modified: head/lib/libc/net/nsdispatch.c Modified: head/lib/libc/net/nsdispatch.c ============================================================================== --- head/lib/libc/net/nsdispatch.c Fri Oct 24 20:02:44 2014 (r273604) +++ head/lib/libc/net/nsdispatch.c Fri Oct 24 20:29:14 2014 (r273605) @@ -329,7 +329,6 @@ _nsdbtdump(const ns_dbt *dbt) static int nss_configure(void) { - static pthread_mutex_t conf_lock = PTHREAD_MUTEX_INITIALIZER; static time_t confmod; struct stat statbuf; int result, isthreaded; @@ -353,13 +352,14 @@ nss_configure(void) if (statbuf.st_mtime <= confmod) return (0); if (isthreaded) { - result = _pthread_mutex_trylock(&conf_lock); - if (result != 0) - return (0); (void)_pthread_rwlock_unlock(&nss_lock); result = _pthread_rwlock_wrlock(&nss_lock); if (result != 0) - goto fin2; + return (result); + if (stat(path, &statbuf) != 0) + goto fin; + if (statbuf.st_mtime <= confmod) + goto fin; } _nsyyin = fopen(path, "re"); if (_nsyyin == NULL) @@ -390,9 +390,6 @@ fin: if (result == 0) result = _pthread_rwlock_rdlock(&nss_lock); } -fin2: - if (isthreaded) - (void)_pthread_mutex_unlock(&conf_lock); return (result); } From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 21:08:03 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9250EB4C; Fri, 24 Oct 2014 21:08:03 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 64BBBD6E; Fri, 24 Oct 2014 21:08:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OL83O3047420; Fri, 24 Oct 2014 21:08:03 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OL83v2047419; Fri, 24 Oct 2014 21:08:03 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410242108.s9OL83v2047419@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 24 Oct 2014 21:08:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273606 - head/sys/arm/ti/cpsw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 21:08:03 -0000 Author: loos Date: Fri Oct 24 21:08:02 2014 New Revision: 273606 URL: https://svnweb.freebsd.org/changeset/base/273606 Log: Fix cpsw_detach() to not panic when called from cpsw_attach(). For an unkown reason (at moment), sometimes if_cpsw cannot read from PHY and fails to attach calling cpsw_detach() which end up in a panic. Fix it by doing the proper check before detach the miibus and also fix the leak of few variables. And to actually make it work, ether_ifattach() has to be moved to the end of cpsw_attach() to avoid a race where calling ether_ifdetach() before domain_init() (which will only run later on) would make it crash at INP_INFO_RLOCK() on in_pcbpurgeif0(). Tested on: BBB (am335x) MFC after: 1 week Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Fri Oct 24 20:29:14 2014 (r273605) +++ head/sys/arm/ti/cpsw/if_cpsw.c Fri Oct 24 21:08:02 2014 (r273606) @@ -666,9 +666,6 @@ cpsw_attach(device_t dev) sc->mac_addr[4] = reg & 0xFF; sc->mac_addr[5] = (reg >> 8) & 0xFF; - ether_ifattach(ifp, sc->mac_addr); - callout_init(&sc->watchdog.callout, 0); - /* Initialze MDIO - ENABLE, PREAMBLE=0, FAULTENB, CLKDIV=0xFF */ /* TODO Calculate MDCLK=CLK/(CLKDIV+1) */ cpsw_write_4(sc, MDIOCONTROL, 1 << 30 | 1 << 18 | 0xFF); @@ -703,6 +700,9 @@ cpsw_attach(device_t dev) return (ENXIO); } + ether_ifattach(ifp, sc->mac_addr); + callout_init(&sc->watchdog.callout, 0); + return (0); } @@ -740,15 +740,21 @@ cpsw_detach(device_t dev) } bus_generic_detach(dev); - device_delete_child(dev, sc->miibus); + if (sc->miibus) + device_delete_child(dev, sc->miibus); /* Stop and release all interrupts */ cpsw_detach_interrupts(sc); /* Free dmamaps and mbufs */ - for (i = 0; i < sizeof(sc->_slots) / sizeof(sc->_slots[0]); ++i) { + for (i = 0; i < sizeof(sc->_slots) / sizeof(sc->_slots[0]); ++i) cpsw_free_slot(sc, &sc->_slots[i]); + if (sc->null_mbuf_dmamap) { + error = bus_dmamap_destroy(sc->mbuf_dtag, sc->null_mbuf_dmamap); + KASSERT(error == 0, ("Mapping still active")); } + if (sc->null_mbuf) + m_freem(sc->null_mbuf); /* Free DMA tag */ error = bus_dma_tag_destroy(sc->mbuf_dtag); @@ -757,6 +763,9 @@ cpsw_detach(device_t dev) /* Free IO memory handler */ bus_release_resources(dev, res_spec, sc->res); + if (sc->ifp != NULL) + if_free(sc->ifp); + /* Destroy mutexes */ mtx_destroy(&sc->rx.lock); mtx_destroy(&sc->tx.lock); From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 21:08:37 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42349CBB; Fri, 24 Oct 2014 21:08:37 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2EBDDD7C; Fri, 24 Oct 2014 21:08:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OL8bes047526; Fri, 24 Oct 2014 21:08:37 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OL8bgt047525; Fri, 24 Oct 2014 21:08:37 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410242108.s9OL8bgt047525@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 21:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273607 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 21:08:37 -0000 Author: rpaulo Date: Fri Oct 24 21:08:36 2014 New Revision: 273607 URL: https://svnweb.freebsd.org/changeset/base/273607 Log: Add a sysctl to control the HPET allow_write behaviour. Requested by: kib Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 21:08:02 2014 (r273606) +++ head/sys/dev/acpica/acpi_hpet.c Fri Oct 24 21:08:36 2014 (r273607) @@ -760,6 +760,11 @@ hpet_attach(device_t dev) OID_AUTO, "mmap_allow", CTLFLAG_RW, &sc->mmap_allow, 0, "Allow userland to memory map HPET"); + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "mmap_allow_write", + CTLFLAG_RW, &sc->mmap_allow_write, 0, + "Allow userland write to the HPET register space"); } else device_printf(dev, "could not create /dev/hpet%d\n", device_get_unit(dev)); From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 22:06:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C4509A67; Fri, 24 Oct 2014 22:06:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFDE95F1; Fri, 24 Oct 2014 22:06:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9OM6M1b075385; Fri, 24 Oct 2014 22:06:22 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9OM6MxU075383; Fri, 24 Oct 2014 22:06:22 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201410242206.s9OM6MxU075383@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 24 Oct 2014 22:06:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273610 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 22:06:23 -0000 Author: loos Date: Fri Oct 24 22:06:21 2014 New Revision: 273610 URL: https://svnweb.freebsd.org/changeset/base/273610 Log: Add an iicbus_reset() method to bcm2835_bsc. While it is generally not used for kernel devices it is used by i2c(8). This fix the 'error: Device not configured' when i2c(8) tries to reset the controller, as an example: # i2c -r Resetting I2C controller on /dev/iic0: error: Device not configured For now use conservative settings for default i2c speeds. MFC after: 1 week Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Oct 24 22:00:25 2014 (r273609) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Fri Oct 24 22:06:21 2014 (r273610) @@ -210,6 +210,8 @@ static void bcm_bsc_reset(struct bcm_bsc_softc *sc) { + /* Enable the BSC Controller, disable interrupts. */ + BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); /* Clear pending interrupts. */ BCM_BSC_WRITE(sc, BCM_BSC_STATUS, BCM_BSC_STATUS_CLKT | BCM_BSC_STATUS_ERR | BCM_BSC_STATUS_DONE); @@ -302,7 +304,6 @@ bcm_bsc_attach(device_t dev) /* Enable the BSC controller. Flush the FIFO. */ BCM_BSC_LOCK(sc); - BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); bcm_bsc_reset(sc); BCM_BSC_UNLOCK(sc); @@ -351,9 +352,8 @@ bcm_bsc_intr(void *arg) /* Check for errors. */ if (status & (BCM_BSC_STATUS_CLKT | BCM_BSC_STATUS_ERR)) { /* Disable interrupts. */ - BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); - sc->sc_flags |= BCM_I2C_ERROR; bcm_bsc_reset(sc); + sc->sc_flags |= BCM_I2C_ERROR; wakeup(sc->sc_dev); BCM_BSC_UNLOCK(sc); return; @@ -375,7 +375,6 @@ bcm_bsc_intr(void *arg) if (status & BCM_BSC_STATUS_DONE) { /* Disable interrupts. */ - BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); bcm_bsc_reset(sc); wakeup(sc->sc_dev); } @@ -459,6 +458,38 @@ bcm_bsc_transfer(device_t dev, struct ii return (err); } +static int +bcm_bsc_iicbus_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +{ + struct bcm_bsc_softc *sc; + uint32_t freq; + + sc = device_get_softc(dev); + BCM_BSC_LOCK(sc); + bcm_bsc_reset(sc); + freq = 0; + switch (speed) { + case IIC_SLOW: + freq = BCM_BSC_SLOW; + break; + case IIC_FAST: + freq = BCM_BSC_FAST; + break; + case IIC_FASTEST: + freq = BCM_BSC_FASTEST; + break; + case IIC_UNKNOWN: + default: + /* Reuse last frequency. */ + break; + } + if (freq != 0) + BCM_BSC_WRITE(sc, BCM_BSC_CLOCK, BCM_BSC_CORE_CLK / freq); + BCM_BSC_UNLOCK(sc); + + return (IIC_ENOADDR); +} + static phandle_t bcm_bsc_get_node(device_t bus, device_t dev) { @@ -474,6 +505,7 @@ static device_method_t bcm_bsc_methods[] DEVMETHOD(device_detach, bcm_bsc_detach), /* iicbus interface */ + DEVMETHOD(iicbus_reset, bcm_bsc_iicbus_reset), DEVMETHOD(iicbus_callback, iicbus_null_callback), DEVMETHOD(iicbus_transfer, bcm_bsc_transfer), Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Fri Oct 24 22:00:25 2014 (r273609) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Fri Oct 24 22:06:21 2014 (r273610) @@ -56,6 +56,10 @@ struct bcm_bsc_softc { #define BCM_I2C_READ 0x02 #define BCM_I2C_ERROR 0x04 +#define BCM_BSC_SLOW 10000 /* 10 kHz. */ +#define BCM_BSC_FAST 50000 /* 50 kHz. */ +#define BCM_BSC_FASTEST 100000 /* 100 kHz. */ + #define BCM_BSC_WRITE(_sc, _off, _val) \ bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) #define BCM_BSC_READ(_sc, _off) \ From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 23:24:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 27A76B5F; Fri, 24 Oct 2014 23:24:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13F13D3F; Fri, 24 Oct 2014 23:24:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ONOlvO013612; Fri, 24 Oct 2014 23:24:47 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ONOlYs013611; Fri, 24 Oct 2014 23:24:47 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410242324.s9ONOlYs013611@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 24 Oct 2014 23:24:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273612 - head/lib/libc/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 23:24:48 -0000 Author: brooks Date: Fri Oct 24 23:24:47 2014 New Revision: 273612 URL: https://svnweb.freebsd.org/changeset/base/273612 Log: Remove an unused variable that would be better spelled __func__. Sponsored by: DARPA, AFRL Modified: head/lib/libc/rpc/clnt_vc.c Modified: head/lib/libc/rpc/clnt_vc.c ============================================================================== --- head/lib/libc/rpc/clnt_vc.c Fri Oct 24 23:08:44 2014 (r273611) +++ head/lib/libc/rpc/clnt_vc.c Fri Oct 24 23:24:47 2014 (r273612) @@ -141,7 +141,6 @@ static cond_t *vc_cv; static const char clnt_vc_errstr[] = "%s : %s"; static const char clnt_vc_str[] = "clnt_vc_create"; -static const char clnt_read_vc_str[] = "read_vc"; static const char __no_mem_str[] = "out of memory"; /* From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 23:25:12 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBEE2C9B; Fri, 24 Oct 2014 23:25:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8417D44; Fri, 24 Oct 2014 23:25:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ONPCOf013746; Fri, 24 Oct 2014 23:25:12 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ONPC0a013745; Fri, 24 Oct 2014 23:25:12 GMT (envelope-from rpaulo@FreeBSD.org) Message-Id: <201410242325.s9ONPC0a013745@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rpaulo set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo Date: Fri, 24 Oct 2014 23:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273613 - head/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 23:25:12 -0000 Author: rpaulo Date: Fri Oct 24 23:25:11 2014 New Revision: 273613 URL: https://svnweb.freebsd.org/changeset/base/273613 Log: Fix the build by installing acpi_hpet.h correctly. Submitted by: jase MFC after: 1 week Modified: head/include/Makefile Modified: head/include/Makefile ============================================================================== --- head/include/Makefile Fri Oct 24 23:24:47 2014 (r273612) +++ head/include/Makefile Fri Oct 24 23:25:11 2014 (r273613) @@ -158,7 +158,7 @@ copies: .endfor cd ${.CURDIR}/../sys/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpiio.h \ - ${DESTDIR}${INCLUDEDIR}/dev/acpica + ${DESTDIR}${INCLUDEDIR}/dev/acpica; \ ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 acpi_hpet.h \ ${DESTDIR}${INCLUDEDIR}/dev/acpica cd ${.CURDIR}/../sys/dev/agp; \ From owner-svn-src-head@FreeBSD.ORG Fri Oct 24 23:25:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB9CBDD8; Fri, 24 Oct 2014 23:25:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A79ECD49; Fri, 24 Oct 2014 23:25:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9ONPjGL013856; Fri, 24 Oct 2014 23:25:45 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9ONPjF8013855; Fri, 24 Oct 2014 23:25:45 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201410242325.s9ONPjF8013855@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 24 Oct 2014 23:25:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273614 - head/lib/libc/stdlib X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Oct 2014 23:25:45 -0000 Author: brooks Date: Fri Oct 24 23:25:44 2014 New Revision: 273614 URL: https://svnweb.freebsd.org/changeset/base/273614 Log: Use the __DECONST macro rather than hand rolling the same thing. Sponsored by: DARPA, AFRL Modified: head/lib/libc/stdlib/lsearch.c Modified: head/lib/libc/stdlib/lsearch.c ============================================================================== --- head/lib/libc/stdlib/lsearch.c Fri Oct 24 23:25:11 2014 (r273613) +++ head/lib/libc/stdlib/lsearch.c Fri Oct 24 23:25:44 2014 (r273614) @@ -39,11 +39,7 @@ lwork(const void *key, const void *base, { uint8_t *ep, *endp; - /* - * Cast to an integer value first to avoid the warning for removing - * 'const' via a cast. - */ - ep = (uint8_t *)(uintptr_t)base; + ep = __DECONST(uint8_t *, base); for (endp = (uint8_t *)(ep + width * *nelp); ep < endp; ep += width) { if (compar(key, ep) == 0) return (ep); From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 00:14:45 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 584746A4; Sat, 25 Oct 2014 00:14:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4467F1EC; Sat, 25 Oct 2014 00:14:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0Ejub038220; Sat, 25 Oct 2014 00:14:45 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0EiRs038218; Sat, 25 Oct 2014 00:14:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201410250014.s9P0EiRs038218@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 25 Oct 2014 00:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273615 - head/sys/dev/cxgbe/firmware X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:14:45 -0000 Author: np Date: Sat Oct 25 00:14:44 2014 New Revision: 273615 URL: https://svnweb.freebsd.org/changeset/base/273615 Log: cxgbe(4): bump up PF4's share of some global resources. This increases the size of the per-port RSS slice and also allows the driver to use a larger number of tx and rx queues. MFC after: 2 weeks Modified: head/sys/dev/cxgbe/firmware/t4fw_cfg.txt head/sys/dev/cxgbe/firmware/t5fw_cfg.txt Modified: head/sys/dev/cxgbe/firmware/t4fw_cfg.txt ============================================================================== --- head/sys/dev/cxgbe/firmware/t4fw_cfg.txt Fri Oct 24 23:25:44 2014 (r273614) +++ head/sys/dev/cxgbe/firmware/t4fw_cfg.txt Sat Oct 25 00:14:44 2014 (r273615) @@ -41,26 +41,34 @@ [function "0"] nvf = 16 nvi = 1 + rssnvi = 0 [function "0/*"] nvi = 1 + rssnvi = 0 [function "1"] nvf = 16 nvi = 1 + rssnvi = 0 [function "1/*"] nvi = 1 + rssnvi = 0 [function "2"] nvf = 16 nvi = 1 + rssnvi = 0 [function "2/*"] nvi = 1 + rssnvi = 0 [function "3"] nvf = 16 nvi = 1 + rssnvi = 0 [function "3/*"] nvi = 1 + rssnvi = 0 # PF4 is the resource-rich PF that the bus/nexus driver attaches to. # It gets 32 MSI/128 MSI-X vectors. @@ -68,9 +76,10 @@ wx_caps = all r_caps = all nvi = 32 - niqflint = 256 - nethctrl = 128 - neq = 256 + rssnvi = 8 + niqflint = 512 + nethctrl = 1024 + neq = 2048 nexactf = 328 cmask = all pmask = all @@ -94,11 +103,13 @@ # Not used right now. [function "5"] nvi = 1 + rssnvi = 0 # PF6 is the FCoE Controller PF. It gets 32 MSI/40 MSI-X vectors. # Not used right now. [function "6"] nvi = 1 + rssnvi = 0 # The following function, 1023, is not an actual PCIE function but is used to # configure and reserve firmware internal resources that come from the global @@ -107,6 +118,7 @@ wx_caps = all r_caps = all nvi = 4 + rssnvi = 0 cmask = all pmask = all nexactf = 8 @@ -148,7 +160,7 @@ [fini] version = 0x1 - checksum = 0x6f516705 + checksum = 0x6a1f8858 # # $FreeBSD$ # Modified: head/sys/dev/cxgbe/firmware/t5fw_cfg.txt ============================================================================== --- head/sys/dev/cxgbe/firmware/t5fw_cfg.txt Fri Oct 24 23:25:44 2014 (r273614) +++ head/sys/dev/cxgbe/firmware/t5fw_cfg.txt Sat Oct 25 00:14:44 2014 (r273615) @@ -5,7 +5,7 @@ # niqflint = 1023 ingress queues with freelists and/or interrupts # nethctrl = 64K Ethernet or ctrl egress queues # neq = 64K egress queues of all kinds, including freelists -# nexactf = 336 MPS TCAM entries, can oversubscribe. +# nexactf = 512 MPS TCAM entries, can oversubscribe. # [global] @@ -54,26 +54,34 @@ [function "0"] nvf = 16 nvi = 1 + rssnvi = 0 [function "0/*"] nvi = 1 + rssnvi = 0 [function "1"] nvf = 16 nvi = 1 + rssnvi = 0 [function "1/*"] nvi = 1 + rssnvi = 0 [function "2"] nvf = 16 nvi = 1 + rssnvi = 0 [function "2/*"] nvi = 1 + rssnvi = 0 [function "3"] nvf = 16 nvi = 1 + rssnvi = 0 [function "3/*"] nvi = 1 + rssnvi = 0 # PF4 is the resource-rich PF that the bus/nexus driver attaches to. # It gets 32 MSI/128 MSI-X vectors. @@ -81,9 +89,10 @@ wx_caps = all r_caps = all nvi = 32 - niqflint = 256 - nethctrl = 128 - neq = 256 + rssnvi = 8 + niqflint = 512 + nethctrl = 1024 + neq = 2048 nexactf = 328 cmask = all pmask = all @@ -107,11 +116,13 @@ # Not used right now. [function "5"] nvi = 1 + rssnvi = 0 # PF6 is the FCoE Controller PF. It gets 32 MSI/40 MSI-X vectors. # Not used right now. [function "6"] nvi = 1 + rssnvi = 0 # The following function, 1023, is not an actual PCIE function but is used to # configure and reserve firmware internal resources that come from the global @@ -120,6 +131,7 @@ wx_caps = all r_caps = all nvi = 4 + rssnvi = 0 cmask = all pmask = all nexactf = 8 @@ -161,7 +173,7 @@ [fini] version = 0x1 - checksum = 0x9f27febc + checksum = 0xa0ee1715 # # $FreeBSD$ # From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 00:16:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E8017887; Sat, 25 Oct 2014 00:16:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3F71206; Sat, 25 Oct 2014 00:16:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0Gage038543; Sat, 25 Oct 2014 00:16:36 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0Gaq4038542; Sat, 25 Oct 2014 00:16:36 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410250016.s9P0Gaq4038542@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 Oct 2014 00:16:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273616 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:16:37 -0000 Author: delphij Date: Sat Oct 25 00:16:36 2014 New Revision: 273616 URL: https://svnweb.freebsd.org/changeset/base/273616 Log: Fix build. Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Oct 25 00:14:44 2014 (r273615) +++ head/sys/kern/kern_umtx.c Sat Oct 25 00:16:36 2014 (r273616) @@ -2895,7 +2895,7 @@ do_sem2_wake(struct thread *td, struct _ */ if (cnt == 1) { umtxq_unlock(&key); - count = fuword32(&sem->_count); + count = fuword32(__DEVOLATILE(void *, &sem->_count)); while (count != -1 && count & USEM_HAS_WAITERS) count = casuword32(&sem->_count, count, count & ~USEM_HAS_WAITERS); From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 00:37:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 32612E64; Sat, 25 Oct 2014 00:37:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04C735FB; Sat, 25 Oct 2014 00:37:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P0bZBv048108; Sat, 25 Oct 2014 00:37:35 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P0bZUo048107; Sat, 25 Oct 2014 00:37:35 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201410250037.s9P0bZUo048107@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 Oct 2014 00:37:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273619 - head/contrib/netcat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 00:37:36 -0000 Author: delphij Date: Sat Oct 25 00:37:35 2014 New Revision: 273619 URL: https://svnweb.freebsd.org/changeset/base/273619 Log: MFV r273617: netcat from OpenBSD 5.6. MFC after: 2 weeks Modified: head/contrib/netcat/netcat.c Directory Properties: head/contrib/netcat/ (props changed) Modified: head/contrib/netcat/netcat.c ============================================================================== --- head/contrib/netcat/netcat.c Sat Oct 25 00:32:30 2014 (r273618) +++ head/contrib/netcat/netcat.c Sat Oct 25 00:37:35 2014 (r273619) @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.117 2013/10/26 21:33:29 sthen Exp $ */ +/* $OpenBSD: netcat.c,v 1.122 2014/07/20 01:38:40 guenther Exp $ */ /* * Copyright (c) 2001 Eric Jackson * @@ -155,9 +155,6 @@ main(int argc, char *argv[]) host = NULL; uport = NULL; sv = NULL; -#if 0 - rtableid = getrtable(); -#endif while ((ch = getopt_long(argc, argv, "46DdEe:FhI:i:klNnoO:P:p:rSs:tT:UuV:vw:X:x:z", @@ -662,7 +659,7 @@ remote_connect(const char *host, const c if (bind(s, (struct sockaddr *)ares->ai_addr, ares->ai_addrlen) < 0) - errx(1, "bind failed: %s", strerror(errno)); + err(1, "bind failed"); freeaddrinfo(ares); } @@ -751,7 +748,7 @@ local_listen(char *host, char *port, str res0->ai_protocol)) < 0) continue; - if (rtableid >= 0 && (setsockopt(s, IPPROTO_IP, SO_SETFIB, + if (rtableid >= 0 && (setsockopt(s, SOL_SOCKET, SO_SETFIB, &rtableid, sizeof(rtableid)) == -1)) err(1, "setsockopt SO_SETFIB"); @@ -796,12 +793,12 @@ void readwrite(int nfd) { struct pollfd pfd[2]; - unsigned char buf[16384]; + unsigned char buf[16 * 1024]; int n, wfd = fileno(stdin); int lfd = fileno(stdout); int plen; - plen = 2048; + plen = sizeof(buf); /* Setup Network FD */ pfd[0].fd = nfd; @@ -816,8 +813,9 @@ readwrite(int nfd) sleep(iflag); if ((n = poll(pfd, 2 - dflag, timeout)) < 0) { + int saved_errno = errno; close(nfd); - err(1, "Polling Error"); + errc(1, saved_errno, "Polling Error"); } if (n == 0) From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 01:36:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C348F683; Sat, 25 Oct 2014 01:36:36 +0000 (UTC) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:130:3ffc::401:25]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2061AAE8; Sat, 25 Oct 2014 01:36:36 +0000 (UTC) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 7C83225D3A92; Sat, 25 Oct 2014 01:36:32 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id A4AE8C77020; Sat, 25 Oct 2014 01:36:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id EFw2k0eHRWzO; Sat, 25 Oct 2014 01:36:27 +0000 (UTC) Received: from [IPv6:fde9:577b:c1a9:4410:9d45:f8c9:ce47:f6c6] (unknown [IPv6:fde9:577b:c1a9:4410:9d45:f8c9:ce47:f6c6]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id B7671C76FD6; Sat, 25 Oct 2014 01:36:25 +0000 (UTC) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: svn commit: r273604 - in head: include lib/libc/gen sys/kern sys/sys usr.bin/truss From: "Bjoern A. Zeeb" In-Reply-To: <201410242002.s9OK2i3w018818@svn.freebsd.org> Date: Sat, 25 Oct 2014 01:35:22 +0000 Content-Transfer-Encoding: quoted-printable Message-Id: <88B273DE-C9EB-4C11-AE9E-0136BC2324C2@FreeBSD.org> References: <201410242002.s9OK2i3w018818@svn.freebsd.org> To: John Baldwin X-Mailer: Apple Mail (2.1878.6) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 01:36:37 -0000 On 24 Oct 2014, at 20:02 , John Baldwin wrote: > Author: jhb > Date: Fri Oct 24 20:02:44 2014 > New Revision: 273604 > URL: https://svnweb.freebsd.org/changeset/base/273604 >=20 > Log: > The current POSIX semaphore implementation stores the _has_waiters = flag > in a separate word from the _count. This does not permit both items = to > be updated atomically in a portable manner. As a result, sem_post() > must always perform a system call to safely clear _has_waiters. >=20 > This change removes the _has_waiters field and instead uses the high = bit > of _count as the _has_waiters flag. A new umtx object type (_usem2) = and > two new umtx operations are added (SEM_WAIT2 and SEM_WAKE2) to = implement > these semantics. The older operations are still supported under the > COMPAT_FREEBSD9/10 options. The POSIX semaphore API in libc has > been updated to use the new implementation. Note that the new > implementation is not compatible with the previous implementation. > However, this only affects static binaries (which cannot be helped by > symbol versioning). Binaries using a dynamic libc will continue to = work > fine. SEM_MAGIC has been bumped so that mismatched binaries will = error > rather than corrupting a shared semaphore. In addition, a padding = field > has been added to sem_t so that it remains the same size. >=20 > Differential Revision: https://reviews.freebsd.org/D961 > Reported by: adrian > Reviewed by: kib, jilles (earlier version) > Sponsored by: Norse >=20 > Modified: > head/include/semaphore.h > head/lib/libc/gen/sem_new.c > head/sys/kern/kern_umtx.c > head/sys/sys/_umtx.h > head/sys/sys/umtx.h > head/usr.bin/truss/syscalls.c >=20 Has anyone fixed this: /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c:2898:21: error: passing = 'volatile __uint32_t *' (aka 'volatile unsigned int *') to parameter of = type 'const void *' discards qualifiers = [-Werror,-Wincompatible-pointer-types-discards-qualifier s] count =3D fuword32(&sem->_count); ^~~~~~~~~~~~ /scratch/tmp/bz/head.svn/sys/sys/systm.h:258:30: note: passing argument = to parameter 'base' here int32_t fuword32(const void *base); ^ 1 error generated. --- kern_umtx.o --- *** [kern_umtx.o] Error code 1 cc1: warnings being treated as errors /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c: In function = 'do_sem2_wake': /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c:2898: warning: passing = argument 1 of 'fuword32' discards qualifiers from pointer target type --- kern_umtx.o --- *** [kern_umtx.o] Error code 1 > Modified: head/sys/kern/kern_umtx.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/kern/kern_umtx.c Fri Oct 24 19:58:24 2014 = (r273603) > +++ head/sys/kern/kern_umtx.c Fri Oct 24 20:02:44 2014 = (r273604) > @@ -2710,6 +2710,7 @@ out: > return (error); > } >=20 > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > static int > do_sem_wait(struct thread *td, struct _usem *sem, struct _umtx_time = *timeout) > { > @@ -2731,7 +2732,7 @@ do_sem_wait(struct thread *td, struct _u > umtxq_busy(&uq->uq_key); > umtxq_insert(uq); > umtxq_unlock(&uq->uq_key); > - casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1); > + casuword32(&sem->_has_waiters, 0, 1); > count =3D fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); > if (count !=3D 0) { > umtxq_lock(&uq->uq_key); > @@ -2761,7 +2762,7 @@ do_sem_wait(struct thread *td, struct _u > } >=20 > /* > - * Signal a userland condition variable. > + * Signal a userland semaphore. > */ > static int > do_sem_wake(struct thread *td, struct _usem *sem) > @@ -2795,6 +2796,119 @@ do_sem_wake(struct thread *td, struct _u > umtx_key_release(&key); > return (error); > } > +#endif > + > +static int > +do_sem2_wait(struct thread *td, struct _usem2 *sem, struct _umtx_time = *timeout) > +{ > + struct abs_timeout timo; > + struct umtx_q *uq; > + uint32_t count, flags; > + int error; > + > + uq =3D td->td_umtxq; > + flags =3D fuword32(&sem->_flags); > + error =3D umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), = &uq->uq_key); > + if (error !=3D 0) > + return (error); > + > + if (timeout !=3D NULL) > + abs_timeout_init2(&timo, timeout); > + > + umtxq_lock(&uq->uq_key); > + umtxq_busy(&uq->uq_key); > + umtxq_insert(uq); > + umtxq_unlock(&uq->uq_key); > + count =3D fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); > + if (count =3D=3D -1) { > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + umtxq_remove(uq); > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (EFAULT); > + } > + for (;;) { > + if (USEM_COUNT(count) !=3D 0) { > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + umtxq_remove(uq); > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (0); > + } > + if (count =3D=3D USEM_HAS_WAITERS) > + break; > + count =3D casuword32(&sem->_count, 0, USEM_HAS_WAITERS); > + if (count =3D=3D -1) { > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + umtxq_remove(uq); > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (EFAULT); > + } > + if (count =3D=3D 0) > + break; > + } > + umtxq_lock(&uq->uq_key); > + umtxq_unbusy(&uq->uq_key); > + > + error =3D umtxq_sleep(uq, "usem", timeout =3D=3D NULL ? NULL : = &timo); > + > + if ((uq->uq_flags & UQF_UMTXQ) =3D=3D 0) > + error =3D 0; > + else { > + umtxq_remove(uq); > + /* A relative timeout cannot be restarted. */ > + if (error =3D=3D ERESTART && timeout !=3D NULL && > + (timeout->_flags & UMTX_ABSTIME) =3D=3D 0) > + error =3D EINTR; > + } > + umtxq_unlock(&uq->uq_key); > + umtx_key_release(&uq->uq_key); > + return (error); > +} > + > +/* > + * Signal a userland semaphore. > + */ > +static int > +do_sem2_wake(struct thread *td, struct _usem2 *sem) > +{ > + struct umtx_key key; > + int error, cnt; > + uint32_t count, flags; > + > + flags =3D fuword32(&sem->_flags); > + if ((error =3D umtx_key_get(sem, TYPE_SEM, GET_SHARE(flags), = &key)) !=3D 0) > + return (error);=09 > + umtxq_lock(&key); > + umtxq_busy(&key); > + cnt =3D umtxq_count(&key); > + if (cnt > 0) { > + umtxq_signal(&key, 1); > + > + /* > + * If this was the last sleeping thread, clear the = waiters > + * flag in _count. > + */ > + if (cnt =3D=3D 1) { > + umtxq_unlock(&key); > + count =3D fuword32(&sem->_count); > + while (count !=3D -1 && count & = USEM_HAS_WAITERS) > + count =3D casuword32(&sem->_count, = count, > + count & ~USEM_HAS_WAITERS); > + if (count =3D=3D -1) > + error =3D EFAULT; > + umtxq_lock(&key); > + } > + } > + umtxq_unbusy(&key); > + umtxq_unlock(&key); > + umtx_key_release(&key); > + return (error); > +} >=20 > inline int > umtx_copyin_timeout(const void *addr, struct timespec *tsp) > @@ -3066,6 +3180,7 @@ __umtx_op_rw_unlock(struct thread *td, s > return do_rw_unlock(td, uap->obj); > } >=20 > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > static int > __umtx_op_sem_wait(struct thread *td, struct _umtx_op_args *uap) > { > @@ -3090,6 +3205,7 @@ __umtx_op_sem_wake(struct thread *td, st > { > return do_sem_wake(td, uap->obj); > } > +#endif >=20 > static int > __umtx_op_wake2_umutex(struct thread *td, struct _umtx_op_args *uap) > @@ -3097,6 +3213,31 @@ __umtx_op_wake2_umutex(struct thread *td > return do_wake2_umutex(td, uap->obj, uap->val); > } >=20 > +static int > +__umtx_op_sem2_wait(struct thread *td, struct _umtx_op_args *uap) > +{ > + struct _umtx_time *tm_p, timeout; > + int error; > + > + /* Allow a null timespec (wait forever). */ > + if (uap->uaddr2 =3D=3D NULL) > + tm_p =3D NULL; > + else { > + error =3D umtx_copyin_umtx_time( > + uap->uaddr2, (size_t)uap->uaddr1, &timeout); > + if (error !=3D 0) > + return (error); > + tm_p =3D &timeout; > + } > + return (do_sem2_wait(td, uap->obj, tm_p)); > +} > + > +static int > +__umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap) > +{ > + return do_sem2_wake(td, uap->obj); > +} > + > typedef int (*_umtx_op_func)(struct thread *td, struct _umtx_op_args = *uap); >=20 > static _umtx_op_func op_table[] =3D { > @@ -3119,10 +3260,17 @@ static _umtx_op_func op_table[] =3D { > __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ > __umtx_op_wait_umutex, /* UMTX_OP_MUTEX_WAIT */ > __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > __umtx_op_sem_wait, /* UMTX_OP_SEM_WAIT */ > __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ > +#else > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ > +#endif > __umtx_op_nwake_private, /* UMTX_OP_NWAKE_PRIVATE */ > - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_sem2_wait, /* UMTX_OP_SEM2_WAIT */ > + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ > }; >=20 > int > @@ -3320,6 +3468,7 @@ __umtx_op_wait_uint_private_compat32(str > return do_wait(td, uap->obj, uap->val, tm_p, 1, 1); > } >=20 > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > static int > __umtx_op_sem_wait_compat32(struct thread *td, struct _umtx_op_args = *uap) > { > @@ -3338,6 +3487,26 @@ __umtx_op_sem_wait_compat32(struct threa > } > return (do_sem_wait(td, uap->obj, tm_p)); > } > +#endif > + > +static int > +__umtx_op_sem2_wait_compat32(struct thread *td, struct _umtx_op_args = *uap) > +{ > + struct _umtx_time *tm_p, timeout; > + int error; > + > + /* Allow a null timespec (wait forever). */ > + if (uap->uaddr2 =3D=3D NULL) > + tm_p =3D NULL; > + else { > + error =3D umtx_copyin_umtx_time32(uap->uaddr2, > + (size_t)uap->uaddr1, &timeout); > + if (error !=3D 0) > + return (error); > + tm_p =3D &timeout; > + } > + return (do_sem2_wait(td, uap->obj, tm_p)); > +} >=20 > static int > __umtx_op_nwake_private32(struct thread *td, struct _umtx_op_args = *uap) > @@ -3385,10 +3554,17 @@ static _umtx_op_func op_table_compat32[] > __umtx_op_wake_private, /* UMTX_OP_WAKE_PRIVATE */ > __umtx_op_wait_umutex_compat32, /* UMTX_OP_MUTEX_WAIT */ > __umtx_op_wake_umutex, /* UMTX_OP_MUTEX_WAKE */ > +#if defined(COMPAT_FREEBSD9) || defined(COMPAT_FREEBSD10) > __umtx_op_sem_wait_compat32, /* UMTX_OP_SEM_WAIT */ > __umtx_op_sem_wake, /* UMTX_OP_SEM_WAKE */ > +#else > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAIT */ > + __umtx_op_unimpl, /* UMTX_OP_SEM_WAKE */ > +#endif > __umtx_op_nwake_private32, /* UMTX_OP_NWAKE_PRIVATE */ > - __umtx_op_wake2_umutex /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_wake2_umutex, /* UMTX_OP_MUTEX_WAKE2 */ > + __umtx_op_sem2_wait_compat32, /* UMTX_OP_SEM2_WAIT */ > + __umtx_op_sem2_wake, /* UMTX_OP_SEM2_WAKE */ > }; >=20 > int =97=20 Bjoern A. Zeeb "Come on. Learn, goddamn it.", WarGames, 1983 From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 01:38:59 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 976747FF; Sat, 25 Oct 2014 01:38:59 +0000 (UTC) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D376AFC; Sat, 25 Oct 2014 01:38:59 +0000 (UTC) Received: by mail-ig0-f181.google.com with SMTP id l13so1443224iga.14 for ; Fri, 24 Oct 2014 18:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JjpTQ2kTSQpN8tj7u7SQ3BhUBnVTGeTn2bHe8nelu5A=; b=dm4Fsmbwvi23PxXowcFs7MIIXWT2Mh70lM+BtYyyaIUewTEAEPy1Ig+TEzc57NrZWm nZ11S9qc+taGb9Li3PQg6I16b5GMPIi6/in+dSa8uhk3MoGkou1ZccYNzvKTJ2bRWDiF rrtKqdQM7//81t59AgrgvdbPYnM4WuQmhfTErdukzVSFG/4ppLf2Lliex1gcnixomKnt Ku3+4wLC10XF/b/DQ2i/EEARTq+R8gDrI6EO03yAW2djThGZ+/C2eWKTiwmD7T1k9fkZ 5W7+jbA/Lc7fv+9nc7E1xkNz5DSuk8rLXN7LMmz40xv83FOpvPr/C1hHtrAyErU7IBkU iBFQ== MIME-Version: 1.0 X-Received: by 10.43.90.198 with SMTP id bj6mr6596527icc.4.1414201138854; Fri, 24 Oct 2014 18:38:58 -0700 (PDT) Received: by 10.50.193.135 with HTTP; Fri, 24 Oct 2014 18:38:58 -0700 (PDT) In-Reply-To: <88B273DE-C9EB-4C11-AE9E-0136BC2324C2@FreeBSD.org> References: <201410242002.s9OK2i3w018818@svn.freebsd.org> <88B273DE-C9EB-4C11-AE9E-0136BC2324C2@FreeBSD.org> Date: Fri, 24 Oct 2014 18:38:58 -0700 Message-ID: Subject: Re: svn commit: r273604 - in head: include lib/libc/gen sys/kern sys/sys usr.bin/truss From: NGie Cooper To: "Bjoern A. Zeeb" Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , John Baldwin X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 01:38:59 -0000 On Fri, Oct 24, 2014 at 6:35 PM, Bjoern A. Zeeb wrote: ... > Has anyone fixed this: > > /scratch/tmp/bz/head.svn/sys/kern/kern_umtx.c:2898:21: error: passing 'volatile __uint32_t *' (aka 'volatile unsigned int *') to parameter of type 'const void *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifier > s] > count = fuword32(&sem->_count); > ^~~~~~~~~~~~ > /scratch/tmp/bz/head.svn/sys/sys/systm.h:258:30: note: passing argument to parameter 'base' here > int32_t fuword32(const void *base); > ^ > 1 error generated. > --- kern_umtx.o --- > *** [kern_umtx.o] Error code 1 Xin did in r273616. Cheers! From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 02:21:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9490B614 for ; Sat, 25 Oct 2014 02:21:46 +0000 (UTC) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com [209.85.217.170]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A5DAEC9 for ; Sat, 25 Oct 2014 02:21:45 +0000 (UTC) Received: by mail-lb0-f170.google.com with SMTP id u10so3695846lbd.1 for ; Fri, 24 Oct 2014 19:21:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=IvbLD0YpZF2UHRGMP+nVo/jDVEM0SHVubs5JOuRsFTo=; b=mY3WaQKNAcNVaSzKJlb4/F9kNT+TzrvySAaq1yzhOC+vANoPLVbH5Ml1WULw1vFvop lT30YTSNzkVvTR9k1RSsfbOcxTKT6YclHIUjkaAT7hny6UuDGWze0920vQFgA+eH1M5a /znIreegNvdPGjTYdtpOpHvQdcAUXbhGk3zVVOU8BMFMuB4xxFreLY/d7Xli2mFvBnEy 7JQGx9L8AxIU+LaKUt5L5N1RD74WP97+HuCt9nEFKnTa8Aub3aeXBLMb36WgbzE8ZTVj ddbQkcT+LtclweFMHdtXppgfOu/KNbcwhfxDdtiDEi6VpBZVavFHer76op4UC8kezD6q 1X1g== X-Gm-Message-State: ALoCoQkG8BvSnrfpj9LDPWV3WeKPZ3Yik4k49MckdE5t8oZeY+LlLTD+Fd1/8fzKjj3SLiAa51op X-Received: by 10.152.5.129 with SMTP id s1mr8186724las.59.1414203697777; Fri, 24 Oct 2014 19:21:37 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id je9sm2431544lac.6.2014.10.24.19.21.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 19:21:37 -0700 (PDT) Message-ID: <544B0930.8010004@freebsd.org> Date: Sat, 25 Oct 2014 06:21:36 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273601 - head/lib/libc/gen References: <201410241955.s9OJtnbm014234@svn.freebsd.org> In-Reply-To: <201410241955.s9OJtnbm014234@svn.freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 02:21:46 -0000 On 24.10.2014 23:55, John Baldwin wrote: > Author: jhb > Date: Fri Oct 24 19:55:49 2014 > New Revision: 273601 > URL: https://svnweb.freebsd.org/changeset/base/273601 > > Log: > Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores > were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). sem kernel module referenced in sem(4) uses the same uipc_sem.c file as kernel's P1003_1B_SEMAPHORES option, so they both use the same code and better be cross-linked since sem(4) explains how to turn it on. -- http://ache.vniz.net/ From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 03:50:04 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F35FA43A for ; Sat, 25 Oct 2014 03:50:03 +0000 (UTC) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78ACE92A for ; Sat, 25 Oct 2014 03:50:02 +0000 (UTC) Received: by mail-lb0-f181.google.com with SMTP id l4so3530405lbv.12 for ; Fri, 24 Oct 2014 20:50:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5fcAsW4xMkQE6xLWVtBV0GdBfRuMLcZ3Hc29zhkzPgg=; b=UX9MPFMFZIqpU1pkdbLj/x4pbQXvPD7lSE+ckGDJmAGIGhD4ai6ecdteLYoj5j9bDt AIxgc7ZLv4pIpYheZj0rZdWvaUJ7DUlkM32X/Zt40gXUjoHRvKTkWGv16u3Z/nDurZPn P+MRj8hGCEgxw3QqS/oJxVx2aXxa9fxV+lSDjYmA3TR/ObHH30bilqtDiJjqCp6+ItlL nfQVSLKVMnV4FkSXN+VVIn6ifVvR3aMW50XZ1z7trIwRl0AOhCB1CThjablTTUClHFcH EZJerrmxLTkJexnjXgTAkBxrKsp58rc1/4KLziUbexL8gGkIgue77KueBLFGj6FSaEVW rI0w== X-Gm-Message-State: ALoCoQlynuHqfUGwTLrnz12+LMMGB0wPTglb6o9mO8+CYSmmFkbW7YaRXr3BdSJk7rRmmFon3V7n X-Received: by 10.112.38.67 with SMTP id e3mr8598190lbk.6.1414208565743; Fri, 24 Oct 2014 20:42:45 -0700 (PDT) Received: from [192.168.1.2] ([89.169.173.68]) by mx.google.com with ESMTPSA id i6sm2469274laf.47.2014.10.24.20.42.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Oct 2014 20:42:45 -0700 (PDT) Message-ID: <544B1C34.1020204@freebsd.org> Date: Sat, 25 Oct 2014 07:42:44 +0400 From: Andrey Chernov User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r273601 - head/lib/libc/gen References: <201410241955.s9OJtnbm014234@svn.freebsd.org> <544B0930.8010004@freebsd.org> In-Reply-To: <544B0930.8010004@freebsd.org> Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 03:50:04 -0000 On 25.10.2014 6:21, Andrey Chernov wrote: > On 24.10.2014 23:55, John Baldwin wrote: >> Author: jhb >> Date: Fri Oct 24 19:55:49 2014 >> New Revision: 273601 >> URL: https://svnweb.freebsd.org/changeset/base/273601 >> >> Log: >> Don't reference sem(4) from the POSIX semaphore pages. POSIX semaphores >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > better be cross-linked since sem(4) explains how to turn it on. > >From the first glance I can't determine, is libc implementation better than kernel one or not. BTW, firefox port still recommends sem_load="YES" -- http://ache.vniz.net/ From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 04:52:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8068F3A7; Sat, 25 Oct 2014 04:52:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CEA2F9C; Sat, 25 Oct 2014 04:52:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P4qnKn069048; Sat, 25 Oct 2014 04:52:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P4qniG069046; Sat, 25 Oct 2014 04:52:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250452.s9P4qniG069046@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 04:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273627 - head/tools/regression/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 04:52:49 -0000 Author: ngie Date: Sat Oct 25 04:52:48 2014 New Revision: 273627 URL: https://svnweb.freebsd.org/changeset/base/273627 Log: - Print out "Bail out!" in die(..) so prove terminates immediately - Handle the output from newer versions of openssl md5, similar to what pjd@ did in r248304 MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/misc.sh Modified: head/tools/regression/zfs/misc.sh ============================================================================== --- head/tools/regression/zfs/misc.sh Sat Oct 25 02:08:02 2014 (r273626) +++ head/tools/regression/zfs/misc.sh Sat Oct 25 04:52:48 2014 (r273627) @@ -39,6 +39,7 @@ fi die() { echo "${1}" > /dev/stderr + echo "Bail out!" exit 1 } @@ -363,7 +364,7 @@ files_destroy() name_create() { - echo "zfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | cut -b -8`" + echo "zfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | awk '{ print $NF }'`" } names_create() From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 05:31:19 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 83BB187B; Sat, 25 Oct 2014 05:31:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 703BF2BA; Sat, 25 Oct 2014 05:31:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P5VJLw087164; Sat, 25 Oct 2014 05:31:19 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P5VJxu087163; Sat, 25 Oct 2014 05:31:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250531.s9P5VJxu087163@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 05:31:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273628 - head/tools/regression/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 05:31:19 -0000 Author: ngie Date: Sat Oct 25 05:31:18 2014 New Revision: 273628 URL: https://svnweb.freebsd.org/changeset/base/273628 Log: Move the redirection to stderr out of the cmd variable assignment Putting 2>/dev/null in cmd= escapes the redirection operation, which causes mdconfig to think it's a filename MFC after: 2 weeks X-MFC with: r273627 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/misc.sh Modified: head/tools/regression/zfs/misc.sh ============================================================================== --- head/tools/regression/zfs/misc.sh Sat Oct 25 04:52:48 2014 (r273627) +++ head/tools/regression/zfs/misc.sh Sat Oct 25 05:31:18 2014 (r273628) @@ -167,8 +167,8 @@ create_memdisk() if [ -n "${devname}" ]; then devparam="-u ${devname}" fi - cmd="mdconfig -a -t swap -s ${size} ${devparam} 2>/dev/null" - DISKNAME=`${cmd}` || die "failed: ${cmd}" + cmd="mdconfig -a -t swap -s ${size} ${devparam}" + DISKNAME=`$cmd 2>/dev/null` || die "failed: ${cmd}" if [ -n "${devname}" ]; then DISKNAME="${devname}" fi From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 05:56:22 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AA0FAC42; Sat, 25 Oct 2014 05:56:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9675B6D9; Sat, 25 Oct 2014 05:56:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P5uMhc096601; Sat, 25 Oct 2014 05:56:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P5uMrx096600; Sat, 25 Oct 2014 05:56:22 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201410250556.s9P5uMrx096600@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 25 Oct 2014 05:56:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273629 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 05:56:22 -0000 Author: mjg Date: Sat Oct 25 05:56:21 2014 New Revision: 273629 URL: https://svnweb.freebsd.org/changeset/base/273629 Log: rlimit: plug duplicate assertion counter sanity is already checked by refcount_release. Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Sat Oct 25 05:31:18 2014 (r273628) +++ head/sys/kern/kern_resource.c Sat Oct 25 05:56:21 2014 (r273629) @@ -1168,7 +1168,6 @@ lim_free(limp) struct plimit *limp; { - KASSERT(limp->pl_refcnt > 0, ("plimit refcnt underflow")); if (refcount_release(&limp->pl_refcnt)) free((void *)limp, M_PLIMIT); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 06:10:02 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9007120; Sat, 25 Oct 2014 06:10:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A53EF829; Sat, 25 Oct 2014 06:10:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P6A2bX001879; Sat, 25 Oct 2014 06:10:02 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P6A2GP001878; Sat, 25 Oct 2014 06:10:02 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250610.s9P6A2GP001878@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 06:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273630 - head/tools/regression/zfs/zpool/add X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 06:10:02 -0000 Author: ngie Date: Sat Oct 25 06:10:01 2014 New Revision: 273630 URL: https://svnweb.freebsd.org/changeset/base/273630 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 191573 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/files.t Modified: head/tools/regression/zfs/zpool/add/files.t ============================================================================== --- head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 05:56:21 2014 (r273629) +++ head/tools/regression/zfs/zpool/add/files.t Sat Oct 25 06:10:01 2014 (r273630) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 191573" + echo "1..54" files_create 8 From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 06:28:49 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 93D6A398; Sat, 25 Oct 2014 06:28:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 804A9993; Sat, 25 Oct 2014 06:28:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P6Sn5t010698; Sat, 25 Oct 2014 06:28:49 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P6SnTD010697; Sat, 25 Oct 2014 06:28:49 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250628.s9P6SnTD010697@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 06:28:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273631 - head/tools/regression/zfs/zpool/add X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 06:28:49 -0000 Author: ngie Date: Sat Oct 25 06:28:48 2014 New Revision: 273631 URL: https://svnweb.freebsd.org/changeset/base/273631 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194586 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Modified: head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t ============================================================================== --- head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Sat Oct 25 06:10:01 2014 (r273630) +++ head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t Sat Oct 25 06:28:48 2014 (r273631) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194586" + echo "1..100" disks_create 7 From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 06:33:01 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A773C5A3; Sat, 25 Oct 2014 06:33:01 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 93D29A42; Sat, 25 Oct 2014 06:33:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P6X1sp014717; Sat, 25 Oct 2014 06:33:01 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P6X1eu014716; Sat, 25 Oct 2014 06:33:01 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250633.s9P6X1eu014716@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 06:33:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273632 - head/tools/regression/zfs/zpool/add X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 06:33:01 -0000 Author: ngie Date: Sat Oct 25 06:33:00 2014 New Revision: 273632 URL: https://svnweb.freebsd.org/changeset/base/273632 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194587 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Modified: head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t ============================================================================== --- head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Sat Oct 25 06:28:48 2014 (r273631) +++ head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t Sat Oct 25 06:33:00 2014 (r273632) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194587" + echo "1..100" disks_create 7 From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 07:20:47 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 94DFE1F2; Sat, 25 Oct 2014 07:20:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80D98E3F; Sat, 25 Oct 2014 07:20:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P7Klf0039077; Sat, 25 Oct 2014 07:20:47 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P7KlTX039076; Sat, 25 Oct 2014 07:20:47 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201410250720.s9P7KlTX039076@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 25 Oct 2014 07:20:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273633 - head/tools/regression/zfs/zpool/create X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 07:20:47 -0000 Author: ngie Date: Sat Oct 25 07:20:46 2014 New Revision: 273633 URL: https://svnweb.freebsd.org/changeset/base/273633 Log: Bail out of the script on FreeBSD due to deterministic panic issue PR: 194589 Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/zfs/zpool/create/files.t Modified: head/tools/regression/zfs/zpool/create/files.t ============================================================================== --- head/tools/regression/zfs/zpool/create/files.t Sat Oct 25 06:33:00 2014 (r273632) +++ head/tools/regression/zfs/zpool/create/files.t Sat Oct 25 07:20:46 2014 (r273633) @@ -4,6 +4,8 @@ dir=`dirname $0` . ${dir}/../../misc.sh +[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194589" + echo "1..59" files_create 5 From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 09:00:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 332C9F2; Sat, 25 Oct 2014 09:00:09 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA69C8F1; Sat, 25 Oct 2014 09:00:08 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s9P902jw031429 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 25 Oct 2014 12:00:02 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s9P902jw031429 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s9P900hQ031428; Sat, 25 Oct 2014 12:00:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 25 Oct 2014 12:00:00 +0300 From: Konstantin Belousov To: Rui Paulo Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica Message-ID: <20141025090000.GG1877@kib.kiev.ua> References: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> <20141024194546.GE1877@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20141024194546.GE1877@kib.kiev.ua> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Rui Paulo X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 09:00:09 -0000 On Fri, Oct 24, 2014 at 10:45:46PM +0300, Konstantin Belousov wrote: > On Fri, Oct 24, 2014 at 07:33:07PM +0000, Rui Paulo wrote: > > On Oct 24, 2014, at 12:20 PM, Konstantin Belousov wrote: > > > > > +static int > > > +hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, > > > + int nprot, vm_memattr_t *memattr) > > > +{ > > > + š šstruct hpet_softc *sc; > > > + > > > + š šsc = cdev->si_drv1; > > > + š š š šif (offset > rman_get_size(sc->mem_res)) > > > + š š š š š š š šreturn (EINVAL); > > > + š šif (!sc->mmap_allow_write && (nprot & PROT_WRITE)) > > > + š š šreturn (EPERM); > > > + š š š*paddr = rman_get_start(sc->mem_res) + offset; > > What is the memattr for the backing page ? Is it set to non-cached > > mode somehow ? I was not able to find place where would this happen. > > š > > I expect it to be set to non-cached since it's a device anyway, but I don't know where it is. šDuring my testing, I did not see any problems with cached values, though. > > > I am not claiming that it is wrong, only that I do not see an easy reason > why it is right. Just printing the *memattr would provide the confidence. > Ok, I did looked at the pte of the HPET page. I get the value 0x80000000fed00025 which coincides with the resource address 0xfed00000 reported by devinfo -vr for hpet (to double-check my findings). The low bits indicate that PAT0 pat entry is used for the page caching mode. Corresponding PAT MSR 0x277 has the following value: sandy% sudo cpucontrol -m 0x277 /dev/cpuctl0 MSR 0x277: 0x00010506 0x00070406 i.e. memory type is 6, which is write-back, according to SDM. This is wrong, as I feared. The patch below fixes the issue. The pte for HPET page is equal to 0x80000000fed0003d after the patch is applied, PAT3 is used, and its value is 0 == UNCACHEABLE, as it must be. Do you agree with the patch ? diff --git a/sys/dev/acpica/acpi_hpet.c b/sys/dev/acpica/acpi_hpet.c index 6b35f5c..0da8bae 100644 --- a/sys/dev/acpica/acpi_hpet.c +++ b/sys/dev/acpica/acpi_hpet.c @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_t offset, vm_paddr_t *paddr, if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); *paddr = rman_get_start(sc->mem_res) + offset; + *memattr = VM_MEMATTR_UNCACHEABLE; return (0); } From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 09:25:30 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5A578482; Sat, 25 Oct 2014 09:25:30 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46904B58; Sat, 25 Oct 2014 09:25:30 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9P9PUqv095274; Sat, 25 Oct 2014 09:25:30 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9P9PULY095273; Sat, 25 Oct 2014 09:25:30 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201410250925.s9P9PULY095273@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 25 Oct 2014 09:25:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273634 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 09:25:30 -0000 Author: tuexen Date: Sat Oct 25 09:25:29 2014 New Revision: 273634 URL: https://svnweb.freebsd.org/changeset/base/273634 Log: Fix a use of an uninitialized variable by makeing sure that sctp_med_chunk_output() always initialized the reason_code instead of relying on the caller. The variable is only used for debugging purpose. This issue was reported by Peter Bostroem from Google. MFC after: 3 days Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Oct 25 07:20:46 2014 (r273633) +++ head/sys/netinet/sctp_output.c Sat Oct 25 09:25:29 2014 (r273634) @@ -6748,7 +6748,7 @@ sctp_sendall_iterator(struct sctp_inpcb if (do_chunk_output) sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_USR_SEND, SCTP_SO_NOT_LOCKED); else if (added_control) { - int num_out = 0, reason = 0, now_filled = 0; + int num_out, reason, now_filled = 0; struct timeval now; int frag_point; @@ -7814,6 +7814,7 @@ sctp_med_chunk_output(struct sctp_inpcb int quit_now = 0; *num_out = 0; + *reason_code = 0; auth_keyid = stcb->asoc.authinfo.active_keyid; if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED) || @@ -9945,7 +9946,7 @@ sctp_chunk_output(struct sctp_inpcb *inp */ struct sctp_association *asoc; struct sctp_nets *net; - int error = 0, num_out = 0, tot_out = 0, ret = 0, reason_code = 0; + int error = 0, num_out, tot_out = 0, ret = 0, reason_code; unsigned int burst_cnt = 0; struct timeval now; int now_filled = 0; From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 12:50:28 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 58E81CB9; Sat, 25 Oct 2014 12:50:28 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 43E672A1; Sat, 25 Oct 2014 12:50:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PCoS4U089612; Sat, 25 Oct 2014 12:50:28 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PCoQaL089386; Sat, 25 Oct 2014 12:50:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410251250.s9PCoQaL089386@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Oct 2014 12:50:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273635 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 12:50:28 -0000 Author: mav Date: Sat Oct 25 12:50:26 2014 New Revision: 273635 URL: https://svnweb.freebsd.org/changeset/base/273635 Log: Add basic iSNS client to the iSCSI target. This makes ctld(8) register its iSCSI targets and portals on configured iSNS servers to allow initiators find them without active discovery. Fetching of allowed initiators from iSNS is not implemented now, so target ACLs still should be configured manually. Reviewed by: trasz@ MFC after: 1 month Sponsored by: iXsystems, Inc. Added: head/usr.sbin/ctld/isns.c (contents, props changed) head/usr.sbin/ctld/isns.h (contents, props changed) Modified: head/usr.sbin/ctld/Makefile head/usr.sbin/ctld/ctl.conf.5 head/usr.sbin/ctld/ctld.c head/usr.sbin/ctld/ctld.h head/usr.sbin/ctld/parse.y head/usr.sbin/ctld/token.l Modified: head/usr.sbin/ctld/Makefile ============================================================================== --- head/usr.sbin/ctld/Makefile Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/Makefile Sat Oct 25 12:50:26 2014 (r273635) @@ -1,7 +1,8 @@ # $FreeBSD$ PROG= ctld -SRCS= chap.c ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h +SRCS= chap.c ctld.c discovery.c isns.c kernel.c keys.c log.c +SRCS+= login.c parse.y pdu.c token.l y.tab.h CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../sys/cam/ctl Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctl.conf.5 Sat Oct 25 12:50:26 2014 (r273635) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 22, 2014 +.Dd October 23, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -106,6 +106,13 @@ The timeout for login sessions, after wh will be forcibly terminated. The default is 60. A setting of 0 disables the timeout. +.It Ic isns-server Ar address +An IPv4 or IPv6 address and optionally port of iSNS server to register on. +.It Ic isns-period Ar seconds +iSNS registration period. +Registered Network Entity not updated during this period will be unregistered. +.It Ic isns-timeout Ar seconds +Timeout for iSNS requests. .El .Ss auth-group Context .Bl -tag -width indent Modified: head/usr.sbin/ctld/ctld.c ============================================================================== --- head/usr.sbin/ctld/ctld.c Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctld.c Sat Oct 25 12:50:26 2014 (r273635) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include "ctld.h" +#include "isns.h" bool proxy_mode = false; @@ -89,7 +90,10 @@ conf_new(void) TAILQ_INIT(&conf->conf_targets); TAILQ_INIT(&conf->conf_auth_groups); TAILQ_INIT(&conf->conf_portal_groups); + TAILQ_INIT(&conf->conf_isns); + conf->conf_isns_period = 900; + conf->conf_isns_timeout = 5; conf->conf_debug = 0; conf->conf_timeout = 60; conf->conf_maxproc = 30; @@ -103,6 +107,7 @@ conf_delete(struct conf *conf) struct target *targ, *tmp; struct auth_group *ag, *cagtmp; struct portal_group *pg, *cpgtmp; + struct isns *is, *istmp; assert(conf->conf_pidfh == NULL); @@ -112,6 +117,8 @@ conf_delete(struct conf *conf) auth_group_delete(ag); TAILQ_FOREACH_SAFE(pg, &conf->conf_portal_groups, pg_next, cpgtmp) portal_group_delete(pg); + TAILQ_FOREACH_SAFE(is, &conf->conf_isns, i_next, istmp) + isns_delete(is); free(conf->conf_pidfile_path); free(conf); } @@ -644,47 +651,28 @@ portal_group_find(const struct conf *con return (NULL); } -int -portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +static int +parse_addr_port(char *arg, const char *def_port, struct addrinfo **ai) { struct addrinfo hints; - struct portal *portal; - char *addr, *ch, *arg; + char *addr, *ch; const char *port; int error, colons = 0; - portal = portal_new(pg); - portal->p_listen = checked_strdup(value); - portal->p_iser = iser; - - arg = portal->p_listen; - if (arg[0] == '\0') { - log_warnx("empty listen address"); - portal_delete(portal); - return (1); - } if (arg[0] == '[') { /* * IPv6 address in square brackets, perhaps with port. */ arg++; addr = strsep(&arg, "]"); - if (arg == NULL) { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + if (arg == NULL) return (1); - } if (arg[0] == '\0') { - port = "3260"; + port = def_port; } else if (arg[0] == ':') { port = arg + 1; - } else { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + } else return (1); - } } else { /* * Either IPv6 address without brackets - and without @@ -696,11 +684,11 @@ portal_group_add_listen(struct portal_gr } if (colons > 1) { addr = arg; - port = "3260"; + port = def_port; } else { addr = strsep(&arg, ":"); if (arg == NULL) - port = "3260"; + port = def_port; else port = arg; } @@ -710,11 +698,23 @@ portal_group_add_listen(struct portal_gr hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; + error = getaddrinfo(addr, port, &hints, ai); + if (error != 0) + return (1); + return (0); +} - error = getaddrinfo(addr, port, &hints, &portal->p_ai); - if (error != 0) { - log_warnx("getaddrinfo for %s failed: %s", - portal->p_listen, gai_strerror(error)); +int +portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +{ + struct portal *portal; + + portal = portal_new(pg); + portal->p_listen = checked_strdup(value); + portal->p_iser = iser; + + if (parse_addr_port(portal->p_listen, "3260", &portal->p_ai)) { + log_warnx("invalid listen address %s", portal->p_listen); portal_delete(portal); return (1); } @@ -727,6 +727,258 @@ portal_group_add_listen(struct portal_gr return (0); } +int +isns_new(struct conf *conf, const char *addr) +{ + struct isns *isns; + + isns = calloc(1, sizeof(*isns)); + if (isns == NULL) + log_err(1, "calloc"); + isns->i_conf = conf; + TAILQ_INSERT_TAIL(&conf->conf_isns, isns, i_next); + isns->i_addr = checked_strdup(addr); + + if (parse_addr_port(isns->i_addr, "3205", &isns->i_ai)) { + log_warnx("invalid iSNS address %s", isns->i_addr); + isns_delete(isns); + return (1); + } + + /* + * XXX: getaddrinfo(3) may return multiple addresses; we should turn + * those into multiple servers. + */ + + return (0); +} + +void +isns_delete(struct isns *isns) +{ + + TAILQ_REMOVE(&isns->i_conf->conf_isns, isns, i_next); + free(isns->i_addr); + if (isns->i_ai != NULL) + freeaddrinfo(isns->i_ai); + free(isns); +} + +static int +isns_do_connect(struct isns *isns) +{ + int s; + + s = socket(isns->i_ai->ai_family, isns->i_ai->ai_socktype, + isns->i_ai->ai_protocol); + if (s < 0) { + log_warn("socket(2) failed for %s", isns->i_addr); + return (-1); + } + if (connect(s, isns->i_ai->ai_addr, isns->i_ai->ai_addrlen)) { + log_warn("connect(2) failed for %s", isns->i_addr); + close(s); + return (-1); + } + return(s); +} + +static int +isns_do_register(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct target *target; + struct portal *portal; + struct portal_group *pg; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVATTRREG, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_delim(req); + isns_req_add_str(req, 1, hostname); + isns_req_add_32(req, 2, 2); /* 2 -- iSCSI */ + isns_req_add_32(req, 6, conf->conf_isns_period); + TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) { + if (pg->pg_unassigned) + continue; + TAILQ_FOREACH(portal, &pg->pg_portals, p_next) { + isns_req_add_addr(req, 16, portal->p_ai); + isns_req_add_port(req, 17, portal->p_ai); + } + } + TAILQ_FOREACH(target, &conf->conf_targets, t_next) { + isns_req_add_str(req, 32, target->t_name); + isns_req_add_32(req, 33, 1); /* 1 -- Target*/ + if (target->t_alias != NULL) + isns_req_add_str(req, 34, target->t_alias); + pg = target->t_portal_group; + isns_req_add_32(req, 51, pg->pg_tag); + TAILQ_FOREACH(portal, &pg->pg_portals, p_next) { + isns_req_add_addr(req, 49, portal->p_ai); + isns_req_add_port(req, 50, portal->p_ai); + } + } + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS register error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +static int +isns_do_check(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVATTRQRY, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_str(req, 1, hostname); + isns_req_add_delim(req); + isns_req_add(req, 2, 0, NULL); + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS check error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +static int +isns_do_deregister(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVDEREG, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_delim(req); + isns_req_add_str(req, 1, hostname); + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS deregister error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +void +isns_register(struct isns *isns, struct isns *oldisns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) { + set_timeout(0, false); + return; + } + gethostname(hostname, sizeof(hostname)); + + if (oldisns == NULL || TAILQ_EMPTY(&oldisns->i_conf->conf_targets)) + oldisns = isns; + res = isns_do_deregister(oldisns, s, hostname); + res = isns_do_register(isns, s, hostname); + close(s); + set_timeout(0, false); +} + +void +isns_check(struct isns *isns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) { + set_timeout(0, false); + return; + } + gethostname(hostname, sizeof(hostname)); + + res = isns_do_check(isns, s, hostname); + if (res < 0) { + res = isns_do_deregister(isns, s, hostname); + res = isns_do_register(isns, s, hostname); + } + close(s); + set_timeout(0, false); +} + +void +isns_deregister(struct isns *isns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) + return; + gethostname(hostname, sizeof(hostname)); + + res = isns_do_deregister(isns, s, hostname); + close(s); + set_timeout(0, false); +} + static bool valid_hex(const char ch) { @@ -1276,6 +1528,7 @@ conf_apply(struct conf *oldconf, struct struct lun *oldlun, *newlun, *tmplun; struct portal_group *oldpg, *newpg; struct portal *oldp, *newp; + struct isns *oldns, *newns; pid_t otherpid; int changed, cumulated_error = 0, error; int one = 1; @@ -1313,6 +1566,16 @@ conf_apply(struct conf *oldconf, struct } } + /* Deregister on removed iSNS servers. */ + TAILQ_FOREACH(oldns, &oldconf->conf_isns, i_next) { + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) { + if (strcmp(oldns->i_addr, newns->i_addr) == 0) + break; + } + if (newns == NULL) + isns_deregister(oldns); + } + /* * XXX: If target or lun removal fails, we should somehow "move" * the old lun or target into newconf, so that subsequent @@ -1342,10 +1605,8 @@ conf_apply(struct conf *oldconf, struct oldlun->l_ctl_lun); cumulated_error++; } - lun_delete(oldlun); } kernel_port_remove(oldtarg); - target_delete(oldtarg); continue; } @@ -1368,7 +1629,6 @@ conf_apply(struct conf *oldconf, struct oldlun->l_ctl_lun); cumulated_error++; } - lun_delete(oldlun); continue; } @@ -1594,6 +1854,19 @@ conf_apply(struct conf *oldconf, struct } } + /* (Re-)Register on remaining/new iSNS servers. */ + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) { + TAILQ_FOREACH(oldns, &oldconf->conf_isns, i_next) { + if (strcmp(oldns->i_addr, newns->i_addr) == 0) + break; + } + isns_register(newns, oldns); + } + + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) + set_timeout((newconf->conf_isns_period + 2) / 3, false); + return (cumulated_error); } @@ -1605,7 +1878,7 @@ timed_out(void) } static void -sigalrm_handler(int dummy __unused) +sigalrm_handler_fatal(int dummy __unused) { /* * It would be easiest to just log an error and exit. We can't @@ -1625,19 +1898,35 @@ sigalrm_handler(int dummy __unused) } static void -set_timeout(const struct conf *conf) +sigalrm_handler(int dummy __unused) +{ + + sigalrm_received = true; +} + +void +set_timeout(int timeout, int fatal) { struct sigaction sa; struct itimerval itv; int error; - if (conf->conf_timeout <= 0) { + if (timeout <= 0) { log_debugx("session timeout disabled"); + bzero(&itv, sizeof(itv)); + error = setitimer(ITIMER_REAL, &itv, NULL); + if (error != 0) + log_err(1, "setitimer"); + sigalrm_received = false; return; } + sigalrm_received = false; bzero(&sa, sizeof(sa)); - sa.sa_handler = sigalrm_handler; + if (fatal) + sa.sa_handler = sigalrm_handler_fatal; + else + sa.sa_handler = sigalrm_handler; sigfillset(&sa.sa_mask); error = sigaction(SIGALRM, &sa, NULL); if (error != 0) @@ -1647,12 +1936,10 @@ set_timeout(const struct conf *conf) * First SIGALRM will arive after conf_timeout seconds. * If we do nothing, another one will arrive a second later. */ + log_debugx("setting session timeout to %d seconds", timeout); bzero(&itv, sizeof(itv)); itv.it_interval.tv_sec = 1; - itv.it_value.tv_sec = conf->conf_timeout; - - log_debugx("setting session timeout to %d seconds", - conf->conf_timeout); + itv.it_value.tv_sec = timeout; error = setitimer(ITIMER_REAL, &itv, NULL); if (error != 0) log_err(1, "setitimer"); @@ -1738,7 +2025,7 @@ handle_connection(struct portal *portal, setproctitle("%s", host); conn = connection_new(portal, fd, host, client_sa); - set_timeout(conf); + set_timeout(conf->conf_timeout, true); kernel_capsicate(); login(conn); if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { @@ -1785,7 +2072,7 @@ main_loop(struct conf *conf, bool dont_f pidfile_write(conf->conf_pidfh); for (;;) { - if (sighup_received || sigterm_received) + if (sighup_received || sigterm_received || timed_out()) return; #ifdef ICL_KERNEL_PROXY @@ -1909,6 +2196,7 @@ int main(int argc, char **argv) { struct conf *oldconf, *newconf, *tmpconf; + struct isns *newns; const char *config_path = DEFAULT_CONFIG_PATH; int debug = 0, ch, error; bool dont_daemonize = false; @@ -1968,6 +2256,10 @@ main(int argc, char **argv) } } + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) + set_timeout((newconf->conf_isns_period + 2) / 3, false); + for (;;) { main_loop(newconf, dont_daemonize); if (sighup_received) { @@ -2003,12 +2295,25 @@ main(int argc, char **argv) error = conf_apply(oldconf, newconf); if (error != 0) log_warnx("failed to apply configuration"); + conf_delete(oldconf); + oldconf = NULL; log_warnx("exiting on signal"); exit(0); } else { nchildren -= wait_for_children(false); assert(nchildren >= 0); + if (timed_out()) { + set_timeout(0, false); + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) + isns_check(newns); + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) { + set_timeout((newconf->conf_isns_period + + 2) / 3, + false); + } + } } } /* NOTREACHED */ Modified: head/usr.sbin/ctld/ctld.h ============================================================================== --- head/usr.sbin/ctld/ctld.h Sat Oct 25 09:25:29 2014 (r273634) +++ head/usr.sbin/ctld/ctld.h Sat Oct 25 12:50:26 2014 (r273635) @@ -146,11 +146,21 @@ struct target { char *t_alias; }; +struct isns { + TAILQ_ENTRY(isns) i_next; + struct conf *i_conf; + char *i_addr; + struct addrinfo *i_ai; +}; + struct conf { char *conf_pidfile_path; TAILQ_HEAD(, target) conf_targets; TAILQ_HEAD(, auth_group) conf_auth_groups; TAILQ_HEAD(, portal_group) conf_portal_groups; + TAILQ_HEAD(, isns) conf_isns; + int conf_isns_period; + int conf_isns_timeout; int conf_debug; int conf_timeout; int conf_maxproc; @@ -281,6 +291,12 @@ struct portal_group *portal_group_find(c int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); +int isns_new(struct conf *conf, const char *addr); +void isns_delete(struct isns *is); +void isns_register(struct isns *isns, struct isns *oldisns); +void isns_check(struct isns *isns); +void isns_deregister(struct isns *isns); + struct target *target_new(struct conf *conf, const char *name); void target_delete(struct target *target); struct target *target_find(struct conf *conf, @@ -358,6 +374,7 @@ void log_debugx(const char *, ...) __p char *checked_strdup(const char *); bool valid_iscsi_name(const char *name); +void set_timeout(int timeout, int fatal); bool timed_out(void); #endif /* !CTLD_H */ Added: head/usr.sbin/ctld/isns.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ctld/isns.c Sat Oct 25 12:50:26 2014 (r273635) @@ -0,0 +1,258 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ctld.h" +#include "isns.h" + +struct isns_req * +isns_req_alloc(void) +{ + struct isns_req *req; + + req = calloc(sizeof(struct isns_req), 1); + if (req == NULL) { + log_err(1, "calloc"); + return (NULL); + } + req->ir_buflen = sizeof(struct isns_hdr); + req->ir_usedlen = 0; + req->ir_buf = calloc(req->ir_buflen, 1); + if (req == NULL) { + free(req); + log_err(1, "calloc"); + return (NULL); + } + return (req); +} + +struct isns_req * +isns_req_create(uint16_t func, uint16_t flags) +{ + struct isns_req *req; + struct isns_hdr *hdr; + + req = isns_req_alloc(); + req->ir_usedlen = sizeof(struct isns_hdr); + hdr = (struct isns_hdr *)req->ir_buf; + be16enc(hdr->ih_version, ISNS_VERSION); + be16enc(hdr->ih_function, func); + be16enc(hdr->ih_flags, flags); + return (req); +} + +void +isns_req_free(struct isns_req *req) +{ + + free(req->ir_buf); + free(req); +} + +static int +isns_req_getspace(struct isns_req *req, uint32_t len) +{ + void *newbuf; + int newlen; + + if (req->ir_usedlen + len <= req->ir_buflen) + return (0); + newlen = 1 << flsl(req->ir_usedlen + len); + newbuf = realloc(req->ir_buf, newlen); + if (newbuf == NULL) { + log_err(1, "realloc"); + return (1); + } + req->ir_buf = newbuf; + req->ir_buflen = newlen; + return (0); +} + +void +isns_req_add(struct isns_req *req, uint32_t tag, uint32_t len, + const void *value) +{ + struct isns_tlv *tlv; + uint32_t vlen; + + vlen = len + ((len & 3) ? (4 - (len & 3)) : 0); + isns_req_getspace(req, sizeof(*tlv) + vlen); + tlv = (struct isns_tlv *)&req->ir_buf[req->ir_usedlen]; + be32enc(tlv->it_tag, tag); + be32enc(tlv->it_length, vlen); + memcpy(tlv->it_value, value, len); + if (vlen != len) + memset(&tlv->it_value[len], 0, vlen - len); + req->ir_usedlen += sizeof(*tlv) + vlen; +} + +void +isns_req_add_delim(struct isns_req *req) +{ + + isns_req_add(req, 0, 0, NULL); +} + +void +isns_req_add_str(struct isns_req *req, uint32_t tag, const char *value) +{ + + isns_req_add(req, tag, strlen(value) + 1, value); +} + +void +isns_req_add_32(struct isns_req *req, uint32_t tag, uint32_t value) +{ + uint32_t beval; + + be32enc(&beval, value); + isns_req_add(req, tag, sizeof(value), &beval); +} + +void +isns_req_add_addr(struct isns_req *req, uint32_t tag, struct addrinfo *ai) +{ + struct sockaddr_in *in4; + struct sockaddr_in6 *in6; + uint8_t buf[16]; + + switch (ai->ai_addr->sa_family) { + case AF_INET: + in4 = (struct sockaddr_in *)(void *)ai->ai_addr; + memset(buf, 0, 10); + buf[10] = 0xff; + buf[11] = 0xff; + memcpy(&buf[12], &in4->sin_addr, sizeof(in4->sin_addr)); + isns_req_add(req, tag, sizeof(buf), buf); + break; + case AF_INET6: + in6 = (struct sockaddr_in6 *)(void *)ai->ai_addr; + isns_req_add(req, tag, sizeof(in6->sin6_addr), &in6->sin6_addr); + break; + default: + log_errx(1, "Unsupported address family %d", + ai->ai_addr->sa_family); + } +} + +void +isns_req_add_port(struct isns_req *req, uint32_t tag, struct addrinfo *ai) +{ + struct sockaddr_in *in4; + struct sockaddr_in6 *in6; + uint32_t buf; + + switch (ai->ai_addr->sa_family) { + case AF_INET: + in4 = (struct sockaddr_in *)(void *)ai->ai_addr; + be32enc(&buf, ntohs(in4->sin_port)); + isns_req_add(req, tag, sizeof(buf), &buf); + break; + case AF_INET6: + in6 = (struct sockaddr_in6 *)(void *)ai->ai_addr; + be32enc(&buf, ntohs(in6->sin6_port)); + isns_req_add(req, tag, sizeof(buf), &buf); + break; + default: + log_errx(1, "Unsupported address family %d", + ai->ai_addr->sa_family); + } +} + +int +isns_req_send(int s, struct isns_req *req) +{ + struct isns_hdr *hdr; + int res; + + hdr = (struct isns_hdr *)req->ir_buf; + be16enc(hdr->ih_length, req->ir_usedlen - sizeof(*hdr)); + be16enc(hdr->ih_flags, be16dec(hdr->ih_flags) | + ISNS_FLAG_LAST | ISNS_FLAG_FIRST); + be16enc(hdr->ih_transaction, 0); + be16enc(hdr->ih_sequence, 0); + + res = write(s, req->ir_buf, req->ir_usedlen); + return ((res < 0) ? -1 : 0); +} + +int +isns_req_receive(int s, struct isns_req *req) +{ + struct isns_hdr *hdr; + ssize_t res, len; + + req->ir_usedlen = 0; + isns_req_getspace(req, sizeof(*hdr)); + res = read(s, req->ir_buf, sizeof(*hdr)); + if (res < (ssize_t)sizeof(*hdr)) + return (-1); + req->ir_usedlen = sizeof(*hdr); + hdr = (struct isns_hdr *)req->ir_buf; + if (be16dec(hdr->ih_version) != ISNS_VERSION) + return (-1); + if ((be16dec(hdr->ih_flags) & (ISNS_FLAG_LAST | ISNS_FLAG_FIRST)) != + (ISNS_FLAG_LAST | ISNS_FLAG_FIRST)) + return (-1); + len = be16dec(hdr->ih_length); + isns_req_getspace(req, len); + res = read(s, &req->ir_buf[req->ir_usedlen], len); + if (res < len) + return (-1); + req->ir_usedlen += len; + return (0); +} + +uint32_t +isns_req_get_status(struct isns_req *req) +{ + + if (req->ir_usedlen < sizeof(struct isns_hdr) + 4) + return (-1); + return (be32dec(&req->ir_buf[sizeof(struct isns_hdr)])); +} Added: head/usr.sbin/ctld/isns.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/ctld/isns.h Sat Oct 25 12:50:26 2014 (r273635) @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ISNS_H +#define _ISNS_H + +#define ISNS_VERSION 0x0001 + +#define ISNS_FUNC_DEVATTRREG 0x0001 +#define ISNS_FUNC_DEVATTRQRY 0x0002 +#define ISNS_FUNC_DEVGETNEXT 0x0003 +#define ISNS_FUNC_DEVDEREG 0x0004 +#define ISNS_FUNC_SCNREG 0x0005 +#define ISNS_FUNC_SCNDEREG 0x0006 +#define ISNS_FUNC_SCNEVENT 0x0007 +#define ISNS_FUNC_SCN 0x0008 +#define ISNS_FUNC_DDREG 0x0009 +#define ISNS_FUNC_DDDEREG 0x000a +#define ISNS_FUNC_DDSREG 0x000b +#define ISNS_FUNC_DDSDEREG 0x000c +#define ISNS_FUNC_ESI 0x000d +#define ISNS_FUNC_HEARTBEAT 0x000e +#define ISNS_FUNC_RESPONSE 0x8000 + +#define ISNS_FLAG_CLIENT 0x8000 +#define ISNS_FLAG_SERVER 0x4000 +#define ISNS_FLAG_AUTH 0x2000 +#define ISNS_FLAG_REPLACE 0x1000 +#define ISNS_FLAG_LAST 0x0800 +#define ISNS_FLAG_FIRST 0x0400 + +struct isns_hdr { + uint8_t ih_version[2]; + uint8_t ih_function[2]; + uint8_t ih_length[2]; + uint8_t ih_flags[2]; + uint8_t ih_transaction[2]; + uint8_t ih_sequence[2]; +}; + +struct isns_tlv { + uint8_t it_tag[4]; + uint8_t it_length[4]; + uint8_t it_value[]; +}; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 15:16:21 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DC8E689F; Sat, 25 Oct 2014 15:16:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C8CB2220; Sat, 25 Oct 2014 15:16:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PFGK18059263; Sat, 25 Oct 2014 15:16:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PFGKuN059261; Sat, 25 Oct 2014 15:16:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410251516.s9PFGKuN059261@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Oct 2014 15:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273638 - in head/sys: geom kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 15:16:21 -0000 Author: mav Date: Sat Oct 25 15:16:19 2014 New Revision: 273638 URL: https://svnweb.freebsd.org/changeset/base/273638 Log: Revert somewhat hackish geom_disk optimization, committed as part of r256880, and the following r273143 commit, supposed to workaround introduced issue by quite innocent-looking change. While there is no clear understanding why, but r273143 is accused in data corruption in some environments with high I/O load. I personally don't see any problem in that commit, and possibly it is just a trigger to some other bug somewhere, but better safe then sorry for now. Requested by: scottl@ MFC after: 3 days Modified: head/sys/geom/geom_disk.c head/sys/kern/vfs_bio.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Sat Oct 25 15:14:19 2014 (r273637) +++ head/sys/geom/geom_disk.c Sat Oct 25 15:16:19 2014 (r273638) @@ -235,25 +235,6 @@ g_disk_done(struct bio *bp) g_destroy_bio(bp); } -static void -g_disk_done_single(struct bio *bp) -{ - struct bintime now; - struct g_disk_softc *sc; - - bp->bio_completed = bp->bio_length - bp->bio_resid; - bp->bio_done = (void *)bp->bio_to; - bp->bio_to = LIST_FIRST(&bp->bio_disk->d_geom->provider); - if ((bp->bio_cmd & (BIO_READ|BIO_WRITE|BIO_DELETE|BIO_FLUSH)) != 0) { - binuptime(&now); - sc = bp->bio_to->private; - mtx_lock(&sc->done_mtx); - devstat_end_transaction_bio_bt(sc->dp->d_devstat, bp, &now); - mtx_unlock(&sc->done_mtx); - } - g_io_deliver(bp, bp->bio_error); -} - static int g_disk_ioctl(struct g_provider *pp, u_long cmd, void * data, int fflag, struct thread *td) { @@ -277,7 +258,7 @@ g_disk_start(struct bio *bp) struct disk *dp; struct g_disk_softc *sc; int error; - off_t d_maxsize, off; + off_t off; sc = bp->bio_to->private; if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) { @@ -294,20 +275,6 @@ g_disk_start(struct bio *bp) /* fall-through */ case BIO_READ: case BIO_WRITE: - d_maxsize = (bp->bio_cmd == BIO_DELETE) ? - dp->d_delmaxsize : dp->d_maxsize; - if (bp->bio_length <= d_maxsize) { - bp->bio_disk = dp; - bp->bio_to = (void *)bp->bio_done; - bp->bio_done = g_disk_done_single; - bp->bio_pblkno = bp->bio_offset / dp->d_sectorsize; - bp->bio_bcount = bp->bio_length; - mtx_lock(&sc->start_mtx); - devstat_start_transaction_bio(dp->d_devstat, bp); - mtx_unlock(&sc->start_mtx); - dp->d_strategy(bp); - break; - } off = 0; bp3 = NULL; bp2 = g_clone_bio(bp); @@ -316,6 +283,10 @@ g_disk_start(struct bio *bp) break; } do { + off_t d_maxsize; + + d_maxsize = (bp->bio_cmd == BIO_DELETE) ? + dp->d_delmaxsize : dp->d_maxsize; bp2->bio_offset += off; bp2->bio_length -= off; if ((bp->bio_flags & BIO_UNMAPPED) == 0) { @@ -415,13 +386,17 @@ g_disk_start(struct bio *bp) error = EOPNOTSUPP; break; } - bp->bio_disk = dp; - bp->bio_to = (void *)bp->bio_done; - bp->bio_done = g_disk_done_single; - mtx_lock(&sc->start_mtx); - devstat_start_transaction_bio(dp->d_devstat, bp); - mtx_unlock(&sc->start_mtx); - dp->d_strategy(bp); + bp2 = g_clone_bio(bp); + if (bp2 == NULL) { + g_io_deliver(bp, ENOMEM); + return; + } + bp2->bio_done = g_disk_done; + bp2->bio_disk = dp; + mtx_lock(&sc->start_mtx); + devstat_start_transaction_bio(dp->d_devstat, bp2); + mtx_unlock(&sc->start_mtx); + dp->d_strategy(bp2); break; default: error = EOPNOTSUPP; Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Sat Oct 25 15:14:19 2014 (r273637) +++ head/sys/kern/vfs_bio.c Sat Oct 25 15:16:19 2014 (r273638) @@ -3618,8 +3618,10 @@ biodone(struct bio *bp) bp->bio_flags |= BIO_DONE; wakeup(bp); mtx_unlock(mtxp); - } else + } else { + bp->bio_flags |= BIO_DONE; done(bp); + } } /* From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 16:34:29 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71FDE881; Sat, 25 Oct 2014 16:34:29 +0000 (UTC) Received: from st11p02mm-asmtp001.mac.com (st11p02mm-asmtp001.mac.com [17.172.220.236]) (using TLSv1 with cipher DES-CBC3-SHA (112/168 bits)) (Client CN "smtp.me.com", Issuer "VeriSign Class 3 Extended Validation SSL SGC CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 44081BA4; Sat, 25 Oct 2014 16:34:28 +0000 (UTC) Received: from fukuyama.hsd1.ca.comcast.net (unknown [73.162.13.215]) by st11p02mm-asmtp001.mac.com (Oracle Communications Messaging Server 7u4-27.10(7.0.4.27.9) 64bit (built Jun 6 2014)) with ESMTPSA id <0NE000MSPE17S780@st11p02mm-asmtp001.mac.com>; Sat, 25 Oct 2014 16:34:21 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52,1.0.28,0.0.0000 definitions=2014-10-25_03:2014-10-24,2014-10-25,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1410250174 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 8.0 \(1990.1\)) Subject: Re: svn commit: r273598 - in head: include sys/dev/acpica From: Rui Paulo In-reply-to: <20141025090000.GG1877@kib.kiev.ua> Date: Sat, 25 Oct 2014 09:34:18 -0700 Content-transfer-encoding: 7bit Message-id: <855B73E0-3073-407C-9A42-AEBE9B6744D6@me.com> References: <33decfcd-e77c-4e4c-8161-9f4a232213c6@me.com> <20141024194546.GE1877@kib.kiev.ua> <20141025090000.GG1877@kib.kiev.ua> To: Konstantin Belousov X-Mailer: Apple Mail (2.1990.1) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 16:34:29 -0000 On Oct 25, 2014, at 02:00, Konstantin Belousov wrote: > > Ok, I did looked at the pte of the HPET page. I get the value > 0x80000000fed00025 > which coincides with the resource address 0xfed00000 reported > by devinfo -vr for hpet (to double-check my findings). The low > bits indicate that PAT0 pat entry is used for the page caching > mode. Corresponding PAT MSR 0x277 has the following value: > sandy% sudo cpucontrol -m 0x277 /dev/cpuctl0 > MSR 0x277: 0x00010506 0x00070406 > i.e. memory type is 6, which is write-back, according to SDM. > This is wrong, as I feared. > > The patch below fixes the issue. The pte for HPET page is equal to > 0x80000000fed0003d > after the patch is applied, PAT3 is used, and its value is 0 == > UNCACHEABLE, as it must be. > > Do you agree with the patch ? Yes, thanks for working on this! -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 17:07:36 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8AFDA328; Sat, 25 Oct 2014 17:07:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BA7BE93; Sat, 25 Oct 2014 17:07:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PH7aca011623; Sat, 25 Oct 2014 17:07:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PH7aQG011622; Sat, 25 Oct 2014 17:07:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201410251707.s9PH7aQG011622@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Oct 2014 17:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273640 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 17:07:36 -0000 Author: mav Date: Sat Oct 25 17:07:35 2014 New Revision: 273640 URL: https://svnweb.freebsd.org/changeset/base/273640 Log: Add support for 12/16-byte EUI and 16-byte NAA IDs. MFC after: 1 week Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Sat Oct 25 15:32:56 2014 (r273639) +++ head/sys/cam/ctl/ctl.c Sat Oct 25 17:07:35 2014 (r273640) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -4349,6 +4350,36 @@ ctl_init_log_page_index(struct ctl_lun * return (CTL_RETVAL_COMPLETE); } +static int +hex2bin(const char *str, uint8_t *buf, int buf_size) +{ + int i; + u_char c; + + memset(buf, 0, buf_size); + while (isspace(str[0])) + str++; + if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) + str += 2; + buf_size *= 2; + for (i = 0; str[i] != 0 && i < buf_size; i++) { + c = str[i]; + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= 16) + break; + if ((i & 1) == 0) + buf[i / 2] |= (c << 4); + else + buf[i / 2] |= c; + } + return ((i + 1) / 2); +} + /* * LUN allocation. * @@ -4414,15 +4445,14 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft } eui = ctl_get_opt(&be_lun->options, "eui"); if (eui != NULL) { - len += sizeof(struct scsi_vpd_id_descriptor) + 8; + len += sizeof(struct scsi_vpd_id_descriptor) + 16; } naa = ctl_get_opt(&be_lun->options, "naa"); if (naa != NULL) { - len += sizeof(struct scsi_vpd_id_descriptor) + 8; + len += sizeof(struct scsi_vpd_id_descriptor) + 16; } lun->lun_devid = malloc(sizeof(struct ctl_devid) + len, M_CTL, M_WAITOK | M_ZERO); - lun->lun_devid->len = len; desc = (struct scsi_vpd_id_descriptor *)lun->lun_devid->data; desc->proto_codeset = SVPD_ID_CODESET_ASCII; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_T10; @@ -4452,8 +4482,10 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->proto_codeset = SVPD_ID_CODESET_BINARY; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_EUI64; - desc->length = 8; - scsi_u64to8b(strtouq(eui, NULL, 0), desc->identifier); + desc->length = hex2bin(eui, desc->identifier, 16); + desc->length = desc->length > 12 ? 16 : + (desc->length > 8 ? 12 : 8); + len -= 16 - desc->length; } if (naa != NULL) { desc = (struct scsi_vpd_id_descriptor *)(&desc->identifier[0] + @@ -4461,9 +4493,11 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft desc->proto_codeset = SVPD_ID_CODESET_BINARY; desc->id_type = SVPD_ID_PIV | SVPD_ID_ASSOC_LUN | SVPD_ID_TYPE_NAA; - desc->length = 8; - scsi_u64to8b(strtouq(naa, NULL, 0), desc->identifier); + desc->length = hex2bin(naa, desc->identifier, 16); + desc->length = desc->length > 8 ? 16 : 8; + len -= 16 - desc->length; } + lun->lun_devid->len = len; mtx_lock(&ctl_softc->ctl_lock); /* From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 17:42:46 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 564376C7; Sat, 25 Oct 2014 17:42:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 36C1B21B; Sat, 25 Oct 2014 17:42:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PHgkiR029491; Sat, 25 Oct 2014 17:42:46 GMT (envelope-from jpaetzel@FreeBSD.org) Received: (from jpaetzel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PHgjwf029487; Sat, 25 Oct 2014 17:42:45 GMT (envelope-from jpaetzel@FreeBSD.org) Message-Id: <201410251742.s9PHgjwf029487@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jpaetzel set sender to jpaetzel@FreeBSD.org using -f From: Josh Paetzel Date: Sat, 25 Oct 2014 17:42:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273641 - in head/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/fs contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 17:42:46 -0000 Author: jpaetzel Date: Sat Oct 25 17:42:44 2014 New Revision: 273641 URL: https://svnweb.freebsd.org/changeset/base/273641 Log: This change addresses 4 bugs in ZFS exposed by Richard Kojedzinszky's crash.sh script attached to FreeNAS bug 4109: https://bugs.freenas.org/issues/4109 Three are in the snapshot layer: a) AVG explains in his notes: https://wiki.freebsd.org/AvgVfsSolarisVsFreeBSD "VOP_INACTIVE must not do any destructive actions to a vnode and its filesystem node, nor invalidate them in any way." gfs_vop_inactive and zfsctl_snapshot_inactive did just that. In OpenSolaris VOP_INACTIVE is much closer to FreeBSD's VOP_RECLAIM. Rename & move them to gfs_vop_reclaim and zfsctl_snapshot_reclaim and merge in the requisite vnode_destroy from zfsctl_common_reclaim. b) gfs_lookup_dot and various zfsctl functions do not honor the FreeBSD VFS convention of only locking from the root downward. When looking up ".." the convention is to drop the current leaf vnode lock before acquiring the directory vnode and then subsequently re-acquiring the lock on the leaf vnode. This fixes that in all the places that our exercised by crash.sh. c) The snapshot may already be unmounted when the directory vnode is reclaimed. Check for this case and return. One in the common layer: d) Callers of traverse expect the reference to the vnode passed in to be maintained. Don't release it. This last one may be an unclear contract. There may in fact be some callers that do expect the reference to be dropped on success in addition to callers that expect it to be released. In this case a further audit of the callers is needed and a consensus on the correct behavior. PR: 184677 Submitted by: kmacy Reviewed by: delphij, will, avg MFC after: 2 weeks Sponsored by: iXsystems Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c Sat Oct 25 17:42:44 2014 (r273641) @@ -91,11 +91,11 @@ traverse(vnode_t **cvpp, int lktype) error = vfs_busy(vfsp, 0); /* * tvp is NULL for *cvpp vnode, which we can't unlock. + * At least some callers expect the reference to be + * maintained to the original *cvpp */ if (tvp != NULL) vput(cvp); - else - vrele(cvp); if (error) return (error); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c Sat Oct 25 17:42:44 2014 (r273641) @@ -90,7 +90,7 @@ * gfs_dir_lookup() * gfs_dir_readdir() * - * gfs_vop_inactive() + * gfs_vop_reclaim() * gfs_vop_lookup() * gfs_vop_readdir() * gfs_vop_map() @@ -435,6 +435,8 @@ gfs_readdir_fini(gfs_readdir_state_t *st int gfs_lookup_dot(vnode_t **vpp, vnode_t *dvp, vnode_t *pvp, const char *nm) { + int ltype; + if (*nm == '\0' || strcmp(nm, ".") == 0) { VN_HOLD(dvp); *vpp = dvp; @@ -444,11 +446,15 @@ gfs_lookup_dot(vnode_t **vpp, vnode_t *d ASSERT(dvp->v_flag & VROOT); VN_HOLD(dvp); *vpp = dvp; + ASSERT_VOP_ELOCKED(dvp, "gfs_lookup_dot: non-locked dvp"); } else { + ltype = VOP_ISLOCKED(dvp); + VOP_UNLOCK(dvp, 0); VN_HOLD(pvp); *vpp = pvp; + vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(dvp, ltype | LK_RETRY); } - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); return (0); } @@ -618,7 +624,7 @@ gfs_root_create_file(size_t size, vfs_t /* * gfs_file_inactive() * - * Called from the VOP_INACTIVE() routine. If necessary, this routine will + * Called from the VOP_RECLAIM() routine. If necessary, this routine will * remove the given vnode from the parent directory and clean up any references * in the VFS layer. * @@ -1215,15 +1221,15 @@ gfs_vop_map(vnode_t *vp, offset_t off, s #endif /* sun */ /* - * gfs_vop_inactive: VOP_INACTIVE() entry point + * gfs_vop_reclaim: VOP_RECLAIM() entry point (solaris' VOP_INACTIVE()) * * Given a vnode that is a GFS file or directory, call gfs_file_inactive() or * gfs_dir_inactive() as necessary, and kmem_free()s associated private data. */ /* ARGSUSED */ int -gfs_vop_inactive(ap) - struct vop_inactive_args /* { +gfs_vop_reclaim(ap) + struct vop_reclaim_args /* { struct vnode *a_vp; struct thread *a_td; } */ *ap; @@ -1236,6 +1242,7 @@ gfs_vop_inactive(ap) else gfs_file_inactive(vp); + vnode_destroy_vobject(vp); VI_LOCK(vp); vp->v_data = NULL; VI_UNLOCK(vp); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Sat Oct 25 17:42:44 2014 (r273641) @@ -603,16 +603,27 @@ zfsctl_freebsd_root_lookup(ap) int nameiop = ap->a_cnp->cn_nameiop; char nm[NAME_MAX + 1]; int err; + int ltype; if ((flags & ISLASTCN) && (nameiop == RENAME || nameiop == CREATE)) return (EOPNOTSUPP); ASSERT(ap->a_cnp->cn_namelen < sizeof(nm)); strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1); - err = zfsctl_root_lookup(dvp, nm, vpp, NULL, 0, NULL, cr, NULL, NULL, NULL); - if (err == 0 && (nm[0] != '.' || nm[1] != '\0')) + if (err == 0 && (nm[0] != '.' || nm[1] != '\0')) { + ltype = VOP_ISLOCKED(dvp); + if (flags & ISDOTDOT) { + VN_HOLD(*vpp); + VOP_UNLOCK(dvp, 0); + } vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + if (flags & ISDOTDOT) { + VN_RELE(*vpp); + vn_lock(dvp, ltype| LK_RETRY); + } + } + return (err); } @@ -625,8 +636,8 @@ static struct vop_vector zfsctl_ops_root .vop_access = zfsctl_common_access, .vop_readdir = gfs_vop_readdir, .vop_lookup = zfsctl_freebsd_root_lookup, - .vop_inactive = gfs_vop_inactive, - .vop_reclaim = zfsctl_common_reclaim, + .vop_inactive = VOP_NULL, + .vop_reclaim = gfs_vop_reclaim, #ifdef TODO .vop_pathconf = zfsctl_pathconf, #endif @@ -679,7 +690,7 @@ zfsctl_unmount_snap(zfs_snapentry_t *sep * the sd_lock mutex held by our caller. */ ASSERT(svp->v_count == 1); - gfs_vop_inactive(svp, cr, NULL); + gfs_vop_reclaim(svp, cr, NULL); kmem_free(sep->se_name, strlen(sep->se_name) + 1); kmem_free(sep, sizeof (zfs_snapentry_t)); @@ -949,7 +960,7 @@ zfsctl_snapdir_lookup(ap) avl_index_t where; zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data; int err; - int flags = 0; + int ltype, flags = 0; /* * No extended attributes allowed under .zfs @@ -973,7 +984,6 @@ zfsctl_snapdir_lookup(ap) return (SET_ERROR(ENOENT)); ZFS_ENTER(zfsvfs); - if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) { ZFS_EXIT(zfsvfs); return (0); @@ -1420,8 +1430,8 @@ static struct vop_vector zfsctl_ops_shar .vop_access = zfsctl_common_access, .vop_readdir = zfsctl_shares_readdir, .vop_lookup = zfsctl_shares_lookup, - .vop_inactive = gfs_vop_inactive, - .vop_reclaim = zfsctl_common_reclaim, + .vop_inactive = VOP_NULL, + .vop_reclaim = gfs_vop_reclaim, .vop_fid = zfsctl_shares_fid, }; #endif /* !sun */ @@ -1449,8 +1459,9 @@ zfsctl_snapshot_mknode(vnode_t *pvp, uin return (vp); } + static int -zfsctl_snapshot_inactive(ap) +zfsctl_snapshot_reclaim(ap) struct vop_inactive_args /* { struct vnode *a_vp; struct thread *a_td; @@ -1458,19 +1469,20 @@ zfsctl_snapshot_inactive(ap) { vnode_t *vp = ap->a_vp; cred_t *cr = ap->a_td->td_ucred; - struct vop_inactive_args iap; + struct vop_reclaim_args iap; zfsctl_snapdir_t *sdp; zfs_snapentry_t *sep, *next; int locked; vnode_t *dvp; - if (vp->v_count > 0) - goto end; - VERIFY(gfs_dir_lookup(vp, "..", &dvp, cr, 0, NULL, NULL) == 0); sdp = dvp->v_data; VOP_UNLOCK(dvp, 0); - + /* this may already have been unmounted */ + if (sdp == NULL) { + VN_RELE(dvp); + return (0); + } if (!(locked = MUTEX_HELD(&sdp->sd_lock))) mutex_enter(&sdp->sd_lock); @@ -1494,7 +1506,6 @@ zfsctl_snapshot_inactive(ap) mutex_exit(&sdp->sd_lock); VN_RELE(dvp); -end: /* * Dispose of the vnode for the snapshot mount point. * This is safe to do because once this entry has been removed @@ -1503,7 +1514,9 @@ end: * creating a new vnode. */ iap.a_vp = vp; - return (gfs_vop_inactive(&iap)); + gfs_vop_reclaim(&iap); + return (0); + } static int @@ -1587,8 +1600,15 @@ zfsctl_snapshot_lookup(ap) error = zfsctl_root_lookup(zfsvfs->z_ctldir, "snapshot", vpp, NULL, 0, NULL, cr, NULL, NULL, NULL); - if (error == 0) + if (error == 0) { + int ltype = VOP_ISLOCKED(dvp); + VN_HOLD(*vpp); + VOP_UNLOCK(dvp, 0); vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + VN_RELE(*vpp); + vn_lock(dvp, ltype | LK_RETRY); + } + return (error); } @@ -1640,9 +1660,9 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc */ static struct vop_vector zfsctl_ops_snapshot = { .vop_default = &default_vnodeops, - .vop_inactive = zfsctl_snapshot_inactive, + .vop_inactive = VOP_NULL, .vop_lookup = zfsctl_snapshot_lookup, - .vop_reclaim = zfsctl_common_reclaim, + .vop_reclaim = zfsctl_snapshot_reclaim, .vop_getattr = zfsctl_snapshot_getattr, .vop_fid = zfsctl_snapshot_fid, .vop_vptocnp = zfsctl_snapshot_vptocnp, Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Sat Oct 25 17:07:35 2014 (r273640) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h Sat Oct 25 17:42:44 2014 (r273641) @@ -149,7 +149,7 @@ extern int gfs_get_parent_ino(vnode_t *, extern int gfs_lookup_dot(vnode_t **, vnode_t *, vnode_t *, const char *); extern int gfs_vop_readdir(struct vop_readdir_args *); -extern int gfs_vop_inactive(struct vop_inactive_args *); +extern int gfs_vop_reclaim(struct vop_reclaim_args *); #ifdef __cplusplus From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 19:31:35 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 551B1FB0; Sat, 25 Oct 2014 19:31:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 282ACE54; Sat, 25 Oct 2014 19:31:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PJVZWf080555; Sat, 25 Oct 2014 19:31:35 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PJVYIk080552; Sat, 25 Oct 2014 19:31:34 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410251931.s9PJVYIk080552@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 25 Oct 2014 19:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273644 - head/share/man/man3 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 19:31:35 -0000 Author: jhb Date: Sat Oct 25 19:31:34 2014 New Revision: 273644 URL: https://svnweb.freebsd.org/changeset/base/273644 Log: Clarify that pthread_cleanup_push()/pop() are implemented as macros that create a new code block and thus must be balanced at the same lexical scope. (This is also a requirement in POSIX.) PR: 194280 Submitted by: dr2867.business@pacbell.net MFC after: 1 week Modified: head/share/man/man3/pthread_cleanup_pop.3 head/share/man/man3/pthread_cleanup_push.3 Modified: head/share/man/man3/pthread_cleanup_pop.3 ============================================================================== --- head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:01:02 2014 (r273643) +++ head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:31:34 2014 (r273644) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 1998 +.Dd October 25, 2014 .Dt PTHREAD_CLEANUP_POP 3 .Os .Sh NAME @@ -50,6 +50,14 @@ If there is no cleanup routine then .Fn pthread_cleanup_pop does nothing. +.Pp +The +.Fn pthread_cleanup_push +function is implemented as a macro that closes a block. +Invocations of this function must appear as standalone statements that are +paired with an earlier call of +.Xr pthread_cleanup_push 3 +in the same lexical scope. .Sh RETURN VALUES The .Fn pthread_cleanup_pop Modified: head/share/man/man3/pthread_cleanup_push.3 ============================================================================== --- head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:01:02 2014 (r273643) +++ head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:31:34 2014 (r273644) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 30, 1998 +.Dd October 25, 2014 .Dt PTHREAD_CLEANUP_PUSH 3 .Os .Sh NAME @@ -52,6 +52,14 @@ When is called, it is passed .Fa arg as its only argument. +.Pp +The +.Fn pthread_cleanup_push +function is implemented as a macro that opens a new block. +Invocations of this function must appear as standalone statements that are +paired with a later call of +.Xr pthread_cleanup_pop 3 +in the same lexical scope. .Sh RETURN VALUES The .Fn pthread_cleanup_push From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 19:36:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2D532216; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 063CAF0E; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 55BEBB926; Sat, 25 Oct 2014 15:36:41 -0400 (EDT) From: John Baldwin To: Andrey Chernov Subject: Re: svn commit: r273601 - head/lib/libc/gen Date: Sat, 25 Oct 2014 15:28:22 -0400 Message-ID: <94327674.WeLfOcjE9r@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <544B1C34.1020204@freebsd.org> References: <201410241955.s9OJtnbm014234@svn.freebsd.org> <544B0930.8010004@freebsd.org> <544B1C34.1020204@freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 25 Oct 2014 15:36:41 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 19:36:43 -0000 On Saturday, October 25, 2014 07:42:44 AM Andrey Chernov wrote: > On 25.10.2014 6:21, Andrey Chernov wrote: > > On 24.10.2014 23:55, John Baldwin wrote: > >> Author: jhb > >> Date: Fri Oct 24 19:55:49 2014 > >> New Revision: 273601 > >> URL: https://svnweb.freebsd.org/changeset/base/273601 > >> > >> Log: > >> Don't reference sem(4) from the POSIX semaphore pages. POSIX > >> semaphores > >> were reimplemented using umtx in FreeBSD 9 and no longer use sem(4). > > > > sem kernel module referenced in sem(4) uses the same uipc_sem.c file as > > kernel's P1003_1B_SEMAPHORES option, so they both use the same code and > > better be cross-linked since sem(4) explains how to turn it on. > > From the first glance I can't determine, is libc implementation better > than kernel one or not. BTW, firefox port still recommends sem_load="YES" The sem_init/open/unlike/destroy/post/*wait() API used to use sem(4) (which is sem.ko and the kernel option) from FreeBSD 5 up through FreeBSD 8. These functions have used umtx_op() instead of sem(4) since FreeBSD 9.0. Note that libc/gen/sem_new.c does not call ksem_*. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 19:36:43 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3A987219; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13C0DF0F; Sat, 25 Oct 2014 19:36:43 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E6922B98A; Sat, 25 Oct 2014 15:36:41 -0400 (EDT) From: John Baldwin To: Xin LI Subject: Re: svn commit: r273616 - head/sys/kern Date: Sat, 25 Oct 2014 15:25:07 -0400 Message-ID: <4239953.NCThceJcDS@ralph.baldwin.cx> User-Agent: KMail/4.12.5 (FreeBSD/10.1-BETA2; KDE/4.12.5; amd64; ; ) In-Reply-To: <201410250016.s9P0Gaq4038542@svn.freebsd.org> References: <201410250016.s9P0Gaq4038542@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 25 Oct 2014 15:36:42 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 19:36:43 -0000 On Saturday, October 25, 2014 12:16:36 AM Xin LI wrote: > Author: delphij > Date: Sat Oct 25 00:16:36 2014 > New Revision: 273616 > URL: https://svnweb.freebsd.org/changeset/base/273616 > > Log: > Fix build. Thanks, I had this fixed in the tree I used for testing but it didn't get committed into my test branch. :( -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 20:11:38 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68FE5AB8; Sat, 25 Oct 2014 20:11:38 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B017331; Sat, 25 Oct 2014 20:11:38 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Xi7gX-000AKH-3H; Sat, 25 Oct 2014 20:11:37 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id s9PKBaIx072808; Sat, 25 Oct 2014 14:11:36 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+7zj/cN6prOY2+ZU8JLbpr X-Authentication-Warning: paranoia.hippie.lan: Host revolution.hippie.lan [172.22.42.240] claimed to be [172.22.42.240] Subject: Re: svn commit: r273644 - head/share/man/man3 From: Ian Lepore To: John Baldwin In-Reply-To: <201410251931.s9PJVYIk080552@svn.freebsd.org> References: <201410251931.s9PJVYIk080552@svn.freebsd.org> Content-Type: text/plain; charset="us-ascii" Date: Sat, 25 Oct 2014 14:11:36 -0600 Message-ID: <1414267896.12052.652.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 20:11:38 -0000 On Sat, 2014-10-25 at 19:31 +0000, John Baldwin wrote: > Author: jhb > Date: Sat Oct 25 19:31:34 2014 > New Revision: 273644 > URL: https://svnweb.freebsd.org/changeset/base/273644 > > Log: > Clarify that pthread_cleanup_push()/pop() are implemented as macros that > create a new code block and thus must be balanced at the same lexical > scope. (This is also a requirement in POSIX.) > > PR: 194280 > Submitted by: dr2867.business@pacbell.net > MFC after: 1 week > > Modified: > head/share/man/man3/pthread_cleanup_pop.3 > head/share/man/man3/pthread_cleanup_push.3 > > Modified: head/share/man/man3/pthread_cleanup_pop.3 > ============================================================================== > --- head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:01:02 2014 (r273643) > +++ head/share/man/man3/pthread_cleanup_pop.3 Sat Oct 25 19:31:34 2014 (r273644) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 30, 1998 > +.Dd October 25, 2014 > .Dt PTHREAD_CLEANUP_POP 3 > .Os > .Sh NAME > @@ -50,6 +50,14 @@ If there is no cleanup routine > then > .Fn pthread_cleanup_pop > does nothing. > +.Pp > +The > +.Fn pthread_cleanup_push Should be pop? -- Ian > +function is implemented as a macro that closes a block. > +Invocations of this function must appear as standalone statements that are > +paired with an earlier call of > +.Xr pthread_cleanup_push 3 > +in the same lexical scope. > .Sh RETURN VALUES > The > .Fn pthread_cleanup_pop > > Modified: head/share/man/man3/pthread_cleanup_push.3 > ============================================================================== > --- head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:01:02 2014 (r273643) > +++ head/share/man/man3/pthread_cleanup_push.3 Sat Oct 25 19:31:34 2014 (r273644) > @@ -27,7 +27,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 30, 1998 > +.Dd October 25, 2014 > .Dt PTHREAD_CLEANUP_PUSH 3 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ When > is called, it is passed > .Fa arg > as its only argument. > +.Pp > +The > +.Fn pthread_cleanup_push > +function is implemented as a macro that opens a new block. > +Invocations of this function must appear as standalone statements that are > +paired with a later call of > +.Xr pthread_cleanup_pop 3 > +in the same lexical scope. > .Sh RETURN VALUES > The > .Fn pthread_cleanup_push > From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 20:42:48 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 822F0594; Sat, 25 Oct 2014 20:42:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F13B888; Sat, 25 Oct 2014 20:42:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PKgmKJ013213; Sat, 25 Oct 2014 20:42:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PKgm8h013212; Sat, 25 Oct 2014 20:42:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201410252042.s9PKgm8h013212@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 25 Oct 2014 20:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273646 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 20:42:48 -0000 Author: jhb Date: Sat Oct 25 20:42:47 2014 New Revision: 273646 URL: https://svnweb.freebsd.org/changeset/base/273646 Log: Use correct type in __DEVOLATILE(). Modified: head/sys/kern/kern_umtx.c Modified: head/sys/kern/kern_umtx.c ============================================================================== --- head/sys/kern/kern_umtx.c Sat Oct 25 20:34:10 2014 (r273645) +++ head/sys/kern/kern_umtx.c Sat Oct 25 20:42:47 2014 (r273646) @@ -2895,7 +2895,8 @@ do_sem2_wake(struct thread *td, struct _ */ if (cnt == 1) { umtxq_unlock(&key); - count = fuword32(__DEVOLATILE(void *, &sem->_count)); + count = fuword32(__DEVOLATILE(uint32_t *, + &sem->_count)); while (count != -1 && count & USEM_HAS_WAITERS) count = casuword32(&sem->_count, count, count & ~USEM_HAS_WAITERS); From owner-svn-src-head@FreeBSD.ORG Sat Oct 25 21:01:51 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84D46C7E; Sat, 25 Oct 2014 21:01:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 713D6A43; Sat, 25 Oct 2014 21:01:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s9PL1pGl022007; Sat, 25 Oct 2014 21:01:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s9PL1pnm022006; Sat, 25 Oct 2014 21:01:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201410252101.s9PL1pnm022006@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 25 Oct 2014 21:01:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r273647 - head/sys/dev/acpica X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2014 21:01:51 -0000 Author: kib Date: Sat Oct 25 21:01:50 2014 New Revision: 273647 URL: https://svnweb.freebsd.org/changeset/base/273647 Log: Set the caching mode for the usermode mapping of the HPET registers page to uncached. Reviewed by: rpaulo Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/dev/acpica/acpi_hpet.c Modified: head/sys/dev/acpica/acpi_hpet.c ============================================================================== --- head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 20:42:47 2014 (r273646) +++ head/sys/dev/acpica/acpi_hpet.c Sat Oct 25 21:01:50 2014 (r273647) @@ -356,6 +356,7 @@ hpet_mmap(struct cdev *cdev, vm_ooffset_ if (!sc->mmap_allow_write && (nprot & PROT_WRITE)) return (EPERM); *paddr = rman_get_start(sc->mem_res) + offset; + *memattr = VM_MEMATTR_UNCACHEABLE; return (0); }