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

2013-08-06 Thread Andrew Turner
Author: andrew
Date: Tue Aug  6 10:03:44 2013
New Revision: 253985
URL: http://svnweb.freebsd.org/changeset/base/253985

Log:
  We no longer need to align the stack before calling swi_handler as it is
  already aligned correctly in the PUSHFRAME macro.

Modified:
  head/sys/arm/arm/exception.S

Modified: head/sys/arm/arm/exception.S
==
--- head/sys/arm/arm/exception.STue Aug  6 06:24:37 2013
(r253984)
+++ head/sys/arm/arm/exception.STue Aug  6 10:03:44 2013
(r253985)
@@ -83,10 +83,7 @@ ASENTRY_NP(swi_entry)
PUSHFRAME
 
mov r0, sp  /* Pass the frame to any function */
-   mov r6, sp  /* Backup the stack pointer */
-   bic sp, sp, #7  /* Align the stack pointer */
bl  _C_LABEL(swi_handler)   /* It's a SWI ! */
-   mov sp, r6  /* Restore the stack */
 
DO_AST
PULLFRAME
___
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: r253986 - head/tools/tools/bootparttest

2013-08-06 Thread Andrey V. Elsukov
Author: ae
Date: Tue Aug  6 10:35:05 2013
New Revision: 253986
URL: http://svnweb.freebsd.org/changeset/base/253986

Log:
  Fix formatting warning.
  
  MFC after:1 week

Modified:
  head/tools/tools/bootparttest/bootparttest.c

