svn commit: r263794 - head/sys/x86/acpica

2014-03-27 Thread Takanori Watanabe
Author: takawata
Date: Thu Mar 27 06:08:07 2014
New Revision: 263794
URL: http://svnweb.freebsd.org/changeset/base/263794

Log:
  To check polarity, check ACPI_MADT_POLARITY_CONFORMS, instead of 
ACPI_MADT_TRIGGER_CONFORMS.
  
  PR:amd64/188010
  Submitted by: syuu

Modified:
  head/sys/x86/acpica/madt.c

Modified: head/sys/x86/acpica/madt.c
==
--- head/sys/x86/acpica/madt.c  Thu Mar 27 04:30:07 2014(r263793)
+++ head/sys/x86/acpica/madt.c  Thu Mar 27 06:08:07 2014(r263794)
@@ -492,7 +492,7 @@ madt_parse_nmi(ACPI_MADT_NMI_SOURCE *nmi
if (!(nmi-IntiFlags  ACPI_MADT_TRIGGER_CONFORMS))
ioapic_set_triggermode(ioapic, pin,
interrupt_trigger(nmi-IntiFlags, 0));
-   if (!(nmi-IntiFlags  ACPI_MADT_TRIGGER_CONFORMS))
+   if (!(nmi-IntiFlags  ACPI_MADT_POLARITY_CONFORMS))
ioapic_set_polarity(ioapic, pin,
interrupt_polarity(nmi-IntiFlags, 0));
 }
___
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-unsubscr...@freebsd.org


svn commit: r263795 - head/sys/x86/acpica

2014-03-27 Thread Takanori Watanabe
Author: takawata
Date: Thu Mar 27 06:36:38 2014
New Revision: 263795
URL: http://svnweb.freebsd.org/changeset/base/263795

Log:
  Strict value checking will cause problem.
  Bay trail DN2820FYKH is supported on Linux but does not work on FreeBSD.
  This behaviour is bug-compatible with Linux-3.13.5.
  
  References:
  http://d.hatena.ne.jp/syuu1228/20140326
  http://lxr.linux.no/linux+v3.13.5/arch/x86/kernel/acpi/boot.c#L1094
  
  Submitted by: syuu

Modified:
  head/sys/x86/acpica/madt.c

Modified: head/sys/x86/acpica/madt.c
==
--- head/sys/x86/acpica/madt.c  Thu Mar 27 06:08:07 2014(r263794)
+++ head/sys/x86/acpica/madt.c  Thu Mar 27 06:36:38 2014(r263795)
@@ -306,10 +306,11 @@ interrupt_polarity(UINT16 IntiFlags, UIN
case ACPI_MADT_POLARITY_ACTIVE_HIGH:
return (INTR_POLARITY_HIGH);
case ACPI_MADT_POLARITY_ACTIVE_LOW:
-   return (INTR_POLARITY_LOW);
+   break;
default:
-   panic(Bogus Interrupt Polarity);
+   printf(WARNING: Bogus Interrupt Polarity. Assume POLALITY 
LOW);
}
+   return (INTR_POLARITY_LOW);
 }
 
 static enum intr_trigger
@@ -325,10 +326,13 @@ interrupt_trigger(UINT16 IntiFlags, UINT
case ACPI_MADT_TRIGGER_EDGE:
return (INTR_TRIGGER_EDGE);
case ACPI_MADT_TRIGGER_LEVEL:
-   return (INTR_TRIGGER_LEVEL);
+   break;
default:
-   panic(Bogus Interrupt Trigger Mode);
+   printf(WARNING: Bogus Interrupt Trigger Mode. Assume Level 
trigger.);
+   
+   break;
}
+   return (INTR_TRIGGER_LEVEL);
 }
 
 /*
___
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-unsubscr...@freebsd.org


svn commit: r263796 - stable/10/share/man/man4

2014-03-27 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 27 06:55:26 2014
New Revision: 263796
URL: http://svnweb.freebsd.org/changeset/base/263796

Log:
  MFC r263291 and r263292:
  Update USB template manual page.

Added:
  stable/10/share/man/man4/usb_template.4
 - copied unchanged from r263292, head/share/man/man4/usb_template.4
Deleted:
  stable/10/share/man/man4/usb2_template.4
Modified:
  stable/10/share/man/man4/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/Makefile
==
--- stable/10/share/man/man4/Makefile   Thu Mar 27 06:36:38 2014
(r263795)
+++ stable/10/share/man/man4/Makefile   Thu Mar 27 06:55:26 2014
(r263796)
@@ -534,6 +534,7 @@ MAN=aac.4 \
${_urtw.4} \
urtwn.4 \
usb.4 \
+   usb_template.4 \
usb_quirk.4 \
uslcom.4 \
utopia.4 \

Copied: stable/10/share/man/man4/usb_template.4 (from r263292, 
head/share/man/man4/usb_template.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/10/share/man/man4/usb_template.4 Thu Mar 27 06:55:26 2014
(r263796, copy of r263292, head/share/man/man4/usb_template.4)
@@ -0,0 +1,83 @@
+.\ $FreeBSD$
+.\
+.\ Copyright (c) 2008 Hans Petter Selasky. 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.
+.\
+.Dd March 18, 2014
+.Dt USB_TEMPLATE 4
+.Os
+.
+.Sh NAME
+.
+.
+.Nm usb_template
+.
+.Nd USB templates
+.
+.
+.Sh SYNOPSIS
+To compile this module into the kernel, place the following line in
+your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device usb_template
+.Ed
+.Pp
+To load the module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+usb_template_load=YES
+.Ed
+.
+.Sh DESCRIPTION
+The
+.Nm
+module implements various USB templates that are needed when
+programming an USB device side driver.
+.
+A USB template consists of an USB device descriptor, one or more USB
+configuration descriptors, one or more USB interface descriptors, one
+or more USB endpoint descriptors, USB strings and additional USB
+descriptors.
+.
+The USB template module currently has templates for USB Mass Storage,
+USB CDC Ethernet and Message Transfer Protocol.
+.
+USB templates are currently selected using the hw.usb.template
+sysctl.
+.
+The hw.usb.template value can be changed at any time, but will not
+have any effect until the USB device has been re-enumerated.
+.
+.
+.
+.Sh SEE ALSO
+.Xr usb 4
+.Sh STANDARDS
+The
+.Nm
+module complies to the USB 1.0, 2.0 and 3.0 standard.
+.Sh HISTORY
+The
+.Nm
+module was written by
+.An Hans Petter Selasky Aq hsela...@freebsd.org .
___
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-unsubscr...@freebsd.org


svn commit: r263798 - stable/9/share/man/man4

2014-03-27 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 27 06:57:32 2014
New Revision: 263798
URL: http://svnweb.freebsd.org/changeset/base/263798

Log:
  MFC r263291 and r263292:
  Update USB template manual page.

Added:
  stable/9/share/man/man4/usb_template.4
 - copied unchanged from r263292, head/share/man/man4/usb_template.4
Deleted:
  stable/9/share/man/man4/usb2_template.4
Modified:
  stable/9/share/man/man4/Makefile
Directory Properties:
  stable/9/share/   (props changed)
  stable/9/share/man/   (props changed)
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/Makefile
==
--- stable/9/share/man/man4/MakefileThu Mar 27 06:56:11 2014
(r263797)
+++ stable/9/share/man/man4/MakefileThu Mar 27 06:57:32 2014
(r263798)
@@ -509,6 +509,7 @@ MAN=aac.4 \
urndis.4 \
${_urtw.4} \
usb.4 \
+   usb_template.4 \
usb_quirk.4 \
uslcom.4 \
utopia.4 \

Copied: stable/9/share/man/man4/usb_template.4 (from r263292, 
head/share/man/man4/usb_template.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/share/man/man4/usb_template.4  Thu Mar 27 06:57:32 2014
(r263798, copy of r263292, head/share/man/man4/usb_template.4)
@@ -0,0 +1,83 @@
+.\ $FreeBSD$
+.\
+.\ Copyright (c) 2008 Hans Petter Selasky. 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.
+.\
+.Dd March 18, 2014
+.Dt USB_TEMPLATE 4
+.Os
+.
+.Sh NAME
+.
+.
+.Nm usb_template
+.
+.Nd USB templates
+.
+.
+.Sh SYNOPSIS
+To compile this module into the kernel, place the following line in
+your kernel configuration file:
+.Bd -ragged -offset indent
+.Cd device usb_template
+.Ed
+.Pp
+To load the module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+usb_template_load=YES
+.Ed
+.
+.Sh DESCRIPTION
+The
+.Nm
+module implements various USB templates that are needed when
+programming an USB device side driver.
+.
+A USB template consists of an USB device descriptor, one or more USB
+configuration descriptors, one or more USB interface descriptors, one
+or more USB endpoint descriptors, USB strings and additional USB
+descriptors.
+.
+The USB template module currently has templates for USB Mass Storage,
+USB CDC Ethernet and Message Transfer Protocol.
+.
+USB templates are currently selected using the hw.usb.template
+sysctl.
+.
+The hw.usb.template value can be changed at any time, but will not
+have any effect until the USB device has been re-enumerated.
+.
+.
+.
+.Sh SEE ALSO
+.Xr usb 4
+.Sh STANDARDS
+The
+.Nm
+module complies to the USB 1.0, 2.0 and 3.0 standard.
+.Sh HISTORY
+The
+.Nm
+module was written by
+.An Hans Petter Selasky Aq hsela...@freebsd.org .
___
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-unsubscr...@freebsd.org


svn commit: r263799 - stable/10/sys/dev/usb

2014-03-27 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 27 06:59:56 2014
New Revision: 263799
URL: http://svnweb.freebsd.org/changeset/base/263799

Log:
  MFC r263423:
  Try to resolve a possible deadlock when detaching USB devices which
  create character devices. The deadlock can happen if an application is
  issuing IOCTLs which require USB refcounting, at the same time the USB
  device is detaching.
  
  There is already a counter in place in the USB device structure to
  detect this situation, but it was not always checked ahead of invoking
  functions that might destroy character devices, like detach, set
  configuration, set alternate interface or detach active kernel driver.

Modified:
  stable/10/sys/dev/usb/usb_dev.c
  stable/10/sys/dev/usb/usb_device.c
  stable/10/sys/dev/usb/usb_process.c
  stable/10/sys/dev/usb/usb_process.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_dev.c
==
--- stable/10/sys/dev/usb/usb_dev.c Thu Mar 27 06:57:32 2014
(r263798)
+++ stable/10/sys/dev/usb/usb_dev.c Thu Mar 27 06:59:56 2014
(r263799)
@@ -214,12 +214,13 @@ usb_ref_device(struct usb_cdev_privdata 
DPRINTFN(2, device is detached\n);
goto error;
}
-   if (cpd-udev-refcount == USB_DEV_REF_MAX) {
-   DPRINTFN(2, no dev ref\n);
-   goto error;
-   }
if (need_uref) {
DPRINTFN(2, ref udev - needed\n);
+
+   if (cpd-udev-refcount == USB_DEV_REF_MAX) {
+   DPRINTFN(2, no dev ref\n);
+   goto error;
+   }
cpd-udev-refcount++;
 
mtx_unlock(usb_ref_lock);
@@ -293,9 +294,8 @@ error:
usbd_enum_unlock(cpd-udev);
 
if (crd-is_uref) {
-   if (--(cpd-udev-refcount) == 0) {
-   cv_signal(cpd-udev-ref_cv);
-   }
+   cpd-udev-refcount--;
+   cv_broadcast(cpd-udev-ref_cv);
}
mtx_unlock(usb_ref_lock);
DPRINTFN(2, fail\n);
@@ -361,10 +361,9 @@ usb_unref_device(struct usb_cdev_privdat
crd-is_write = 0;
}
if (crd-is_uref) {
-   if (--(cpd-udev-refcount) == 0) {
-   cv_signal(cpd-udev-ref_cv);
-   }
crd-is_uref = 0;
+   cpd-udev-refcount--;
+   cv_broadcast(cpd-udev-ref_cv);
}
mtx_unlock(usb_ref_lock);
 }

Modified: stable/10/sys/dev/usb/usb_device.c
==
--- stable/10/sys/dev/usb/usb_device.c  Thu Mar 27 06:57:32 2014
(r263798)
+++ stable/10/sys/dev/usb/usb_device.c  Thu Mar 27 06:59:56 2014
(r263799)
@@ -452,6 +452,65 @@ usb_endpoint_foreach(struct usb_device *
 }
 
 /**
+ * usb_wait_pending_ref_locked
+ *
+ * This function will wait for any USB references to go away before
+ * returning and disable further USB device refcounting on the
+ * specified USB device. This function is used when detaching a USB
+ * device.
+ **/
+static void
+usb_wait_pending_ref_locked(struct usb_device *udev)
+{
+#if USB_HAVE_UGEN
+   const uint16_t refcount =
+   usb_proc_is_called_from(
+   USB_BUS_EXPLORE_PROC(udev-bus)) ? 1 : 2;
+
+   DPRINTF(Refcount = %d\n, (int)refcount); 
+
+   while (1) {
+   /* wait for any pending references to go away */
+   mtx_lock(usb_ref_lock);
+   if (udev-refcount == refcount) {
+   /* prevent further refs being taken */
+   udev-refcount = USB_DEV_REF_MAX;
+   mtx_unlock(usb_ref_lock);
+   break;
+   }
+   usbd_enum_unlock(udev);
+   cv_wait(udev-ref_cv, usb_ref_lock);
+   mtx_unlock(usb_ref_lock);
+   (void) usbd_enum_lock(udev);
+   }
+#endif
+}
+
+/**
+ * usb_ref_restore_locked
+ *
+ * This function will restore the reference count value after a call
+ * to usb_wait_pending_ref_locked().
+ **/
+static void
+usb_ref_restore_locked(struct usb_device *udev)
+{
+#if USB_HAVE_UGEN
+   const uint16_t refcount =
+   usb_proc_is_called_from(
+   USB_BUS_EXPLORE_PROC(udev-bus)) ? 1 : 2;
+
+   DPRINTF(Refcount = %d\n, (int)refcount); 
+
+   /* restore reference count and wakeup waiters, if any */
+   mtx_lock(usb_ref_lock);
+   udev-refcount = refcount;
+   cv_broadcast(udev-ref_cv);
+   mtx_unlock(usb_ref_lock);
+#endif
+}
+

svn commit: r263800 - stable/9/sys/dev/usb

2014-03-27 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 27 07:03:50 2014
New Revision: 263800
URL: http://svnweb.freebsd.org/changeset/base/263800

Log:
  MFC r263423:
  Try to resolve a possible deadlock when detaching USB devices which
  create character devices. The deadlock can happen if an application is
  issuing IOCTLs which require USB refcounting, at the same time the USB
  device is detaching.
  
  There is already a counter in place in the USB device structure to
  detect this situation, but it was not always checked ahead of invoking
  functions that might destroy character devices, like detach, set
  configuration, set alternate interface or detach active kernel driver.

Modified:
  stable/9/sys/dev/usb/usb_dev.c
  stable/9/sys/dev/usb/usb_device.c
  stable/9/sys/dev/usb/usb_process.c
  stable/9/sys/dev/usb/usb_process.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/usb/usb_dev.c
==
--- stable/9/sys/dev/usb/usb_dev.c  Thu Mar 27 06:59:56 2014
(r263799)
+++ stable/9/sys/dev/usb/usb_dev.c  Thu Mar 27 07:03:50 2014
(r263800)
@@ -210,12 +210,13 @@ usb_ref_device(struct usb_cdev_privdata 
DPRINTFN(2, device is detached\n);
goto error;
}
-   if (cpd-udev-refcount == USB_DEV_REF_MAX) {
-   DPRINTFN(2, no dev ref\n);
-   goto error;
-   }
if (need_uref) {
DPRINTFN(2, ref udev - needed\n);
+
+   if (cpd-udev-refcount == USB_DEV_REF_MAX) {
+   DPRINTFN(2, no dev ref\n);
+   goto error;
+   }
cpd-udev-refcount++;
 
mtx_unlock(usb_ref_lock);
@@ -289,9 +290,8 @@ error:
usbd_enum_unlock(cpd-udev);
 
if (crd-is_uref) {
-   if (--(cpd-udev-refcount) == 0) {
-   cv_signal(cpd-udev-ref_cv);
-   }
+   cpd-udev-refcount--;
+   cv_broadcast(cpd-udev-ref_cv);
}
mtx_unlock(usb_ref_lock);
DPRINTFN(2, fail\n);
@@ -357,10 +357,9 @@ usb_unref_device(struct usb_cdev_privdat
crd-is_write = 0;
}
if (crd-is_uref) {
-   if (--(cpd-udev-refcount) == 0) {
-   cv_signal(cpd-udev-ref_cv);
-   }
crd-is_uref = 0;
+   cpd-udev-refcount--;
+   cv_broadcast(cpd-udev-ref_cv);
}
mtx_unlock(usb_ref_lock);
 }

Modified: stable/9/sys/dev/usb/usb_device.c
==
--- stable/9/sys/dev/usb/usb_device.c   Thu Mar 27 06:59:56 2014
(r263799)
+++ stable/9/sys/dev/usb/usb_device.c   Thu Mar 27 07:03:50 2014
(r263800)
@@ -431,6 +431,65 @@ usb_endpoint_foreach(struct usb_device *
 }
 
 /**
+ * usb_wait_pending_ref_locked
+ *
+ * This function will wait for any USB references to go away before
+ * returning and disable further USB device refcounting on the
+ * specified USB device. This function is used when detaching a USB
+ * device.
+ **/
+static void
+usb_wait_pending_ref_locked(struct usb_device *udev)
+{
+#if USB_HAVE_UGEN
+   const uint16_t refcount =
+   usb_proc_is_called_from(
+   udev-bus-explore_proc) ? 1 : 2;
+
+   DPRINTF(Refcount = %d\n, (int)refcount); 
+
+   while (1) {
+   /* wait for any pending references to go away */
+   mtx_lock(usb_ref_lock);
+   if (udev-refcount == refcount) {
+   /* prevent further refs being taken */
+   udev-refcount = USB_DEV_REF_MAX;
+   mtx_unlock(usb_ref_lock);
+   break;
+   }
+   usbd_enum_unlock(udev);
+   cv_wait(udev-ref_cv, usb_ref_lock);
+   mtx_unlock(usb_ref_lock);
+   (void) usbd_enum_lock(udev);
+   }
+#endif
+}
+
+/**
+ * usb_ref_restore_locked
+ *
+ * This function will restore the reference count value after a call
+ * to usb_wait_pending_ref_locked().
+ **/
+static void
+usb_ref_restore_locked(struct usb_device *udev)
+{
+#if USB_HAVE_UGEN
+   const uint16_t refcount =
+   usb_proc_is_called_from(
+   udev-bus-explore_proc) ? 1 : 2;
+
+   DPRINTF(Refcount = %d\n, (int)refcount); 
+
+   /* restore reference count and wakeup waiters, if any */
+   mtx_lock(usb_ref_lock);
+   udev-refcount = refcount;
+   cv_broadcast(udev-ref_cv);
+   mtx_unlock(usb_ref_lock);
+#endif
+}
+

svn commit: r263801 - stable/8/sys/dev/usb

2014-03-27 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Mar 27 07:06:29 2014
New Revision: 263801
URL: http://svnweb.freebsd.org/changeset/base/263801

Log:
  MFC r263423:
  Try to resolve a possible deadlock when detaching USB devices which
  create character devices. The deadlock can happen if an application is
  issuing IOCTLs which require USB refcounting, at the same time the USB
  device is detaching.
  
  There is already a counter in place in the USB device structure to
  detect this situation, but it was not always checked ahead of invoking
  functions that might destroy character devices, like detach, set
  configuration, set alternate interface or detach active kernel driver.

Modified:
  stable/8/sys/dev/usb/usb_dev.c
  stable/8/sys/dev/usb/usb_device.c
  stable/8/sys/dev/usb/usb_process.c
  stable/8/sys/dev/usb/usb_process.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/usb_dev.c
