svn commit: r254356 - in head/sys: compat/freebsd32 kern ofed/include/linux opencrypto sys

2013-08-15 Thread Gleb Smirnoff
Author: glebius
Date: Thu Aug 15 07:54:31 2013
New Revision: 254356
URL: http://svnweb.freebsd.org/changeset/base/254356

Log:
  Make sendfile() a method in the struct fileops.  Currently only
  vnode backed file descriptors have this method implemented.
  
  Reviewed by:  kib
  Sponsored by: Nginx, Inc.
  Sponsored by: Netflix

Modified:
  head/sys/compat/freebsd32/freebsd32_misc.c
  head/sys/kern/kern_descrip.c
  head/sys/kern/kern_event.c
  head/sys/kern/sys_pipe.c
  head/sys/kern/sys_socket.c
  head/sys/kern/tty_pts.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/uipc_sem.c
  head/sys/kern/uipc_shm.c
  head/sys/kern/uipc_syscalls.c
  head/sys/kern/vfs_vnops.c
  head/sys/ofed/include/linux/linux_compat.c
  head/sys/opencrypto/cryptodev.c
  head/sys/sys/file.h
  head/sys/sys/socket.h

Modified: head/sys/compat/freebsd32/freebsd32_misc.c
==
--- head/sys/compat/freebsd32/freebsd32_misc.c  Thu Aug 15 05:14:20 2013
(r254355)
+++ head/sys/compat/freebsd32/freebsd32_misc.c  Thu Aug 15 07:54:31 2013
(r254356)
@@ -35,6 +35,7 @@ __FBSDID($FreeBSD$);
 
 #include sys/param.h
 #include sys/bus.h
+#include sys/capability.h
 #include sys/clock.h
 #include sys/exec.h
 #include sys/fcntl.h
@@ -1653,22 +1654,19 @@ static int
 freebsd32_do_sendfile(struct thread *td,
 struct freebsd32_sendfile_args *uap, int compat)
 {
-   struct sendfile_args ap;
struct sf_hdtr32 hdtr32;
struct sf_hdtr hdtr;
struct uio *hdr_uio, *trl_uio;
struct iovec32 *iov32;
+   struct file *fp;
+   off_t offset;
int error;
 
-   hdr_uio = trl_uio = NULL;
+   offset = PAIR32TO64(off_t, uap-offset);
+   if (offset  0)
+   return (EINVAL);
 
-   ap.fd = uap-fd;
-   ap.s = uap-s;
-   ap.offset = PAIR32TO64(off_t,uap-offset);
-   ap.nbytes = uap-nbytes;
-   ap.hdtr = (struct sf_hdtr *)uap-hdtr;  /* XXX not used */
-   ap.sbytes = uap-sbytes;
-   ap.flags = uap-flags;
+   hdr_uio = trl_uio = NULL;
 
if (uap-hdtr != NULL) {
error = copyin(uap-hdtr, hdtr32, sizeof(hdtr32));
@@ -1695,7 +1693,15 @@ freebsd32_do_sendfile(struct thread *td,
}
}
 
-   error = kern_sendfile(td, ap, hdr_uio, trl_uio, compat);
+   AUDIT_ARG_FD(uap-fd);
+
+   if ((error = fget_read(td, uap-fd, CAP_PREAD, fp)) != 0)
+   goto out;
+
+   error = fo_sendfile(fp, uap-s, hdr_uio, trl_uio, offset,
+   uap-nbytes, uap-sbytes, uap-flags, compat ? SFK_COMPAT : 0, td);
+   fdrop(fp, td);
+
 out:
if (hdr_uio)
free(hdr_uio, M_IOV);

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cThu Aug 15 05:14:20 2013
(r254355)
+++ head/sys/kern/kern_descrip.cThu Aug 15 07:54:31 2013
(r254356)
@@ -3887,6 +3887,15 @@ badfo_chown(struct file *fp, uid_t uid, 
return (EBADF);
 }
 
+static int
+badfo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
+struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags,
+int kflags, struct thread *td)
+{
+
+   return (EBADF);
+}
+
 struct fileops badfileops = {
.fo_read = badfo_readwrite,
.fo_write = badfo_readwrite,
@@ -3898,6 +3907,7 @@ struct fileops badfileops = {
.fo_close = badfo_close,
.fo_chmod = badfo_chmod,
.fo_chown = badfo_chown,
+   .fo_sendfile = badfo_sendfile,
 };
 
 int
@@ -3916,6 +3926,15 @@ invfo_chown(struct file *fp, uid_t uid, 
return (EINVAL);
 }
 
+int
+invfo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
+struct uio *trl_uio, off_t offset, size_t nbytes, off_t *sent, int flags,
+int kflags, struct thread *td)
+{
+
+   return (EINVAL);
+}
+
 /*---*/
 
 /*

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Thu Aug 15 05:14:20 2013(r254355)
+++ head/sys/kern/kern_event.c  Thu Aug 15 07:54:31 2013(r254356)
@@ -127,6 +127,7 @@ static struct fileops kqueueops = {
.fo_close = kqueue_close,
.fo_chmod = invfo_chmod,
.fo_chown = invfo_chown,
+   .fo_sendfile = invfo_sendfile,
 };
 
 static int knote_attach(struct knote *kn, struct kqueue *kq);

Modified: head/sys/kern/sys_pipe.c
==
--- head/sys/kern/sys_pipe.cThu Aug 15 05:14:20 2013(r254355)
+++ head/sys/kern/sys_pipe.cThu Aug 15 07:54:31 2013(r254356)
@@ -164,6 +164,7 @@ struct fileops pipeops = {
.fo_close = pipe_close,
.fo_chmod = pipe_chmod,
.fo_chown = pipe_chown,
+   .fo_sendfile = invfo_sendfile,

svn commit: r254358 - head/sys/sys

2013-08-15 Thread Jeremie Le Hen
Author: jlh
Date: Thu Aug 15 08:21:00 2013
New Revision: 254358
URL: http://svnweb.freebsd.org/changeset/base/254358

Log:
  Belatedly bump __FreeBSD_version for libc being an ld script.
  This should have been done in r251668, on June 12, 2013.
  
  This will have no practical consequences, besides having -lssp_nonshared
  appearing twice on the command-line for systems built in this time frame.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hThu Aug 15 08:12:16 2013(r254357)
+++ head/sys/sys/param.hThu Aug 15 08:21:00 2013(r254358)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 143  /* Master, propagated to newvers */
+#define __FreeBSD_version 144  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r254358 - head/sys/sys

2013-08-15 Thread Gleb Smirnoff
On Thu, Aug 15, 2013 at 08:21:00AM +, Jeremie Le Hen wrote:
J Author: jlh
J Date: Thu Aug 15 08:21:00 2013
J New Revision: 254358
J URL: http://svnweb.freebsd.org/changeset/base/254358
J 
J Log:
J   Belatedly bump __FreeBSD_version for libc being an ld script.
J   This should have been done in r251668, on June 12, 2013.
J   This will have no practical consequences, besides having -lssp_nonshared
J   appearing twice on the command-line for systems built in this time frame.