Modified: head/tools/tools/bootparttest/bootparttest.c
==
--- head/tools/tools/bootparttest/bootparttest.cTue Aug  6 10:03:44 
2013(r253985)
+++ head/tools/tools/bootparttest/bootparttest.cTue Aug  6 10:35:05 
2013(r253986)
@@ -54,7 +54,7 @@ diskread(void *arg, void *buf, size_t bl
struct disk *dp;
 
dp = (struct disk *)arg;
-   printf("%s: read %d blocks from the offset %jd [+%jd]\n", dp->name,
+   printf("%s: read %lu blocks from the offset %jd [+%jd]\n", dp->name,
blocks, offset, dp->offset);
if (offset >= dp->mediasize / dp->sectorsize)
return (-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"


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

2013-08-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Tue Aug  6 10:42:18 2013
New Revision: 253987
URL: http://svnweb.freebsd.org/changeset/base/253987

Log:
  Remove dead code.

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

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Tue Aug  6 10:35:05 2013(r253986)
+++ head/sys/cam/ctl/ctl.c  Tue Aug  6 10:42:18 2013(r253987)
@@ -8941,17 +8941,7 @@ ctl_inquiry_evpd_supported(struct ctl_sc
 
sup_page_size = sizeof(struct scsi_vpd_supported_pages) +
SCSI_EVPD_NUM_SUPPORTED_PAGES;
-   /*
-* XXX KDM GFP_???  We probably don't want to wait here,
-* unless we end up having a process/thread context.
-*/
ctsio->kern_data_ptr = malloc(sup_page_size, M_CTL, M_WAITOK | M_ZERO);
-   if (ctsio->kern_data_ptr == NULL) {
-   ctsio->io_hdr.status = CTL_SCSI_ERROR;
-   ctsio->scsi_status = SCSI_STATUS_BUSY;
-   ctl_done((union ctl_io *)ctsio);
-   return (CTL_RETVAL_COMPLETE);
-   }
pages = (struct scsi_vpd_supported_pages *)ctsio->kern_data_ptr;
ctsio->kern_sg_entries = 0;
 
@@ -9006,14 +8996,7 @@ ctl_inquiry_evpd_serial(struct ctl_scsii
 
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
-   /* XXX KDM which malloc flags here?? */
ctsio->kern_data_ptr = malloc(sizeof(*sn_ptr), M_CTL, M_WAITOK | 
M_ZERO);
-   if (ctsio->kern_data_ptr == NULL) {
-   ctsio->io_hdr.status = CTL_SCSI_ERROR;
-   ctsio->scsi_status = SCSI_STATUS_BUSY;
-   ctl_done((union ctl_io *)ctsio);
-   return (CTL_RETVAL_COMPLETE);
-   }
sn_ptr = (struct scsi_vpd_unit_serial_number *)ctsio->kern_data_ptr;
ctsio->kern_sg_entries = 0;
 
@@ -9098,14 +9081,7 @@ ctl_inquiry_evpd_devid(struct ctl_scsiio
sizeof(struct scsi_vpd_id_descriptor) +
sizeof(struct scsi_vpd_id_trgt_port_grp_id);
 
-   /* XXX KDM which malloc flags here ?? */
ctsio->kern_data_ptr = malloc(devid_len, M_CTL, M_WAITOK | M_ZERO);
-   if (ctsio->kern_data_ptr == NULL) {
-   ctsio->io_hdr.status = CTL_SCSI_ERROR;
-   ctsio->scsi_status = SCSI_STATUS_BUSY;
-   ctl_done((union ctl_io *)ctsio);
-   return (CTL_RETVAL_COMPLETE);
-   }
devid_ptr = (struct scsi_vpd_device_id *)ctsio->kern_data_ptr;
ctsio->kern_sg_entries = 0;
 
@@ -9328,14 +9304,7 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio
 * in.  If the user only asks for less, we'll give him
 * that much.
 */
-   /* XXX KDM what malloc flags should we use here?? */
ctsio->kern_data_ptr = malloc(sizeof(*inq_ptr), M_CTL, M_WAITOK | 
M_ZERO);
-   if (ctsio->kern_data_ptr == NULL) {
-   ctsio->io_hdr.status = CTL_SCSI_ERROR;
-   ctsio->scsi_status = SCSI_STATUS_BUSY;
-   ctl_done((union ctl_io *)ctsio);
-   return (CTL_RETVAL_COMPLETE);
-   }
inq_ptr = (struct scsi_inquiry_data *)ctsio->kern_data_ptr;
ctsio->kern_sg_entries = 0;
ctsio->kern_data_resid = 0;

Modified: head/sys/cam/ctl/ctl_frontend_internal.c
==
--- head/sys/cam/ctl/ctl_frontend_internal.cTue Aug  6 10:35:05 2013
(r253986)
+++ head/sys/cam/ctl/ctl_frontend_internal.cTue Aug  6 10:42:18 2013
(r253987)
@@ -490,9 +490,6 @@ cfi_lun_disable(void *arg, struct ctl_id
return (0);
 }
 
-/*
- * XXX KDM run this inside a thread, or inside the caller's context?
- */
 static void
 cfi_datamove(union ctl_io *io)
 {
@@ -532,18 +529,8 @@ cfi_datamove(union ctl_io *io)
 
ext_sglen = ctsio->ext_sg_entries * sizeof(*ext_sglist);
 
-   /*
-* XXX KDM GFP_KERNEL, don't know what the caller's context
-* is.  Need to figure that out.
-*/
ext_sglist = (struct ctl_sg_entry *)malloc(ext_sglen, M_CTL_CFI,
   M_WAITOK);
-   if (ext_sglist == NULL) {
-   ctl_set_internal_failure(ctsio,
-/*sks_valid*/ 0,
-/*retry_count*/ 0);
-   return;
-   }
ext_sglist_malloced = 1;
if (memcpy(ext_sglist, ctsio->ext_data_ptr, ext_sglen) != 0) {
ctl_set_internal_failure(ctsio,
___
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: r253988 - head/share/man/man4

2013-08-06 Thread David Malone
Author: dwmalone
Date: Tue Aug  6 11:00:56 2013
New Revision: 253988
URL: http://svnweb.freebsd.org/changeset/base/253988

Log:
  Make section headings for different quirk types consistent.

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

Modified: head/share/man/man4/usb_quirk.4
==
--- head/share/man/man4/usb_quirk.4 Tue Aug  6 10:42:18 2013
(r253987)
+++ head/share/man/man4/usb_quirk.4 Tue Aug  6 11:00:56 2013
(r253988)
@@ -95,7 +95,7 @@ select configuration index 0 by default
 .It UQ_ASSUME_CM_OVER_DATA
 assume cm over data feature
 .El
-.Sh USB Mass Storage Quirks
+.Sh USB Mass Storage quirks:
 .Bl -tag -width Ds
 .It UQ_MSC_NO_TEST_UNIT_READY
 send start/stop instead of TUR
@@ -142,7 +142,7 @@ force UFI command protocol
 .It UQ_MSC_FORCE_PROTO_RBC
 force RBC command protocol
 .El
-.Sh Mass Storage Change (u3g) quirks:
+.Sh 3G Datacard (u3g) quirks:
 .Bl -tag -width Ds
 .It UQ_MSC_EJECT_HUAWEI
 ejects after Huawei USB command
___
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: r253989 - head/sys/modules/dtrace/dtrace

2013-08-06 Thread Andriy Gapon
Author: avg
Date: Tue Aug  6 13:55:39 2013
New Revision: 253989
URL: http://svnweb.freebsd.org/changeset/base/253989

Log:
  dtrace: fix compilation with gcc
  
  Cowardly taking the easiest way and using -Wno-*
  
  MFC after:3 days
  X-MFC with:   r253772

Modified:
  head/sys/modules/dtrace/dtrace/Makefile

Modified: head/sys/modules/dtrace/dtrace/Makefile
==
--- head/sys/modules/dtrace/dtrace/Makefile Tue Aug  6 11:00:56 2013
(r253988)
+++ head/sys/modules/dtrace/dtrace/Makefile Tue Aug  6 13:55:39 2013
(r253989)
@@ -52,3 +52,4 @@ dtrace_asm.o:  assym.s
 
 CWARNFLAGS+=   -Wno-parentheses
 CWARNFLAGS+=   -Wno-uninitialized
+CWARNFLAGS+=   -Wno-cast-qual
___
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: r253990 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2013-08-06 Thread Alexander Motin
Author: mav
Date: Tue Aug  6 14:20:41 2013
New Revision: 253990
URL: http://svnweb.freebsd.org/changeset/base/253990

Log:
  Make ZFS to use separate thread to handle SPA_ASYNC_REMOVE async events.
  Existing async thread is running only on successfull spa_sync() completion,
  that is impossible in case of pool loosing required (last) disk(s).  That
  indefinite delay of SPA_ASYNC_REMOVE processing made ZFS to not close the
  lost disks, preventing GEOM/CAM from destroying devices and reusing names
  on later disk reattach.
  
  In earlier version of the patch I've tried to just run existing thread
  immediately, unrelated to spa_sync() completion, but that exposed number
  of situations where it could stuck due to locks held by stuck spa_sync(),
  that are required for other kinds of async events.
  
  Experiments with OpenIndiana snapshot confirmed that they also have this
  issue with lost disks reattach.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Tue Aug  6 
13:55:39 2013(r253989)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Tue Aug  6 
14:20:41 2013(r253990)
@@ -5763,7 +5763,7 @@ spa_async_thread(void *arg)
 
mutex_enter(&spa->spa_async_lock);
tasks = spa->spa_async_tasks;
-   spa->spa_async_tasks = 0;
+   spa->spa_async_tasks &= SPA_ASYNC_REMOVE;
mutex_exit(&spa->spa_async_lock);
 
/*
@@ -5789,19 +5789,6 @@ spa_async_thread(void *arg)
}
}
 
-   /*
-* See if any devices need to be marked REMOVED.
-*/
-   if (tasks & SPA_ASYNC_REMOVE) {
-   spa_vdev_state_enter(spa, SCL_NONE);
-   spa_async_remove(spa, spa->spa_root_vdev);
-   for (int i = 0; i < spa->spa_l2cache.sav_count; i++)
-   spa_async_remove(spa, spa->spa_l2cache.sav_vdevs[i]);
-   for (int i = 0; i < spa->spa_spares.sav_count; i++)
-   spa_async_remove(spa, spa->spa_spares.sav_vdevs[i]);
-   (void) spa_vdev_state_exit(spa, NULL, 0);
-   }
-
if ((tasks & SPA_ASYNC_AUTOEXPAND) && !spa_suspended(spa)) {
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
spa_async_autoexpand(spa, spa->spa_root_vdev);
@@ -5839,12 +5826,53 @@ spa_async_thread(void *arg)
thread_exit();
 }
 
+static void
+spa_async_thread_vd(void *arg)
+{
+   spa_t *spa = arg;
+   int tasks;
+
+   ASSERT(spa->spa_sync_on);
+
+   mutex_enter(&spa->spa_async_lock);
+   tasks = spa->spa_async_tasks;
+retry:
+   spa->spa_async_tasks &= ~SPA_ASYNC_REMOVE;
+   mutex_exit(&spa->spa_async_lock);
+
+   /*
+* See if any devices need to be marked REMOVED.
+*/
+   if (tasks & SPA_ASYNC_REMOVE) {
+   spa_vdev_state_enter(spa, SCL_NONE);
+   spa_async_remove(spa, spa->spa_root_vdev);
+   for (int i = 0; i < spa->spa_l2cache.sav_count; i++)
+   spa_async_remove(spa, spa->spa_l2cache.sav_vdevs[i]);
+   for (int i = 0; i < spa->spa_spares.sav_count; i++)
+   spa_async_remove(spa, spa->spa_spares.sav_vdevs[i]);
+   (void) spa_vdev_state_exit(spa, NULL, 0);
+   }
+
+   /*
+* Let the world know that we're done.
+*/
+   mutex_enter(&spa->spa_async_lock);
+   tasks = spa->spa_async_tasks;
+   if ((tasks & SPA_ASYNC_REMOVE) != 0)
+   goto retry;
+   spa->spa_async_thread_vd = NULL;
+   cv_broadcast(&spa->spa_async_cv);
+   mutex_exit(&spa->spa_async_lock);
+   thread_exit();
+}
+
 void
 spa_async_suspend(spa_t *spa)
 {
mutex_enter(&spa->spa_async_lock);
spa->spa_async_suspended++;
-   while (spa->spa_async_thread != NULL)
+   while (spa->spa_async_thread != NULL &&
+   spa->spa_async_thread_vd != NULL)
cv_wait(&spa->spa_async_cv, &spa->spa_async_lock);
mutex_exit(&spa->spa_async_lock);
 }
@@ -5865,7 +5893,8 @@ spa_async_tasks_pending(spa_t *spa)
uint_t config_task;
boolean_t config_task_suspended;
 
-   non_config_tasks = spa->spa_async_tasks & ~SPA_ASYNC_CONFIG_UPDATE;
+   non_config_tasks = spa->spa_async_tasks & ~(SPA_ASYNC_CONFIG_UPDATE |
+   SPA_ASYNC_REMOVE);
config_task = spa->spa_async_tasks & SPA_ASYNC_CONFIG_UPDATE;
if (spa->spa_ccw_fail_time == 0) {
config_task_suspended = B_FALSE;
@@ -5891,6 +5920,19 @@ spa_async_dispatch(spa_t *spa)
mutex_exit(&spa->spa_async_lock);
 }
 
+static void
+spa_async_dispatch_vd(spa_t *spa)
+{
+   mutex_enter(&spa->spa_async_lock);
+   if ((spa->sp

svn commit: r253991 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-08-06 Thread Alexander Motin
Author: mav
Date: Tue Aug  6 14:23:33 2013
New Revision: 253991
URL: http://svnweb.freebsd.org/changeset/base/253991

Log:
  Make `zpool clear` to reopen also reconnected cache and spare devices.
  Since `zpool status` reports about such kinds of errors, it is strange
  that they are not cleared by `zpool clear`.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Tue Aug  6 
14:20:41 2013(r253990)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c  Tue Aug  6 
14:23:33 2013(r253991)
@@ -2383,6 +2383,14 @@ vdev_clear(spa_t *spa, vdev_t *vd)
for (int c = 0; c < vd->vdev_children; c++)
vdev_clear(spa, vd->vdev_child[c]);
 
+   if (vd == rvd) {
+   for (int c = 0; c < spa->spa_l2cache.sav_count; c++)
+   vdev_clear(spa, spa->spa_l2cache.sav_vdevs[c]);
+
+   for (int c = 0; c < spa->spa_spares.sav_count; c++)
+   vdev_clear(spa, spa->spa_spares.sav_vdevs[c]);
+   }
+
/*
 * If we're in the FAULTED state or have experienced failed I/O, then
 * clear the persistent state and attempt to reopen the device.  We
___
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: r253974 - head/sys/ufs/ffs

2013-08-06 Thread Mitya
Does it fix a problem on recent 9-STABLE that process writing to almost-full 
partition eats 100% CPU and writes 1MB/sec?
It has SU enabled but no SU+J.

I observed that today after upgrading to 9.2-BETA2 from ~1 year old 9-STABLE.

Thanks.


On 06.08.2013, at 2:02, Kirk McKusick  wrote:

> Author: mckusick
> Date: Mon Aug  5 22:02:45 2013
> New Revision: 253974
> URL: http://svnweb.freebsd.org/changeset/base/253974
> 
> Log:
>  With the addition of journalled soft updates, the "newblk" structures
>  persist much longer than previously. Historically we had at most 100
>  entries; now the count may reach a million. With the increased count
>  we spent far too much time looking them up in the grossly undersized
>  newblk hash table. Configure the newblk hash table to accurately reflect
>  the number of entries that it must index.
> 
>  Reviewed by: kib
>  Tested by:   Peter Holm
>  MFC after:   2 weeks
> 
> Modified:
>  head/sys/ufs/ffs/ffs_softdep.c
> 
> Modified: head/sys/ufs/ffs/ffs_softdep.c
> ==
> --- head/sys/ufs/ffs/ffs_softdep.cMon Aug  5 22:01:16 2013
> (r253973)
> +++ head/sys/ufs/ffs/ffs_softdep.cMon Aug  5 22:02:45 2013
> (r253974)
> @@ -2393,7 +2393,7 @@ softdep_initialize()
>   max_softdeps = desiredvnodes * 4;
>   pagedep_hashtbl = hashinit(desiredvnodes / 5, M_PAGEDEP, &pagedep_hash);
>   inodedep_hashtbl = hashinit(desiredvnodes, M_INODEDEP, &inodedep_hash);
> - newblk_hashtbl = hashinit(desiredvnodes / 5,  M_NEWBLK, &newblk_hash);
> + newblk_hashtbl = hashinit(max_softdeps / 2,  M_NEWBLK, &newblk_hash);
>   bmsafemap_hashtbl = hashinit(1024, M_BMSAFEMAP, &bmsafemap_hash);
>   i = 1 << (ffs(desiredvnodes / 10) - 1);
>   indir_hashtbl = malloc(i * sizeof(indir_hashtbl[0]), M_FREEWORK,
> ___
> svn-src-...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-all
> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

___
svn-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: r253992 - in head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2013-08-06 Thread Alexander Motin
Author: mav
Date: Tue Aug  6 14:30:28 2013
New Revision: 253992
URL: http://svnweb.freebsd.org/changeset/base/253992

Log:
  Disable r252840 when ZFS TRIM is enabled (vfs.zfs.trim.enabled=1) and really
  disable TRIM otherwise.
  
  r252840 (illumos bug 3836) is based on assumption that zio_free_sync() has
  no lock dependencies and should complete immediately. Unfortunately, with our
  TRIM implementation that is not true due to ZIO_STAGE_VDEV_IO_START added
  to the ZIO_FREE_PIPELINE, which, while not really accessing devices, still
  acquires SCL_ZIO lock for read to be sure devices won't disappear.
  
  When TRIM is disabled, this patch enables direct free execution from r252840
  and removes ZIO_STAGE_VDEV_IO_START and ZIO_STAGE_VDEV_IO_ASSESS stages from
  the pipeline to avoid lock acquisition.  Otherwise it queues free request as
  it was before r252840.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h  Tue Aug 
 6 14:23:33 2013(r253991)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h  Tue Aug 
 6 14:30:28 2013(r253992)
@@ -213,9 +213,7 @@ enum zio_stage {
 #defineZIO_FREE_PIPELINE   \
(ZIO_INTERLOCK_STAGES | \
ZIO_STAGE_FREE_BP_INIT |\
-   ZIO_STAGE_DVA_FREE |\
-   ZIO_STAGE_VDEV_IO_START |   \
-   ZIO_STAGE_VDEV_IO_ASSESS)
+   ZIO_STAGE_DVA_FREE)
 
 #defineZIO_DDT_FREE_PIPELINE   \
(ZIO_INTERLOCK_STAGES | \

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Tue Aug  6 
14:23:33 2013(r253991)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c   Tue Aug  6 
14:30:28 2013(r253992)
@@ -770,7 +770,7 @@ zio_free(spa_t *spa, uint64_t txg, const
 * DEDUP), can be processed immediately.  Otherwise, put them on the
 * in-memory list for later processing.
 */
-   if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp) ||
+   if (zfs_trim_enabled || BP_IS_GANG(bp) || BP_GET_DEDUP(bp) ||
txg != spa->spa_syncing_txg ||
spa_sync_pass(spa) >= zfs_sync_pass_deferred_free) {
bplist_append(&spa->spa_free_bplist[txg & TXG_MASK], bp);
@@ -797,12 +797,15 @@ zio_free_sync(zio_t *pio, spa_t *spa, ui
metaslab_check_free(spa, bp);
arc_freed(spa, bp);
 
+   if (zfs_trim_enabled)
+   stage |= ZIO_STAGE_ISSUE_ASYNC | ZIO_STAGE_VDEV_IO_START |
+   ZIO_STAGE_VDEV_IO_ASSESS;
/*
 * GANG and DEDUP blocks can induce a read (for the gang block header,
 * or the DDT), so issue them asynchronously so that this thread is
 * not tied up.
 */
-   if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp))
+   else if (BP_IS_GANG(bp) || BP_GET_DEDUP(bp))
stage |= ZIO_STAGE_ISSUE_ASYNC;
 
zio = zio_create(pio, spa, txg, bp, NULL, size,
___
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: r253993 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-08-06 Thread Alexander Motin
Author: mav
Date: Tue Aug  6 14:41:41 2013
New Revision: 253993
URL: http://svnweb.freebsd.org/changeset/base/253993

Log:
  Block reporting of ZFS features for suspended pools.
  
  Before executing any subcommand, zpool tool fetches pools configuration from
  the kernel.  Before features support was added, kernel was regenerating that
  configuration based on data always present in memory.  Unfortunately, pool
  features list and activity counters are not such. They are stored in ZAP,
  that normally resides in ARC, but under heavy memory pressure may be swapped
  out.  If pool is suspended at this point, there is no way to recover it back
  since any zpool command will stuck.
  
  This change has one predictable flaw: `zpool upgrade` always wish to upgrade
  suspended pools, but fortunately it can't do it due to the suspension.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Tue Aug  6 
14:30:28 2013(r253992)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Tue Aug  6 
14:41:41 2013(r253993)
@@ -3060,6 +3060,10 @@ spa_add_feature_stats(spa_t *spa, nvlist
ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER));
VERIFY(nvlist_alloc(&features, NV_UNIQUE_NAME, KM_SLEEP) == 0);
 
+   /* We may be unable to read features if pool is suspended. */
+   if (spa_suspended(spa))
+   goto out;
+
if (spa->spa_feat_for_read_obj != 0) {
for (zap_cursor_init(&zc, spa->spa_meta_objset,
spa->spa_feat_for_read_obj);
@@ -3086,6 +3090,7 @@ spa_add_feature_stats(spa_t *spa, nvlist
zap_cursor_fini(&zc);
}
 
+out:
VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
features) == 0);
nvlist_free(features);
___
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: r253994 - in head/sys/sparc64: include sparc64

2013-08-06 Thread Marius Strobl
Author: marius
Date: Tue Aug  6 15:34:11 2013
New Revision: 253994
URL: http://svnweb.freebsd.org/changeset/base/253994

Log:
  Add MD (for now) atomic_store_acq_() and use it in pmap_activate()
  to get the semantics when setting the PMAP right. Prior to r251782, the
  latter already used implicit acquire semantics, which - currently - means
  to not employ additional explicit memory barriers under the hood (see also
  r225889).

Modified:
  head/sys/sparc64/include/atomic.h
  head/sys/sparc64/sparc64/pmap.c

Modified: head/sys/sparc64/include/atomic.h
==
--- head/sys/sparc64/include/atomic.h   Tue Aug  6 14:41:41 2013
(r253993)
+++ head/sys/sparc64/include/atomic.h   Tue Aug  6 15:34:11 2013
(r253994)
@@ -133,14 +133,14 @@
t;  \
 })
 
-#defineatomic_load_acq(p, sz) ({   
\
+#defineatomic_ld_acq(p, sz) ({ 
\
itype(sz) v;\
v = atomic_cas((p), 0, 0, sz);  \
__compiler_membar();\
v;  \
 })
 
-#defineatomic_load_clear(p, sz) ({ 
\
+#defineatomic_ld_clear(p, sz) ({   
\
itype(sz) e, r; \
for (e = *(volatile itype(sz) *)(p);; e = r) {  \
r = atomic_cas((p), e, 0, sz);  \
@@ -150,9 +150,8 @@
e;  \
 })
 
-#defineatomic_store_rel(p, v, sz) do { 
\
+#defineatomic_st(p, v, sz) do {
\
itype(sz) e, r; \
-   membar(LoadStore | StoreStore); \
for (e = *(volatile itype(sz) *)(p);; e = r) {  \
r = atomic_cas((p), e, (v), sz);\
if (r == e) \
@@ -160,6 +159,16 @@
}   \
 } while (0)
 
+#defineatomic_st_acq(p, v, sz) do {
\
+   atomic_st((p), (v), sz);\
+   __compiler_membar();\
+} while (0)
+
+#defineatomic_st_rel(p, v, sz) do {
\
+   membar(LoadStore | StoreStore); \
+   atomic_st((p), (v), sz);\
+} while (0)
+
 #defineATOMIC_GEN(name, ptype, vtype, atype, sz)   
\
\
 static __inline vtype  \
@@ -224,7 +233,7 @@ atomic_load_acq_ ## name(volatile ptype 
 static __inline vtype  \
 atomic_readandclear_ ## name(volatile ptype p) \
 {  \
-   return ((vtype)atomic_load_clear((p), sz)); \
+   return ((vtype)atomic_ld_clear((p), sz));   \
 }  \
\
 static __inline vtype  \
@@ -260,9 +269,14 @@ atomic_subtract_rel_ ## name(volatile pt
 }  \
\
 static __inline void   \
+atomic_store_acq_ ## name(volatile ptype p, vtype v)   \
+{  \
+   atomic_st_acq((p), (v), sz);\
+}  \
+static __inline void   \
 atomic_store_rel_ ## name(volatile ptype p, vtype v)   \
 {  \
-   atomic_store_rel((p), (v), sz); \
+   atomic_st_rel((p), (v), sz);\
 }
 
 ATOMIC_GEN(int, u_int *, u_int, u_int, 32);
@@ -284,8 +298,10 @@ ATOMIC_GEN(ptr, uintptr_t *, uintptr_t, 
 #undef atomic_op
 #undef atomic_op_acq
 #undef atom

svn commit: r253995 - in head/usr.sbin: rtadvd rtsold

2013-08-06 Thread Hiroki Sato
Author: hrs
Date: Tue Aug  6 15:49:18 2013
New Revision: 253995
URL: http://svnweb.freebsd.org/changeset/base/253995

Log:
  Fix build on arm and mips.

Modified:
  head/usr.sbin/rtadvd/timer.c
  head/usr.sbin/rtsold/rtsold.c

Modified: head/usr.sbin/rtadvd/timer.c
==
--- head/usr.sbin/rtadvd/timer.cTue Aug  6 15:34:11 2013
(r253994)
+++ head/usr.sbin/rtadvd/timer.cTue Aug  6 15:49:18 2013
(r253995)
@@ -59,11 +59,8 @@ void
 rtadvd_timer_init(void)
 {
/* Generate maximum time in timespec. */
-   memset(&tm_limit.tv_sec, 0xff, sizeof(tm_limit.tv_sec));
-   memset(&tm_limit.tv_nsec, 0xff, sizeof(tm_limit.tv_nsec));
-   tm_limit.tv_sec &= ~(1UL << (sizeof(tm_limit.tv_sec) * 8 - 1));
-   tm_limit.tv_nsec &= ~(1UL << (sizeof(tm_limit.tv_nsec) * 8 - 1));
-
+   tm_limit.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 
1));
+   tm_limit.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 
1));
tm_max = tm_limit;
TAILQ_INIT(&ra_timer);
 }