==
--- stable/8/sys/dev/usb/usb_dev.c  Thu Mar 27 07:03:50 2014
(r263800)
+++ stable/8/sys/dev/usb/usb_dev.c  Thu Mar 27 07:06:29 2014
(r263801)
@@ -208,12 +208,13 @@ usb_ref_device(struct usb_cdev_privdata 
DPRINTFN(2, device is detached\n);
goto error;
}
-   if (cpd-udev-refcount == USB_DEV_REF_MAX) {
-   DPRINTFN(2, no dev ref\n);
-   goto error;
-   }
if (need_uref) {
DPRINTFN(2, ref udev - needed\n);
+
+   if (cpd-udev-refcount == USB_DEV_REF_MAX) {
+   DPRINTFN(2, no dev ref\n);
+   goto error;
+   }
cpd-udev-refcount++;
 
mtx_unlock(usb_ref_lock);
@@ -287,9 +288,8 @@ error:
usbd_enum_unlock(cpd-udev);
 
if (crd-is_uref) {
-   if (--(cpd-udev-refcount) == 0) {
-   cv_signal(cpd-udev-ref_cv);
-   }
+   cpd-udev-refcount--;
+   cv_broadcast(cpd-udev-ref_cv);
}
mtx_unlock(usb_ref_lock);
DPRINTFN(2, fail\n);
@@ -355,10 +355,9 @@ usb_unref_device(struct usb_cdev_privdat
crd-is_write = 0;
}
if (crd-is_uref) {
-   if (--(cpd-udev-refcount) == 0) {
-   cv_signal(cpd-udev-ref_cv);
-   }
crd-is_uref = 0;
+   cpd-udev-refcount--;
+   cv_broadcast(cpd-udev-ref_cv);
}
mtx_unlock(usb_ref_lock);
 }

Modified: stable/8/sys/dev/usb/usb_device.c
==
--- stable/8/sys/dev/usb/usb_device.c   Thu Mar 27 07:03:50 2014
(r263800)
+++ stable/8/sys/dev/usb/usb_device.c   Thu Mar 27 07:06:29 2014
(r263801)
@@ -431,6 +431,65 @@ usb_endpoint_foreach(struct usb_device *
 }
 
 /**
+ * usb_wait_pending_ref_locked
+ *
+ * This function will wait for any USB references to go away before
+ * returning and disable further USB device refcounting on the
+ * specified USB device. This function is used when detaching a USB
+ * device.
+ **/
+static void
+usb_wait_pending_ref_locked(struct usb_device *udev)
+{
+#if USB_HAVE_UGEN
+   const uint16_t refcount =
+   usb_proc_is_called_from(
+   udev-bus-explore_proc) ? 1 : 2;
+
+   DPRINTF(Refcount = %d\n, (int)refcount); 
+
+   while (1) {
+   /* wait for any pending references to go away */
+   mtx_lock(usb_ref_lock);
+   if (udev-refcount == refcount) {
+   /* prevent further refs being taken */
+   udev-refcount = USB_DEV_REF_MAX;
+   mtx_unlock(usb_ref_lock);
+   break;
+   }
+   usbd_enum_unlock(udev);
+   cv_wait(udev-ref_cv, usb_ref_lock);
+   mtx_unlock(usb_ref_lock);
+   (void) usbd_enum_lock(udev);
+   }
+#endif
+}
+
+/**
+ * usb_ref_restore_locked
+ *
+ * This function will restore the reference count value after a call
+ * to usb_wait_pending_ref_locked().
+ **/
+static void
+usb_ref_restore_locked(struct usb_device *udev)
+{
+#if USB_HAVE_UGEN
+   const uint16_t refcount =
+   usb_proc_is_called_from(
+   udev-bus-explore_proc) ? 1 : 2;
+
+   DPRINTF(Refcount = %d\n, (int)refcount); 
+
+   /* restore reference count and wakeup waiters, if any */
+   mtx_lock(usb_ref_lock);
+   udev-refcount = refcount;
+   cv_broadcast(udev-ref_cv);
+   

Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread David Xu

On 2014/03/26 07:30, Mateusz Guzik wrote:

Author: mjg
Date: Tue Mar 25 23:30:35 2014
New Revision: 263755
URL: http://svnweb.freebsd.org/changeset/base/263755

Log:
   Document a known problem with handling the process intended to receive
   SIGIO in /dev/devctl.

   Suggested by:adrian
   MFC after:   6 days

Modified:
   head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cTue Mar 25 23:19:45 2014(r263754)
+++ head/sys/kern/subr_bus.cTue Mar 25 23:30:35 2014(r263755)
@@ -490,6 +490,21 @@ devioctl(struct cdev *dev, u_long cmd, c
devsoftc.nonblock = 0;
return (0);
case FIOASYNC:
+   /*
+* FIXME:
+* Since this is a simple assignment there is no guarantee that
+* devsoftc.async_proc consumers will get a valid pointer.
+*
+* Example scenario where things break (processes A and B):
+* 1. A opens devctl
+* 2. A sends fd to B
+* 3. B sets itself as async_proc
+* 4. B exits
+*
+* However, normally this requires root privileges and the only
+* in-tree consumer does not behave in a dangerous way so the
+* issue is not critical.
+*/
if (*(int*)data)
devsoftc.async_proc = td-td_proc;
else
@@ -575,6 +590,7 @@ devctl_queue_data_f(char *data, int flag
cv_broadcast(devsoftc.cv);
mtx_unlock(devsoftc.mtx);
selwakeup(devsoftc.sel);
+   /* XXX see a comment in devioctl */
p = devsoftc.async_proc;
if (p != NULL) {
PROC_LOCK(p);




I think the async process pointer can be cleared when a process exits
by registering an event handler. please see attached patch.


# HG changeset patch
# Parent 53b614ff2cae108f27e4475989d3a86997017268

diff -r 53b614ff2cae sys/kern/subr_bus.c
--- a/sys/kern/subr_bus.c	Thu Mar 27 10:03:50 2014 +0800
+++ b/sys/kern/subr_bus.c	Thu Mar 27 15:38:40 2014 +0800
@@ -54,6 +54,7 @@
 #include sys/uio.h
 #include sys/bus.h
 #include sys/interrupt.h
+#include sys/eventhandler.h
 
 #include net/vnet.h
 
@@ -399,6 +400,18 @@
 } devsoftc;
 
 static struct cdev *devctl_dev;
+static eventhandler_tag devctl_eh;
+
+static void
+devctl_proc_clear(void *arg, struct proc *p, struct image_params *imgp __unused)
+{
+	if (devsoftc.async_proc == p) {
+		mtx_lock(devsoftc.mtx);
+		if (devsoftc.async_proc == p)
+			devsoftc.async_proc = NULL;
+		mtx_unlock(devsoftc.mtx);
+	}
+}
 
 static void
 devinit(void)
@@ -408,6 +421,8 @@
 	mtx_init(devsoftc.mtx, dev mtx, devd, MTX_DEF);
 	cv_init(devsoftc.cv, dev cv);
 	TAILQ_INIT(devsoftc.devq);
+	devctl_eh = EVENTHANDLER_REGISTER(process_exit, devctl_proc_clear, NULL,
+		EVENTHANDLER_PRI_ANY);
 }
 
 static int
@@ -490,25 +505,12 @@
 			devsoftc.nonblock = 0;
 		return (0);
 	case FIOASYNC:
-		/*
-		 * FIXME:
-		 * Since this is a simple assignment there is no guarantee that
-		 * devsoftc.async_proc consumers will get a valid pointer.
-		 *
-		 * Example scenario where things break (processes A and B):
-		 * 1. A opens devctl
-		 * 2. A sends fd to B
-		 * 3. B sets itself as async_proc
-		 * 4. B exits
-		 *
-		 * However, normally this requires root privileges and the only
-		 * in-tree consumer does not behave in a dangerous way so the
-		 * issue is not critical.
-		 */
+		mtx_lock(devsoftc.mtx);
 		if (*(int*)data)
 			devsoftc.async_proc = td-td_proc;
 		else
 			devsoftc.async_proc = NULL;
+		mtx_unlock(devsoftc.mtx);
 		return (0);
 
 		/* (un)Support for other fcntl() calls. */
@@ -588,15 +590,14 @@
 	TAILQ_INSERT_TAIL(devsoftc.devq, n1, dei_link);
 	devsoftc.queued++;
 	cv_broadcast(devsoftc.cv);
-	mtx_unlock(devsoftc.mtx);
 	selwakeup(devsoftc.sel);
-	/* XXX see a comment in devioctl */
 	p = devsoftc.async_proc;
 	if (p != NULL) {
 		PROC_LOCK(p);
 		kern_psignal(p, SIGIO);
 		PROC_UNLOCK(p);
 	}
+	mtx_unlock(devsoftc.mtx);
 	return;
 out:
 	/*
@@ -4503,7 +4504,7 @@
 		return (0);
 
 	case MOD_SHUTDOWN:
-		device_shutdown(root_bus);
+		EVENTHANDLER_DEREGISTER(process_exit, devctl_eh);
 		return (0);
 	default:
 		return (EOPNOTSUPP);
___
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-unsubscr...@freebsd.org

Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Mateusz Guzik
On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
 I think the async process pointer can be cleared when a process exits
 by registering an event handler. please see attached patch.
 

Sure, but I'm not very fond of this solution.

This is a rather obscure bug you wont hit unless you explicitly try,
and even then you need root privs by default.

As such writing a callback function which will be executed for all exiting
processes seems unjustified for me.

Ideally we would get some mechanism which would allow to register
callbacks for events related to given entity. Then it could be used to
provide a call this function when process p exits, amongst other things.

-- 
Mateusz Guzik mjguzik gmail.com
___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread David Xu

On 2014/03/27 16:37, Mateusz Guzik wrote:

On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:

I think the async process pointer can be cleared when a process exits
by registering an event handler. please see attached patch.



Sure, but I'm not very fond of this solution.

This is a rather obscure bug you wont hit unless you explicitly try,
and even then you need root privs by default.


OK, but I don't like the bug exists in kernel. It is not obscure for me,
I can run shutdown now command, and insert a device, and then the
kernel will write garbage data into freed memory space.


As such writing a callback function which will be executed for all exiting
processes seems unjustified for me.

Ideally we would get some mechanism which would allow to register
callbacks for events related to given entity. Then it could be used to
provide a call this function when process p exits, amongst other things.



Yes, but the callback itself is cheap enough and is not worth to be
per-entity entry.


___
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-unsubscr...@freebsd.org


svn commit: r263809 - head/sys/dev/vt

2014-03-27 Thread Aleksandr Rybalko
Author: ray
Date: Thu Mar 27 09:24:09 2014
New Revision: 263809
URL: http://svnweb.freebsd.org/changeset/base/263809

Log:
  Fix crash on resume in vt(9).
  Statically allocated terminal window have not initialized callout handler, so 
we
  have to initialize it even for existing window if it is console window.
  
  Reported by:  gjb and many
  Tested by:gjb
  MFC after:7 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Thu Mar 27 08:52:48 2014(r263808)
+++ head/sys/dev/vt/vt_core.c   Thu Mar 27 09:24:09 2014(r263809)
@@ -1872,6 +1872,9 @@ vt_upgrade(struct vt_device *vd)
if (vw == NULL) {
/* New window. */
vw = vt_allocate_window(vd, i);
+   } else if (vw-vw_flags  VWF_CONSOLE) {
+   /* For existing console window. */
+   callout_init(vw-vw_proc_dead_timer, 0);
}
if (i == VT_CONSWINDOW) {
/* Console window. */
___
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-unsubscr...@freebsd.org


Re: svn commit: r263355 - stable/9/sys/kern

2014-03-27 Thread Alexey Dokuchaev
On Wed, Mar 19, 2014 at 12:57:13PM +, Konstantin Belousov wrote:
 New Revision: 263355
 URL: http://svnweb.freebsd.org/changeset/base/263355
 
 Log:
   MFC r263079:
   The auio structure is only initialized when the vnode is symlink,
   avoid reading from it otherwise.

Is it applicable to stable/8, and if yes, can it be MFCed?  Thanks,

./danfe
___
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-unsubscr...@freebsd.org


Re: svn commit: r263321 - head/sys/dev/vt

2014-03-27 Thread Aleksandr Rybalko
On Wed, 19 Mar 2014 14:53:47 -0400
John Baldwin j...@freebsd.org wrote:

 On Tuesday, March 18, 2014 6:22:48 pm Aleksandr Rybalko wrote:
  Author: ray
  Date: Tue Mar 18 22:22:47 2014
  New Revision: 263321
  URL: http://svnweb.freebsd.org/changeset/base/263321
  
  Log:
Switch kern.vt.suspendswitch to 0 by default (disabled).
kern.vt.suspendswitch - sysctl/tunable which enable switch to VT0 before 
  going
to suspend and switch back after resume.

MFC after:7 days
 
 I think it is fine to change the default, but I'm not certain that this fixes
 the panics on resume.  So far no one has reported back that this did fix them
 after I suggested it.  It would be good to fix the panics as well if possible.
 The last time I looked at it in detail, it seemed like the callout for only
 ttyv0 had been zero'd.  Other ttyv timers used in switching still had the 
 correct
 contents.
 
 -- 
 John Baldwin

Yeah, thanks for pointing on it. Your hint about ttyv0 point to the
difference between ttyv0 and others. Window structure for VT1 defined
statically for early stage drivers (like vt_vga), so I forget to
initialize callout for that window :)

Now it was fixed by r263809.

And since we still have problem with puzzling Xorg screen after
suspend/resume - I will revert this commit.

My research on that problem (puzzling Xorg screen) point on two
possible problems:
1. maybe Xorg lack of APM module, or it is broken somehow.
2. maybe problem in drm2, so Xorg's framebuffer rearranged by drm2, but
Xorg don't know about that.

Many thanks!

WBW
-- 
Aleksandr Rybalko r...@freebsd.org
___
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-unsubscr...@freebsd.org


svn commit: r263810 - head/sys/cam/ctl

2014-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Mar 27 10:15:35 2014
New Revision: 263810
URL: http://svnweb.freebsd.org/changeset/base/263810

Log:
  Rework cfiscsi_datamove_in() to obey expected data transfer length
  received from the initiator.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- head/sys/cam/ctl/ctl_frontend_iscsi.c   Thu Mar 27 09:24:09 2014
(r263809)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c   Thu Mar 27 10:15:35 2014
(r263810)
@@ -2315,8 +2315,8 @@ cfiscsi_datamove_in(union ctl_io *io)
const struct iscsi_bhs_scsi_command *bhssc;
struct iscsi_bhs_data_in *bhsdi;
struct ctl_sg_entry ctl_sg_entry, *ctl_sglist;
-   size_t copy_len, len, off;
-   const char *addr;
+   size_t len, expected_len, sg_len, buffer_offset;
+   const char *sg_addr;
int ctl_sg_count, error, i;
 
request = io-io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr;
@@ -2338,26 +2338,49 @@ cfiscsi_datamove_in(union ctl_io *io)
}
 
/*
-* We need to record it so that we can properly report
+* This is the total amount of data to be transferred within the current
+* SCSI command.  We need to record it so that we can properly report
 * underflow/underflow.
 */
PDU_TOTAL_TRANSFER_LEN(request) = io-scsiio.kern_total_len;
 
/*
-* This is the offset within the current SCSI command;
-* i.e. for the first call of datamove(), it will be 0,
-* and for subsequent ones it will be the sum of lengths
-* of previous ones.
+* This is the offset within the current SCSI command; for the first
+* call to cfiscsi_datamove() it will be 0, and for subsequent ones
+* it will be the sum of lengths of previous ones.  It's being
+* incremented as we append data to the data segment.
 */
-   off = htonl(io-scsiio.kern_rel_offset);
+   buffer_offset = io-scsiio.kern_rel_offset;
+
+   /*
+* This is the transfer length expected by the initiator.  In theory,
+* it could be different from the correct amount of data from the SCSI
+* point of view, even if that doesn't make any sense.
+*/
+   expected_len = ntohl(bhssc-bhssc_expected_data_transfer_length);
+#if 0
+   if (expected_len != io-scsiio.kern_total_len)
+   CFISCSI_SESSION_DEBUG(cs, expected transfer length = %zd, 
+   actual length = %zd, expected_len,
+   io-scsiio.kern_total_len);
+#endif
+
+   if (buffer_offset = expected_len) {
+#if 0
+   CFISCSI_SESSION_DEBUG(cs, buffer_offset = %zd, 
+   already sent the expected len, buffer_offset);
+#endif
+   io-scsiio.ext_data_filled = io-scsiio.kern_total_len;
+   io-scsiio.be_move_done(io);
+   return;
+   }
 
