svn commit: r297334 - head/sys/dev/vt/hw/vga

2016-03-28 Thread Sepherosa Ziehau
Author: sephe
Date: Mon Mar 28 07:36:54 2016
New Revision: 297334
URL: https://svnweb.freebsd.org/changeset/base/297334

Log:
  vt: Use textmode when we're running on hypervisors
  
  The graphic mode is noticeably slow on hypervisors, especially
  on Hyper-V (1 second to each line).
  
  Submitted by: Dexuan Cui 
  Reviewed by:  kib, sephe, royger (early loader version)
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5739

Modified:
  head/sys/dev/vt/hw/vga/vt_vga.c

Modified: head/sys/dev/vt/hw/vga/vt_vga.c
==
--- head/sys/dev/vt/hw/vga/vt_vga.c Mon Mar 28 05:42:15 2016
(r297333)
+++ head/sys/dev/vt/hw/vga/vt_vga.c Mon Mar 28 07:36:54 2016
(r297334)
@@ -1214,7 +1214,6 @@ vga_init(struct vt_device *vd)
if (vd->vd_softc == NULL)
vd->vd_softc = (void *)&vga_conssoftc;
sc = vd->vd_softc;
-   textmode = 0;
 
if (vd->vd_flags & VDF_DOWNGRADE && vd->vd_video_dev != NULL)
vga_pci_repost(vd->vd_video_dev);
@@ -1229,6 +1228,13 @@ vga_init(struct vt_device *vd)
bus_space_map(sc->vga_reg_tag, VGA_REG_BASE, VGA_REG_SIZE, 0,
&sc->vga_reg_handle);
 