Modified: head/usr.sbin/rtsold/rtsold.c
==
--- head/usr.sbin/rtsold/rtsold.c   Tue Aug  6 15:34:11 2013
(r253994)
+++ head/usr.sbin/rtsold/rtsold.c   Tue Aug  6 15:49:18 2013
(r253995)
@@ -188,10 +188,8 @@ main(int argc, char **argv)
}
 
/* Generate maximum time in timespec. */
-   memset(&tm_max.tv_sec, 0xff, sizeof(tm_max.tv_sec));
-   memset(&tm_max.tv_nsec, 0xff, sizeof(tm_max.tv_nsec));
-   tm_max.tv_sec &= ~(1UL << (sizeof(tm_max.tv_sec) * 8 - 1));
-   tm_max.tv_nsec &= ~(1UL << (sizeof(tm_max.tv_nsec) * 8 - 1));
+   tm_max.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 
1));
+   tm_max.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 
1));
 
/* set log level */
if (dflag > 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"


svn commit: r253996 - in head: . sys/cddl/compat/opensolaris/sys sys/cddl/dev/dtrace sys/conf sys/modules/cyclic sys/modules/dtrace/dtio sys/modules/dtrace/dtmalloc sys/modules/dtrace/dtnfscl sys/m...

2013-08-06 Thread Andriy Gapon
Author: avg
Date: Tue Aug  6 15:51:56 2013
New Revision: 253996
URL: http://svnweb.freebsd.org/changeset/base/253996

Log:
  opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG
  
  Do this by forcing inclusion of
  sys/cddl/compat/opensolaris/sys/debug_compat.h
  via -include option into all source files from OpenSolaris.
  Note that this -include option must always be after -include opt_global.h.
  
  Additionally, remove forced definition of DEBUG for some modules and fix
  their build without DEBUG.
  
  Also, meaning of DEBUG was overloaded to enable WITNESS support for some
  OpenSolaris (primarily ZFS) locks.  Now this overloading is removed and
  that use of DEBUG is replaced with a new option OPENSOLARIS_WITNESS.
  
  MFC after:17 days

Added:
  head/sys/cddl/compat/opensolaris/sys/debug_compat.h   (contents, props 
changed)
Modified:
  head/UPDATING
  head/sys/cddl/compat/opensolaris/sys/mutex.h
  head/sys/cddl/compat/opensolaris/sys/rwlock.h
  head/sys/cddl/dev/dtrace/dtrace_load.c
  head/sys/cddl/dev/dtrace/dtrace_unload.c
  head/sys/conf/kern.pre.mk
  head/sys/conf/options
  head/sys/modules/cyclic/Makefile
  head/sys/modules/dtrace/dtio/Makefile
  head/sys/modules/dtrace/dtmalloc/Makefile
  head/sys/modules/dtrace/dtnfscl/Makefile
  head/sys/modules/dtrace/dtnfsclient/Makefile
  head/sys/modules/dtrace/dtrace/Makefile
  head/sys/modules/dtrace/dtrace_test/Makefile
  head/sys/modules/dtrace/dtraceall/Makefile
  head/sys/modules/dtrace/fasttrap/Makefile
  head/sys/modules/dtrace/fbt/Makefile
  head/sys/modules/dtrace/lockstat/Makefile
  head/sys/modules/dtrace/profile/Makefile
  head/sys/modules/dtrace/prototype/Makefile
  head/sys/modules/dtrace/sdt/Makefile
  head/sys/modules/dtrace/systrace/Makefile
  head/sys/modules/dtrace/systrace_freebsd32/Makefile
  head/sys/modules/dtrace/systrace_linux32/Makefile
  head/sys/modules/opensolaris/Makefile
  head/sys/modules/zfs/Makefile

Modified: head/UPDATING
==
--- head/UPDATING   Tue Aug  6 15:49:18 2013(r253995)
+++ head/UPDATING   Tue Aug  6 15:51:56 2013(r253996)
@@ -32,6 +32,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
 20130806:
+   INVARIANTS option now enables DEBUG for code with OpenSolaris and
+   Illumos origin, including ZFS.  If you have INVARIANTS in your
+   kernel configuration, then there is no need to set DEBUG or ZFS_DEBUG
+   explicitly.
+   DEBUG used to enable witness(9) tracking of OpenSolaris (mostly ZFS)
+   locks if WITNESS option was set.  Because that generated a lot of
+   witness(9) reports and all of them were believed to be false
+   positives, this is no longer done.  New option OPENSOLARIS_WITNESS
+   can be used to achieve the previous behavior.
+
+20130806:
Timer values in IPv6 data structures now use time_uptime instead
of time_second.  Although this is not a user-visible functional
change, userland utilities which directly use them---ndp(8),

Added: head/sys/cddl/compat/opensolaris/sys/debug_compat.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/cddl/compat/opensolaris/sys/debug_compat.h Tue Aug  6 15:51:56 
2013(r253996)
@@ -0,0 +1,37 @@
+/*-
+ * Copyright (c) 2013 Andriy Gapon 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * This is a special file that SHOULD NOT be included using #include directive.
+ */
+
+#if defined(INVARIANTS)

svn commit: r253997 - head/sys/modules/cyclic

2013-08-06 Thread Andriy Gapon
Author: avg
Date: Tue Aug  6 16:18:07 2013
New Revision: 253997
URL: http://svnweb.freebsd.org/changeset/base/253997

Log:
  fix fat-fingering in r253996
  
  MFC after:17 days
  X-MFC with:   r253996

Modified:
  head/sys/modules/cyclic/Makefile

Modified: head/sys/modules/cyclic/Makefile
==
--- head/sys/modules/cyclic/MakefileTue Aug  6 15:51:56 2013
(r253996)
+++ head/sys/modules/cyclic/MakefileTue Aug  6 16:18:07 2013
(r253997)
@@ -11,7 +11,6 @@ CFLAGS+=  -I${.CURDIR}/../../cddl/compat/
-I${.CURDIR}/../../cddl/contrib/opensolaris/uts/common  \
-I${.CURDIR}/../..  \
-I${.CURDIR}/../../cddl/dev/cyclic/i386
-CFLAGS+=   -include 
${.CURDIR}/../../cddl/compat/opensolaris/sys/debug_compat.h
 
 IGNORE_PRAGMA= 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"


Re: svn commit: r253995 - in head/usr.sbin: rtadvd rtsold

2013-08-06 Thread Ian Lepore
On Tue, 2013-08-06 at 15:49 +, Hiroki Sato wrote:
> Author: hrs
> Date: Tue Aug  6 15:49:18 2013
> New Revision: 253995
> URL: http://svnweb.freebsd.org/changeset/base/253995
> 
> Log:
>   Fix build on arm and mips.
> 
> Modified:
>   head/usr.sbin/rtadvd/timer.c
>   head/usr.sbin/rtsold/rtsold.c
> 
> Modified: head/usr.sbin/rtadvd/timer.c
> ==
> --- head/usr.sbin/rtadvd/timer.c  Tue Aug  6 15:34:11 2013
> (r253994)
> +++ head/usr.sbin/rtadvd/timer.c  Tue Aug  6 15:49:18 2013
> (r253995)
> @@ -59,11 +59,8 @@ void
>  rtadvd_timer_init(void)
>  {
>   /* Generate maximum time in timespec. */
> - memset(&tm_limit.tv_sec, 0xff, sizeof(tm_limit.tv_sec));
> - memset(&tm_limit.tv_nsec, 0xff, sizeof(tm_limit.tv_nsec));
> - tm_limit.tv_sec &= ~(1UL << (sizeof(tm_limit.tv_sec) * 8 - 1));
> - tm_limit.tv_nsec &= ~(1UL << (sizeof(tm_limit.tv_nsec) * 8 - 1));
> -
> + tm_limit.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 
> 1));
> + tm_limit.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 
> 1));
>   tm_max = tm_limit;
>   TAILQ_INIT(&ra_timer);
>  }
> 
> Modified: head/usr.sbin/rtsold/rtsold.c
> ==
> --- head/usr.sbin/rtsold/rtsold.c Tue Aug  6 15:34:11 2013
> (r253994)
> +++ head/usr.sbin/rtsold/rtsold.c Tue Aug  6 15:49:18 2013
> (r253995)
> @@ -188,10 +188,8 @@ main(int argc, char **argv)
>   }
>  
>   /* Generate maximum time in timespec. */
> - memset(&tm_max.tv_sec, 0xff, sizeof(tm_max.tv_sec));
> - memset(&tm_max.tv_nsec, 0xff, sizeof(tm_max.tv_nsec));
> - tm_max.tv_sec &= ~(1UL << (sizeof(tm_max.tv_sec) * 8 - 1));
> - tm_max.tv_nsec &= ~(1UL << (sizeof(tm_max.tv_nsec) * 8 - 1));
> + tm_max.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 
> 1));
> + tm_max.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 
> 1));
>  
>   /* set log level */
>   if (dflag > 1)

