svn commit: r240381 - head/sys/dev/usb/controller

2012-09-12 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Sep 12 07:34:09 2012
New Revision: 240381
URL: http://svn.freebsd.org/changeset/base/240381

Log:
  Reduce DWC OTG polling rate by using the SOF interrupt.

Modified:
  head/sys/dev/usb/controller/dwc_otg.c
  head/sys/dev/usb/controller/dwc_otg.h

Modified: head/sys/dev/usb/controller/dwc_otg.c
==
--- head/sys/dev/usb/controller/dwc_otg.c   Wed Sep 12 04:29:11 2012
(r240380)
+++ head/sys/dev/usb/controller/dwc_otg.c   Wed Sep 12 07:34:09 2012
(r240381)
@@ -160,6 +160,23 @@ dwc_otg_get_hw_ep_profile(struct usb_dev
*ppf = NULL;
 }
 
+static void
+dwc_otg_request_sof(struct dwc_otg_softc *sc)
+{
+   sc->sc_sof_refs++;
+   sc->sc_irq_mask |= GINTMSK_SOFMSK;
+   DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask);
+}
+
+static void
+dwc_otg_release_sof(struct dwc_otg_softc *sc)
+{
+   if (--(sc->sc_sof_refs) == 0) {
+   sc->sc_irq_mask &= ~GINTMSK_SOFMSK;
+   DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask);
+   }
+}
+
 static int
 dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode)
 {
@@ -523,6 +540,9 @@ dwc_otg_host_channel_alloc(struct dwc_ot
/* set active EP */
sc->sc_active_rx_ep |= (1 << x);
 
+   /* request SOF's */
+   dwc_otg_request_sof(sc);
+
return (0); /* allocated */
}
}
@@ -576,6 +596,10 @@ dwc_otg_host_setup_tx(struct dwc_otg_td 
td->remainder -= td->tx_bytes;
td->toggle = 1;
return (0); /* complete */
+   } else {
+   if ((sc->sc_sof_val & 1) != (td->sof_val & 1))
+   return (1); /* busy */
+   td->sof_val += 1;
}
} else {
return (1); /* busy */
@@ -882,12 +906,19 @@ not_complete:
/* DATA 0 */
td->toggle = 0;
} else if (ep_type == UE_INTERRUPT) {
-   if ((sc->sc_interrupt_val & 0xFF) != td->sof_val)
+   if ((sc->sc_sof_val & 0xFF) != td->sof_val)
return (1); /* busy */
td->sof_val += td->sof_res;
-   } else if (td->set_toggle) {
-   td->set_toggle = 0;
-   td->toggle = 1;
+   } else {
+   if (td->did_nak) {
+   if ((sc->sc_sof_val & 1) != (td->sof_val & 1))
+   return (1); /* busy */
+   td->sof_val += 1;
+   }
+   if (td->set_toggle) {
+   td->set_toggle = 0;
+   td->toggle = 1;
+   }
}
 
/* receive one packet */
@@ -1078,7 +1109,11 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
 
/* else we need to transmit a short packet */
}
-   }
+   } else {
+   if ((sc->sc_sof_val & 1) != (td->sof_val & 1))
+   return (1); /* busy */
+   td->sof_val += 1;
+   }
} else {
return (1); /* busy */
}
@@ -1098,7 +1133,7 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
td->toggle = 0;
 
} else if (ep_type == UE_INTERRUPT) {
-   if ((sc->sc_interrupt_val & 0xFF) != td->sof_val)
+   if ((sc->sc_sof_val & 0xFF) != td->sof_val)
return (1); /* busy */
td->sof_val += td->sof_res;
} else if (td->set_toggle) {
@@ -1775,21 +1810,8 @@ dwc_otg_interrupt(struct dwc_otg_softc *
}
 
/* check for Start Of Frame IRQ */
-   if (status & GINTMSK_SOFMSK) {
-
-   uint32_t temp;
-
-   temp = DWC_OTG_READ_4(sc, DOTG_HFNUM);
-   temp &= HFNUM_FRNUM_MASK;
-
-   if (sc->sc_flags.status_high_speed) {
-   if ((temp & 7) == (sc->sc_sof_val & 7))
-   sc->sc_sof_val++;
-   } else {
-   if ((temp & 1) == (sc->sc_sof_val & 1))
-   sc->sc_sof_val++;
-   }
-   }
+   if (status & GINTMSK_SOFMSK)
+   sc->sc_sof_val++;
 
/* poll FIFO(s) */
dwc_otg_interrupt_poll(sc);
@@ -2058,6 +2080,16 @@ dwc_otg_setup_standard_chain(struct usb_
} else {
td->hcsplt = 0;
}
+   if (xfer_type == UE_INTERRUPT) {
+   uint32_t ival;
+   ival = xfer->interval;
+   if (ival == 0)
+   ival = 1;
+  

svn commit: r240382 - head/sys/dev/usb/serial

2012-09-12 Thread Kevin Lo
Author: kevlo
Date: Wed Sep 12 07:59:28 2012
New Revision: 240382
URL: http://svn.freebsd.org/changeset/base/240382

Log:
  Restart the USB transfer if the error is not USB_ERR_CANCELLED.

Modified:
  head/sys/dev/usb/serial/ufoma.c

Modified: head/sys/dev/usb/serial/ufoma.c
==
--- head/sys/dev/usb/serial/ufoma.c Wed Sep 12 07:34:09 2012
(r240381)
+++ head/sys/dev/usb/serial/ufoma.c Wed Sep 12 07:59:28 2012
(r240382)
@@ -631,10 +631,7 @@ tr_setup:
 
if (error == USB_ERR_CANCELLED) {
return;
-   } else {
-   goto tr_setup;
}
-
goto tr_transferred;
}
 }