It has been bumped several times since June 12.

You could use __FreeBSD_version 136 from r253049, which
happened on July 7.

-- 
Totus tuus, Glebius.
___
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: r254358 - head/sys/sys

2013-08-15 Thread Jeremie Le Hen
On Thu, Aug 15, 2013 at 12:25:05PM +0400, Gleb Smirnoff wrote:
 On Thu, Aug 15, 2013 at 08:21:00AM +, Jeremie Le Hen wrote:
 J Author: jlh
 J Date: Thu Aug 15 08:21:00 2013
 J New Revision: 254358
 J URL: http://svnweb.freebsd.org/changeset/base/254358
 J 
 J Log:
 J   Belatedly bump __FreeBSD_version for libc being an ld script.
 J   This should have been done in r251668, on June 12, 2013.
 J   This will have no practical consequences, besides having -lssp_nonshared
 J   appearing twice on the command-line for systems built in this time frame.
 
 It has been bumped several times since June 12.
 
 You could use __FreeBSD_version 136 from r253049, which
 happened on July 7.

That's right, but I didn't know if it was accepted to overload a
version.  Should I back this out?

-- 
Jeremie Le Hen

Scientists say the world is made up of Protons, Neutrons and Electrons.
They forgot to mention Morons.
___
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: r254358 - head/sys/sys

2013-08-15 Thread Gleb Smirnoff
On Thu, Aug 15, 2013 at 10:54:04AM +0200, Jeremie Le Hen wrote:
J On Thu, Aug 15, 2013 at 12:25:05PM +0400, Gleb Smirnoff wrote:
J  On Thu, Aug 15, 2013 at 08:21:00AM +, Jeremie Le Hen wrote:
J  J Author: jlh
J  J Date: Thu Aug 15 08:21:00 2013
J  J New Revision: 254358
J  J URL: http://svnweb.freebsd.org/changeset/base/254358
J  J 
J  J Log:
J  J   Belatedly bump __FreeBSD_version for libc being an ld script.
J  J   This should have been done in r251668, on June 12, 2013.
J  J   This will have no practical consequences, besides having 
-lssp_nonshared
J  J   appearing twice on the command-line for systems built in this time 
frame.
J  
J  It has been bumped several times since June 12.
J  
J  You could use __FreeBSD_version 136 from r253049, which
J  happened on July 7.
J 
J That's right, but I didn't know if it was accepted to overload a
J version.  Should I back this out?

IMO, version should never go backwards. So please do not back out.

But the code that depends on libc being an ld script should better
use 136 as __FreeBSD_version, making time frame of non-bumped
version much smaller.

-- 
Totus tuus, Glebius.
___
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: r254362 - head/sys/vm

2013-08-15 Thread Attilio Rao
Author: attilio
Date: Thu Aug 15 11:01:25 2013
New Revision: 254362
URL: http://svnweb.freebsd.org/changeset/base/254362