The maximum number of nsec is 9 regardless of the type of
tv_nsec.

That expression for max time_t sure is ugly, but I can't think of
anything that isn't just differently-ugly.  At least the comment makes
the purpose clear.

-- Ian


___
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: r253998 - head/sys/ufs/ufs

2013-08-06 Thread Kirk McKusick
Author: mckusick
Date: Tue Aug  6 16:50:05 2013
New Revision: 253998
URL: http://svnweb.freebsd.org/changeset/base/253998

Log:
  This bug fix is in a code path in rename taken when there is a
  collision between a rename and an open system call for the same
  target file. Here, rename releases its vnode references, waits for
  the open to finish, and then restarts by reacquiring its needed
  vnode locks. In this case, rename was unlocking but failing to
  release its reference to one of its held vnodes. The effect was
  that even after all the actual references to the vnode had gone,
  the vnode still showed active references. For files that had been
  removed, their space was not reclaimed until the filesystem was
  forcibly unmounted.
  
  This bug manifested itself in the Postgres server which would
  leak/lose hundreds of files per day amounting to many gigabytes of
  disk space. This bug required shutting down Postgres, forcibly
  unmounting its filesystem, remounting its filesystem and restarting
  Postgres every few days to recover the lost space.
  
  Reported by: Dan Thomas and Palle Girgensohn
  Bug-fix by:  kib
  Tested by:   Dan Thomas and Palle Girgensohn
  MFC after:   2 weeks

Modified:
  head/sys/ufs/ufs/ufs_vnops.c

Modified: head/sys/ufs/ufs/ufs_vnops.c
==
--- head/sys/ufs/ufs/ufs_vnops.cTue Aug  6 16:18:07 2013
(r253997)
+++ head/sys/ufs/ufs/ufs_vnops.cTue Aug  6 16:50:05 2013
(r253998)
@@ -1263,7 +1263,7 @@ relock:
error = VFS_VGET(mp, ino, LK_EXCLUSIVE, &nvp);
if (error != 0)
goto releout;
-   VOP_UNLOCK(nvp, 0);
+   vput(nvp);
atomic_add_int(&rename_restarts, 1);
goto relock;
}
___
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: r253999 - in head: sys/netinet6 usr.sbin/ndp

2013-08-06 Thread Hiroki Sato
Author: hrs
Date: Tue Aug  6 17:10:52 2013
New Revision: 253999
URL: http://svnweb.freebsd.org/changeset/base/253999

Log:
  Fix incompatibility in ICMPV6CTL_ND6_PRLIST sysctl, and SIOCGPRLST_IN6,
  SIOCGDRLST_IN6, and SIOCGNBRINFO_IN6 ioctl.  These userland interfaces
  treat expiration times in time_second, not time_uptime.

Modified:
  head/sys/netinet6/nd6.c
  head/usr.sbin/ndp/ndp.c

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Tue Aug  6 16:50:05 2013(r253998)
+++ head/sys/netinet6/nd6.c Tue Aug  6 17:10:52 2013(r253999)
@@ -1243,7 +1243,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
 
drl->defrouter[i].flags = dr->flags;
drl->defrouter[i].rtlifetime = dr->rtlifetime;
-   drl->defrouter[i].expire = dr->expire;
+   drl->defrouter[i].expire = dr->expire +
+   (time_second - time_uptime);
drl->defrouter[i].if_index = dr->ifp->if_index;
i++;
}
@@ -1287,7 +1288,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
maxexpire - pr->ndpr_lastupdate) {
oprl->prefix[i].expire =
pr->ndpr_lastupdate +
-   pr->ndpr_vltime;
+   pr->ndpr_vltime +
+   (time_second - time_uptime);
} else
oprl->prefix[i].expire = maxexpire;
}
@@ -1506,7 +1508,7 @@ nd6_ioctl(u_long cmd, caddr_t data, stru
nbi->state = ln->ln_state;
nbi->asked = ln->la_asked;
nbi->isrouter = ln->ln_router;
-   nbi->expire = ln->la_expire;
+   nbi->expire = ln->la_expire + (time_second - time_uptime);
LLE_RUNLOCK(ln);
break;
}
@@ -2286,7 +2288,7 @@ nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS)
return (error);
d.flags = dr->flags;
d.rtlifetime = dr->rtlifetime;
-   d.expire = dr->expire;
+   d.expire = dr->expire + (time_second - time_uptime);
d.if_index = dr->ifp->if_index;
error = SYSCTL_OUT(req, &d, sizeof(d));
if (error != 0)
@@ -2338,7 +2340,8 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS)
~((time_t)1 << ((sizeof(maxexpire) * 8) - 1));
if (pr->ndpr_vltime < maxexpire - pr->ndpr_lastupdate)
p.expire = pr->ndpr_lastupdate +
-   pr->ndpr_vltime;
+   pr->ndpr_vltime +
+   (time_second - time_uptime);
else
p.expire = maxexpire;
}

Modified: head/usr.sbin/ndp/ndp.c
==
--- head/usr.sbin/ndp/ndp.c Tue Aug  6 16:50:05 2013(r253998)
+++ head/usr.sbin/ndp/ndp.c Tue Aug  6 17:10:52 2013(r253999)
@@ -79,6 +79,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -104,7 +105,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include "gmt2local.h"
@@ -125,7 +125,6 @@ static int tflag;
 static int32_t thiszone;   /* time difference with gmt */
 static int s = -1;
 static int repeat = 0;
-static struct timespec ts, ts0;
 
 char ntop_buf[INET6_ADDRSTRLEN];   /* inet_ntop() */
 char host_buf[NI_MAXHOST]; /* getnameinfo() */
@@ -154,7 +153,7 @@ static void getdefif(void);
 static void setdefif(char *);
 #endif
 static char *sec2str(time_t);
-static void ts_print(const struct timespec *);
+static void ts_print(const struct timeval *);
 
 #ifdef ICMPV6CTL_ND6_DRLIST
 static char *rtpref_str[] = {
@@ -165,16 +164,6 @@ static char *rtpref_str[] = {
 };
 #endif
 
-#defineTS_SUB(tsp, usp, vsp)   
\
-   do {\
-   (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;  \
-   (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;   \
-   if ((vsp)->tv_nsec < 0) {   \
-   (vsp)->tv_sec--;\
-   (vsp)->tv_nsec += 10L;  \
-   }   \
-   } while (0)
-
 int mode = 0;
 char *arg = NULL;
 
@@ -183,14 +172,10 @@ main(argc, argv)
int argc;
char **argv;
 {
-   struct timespec now;
int ch;

Re: svn commit: r253995 - in head/usr.sbin: rtadvd rtsold

2013-08-06 Thread Hiroki Sato
Ian Lepore  wrote
  in <1375807689.3320.48.ca...@revolution.hippie.lan>:

ia> On Tue, 2013-08-06 at 15:49 +, Hiroki Sato wrote:
ia> >   /* Generate maximum time in timespec. */
ia> > - memset(&tm_max.tv_sec, 0xff, sizeof(tm_max.tv_sec));
ia> > - memset(&tm_max.tv_nsec, 0xff, sizeof(tm_max.tv_nsec));
ia> > - tm_max.tv_sec &= ~(1UL << (sizeof(tm_max.tv_sec) * 8 - 1));
ia> > - tm_max.tv_nsec &= ~(1UL << (sizeof(tm_max.tv_nsec) * 8 - 1));
ia> > + tm_max.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 
1));
ia> > + tm_max.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 
1));
ia> >
ia> >   /* set log level */
ia> >   if (dflag > 1)
ia>
ia> The maximum number of nsec is 9 regardless of the type of
ia> tv_nsec.
ia>
ia> That expression for max time_t sure is ugly, but I can't think of
ia> anything that isn't just differently-ugly.  At least the comment makes
ia> the purpose clear.

 This was defined as {0x7fff, 0x7fff} in the original code and
 used just as a large enough value to make a conditional (tm_max >
 tm_other) be always true, not the exact maximum value.  Yes, this is
 ugly and can be improved.

-- Hiroki


pgpXSTFRUhTGW.pgp
Description: PGP signature


svn commit: r254002 - head/sys/dev/e1000