@@ -651,7 +648,6 @@ ufoma_ctrl_write_callback(struct usb_xfe
case USB_ST_TRANSFERRED:
 tr_transferred:
case USB_ST_SETUP:
-tr_setup:
pc = usbd_xfer_get_frame(xfer, 1);
if (ucom_get_data(&sc->sc_ucom, pc, 0, 1, &actlen)) {
 
@@ -677,10 +673,7 @@ tr_setup:
 
if (error == USB_ERR_CANCELLED) {
return;
-   } else {
-   goto tr_setup;
}
-
goto tr_transferred;
}
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240383 - head/sys/dev/ahci

2012-09-12 Thread Alexander Motin
Author: mav
Date: Wed Sep 12 09:20:37 2012
New Revision: 240383
URL: http://svn.freebsd.org/changeset/base/240383

Log:
  Fix AHCI 1.2 version checks. This should be mostly cosmetic.
  
  Submitted by: Dmitry Luhtionov 
  MFC after:1 week

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

Modified: head/sys/dev/ahci/ahci.c
==
--- head/sys/dev/ahci/ahci.cWed Sep 12 07:59:28 2012(r240382)
+++ head/sys/dev/ahci/ahci.cWed Sep 12 09:20:37 2012(r240383)
@@ -403,7 +403,7 @@ ahci_attach(device_t dev)
/* Get the HW capabilities */
version = ATA_INL(ctlr->r_mem, AHCI_VS);
ctlr->caps = ATA_INL(ctlr->r_mem, AHCI_CAP);
-   if (version >= 0x00010020)
+   if (version >= 0x00010200)
ctlr->caps2 = ATA_INL(ctlr->r_mem, AHCI_CAP2);
if (ctlr->caps & AHCI_CAP_EMS)
ctlr->capsem = ATA_INL(ctlr->r_mem, AHCI_EM_CTL);
@@ -483,7 +483,7 @@ ahci_attach(device_t dev)
(ctlr->caps & AHCI_CAP_SXS) ? " eSATA":"",
(ctlr->caps & AHCI_CAP_NPMASK) + 1);
}
-   if (bootverbose && version >= 0x00010020) {
+   if (bootverbose && version >= 0x00010200) {
device_printf(dev, "Caps2:%s%s%s\n",
(ctlr->caps2 & AHCI_CAP2_APST) ? " APST":"",
(ctlr->caps2 & AHCI_CAP2_NVMP) ? " NVMP":"",
@@ -982,7 +982,7 @@ ahci_ch_attach(device_t dev)
}
ch->chcaps = ATA_INL(ch->r_mem, AHCI_P_CMD);
version = ATA_INL(ctlr->r_mem, AHCI_VS);
-   if (version < 0x00010020 && (ctlr->caps & AHCI_CAP_FBSS))
+   if (version < 0x00010200 && (ctlr->caps & AHCI_CAP_FBSS))
ch->chcaps |= AHCI_P_CMD_FBSCP;
if (bootverbose) {
device_printf(dev, "Caps:%s%s%s%s%s\n",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240385 - head/lib/libc/sys

2012-09-12 Thread Gleb Smirnoff
Author: glebius
Date: Wed Sep 12 09:50:17 2012
New Revision: 240385
URL: http://svn.freebsd.org/changeset/base/240385

Log:
  Describe in detail required conditions for receiving the SCM_CREDS
  control message and suggest to use LOCAL_CREDS setsockopt() for
  reliability.

Modified:
  head/lib/libc/sys/recv.2

Modified: head/lib/libc/sys/recv.2
==
--- head/lib/libc/sys/recv.2Wed Sep 12 09:29:22 2012(r240384)
+++ head/lib/libc/sys/recv.2Wed Sep 12 09:50:17 2012(r240385)
@@ -28,7 +28,7 @@
 .\" @(#)recv.2 8.3 (Berkeley) 2/21/94
 .\" $FreeBSD$
 .\"
-.Dd December 28, 2006
+.Dd September 12, 2012
 .Dt RECV 2
 .Os
 .Sh NAME
@@ -252,8 +252,21 @@ struct cmsgcred {
 };
 .Ed
 .Pp
-The kernel will fill in the credential information of the sending process
-and deliver it to the receiver.
+If a sender supplies ancillary data with enough space for the above struct
+tagged as
+.Dv SCM_CREDS
+control message type to the
+.Fn sendmsg
+system call, then kernel will fill in the credential information of the
+sending process and deliver it to the receiver.
+Since receiver usually has no control over a sender, this method of retrieving
+credential information isn't reliable.
+For reliable retrieval of remote side credentials it is advised to use the
+.Dv LOCAL_CREDS
+socket option on the receiving socket.
+See
+.Xr unix 4
+for details.
 .Pp
 The
 .Fa msg_flags
@@ -322,7 +335,8 @@ address space.
 .Xr getsockopt 2 ,
 .Xr read 2 ,
 .Xr select 2 ,
-.Xr socket 2
+.Xr socket 2 ,
+.Xr unix 4
 .Sh HISTORY
 The
 .Fn recv
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240386 - head/share/man/man4

2012-09-12 Thread Gleb Smirnoff
Author: glebius
Date: Wed Sep 12 10:09:34 2012
New Revision: 240386
URL: http://svn.freebsd.org/changeset/base/240386

Log:
  Document conditions for IP_SENDSRCADDR socket option.
  
  Obtained from:r167342 commit message

Modified:
  head/share/man/man4/ip.4

Modified: head/share/man/man4/ip.4
==
--- head/share/man/man4/ip.4Wed Sep 12 09:50:17 2012(r240385)
+++ head/share/man/man4/ip.4Wed Sep 12 10:09:34 2012(r240386)
@@ -32,7 +32,7 @@
 .\" @(#)ip.4   8.2 (Berkeley) 11/30/93
 .\" $FreeBSD$
 .\"
-.Dd June 15, 2012
+.Dd September 12, 2012
 .Dt IP 4
 .Os
 .Sh NAME
@@ -172,9 +172,7 @@ cmsg_type = IP_RECVDSTADDR
 .Pp
 The source address to be used for outgoing
 .Tn UDP
-datagrams on a socket that is not bound to a specific
-.Tn IP
-address can be specified as ancillary data with a type code of
+datagrams on a socket can be specified as ancillary data with a type code of
 .Dv IP_SENDSRCADDR .
 The msg_control field in the msghdr structure should point to a buffer
 that contains a
@@ -189,6 +187,22 @@ cmsg_level = IPPROTO_IP
 cmsg_type = IP_SENDSRCADDR
 .Ed
 .Pp
+The socket should be bound to a local port.
+The socket may be bound or not bound to a local address.
+In the former case address supplied with
+.Dv IP_SENDSRCADDR
+overrides bound address.
+If the socket is bound to a local address and the address supplied with
+.Dv IP_SENDSRCADDR
+is
+.Dv INADDR_ANY ,
+then bound address is overriden via generic source address selection logic,
+which would choose IP address of interface closest to destination.
+If the socket is not bound to a local address, then address supplied with
+.Dv IP_SENDSRCADDR
+can't be
+.Dv INADDR_ANY .
+.Pp
 For convenience,
 .Dv IP_SENDSRCADDR
 is defined to have the same value as
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240387 - head/sys/compat/linux

2012-09-12 Thread Kevin Lo
Author: kevlo
Date: Wed Sep 12 10:12:03 2012
New Revision: 240387
URL: http://svn.freebsd.org/changeset/base/240387

Log:
  Remove redundant check

Modified:
  head/sys/compat/linux/linux_file.c

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Wed Sep 12 10:09:34 2012
(r240386)
+++ head/sys/compat/linux/linux_file.c  Wed Sep 12 10:12:03 2012
(r240387)
@@ -384,11 +384,6 @@ getdents_common(struct thread *td, struc
auio.uio_resid = buflen;
auio.uio_offset = off;
 
-   if (cookies) {
-   free(cookies, M_TEMP);
-   cookies = NULL;
-   }
-
 #ifdef MAC
/*
 * Do directory search MAC check using non-cached credentials.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240388 - head/usr.sbin/timed/timed

2012-09-12 Thread Kevin Lo
Author: kevlo
Date: Wed Sep 12 10:16:39 2012
New Revision: 240388
URL: http://svn.freebsd.org/changeset/base/240388

Log:
  Add missing braces
  
  Obtained from:DragonFly

Modified:
  head/usr.sbin/timed/timed/timed.c

Modified: head/usr.sbin/timed/timed/timed.c
==
--- head/usr.sbin/timed/timed/timed.c   Wed Sep 12 10:12:03 2012
(r240387)
+++ head/usr.sbin/timed/timed/timed.c   Wed Sep 12 10:16:39 2012
(r240388)
@@ -418,9 +418,10 @@ main(argc, argv)
justquit = 1;
}
for (ntp = nettab; ntp != NULL; ntp = ntp->next) {
-   if (ntp->status == MASTER)
+   if (ntp->status == MASTER) {
rmnetmachs(ntp);
ntp->status = NOMASTER;
+   }
}
checkignorednets();
pickslavenet(0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240389 - head/usr.sbin/syslogd

2012-09-12 Thread Baptiste Daroussin
Author: bapt
Date: Wed Sep 12 10:39:47 2012
New Revision: 240389
URL: http://svn.freebsd.org/changeset/base/240389

Log:
  Add support for ipv6 addresses as destination
  
  PR:   bin/150530
  Submitted by: andy white 
  Tested by:Olivier Cochard-Labbe 
  MFC after:1 month

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Wed Sep 12 10:16:39 2012
(r240388)
+++ head/usr.sbin/syslogd/syslogd.c Wed Sep 12 10:39:47 2012
(r240389)
@@ -1931,6 +1931,7 @@ cfline(const char *line, struct filed *f
case '@':
{
char *tp;
+   char endkey = ':';
/*
 * scan forward to see if there is a port defined.
 * so we can't use strlcpy..
@@ -1939,9 +1940,19 @@ cfline(const char *line, struct filed *f
tp = f->f_un.f_forw.f_hname;
p++;
 
-   while (*p && (*p != ':') && (i-- > 0)) {
+   /*
+* an ipv6 address should start with a '[' in that case
+* we should scan for a ']'
+*/
+   if (*p == '[') {
+   p++;
+   endkey = ']';
+   }
+   while (*p && (*p != endkey) && (i-- > 0)) {
*tp++ = *p++;
}
+   if (endkey == ']' && *p == endkey)
+   p++;
*tp = '\0';
}
/* See if we copied a domain and have a port */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240391 - head/lib/libutil

2012-09-12 Thread Baptiste Daroussin
Author: bapt
Date: Wed Sep 12 11:41:03 2012
New Revision: 240391
URL: http://svn.freebsd.org/changeset/base/240391

Log:
  Fix IEC / SI binary prefixes (Ki, Mi, Gi, etc) production by 
humanize_number(3)
  
  PR:   bin/171487
  Submitted by: matthew
  MFC after:1 week

Modified:
  head/lib/libutil/humanize_number.c

Modified: head/lib/libutil/humanize_number.c
==
--- head/lib/libutil/humanize_number.c  Wed Sep 12 10:53:08 2012
(r240390)
+++ head/lib/libutil/humanize_number.c  Wed Sep 12 11:41:03 2012
(r240391)
@@ -76,7 +76,7 @@ humanize_number(char *buf, size_t len, i
if (flags & HN_B)
prefixes = "B\0\0Ki\0Mi\0Gi\0Ti\0Pi\0Ei";
else
-   prefixes = "\0\0Ki\0Mi\0Gi\0Ti\0Pi\0Ei";
+   prefixes = "\0\0\0Ki\0Mi\0Gi\0Ti\0Pi\0Ei";
} else {
baselen = 1;
if (flags & HN_DIVISOR_1000)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240392 - head/sys/netipsec

2012-09-12 Thread VANHULLEBUS Yvan
Author: vanhu
Date: Wed Sep 12 12:14:50 2012
New Revision: 240392
URL: http://svn.freebsd.org/changeset/base/240392

Log:
  In NAT-T transport mode, allow a client to open a new connection just after
  closing another.
  It worked only in tunnel mode before.
  
  Submitted by: Andreas Longwitz 
  MFC after: 1M

Modified:
  head/sys/netipsec/key.c

Modified: head/sys/netipsec/key.c
==
--- head/sys/netipsec/key.c Wed Sep 12 11:41:03 2012(r240391)
+++ head/sys/netipsec/key.c Wed Sep 12 12:14:50 2012(r240392)
@@ -4055,10 +4055,12 @@ key_cmpsaidx(
/*
 * If NAT-T is enabled, check ports for tunnel mode.
 * Do not check ports if they are set to zero in the SPD.
-* Also do not do it for transport mode, as there is no
-* port information available in the SP.
+* Also do not do it for native transport mode, as there
+* is no port information available in the SP.
 */
-   if (saidx1->mode == IPSEC_MODE_TUNNEL &&
+   if ((saidx1->mode == IPSEC_MODE_TUNNEL ||
+(saidx1->mode == IPSEC_MODE_TRANSPORT &&
+ saidx1->proto == IPPROTO_ESP)) &&
saidx1->src.sa.sa_family == AF_INET &&
saidx1->dst.sa.sa_family == AF_INET &&
((const struct sockaddr_in *)(&saidx1->src))->sin_port &&
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240393 - head/usr.bin/truss

2012-09-12 Thread Andrey Zonov
Author: zont
Date: Wed Sep 12 13:06:57 2012
New Revision: 240393
URL: http://svn.freebsd.org/changeset/base/240393

Log:
  - Fix detaching under some circumstances.
  
When truss is detaching from very active process it is possible to
hang on waitpid(2) in restore_proc() forever, because
ptrace(PT_SYSCALL) must be called before detaching, to allow the
debugging process to continue execution.  Also when truss called with
'-c' argument, it does not print anything after detach, because it
immediately exits from restore_proc().
  
To fix these two problems make detaching deferred, but then it is
impossible to detach from a process which does not do any system call.
To fix this issue use sigaction(2) instead of signal(3) to disable
SA_RESTART flag for waitpid(2) that makes it non-restartable.  Remove
global variable child_pid, because now detaching is handled in context
where child's pid is known.
  
  Reported by:  mjg
  Tested by:mjg, swills
  Approved by:  kib (mentor)
  MFC after:2 weeks

Modified:
  head/usr.bin/truss/main.c
  head/usr.bin/truss/setup.c
  head/usr.bin/truss/truss.h

Modified: head/usr.bin/truss/main.c
==
--- head/usr.bin/truss/main.c   Wed Sep 12 12:14:50 2012(r240392)
+++ head/usr.bin/truss/main.c   Wed Sep 12 13:06:57 2012(r240393)
@@ -163,6 +163,7 @@ strsig(int sig)
 int
 main(int ac, char **av)
 {
+   struct sigaction sa;
struct ex_types *funcs;
struct trussinfo *trussinfo;
char *fname;
@@ -257,10 +258,13 @@ main(int ac, char **av)
signal(SIGTERM, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
} else {
+   sa.sa_handler = restore_proc;
+   sa.sa_flags = 0;
+   sigemptyset(&sa.sa_mask);
+   sigaction(SIGINT, &sa, NULL);
+   sigaction(SIGQUIT, &sa, NULL);
+   sigaction(SIGTERM, &sa, NULL);
start_tracing(trussinfo->pid);
-   signal(SIGINT, restore_proc);
-   signal(SIGTERM, restore_proc);
-   signal(SIGQUIT, restore_proc);
}
 
 
@@ -366,7 +370,8 @@ START_TRACE:
default:
break;
}
-   } while (trussinfo->pr_why != S_EXIT);
+   } while (trussinfo->pr_why != S_EXIT &&
+   trussinfo->pr_why != S_DETACHED);
 
if (trussinfo->flags & FOLLOWFORKS) {
do {

Modified: head/usr.bin/truss/setup.c
==
--- head/usr.bin/truss/setup.c  Wed Sep 12 12:14:50 2012(r240392)
+++ head/usr.bin/truss/setup.c  Wed Sep 12 13:06:57 2012(r240393)
@@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$");
 #include "truss.h"
 #include "extern.h"
 
-static pid_t child_pid;
+static sig_atomic_t detaching;
 
 /*
  * setup_and_wait() is called to start a process.  All it really does
@@ -84,8 +84,6 @@ setup_and_wait(char *command[])
if (waitpid(pid, NULL, 0) < 0)
err(1, "unexpect stop in waitpid");
 
-   child_pid = pid;
-
return (pid);
 }
 
@@ -108,7 +106,6 @@ start_tracing(pid_t pid)
if (ret)
err(1, "can not attach to target process");
 
-   child_pid = pid;
if (waitpid(pid, NULL, 0) < 0)
err(1, "Unexpect stop in waitpid");
 
@@ -121,21 +118,30 @@ start_tracing(pid_t pid)
  * applies if truss was told to monitor an already-existing
  * process.
  */
+
 void
 restore_proc(int signo __unused)
 {
+
+   detaching = 1;
+}
+
+static int
+detach_proc(pid_t pid)
+{
int waitval;
 
/* stop the child so that we can detach */
-   kill(child_pid, SIGSTOP);
-   if (waitpid(child_pid, &waitval, 0) < 0)
+   kill(pid, SIGSTOP);
+   if (waitpid(pid, &waitval, 0) < 0)
err(1, "Unexpected stop in waitpid");
 
-   if (ptrace(PT_DETACH, child_pid, (caddr_t)1, 0) < 0)
+   if (ptrace(PT_DETACH, pid, (caddr_t)1, 0) < 0)
err(1, "Can not detach the process");
 
-   kill(child_pid, SIGCONT);
-   exit(0);
+   kill(pid, SIGCONT);
+
+   return (waitval);
 }
 
 /*
@@ -180,8 +186,19 @@ waitevent(struct trussinfo *info)
ptrace(PT_SYSCALL, info->pid, (caddr_t)1, pending_signal);
pending_signal = 0;
 
-   if (waitpid(info->pid, &waitval, 0) < 0)
+detach:
+   if (detaching) {
+   waitval = detach_proc(info->pid);
+   info->pr_why = S_DETACHED;
+   info->pr_data = WEXITSTATUS(waitval);
+   return;
+   }
+
+   if (waitpid(info->pid, &waitval, 0) == -1) {
+   if (errno == EINTR)
+   goto detach;
err(1, "Unexpected stop in waitpid");
+   }
 
if (WIFCONTINUED(waitval)) {
info->pr_why = S_NONE;

Modified: head/usr.bin/truss/truss.h

svn commit: r240400 - head/sys/conf

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 13:58:18 2012
New Revision: 240400
URL: http://svn.freebsd.org/changeset/base/240400

Log:
  Replace a bare use of 'objcopy' with ${OBJCOPY} for easier cross compilation
  in environments where 'objcopy' is spelled differently.
  
  Submitted by: John Van Horne 

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Sep 12 13:43:42 2012(r240399)
+++ head/sys/conf/files.amd64   Wed Sep 12 13:58:18 2012(r240400)
@@ -79,7 +79,7 @@ acpi_wakecode.o   optionalacpi
\
clean   "acpi_wakecode.o"
 acpi_wakecode.bin  optionalacpi\
dependency  "acpi_wakecode.o"   \
-   compile-with"objcopy -S -O binary acpi_wakecode.o ${.TARGET}" \
+   compile-with"${OBJCOPY} -S -O binary acpi_wakecode.o ${.TARGET}" \
no-obj no-implicit-rule before-depend   \
clean   "acpi_wakecode.bin"
 acpi_wakecode.hoptionalacpi
\

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Sep 12 13:43:42 2012(r240399)
+++ head/sys/conf/files.i386Wed Sep 12 13:58:18 2012(r240400)
@@ -369,7 +369,7 @@ acpi_wakecode.o optional acpi   
\
clean   "acpi_wakecode.o"
 acpi_wakecode.bin  optional acpi   \
dependency  "acpi_wakecode.o"   \
-   compile-with"objcopy -S -O binary acpi_wakecode.o ${.TARGET}" \
+   compile-with"${OBJCOPY} -S -O binary acpi_wakecode.o ${.TARGET}" \
no-obj no-implicit-rule before-depend   \
clean   "acpi_wakecode.bin"
 acpi_wakecode.hoptional acpi   
\
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240401 - head/sys/conf

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 14:17:11 2012
New Revision: 240401
URL: http://svn.freebsd.org/changeset/base/240401

Log:
  Not all Pmake derived makes quietly tolerate assignment from shell commands
  with no output.  Add "echo" at the end these shell commands whose output is
  assigned to a variable's value to ensure there is some output.
  
  Submitted by: John Van Horne 

Modified:
  head/sys/conf/Makefile.amd64
  head/sys/conf/Makefile.arm
  head/sys/conf/Makefile.powerpc

Modified: head/sys/conf/Makefile.amd64
==
--- head/sys/conf/Makefile.amd64Wed Sep 12 13:58:18 2012
(r240400)
+++ head/sys/conf/Makefile.amd64Wed Sep 12 14:17:11 2012
(r240401)
@@ -31,9 +31,9 @@ S=../../..
 .endif
 .include "$S/conf/kern.pre.mk"
 
-DDB_ENABLED!=  grep DDB opt_ddb.h || true
-DTR_ENABLED!=  grep KDTRACE_FRAME opt_kdtrace.h || true
-HWPMC_ENABLED!=grep HWPMC opt_hwpmc_hooks.h || true
+DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
+DTR_ENABLED!=  grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
+HWPMC_ENABLED!=grep HWPMC opt_hwpmc_hooks.h || true ; echo
 .if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
 CFLAGS+=   -fno-omit-frame-pointer
 .endif

Modified: head/sys/conf/Makefile.arm
==
--- head/sys/conf/Makefile.arm  Wed Sep 12 13:58:18 2012(r240400)
+++ head/sys/conf/Makefile.arm  Wed Sep 12 14:17:11 2012(r240401)
@@ -39,7 +39,7 @@ SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscri
 STRIP_FLAGS = -S
 .endif
 
-DDB_ENABLED!=  grep DDB opt_ddb.h || true
+DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
 
 .if empty(DDB_ENABLED)
 CFLAGS += -mno-apcs-frame

Modified: head/sys/conf/Makefile.powerpc
==
--- head/sys/conf/Makefile.powerpc  Wed Sep 12 13:58:18 2012
(r240400)
+++ head/sys/conf/Makefile.powerpc  Wed Sep 12 14:17:11 2012
(r240401)
@@ -37,7 +37,7 @@ INCLUDES+= -I$S/contrib/libfdt
 
 CFLAGS+= -msoft-float -Wa,-many
 
-DDB_ENABLED!=  grep DDB opt_ddb.h || true
+DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
 .if !empty(DDB_ENABLED)
 CFLAGS+=   -fno-omit-frame-pointer
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240402 - head/sys/conf

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 14:19:40 2012
New Revision: 240402
URL: http://svn.freebsd.org/changeset/base/240402

Log:
  Remove duplication and centralize testing of various config(8)ed features.

Modified:
  head/sys/conf/Makefile.amd64
  head/sys/conf/Makefile.arm
  head/sys/conf/Makefile.powerpc
  head/sys/conf/kern.pre.mk

Modified: head/sys/conf/Makefile.amd64
==
--- head/sys/conf/Makefile.amd64Wed Sep 12 14:17:11 2012
(r240401)
+++ head/sys/conf/Makefile.amd64Wed Sep 12 14:19:40 2012
(r240402)
@@ -31,9 +31,6 @@ S=../../..
 .endif
 .include "$S/conf/kern.pre.mk"
 
-DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
-DTR_ENABLED!=  grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
-HWPMC_ENABLED!=grep HWPMC opt_hwpmc_hooks.h || true ; echo
 .if !empty(DDB_ENABLED) || !empty(DTR_ENABLED) || !empty(HWPMC_ENABLED)
 CFLAGS+=   -fno-omit-frame-pointer
 .endif

Modified: head/sys/conf/Makefile.arm
==
--- head/sys/conf/Makefile.arm  Wed Sep 12 14:17:11 2012(r240401)
+++ head/sys/conf/Makefile.arm  Wed Sep 12 14:19:40 2012(r240402)
@@ -39,8 +39,6 @@ SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscri
 STRIP_FLAGS = -S
 .endif
 
-DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
-
 .if empty(DDB_ENABLED)
 CFLAGS += -mno-apcs-frame
 .endif

Modified: head/sys/conf/Makefile.powerpc
==
--- head/sys/conf/Makefile.powerpc  Wed Sep 12 14:17:11 2012
(r240401)
+++ head/sys/conf/Makefile.powerpc  Wed Sep 12 14:19:40 2012
(r240402)
@@ -37,7 +37,6 @@ INCLUDES+= -I$S/contrib/libfdt
 
 CFLAGS+= -msoft-float -Wa,-many
 
-DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
 .if !empty(DDB_ENABLED)
 CFLAGS+=   -fno-omit-frame-pointer
 .endif

Modified: head/sys/conf/kern.pre.mk
==
--- head/sys/conf/kern.pre.mk   Wed Sep 12 14:17:11 2012(r240401)
+++ head/sys/conf/kern.pre.mk   Wed Sep 12 14:19:40 2012(r240402)
@@ -189,3 +189,8 @@ MKMODULESENV+=  WITHOUT_MODULES="${WITHOU
 .if defined(DEBUG)
 MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
 .endif
+
+# Are various things configured?
+DDB_ENABLED!=  grep DDB opt_ddb.h || true ; echo
+DTR_ENABLED!=  grep KDTRACE_FRAME opt_kdtrace.h || true ; echo
+HWPMC_ENABLED!=grep HWPMC opt_hwpmc_hooks.h || true ; echo
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240403 - head

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 14:44:25 2012
New Revision: 240403
URL: http://svn.freebsd.org/changeset/base/240403

Log:
  Not all Pmake derivatives silently handle empty shell output, so ensure there
  is something for make(1) to consume.  Bmake gives output such as:
 "warning: Couldn't read shell's output for "/bin/sh -c true"
  Note we parted from traditional Pmake behavior in r18864 / r18255.

Modified:
  head/Makefile
  head/Makefile.inc1

Modified: head/Makefile
==
--- head/Makefile   Wed Sep 12 14:19:40 2012(r240402)
+++ head/Makefile   Wed Sep 12 14:44:25 2012(r240403)
@@ -216,7 +216,7 @@ ${TGTS}:
 .MAIN: all
 
 STARTTIME!= LC_ALL=C date
-CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s
+CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
 .if !empty(CHECK_TIME)
 .error check your date/time: ${STARTTIME}
 .endif

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Wed Sep 12 14:19:40 2012(r240402)
+++ head/Makefile.inc1  Wed Sep 12 14:44:25 2012(r240403)
@@ -1558,7 +1558,7 @@ DTBOUTPUTPATH= ${KRNLOBJDIR}/${KERNCONF}
 .if !defined(FDT_DTS_FILE) || empty(FDT_DTS_FILE)
 .if exists(${KERNCONFDIR}/${KERNCONF})
 FDT_DTS_FILE!= awk 'BEGIN {FS="="} /^makeoptions[[:space:]]+FDT_DTS_FILE/ 
{print $$2}' \
-   ${KERNCONFDIR}/${KERNCONF}
+   ${KERNCONFDIR}/${KERNCONF} ; echo
 .endif
 .endif
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240404 - in head: share/mk usr.bin

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 14:58:07 2012
New Revision: 240404
URL: http://svn.freebsd.org/changeset/base/240404

Log:
  Add MK_KDUMP.

Modified:
  head/share/mk/bsd.own.mk
  head/usr.bin/Makefile

Modified: head/share/mk/bsd.own.mk
==
--- head/share/mk/bsd.own.mkWed Sep 12 14:44:25 2012(r240403)
+++ head/share/mk/bsd.own.mkWed Sep 12 14:58:07 2012(r240404)
@@ -254,6 +254,7 @@ WITHOUT_${var}=
 INFO \
 IPFILTER \
 IPX \
+KDUMP \
 KERBEROS \
 LIB32 \
 LIBPTHREAD \
@@ -357,6 +358,7 @@ __DEFAULT_YES_OPTIONS = \
 IPFW \
 IPX \
 JAIL \
+KDUMP \
 KERBEROS \
 KERNEL_SYMBOLS \
 KVM \

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Wed Sep 12 14:44:25 2012(r240403)
+++ head/usr.bin/Makefile   Wed Sep 12 14:58:07 2012(r240404)
@@ -68,7 +68,7 @@ SUBDIR=   alias \
ipcs \
join \
jot \
-   kdump \
+   ${_kdump} \
keylogin \
keylogout \
killall \
@@ -163,7 +163,7 @@ SUBDIR= alias \
tr \
true \
truncate \
-   truss \
+   ${_truss} \
tset \
tsort \
tty \
@@ -245,6 +245,11 @@ _mkcsmapper=   mkcsmapper
 _mkesdb=   mkesdb
 .endif
 
+.if ${MK_KDUMP} != "no"
+SUBDIR+=kdump
+SUBDIR+=truss
+.endif
+
 .if ${MK_KERBEROS_SUPPORT} != "no"
 SUBDIR+=   compile_et
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240405 - head/sbin/fsck_ffs

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 14:59:57 2012
New Revision: 240405
URL: http://svn.freebsd.org/changeset/base/240405

Log:
  Simply printf-like strings and outdent strings so that it is easy to see
  if they fit on a standard terminal.

Modified:
  head/sbin/fsck_ffs/main.c

Modified: head/sbin/fsck_ffs/main.c
==
--- head/sbin/fsck_ffs/main.c   Wed Sep 12 14:58:07 2012(r240404)
+++ head/sbin/fsck_ffs/main.c   Wed Sep 12 14:59:57 2012(r240405)
@@ -279,8 +279,8 @@ checkfilesys(char *filesys)
exit(0);
exit(4);
} else {
-   pfatal("UNEXPECTED INCONSISTENCY, %s\n",
-   "CANNOT RUN FAST FSCK\n");
+   pfatal(
+   "UNEXPECTED INCONSISTENCY, CANNOT RUN FAST FSCK\n");
}
}
}
@@ -297,8 +297,8 @@ checkfilesys(char *filesys)
pfatal("NOT MOUNTED, CANNOT RUN IN BACKGROUND\n");
} else if ((mntp->f_flags & MNT_SOFTDEP) == 0) {
bkgrdflag = 0;
-   pfatal("NOT USING SOFT UPDATES, %s\n",
-   "CANNOT RUN IN BACKGROUND");
+   pfatal(
+ "NOT USING SOFT UPDATES, CANNOT RUN IN BACKGROUND\n");
} else if ((mntp->f_flags & MNT_RDONLY) != 0) {
bkgrdflag = 0;
pfatal("MOUNTED READ-ONLY, CANNOT RUN IN BACKGROUND\n");
@@ -306,8 +306,8 @@ checkfilesys(char *filesys)
if (readsb(0) != 0) {
if (sblock.fs_flags & (FS_NEEDSFSCK | FS_SUJ)) {
bkgrdflag = 0;
-   pfatal("UNEXPECTED INCONSISTENCY, %s\n",
-   "CANNOT RUN IN BACKGROUND\n");
+   pfatal(
+   "UNEXPECTED INCONSISTENCY, CANNOT RUN IN BACKGROUND\n");
}
if ((sblock.fs_flags & FS_UNCLEAN) == 0 &&
skipclean && ckclean) {
@@ -315,8 +315,8 @@ checkfilesys(char *filesys)
 * file system is clean;
 * skip snapshot and report it clean
 */
-   pwarn("FILE SYSTEM CLEAN; %s\n",
-   "SKIPPING CHECKS");
+   pwarn(
+   "FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
goto clean;
}
}
@@ -328,24 +328,23 @@ checkfilesys(char *filesys)
if (stat(snapname, &snapdir) < 0) {
if (errno != ENOENT) {
bkgrdflag = 0;
-   pfatal("CANNOT FIND %s %s: %s, %s\n",
-   "SNAPSHOT DIRECTORY",
-   snapname, strerror(errno),
-   "CANNOT RUN IN BACKGROUND");
+   pfatal(
+   "CANNOT FIND SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
+   snapname, strerror(errno));
} else if ((grp = getgrnam("operator")) == 0 ||
mkdir(snapname, 0770) < 0 ||
chown(snapname, -1, grp->gr_gid) < 0 ||
chmod(snapname, 0770) < 0) {
bkgrdflag = 0;
-   pfatal("CANNOT CREATE %s %s: %s, %s\n",
-   "SNAPSHOT DIRECTORY",
-   snapname, strerror(errno),
-   "CANNOT RUN IN BACKGROUND");
+   pfatal(
+   "CANNOT CREATE SNAPSHOT DIRECTORY %s: %s, CANNOT RUN IN BACKGROUND\n",
+   snapname, strerror(errno));
}
} else if (!S_ISDIR(snapdir.st_mode)) {
bkgrdflag = 0;
-   pfatal("%s IS NOT A DIRECTORY, %s\n", snapname,
-   "CANNOT RUN IN BACKGROUND");
+   pfatal(
+   "%s IS NOT A DIRECTORY, CANNOT RUN IN BACKGROUND\n",
+   snapname);
}
}
  

svn commit: r240406 - head/sbin/fsck_ffs

2012-09-12 Thread David E. O'Brien
Author: obrien
Date: Wed Sep 12 15:36:44 2012
New Revision: 240406
URL: http://svn.freebsd.org/changeset/base/240406

Log:
  Remove needless (int) casts of write(2)'s 3rd argument.
  Also change blwrite() 'size' parameter to a ssize_t to better match
  write(2).

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/fsutil.c

Modified: head/sbin/fsck_ffs/fsck.h
==
--- head/sbin/fsck_ffs/fsck.h   Wed Sep 12 14:59:57 2012(r240405)
+++ head/sbin/fsck_ffs/fsck.h   Wed Sep 12 15:36:44 2012(r240406)
@@ -337,7 +337,7 @@ voidblkerror(ino_t ino, const char *ty
 char  *blockcheck(char *name);
 intblread(int fd, char *buf, ufs2_daddr_t blk, long size);
 void   bufinit(void);
-void   blwrite(int fd, char *buf, ufs2_daddr_t blk, long size);
+void   blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size);
 void   blerase(int fd, ufs2_daddr_t blk, long size);
 void   cacheino(union dinode *dp, ino_t inumber);
 void   catch(int);

Modified: head/sbin/fsck_ffs/fsutil.c
==
--- head/sbin/fsck_ffs/fsutil.c Wed Sep 12 14:59:57 2012(r240405)
+++ head/sbin/fsck_ffs/fsutil.c Wed Sep 12 15:36:44 2012(r240406)
@@ -245,7 +245,7 @@ flush(int fd, struct bufarea *bp)
(bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
(long long)bp->b_bno);
bp->b_errs = 0;
-   blwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size);
+   blwrite(fd, bp->b_un.b_buf, bp->b_bno, bp->b_size);
if (bp != &sblk)
return;
for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) {
@@ -392,7 +392,7 @@ blread(int fd, char *buf, ufs2_daddr_t b
 }
 
 void
-blwrite(int fd, char *buf, ufs2_daddr_t blk, long size)
+blwrite(int fd, char *buf, ufs2_daddr_t blk, ssize_t size)
 {
int i;
char *cp;
@@ -404,7 +404,7 @@ blwrite(int fd, char *buf, ufs2_daddr_t 
offset *= dev_bsize;
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK BLK", blk);
-   else if (write(fd, buf, (int)size) == size) {
+   else if (write(fd, buf, size) == size) {
fsmodified = 1;
return;
}
@@ -414,7 +414,7 @@ blwrite(int fd, char *buf, ufs2_daddr_t 
rwerror("SEEK BLK", blk);
printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
-   if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
+   if (write(fd, cp, dev_bsize) != dev_bsize) {
(void)lseek(fd, offset + i + dev_bsize, 0);
printf(" %jd,", (intmax_t)blk + i / dev_bsize);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r240135 - in head/sys: amd64/conf conf dev/random i386/conf modules/random

2012-09-12 Thread Arthur Mesh
On Wed, Sep 12, 2012 at 07:33:02AM +0300, Konstantin Belousov wrote:
> Can you submit the desired patch ?

Sure,

Index: sys/i386/conf/GENERIC
===
--- sys/i386/conf/GENERIC   (revision 240406)
+++ sys/i386/conf/GENERIC   (working copy)
@@ -306,7 +306,7 @@
 device loop# Network loopback
 device random  # Entropy device
 optionsPADLOCK_RNG # VIA Padlock RNG
-optionsIVY_RNG # Intel Bull Mountain RNG
+optionsRDRAND_RNG  # Intel Bull Mountain RNG
 device ether   # Ethernet support
 device vlan# 802.1Q VLAN support
 device tun # Packet tunnel.
Index: sys/dev/random/probe.c
===
--- sys/dev/random/probe.c  (revision 240406)
+++ sys/dev/random/probe.c  (working copy)
@@ -55,7 +55,7 @@
 #ifdef PADLOCK_RNG
 extern struct random_systat random_nehemiah;
 #endif
-#ifdef IVY_RNG
+#ifdef RDRAND_RNG
 extern struct random_systat random_ivy;
 #endif
 #endif
@@ -79,7 +79,7 @@
*systat = random_nehemiah;
}
 #endif
-#ifdef IVY_RNG
+#ifdef RDRAND_RNG
if (cpu_feature2 & CPUID2_RDRAND) {
int enable;
 
Index: sys/dev/random/ivy.c
===
--- sys/dev/random/ivy.c(revision 240406)
+++ sys/dev/random/ivy.c(working copy)
@@ -30,7 +30,7 @@
 
 #include "opt_cpu.h"
 
-#ifdef IVY_RNG
+#ifdef RDRAND_RNG
 
 #include 
 #include 
Index: sys/conf/options.amd64
===
--- sys/conf/options.amd64  (revision 240406)
+++ sys/conf/options.amd64  (working copy)
@@ -71,4 +71,4 @@
 
 # hw random number generators for random(4)
 PADLOCK_RNGopt_cpu.h
-IVY_RNGopt_cpu.h
+RDRAND_RNG opt_cpu.h
Index: sys/conf/options.i386
===
--- sys/conf/options.i386   (revision 240406)
+++ sys/conf/options.i386   (working copy)
@@ -126,4 +126,4 @@
 
 # hw random number generators for random(4)
 PADLOCK_RNGopt_cpu.h
-IVY_RNGopt_cpu.h
+RDRAND_RNG opt_cpu.h
Index: sys/amd64/conf/GENERIC
===
--- sys/amd64/conf/GENERIC  (revision 240406)
+++ sys/amd64/conf/GENERIC  (working copy)
@@ -293,7 +293,7 @@
 device loop# Network loopback
 device random  # Entropy device
 optionsPADLOCK_RNG # VIA Padlock RNG
-optionsIVY_RNG # Intel Bull Mountain RNG
+optionsRDRAND_RNG  # Intel Bull Mountain RNG
 device ether   # Ethernet support
 device vlan# 802.1Q VLAN support
 device tun # Packet tunnel.

___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240409 - head/usr.sbin/syslogd

2012-09-12 Thread Eitan Adler
Author: eadler
Date: Wed Sep 12 16:58:42 2012
New Revision: 240409
URL: http://svn.freebsd.org/changeset/base/240409

Log:
  Add documentation for IPv6 support
  
  PR:   docs/171580
  Submitted by: bdrewery
  Reviewed by:  wblock
  Approved by:  gjb
  MFC after:1 month
  X-MFC-With:   r240389

Modified:
  head/usr.sbin/syslogd/syslog.conf.5

Modified: head/usr.sbin/syslogd/syslog.conf.5
==
--- head/usr.sbin/syslogd/syslog.conf.5 Wed Sep 12 16:01:48 2012
(r240408)
+++ head/usr.sbin/syslogd/syslog.conf.5 Wed Sep 12 16:58:42 2012
(r240409)
@@ -28,7 +28,7 @@
 .\" @(#)syslog.conf.5  8.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd December 23, 2008
+.Dd September 12, 2012
 .Dt SYSLOG.CONF 5
 .Os
 .Sh NAME
@@ -347,6 +347,14 @@ If a port number is added after a colon
 .Pq Ql :\&
 then that port will be used as the destination port
 rather than the usual syslog port.
+IPv6 addresses can be used
+by surrounding the address portion with
+square brackets
+.Po
+.Ql [\&
+and
+.Ql ]\&
+.Pc .
 .It
 A comma separated list of users.
 Selected messages are written to those users
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240410 - head/lib/libc/stdlib

2012-09-12 Thread Ed Maste
Author: emaste
Date: Wed Sep 12 17:05:39 2012
New Revision: 240410
URL: http://svn.freebsd.org/changeset/base/240410

Log:
  Avoid mapping ENOENT to ENOTDIR for non-existent path components.
  
  The ENOTDIR mapping was introduced in r235266 for kern/128933 based on
  an interpretation of the somewhat ambiguous language in the POSIX realpath
  specification.  The interpretation is inconsistent with Solaris and Linux,
  a regression from 9.0, and does not appear to be permitted by the
  description of ENOTDIR:
  
   20 ENOTDIR Not a directory.  A component of the specified pathname
   existed, but it was not a directory, when a directory was
   expected.
  
  PR:   standards/171577
  MFC after:3 days

Modified:
  head/lib/libc/stdlib/realpath.c

Modified: head/lib/libc/stdlib/realpath.c
==
--- head/lib/libc/stdlib/realpath.c Wed Sep 12 16:58:42 2012
(r240409)
+++ head/lib/libc/stdlib/realpath.c Wed Sep 12 17:05:39 2012
(r240410)
@@ -181,8 +181,6 @@ realpath(const char * __restrict path, c
return (NULL);
}
if (lstat(resolved, &sb) != 0) {
-   if (errno != ENOENT || p != NULL)
-   errno = ENOTDIR;
if (m)
free(resolved);
return (NULL);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240412 - head/lib/libc/stdlib

2012-09-12 Thread Ed Maste
Author: emaste
Date: Wed Sep 12 17:54:09 2012
New Revision: 240412
URL: http://svn.freebsd.org/changeset/base/240412

Log:
  According to a clarification at http://austingroupbugs.net/view.php?id=503
  ptsname may set errno, so avoid saving and restoring errno across the
  function.
  
  PR:   standards/171572

Modified:
  head/lib/libc/stdlib/ptsname.3
  head/lib/libc/stdlib/ptsname.c

Modified: head/lib/libc/stdlib/ptsname.3
==
--- head/lib/libc/stdlib/ptsname.3  Wed Sep 12 17:50:56 2012
(r240411)
+++ head/lib/libc/stdlib/ptsname.3  Wed Sep 12 17:54:09 2012
(r240412)
@@ -102,7 +102,8 @@ of the slave device on success; otherwis
 pointer is returned.
 .Sh ERRORS
 The
-.Fn grantpt
+.Fn grantpt ,
+.Fn ptsname
 and
 .Fn unlockpt
 functions may fail and set

Modified: head/lib/libc/stdlib/ptsname.c
==
--- head/lib/libc/stdlib/ptsname.c  Wed Sep 12 17:50:56 2012
(r240411)
+++ head/lib/libc/stdlib/ptsname.c  Wed Sep 12 17:54:09 2012
(r240412)
@@ -77,7 +77,6 @@ ptsname(int fildes)
 {
static char pt_slave[sizeof _PATH_DEV + SPECNAMELEN] = _PATH_DEV;
char *ret = NULL;
-   int sverrno = errno;
 
/* Make sure fildes points to a master device. */
if (__isptmaster(fildes) != 0)
@@ -87,7 +86,6 @@ ptsname(int fildes)
sizeof pt_slave - (sizeof _PATH_DEV - 1)) != NULL)
ret = pt_slave;
 
-done:  /* Make sure ptsname() does not overwrite errno. */
-   errno = sverrno;
+done:
return (ret);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240415 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest cddl/contrib/opensolaris/lib/libuutil/common cddl/contrib/opens...

2012-09-12 Thread Martin Matuska
Author: mm
Date: Wed Sep 12 18:05:43 2012
New Revision: 240415
URL: http://svn.freebsd.org/changeset/base/240415

Log:
  Merge recent zfs vendor changes, sync code and adjust userland DEBUG.
  
  Illumos issued covered:
  1884 Empty "used" field for zfs *space commands
  3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument
   is zero
  3028 zfs {group,user}space -n prints (null) instead of numeric GID/UID
  3048 zfs {user,group}space [-s|-S] is broken
  3049 zfs {user,group}space -t doesn't really filter the results
  3060 zfs {user,group}space -H output isn't tab-delimited
  3061 zfs {user,group}space -o doesn't use specified fields order
  3064 usr/src/cmd/zpool/zpool_main.c misspells "successful"
  3093 zfs {user,group}space's -i is noop
  3098 zfs userspace/groupspace fail without saying why when run as non-root
  
  References:
https://www.illumos.org/issues/ + [issue_id]
  
  Obtained from:illumos (vendor/illumos, vendor/illumos-sys)
  MFC after:2 weeks

Added:
  head/sys/cddl/compat/opensolaris/sys/debug.h
 - copied, changed from r240302, 
head/sys/cddl/compat/opensolaris/sys/debug.h
Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  head/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  head/cddl/contrib/opensolaris/lib/libuutil/common/uu_misc.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
  head/cddl/lib/libzpool/Makefile
  head/cddl/usr.bin/ztest/Makefile
  head/cddl/usr.sbin/zdb/Makefile
  head/cddl/usr.sbin/zhack/Makefile
  head/sys/cddl/compat/opensolaris/sys/assfail.h
  head/sys/cddl/contrib/opensolaris/common/nvpair/fnvpair.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_debug.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/debug.h
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  head/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Sep 12 18:02:35 2012
(r240414)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Wed Sep 12 18:05:43 2012
(r240415)
@@ -137,17 +137,21 @@
 .Fl a | Ar filesystem
 .Nm
 .Cm userspace
-.Op Fl niHp
+.Op Fl Hinp
 .Op Fl o Ar field Ns Op , Ns Ar ...
-.Op Fl sS Ar field
+.Op Fl s Ar field
+.Ar ...
+.Op Fl S Ar field
 .Ar ...
 .Op Fl t Ar type Ns Op , Ns Ar ...
 .Ar filesystem Ns | Ns Ar snapshot
 .Nm
 .Cm groupspace
-.Op Fl niHp
+.Op Fl Hinp
 .Op Fl o Ar field Ns Op , Ns Ar ...
-.Op Fl sS Ar field
+.Op Fl s Ar field
+.Ar ...
+.Op Fl S Ar field
 .Ar ...
 .Op Fl t Ar type Ns Op , Ns Ar ...
 .Ar filesystem Ns | Ns Ar snapshot
@@ -1987,9 +1991,11 @@ Upgrade the specified file system.
 .It Xo
 .Nm
 .Cm userspace
-.Op Fl niHp
+.Op Fl Hinp
 .Op Fl o Ar field Ns Op , Ns Ar ...
-.Op Fl sS Ar field
+.Op Fl s Ar field
+.Ar ...
+.Op Fl S Ar field
 .Ar ...
 .Op Fl t Ar type Ns Op , Ns Ar 

svn commit: r240419 - head/sys/dev/usb/controller

2012-09-12 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Sep 12 19:15:29 2012
New Revision: 240419
URL: http://svn.freebsd.org/changeset/base/240419

Log:
  Fix TX FIFO sizes. Correct FIFO handling in Host mode.

Modified:
  head/sys/dev/usb/controller/dwc_otg.c
  head/sys/dev/usb/controller/dwc_otg.h

Modified: head/sys/dev/usb/controller/dwc_otg.c
==
--- head/sys/dev/usb/controller/dwc_otg.c   Wed Sep 12 18:18:14 2012
(r240418)
+++ head/sys/dev/usb/controller/dwc_otg.c   Wed Sep 12 19:15:29 2012
(r240419)
@@ -211,24 +211,34 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
return (EINVAL);
}
 
-   DWC_OTG_WRITE_4(sc, DOTG_GNPTXFSIZ, (0x10 << 16) | (tx_start / 4));
-   fifo_size -= 0x40;
-   tx_start += 0x40;
-
-   /* setup control endpoint profile */
-   sc->sc_hw_ep_profile[0].usb = dwc_otg_ep_profile[0];
-
if (mode == DWC_MODE_HOST) {
 
/* reset active endpoints */
sc->sc_active_rx_ep = 0;
 
+   fifo_size /= 2;
+
+   DWC_OTG_WRITE_4(sc, DOTG_GNPTXFSIZ,
+   ((fifo_size / 4) << 16) |
+   (tx_start / 4));
+
+   tx_start += fifo_size;
+
DWC_OTG_WRITE_4(sc, DOTG_HPTXFSIZ,
((fifo_size / 4) << 16) |
(tx_start / 4));
}
+
if (mode == DWC_MODE_DEVICE) {
 
+   DWC_OTG_WRITE_4(sc, DOTG_GNPTXFSIZ,
+   (0x10 << 16) | (tx_start / 4));
+   fifo_size -= 0x40;
+   tx_start += 0x40;
+
+   /* setup control endpoint profile */
+   sc->sc_hw_ep_profile[0].usb = dwc_otg_ep_profile[0];
+
/* reset active endpoints */
sc->sc_active_rx_ep = 1;
 
@@ -521,18 +531,11 @@ dwc_otg_host_channel_alloc(struct dwc_ot
/* enable interrupts */
DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x),
HCINT_STALL | HCINT_BBLERR |
-   HCINT_AHBERR | HCINT_CHHLTD |
-   HCINT_XACTERR | HCINT_XFERCOMPL |
-   HCINT_NAK | HCINT_NYET);
+   HCINT_AHBERR | HCINT_XACTERR |
+   HCINT_XFERCOMPL | HCINT_NAK);
 
DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(x), td->hcsplt);
DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(x), 0);
-   DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(x), 0);
-
-   /* reset TX FIFO */
-   DWC_OTG_WRITE_4(sc, DOTG_GRSTCTL,
-   GRSTCTL_TXFIFO(x) |
-   GRSTCTL_TXFFLSH);
 
/* set channel */
td->channel = x;
@@ -581,8 +584,7 @@ dwc_otg_host_setup_tx(struct dwc_otg_td 
return (0); /* complete */
}
 
-   if (temp & (HCINT_BBLERR |
-   HCINT_AHBERR | HCINT_CHHLTD | HCINT_XACTERR)) {
+   if (temp & (HCINT_BBLERR | HCINT_AHBERR | HCINT_XACTERR)) {
td->error_any = 1;
return (0); /* complete */
}
@@ -783,7 +785,6 @@ dwc_otg_host_data_rx(struct dwc_otg_td *
struct dwc_otg_softc *sc;
uint32_t temp;
uint16_t count;
-   uint8_t got_short;
uint8_t ep_type;
 
if (dwc_otg_host_channel_alloc(td))
@@ -800,24 +801,25 @@ dwc_otg_host_data_rx(struct dwc_otg_td *
temp, DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel)),
DWC_OTG_READ_4(sc, DOTG_HCTSIZ(td->channel)));
 
-   if (temp & HCINT_NAK)
+   if (temp & HCINT_NAK) {
td->did_nak = 1;
 
+   /* disable channel - will generate a halted event */
+   DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel),
+   HCCHAR_CHENA | HCCHAR_CHDIS);
+   }
+
if (temp & HCINT_STALL) {
td->error_stall = 1;
td->error_any = 1;
return (0); /* complete */
}
 
-   if (temp & (HCINT_BBLERR |
-   HCINT_AHBERR | HCINT_CHHLTD | HCINT_XACTERR)) {
+   if (temp & (HCINT_BBLERR | HCINT_AHBERR | HCINT_XACTERR)) {
td->error_any = 1;
return (0); /* complete */
}
 
-   if (temp & HCINT_XFERCOMPL)
-   td->did_complete = 1;
-
/* check endpoint status */
if (sc->sc_last_rx_status == 0)
goto not_complete;
@@ -826,14 +828,22 @@ dwc_otg_host_data_rx(struct dwc_otg_td *
goto not_complete;
 
switch (sc->sc_last_rx_status & GRXSTSRD_PKTSTS_MASK) {
+   case GRXSTSRH_HALTED:
+   DPRINTF("HALTED\n");
+   td->did_complete = 1;
+   break;
+   case GRXSTSRH_IN_COMPLETE:
+   DPRINTF("COMPLETE\n");
+   /* disable channel - will generate a halted event */
+

svn commit: r240420 - in head/sys: conf modules

2012-09-12 Thread Jim Harris
Author: jimharris
Date: Wed Sep 12 19:36:54 2012
New Revision: 240420
URL: http://svn.freebsd.org/changeset/base/240420

Log:
  Remove some trailing whitespace.

Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Wed Sep 12 19:15:29 2012(r240419)
+++ head/sys/conf/files.amd64   Wed Sep 12 19:36:54 2012(r240420)
@@ -135,7 +135,7 @@ crypto/aesni/aesencdec_amd64.S  optional 
 crypto/aesni/aeskeys_amd64.S   optional aesni
 crypto/aesni/aesni.c   optional aesni
 crypto/aesni/aesni_wrap.c  optional aesni
-crypto/blowfish/bf_enc.c   optionalcrypto | ipsec 
+crypto/blowfish/bf_enc.c   optionalcrypto | ipsec
 crypto/des/des_enc.c   optionalcrypto | ipsec | netsmb
 crypto/via/padlock.c   optionalpadlock
 crypto/via/padlock_cipher.coptionalpadlock

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Wed Sep 12 19:15:29 2012(r240419)
+++ head/sys/conf/files.i386Wed Sep 12 19:36:54 2012(r240420)
@@ -472,7 +472,7 @@ i386/linux/linux_support.s  optional comp
 i386/linux/linux_sysent.c  optional compat_linux
 i386/linux/linux_sysvec.c  optional compat_linux
 i386/pci/pci_cfgreg.c  optional pci
-i386/pci/pci_pir.c optional pci 
+i386/pci/pci_pir.c optional pci
 i386/svr4/svr4_locore.soptional compat_svr4\
dependency  "svr4_assym.h"  \
warning "COMPAT_SVR4 is broken and should be avoided"
@@ -516,7 +516,7 @@ x86/cpufreq/hwpstate.c  optional cpufreq
 x86/cpufreq/p4tcc.coptional cpufreq
 x86/cpufreq/powernow.c optional cpufreq
 x86/cpufreq/smist.coptional cpufreq
-x86/isa/atpic.coptional atpic  
+x86/isa/atpic.coptional atpic
 x86/isa/atrtc.coptional native
 x86/isa/clock.coptional native
 x86/isa/elcr.c optional atpic | apic native

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Wed Sep 12 19:15:29 2012(r240419)
+++ head/sys/modules/Makefile   Wed Sep 12 19:36:54 2012(r240420)
@@ -708,7 +708,7 @@ _padlock=   padlock
 .endif
 _pccard=   pccard
 _qlxgb=qlxgb
-_rdma= rdma
+_rdma= rdma
 _s3=   s3
 _safe= safe
 _scsi_low= scsi_low
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240421 - head/sys/boot/i386/libi386

2012-09-12 Thread Alexander Motin
Author: mav
Date: Wed Sep 12 21:00:37 2012
New Revision: 240421
URL: http://svn.freebsd.org/changeset/base/240421

Log:
  Make pxe device in lsdev really include device name, looking like this:
  pxe0:192.168.3.1:/storage/nfsroot/amd64
  , instead of confusing and less useful:
192.168.3.1:pxeboot

Modified:
  head/sys/boot/i386/libi386/pxe.c
  head/sys/boot/i386/libi386/pxe.h

Modified: head/sys/boot/i386/libi386/pxe.c
==
--- head/sys/boot/i386/libi386/pxe.cWed Sep 12 19:36:54 2012
(r240420)
+++ head/sys/boot/i386/libi386/pxe.cWed Sep 12 21:00:37 2012
(r240421)
@@ -355,18 +355,11 @@ pxe_close(struct open_file *f)
 static void
 pxe_print(int verbose)
 {
-   if (pxe_call != NULL) {
-   if (*bootplayer.Sname == '\0') {
-   printf("  "IP_STR":%s\n",
-  IP_ARGS(htonl(bootplayer.sip)),
-  bootplayer.bootfile);
-   } else {
-   printf("  %s:%s\n", bootplayer.Sname,
-  bootplayer.bootfile);
-   }
-   }
 
-   return;
+   if (pxe_call == NULL)
+   return;
+
+   printf("pxe0:%s:%s\n", inet_ntoa(rootip), rootpath);
 }
 
 static void

Modified: head/sys/boot/i386/libi386/pxe.h
==
--- head/sys/boot/i386/libi386/pxe.hWed Sep 12 19:36:54 2012
(r240420)
+++ head/sys/boot/i386/libi386/pxe.hWed Sep 12 21:00:37 2012
(r240421)
@@ -52,15 +52,6 @@
 
 #defineS_SIZE(s)   s, sizeof(s) - 1
 
-#defineIP_STR  "%d.%d.%d.%d"
-#defineIP_ARGS(ip) \
-   (int)(ip >> 24) & 0xff, (int)(ip >> 16) & 0xff, \
-   (int)(ip >> 8) & 0xff, (int)ip & 0xff
-
-#defineMAC_STR "%02x:%02x:%02x:%02x:%02x:%02x"
-#defineMAC_ARGS(mac)   \
-   mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] 
-
 #definePXENFSROOTPATH  "/pxeroot"
 
 typedef struct {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240422 - in head: share/man/man3 sys/sys

2012-09-12 Thread Ed Schouten
Author: ed
Date: Wed Sep 12 21:03:48 2012
New Revision: 240422
URL: http://svn.freebsd.org/changeset/base/240422

Log:
  Implement LIST_PREV().
  
  Regular LISTs have been implemented in such a way that the prev-pointer
  does not point to the previous element, but to the next-pointer stored
  in the previous element. This is done to simplify LIST_REMOVE(). This
  macro can be implemented without knowing the address of the list head.
  
  Unfortunately this makes it harder to implement LIST_PREV(), which is
  why this macro was never here. Still, it is possible to implement this
  macro. If the prev-pointer points to the list head, we return NULL.
  Otherwise we simply subtract the offset of the prev-pointer within the
  structure.
  
  It's not as efficient as traversing forward of course, but in practice
  it shouldn't be that bad. In almost all use cases, people will want to
  compare the value returned by LIST_PREV() against NULL, so an optimizing
  compiler will not emit code that does more branching than TAILQs.
  
  While there, make the code a bit more readable by introducing
  __member2struct(). This makes STAILQ_LAST() far more readable.
  
  MFC after:1 month

Modified:
  head/share/man/man3/Makefile
  head/share/man/man3/queue.3
  head/sys/sys/cdefs.h
  head/sys/sys/param.h
  head/sys/sys/queue.h

Modified: head/share/man/man3/Makefile
==
--- head/share/man/man3/MakefileWed Sep 12 21:00:37 2012
(r240421)
+++ head/share/man/man3/MakefileWed Sep 12 21:03:48 2012
(r240422)
@@ -76,6 +76,7 @@ MLINKS+=  queue.3 LIST_EMPTY.3 \
queue.3 LIST_INSERT_BEFORE.3 \
queue.3 LIST_INSERT_HEAD.3 \
queue.3 LIST_NEXT.3 \
+   queue.3 LIST_PREV.3 \
queue.3 LIST_REMOVE.3 \
queue.3 LIST_SWAP.3 \
queue.3 SLIST_EMPTY.3 \

Modified: head/share/man/man3/queue.3
==
--- head/share/man/man3/queue.3 Wed Sep 12 21:00:37 2012(r240421)
+++ head/share/man/man3/queue.3 Wed Sep 12 21:03:48 2012(r240422)
@@ -32,7 +32,7 @@
 .\"@(#)queue.3 8.2 (Berkeley) 1/24/94
 .\" $FreeBSD$
 .\"
-.Dd May 13, 2011
+.Dd Sep 12, 2012
 .Dt QUEUE 3
 .Os
 .Sh NAME
@@ -81,6 +81,7 @@
 .Nm LIST_INSERT_BEFORE ,
 .Nm LIST_INSERT_HEAD ,
 .Nm LIST_NEXT ,
+.Nm LIST_PREV ,
 .Nm LIST_REMOVE ,
 .Nm LIST_SWAP ,
 .Nm TAILQ_CONCAT ,
@@ -155,6 +156,7 @@ lists and tail queues
 .Fn LIST_INSERT_BEFORE "TYPE *listelm" "TYPE *elm" "LIST_ENTRY NAME"
 .Fn LIST_INSERT_HEAD "LIST_HEAD *head" "TYPE *elm" "LIST_ENTRY NAME"
 .Fn LIST_NEXT "TYPE *elm" "LIST_ENTRY NAME"
+.Fn LIST_PREV "TYPE *elm" "LIST_HEAD *head" "TYPE" "LIST_ENTRY NAME"
 .Fn LIST_REMOVE "TYPE *elm" "LIST_ENTRY NAME"
 .Fn LIST_SWAP "LIST_HEAD *head1" "LIST_HEAD *head2" "TYPE" "LIST_ENTRY NAME"
 .\"
@@ -248,8 +250,18 @@ Code size and execution time of operatio
 twice that of the singly-linked data-structures.
 .El
 .Pp
-Linked lists are the simplest of the doubly linked data structures and support
-only the above functionality over singly-linked lists.
+Linked lists are the simplest of the doubly linked data structures.
+They add the following functionality over the above:
+.Bl -enum -compact -offset indent
+.It
+They may be traversed backwards.
+.El
+However:
+.Bl -enum -compact -offset indent
+.It
+To traverse backwards, an entry to begin the traversal and the list in
+which it is contained must be specified.
+.El
 .Pp
 Tail queues add the following functionality:
 .Bl -enum -compact -offset indent
@@ -763,6 +775,14 @@ The macro
 returns the next element in the list, or NULL if this is the last.
 .Pp
 The macro
+.Nm LIST_PREV
+returns the previous element in the list, or NULL if this is the first.
+List
+.Fa head
+must contain element
+.Fa elm .
+.Pp
+The macro
 .Nm LIST_REMOVE
 removes the element
 .Fa elm

Modified: head/sys/sys/cdefs.h
==
--- head/sys/sys/cdefs.hWed Sep 12 21:00:37 2012(r240421)
+++ head/sys/sys/cdefs.hWed Sep 12 21:03:48 2012(r240422)
@@ -402,6 +402,8 @@
 #endif
 #define__rangeof(type, start, end) \
(__offsetof(type, end) - __offsetof(type, start))
+#define__member2struct(s, m, x)
\
+   ((struct s *)(void *)((char *)(x) - __offsetof(struct s, m)))
 
 /*
  * Compiler-dependent macros to declare that functions take printf-like

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hWed Sep 12 21:00:37 2012(r240421)
+++ head/sys/sys/param.hWed Sep 12 21:03:48 2012(r240422)
@@ -334,8 +334,7 @@ __END_DECLS
  * Given the pointer x to the member m of the struct s, return
  * a pointer to the containin

svn commit: r240423 - head/sys/kern

2012-09-12 Thread Attilio Rao
Author: attilio
Date: Wed Sep 12 22:05:54 2012
New Revision: 240423
URL: http://svn.freebsd.org/changeset/base/240423

Log:
  Tweak the commit message in case of panic for sleeping from threads
  with TDP_NOSLEEPING on.
  
  The current message has no informations on the thread and wchan
  involed, which may be useful in case where dumps have mangled dwarf
  informations.
  
  Reported by:kib
  Reviewed by:  bde, jhb, kib
  MFC after:1 week

Modified:
  head/sys/kern/subr_sleepqueue.c

Modified: head/sys/kern/subr_sleepqueue.c
==
--- head/sys/kern/subr_sleepqueue.c Wed Sep 12 21:03:48 2012
(r240422)
+++ head/sys/kern/subr_sleepqueue.c Wed Sep 12 22:05:54 2012
(r240423)
@@ -297,7 +297,8 @@ sleepq_add(void *wchan, struct lock_obje
 
/* If this thread is not allowed to sleep, die a horrible death. */
KASSERT(!(td->td_pflags & TDP_NOSLEEPING),
-   ("Trying sleep, but thread marked as sleeping prohibited"));
+   ("%s: td %p to sleep on wchan %p with TDP_NOSLEEPING on",
+   __func__, td, wchan));
 
/* Look up the sleep queue associated with the wait channel 'wchan'. */
sq = sleepq_lookup(wchan);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240424 - head/sys/kern

2012-09-12 Thread Attilio Rao
Author: attilio
Date: Wed Sep 12 22:10:53 2012
New Revision: 240424
URL: http://svn.freebsd.org/changeset/base/240424

Log:
  Improve check coverage about idle threads.
  
  Idle threads are not allowed to acquire any lock but spinlocks.
  Deny any attempt to do so by panicing at the locking operation
  when INVARIANTS is on. Then, remove the check on blocking on a
  turnstile.
  The check in sleepqueues is left because they are not allowed to use
  tsleep() either which could happen still.
  
  Reviewed by:  bde, jhb, kib
  MFC after:1 week

Modified:
  head/sys/kern/kern_lock.c
  head/sys/kern/kern_mutex.c
  head/sys/kern/kern_rmlock.c
  head/sys/kern/kern_rwlock.c
  head/sys/kern/kern_sx.c
  head/sys/kern/subr_turnstile.c

Modified: head/sys/kern/kern_lock.c
==
--- head/sys/kern/kern_lock.c   Wed Sep 12 22:05:54 2012(r240423)
+++ head/sys/kern/kern_lock.c   Wed Sep 12 22:10:53 2012(r240424)
@@ -477,6 +477,9 @@ __lockmgr_args(struct lock *lk, u_int fl
KASSERT((flags & LK_INTERLOCK) == 0 || ilk != NULL,
("%s: LK_INTERLOCK passed without valid interlock @ %s:%d",
__func__, file, line));
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("%s: idle thread %p on lockmgr %s @ %s:%d", __func__, curthread,
+   lk->lock_object.lo_name, file, line));
 
class = (flags & LK_INTERLOCK) ? LOCK_CLASS(ilk) : NULL;
if (panicstr != NULL) {

Modified: head/sys/kern/kern_mutex.c
==
--- head/sys/kern/kern_mutex.c  Wed Sep 12 22:05:54 2012(r240423)
+++ head/sys/kern/kern_mutex.c  Wed Sep 12 22:10:53 2012(r240424)
@@ -201,6 +201,9 @@ _mtx_lock_flags(struct mtx *m, int opts,
if (SCHEDULER_STOPPED())
return;
MPASS(curthread != NULL);
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("mtx_lock() by idle thread %p on sleep mutex %s @ %s:%d",
+   curthread, m->lock_object.lo_name, file, line));
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_lock() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,
@@ -301,6 +304,9 @@ mtx_trylock_flags_(struct mtx *m, int op
return (1);
 
MPASS(curthread != NULL);
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("mtx_trylock() by idle thread %p on sleep mutex %s @ %s:%d",
+   curthread, m->lock_object.lo_name, file, line));
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_trylock() of destroyed mutex @ %s:%d", file, line));
KASSERT(LOCK_CLASS(&m->lock_object) == &lock_class_mtx_sleep,

Modified: head/sys/kern/kern_rmlock.c
==
--- head/sys/kern/kern_rmlock.c Wed Sep 12 22:05:54 2012(r240423)
+++ head/sys/kern/kern_rmlock.c Wed Sep 12 22:10:53 2012(r240424)
@@ -498,6 +498,9 @@ void _rm_wlock_debug(struct rmlock *rm, 
if (SCHEDULER_STOPPED())
return;
 
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("rm_wlock() by idle thread %p on rmlock %s @ %s:%d",
+   curthread, rm->lock_object.lo_name, file, line));
WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE,
file, line, NULL);
 
@@ -540,6 +543,9 @@ _rm_rlock_debug(struct rmlock *rm, struc
if (SCHEDULER_STOPPED())
return (1);
 
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("rm_rlock() by idle thread %p on rmlock %s @ %s:%d",
+   curthread, rm->lock_object.lo_name, file, line));
if (!trylock && (rm->lock_object.lo_flags & RM_SLEEPABLE))
WITNESS_CHECKORDER(&rm->rm_lock_sx.lock_object, LOP_NEWORDER,
file, line, NULL);

Modified: head/sys/kern/kern_rwlock.c
==
--- head/sys/kern/kern_rwlock.c Wed Sep 12 22:05:54 2012(r240423)
+++ head/sys/kern/kern_rwlock.c Wed Sep 12 22:10:53 2012(r240424)
@@ -242,6 +242,9 @@ _rw_wlock(struct rwlock *rw, const char 
if (SCHEDULER_STOPPED())
return;
MPASS(curthread != NULL);
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("rw_wlock() by idle thread %p on rwlock %s @ %s:%d",
+   curthread, rw->lock_object.lo_name, file, line));
KASSERT(rw->rw_lock != RW_DESTROYED,
("rw_wlock() of destroyed rwlock @ %s:%d", file, line));
WITNESS_CHECKORDER(&rw->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE, file,
@@ -260,6 +263,9 @@ _rw_try_wlock(struct rwlock *rw, const c
if (SCHEDULER_STOPPED())
return (1);
 
+   KASSERT(!TD_IS_IDLETHREAD(curthread),
+   ("rw_try_wlock() by idle thread %p on rwlock %s @ %s:%d",
+   curthread, rw->lock_object.lo_na

svn commit: r240425 - head/usr.bin/last

2012-09-12 Thread Ed Schouten
Author: ed
Date: Wed Sep 12 22:16:31 2012
New Revision: 240425
URL: http://svn.freebsd.org/changeset/base/240425

Log:
  Switch batch to an SLIST.
  
  This code requires none of the features of LIST.

Modified:
  head/usr.bin/last/last.c

Modified: head/usr.bin/last/last.c
==
--- head/usr.bin/last/last.cWed Sep 12 22:10:53 2012(r240424)
+++ head/usr.bin/last/last.cWed Sep 12 22:16:31 2012(r240425)
@@ -72,12 +72,12 @@ typedef struct arg {
 } ARG;
 static ARG *arglist;   /* head of linked list */
 
-static LIST_HEAD(idlisthead, idtab) idlist;
+static SLIST_HEAD(, idtab) idlist;
 
 struct idtab {
time_t  logout; /* log out time */
charid[sizeof ((struct utmpx *)0)->ut_id]; /* identifier */
-   LIST_ENTRY(idtab) list;
+   SLIST_ENTRY(idtab) list;
 };
 
 static const   char *crmsg;/* cause of last reboot */
@@ -206,7 +206,7 @@ wtmp(void)
char ct[80];
struct tm *tm;
 
-   LIST_INIT(&idlist);
+   SLIST_INIT(&idlist);
(void)time(&t);
 
/* Load the last entries from the file. */
@@ -240,16 +240,14 @@ wtmp(void)
 static void
 doentry(struct utmpx *bp)
 {
-   struct idtab*tt, *ttx;  /* idlist entry */
+   struct idtab *tt;
 
/* the machine stopped */
if (bp->ut_type == BOOT_TIME || bp->ut_type == SHUTDOWN_TIME) {
/* everybody just logged out */
-   for (tt = LIST_FIRST(&idlist); tt;) {
-   LIST_REMOVE(tt, list);
-   ttx = tt;
-   tt = LIST_NEXT(tt, list);
-   free(ttx);
+   while ((tt = SLIST_FIRST(&idlist)) != NULL) {
+   SLIST_REMOVE_HEAD(&idlist, list);
+   free(tt);
}
currentout = -bp->ut_tv.tv_sec;
crmsg = bp->ut_type != SHUTDOWN_TIME ?
@@ -279,7 +277,7 @@ doentry(struct utmpx *bp)
return;
 
/* find associated identifier */
-   LIST_FOREACH(tt, &idlist, list)
+   SLIST_FOREACH(tt, &idlist, list)
if (!memcmp(tt->id, bp->ut_id, sizeof bp->ut_id))
break;
 
@@ -290,7 +288,7 @@ doentry(struct utmpx *bp)
errx(1, "malloc failure");
tt->logout = currentout;
memcpy(tt->id, bp->ut_id, sizeof bp->ut_id);
-   LIST_INSERT_HEAD(&idlist, tt, list);
+   SLIST_INSERT_HEAD(&idlist, tt, list);
}
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240426 - head/sys/sys

2012-09-12 Thread Ed Schouten
Author: ed
Date: Wed Sep 12 22:54:11 2012
New Revision: 240426
URL: http://svn.freebsd.org/changeset/base/240426

Log:
  Correctness: use __member2struct() on the correct fields.
  
  The prev-pointers point to the next-pointers of the previous element --
  not the ENTRY structure. The next-pointers are stored in the ENTRY
  structures first, so the code would already work correctly. Still, it is
  more accurate to use the next-fields.
  
  To prevent misuse of __member2struct() in the future, I've got a patch
  that requires the pointer to be passed to this macro to be compatible
  with the member of the structure. I'll commit this patch after I've
  tested it properly.
  
  MFC after:1 month.

Modified:
  head/sys/sys/queue.h

Modified: head/sys/sys/queue.h
==
--- head/sys/sys/queue.hWed Sep 12 22:16:31 2012(r240425)
+++ head/sys/sys/queue.hWed Sep 12 22:54:11 2012(r240426)
@@ -289,7 +289,7 @@ struct {
\
 #defineSTAILQ_LAST(head, type, field)  
\
(STAILQ_EMPTY((head)) ? \
NULL :  \
-   __member2struct(type, field, (head)->stqh_last))
+   __member2struct(type, field.stqe_next, (head)->stqh_last))
 
 #defineSTAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
 
@@ -427,7 +427,7 @@ struct {
\
 #defineLIST_PREV(elm, head, type, field)   
\
((elm)->field.le_prev == &LIST_FIRST((head)) ?  \
NULL :  \
-   __member2struct(type, field, (elm)->field.le_prev))
+   __member2struct(type, field.le_next, (elm)->field.le_prev))
 
 #defineLIST_REMOVE(elm, field) do {
\
QMD_SAVELINK(oldnext, (elm)->field.le_next);\
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240427 - head/sys/dev/virtio

2012-09-12 Thread Peter Grehan
Author: grehan
Date: Thu Sep 13 00:36:46 2012
New Revision: 240427
URL: http://svn.freebsd.org/changeset/base/240427

Log:
  Relax requirement of certain mb()s
  
  Submitted by: Bryan Venteicher bryanv at daemoninthecloset org

Modified:
  head/sys/dev/virtio/virtqueue.c

Modified: head/sys/dev/virtio/virtqueue.c
==
--- head/sys/dev/virtio/virtqueue.c Wed Sep 12 22:54:11 2012
(r240426)
+++ head/sys/dev/virtio/virtqueue.c Thu Sep 13 00:36:46 2012
(r240427)
@@ -525,7 +525,7 @@ virtqueue_dequeue(struct virtqueue *vq, 
used_idx = vq->vq_used_cons_idx++ & (vq->vq_nentries - 1);
uep = &vq->vq_ring.used->ring[used_idx];
 
-   mb();
+   rmb();
desc_idx = (uint16_t) uep->id;
if (len != NULL)
*len = uep->len;
@@ -623,7 +623,7 @@ vq_ring_update_avail(struct virtqueue *v
avail_idx = vq->vq_ring.avail->idx & (vq->vq_nentries - 1);
vq->vq_ring.avail->ring[avail_idx] = desc_idx;
 
-   mb();
+   wmb();
vq->vq_ring.avail->idx++;
 
/* Keep pending count until virtqueue_notify(). */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240430 - head/sys/dev/virtio

2012-09-12 Thread Peter Grehan
Author: grehan
Date: Thu Sep 13 00:42:56 2012
New Revision: 240430
URL: http://svn.freebsd.org/changeset/base/240430

Log:
  No need to leak these into the includer's namespace.
  
  Submitted by: Bryan Venteicher bryanv at daemoninthecloset org

Modified:
  head/sys/dev/virtio/virtio.h

Modified: head/sys/dev/virtio/virtio.h
==
--- head/sys/dev/virtio/virtio.hThu Sep 13 00:39:44 2012
(r240429)
+++ head/sys/dev/virtio/virtio.hThu Sep 13 00:42:56 2012
(r240430)
@@ -151,6 +151,8 @@ VIRTIO_RDWR_DEVICE_CONFIG(1, uint8_t);
 VIRTIO_RDWR_DEVICE_CONFIG(2, uint16_t);
 VIRTIO_RDWR_DEVICE_CONFIG(4, uint32_t);
 
+#undef VIRTIO_RDWR_DEVICE_CONFIG
+
 #define VIRTIO_READ_IVAR(name, ivar)   \
 static inline int  \
 __CONCAT(virtio_get_,name)(device_t dev)   \
@@ -166,6 +168,8 @@ VIRTIO_READ_IVAR(device,VIRTIO_IVAR_DEV
 VIRTIO_READ_IVAR(subvendor,VIRTIO_IVAR_SUBVENDOR);
 VIRTIO_READ_IVAR(subdevice,VIRTIO_IVAR_SUBDEVICE);
 
+#undef VIRTIO_READ_IVAR
+
 #define VIRTIO_WRITE_IVAR(name, ivar)  \
 static inline void \
 __CONCAT(virtio_set_,name)(device_t dev, void *val)\
@@ -175,4 +179,6 @@ __CONCAT(virtio_set_,name)(device_t dev,
 
 VIRTIO_WRITE_IVAR(feature_desc,VIRTIO_IVAR_FEATURE_DESC);
 
+#undef VIRTIO_WRITE_IVAR
+
 #endif /* _VIRTIO_H_ */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r240442 - head/sys/arm/arm

2012-09-12 Thread Alan Cox
Author: alc
Date: Thu Sep 13 06:16:49 2012
New Revision: 240442
URL: http://svn.freebsd.org/changeset/base/240442

Log:
  Simplify the kernel pmap locking in pmap_enter_pv().  While I'm here, tidy
  up the comments and whitespace.
  
  Tested by:cognet

Modified:
  head/sys/arm/arm/pmap.c

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Thu Sep 13 01:05:30 2012(r240441)
+++ head/sys/arm/arm/pmap.c Thu Sep 13 06:16:49 2012(r240442)
@@ -1588,11 +1588,11 @@ pmap_clearbit(struct vm_page *pg, u_int 
  */
 
 /*
- * pmap_enter_pv: enter a mapping onto a vm_page lst
+ * pmap_enter_pv: enter a mapping onto a vm_page's PV list
  *
  * => caller should hold the proper lock on pvh_global_lock
  * => caller should have pmap locked
- * => we will gain the lock on the vm_page and allocate the new pv_entry
+ * => we will (someday) gain the lock on the vm_page's PV list
  * => caller should adjust ptp's wire_count before calling
  * => caller should not adjust pmap's wire_count
  */
@@ -1600,33 +1600,26 @@ static void
 pmap_enter_pv(struct vm_page *pg, struct pv_entry *pve, pmap_t pm,
 vm_offset_t va, u_int flags)
 {
-   int km;
 
rw_assert(&pvh_global_lock, RA_WLOCKED);
-
+   PMAP_ASSERT_LOCKED(pm);
if (pg->md.pv_kva != 0) {
-   /* PMAP_ASSERT_LOCKED(pmap_kernel()); */
-   pve->pv_pmap = pmap_kernel();
+   pve->pv_pmap = kernel_pmap;
pve->pv_va = pg->md.pv_kva;
pve->pv_flags = PVF_WRITE | PVF_UNMAN;
-   pg->md.pv_kva = 0;
-
-   if (!(km = PMAP_OWNED(pmap_kernel(
-   PMAP_LOCK(pmap_kernel());
+   if (pm != kernel_pmap)
+   PMAP_LOCK(kernel_pmap);
TAILQ_INSERT_HEAD(&pg->md.pv_list, pve, pv_list);
-   TAILQ_INSERT_HEAD(&pve->pv_pmap->pm_pvlist, pve, pv_plist);
-   PMAP_UNLOCK(pmap_kernel());
+   TAILQ_INSERT_HEAD(&kernel_pmap->pm_pvlist, pve, pv_plist);
+   if (pm != kernel_pmap)
+   PMAP_UNLOCK(kernel_pmap);
+   pg->md.pv_kva = 0;
if ((pve = pmap_get_pv_entry()) == NULL)
panic("pmap_kenter_pv: no pv entries");
-   if (km)
-   PMAP_LOCK(pmap_kernel());
}
-
-   PMAP_ASSERT_LOCKED(pm);
pve->pv_pmap = pm;
pve->pv_va = va;
pve->pv_flags = flags;
-
TAILQ_INSERT_HEAD(&pg->md.pv_list, pve, pv_list);
TAILQ_INSERT_HEAD(&pm->pm_pvlist, pve, pv_plist);
pg->md.pvh_attrs |= flags & (PVF_REF | PVF_MOD);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"