i = 0;
-   addr = NULL;
-   len = 0;
+   sg_addr = NULL;
+   sg_len = 0;
response = NULL;
bhsdi = NULL;
for (;;) {
-   KASSERT(i  ctl_sg_count, (i = ctl_sg_count));
if (response == NULL) {
response = cfiscsi_pdu_new_response(request, M_NOWAIT);
if (response == NULL) {
@@ -2374,22 +2397,43 @@ cfiscsi_datamove_in(union ctl_io *io)
bhssc-bhssc_initiator_task_tag;
bhsdi-bhsdi_datasn = htonl(PDU_EXPDATASN(request));
PDU_EXPDATASN(request)++;
-   bhsdi-bhsdi_buffer_offset = htonl(off);
+   bhsdi-bhsdi_buffer_offset = htonl(buffer_offset);
}
 
-   if (len == 0) {
-   addr = ctl_sglist[i].addr;
-   len = ctl_sglist[i].len;
-   KASSERT(len  0, (len = 0));
+   KASSERT(i  ctl_sg_count, (i = ctl_sg_count));
+   if (sg_len == 0) {
+   sg_addr = ctl_sglist[i].addr;
+   sg_len = ctl_sglist[i].len;
+   KASSERT(sg_len  0, (sg_len = 0));
}
 
-   copy_len = len;
-   if (response-ip_data_len + copy_len 
+   len = sg_len;
+
+   /*
+* Truncate to maximum data segment length.
+*/
+   KASSERT(response-ip_data_len  cs-cs_max_data_segment_length,
+   (max_data_segment_length %zd = ip_data_len %zd,
+   response-ip_data_len, cs-cs_max_data_segment_length));
+   if (response-ip_data_len + len 
cs-cs_max_data_segment_length)
-   copy_len = cs-cs_max_data_segment_length -
+   len = cs-cs_max_data_segment_length -

svn commit: r263811 - in head/sys: cam/ctl conf modules/ctl

2014-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Mar 27 11:10:13 2014
New Revision: 263811
URL: http://svnweb.freebsd.org/changeset/base/263811

Log:
  Remove ctl_mem_pool.{c,h}.
  
  Sponsored by: The FreeBSD Foundation

Deleted:
  head/sys/cam/ctl/ctl_mem_pool.c
  head/sys/cam/ctl/ctl_mem_pool.h
Modified:
  head/sys/cam/ctl/README.ctl.txt
  head/sys/cam/ctl/ctl_frontend_cam_sim.c
  head/sys/cam/ctl/ctl_frontend_internal.c
  head/sys/conf/files
  head/sys/modules/ctl/Makefile

Modified: head/sys/cam/ctl/README.ctl.txt
==
--- head/sys/cam/ctl/README.ctl.txt Thu Mar 27 10:15:35 2014
(r263810)
+++ head/sys/cam/ctl/README.ctl.txt Thu Mar 27 11:10:13 2014
(r263811)
@@ -394,14 +394,6 @@ ctl_ioctl.h:
 This defines all ioctls available through the CTL character device, and
 the data structures needed for those ioctls.
 
-ctl_mem_pool.c
-ctl_mem_pool.h:
---
-
-Generic memory pool implementation.  This is currently only used by the
-internal frontend.  The internal frontend can probably be rewritten to use
-UMA zones and this can be removed.
-
 ctl_private.h:
 -
 

Modified: head/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- head/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Mar 27 10:15:35 2014
(r263810)
+++ head/sys/cam/ctl/ctl_frontend_cam_sim.c Thu Mar 27 11:10:13 2014
(r263811)
@@ -65,7 +65,6 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl.h
 #include cam/ctl/ctl_frontend.h
 #include cam/ctl/ctl_frontend_internal.h
-#include cam/ctl/ctl_mem_pool.h
 #include cam/ctl/ctl_debug.h
 
 #defineio_ptr  spriv_ptr1

Modified: head/sys/cam/ctl/ctl_frontend_internal.c
==
--- head/sys/cam/ctl/ctl_frontend_internal.cThu Mar 27 10:15:35 2014
(r263810)
+++ head/sys/cam/ctl/ctl_frontend_internal.cThu Mar 27 11:10:13 2014
(r263811)
@@ -62,6 +62,7 @@ __FBSDID($FreeBSD$);
 #include sys/queue.h
 #include sys/sbuf.h
 #include sys/sysctl.h
+#include vm/uma.h
 #include cam/scsi/scsi_all.h
 #include cam/scsi/scsi_da.h
 #include cam/ctl/ctl_io.h
@@ -73,7 +74,6 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl_util.h
 #include cam/ctl/ctl_ha.h
 #include cam/ctl/ctl_private.h
-#include cam/ctl/ctl_mem_pool.h
 #include cam/ctl/ctl_debug.h
 #include cam/ctl/ctl_scsi_all.h
 #include cam/ctl/ctl_error.h
@@ -118,7 +118,6 @@ struct cfi_metatask {
cfi_tasktypetasktype;
cfi_mt_status   status;
union cfi_taskinfo  taskinfo;
-   struct ctl_mem_element  *element;
void*cfi_context;
STAILQ_ENTRY(cfi_metatask) links;
 };
@@ -153,7 +152,6 @@ struct cfi_lun {
int blocksize_powerof2;
uint32_t cur_tag_num;
cfi_lun_state state;
-   struct ctl_mem_element *element;
struct cfi_softc *softc;
STAILQ_HEAD(, cfi_lun_io) io_list;
STAILQ_ENTRY(cfi_lun) links;
@@ -181,12 +179,13 @@ struct cfi_softc {
cfi_flags flags;
STAILQ_HEAD(, cfi_lun) lun_list;
STAILQ_HEAD(, cfi_metatask) metatask_list;
-   struct ctl_mem_pool lun_pool;
-   struct ctl_mem_pool metatask_pool;
 };
 
 MALLOC_DEFINE(M_CTL_CFI, ctlcfi, CTL CFI);
 
+static uma_zone_t cfi_lun_zone;
+static uma_zone_t cfi_metatask_zone;
+
 static struct cfi_softc fetd_internal_softc;
 
 int cfi_init(void);
@@ -275,48 +274,15 @@ cfi_init(void)
if (ctl_frontend_register(fe, (softc-flags  CTL_FLAG_MASTER_SHELF)) 
!= 0) 
{
printf(%s: internal frontend registration failed\n, __func__);
-   retval = 1;
-   goto bailout;
+   return (0);
}
 
-   if (ctl_init_mem_pool(softc-lun_pool,
- sizeof(struct cfi_lun),
- CTL_MEM_POOL_PERM_GROW, /*grow_inc*/ 3,
- /* initial_pool_size */ CTL_MAX_LUNS) != 0) {
-   printf(%s: can't initialize LUN memory pool\n, __func__);
-   retval = 1;
-   goto bailout_error;
-   }
-
-   if (ctl_init_mem_pool(softc-metatask_pool,
- sizeof(struct cfi_metatask),
- CTL_MEM_POOL_PERM_GROW, /*grow_inc*/ 3,
- /*initial_pool_size*/ 10) != 0) {
-   printf(%s: can't initialize metatask memory pool\n, __func__);
-   retval = 2;
-   goto bailout_error;
-   }
-bailout:
+   cfi_lun_zone = uma_zcreate(cfi_lun, sizeof(struct cfi_lun),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+   cfi_metatask_zone = uma_zcreate(cfi_metatask, sizeof(struct 
cfi_metatask),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
 
return (0);
-
-bailout_error:
-
-   switch (retval) {
-   case 3:
-   

svn commit: r263812 - head/share/man/man7

2014-03-27 Thread Bryan Drewery
Author: bdrewery
Date: Thu Mar 27 11:12:35 2014
New Revision: 263812
URL: http://svnweb.freebsd.org/changeset/base/263812

Log:
  Update build(7) with LOCAL_* vars
  
  PR:   docs/178286
  Submitted by: Garrett Cooper yaneurab...@gmail.com
  Sponsored by: EMC / Isilon Storage Division
  MFC after:1 week

Modified:
  head/share/man/man7/build.7

Modified: head/share/man/man7/build.7
==
--- head/share/man/man7/build.7 Thu Mar 27 11:10:13 2014(r263811)
+++ head/share/man/man7/build.7 Thu Mar 27 11:12:35 2014(r263812)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 10, 2012
+.Dd March 27, 2014
 .Dt BUILD 7
 .Os
 .Sh NAME
@@ -411,8 +411,25 @@ then
 is set to the value of
 .Va KERNFAST .
 .It Va LOCAL_DIRS
-If set, this variable supplies a list of additional directories to
-build, relative to the root of the source tree.
+If set, this variable supplies a list of additional directories relative to
+the root of the source tree to build as part of the
+.Cm everything
+target.
+.It Va LOCAL_LIB_DIRS
+If set, this variable supplies a list of additional directories relative to
+the root of the source tree to build as part of the
+.Cm libraries
+target.
+.It Va LOCAL_MTREE
+If set, this variable supplies a list of additional mtrees relative to the
+root of the source tree to use as part of the
+.Cm hierarchy
+target.
+.It Va LOCAL_TOOL_DIRS
+If set, this variable supplies a list of additional directories relative to
+the root of the source tree to build as part of the
+.Cm build-tools
+target.
 .It Va PORTS_MODULES
 A list of ports with kernel modules that should be built and installed
 as part of the
___
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-unsubscr...@freebsd.org


Re: svn commit: r263355 - stable/9/sys/kern

2014-03-27 Thread Konstantin Belousov
On Thu, Mar 27, 2014 at 09:40:03AM +, Alexey Dokuchaev wrote:
 On Wed, Mar 19, 2014 at 12:57:13PM +, Konstantin Belousov wrote:
  New Revision: 263355
  URL: http://svnweb.freebsd.org/changeset/base/263355
  
  Log:
MFC r263079:
The auio structure is only initialized when the vnode is symlink,
avoid reading from it otherwise.
 
 Is it applicable to stable/8, and if yes, can it be MFCed?  Thanks,

This is purely cosmetic commit.  Why do you insist on merging ?


pgptjdo4h8ZQz.pgp
Description: PGP signature


Re: svn commit: r263355 - stable/9/sys/kern

2014-03-27 Thread Alexey Dokuchaev
On Thu, Mar 27, 2014 at 02:11:55PM +0200, Konstantin Belousov wrote:
 On Thu, Mar 27, 2014 at 09:40:03AM +, Alexey Dokuchaev wrote:
  On Wed, Mar 19, 2014 at 12:57:13PM +, Konstantin Belousov wrote:
   New Revision: 263355
   URL: http://svnweb.freebsd.org/changeset/base/263355
   
   Log:
 MFC r263079:
 The auio structure is only initialized when the vnode is symlink,
 avoid reading from it otherwise.
  
  Is it applicable to stable/8, and if yes, can it be MFCed?  Thanks,
 
 This is purely cosmetic commit.  Why do you insist on merging ?

I am not insisting. ;-)  I thought it was more than purely cosmetic, but
then again, I did not study the code thoroughly enough.

Sorry for the noise.  My reason in that stable/8 is going to be EOLed
sooner or later, yet I'm not willing to move from it since 9.x/10.x do
not bring anything important for me except the bloat, and 8.x works
perfectly fine.  That said, I'm trying to get seemingly important bug
fixes MFCed, albeit sometimes I overestimate their importance and/or
relevance.

./danfe
___
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-unsubscr...@freebsd.org


svn commit: r263814 - head/sbin/mdconfig/tests

2014-03-27 Thread Julio Merino
Author: jmmv
Date: Thu Mar 27 13:15:22 2014
New Revision: 263814
URL: http://svnweb.freebsd.org/changeset/base/263814

Log:
  Fix path to the run.pl script to let these tests run.
  
  Submitted by: Peel, Casey
  Obtained from:freebsd-testing

Modified:
  head/sbin/mdconfig/tests/legacy_test.sh

Modified: head/sbin/mdconfig/tests/legacy_test.sh
==
--- head/sbin/mdconfig/tests/legacy_test.sh Thu Mar 27 12:59:23 2014
(r263813)
+++ head/sbin/mdconfig/tests/legacy_test.sh Thu Mar 27 13:15:22 2014
(r263814)
@@ -38,7 +38,7 @@ fi
 
 TESTDIR=$(dirname $(realpath $0))
 
-__PERL__ -w -U $TESTDIR/run $TESTDIR/mdconfig.test  /dev/null
+__PERL__ -w -U $TESTDIR/run.pl $TESTDIR/mdconfig.test  /dev/null
 
 if [ $? -eq 0 ]; then
echo ok 1
___
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-unsubscr...@freebsd.org


svn commit: r263815 - in head/sys: ia64/acpica ia64/ia64 ia64/include sys

2014-03-27 Thread Ed Maste
Author: emaste
Date: Thu Mar 27 13:57:00 2014
New Revision: 263815
URL: http://svnweb.freebsd.org/changeset/base/263815

Log:
  Move ia64 efi.h to sys in preparation for amd64 UEFI support
  
  Prototypes specific to ia64 have been left in this file for now, under
  __ia64__, rather than moving them to a new header under sys/ia64.
  I anticipate that (some of) the corresponding functions will be shared
  by the amd64, arm64, i386, and ia64 architectures, and we can adjust
  this as EFI support on other than ia64 continues to develop.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/sys/efi.h
 - copied, changed from r263814, head/sys/ia64/include/efi.h
Deleted:
  head/sys/ia64/include/efi.h
Modified:
  head/sys/ia64/acpica/OsdEnvironment.c
  head/sys/ia64/ia64/clock.c
  head/sys/ia64/ia64/dump_machdep.c
  head/sys/ia64/ia64/efi.c
  head/sys/ia64/ia64/iodev_machdep.c
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/ia64/nexus.c
  head/sys/ia64/ia64/pmap.c
  head/sys/ia64/ia64/sal.c
  head/sys/ia64/ia64/trap.c

Modified: head/sys/ia64/acpica/OsdEnvironment.c
==
--- head/sys/ia64/acpica/OsdEnvironment.c   Thu Mar 27 13:15:22 2014
(r263814)
+++ head/sys/ia64/acpica/OsdEnvironment.c   Thu Mar 27 13:57:00 2014
(r263815)
@@ -29,8 +29,8 @@
 __FBSDID($FreeBSD$);
 
 #include sys/types.h
+#include sys/efi.h
 #include sys/sysctl.h
-#include machine/efi.h
 
 #include contrib/dev/acpica/include/acpi.h
 

Modified: head/sys/ia64/ia64/clock.c
==
--- head/sys/ia64/ia64/clock.c  Thu Mar 27 13:15:22 2014(r263814)
+++ head/sys/ia64/ia64/clock.c  Thu Mar 27 13:57:00 2014(r263815)
@@ -30,6 +30,7 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/kernel.h
 #include sys/bus.h
+#include sys/efi.h
 #include sys/interrupt.h
 #include sys/priority.h
 #include sys/proc.h
@@ -41,7 +42,6 @@ __FBSDID($FreeBSD$);
 #include sys/pcpu.h
 
 #include machine/cpu.h
-#include machine/efi.h
 #include machine/intr.h
 #include machine/intrcnt.h
 #include machine/md_var.h

Modified: head/sys/ia64/ia64/dump_machdep.c
==
--- head/sys/ia64/ia64/dump_machdep.c   Thu Mar 27 13:15:22 2014
(r263814)
+++ head/sys/ia64/ia64/dump_machdep.c   Thu Mar 27 13:57:00 2014
(r263815)
@@ -33,6 +33,7 @@ __FBSDID($FreeBSD$);
 #include sys/systm.h
 #include sys/conf.h
 #include sys/cons.h
+#include sys/efi.h
 #include sys/kernel.h
 #include sys/kerneldump.h
 #ifdef SW_WATCHDOG
@@ -41,7 +42,6 @@ __FBSDID($FreeBSD$);
 #include vm/vm.h
 #include vm/pmap.h
 #include machine/bootinfo.h
-#include machine/efi.h
 #include machine/elf.h
 #include machine/md_var.h
 

Modified: head/sys/ia64/ia64/efi.c
==
--- head/sys/ia64/ia64/efi.cThu Mar 27 13:15:22 2014(r263814)
+++ head/sys/ia64/ia64/efi.cThu Mar 27 13:57:00 2014(r263815)
@@ -29,9 +29,9 @@
 __FBSDID($FreeBSD$);
 
 #include sys/param.h
+#include sys/efi.h
 #include sys/systm.h
 #include machine/bootinfo.h
-#include machine/efi.h
 #include machine/md_var.h
 #include machine/sal.h
 #include vm/vm.h

Modified: head/sys/ia64/ia64/iodev_machdep.c
==
--- head/sys/ia64/ia64/iodev_machdep.c  Thu Mar 27 13:15:22 2014
(r263814)
+++ head/sys/ia64/ia64/iodev_machdep.c  Thu Mar 27 13:57:00 2014
(r263815)
@@ -29,6 +29,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/conf.h
+#include sys/efi.h
 #include sys/fcntl.h
 #include sys/ioccom.h
 #include sys/malloc.h
@@ -37,7 +38,6 @@ __FBSDID($FreeBSD$);
 #include sys/systm.h
 
 #include machine/bus.h
-#include machine/efi.h
 #include machine/iodev.h
 
 static int iodev_efivar_getvar(struct iodev_efivar_req *req);

Modified: head/sys/ia64/ia64/machdep.c
==
--- head/sys/ia64/ia64/machdep.cThu Mar 27 13:15:22 2014
(r263814)
+++ head/sys/ia64/ia64/machdep.cThu Mar 27 13:57:00 2014
(r263815)
@@ -42,6 +42,7 @@ __FBSDID($FreeBSD$);
 #include sys/bus.h
 #include sys/cons.h
 #include sys/cpu.h
+#include sys/efi.h
 #include sys/eventhandler.h
 #include sys/exec.h
 #include sys/imgact.h
@@ -83,7 +84,6 @@ __FBSDID($FreeBSD$);
 
 #include machine/bootinfo.h
 #include machine/cpu.h
-#include machine/efi.h
 #include machine/elf.h
 #include machine/fpu.h
 #include machine/intr.h

Modified: head/sys/ia64/ia64/nexus.c
==
--- head/sys/ia64/ia64/nexus.c  Thu Mar 27 13:15:22 2014(r263814)
+++ head/sys/ia64/ia64/nexus.c  Thu Mar 27 13:57:00 2014(r263815)
@@ -44,6 +44,7 @@
 #include sys/systm.h
 #include sys/bus.h
 

svn commit: r263816 - head/sys/dev/vt

2014-03-27 Thread Aleksandr Rybalko
Author: ray
Date: Thu Mar 27 14:07:36 2014
New Revision: 263816
URL: http://svnweb.freebsd.org/changeset/base/263816

Log:
  Revert r263321.
  vt(9) crash on resume fixed, but Xorg still have damaged screen on resume (at
  least with i915kms), so better to switch to VT0 before suspend and back on
  resume.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Thu Mar 27 13:57:00 2014(r263815)
+++ head/sys/dev/vt/vt_core.c   Thu Mar 27 14:07:36 2014(r263816)
@@ -118,7 +118,7 @@ static SYSCTL_NODE(_kern, OID_AUTO, vt, 
 VT_SYSCTL_INT(enable_altgr, 1, Enable AltGr key (Do not assume R.Alt as 
Alt));
 VT_SYSCTL_INT(debug, 0, vt(9) debug level);
 VT_SYSCTL_INT(deadtimer, 15, Time to wait busy process in VT_PROCESS mode);
-VT_SYSCTL_INT(suspendswitch, 0, Switch to VT0 before suspend);
+VT_SYSCTL_INT(suspendswitch, 1, Switch to VT0 before suspend);
 
 static unsigned int vt_unit = 0;
 static MALLOC_DEFINE(M_VT, vt, vt device);
___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Mateusz Guzik
On Thu, Mar 27, 2014 at 04:46:57PM +0800, David Xu wrote:
 On 2014/03/27 16:37, Mateusz Guzik wrote:
 On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
 I think the async process pointer can be cleared when a process exits
 by registering an event handler. please see attached patch.
 
 
 Sure, but I'm not very fond of this solution.
 
 This is a rather obscure bug you wont hit unless you explicitly try,
 and even then you need root privs by default.
 
 OK, but I don't like the bug exists in kernel. It is not obscure for me,
 I can run shutdown now command, and insert a device, and then the
 kernel will write garbage data into freed memory space.
 

Not sure what you mean. devd does not use this feature, and even if it
did async_proc is cleared on close, which happens while signal delivery
is still legal.

That said, you are not going to encounter this bug unless you code
something up to specifically trigger it.

fwiw, I think we could axe this feature if there was no way to fix it
without introducing a check for every process.

 As such writing a callback function which will be executed for all exiting
 processes seems unjustified for me.
 
 Ideally we would get some mechanism which would allow to register
 callbacks for events related to given entity. Then it could be used to
 provide a call this function when process p exits, amongst other things.
 
 
 Yes, but the callback itself is cheap enough and is not worth to be
 per-entity entry.
 

There is other code in the kernel which would benefit from such
functionality - dev/syscons/scmouse, dev/vt/vt_core.c, aio and possibly
more.

As such I think this is worth pursuing.

-- 
Mateusz Guzik mjguzik gmail.com
___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Mateusz Guzik
On Thu, Mar 27, 2014 at 03:58:19PM +0100, Mateusz Guzik wrote:
 On Thu, Mar 27, 2014 at 04:46:57PM +0800, David Xu wrote:
  On 2014/03/27 16:37, Mateusz Guzik wrote:
  On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
  I think the async process pointer can be cleared when a process exits
  by registering an event handler. please see attached patch.
  
  
  Sure, but I'm not very fond of this solution.
  
  This is a rather obscure bug you wont hit unless you explicitly try,
  and even then you need root privs by default.
  
  OK, but I don't like the bug exists in kernel. It is not obscure for me,
  I can run shutdown now command, and insert a device, and then the
  kernel will write garbage data into freed memory space.
  
 
 Not sure what you mean. devd does not use this feature, and even if it
 did async_proc is cleared on close, which happens while signal delivery
 is still legal.
 
 That said, you are not going to encounter this bug unless you code
 something up to specifically trigger it.
 
 fwiw, I think we could axe this feature if there was no way to fix it
 without introducing a check for every process.
 
  As such writing a callback function which will be executed for all exiting
  processes seems unjustified for me.
  
  Ideally we would get some mechanism which would allow to register
  callbacks for events related to given entity. Then it could be used to
  provide a call this function when process p exits, amongst other things.
  
  
  Yes, but the callback itself is cheap enough and is not worth to be
  per-entity entry.
  
 
 There is other code in the kernel which would benefit from such
 functionality - dev/syscons/scmouse, dev/vt/vt_core.c, aio and possibly
 more.
 
 As such I think this is worth pursuing.
 

We can hack around this one the way the other code is doing - apart from
from proc pointer you store pid and then compare result of pfind(pid).

This is still buggy as both proc and pid pointer can be recycled and end
up being the same (but you have an entrirely new process).

However, then in absolutely worst cae you send SIGIO to incorrect
process, always an existing process so no more corruption.

Would you be ok with such hack for the time being?

-- 
Mateusz Guzik mjguzik gmail.com
___
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-unsubscr...@freebsd.org


Re: svn commit: r263795 - head/sys/x86/acpica

2014-03-27 Thread John Baldwin
On Thursday, March 27, 2014 2:36:39 am Takanori Watanabe wrote:
 Author: takawata
 Date: Thu Mar 27 06:36:38 2014
 New Revision: 263795
 URL: http://svnweb.freebsd.org/changeset/base/263795
 
 Log:
   Strict value checking will cause problem.
   Bay trail DN2820FYKH is supported on Linux but does not work on FreeBSD.
   This behaviour is bug-compatible with Linux-3.13.5.
   
   References:
   http://d.hatena.ne.jp/syuu1228/20140326
   http://lxr.linux.no/linux+v3.13.5/arch/x86/kernel/acpi/boot.c#L1094
   
   Submitted by: syuu

I think the problem with changing it at this level is that you don't know
what the default should be.  These are used both for local NMI but also
for interrupt override entries for ISA interrupts in the local APIC, so
hardcoding 

I think you should instead treat invalid values as conforms.  You can
do this by mostly reverting your change and moving default to the top of
the case and have it print a warning but fall through to the conforms
cases.

 Modified:
   head/sys/x86/acpica/madt.c
 
 Modified: head/sys/x86/acpica/madt.c
 
==
 --- head/sys/x86/acpica/madt.cThu Mar 27 06:08:07 2014
 (r263794)
 +++ head/sys/x86/acpica/madt.cThu Mar 27 06:36:38 2014
 (r263795)
 @@ -306,10 +306,11 @@ interrupt_polarity(UINT16 IntiFlags, UIN
   case ACPI_MADT_POLARITY_ACTIVE_HIGH:
   return (INTR_POLARITY_HIGH);
   case ACPI_MADT_POLARITY_ACTIVE_LOW:
 - return (INTR_POLARITY_LOW);
 + break;

I am not a fan of this at all.  If we fixed default's logic to be different
(e.g. as I suggested above), then falling through could result in the
wrong thing.  POLARITY_LOW should always explicitly return POLARITY_LOW.

   default:
 - panic(Bogus Interrupt Polarity);
 + printf(WARNING: Bogus Interrupt Polarity. Assume POLALITY 
 LOW);
   }
 + return (INTR_POLARITY_LOW);
  }
  
  static enum intr_trigger

-- 
John Baldwin
___
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-unsubscr...@freebsd.org


Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread John Baldwin
On Wednesday, March 26, 2014 6:30:39 pm Dimitry Andric wrote:
 Author: dim
 Date: Wed Mar 26 22:30:38 2014
 New Revision: 263778
 URL: http://svnweb.freebsd.org/changeset/base/263778
 
 Log:
   Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
   all the SUBDIR entries in parallel, instead of serially.  Apply this
   option to a selected number of Makefiles, which can greatly speed up the
   build on multi-core machines, when using make -j.
   
   This can be extended to more Makefiles later on, whenever they are
   verified to work correctly with parallel building.
   
   I tested this on a 24-core machine, with make -j48 buildworld (N = 6):
   
   beforestddev   afterstddev
   ===   ==   ===  ==
   real time1741.1 16.5 959.8 2.7
   user time   12468.7 16.4   14393.016.8
   sys  time1825.0 54.82110.622.8
   
   (user+sys)/real 8.2   17.1
   
   E.g. the build was approximately 45% faster in real time.  On machines
   with less cores, or with lower -j settings, the speedup will not be as
   impressive.  But at least you can now almost max out a machine with
   buildworld!
   
   Submitted by:   jilles
   MFC after:  2 weeks

Nice!

-- 
John Baldwin
___
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-unsubscr...@freebsd.org


Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread David Chisnall
On 26 Mar 2014, at 22:30, Dimitry Andric d...@freebsd.org wrote:

  Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
  all the SUBDIR entries in parallel, instead of serially.  Apply this
  option to a selected number of Makefiles, which can greatly speed up the
  build on multi-core machines, when using make -j.

THANK YOU!  That's really excellent.  We can probably parallelise pretty much 
all of usr.lib and usr.bin as well, but going from using 8 cores to 17 is a 
very nice improvement.  This should help tinderbox / Jenkins build a LOT!

David

___
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-unsubscr...@freebsd.org


Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread Bryan Drewery

On 2014-03-27 10:39, David Chisnall wrote:

On 26 Mar 2014, at 22:30, Dimitry Andric d...@freebsd.org wrote:

 Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to 
process

 all the SUBDIR entries in parallel, instead of serially.  Apply this
 option to a selected number of Makefiles, which can greatly speed up 
the

 build on multi-core machines, when using make -j.


THANK YOU!  That's really excellent.  We can probably parallelise
pretty much all of usr.lib and usr.bin as well, but going from using 8
cores to 17 is a very nice improvement.  This should help tinderbox /
Jenkins build a LOT!

David


I'll do some wider tests on the portmgr boxes. We have some 32 cpu 
systems.


--
Regards,
Bryan Drewery
___
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-unsubscr...@freebsd.org


svn commit: r263817 - in stable/9: sys/conf sys/dev/drm2 sys/dev/drm2/i915 sys/dev/drm2/radeon sys/dev/fb sys/dev/syscons sys/dev/vt sys/dev/vt/font sys/dev/vt/hw/fb sys/dev/vt/hw/ofwfb sys/dev/vt/...

2014-03-27 Thread Aleksandr Rybalko
Author: ray
Date: Thu Mar 27 15:58:18 2014
New Revision: 263817
URL: http://svnweb.freebsd.org/changeset/base/263817

Log:
  MFC 219886, 226100, 226111, 226341, 242529, 259015, 259016, 259019, 259049,
   259071, 259102, 259110, 259129, 259130, 259178, 259179, 259203, 259221,
   259261, 259532, 259615, 259650, 259651, 259667, 259680, 259727, 259761,
   259772, 259776, 259777, 259830, 259882, 259915, 260160, 260449, 260450,
   260688, 260888, 260953, 261269, 261547, 261551, 261552, 261553, 261585
  o Merge vt(4) virtual terminal (a.k.a. newcons) to stable/9.
  o Merge teken updates.
  o Add few more tty methods required by vt(4).
  o Update syscons(4) to work with fresh teken.
  
  Sponsored by: The FreeBSD Foundation

Added:
  stable/9/sys/dev/fb/fb_if.m
 - copied unchanged from r259016, head/sys/dev/fb/fb_if.m
  stable/9/sys/dev/fb/fbd.c
 - copied, changed from r259016, head/sys/dev/fb/fbd.c
  stable/9/sys/dev/vt/
 - copied from r259016, head/sys/dev/vt/
  stable/9/sys/kern/subr_terminal.c
 - copied, changed from r259016, head/sys/kern/subr_terminal.c
  stable/9/sys/sys/terminal.h
 - copied, changed from r259016, head/sys/sys/terminal.h
  stable/9/tools/tools/vt/
 - copied from r259019, head/tools/tools/vt/
Modified:
  stable/9/sys/conf/files
  stable/9/sys/conf/files.amd64
  stable/9/sys/conf/files.arm
  stable/9/sys/conf/files.i386
  stable/9/sys/conf/files.powerpc
  stable/9/sys/conf/files.sparc64
  stable/9/sys/conf/kmod.mk
  stable/9/sys/conf/options
  stable/9/sys/dev/drm2/drmP.h
  stable/9/sys/dev/drm2/drm_fb_helper.c
  stable/9/sys/dev/drm2/drm_os_freebsd.h
  stable/9/sys/dev/drm2/i915/i915_drv.c
  stable/9/sys/dev/drm2/i915/intel_fb.c
  stable/9/sys/dev/drm2/radeon/radeon.h
  stable/9/sys/dev/drm2/radeon/radeon_drv.c
  stable/9/sys/dev/drm2/radeon/radeon_fb.c
  stable/9/sys/dev/drm2/radeon/radeon_pm.c
  stable/9/sys/dev/syscons/scterm-teken.c
  stable/9/sys/dev/syscons/scvidctl.c
  stable/9/sys/dev/vt/font/vt_font_default.c
  stable/9/sys/dev/vt/font/vt_mouse_cursor.c
  stable/9/sys/dev/vt/hw/fb/vt_fb.c
  stable/9/sys/dev/vt/hw/ofwfb/ofwfb.c   (contents, props changed)
  stable/9/sys/dev/vt/hw/vga/vga.c
  stable/9/sys/dev/vt/hw/xboxfb/xboxfb.c
  stable/9/sys/dev/vt/vt.h
  stable/9/sys/dev/vt/vt_buf.c
  stable/9/sys/dev/vt/vt_consolectl.c
  stable/9/sys/dev/vt/vt_core.c
  stable/9/sys/dev/vt/vt_font.c
  stable/9/sys/dev/vt/vt_sysmouse.c
  stable/9/sys/kern/tty.c
  stable/9/sys/modules/drm2/drm2/Makefile
  stable/9/sys/modules/drm2/i915kms/Makefile
  stable/9/sys/modules/drm2/radeonkms/Makefile
  stable/9/sys/sparc64/sparc64/machdep.c
  stable/9/sys/sys/consio.h
  stable/9/sys/sys/eventhandler.h
  stable/9/sys/sys/fbio.h
  stable/9/sys/sys/tty.h
  stable/9/sys/teken/demo/Makefile
  stable/9/sys/teken/demo/teken_demo.c
  stable/9/sys/teken/libteken/Symbol.map
  stable/9/sys/teken/stress/teken_stress.c
  stable/9/sys/teken/teken.c
  stable/9/sys/teken/teken.h
  stable/9/sys/teken/teken_subr.h
  stable/9/tools/tools/vt/mkkfont/mkkfont.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/modules/   (props changed)
  stable/9/sys/sys/   (props changed)
  stable/9/tools/tools/   (props changed)

Modified: stable/9/sys/conf/files
==
--- stable/9/sys/conf/files Thu Mar 27 14:07:36 2014(r263816)
+++ stable/9/sys/conf/files Thu Mar 27 15:58:18 2014(r263817)
@@ -87,7 +87,7 @@ pccarddevs.h  standard
   \
compile-with${AWK} -f $S/tools/pccarddevs2h.awk 
$S/dev/pccard/pccarddevs \
no-obj no-implicit-rule before-depend  \
clean   pccarddevs.h
-teken_state.h  optional sc\
+teken_state.h  optional sc | vt   \
dependency  $S/teken/gensequences $S/teken/sequences \
compile-with${AWK} -f $S/teken/gensequences $S/teken/sequences  
teken_state.h \
no-obj no-implicit-rule before-depend  \
@@ -1143,7 +1143,9 @@ dev/ex/if_ex_isa.coptional ex isa
 dev/ex/if_ex_pccard.c  optional ex pccard
 dev/exca/exca.coptional cbb
 dev/fatm/if_fatm.c optional fatm pci
-dev/fb/splash.coptional splash
+dev/fb/fbd.c   optional fbd | vt
+dev/fb/fb_if.m standard
+dev/fb/splash.coptional sc splash
 dev/fdt/fdt_common.c   optional fdt
 dev/fdt/fdt_pci.c  optional fdt pci
 dev/fdt/fdt_static_dtb.S   optional fdt fdt_dtb_static
@@ -2122,6 +2124,17 @@ dev/utopia/utopia.c  optional utopia
 dev/vge/if_vge.c   optional vge
 dev/vkbd/vkbd.coptional vkbd
 dev/vr/if_vr.c

svn commit: r263818 - stable/9/sys/sys

2014-03-27 Thread Aleksandr Rybalko
Author: ray
Date: Thu Mar 27 16:00:53 2014
New Revision: 263818
URL: http://svnweb.freebsd.org/changeset/base/263818

Log:
  Bump __FreeBSD_version to reflect presence ov vt(4).
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/sys/sys/param.h

Modified: stable/9/sys/sys/param.h
==
--- stable/9/sys/sys/param.hThu Mar 27 15:58:18 2014(r263817)
+++ stable/9/sys/sys/param.hThu Mar 27 16:00:53 2014(r263818)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 902509   /* Master, propagated to newvers */
+#define __FreeBSD_version 902510   /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Konstantin Belousov
On Thu, Mar 27, 2014 at 04:05:12PM +0100, Mateusz Guzik wrote:
 On Thu, Mar 27, 2014 at 03:58:19PM +0100, Mateusz Guzik wrote:
  On Thu, Mar 27, 2014 at 04:46:57PM +0800, David Xu wrote:
   On 2014/03/27 16:37, Mateusz Guzik wrote:
   On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
   I think the async process pointer can be cleared when a process exits
   by registering an event handler. please see attached patch.
   
   
   Sure, but I'm not very fond of this solution.
   
   This is a rather obscure bug you wont hit unless you explicitly try,
   and even then you need root privs by default.
   
   OK, but I don't like the bug exists in kernel. It is not obscure for me,
   I can run shutdown now command, and insert a device, and then the
   kernel will write garbage data into freed memory space.
   
  
  Not sure what you mean. devd does not use this feature, and even if it
  did async_proc is cleared on close, which happens while signal delivery
  is still legal.
  
  That said, you are not going to encounter this bug unless you code
  something up to specifically trigger it.
  
  fwiw, I think we could axe this feature if there was no way to fix it
  without introducing a check for every process.
  
   As such writing a callback function which will be executed for all 
   exiting
   processes seems unjustified for me.
   
   Ideally we would get some mechanism which would allow to register
   callbacks for events related to given entity. Then it could be used to
   provide a call this function when process p exits, amongst other 
   things.
   
   
   Yes, but the callback itself is cheap enough and is not worth to be
   per-entity entry.
   
  
  There is other code in the kernel which would benefit from such
  functionality - dev/syscons/scmouse, dev/vt/vt_core.c, aio and possibly
  more.
  
  As such I think this is worth pursuing.
  
 
 We can hack around this one the way the other code is doing - apart from
 from proc pointer you store pid and then compare result of pfind(pid).
 
 This is still buggy as both proc and pid pointer can be recycled and end
 up being the same (but you have an entrirely new process).
 
 However, then in absolutely worst cae you send SIGIO to incorrect
 process, always an existing process so no more corruption.
 
 Would you be ok with such hack for the time being?

Isn't p_sigiolist and fsetown(9) already provide the neccessary registration
and cleanup on the process exit ?  The KPI might require some generalization,
but I think that the mechanism itself is enough.


pgp8QUuUidTo7.pgp
Description: PGP signature


svn commit: r263819 - stable/9/release/doc/en_US.ISO8859-1/relnotes

2014-03-27 Thread Glen Barber
Author: gjb
Date: Thu Mar 27 16:28:46 2014
New Revision: 263819
URL: http://svnweb.freebsd.org/changeset/base/263819

Log:
  Document r263817, r263818.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml

Modified: stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml
==
--- stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu Mar 27 
16:00:53 2014(r263818)
+++ stable/9/release/doc/en_US.ISO8859-1/relnotes/article.xml   Thu Mar 27 
16:28:46 2014(r263819)
@@ -265,6 +265,9 @@
   para revision=263408A memory leak has been fixed in
literallibzfs/literal./para
 
+  para revision=263817,263818The literalvt/literal driver
+   has been merged from literalhead//literal./para
+
   sect3 xml:id=boot
titleBoot Loader Changes/title
 
___
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-unsubscr...@freebsd.org


svn commit: r263820 - in stable/10: sys/kern sys/sys tests/sys/kern

2014-03-27 Thread Alan Somers
Author: asomers
Date: Thu Mar 27 16:47:35 2014
New Revision: 263820
URL: http://svnweb.freebsd.org/changeset/base/263820

Log:
  MFC r262867
  
  Fix PR kern/185813 SOCK_SEQPACKET AF_UNIX sockets with asymmetrical buffers
  drop packets.  It was caused by a check for the space available in a
  sockbuf, but it was checking the wrong sockbuf.
  
  sys/sys/sockbuf.h
  sys/kern/uipc_sockbuf.c
Add sbappendaddr_nospacecheck_locked(), which is just like
sbappendaddr_locked but doesn't validate the receiving socket's space.
Factor out common code into sbappendaddr_locked_internal().  We
shouldn't simply make sbappendaddr_locked check the space and then call
sbappendaddr_nospacecheck_locked, because that would cause the O(n)
function m_length to be called twice.
  
  sys/kern/uipc_usrreq.c
Use sbappendaddr_nospacecheck_locked for SOCK_SEQPACKET sockets,
because the receiving sockbuf's size limit is irrelevant.
  
  tests/sys/kern/unix_seqpacket_test.c
Now that 185813 is fixed, pipe_128k_8k fails intermittently due to
185812.  Make it fail every time by adding a usleep after starting the
writer thread and before starting the reader thread in test_pipe.  That
gives the writer time to fill up its send buffer.  Also, clear the
expected failure message due to 185813.  It actually said 185812, but
that was a typo.
  
  PR:   kern/185813

Modified:
  stable/10/sys/kern/uipc_sockbuf.c
  stable/10/sys/kern/uipc_usrreq.c
  stable/10/sys/sys/sockbuf.h
  stable/10/tests/sys/kern/unix_seqpacket_test.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/uipc_sockbuf.c
==
--- stable/10/sys/kern/uipc_sockbuf.c   Thu Mar 27 16:28:46 2014
(r263819)
+++ stable/10/sys/kern/uipc_sockbuf.c   Thu Mar 27 16:47:35 2014
(r263820)
@@ -620,29 +620,12 @@ sbappendrecord(struct sockbuf *sb, struc
SOCKBUF_UNLOCK(sb);
 }
 
-/*
- * Append address and data, and optionally, control (ancillary) data to the
- * receive queue of a socket.  If present, m0 must include a packet header
- * with total length.  Returns 0 if no space in sockbuf or insufficient
- * mbufs.
- */
-int
-sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,
-struct mbuf *m0, struct mbuf *control)
+/* Helper routine that appends data, control, and address to a sockbuf. */
+static int
+sbappendaddr_locked_internal(struct sockbuf *sb, const struct sockaddr *asa,
+struct mbuf *m0, struct mbuf *control, struct mbuf *ctrl_last)
 {
struct mbuf *m, *n, *nlast;
-   int space = asa-sa_len;
-
-   SOCKBUF_LOCK_ASSERT(sb);
-
-   if (m0  (m0-m_flags  M_PKTHDR) == 0)
-   panic(sbappendaddr_locked);
-   if (m0)
-   space += m0-m_pkthdr.len;
-   space += m_length(control, n);
-
-   if (space  sbspace(sb))
-   return (0);
 #if MSIZE = 256
if (asa-sa_len  MLEN)
return (0);
@@ -652,8 +635,8 @@ sbappendaddr_locked(struct sockbuf *sb, 
return (0);
m-m_len = asa-sa_len;
bcopy(asa, mtod(m, caddr_t), asa-sa_len);
-   if (n)
-   n-m_next = m0; /* concatenate data to control */
+   if (ctrl_last)
+   ctrl_last-m_next = m0; /* concatenate data to control */
else
control = m0;
m-m_next = control;
@@ -677,6 +660,50 @@ sbappendaddr_locked(struct sockbuf *sb, 
  * mbufs.
  */
 int
+sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,
+struct mbuf *m0, struct mbuf *control)
+{
+   struct mbuf *ctrl_last;
+   int space = asa-sa_len;
+
+   SOCKBUF_LOCK_ASSERT(sb);
+
+   if (m0  (m0-m_flags  M_PKTHDR) == 0)
+   panic(sbappendaddr_locked);
+   if (m0)
+   space += m0-m_pkthdr.len;
+   space += m_length(control, ctrl_last);
+
+   if (space  sbspace(sb))
+   return (0);
+   return (sbappendaddr_locked_internal(sb, asa, m0, control, ctrl_last));
+}
+
+/*
+ * Append address and data, and optionally, control (ancillary) data to the
+ * receive queue of a socket.  If present, m0 must include a packet header
+ * with total length.  Returns 0 if insufficient mbufs.  Does not validate 
space
+ * on the receiving sockbuf.
+ */
+int
+sbappendaddr_nospacecheck_locked(struct sockbuf *sb, const struct sockaddr 
*asa,
+struct mbuf *m0, struct mbuf *control)
+{
+   struct mbuf *ctrl_last;
+
+   SOCKBUF_LOCK_ASSERT(sb);
+
+   ctrl_last = (control == NULL) ? NULL : m_last(control);
+   return (sbappendaddr_locked_internal(sb, asa, m0, control, ctrl_last));
+}
+
+/*
+ * Append address and data, and optionally, control (ancillary) data to the
+ * receive queue of a socket.  If present, m0 must include a packet header
+ * with total length.  Returns 0 if no space in 

svn commit: r263821 - in stable/9/sys: amd64/conf i386/conf

2014-03-27 Thread Glen Barber
Author: gjb
Date: Thu Mar 27 16:55:12 2014
New Revision: 263821
URL: http://svnweb.freebsd.org/changeset/base/263821

Log:
  Pull in the VT kernel configuration files, missed in r263817
  (MFC r260888).
  
  This is a direct commit to stable/9, and the original mergeinfo
  already exists.
  
  Sponsored by: The FreeBSD Foundation

Added:
  stable/9/sys/amd64/conf/VT
 - copied unchanged from r260888, head/sys/amd64/conf/VT
  stable/9/sys/i386/conf/VT
 - copied unchanged from r260888, head/sys/i386/conf/VT

Copied: stable/9/sys/amd64/conf/VT (from r260888, head/sys/amd64/conf/VT)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/sys/amd64/conf/VT  Thu Mar 27 16:55:12 2014(r263821, copy 
of r260888, head/sys/amd64/conf/VT)
@@ -0,0 +1,14 @@
+# VT -- kernel config using the vt(9) system console instead of legacy syscons
+#  
+# For more information see https://wiki.freebsd.org/Newcons
+#
+# $FreeBSD$
+
+includeGENERIC
+ident  VT
+
+nodevice   sc
+nodevice   vga
+
+device vt
+device vt_vga

Copied: stable/9/sys/i386/conf/VT (from r260888, head/sys/i386/conf/VT)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/sys/i386/conf/VT   Thu Mar 27 16:55:12 2014(r263821, copy 
of r260888, head/sys/i386/conf/VT)
@@ -0,0 +1,14 @@
+# VT -- kernel config using the vt(9) system console instead of legacy syscons
+#  
+# For more information see https://wiki.freebsd.org/Newcons
+#
+# $FreeBSD$
+
+includeGENERIC
+ident  VT
+
+nodevice   sc
+nodevice   vga
+
+device vt
+device vt_vga
___
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-unsubscr...@freebsd.org


Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread Warner Losh
Why not have this ‘opt out’ rather than ‘opt in’ like it is now? Are there any 
known bad dependencies this introduces?

Warner

On Mar 26, 2014, at 4:30 PM, Dimitry Andric d...@freebsd.org wrote:

 Author: dim
 Date: Wed Mar 26 22:30:38 2014
 New Revision: 263778
 URL: http://svnweb.freebsd.org/changeset/base/263778
 
 Log:
  Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
  all the SUBDIR entries in parallel, instead of serially.  Apply this
  option to a selected number of Makefiles, which can greatly speed up the
  build on multi-core machines, when using make -j.
 
  This can be extended to more Makefiles later on, whenever they are
  verified to work correctly with parallel building.
 
  I tested this on a 24-core machine, with make -j48 buildworld (N = 6):
 
  beforestddev   afterstddev
  ===   ==   ===  ==
  real time1741.1 16.5 959.8 2.7
  user time   12468.7 16.4   14393.016.8
  sys  time1825.0 54.82110.622.8
 
  (user+sys)/real 8.2   17.1
 
  E.g. the build was approximately 45% faster in real time.  On machines
  with less cores, or with lower -j settings, the speedup will not be as
  impressive.  But at least you can now almost max out a machine with
  buildworld!
 
  Submitted by:jilles
  MFC after:   2 weeks
 
 Modified:
  head/bin/Makefile
  head/lib/Makefile
  head/lib/clang/Makefile
  head/sbin/Makefile
  head/share/mk/bsd.subdir.mk
  head/usr.bin/Makefile
  head/usr.sbin/Makefile
 
 Modified: head/bin/Makefile
 ==
 --- head/bin/Makefile Wed Mar 26 20:43:40 2014(r263777)
 +++ head/bin/Makefile Wed Mar 26 22:30:38 2014(r263778)
 @@ -60,4 +60,6 @@ SUBDIR+=tests
 
 SUBDIR:=  ${SUBDIR:O}
 
 +SUBDIR_PARALLEL=
 +
 .include bsd.subdir.mk
 
 Modified: head/lib/Makefile
 ==
 --- head/lib/Makefile Wed Mar 26 20:43:40 2014(r263777)
 +++ head/lib/Makefile Wed Mar 26 22:30:38 2014(r263778)
 @@ -276,4 +276,8 @@ afterinstall:
   ${INSTALL_SYMLINK} ../include ${DESTDIR}/usr/lib/include
 .endif
 
 +.if !make(install)
 +SUBDIR_PARALLEL=
 +.endif
 +
 .include bsd.subdir.mk
 
 Modified: head/lib/clang/Makefile
 ==
 --- head/lib/clang/Makefile   Wed Mar 26 20:43:40 2014(r263777)
 +++ head/lib/clang/Makefile   Wed Mar 26 22:30:38 2014(r263778)
 @@ -147,4 +147,6 @@ SUBDIR+=liblldb \
 
 SUBDIR+= include
 
 +SUBDIR_PARALLEL=
 +
 .include bsd.subdir.mk
 
 Modified: head/sbin/Makefile
 ==
 --- head/sbin/MakefileWed Mar 26 20:43:40 2014(r263777)
 +++ head/sbin/MakefileWed Mar 26 22:30:38 2014(r263778)
 @@ -126,4 +126,6 @@ SUBDIR+=  tests
 
 SUBDIR:=  ${SUBDIR:O}
 
 +SUBDIR_PARALLEL=
 +
 .include bsd.subdir.mk
 
 Modified: head/share/mk/bsd.subdir.mk
 ==
 --- head/share/mk/bsd.subdir.mk   Wed Mar 26 20:43:40 2014
 (r263777)
 +++ head/share/mk/bsd.subdir.mk   Wed Mar 26 22:30:38 2014
 (r263778)
 @@ -71,7 +71,26 @@ ${SUBDIR}: .PHONY .MAKE
 .for __target in all all-man checkdpadd clean cleandepend cleandir \
 cleanilinks depend distribute lint maninstall manlint obj objlink \
 realinstall regress tags ${SUBDIR_TARGETS}
 +.ifdef SUBDIR_PARALLEL
 +.for __dir in ${SUBDIR}
 +${__target}: ${__target}_subdir_${__dir}
 +${__target}_subdir_${__dir}: .MAKE
 + @${_+_}set -e; \
 + if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
 + ${ECHODIR} === ${DIRPRFX}${__dir}.${MACHINE_ARCH} 
 (${__target:realinstall=install}); \
 + edir=${__dir}.${MACHINE_ARCH}; \
 + cd ${.CURDIR}/$${edir}; \
 + else \
 + ${ECHODIR} === ${DIRPRFX}${__dir} 
 (${__target:realinstall=install}); \
 + edir=${__dir}; \
 + cd ${.CURDIR}/$${edir}; \
 + fi; \
 + ${MAKE} ${__target:realinstall=install} \
 + DIRPRFX=${DIRPRFX}$$edir/
 +.endfor
 +.else
 ${__target}: _SUBDIR
 +.endif
 .endfor
 
 .for __target in files includes
 
 Modified: head/usr.bin/Makefile
 ==
 --- head/usr.bin/Makefile Wed Mar 26 20:43:40 2014(r263777)
 +++ head/usr.bin/Makefile Wed Mar 26 22:30:38 2014(r263778)
 @@ -379,4 +379,6 @@ SUBDIR+=  svn
 
 SUBDIR:=  ${SUBDIR:O}
 
 +SUBDIR_PARALLEL=
 +
 .include bsd.subdir.mk
 
 Modified: head/usr.sbin/Makefile
 

Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Warner Losh

On Mar 27, 2014, at 2:37 AM, Mateusz Guzik mjgu...@gmail.com wrote:

 On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
 I think the async process pointer can be cleared when a process exits
 by registering an event handler. please see attached patch.
 
 
 Sure, but I'm not very fond of this solution.
 
 This is a rather obscure bug you wont hit unless you explicitly try,
 and even then you need root privs by default.
 
 As such writing a callback function which will be executed for all exiting
 processes seems unjustified for me.
 
 Ideally we would get some mechanism which would allow to register
 callbacks for events related to given entity. Then it could be used to
 provide a call this function when process p exits, amongst other things.

I’m wondering why the FD isn’t getting closed and the close() routine being 
called
which should clear this pointer. Since we can only ever have one opener, we
know the close will always be called.

What am I missing? Seems like an invented non-issue.

Warner

___
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-unsubscr...@freebsd.org


Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread Ian Lepore
It's also a bit odd that the way of opting in makes it appear as if
you're opting out.

-- Ian

On Thu, 2014-03-27 at 11:05 -0600, Warner Losh wrote:
 Why not have this ‘opt out’ rather than ‘opt in’ like it is now? Are there 
 any known bad dependencies this introduces?
 
 Warner
 
 On Mar 26, 2014, at 4:30 PM, Dimitry Andric d...@freebsd.org wrote:
 
  Author: dim
  Date: Wed Mar 26 22:30:38 2014
  New Revision: 263778
  URL: http://svnweb.freebsd.org/changeset/base/263778
  
  Log:
   Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
   all the SUBDIR entries in parallel, instead of serially.  Apply this
   option to a selected number of Makefiles, which can greatly speed up the
   build on multi-core machines, when using make -j.
  
   This can be extended to more Makefiles later on, whenever they are
   verified to work correctly with parallel building.
  
   I tested this on a 24-core machine, with make -j48 buildworld (N = 6):
  
   beforestddev   afterstddev
   ===   ==   ===  ==
   real time1741.1 16.5 959.8 2.7
   user time   12468.7 16.4   14393.016.8
   sys  time1825.0 54.82110.622.8
  
   (user+sys)/real 8.2   17.1
  
   E.g. the build was approximately 45% faster in real time.  On machines
   with less cores, or with lower -j settings, the speedup will not be as
   impressive.  But at least you can now almost max out a machine with
   buildworld!
  
   Submitted by:  jilles
   MFC after: 2 weeks
  
  Modified:
   head/bin/Makefile
   head/lib/Makefile
   head/lib/clang/Makefile
   head/sbin/Makefile
   head/share/mk/bsd.subdir.mk
   head/usr.bin/Makefile
   head/usr.sbin/Makefile
  
  Modified: head/bin/Makefile
  ==
  --- head/bin/Makefile   Wed Mar 26 20:43:40 2014(r263777)
  +++ head/bin/Makefile   Wed Mar 26 22:30:38 2014(r263778)
  @@ -60,4 +60,6 @@ SUBDIR+=  tests
  
  SUBDIR:=${SUBDIR:O}
  
  +SUBDIR_PARALLEL=
  +
  .include bsd.subdir.mk
  
  Modified: head/lib/Makefile
  ==
  --- head/lib/Makefile   Wed Mar 26 20:43:40 2014(r263777)
  +++ head/lib/Makefile   Wed Mar 26 22:30:38 2014(r263778)
  @@ -276,4 +276,8 @@ afterinstall:
  ${INSTALL_SYMLINK} ../include ${DESTDIR}/usr/lib/include
  .endif
  
  +.if !make(install)
  +SUBDIR_PARALLEL=
  +.endif
  +
  .include bsd.subdir.mk
  
  Modified: head/lib/clang/Makefile
  ==
  --- head/lib/clang/Makefile Wed Mar 26 20:43:40 2014(r263777)
  +++ head/lib/clang/Makefile Wed Mar 26 22:30:38 2014(r263778)
  @@ -147,4 +147,6 @@ SUBDIR+=liblldb \
  
  SUBDIR+= include
  
  +SUBDIR_PARALLEL=
  +
  .include bsd.subdir.mk
  
  Modified: head/sbin/Makefile
  ==
  --- head/sbin/Makefile  Wed Mar 26 20:43:40 2014(r263777)
  +++ head/sbin/Makefile  Wed Mar 26 22:30:38 2014(r263778)
  @@ -126,4 +126,6 @@ SUBDIR+=tests
  
  SUBDIR:=${SUBDIR:O}
  
  +SUBDIR_PARALLEL=
  +
  .include bsd.subdir.mk
  
  Modified: head/share/mk/bsd.subdir.mk
  ==
  --- head/share/mk/bsd.subdir.mk Wed Mar 26 20:43:40 2014
  (r263777)
  +++ head/share/mk/bsd.subdir.mk Wed Mar 26 22:30:38 2014
  (r263778)
  @@ -71,7 +71,26 @@ ${SUBDIR}: .PHONY .MAKE
  .for __target in all all-man checkdpadd clean cleandepend cleandir \
  cleanilinks depend distribute lint maninstall manlint obj objlink \
  realinstall regress tags ${SUBDIR_TARGETS}
  +.ifdef SUBDIR_PARALLEL
  +.for __dir in ${SUBDIR}
  +${__target}: ${__target}_subdir_${__dir}
  +${__target}_subdir_${__dir}: .MAKE
  +   @${_+_}set -e; \
  +   if test -d ${.CURDIR}/${__dir}.${MACHINE_ARCH}; then \
  +   ${ECHODIR} === ${DIRPRFX}${__dir}.${MACHINE_ARCH} 
  (${__target:realinstall=install}); \
  +   edir=${__dir}.${MACHINE_ARCH}; \
  +   cd ${.CURDIR}/$${edir}; \
  +   else \
  +   ${ECHODIR} === ${DIRPRFX}${__dir} 
  (${__target:realinstall=install}); \
  +   edir=${__dir}; \
  +   cd ${.CURDIR}/$${edir}; \
  +   fi; \
  +   ${MAKE} ${__target:realinstall=install} \
  +   DIRPRFX=${DIRPRFX}$$edir/
  +.endfor
  +.else
  ${__target}: _SUBDIR
  +.endif
  .endfor
  
  .for __target in files includes
  
  Modified: head/usr.bin/Makefile
  ==
  --- head/usr.bin/Makefile   Wed Mar 26 20:43:40 2014(r263777)
  +++ head/usr.bin/Makefile   

Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread Jilles Tjoelker
On Thu, Mar 27, 2014 at 11:05:00AM -0600, Warner Losh wrote:
 On Mar 26, 2014, at 4:30 PM, Dimitry Andric d...@freebsd.org wrote:
  Author: dim
  Date: Wed Mar 26 22:30:38 2014
  New Revision: 263778
  URL: http://svnweb.freebsd.org/changeset/base/263778

  Log:
   Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
   all the SUBDIR entries in parallel, instead of serially.  Apply this
   option to a selected number of Makefiles, which can greatly speed up the
   build on multi-core machines, when using make -j.

   This can be extended to more Makefiles later on, whenever they are
   verified to work correctly with parallel building.

 Why not have this ‘opt out’ rather than ‘opt in’ like it is now? Are
 there any known bad dependencies this introduces?

I'm paranoid about build systems ;) It is easy to add dependencies
across directories and as long as directories are built in sequence,
nothing goes wrong.

In fact, I had enabled SUBDIR_PARALLEL in sys/modules/Makefile as well,
but this caused mysterious failures with some kernels such as mips
ADM5120.

-- 
Jilles Tjoelker
___
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-unsubscr...@freebsd.org

svn commit: r263822 - in head/sys/amd64: amd64 include

2014-03-27 Thread Ed Maste
Author: emaste
Date: Thu Mar 27 18:23:02 2014
New Revision: 263822
URL: http://svnweb.freebsd.org/changeset/base/263822

Log:
  amd64: Parse the EFI memory map if present
  
  With this change (and loader.efi from the projects/uefi branch) we can now
  boot under qemu using the OVMF UEFI firmware image with the limitation
  that a serial console is required.
  
  (This is largely r246337 from the projects/uefi branch.)
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/include/metadata.h

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Thu Mar 27 16:55:12 2014
(r263821)
+++ head/sys/amd64/amd64/machdep.c  Thu Mar 27 18:23:02 2014
(r263822)
@@ -63,6 +63,7 @@ __FBSDID($FreeBSD$);
 #include sys/callout.h
 #include sys/cons.h
 #include sys/cpu.h
+#include sys/efi.h
 #include sys/eventhandler.h
 #include sys/exec.h
 #include sys/imgact.h
@@ -1431,10 +1432,105 @@ bios_add_smap_entries(struct bios_smap *
}
 }
 
+#define efi_next_descriptor(ptr, size) \
+   ((struct efi_md *)(((uint8_t *) ptr) + size))
+
+static void
+add_efi_map_entries(struct efi_map_header *efihdr, vm_paddr_t *physmap,
+int *physmap_idx)
+{
+   struct efi_md *map, *p;
+   const char *type;
+   size_t efisz;
+   int ndesc, i;
+
+   static const char *types[] = {
+   Reserved,
+   LoaderCode,
+   LoaderData,
+   BootServicesCode,
+   BootServicesData,
+   RuntimeServicesCode,
+   RuntimeServicesData,
+   ConventionalMemory,
+   UnusableMemory,
+   ACPIReclaimMemory,
+   ACPIMemoryNVS,
+   MemoryMappedIO,
+   MemoryMappedIOPortSpace,
+   PalCode
+   };
+
+   /*
+* Memory map data provided by UEFI via the GetMemoryMap
+* Boot Services API.
+*/
+   efisz = (sizeof(struct efi_map_header) + 0xf)  ~0xf;
+   map = (struct efi_md *)((uint8_t *)efihdr + efisz); 
+
+   if (efihdr-descriptor_size == 0)
+   return;
+   ndesc = efihdr-memory_size / efihdr-descriptor_size;
+
+   if (boothowto  RB_VERBOSE)
+   printf(%23s %12s %12s %8s %4s\n,
+   Type, Physical, Virtual, #Pages, Attr);
+
+   for (i = 0, p = map; i  ndesc; i++,
+   p = efi_next_descriptor(p, efihdr-descriptor_size)) {
+   if (boothowto  RB_VERBOSE) {
+   if (p-md_type = EFI_MD_TYPE_PALCODE)
+   type = types[p-md_type];
+   else
+   type = INVALID;
+   printf(%23s %012lx %12p %08lx , type, p-md_phys,
+   p-md_virt, p-md_pages);
+   if (p-md_attr  EFI_MD_ATTR_UC)
+   printf(UC );
+   if (p-md_attr  EFI_MD_ATTR_WC)
+   printf(WC );
+   if (p-md_attr  EFI_MD_ATTR_WT)
+   printf(WT );
+   if (p-md_attr  EFI_MD_ATTR_WB)
+   printf(WB );
+   if (p-md_attr  EFI_MD_ATTR_UCE)
+   printf(UCE );
+   if (p-md_attr  EFI_MD_ATTR_WP)
+   printf(WP );
+   if (p-md_attr  EFI_MD_ATTR_RP)
+   printf(RP );
+   if (p-md_attr  EFI_MD_ATTR_XP)
+   printf(XP );
+   if (p-md_attr  EFI_MD_ATTR_RT)
+   printf(RUNTIME);
+   printf(\n);
+   }
+
+   switch (p-md_type) {
+   case EFI_MD_TYPE_CODE:
+   case EFI_MD_TYPE_DATA:
+   case EFI_MD_TYPE_BS_CODE:
+   case EFI_MD_TYPE_BS_DATA:
+   case EFI_MD_TYPE_FREE:
+   /*
+* We're allowed to use any entry with these types.
+*/
+   break;
+   default:
+   continue;
+   }
+
+   if (!add_physmap_entry(p-md_phys, (p-md_pages * PAGE_SIZE),
+   physmap, physmap_idx))
+   break;
+   }
+}
+
 static void
 native_parse_memmap(caddr_t kmdp, vm_paddr_t *physmap, int *physmap_idx)
 {
struct bios_smap *smap;
+   struct efi_map_header *efihdr;
u_int32_t size;
 
/*
@@ -1445,13 +1541,19 @@ native_parse_memmap(caddr_t kmdp, vm_pad
 * ie: an int32_t immediately precedes smap.
 */
 
+   efihdr = (struct efi_map_header *)preload_search_info(kmdp,
+   MODINFO_METADATA | MODINFOMD_EFI_MAP);
smap = 

Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Mateusz Guzik
On Thu, Mar 27, 2014 at 11:08:34AM -0600, Warner Losh wrote:
 
 On Mar 27, 2014, at 2:37 AM, Mateusz Guzik mjgu...@gmail.com wrote:
 
  On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
  I think the async process pointer can be cleared when a process exits
  by registering an event handler. please see attached patch.
  
  
  Sure, but I'm not very fond of this solution.
  
  This is a rather obscure bug you wont hit unless you explicitly try,
  and even then you need root privs by default.
  
  As such writing a callback function which will be executed for all exiting
  processes seems unjustified for me.
  
  Ideally we would get some mechanism which would allow to register
  callbacks for events related to given entity. Then it could be used to
  provide a call this function when process p exits, amongst other things.
 
 I’m wondering why the FD isn’t getting closed and the close() routine being 
 called
 which should clear this pointer. Since we can only ever have one opener, we
 know the close will always be called.
 
 What am I missing? Seems like an invented non-issue.
 

This happens if you set yourself as async_proc and fork (so the child has the
fd as well) or pass the fd to some other process before exiting.

As was noted, this is not the case with devd so no rush.

-- 
Mateusz Guzik mjguzik gmail.com
___
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-unsubscr...@freebsd.org

svn commit: r263823 - in stable/9/sys: kern sys

2014-03-27 Thread Alan Somers
Author: asomers
Date: Thu Mar 27 19:04:15 2014
New Revision: 263823
URL: http://svnweb.freebsd.org/changeset/base/263823

Log:
  MFC r258311
  
opensolaris/uts/common/dtrace/fasttrap.c
Fix several problems that can cause panics on kldload and kldunload.
  
* kproc_create(fasttrap_pid_cleanup_cb, ...) gets called before
  fasttrap_provs.fth_table gets allocated.  This can lead to a panic
  on module load, because fasttrap_pid_cleanup_cb references
  fasttrap_provs.fth_table.  Move kproc_create down after the point
  that fasttrap_provs.fth_table gets allocated, and modify the error
  handling accordingly.
  
* dtrace_fasttrap_{fork,exec,exit} weren't getting NULLed until
  after fasttrap_provs.fth_table got freed.  That caused panics on
  module unload because fasttrap_exec_exit calls
  fasttrap_provider_retire, which references
  fasttrap_provs.fth_table.  NULL those function pointers earlier.
  
* There wasn't any code to destroy the
  fasttrap_{tpoints,provs,procs}.fth_table mutexes on module unload,
  leading to a resource leak when WITNESS is enabled.  Destroy those
  mutexes during fasttrap_unload().
  
  Sponsored by: Spectra Logic Corporation

Modified:
  stable/9/sys/kern/uipc_sockbuf.c
  stable/9/sys/kern/uipc_usrreq.c
  stable/9/sys/sys/sockbuf.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/kern/uipc_sockbuf.c
==
--- stable/9/sys/kern/uipc_sockbuf.cThu Mar 27 18:23:02 2014
(r263822)
+++ stable/9/sys/kern/uipc_sockbuf.cThu Mar 27 19:04:15 2014
(r263823)
@@ -617,29 +617,12 @@ sbappendrecord(struct sockbuf *sb, struc
SOCKBUF_UNLOCK(sb);
 }
 
-/*
- * Append address and data, and optionally, control (ancillary) data to the
- * receive queue of a socket.  If present, m0 must include a packet header
- * with total length.  Returns 0 if no space in sockbuf or insufficient
- * mbufs.
- */
-int
-sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,
-struct mbuf *m0, struct mbuf *control)
+/* Helper routine that appends data, control, and address to a sockbuf. */
+static int
+sbappendaddr_locked_internal(struct sockbuf *sb, const struct sockaddr *asa,
+struct mbuf *m0, struct mbuf *control, struct mbuf *ctrl_last)
 {
struct mbuf *m, *n, *nlast;
-   int space = asa-sa_len;
-
-   SOCKBUF_LOCK_ASSERT(sb);
-
-   if (m0  (m0-m_flags  M_PKTHDR) == 0)
-   panic(sbappendaddr_locked);
-   if (m0)
-   space += m0-m_pkthdr.len;
-   space += m_length(control, n);
-
-   if (space  sbspace(sb))
-   return (0);
 #if MSIZE = 256
if (asa-sa_len  MLEN)
return (0);
@@ -649,8 +632,8 @@ sbappendaddr_locked(struct sockbuf *sb, 
return (0);
m-m_len = asa-sa_len;
bcopy(asa, mtod(m, caddr_t), asa-sa_len);
-   if (n)
-   n-m_next = m0; /* concatenate data to control */
+   if (ctrl_last)
+   ctrl_last-m_next = m0; /* concatenate data to control */
else
control = m0;
m-m_next = control;
@@ -674,6 +657,50 @@ sbappendaddr_locked(struct sockbuf *sb, 
  * mbufs.
  */
 int
+sbappendaddr_locked(struct sockbuf *sb, const struct sockaddr *asa,
+struct mbuf *m0, struct mbuf *control)
+{
+   struct mbuf *ctrl_last;
+   int space = asa-sa_len;
+
+   SOCKBUF_LOCK_ASSERT(sb);
+
+   if (m0  (m0-m_flags  M_PKTHDR) == 0)
+   panic(sbappendaddr_locked);
+   if (m0)
+   space += m0-m_pkthdr.len;
+   space += m_length(control, ctrl_last);
+
+   if (space  sbspace(sb))
+   return (0);
+   return (sbappendaddr_locked_internal(sb, asa, m0, control, ctrl_last));
+}
+
+/*
+ * Append address and data, and optionally, control (ancillary) data to the
+ * receive queue of a socket.  If present, m0 must include a packet header
+ * with total length.  Returns 0 if insufficient mbufs.  Does not validate 
space
+ * on the receiving sockbuf.
+ */
+int
+sbappendaddr_nospacecheck_locked(struct sockbuf *sb, const struct sockaddr 
*asa,
+struct mbuf *m0, struct mbuf *control)
+{
+   struct mbuf *ctrl_last;
+
+   SOCKBUF_LOCK_ASSERT(sb);
+
+   ctrl_last = (control == NULL) ? NULL : m_last(control);
+   return (sbappendaddr_locked_internal(sb, asa, m0, control, ctrl_last));
+}
+
+/*
+ * Append address and data, and optionally, control (ancillary) data to the
+ * receive queue of a socket.  If present, m0 must include a packet header
+ * with total length.  Returns 0 if no space in sockbuf or insufficient
+ * mbufs.
+ */
+int
 sbappendaddr(struct sockbuf *sb, const 

svn commit: r263826 - in head/sys: amd64/include dev/vt/hw/efifb

2014-03-27 Thread Ed Maste
Author: emaste
Date: Thu Mar 27 19:43:38 2014
New Revision: 263826
URL: http://svnweb.freebsd.org/changeset/base/263826

Log:
  Update EFI framebuffer handoff from loader
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/amd64/include/metadata.h
  head/sys/dev/vt/hw/efifb/efifb.c

Modified: head/sys/amd64/include/metadata.h
==
--- head/sys/amd64/include/metadata.h   Thu Mar 27 19:16:28 2014
(r263825)
+++ head/sys/amd64/include/metadata.h   Thu Mar 27 19:43:38 2014
(r263826)
@@ -33,11 +33,24 @@
 #defineMODINFOMD_SMAP_XATTR0x1002
 #defineMODINFOMD_DTBP  0x1003
 #defineMODINFOMD_EFI_MAP   0x1004
+#defineMODINFOMD_EFI_FB0x1005
 
-struct efi_map_header {
+struct efi_map_header {
size_t  memory_size;
size_t  descriptor_size;
uint32_tdescriptor_version;
 };
 
+struct efi_fb {
+   uint64_tfb_addr;
+   uint64_tfb_size;
+   int fb_height;
+   int fb_width;
+   int fb_stride;
+   uint32_tfb_mask_red;
+   uint32_tfb_mask_green;
+   uint32_tfb_mask_blue;
+   uint32_tfb_mask_reserved;
+};
+
 #endif /* !_MACHINE_METADATA_H_ */

Modified: head/sys/dev/vt/hw/efifb/efifb.c
==
--- head/sys/dev/vt/hw/efifb/efifb.cThu Mar 27 19:16:28 2014
(r263825)
+++ head/sys/dev/vt/hw/efifb/efifb.cThu Mar 27 19:43:38 2014
(r263826)
@@ -40,7 +40,6 @@ __FBSDID($FreeBSD$);
 
 #include opt_platform.h
 
-#include machine/efi.h
 #include machine/metadata.h
 #include machine/vm.h
 #include machine/vmparam.h
@@ -85,8 +84,8 @@ vt_efb_init(struct vt_device *vd)
kmdp = preload_search_by_type(elf kernel);
if (kmdp == NULL)
kmdp = preload_search_by_type(elf64 kernel);
-efifb = (struct efi_fb *)preload_search_info(kmdp,
-MODINFO_METADATA | MODINFOMD_EFI_FB);
+   efifb = (struct efi_fb *)preload_search_info(kmdp,
+   MODINFO_METADATA | MODINFOMD_EFI_FB);
if (efifb == NULL)
return (CN_DEAD);
 
___
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-unsubscr...@freebsd.org


Re: svn commit: r263778 - in head: bin lib lib/clang sbin share/mk usr.bin usr.sbin

2014-03-27 Thread Dimitry Andric
On 27 Mar 2014, at 19:12, Jilles Tjoelker jil...@stack.nl wrote:
 On Thu, Mar 27, 2014 at 11:05:00AM -0600, Warner Losh wrote:
 On Mar 26, 2014, at 4:30 PM, Dimitry Andric d...@freebsd.org wrote:
 Author: dim
 Date: Wed Mar 26 22:30:38 2014
 New Revision: 263778
 URL: http://svnweb.freebsd.org/changeset/base/263778
 
 Log:
 Add a SUBDIR_PARALLEL option to bsd.subdir.mk, to allow make to process
 all the SUBDIR entries in parallel, instead of serially.  Apply this
 option to a selected number of Makefiles, which can greatly speed up the
 build on multi-core machines, when using make -j.
 
 This can be extended to more Makefiles later on, whenever they are
 verified to work correctly with parallel building.
 
 Why not have this ‘opt out’ rather than ‘opt in’ like it is now? Are
 there any known bad dependencies this introduces?
 
 I'm paranoid about build systems ;) It is easy to add dependencies
 across directories and as long as directories are built in sequence,
 nothing goes wrong.
 
 In fact, I had enabled SUBDIR_PARALLEL in sys/modules/Makefile as well,
 but this caused mysterious failures with some kernels such as mips
 ADM5120.

There are a bunch of other parts that don't really like parallel builds
at the moment.  For example, gnu/usr.bin/binutils needs its libraries
(libbfd.a, etc) built first, before it can link the programs.  Similar
for gnu/usr.bin/cc, which needs libiberty, libcpp, etc before being able
to build the rest of gcc.

Most of these cases can hopefully be solved by adding .WAIT targets at
strategic points in the SUBDIR lists, but this also needs a bit of extra
logic in bsd.subdir.mk.

-Dimitry
 


signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r263830 - stable/10/libexec/bootpd/tools/bootptest

2014-03-27 Thread Christian Brueffer
Author: brueffer
Date: Thu Mar 27 20:13:53 2014
New Revision: 263830
URL: http://svnweb.freebsd.org/changeset/base/263830

Log:
  MFC: r263121
  
  Re-format the license to conform to our BSD license template as much
  as possible.  This does not change the wording in any way.
  
  Remove the 3rd clause (advertising clause) of the BSD license as
  permitted by the University of Berkeley on July 22, 1999.  While the
  clause itself mentions Lawrence Berkeley Laboratory, UCB is the sole
  copyright holder of this file.
  
  Reviewed by:  imp, emaste, eadler

Modified:
  stable/10/libexec/bootpd/tools/bootptest/print-bootp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/bootpd/tools/bootptest/print-bootp.c
==
--- stable/10/libexec/bootpd/tools/bootptest/print-bootp.c  Thu Mar 27 
20:10:26 2014(r263829)
+++ stable/10/libexec/bootpd/tools/bootptest/print-bootp.c  Thu Mar 27 
20:13:53 2014(r263830)
@@ -1,19 +1,18 @@
 /*
- * Copyright (c) 1988-1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988-1990
+ *  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: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' 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.
+ * modification, are permitted provided that:
+ * 1. Source code distributions retain the above copyright
+ *notice and this paragraph in its entirety
+ * 2. Distributions including binary code include the above copyright
+ *notice and this paragraph in its entirety in the documentation
+ *or other materials provided with the distribution, and 
+ * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
___
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-unsubscr...@freebsd.org


svn commit: r263832 - stable/9/libexec/bootpd/tools/bootptest

2014-03-27 Thread Christian Brueffer
Author: brueffer
Date: Thu Mar 27 20:14:50 2014
New Revision: 263832
URL: http://svnweb.freebsd.org/changeset/base/263832

Log:
  MFC: r263121
  
  Re-format the license to conform to our BSD license template as much
  as possible.  This does not change the wording in any way.
  
  Remove the 3rd clause (advertising clause) of the BSD license as
  permitted by the University of Berkeley on July 22, 1999.  While the
  clause itself mentions Lawrence Berkeley Laboratory, UCB is the sole
  copyright holder of this file.
  
  Reviewed by:imp, emaste, eadler

Modified:
  stable/9/libexec/bootpd/tools/bootptest/print-bootp.c
Directory Properties:
  stable/9/libexec/bootpd/   (props changed)

Modified: stable/9/libexec/bootpd/tools/bootptest/print-bootp.c
==
--- stable/9/libexec/bootpd/tools/bootptest/print-bootp.c   Thu Mar 27 
20:14:40 2014(r263831)
+++ stable/9/libexec/bootpd/tools/bootptest/print-bootp.c   Thu Mar 27 
20:14:50 2014(r263832)
@@ -1,19 +1,18 @@
 /*
- * Copyright (c) 1988-1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988-1990
+ *  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: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' 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.
+ * modification, are permitted provided that:
+ * 1. Source code distributions retain the above copyright
+ *notice and this paragraph in its entirety
+ * 2. Distributions including binary code include the above copyright
+ *notice and this paragraph in its entirety in the documentation
+ *or other materials provided with the distribution, and 
+ * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
___
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-unsubscr...@freebsd.org


svn commit: r263834 - stable/8/libexec/bootpd/tools/bootptest

2014-03-27 Thread Christian Brueffer
Author: brueffer
Date: Thu Mar 27 20:15:35 2014
New Revision: 263834
URL: http://svnweb.freebsd.org/changeset/base/263834

Log:
  MFC: r263121
  
  Re-format the license to conform to our BSD license template as much
  as possible.  This does not change the wording in any way.
  
  Remove the 3rd clause (advertising clause) of the BSD license as
  permitted by the University of Berkeley on July 22, 1999.  While the
  clause itself mentions Lawrence Berkeley Laboratory, UCB is the sole
  copyright holder of this file.
  
  Reviewed by:imp, emaste, eadler

Modified:
  stable/8/libexec/bootpd/tools/bootptest/print-bootp.c
Directory Properties:
  stable/8/libexec/bootpd/   (props changed)

Modified: stable/8/libexec/bootpd/tools/bootptest/print-bootp.c
==
--- stable/8/libexec/bootpd/tools/bootptest/print-bootp.c   Thu Mar 27 
20:15:33 2014(r263833)
+++ stable/8/libexec/bootpd/tools/bootptest/print-bootp.c   Thu Mar 27 
20:15:35 2014(r263834)
@@ -1,19 +1,18 @@
 /*
- * Copyright (c) 1988-1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1988-1990
+ *  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: (1) source code distributions
- * retain the above copyright notice and this paragraph in its entirety, (2)
- * distributions including binary code include the above copyright notice and
- * this paragraph in its entirety in the documentation or other materials
- * provided with the distribution, and (3) all advertising materials mentioning
- * features or use of this software display the following acknowledgement:
- * ``This product includes software developed by the University of California,
- * Lawrence Berkeley Laboratory and its contributors.'' 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.
+ * modification, are permitted provided that:
+ * 1. Source code distributions retain the above copyright
+ *notice and this paragraph in its entirety
+ * 2. Distributions including binary code include the above copyright
+ *notice and this paragraph in its entirety in the documentation
+ *or other materials provided with the distribution, and 
+ * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
___
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-unsubscr...@freebsd.org


svn commit: r263833 - in head: gnu/usr.bin usr.bin/clang

2014-03-27 Thread Dimitry Andric
Author: dim
Date: Thu Mar 27 20:15:33 2014
New Revision: 263833
URL: http://svnweb.freebsd.org/changeset/base/263833

Log:
  Enable parallel building for gnu/usr.bin and usr.bin/clang too.
  
  MFC after:2 weeks
  X-MFC-With:   r263778

Modified:
  head/gnu/usr.bin/Makefile
  head/usr.bin/clang/Makefile

Modified: head/gnu/usr.bin/Makefile
==
--- head/gnu/usr.bin/Makefile   Thu Mar 27 20:14:50 2014(r263832)
+++ head/gnu/usr.bin/Makefile   Thu Mar 27 20:15:33 2014(r263833)
@@ -46,4 +46,6 @@ _cc=  cc
 _gdb=  gdb
 .endif
 
+SUBDIR_PARALLEL=
+
 .include bsd.subdir.mk

Modified: head/usr.bin/clang/Makefile
==
--- head/usr.bin/clang/Makefile Thu Mar 27 20:14:50 2014(r263832)
+++ head/usr.bin/clang/Makefile Thu Mar 27 20:15:33 2014(r263833)
@@ -29,4 +29,6 @@ SUBDIR+=lldb
 .endif
 .endif # TOOLS_PREFIX
 
+SUBDIR_PARALLEL=
+
 .include bsd.subdir.mk
___
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-unsubscr...@freebsd.org


svn commit: r263835 - stable/10/usr.sbin/btxld

2014-03-27 Thread Christian Brueffer
Author: brueffer
Date: Thu Mar 27 20:19:11 2014
New Revision: 263835
URL: http://svnweb.freebsd.org/changeset/base/263835

Log:
  MFC: r262484
  
  In puthdr(), start the ELF .data section on a new page, as this is
  what btxldr expects (.set MEM_DATA,start+0x1000 in btxldr.S).
  
  This makes resulting ELF binaries bootable with grub, gptboot and boot2.
  
  PR:   153801
  Submitted by: Gleb Kurtsou gleb.kurtsou at gmail.com
  Tested by:Ruben Kerkhof ruben at rubenkerkhof.com
  Glanced at by:jhb, peter

Modified:
  stable/10/usr.sbin/btxld/btxld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/btxld/btxld.c
==
--- stable/10/usr.sbin/btxld/btxld.cThu Mar 27 20:15:35 2014
(r263834)
+++ stable/10/usr.sbin/btxld/btxld.cThu Mar 27 20:19:11 2014
(r263835)
@@ -426,7 +426,7 @@ puthdr(int fd, struct hdr *hdr)
le32toh(eh.p[0].p_filesz));
eh.p[1].p_vaddr = eh.p[1].p_paddr =
htole32(align(le32toh(eh.p[0].p_paddr) + le32toh(eh.p[0].p_memsz),
-   4));
+   4096));
eh.p[1].p_filesz = eh.p[1].p_memsz = htole32(hdr-data);
eh.sh[2].sh_addr = eh.p[0].p_vaddr;
eh.sh[2].sh_offset = eh.p[0].p_offset;
___
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-unsubscr...@freebsd.org


svn commit: r263836 - stable/9/usr.sbin/btxld

2014-03-27 Thread Christian Brueffer
Author: brueffer
Date: Thu Mar 27 20:20:20 2014
New Revision: 263836
URL: http://svnweb.freebsd.org/changeset/base/263836

Log:
  MFC: r262484
  
  In puthdr(), start the ELF .data section on a new page, as this is
  what btxldr expects (.set MEM_DATA,start+0x1000 in btxldr.S).
  
  This makes resulting ELF binaries bootable with grub, gptboot and boot2.
  
  PR: 153801
  Submitted by:   Gleb Kurtsou gleb.kurtsou at gmail.com
  Tested by:  Ruben Kerkhof ruben at rubenkerkhof.com
  Glanced at by:  jhb, peter

Modified:
  stable/9/usr.sbin/btxld/btxld.c
Directory Properties:
  stable/9/usr.sbin/btxld/   (props changed)

Modified: stable/9/usr.sbin/btxld/btxld.c
==
--- stable/9/usr.sbin/btxld/btxld.c Thu Mar 27 20:19:11 2014
(r263835)
+++ stable/9/usr.sbin/btxld/btxld.c Thu Mar 27 20:20:20 2014
(r263836)
@@ -426,7 +426,7 @@ puthdr(int fd, struct hdr *hdr)
le32toh(eh.p[0].p_filesz));
eh.p[1].p_vaddr = eh.p[1].p_paddr =
htole32(align(le32toh(eh.p[0].p_paddr) + le32toh(eh.p[0].p_memsz),
-   4));
+   4096));
eh.p[1].p_filesz = eh.p[1].p_memsz = htole32(hdr-data);
eh.sh[2].sh_addr = eh.p[0].p_vaddr;
eh.sh[2].sh_offset = eh.p[0].p_offset;
___
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-unsubscr...@freebsd.org


svn commit: r263837 - stable/8/usr.sbin/btxld

2014-03-27 Thread Christian Brueffer
Author: brueffer
Date: Thu Mar 27 20:21:13 2014
New Revision: 263837
URL: http://svnweb.freebsd.org/changeset/base/263837

Log:
  MFC: r262484
  
  In puthdr(), start the ELF .data section on a new page, as this is
  what btxldr expects (.set MEM_DATA,start+0x1000 in btxldr.S).
  
  This makes resulting ELF binaries bootable with grub, gptboot and boot2.
  
  PR: 153801
  Submitted by:   Gleb Kurtsou gleb.kurtsou at gmail.com
  Tested by:  Ruben Kerkhof ruben at rubenkerkhof.com
  Glanced at by:  jhb, peter

Modified:
  stable/8/usr.sbin/btxld/btxld.c
Directory Properties:
  stable/8/usr.sbin/btxld/   (props changed)

Modified: stable/8/usr.sbin/btxld/btxld.c
==
--- stable/8/usr.sbin/btxld/btxld.c Thu Mar 27 20:20:20 2014
(r263836)
+++ stable/8/usr.sbin/btxld/btxld.c Thu Mar 27 20:21:13 2014
(r263837)
@@ -426,7 +426,7 @@ puthdr(int fd, struct hdr *hdr)
le32toh(eh.p[0].p_filesz));
eh.p[1].p_vaddr = eh.p[1].p_paddr =
htole32(align(le32toh(eh.p[0].p_paddr) + le32toh(eh.p[0].p_memsz),
-   4));
+   4096));
eh.p[1].p_filesz = eh.p[1].p_memsz = htole32(hdr-data);
eh.sh[2].sh_addr = eh.p[0].p_vaddr;
eh.sh[2].sh_offset = eh.p[0].p_offset;
___
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-unsubscr...@freebsd.org


svn commit: r263838 - in stable: 10 9

2014-03-27 Thread Dimitry Andric
Author: dim
Date: Thu Mar 27 20:32:58 2014
New Revision: 263838
URL: http://svnweb.freebsd.org/changeset/base/263838

Log:
  MFC r263692:
  
  Add a note to UPDATING about customized kernel configuration files now
  requiring -gdwarf-2 for debug info, when using clang 3.4.
  
  Suggested by: adrian

Modified:
  stable/10/UPDATING
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/9/UPDATING   (contents, props changed)

Modified: stable/10/UPDATING
==
--- stable/10/UPDATING  Thu Mar 27 20:21:13 2014(r263837)
+++ stable/10/UPDATING  Thu Mar 27 20:32:58 2014(r263838)
@@ -18,7 +18,16 @@ older version of current is a bit fragil
 
 
 20140321:
-   Clang and llvm have been upgraded to 3.4 release.
+   Clang and llvm have been upgraded to 3.4 release.  Please note that
+   clang 3.4 now defaults to DWARF4 debug information format when you
+   specify -g.  Since kgdb(1) only supports DWARF2, you should update any
+   customized kernel configurations which include debug information to
+   explicitly use -gdwarf-2, e.g:
+
+ makeoptions   DEBUG=-gdwarf-2
+
+   This has already been applied to the appropriate GENERIC configuration
+   files, so if you inherit from those, no changes are required.
 
 20140306:
If a Makefile in a tests/ directory was auto-generating a Kyuafile
___
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-unsubscr...@freebsd.org


svn commit: r263838 - in stable: 10 9

2014-03-27 Thread Dimitry Andric
Author: dim
Date: Thu Mar 27 20:32:58 2014
New Revision: 263838
URL: http://svnweb.freebsd.org/changeset/base/263838

Log:
  MFC r263692:
  
  Add a note to UPDATING about customized kernel configuration files now
  requiring -gdwarf-2 for debug info, when using clang 3.4.
  
  Suggested by: adrian

Modified:
  stable/9/UPDATING   (contents, props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/UPDATING
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/UPDATING
==
--- stable/9/UPDATING   Thu Mar 27 20:21:13 2014(r263837)
+++ stable/9/UPDATING   Thu Mar 27 20:32:58 2014(r263838)
@@ -12,7 +12,16 @@ Items affecting the ports and packages s
 /usr/ports/UPDATING.  Please read that file before running portupgrade.
 
 20140321:
-   Clang and llvm have been upgraded to 3.4 release.
+   Clang and llvm have been upgraded to 3.4 release.  Please note that
+   clang 3.4 now defaults to DWARF4 debug information format when you
+   specify -g.  Since kgdb(1) only supports DWARF2, you should update any
+   customized kernel configurations which include debug information to
+   explicitly use -gdwarf-2, e.g:
+
+ makeoptions   DEBUG=-gdwarf-2
+
+   This has already been applied to the appropriate GENERIC configuration
+   files, so if you inherit from those, no changes are required.
 
 20140216:
The nve(4) driver for NVIDIA nForce MCP Ethernet adapters has
___
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-unsubscr...@freebsd.org


svn commit: r263839 - in stable: 10/sbin/devd 9/sbin/devd

2014-03-27 Thread Dimitry Andric
Author: dim
Date: Thu Mar 27 20:46:46 2014
New Revision: 263839
URL: http://svnweb.freebsd.org/changeset/base/263839

Log:
  MFC r263694:
  
  Apply a temporary band-aid for building devd with clang 3.4, libstdc++
  and -Wsystem-headers enabled (which is the default for any non-zero
  WARNS level, crazily enough!).  This is primarily meant to be MFC'd as
  soon as possible.

Modified:
  stable/10/sbin/devd/Makefile
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/9/sbin/devd/Makefile
Directory Properties:
  stable/9/sbin/devd/   (props changed)

Modified: stable/10/sbin/devd/Makefile
==
--- stable/10/sbin/devd/MakefileThu Mar 27 20:32:58 2014
(r263838)
+++ stable/10/sbin/devd/MakefileThu Mar 27 20:46:46 2014
(r263839)
@@ -13,6 +13,7 @@ LDADD=-ll -lutil
 
 YFLAGS+=-v
 CFLAGS+=-I. -I${.CURDIR}
+CFLAGS.clang+=-Wno-keyword-compat
 
 CLEANFILES= y.output
 
___
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-unsubscr...@freebsd.org


svn commit: r263839 - in stable: 10/sbin/devd 9/sbin/devd

2014-03-27 Thread Dimitry Andric
Author: dim
Date: Thu Mar 27 20:46:46 2014
New Revision: 263839
URL: http://svnweb.freebsd.org/changeset/base/263839

Log:
  MFC r263694:
  
  Apply a temporary band-aid for building devd with clang 3.4, libstdc++
  and -Wsystem-headers enabled (which is the default for any non-zero
  WARNS level, crazily enough!).  This is primarily meant to be MFC'd as
  soon as possible.

Modified:
  stable/9/sbin/devd/Makefile
Directory Properties:
  stable/9/sbin/devd/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sbin/devd/Makefile
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sbin/devd/Makefile
==
--- stable/9/sbin/devd/Makefile Thu Mar 27 20:32:58 2014(r263838)
+++ stable/9/sbin/devd/Makefile Thu Mar 27 20:46:46 2014(r263839)
@@ -13,6 +13,7 @@ LDADD=-ll -lutil
 
 YFLAGS+=-v
 CFLAGS+=-I. -I${.CURDIR}
+CFLAGS.clang+=-Wno-keyword-compat
 
 CLEANFILES= y.output
 
___
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-unsubscr...@freebsd.org


svn commit: r263842 - in head/lib/libc: capability gen sys

2014-03-27 Thread Robert Watson
Author: rwatson
Date: Thu Mar 27 21:43:00 2014
New Revision: 263842
URL: http://svnweb.freebsd.org/changeset/base/263842

Log:
  Update system man pages for s/capability.h/capsicum.h/.
  
  MFC after:3 weeks

Modified:
  head/lib/libc/capability/cap_rights_init.3
  head/lib/libc/gen/cap_rights_get.3
  head/lib/libc/gen/cap_sandboxed.3
  head/lib/libc/sys/cap_enter.2
  head/lib/libc/sys/cap_fcntls_limit.2
  head/lib/libc/sys/cap_ioctls_limit.2
  head/lib/libc/sys/cap_rights_limit.2

Modified: head/lib/libc/capability/cap_rights_init.3
==
--- head/lib/libc/capability/cap_rights_init.3  Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/capability/cap_rights_init.3  Thu Mar 27 21:43:00 2014
(r263842)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 23, 2013
+.Dd March 27, 2014
 .Dt CAP_RIGHTS_INIT 3
 .Os
 .Sh NAME
@@ -44,7 +44,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft cap_rights_t *
 .Fn cap_rights_init cap_rights_t *rights ...
 .Ft cap_rights_t *

Modified: head/lib/libc/gen/cap_rights_get.3
==
--- head/lib/libc/gen/cap_rights_get.3  Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/gen/cap_rights_get.3  Thu Mar 27 21:43:00 2014
(r263842)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 23, 2013
+.Dd March 27, 2014
 .Dt CAP_RIGHTS_GET 3
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft int
 .Fn cap_rights_get int fd cap_rights_t *rights
 .Sh DESCRIPTION

Modified: head/lib/libc/gen/cap_sandboxed.3
==
--- head/lib/libc/gen/cap_sandboxed.3   Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/gen/cap_sandboxed.3   Thu Mar 27 21:43:00 2014
(r263842)
@@ -1,3 +1,4 @@
+.\
 .\ Copyright (c) 2012 The FreeBSD Foundation
 .\ All rights reserved.
 .\
@@ -27,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 18, 2012
+.Dd March 27, 2014
 .Dt CAP_SANDBOXED 3
 .Os
 .Sh NAME
@@ -36,7 +37,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .In stdbool.h
 .Ft bool
 .Fn cap_sandboxed void

Modified: head/lib/libc/sys/cap_enter.2
==
--- head/lib/libc/sys/cap_enter.2   Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/sys/cap_enter.2   Thu Mar 27 21:43:00 2014
(r263842)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 25, 2012
+.Dd March 27, 2014
 .Dt CAP_ENTER 2
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft int
 .Fn cap_enter void
 .Ft int

Modified: head/lib/libc/sys/cap_fcntls_limit.2
==
--- head/lib/libc/sys/cap_fcntls_limit.2Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/sys/cap_fcntls_limit.2Thu Mar 27 21:43:00 2014
(r263842)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 20, 2012
+.Dd March 27, 2014
 .Dt CAP_FCNTLS_LIMIT 2
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft int
 .Fn cap_fcntls_limit int fd uint32_t fcntlrights
 .Ft int

Modified: head/lib/libc/sys/cap_ioctls_limit.2
==
--- head/lib/libc/sys/cap_ioctls_limit.2Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/sys/cap_ioctls_limit.2Thu Mar 27 21:43:00 2014
(r263842)
@@ -28,7 +28,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd September 20, 2012
+.Dd March 27, 2014
 .Dt CAP_IOCTLS_LIMIT 2
 .Os
 .Sh NAME
@@ -38,7 +38,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft int
 .Fn cap_ioctls_limit int fd const unsigned long *cmds size_t ncmds
 .Ft ssize_t

Modified: head/lib/libc/sys/cap_rights_limit.2
==
--- head/lib/libc/sys/cap_rights_limit.2Thu Mar 27 21:32:02 2014
(r263841)
+++ head/lib/libc/sys/cap_rights_limit.2Thu Mar 27 21:43:00 2014
(r263842)
@@ -32,7 +32,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd February 23, 2013
+.Dd March 27, 2014
 .Dt CAP_RIGHTS_LIMIT 2
 .Os
 .Sh NAME
@@ -41,7 +41,7 @@
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
-.In sys/capability.h
+.In sys/capsicum.h
 .Ft int
 .Fn cap_rights_limit int fd const cap_rights_t *rights
 .Sh DESCRIPTION
___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread Don Lewis
On 27 Mar, Konstantin Belousov wrote:
 On Thu, Mar 27, 2014 at 04:05:12PM +0100, Mateusz Guzik wrote:
 On Thu, Mar 27, 2014 at 03:58:19PM +0100, Mateusz Guzik wrote:
  On Thu, Mar 27, 2014 at 04:46:57PM +0800, David Xu wrote:
   On 2014/03/27 16:37, Mateusz Guzik wrote:
   On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:
   I think the async process pointer can be cleared when a process exits
   by registering an event handler. please see attached patch.
   
   
   Sure, but I'm not very fond of this solution.
   
   This is a rather obscure bug you wont hit unless you explicitly try,
   and even then you need root privs by default.
   
   OK, but I don't like the bug exists in kernel. It is not obscure for me,
   I can run shutdown now command, and insert a device, and then the
   kernel will write garbage data into freed memory space.
   
  
  Not sure what you mean. devd does not use this feature, and even if it
  did async_proc is cleared on close, which happens while signal delivery
  is still legal.
  
  That said, you are not going to encounter this bug unless you code
  something up to specifically trigger it.
  
  fwiw, I think we could axe this feature if there was no way to fix it
  without introducing a check for every process.
  
   As such writing a callback function which will be executed for all 
   exiting
   processes seems unjustified for me.
   
   Ideally we would get some mechanism which would allow to register
   callbacks for events related to given entity. Then it could be used to
   provide a call this function when process p exits, amongst other 
   things.
   
   
   Yes, but the callback itself is cheap enough and is not worth to be
   per-entity entry.
   
  
  There is other code in the kernel which would benefit from such
  functionality - dev/syscons/scmouse, dev/vt/vt_core.c, aio and possibly
  more.
  
  As such I think this is worth pursuing.
  
 
 We can hack around this one the way the other code is doing - apart from
 from proc pointer you store pid and then compare result of pfind(pid).
 
 This is still buggy as both proc and pid pointer can be recycled and end
 up being the same (but you have an entrirely new process).
 
 However, then in absolutely worst cae you send SIGIO to incorrect
 process, always an existing process so no more corruption.
 
 Would you be ok with such hack for the time being?
 
 Isn't p_sigiolist and fsetown(9) already provide the neccessary registration
 and cleanup on the process exit ?  The KPI might require some generalization,
 but I think that the mechanism itself is enough.

That's the correct mechanism, but it's not being used here.

Something like the following untested patch should do the trick:

Index: sys/kern/subr_bus.c
===
--- sys/kern/subr_bus.c (revision 263289)
+++ sys/kern/subr_bus.c (working copy)
@@ -402,7 +402,7 @@
struct cv cv;
struct selinfo sel;
struct devq devq;
-   struct proc *async_proc;
+   struct sigio *sigio;
 } devsoftc;
 
 static struct cdev *devctl_dev;
@@ -425,7 +425,7 @@
/* move to init */
devsoftc.inuse = 1;
devsoftc.nonblock = 0;
-   devsoftc.async_proc = NULL;
+   funsetown(devsoftc.sigio);
return (0);
 }
 
@@ -436,7 +436,7 @@
mtx_lock(devsoftc.mtx);
cv_broadcast(devsoftc.cv);
mtx_unlock(devsoftc.mtx);
-   devsoftc.async_proc = NULL;
+   funsetown(devsoftc.sigio);
return (0);
 }
 
@@ -492,9 +492,8 @@
return (0);
case FIOASYNC:
if (*(int*)data)
-   devsoftc.async_proc = td-td_proc;
-   else
-   devsoftc.async_proc = NULL;
+   return (fsetown(td-td_proc-p_pid, devsoftc.sigio));
+   funsetown(devsoftc.sigio);
return (0);
 
/* (un)Support for other fcntl() calls. */
@@ -546,7 +545,6 @@
 devctl_queue_data_f(char *data, int flags)
 {
struct dev_event_info *n1 = NULL, *n2 = NULL;
-   struct proc *p;
 
if (strlen(data) == 0)
goto out;
@@ -576,12 +574,8 @@
cv_broadcast(devsoftc.cv);
mtx_unlock(devsoftc.mtx);
selwakeup(devsoftc.sel);
-   p = devsoftc.async_proc;
-   if (p != NULL) {
-   PROC_LOCK(p);
-   kern_psignal(p, SIGIO);
-   PROC_UNLOCK(p);
-   }
+   if (devsoftc.sigio != NULL)
+   pgsigio(devsoftc.sigio, SIGIO, 0);
return;
 out:
/*

___
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-unsubscr...@freebsd.org


svn commit: r263846 - head/bin/sh

2014-03-27 Thread Jilles Tjoelker
Author: jilles
Date: Thu Mar 27 22:52:26 2014
New Revision: 263846
URL: http://svnweb.freebsd.org/changeset/base/263846

Log:
  sh: Fix memory leak when trying to set a read only variable.
  
  MFC after:1 week

Modified:
  head/bin/sh/var.c

Modified: head/bin/sh/var.c
==
--- head/bin/sh/var.c   Thu Mar 27 22:48:48 2014(r263845)
+++ head/bin/sh/var.c   Thu Mar 27 22:52:26 2014(r263846)
@@ -325,8 +325,11 @@ setvareq(char *s, int flags)
mklocal(s);
vp = find_var(s, vpp, nlen);
if (vp != NULL) {
-   if (vp-flags  VREADONLY)
+   if (vp-flags  VREADONLY) {
+   if ((flags  (VTEXTFIXED|VSTACK)) == 0)
+   ckfree(s);
error(%.*s: is read only, vp-name_len, s);
+   }
if (flags  VNOSET)
return;
INTOFF;
___
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-unsubscr...@freebsd.org


svn commit: r263847 - head/bin/sh

2014-03-27 Thread Jilles Tjoelker
Author: jilles
Date: Thu Mar 27 22:57:23 2014
New Revision: 263847
URL: http://svnweb.freebsd.org/changeset/base/263847

Log:
  sh: Fix memory leak with an assignment before a regular builtin.
  
  MFC after:1 week

Modified:
  head/bin/sh/var.c

Modified: head/bin/sh/var.c
==
--- head/bin/sh/var.c   Thu Mar 27 22:52:26 2014(r263846)
+++ head/bin/sh/var.c   Thu Mar 27 22:57:23 2014(r263847)
@@ -330,8 +330,11 @@ setvareq(char *s, int flags)
ckfree(s);
error(%.*s: is read only, vp-name_len, s);
}
-   if (flags  VNOSET)
+   if (flags  VNOSET) {
+   if ((flags  (VTEXTFIXED|VSTACK)) == 0)
+   ckfree(s);
return;
+   }
INTOFF;
 
if (vp-func  (flags  VNOFUNC) == 0)
@@ -364,8 +367,11 @@ setvareq(char *s, int flags)
return;
}
/* not found */
-   if (flags  VNOSET)
+   if (flags  VNOSET) {
+   if ((flags  (VTEXTFIXED|VSTACK)) == 0)
+   ckfree(s);
return;
+   }
INTOFF;
vp = ckmalloc(sizeof (*vp));
vp-flags = flags;
___
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-unsubscr...@freebsd.org


svn commit: r263851 - in vendor-sys/acpica/dist: . generate/unix/acpibin generate/unix/acpidump generate/unix/acpiexamples generate/unix/acpiexec generate/unix/acpihelp generate/unix/acpinames gene...

2014-03-27 Thread Jung-uk Kim
Author: jkim
Date: Thu Mar 27 23:50:54 2014
New Revision: 263851
URL: http://svnweb.freebsd.org/changeset/base/263851

Log:
  Import ACPICA 20140325.

Added:
  vendor-sys/acpica/dist/source/common/ahids.c   (contents, props changed)
  vendor-sys/acpica/dist/source/common/cmfsize.c   (contents, props changed)
  vendor-sys/acpica/dist/source/components/tables/tbdata.c   (contents, props 
changed)
Modified:
  vendor-sys/acpica/dist/changes.txt
  vendor-sys/acpica/dist/generate/unix/acpibin/Makefile
  vendor-sys/acpica/dist/generate/unix/acpidump/Makefile
  vendor-sys/acpica/dist/generate/unix/acpiexamples/Makefile
  vendor-sys/acpica/dist/generate/unix/acpiexec/Makefile
  vendor-sys/acpica/dist/generate/unix/acpihelp/Makefile
  vendor-sys/acpica/dist/generate/unix/acpinames/Makefile
  vendor-sys/acpica/dist/generate/unix/acpisrc/Makefile
  vendor-sys/acpica/dist/generate/unix/iasl/Makefile
  vendor-sys/acpica/dist/source/common/adfile.c
  vendor-sys/acpica/dist/source/common/adisasm.c
  vendor-sys/acpica/dist/source/common/adwalk.c
  vendor-sys/acpica/dist/source/common/ahpredef.c
  vendor-sys/acpica/dist/source/common/dmextern.c
  vendor-sys/acpica/dist/source/compiler/aslcompile.c
  vendor-sys/acpica/dist/source/compiler/aslerror.c
  vendor-sys/acpica/dist/source/compiler/aslfileio.c
  vendor-sys/acpica/dist/source/compiler/aslmain.c
  vendor-sys/acpica/dist/source/compiler/aslmessages.h
  vendor-sys/acpica/dist/source/compiler/asloptions.c
  vendor-sys/acpica/dist/source/compiler/aslstubs.c
  vendor-sys/acpica/dist/source/compiler/aslutils.c
  vendor-sys/acpica/dist/source/compiler/dtcompiler.h
  vendor-sys/acpica/dist/source/compiler/dtio.c
  vendor-sys/acpica/dist/source/compiler/dtutils.c
  vendor-sys/acpica/dist/source/components/debugger/dbcmds.c
  vendor-sys/acpica/dist/source/components/debugger/dbfileio.c
  vendor-sys/acpica/dist/source/components/debugger/dbmethod.c
  vendor-sys/acpica/dist/source/components/disassembler/dmbuffer.c
  vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c
  vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c
  vendor-sys/acpica/dist/source/components/dispatcher/dsmethod.c
  vendor-sys/acpica/dist/source/components/events/evmisc.c
  vendor-sys/acpica/dist/source/components/events/evsci.c
  vendor-sys/acpica/dist/source/components/events/evxface.c
  vendor-sys/acpica/dist/source/components/executer/exconfig.c
  vendor-sys/acpica/dist/source/components/executer/exdump.c
  vendor-sys/acpica/dist/source/components/tables/tbfadt.c
  vendor-sys/acpica/dist/source/components/tables/tbfind.c
  vendor-sys/acpica/dist/source/components/tables/tbinstal.c
  vendor-sys/acpica/dist/source/components/tables/tbutils.c
  vendor-sys/acpica/dist/source/components/tables/tbxface.c
  vendor-sys/acpica/dist/source/components/tables/tbxfload.c
  vendor-sys/acpica/dist/source/components/utilities/utdecode.c
  vendor-sys/acpica/dist/source/components/utilities/utstring.c
  vendor-sys/acpica/dist/source/include/acapps.h
  vendor-sys/acpica/dist/source/include/acbuffer.h
  vendor-sys/acpica/dist/source/include/acconfig.h
  vendor-sys/acpica/dist/source/include/acdebug.h
  vendor-sys/acpica/dist/source/include/acdisasm.h
  vendor-sys/acpica/dist/source/include/acdispat.h
  vendor-sys/acpica/dist/source/include/acevents.h
  vendor-sys/acpica/dist/source/include/acexcep.h
  vendor-sys/acpica/dist/source/include/acglobal.h
  vendor-sys/acpica/dist/source/include/achware.h
  vendor-sys/acpica/dist/source/include/acinterp.h
  vendor-sys/acpica/dist/source/include/aclocal.h
  vendor-sys/acpica/dist/source/include/acmacros.h
  vendor-sys/acpica/dist/source/include/acnamesp.h
  vendor-sys/acpica/dist/source/include/acobject.h
  vendor-sys/acpica/dist/source/include/acoutput.h
  vendor-sys/acpica/dist/source/include/acparser.h
  vendor-sys/acpica/dist/source/include/acpiosxf.h
  vendor-sys/acpica/dist/source/include/acpixf.h
  vendor-sys/acpica/dist/source/include/acpredef.h
  vendor-sys/acpica/dist/source/include/acresrc.h
  vendor-sys/acpica/dist/source/include/acrestyp.h
  vendor-sys/acpica/dist/source/include/acstruct.h
  vendor-sys/acpica/dist/source/include/actables.h
  vendor-sys/acpica/dist/source/include/actbl.h
  vendor-sys/acpica/dist/source/include/actbl1.h
  vendor-sys/acpica/dist/source/include/actbl2.h
  vendor-sys/acpica/dist/source/include/actbl3.h
  vendor-sys/acpica/dist/source/include/actypes.h
  vendor-sys/acpica/dist/source/include/acutils.h
  vendor-sys/acpica/dist/source/include/amlcode.h
  vendor-sys/acpica/dist/source/include/amlresrc.h
  vendor-sys/acpica/dist/source/include/platform/acgcc.h
  vendor-sys/acpica/dist/source/include/platform/aclinux.h
  vendor-sys/acpica/dist/source/os_specific/service_layers/oslinuxtbl.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/osunixdir.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/osunixxf.c
  vendor-sys/acpica/dist/source/os_specific/service_layers/oswintbl.c
  

svn commit: r263852 - vendor-sys/acpica/20140325

2014-03-27 Thread Jung-uk Kim
Author: jkim
Date: Thu Mar 27 23:51:39 2014
New Revision: 263852
URL: http://svnweb.freebsd.org/changeset/base/263852

Log:
  Tag ACPICA 20140325.

Added:
  vendor-sys/acpica/20140325/
 - copied from r263851, vendor-sys/acpica/dist/
___
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-unsubscr...@freebsd.org


svn commit: r263853 - stable/10/sys/dev/hyperv/netvsc

2014-03-27 Thread Xin LI
Author: delphij
Date: Fri Mar 28 01:13:08 2014
New Revision: 263853
URL: http://svnweb.freebsd.org/changeset/base/263853

Log:
  MFC r259180 (pjd) + r263123:
  
  Hide a few messages under bootverbose.

Modified:
  stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Mar 27 
23:51:39 2014(r263852)
+++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Fri Mar 28 
01:13:08 2014(r263853)
@@ -182,7 +182,8 @@ netvsc_drv_init(void)
 static void
 netvsc_init(void)
 {
-   printf(Netvsc initializing... );
+   if (bootverbose)
+   printf(Netvsc initializing... );
 
/*
 * XXXKYS: cleanup initialization
@@ -190,9 +191,10 @@ netvsc_init(void)
if (!cold  !g_netvsc_drv.drv_inited) {
g_netvsc_drv.drv_inited = 1;
netvsc_drv_init();
-   } else {
+   if (bootverbose)
+   printf(done!\n);
+   } else if (bootverbose)
printf(Already initialized!\n);
-   }
 }
 
 /* {F8615163-DF3E-46c5-913F-F2D2F965ED0E} */
@@ -213,7 +215,8 @@ netvsc_probe(device_t dev)
p = vmbus_get_type(dev);
if (!memcmp(p, g_net_vsc_device_type.data, sizeof(hv_guid))) {
device_set_desc(dev, Synthetic Network Interface);
-   printf(Netvsc probe... DONE \n);
+   if (bootverbose)
+   printf(Netvsc probe... DONE \n);
 
return (0);
}
@@ -299,7 +302,8 @@ netvsc_detach(device_t dev)
 {
struct hv_device *hv_device = vmbus_get_devctx(dev); 
 
-   printf(netvsc_detach\n);
+   if (bootverbose)
+   printf(netvsc_detach\n);
 
/*
 * XXXKYS:  Need to clean up all our
@@ -894,7 +898,8 @@ hn_stop(hn_softc_t *sc)
 
ifp = sc-hn_ifp;
 
-   printf( Closing Device ...\n);
+   if (bootverbose)
+   printf( Closing Device ...\n);
 
ifp-if_drv_flags = ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
sc-hn_initdone = 0;
___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread David Xu

On 2014/03/27 22:58, Mateusz Guzik wrote:

On Thu, Mar 27, 2014 at 04:46:57PM +0800, David Xu wrote:

On 2014/03/27 16:37, Mateusz Guzik wrote:

On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:

I think the async process pointer can be cleared when a process exits
by registering an event handler. please see attached patch.



Sure, but I'm not very fond of this solution.

This is a rather obscure bug you wont hit unless you explicitly try,
and even then you need root privs by default.


OK, but I don't like the bug exists in kernel. It is not obscure for me,
I can run shutdown now command, and insert a device, and then the
kernel will write garbage data into freed memory space.



Not sure what you mean. devd does not use this feature, and even if it
did async_proc is cleared on close, which happens while signal delivery
is still legal.


Thers is no race conidtion when using lock to protect it.


That said, you are not going to encounter this bug unless you code
something up to specifically trigger it.

fwiw, I think we could axe this feature if there was no way to fix it
without introducing a check for every process.



If you added a feature, you can not assume people won't use it.


As such writing a callback function which will be executed for all exiting
processes seems unjustified for me.

Ideally we would get some mechanism which would allow to register
callbacks for events related to given entity. Then it could be used to
provide a call this function when process p exits, amongst other things.



Yes, but the callback itself is cheap enough and is not worth to be
per-entity entry.



There is other code in the kernel which would benefit from such
functionality - dev/syscons/scmouse, dev/vt/vt_core.c, aio and possibly
more.

As such I think this is worth pursuing.


I can not say more, it seems it is an extension.

___
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-unsubscr...@freebsd.org


Re: svn commit: r263755 - head/sys/kern

2014-03-27 Thread David Xu

On 2014/03/28 06:31, Don Lewis wrote:

On 27 Mar, Konstantin Belousov wrote:

On Thu, Mar 27, 2014 at 04:05:12PM +0100, Mateusz Guzik wrote:

On Thu, Mar 27, 2014 at 03:58:19PM +0100, Mateusz Guzik wrote:

On Thu, Mar 27, 2014 at 04:46:57PM +0800, David Xu wrote:

On 2014/03/27 16:37, Mateusz Guzik wrote:

On Thu, Mar 27, 2014 at 03:45:17PM +0800, David Xu wrote:

I think the async process pointer can be cleared when a process exits
by registering an event handler. please see attached patch.



Sure, but I'm not very fond of this solution.

This is a rather obscure bug you wont hit unless you explicitly try,
and even then you need root privs by default.


OK, but I don't like the bug exists in kernel. It is not obscure for me,
I can run shutdown now command, and insert a device, and then the
kernel will write garbage data into freed memory space.



Not sure what you mean. devd does not use this feature, and even if it
did async_proc is cleared on close, which happens while signal delivery
is still legal.

That said, you are not going to encounter this bug unless you code
something up to specifically trigger it.

fwiw, I think we could axe this feature if there was no way to fix it
without introducing a check for every process.


As such writing a callback function which will be executed for all exiting
processes seems unjustified for me.

Ideally we would get some mechanism which would allow to register
callbacks for events related to given entity. Then it could be used to
provide a call this function when process p exits, amongst other things.



Yes, but the callback itself is cheap enough and is not worth to be
per-entity entry.



There is other code in the kernel which would benefit from such
functionality - dev/syscons/scmouse, dev/vt/vt_core.c, aio and possibly
more.

As such I think this is worth pursuing.



We can hack around this one the way the other code is doing - apart from
from proc pointer you store pid and then compare result of pfind(pid).

This is still buggy as both proc and pid pointer can be recycled and end
up being the same (but you have an entrirely new process).

However, then in absolutely worst cae you send SIGIO to incorrect
process, always an existing process so no more corruption.

Would you be ok with such hack for the time being?


Isn't p_sigiolist and fsetown(9) already provide the neccessary registration
and cleanup on the process exit ?  The KPI might require some generalization,
but I think that the mechanism itself is enough.


That's the correct mechanism, but it's not being used here.

Something like the following untested patch should do the trick:

Index: sys/kern/subr_bus.c
===
--- sys/kern/subr_bus.c (revision 263289)
+++ sys/kern/subr_bus.c (working copy)
@@ -402,7 +402,7 @@
struct cv cv;
struct selinfo sel;
struct devq devq;
-   struct proc *async_proc;
+   struct sigio *sigio;
  } devsoftc;

  static struct cdev *devctl_dev;
@@ -425,7 +425,7 @@
/* move to init */
devsoftc.inuse = 1;
devsoftc.nonblock = 0;
-   devsoftc.async_proc = NULL;
+   funsetown(devsoftc.sigio);
return (0);
  }

@@ -436,7 +436,7 @@
mtx_lock(devsoftc.mtx);
cv_broadcast(devsoftc.cv);
mtx_unlock(devsoftc.mtx);
-   devsoftc.async_proc = NULL;
+   funsetown(devsoftc.sigio);
return (0);
  }

@@ -492,9 +492,8 @@
return (0);
case FIOASYNC:
if (*(int*)data)
-   devsoftc.async_proc = td-td_proc;
-   else
-   devsoftc.async_proc = NULL;
+   return (fsetown(td-td_proc-p_pid, devsoftc.sigio));
+   funsetown(devsoftc.sigio);
return (0);

/* (un)Support for other fcntl() calls. */
@@ -546,7 +545,6 @@
  devctl_queue_data_f(char *data, int flags)
  {
struct dev_event_info *n1 = NULL, *n2 = NULL;
-   struct proc *p;

if (strlen(data) == 0)
goto out;
@@ -576,12 +574,8 @@
cv_broadcast(devsoftc.cv);
mtx_unlock(devsoftc.mtx);
selwakeup(devsoftc.sel);
-   p = devsoftc.async_proc;
-   if (p != NULL) {
-   PROC_LOCK(p);
-   kern_psignal(p, SIGIO);
-   PROC_UNLOCK(p);
-   }
+   if (devsoftc.sigio != NULL)
+   pgsigio(devsoftc.sigio, SIGIO, 0);
return;
  out:
/*



Hope this works.

___
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-unsubscr...@freebsd.org


svn commit: r263859 - head/sys/x86/acpica

2014-03-27 Thread Takanori Watanabe
Author: takawata
Date: Fri Mar 28 02:38:14 2014
New Revision: 263859
URL: http://svnweb.freebsd.org/changeset/base/263859

Log:
  Change default logic to CONFORM because this routine is shared
  with SCI polarity setting.
  
  Reviewed by: jhb

Modified:
  head/sys/x86/acpica/madt.c

Modified: head/sys/x86/acpica/madt.c
==
--- head/sys/x86/acpica/madt.c  Fri Mar 28 02:06:51 2014(r263858)
+++ head/sys/x86/acpica/madt.c  Fri Mar 28 02:38:14 2014(r263859)
@@ -298,6 +298,9 @@ interrupt_polarity(UINT16 IntiFlags, UIN
 {
 
switch (IntiFlags  ACPI_MADT_POLARITY_MASK) {
+   default:
+   printf(WARNING: Bogus Interrupt Polarity. Assume CONFORMS);
+   /* FALLTHROUGH*/
case ACPI_MADT_POLARITY_CONFORMS:
if (Source == AcpiGbl_FADT.SciInterrupt)
return (INTR_POLARITY_LOW);
@@ -306,11 +309,8 @@ interrupt_polarity(UINT16 IntiFlags, UIN
case ACPI_MADT_POLARITY_ACTIVE_HIGH:
return (INTR_POLARITY_HIGH);
case ACPI_MADT_POLARITY_ACTIVE_LOW:
-   break;
-   default:
-   printf(WARNING: Bogus Interrupt Polarity. Assume POLALITY 
LOW);
+   return (INTR_POLARITY_LOW);
}
-   return (INTR_POLARITY_LOW);
 }
 
 static enum intr_trigger
@@ -318,6 +318,9 @@ interrupt_trigger(UINT16 IntiFlags, UINT
 {
 
switch (IntiFlags  ACPI_MADT_TRIGGER_MASK) {
+   default:
+   printf(WARNING: Bogus Interrupt Trigger Mode. Assume 
CONFORMS.);
+   /*FALLTHROUGH*/
case ACPI_MADT_TRIGGER_CONFORMS:
if (Source == AcpiGbl_FADT.SciInterrupt)
return (INTR_TRIGGER_LEVEL);
@@ -326,13 +329,8 @@ interrupt_trigger(UINT16 IntiFlags, UINT
case ACPI_MADT_TRIGGER_EDGE:
return (INTR_TRIGGER_EDGE);
case ACPI_MADT_TRIGGER_LEVEL:
-   break;
-   default:
-   printf(WARNING: Bogus Interrupt Trigger Mode. Assume Level 
trigger.);
-   
-   break;
+   return (INTR_TRIGGER_LEVEL);
}
-   return (INTR_TRIGGER_LEVEL);
 }
 
 /*
___
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-unsubscr...@freebsd.org


svn commit: r263863 - head/lib/libmd

2014-03-27 Thread Glen Barber
Author: gjb
Date: Fri Mar 28 04:19:06 2014
New Revision: 263863
URL: http://svnweb.freebsd.org/changeset/base/263863

Log:
  Dereference nonexistent md2(3) manual.
  
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libmd/ripemd.3
  head/lib/libmd/sha.3
  head/lib/libmd/sha256.3
  head/lib/libmd/sha512.3

Modified: head/lib/libmd/ripemd.3
==
--- head/lib/libmd/ripemd.3 Fri Mar 28 04:14:40 2014(r263862)
+++ head/lib/libmd/ripemd.3 Fri Mar 28 04:19:06 2014(r263863)
@@ -9,7 +9,7 @@
 .\From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
 .\ $FreeBSD$
 .\
-.Dd February 26, 1999
+.Dd March 28, 2014
 .Dt RIPEMD 3
 .Os
 .Sh NAME
@@ -123,7 +123,6 @@ If the
 .Fa buf
 argument is non-null it must point to at least 41 characters of buffer space.
 .Sh SEE ALSO
-.Xr md2 3 ,
 .Xr md4 3 ,
 .Xr md5 3 ,
 .Xr sha 3

Modified: head/lib/libmd/sha.3
==
--- head/lib/libmd/sha.3Fri Mar 28 04:14:40 2014(r263862)
+++ head/lib/libmd/sha.3Fri Mar 28 04:19:06 2014(r263863)
@@ -9,7 +9,7 @@
 .\From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
 .\ $FreeBSD$
 .\
-.Dd February 25, 1999
+.Dd March 28, 2014
 .Dt SHA 3
 .Os
 .Sh NAME
@@ -154,7 +154,6 @@ If the
 .Fa buf
 argument is non-null it must point to at least 41 characters of buffer space.
 .Sh SEE ALSO
-.Xr md2 3 ,
 .Xr md4 3 ,
 .Xr md5 3 ,
 .Xr ripemd 3 ,

Modified: head/lib/libmd/sha256.3
==
--- head/lib/libmd/sha256.3 Fri Mar 28 04:14:40 2014(r263862)
+++ head/lib/libmd/sha256.3 Fri Mar 28 04:19:06 2014(r263863)
@@ -9,7 +9,7 @@
 .\From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
 .\ $FreeBSD$
 .\
-.Dd September 14, 2005
+.Dd March 28, 2014
 .Dt SHA256 3
 .Os
 .Sh NAME
@@ -120,7 +120,6 @@ If the
 .Fa buf
 argument is non-null it must point to at least 65 characters of buffer space.
 .Sh SEE ALSO
-.Xr md2 3 ,
 .Xr md4 3 ,
 .Xr md5 3 ,
 .Xr ripemd 3 ,

Modified: head/lib/libmd/sha512.3
==
--- head/lib/libmd/sha512.3 Fri Mar 28 04:14:40 2014(r263862)
+++ head/lib/libmd/sha512.3 Fri Mar 28 04:19:06 2014(r263863)
@@ -9,7 +9,7 @@
 .\From: Id: mdX.3,v 1.14 1999/02/11 20:31:49 wollman Exp
 .\ $FreeBSD$
 .\
-.Dd April 1, 2011
+.Dd March 28, 2014
 .Dt SHA512 3
 .Os
 .Sh NAME
@@ -120,7 +120,6 @@ If the
 .Fa buf
 argument is non-null it must point to at least 65 characters of buffer space.
 .Sh SEE ALSO
-.Xr md2 3 ,
 .Xr md4 3 ,
 .Xr md5 3 ,
 .Xr ripemd 3 ,
___
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-unsubscr...@freebsd.org