2013-08-06 Thread Jack F Vogel
Author: jfv
Date: Tue Aug  6 18:00:53 2013
New Revision: 254002
URL: http://svnweb.freebsd.org/changeset/base/254002

Log:
  When the igb driver is static there are cases when early interrupts occur,
  resulting in a panic in refresh_mbufs, to prevent this add a check in the
  interrupt handler for DRV_RUNNING.
  
  MFC after: 1 day (critical for 9.2)

Modified:
  head/sys/dev/e1000/if_igb.c

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Tue Aug  6 17:22:06 2013(r254001)
+++ head/sys/dev/e1000/if_igb.c Tue Aug  6 18:00:53 2013(r254002)
@@ -1572,6 +1572,10 @@ igb_msix_que(void *arg)
u32 newitr = 0;
boolmore_rx;
 
+   /* Ignore spurious interrupts */
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   return;
+
E1000_WRITE_REG(&adapter->hw, E1000_EIMC, que->eims);
++que->irqs;
 
___
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: r253802 - head/contrib/llvm/tools/clang/lib/Headers

2013-08-06 Thread John Baldwin
On Wednesday, July 31, 2013 8:21:42 am Dimitry Andric wrote:
> On Jul 30, 2013, at 18:16, John Baldwin  wrote:
> > On Tuesday, July 30, 2013 10:09:35 am Matthew Fleming wrote:
> >> On Tue, Jul 30, 2013 at 5:33 AM, Dimitry Andric  wrote:
> >> 
> >>> Author: dim
> >>> Date: Tue Jul 30 12:33:21 2013
> >>> New Revision: 253802
> >>> URL: http://svnweb.freebsd.org/changeset/base/253802
> ...
> >> PIC mode on amd64 also uses %ebx.  The difference is that FreeBSD makefiles
> >> set -fPIC for i386 kernel compile but not amd64.  Locally we use -fPIC for
> >> amd64 (it was added 6 years ago to our environment because it gave better
> >> kernel debugging).
> > 
> > Note that this is used in userland and the kernel.
> > 
> >> Anyways, is there some way to detect PIC mode and use that to decide
> >> whether to use %ebx for the cpuid instruction, rather than using i386?
> > 
> > Does clang supply a reliable #define to indicate that PIC is in use?  If 
> > not,
> > then this should use the PIC path always to be safe.
> 
> Just like gcc, clang defines both __pic__ and __PIC__ as 1 for -fpic,
> and as 2 for -fPIC (though on x86, there is no difference between the 
> two).  Similarly, __pie__ and __PIE__ are defined as 1 for -fpie, and as
> 2 for -fPIE.

Ok, can you fix the header to check for __PIC__ then and push the change
upstream?  Also, feel free to make any changes to bit_* that you need and
push those upstream as well.

-- 
John Baldwin
___
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: r254004 - head/sys/dev/aac

2013-08-06 Thread Marius Strobl
Author: marius
Date: Tue Aug  6 18:55:59 2013
New Revision: 254004
URL: http://svnweb.freebsd.org/changeset/base/254004

Log:
  As it turns out, MSIs are broken with 2820SA so introduce an AAC_FLAGS_NOMSI
  quirk and apply it to these controllers [1]. The same problem was reported
  for 2230S, in which case it wasn't actually clear whether the culprit is the
  controller or the mainboard, though. In order to be on the safe side, flag
  MSIs as being broken with the latter type of controller as well. Given that
  these are the only reports of MSI-related breakage with aac(4) so far and
  OSes like OpenSolaris unconditionally employ MSIs for all adapters of this
  family, however, it doesn't seem warranted to generally disable the use of
  MSIs in aac(4).
  While it, simplify the MSI allocation logic a bit; there's no need to check
  for the presence of the MSI capability on our own as pci_alloc_msi(9) will
  just fail when these kind of interrupts are not available.
  Reported and tested by: David Boyd [1]
  
  MFC after:3 days

Modified:
  head/sys/dev/aac/aac_pci.c
  head/sys/dev/aac/aacvar.h

Modified: head/sys/dev/aac/aac_pci.c
==
--- head/sys/dev/aac/aac_pci.c  Tue Aug  6 18:20:31 2013(r254003)
+++ head/sys/dev/aac/aac_pci.c  Tue Aug  6 18:55:59 2013(r254004)
@@ -139,7 +139,7 @@ static const struct aac_ident
 "Adaptec SATA RAID 21610SA"},
{0x9005, 0x0285, 0x103c, 0x3227, AAC_HWIF_I960RX, AAC_FLAGS_NO4GB,
 "HP ML110 G2 (Adaptec 2610SA)"},
-   {0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, 0,
+   {0x9005, 0x0286, 0x9005, 0x028c, AAC_HWIF_RKT, AAC_FLAGS_NOMSI,
 "Adaptec SCSI RAID 2230S"},
{0x9005, 0x0286, 0x9005, 0x028d, AAC_HWIF_RKT, 0,
 "Adaptec SCSI RAID 2130S"},
@@ -157,7 +157,7 @@ static const struct aac_ident
 "Adaptec SCSI RAID 2020ZCR"},
{0x9005, 0x0285, 0x9005, 0x028b, AAC_HWIF_I960RX, 0,
 "Adaptec SCSI RAID 2025ZCR"},
-   {0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, 0,
+   {0x9005, 0x0286, 0x9005, 0x029b, AAC_HWIF_RKT, AAC_FLAGS_NOMSI,
 "Adaptec SATA RAID 2820SA"},
{0x9005, 0x0286, 0x9005, 0x029c, AAC_HWIF_RKT, 0,
 "Adaptec SATA RAID 2620SA"},
@@ -311,7 +311,6 @@ aac_find_ident(device_t dev)
if ((m->vendor == vendid) && (m->device == devid))
return (m);
}
-
return (NULL);
 }
 
@@ -340,7 +339,7 @@ aac_pci_attach(device_t dev)
 {
struct aac_softc *sc;
const struct aac_ident *id;
-   int count, error, reg, rid;
+   int count, error, rid;
 
fwprintf(NULL, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "");
 
@@ -363,6 +362,38 @@ aac_pci_attach(device_t dev)
}
 
/*
+* Detect the hardware interface version, set up the bus interface
+* indirection.
+*/
+   id = aac_find_ident(dev);
+   sc->aac_hwif = id->hwif;
+   switch(sc->aac_hwif) {
+   case AAC_HWIF_I960RX:
+   case AAC_HWIF_NARK:
+   fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
+   "set hardware up for i960Rx/NARK");
+   sc->aac_if = &aac_rx_interface;
+   break;
+   case AAC_HWIF_STRONGARM:
+   fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
+   "set hardware up for StrongARM");
+   sc->aac_if = &aac_sa_interface;
+   break;
+   case AAC_HWIF_RKT:
+   fwprintf(sc, HBA_FLAGS_DBG_INIT_B,
+   "set hardware up for Rocket/MIPS");
+   sc->aac_if = &aac_rkt_interface;
+   break;
+   default:
+   sc->aac_hwif = AAC_HWIF_UNKNOWN;
+   device_printf(dev, "unknown hardware type\n");
+   goto out;
+   }
+
+   /* Set up quirks */
+   sc->flags = id->quirks;
+
+   /*
 * Allocate the PCI register window(s).
 */
rid = PCIR_BAR(0);
@@ -395,8 +426,8 @@ aac_pci_attach(device_t dev)
 */
rid = 0;
count = 0;
-   if (aac_enable_msi != 0 && pci_find_cap(dev, PCIY_MSI, ®) == 0) {
-   count = pci_msi_count(dev);
+   if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0 &&
+   (count = pci_msi_count(dev)) != 0) {
if (count > 1)
count = 1;
else
@@ -431,36 +462,6 @@ aac_pci_attach(device_t dev)
}
 
/*
-* Detect the hardware interface version, set up the bus interface
-* indirection.
-*/
-   id = aac_find_ident(dev);
-   sc->aac_hwif = id->hwif;
-   switch(sc->aac_hwif) {
-   case AAC_HWIF_I960RX:
-   case AAC_HWIF_NARK:
-   fwprintf(sc, HBA_FLAGS_DBG_INIT_B, "set hardware up for 
i960Rx/NARK");
-   sc->aac_if = &aac_rx_interface;
-   break;
-   case AAC_HWIF_STRONGARM:
-   fwprintf(sc, HBA_FLAGS_DB

svn commit: r254005 - head/sys/dev/aac

2013-08-06 Thread Marius Strobl
Author: marius
Date: Tue Aug  6 19:14:02 2013
New Revision: 254005
URL: http://svnweb.freebsd.org/changeset/base/254005

Log:
  - Fix a bug in the MSI allocation logic so an MSI is also employed if a
controller supports only a single message. I haven't seen such an adapter
out in the wild, though, so this change likely is a NOP.
While at it, further simplify the MSI allocation logic; there's no need
to check the number of available messages on our own as pci_alloc_msi(9)
will just fail if it can't provide us with the single message we want.
  - Nuke the unused softc of aacch(4).
  
  MFC after:1 month

Modified:
  head/sys/dev/aac/aac_pci.c

Modified: head/sys/dev/aac/aac_pci.c
==
--- head/sys/dev/aac/aac_pci.c  Tue Aug  6 18:55:59 2013(r254004)
+++ head/sys/dev/aac/aac_pci.c  Tue Aug  6 19:14:02 2013(r254005)
@@ -425,18 +425,13 @@ aac_pci_attach(device_t dev)
 * Allocate the interrupt.
 */
rid = 0;
-   count = 0;
-   if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0 &&
-   (count = pci_msi_count(dev)) != 0) {
-   if (count > 1)
-   count = 1;
-   else
-   count = 0;
-   if (count == 1 && pci_alloc_msi(dev, &count) == 0)
+   if (aac_enable_msi != 0 && (sc->flags & AAC_FLAGS_NOMSI) == 0) {
+   count = 1;
+   if (pci_alloc_msi(dev, &count) == 0)
rid = 1;
}
if ((sc->aac_irq = bus_alloc_resource_any(sc->aac_dev, SYS_RES_IRQ,
-   &rid, RF_ACTIVE | (count != 0 ? 0 : RF_SHAREABLE))) == NULL) {
+   &rid, RF_ACTIVE | (rid != 0 ? 0 : RF_SHAREABLE))) == NULL) {
device_printf(dev, "can't allocate interrupt\n");
goto out;
}
@@ -489,14 +484,10 @@ static device_method_t aacch_methods[] =
DEVMETHOD_END
 };
 
-struct aacch_softc {
-   device_tdev;
-};
-
 static driver_t aacch_driver = {
"aacch",
aacch_methods,
-   sizeof(struct aacch_softc)
+   1   /* no softc */
 };
 
 static devclass_t  aacch_devclass;
@@ -515,19 +506,14 @@ aacch_probe(device_t dev)
 }
 
 static int
-aacch_attach(device_t dev)
+aacch_attach(device_t dev __unused)
 {
-   struct aacch_softc *sc;
-
-   sc = device_get_softc(dev);
-
-   sc->dev = dev;
 
return (0);
 }
 
 static int