+   /*
+* If "hw.vga.textmode" is not set and we're running on hypervisor,
+* we use text mode by default, this is because when we're on
+* hypervisor, vt(4) is usually much slower in graphics mode than
+* in text mode, especially when we're on Hyper-V.
+*/
+   textmode = vm_guest != VM_GUEST_NO;
TUNABLE_INT_FETCH("hw.vga.textmode", &textmode);
if (textmode) {
vd->vd_flags |= VDF_TEXTMODE;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297335 - head/sys/fs/ext2fs

2016-03-28 Thread Kevin Lo
Author: kevlo
Date: Mon Mar 28 07:44:55 2016
New Revision: 297335
URL: https://svnweb.freebsd.org/changeset/base/297335

Log:
  Update superblock and inode structs for ext4.
  
  Reviewed by:  pfg

Modified:
  head/sys/fs/ext2fs/ext2_dinode.h
  head/sys/fs/ext2fs/ext2fs.h

Modified: head/sys/fs/ext2fs/ext2_dinode.h
==
--- head/sys/fs/ext2fs/ext2_dinode.hMon Mar 28 07:36:54 2016
(r297334)
+++ head/sys/fs/ext2fs/ext2_dinode.hMon Mar 28 07:44:55 2016
(r297335)
@@ -131,6 +131,7 @@ struct ext2fs_dinode {
uint32_te2di_crtime;/* 144: Creation (birth)time */
uint32_te2di_crtime_extra; /* 148: Extra creation (birth)time */
uint32_te2di_version_hi;  /* 152: High bits of inode version */
+   uint32_te2di_projid;/* 156: Project ID */
 };
 
 #endif /* !_FS_EXT2FS_EXT2_DINODE_H_ */

Modified: head/sys/fs/ext2fs/ext2fs.h
==
--- head/sys/fs/ext2fs/ext2fs.h Mon Mar 28 07:36:54 2016(r297334)
+++ head/sys/fs/ext2fs/ext2fs.h Mon Mar 28 07:44:55 2016(r297335)
@@ -72,7 +72,7 @@ struct ext2fs {
uint32_t  e2fs_first_ino;   /* first non-reserved inode */
uint16_t  e2fs_inode_size;  /* size of inode structure */
uint16_t  e2fs_block_group_nr;  /* block grp number of this sblk*/
-   uint32_t  e2fs_features_compat; /*  compatible feature set */
+   uint32_t  e2fs_features_compat; /* compatible feature set */
uint32_t  e2fs_features_incompat; /* incompatible feature set */
uint32_t  e2fs_features_rocompat; /* RO-compatible feature set */
uint8_t   e2fs_uuid[16];/* 128-bit uuid for volume */
@@ -88,25 +88,54 @@ struct ext2fs {
uint32_t  e3fs_last_orphan; /* start of list of inodes to delete */
uint32_t  e3fs_hash_seed[4];/* HTREE hash seed */
char  e3fs_def_hash_version; /* Default hash version to use */
-   char  e3fs_reserved_char_pad;
+   char  e3fs_jnl_backup_type;
+   uint16_t  e3fs_desc_size;   /* size of group descriptor */
uint32_t  e3fs_default_mount_opts;
uint32_t  e3fs_first_meta_bg;   /* First metablock block group */
-   uint32_t  e3fs_mkfs_time;  /* when the fs was created */
-   uint32_t  e3fs_jnl_blks[17];   /* backup of the journal inode */
-   uint32_t  e4fs_bcount_hi;  /* block count */
-   uint32_t  e4fs_rbcount_hi; /* reserved blocks count */
-   uint32_t  e4fs_fbcount_hi; /* free blocks count */
-   uint16_t  e4fs_min_extra_isize;/* all inodes have at least some bytes */
+   uint32_t  e3fs_mkfs_time;   /* when the fs was created */
+   uint32_t  e3fs_jnl_blks[17];/* backup of the journal inode */
+   uint32_t  e4fs_bcount_hi;   /* high bits of blocks count */
+   uint32_t  e4fs_rbcount_hi;  /* high bits of reserved blocks count */
+   uint32_t  e4fs_fbcount_hi;  /* high bits of free blocks count */
+   uint16_t  e4fs_min_extra_isize; /* all inodes have at least some bytes 
*/
uint16_t  e4fs_want_extra_isize; /* inodes must reserve some bytes */
-   uint32_t  e4fs_flags; /* miscellaneous flags */
-   uint16_t  e4fs_raid_stride;/* RAID stride */
-   uint16_t  e4fs_mmpintv; /* number of seconds to wait in MMP checking */
-   uint64_t  e4fs_mmpblk;   /* block for multi-mount protection */
-   uint32_t  e4fs_raid_stripe_wid;/* blocks on all data disks (N * stride) 
*/
-   uint8_t   e4fs_log_gpf; /* FLEX_BG group size */
-   uint8_t   e4fs_char_pad2;
-   uint16_t  e4fs_pad;
-   uint32_t  reserved2[162];   /* Padding to the end of the block */
+   uint32_t  e4fs_flags;   /* miscellaneous flags */
+   uint16_t  e4fs_raid_stride; /* RAID stride */
+   uint16_t  e4fs_mmpintv; /* number of seconds to wait in MMP 
checking */
+   uint64_t  e4fs_mmpblk;  /* block for multi-mount protection */
+   uint32_t  e4fs_raid_stripe_wid; /* blocks on all data disks (N * 
stride) */
+   uint8_t   e4fs_log_gpf; /* FLEX_BG group size */
+   uint8_t   e4fs_chksum_type; /* metadata checksum algorithm used */
+   uint8_t   e4fs_encrypt; /* versioning level for encryption */
+   uint8_t   e4fs_reserved_pad;
+   uint64_t  e4fs_kbytes_written;  /* number of lifetime kilobytes */
+   uint32_t  e4fs_snapinum;/* inode number of active snapshot */
+   uint32_t  e4fs_snapid;  /* sequential ID of active snapshot */
+   uint64_t  e4fs_snaprbcount; /* reserved blocks for active snapshot 
*/
+   uint32_t  e4fs_snaplist;/* inode number for on-disk snapshot */
+   uint32_t  e4fs_errcount;/* number of file system errors */
+   uint32_t  e4fs_first_errtime;   /* first time an

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

2016-03-28 Thread Alexander Motin
Author: mav
Date: Mon Mar 28 08:12:29 2016
New Revision: 297337
URL: https://svnweb.freebsd.org/changeset/base/297337

Log:
  Pass through error code from make_dev_p().
  
  ENAMETOOLONG is much more informative in logs then ENXIO.
  
  MFC after:1 week

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Mon Mar 28 
08:01:38 2016(r297336)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c  Mon Mar 28 
08:12:29 2016(r297337)
@@ -688,13 +688,14 @@ zvol_create_minor(const char *name)
bioq_init(&zv->zv_queue);
mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF);
} else if (zv->zv_volmode == ZFS_VOLMODE_DEV) {
-   if (make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK,
+   error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK,
&dev, &zvol_cdevsw, NULL, UID_ROOT, GID_OPERATOR,
-   0640, "%s/%s", ZVOL_DRIVER, name) != 0) {
+   0640, "%s/%s", ZVOL_DRIVER, name);
+   if (error != 0) {
kmem_free(zv, sizeof(*zv));
dmu_objset_disown(os, FTAG);
mutex_exit(&zfsdev_state_lock);
-   return (SET_ERROR(ENXIO));
+   return (error);
}
zv->zv_dev = dev;
dev->si_iosize_max = MAXPHYS;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-03-28 Thread Konstantin Belousov
On Mon, Mar 28, 2016 at 08:12:29AM +, Alexander Motin wrote:
> Author: mav
> Date: Mon Mar 28 08:12:29 2016
> New Revision: 297337
> URL: https://svnweb.freebsd.org/changeset/base/297337
> 
> Log:
>   Pass through error code from make_dev_p().
>   
>   ENAMETOOLONG is much more informative in logs then ENXIO.
>   
>   MFC after:  1 week
> 
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
> 
> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
> ==
> --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.cMon Mar 
> 28 08:01:38 2016(r297336)
> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.cMon Mar 
> 28 08:12:29 2016(r297337)
> @@ -688,13 +688,14 @@ zvol_create_minor(const char *name)
>   bioq_init(&zv->zv_queue);
>   mtx_init(&zv->zv_queue_mtx, "zvol", NULL, MTX_DEF);
>   } else if (zv->zv_volmode == ZFS_VOLMODE_DEV) {
> - if (make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK,
> + error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK,
>   &dev, &zvol_cdevsw, NULL, UID_ROOT, GID_OPERATOR,
> - 0640, "%s/%s", ZVOL_DRIVER, name) != 0) {
> + 0640, "%s/%s", ZVOL_DRIVER, name);
> + if (error != 0) {
>   kmem_free(zv, sizeof(*zv));
>   dmu_objset_disown(os, FTAG);
>   mutex_exit(&zfsdev_state_lock);
> - return (SET_ERROR(ENXIO));
> + return (error);
>   }
>   zv->zv_dev = dev;
>   dev->si_iosize_max = MAXPHYS;
Did you considered switching to make_dev_s(9) KPI ?
The next line, not shown in the diff, is
dev->si_drv2 = zv;
The make_dev_s() use would solve an issue where user mode request might
be executed before si_drv2 is assigned.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297347 - head/sys/x86/include

2016-03-28 Thread Konstantin Belousov
Author: kib
Date: Mon Mar 28 09:43:40 2016
New Revision: 297347
URL: https://svnweb.freebsd.org/changeset/base/297347

Log:
  Add defines for the LAPIC TSC deadline timer mode.  The LVT timer mode
  field is two-bit, extend the mask.
  
  Also add comments about all MSRs writes to which are not serializing.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/x86/include/apicreg.h
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/apicreg.h
==
--- head/sys/x86/include/apicreg.h  Mon Mar 28 09:36:52 2016
(r297346)
+++ head/sys/x86/include/apicreg.h  Mon Mar 28 09:43:40 2016
(r297347)
@@ -399,10 +399,11 @@ typedef struct IOAPIC ioapic_t;
 #define APIC_LVTT_VECTOR   0x00ff
 #define APIC_LVTT_DS   0x1000
 #define APIC_LVTT_M0x0001
-#define APIC_LVTT_TM   0x0002
+#define APIC_LVTT_TM   0x0006
 # define APIC_LVTT_TM_ONE_SHOT 0x
 # define APIC_LVTT_TM_PERIODIC 0x0002
-
+# define APIC_LVTT_TM_TSCDLT   0x0004
+# define APIC_LVTT_TM_RSRV 0x0006
 
 /* APIC timer current count */
 #defineAPIC_TIMER_MAX_COUNT0x

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Mon Mar 28 09:36:52 2016
(r297346)
+++ head/sys/x86/include/specialreg.h   Mon Mar 28 09:43:40 2016
(r297347)
@@ -457,6 +457,7 @@
 #defineMSR_DRAM_ENERGY_STATUS  0x619
 #defineMSR_PP0_ENERGY_STATUS   0x639
 #defineMSR_PP1_ENERGY_STATUS   0x641
+#defineMSR_TSC_DEADLINE0x6e0   /* Writes are not serializing */
 
 /*
  * VMX MSRs
@@ -478,7 +479,8 @@
 #defineMSR_VMX_TRUE_ENTRY_CTLS 0x490
 
 /*
- * X2APIC MSRs
+ * X2APIC MSRs.
+ * Writes are not serializing.
  */
 #defineMSR_APIC_0000x800
 #defineMSR_APIC_ID 0x802
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297348 - head/sys/x86/x86

2016-03-28 Thread Konstantin Belousov
Author: kib
Date: Mon Mar 28 09:52:44 2016
New Revision: 297348
URL: https://svnweb.freebsd.org/changeset/base/297348

Log:
  Use TSC deadline mode for LAPIC timer, when available.  The mode fires
  LAPIC timer iinterrupt when TSC reaches the value written to the
  IA32_TSC_DEADLINE MSR.  To arm or reset the timer in deadline mode, a
  single non-serializing MSR write is enough.  This is an advance from
  the one-shot mode of LAPIC, where timer operated with the FSB
  frequency and required two (serialized in case of xAPIC) writes to the
  APIC registers.
  
  The LVT_TIMER register value is cached to avoid unneeded writes in the
  deadline mode.  Unused arguments to specify period (which is passed in
  struct lapic as la_timer_period) and interrupt enable (which is always
  enabled) are removed from lapic_timer_{oneshot,periodic,deadline}
  functions.  Instead, special lapic_timer_oneshot_nointr() function for
  interrupt-less one-shot calibration is added.
  
  Reviewed by:  mav (previous version)
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  Differential revision:https://reviews.freebsd.org/D5738

Modified:
  head/sys/x86/x86/local_apic.c

Modified: head/sys/x86/x86/local_apic.c
==
--- head/sys/x86/x86/local_apic.c   Mon Mar 28 09:43:40 2016
(r297347)
+++ head/sys/x86/x86/local_apic.c   Mon Mar 28 09:52:44 2016
(r297348)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -94,6 +95,13 @@ CTASSERT(IPI_STOP < APIC_SPURIOUS_INT);
 #defineIRQ_DTRACE_RET  (NUM_IO_INTS + 3)
 #defineIRQ_EVTCHN  (NUM_IO_INTS + 4)
 
+enum lat_timer_mode {
+   LAT_MODE_UNDEF =0,
+   LAT_MODE_PERIODIC = 1,
+   LAT_MODE_ONESHOT =  2,
+   LAT_MODE_DEADLINE = 3,
+};
+
 /*
  * Support for local APICs.  Local APICs manage interrupts on each
  * individual processor as opposed to I/O APICs which receive interrupts
@@ -119,9 +127,10 @@ struct lapic {
u_int la_cluster_id:2;
u_int la_present:1;
u_long *la_timer_count;
-   u_long la_timer_period;
-   u_int la_timer_mode;
-   uint32_t lvt_timer_cache;
+   uint64_t la_timer_period;
+   enum lat_timer_mode la_timer_mode;
+   uint32_t lvt_timer_base;
+   uint32_t lvt_timer_last;
/* Include IDT_SYSCALL to make indexing easier. */
int la_ioint_irqs[APIC_NUM_IOINTS + 1];
 } static lapics[MAX_APIC_ID + 1];
@@ -160,6 +169,7 @@ volatile char *lapic_map;
 vm_paddr_t lapic_paddr;
 int x2apic_mode;
 int lapic_eoi_suppression;
+static int lapic_timer_tsc_deadline;
 static u_long lapic_timer_divisor;
 static struct eventtimer lapic_et;
 
@@ -167,6 +177,8 @@ SYSCTL_NODE(_hw, OID_AUTO, apic, CTLFLAG
 SYSCTL_INT(_hw_apic, OID_AUTO, x2apic_mode, CTLFLAG_RD, &x2apic_mode, 0, "");
 SYSCTL_INT(_hw_apic, OID_AUTO, eoi_suppression, CTLFLAG_RD,
 &lapic_eoi_suppression, 0, "");
+SYSCTL_INT(_hw_apic, OID_AUTO, timer_tsc_deadline, CTLFLAG_RD,
+&lapic_timer_tsc_deadline, 0, "");
 
 static uint32_t
 lapic_read32(enum LAPIC_REGISTERS reg)
@@ -256,10 +268,10 @@ native_lapic_enable_x2apic(void)
 
 static voidlapic_enable(void);
 static voidlapic_resume(struct pic *pic, bool suspend_cancelled);
-static voidlapic_timer_oneshot(struct lapic *,
-   u_int count, int enable_int);
-static voidlapic_timer_periodic(struct lapic *,
-   u_int count, int enable_int);
+static voidlapic_timer_oneshot(struct lapic *);
+static voidlapic_timer_oneshot_nointr(struct lapic *, uint32_t);
+static voidlapic_timer_periodic(struct lapic *);
+static voidlapic_timer_deadline(struct lapic *);
 static voidlapic_timer_stop(struct lapic *);
 static voidlapic_timer_set_divisor(u_int divisor);
 static uint32_tlvt_mode(struct lapic *la, u_int pin, uint32_t value);
@@ -450,7 +462,14 @@ native_lapic_init(vm_paddr_t addr)
if (!arat) {
lapic_et.et_flags |= ET_FLAGS_C3STOP;
lapic_et.et_quality -= 200;
+   } else if ((cpu_feature & CPUID_TSC) != 0 &&
+   (cpu_feature2 & CPUID2_TSCDLT) != 0 &&
+   tsc_is_invariant && tsc_freq != 0) {
+   lapic_timer_tsc_deadline = 1;
+   TUNABLE_INT_FETCH("hw.lapic_tsc_deadline",
+   &lapic_timer_tsc_deadline);
}
+
lapic_et.et_frequency = 0;
/* We don't know frequency yet, so trying to guess. */
lapic_et.et_min_period = 0x1000LL;
@@ -604,23 +623,34 @@ native_lapic_setup(int boot)
}
 
/* Program timer LVT and setup handler. */
-   la->lvt_timer_cache = lvt_mode(la, APIC_LVT_TIMER,
+   la->lvt_timer_base = lvt_mode(la, APIC_LVT_TIMER,
lapic_read32(LAPIC_LVT_TIMER));
- 

svn commit: r297349 - head/sys/netinet

2016-03-28 Thread Michael Tuexen
Author: tuexen
Date: Mon Mar 28 11:32:20 2016
New Revision: 297349
URL: https://svnweb.freebsd.org/changeset/base/297349

Log:
  Trigger sending of queued ASCONF chunks if outstanding ones are ACKED.
  
  MFC after:1 week

Modified:
  head/sys/netinet/sctp_input.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Mon Mar 28 09:52:44 2016
(r297348)
+++ head/sys/netinet/sctp_input.c   Mon Mar 28 11:32:20 2016
(r297349)
@@ -6033,7 +6033,9 @@ trigger_send:
if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) {
cnt_ctrl_ready = stcb->asoc.ctrl_queue_cnt - 
stcb->asoc.ecn_echo_cnt_onq;
}
-   if (cnt_ctrl_ready || stcb->asoc.trigger_reset ||
+   if (!TAILQ_EMPTY(&stcb->asoc.asconf_send_queue) ||
+   cnt_ctrl_ready ||
+   stcb->asoc.trigger_reset ||
((un_sent) &&
(stcb->asoc.peers_rwnd > 0 ||
(stcb->asoc.peers_rwnd <= 0 && stcb->asoc.total_flight == 0 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297350 - head/sys/dev/extres/clk

2016-03-28 Thread Jared McNeill
Author: jmcneill
Date: Mon Mar 28 11:51:35 2016
New Revision: 297350
URL: https://svnweb.freebsd.org/changeset/base/297350

Log:
  Pass clkdev_if methods through to parent device by default.
  
  Reviewed by:  mmel, adrian (mentor)
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D5750

Modified:
  head/sys/dev/extres/clk/clkdev_if.m

Modified: head/sys/dev/extres/clk/clkdev_if.m
==
--- head/sys/dev/extres/clk/clkdev_if.m Mon Mar 28 11:32:20 2016
(r297349)
+++ head/sys/dev/extres/clk/clkdev_if.m Mon Mar 28 11:51:35 2016
(r297350)
@@ -32,18 +32,66 @@ INTERFACE clkdev;
 
 CODE {
#include 
+   #include 
+   static int
+   clkdev_default_write_4(device_t dev, bus_addr_t addr, uint32_t val)
+   {
+   device_t pdev;
+
+   pdev = device_get_parent(dev);
+   if (pdev == NULL)
+   return (ENXIO);
+
+   return (CLKDEV_WRITE_4(pdev, addr, val));
+   }
+
+   static int
+   clkdev_default_read_4(device_t dev, bus_addr_t addr, uint32_t *val)
+   {
+   device_t pdev;
+
+   pdev = device_get_parent(dev);
+   if (pdev == NULL)
+   return (ENXIO);
+
+   return (CLKDEV_READ_4(pdev, addr, val));
+   }
+
+   static int
+   clkdev_default_modify_4(device_t dev, bus_addr_t addr,
+   uint32_t clear_mask, uint32_t set_mask)
+   {
+   device_t pdev;
+
+   pdev = device_get_parent(dev);
+   if (pdev == NULL)
+   return (ENXIO);
+
+   return (CLKDEV_MODIFY_4(pdev, addr, clear_mask, set_mask));
+   }
+
static void
clkdev_default_device_lock(device_t dev)
{
+   device_t pdev;
 
-   panic("clkdev_device_lock() is not implemented");
+   pdev = device_get_parent(dev);
+   if (pdev == NULL)
+   panic("clkdev_device_lock not implemented");
+
+   CLKDEV_DEVICE_LOCK(pdev);
}
 
static void
clkdev_default_device_unlock(device_t dev)
{
+   device_t pdev;
+
+   pdev = device_get_parent(dev);
+   if (pdev == NULL)
+   panic("clkdev_device_unlock not implemented");
 
-   panic("clkdev_device_unlock() is not implemented");
+   CLKDEV_DEVICE_UNLOCK(pdev);
}
 }
 
@@ -54,7 +102,7 @@ METHOD int write_4 {
device_tdev;
bus_addr_t  addr;
uint32_tval;
-};
+} DEFAULT clkdev_default_write_4;
 
 #
 # Read single register
@@ -63,7 +111,7 @@ METHOD int read_4 {
device_tdev;
bus_addr_t  addr;
uint32_t*val;
-};
+} DEFAULT clkdev_default_read_4;
 
 #
 # Modify single register
@@ -73,7 +121,7 @@ METHOD int modify_4 {
bus_addr_t  addr;
uint32_tclear_mask;
uint32_tset_mask;
-};
+} DEFAULT clkdev_default_modify_4;
 
 #
 # Get exclusive access to underlying device
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r297334 - head/sys/dev/vt/hw/vga

2016-03-28 Thread Dimitry Andric
On 28 Mar 2016, at 09:36, Sepherosa Ziehau  wrote:
> 
> Author: sephe
> Date: Mon Mar 28 07:36:54 2016
> New Revision: 297334
> URL: https://svnweb.freebsd.org/changeset/base/297334
> 
> Log:
>  vt: Use textmode when we're running on hypervisors
> 
>  The graphic mode is noticeably slow on hypervisors, especially
>  on Hyper-V (1 second to each line).
> 
>  Submitted by:Dexuan Cui 
>  Reviewed by: kib, sephe, royger (early loader version)
>  MFC after:   1 week
>  Sponsored by:Microsoft OSTC
>  Differential Revision:   https://reviews.freebsd.org/D5739

Ah yes, this is very nice, thanks.  The graphical console was also
*extremely* slow on VMware guests.  It could take 15 minutes to reach
the login prompt!

That said, it would be still be interesting to see if it is possible to
speed up the graphical console somehow.  The Linux kernel can also use
a graphical console, but it isn't nearly as slow as that of FreeBSD...

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r297351 - head/sys/x86/x86

2016-03-28 Thread Konstantin Belousov
Author: kib
Date: Mon Mar 28 15:05:00 2016
New Revision: 297351
URL: https://svnweb.freebsd.org/changeset/base/297351

Log:
  Do not load LAPIC_DCR_TIMER with an undefined value.  If we are in the
  deadline mode the divide configuration is not used and
  lapic_timer_divisor is not set.
  
  Reported by:  dhw, mav
  Tested by:mav
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/x86/x86/local_apic.c

Modified: head/sys/x86/x86/local_apic.c
==
--- head/sys/x86/x86/local_apic.c   Mon Mar 28 11:51:35 2016
(r297350)
+++ head/sys/x86/x86/local_apic.c   Mon Mar 28 15:05:00 2016
(r297351)
@@ -636,12 +636,13 @@ native_lapic_setup(int boot)
if (la->la_timer_mode != LAT_MODE_UNDEF) {
KASSERT(la->la_timer_period != 0, ("lapic%u: zero divisor",
lapic_id()));
-   lapic_timer_set_divisor(lapic_timer_divisor);
switch (la->la_timer_mode) {
case LAT_MODE_PERIODIC:
+   lapic_timer_set_divisor(lapic_timer_divisor);
lapic_timer_periodic(la);
break;
case LAT_MODE_ONESHOT:
+   lapic_timer_set_divisor(lapic_timer_divisor);
lapic_timer_oneshot(la);
break;
case LAT_MODE_DEADLINE:
@@ -803,9 +804,9 @@ lapic_et_start(struct eventtimer *et, sb
et->et_min_period = (0x0002LLU << 32) / et->et_frequency;
et->et_max_period = (0xfffeLLU << 32) / et->et_frequency;
}
-   if (la->la_timer_mode == LAT_MODE_UNDEF)
-   lapic_timer_set_divisor(lapic_timer_divisor);
if (period != 0) {
+   if (la->la_timer_mode == LAT_MODE_UNDEF)
+   lapic_timer_set_divisor(lapic_timer_divisor);
la->la_timer_mode = LAT_MODE_PERIODIC;
la->la_timer_period = ((uint32_t)et->et_frequency * period) >>
32;
@@ -815,6 +816,8 @@ lapic_et_start(struct eventtimer *et, sb
la->la_timer_period = (et->et_frequency * first) >> 32;
lapic_timer_deadline(la);
} else {
+   if (la->la_timer_mode == LAT_MODE_UNDEF)
+   lapic_timer_set_divisor(lapic_timer_divisor);
la->la_timer_mode = LAT_MODE_ONESHOT;
la->la_timer_period = ((uint32_t)et->et_frequency * first) >>
32;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297355 - in head: bin/freebsd-version lib/libc/stdio lib/libc/sys lib/libfetch sbin/atm/atmconfig share/man/man4 share/man/man5 share/man/man7 share/man/man9

2016-03-28 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Mar 28 16:48:28 2016
New Revision: 297355
URL: https://svnweb.freebsd.org/changeset/base/297355

Log:
  Fix bunch of .Xrs.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/bin/freebsd-version/freebsd-version.1
  head/lib/libc/stdio/open_memstream.3
  head/lib/libc/sys/ptrace.2
  head/lib/libfetch/fetch.3
  head/sbin/atm/atmconfig/atmconfig.8
  head/share/man/man4/cyapa.4
  head/share/man/man4/ddb.4
  head/share/man/man4/pcm.4
  head/share/man/man4/sppp.4
  head/share/man/man4/vxlan.4
  head/share/man/man5/periodic.conf.5
  head/share/man/man7/ports.7
  head/share/man/man9/netisr.9

Modified: head/bin/freebsd-version/freebsd-version.1
==
--- head/bin/freebsd-version/freebsd-version.1  Mon Mar 28 16:25:07 2016
(r297354)
+++ head/bin/freebsd-version/freebsd-version.1  Mon Mar 28 16:48:28 2016
(r297355)
@@ -110,8 +110,7 @@ env ROOT=/mnt /mnt/bin/freebsd-version -
 .Ed
 .Sh SEE ALSO
 .Xr uname 1 ,
-.Xr loader.conf 5 ,
-.Xr freebsd-version 8
+.Xr loader.conf 5
 .Sh HISTORY
 The
 .Nm

Modified: head/lib/libc/stdio/open_memstream.3
==
--- head/lib/libc/stdio/open_memstream.3Mon Mar 28 16:25:07 2016
(r297354)
+++ head/lib/libc/stdio/open_memstream.3Mon Mar 28 16:48:28 2016
(r297355)
@@ -144,8 +144,8 @@ Memory for the stream or buffer could no
 .Xr fopen 3 ,
 .Xr free 3 ,
 .Xr fseek 3 ,
-.Xr sbuf 3 ,
-.Xr stdio 3
+.Xr stdio 3 ,
+.Xr sbuf 9
 .Sh STANDARDS
 The
 .Fn open_memstream

Modified: head/lib/libc/sys/ptrace.2
==
--- head/lib/libc/sys/ptrace.2  Mon Mar 28 16:25:07 2016(r297354)
+++ head/lib/libc/sys/ptrace.2  Mon Mar 28 16:48:28 2016(r297355)
@@ -103,7 +103,7 @@ be ignored.
 If the child was created by
 .Xr vfork 2
 system call or
-.Xr rfork(2)
+.Xr rfork 2
 call with the
 .Dv RFMEM
 flag specified, the debugging events are reported to the parent

Modified: head/lib/libfetch/fetch.3
==
--- head/lib/libfetch/fetch.3   Mon Mar 28 16:25:07 2016(r297354)
+++ head/lib/libfetch/fetch.3   Mon Mar 28 16:48:28 2016(r297355)
@@ -724,7 +724,6 @@ SSL_CA_CERT_FILE=/path/to/myca.pem
 .Ed
 .Sh SEE ALSO
 .Xr fetch 1 ,
-.Xr ftpio 3 ,
 .Xr ip 4
 .Rs
 .%A J. Postel

Modified: head/sbin/atm/atmconfig/atmconfig.8
==
--- head/sbin/atm/atmconfig/atmconfig.8 Mon Mar 28 16:25:07 2016
(r297354)
+++ head/sbin/atm/atmconfig/atmconfig.8 Mon Mar 28 16:48:28 2016
(r297355)
@@ -313,7 +313,6 @@ List all NATM routes.
 .El
 .Sh SEE ALSO
 .Xr natm 4 ,
-.Xr natmip 4 ,
-.Xr atm 8
+.Xr natmip 4
 .Sh AUTHORS
 .An Hartmut Brandt Aq Mt ha...@freebsd.org

Modified: head/share/man/man4/cyapa.4
==
--- head/share/man/man4/cyapa.4 Mon Mar 28 16:25:07 2016(r297354)
+++ head/share/man/man4/cyapa.4 Mon Mar 28 16:48:28 2016(r297355)
@@ -175,9 +175,9 @@ file:
 .Dl debug.cyapa_enable_tapclick=2
 .Sh SEE ALSO
 .Xr ig4 4 ,
-.Xr moused 4 ,
 .Xr smbus 4 ,
-.Xr sysmouse 4
+.Xr sysmouse 4 ,
+.Xr moused 8
 .Sh AUTHORS
 .An -nosplit
 The original

Modified: head/share/man/man4/ddb.4
==
--- head/share/man/man4/ddb.4   Mon Mar 28 16:25:07 2016(r297354)
+++ head/share/man/man4/ddb.4   Mon Mar 28 16:48:28 2016(r297355)
@@ -1132,7 +1132,7 @@ abbreviations.
 .Nm
 supports a basic output capture facility, which can be used to retrieve the
 results of debugging commands from userspace using
-.Xr sysctl 2 .
+.Xr sysctl 3 .
 .Ic capture on
 enables output capture;
 .Ic capture off

Modified: head/share/man/man4/pcm.4
==
--- head/share/man/man4/pcm.4   Mon Mar 28 16:25:07 2016(r297354)
+++ head/share/man/man4/pcm.4   Mon Mar 28 16:48:28 2016(r297355)
@@ -233,7 +233,7 @@ Most bridge device drivers are still mis
 support, but in most cases this should be trivial to implement.
 Use the
 .Va dev.pcm.%d.[play|rec].vchanformat
-.Xr sysctl(8)
+.Xr sysctl 8
 to adjust the number of channels used.
 The current multichannel interleaved structure and arrangement was
 implemented by inspecting various popular UNIX applications.

Modified: head/share/man/man4/sppp.4
==
--- head/share/man/man4/sppp.4  Mon Mar 28 16:25:07 2016(r297354)
+++ head/share/man/man4/sppp.4  Mon Mar 28 16:48:28 2016(r297355)
@@ -175,7 +175,6 @@ take place.
 .Sh SEE ALSO
 .Xr inet 4 ,
 .Xr intro 4 ,
-.Xr ppp 4 ,
 .Xr ifconfig 8 ,
 .Xr 

svn commit: r297356 - head/share/mk

2016-03-28 Thread Warner Losh
Author: imp
Date: Mon Mar 28 17:32:31 2016
New Revision: 297356
URL: https://svnweb.freebsd.org/changeset/base/297356

Log:
  Support simple soft floating point abi for CPUTYPE in arm. Complex
  types to follow.

Modified:
  head/share/mk/bsd.cpu.mk

Modified: head/share/mk/bsd.cpu.mk
==
--- head/share/mk/bsd.cpu.mkMon Mar 28 16:48:28 2016(r297355)
+++ head/share/mk/bsd.cpu.mkMon Mar 28 17:32:31 2016(r297356)
@@ -108,21 +108,24 @@ _CPUCFLAGS = -march=${CPUTYPE}
 #XXX: gcc doesn't seem to like -mcpu=xscale, and dies while rebuilding itself
 #_CPUCFLAGS = -mcpu=xscale
 _CPUCFLAGS = -march=armv5te -D__XSCALE__
-. elif ${CPUTYPE} == "armv6"
+.  elif ${CPUTYPE:M*soft*} != ""
+_CPUCFLAGS = -mfloat-abi=softfp
+.  elif ${CPUTYPE} == "armv6"
+# Not sure we still need ARM_ARCH_6=1 here.
 _CPUCFLAGS = -march=${CPUTYPE} -DARM_ARCH_6=1
-. elif ${CPUTYPE} == "cortexa"
+.  elif ${CPUTYPE} == "cortexa"
 _CPUCFLAGS = -march=armv7 -DARM_ARCH_6=1 -mfpu=vfp
-. elif ${CPUTYPE:Marmv[4567]*} != ""
+.  elif ${CPUTYPE:Marmv[4567]*} != ""
 # Handle all the armvX types that FreeBSD runs:
 #  armv4, armv4t, armv5, armv5te, armv6, armv6t2, armv7, armv7-a, armv7ve
 # they require -march=. All the others require -mcpu=.
 _CPUCFLAGS = -march=${CPUTYPE}
-. else
+.  else
 # Common values for FreeBSD
-# arm:
+# arm: (any arm v4 or v5 processor you are targetting)
 #  arm920t, arm926ej-s, marvell-pj4, fa526, fa626,
 #  fa606te, fa626te, fa726te
-# armv6:
+# armv6: (any arm v7 or v8 processor you are targetting and the arm1176jzf-s)
 #  arm1176jzf-s, generic-armv7-a, cortex-a5, cortex-a7, cortex-a8,
 #  cortex-a9, cortex-a12, cortex-a15, cortex-a17, cortex-a53, cortex-a57,
 #  cortex-a72, exynos-m1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-03-28 Thread Warren Block
Author: wblock (doc committer)
Date: Mon Mar 28 17:42:14 2016
New Revision: 297357
URL: https://svnweb.freebsd.org/changeset/base/297357

Log:
  Replace "user land", which, for any definition of the word "user",
  sounds like some kind of horrific theme park.  "Hey kids, want to go to
  User Land?"  "No!  We'll be good!"
  
  The obvious replacement is "userland", a compound word replete with
  term-of-art meaning and just a hint of cautionary tale.  The alternate
  terms "flugelhorn" and "bullfrog", while also good, are less well-known
  and were voted down in committee.
  
  MFC after:1 week

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

Modified: head/share/man/man7/hier.7
==
--- head/share/man/man7/hier.7  Mon Mar 28 17:32:31 2016(r297356)
+++ head/share/man/man7/hier.7  Mon Mar 28 17:42:14 2016(r297357)
@@ -546,7 +546,7 @@ Chinese translations of documents in /us
 .It Pa examples/
 various examples for users and programmers
 .It Pa firmware/
-Firmware images loaded by user land programs
+Firmware images loaded by userland programs
 .It Pa games/
 ASCII text files used by various games
 .It Pa groff_font/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r297357 - head/share/man/man7

2016-03-28 Thread Bryan Drewery
On 3/28/16 10:42 AM, Warren Block wrote:
> Author: wblock (doc committer)
> Date: Mon Mar 28 17:42:14 2016
> New Revision: 297357
> URL: https://svnweb.freebsd.org/changeset/base/297357
> 
> Log:
>   Replace "user land", which, for any definition of the word "user",
>   sounds like some kind of horrific theme park.  "Hey kids, want to go to
>   User Land?"  "No!  We'll be good!"

share/man/man4/iscsi_initiator.4:protocol standard, the user land
companion is
share/man/man9/kqueue.9:Using this function could leak user land
resources if a process uses the

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


Re: svn commit: r297356 - head/share/mk

2016-03-28 Thread Konstantin Belousov
On Mon, Mar 28, 2016 at 05:32:31PM +, Warner Losh wrote:
> -# armv6:
> +# armv6: (any arm v7 or v8 processor you are targetting and the arm1176jzf-s)
I think it would be useful to say there
any arm v7 or v8 in aarch32 mode you are targetting ...
>  #arm1176jzf-s, generic-armv7-a, cortex-a5, cortex-a7, cortex-a8,
>  #cortex-a9, cortex-a12, cortex-a15, cortex-a17, cortex-a53, cortex-a57,
>  #cortex-a72, exynos-m1
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297358 - head/sys/net

2016-03-28 Thread George V. Neville-Neil
Author: gnn
Date: Mon Mar 28 18:25:54 2016
New Revision: 297358
URL: https://svnweb.freebsd.org/changeset/base/297358

Log:
  Add ethertype reserved for network testing
  
  MFC after:2 weeks

Modified:
  head/sys/net/ethernet.h

Modified: head/sys/net/ethernet.h
==
--- head/sys/net/ethernet.h Mon Mar 28 17:42:14 2016(r297357)
+++ head/sys/net/ethernet.h Mon Mar 28 18:25:54 2016(r297358)
@@ -333,6 +333,7 @@ struct ether_vlan_header {
 #defineETHERTYPE_SLOW  0x8809  /* 802.3ad link aggregation 
(LACP) */
 #defineETHERTYPE_PPP   0x880B  /* PPP (obsolete by PPPoE) */
 #defineETHERTYPE_HITACHI   0x8820  /* Hitachi Cable 
(Optoelectronic Systems Laboratory) */
+#define ETHERTYPE_TEST 0x8822  /* Network Conformance Testing */
 #defineETHERTYPE_MPLS  0x8847  /* MPLS Unicast */
 #defineETHERTYPE_MPLS_MCAST0x8848  /* MPLS Multicast */
 #defineETHERTYPE_AXIS  0x8856  /* Axis Communications AB 
proprietary bootstrap/config */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r297358 - head/sys/net

2016-03-28 Thread Jonathan T. Looney
On 3/28/16, 2:25 PM, "owner-src-committ...@freebsd.org on behalf of George V. 
Neville-Neil"  
wrote:

>Author: gnn
>Date: Mon Mar 28 18:25:54 2016
>New Revision: 297358
>URL: https://svnweb.freebsd.org/changeset/base/297358
>
>Log:
>  Add ethertype reserved for network testing
>  
>  MFC after:   2 weeks
>
>Modified:
>  head/sys/net/ethernet.h
>
>Modified: head/sys/net/ethernet.h
>==
>--- head/sys/net/ethernet.hMon Mar 28 17:42:14 2016(r297357)
>+++ head/sys/net/ethernet.hMon Mar 28 18:25:54 2016(r297358)
>@@ -333,6 +333,7 @@ struct ether_vlan_header {
> #define   ETHERTYPE_SLOW  0x8809  /* 802.3ad link aggregation 
> (LACP) */
> #define   ETHERTYPE_PPP   0x880B  /* PPP (obsolete by PPPoE) */
> #define   ETHERTYPE_HITACHI   0x8820  /* Hitachi Cable 
> (Optoelectronic Systems Laboratory) */
>+#define ETHERTYPE_TEST0x8822  /* Network Conformance Testing 
>*/
> #define   ETHERTYPE_MPLS  0x8847  /* MPLS Unicast */
> #define   ETHERTYPE_MPLS_MCAST0x8848  /* MPLS Multicast */
> #define   ETHERTYPE_AXIS  0x8856  /* Axis Communications AB 
> proprietary bootstrap/config */

The IEEE registry shows this Ethertype as being allocated to Wind River 
Systems. Do we know that Wind River Systems has further allocated that to be 
used for network conformance testing? If not, I fear we could end up causing 
problems down the road.

Jonathan

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


svn commit: r297359 - head/lib/libkvm

2016-03-28 Thread John Baldwin
Author: jhb
Date: Mon Mar 28 18:41:48 2016
New Revision: 297359
URL: https://svnweb.freebsd.org/changeset/base/297359

Log:
  Fix parsing of a 1GB page table entry.
  
  Use 'pdpe' to extract the PA of the 1GB page instead of 'pde' (which was
  a copy and paste bug from the 2MB page case further down).
  
  CID:  1341467
  Reported by:  pfg

Modified:
  head/lib/libkvm/kvm_amd64.c

Modified: head/lib/libkvm/kvm_amd64.c
==
--- head/lib/libkvm/kvm_amd64.c Mon Mar 28 18:25:54 2016(r297358)
+++ head/lib/libkvm/kvm_amd64.c Mon Mar 28 18:41:48 2016(r297359)
@@ -227,7 +227,7 @@ _amd64_vatop(kvm_t *kd, kvaddr_t va, off
/*
 * No next-level page table; pdpe describes one 1GB page.
 */
-   a = (pde & AMD64_PG_1GB_FRAME) + (va & AMD64_PDPMASK);
+   a = (pdpe & AMD64_PG_1GB_FRAME) + (va & AMD64_PDPMASK);
s = _kvm_pa2off(kd, a, pa);
if (s == 0) {
_kvm_err(kd, kd->program,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r297039 - head/sys/x86/x86

2016-03-28 Thread John Baldwin
On Thursday, March 24, 2016 11:09:17 AM Konstantin Belousov wrote:
> On Wed, Mar 23, 2016 at 02:21:59PM -0700, John Baldwin wrote:
> > As you noted, the issue is if a timecounter needs locks (e.g. i8254) though
> > outside of that I think the patch is great. :-/  Of course, if the TSC
> > isn't advertised as invariant, DELAY() is talking to the timecounter
> > directly as well.
> > 
> > However, I think we probably can use the TSC.  The only specific note I got
> > from Ryan (cc'd) was about the TSC being unstable as a timecounter under 
> > KVM.
> > That doesn't mean that the TSC is non-mononotic on a single vCPU.  In fact,
> > thinking about this more I have a different theory to explain how the TSC
> > can be out of whack on different vCPUs even if the hardware TSC is in sync
> > in the physical CPUs underneath.
> In fact, if we can use TSC with the only requirement of being monotonic,
> I do not see why do we need TSC at all. We can return to pre-r278325
> loop, but calibrate the number of loop iterations for known delay in
> 1us, once on boot.  Do you agree with this ?

Yes, I think this is fine.  What we really want is to be sure the minimum wait
times aren't too low, but we just need to be reasonably close.

> > One of the things present in the VCMS on Intel CPUs using VT-x is a TSC
> > adjustment.  The hypervisor can alter this TSC adjustment during a VM-exit 
> > to
> > alter the offset between the TSC in the guest and the "real" TSC value in 
> > the
> > physical CPU itself.  One way a hypervisor might use this is to try to
> > "pause" the TSC during a VM-exit by taking TSC timestamps at the start and
> > end of a VM-exit and adding that delta to the TSC offset just before each
> > VM-entry.  However, if you have two vCPUs, one of which is running in the
> > guest and one of which is handling a VM-exit in the hypervisor, the TSC on
> > the first vCPU will run while the effective TSC of the second vCPU is 
> > paused.
> > When the second vCPU resumes after a VM-entry, it's TSC will now "unpause",
> > but it will lag the first vCPU by however long it took to handle its 
> > VM-exit.
> > 
> > It wouldn't surprise me if KVM was doing this.  bhyve does not do this to my
> > knowledge (so the TSC is actually still usable as a timecounter under bhyve
> > for some value of "usable").  However, even with this TSC pausing/unpausing,
> > the TSC would still increase monotonically on a single vCPU.  For the 
> > purposes
> > of DELAY() (and other spin loops on a pinned thread such as in
> > lapic_ipi_wait()), that is all you need.
> BTW, Intel exported this mechanism to the non-VT environment as well, on
> recent chips.  So I would be not too surprised if SMM handlers start
> 'compensate' for some long delays in near future.

I think this is more to allow you to keep the TSCs in sync across cores
more sanely by being able to adjust TSC_ADJ instead of trying to time
a write to the TSC to apply an offset (which is racy).  If it was targeted
at SMM, it wouldn't be exposed to the host OS.  I think Intel understands
at this point that OS's want a synchronized TSC on bare metal for "cheap"
timekeeping (at this point the TSC is more about that then about counting
CPU "instructions").

I think your patch later in the thread looks fine.

Most of the worry about older hardware with variable TSC's later in the
thread is becoming less and less relevant.  Intel hasn't shipped a CPU with
a variable TSC in close to a decade now?

Bruce's points about the hardcoded timeouts for things like mutxes are well
founded.  I'm not sure about how best to fix those however.

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


svn commit: r297360 - in head/bin/sh: . tests/builtins

2016-03-28 Thread Jilles Tjoelker
Author: jilles
Date: Mon Mar 28 18:58:40 2016
New Revision: 297360
URL: https://svnweb.freebsd.org/changeset/base/297360

Log:
  sh: Fix use-after-free if a trap replaces itself.
  
  MFC after:1 week

Added:
  head/bin/sh/tests/builtins/trap17.0   (contents, props changed)
Modified:
  head/bin/sh/tests/builtins/Makefile
  head/bin/sh/trap.c

Modified: head/bin/sh/tests/builtins/Makefile
==
--- head/bin/sh/tests/builtins/Makefile Mon Mar 28 18:41:48 2016
(r297359)
+++ head/bin/sh/tests/builtins/Makefile Mon Mar 28 18:58:40 2016
(r297360)
@@ -149,6 +149,7 @@ FILES+= trap13.0
 FILES+=trap14.0
 FILES+=trap15.0
 FILES+=trap16.0
+FILES+=trap17.0
 FILES+=trap2.0
 FILES+=trap3.0
 FILES+=trap4.0

Added: head/bin/sh/tests/builtins/trap17.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/bin/sh/tests/builtins/trap17.0 Mon Mar 28 18:58:40 2016
(r297360)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+# This use-after-free bug probably needs non-default settings to show up.
+
+v1=nothing v2=nothing
+trap 'trap "echo bad" USR1
+v1=trap_received
+v2=trap_invoked
+:' USR1
+kill -USR1 "$$"
+[ "$v1.$v2" = trap_received.trap_invoked ]

Modified: head/bin/sh/trap.c
==
--- head/bin/sh/trap.c  Mon Mar 28 18:41:48 2016(r297359)
+++ head/bin/sh/trap.c  Mon Mar 28 18:58:40 2016(r297360)
@@ -412,6 +412,7 @@ onsig(int signo)
 void
 dotrap(void)
 {
+   struct stackmark smark;
int i;
int savestatus, prev_evalskip, prev_skipcount;
 
@@ -445,7 +446,9 @@ dotrap(void)
 
last_trapsig = i;
savestatus = exitstatus;
-   evalstring(trap[i], 0);
+   setstackmark(&smark);
+   evalstring(stsavestr(trap[i]), 0);
+   popstackmark(&smark);
 
/*
 * If such a command was not
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297361 - head/sys/netinet

2016-03-28 Thread Michael Tuexen
Author: tuexen
Date: Mon Mar 28 19:31:10 2016
New Revision: 297361
URL: https://svnweb.freebsd.org/changeset/base/297361

Log:
  Restrict local addresses until they are acked by the peer.
  
  MFC after: 1 week

Modified:
  head/sys/netinet/sctp_pcb.c

Modified: head/sys/netinet/sctp_pcb.c
==
--- head/sys/netinet/sctp_pcb.c Mon Mar 28 18:58:40 2016(r297360)
+++ head/sys/netinet/sctp_pcb.c Mon Mar 28 19:31:10 2016(r297361)
@@ -5357,6 +5357,7 @@ void
 sctp_add_local_addr_ep(struct sctp_inpcb *inp, struct sctp_ifa *ifa, uint32_t 
action)
 {
struct sctp_laddr *laddr;
+   struct sctp_tcb *stcb;
int fnd, error = 0;
 
fnd = 0;
@@ -5402,6 +5403,9 @@ sctp_add_local_addr_ep(struct sctp_inpcb
default:
break;
}
+   LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
+   sctp_add_local_addr_restricted(stcb, ifa);
+   }
}
return;
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297362 - head/sys/netinet

2016-03-28 Thread Michael Tuexen
Author: tuexen
Date: Mon Mar 28 19:32:13 2016
New Revision: 297362
URL: https://svnweb.freebsd.org/changeset/base/297362

Log:
  Don't allow the user to set a peer primary which is restricted
  and not pending.
  
  MFC after: 1 week

Modified:
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp_usrreq.c
==
--- head/sys/netinet/sctp_usrreq.c  Mon Mar 28 19:31:10 2016
(r297361)
+++ head/sys/netinet/sctp_usrreq.c  Mon Mar 28 19:32:13 2016
(r297362)
@@ -5816,6 +5816,10 @@ sctp_setopt(struct socket *so, int optna
__func__);
continue;
}
+   if 
((sctp_is_addr_restricted(stcb, laddr->ifa)) &&
+   
(!sctp_is_addr_pending(stcb, laddr->ifa))) {
+   continue;
+   }
if (laddr->ifa == ifa) {
found = 1;
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297363 - in head: . sys/conf

2016-03-28 Thread Ed Maste
Author: emaste
Date: Mon Mar 28 19:51:45 2016
New Revision: 297363
URL: https://svnweb.freebsd.org/changeset/base/297363

Log:
  simplify compile-time default keyboard map generation
  
  In r296926 the -P  option was added to kbdcontrol, which enables
  this change for a simplified compile-time default keymap build process.
  
  PR:   193865
  Reviewed by:  Oliver Pinter
  Tested by:Oliver Pinter
  MFC After:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D5708

Modified:
  head/Makefile.inc1
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/conf/files.pc98
  head/sys/conf/files.sparc64

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Mar 28 19:32:13 2016(r297362)
+++ head/Makefile.inc1  Mon Mar 28 19:51:45 2016(r297363)
@@ -1361,6 +1361,11 @@ _crunch= usr.sbin/crunch
 _awk=  usr.bin/awk
 .endif
 
+# r296926 -P keymap search path
+.if ${BOOTSTRAPPING} < 1100103
+_kbdcontrol=   usr.sbin/kbdcontrol
+.endif
+
 _yacc= lib/liby \
usr.bin/yacc
 
@@ -1425,6 +1430,7 @@ bootstrap-tools: .PHONY
 ${_awk} \
 ${_cat} \
 ${_dd} \
+${_kbdcontrol} \
 usr.bin/lorder \
 ${_libopenbsd} \
 ${_makewhatis} \

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Mon Mar 28 19:32:13 2016(r297362)
+++ head/sys/conf/files.amd64   Mon Mar 28 19:51:45 2016(r297363)
@@ -50,12 +50,12 @@ font.h  optional
sc_dflt_font\
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
 #
 atkbdmap.h optionalatkbd_dflt_keymap   \
-   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${ATKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > atkbdmap.h; else echo 
Error: atkbd_dflt_keymap not found; exit 1; fi"\
+   compile-with"kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P 
${S:S/sys$/share/}/syscons/keymaps -L ${ATKBD_DFLT_KEYMAP} | sed -e 's/^static 
keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = 
/static accentmap_t accent_map = /' > atkbdmap.h"   \
no-obj no-implicit-rule before-depend   \
clean   "atkbdmap.h"
 #
 ukbdmap.h  optionalukbd_dflt_keymap\
-   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${UKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${UKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h; else echo 
Error:ukbd_dflt_keymap not found; exit 1; fi" \
+   compile-with"kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P 
${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static 
keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = 
/static accentmap_t accent_map = /' > ukbdmap.h" \
no-obj no-implicit-rule before-depend   \
clean   "ukbdmap.h"
 #

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Mon Mar 28 19:32:13 2016(r297362)
+++ head/sys/conf/files.i386Mon Mar 28 19:51:45 2016(r297363)
@@ -49,12 +49,12 @@ font.h  optional
sc_dflt_font\
clean   "font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 
${SC_DFLT_FONT}-8x8"
 #
 atkbdmap.h optionalatkbd_dflt_keymap   \
-   compile-with"unset KEYMAP_PATH; for kmpath in 
${S:S/sys$/share/}/vt/keymaps ${S:S/sys$/share/}/syscons/keymaps; do 
kmapfile=$${kmpath}/${ATKBD_DFLT_KEYMAP:C/\.kbd$$//}.kbd; if [ -r $${kmapfile} 
]; then KEYMAP_PATH=$${kmpath}; fi; done; if [ X$${KEYMAP_PATH} != X ]; then 
env KEYMAP_PATH=$${KEYMAP_PATH} /usr/sbin/kbdcontrol -L ${ATKBD_DFLT_KEYMAP} | 
sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static 
accentmap_t.* = /static accentmap_t accent_map = /' 

svn commit: r297364 - in head/share/man: man4 man9

2016-03-28 Thread Warren Block
Author: wblock (doc committer)
Date: Mon Mar 28 19:55:30 2016
New Revision: 297364
URL: https://svnweb.freebsd.org/changeset/base/297364

Log:
  Fix two more unhappy instances of "user land".
  
  Submitted by: bdrewery
  MFC after:1 week

Modified:
  head/share/man/man4/iscsi_initiator.4
  head/share/man/man9/kqueue.9

Modified: head/share/man/man4/iscsi_initiator.4
==
--- head/share/man/man4/iscsi_initiator.4   Mon Mar 28 19:51:45 2016
(r297363)
+++ head/share/man/man4/iscsi_initiator.4   Mon Mar 28 19:55:30 2016
(r297364)
@@ -57,7 +57,7 @@ instead.
 The
 .Nm
 implements the kernel side of the Internet SCSI (iSCSI) network
-protocol standard, the user land companion is
+protocol standard, the userland companion is
 .Xr iscontrol 8 ,
 and permits access to remote
 .Em virtual

Modified: head/share/man/man9/kqueue.9
==
--- head/share/man/man9/kqueue.9Mon Mar 28 19:51:45 2016
(r297363)
+++ head/share/man/man9/kqueue.9Mon Mar 28 19:55:30 2016
(r297364)
@@ -372,7 +372,7 @@ The function
 will not be called, and the
 .Vt knote
 will not be returned on the next scan.
-Using this function could leak user land resources if a process uses the
+Using this function could leak userland resources if a process uses the
 .Vt knote
 to track resources.
 .Pp
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297365 - in head/sys: dev/pccard kern sys

2016-03-28 Thread Warner Losh
Author: imp
Date: Mon Mar 28 20:16:29 2016
New Revision: 297365
URL: https://svnweb.freebsd.org/changeset/base/297365

Log:
  Move pccard_safe_quote() up to subr_bus.c and rename to
  devctl_safe_quote() so it can be used more generally.

Modified:
  head/sys/dev/pccard/pccard.c
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/dev/pccard/pccard.c
==
--- head/sys/dev/pccard/pccard.cMon Mar 28 19:55:30 2016
(r297364)
+++ head/sys/dev/pccard/pccard.cMon Mar 28 20:16:29 2016
(r297365)
@@ -1025,26 +1025,6 @@ pccard_child_location_str(device_t bus, 
return (0);
 }
 
-/* XXX Maybe this should be in subr_bus? */
-static void
-pccard_safe_quote(char *dst, const char *src, size_t len)
-{
-   char *walker = dst, *ep = dst + len - 1;
-
-   if (len == 0)
-   return;
-   while (src != NULL && walker < ep)
-   {
-   if (*src == '"') {
-   if (ep - walker < 2)
-   break;
-   *walker++ = '\\';
-   }
-   *walker++ = *src++;
-   }
-   *walker = '\0';
-}
-
 static int
 pccard_child_pnpinfo_str(device_t bus, device_t child, char *buf,
 size_t buflen)
@@ -1054,8 +1034,8 @@ pccard_child_pnpinfo_str(device_t bus, d
struct pccard_softc *sc = PCCARD_SOFTC(bus);
char cis0[128], cis1[128];
 
-   pccard_safe_quote(cis0, sc->card.cis1_info[0], sizeof(cis0));
-   pccard_safe_quote(cis1, sc->card.cis1_info[1], sizeof(cis1));
+   devctl_safe_quote(cis0, sc->card.cis1_info[0], sizeof(cis0));
+   devctl_safe_quote(cis1, sc->card.cis1_info[1], sizeof(cis1));
snprintf(buf, buflen, "manufacturer=0x%04x product=0x%04x "
"cisvendor=\"%s\" cisproduct=\"%s\" function_type=%d",
sc->card.manufacturer, sc->card.product, cis0, cis1, pf->function);

Modified: head/sys/kern/subr_bus.c
==
--- head/sys/kern/subr_bus.cMon Mar 28 19:55:30 2016(r297364)
+++ head/sys/kern/subr_bus.cMon Mar 28 20:16:29 2016(r297365)
@@ -839,6 +839,38 @@ sysctl_devctl_queue(SYSCTL_HANDLER_ARGS)
return (0);
 }
 
+/**
+ * @brief safely quotes strings that might have double quotes in them.
+ *
+ * The devctl protocol relies on quoted strings having matching quotes.
+ * This routine quotes any internal quotes so the resulting string
+ * is safe to pass to snprintf to construct, for example pnp info strings.
+ * Strings are always terminated with a NUL, but may be truncated if longer
+ * than @p len bytes after quotes.
+ *
+ * @param dst  Buffer to hold the string. Must be at least @p len bytes long
+ * @param src  Original buffer.
+ * @param len  Length of buffer pointed to by @dst, including trailing NUL
+ */
+void
+devctl_safe_quote(char *dst, const char *src, size_t len)
+{
+   char *walker = dst, *ep = dst + len - 1;
+
+   if (len == 0)
+   return;
+   while (src != NULL && walker < ep)
+   {
+   if (*src == '"') {
+   if (ep - walker < 2)
+   break;
+   *walker++ = '\\';
+   }
+   *walker++ = *src++;
+   }
+   *walker = '\0';
+}
+
 /* End of /dev/devctl code */
 
 static TAILQ_HEAD(,device) bus_data_devices;

Modified: head/sys/sys/bus.h
==
--- head/sys/sys/bus.h  Mon Mar 28 19:55:30 2016(r297364)
+++ head/sys/sys/bus.h  Mon Mar 28 20:16:29 2016(r297365)
@@ -141,6 +141,7 @@ void devctl_notify(const char *__system,
 const char *__type, const char *__data);
 void devctl_queue_data_f(char *__data, int __flags);
 void devctl_queue_data(char *__data);
+void devctl_safe_quote(char *__dst, const char *__src, size_t len);
 
 /**
  * Device name parsers.  Hook to allow device enumerators to map
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r297357 - head/share/man/man7

2016-03-28 Thread Warren Block

On Mon, 28 Mar 2016, Bryan Drewery wrote:


On 3/28/16 10:42 AM, Warren Block wrote:

Author: wblock (doc committer)
Date: Mon Mar 28 17:42:14 2016
New Revision: 297357
URL: https://svnweb.freebsd.org/changeset/base/297357

Log:
  Replace "user land", which, for any definition of the word "user",
  sounds like some kind of horrific theme park.  "Hey kids, want to go to
  User Land?"  "No!  We'll be good!"


share/man/man4/iscsi_initiator.4:protocol standard, the user land
companion is
share/man/man9/kqueue.9:Using this function could leak user land
resources if a process uses the


Fixed in r297364:
https://svnweb.freebsd.org/base?view=revision&revision=297364

Remaining instances appear to only be in source file comments or plain 
text files:


  find -X . -not -path "./.svn/*" -print | xargs grep -Hi 'user land' \
| cut -c 1-70
  ./cddl/contrib/dtracetoolkit/Notes/ALLoverhead.txt:  then perhaps this
  ./lib/libc/rpc/svc.c: * The storage is trivially management on the cal
  ./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c: * user l
  ./sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c: * (curr
  ./sys/contrib/ipfilter/netinet/fil.c:/* compatible at the ABI for user
  ./sys/contrib/ipfilter/netinet/fil.c:/* it backward  compatible at the
  ./sys/dev/atkbdc/psm.c:   /* copy data to the user land */
  ./sys/dev/atkbdc/psm.c:   /* copy data from the user land */
  ./sys/fs/ext2fs/ext2fs.h: * macros from user land. */
  ./sys/gnu/fs/reiserfs/reiserfs_namei.c:   /* Copy to user land */
  ./sys/gnu/fs/reiserfs/reiserfs_namei.c: reiserfs_log(LOG_DEBUG, "
  ./sys/netinet/sctp.h: * Main SCTP chunk types we place these here so n
  ./sys/netinet6/raw_ip6.c: * Send RA/RS messages to user land for prot
  ./sys/netinet6/in6_var.h: * user land command(ifconfig) and daemon(rta
  ./sys/netipsec/key.c: * from a user land process, and return
  ./sys/netipsec/key.c:  * This message is from user land.
  ./sys/netipsec/key.c: * application in user land.
  ./sys/netipsec/key.c: * a waiting application in user land.
  ./sys/netpfil/ipfw/dummynet.txt:The dummynet user land will format the

The contrib software is usually better fixed by submitting upstream. 
Fixing the homegrown stuff would remove more than half of these.

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


svn commit: r297366 - head/sys/dev/random

2016-03-28 Thread John Baldwin
Author: jhb
Date: Mon Mar 28 21:51:56 2016
New Revision: 297366
URL: https://svnweb.freebsd.org/changeset/base/297366

Log:
  Don't start the random harvester process until timers are working.
  
  This is a no-op currently, but in kernels with earlier AP startup, the
  random kthread was trying to use timeouts with sleeps before timers are
  working.  Wait until SI_SUB_KICK_SCHEDULER to start the random kproc.
  
  Reviewed by:  delphij, imp, markm
  Approved by:  so
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D5712

Modified:
  head/sys/dev/random/random_harvestq.c

Modified: head/sys/dev/random/random_harvestq.c
==
--- head/sys/dev/random/random_harvestq.c   Mon Mar 28 20:16:29 2016
(r297365)
+++ head/sys/dev/random/random_harvestq.c   Mon Mar 28 21:51:56 2016
(r297366)
@@ -183,7 +183,8 @@ random_kthread(void)
/* NOTREACHED */
 }
 /* This happens well after SI_SUB_RANDOM */
-SYSINIT(random_device_h_proc, SI_SUB_CREATE_INIT, SI_ORDER_ANY, kproc_start, 
&random_proc_kp);
+SYSINIT(random_device_h_proc, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, kproc_start,
+&random_proc_kp);
 
 /*
  * Run through all fast sources reading entropy for the given
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297367 - head/sys/kern

2016-03-28 Thread Jamie Gritton
Author: jamie
Date: Mon Mar 28 22:18:37 2016
New Revision: 297367
URL: https://svnweb.freebsd.org/changeset/base/297367

Log:
  Move the various per-type arrays of OSD data into a single structure array.

Modified:
  head/sys/kern/kern_osd.c

Modified: head/sys/kern/kern_osd.c
==
--- head/sys/kern/kern_osd.cMon Mar 28 21:51:56 2016(r297366)
+++ head/sys/kern/kern_osd.cMon Mar 28 22:18:37 2016(r297367)
@@ -44,6 +44,23 @@ __FBSDID("$FreeBSD$");
 
 /* OSD (Object Specific Data) */
 
+/*
+ * Lock key:
+ *  (m) osd_module_lock
+ *  (o) osd_object_lock
+ *  (l) osd_list_lock
+ */
+struct osd_master {
+   struct sxosd_module_lock;
+   struct rmlockosd_object_lock;
+   struct mtx   osd_list_lock;
+   LIST_HEAD(, osd) osd_list;  /* (m) */
+   osd_destructor_t*osd_destructors;   /* (o) */
+   osd_method_t*osd_methods;   /* (m) */
+   u_intosd_ntslots;   /* (m) */
+   const u_int  osd_nmethods;
+};
+
 static MALLOC_DEFINE(M_OSD, "osd", "Object Specific Data");
 
 static int osd_debug = 0;
@@ -61,25 +78,12 @@ static void do_osd_del(u_int type, struc
 int list_locked);
 
 /*
- * Lists of objects with OSD.
- *
- * Lock key:
- *  (m) osd_module_lock
- *  (o) osd_object_lock
- *  (l) osd_list_lock
+ * List of objects with OSD.
  */
-static LIST_HEAD(, osd)osd_list[OSD_LAST + 1]; /* (m) */
-static osd_method_t *osd_methods[OSD_LAST + 1];/* (m) */
-static u_int osd_nslots[OSD_LAST + 1]; /* (m) */
-static osd_destructor_t *osd_destructors[OSD_LAST + 1];/* (o) */
-static const u_int osd_nmethods[OSD_LAST + 1] = {
-   [OSD_JAIL] = PR_MAXMETHOD,
+struct osd_master osdm[OSD_LAST + 1] = {
+   [OSD_JAIL] = { .osd_nmethods = PR_MAXMETHOD },
 };
 
-static struct sx osd_module_lock[OSD_LAST + 1];
-static struct rmlock osd_object_lock[OSD_LAST + 1];
-static struct mtx osd_list_lock[OSD_LAST + 1];
-
 static void
 osd_default_destructor(void *value __unused)
 {
@@ -101,12 +105,12 @@ osd_register(u_int type, osd_destructor_
if (destructor == NULL)
destructor = osd_default_destructor;
 
-   sx_xlock(&osd_module_lock[type]);
+   sx_xlock(&osdm[type].osd_module_lock);
/*
 * First, we try to find unused slot.
 */
-   for (i = 0; i < osd_nslots[type]; i++) {
-   if (osd_destructors[type][i] == NULL) {
+   for (i = 0; i < osdm[type].osd_ntslots; i++) {
+   if (osdm[type].osd_destructors[i] == NULL) {
OSD_DEBUG("Unused slot found (type=%u, slot=%u).",
type, i);
break;
@@ -115,31 +119,31 @@ osd_register(u_int type, osd_destructor_
/*
 * If no unused slot was found, allocate one.
 */
-   if (i == osd_nslots[type]) {
-   osd_nslots[type]++;
-   if (osd_nmethods[type] != 0)
-   osd_methods[type] = realloc(osd_methods[type],
-   sizeof(osd_method_t) * osd_nslots[type] *
-   osd_nmethods[type], M_OSD, M_WAITOK);
-   newptr = malloc(sizeof(osd_destructor_t) * osd_nslots[type],
-   M_OSD, M_WAITOK);
-   rm_wlock(&osd_object_lock[type]);
-   bcopy(osd_destructors[type], newptr,
+   if (i == osdm[type].osd_ntslots) {
+   osdm[type].osd_ntslots++;
+   if (osdm[type].osd_nmethods != 0)
+   osdm[type].osd_methods = realloc(osdm[type].osd_methods,
+   sizeof(osd_method_t) * osdm[type].osd_ntslots *
+   osdm[type].osd_nmethods, M_OSD, M_WAITOK);
+   newptr = malloc(sizeof(osd_destructor_t) *
+   osdm[type].osd_ntslots, M_OSD, M_WAITOK);
+   rm_wlock(&osdm[type].osd_object_lock);
+   bcopy(osdm[type].osd_destructors, newptr,
sizeof(osd_destructor_t) * i);
-   free(osd_destructors[type], M_OSD);
-   osd_destructors[type] = newptr;
-   rm_wunlock(&osd_object_lock[type]);
+   free(osdm[type].osd_destructors, M_OSD);
+   osdm[type].osd_destructors = newptr;
+   rm_wunlock(&osdm[type].osd_object_lock);
OSD_DEBUG("New slot allocated (type=%u, slot=%u).",
type, i + 1);
}
 
-   osd_destructors[type][i] = destructor;
-   if (osd_nmethods[type] != 0) {
-   for (m = 0; m < osd_nmethods[type]; m++)
-   osd_methods[type][i * osd_nmethods[type] + m] =
-   methods != NULL ? methods[m] : NULL;
+   osdm[type].osd_destructors[i] = destructor;
+   if (osdm[type].osd_nmethods

Re: svn commit: r297358 - head/sys/net

2016-03-28 Thread George Neville-Neil



On 28 Mar 2016, at 14:36, Jonathan T. Looney wrote:

On 3/28/16, 2:25 PM, "owner-src-committ...@freebsd.org on behalf of 
George V. Neville-Neil" g...@freebsd.org> wrote:



Author: gnn
Date: Mon Mar 28 18:25:54 2016
New Revision: 297358
URL: https://svnweb.freebsd.org/changeset/base/297358

Log:
 Add ethertype reserved for network testing

 MFC after: 2 weeks

Modified:
 head/sys/net/ethernet.h

Modified: head/sys/net/ethernet.h
==
--- head/sys/net/ethernet.h Mon Mar 28 17:42:14 2016(r297357)
+++ head/sys/net/ethernet.h Mon Mar 28 18:25:54 2016(r297358)
@@ -333,6 +333,7 @@ struct ether_vlan_header {
#define ETHERTYPE_SLOW  0x8809  /* 802.3ad link aggregation (LACP) */
#define ETHERTYPE_PPP   0x880B  /* PPP (obsolete by PPPoE) */
#define	ETHERTYPE_HITACHI	0x8820	/* Hitachi Cable (Optoelectronic 
Systems Laboratory) */

+#define ETHERTYPE_TEST 0x8822  /* Network Conformance Testing */
#define ETHERTYPE_MPLS  0x8847  /* MPLS Unicast */
#define ETHERTYPE_MPLS_MCAST0x8848  /* MPLS Multicast */
#define	ETHERTYPE_AXIS		0x8856	/* Axis Communications AB proprietary 
bootstrap/config */


The IEEE registry shows this Ethertype as being allocated to Wind 
River Systems. Do we know that Wind River Systems has further 
allocated that to be used for network conformance testing? If not, I 
fear we could end up causing problems down the road.


Guess who worked at Wind River and got that allocated :-)

I am going to dig through my old mail archives from WR days and get the 
IEEE to move it, since, clearly, not one kept the thing up after I left. 
 That address is over a decade out of date, and Wind River no longer 
exists, as Intel bought them several years ago.


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


svn commit: r297368 - head/sys/dev/cxgbe/iw_cxgbe

2016-03-28 Thread Navdeep Parhar
Author: np
Date: Tue Mar 29 00:10:47 2016
New Revision: 297368
URL: https://svnweb.freebsd.org/changeset/base/297368

Log:
  cxgbe/iw_cxgbe: Fix for stray "start_ep_timer timer already started!"
  messages.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/iw_cxgbe/cm.c

Modified: head/sys/dev/cxgbe/iw_cxgbe/cm.c
==
--- head/sys/dev/cxgbe/iw_cxgbe/cm.cMon Mar 28 22:18:37 2016
(r297367)
+++ head/sys/dev/cxgbe/iw_cxgbe/cm.cTue Mar 29 00:10:47 2016
(r297368)
@@ -1855,6 +1855,7 @@ process_mpa_request(struct c4iw_ep *ep)
ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version);
 
state_set(&ep->com, MPA_REQ_RCVD);
+   STOP_EP_TIMER(ep);
 
/* drive upcall */
mutex_lock(&ep->parent_ep->com.mutex);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r297358 - head/sys/net

2016-03-28 Thread Jonathan T. Looney
On 3/28/16, 7:05 PM, "George Neville-Neil"  wrote:

>On 28 Mar 2016, at 14:36, Jonathan T. Looney wrote:
>
>>The IEEE registry shows this Ethertype as being allocated to Wind
>> River Systems. Do we know that Wind River Systems has further 
>> allocated that to be used for network conformance testing? If not, I 
>> fear we could end up causing problems down the road.
>
>Guess who worked at Wind River and got that allocated :-)
>
>I am going to dig through my old mail archives from WR days and get the 
>IEEE to move it, since, clearly, not one kept the thing up after I left. 
>  That address is over a decade out of date, and Wind River no longer 
>exists, as Intel bought them several years ago.

Thanks for answering my question!

I think its a great idea that *someone* allocated this. Its too bad IEEE didn't 
do it themselves, but I'm glad someone did.

Jonathan

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


svn commit: r297369 - head/sys/contrib/rdma/krping

2016-03-28 Thread Navdeep Parhar
Author: np
Date: Tue Mar 29 01:41:07 2016
New Revision: 297369
URL: https://svnweb.freebsd.org/changeset/base/297369

Log:
  krping wasn't designed to take more than one client.  Fail any connect
  requests if cb->state is not IDLE.
  
  Submitted by: Krishnamraju Eraparaju @ Chelsio
  Reviewed by:  Steve Wise @ Open Grid Computing
  Sponsored by: Chelsio Communications

Modified:
  head/sys/contrib/rdma/krping/krping.c

Modified: head/sys/contrib/rdma/krping/krping.c
==
--- head/sys/contrib/rdma/krping/krping.c   Tue Mar 29 00:10:47 2016
(r297368)
+++ head/sys/contrib/rdma/krping/krping.c   Tue Mar 29 01:41:07 2016
(r297369)
@@ -266,8 +266,13 @@ static int krping_cma_event_handler(stru
break;
 
case RDMA_CM_EVENT_CONNECT_REQUEST:
-   cb->state = CONNECT_REQUEST;
-   cb->child_cm_id = cma_id;
+   if (cb->state == IDLE) {
+   cb->state = CONNECT_REQUEST;
+   cb->child_cm_id = cma_id;
+   } else {
+   PRINTF(cb, "Received connection request in wrong state"
+   " (%d)\n", cb->state);
+   }
DEBUG_LOG(cb, "child cma %p\n", cb->child_cm_id);
wake_up_interruptible(&cb->sem);
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r297370 - in head/sys/cam: ata scsi

2016-03-28 Thread Jean-Sébastien Pédron
Author: dumbbell
Date: Tue Mar 29 06:56:46 2016
New Revision: 297370
URL: https://svnweb.freebsd.org/changeset/base/297370

Log:
  CAM: Generalize 4k quirk to all Samsung MZ7* SSDs
  
  This adds Samsung PM851 to the list. It can be found in Lenovo Thinkpad
  T440 for instance.
  
  Reviewed by:  Kevin Bowling ,
Jason Wolfe 
  Approved by:  Kevin Bowling ,
Jason Wolfe 
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D5753

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Tue Mar 29 01:41:07 2016(r297369)
+++ head/sys/cam/ata/ata_da.c   Tue Mar 29 06:56:46 2016(r297370)
@@ -466,14 +466,6 @@ static struct ada_quirk_entry ada_quirk_
},
{
/*
-* Samsung 843T Series SSDs
-* 4k optimised
-*/
-   { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7WD*", "*" },
-   /*quirks*/ADA_Q_4K
-   },
-   {
-   /*
 * Samsung 850 SSDs
 * 4k optimised
 */
@@ -482,18 +474,13 @@ static struct ada_quirk_entry ada_quirk_
},
{
/*
-* Samsung PM853T Series SSDs
-* 4k optimised
-*/
-   { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7GE*", "*" },
-   /*quirks*/ADA_Q_4K
-   },
-   {
-   /*
-* Samsung SM863 Series SSDs
+* Samsung 843T Series SSDs (MZ7WD*)
+* Samsung PM851 Series SSDs (MZ7TE*)
+* Samsung PM853T Series SSDs (MZ7GE*)
+* Samsung SM863 Series SSDs (MZ7KM*)
 * 4k optimised
 */
-   { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7KM*", "*" },
+   { T_DIRECT, SIP_MEDIA_FIXED, "*", "SAMSUNG MZ7*", "*" },
/*quirks*/ADA_Q_4K
},
{

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Tue Mar 29 01:41:07 2016(r297369)
+++ head/sys/cam/scsi/scsi_da.c Tue Mar 29 06:56:46 2016(r297370)
@@ -1138,14 +1138,6 @@ static struct da_quirk_entry da_quirk_ta
},
{
/*
-* Samsung 843T Series SSDs
-* 4k optimised
-*/
-   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7WD*", "*" },
-   /*quirks*/DA_Q_4K
-   },
-   {
-   /*
 * Samsung 850 SSDs
 * 4k optimised & trim only works in 4k requests + 4k aligned
 */
@@ -1154,18 +1146,13 @@ static struct da_quirk_entry da_quirk_ta
},
{
/*
-* Samsung PM853T Series SSDs
-* 4k optimised
-*/
-   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7GE*", "*" },
-   /*quirks*/DA_Q_4K
-   },
-   {
-   /*
-* Samsung SM863 Series SSDs
+* Samsung 843T Series SSDs (MZ7WD*)
+* Samsung PM851 Series SSDs (MZ7TE*)
+* Samsung PM853T Series SSDs (MZ7GE*)
+* Samsung SM863 Series SSDs (MZ7KM*)
 * 4k optimised
 */
-   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7KM*", "*" },
+   { T_DIRECT, SIP_MEDIA_FIXED, "ATA", "SAMSUNG MZ7*", "*" },
/*quirks*/DA_Q_4K
},
{
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"