svn commit: r279351 - head/sys/dev/sfxge

2015-02-26 Thread Andrew Rybchenko
Author: arybchik
Date: Fri Feb 27 07:39:09 2015
New Revision: 279351
URL: https://svnweb.freebsd.org/changeset/base/279351

Log:
  sfxge: expect required init_state on data path and in periodic calls
  
  With the patch applied the number of instruction events is 1% less and
  number of mispredicted branch events is 5% less under multistream TCP
  traffic load close to line rate.
  
  Sponsored by:   Solarflare Communications, Inc.
  Approved by:gnn (mentor)

Modified:
  head/sys/dev/sfxge/sfxge_ev.c
  head/sys/dev/sfxge/sfxge_intr.c
  head/sys/dev/sfxge/sfxge_port.c
  head/sys/dev/sfxge/sfxge_rx.c
  head/sys/dev/sfxge/sfxge_tx.c

Modified: head/sys/dev/sfxge/sfxge_ev.c
==
--- head/sys/dev/sfxge/sfxge_ev.c   Fri Feb 27 04:45:47 2015
(r279350)
+++ head/sys/dev/sfxge/sfxge_ev.c   Fri Feb 27 07:39:09 2015
(r279351)
@@ -103,7 +103,7 @@ sfxge_ev_rx(void *arg, uint32_t label, u
KASSERT(evq-index == rxq-index,
(evq-index != rxq-index));
 
-   if (rxq-init_state != SFXGE_RXQ_STARTED)
+   if (__predict_false(rxq-init_state != SFXGE_RXQ_STARTED))
goto done;
 
expected = rxq-pending++  rxq-ptr_mask;
@@ -256,7 +256,7 @@ sfxge_ev_tx(void *arg, uint32_t label, u
KASSERT(evq-index == txq-evq_index,
(evq-index != txq-evq_index));
 
-   if (txq-init_state != SFXGE_TXQ_STARTED)
+   if (__predict_false(txq-init_state != SFXGE_TXQ_STARTED))
goto done;
 
stop = (id + 1)  txq-ptr_mask;
@@ -433,7 +433,7 @@ sfxge_ev_stat_update(struct sfxge_softc 
 
SFXGE_ADAPTER_LOCK(sc);
 
-   if (sc-evq[0]-init_state != SFXGE_EVQ_STARTED)
+   if (__predict_false(sc-evq[0]-init_state != SFXGE_EVQ_STARTED))
goto out;
 
now = ticks;
@@ -598,8 +598,8 @@ sfxge_ev_qpoll(struct sfxge_evq *evq)
 
SFXGE_EVQ_LOCK(evq);
 
-   if (evq-init_state != SFXGE_EVQ_STARTING 
-   evq-init_state != SFXGE_EVQ_STARTED) {
+   if (__predict_false(evq-init_state != SFXGE_EVQ_STARTING 
+   evq-init_state != SFXGE_EVQ_STARTED)) {
rc = EINVAL;
goto fail;
}

Modified: head/sys/dev/sfxge/sfxge_intr.c
==
--- head/sys/dev/sfxge/sfxge_intr.c Fri Feb 27 04:45:47 2015
(r279350)
+++ head/sys/dev/sfxge/sfxge_intr.c Fri Feb 27 07:39:09 2015
(r279351)
@@ -134,7 +134,7 @@ sfxge_intr_message(void *arg)
KASSERT(intr-type == EFX_INTR_MESSAGE,
(intr-type != EFX_INTR_MESSAGE));
 
-   if (intr-state != SFXGE_INTR_STARTED)
+   if (__predict_false(intr-state != SFXGE_INTR_STARTED))
return;
 
(void)efx_intr_status_message(enp, index, fatal);

Modified: head/sys/dev/sfxge/sfxge_port.c
==
--- head/sys/dev/sfxge/sfxge_port.c Fri Feb 27 04:45:47 2015
(r279350)
+++ head/sys/dev/sfxge/sfxge_port.c Fri Feb 27 07:39:09 2015
(r279351)
@@ -50,7 +50,7 @@ sfxge_mac_stat_update(struct sfxge_softc
 
SFXGE_PORT_LOCK_ASSERT_OWNED(port);
 
-   if (port-init_state != SFXGE_PORT_STARTED) {
+   if (__predict_false(port-init_state != SFXGE_PORT_STARTED)) {
rc = 0;
goto out;
}
@@ -241,7 +241,7 @@ sfxge_port_wanted_fc_handler(SYSCTL_HAND
SFXGE_PORT_LOCK(port);
 
if (port-wanted_fc != fcntl) {
-   if (port-init_state == SFXGE_PORT_STARTED)
+   if (__predict_false(port-init_state == SFXGE_PORT_STARTED))
error = efx_mac_fcntl_set(sc-enp,
  port-wanted_fc,
  B_TRUE);
@@ -272,7 +272,8 @@ sfxge_port_link_fc_handler(SYSCTL_HANDLE
port = sc-port;
 
SFXGE_PORT_LOCK(port);
-   if (port-init_state == SFXGE_PORT_STARTED  SFXGE_LINK_UP(sc))
+   if (__predict_true(port-init_state == SFXGE_PORT_STARTED) 
+   SFXGE_LINK_UP(sc))
efx_mac_fcntl_get(sc-enp, wanted_fc, link_fc);
else
link_fc = 0;
@@ -327,7 +328,7 @@ sfxge_mac_poll_work(void *arg, int npend
 
SFXGE_PORT_LOCK(port);
 
-   if (port-init_state != SFXGE_PORT_STARTED)
+   if (__predict_false(port-init_state != SFXGE_PORT_STARTED))
goto done;
 
/* This may sleep waiting for MCDI completion */
@@ -394,7 +395,7 @@ sfxge_mac_filter_set(struct sfxge_softc 
 * lock is held in sleeping thread. Both problems are repeatable
 * on LAG with LACP proto bring up.
 */
-   if (port-init_state == SFXGE_PORT_STARTED)
+   if (__predict_true(port-init_state == SFXGE_PORT_STARTED))
rc = 

svn commit: r279338 - head/sys/arm/include

2015-02-26 Thread Ian Lepore
Author: ian
Date: Thu Feb 26 23:05:46 2015
New Revision: 279338
URL: https://svnweb.freebsd.org/changeset/base/279338

Log:
  Add casting to make atomic ops work for pointers.  (Apparently nobody has
  ever done atomic ops on pointers before now on arm).
  
  Submitted by: Svatopluk Kraus onw...@gmail.com

Modified:
  head/sys/arm/include/atomic.h

Modified: head/sys/arm/include/atomic.h
==
--- head/sys/arm/include/atomic.h   Thu Feb 26 22:46:01 2015
(r279337)
+++ head/sys/arm/include/atomic.h   Thu Feb 26 23:05:46 2015
(r279338)
@@ -1103,13 +1103,23 @@ atomic_store_long(volatile u_long *dst, 
*dst = src;
 }
 
-#define atomic_clear_ptr   atomic_clear_32
-#define atomic_set_ptr atomic_set_32
-#define atomic_cmpset_ptr  atomic_cmpset_32
-#define atomic_cmpset_rel_ptr  atomic_cmpset_rel_32
-#define atomic_cmpset_acq_ptr  atomic_cmpset_acq_32
-#define atomic_store_ptr   atomic_store_32
-#define atomic_store_rel_ptr   atomic_store_rel_32
+#define atomic_clear_ptr(p, v) \
+   atomic_clear_32((volatile uint32_t *)(p), (uint32_t)(v))
+#define atomic_set_ptr(p, v) \
+   atomic_set_32((volatile uint32_t *)(p), (uint32_t)(v))
+#define atomic_cmpset_ptr(p, cmpval, newval) \
+   atomic_cmpset_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \
+   (u_int32_t)(newval))
+#define atomic_cmpset_rel_ptr(p, cmpval, newval) \
+   atomic_cmpset_rel_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \
+   (u_int32_t)(newval))
+#define atomic_cmpset_acq_ptr(p, cmpval, newval) \
+   atomic_cmpset_acq_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \
+   (u_int32_t)(newval))
+#define atomic_store_ptr(p, v) \
+   atomic_store_32((volatile uint32_t *)(p), (uint32_t)(v))
+#define atomic_store_rel_ptr(p, v) \
+   atomic_store_rel_32((volatile uint32_t *)(p), (uint32_t)(v))
 
 #define atomic_add_int atomic_add_32
 #define atomic_add_acq_int atomic_add_acq_32
___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Adrian Chadd
On 26 February 2015 at 15:13, Peter Grehan gre...@freebsd.org wrote:
 Koop did provide feedback shortly after Kib asked him to provide
 information and test a patch. There wasn't a response from kib or
 anyone else until I reported the same bug.


  http://docs.FreeBSD.org/cgi/mid.cgi?20150219200900.GH34251

So some other discussion may have occured off-list; I can't see that.

Anyway - I have that model laptop, it hangs after calling
ipi_startup() to the first AP with x2apic enabled. What can I do to
continue debugging?




-a
___
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: r279321 - head/share/examples/uefisign

2015-02-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 26 14:22:27 2015
New Revision: 279321
URL: https://svnweb.freebsd.org/changeset/base/279321

Log:
  Make the uefikeys script output slightly more obvious.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/examples/uefisign/uefikeys

Modified: head/share/examples/uefisign/uefikeys
==
--- head/share/examples/uefisign/uefikeys   Thu Feb 26 12:51:05 2015
(r279320)
+++ head/share/examples/uefisign/uefikeys   Thu Feb 26 14:22:27 2015
(r279321)
@@ -18,7 +18,6 @@ fi
 certfile=${1}.pem
 efifile=${1}.cer
 keyfile=${1}.key
-p12file=${1}.p12
 # XXX: Set this to ten years; we don't want system to suddenly stop booting
 #  due to certificate expiration.  Better way would be to use Authenticode
 #  Timestamp.  That said, the rumor is UEFI implementations ignore it 
anyway.
@@ -28,13 +27,11 @@ subj=/CN=${1}
 [ ! -e ${certfile} ] || die ${certfile} already exists
 [ ! -e ${efifile} ] || die ${efifile} already exists
 [ ! -e ${keyfile} ] || die ${keyfile} already exists
-[ ! -e ${p12file} ] || die ${p12file} already exists
 
 umask 077 || die umask 077 failed
 
 openssl genrsa -out ${keyfile} 2048 2 /dev/null || die openssl genrsa 
failed
 openssl req -new -x509 -sha256 -days ${days} -subj ${subj} -key 
${keyfile} -out ${certfile} || die openssl req failed
 openssl x509 -inform PEM -outform DER -in ${certfile} -out ${efifile} || 
die openssl x509 failed
-openssl pkcs12 -export -out ${p12file} -inkey ${keyfile} -in ${certfile} 
-password 'pass:' || die openssl pkcs12 failed
 
-echo certificate: ${certfile}; private key: ${keyfile}; UEFI public key: 
${efifile}; private key with empty password for pesign: ${p12file}
+echo certificate: ${certfile}; private key: ${keyfile}; certificate to enroll 
in UEFI: ${efifile}
___
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: r279326 - head/lib/libstdthreads

2015-02-26 Thread Konstantin Belousov
Author: kib
Date: Thu Feb 26 16:39:57 2015
New Revision: 279326
URL: https://svnweb.freebsd.org/changeset/base/279326

Log:
  Use pthread_mutex_trylock(3) to implement mtx_trylock(3).
  
  Noted and tested by:  Vineela vineela...@yahoo.com
  PR:   198050
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libstdthreads/mtx.c

Modified: head/lib/libstdthreads/mtx.c
==
--- head/lib/libstdthreads/mtx.cThu Feb 26 16:05:09 2015
(r279325)
+++ head/lib/libstdthreads/mtx.cThu Feb 26 16:39:57 2015
(r279326)
@@ -96,7 +96,7 @@ int
 mtx_trylock(mtx_t *mtx)
 {
 
-   switch (pthread_mutex_lock(mtx)) {
+   switch (pthread_mutex_trylock(mtx)) {
case 0:
return (thrd_success);
case EBUSY:
___
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: r279325 - head/sys/x86/xen

2015-02-26 Thread Roger Pau Monné
Author: royger
Date: Thu Feb 26 16:05:09 2015
New Revision: 279325
URL: https://svnweb.freebsd.org/changeset/base/279325

Log:
  xen/intr: fix fallout from r278854
  
  r278854 introduced a race in the event channel handling code. We must make
  sure that the pending bit is cleared before executing the filter, or else we
  might miss other events that would be injected after the filter has ran but
  before the pending bit is cleared.
  
  While there also mask event channels while FreeBSD executes the ithread
  bound to that event channel. This refrains Xen from injecting more
  interrupts while the ithread has not finished it's work.
  
  Sponsored by: Citrix Systems RD
  Reported by: sbruno, robak
  Tested by: robak

Modified:
  head/sys/x86/xen/xen_intr.c

Modified: head/sys/x86/xen/xen_intr.c
==
--- head/sys/x86/xen/xen_intr.c Thu Feb 26 15:59:45 2015(r279324)
+++ head/sys/x86/xen/xen_intr.c Thu Feb 26 16:05:09 2015(r279325)
@@ -128,6 +128,7 @@ struct xenisrc {
u_int   xi_close:1; /* close on unbind? */
u_int   xi_activehi:1;
u_int   xi_edgetrigger:1;
+   u_int   xi_masked:1;
 };
 
 #define ARRAY_SIZE(a)  (sizeof(a) / sizeof(a[0]))
@@ -578,12 +579,11 @@ xen_intr_handle_upcall(struct trapframe 
 
/* process port */
port = (l1i * LONG_BIT) + l2i;
+   synch_clear_bit(port, s-evtchn_pending[0]);
 
isrc = xen_intr_port_to_isrc[port];
-   if (__predict_false(isrc == NULL)) {
-   synch_clear_bit(port, s-evtchn_pending[0]);
+   if (__predict_false(isrc == NULL))
continue;
-   }
 
/* Make sure we are firing on the right vCPU */
KASSERT((isrc-xi_cpu == PCPU_GET(cpuid)),
@@ -930,11 +930,21 @@ out:
  *  acknowledgements.
  */
 static void
-xen_intr_disable_source(struct intsrc *isrc, int eoi)
+xen_intr_disable_source(struct intsrc *base_isrc, int eoi)
 {
+   struct xenisrc *isrc;
 
-   if (eoi == PIC_EOI)
-   xen_intr_eoi_source(isrc);
+   isrc = (struct xenisrc *)base_isrc;
+
+   /*
+* NB: checking if the event channel is already masked is
+* needed because the event channel user-space device
+* masks event channels on it's filter as part of it's
+* normal operation, and those shouldn't be automatically
+* unmasked by the generic interrupt code. The event channel
+* device will unmask them when needed.
+*/
+   isrc-xi_masked = !!evtchn_test_and_set_mask(isrc-xi_port);
 }
 
 /*
@@ -943,8 +953,14 @@ xen_intr_disable_source(struct intsrc *i
  * \param isrc  The interrupt source to unmask (if necessary).
  */
 static void
-xen_intr_enable_source(struct intsrc *isrc)
+xen_intr_enable_source(struct intsrc *base_isrc)
 {
+   struct xenisrc *isrc;
+
+   isrc = (struct xenisrc *)base_isrc;
+
+   if (isrc-xi_masked == 0)
+   evtchn_unmask_port(isrc-xi_port);
 }
 
 /*
@@ -955,11 +971,6 @@ xen_intr_enable_source(struct intsrc *is
 static void
 xen_intr_eoi_source(struct intsrc *base_isrc)
 {
-   struct xenisrc *isrc;
-
-   isrc = (struct xenisrc *)base_isrc;
-   synch_clear_bit(isrc-xi_port,
-   HYPERVISOR_shared_info-evtchn_pending[0]);
 }
 
 /*
@@ -1025,8 +1036,6 @@ xen_intr_pirq_eoi_source(struct intsrc *
 
isrc = (struct xenisrc *)base_isrc;
 
-   synch_clear_bit(isrc-xi_port,
-   HYPERVISOR_shared_info-evtchn_pending[0]);
if (test_bit(isrc-xi_pirq, xen_intr_pirq_eoi_map)) {
struct physdev_eoi eoi = { .irq = isrc-xi_pirq };
 
___
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: r279324 - head/sbin/geom/class/part

2015-02-26 Thread Andrey V. Elsukov
Author: ae
Date: Thu Feb 26 15:59:45 2015
New Revision: 279324
URL: https://svnweb.freebsd.org/changeset/base/279324

Log:
  When gpart(8) is trying automatically determine the first available
  block of free space after existing partition, take into account
  provider's stripeoffset, since the result will be adjusted to this
  value.
  
  PR:   197989
  MFC after:1 week

Modified:
  head/sbin/geom/class/part/geom_part.c

Modified: head/sbin/geom/class/part/geom_part.c
==
--- head/sbin/geom/class/part/geom_part.c   Thu Feb 26 15:48:20 2015
(r279323)
+++ head/sbin/geom/class/part/geom_part.c   Thu Feb 26 15:59:45 2015
(r279324)
@@ -561,7 +561,7 @@ gpart_autofill(struct gctl_req *req)
 
s = find_provcfg(pp, end);
first = (off_t)strtoimax(s, NULL, 0) + 1;
-   if (first  a_first)
+   if (first + offset  a_first)
a_first = ALIGNUP(first + offset, alignment);
}
if (a_first = last) {
___
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: r279323 - head/usr.sbin/uefisign

2015-02-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 26 15:48:20 2015
New Revision: 279323
URL: https://svnweb.freebsd.org/changeset/base/279323

Log:
  Use LIBADD.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/uefisign/Makefile

Modified: head/usr.sbin/uefisign/Makefile
==
--- head/usr.sbin/uefisign/Makefile Thu Feb 26 14:48:28 2015
(r279322)
+++ head/usr.sbin/uefisign/Makefile Thu Feb 26 15:48:20 2015
(r279323)
@@ -4,7 +4,7 @@ PROG=   uefisign
 SRCS=  uefisign.c child.c pe.c
 MAN=   uefisign.8
 
-LDFLAGS=   -lcrypto
+LIBADD=crypto
 
 WARNS= 6
 
___
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: r279320 - head/sys/dev/ahci

2015-02-26 Thread Alexander Motin
Author: mav
Date: Thu Feb 26 12:51:05 2015
New Revision: 279320
URL: https://svnweb.freebsd.org/changeset/base/279320

Log:
  For some uniformity move ahci_ch_init() call under the lock.
  
  Submitted by: Dmitry Luhtionov dmitryluhtio...@gmail.com
  MFC after:2 weeks

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cThu Feb 26 11:02:40 2015(r279319)
+++ head/sys/dev/ahci/ahci.cThu Feb 26 12:51:05 2015(r279320)
@@ -668,8 +668,8 @@ ahci_ch_attach(device_t dev)
return (ENXIO);
ahci_dmainit(dev);
ahci_slotsalloc(dev);
-   ahci_ch_init(dev);
mtx_lock(ch-mtx);
+   ahci_ch_init(dev);
rid = ATA_IRQ_RID;
if (!(ch-r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
rid, RF_SHAREABLE | RF_ACTIVE))) {
___
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: r278320 - in head: contrib/mdocml lib lib/libdevctl share/mk sys/dev/acpica sys/dev/pci sys/kern sys/sys usr.sbin usr.sbin/devctl

2015-02-26 Thread John Baldwin
On Thursday, February 26, 2015 12:40:06 AM Mateusz Guzik wrote:
 On Fri, Feb 06, 2015 at 04:09:02PM +, John Baldwin wrote:
  Author: jhb
  Date: Fri Feb  6 16:09:01 2015
  New Revision: 278320
  URL: https://svnweb.freebsd.org/changeset/base/278320
  
  Log:
Add a new device control utility for new-bus devices called devctl. 
This
allows the user to request administrative changes to individual devices
 
 [..]
 
  +static int
  +devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
  +struct thread *td)
  +{
  +   struct devreq *req;
  +   device_t dev;
  +   int error, old;
  +
  +   /* Locate the device to control. */
  +   mtx_lock(Giant);
  +   req = (struct devreq *)data;
 
 [..]
 
  +   switch (cmd) {
 
 [..]
 
  +   case DEV_SET_DRIVER: {
  +   devclass_t dc;
  +   char driver[128];
  +
  +   error = copyinstr(req-dr_data, driver, sizeof(driver), NULL);
 
 [..]
 
  +   if (!driver_exists(dev-parent, driver)) {
  +   error = ENOENT;
  +   break;
  +   }
 
 [..]
 
  +   }
  +   mtx_unlock(Giant);
  +   return (error);
  +}
 
 I only skimmed thourgh this, will not a page fault drop + reacquire Giant
 lock?
 
 iow, would not it be better to copy prior to taking the lock?

It won't make a difference.  All the logic is done after the copy, so it is 
still atomic.

-- 
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Adrian Chadd
Kib,

This just broke on my sandybridge laptop. It hung during obot at the same place.

I'm going to set the x2apic_disable=0 by default in 24 hours so people
have time to fix this without it impacting the functionality of -HEAD
by default.

Thanks,



-adrian
___
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: r279327 - stable/10/etc

2015-02-26 Thread Rui Paulo
Author: rpaulo
Date: Thu Feb 26 19:56:48 2015
New Revision: 279327
URL: https://svnweb.freebsd.org/changeset/base/279327

Log:
  MFC r278933:
Fix a typo in ipv6_down().
  
Submitted by:   Ashutosh Kumar AK0037447 at TechMahindra.com

Modified:
  stable/10/etc/network.subr
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/etc/network.subr
==
--- stable/10/etc/network.subr  Thu Feb 26 16:39:57 2015(r279326)
+++ stable/10/etc/network.subr  Thu Feb 26 19:56:48 2015(r279327)
@@ -761,7 +761,7 @@ ipv6_down()
IFS=$_ifs
for _inet6 in $inetList ; do
# get rid of extraneous line
-   case $_inet in
+   case $_inet6 in
inet6\ *)   ;;
*)  continue ;;
esac
___
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: r279328 - head

2015-02-26 Thread Ed Maste
Author: emaste
Date: Thu Feb 26 20:02:29 2015
New Revision: 279328
URL: https://svnweb.freebsd.org/changeset/base/279328

Log:
  Support CROSS_BINUTILS_PREFIX with in-tree compiler
  
  Reviewed by:  bapt, imp
  Sponsored by: The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D1974

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Feb 26 19:56:48 2015(r279327)
+++ head/Makefile.inc1  Thu Feb 26 20:02:29 2015(r279328)
@@ -371,7 +371,13 @@ XCFLAGS+=  -target ${TARGET_TRIPLE}
 XCFLAGS+=  --sysroot=${WORLDTMP} ${BFLAGS}
 XCXXFLAGS+=--sysroot=${WORLDTMP} ${BFLAGS}
 .endif
+.else
+.if defined(CROSS_BINUTILS_PREFIX)  exists(${CROSS_BINUTILS_PREFIX})
+BFLAGS+=   -B${CROSS_BINUTILS_PREFIX}
+XCFLAGS+=  ${BFLAGS}
+XCXXFLAGS+=${BFLAGS}
 .endif
+.endif # ${XCC:M/*}
 
 WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 
DESTDIR=${WORLDTMP}
 
___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Peter Grehan

I'm going to set the x2apic_disable=0 by default in 24 hours so people
have time to fix this without it impacting the functionality of -HEAD
by default.


 What gives you the right to make this decision ?

later,

Peter.

___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Adrian Chadd
On 26 February 2015 at 12:17, Peter Grehan gre...@freebsd.org wrote:
 I'm going to set the x2apic_disable=0 by default in 24 hours so people
 have time to fix this without it impacting the functionality of -HEAD
 by default.

  What gives you the right to make this decision ?

This has been reported by more than one person, it's been a couple of
weeks, it's an actual regression, and there's no specific solution in
sight.

I'm happy to test solutions, but stalling on reverting a regression
reported by people running -HEAD is irresponsible.

So, no, I don't have any specific right over anyone else, but
everyone here has the /responsibility/ to keep things working.




-adrian
___
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: r279262 - head/sys/netinet

2015-02-26 Thread Rui Paulo

On Feb 24, 2015, at 09:43 PM, Xin LI delp...@freebsd.org wrote:

Author: delphij
Date: Wed Feb 25 05:42:59 2015
New Revision: 279262
URL: https://svnweb.freebsd.org/changeset/base/279262

Log:
Fix integer overflow in IGMP protocol.

Security:    FreeBSD-SA-15:04.igmp
Security:        CVE-2015-1414
Found by:        Mateusz Kocielski, Logicaltrust
Analyzed by:      Marek Kroemeke, Mateusz Kocielski (s...@netbsd.org) and
           22733db72ab3ed94b5f8a1ffcde850251fe6f466
 
It looks weird to me that a SHA1 hash is capable of analysing code Maybe 
the AI Winter has finally ended?  :-)
___
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: r278320 - in head: contrib/mdocml lib lib/libdevctl share/mk sys/dev/acpica sys/dev/pci sys/kern sys/sys usr.sbin usr.sbin/devctl

2015-02-26 Thread Mateusz Guzik
On Thu, Feb 26, 2015 at 07:46:38AM -0500, John Baldwin wrote:
 On Thursday, February 26, 2015 12:40:06 AM Mateusz Guzik wrote:
  On Fri, Feb 06, 2015 at 04:09:02PM +, John Baldwin wrote:
   Author: jhb
   Date: Fri Feb  6 16:09:01 2015
   New Revision: 278320
   URL: https://svnweb.freebsd.org/changeset/base/278320
   
   Log:
 Add a new device control utility for new-bus devices called devctl. 
 This
 allows the user to request administrative changes to individual devices
  
  [..]
  
   +static int
   +devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
   +struct thread *td)
   +{
   + struct devreq *req;
   + device_t dev;
   + int error, old;
   +
   + /* Locate the device to control. */
   + mtx_lock(Giant);
   + req = (struct devreq *)data;
  
  [..]
  
   + switch (cmd) {
  
  [..]
  
   + case DEV_SET_DRIVER: {
   + devclass_t dc;
   + char driver[128];
   +
   + error = copyinstr(req-dr_data, driver, sizeof(driver), NULL);
  
  [..]
  
   + if (!driver_exists(dev-parent, driver)) {
   + error = ENOENT;
   + break;
   + }
  
  [..]
  
   + }
   + mtx_unlock(Giant);
   + return (error);
   +}
  
  I only skimmed thourgh this, will not a page fault drop + reacquire Giant
  lock?
  
  iow, would not it be better to copy prior to taking the lock?
 
 It won't make a difference.  All the logic is done after the copy, so it is 
 still atomic.
 

Are devices guaranteed to be persistent?

find_device does ref them in any way, so i would assume that the dev you
found is only stable as long as Giant lock is held.

-- 
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Peter Grehan

This has been reported by more than one person, it's been a couple of
weeks, it's an actual regression, and there's no specific solution in
sight.


 It's been reported by you and one other, with no feedback from the 
other person despite requests for more information, and there would be a 
specific solution if those with an impacted system offered to help out.



I'm happy to test solutions, but stalling on reverting a regression
reported by people running -HEAD is irresponsible.


 Reported by 2 people, 2 weeks apart.

 Even more irresponsible to threaten to back out someone else's fix 
without even offering to help diagnose when there is a simple workaround 
available.


later,

Peter.
___
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: r279329 - in stable/10: sbin/camcontrol sys/cam sys/cam/scsi sys/dev/mpr sys/dev/mps sys/sys

2015-02-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb 26 20:46:16 2015
New Revision: 279329
URL: https://svnweb.freebsd.org/changeset/base/279329

Log:
  MFC r278964:
  
  The __FreeBSD_version was changed to 1001510 to be appropriate for
  stable/10.
  
  I will followup with a commit to mpr(4) and mps(4) in head to reflect
  the stable/10 __FreeBSD_version and merge the change back to stable/10.
  

r278964 | ken | 2015-02-18 11:30:19 -0700 (Wed, 18 Feb 2015) | 46 lines
  
Make sure that the flags for the XPT_DEV_ADVINFO CCB are initialized
properly.
  
If there is garbage in the flags field, it can sometimes include a
set CDAI_FLAG_STORE flag, which may cause either an error or
perhaps result in overwriting the field that was intended to be
read.
  
sys/cam/cam_ccb.h:
Add a new flag to the XPT_DEV_ADVINFO CCB, CDAI_FLAG_NONE,
that callers can use to set the flags field when no store
is desired.
  
sys/cam/scsi/scsi_enc_ses.c:
In ses_setphyspath_callback(), explicitly set the
XPT_DEV_ADVINFO flags to CDAI_FLAG_NONE when fetching the
physical path information.  Instead of ORing in the
CDAI_FLAG_STORE flag when storing the physical path, set
the flags field to CDAI_FLAG_STORE.
  
sys/cam/scsi/scsi_sa.c:
Set the XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE when
fetching extended inquiry information.
  
sys/cam/scsi/scsi_da.c:
When storing extended READ CAPACITY information, set the
XPT_DEV_ADVINFO flags field to CDAI_FLAG_STORE instead of
ORing it into a field that isn't initialized.
  
sys/dev/mpr/mpr_sas.c,
sys/dev/mps/mps_sas.c:
When fetching extended READ CAPACITY information, set the
XPT_DEV_ADVINFO flags field to CDAI_FLAG_NONE instead of
setting it to 0.
  
sbin/camcontrol/camcontrol.c:
When fetching a device ID, set the XPT_DEV_ADVINFO flags
field to CDAI_FLAG_NONE instead of 0.
  
sys/sys/param.h:
Bump __FreeBSD_version to 1100061 for the new XPT_DEV_ADVINFO
CCB flag, CDAI_FLAG_NONE.
  
Sponsored by:   Spectra Logic

Modified:
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sys/cam/cam_ccb.h
  stable/10/sys/cam/scsi/scsi_da.c
  stable/10/sys/cam/scsi/scsi_enc_ses.c
  stable/10/sys/dev/mpr/mpr_sas.c
  stable/10/sys/dev/mps/mps_sas.c
  stable/10/sys/sys/param.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.c
==
--- stable/10/sbin/camcontrol/camcontrol.c  Thu Feb 26 20:02:29 2015
(r279328)
+++ stable/10/sbin/camcontrol/camcontrol.c  Thu Feb 26 20:46:16 2015
(r279329)
@@ -7404,7 +7404,7 @@ getdevid(struct cam_devitem *item)
 retry:
ccb-ccb_h.func_code = XPT_DEV_ADVINFO;
ccb-ccb_h.flags = CAM_DIR_IN;
-   ccb-cdai.flags = 0;
+   ccb-cdai.flags = CDAI_FLAG_NONE;
ccb-cdai.buftype = CDAI_TYPE_SCSI_DEVID;
ccb-cdai.bufsiz = item-device_id_len;
if (item-device_id_len != 0)

Modified: stable/10/sys/cam/cam_ccb.h
==
--- stable/10/sys/cam/cam_ccb.h Thu Feb 26 20:02:29 2015(r279328)
+++ stable/10/sys/cam/cam_ccb.h Thu Feb 26 20:46:16 2015(r279329)
@@ -1145,6 +1145,7 @@ struct ccb_eng_exec { /* This structure 
 struct ccb_dev_advinfo {
struct ccb_hdr ccb_h;
uint32_t flags;
+#defineCDAI_FLAG_NONE  0x0 /* No flags set */
 #defineCDAI_FLAG_STORE 0x1 /* If set, action becomes store 
*/
uint32_t buftype;   /* IN: Type of data being requested */
/* NB: buftype is interpreted on a per-transport basis */

Modified: stable/10/sys/cam/scsi/scsi_da.c
==
--- stable/10/sys/cam/scsi/scsi_da.cThu Feb 26 20:02:29 2015
(r279328)
+++ stable/10/sys/cam/scsi/scsi_da.cThu Feb 26 20:46:16 2015
(r279329)
@@ -3784,7 +3784,7 @@ dasetgeom(struct cam_periph *periph, uin
xpt_setup_ccb(cdai.ccb_h, periph-path, CAM_PRIORITY_NORMAL);
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-   cdai.flags |= CDAI_FLAG_STORE;
+   cdai.flags = CDAI_FLAG_STORE;
cdai.bufsiz = rcap_len;
cdai.buf = (uint8_t *)rcaplong;
xpt_action((union ccb *)cdai);

Modified: stable/10/sys/cam/scsi/scsi_enc_ses.c
==
--- stable/10/sys/cam/scsi/scsi_enc_ses.c   Thu Feb 26 20:02:29 2015
(r279328)
+++ stable/10/sys/cam/scsi/scsi_enc_ses.c   Thu Feb 26 20:46:16 2015
(r279329)
@@ -1007,7 

svn commit: r279330 - head/bin/sh

2015-02-26 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Feb 26 20:59:18 2015
New Revision: 279330
URL: https://svnweb.freebsd.org/changeset/base/279330

Log:
  Fix unitialized variable that broke sh on PowerPC starting with r278826.

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==
--- head/bin/sh/expand.cThu Feb 26 20:46:16 2015(r279329)
+++ head/bin/sh/expand.cThu Feb 26 20:59:18 2015(r279330)
@@ -635,7 +635,7 @@ evalvar(char *p, int flag)
int varlenb;
int easy;
int quotes = flag  (EXP_FULL | EXP_CASE);
-   int record;
+   int record = 0;
 
varflags = (unsigned char)*p++;
subtype = varflags  VSTYPE;
___
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: r279330 - head/bin/sh

2015-02-26 Thread Andreas Tobler

On 26.02.15 21:59, Nathan Whitehorn wrote:

Author: nwhitehorn
Date: Thu Feb 26 20:59:18 2015
New Revision: 279330
URL: https://svnweb.freebsd.org/changeset/base/279330

Log:
   Fix unitialized variable that broke sh on PowerPC starting with r278826.


Thanks Nathan!

Andreas

___
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: r279300 - in head/sys: kern sys

2015-02-26 Thread hiren panchasara
On 02/25/15 at 09:59P, Adrian Chadd wrote:
 Author: adrian
 Date: Wed Feb 25 21:59:03 2015
 New Revision: 279300
 URL: https://svnweb.freebsd.org/changeset/base/279300
 
 Log:
   Remove taskqueue_start_threads_pinned(); there's noa generic cpuset version 
 of this.
   
   Sponsored by:   Norse Corp, Inc.
 
 Modified:
   head/sys/kern/subr_taskqueue.c
   head/sys/sys/taskqueue.h
 
 Modified: head/sys/kern/subr_taskqueue.c
 ==
 --- head/sys/kern/subr_taskqueue.cWed Feb 25 21:44:53 2015
 (r279299)
 +++ head/sys/kern/subr_taskqueue.cWed Feb 25 21:59:03 2015
 (r279300)
 @@ -659,30 +659,6 @@ taskqueue_start_threads_cpuset(struct ta
   return (error);
  }
  
 -int
 -taskqueue_start_threads_pinned(struct taskqueue **tqp, int count, int pri,
 -int cpu_id, const char *name, ...)
 -{
 - cpuset_t mask;
 - va_list ap;
 - int error;
 -
 - /*
 -  * In case someone passes in NOCPU, just fall back to the
 -  * default behaviour of don't pin.
 -  */
 - if (cpu_id != NOCPU) {
 - CPU_ZERO(mask);
 - CPU_SET(cpu_id, mask);
 - }
 -
 - va_start(ap, name);
 - error = _taskqueue_start_threads(tqp, count, pri,
 - cpu_id == NOCPU ? NULL : mask, name, ap);
 - va_end(ap);
 - return (error);
 -}
 -
  static inline void
  taskqueue_run_callback(struct taskqueue *tq,
  enum taskqueue_callback_type cb_type)
 
 Modified: head/sys/sys/taskqueue.h
 ==
 --- head/sys/sys/taskqueue.h  Wed Feb 25 21:44:53 2015(r279299)
 +++ head/sys/sys/taskqueue.h  Wed Feb 25 21:59:03 2015(r279300)
 @@ -74,10 +74,6 @@ inttaskqueue_start_threads(struct taskq
   const char *name, ...) __printflike(4, 5);
  int  taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count,
   int pri, cpuset_t *mask, const char *name, ...) __printflike(5, 6);
 -int  taskqueue_start_threads_pinned(struct taskqueue **tqp, int count,
 - int pri, int cpu_id, const char *name,
 - ...) __printflike(5, 6);
 -
  int  taskqueue_enqueue(struct taskqueue *queue, struct task *task);
  int  taskqueue_enqueue_timeout(struct taskqueue *queue,
   struct timeout_task *timeout_task, int ticks);


Can you please update the manpage if you haven't already?

Cheers,
Hiren


pgp93V_bBs7HB.pgp
Description: PGP signature


Re: svn commit: r278320 - in head: contrib/mdocml lib lib/libdevctl share/mk sys/dev/acpica sys/dev/pci sys/kern sys/sys usr.sbin usr.sbin/devctl

2015-02-26 Thread John Baldwin
On Thursday, February 26, 2015 08:28:33 PM Mateusz Guzik wrote:
 On Thu, Feb 26, 2015 at 07:46:38AM -0500, John Baldwin wrote:
  On Thursday, February 26, 2015 12:40:06 AM Mateusz Guzik wrote:
   On Fri, Feb 06, 2015 at 04:09:02PM +, John Baldwin wrote:
Author: jhb
Date: Fri Feb  6 16:09:01 2015
New Revision: 278320
URL: https://svnweb.freebsd.org/changeset/base/278320

Log:
  Add a new device control utility for new-bus devices called devctl.
  This
  allows the user to request administrative changes to individual
  devices
   
   [..]
   
+static int
+devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag,
+struct thread *td)
+{
+   struct devreq *req;
+   device_t dev;
+   int error, old;
+
+   /* Locate the device to control. */
+   mtx_lock(Giant);
+   req = (struct devreq *)data;
   
   [..]
   
+   switch (cmd) {
   
   [..]
   
+   case DEV_SET_DRIVER: {
+   devclass_t dc;
+   char driver[128];
+
+   error = copyinstr(req-dr_data, driver, sizeof(driver), 
NULL);
   
   [..]
   
+   if (!driver_exists(dev-parent, driver)) {
+   error = ENOENT;
+   break;
+   }
   
   [..]
   
+   }
+   mtx_unlock(Giant);
+   return (error);
+}
   
   I only skimmed thourgh this, will not a page fault drop + reacquire
   Giant
   lock?
   
   iow, would not it be better to copy prior to taking the lock?
  
  It won't make a difference.  All the logic is done after the copy, so it
  is
  still atomic.
 
 Are devices guaranteed to be persistent?
 
 find_device does ref them in any way, so i would assume that the dev you
 found is only stable as long as Giant lock is held.

Ah, fair enough.  Even when new-bus doesn't need Giant it would probably need 
this fix as well.


-- 
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


svn commit: r279314 - head/usr.sbin/ctld

2015-02-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 26 09:08:48 2015
New Revision: 279314
URL: https://svnweb.freebsd.org/changeset/base/279314

Log:
  Add missing error check.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.sbin/ctld/parse.y

Modified: head/usr.sbin/ctld/parse.y
==
--- head/usr.sbin/ctld/parse.y  Thu Feb 26 07:51:43 2015(r279313)
+++ head/usr.sbin/ctld/parse.y  Thu Feb 26 09:08:48 2015(r279314)
@@ -774,6 +774,7 @@ target_lun: LUN lun_number
 lun_number:STR
{
uint64_t tmp;
+   int ret;
char *name;
 
if (expand_number($1, tmp) != 0) {
@@ -782,7 +783,9 @@ lun_number: STR
return (1);
}
 
-   asprintf(name, %s,lun,%ju, target-t_name, tmp);
+   ret = asprintf(name, %s,lun,%ju, target-t_name, tmp);
+   if (ret = 0)
+   log_err(1, asprintf);
lun = lun_new(conf, name);
if (lun == NULL)
return (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: r279315 - in head/usr.sbin: . uefisign

2015-02-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 26 09:15:24 2015
New Revision: 279315
URL: https://svnweb.freebsd.org/changeset/base/279315

Log:
  Add uefisign(8), UEFI Secure Boot signing utility.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Added:
  head/usr.sbin/uefisign/
  head/usr.sbin/uefisign/Makefile   (contents, props changed)
  head/usr.sbin/uefisign/child.c   (contents, props changed)
  head/usr.sbin/uefisign/magic.h   (contents, props changed)
  head/usr.sbin/uefisign/pe.c   (contents, props changed)
  head/usr.sbin/uefisign/uefisign.8   (contents, props changed)
  head/usr.sbin/uefisign/uefisign.c   (contents, props changed)
  head/usr.sbin/uefisign/uefisign.h   (contents, props changed)
Modified:
  head/usr.sbin/Makefile

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Thu Feb 26 09:08:48 2015(r279314)
+++ head/usr.sbin/Makefile  Thu Feb 26 09:15:24 2015(r279315)
@@ -86,6 +86,7 @@ SUBDIR=   adduser \
traceroute \
trpt \
tzsetup \
+   uefisign \
ugidfw \
vigr \
vipw \

Added: head/usr.sbin/uefisign/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/uefisign/Makefile Thu Feb 26 09:15:24 2015
(r279315)
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+PROG=  uefisign
+SRCS=  uefisign.c child.c pe.c
+MAN=   uefisign.8
+
+LDFLAGS=   -lcrypto
+
+WARNS= 6
+
+.include bsd.prog.mk

Added: head/usr.sbin/uefisign/child.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/uefisign/child.c  Thu Feb 26 09:15:24 2015
(r279315)
@@ -0,0 +1,277 @@
+/*-
+ * Copyright (c) 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#include sys/cdefs.h
+__FBSDID($FreeBSD$);
+
+#include sys/param.h
+#if __FreeBSD_version = 110
+#include sys/capsicum.h
+#else
+#include sys/capability.h
+#endif
+#include sys/types.h
+#include sys/stat.h
+#include assert.h
+#include err.h
+#include errno.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include openssl/evp.h
+#include openssl/err.h
+#include openssl/pem.h
+
+#include uefisign.h
+
+static void
+load(struct executable *x)
+{
+   int error, fd;
+   struct stat sb;
+   char *buf;
+   size_t nread, len;
+
+   fd = fileno(x-x_fp);
+
+   error = fstat(fd, sb);
+   if (error != 0)
+   err(1, %s: fstat, x-x_path);
+
+   len = sb.st_size;
+   if (len = 0)
+   errx(1, %s: file is empty, x-x_path);
+
+   buf = malloc(len);
+   if (buf == NULL)
+   err(1, %s: cannot malloc %zd bytes, x-x_path, len);
+
+   nread = fread(buf, len, 1, x-x_fp);
+   if (nread != 1)
+   err(1, %s: fread, x-x_path);
+
+   x-x_buf = buf;
+   x-x_len = len;
+}
+
+static void
+digest_range(struct executable *x, EVP_MD_CTX *mdctx, off_t off, size_t len)
+{
+   int ok;
+
+   range_check(x, off, len, chunk);
+
+   ok = EVP_DigestUpdate(mdctx, x-x_buf + off, len);
+   if (ok == 0) {
+   ERR_print_errors_fp(stderr);
+   errx(1, EVP_DigestUpdate(3) failed);
+   }
+}
+
+static void
+digest(struct executable *x)
+{
+   EVP_MD_CTX *mdctx;
+   const EVP_MD *md;
+   size_t sum_of_bytes_hashed;
+   int 

svn commit: r279316 - head/share/man/man8

2015-02-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 26 09:16:36 2015
New Revision: 279316
URL: https://svnweb.freebsd.org/changeset/base/279316

Log:
  Add uefisign(8) reference to uefi(8) manual page.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man8/uefi.8

Modified: head/share/man/man8/uefi.8
==
--- head/share/man/man8/uefi.8  Thu Feb 26 09:15:24 2015(r279315)
+++ head/share/man/man8/uefi.8  Thu Feb 26 09:16:36 2015(r279316)
@@ -24,7 +24,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 17, 2014
+.Dd February 26, 2015
 .Dt UEFI 8
 .Os
 .Sh NAME
@@ -114,7 +114,8 @@ typical non-default kernel (optional)
 .Xr vt 4 ,
 .Xr msdosfs 5 ,
 .Xr boot 8 ,
-.Xr gpart 8
+.Xr gpart 8 , 
+.Xr uefisign 8
 .Sh HISTORY
 .Nm
 boot support first appeared in
___
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: r279317 - in head: etc/mtree share/examples share/examples/uefisign

2015-02-26 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Feb 26 09:31:25 2015
New Revision: 279317
URL: https://svnweb.freebsd.org/changeset/base/279317

Log:
  Add key/cert generation script for uefisign(8).
  
  (Forgot about Relnotes in the commit that added uefisign(8), so set it here.)
  
  MFC after:1 month
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Added:
  head/share/examples/uefisign/
  head/share/examples/uefisign/uefikeys   (contents, props changed)
Modified:
  head/etc/mtree/BSD.usr.dist
  head/share/examples/Makefile

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Thu Feb 26 09:16:36 2015(r279316)
+++ head/etc/mtree/BSD.usr.dist Thu Feb 26 09:31:25 2015(r279317)
@@ -415,6 +415,8 @@
 ..
 tcsh
 ..
+uefisign
+..
 ..
 games
 fortune

Modified: head/share/examples/Makefile
==
--- head/share/examples/MakefileThu Feb 26 09:16:36 2015
(r279316)
+++ head/share/examples/MakefileThu Feb 26 09:31:25 2015
(r279317)
@@ -27,7 +27,8 @@ LDIRS=BSD_daemon \
printing \
ses \
scsi_target \
-   sunrpc
+   sunrpc \
+   uefisign
 
 XFILES=BSD_daemon/FreeBSD.pfa \
BSD_daemon/README \
@@ -181,7 +182,8 @@ XFILES= BSD_daemon/FreeBSD.pfa \
sunrpc/sort/Makefile \
sunrpc/sort/rsort.c \
sunrpc/sort/sort.x \
-   sunrpc/sort/sort_proc.c
+   sunrpc/sort/sort_proc.c \
+   uefisign/uefikeys
 
 BINDIR= ${SHAREDIR}/examples
 

Added: head/share/examples/uefisign/uefikeys
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/examples/uefisign/uefikeys   Thu Feb 26 09:31:25 2015
(r279317)
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# See uefisign(8) manual page for usage instructions.
+#
+# $FreeBSD$
+#
+
+die() {
+   echo $*  /dev/stderr
+   exit 1
+}
+
+if [ $# -ne 1 ]; then
+   echo usage: $0 common-name
+   exit 1
+fi
+
+certfile=${1}.pem
+efifile=${1}.cer
+keyfile=${1}.key
+p12file=${1}.p12
+# XXX: Set this to ten years; we don't want system to suddenly stop booting
+#  due to certificate expiration.  Better way would be to use Authenticode
+#  Timestamp.  That said, the rumor is UEFI implementations ignore it 
anyway.
+days=3650
+subj=/CN=${1}
+
+[ ! -e ${certfile} ] || die ${certfile} already exists
+[ ! -e ${efifile} ] || die ${efifile} already exists
+[ ! -e ${keyfile} ] || die ${keyfile} already exists
+[ ! -e ${p12file} ] || die ${p12file} already exists
+
+umask 077 || die umask 077 failed
+
+openssl genrsa -out ${keyfile} 2048 2 /dev/null || die openssl genrsa 
failed
+openssl req -new -x509 -sha256 -days ${days} -subj ${subj} -key 
${keyfile} -out ${certfile} || die openssl req failed
+openssl x509 -inform PEM -outform DER -in ${certfile} -out ${efifile} || 
die openssl x509 failed
+openssl pkcs12 -export -out ${p12file} -inkey ${keyfile} -in ${certfile} 
-password 'pass:' || die openssl pkcs12 failed
+
+echo certificate: ${certfile}; private key: ${keyfile}; UEFI public key: 
${efifile}; private key with empty password for pesign: ${p12file}
___
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: r279318 - head/lib/libstdthreads

2015-02-26 Thread Konstantin Belousov
Author: kib
Date: Thu Feb 26 09:42:03 2015
New Revision: 279318
URL: https://svnweb.freebsd.org/changeset/base/279318

Log:
  Check that the pointer to the thread return value is not NULL before
  dereferencing. NULL is allowed by C11 and must be handled.
  
  Reported and tested by:   Vineela vineela...@yahoo.com
  PR:   198038
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/lib/libstdthreads/thrd.c

Modified: head/lib/libstdthreads/thrd.c
==
--- head/lib/libstdthreads/thrd.c   Thu Feb 26 09:31:25 2015
(r279317)
+++ head/lib/libstdthreads/thrd.c   Thu Feb 26 09:42:03 2015
(r279318)
@@ -108,7 +108,8 @@ thrd_join(thrd_t thr, int *res)
 
if (pthread_join(thr, value_ptr) != 0)
return (thrd_error);
-   *res = (intptr_t)value_ptr;
+   if (res != NULL)
+   *res = (intptr_t)value_ptr;
return (thrd_success);
 }
 
___
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: r279315 - in head/usr.sbin: . uefisign

2015-02-26 Thread Baptiste Daroussin
On Thu, Feb 26, 2015 at 09:15:25AM +, Edward Tomasz Napierala wrote:
 Author: trasz
 Date: Thu Feb 26 09:15:24 2015
 New Revision: 279315
 URL: https://svnweb.freebsd.org/changeset/base/279315
 
 Log:
   Add uefisign(8), UEFI Secure Boot signing utility.
   
   MFC after:  1 month
   Sponsored by:   The FreeBSD Foundation
 
 Added:
   head/usr.sbin/uefisign/
   head/usr.sbin/uefisign/Makefile   (contents, props changed)
   head/usr.sbin/uefisign/child.c   (contents, props changed)
   head/usr.sbin/uefisign/magic.h   (contents, props changed)
   head/usr.sbin/uefisign/pe.c   (contents, props changed)
   head/usr.sbin/uefisign/uefisign.8   (contents, props changed)
   head/usr.sbin/uefisign/uefisign.c   (contents, props changed)
   head/usr.sbin/uefisign/uefisign.h   (contents, props changed)
 Modified:
   head/usr.sbin/Makefile
 
 Modified: head/usr.sbin/Makefile
 ==
 --- head/usr.sbin/MakefileThu Feb 26 09:08:48 2015(r279314)
 +++ head/usr.sbin/MakefileThu Feb 26 09:15:24 2015(r279315)
 @@ -86,6 +86,7 @@ SUBDIR= adduser \
   traceroute \
   trpt \
   tzsetup \
 + uefisign \
   ugidfw \
   vigr \
   vipw \
 
 Added: head/usr.sbin/uefisign/Makefile
 ==
 --- /dev/null 00:00:00 1970   (empty, because file is newly added)
 +++ head/usr.sbin/uefisign/Makefile   Thu Feb 26 09:15:24 2015
 (r279315)
 @@ -0,0 +1,11 @@
 +# $FreeBSD$
 +
 +PROG=uefisign
 +SRCS=uefisign.c child.c pe.c
 +MAN= uefisign.8
 +
 +LDFLAGS= -lcrypto
LIBADD= crypto ?
 +
 +WARNS=   6
 +
 +.include bsd.prog.mk
 

regards,
Bapt


pgpxziWFgRV8V.pgp
Description: PGP signature


svn commit: r279319 - in head/sys/x86: include x86

2015-02-26 Thread Konstantin Belousov
Author: kib
Date: Thu Feb 26 11:02:40 2015
New Revision: 279319
URL: https://svnweb.freebsd.org/changeset/base/279319

Log:
  Implements EOI suppression mode, where LAPIC on EOI command for
  level-triggered interrupt does not broadcast the EOI message to all
  APICs in the system.  Instead, interrupt handler must follow LAPIC EOI
  with IOAPIC EOI.  For modern IOAPICs, the later is done by writing to
  EOIR register.  Otherwise, Intel provided Linux with a trick of
  temporary switching the pin config to edge and then back to level.
  
  Detect presence of EOIR register by reading IO-APIC version.  The
  summary table in the comments was taken from the Linux kernel.  For
  Intel, newer IO-APICs are only briefly documented as part of the
  ICH/PCH datasheet.  According to the BKDG and chipset documentation,
  AMD LAPICs do not provide EOI suppression, althought IO-APICs do
  declare version 0x21 and implement EOIR.
  
  The trick to temporary switch pin to edge mode to clear IRR was tested
  on modern chipset, by pretending that EOIR is not present, i.e. by
  forcing io_haseoi to zero.
  
  Tunable hw.lapic_eoi_suppression disables the optimization.
  
  Reviewed by:  neel
  Tested by:pho
  Review:   https://reviews.freebsd.org/D1943
  Sponsored by: The FreeBSD Foundation
  MFC after:2 months

Modified:
  head/sys/x86/include/apicvar.h
  head/sys/x86/x86/io_apic.c
  head/sys/x86/x86/local_apic.c

Modified: head/sys/x86/include/apicvar.h
==
--- head/sys/x86/include/apicvar.h  Thu Feb 26 09:42:03 2015
(r279318)
+++ head/sys/x86/include/apicvar.h  Thu Feb 26 11:02:40 2015
(r279319)
@@ -426,6 +426,7 @@ voidlapic_handle_timer(struct trapframe
 void   xen_intr_handle_upcall(struct trapframe *frame);
 
 extern int x2apic_mode;
+extern int lapic_eoi_suppression;
 
 #ifdef _SYS_SYSCTL_H_
 SYSCTL_DECL(_hw_apic);

Modified: head/sys/x86/x86/io_apic.c
==
--- head/sys/x86/x86/io_apic.c  Thu Feb 26 09:42:03 2015(r279318)
+++ head/sys/x86/x86/io_apic.c  Thu Feb 26 11:02:40 2015(r279319)
@@ -97,6 +97,7 @@ struct ioapic {
u_int io_apic_id:4;
u_int io_intbase:8; /* System Interrupt base */
u_int io_numintr:8;
+   u_int io_haseoi:1;
volatile ioapic_t *io_addr; /* XXX: should use bus_space */
vm_paddr_t io_paddr;
STAILQ_ENTRY(ioapic) io_next;
@@ -134,10 +135,53 @@ static int enable_extint;
 SYSCTL_INT(_hw_apic, OID_AUTO, enable_extint, CTLFLAG_RDTUN, enable_extint, 0,
 Enable the ExtINT pin in the first I/O APIC);
 
-static __inline void
-_ioapic_eoi_source(struct intsrc *isrc)
+static void
+_ioapic_eoi_source(struct intsrc *isrc, int locked)
 {
+   struct ioapic_intsrc *src;
+   struct ioapic *io;
+   volatile uint32_t *apic_eoi;
+   uint32_t low1;
+
lapic_eoi();
+   if (!lapic_eoi_suppression)
+   return;
+   src = (struct ioapic_intsrc *)isrc;
+   if (src-io_edgetrigger)
+   return;
+   io = (struct ioapic *)isrc-is_pic;
+
+   /*
+* Handle targeted EOI for level-triggered pins, if broadcast
+* EOI suppression is supported by LAPICs.
+*/
+   if (io-io_haseoi) {
+   /*
+* If IOAPIC has EOI Register, simply write vector
+* number into the reg.
+*/
+   apic_eoi = (volatile uint32_t *)((volatile char *)
+   io-io_addr + IOAPIC_EOIR);
+   *apic_eoi = src-io_vector;
+   } else {
+   /*
+* Otherwise, if IO-APIC is too old to provide EOIR,
+* do what Intel did for the Linux kernel. Temporary
+* switch the pin to edge-trigger and back, masking
+* the pin during the trick.
+*/
+   if (!locked)
+   mtx_lock_spin(icu_lock);
+   low1 = src-io_lowreg;
+   low1 = ~IOART_TRGRLVL;
+   low1 |= IOART_TRGREDG | IOART_INTMSET;
+   ioapic_write(io-io_addr, IOAPIC_REDTBL_LO(src-io_intpin),
+   low1);
+   ioapic_write(io-io_addr, IOAPIC_REDTBL_LO(src-io_intpin),
+   src-io_lowreg);
+   if (!locked)
+   mtx_unlock_spin(icu_lock);
+   }
 }
 
 static u_int
@@ -230,7 +274,7 @@ ioapic_disable_source(struct intsrc *isr
}
 
if (eoi == PIC_EOI)
-   _ioapic_eoi_source(isrc);
+   _ioapic_eoi_source(isrc, 1);
 
mtx_unlock_spin(icu_lock);
 }
@@ -239,7 +283,7 @@ static void
 ioapic_eoi_source(struct intsrc *isrc)
 {
 
-   _ioapic_eoi_source(isrc);
+   _ioapic_eoi_source(isrc, 0);
 }
 
 /*
@@ -545,6 +589,22 @@ ioapic_create(vm_paddr_t addr, int32_t a
io-io_addr = apic;
   

Re: svn commit: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Peter Grehan

Koop did provide feedback shortly after Kib asked him to provide
information and test a patch. There wasn't a response from kib or
anyone else until I reported the same bug.


 http://docs.FreeBSD.org/cgi/mid.cgi?20150219200900.GH34251

later,

Peter.

___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Adrian Chadd
On 26 February 2015 at 12:36, Peter Grehan gre...@freebsd.org wrote:
 This has been reported by more than one person, it's been a couple of
 weeks, it's an actual regression, and there's no specific solution in
 sight.


  It's been reported by you and one other, with no feedback from the other
 person despite requests for more information, and there would be a specific
 solution if those with an impacted system offered to help out.

 I'm happy to test solutions, but stalling on reverting a regression
 reported by people running -HEAD is irresponsible.


  Reported by 2 people, 2 weeks apart.

  Even more irresponsible to threaten to back out someone else's fix without
 even offering to help diagnose when there is a simple workaround available.

I'm not suggesting anything is backed out. I'm suggesting that we just
disable it until it's fixed. That way we don't end up with other
people complaining that things hang the way that they do and then
assume FreeBSD is just plain broken and give up.




-adrian
___
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: r279300 - in head/sys: kern sys

2015-02-26 Thread Adrian Chadd
I'm going to do this soon. Just need to get some help from doc@.

I was waiting until I killed _pinned() so I wouldn't have to do it twice.

Thanks (and keep poking me until i do it!)


-a


On 26 February 2015 at 13:22, hiren panchasara
hi...@strugglingcoder.info wrote:
 On 02/25/15 at 09:59P, Adrian Chadd wrote:
 Author: adrian
 Date: Wed Feb 25 21:59:03 2015
 New Revision: 279300
 URL: https://svnweb.freebsd.org/changeset/base/279300

 Log:
   Remove taskqueue_start_threads_pinned(); there's noa generic cpuset 
 version of this.

   Sponsored by:   Norse Corp, Inc.

 Modified:
   head/sys/kern/subr_taskqueue.c
   head/sys/sys/taskqueue.h

 Modified: head/sys/kern/subr_taskqueue.c
 ==
 --- head/sys/kern/subr_taskqueue.cWed Feb 25 21:44:53 2015
 (r279299)
 +++ head/sys/kern/subr_taskqueue.cWed Feb 25 21:59:03 2015
 (r279300)
 @@ -659,30 +659,6 @@ taskqueue_start_threads_cpuset(struct ta
   return (error);
  }

 -int
 -taskqueue_start_threads_pinned(struct taskqueue **tqp, int count, int pri,
 -int cpu_id, const char *name, ...)
 -{
 - cpuset_t mask;
 - va_list ap;
 - int error;
 -
 - /*
 -  * In case someone passes in NOCPU, just fall back to the
 -  * default behaviour of don't pin.
 -  */
 - if (cpu_id != NOCPU) {
 - CPU_ZERO(mask);
 - CPU_SET(cpu_id, mask);
 - }
 -
 - va_start(ap, name);
 - error = _taskqueue_start_threads(tqp, count, pri,
 - cpu_id == NOCPU ? NULL : mask, name, ap);
 - va_end(ap);
 - return (error);
 -}
 -
  static inline void
  taskqueue_run_callback(struct taskqueue *tq,
  enum taskqueue_callback_type cb_type)

 Modified: head/sys/sys/taskqueue.h
 ==
 --- head/sys/sys/taskqueue.h  Wed Feb 25 21:44:53 2015(r279299)
 +++ head/sys/sys/taskqueue.h  Wed Feb 25 21:59:03 2015(r279300)
 @@ -74,10 +74,6 @@ inttaskqueue_start_threads(struct taskq
   const char *name, ...) __printflike(4, 5);
  int  taskqueue_start_threads_cpuset(struct taskqueue **tqp, int count,
   int pri, cpuset_t *mask, const char *name, ...) __printflike(5, 6);
 -int  taskqueue_start_threads_pinned(struct taskqueue **tqp, int count,
 - int pri, int cpu_id, const char *name,
 - ...) __printflike(5, 6);
 -
  int  taskqueue_enqueue(struct taskqueue *queue, struct task *task);
  int  taskqueue_enqueue_timeout(struct taskqueue *queue,
   struct timeout_task *timeout_task, int ticks);


 Can you please update the manpage if you haven't already?

 Cheers,
 Hiren
___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Peter Grehan

I'm not suggesting anything is backed out. I'm suggesting that we
just disable it until it's fixed.


 Both Kostik and Neel gave their reasons for keeping it enabled. I'm 
adding to that.


That way we don't end up with other
people complaining that things hang the way that they do and then
assume FreeBSD is just plain broken and give up.

 If you really thought that you would be helping to get your rare 
outlier fixed instead of demanding 24-hour turnaround and unilateral 
reverting of functionality.


 That's all I'm going to say on this.

later,

Peter.
___
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: r279341 - head/sys/mips/nlm

2015-02-26 Thread Jayachandran C.
Author: jchandra
Date: Fri Feb 27 00:57:09 2015
New Revision: 279341
URL: https://svnweb.freebsd.org/changeset/base/279341

Log:
  Improve additional interrupt ACK for Broadcom XLP
  
  Handling some interrupts in XLP (like PCIe and SATA) involves writing to
  vendor specific registers as part of interrupt acknowledgement.
  
  This was earlier done with xlp_establish_intr(), but a better solution
  is to provide a function xlp_set_bus_ack() that can be used with
  cpu_establish_hardintr(). This will allow platform initialization code to
  setup these ACKs without changing the standrard drivers.

Modified:
  head/sys/mips/nlm/interrupt.h
  head/sys/mips/nlm/intr_machdep.c
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/mips/nlm/interrupt.h
==
--- head/sys/mips/nlm/interrupt.h   Fri Feb 27 00:54:53 2015
(r279340)
+++ head/sys/mips/nlm/interrupt.h   Fri Feb 27 00:57:09 2015
(r279341)
@@ -68,9 +68,7 @@
  * XLR needs custom pre and post handlers for PCI/PCI-e interrupts
  * XXX: maybe follow i386 intsrc model
  */
-void xlp_establish_intr(const char *name, driver_filter_t filt,
-driver_intr_t handler, void *arg, int irq, int flags,
-void **cookiep, void (*busack)(int));
 void xlp_enable_irq(int irq);
+void xlp_set_bus_ack(int irq, void (*ack)(int, void *), void *arg);
 
 #endif /* _RMI_INTERRUPT_H_ */

Modified: head/sys/mips/nlm/intr_machdep.c
==
--- head/sys/mips/nlm/intr_machdep.cFri Feb 27 00:54:53 2015
(r279340)
+++ head/sys/mips/nlm/intr_machdep.cFri Feb 27 00:57:09 2015
(r279341)
@@ -58,7 +58,8 @@ __FBSDID($FreeBSD$);
 #include mips/nlm/xlp.h
 
 struct xlp_intrsrc {
-   void (*busack)(int);/* Additional ack */
+   void (*bus_ack)(int, void *);   /* Additional ack */
+   void *bus_ack_arg;  /* arg for additional ack */
struct intr_event *ie;  /* event corresponding to intr */
int irq;
int irt;
@@ -119,23 +120,13 @@ cpu_establish_softintr(const char *name,
panic(Soft interrupts unsupported!\n);
 }
 
-void
-cpu_establish_hardintr(const char *name, driver_filter_t * filt,
-void (*handler) (void *), void *arg, int irq, int flags,
-void **cookiep)
-{
-
-   xlp_establish_intr(name, filt, handler, arg, irq, flags,
-   cookiep, NULL);
-}
-
 static void
 xlp_post_filter(void *source)
 {
struct xlp_intrsrc *src = source;

-   if (src-busack)
-   src-busack(src-irq);
+   if (src-bus_ack)
+   src-bus_ack(src-irq, src-bus_ack_arg);
nlm_pic_ack(xlp_pic_base, src-irt);
 }
 
@@ -144,8 +135,8 @@ xlp_pre_ithread(void *source)
 {
struct xlp_intrsrc *src = source;
 
-   if (src-busack)
-   src-busack(src-irq);
+   if (src-bus_ack)
+   src-bus_ack(src-irq, src-bus_ack_arg);
 }
 
 static void
@@ -157,19 +148,35 @@ xlp_post_ithread(void *source)
 }
 
 void
-xlp_establish_intr(const char *name, driver_filter_t filt,
-driver_intr_t handler, void *arg, int irq, int flags,
-void **cookiep, void (*busack)(int))
+xlp_set_bus_ack(int irq, void (*ack)(int, void *), void *arg)
+{
+   struct xlp_intrsrc *src;
+
+   KASSERT(irq  0  irq = XLR_MAX_INTR,
+   (%s called for bad hard intr %d, __func__, irq));
+
+   /* no locking needed - this will called early in boot */
+   src = xlp_interrupts[irq];
+   KASSERT(src-ie != NULL,
+   (%s called after IRQ enable for %d., __func__, irq));
+   src-bus_ack_arg = arg;
+   src-bus_ack = ack;
+}
+
+void
+cpu_establish_hardintr(const char *name, driver_filter_t * filt,
+void (*handler) (void *), void *arg, int irq, int flags,
+void **cookiep)
 {
struct intr_event *ie;  /* descriptor for the IRQ */
struct xlp_intrsrc *src = NULL;
int errcode;
 
-   if (irq  0 || irq  XLR_MAX_INTR)
-   panic(%s called for unknown hard intr %d, __func__, irq);
+   KASSERT(irq  0  irq = XLR_MAX_INTR ,
+   (%s called for bad hard intr %d, __func__, irq));
 
/*
-* FIXME locking - not needed now, because we do this only on
+* Locking - not needed now, because we do this only on
 * startup from CPU0
 */
src = xlp_interrupts[irq];
@@ -194,7 +201,6 @@ xlp_establish_intr(const char *name, dri
return;
}
src-irq = irq;
-   src-busack = busack;
src-ie = ie;
}
if (XLP_IRQ_IS_PICINTR(irq)) {

Modified: head/sys/mips/nlm/xlp_pci.c
==
--- head/sys/mips/nlm/xlp_pci.c Fri Feb 27 00:54:53 2015(r279340)
+++ head/sys/mips/nlm/xlp_pci.c Fri Feb 27 00:57:09 2015(r279341)
@@ 

svn commit: r279336 - in head/sys/dev: mpr mps

2015-02-26 Thread Kenneth D. Merry
Author: ken
Date: Thu Feb 26 22:22:06 2015
New Revision: 279336
URL: https://svnweb.freebsd.org/changeset/base/279336

Log:
  Add FreeBSD stable/10 version checks for the availability of the
  CDAI_FLAG_NONE advanced information CCB flag.
  
  Support for the flag was merged to stable/10 in r279329, and the
  __FreeBSD_version in stable/10 was bumped to 1001510.
  
  Check for that version in the mps(4) and mpr(4) drivers when determining
  whether to use the flag.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mps/mps_sas.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Thu Feb 26 21:30:40 2015(r279335)
+++ head/sys/dev/mpr/mpr_sas.c  Thu Feb 26 22:22:06 2015(r279336)
@@ -3082,7 +3082,8 @@ mprsas_async(void *callback_arg, uint32_
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.ccb_h.flags = CAM_DIR_IN;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-#if __FreeBSD_version = 1100061
+#if (__FreeBSD_version = 1100061) || \
+((__FreeBSD_version = 1001510)  (__FreeBSD_version  110))
cdai.flags = CDAI_FLAG_NONE;
 #else
cdai.flags = 0;

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Thu Feb 26 21:30:40 2015(r279335)
+++ head/sys/dev/mps/mps_sas.c  Thu Feb 26 22:22:06 2015(r279336)
@@ -3277,7 +3277,8 @@ mpssas_async(void *callback_arg, uint32_
cdai.ccb_h.func_code = XPT_DEV_ADVINFO;
cdai.ccb_h.flags = CAM_DIR_IN;
cdai.buftype = CDAI_TYPE_RCAPLONG;
-#if __FreeBSD_version = 1100061
+#if (__FreeBSD_version = 1100061) || \
+((__FreeBSD_version = 1001510)  (__FreeBSD_version  110))
cdai.flags = CDAI_FLAG_NONE;
 #else
cdai.flags = 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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Adrian Chadd
Peter,

Koop did provide feedback shortly after Kib asked him to provide
information and test a patch. There wasn't a response from kib or
anyone else until I reported the same bug.


-adrian
___
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: r279349 - head/sys/kern

2015-02-26 Thread Warner Losh
Author: imp
Date: Fri Feb 27 02:56:58 2015
New Revision: 279349
URL: https://svnweb.freebsd.org/changeset/base/279349

Log:
  Create sched_rand() and move the LCG code into that. Call this when
  we need randomness in ULE. This removes random() call from the
  rebalance interval code.
  
  Submitted by: Harrison Grundy
  Differential Revision: https://reviews.freebsd.org/D1968

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Fri Feb 27 02:53:44 2015(r279348)
+++ head/sys/kern/sched_ule.c   Fri Feb 27 02:56:58 2015(r279349)
@@ -302,6 +302,7 @@ static int sched_interact_score(struct t
 static void sched_interact_update(struct thread *);
 static void sched_interact_fork(struct thread *);
 static void sched_pctcpu_update(struct td_sched *, int);
+static int sched_random(void);
 
 /* Operations on per processor queues */
 static struct thread *tdq_choose(struct tdq *);
@@ -357,6 +358,22 @@ SDT_PROBE_DEFINE2(sched, , , surrender, 
 struct proc *);
 
 /*
+ * We need some randomness. Implement the classic Linear Congruential
+ * generator X_{n+1}=(aX_n+c) mod m. These values are optimized for
+ * m = 2^32, a = 69069 and c = 5. This is signed so that we can get
+ * both positive and negative values from it by shifting the value
+ * right.
+ */
+static int sched_random() 
+{
+int rnd, *rndptr;
+rndptr = DPCPU_PTR(randomval);
+rnd = *rndptr * 69069 + 5;
+*rndptr = rnd;
+return(rnd);
+} 
+
+/*
  * Print the threads waiting on a run-queue.
  */
 static void
@@ -651,7 +668,7 @@ cpu_search(const struct cpu_group *cg, s
cpuset_t cpumask;
struct cpu_group *child;
struct tdq *tdq;
-   int cpu, i, hload, lload, load, total, rnd, *rndptr;
+   int cpu, i, hload, lload, load, total, rnd;
 
total = 0;
cpumask = cg-cg_mask;
@@ -700,8 +717,7 @@ cpu_search(const struct cpu_group *cg, s
CPU_CLR(cpu, cpumask);
tdq = TDQ_CPU(cpu);
load = tdq-tdq_load * 256;
-   rndptr = DPCPU_PTR(randomval);
-   rnd = (*rndptr = *rndptr * 69069 + 5)  26;
+   rnd = sched_random()  26; /* -32 to +31 */
if (match  CPU_SEARCH_LOWEST) {
if (cpu == low-cs_prefer)
load -= 64;
@@ -861,14 +877,11 @@ sched_balance(void)
 {
struct tdq *tdq;
 
-   /*
-* Select a random time between .5 * balance_interval and
-* 1.5 * balance_interval.
-*/
-   balance_ticks = max(balance_interval / 2, 1);
-   balance_ticks += random() % balance_interval;
if (smp_started == 0 || rebalance == 0)
return;
+
+   balance_ticks = max(balance_interval / 2, 1) +
+((sched_random()  16) % balance_interval);
tdq = TDQ_SELF();
TDQ_UNLOCK(tdq);
sched_balance_group(cpu_top);
___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Peter Grehan

Anyway - I have that model laptop, it hangs after calling
ipi_startup() to the first AP with x2apic enabled. What can I do to
continue debugging?


 Please provide the info that Kostik requested here, try out the patch, 
and wait for the timezone in Ukraine to be a little more reasonable for 
a reply.


 http://docs.FreeBSD.org/cgi/mid.cgi?20150216174658.GI34251

 Use the workaround of setting hw.x2apic_enable=0 in the loader to fall 
back to stock APIC mode.


later,

Peter.

___
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: r279344 - head/lib/libc/net

2015-02-26 Thread Pedro F. Giffuni
Author: pfg
Date: Fri Feb 27 01:59:29 2015
New Revision: 279344
URL: https://svnweb.freebsd.org/changeset/base/279344

Log:
  Hint out check for unsigned negative values.
  
  On FreeBSD socklen_t is unsigned so the check negative len
  in inet6_opt_append() is redundant and likely to be optimized
  away by the compiler.
  
  On other operating systems this is not necessarily so, and
  in the future we may want to sign it so leave the check in
  but place it in a secondary position as a subtle indication
  that the bogus check is intentional.
  
  Discussed with:   rpaulo
  
  CID:  1017783

Modified:
  head/lib/libc/net/ip6opt.c

Modified: head/lib/libc/net/ip6opt.c
==
--- head/lib/libc/net/ip6opt.c  Fri Feb 27 01:20:17 2015(r279343)
+++ head/lib/libc/net/ip6opt.c  Fri Feb 27 01:59:29 2015(r279344)
@@ -419,7 +419,7 @@ inet6_opt_append(void *extbuf, socklen_t
 * The option data length must have a value between 0 and 255,
 * inclusive, and is the length of the option data that follows.
 */
-   if (len  0 || len  255)
+   if (len  255 || len  0 )
return(-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: r279342 - head/sys/net

2015-02-26 Thread Gleb Smirnoff
Author: glebius
Date: Fri Feb 27 01:15:23 2015
New Revision: 279342
URL: https://svnweb.freebsd.org/changeset/base/279342

Log:
  Hide struct ifmultiaddr under _KERNEL, too.

Modified:
  head/sys/net/if_var.h

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Fri Feb 27 00:57:09 2015(r279341)
+++ head/sys/net/if_var.h   Fri Feb 27 01:15:23 2015(r279342)
@@ -402,7 +402,6 @@ struct ifaddr {
 struct ifaddr *ifa_alloc(size_t size, int flags);
 void   ifa_free(struct ifaddr *ifa);
 void   ifa_ref(struct ifaddr *ifa);
-#endif /* _KERNEL */
 
 /*
  * Multicast address structure.  This is analogous to the ifaddr
@@ -418,8 +417,6 @@ struct ifmultiaddr {
struct  ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */
 };
 
-#ifdef _KERNEL
-
 extern struct rwlock ifnet_rwlock;
 extern struct sx ifnet_sxlock;
 
___
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: r279348 - stable/10/usr.sbin/jls

2015-02-26 Thread Jamie Gritton
Author: jamie
Date: Fri Feb 27 02:53:44 2015
New Revision: 279348
URL: https://svnweb.freebsd.org/changeset/base/279348

Log:
  MFC r279083:
  
Fix the logic for skipping parameters (with -s) that have jailsys
parents (such as host.hostname); these were being skipped all the time.
That it went this long without anyone noticing is a sign that this feature
isn't actually used by anyone, but it's there so it might as well work.
  
  MFC r279123:
  
Allow for parameters added with the JP_OPT flag to not exist.
That's why the flag exists in the first place.

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

Modified: stable/10/usr.sbin/jls/jls.c
==
--- stable/10/usr.sbin/jls/jls.cFri Feb 27 02:50:01 2015
(r279347)
+++ stable/10/usr.sbin/jls/jls.cFri Feb 27 02:53:44 2015
(r279348)
@@ -78,7 +78,7 @@ static void quoted_print(char *str);
 int
 main(int argc, char **argv)
 {
-   char *dot, *ep, *jname;
+   char *dot, *ep, *jname, *pname;
int c, i, jflags, jid, lastjid, pflags, spc;
 
jname = NULL;
@@ -178,10 +178,11 @@ main(int argc, char **argv)
for (i = 0; i  nparams; i++) {
if ((params[i].jp_flags  JP_USER) 
(dot = strchr(params[i].jp_name, '.'))) {
-   *dot = 0;
-   param_parent[i] = add_param(params[i].jp_name,
+   pname = alloca((dot - params[i].jp_name) + 1);
+   strlcpy(pname, params[i].jp_name,
+   (dot - params[i].jp_name) + 1);
+   param_parent[i] = add_param(pname,
NULL, (size_t)0, NULL, JP_OPT);
-   *dot = '.';
}
}
}
@@ -293,10 +294,8 @@ add_param(const char *name, void *value,
param-jp_flags |= flags;
return param - params;
}
-   if (jailparam_init(param, name)  0)
-   errx(1, %s, jail_errmsg);
-   param-jp_flags = flags;
-   if ((value != NULL ? jailparam_import_raw(param, value, valuelen)
+   if (jailparam_init(param, name)  0 ||
+   (value != NULL ? jailparam_import_raw(param, value, valuelen)
 : jailparam_import(param, value))  0) {
if (flags  JP_OPT) {
nparams--;
@@ -304,6 +303,7 @@ add_param(const char *name, void *value,
}
errx(1, %s, jail_errmsg);
}
+   param-jp_flags = flags;
return param - params;
 }
 
___
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: r279338 - head/sys/arm/include

2015-02-26 Thread Bruce Evans

On Thu, 26 Feb 2015, Ian Lepore wrote:


Log:
 Add casting to make atomic ops work for pointers.  (Apparently nobody has
 ever done atomic ops on pointers before now on arm).


Apparently, arm code handled pointers correctly before.  des broke
i386 in the same way and didn't back out the changes as requested, but
all other arches including amd64 remained unbroken, so there can't be
any MI code that handles the pointers incorrectly enough to need it.
Checking shows no MD code either.


Modified: head/sys/arm/include/atomic.h
==
--- head/sys/arm/include/atomic.h   Thu Feb 26 22:46:01 2015
(r279337)
+++ head/sys/arm/include/atomic.h   Thu Feb 26 23:05:46 2015
(r279338)
@@ -1103,13 +1103,23 @@ atomic_store_long(volatile u_long *dst,
*dst = src;
}

-#define atomic_clear_ptr   atomic_clear_32
-#define atomic_set_ptr atomic_set_32
-#define atomic_cmpset_ptr  atomic_cmpset_32
-#define atomic_cmpset_rel_ptr  atomic_cmpset_rel_32
-#define atomic_cmpset_acq_ptr  atomic_cmpset_acq_32
-#define atomic_store_ptr   atomic_store_32
-#define atomic_store_rel_ptr   atomic_store_rel_32
+#define atomic_clear_ptr(p, v) \
+   atomic_clear_32((volatile uint32_t *)(p), (uint32_t)(v))
+#define atomic_set_ptr(p, v) \
+   atomic_set_32((volatile uint32_t *)(p), (uint32_t)(v))
+#define atomic_cmpset_ptr(p, cmpval, newval) \
+   atomic_cmpset_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \
+   (u_int32_t)(newval))
+#define atomic_cmpset_rel_ptr(p, cmpval, newval) \
+   atomic_cmpset_rel_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \
+   (u_int32_t)(newval))
+#define atomic_cmpset_acq_ptr(p, cmpval, newval) \
+   atomic_cmpset_acq_32((volatile u_int32_t *)(p), (u_int32_t)(cmpval), \
+   (u_int32_t)(newval))
+#define atomic_store_ptr(p, v) \
+   atomic_store_32((volatile uint32_t *)(p), (uint32_t)(v))
+#define atomic_store_rel_ptr(p, v) \
+   atomic_store_rel_32((volatile uint32_t *)(p), (uint32_t)(v))

#define atomic_add_int  atomic_add_32
#define atomic_add_acq_int  atomic_add_acq_32


These bogus casts reduce type safety.  atomic*ptr is designed and
documented to take only (indirect) uintptr_t * and (direct) uintptr_t
args, not pointer args bogusly cast or otherwise type-punned to these.
Most callers actually use the API correctly.  E.g., the mutex cookie
is a uintptr_t, not a pointer.  This affected the design of mutexes
a little.  The cookie could be either a pointer representing an integer
ot an integer representing a pointer, or a union of these, and the
integer is simplest.

These casts don't even break the warning in most cases where they have
an effect.  They share this implementation bug with the i386 ones.
Casting to [volatile] uint32_t * only works if the pointer is already
[volatile] uint32_t * or [volatile] void *.  For full breakage, it
us necessary to cast to volatile void * first.  Omitting the cast to
void * should only work here because most or all callers ensure that
the pointer already has one of these types, so the cast here has no
effect.

Casting the input arg to uint32_t does work to break the warning,
because uint32_t is the same as uintptr_t and -Wcast-qual is broken
for casting away qualifiers in this way.

Here are all matches with atomic.*ptr in .c files in /sys/:

./dev/hatm/if_hatm_intr.c:  if (atomic_cmpset_ptr((uintptr_t *)list, 
(uintptr_t)buf-link,
./dev/hatm/if_hatm_intr.c:  if (atomic_cmpset_ptr((uintptr_t 
*)sc-mbuf_list[g],
./dev/hatm/if_hatm_intr.c:  if (atomic_cmpset_ptr((uintptr_t 
*)sc-mbuf_list[g],

Bogus casts in the caller.  As partly mentioned above, casting to
uintptr_t * shouldn't even break the warning.  It is necessary to go through
void *, and for that casting to void * here is sufficient (the prototype
will complete the type pun).

./dev/cxgbe/t4_main.c:  atomic_store_rel_ptr(loc, new);
./dev/cxgbe/t4_main.c:  atomic_store_rel_ptr(loc, new);
./dev/cxgbe/t4_main.c:  atomic_store_rel_ptr(loc, new);

Correct.  The variables are uintptr_t * and uinptr_t, respectively.

./dev/cxgbe/tom/t4_listen.c:wr = (struct wrqe 
*)atomic_readandclear_ptr(synqe-wr);

Correct.  syncqe-wr is uintptr_t.

./dev/cxgbe/tom/t4_listen.c:atomic_store_rel_ptr(synqe-wr, (uintptr_t)wr);
./dev/cxgbe/tom/t4_listen.c:if (atomic_cmpset_ptr(synqe-wr, 
(uintptr_t)wr, 0)) {

Correct.  For some reason, wr is a pointer so it must be cast.  This cast is
not bogus.  (Conversion from any pointer type to uintptr_t and back is
possible.  This may change its representation, although it doesn't on any
supported arch.   If the representation does change, input args continue
to work right but the API becomes unsuitable for handling output args.

./dev/cxgb/cxgb_main.c: atomic_store_rel_ptr(loc, new);


svn commit: r279347 - stable/10/usr.sbin/jls

2015-02-26 Thread Jamie Gritton
Author: jamie
Date: Fri Feb 27 02:50:01 2015
New Revision: 279347
URL: https://svnweb.freebsd.org/changeset/base/279347

Log:
  MFC r279081:
  
Allow parameters listed on the command line to override the -v option,
instead of crashing.
  
  PR:   197701

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

Modified: stable/10/usr.sbin/jls/jls.8
==
--- stable/10/usr.sbin/jls/jls.8Fri Feb 27 02:44:12 2015
(r279346)
+++ stable/10/usr.sbin/jls/jls.8Fri Feb 27 02:50:01 2015
(r279347)
@@ -92,7 +92,8 @@ skipping read-only and unused parameters
 Implies
 .Fl nq .
 .It Fl v
-Print a multiple-line summary per jail, with the following parameters:
+Extend the standard display with a multiple-line summary per jail,
+containing the following parameters:
 jail identifier (jid), hostname (host.hostname), path (path),
 jail name (name), jail state (dying), cpuset ID (cpuset),
 IP address(es) (ip4.addr and ip6.addr).

Modified: stable/10/usr.sbin/jls/jls.c
==
--- stable/10/usr.sbin/jls/jls.cFri Feb 27 02:44:12 2015
(r279346)
+++ stable/10/usr.sbin/jls/jls.cFri Feb 27 02:50:01 2015
(r279347)
@@ -166,10 +166,12 @@ main(int argc, char **argv)
JP_USER);
add_param(path, NULL, (size_t)0, NULL, JP_USER);
}
-   } else
+   } else {
+   pflags = ~PRINT_VERBOSE;
while (optind  argc)
add_param(argv[optind++], NULL, (size_t)0, NULL,
JP_USER);
+   }
 
if (pflags  PRINT_SKIP) {
/* Check for parameters with jailsys parents. */
___
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: r278473 - in head/sys: amd64/amd64 amd64/include amd64/vmm contrib/dev/acpica/include i386/i386 i386/include x86/acpica x86/include x86/x86 x86/xen

2015-02-26 Thread Adrian Chadd
On 26 February 2015 at 17:17, Peter Grehan gre...@freebsd.org wrote:
 Anyway - I have that model laptop, it hangs after calling
 ipi_startup() to the first AP with x2apic enabled. What can I do to
 continue debugging?


  Please provide the info that Kostik requested here, try out the patch, and
 wait for the timezone in Ukraine to be a little more reasonable for a reply.

  http://docs.FreeBSD.org/cgi/mid.cgi?20150216174658.GI34251

Hi,

That patch is already in -HEAD; I'm already running it and no, it
doesn't help. The details are the same as what koop provided.

  Use the workaround of setting hw.x2apic_enable=0 in the loader to fall back
 to stock APIC mode.

Yup - I'm using it to at least boot the laptop to get debugging output.




-adrian
___
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: r279345 - in head/sys: boot/fdt/dts/mips mips/nlm

2015-02-26 Thread Jayachandran C.
Author: jchandra
Date: Fri Feb 27 02:21:52 2015
New Revision: 279345
URL: https://svnweb.freebsd.org/changeset/base/279345

Log:
  Move PCI bus below simplebus for Broadcom XLP
  
  This will enable us to do common allocation code for memory and
  interrupts for SoC devices as well as PCI devices.

Modified:
  head/sys/boot/fdt/dts/mips/xlp-basic.dts
  head/sys/mips/nlm/xlp_pci.c

Modified: head/sys/boot/fdt/dts/mips/xlp-basic.dts
==
--- head/sys/boot/fdt/dts/mips/xlp-basic.dtsFri Feb 27 01:59:29 2015
(r279344)
+++ head/sys/boot/fdt/dts/mips/xlp-basic.dtsFri Feb 27 02:21:52 2015
(r279345)
@@ -65,6 +65,10 @@
interrupts = 17;
};
 
+   pci0: pci@1800 {
+   compatible = netlogic,xlp-pci, pci;
+   reg = 0xd000 0x1000;
+   };
};
 
chosen {

Modified: head/sys/mips/nlm/xlp_pci.c
==
--- head/sys/mips/nlm/xlp_pci.c Fri Feb 27 01:59:29 2015(r279344)
+++ head/sys/mips/nlm/xlp_pci.c Fri Feb 27 02:21:52 2015(r279345)
@@ -52,6 +52,9 @@ __FBSDID($FreeBSD$);
 #include dev/uart/uart_bus.h
 #include dev/uart/uart_cpu.h
 
+#include dev/ofw/ofw_bus.h
+#include dev/ofw/ofw_bus_subr.h
+
 #include machine/bus.h
 #include machine/md_var.h
 #include machine/intr_machdep.h
@@ -281,7 +284,6 @@ DEFINE_CLASS_1(pci, xlp_pci_driver, xlp_
 pci_driver);
 DRIVER_MODULE(xlp_pci, pcib, xlp_pci_driver, pci_devclass, 0, 0);
 
-static devclass_t pcib_devclass;
 static struct rman irq_rman, port_rman, mem_rman, emul_rman;
 
 static void
@@ -328,8 +330,11 @@ static int
 xlp_pcib_probe(device_t dev)
 {
 
-   device_set_desc(dev, XLP PCI bus);
-   return (BUS_PROBE_NOWILDCARD);
+   if (ofw_bus_is_compatible(dev, netlogic,xlp-pci)) {
+   device_set_desc(dev, XLP PCI bus);
+   return (BUS_PROBE_DEFAULT);
+   }
+   return (ENXIO);
 }
 
 static int
@@ -481,13 +486,6 @@ xlp_pcib_attach(device_t dev)
return (0);
 }
 
-static void
-xlp_pcib_identify(driver_t * driver, device_t parent)
-{
-
-   BUS_ADD_CHILD(parent, 0, pcib, 0);
-}
-
 /*
  * XLS PCIe can have upto 4 links, and each link has its on IRQ
  * Find the link on which the device is on 
@@ -780,7 +778,6 @@ mips_pcib_route_interrupt(device_t bus, 
 
 static device_method_t xlp_pcib_methods[] = {
/* Device interface */
-   DEVMETHOD(device_identify, xlp_pcib_identify),
DEVMETHOD(device_probe, xlp_pcib_probe),
DEVMETHOD(device_attach, xlp_pcib_attach),
 
@@ -813,4 +810,5 @@ static driver_t xlp_pcib_driver = {
1, /* no softc */
 };
 
-DRIVER_MODULE(pcib, nexus, xlp_pcib_driver, pcib_devclass, 0, 0);
+static devclass_t pcib_devclass;
+DRIVER_MODULE(xlp_pcib, simplebus, xlp_pcib_driver, pcib_devclass, 0, 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: r279346 - head/lib/libdevstat

2015-02-26 Thread Kenneth D. Merry
Author: ken
Date: Fri Feb 27 02:44:12 2015
New Revision: 279346
URL: https://svnweb.freebsd.org/changeset/base/279346

Log:
  Remove an obsolete comment in devstat(3) about the accuracy of the
  milliseconds per transaction (DSM_MS_PER_TRANSACTION) calculation.
  
  The comment was accurate many years ago when the kernel didn't
  record I/O times on a per-I/O basis, but now that we do collect
  that information in most areas, it isn't correct.
  
  The milliseconds per transaction values are correct, assuming the
  I/O duration has been recorded.
  
  Sponsored by: Spectra Logic
  MFC after:3 days

Modified:
  head/lib/libdevstat/devstat.c

Modified: head/lib/libdevstat/devstat.c
==
--- head/lib/libdevstat/devstat.c   Fri Feb 27 02:21:52 2015
(r279345)
+++ head/lib/libdevstat/devstat.c   Fri Feb 27 02:44:12 2015
(r279346)
@@ -1487,22 +1487,9 @@ devstat_compute_statistics(struct devsta
*destld = 0.0;
break;
/*
-* This calculation is somewhat bogus.  It simply divides
-* the elapsed time by the total number of transactions
-* completed.  While that does give the caller a good
-* picture of the average rate of transaction completion,
-* it doesn't necessarily give the caller a good view of
-* how long transactions took to complete on average.
-* Those two numbers will be different for a device that
-* can handle more than one transaction at a time.  e.g.
-* SCSI disks doing tagged queueing.
-*
-* The only way to accurately determine the real average
-* time per transaction would be to compute and store the
-* time on a per-transaction basis.  That currently isn't
-* done in the kernel, and would only be desireable if it
-* could be implemented in a somewhat non-intrusive and high
-* performance way.
+* Some devstat callers update the duration and some don't.
+* So this will only be accurate if they provide the
+* duration. 
 */
case DSM_MS_PER_TRANSACTION:
if (totaltransfers  0) {
@@ -1512,11 +1499,6 @@ devstat_compute_statistics(struct devsta
} else
*destld = 0.0;
break;
-   /*
-* As above, these next two really only give the average
-* rate of completion for read and write transactions, not
-* the average time the transaction took to complete.
-*/
case DSM_MS_PER_TRANSACTION_READ:
if (totaltransfersread  0) {
*destld = totaldurationread;
___
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: r279350 - head/sys/net80211

2015-02-26 Thread Adrian Chadd
Author: adrian
Date: Fri Feb 27 04:45:47 2015
New Revision: 279350
URL: https://svnweb.freebsd.org/changeset/base/279350

Log:
  Fix kern/196290 - don't announce 11n HTINFO rates if the channel is
  configured as 11b.
  
  This came up when debugging other issues surrounding scanning and
  channel modes.
  
  What's going on:
  
  * The VAP comes up as an 11b VAP, but on an 11n capable NIC;
  * .. it announces HTINFO and MCS rates;
  * The AP thinks it's an 11n capable device and transmits 11n frames
to the STA;
  * But the STA is in 11b mode, and thus doesn't receive/ACK the frames.
  
  It didn't happen for the ath(4) devices as the AR5416/AR9300 HALs
  unconditionally enable MCS frame reception, even if the channel
  mode is not 11n.  But the Intel NICs are configured in 11b/11a/11g
  modes when doing those, even if 11n is enabled and available.
  
  So, don't announce 11n capabilities if the VAP isn't on an 11n
  channel when sending management assocation request / reassociation
  request frames.
  
  TODO:
  
  * Lots more testing - 11n should be upgraded after association,
and I just want to make sure I haven't broken 11n upgrade.
I shouldn't have - this is only happening for /sending/ association
requests, which APs aren't doing.
  
  Tested:
  
  * ath(4) APs (AR9331, AR7161+AR9280, AR934x)
  * AR5416, STA mode
  * Intel 5100, STA mode
  
  PR:   kern/196290

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cFri Feb 27 02:56:58 2015
(r279349)
+++ head/sys/net80211/ieee80211_output.cFri Feb 27 04:45:47 2015
(r279350)
@@ -2322,18 +2322,33 @@ ieee80211_send_mgmt(struct ieee80211_nod
ic-ic_curchan);
frm = ieee80211_add_supportedchannels(frm, ic);
}
+
+   /*
+* Check the channel - we may be using an 11n NIC with an
+* 11n capable station, but we're configured to be an 11b
+* channel.
+*/
if ((vap-iv_flags_ht  IEEE80211_FHT_HT) 
+   IEEE80211_IS_CHAN_HT(ni-ni_chan) 
ni-ni_ies.htcap_ie != NULL 
-   ni-ni_ies.htcap_ie[0] == IEEE80211_ELEMID_HTCAP)
+   ni-ni_ies.htcap_ie[0] == IEEE80211_ELEMID_HTCAP) {
frm = ieee80211_add_htcap(frm, ni);
+   }
frm = ieee80211_add_wpa(frm, vap);
if ((ic-ic_flags  IEEE80211_F_WME) 
ni-ni_ies.wme_ie != NULL)
frm = ieee80211_add_wme_info(frm, ic-ic_wme);
+
+   /*
+* Same deal - only send HT info if we're on an 11n
+* capable channel.
+*/
if ((vap-iv_flags_ht  IEEE80211_FHT_HT) 
+   IEEE80211_IS_CHAN_HT(ni-ni_chan) 
ni-ni_ies.htcap_ie != NULL 
-   ni-ni_ies.htcap_ie[0] == IEEE80211_ELEMID_VENDOR)
+   ni-ni_ies.htcap_ie[0] == IEEE80211_ELEMID_VENDOR) {
frm = ieee80211_add_htcap_vendor(frm, ni);
+   }
 #ifdef IEEE80211_SUPPORT_SUPERG
if (IEEE80211_ATH_CAP(vap, ni, IEEE80211_F_ATHEROS)) {
frm = ieee80211_add_ath(frm, 
___
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: r279197 - head

2015-02-26 Thread Garrett Cooper
On Feb 23, 2015, at 11:42, Rui Paulo rpa...@me.com wrote:

 How much time did this save?

Test profile:

- 4 x CPU VMware Fusion hosted amd64 VM with 4GB allocated to it and with 
open-vm-tools installed
- Kernel with WITNESS watch turned on.
- Multiuser mode (because I’m lazy)

The worst case scenario was tested:
- All BOOTSTRAPPING checks were removed
- The default SRCCONF values were set
- I built with i386 instead of amd64 (to force elftoolchain and the dtrace 
tools to always be built).

Observations:

-j1: standard deviation was huge (5.75 is not statistically accurate), so I 
threw out a few outliers and redid the numbers.
-j1 vs -j4: ~3 minutes faster - ~3x speedup
-j4 vs -j8:  - no real noticeable change, but the outliers were statistically 
larger.

Cheers!



-j1:

$ grep ' 1:.*real' ts | awk 'NR  1 { print $3 }' | ministat 
x stdin
+--+
|  x

   |
|   x  xx   x   xx  
x   
x x|
||__MA___|
 |
+--+
N   Min   MaxMedian   AvgStddev
x  10259.57275.06263.04   264.747 5.7545094

-j1 (statistically more accurate sample, but smaller sample size):

$ grep ' 1:.*real' ts | awk 'NR  1  NR  8 { print $3 }' | ministat
x stdin
+--+
|xx  x  
   x x  
  x|
||AM|
  |
+--+
N   Min   MaxMedian   AvgStddev
x   6260.45 263.8262.46 261.83667 1.4530336

-j4:

$ grep ' 4:.*real' ts | awk 'NR  1 { print $3 }' | ministat
x stdin
+--+
|xxx x  
 x  xx  
 x   xx|
|  
|__A_M___|
  |
+--+
N   Min   MaxMedian   AvgStddev
x  10 87.78 90.34 89.0489.0110.99822565

$ grep ‘ 8:.*real' ts | awk 'NR  1 { print $3 }' | ministat

   
x stdin
+--+
|x x x  x   
  x  x   x xx   
  x|
| 
|A_M__|