-aacch_detach(device_t dev)
+aacch_detach(device_t dev __unused)
 {
 
return (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: r254008 - in head/sys/dev: e1000 ixgbe

2013-08-06 Thread Jack F Vogel
Author: jfv
Date: Tue Aug  6 21:01:38 2013
New Revision: 254008
URL: http://svnweb.freebsd.org/changeset/base/254008

Log:
  Make the various driver MSIX setup routines fallback to MSI more
  gracefully. This change was suggested by Marius Strobl, thank you.
  
  PR: kern/181016
  MFC after: ASAP

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/ixgbe/ixgbe.c
  head/sys/dev/ixgbe/ixv.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Tue Aug  6 20:04:44 2013(r254007)
+++ head/sys/dev/e1000/if_em.c  Tue Aug  6 21:01:38 2013(r254008)
@@ -2750,7 +2750,7 @@ static int
 em_setup_msix(struct adapter *adapter)
 {
device_t dev = adapter->dev;
-   int val = 0;
+   int val;
 
/*
** Setup MSI/X for Hartwell: tests have shown
@@ -2764,17 +2764,17 @@ em_setup_msix(struct adapter *adapter)
int rid = PCIR_BAR(EM_MSIX_BAR);
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
-   if (!adapter->msix_mem) {
+   if (adapter->msix_mem == NULL) {
/* May not be enabled */
device_printf(adapter->dev,
"Unable to map MSIX table \n");
goto msi;
}
val = pci_msix_count(dev); 
-   /* We only need 3 vectors */
-   if (val > 3)
+   /* We only need/want 3 vectors */
+   if (val >= 3)
val = 3;
-   if ((val != 3) && (val != 5)) {
+   else {
bus_release_resource(dev, SYS_RES_MEMORY,
PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem);
adapter->msix_mem = NULL;
@@ -2787,14 +2787,13 @@ em_setup_msix(struct adapter *adapter)
device_printf(adapter->dev,
"Using MSIX interrupts "
"with %d vectors\n", val);
+   return (val);
}
-
-   return (val);
+   /* Fall through to MSI */
}
 msi:
-   val = pci_msi_count(dev);
-   if (val == 1 && pci_alloc_msi(dev, &val) == 0) {
-   adapter->msix = 1;
+   val = 1;
+   if (pci_alloc_msi(dev, &val) == 0) {
device_printf(adapter->dev,"Using an MSI interrupt\n");
return (val);
} 

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Tue Aug  6 20:04:44 2013(r254007)
+++ head/sys/dev/e1000/if_igb.c Tue Aug  6 21:01:38 2013(r254008)
@@ -2842,24 +2842,19 @@ igb_setup_msix(struct adapter *adapter)
goto msi;
 
/* First try MSI/X */
+   msgs = pci_msix_count(dev); 
+   if (msgs == 0)
+   goto msi;
rid = PCIR_BAR(IGB_MSIX_BAR);
adapter->msix_mem = bus_alloc_resource_any(dev,
SYS_RES_MEMORY, &rid, RF_ACTIVE);
-   if (!adapter->msix_mem) {
+   if (adapter->msix_mem == NULL) {
/* May not be enabled */
device_printf(adapter->dev,
"Unable to map MSIX table \n");
goto msi;
}
 
-   msgs = pci_msix_count(dev); 
-   if (msgs == 0) { /* system has msix disabled */
-   bus_release_resource(dev, SYS_RES_MEMORY,
-   PCIR_BAR(IGB_MSIX_BAR), adapter->msix_mem);
-   adapter->msix_mem = NULL;
-   goto msi;
-   }
-
/* Figure out a reasonable auto config value */
queues = (mp_ncpus > (msgs-1)) ? (msgs-1) : mp_ncpus;
 
@@ -2902,20 +2897,27 @@ igb_setup_msix(struct adapter *adapter)
"MSIX Configuration Problem, "
"%d vectors configured, but %d queues wanted!\n",
msgs, want);
-   return (0);
+   goto msi;
}
-   if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) {
+   if (pci_alloc_msix(dev, &msgs) == 0) {
device_printf(adapter->dev,
"Using MSIX interrupts with %d vectors\n", msgs);
adapter->num_queues = queues;
return (msgs);
}
+   /* Fallback to MSI configuration */
 msi:
-   msgs = pci_msi_count(dev);
-   if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) {
+   if (adapter->msix_mem != NULL) {
+   bus_release_resource(dev, SYS_RES_MEMORY,
+   PCIR_BAR(IGB_MSIX_BAR), adapter->msix_mem);
+   adapter->msix_mem = NULL;
+   }
+   msgs = 1;
+   if (pci_alloc_msi(de

svn commit: r254010 - head/tools/build/mk

2013-08-06 Thread Sean Bruno
Author: sbruno
Date: Tue Aug  6 21:30:37 2013
New Revision: 254010
URL: http://svnweb.freebsd.org/changeset/base/254010

Log:
  Adjust make knobs to know that WITH_ICONV installs a /usr/bin/iconv
  
  Remove it if the knob isn't tweaked.  Certain ports seem to think that
  if /usr/bin/iconv exists, then libc has built in libiconv things and will
  blow up pretty nicely when built.
  
  Reviewed by:  gjb@
  MFC after:2 weeks

Modified:
  head/tools/build/mk/OptionalObsoleteFiles.inc

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Aug  6 21:16:00 
2013(r254009)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Aug  6 21:30:37 
2013(r254010)
@@ -4347,3 +4347,7 @@ OLD_FILES+=usr/bin/svnserve
 OLD_FILES+=usr/bin/svnsync
 OLD_FILES+=usr/bin/svnversion
 .endif
+
+.if ${MK_ICONV} == no
+OLD_FILES+=usr/bin/iconv
+.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: r254012 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-08-06 Thread Xin LI
Author: delphij
Date: Tue Aug  6 21:36:01 2013
New Revision: 254012
URL: http://svnweb.freebsd.org/changeset/base/254012

Log:
  MFV r254011:
  
  This change have no effect to FreeBSD but integrated for
  completeness.
  
  Illumos ZFS issues:
348 ZFS should handle DKIOCGMEDIAINFOEXT failure

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Tue Aug 
 6 21:31:37 2013(r254011)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c Tue Aug 
 6 21:36:01 2013(r254012)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include 
@@ -134,18 +135,34 @@ vdev_disk_get_space(vdev_t *vd, uint64_t
return (avail_space);
 }
 
+/*
+ * We want to be loud in DEBUG kernels when DKIOCGMEDIAINFOEXT fails, or when
+ * even a fallback to DKIOCGMEDIAINFO fails.
+ */
+#ifdef DEBUG
+#defineVDEV_DEBUG(...) cmn_err(CE_NOTE, __VA_ARGS__)
+#else
+#defineVDEV_DEBUG(...) /* Nothing... */
+#endif
+
 static int
 vdev_disk_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
 uint64_t *ashift)
 {
spa_t *spa = vd->vdev_spa;
vdev_disk_t *dvd;
-   struct dk_minfo_ext dkmext;
+   union {
+   struct dk_minfo_ext ude;
+   struct dk_minfo ud;
+   } dks;
+   struct dk_minfo_ext *dkmext = &dks.ude;
+   struct dk_minfo *dkm = &dks.ud;
int error;
dev_t dev;
int otyp;
boolean_t validate_devid = B_FALSE;
ddi_devid_t devid;
+   uint64_t capacity = 0, blksz = 0, pbsize;
 
/*
 * We must have a pathname, and it must be absolute.
@@ -330,33 +347,56 @@ skip_open:
return (SET_ERROR(EINVAL));
}
 
+   *max_psize = *psize;
+
/*
 * Determine the device's minimum transfer size.
 * If the ioctl isn't supported, assume DEV_BSIZE.
 */
-   if (ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFOEXT, (intptr_t)&dkmext,
-   FKIOCTL, kcred, NULL) != 0)
-   dkmext.dki_pbsize = DEV_BSIZE;
+   if ((error = ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFOEXT,
+   (intptr_t)dkmext, FKIOCTL, kcred, NULL)) == 0) {
+   capacity = dkmext->dki_capacity - 1;
+   blksz = dkmext->dki_lbsize;
+   pbsize = dkmext->dki_pbsize;
+   } else if ((error = ldi_ioctl(dvd->vd_lh, DKIOCGMEDIAINFO,
+   (intptr_t)dkm, FKIOCTL, kcred, NULL)) == 0) {
+   VDEV_DEBUG(
+   "vdev_disk_open(\"%s\"): fallback to DKIOCGMEDIAINFO\n",
+   vd->vdev_path);
+   capacity = dkm->dki_capacity - 1;
+   blksz = dkm->dki_lbsize;
+   pbsize = blksz;
+   } else {
+   VDEV_DEBUG("vdev_disk_open(\"%s\"): "
+   "both DKIOCGMEDIAINFO{,EXT} calls failed, %d\n",
+   vd->vdev_path, error);
+   pbsize = DEV_BSIZE;
+   }
 
-   *ashift = highbit(MAX(dkmext.dki_pbsize, SPA_MINBLOCKSIZE)) - 1;
+   *ashift = highbit(MAX(pbsize, SPA_MINBLOCKSIZE)) - 1;
 
if (vd->vdev_wholedisk == 1) {
-   uint64_t capacity = dkmext.dki_capacity - 1;
-   uint64_t blksz = dkmext.dki_lbsize;
int wce = 1;
 
+   if (error == 0) {
+   /*
+* If we have the capability to expand, we'd have
+* found out via success from DKIOCGMEDIAINFO{,EXT}.
+* Adjust max_psize upward accordingly since we know
+* we own the whole disk now.
+*/
+   *max_psize += vdev_disk_get_space(vd, capacity, blksz);
+   zfs_dbgmsg("capacity change: vdev %s, psize %llu, "
+   "max_psize %llu", vd->vdev_path, *psize,
+   *max_psize);
+   }
+
/*
-* If we own the whole disk, try to enable disk write caching.
-* We ignore errors because it's OK if we can't do it.
+* Since we own the whole disk, try to enable disk write
+* caching.  We ignore errors because it's OK if we can't do it.
 */
(void) ldi_ioctl(dvd->vd_lh, DKIOCSETWCE, (intptr_t)&wce,
FKIOCTL, kcred, NULL);
-
-   *max_psize = *psize + vdev_disk_get_space(vd, capacity, blksz);
-   zfs_dbgmsg("capacity change: vdev %s, psize %llu, "
-

svn commit: r254014 - head/sys/cddl/contrib/opensolaris

2013-08-06 Thread Xin LI
Author: delphij
Date: Tue Aug  6 21:44:54 2013
New Revision: 254014
URL: http://svnweb.freebsd.org/changeset/base/254014

Log:
  MFV r254013 (dummy merge to note that the change is already
  merged):
  
  Illumos ZFS issues:
3973 zfs_ioc_rename alters passed in zc->zc_name

Modified:
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)
___
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: r254015 - in head: sbin/fdisk_pc98 sys/boot/pc98/boot2 sys/boot/pc98/libpc98 sys/geom sys/geom/part sys/sys usr.sbin/boot98cfg

2013-08-06 Thread Marcel Moolenaar
Author: marcel
Date: Wed Aug  7 00:00:48 2013
New Revision: 254015
URL: http://svnweb.freebsd.org/changeset/base/254015

Log:
  Change  to not redefine the same symbols that are
  being defined in . Instead give the symbols here a
  "PC98_" prefix. This way, both  and 
  can be included in the same C source file.
  
  The renaming is trivial. The only gotcha is that DOSBBSECTOR is
  also redefined from 0 to 1. This because DOSBBSECTOR was always
  used in conjunction with an addition of 1. The PC98_BBSECTOR symbol
  is defined as 1 and the expression is simplified.
  
  Note: it is not believed that ports are seriously impacted; or at
  all for that matter.
  
  Approved by: nyan@

Modified:
  head/sbin/fdisk_pc98/fdisk.c
  head/sys/boot/pc98/boot2/boot2.c
  head/sys/boot/pc98/libpc98/biosdisk.c
  head/sys/geom/geom_pc98.c
  head/sys/geom/part/g_part_pc98.c
  head/sys/sys/diskpc98.h
  head/usr.sbin/boot98cfg/boot98cfg.c

Modified: head/sbin/fdisk_pc98/fdisk.c
==
--- head/sbin/fdisk_pc98/fdisk.cTue Aug  6 21:44:54 2013
(r254014)
+++ head/sbin/fdisk_pc98/fdisk.cWed Aug  7 00:00:48 2013
(r254015)
@@ -254,7 +254,7 @@ main(int argc, char *argv[])
dos_sectors);
printf("Part  %11s %11s %4s %4s %-16s\n", "Start", "Size", 
"MID",
"SID", "Name");
-   for (i = 0; i < NDOSPART; i++) {
+   for (i = 0; i < PC98_NPARTS; i++) {
partp = ((struct pc98_partition *) &mboot.parts) + i;
if (partp->dp_sid == 0)
continue;
@@ -310,7 +310,7 @@ main(int argc, char *argv[])
printf("Warning: BIOS sector numbering starts with sector 1\n");
printf("Information from DOS bootblock is:\n");
if (partition == -1)
-   for (i = 1; i <= NDOSPART; i++)
+   for (i = 1; i <= PC98_NPARTS; i++)
change_part(i, v_flag);
else
change_part(partition, 1);
@@ -367,7 +367,7 @@ print_s0(int which)
print_params();
printf("Information from DOS bootblock is:\n");
if (which == -1) {
-   for (i = 1; i <= NDOSPART; i++)
+   for (i = 1; i <= PC98_NPARTS; i++)
if (v_flag || !part_unused(i)) {
printf("%d: ", i);
print_part(i);
@@ -414,7 +414,7 @@ static void
 init_boot(void)
 {
 
-   mboot.signature = DOSMAGIC;
+   mboot.signature = PC98_MAGIC;
 }
 
 
@@ -517,7 +517,7 @@ change_active(int which)
int active, i, new, tmp;
 
active = -1;
-   for (i = 0; i < NDOSPART; i++) {
+   for (i = 0; i < PC98_NPARTS; i++) {
if ((partp[i].dp_sid & PC98_SID_ACTIVE) == 0)
continue;
printf("Partition %d is marked active\n", i + 1);
@@ -672,7 +672,7 @@ write_disk(off_t sector, void *buf)
if (error == sz)
return (0);
 
-   for (i = 0; i < NDOSPART; i++) {
+   for (i = 0; i < PC98_NPARTS; i++) {
sprintf(fbuf, "%ss%d", disk, i + 1);
fdw = open(fbuf, O_RDWR, 0);
if (fdw < 0)
@@ -731,7 +731,7 @@ read_s0()
warnx("can't read fdisk partition table");
return -1;
}
-   if (mboot.signature != DOSMAGIC) {
+   if (mboot.signature != PC98_MAGIC) {
warnx("invalid fdisk partition table found");
/* So should we initialize things */
return -1;
@@ -911,7 +911,7 @@ reset_boot(void)
struct pc98_partition *partp;
 
init_boot();
-   for (i = 1; i <= NDOSPART; i++) {
+   for (i = 1; i <= PC98_NPARTS; i++) {
partp = ((struct pc98_partition *) &mboot.parts) + i - 1;
bzero((char *)partp, sizeof (struct pc98_partition));
}

Modified: head/sys/boot/pc98/boot2/boot2.c
==
--- head/sys/boot/pc98/boot2/boot2.cTue Aug  6 21:44:54 2013
(r254014)
+++ head/sys/boot/pc98/boot2/boot2.cWed Aug  7 00:00:48 2013
(r254015)
@@ -330,10 +330,10 @@ check_slice(void)
 
 if (dsk.type == TYPE_FD)
return (WHOLE_DISK_SLICE);
-if (drvread(sec, DOSBBSECTOR + 1))
+if (drvread(sec, PC98_BBSECTOR))
return (WHOLE_DISK_SLICE);  /* Read error */
-dp = (void *)(sec + DOSPARTOFF);
-for (i = 0; i < NDOSPART; i++) {
+dp = (void *)(sec + PC98_PARTOFF);
+for (i = 0; i < PC98_NPARTS; i++) {
if (dp[i].dp_mid == DOSMID_386BSD) {
if (dp[i].dp_scyl <= cyl && cyl <= dp[i].dp_ecyl)
return (BASE_SLICE + i);
@@ -583,7 +583,7 @@ parse()
dsk.slice = WHOLE_DISK_SLICE;
if (arg[1] == ',') {
dsk.slice = *arg -

svn commit: r254017 - head/sys/vm

2013-08-06 Thread Mark Johnston
Author: markj
Date: Wed Aug  7 00:20:30 2013
New Revision: 254017
URL: http://svnweb.freebsd.org/changeset/base/254017

Log:
  Fill in the description fields for M_FICT_PAGES.
  
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/sys/vm/vm_phys.c

Modified: head/sys/vm/vm_phys.c
==
--- head/sys/vm/vm_phys.c   Wed Aug  7 00:09:49 2013(r254016)
+++ head/sys/vm/vm_phys.c   Wed Aug  7 00:20:30 2013(r254017)
@@ -93,7 +93,7 @@ static struct vm_phys_fictitious_seg {
vm_page_t   first_page;
 } vm_phys_fictitious_segs[VM_PHYS_FICTITIOUS_NSEGS];
 static struct mtx vm_phys_fictitious_reg_mtx;
-MALLOC_DEFINE(M_FICT_PAGES, "", "");
+MALLOC_DEFINE(M_FICT_PAGES, "vm_fictitious", "Fictitious VM pages");
 
 static struct vm_freelist
 vm_phys_free_queues[MAXMEMDOM][VM_NFREELIST][VM_NFREEPOOL][VM_NFREEORDER];
___
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: r254018 - head/usr.bin/ldd

2013-08-06 Thread Mark Johnston
Author: markj
Date: Wed Aug  7 00:28:17 2013
New Revision: 254018
URL: http://svnweb.freebsd.org/changeset/base/254018

Log:
  Pass variables prefixed with both LD_ and LD_32_ to the run-time linker.
  This prevents unintentional execution of programs when running ldd(1) on
  32-bit Linux binaries.
  
  PR:   175339, 127276
  Suggested by: kib, rstone
  Reviewed by:  kib
  MFC after:2 weeks

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

Modified: head/usr.bin/ldd/ldd.c
==
--- head/usr.bin/ldd/ldd.c  Wed Aug  7 00:20:30 2013(r254017)
+++ head/usr.bin/ldd/ldd.c  Wed Aug  7 00:28:17 2013(r254018)
@@ -49,12 +49,6 @@ __FBSDID("$FreeBSD$");
 
 #include "extern.h"
 
-#ifdef COMPAT_32BIT
-#defineLD_ "LD_32_"
-#else
-#defineLD_ "LD_"
-#endif
-
 /*
  * 32-bit ELF data structures can only be used if the system header[s] declare
  * them.  There is no official macro for determining whether they are declared,
@@ -64,6 +58,16 @@ __FBSDID("$FreeBSD$");
 #defineELF32_SUPPORTED
 #endif
 
+#defineLDD_SETENV(name, value, overwrite) do { \
+   setenv("LD_" name, value, overwrite);   \
+   setenv("LD_32_" name, value, overwrite);\
+} while (0)
+
+#defineLDD_UNSETENV(name) do { \
+   unsetenv("LD_" name);   \
+   unsetenv("LD_32_" name);\
+} while (0)
+
 static int is_executable(const char *fname, int fd, int *is_shlib,
int *type);
 static voidusage(void);
@@ -82,7 +86,7 @@ execldd32(char *file, char *fmt1, char *
char *argv[8];
int i, rval, status;
 
-   unsetenv(LD_ "TRACE_LOADED_OBJECTS");
+   LDD_UNSETENV("TRACE_LOADED_OBJECTS");
rval = 0;
i = 0;
argv[i++] = strdup(_PATH_LDD32);
@@ -121,7 +125,7 @@ execldd32(char *file, char *fmt1, char *
}
while (i--)
free(argv[i]);
-   setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1);
+   LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1);
return (rval);
 }
 #endif
@@ -210,15 +214,15 @@ main(int argc, char *argv[])
}
 
/* ld.so magic */
-   setenv(LD_ "TRACE_LOADED_OBJECTS", "yes", 1);
+   LDD_SETENV("TRACE_LOADED_OBJECTS", "yes", 1);
if (fmt1 != NULL)
-   setenv(LD_ "TRACE_LOADED_OBJECTS_FMT1", fmt1, 1);
+   LDD_SETENV("TRACE_LOADED_OBJECTS_FMT1", fmt1, 1);
if (fmt2 != NULL)
-   setenv(LD_ "TRACE_LOADED_OBJECTS_FMT2", fmt2, 1);
+   LDD_SETENV("TRACE_LOADED_OBJECTS_FMT2", fmt2, 1);
 
-   setenv(LD_ "TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1);
+   LDD_SETENV("TRACE_LOADED_OBJECTS_PROGNAME", *argv, 1);
if (aflag)
-   setenv(LD_ "TRACE_LOADED_OBJECTS_ALL", "1", 1);
+   LDD_SETENV("TRACE_LOADED_OBJECTS_ALL", "1", 1);
else if (fmt1 == NULL && fmt2 == NULL)
/* Default formats */
printf("%s:\n", *argv);
___
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: r254019 - head/contrib/wpa/src/drivers

2013-08-06 Thread Rui Paulo
Author: rpaulo
Date: Wed Aug  7 01:01:58 2013
New Revision: 254019
URL: http://svnweb.freebsd.org/changeset/base/254019

Log:
  Fix a timing issue with the wired driver.
  
  After configuring the interface, wait for the link to become active.
  Many ethernet drivers reset the chip when we set multicast filters
  (causing significant delays due to link re-negotiation) and, by the time
  we start sending packets, they are discared instead of going to the ether.
  
  Tested by:dumbbell

Modified:
  head/contrib/wpa/src/drivers/driver_wired.c

Modified: head/contrib/wpa/src/drivers/driver_wired.c
==
--- head/contrib/wpa/src/drivers/driver_wired.c Wed Aug  7 00:28:17 2013
(r254018)
+++ head/contrib/wpa/src/drivers/driver_wired.c Wed Aug  7 01:01:58 2013
(r254019)
@@ -17,6 +17,7 @@
 #endif /* __linux__ */
 #if defined(__FreeBSD__) || defined(__DragonFly__) || 
defined(__FreeBSD_kernel__)
 #include 
+#include 
 #endif /* defined(__FreeBSD__) || defined(__DragonFly__) || 
defined(__FreeBSD_kernel__) */
 #ifdef __sun__
 #include 
@@ -453,6 +454,29 @@ static int wpa_driver_wired_set_ifflags(
return 0;
 }
 
+static int wpa_driver_wired_get_ifstatus(const char *ifname, int *status)
+{
+   struct ifmediareq ifmr;
+   int s;
+
+   s = socket(PF_INET, SOCK_DGRAM, 0);
+   if (s < 0) {
+   perror("socket");
+   return -1;
+   }
+
+   os_memset(&ifmr, 0, sizeof(ifmr));
+   os_strlcpy(ifmr.ifm_name, ifname, IFNAMSIZ);
+   if (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) {
+   perror("ioctl[SIOCGIFMEDIA]");
+   close(s);
+   return -1;
+   }
+   close(s);
+   *status = ifmr.ifm_status & IFM_ACTIVE;
+
+   return 0;
+}
 
 static int wpa_driver_wired_multi(const char *ifname, const u8 *addr, int add)
 {
@@ -511,7 +535,7 @@ static int wpa_driver_wired_multi(const 
 static void * wpa_driver_wired_init(void *ctx, const char *ifname)
 {
struct wpa_driver_wired_data *drv;
-   int flags;
+   int flags, status;
 
drv = os_zalloc(sizeof(*drv));
if (drv == NULL)
@@ -562,6 +586,11 @@ static void * wpa_driver_wired_init(void
   __func__);
drv->iff_allmulti = 1;
}
+   wpa_printf(MSG_DEBUG, "%s: waiting for link to become active",
+   __func__);
+   while (wpa_driver_wired_get_ifstatus(ifname, &status) == 0 && 
+   status == 0)
+   sleep(1);
 
return drv;
 }
___
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: r254020 - head/sys/net

2013-08-06 Thread Mark Johnston
Author: markj
Date: Wed Aug  7 01:32:08 2013
New Revision: 254020
URL: http://svnweb.freebsd.org/changeset/base/254020

Log:
  Add a missing module version declaration to if_tun(4).
  
  PR:   181078
  Submitted by: Brandon Gooch 
  MFC after:1 week

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Wed Aug  7 01:01:58 2013(r254019)
+++ head/sys/net/if_tun.c   Wed Aug  7 01:32:08 2013(r254020)
@@ -321,6 +321,7 @@ static moduledata_t tun_mod = {
 };
 
 DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+MODULE_VERSION(if_tun, 1);
 
 static void
 tunstart(struct ifnet *ifp)
___
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: r254021 - head/contrib/wpa/src/drivers

2013-08-06 Thread Rui Paulo
Author: rpaulo
Date: Wed Aug  7 04:03:30 2013
New Revision: 254021
URL: http://svnweb.freebsd.org/changeset/base/254021

Log:
  Make sure IFM_AVALID is also set when checking ifm_status.
  
  Submitted by: yongari

Modified:
  head/contrib/wpa/src/drivers/driver_wired.c

Modified: head/contrib/wpa/src/drivers/driver_wired.c
==
--- head/contrib/wpa/src/drivers/driver_wired.c Wed Aug  7 01:32:08 2013
(r254020)
+++ head/contrib/wpa/src/drivers/driver_wired.c Wed Aug  7 04:03:30 2013
(r254021)
@@ -473,7 +473,7 @@ static int wpa_driver_wired_get_ifstatus
return -1;
}
close(s);
-   *status = ifmr.ifm_status & IFM_ACTIVE;
+   *status = ifmr.ifm_status & (IFM_ACTIVE|IFM_AVALID);
 
return 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"


Re: svn commit: r253995 - in head/usr.sbin: rtadvd rtsold

2013-08-06 Thread Bruce Evans

On Wed, 7 Aug 2013, Hiroki Sato wrote:


Ian Lepore  wrote
 in <1375807689.3320.48.ca...@revolution.hippie.lan>:

ia> On Tue, 2013-08-06 at 15:49 +, Hiroki Sato wrote:
ia> > /* Generate maximum time in timespec. */
ia> > -   memset(&tm_max.tv_sec, 0xff, sizeof(tm_max.tv_sec));
ia> > -   memset(&tm_max.tv_nsec, 0xff, sizeof(tm_max.tv_nsec));
ia> > -   tm_max.tv_sec &= ~(1UL << (sizeof(tm_max.tv_sec) * 8 - 1));
ia> > -   tm_max.tv_nsec &= ~(1UL << (sizeof(tm_max.tv_nsec) * 8 - 1));
ia> > +   tm_max.tv_sec = (-1) & ~((time_t)1 << ((sizeof(tm_max.tv_sec) * 8) - 
1));
ia> > +   tm_max.tv_nsec = (-1) & ~((long)1 << ((sizeof(tm_max.tv_nsec) * 8) - 
1));
ia> >
ia> > /* set log level */
ia> > if (dflag > 1)
ia>
ia> The maximum number of nsec is 9 regardless of the type of
ia> tv_nsec.
ia>
ia> That expression for max time_t sure is ugly, but I can't think of
ia> anything that isn't just differently-ugly.  At least the comment makes
ia> the purpose clear.

This was defined as {0x7fff, 0x7fff} in the original code and
used just as a large enough value to make a conditional (tm_max >
tm_other) be always true, not the exact maximum value.  Yes, this is
ugly and can be improved.


After the change to monotonic times, the max time in seconds can't be
more than a few million.  1 non-leap year = 31.536 million seconds.
This is not quite enough for anyone, so use LONG_MAX > 2147 million
to work for 68 years.  Thus all uses of intmax_t are bogus, and even
all uses of long are unnecessary, since they are only needed to support
systems with < 32-bit ints. but no such systems are supported.

The change to monotonic times gave lots of style bugs.  Mainly expansion
of lines beyond 80 columns by large ugly code.  In the above, the lines
with the complicated expressions for the maximums became too long.

Bruce
___
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: r254025 - in head/sys: amd64/amd64 arm/arm arm/at91 arm/mv/armadaxp arm/s3c2xx0 arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 cddl/compat/opensolaris/kern cddl/compat/opensolari...

2013-08-06 Thread Jeff Roberson
Author: jeff
Date: Wed Aug  7 06:21:20 2013
New Revision: 254025
URL: http://svnweb.freebsd.org/changeset/base/254025

Log:
  Replace kernel virtual address space allocation with vmem.  This provides
  transparent layering and better fragmentation.
  
   - Normalize functions that allocate memory to use kmem_*
   - Those that allocate address space are named kva_*
   - Those that operate on maps are named kmap_*
   - Implement recursive allocation handling for kmem_arena in vmem.
  
  Reviewed by:  alc
  Tested by:pho
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/amd64/amd64/pmap.c
  head/sys/amd64/amd64/sys_machdep.c
  head/sys/amd64/amd64/vm_machdep.c
  head/sys/arm/arm/bus_space_generic.c
  head/sys/arm/arm/busdma_machdep-v6.c
  head/sys/arm/arm/busdma_machdep.c
  head/sys/arm/arm/mp_machdep.c
  head/sys/arm/arm/pmap-v6.c
  head/sys/arm/arm/pmap.c
  head/sys/arm/arm/vm_machdep.c
  head/sys/arm/at91/at91.c
  head/sys/arm/mv/armadaxp/armadaxp_mp.c
  head/sys/arm/s3c2xx0/s3c2xx0_space.c
  head/sys/arm/xscale/i80321/i80321_space.c
  head/sys/arm/xscale/i8134x/i81342_space.c
  head/sys/arm/xscale/ixp425/ixp425_pci_space.c
  head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
  head/sys/cddl/compat/opensolaris/sys/kmem.h
  head/sys/compat/linux/linux_misc.c
  head/sys/compat/ndis/subr_ntoskrnl.c
  head/sys/dev/bktr/bktr_core.c
  head/sys/dev/drm/drm_scatter.c
  head/sys/dev/drm2/drm_scatter.c
  head/sys/dev/drm2/i915/intel_ringbuffer.c
  head/sys/dev/drm2/ttm/ttm_bo_util.c
  head/sys/dev/xen/blkback/blkback.c
  head/sys/dev/xen/netback/netback.c
  head/sys/dev/xen/xenpci/xenpci.c
  head/sys/i386/i386/machdep.c
  head/sys/i386/i386/mp_machdep.c
  head/sys/i386/i386/pmap.c
  head/sys/i386/i386/sys_machdep.c
  head/sys/i386/i386/vm_machdep.c
  head/sys/i386/ibcs2/imgact_coff.c
  head/sys/i386/pci/pci_cfgreg.c
  head/sys/i386/xen/mp_machdep.c
  head/sys/i386/xen/pmap.c
  head/sys/ia64/ia64/mp_machdep.c
  head/sys/kern/imgact_gzip.c
  head/sys/kern/init_main.c
  head/sys/kern/kern_exec.c
  head/sys/kern/kern_malloc.c
  head/sys/kern/kern_mbuf.c
  head/sys/kern/kern_sharedpage.c
  head/sys/kern/subr_busdma_bufalloc.c
  head/sys/kern/subr_vmem.c
  head/sys/kern/vfs_bio.c
  head/sys/mips/mips/mp_machdep.c
  head/sys/mips/mips/pmap.c
  head/sys/mips/mips/vm_machdep.c
  head/sys/mips/sibyte/sb_zbpci.c
  head/sys/ofed/include/linux/dma-mapping.h
  head/sys/ofed/include/linux/gfp.h
  head/sys/ofed/include/linux/linux_compat.c
  head/sys/pc98/pc98/machdep.c
  head/sys/powerpc/aim/mmu_oea.c
  head/sys/powerpc/aim/mmu_oea64.c
  head/sys/powerpc/aim/vm_machdep.c
  head/sys/powerpc/booke/pmap.c
  head/sys/powerpc/booke/vm_machdep.c
  head/sys/powerpc/powerpc/busdma_machdep.c
  head/sys/powerpc/powerpc/mp_machdep.c
  head/sys/sparc64/sparc64/bus_machdep.c
  head/sys/sparc64/sparc64/mem.c
  head/sys/sparc64/sparc64/mp_machdep.c
  head/sys/sparc64/sparc64/pmap.c
  head/sys/sparc64/sparc64/vm_machdep.c
  head/sys/vm/memguard.c
  head/sys/vm/memguard.h
  head/sys/vm/pmap.h
  head/sys/vm/uma_core.c
  head/sys/vm/vm_extern.h
  head/sys/vm/vm_glue.c
  head/sys/vm/vm_init.c
  head/sys/vm/vm_kern.c
  head/sys/vm/vm_kern.h
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h
  head/sys/vm/vm_object.c
  head/sys/x86/x86/busdma_machdep.c
  head/sys/xen/gnttab.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Wed Aug  7 06:05:57 2013
(r254024)
+++ head/sys/amd64/amd64/mp_machdep.c   Wed Aug  7 06:21:20 2013
(r254025)
@@ -938,10 +938,14 @@ start_all_aps(void)
apic_id = cpu_apic_ids[cpu];
 
/* allocate and set up an idle stack data page */
-   bootstacks[cpu] = (void *)kmem_alloc(kernel_map, KSTACK_PAGES * 
PAGE_SIZE);
-   doublefault_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE);
-   nmi_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE);
-   dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE);
+   bootstacks[cpu] = (void *)kmem_malloc(kernel_arena,
+   KSTACK_PAGES * PAGE_SIZE, M_WAITOK | M_ZERO);
+   doublefault_stack = (char *)kmem_malloc(kernel_arena,
+   PAGE_SIZE, M_WAITOK | M_ZERO);
+   nmi_stack = (char *)kmem_malloc(kernel_arena, PAGE_SIZE,
+   M_WAITOK | M_ZERO);
+   dpcpu = (void *)kmem_malloc(kernel_arena, DPCPU_SIZE,
+   M_WAITOK | M_ZERO);
 
bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 
8;
bootAP = cpu;

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Aug  7 06:05:57 2013(r254024)
+++ head/sys/amd64/amd64/pmap.c Wed Aug  7 06:21:20 2013(r254025)
@@ -860,7 +860,8 @@ pmap_init(void)