Log:
  On the recovery path for vm_page_alloc(), if a page had been requested
  wired, unwind back the wiring bits otherwise we can end up freeing a
  page that is considered wired.
  
  Sponsored by: EMC / Isilon storage division
  Reported by:  alc

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Aug 15 10:38:10 2013(r254361)
+++ head/sys/vm/vm_page.c   Thu Aug 15 11:01:25 2013(r254362)
@@ -1611,6 +1611,10 @@ vm_page_alloc(vm_object_t object, vm_pin
if (vp != NULL)
vdrop(vp);
pagedaemon_wakeup();
+   if (req  VM_ALLOC_WIRED) {
+   atomic_subtract_int(cnt.v_wire_count, 1);
+   m-wire_count = 0;
+   }
m-object = NULL;
vm_page_free(m);
return (NULL);
@@ -1806,8 +1810,13 @@ retry:
deferred_vdrop_list);
if (vm_paging_needed())
pagedaemon_wakeup();
+   if ((req  VM_ALLOC_WIRED) != 0)
+   atomic_subtract_int(cnt.v_wire_count,
+   npages);
for (m_tmp = m, m = m_ret;
m  m_ret[npages]; m++) {
+   if ((req  VM_ALLOC_WIRED) != 0)
+   m-wire_count = 0;
if (m = m_tmp)
m-object = NULL;
vm_page_free(m);
___
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: r254371 - head/share/misc

2013-08-15 Thread Rusmir Dusko
Author: nemysis (ports committer)
Date: Thu Aug 15 16:03:09 2013
New Revision: 254371
URL: http://svnweb.freebsd.org/changeset/base/254371

Log:
  - Add myself in committers-ports.dot
  
  Approved by:  miwi/wxs/wg (mentors)

Modified:
  head/share/misc/committers-ports.dot

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotThu Aug 15 15:34:26 2013
(r254370)
+++ head/share/misc/committers-ports.dotThu Aug 15 16:03:09 2013
(r254371)
@@ -155,6 +155,7 @@ miwi [label=Martin Wilke\nmiwi@FreeBSD.
 mm [label=Martin Matuska\n...@freebsd.org\n2007/04/04]
 mnag [label=Marcus Alves Grando\nm...@freebsd.org\n2005/09/15]
 mva [label=Marcus von Appen\n...@freebsd.org\n2009/02/16]
+nemysis [label=Rusmir Dusko\nnemy...@freebsd.org\n2013/07/31]
 nemoliu [label=Tong Liu\nnemo...@freebsd.org\n2007/04/25]
 netchild [label=Alexander Leidinger\nnetch...@freebsd.org\n2002/03/19]
 nobutaka [label=Nobutaka Mantani\nnobut...@freebsd.org\n2001/11/02]
@@ -421,6 +422,7 @@ miwi - lme
 miwi - makc
 miwi - mandree
 miwi - mva
+miwi - nemysis
 miwi - nox
 miwi - olivierd
 miwi - pawel
@@ -456,6 +458,8 @@ pav - josef
 pav - kwm
 pav - mnag
 
+pawel - nemysis
+
 pgj - ashish
 pgj - jacula
 
@@ -525,9 +529,12 @@ wen - cs
 wen - culot
 wen - pawel
 
+wg - nemysis
+
 will - lioux
 
 wxs - jsa
+wxs - nemysis
 wxs - sahil
 wxs - skreuzer
 wxs - swills
___
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: r254372 - head/sys/dev/isp

2013-08-15 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 15 16:41:27 2013
New Revision: 254372
URL: http://svnweb.freebsd.org/changeset/base/254372

Log:
  Export the maxio field in the CAM XPT_PATH_INQ CCB in the isp(4)
  driver.
  
  This tells consumers up the stack the maximum I/O size that the
  controller can handle.
  
  The I/O size is bounded by the number of scatter/gather segments
  the controller can handle and the page size.  For an amd64 system,
  it works out to around 5MB.
  
  Reviewed by:  mjacob
  MFC after:3 days
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Thu Aug 15 16:03:09 2013
(r254371)
+++ head/sys/dev/isp/isp_freebsd.c  Thu Aug 15 16:41:27 2013
(r254372)
@@ -5445,6 +5445,11 @@ isp_action(struct cam_sim *sim, union cc
cpi-max_target = ISP_MAX_TARGETS(isp) - 1;
cpi-max_lun = ISP_MAX_LUNS(isp) - 1;
cpi-bus_id = cam_sim_bus(sim);
+   if (isp-isp_osinfo.sixtyfourbit)
+   cpi-maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE;
+   else
+   cpi-maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE;
+
bus = cam_sim_bus(xpt_path_sim(cpi-ccb_h.path));
if (IS_FC(isp)) {
fcparam *fcp = FCPARAM(isp, bus);
___
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: r254373 - head/sys/x86/isa

2013-08-15 Thread Brooks Davis
Author: brooks
Date: Thu Aug 15 17:21:06 2013
New Revision: 254373
URL: http://svnweb.freebsd.org/changeset/base/254373

Log:
  Call set_i8254_freq with MODE_STOP (0) rather than a magic number of 0.

Modified:
  head/sys/x86/isa/clock.c

Modified: head/sys/x86/isa/clock.c
==
--- head/sys/x86/isa/clock.cThu Aug 15 16:41:27 2013(r254372)
+++ head/sys/x86/isa/clock.cThu Aug 15 17:21:06 2013(r254373)
@@ -469,7 +469,7 @@ i8254_restore(void)
if (attimer_sc != NULL)
set_i8254_freq(attimer_sc-mode, attimer_sc-period);
else
-   set_i8254_freq(0, 0);
+   set_i8254_freq(MODE_STOP, 0);
 }
 
 #ifndef __amd64__
@@ -504,7 +504,7 @@ i8254_init(void)
if (pc98_machine_type  M_8M)
i8254_freq = 1996800L; /* 1.9968 MHz */
 #endif
-   set_i8254_freq(0, 0);
+   set_i8254_freq(MODE_STOP, 0);
 }
 
 void
@@ -539,7 +539,7 @@ sysctl_machdep_i8254_freq(SYSCTL_HANDLER
set_i8254_freq(attimer_sc-mode, attimer_sc-period);
attimer_sc-tc.tc_frequency = freq;
} else {
-   set_i8254_freq(0, 0);
+   set_i8254_freq(MODE_STOP, 0);
}
}
return (error);
@@ -715,7 +715,7 @@ attimer_attach(device_t dev)
i8254_pending = i8254_intsrc-is_pic-pic_source_pending;
resource_int_value(device_get_name(dev), device_get_unit(dev),
timecounter, i8254_timecounter);
-   set_i8254_freq(0, 0);
+   set_i8254_freq(MODE_STOP, 0);
if (i8254_timecounter) {
sc-tc.tc_get_timecount = i8254_get_timecount;
sc-tc.tc_counter_mask = 0x;
___
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: r254374 - head/sys/amd64/amd64

2013-08-15 Thread Brooks Davis
Author: brooks
Date: Thu Aug 15 17:44:44 2013
New Revision: 254374
URL: http://svnweb.freebsd.org/changeset/base/254374

Log:
  Use an ANSI C definition of initializecpucache() to match the declaration
  and the rest of the file.

Modified:
  head/sys/amd64/amd64/initcpu.c

Modified: head/sys/amd64/amd64/initcpu.c
==
--- head/sys/amd64/amd64/initcpu.c  Thu Aug 15 17:21:06 2013
(r254373)
+++ head/sys/amd64/amd64/initcpu.c  Thu Aug 15 17:44:44 2013
(r254374)
@@ -192,7 +192,7 @@ initializecpu(void)
 }
 
 void
-initializecpucache()
+initializecpucache(void)
 {
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-08-15 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Aug 15 20:00:32 2013
New Revision: 254378
URL: http://svnweb.freebsd.org/changeset/base/254378

Log:
  Turn comments about locking into actual lock assertions.
  
  Reviewed by:  ken
  Tested by:ken
  MFC after:1 month

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

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Thu Aug 15 19:46:31 2013(r254377)
+++ head/sys/cam/ctl/ctl.c  Thu Aug 15 20:00:32 2013(r254378)
@@ -1070,9 +1070,11 @@ ctl_init(void)
softc-emergency_pool = emergency_pool;
softc-othersc_pool = other_pool;
 
+   mtx_lock(softc-ctl_lock);
ctl_pool_acquire(internal_pool);
ctl_pool_acquire(emergency_pool);
ctl_pool_acquire(other_pool);
+   mtx_unlock(softc-ctl_lock);
 
/*
 * We used to allocate a processor LUN here.  The new scheme is to
@@ -1088,10 +1090,12 @@ ctl_init(void)
 ctl_thrd);
if (error != 0) {
printf(error creating CTL work thread!\n);
+   mtx_lock(softc-ctl_lock);
ctl_free_lun(lun);
ctl_pool_free(softc, internal_pool);
ctl_pool_free(softc, emergency_pool);
ctl_pool_free(softc, other_pool);
+   mtx_unlock(softc-ctl_lock);
return (error);
}
printf(ctl: CAM Target Layer loaded\n);
@@ -1372,7 +1376,6 @@ ctl_ioctl_offline(void *arg)
 /*
  * Remove an initiator by port number and initiator ID.
  * Returns 0 for success, 1 for failure.
- * Assumes the caller does NOT hold the CTL lock.
  */
 int
 ctl_remove_initiator(int32_t targ_port, uint32_t iid)
@@ -1381,6 +1384,8 @@ ctl_remove_initiator(int32_t targ_port, 
 
softc = control_softc;
 
+   mtx_assert(softc-ctl_lock, MA_NOTOWNED);
+
if ((targ_port  0)
 || (targ_port  CTL_MAX_PORTS)) {
printf(%s: invalid port number %d\n, __func__, targ_port);
@@ -1404,7 +1409,6 @@ ctl_remove_initiator(int32_t targ_port, 
 /*
  * Add an initiator to the initiator map.
  * Returns 0 for success, 1 for failure.
- * Assumes the caller does NOT hold the CTL lock.
  */
 int
 ctl_add_initiator(uint64_t wwpn, int32_t targ_port, uint32_t iid)
@@ -1414,6 +1418,8 @@ ctl_add_initiator(uint64_t wwpn, int32_t
 
softc = control_softc;
 
+   mtx_assert(softc-ctl_lock, MA_NOTOWNED);
+
retval = 0;
 
if ((targ_port  0)
@@ -1970,7 +1976,6 @@ ctl_ioctl_bbrread_callback(void *arg, st
 }
 
 /*
- * Must be called with the ctl_lock held.
  * Returns 0 for success, errno for failure.
  */
 static int
@@ -1982,6 +1987,8 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, 
 
retval = 0;
 
+   mtx_assert(control_softc-ctl_lock, MA_OWNED);
+
for (io = (union ctl_io *)TAILQ_FIRST(lun-ooa_queue); (io != NULL);
 (*cur_fill_num)++, io = (union ctl_io *)TAILQ_NEXT(io-io_hdr,
 ooa_links)) {
@@ -3395,12 +3402,12 @@ bailout:
return (retval);
 }
 
-/*
- * Caller must hold ctl_softc-ctl_lock.
- */
 int
 ctl_pool_acquire(struct ctl_io_pool *pool)
 {
+
+   mtx_assert(control_softc-ctl_lock, MA_OWNED);
+
if (pool == NULL)
return (-EINVAL);
 
@@ -3412,12 +3419,12 @@ ctl_pool_acquire(struct ctl_io_pool *poo
return (0);
 }
 
-/*
- * Caller must hold ctl_softc-ctl_lock.
- */
 int
 ctl_pool_invalidate(struct ctl_io_pool *pool)
 {
+
+   mtx_assert(control_softc-ctl_lock, MA_OWNED);
+
if (pool == NULL)
return (-EINVAL);
 
@@ -3426,12 +3433,12 @@ ctl_pool_invalidate(struct ctl_io_pool *
return (0);
 }
 
-/*
- * Caller must hold ctl_softc-ctl_lock.
- */
 int
 ctl_pool_release(struct ctl_io_pool *pool)
 {
+
+   mtx_assert(control_softc-ctl_lock, MA_OWNED);
+
if (pool == NULL)
return (-EINVAL);
 
@@ -3443,14 +3450,13 @@ ctl_pool_release(struct ctl_io_pool *poo
return (0);
 }
 
-/*
- * Must be called with ctl_softc-ctl_lock held.
- */
 void
 ctl_pool_free(struct ctl_softc *ctl_softc, struct ctl_io_pool *pool)
 {
union ctl_io *cur_io, *next_io;
 
+   mtx_assert(ctl_softc-ctl_lock, MA_OWNED);
+
for (cur_io = (union ctl_io *)STAILQ_FIRST(pool-free_queue);
 cur_io != NULL; cur_io = next_io) {
next_io = (union ctl_io *)STAILQ_NEXT(cur_io-io_hdr,
@@ -4392,7 +4398,6 @@ ctl_alloc_lun(struct ctl_softc *ctl_soft
 /*
  * Delete a LUN.
  * Assumptions:
- * - caller holds ctl_softc-ctl_lock.
  * - LUN has already been marked invalid and any pending I/O has been taken
  *   care of.
  */
@@ -4409,6 +4414,8 @@ ctl_free_lun(struct ctl_lun *lun)
 
softc = lun-ctl_softc;
 
+   mtx_assert(softc-ctl_lock, MA_OWNED);
+
STAILQ_REMOVE(softc-lun_list, lun, ctl_lun, links);
 
ctl_clear_mask(softc-ctl_lun_mask, lun-lun);
@@ -9772,7 +9779,6 @@ ctl_check_for_blockage(union ctl_io *pen
 

svn commit: r254379 - head/sys/dev/iir

2013-08-15 Thread Jung-uk Kim
Author: jkim
Date: Thu Aug 15 20:03:22 2013
New Revision: 254379
URL: http://svnweb.freebsd.org/changeset/base/254379

Log:
  Avoid potential redefinition of the macro.

Modified:
  head/sys/dev/iir/iir.c
  head/sys/dev/iir/iir.h
  head/sys/dev/iir/iir_ctrl.c
  head/sys/dev/iir/iir_pci.c

Modified: head/sys/dev/iir/iir.c
==
--- head/sys/dev/iir/iir.c  Thu Aug 15 20:00:32 2013(r254378)
+++ head/sys/dev/iir/iir.c  Thu Aug 15 20:03:22 2013(r254379)
@@ -399,7 +399,7 @@ iir_init(struct gdt_softc *gdt)
gdt-oem_name[7]='\0';
} else {
/* Old method, based on PCI ID */
-   if (gdt-sc_vendor == INTEL_VENDOR_ID)
+   if (gdt-sc_vendor == INTEL_VENDOR_ID_IIR)
 strcpy(gdt-oem_name,Intel  );
 else 
strcpy(gdt-oem_name,ICP);
@@ -1374,7 +1374,7 @@ iir_action( struct cam_sim *sim, union c
   (bus == gdt-sc_virt_bus ? 127 : gdt-sc_bus_id[bus]);
   cpi-base_transfer_speed = 3300;
   strncpy(cpi-sim_vid, FreeBSD, SIM_IDLEN);
-  if (gdt-sc_vendor == INTEL_VENDOR_ID)
+  if (gdt-sc_vendor == INTEL_VENDOR_ID_IIR)
   strncpy(cpi-hba_vid, Intel Corp., HBA_IDLEN);
   else
   strncpy(cpi-hba_vid, ICP vortex , HBA_IDLEN);

Modified: head/sys/dev/iir/iir.h
==
--- head/sys/dev/iir/iir.h  Thu Aug 15 20:00:32 2013(r254378)
+++ head/sys/dev/iir/iir.h  Thu Aug 15 20:03:22 2013(r254379)
@@ -63,7 +63,7 @@
 #define GDT_DEVICE_ID_MAX   0x2ff
 #define GDT_DEVICE_ID_NEWRX 0x300
 
-#define INTEL_VENDOR_ID 0x8086
+#define INTEL_VENDOR_ID_IIR 0x8086
 #define INTEL_DEVICE_ID_IIR 0x600
 
 #define GDT_MAXBUS  6   /* XXX Why not 5? */

Modified: head/sys/dev/iir/iir_ctrl.c
==
--- head/sys/dev/iir/iir_ctrl.c Thu Aug 15 20:00:32 2013(r254378)
+++ head/sys/dev/iir/iir_ctrl.c Thu Aug 15 20:03:22 2013(r254379)
@@ -273,7 +273,7 @@ iir_ioctl(struct cdev *dev, u_long cmd, 
 return (ENXIO);
 /* only RP controllers */
 p-ext_type = 0x6000 | gdt-sc_device;
-if (gdt-sc_vendor == INTEL_VENDOR_ID) {
+if (gdt-sc_vendor == INTEL_VENDOR_ID_IIR) {
 p-oem_id = OEM_ID_INTEL;
 p-type = 0xfd;
 /* new - subdevice into ext_type */

Modified: head/sys/dev/iir/iir_pci.c
==
--- head/sys/dev/iir/iir_pci.c  Thu Aug 15 20:00:32 2013(r254378)
+++ head/sys/dev/iir/iir_pci.c  Thu Aug 15 20:03:22 2013(r254379)
@@ -163,7 +163,7 @@ MODULE_DEPEND(iir, cam, 1, 1, 1);
 static int
 iir_pci_probe(device_t dev)
 {
-if (pci_get_vendor(dev) == INTEL_VENDOR_ID 
+if (pci_get_vendor(dev) == INTEL_VENDOR_ID_IIR 
 pci_get_device(dev) == INTEL_DEVICE_ID_IIR) {
 device_set_desc(dev, Intel Integrated RAID Controller);
 return (BUS_PROBE_DEFAULT);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r254380 - in head/sys: kern sys

2013-08-15 Thread Colin Percival
Author: cperciva
Date: Thu Aug 15 20:19:17 2013
New Revision: 254380
URL: http://svnweb.freebsd.org/changeset/base/254380

Log:
  Change the queue of locks in kern_rangelock.c from holding lock requests in
  the order that they arrive, to holding
  (a) granted write lock requests, followed by
  (b) granted read lock requests, followed by
  (c) ungranted requests, in order of arrival.
  
  This changes the stopping condition for iterating through granted locks to
  see if a new request can be granted: When considering a read lock request,
  we can stop iterating as soon as we see a read lock request, since anything
  after that point is either a granted read lock request or a request which
  has not yet been granted.  (For write lock requests, we must still compare
  against all granted lock requests.)
  
  For workloads with R parallel reads and W parallel writes, this improves
  the time spent from O((R+W)^2) to O(W*(R+W)); i.e., heavy parallel-read
  workloads become significantly more scalable.
  
  No statistically significant change in buildworld time has been measured,
  but synthetic tests of parallel 'dd  /dev/null' and 'openssl enc /dev/null'
  with the input file cached yield dramatic (up to 10x) improvement with high
  (up to 128 processes) levels of parallelism.
  
  Reviewed by:  kib

Modified:
  head/sys/kern/kern_rangelock.c
  head/sys/sys/rangelock.h

Modified: head/sys/kern/kern_rangelock.c
==
--- head/sys/kern/kern_rangelock.c  Thu Aug 15 20:03:22 2013
(r254379)
+++ head/sys/kern/kern_rangelock.c  Thu Aug 15 20:19:17 2013
(r254380)
@@ -84,20 +84,14 @@ rangelock_destroy(struct rangelock *lock
 }
 
 /*
- * Verifies the supplied rl_q_entries for compatibility.  Returns true
- * if the rangelock queue entries are not compatible, false if they are.
- *
  * Two entries are compatible if their ranges do not overlap, or both
  * entries are for read.
  */
 static int
-rangelock_incompatible(const struct rl_q_entry *e1,
+ranges_overlap(const struct rl_q_entry *e1,
 const struct rl_q_entry *e2)
 {
 
-   if ((e1-rl_q_flags  RL_LOCK_TYPE_MASK) == RL_LOCK_READ 
-   (e2-rl_q_flags  RL_LOCK_TYPE_MASK) == RL_LOCK_READ)
-   return (0);
if (e1-rl_q_start  e2-rl_q_end  e1-rl_q_end  e2-rl_q_start)
return (1);
return (0);
@@ -109,30 +103,38 @@ rangelock_incompatible(const struct rl_q
 static void
 rangelock_calc_block(struct rangelock *lock)
 {
-   struct rl_q_entry *entry, *entry1, *whead;
+   struct rl_q_entry *entry, *nextentry, *entry1;
 
-   if (lock-rl_currdep == TAILQ_FIRST(lock-rl_waiters) 
-   lock-rl_currdep != NULL)
-   lock-rl_currdep = TAILQ_NEXT(lock-rl_currdep, rl_q_link);
-   for (entry = lock-rl_currdep; entry != NULL;
-entry = TAILQ_NEXT(entry, rl_q_link)) {
-   TAILQ_FOREACH(entry1, lock-rl_waiters, rl_q_link) {
-   if (rangelock_incompatible(entry, entry1))
-   goto out;
-   if (entry1 == entry)
-   break;
+   for (entry = lock-rl_currdep; entry != NULL; entry = nextentry) {
+   nextentry = TAILQ_NEXT(entry, rl_q_link);
+   if (entry-rl_q_flags  RL_LOCK_READ) {
+   /* Reads must not overlap with granted writes. */
+   for (entry1 = TAILQ_FIRST(lock-rl_waiters);
+   !(entry1-rl_q_flags  RL_LOCK_READ);
+   entry1 = TAILQ_NEXT(entry1, rl_q_link)) {
+   if (ranges_overlap(entry, entry1))
+   goto out;
+   }
+   } else {
+   /* Write must not overlap with any granted locks. */
+   for (entry1 = TAILQ_FIRST(lock-rl_waiters);
+   entry1 != entry;
+   entry1 = TAILQ_NEXT(entry1, rl_q_link)) {
+   if (ranges_overlap(entry, entry1))
+   goto out;
+   }
+
+   /* Move grantable write locks to the front. */
+   TAILQ_REMOVE(lock-rl_waiters, entry, rl_q_link);
+   TAILQ_INSERT_HEAD(lock-rl_waiters, entry, rl_q_link);
}
+
+   /* Grant this lock. */
+   entry-rl_q_flags |= RL_LOCK_GRANTED;
+   wakeup(entry);
}
 out:
lock-rl_currdep = entry;
-   TAILQ_FOREACH(whead, lock-rl_waiters, rl_q_link) {
-   if (whead == lock-rl_currdep)
-   break;
-   if (!(whead-rl_q_flags  RL_LOCK_GRANTED)) {
-   whead-rl_q_flags |= RL_LOCK_GRANTED;
-   wakeup(whead);
-   }
-   }
 }
 
 static void

Modified: 

Re: svn commit: r254380 - in head/sys: kern sys

2013-08-15 Thread Ivan Voras
On 15 August 2013 22:19, Colin Percival cperc...@freebsd.org wrote:

   For workloads with R parallel reads and W parallel writes, this improves
   the time spent from O((R+W)^2) to O(W*(R+W)); i.e., heavy parallel-read
   workloads become significantly more scalable.

   No statistically significant change in buildworld time has been measured,
   but synthetic tests of parallel 'dd  /dev/null' and 'openssl enc 
 /dev/null'
   with the input file cached yield dramatic (up to 10x) improvement with high
   (up to 128 processes) levels of parallelism.

That's interesting. Have you tried running the blogbench benchmark
before  after?
___
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: r254380 - in head/sys: kern sys

2013-08-15 Thread Colin Percival
On 08/15/13 13:29, Ivan Voras wrote:
 On 15 August 2013 22:19, Colin Percival cperc...@freebsd.org wrote:
   For workloads with R parallel reads and W parallel writes, this improves
   the time spent from O((R+W)^2) to O(W*(R+W)); i.e., heavy parallel-read
   workloads become significantly more scalable.

   No statistically significant change in buildworld time has been measured,
   but synthetic tests of parallel 'dd  /dev/null' and 'openssl enc 
 /dev/null'
   with the input file cached yield dramatic (up to 10x) improvement with high
   (up to 128 processes) levels of parallelism.
 
 That's interesting. Have you tried running the blogbench benchmark
 before  after?

No, I wasn't aware that it existed.  Given that this change applies only to
parallel operations *on the same vnode* and blogbench seems to have traffic
randomly spread between many files, I doubt there would be any difference.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid

___
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: r254384 - head/sys/i386/i386

2013-08-15 Thread Jung-uk Kim
Author: jkim
Date: Thu Aug 15 21:09:05 2013
New Revision: 254384
URL: http://svnweb.freebsd.org/changeset/base/254384

Log:
  Simplify check for CMPXCHG8B instruction.  Note CMPXCHG8B instruction is
  always available for Rise mP6 processors although it is not set by CPUID.

Modified:
  head/sys/i386/i386/initcpu.c
  head/sys/i386/i386/machdep.c

Modified: head/sys/i386/i386/initcpu.c
==
--- head/sys/i386/i386/initcpu.cThu Aug 15 21:06:38 2013
(r254383)
+++ head/sys/i386/i386/initcpu.cThu Aug 15 21:09:05 2013
(r254384)
@@ -424,6 +424,19 @@ init_6x86(void)
 
 #ifdef I586_CPU
 /*
+ * Rise mP6
+ */
+static void
+init_rise(void)
+{
+
+   /*
+* The CMPXCHG8B instruction is always available but hidden.
+*/
+   cpu_feature |= CPUID_CX8;
+}
+
+/*
  * IDT WinChip C6/2/2A/2B/3
  *
  * http://www.centtech.com/winchip_bios_writers_guide_v4_0.pdf
@@ -690,6 +703,9 @@ initializecpu(void)
case CPU_VENDOR_TRANSMETA:
init_transmeta();
break;
+   case CPU_VENDOR_RISE:
+   init_rise();
+   break;
}
break;
 #endif

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cThu Aug 15 21:06:38 2013
(r254383)
+++ head/sys/i386/i386/machdep.cThu Aug 15 21:09:05 2013
(r254384)
@@ -1557,8 +1557,7 @@ static void
 cpu_probe_cmpxchg8b(void)
 {
 
-   if ((cpu_feature  CPUID_CX8) != 0 ||
-   cpu_vendor_id == CPU_VENDOR_RISE) {
+   if ((cpu_feature  CPUID_CX8) != 0) {
atomic_load_acq_64 = atomic_load_acq_64_i586;
atomic_store_rel_64 = atomic_store_rel_64_i586;
}
___
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: r254380 - in head/sys: kern sys

2013-08-15 Thread Ivan Voras
On 15 August 2013 22:32, Colin Percival cperc...@freebsd.org wrote:

 No, I wasn't aware that it existed.  Given that this change applies only to
 parallel operations *on the same vnode* and blogbench seems to have traffic
 randomly spread between many files, I doubt there would be any difference.

Maybe it could help a bit on the directories?

Whatever the problem may be (does FreeBSD still have single-writer +
multiple readers lock for processes accessing the same vnode?), there
is a huge difference in performance with blogbench between FreeBSD and
Linux.
___
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: r254380 - in head/sys: kern sys

2013-08-15 Thread Colin Percival
On 08/15/13 14:34, Ivan Voras wrote:
 On 15 August 2013 22:32, Colin Percival cperc...@freebsd.org wrote:
 No, I wasn't aware that it existed.  Given that this change applies only to
 parallel operations *on the same vnode* and blogbench seems to have traffic
 randomly spread between many files, I doubt there would be any difference.
 
 Maybe it could help a bit on the directories?
 
 Whatever the problem may be (does FreeBSD still have single-writer +
 multiple readers lock for processes accessing the same vnode?), there
 is a huge difference in performance with blogbench between FreeBSD and
 Linux.

We have a single-writer / multiple-readers lock on *any particular byte*
of a vnode.  The rangelock code is what keeps track of this, and the
locking contention I was reducing was in the rangelock bookkeeping.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid

___
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: r254387 - head/sys/vm

2013-08-15 Thread Jeff Roberson
Author: jeff
Date: Thu Aug 15 22:29:49 2013
New Revision: 254387
URL: http://svnweb.freebsd.org/changeset/base/254387

Log:
   - Fix bug in r254304.  Use the ACTIVE pq count for the active list
 processing, not inactive.  This was the result of a bad merge.
  
  Reported by:  pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/vm/vm_pageout.c

Modified: head/sys/vm/vm_pageout.c
==
--- head/sys/vm/vm_pageout.cThu Aug 15 21:48:29 2013(r254386)
+++ head/sys/vm/vm_pageout.cThu Aug 15 22:29:49 2013(r254387)
@@ -1286,6 +1286,8 @@ relock_queues:
 * Compute the number of pages we want to try to move from the
 * active queue to the inactive queue.
 */
+   pq = vmd-vmd_pagequeues[PQ_ACTIVE];
+   vm_pagequeue_lock(pq);
pcount = pq-pq_cnt;
page_shortage = vm_paging_target() +
cnt.v_inactive_target - cnt.v_inactive_count;
@@ -1304,8 +1306,6 @@ relock_queues:
 * track the per-page activity counter and use it to locate
 * deactivation candidates.
 */
-   pq = vmd-vmd_pagequeues[PQ_ACTIVE];
-   vm_pagequeue_lock(pq);
m = TAILQ_FIRST(pq-pq_pl);
while ((m != NULL)  (pcount--  0)  (page_shortage  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: r254388 - head/lib/libc/sys

2013-08-15 Thread Jilles Tjoelker
Author: jilles
Date: Thu Aug 15 22:33:27 2013
New Revision: 254388
URL: http://svnweb.freebsd.org/changeset/base/254388

Log:
  sigsuspend(2): Add xrefs to pselect(2) and sigwait-alikes.

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

Modified: head/lib/libc/sys/sigsuspend.2
==
--- head/lib/libc/sys/sigsuspend.2  Thu Aug 15 22:29:49 2013
(r254387)
+++ head/lib/libc/sys/sigsuspend.2  Thu Aug 15 22:33:27 2013
(r254388)
@@ -28,7 +28,7 @@
 .\@(#)sigsuspend.28.2 (Berkeley) 5/16/95
 .\ $FreeBSD$
 .\
-.Dd May 16, 1995
+.Dd August 16, 2013
 .Dt SIGSUSPEND 2
 .Os
 .Sh NAME
@@ -70,9 +70,13 @@ always terminates by being interrupted, 
 set to
 .Er EINTR .
 .Sh SEE ALSO
+.Xr pselect 2 ,
 .Xr sigaction 2 ,
 .Xr sigpending 2 ,
 .Xr sigprocmask 2 ,
+.Xr sigtimedwait 2 ,
+.Xr sigwait 2 ,
+.Xr sigwaitinfo 2 ,
 .Xr sigsetops 3
 .Sh STANDARDS
 The
___
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: r254389 - in head/sys: dev/nvme geom kern sys

2013-08-15 Thread Kenneth D. Merry
Author: ken
Date: Thu Aug 15 22:52:39 2013
New Revision: 254389
URL: http://svnweb.freebsd.org/changeset/base/254389

Log:
  Change the way that unmapped I/O capability is advertised.
  
  The previous method was to set the D_UNMAPPED_IO flag in the cdevsw
  for the driver.  The problem with this is that in many cases (e.g.
  sa(4)) there may be some instances of the driver that can handle
  unmapped I/O and some that can't.  The isp(4) driver can handle
  unmapped I/O, but the esp(4) driver currently cannot.  The cdevsw
  is shared among all driver instances.
  
  So instead of setting a flag on the cdevsw, set a flag on the cdev.
  This allows drivers to indicate support for unmapped I/O on a
  per-instance basis.
  
  sys/conf.h:   Remove the D_UNMAPPED_IO cdevsw flag and replace it
with an SI_UNMAPPED cdev flag.
  
  kern_physio.c:Look at the cdev SI_UNMAPPED flag to determine
whether or not a particular driver can handle
unmapped I/O.
  
  geom_dev.c:   Set the SI_UNMAPPED flag for all GEOM cdevs.
Since GEOM will create a temporary mapping when
needed, setting SI_UNMAPPED unconditionally will
work.
  
Remove the D_UNMAPPED_IO flag.
  
  nvme_ns.c:Set the SI_UNMAPPED flag on cdevs created here
if NVME_UNMAPPED_BIO_SUPPORT is enabled.
  
  vfs_aio.c:In aio_qphysio(), check the SI_UNMAPPED flag on a
cdev instead of the D_UNMAPPED_IO flag on the cdevsw.
  
  sys/param.h:  Bump __FreeBSD_version to 145 for the switch from
setting the D_UNMAPPED_IO flag in the cdevsw to setting
SI_UNMAPPED in the cdev.
  
  Reviewed by:  kib, jimharris
  MFC after:1 week
  Sponsored by: Spectra Logic

Modified:
  head/sys/dev/nvme/nvme_ns.c
  head/sys/geom/geom_dev.c
  head/sys/kern/kern_physio.c
  head/sys/kern/vfs_aio.c
  head/sys/sys/conf.h
  head/sys/sys/param.h

Modified: head/sys/dev/nvme/nvme_ns.c
==
--- head/sys/dev/nvme/nvme_ns.c Thu Aug 15 22:33:27 2013(r254388)
+++ head/sys/dev/nvme/nvme_ns.c Thu Aug 15 22:52:39 2013(r254389)
@@ -133,11 +133,7 @@ nvme_ns_strategy(struct bio *bp)
 
 static struct cdevsw nvme_ns_cdevsw = {
.d_version =D_VERSION,
-#ifdef NVME_UNMAPPED_BIO_SUPPORT
-   .d_flags =  D_DISK | D_UNMAPPED_IO,
-#else
.d_flags =  D_DISK,
-#endif
.d_read =   physread,
.d_write =  physwrite,
.d_open =   nvme_ns_open,
@@ -348,6 +344,9 @@ nvme_ns_construct(struct nvme_namespace 
NULL, UID_ROOT, GID_WHEEL, 0600, nvme%dns%d,
device_get_unit(ctrlr-dev), ns-id);
 #endif
+#ifdef NVME_UNMAPPED_BIO_SUPPORT
+   ns-cdev-si_flags |= SI_UNMAPPED;
+#endif
 
if (ns-cdev != NULL)
ns-cdev-si_drv1 = ns;

Modified: head/sys/geom/geom_dev.c
==
--- head/sys/geom/geom_dev.cThu Aug 15 22:33:27 2013(r254388)
+++ head/sys/geom/geom_dev.cThu Aug 15 22:52:39 2013(r254389)
@@ -79,7 +79,7 @@ static struct cdevsw g_dev_cdevsw = {
.d_ioctl =  g_dev_ioctl,
.d_strategy =   g_dev_strategy,
.d_name =   g_dev,
-   .d_flags =  D_DISK | D_TRACKCLOSE | D_UNMAPPED_IO,
+   .d_flags =  D_DISK | D_TRACKCLOSE,
 };
 
 static g_taste_t g_dev_taste;
@@ -237,6 +237,7 @@ g_dev_taste(struct g_class *mp, struct g
g_free(sc);
return (NULL);
}
+   dev-si_flags |= SI_UNMAPPED;
sc-sc_dev = dev;
 
/* Search for device alias name and create it if found. */
@@ -251,6 +252,7 @@ g_dev_taste(struct g_class *mp, struct g
freeenv(val);
make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK,
adev, dev, %s, buf);
+   adev-si_flags |= SI_UNMAPPED;
break;
}
}

Modified: head/sys/kern/kern_physio.c
==
--- head/sys/kern/kern_physio.c Thu Aug 15 22:33:27 2013(r254388)
+++ head/sys/kern/kern_physio.c Thu Aug 15 22:52:39 2013(r254389)
@@ -93,8 +93,7 @@ physio(struct cdev *dev, struct uio *uio
 
csw = dev-si_devsw;
if (uio-uio_segflg == UIO_USERSPACE) {
-   if (csw != NULL 
-(csw-d_flags  D_UNMAPPED_IO) != 0)
+   if (dev-si_flags  SI_UNMAPPED)
mapped = 0;
else
mapped = 1;

Modified: head/sys/kern/vfs_aio.c
==
--- 

svn commit: r254395 - head/usr.sbin/bhyve

2013-08-15 Thread Peter Grehan
Author: grehan
Date: Fri Aug 16 00:35:20 2013
New Revision: 254395
URL: http://svnweb.freebsd.org/changeset/base/254395

Log:
  Fix ordering of legacy IRQ reservations.
  
  Submitted by: Jeremiah Lott   jlott at averesystems dot com

Modified:
  head/usr.sbin/bhyve/pci_emul.c

Modified: head/usr.sbin/bhyve/pci_emul.c
==
--- head/usr.sbin/bhyve/pci_emul.c  Fri Aug 16 00:24:34 2013
(r254394)
+++ head/usr.sbin/bhyve/pci_emul.c  Fri Aug 16 00:35:20 2013
(r254395)
@@ -1008,6 +1008,16 @@ init_pci(struct vmctx *ctx)
pci_emul_membase32 = vm_get_lowmem_limit(ctx);
pci_emul_membase64 = PCI_EMUL_MEMBASE64;
 
+   /*
+* Allow ISA IRQs 5,10,11,12, and 15 to be available for
+* generic use
+*/
+   lirq[5].li_generic = 1;
+   lirq[10].li_generic = 1;
+   lirq[11].li_generic = 1;
+   lirq[12].li_generic = 1;
+   lirq[15].li_generic = 1;
+
for (slot = 0; slot  MAXSLOTS; slot++) {
for (func = 0; func  MAXFUNCS; func++) {
si = pci_slotinfo[slot][func];
@@ -1023,16 +1033,6 @@ init_pci(struct vmctx *ctx)
}
 
/*
-* Allow ISA IRQs 5,10,11,12, and 15 to be available for
-* generic use
-*/
-   lirq[5].li_generic = 1;
-   lirq[10].li_generic = 1;
-   lirq[11].li_generic = 1;
-   lirq[12].li_generic = 1;
-   lirq[15].li_generic = 1;
-
-   /*
 * The guest physical memory map looks like the following:
 * [0,  lowmem) guest system memory
 * [lowmem, lowmem_limit)   memory hole (may be absent)
___
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: r254396 - head/sys/kern

2013-08-15 Thread Mark Johnston
Author: markj
Date: Fri Aug 16 03:41:41 2013
New Revision: 254396
URL: http://svnweb.freebsd.org/changeset/base/254396

Log:
  Use strdup(9) instead of reimplementing it.

Modified:
  head/sys/kern/kern_linker.c

Modified: head/sys/kern/kern_linker.c
==
--- head/sys/kern/kern_linker.c Fri Aug 16 00:35:20 2013(r254395)
+++ head/sys/kern/kern_linker.c Fri Aug 16 03:41:41 2013(r254396)
@@ -153,16 +153,6 @@ static int linker_load_module(const char
struct mod_depend *verinfo, struct linker_file **lfpp);
 static modlist_t modlist_lookup2(const char *name, struct mod_depend *verinfo);
 
-static char *
-linker_strdup(const char *str)
-{
-   char *result;
-
-   if ((result = malloc((strlen(str) + 1), M_LINKER, M_WAITOK)) != NULL)
-   strcpy(result, str);
-   return (result);
-}
-
 static void
 linker_init(void *arg)
 {
@@ -577,8 +567,8 @@ linker_make_file(const char *pathname, l
lf-refs = 1;
lf-userrefs = 0;
lf-flags = 0;
-   lf-filename = linker_strdup(filename);
-   lf-pathname = linker_strdup(pathname);
+   lf-filename = strdup(filename, M_LINKER);
+   lf-pathname = strdup(pathname, M_LINKER);
LINKER_GET_NEXT_FILE_ID(lf-id);
lf-ndeps = 0;
lf-deps = NULL;
@@ -1918,7 +1908,7 @@ linker_search_kld(const char *name)
 
/* qualified at all? */
if (strchr(name, '/'))
-   return (linker_strdup(name));
+   return (strdup(name, M_LINKER));
 
/* traverse the linker path */
len = strlen(name);
@@ -2011,7 +2001,7 @@ linker_load_module(const char *kldname, 
if (modlist_lookup2(modname, verinfo) != NULL)
return (EEXIST);
if (kldname != NULL)
-   pathname = linker_strdup(kldname);
+   pathname = strdup(kldname, M_LINKER);
else if (rootvnode == NULL)
pathname = NULL;
else
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r254397 - head/usr.sbin/makefs

2013-08-15 Thread Glen Barber
Author: gjb
Date: Fri Aug 16 05:30:13 2013
New Revision: 254397
URL: http://svnweb.freebsd.org/changeset/base/254397

Log:
  Mark the makefs(8) '-p' flag as deprecated in preference for
  the '-Z' flag for compatibility with NetBSD.
  
  Submitted by: Eric van Gyzen (via stable@)
  MFC after:3 days

Modified:
  head/usr.sbin/makefs/makefs.8
  head/usr.sbin/makefs/makefs.c

Modified: head/usr.sbin/makefs/makefs.8
==
--- head/usr.sbin/makefs/makefs.8   Fri Aug 16 03:41:41 2013
(r254396)
+++ head/usr.sbin/makefs/makefs.8   Fri Aug 16 05:30:13 2013
(r254397)
@@ -35,7 +35,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 22, 2012
+.Dd August 16, 2013
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .Nd create a file system image from a directory tree or a mtree manifest
 .Sh SYNOPSIS
 .Nm
-.Op Fl Dpx
+.Op Fl DxZ
 .Op Fl B Ar byte-order
 .Op Fl b Ar free-blocks
 .Op Fl d Ar debug-mask
@@ -191,7 +191,10 @@ Set file system specific options.
 is a comma separated list of options.
 Valid file system specific options are detailed below.
 .It Fl p
-Create the image as a sparse file.
+Deprecated.
+See the
+.Fl Z
+flag.
 .It Fl S Ar sector-size
 Set the file system sector size to
 .Ar sector-size .
@@ -213,6 +216,8 @@ ISO 9660 file system.
 .El
 .It Fl x
 Exclude file system nodes not explicitly listed in the specfile.
+.It Fl Z
+Create the image as a sparse file.
 .El
 .Pp
 Where sizes are specified, a decimal number of bytes is expected.

Modified: head/usr.sbin/makefs/makefs.c
==
--- head/usr.sbin/makefs/makefs.c   Fri Aug 16 03:41:41 2013
(r254396)
+++ head/usr.sbin/makefs/makefs.c   Fri Aug 16 05:30:13 2013
(r254397)
@@ -113,7 +113,7 @@ main(int argc, char *argv[])
start_time.tv_sec = start.tv_sec;
start_time.tv_nsec = start.tv_usec * 1000;
 
-   while ((ch = getopt(argc, argv, B:b:Dd:f:F:M:m:N:o:ps:S:t:x)) != -1) {
+   while ((ch = getopt(argc, argv, B:b:Dd:f:F:M:m:N:o:ps:S:t:xZ)) != -1) 
{
switch (ch) {
 
case 'B':
@@ -205,6 +205,7 @@ main(int argc, char *argv[])
break;
}
case 'p':
+   /* Deprecated in favor of 'Z' */
fsoptions.sparse = 1;
break;
 
@@ -233,6 +234,11 @@ main(int argc, char *argv[])
fsoptions.onlyspec = 1;
break;
 
+   case 'Z':
+   /* Superscedes 'p' for compatibility with NetBSD 
makefs(8) */
+   fsoptions.sparse = 1;
+   break;
+
case '?':
default:
usage();
@@ -354,7 +360,7 @@ usage(void)
fprintf(stderr,
 usage: %s [-t fs-type] [-o fs-options] [-d debug-mask] [-B endian]\n
 \t[-S sector-size] [-M minimum-size] [-m maximum-size] [-s image-size]\n
-\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-px]\n
+\t[-b free-blocks] [-f free-files] [-F mtree-specfile] [-xZ]\n
 \t[-N userdb-dir] image-file directory | manifest [extra-directory ...]\n,
prog);
exit(1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org