svn commit: r304140 - in head/sys/arm64: arm64 include

2016-08-15 Thread Andrew Turner
Author: andrew
Date: Mon Aug 15 09:23:08 2016
New Revision: 304140
URL: https://svnweb.freebsd.org/changeset/base/304140

Log:
  Add the ARMv8.1 identification registers to the list we print when booting.
  
  MFC after:1 week
  Sponsored by: ABT Systems Ltd

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Mon Aug 15 09:19:26 2016
(r304139)
+++ head/sys/arm64/arm64/identcpu.c Mon Aug 15 09:23:08 2016
(r304140)
@@ -188,6 +188,27 @@ print_cpu_features(u_int cpu)
if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_ISAR0) != 0) {
printed = 0;
printf(" Instruction Set Attributes 0 = <");
+
+   switch (ID_AA64ISAR0_RDM(cpu_desc[cpu].id_aa64isar0)) {
+   case ID_AA64ISAR0_RDM_NONE:
+   break;
+   case ID_AA64ISAR0_RDM_IMPL:
+   printf("%sRDM", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown RDM", SEP_STR);
+   }
+
+   switch (ID_AA64ISAR0_ATOMIC(cpu_desc[cpu].id_aa64isar0)) {
+   case ID_AA64ISAR0_ATOMIC_NONE:
+   break;
+   case ID_AA64ISAR0_ATOMIC_IMPL:
+   printf("%sAtomic", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown Atomic", SEP_STR);
+   }
+
switch (ID_AA64ISAR0_AES(cpu_desc[cpu].id_aa64isar0)) {
case ID_AA64ISAR0_AES_NONE:
break;
@@ -466,8 +487,82 @@ print_cpu_features(u_int cpu)
 
/* AArch64 Memory Model Feature Register 1 */
if (cpu == 0 || (cpu_print_regs & PRINT_ID_AA64_MMFR1) != 0) {
-   printf("  Memory Model Features 1 = <%#lx>\n",
-   cpu_desc[cpu].id_aa64mmfr1);
+   printed = 0;
+   printf("  Memory Model Features 1 = <");
+
+   switch (ID_AA64MMFR1_PAN(cpu_desc[cpu].id_aa64mmfr1)) {
+   case ID_AA64MMFR1_PAN_NONE:
+   break;
+   case ID_AA64MMFR1_PAN_IMPL:
+   printf("%sPAN", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown PAN", SEP_STR);
+   break;
+   }
+
+   switch (ID_AA64MMFR1_LO(cpu_desc[cpu].id_aa64mmfr1)) {
+   case ID_AA64MMFR1_LO_NONE:
+   break;
+   case ID_AA64MMFR1_LO_IMPL:
+   printf("%sLO", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown LO", SEP_STR);
+   break;
+   }
+
+   switch (ID_AA64MMFR1_HPDS(cpu_desc[cpu].id_aa64mmfr1)) {
+   case ID_AA64MMFR1_HPDS_NONE:
+   break;
+   case ID_AA64MMFR1_HPDS_IMPL:
+   printf("%sHPDS", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown HPDS", SEP_STR);
+   break;
+   }
+
+   switch (ID_AA64MMFR1_VH(cpu_desc[cpu].id_aa64mmfr1)) {
+   case ID_AA64MMFR1_VH_NONE:
+   break;
+   case ID_AA64MMFR1_VH_IMPL:
+   printf("%sVHE", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown VHE", SEP_STR);
+   break;
+   }
+
+   switch (ID_AA64MMFR1_VMIDBITS(cpu_desc[cpu].id_aa64mmfr1)) {
+   case ID_AA64MMFR1_VMIDBITS_8:
+   break;
+   case ID_AA64MMFR1_VMIDBITS_16:
+   printf("%s16 VMID bits", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown VMID bits", SEP_STR);
+   break;
+   }
+
+   switch (ID_AA64MMFR1_HAFDBS(cpu_desc[cpu].id_aa64mmfr1)) {
+   case ID_AA64MMFR1_HAFDBS_NONE:
+   break;
+   case ID_AA64MMFR1_HAFDBS_AF:
+   printf("%sAF", SEP_STR);
+   break;
+   case ID_AA64MMFR1_HAFDBS_AF_DBS:
+   printf("%sAF+DBS", SEP_STR);
+   break;
+   default:
+   printf("%sUnknown Hardware update AF/DBS", SEP_STR);
+   break;
+   }
+
+   if ((cpu_desc[cpu].id_aa64mmfr1 & ~ID_AA64MMFR1_MASK) != 0)
+   printf("%s%#lx", SEP_STR,
+   cpu_desc[cpu].id_aa64mmfr1 & ~ID_AA64MMFR1_MASK);
+   printf(">\n");
  

Re: svn commit: r303019 - head/sys/geom

2016-08-15 Thread Bryan Drewery
On 8/13/16 5:45 AM, Warner Losh wrote:
> On Fri, Aug 12, 2016 at 3:06 PM, Ngie Cooper  wrote:
>> On Fri, Aug 12, 2016 at 8:23 AM, Bryan Drewery  wrote:
>>
>> ...
>>
>>> No, I was missing r303637.  Hard to say if it is related... Andrey says
>>> it's not.  I haven't dived into it yet and it's so far only happened
>>> once (out of a few tests).  We do have various customizations but I'm
>>> inclined to think it's the stock code having problems.
>>
>> I hit it again on our internal vendor tree (what bdrewery was noting
>> previously). I can provide some details about the panic if need be.
> 
> Ideally, you'd reproduce it on an unmodified -current. In a vendor tree 
> there's
> many chances that something else is odd or off that would make it hard for
> the community to help.
> 
> Warner
> 

#4  0x80477b82 in g_resize_provider_event
(arg=0xf80007f8d3a0, flag=) at
/b/mnt/src/sys/geom/geom_subr.c:668
668 KASSERT(!(pp->flags & G_PF_WITHER),
(gdb) p pp->mediasize
$2 = 0

It seems that r303637 really does cover the panic we're hitting since
the g_resize_provider_event was posted with mediasize==0 which r303637
avoids.

-- 
Regards,
Bryan Drewery



signature.asc
Description: OpenPGP digital signature


svn commit: r304142 - head/usr.sbin/bsdinstall/partedit

2016-08-15 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Aug 15 09:30:21 2016
New Revision: 304142
URL: https://svnweb.freebsd.org/changeset/base/304142

Log:
  Ensure that the sector size is a multiple of 4096 to avoid creating
  unaligned partitions when the actual sector size is hidden from us.
  
  PR:   211361
  MFC after:3 days

Modified:
  head/usr.sbin/bsdinstall/partedit/gpart_ops.c

Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Mon Aug 15 09:27:15 
2016(r304141)
+++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Mon Aug 15 09:30:21 
2016(r304142)
@@ -795,6 +795,7 @@ gpart_max_free(struct ggeom *geom, intma
 {
struct gconfig *gc;
struct gprovider *pp, **providers;
+   intmax_t sectorsize, stripesize, offset;
intmax_t lastend;
intmax_t start, end;
intmax_t maxsize, maxstart;
@@ -845,12 +846,25 @@ gpart_max_free(struct ggeom *geom, intma
 
pp = LIST_FIRST(&geom->lg_consumer)->lg_provider;
 
-   /* Compute beginning of new partition and maximum available space */
-   if (pp->lg_stripesize > 0 &&
-   (maxstart*pp->lg_sectorsize % pp->lg_stripesize) != 0) {
-   intmax_t offset = (pp->lg_stripesize -
-   ((maxstart*pp->lg_sectorsize) % pp->lg_stripesize)) /
-   pp->lg_sectorsize;
+   /*
+* Round the start and size of the largest available space up to
+* the nearest multiple of the adjusted stripe size.
+*
+* The adjusted stripe size is the least common multiple of the
+* actual stripe size, or the sector size if no stripe size was
+* reported, and 4096.  The reason for this is that contemporary
+* disks often have 4096-byte physical sectors but report 512
+* bytes instead for compatibility with older / broken operating
+* systems and BIOSes.  For the same reasons, virtualized storage
+* may also report a 512-byte stripe size, or none at all.
+*/
+   sectorsize = pp->lg_sectorsize;
+   if ((stripesize = pp->lg_stripesize) == 0)
+   stripesize = sectorsize;
+   while (stripesize % 4096 != 0)
+   stripesize *= 2;
+   if ((offset = maxstart * sectorsize % stripesize) != 0) {
+   offset = (stripesize - offset) / sectorsize;
maxstart += offset;
maxsize -= offset;
}
___
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: r304146 - head/sys/netinet

2016-08-15 Thread Michael Tuexen
Author: tuexen
Date: Mon Aug 15 10:16:08 2016
New Revision: 304146
URL: https://svnweb.freebsd.org/changeset/base/304146

Log:
  Ensure that sctp_it_ctl.cur_it does not point to a free object (during
  a small time window).
  Thanks to Byron Campen for reporting the issue and
  suggesting a fix.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctputil.c

Modified: head/sys/netinet/sctputil.c
==
--- head/sys/netinet/sctputil.c Mon Aug 15 09:39:26 2016(r304145)
+++ head/sys/netinet/sctputil.c Mon Aug 15 10:16:08 2016(r304146)
@@ -1280,6 +1280,7 @@ sctp_iterator_work(struct sctp_iterator 
 
SCTP_INP_INFO_RLOCK();
SCTP_ITERATOR_LOCK();
+   sctp_it_ctl.cur_it = it;
if (it->inp) {
SCTP_INP_RLOCK(it->inp);
SCTP_INP_DECR_REF(it->inp);
@@ -1287,6 +1288,7 @@ sctp_iterator_work(struct sctp_iterator 
if (it->inp == NULL) {
/* iterator is complete */
 done_with_iterator:
+   sctp_it_ctl.cur_it = NULL;
SCTP_ITERATOR_UNLOCK();
SCTP_INP_INFO_RUNLOCK();
if (it->function_atend != NULL) {
@@ -1427,13 +1429,11 @@ sctp_iterator_worker(void)
 
sctp_it_ctl.iterator_running = 1;
TAILQ_FOREACH_SAFE(it, &sctp_it_ctl.iteratorhead, sctp_nxt_itr, nit) {
-   sctp_it_ctl.cur_it = it;
/* now lets work on this one */
TAILQ_REMOVE(&sctp_it_ctl.iteratorhead, it, sctp_nxt_itr);
SCTP_IPI_ITERATOR_WQ_UNLOCK();
CURVNET_SET(it->vn);
sctp_iterator_work(it);
-   sctp_it_ctl.cur_it = NULL;
CURVNET_RESTORE();
SCTP_IPI_ITERATOR_WQ_LOCK();
/* sa_ignore FREED_MEMORY */
___
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: r304147 - head/sys/i386/include

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 10:46:33 2016
New Revision: 304147
URL: https://svnweb.freebsd.org/changeset/base/304147

Log:
  Remove duplicate definition of get_pcb_td().  gcc works for detecting
  this error.

Modified:
  head/sys/i386/include/md_var.h

Modified: head/sys/i386/include/md_var.h
==
--- head/sys/i386/include/md_var.h  Mon Aug 15 10:16:08 2016
(r304146)
+++ head/sys/i386/include/md_var.h  Mon Aug 15 10:46:33 2016
(r304147)
@@ -69,6 +69,5 @@ void  ppro_reenable_apic(void);
 void   setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int selec);
 union savefpu *get_pcb_user_save_td(struct thread *td);
 union savefpu *get_pcb_user_save_pcb(struct pcb *pcb);
-struct pcb *get_pcb_td(struct thread *td);
 
 #endif /* !_MACHINE_MD_VAR_H_ */
___
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: r304149 - head/sys/dev/e1000

2016-08-15 Thread Sean Bruno
Author: sbruno
Date: Mon Aug 15 11:24:30 2016
New Revision: 304149
URL: https://svnweb.freebsd.org/changeset/base/304149

Log:
  e1000:  Add support for Kaby Lake IDs
  
  Fixup some errors when transitioning to/from low power states.
  
  Submitted by: erj
  Reviewed by:  Jeffery Piper (jeffrey.e.pi...@intel.com)
  MFC after:3 days
  Relnotes: yes
  Sponsored by: Intel Corporation
  Differential Revision:https://reviews.freebsd.org/D7478

Modified:
  head/sys/dev/e1000/e1000_api.c
  head/sys/dev/e1000/e1000_hw.h
  head/sys/dev/e1000/e1000_ich8lan.c
  head/sys/dev/e1000/e1000_ich8lan.h
  head/sys/dev/e1000/e1000_phy.c
  head/sys/dev/e1000/if_em.c

Modified: head/sys/dev/e1000/e1000_api.c
==
--- head/sys/dev/e1000/e1000_api.c  Mon Aug 15 11:16:43 2016
(r304148)
+++ head/sys/dev/e1000/e1000_api.c  Mon Aug 15 11:24:30 2016
(r304149)
@@ -304,6 +304,10 @@ s32 e1000_set_mac_type(struct e1000_hw *
case E1000_DEV_ID_PCH_SPT_I219_LM2:
case E1000_DEV_ID_PCH_SPT_I219_V2:
case E1000_DEV_ID_PCH_LBG_I219_LM3:
+   case E1000_DEV_ID_PCH_SPT_I219_LM4:
+   case E1000_DEV_ID_PCH_SPT_I219_V4:
+   case E1000_DEV_ID_PCH_SPT_I219_LM5:
+   case E1000_DEV_ID_PCH_SPT_I219_V5:
mac->type = e1000_pch_spt;
break;
case E1000_DEV_ID_82575EB_COPPER:

Modified: head/sys/dev/e1000/e1000_hw.h
==
--- head/sys/dev/e1000/e1000_hw.h   Mon Aug 15 11:16:43 2016
(r304148)
+++ head/sys/dev/e1000/e1000_hw.h   Mon Aug 15 11:24:30 2016
(r304149)
@@ -142,6 +142,10 @@ struct e1000_hw;
 #define E1000_DEV_ID_PCH_SPT_I219_LM2  0x15B7 /* Sunrise Point-H PCH */
 #define E1000_DEV_ID_PCH_SPT_I219_V2   0x15B8 /* Sunrise Point-H PCH */
 #define E1000_DEV_ID_PCH_LBG_I219_LM3  0x15B9 /* LEWISBURG PCH */
+#define E1000_DEV_ID_PCH_SPT_I219_LM4  0x15D7
+#define E1000_DEV_ID_PCH_SPT_I219_V4   0x15D8
+#define E1000_DEV_ID_PCH_SPT_I219_LM5  0x15E3
+#define E1000_DEV_ID_PCH_SPT_I219_V5   0x15D6
 #define E1000_DEV_ID_82576 0x10C9
 #define E1000_DEV_ID_82576_FIBER   0x10E6
 #define E1000_DEV_ID_82576_SERDES  0x10E7
@@ -957,9 +961,13 @@ struct e1000_dev_spec_ich8lan {
E1000_MUTEX nvm_mutex;
E1000_MUTEX swflag_mutex;
bool nvm_k1_enabled;
+   bool disable_k1_off;
bool eee_disable;
u16 eee_lp_ability;
enum e1000_ulp_state ulp_state;
+   bool ulp_capability_disabled;
+   bool during_suspend_flow;
+   bool during_dpg_exit;
 };
 
 struct e1000_dev_spec_82575 {

Modified: head/sys/dev/e1000/e1000_ich8lan.c
==
--- head/sys/dev/e1000/e1000_ich8lan.c  Mon Aug 15 11:16:43 2016
(r304148)
+++ head/sys/dev/e1000/e1000_ich8lan.c  Mon Aug 15 11:24:30 2016
(r304149)
@@ -288,7 +288,7 @@ static void e1000_toggle_lanphypc_pch_lp
mac_reg &= ~E1000_CTRL_LANPHYPC_VALUE;
E1000_WRITE_REG(hw, E1000_CTRL, mac_reg);
E1000_WRITE_FLUSH(hw);
-   usec_delay(10);
+   msec_delay(1);
mac_reg &= ~E1000_CTRL_LANPHYPC_OVERRIDE;
E1000_WRITE_REG(hw, E1000_CTRL, mac_reg);
E1000_WRITE_FLUSH(hw);
@@ -1625,7 +1625,17 @@ static s32 e1000_check_for_copper_link_i
hw->phy.ops.write_reg_locked(hw,
 I217_PLL_CLOCK_GATE_REG,
 phy_reg);
-   }
+
+   if (speed == SPEED_1000) {
+   hw->phy.ops.read_reg_locked(hw, HV_PM_CTRL,
+   &phy_reg);
+
+   phy_reg |= HV_PM_CTRL_K1_CLK_REQ;
+
+   hw->phy.ops.write_reg_locked(hw, HV_PM_CTRL,
+phy_reg);
+   }
+}
hw->phy.ops.release(hw);
 
if (ret_val)
@@ -1718,7 +1728,8 @@ static s32 e1000_check_for_copper_link_i
u32 pcieanacfg = E1000_READ_REG(hw, E1000_PCIEANACFG);
u32 fextnvm6 = E1000_READ_REG(hw, E1000_FEXTNVM6);
 
-   if (pcieanacfg & E1000_FEXTNVM6_K1_OFF_ENABLE)
+   if ((pcieanacfg & E1000_FEXTNVM6_K1_OFF_ENABLE) &&
+   (hw->dev_spec.ich8lan.disable_k1_off == FALSE))
fextnvm6 |= E1000_FEXTNVM6_K1_OFF_ENABLE;
else
fextnvm6 &= ~E1000_FEXTNVM6_K1_OFF_ENABLE;

Modified: head/sys/dev/e1000/e1000_ich8lan.h
==
--- head/sys/dev/e1000/e1000_ich8lan.h  Mon Au

svn commit: r304151 - head/contrib/elftoolchain/elfcopy

2016-08-15 Thread Ed Maste
Author: emaste
Date: Mon Aug 15 11:54:39 2016
New Revision: 304151
URL: https://svnweb.freebsd.org/changeset/base/304151

Log:
  elfcopy: silence GCC 5.3 unitialized variable warning
  
  Although it's a false positive there is little cost to initializing it
  always.
  
  Submitted by: adrian

Modified:
  head/contrib/elftoolchain/elfcopy/ascii.c

Modified: head/contrib/elftoolchain/elfcopy/ascii.c
==
--- head/contrib/elftoolchain/elfcopy/ascii.c   Mon Aug 15 11:54:29 2016
(r304150)
+++ head/contrib/elftoolchain/elfcopy/ascii.c   Mon Aug 15 11:54:39 2016
(r304151)
@@ -251,6 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp
sec_index = 1;
sec_addr = entry = 0;
while (fgets(line, _LINE_BUFSZ, ifp) != NULL) {
+   sz = 0; /* Silence GCC 5.3 unintialized variable warning */
if (line[0] == '\r' || line[0] == '\n')
continue;
if (line[0] == '$' && line[1] == '$') {
___
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: r304152 - head/sys/netpfil/pf

2016-08-15 Thread Kristof Provost
Author: kp
Date: Mon Aug 15 12:13:14 2016
New Revision: 304152
URL: https://svnweb.freebsd.org/changeset/base/304152

Log:
  pf: Add missing byte-order swap to pf_match_addr_range
  
  Without this, rules using address ranges (e.g. "10.1.1.1 - 10.1.1.5") did not
  match addresses correctly on little-endian systems.
  
  PR:   211796
  Obtained from:OpenBSD (sthen)
  MFC after:3 days

Modified:
  head/sys/netpfil/pf/pf.c

Modified: head/sys/netpfil/pf/pf.c
==
--- head/sys/netpfil/pf/pf.cMon Aug 15 11:54:39 2016(r304151)
+++ head/sys/netpfil/pf/pf.cMon Aug 15 12:13:14 2016(r304152)
@@ -2600,8 +2600,8 @@ pf_match_addr_range(struct pf_addr *b, s
switch (af) {
 #ifdef INET
case AF_INET:
-   if ((a->addr32[0] < b->addr32[0]) ||
-   (a->addr32[0] > e->addr32[0]))
+   if ((ntohl(a->addr32[0]) < ntohl(b->addr32[0])) ||
+   (ntohl(a->addr32[0]) > ntohl(e->addr32[0])))
return (0);
break;
 #endif /* INET */
@@ -2611,15 +2611,15 @@ pf_match_addr_range(struct pf_addr *b, s
 
/* check a >= b */
for (i = 0; i < 4; ++i)
-   if (a->addr32[i] > b->addr32[i])
+   if (ntohl(a->addr32[i]) > ntohl(b->addr32[i]))
break;
-   else if (a->addr32[i] < b->addr32[i])
+   else if (ntohl(a->addr32[i]) < ntohl(b->addr32[i]))
return (0);
/* check a <= e */
for (i = 0; i < 4; ++i)
-   if (a->addr32[i] < e->addr32[i])
+   if (ntohl(a->addr32[i]) < ntohl(e->addr32[i]))
break;
-   else if (a->addr32[i] > e->addr32[i])
+   else if (ntohl(a->addr32[i]) > ntohl(e->addr32[i]))
return (0);
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: r304153 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 12:56:45 2016
New Revision: 304153
URL: https://svnweb.freebsd.org/changeset/base/304153

Log:
  Quick fix for locking fixes in r172250.  The lock added there was per-
  virtual-device, but needs to be per-physical-device so that it protects
  shared data.  Usually, scp->sc->write_in_progress got corrupted first
  and further corruption was limited when this variable was left at nonzero
  with no write in progress.
  
  Attempt to fix missing lock destruction in r162285.  Put it with the
  lock destruction for r172250 after moving the latter.  Both might be
  unreachable.
  
  To demonstrate the bug, find a buggy syscall or sysctl that calls
  printf(9) and run this often.  Run hd /dev/zero >/dev/ttyvN for any
  N != 0.  The console spam goes to ttyv0 and the non-console spam goes
  to ttyvN, so the lock provided no protection (but it helped for
  N == 0).

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 12:13:14 2016
(r304152)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 12:56:45 2016
(r304153)
@@ -2688,13 +2688,13 @@ sc_puts(scr_stat *scp, u_char *buf, int 
 #endif
 
 if (scp->tsw) {
-   if (!kdb_active && !mtx_owned(&scp->scr_lock)) {
+   if (!kdb_active && !mtx_owned(&scp->sc->scr_lock)) {
need_unlock = 1;
-   mtx_lock_spin(&scp->scr_lock);
+   mtx_lock_spin(&scp->sc->scr_lock);
}
(*scp->tsw->te_puts)(scp, buf, len, kernel);
if (need_unlock)
-   mtx_unlock_spin(&scp->scr_lock);
+   mtx_unlock_spin(&scp->sc->scr_lock);
 }
 
 if (scp->sc->delayed_next_scr)
@@ -2859,8 +2859,10 @@ scinit(int unit, int flags)
  * disappeared...
  */
 sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE);
-if ((sc->flags & SC_INIT_DONE) == 0)
+if ((sc->flags & SC_INIT_DONE) == 0) {
+   mtx_init(&sc->scr_lock, "scrlock", NULL, MTX_SPIN);
SC_VIDEO_LOCKINIT(sc);
+}
 
 adp = NULL;
 if (sc->adapter >= 0) {
@@ -3077,7 +3079,8 @@ scterm(int unit, int flags)
(*scp->tsw->te_term)(scp, &scp->ts);
 if (scp->ts != NULL)
free(scp->ts, M_DEVBUF);
-mtx_destroy(&scp->scr_lock);
+mtx_destroy(&sc->scr_lock);
+mtx_destroy(&sc->video_mtx);
 
 /* clear the structure */
 if (!(flags & SC_KERNEL_CONSOLE)) {
@@ -3302,8 +3305,6 @@ init_scp(sc_softc_t *sc, int vty, scr_st
 scp->history = NULL;
 scp->history_pos = 0;
 scp->history_size = 0;
-
-mtx_init(&scp->scr_lock, "scrlock", NULL, MTX_SPIN);
 }
 
 int

Modified: head/sys/dev/syscons/syscons.h
==
--- head/sys/dev/syscons/syscons.h  Mon Aug 15 12:13:14 2016
(r304152)
+++ head/sys/dev/syscons/syscons.h  Mon Aug 15 12:56:45 2016
(r304153)
@@ -230,6 +230,7 @@ typedef struct sc_softc {
charswitch_in_progress;
charwrite_in_progress;
charblink_in_progress;
+   struct mtx  scr_lock;   /* mutex for sc_puts() */
struct mtx  video_mtx;
 
longscrn_time_stamp;
@@ -344,7 +345,6 @@ typedef struct scr_stat {
 
int splash_save_mode;   /* saved mode for splash screen 
*/
int splash_save_status; /* saved status for splash 
screen */
-   struct mtx  scr_lock;   /* mutex for sc_puts() */
 #ifdef _SCR_MD_STAT_DECLARED_
scr_md_stat_t   md; /* machine dependent vars */
 #endif
___
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: r304154 - head/sys/netpfil/ipfw

2016-08-15 Thread Oleg Bulyzhin
Author: oleg
Date: Mon Aug 15 13:06:29 2016
New Revision: 304154
URL: https://svnweb.freebsd.org/changeset/base/304154

Log:
  Fix command: ipfw set (enable|disable) N (where N > 4).
  enable_sets() expects set bitmasks, not set numbers.
  
  MFC after:3 days

Modified:
  head/sys/netpfil/ipfw/ip_fw_sockopt.c

Modified: head/sys/netpfil/ipfw/ip_fw_sockopt.c
==
--- head/sys/netpfil/ipfw/ip_fw_sockopt.c   Mon Aug 15 12:56:45 2016
(r304153)
+++ head/sys/netpfil/ipfw/ip_fw_sockopt.c   Mon Aug 15 13:06:29 2016
(r304154)
@@ -1420,8 +1420,10 @@ manage_sets(struct ip_fw_chain *chain, i
 
if (rh->range.head.length != sizeof(ipfw_range_tlv))
return (1);
-   if (rh->range.set >= IPFW_MAX_SETS ||
-   rh->range.new_set >= IPFW_MAX_SETS)
+   /* enable_sets() expects bitmasks. */
+   if (op3->opcode != IP_FW_SET_ENABLE &&
+   (rh->range.set >= IPFW_MAX_SETS ||
+   rh->range.new_set >= IPFW_MAX_SETS))
return (EINVAL);
 
ret = 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"


Re: svn commit: r304153 - head/sys/dev/syscons

2016-08-15 Thread Shawn Webb
On Mon, Aug 15, 2016 at 12:56:45PM +, Bruce Evans wrote:
> Author: bde
> Date: Mon Aug 15 12:56:45 2016
> New Revision: 304153
> URL: https://svnweb.freebsd.org/changeset/base/304153
> 
> Log:
>   Quick fix for locking fixes in r172250.  The lock added there was per-
>   virtual-device, but needs to be per-physical-device so that it protects
>   shared data.  Usually, scp->sc->write_in_progress got corrupted first
>   and further corruption was limited when this variable was left at nonzero
>   with no write in progress.
>   
>   Attempt to fix missing lock destruction in r162285.  Put it with the
>   lock destruction for r172250 after moving the latter.  Both might be
>   unreachable.
>   
>   To demonstrate the bug, find a buggy syscall or sysctl that calls
>   printf(9) and run this often.  Run hd /dev/zero >/dev/ttyvN for any
>   N != 0.  The console spam goes to ttyv0 and the non-console spam goes
>   to ttyvN, so the lock provided no protection (but it helped for
>   N == 0).
> 

Hey Bruce,

Should this be MFC'd after some point?

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:  0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE


signature.asc
Description: PGP signature


Re: svn commit: r304153 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans

On Mon, 15 Aug 2016, Shawn Webb wrote:


On Mon, Aug 15, 2016 at 12:56:45PM +, Bruce Evans wrote:


Log:
  Quick fix for locking fixes in r172250.  The lock added there was per-
  virtual-device, but needs to be per-physical-device so that it protects
  shared data.  Usually, scp->sc->write_in_progress got corrupted first
  and further corruption was limited when this variable was left at nonzero
  with no write in progress.

...

Should this be MFC'd after some point?


Possibly.  This is a small part of ~60K of patches for locking bugs in
console drivers (only ones that I use, syscons and sio) and subr_prf.c
and subr_msgbuf.c.  It is meant to be safe and easy to merge by itself,
but I have too many little patches to merge one at a time.

Bruce
___
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: r304160 - head/contrib/elftoolchain/libelftc

2016-08-15 Thread Ed Maste
Author: emaste
Date: Mon Aug 15 14:28:08 2016
New Revision: 304160
URL: https://svnweb.freebsd.org/changeset/base/304160

Log:
  elfcopy: add elf64-littleaarch64 output target support
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
  head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c

Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
==
--- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3  Mon Aug 15 
14:24:47 2016(r304159)
+++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3  Mon Aug 15 
14:28:08 2016(r304160)
@@ -89,6 +89,7 @@ Known descriptor names and their propert
 .It Li elf64-ia64-big Ta ELF Ta MSB Ta 64
 .It Li elf64-ia64-little Ta ELF Ta LSB Ta 64
 .It Li elf64-little Ta ELF Ta LSB Ta 64
+.It Li elf64-littleaarch64 Ta ELF Ta LSB Ta 64
 .It Li elf64-littlemips Ta ELF Ta LSB Ta 64
 .It Li elf64-powerpc Ta ELF Ta MSB Ta 64
 .It Li elf64-powerpcle Ta ELF Ta LSB Ta 64

Modified: head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
==
--- head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon Aug 15 
14:24:47 2016(r304159)
+++ head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c Mon Aug 15 
14:28:08 2016(r304160)
@@ -250,6 +250,14 @@ struct _Elftc_Bfd_Target _libelftc_targe
},
 
{
+   .bt_name  = "elf64-littleaarch64",
+   .bt_type  = ETF_ELF,
+   .bt_byteorder = ELFDATA2LSB,
+   .bt_elfclass  = ELFCLASS64,
+   .bt_machine   = EM_AARCH64,
+   },
+
+   {
.bt_name  = "elf64-littlemips",
.bt_type  = ETF_ELF,
.bt_byteorder = ELFDATA2LSB,
___
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: r304161 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 14:28:16 2016
New Revision: 304161
URL: https://svnweb.freebsd.org/changeset/base/304161

Log:
  Change all uses of 'debugger' to kdb_active and remove this variable.  This
  restores avoidance of doing dangerous things like calling wakeup() and
  callouts while in ddb.
  
  Initialization of 'debugger' was broken by removing the cndbctl() console
  method that was used mainly in this driver to initialize 'debugger' and
  switch to the console screen on entry to ddb.  The screen switch was
  restored using the cngrab() method, but cngrab() is more general so it
  should not initialize 'debugger' and never did.  'debugger' was just
  an over-engineered alias for kdb_active anyway.  It existed because
  kdb_active (when it was named ddb_active) was considered as a private
  kdb variable, and there are ordering problems initializing the variables
  atomically with the state that they represent, but an extra variable and
  method to set it increased these problems.
  
  The bug caused LORs, but WITNESS is normally misconfigured with
  WITNESS_SKIPSIN so it doesn't check the spinlocks used by wakeup() and
  callouts.

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

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 14:28:08 2016
(r304160)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 14:28:16 2016
(r304161)
@@ -172,8 +172,6 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_pa
 
 #define VTY_WCHAN(sc, vty) (&SC_DEV(sc, vty))
 
-static int debugger;
-
 /* prototypes */
 static int sc_allocate_keyboard(sc_softc_t *sc, int unit);
 static int scvidprobe(int unit, int flags, int cons);
@@ -1815,7 +1813,7 @@ sccnupdate(scr_stat *scp)
 if (suspend_in_progress || scp->sc->font_loading_in_progress)
return;
 
-if (debugger > 0 || panicstr || shutdown_in_progress) {
+if (kdb_active || panicstr || shutdown_in_progress) {
sc_touch_scrn_saver();
 } else if (scp != scp->sc->cur_scp) {
return;
@@ -1884,7 +1882,7 @@ scrn_timer(void *arg)
 #endif /* PC98 */
 
 /* should we stop the screen saver? */
-if (debugger > 0 || panicstr || shutdown_in_progress)
+if (kdb_active || panicstr || shutdown_in_progress)
sc_touch_scrn_saver();
 if (run_scrn_saver) {
if (time_uptime > sc->scrn_time_stamp + scrn_blank_time)
@@ -2279,7 +2277,7 @@ stop_scrn_saver(sc_softc_t *sc, void (*s
 mark_all(sc->cur_scp);
 if (sc->delayed_next_scr)
sc_switch_scr(sc, sc->delayed_next_scr - 1);
-if (debugger == 0)
+if (!kdb_active)
wakeup(&scrn_blanked);
 }
 
@@ -2474,7 +2472,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next
DPRINTF(5, ("error 2, requested vty isn't open!\n"));
return EINVAL;
}
-   if ((debugger > 0) && (SC_STAT(tp)->smode.mode == VT_PROCESS)) {
+   if (kdb_active && SC_STAT(tp)->smode.mode == VT_PROCESS) {
splx(s);
DPRINTF(5, ("error 3, requested vty is in the VT_PROCESS mode\n"));
return EINVAL;
@@ -2495,7 +2493,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next
 * is supposed to be locked by splhigh(), but the debugger may
 * be invoked at splhigh().
 */
-   if (debugger == 0)
+   if (!kdb_active)
wakeup(VTY_WCHAN(sc,next_scr));
splx(s);
DPRINTF(5, ("switch done (new == old)\n"));
@@ -2518,7 +2516,7 @@ sc_switch_scr(sc_softc_t *sc, u_int next
 s = spltty();
 
 /* wake up processes waiting for this vty */
-if (debugger == 0)
+if (!kdb_active)
wakeup(VTY_WCHAN(sc,next_scr));
 
 /* wait for the controlling process to acknowledge, if necessary */
___
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: r304162 - head/etc/periodic/daily

2016-08-15 Thread Alan Somers
Author: asomers
Date: Mon Aug 15 14:58:25 2016
New Revision: 304162
URL: https://svnweb.freebsd.org/changeset/base/304162

Log:
  Decrease the anti-congestion sleep in 480.leapfile-ntpd to 1 hour
  
  24 hours is too long. Periodic scripts are executed serially, so when
  combined with the sleep in 410.pkg-audit periodic could actually take more
  than 24 hours and block the next invocation.
  
  Reviewed by:  cy
  MFC after:4 weeks
  Sponsored by: Spectra Logic Corp
  Differential Revision:https://reviews.freebsd.org/D7481

Modified:
  head/etc/periodic/daily/480.leapfile-ntpd

Modified: head/etc/periodic/daily/480.leapfile-ntpd
==
--- head/etc/periodic/daily/480.leapfile-ntpd   Mon Aug 15 14:28:16 2016
(r304161)
+++ head/etc/periodic/daily/480.leapfile-ntpd   Mon Aug 15 14:58:25 2016
(r304162)
@@ -16,7 +16,7 @@ case "$daily_ntpd_leapfile_enable" in
case "$daily_ntpd_avoid_congestion" in
[Yy][Ee][Ss])
# Avoid dogpiling
-   (sleep $(jot -r 1 0 86400); service ntpd onefetch) &
+   (sleep $(jot -r 1 0 3600); service ntpd onefetch) &
;;
*)
service ntpd onefetch
___
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: r304142 - head/usr.sbin/bsdinstall/partedit

2016-08-15 Thread Nathan Whitehorn
As a note for people who weren't paying attention to the bug, we need to 
fix this in a better way outside of the constraints of getting 11.0 out 
the door. The system (gpart, the installer, ZFS, etc.) uses the reported 
GEOM stripesize for partition alignment and IO block size selection. If 
that is wrong, we should identify devices on which it is wrong and fix 
them, and maybe also add some global tunable that sets a floor on the 
numbers reported by GEOM_DISK. Hacking the installer like this is 
triage, which is fine, but not viable as a permanent solution to anything.

-Nathan

On 08/15/16 02:30, Dag-Erling Smørgrav wrote:

Author: des
Date: Mon Aug 15 09:30:21 2016
New Revision: 304142
URL: https://svnweb.freebsd.org/changeset/base/304142

Log:
   Ensure that the sector size is a multiple of 4096 to avoid creating
   unaligned partitions when the actual sector size is hidden from us.
   
   PR:		211361

   MFC after:   3 days

Modified:
   head/usr.sbin/bsdinstall/partedit/gpart_ops.c

Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Mon Aug 15 09:27:15 
2016(r304141)
+++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Mon Aug 15 09:30:21 
2016(r304142)
@@ -795,6 +795,7 @@ gpart_max_free(struct ggeom *geom, intma
  {
struct gconfig *gc;
struct gprovider *pp, **providers;
+   intmax_t sectorsize, stripesize, offset;
intmax_t lastend;
intmax_t start, end;
intmax_t maxsize, maxstart;
@@ -845,12 +846,25 @@ gpart_max_free(struct ggeom *geom, intma
  
  	pp = LIST_FIRST(&geom->lg_consumer)->lg_provider;
  
-	/* Compute beginning of new partition and maximum available space */

-   if (pp->lg_stripesize > 0 &&
-   (maxstart*pp->lg_sectorsize % pp->lg_stripesize) != 0) {
-   intmax_t offset = (pp->lg_stripesize -
-   ((maxstart*pp->lg_sectorsize) % pp->lg_stripesize)) /
-   pp->lg_sectorsize;
+   /*
+* Round the start and size of the largest available space up to
+* the nearest multiple of the adjusted stripe size.
+*
+* The adjusted stripe size is the least common multiple of the
+* actual stripe size, or the sector size if no stripe size was
+* reported, and 4096.  The reason for this is that contemporary
+* disks often have 4096-byte physical sectors but report 512
+* bytes instead for compatibility with older / broken operating
+* systems and BIOSes.  For the same reasons, virtualized storage
+* may also report a 512-byte stripe size, or none at all.
+*/
+   sectorsize = pp->lg_sectorsize;
+   if ((stripesize = pp->lg_stripesize) == 0)
+   stripesize = sectorsize;
+   while (stripesize % 4096 != 0)
+   stripesize *= 2;
+   if ((offset = maxstart * sectorsize % stripesize) != 0) {
+   offset = (stripesize - offset) / sectorsize;
maxstart += offset;
maxsize -= offset;
}



___
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: r304164 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 15:34:53 2016
New Revision: 304164
URL: https://svnweb.freebsd.org/changeset/base/304164

Log:
  Disable some more unsafe things in (low level) console mode:
  - never call up to the tty layer to restart output for keyboard input in
console mode.  This was already disallowed in kdb mode.  Other cases
are rarely reached.
  - disable the reboot, halt and powerdown keys in console mode.  The suspend,
standby and panic keys are still allowed, and aren't even conditonal
on excessive configuration options.  Some of these actions are still
available in ddb mode as ddb commands which are equally unsafe.  Some
are useful at input prompts and should be restored when the locking is
fixed.
  - disallow bells in kdb mode (should be in console mode, but the flag for
that is not available).  Visual bell gives very alarming behaviour by
trying to use callouts which don't work in kdb mode.  Audio bell uses
timeouts and hardware resources with mutexes that can deadlock in
reasonable use of ddb.
  
  Screen switches in kdb mode are not very safe, but they are important
  functionality and there is a lot of code to make them sort of work.

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

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 15:23:45 2016
(r304163)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 15:34:53 2016
(r304164)
@@ -3505,8 +3505,9 @@ next_code:
scp->status |= CURSOR_ENABLED;
sc_draw_cursor_image(scp);
}
+   /* Only safe in Giant-locked context. */
tp = SC_DEV(sc, scp->index);
-   if (!kdb_active && tty_opened_ns(tp))
+   if (!(flags & SCGETC_CN) && tty_opened_ns(tp))
sctty_outwakeup(tp);
 #endif
}
@@ -3557,21 +3558,21 @@ next_code:
 
case RBT:
 #ifndef SC_DISABLE_REBOOT
-   if (enable_reboot)
+   if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(0);
 #endif
break;
 
case HALT:
 #ifndef SC_DISABLE_REBOOT
-   if (enable_reboot)
+   if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT);
 #endif
break;
 
case PDWN:
 #ifndef SC_DISABLE_REBOOT
-   if (enable_reboot)
+   if (enable_reboot && !(flags & SCGETC_CN))
shutdown_nice(RB_HALT|RB_POWEROFF);
 #endif
break;
@@ -3842,7 +3843,7 @@ sc_respond(scr_stat *scp, const u_char *
 void
 sc_bell(scr_stat *scp, int pitch, int duration)
 {
-if (cold || shutdown_in_progress || !enable_bell)
+if (cold || kdb_active || shutdown_in_progress || !enable_bell)
return;
 
 if (scp != scp->sc->cur_scp && (scp->sc->flags & SC_QUIET_BELL))
___
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: r304165 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 17:08:25 2016
New Revision: 304165
URL: https://svnweb.freebsd.org/changeset/base/304165

Log:
  Like scr_lock, the grab count needs to be per-physical-device to work.
  
  This bug corrupted the grab count on both vtys if the ungrabbed vty is
  different from the console, and failed to restore the keyboard state
  on the ungrabbed vty, but not restoring the latter usually left the
  keyboard mode part of it uncorrupted at 1 (K_XLATE), while after this
  fix the keyboard mode part is usually corrupted to 0 (K_RAW).
  
  While here, rename the grab count from 'grabbed' to grab_level.

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

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 15:34:53 2016
(r304164)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 17:08:25 2016
(r304165)
@@ -1661,7 +1661,7 @@ sc_cngrab(struct consdev *cp)
 if (scp->sc->kbd == NULL)
return;
 
-if (scp->grabbed++ > 0)
+if (scp->sc->grab_level++ > 0)
return;
 
 /*
@@ -1687,7 +1687,7 @@ sc_cnungrab(struct consdev *cp)
 if (scp->sc->kbd == NULL)
return;
 
-if (--scp->grabbed > 0)
+if (--scp->sc->grab_level > 0)
return;
 
 kbdd_poll(scp->sc->kbd, FALSE);
___
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: r304166 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 17:11:05 2016
New Revision: 304166
URL: https://svnweb.freebsd.org/changeset/base/304166

Log:
  [Oops, the previous commit was missing the update to syscons.h.]
  
  Like scr_lock, the grab count needs to be per-physical-device to work.
  
  This bug corrupted the grab count on both vtys if the ungrabbed vty is
  different from the console, and failed to restore the keyboard state
  on the ungrabbed vty, but not restoring it usually left the keyboard
  mode part of the keyboard state uncorrupted at 1 (K_XLATE), while
  after this fix the keyboard mode part is usually corrupted to 0 (K_RAW).
  
  While here, rename the grab count from grabbed to grab_level.

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

Modified: head/sys/dev/syscons/syscons.h
==
--- head/sys/dev/syscons/syscons.h  Mon Aug 15 17:08:25 2016
(r304165)
+++ head/sys/dev/syscons/syscons.h  Mon Aug 15 17:11:05 2016
(r304166)
@@ -230,6 +230,7 @@ typedef struct sc_softc {
charswitch_in_progress;
charwrite_in_progress;
charblink_in_progress;
+   int grab_level;
struct mtx  scr_lock;   /* mutex for sc_puts() */
struct mtx  video_mtx;
 
@@ -304,7 +305,6 @@ typedef struct scr_stat {
void*ts;
 
int status; /* status (bitfield) */
-   int grabbed;
int kbd_mode;   /* keyboard I/O mode */
int kbd_prev_mode;  /* keyboard I/O mode */
 
___
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: r304168 - in head/sys/dev/cxgbe: . common

2016-08-15 Thread John Baldwin
Author: jhb
Date: Mon Aug 15 17:40:05 2016
New Revision: 304168
URL: https://svnweb.freebsd.org/changeset/base/304168

Log:
  Make SGE parameter handling more VF-friendly.
  
  Add fields to hold the SGE control register and free list buffer sizes to
  the sge_params structure.  Populate these new fields in
  t4_init_sge_params() for PF devices and change t4_read_chip_settings() to
  pull these values out of the params structure instead of reading
  registers directly.  This will permit t4_read_chip_settings() to be reused
  for VF devices which cannot read SGE registers directly.
  
  While here, move the call to t4_init_sge_params() to
  get_params__post_init().  The VF driver will populate the SGE parameters
  structure via a different method before calling t4_read_chip_settings().
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7476

Modified:
  head/sys/dev/cxgbe/common/common.h
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/common/common.h
==
--- head/sys/dev/cxgbe/common/common.h  Mon Aug 15 17:37:28 2016
(r304167)
+++ head/sys/dev/cxgbe/common/common.h  Mon Aug 15 17:40:05 2016
(r304168)
@@ -215,6 +215,8 @@ struct sge_params {
int pad_boundary;
int pack_boundary;
int fl_pktshift;
+   u32 sge_control;
+   u32 sge_fl_buffer_size[SGE_FLBUF_SIZES];
 };
 
 struct tp_params {

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Mon Aug 15 17:37:28 2016
(r304167)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Mon Aug 15 17:40:05 2016
(r304168)
@@ -7644,6 +7644,7 @@ int t4_init_sge_params(struct adapter *a
 {
u32 r;
struct sge_params *sp = &adapter->params.sge;
+   unsigned i;
 
r = t4_read_reg(adapter, A_SGE_INGRESS_RX_THRESHOLD);
sp->counter_val[0] = G_THRESHOLD_0(r);
@@ -7686,6 +7687,7 @@ int t4_init_sge_params(struct adapter *a
sp->page_shift = (r & M_HOSTPAGESIZEPF0) + 10;
 
r = t4_read_reg(adapter, A_SGE_CONTROL);
+   sp->sge_control = r;
sp->spg_len = r & F_EGRSTATUSPAGESIZE ? 128 : 64;
sp->fl_pktshift = G_PKTSHIFT(r);
sp->pad_boundary = 1 << (G_INGPADBOUNDARY(r) + 5);
@@ -7698,6 +7700,9 @@ int t4_init_sge_params(struct adapter *a
else
sp->pack_boundary = 1 << (G_INGPACKBOUNDARY(r) + 5);
}
+   for (i = 0; i < SGE_FLBUF_SIZES; i++)
+   sp->sge_fl_buffer_size[i] = t4_read_reg(adapter,
+   A_SGE_FL_BUFFER_SIZE0 + (4 * i));
 
return 0;
 }

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cMon Aug 15 17:37:28 2016
(r304167)
+++ head/sys/dev/cxgbe/t4_main.cMon Aug 15 17:40:05 2016
(r304168)
@@ -3332,6 +3332,8 @@ get_params__post_init(struct adapter *sc
sc->vres.iscsi.size = val[1] - val[0] + 1;
}
 
+   t4_init_sge_params(sc);
+
/*
 * We've got the params we wanted to query via the firmware.  Now grab
 * some others directly from the chip.

Modified: head/sys/dev/cxgbe/t4_sge.c
==
--- head/sys/dev/cxgbe/t4_sge.c Mon Aug 15 17:37:28 2016(r304167)
+++ head/sys/dev/cxgbe/t4_sge.c Mon Aug 15 17:40:05 2016(r304168)
@@ -625,11 +625,9 @@ t4_read_chip_settings(struct adapter *sc
struct sw_zone_info *swz, *safe_swz;
struct hw_buf_info *hwb;
 
-   t4_init_sge_params(sc);
-
m = F_RXPKTCPLMODE;
v = F_RXPKTCPLMODE;
-   r = t4_read_reg(sc, A_SGE_CONTROL);
+   r = sc->params.sge.sge_control;
if ((r & m) != v) {
device_printf(sc->dev, "invalid SGE_CONTROL(0x%x)\n", r);
rc = EINVAL;
@@ -647,7 +645,7 @@ t4_read_chip_settings(struct adapter *sc
/* Filter out unusable hw buffer sizes entirely (mark with -2). */
hwb = &s->hw_buf_info[0];
for (i = 0; i < nitems(s->hw_buf_info); i++, hwb++) {
-   r = t4_read_reg(sc, A_SGE_FL_BUFFER_SIZE0 + (4 * i));
+   r = sc->params.sge.sge_fl_buffer_size[i];
hwb->size = r;
hwb->zidx = hwsz_ok(sc, r) ? -1 : -2;
hwb->next = -1;
___
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: r304169 - head/sys/dev/cxgbe/common

2016-08-15 Thread John Baldwin
Author: jhb
Date: Mon Aug 15 17:41:34 2016
New Revision: 304169
URL: https://svnweb.freebsd.org/changeset/base/304169

Log:
  Update mailbox writes to work with VF devices.
  
  - Use alternate register locations for the data and control registers for
VFs.
  - Do a dummy read to force the writes to the  mailbox data registers to
post before the write to the control register on VFs.
  - Do not check the PCI-e firmware register for errors on VFs.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7483

Modified:
  head/sys/dev/cxgbe/common/t4_hw.c

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Mon Aug 15 17:40:05 2016
(r304168)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Mon Aug 15 17:41:34 2016
(r304169)
@@ -289,6 +289,14 @@ int t4_wr_mbox_meat_timeout(struct adapt
if ((size & 15) || size > MBOX_LEN)
return -EINVAL;
 
+   if (adap->flags & IS_VF) {
+   if (is_t6(adap))
+   data_reg = FW_T6VF_MBDATA_BASE_ADDR;
+   else
+   data_reg = FW_T4VF_MBDATA_BASE_ADDR;
+   ctl_reg = VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_CTRL);
+   }
+
/*
 * If we have a negative timeout, that implies that we can't sleep.
 */
@@ -343,6 +351,22 @@ int t4_wr_mbox_meat_timeout(struct adapt
for (i = 0; i < size; i += 8, p++)
t4_write_reg64(adap, data_reg + i, be64_to_cpu(*p));
 
+   if (adap->flags & IS_VF) {
+   /*
+* For the VFs, the Mailbox Data "registers" are
+* actually backed by T4's "MA" interface rather than
+* PL Registers (as is the case for the PFs).  Because
+* these are in different coherency domains, the write
+* to the VF's PL-register-backed Mailbox Control can
+* race in front of the writes to the MA-backed VF
+* Mailbox Data "registers".  So we need to do a
+* read-back on at least one byte of the VF Mailbox
+* Data registers before doing the write to the VF
+* Mailbox Control register.
+*/
+   t4_read_reg(adap, data_reg);
+   }
+
CH_DUMP_MBOX(adap, mbox, data_reg);
 
t4_write_reg(adap, ctl_reg, F_MBMSGVALID | V_MBOWNER(X_MBOWNER_FW));
@@ -355,10 +379,13 @@ int t4_wr_mbox_meat_timeout(struct adapt
 * Loop waiting for the reply; bail out if we time out or the firmware
 * reports an error.
 */
-   for (i = 0;
-!((pcie_fw = t4_read_reg(adap, A_PCIE_FW)) & F_PCIE_FW_ERR) &&
-i < timeout;
-i += ms) {
+   pcie_fw = 0;
+   for (i = 0; i < timeout; i += ms) {
+   if (!(adap->flags & IS_VF)) {
+   pcie_fw = t4_read_reg(adap, A_PCIE_FW);
+   if (pcie_fw & F_PCIE_FW_ERR)
+   break;
+   }
if (sleep_ok) {
ms = delay[delay_idx];  /* last element may repeat */
if (delay_idx < ARRAY_SIZE(delay) - 1)
___
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: r304170 - in head/sys/dev/cxgbe: . common

2016-08-15 Thread John Baldwin
Author: jhb
Date: Mon Aug 15 17:42:54 2016
New Revision: 304170
URL: https://svnweb.freebsd.org/changeset/base/304170

Log:
  Add support for register dumps on VF devices.
  
  - Add handling of VF register sets to t4_get_regs_len() and t4_get_regs().
  - While here, use t4_get_regs_len() in the ioctl handler for regdump
instead of inlining it.
  
  Reviewed by:  np
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D7484

Modified:
  head/sys/dev/cxgbe/common/t4_hw.c
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/common/t4_hw.c
==
--- head/sys/dev/cxgbe/common/t4_hw.c   Mon Aug 15 17:41:34 2016
(r304169)
+++ head/sys/dev/cxgbe/common/t4_hw.c   Mon Aug 15 17:42:54 2016
(r304170)
@@ -725,10 +725,14 @@ unsigned int t4_get_regs_len(struct adap
 
switch (chip_version) {
case CHELSIO_T4:
+   if (adapter->flags & IS_VF)
+   return FW_T4VF_REGMAP_SIZE;
return T4_REGMAP_SIZE;
 
case CHELSIO_T5:
case CHELSIO_T6:
+   if (adapter->flags & IS_VF)
+   return FW_T4VF_REGMAP_SIZE;
return T5_REGMAP_SIZE;
}
 
@@ -1207,6 +1211,18 @@ void t4_get_regs(struct adapter *adap, u
0x27e00, 0x27e04,
};
 
+   static const unsigned int t4vf_reg_ranges[] = {
+   VF_SGE_REG(A_SGE_VF_KDOORBELL), VF_SGE_REG(A_SGE_VF_GTS),
+   VF_MPS_REG(A_MPS_VF_CTL),
+   VF_MPS_REG(A_MPS_VF_STAT_RX_VF_ERR_FRAMES_H),
+   VF_PL_REG(A_PL_VF_WHOAMI), VF_PL_REG(A_PL_VF_WHOAMI),
+   VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_CTRL),
+   VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_STATUS),
+   FW_T4VF_MBDATA_BASE_ADDR,
+   FW_T4VF_MBDATA_BASE_ADDR +
+   ((NUM_CIM_PF_MAILBOX_DATA_INSTANCES - 1) * 4),
+   };
+
static const unsigned int t5_reg_ranges[] = {
0x1008, 0x10c0,
0x10cc, 0x10f8,
@@ -1982,6 +1998,18 @@ void t4_get_regs(struct adapter *adap, u
0x51300, 0x51308,
};
 
+   static const unsigned int t5vf_reg_ranges[] = {
+   VF_SGE_REG(A_SGE_VF_KDOORBELL), VF_SGE_REG(A_SGE_VF_GTS),
+   VF_MPS_REG(A_MPS_VF_CTL),
+   VF_MPS_REG(A_MPS_VF_STAT_RX_VF_ERR_FRAMES_H),
+   VF_PL_REG(A_PL_VF_WHOAMI), VF_PL_REG(A_PL_VF_REVISION),
+   VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_CTRL),
+   VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_STATUS),
+   FW_T4VF_MBDATA_BASE_ADDR,
+   FW_T4VF_MBDATA_BASE_ADDR +
+   ((NUM_CIM_PF_MAILBOX_DATA_INSTANCES - 1) * 4),
+   };
+
static const unsigned int t6_reg_ranges[] = {
0x1008, 0x101c,
0x1024, 0x10a8,
@@ -2559,6 +2587,18 @@ void t4_get_regs(struct adapter *adap, u
0x51300, 0x51324,
};
 
+   static const unsigned int t6vf_reg_ranges[] = {
+   VF_SGE_REG(A_SGE_VF_KDOORBELL), VF_SGE_REG(A_SGE_VF_GTS),
+   VF_MPS_REG(A_MPS_VF_CTL),
+   VF_MPS_REG(A_MPS_VF_STAT_RX_VF_ERR_FRAMES_H),
+   VF_PL_REG(A_PL_VF_WHOAMI), VF_PL_REG(A_PL_VF_REVISION),
+   VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_CTRL),
+   VF_CIM_REG(A_CIM_VF_EXT_MAILBOX_STATUS),
+   FW_T6VF_MBDATA_BASE_ADDR,
+   FW_T6VF_MBDATA_BASE_ADDR +
+   ((NUM_CIM_PF_MAILBOX_DATA_INSTANCES - 1) * 4),
+   };
+
u32 *buf_end = (u32 *)(buf + buf_size);
const unsigned int *reg_ranges;
int reg_ranges_size, range;
@@ -2570,18 +2610,33 @@ void t4_get_regs(struct adapter *adap, u
 */
switch (chip_version) {
case CHELSIO_T4:
-   reg_ranges = t4_reg_ranges;
-   reg_ranges_size = ARRAY_SIZE(t4_reg_ranges);
+   if (adap->flags & IS_VF) {
+   reg_ranges = t4vf_reg_ranges;
+   reg_ranges_size = ARRAY_SIZE(t4vf_reg_ranges);
+   } else {
+   reg_ranges = t4_reg_ranges;
+   reg_ranges_size = ARRAY_SIZE(t4_reg_ranges);
+   }
break;
 
case CHELSIO_T5:
-   reg_ranges = t5_reg_ranges;
-   reg_ranges_size = ARRAY_SIZE(t5_reg_ranges);
+   if (adap->flags & IS_VF) {
+   reg_ranges = t5vf_reg_ranges;
+   reg_ranges_size = ARRAY_SIZE(t5vf_reg_ranges);
+   } else {
+   reg_ranges = t5_reg_ranges;
+   reg_ranges_size = ARRAY_SIZE(t5_reg_ranges);
+   }
break;
 
case CHELSIO_T6:
-   reg_ranges = t6_reg_ranges;
-   reg_ranges_size = ARRAY_SIZE(t6_reg_ranges);
+   if (adap->flags & IS_VF) {
+

svn commit: r304173 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 18:02:37 2016
New Revision: 304173
URL: https://svnweb.freebsd.org/changeset/base/304173

Log:
  Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
  Simply change the mode to K_XLATE using a local variable and use the
  grab level as a flag to tell screen switches not to change it again,
  so that we don't need to switch scp->kbd_mode.  We did the latter,
  but didn't have the complications to update the keyboard mode switch
  for every screen switch.  sc->kbd_mode remains at its user setting
  for all scp's and ungrabbing restores to it.

Modified:
  head/sys/dev/syscons/syscons.c
  head/sys/dev/syscons/syscons.h

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 17:58:12 2016
(r304172)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 18:02:37 2016
(r304173)
@@ -1649,6 +1649,7 @@ static void
 sc_cngrab(struct consdev *cp)
 {
 scr_stat *scp;
+int kbd_mode;
 
 if (!cold &&
sc_console->sc->cur_scp->index != sc_console->index &&
@@ -1670,11 +1671,9 @@ sc_cngrab(struct consdev *cp)
  */
 kbdd_enable(scp->sc->kbd);
 
-/* we shall always use the keyboard in the XLATE mode here */
-scp->kbd_prev_mode = scp->kbd_mode;
-scp->kbd_mode = K_XLATE;
-(void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
-
+/* Switch the keyboard to console mode (K_XLATE, polled) on all scp's. */
+kbd_mode = K_XLATE;
+(void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&kbd_mode);
 kbdd_poll(scp->sc->kbd, TRUE);
 }
 
@@ -1690,10 +1689,10 @@ sc_cnungrab(struct consdev *cp)
 if (--scp->sc->grab_level > 0)
return;
 
+/* Restore keyboard mode (for the current, possibly-changed scp). */
 kbdd_poll(scp->sc->kbd, FALSE);
-
-scp->kbd_mode = scp->kbd_prev_mode;
 (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
+
 kbdd_disable(scp->sc->kbd);
 }
 
@@ -2667,7 +2666,7 @@ exchange_scr(sc_softc_t *sc)
 sc_set_border(scp, scp->border);
 
 /* set up the keyboard for the new screen */
-if (sc->old_scp->kbd_mode != scp->kbd_mode)
+if (sc->grab_level == 0 && sc->old_scp->kbd_mode != scp->kbd_mode)
(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
 update_kbd_state(scp, scp->status, LOCK_MASK);
 
@@ -3412,7 +3411,7 @@ next_code:
 if (!(flags & SCGETC_CN))
random_harvest_queue(&c, sizeof(c), 1, RANDOM_KEYBOARD);
 
-if (scp->kbd_mode != K_XLATE)
+if (sc->grab_level == 0 && scp->kbd_mode != K_XLATE)
return KEYCHAR(c);
 
 /* if scroll-lock pressed allow history browsing */

Modified: head/sys/dev/syscons/syscons.h
==
--- head/sys/dev/syscons/syscons.h  Mon Aug 15 17:58:12 2016
(r304172)
+++ head/sys/dev/syscons/syscons.h  Mon Aug 15 18:02:37 2016
(r304173)
@@ -306,7 +306,6 @@ typedef struct scr_stat {
 
int status; /* status (bitfield) */
int kbd_mode;   /* keyboard I/O mode */
-   int kbd_prev_mode;  /* keyboard I/O mode */
 
int cursor_pos; /* cursor buffer position */
int cursor_oldpos;  /* cursor old buffer position */
___
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: r303848 - head/sys/netgraph

2016-08-15 Thread Hans Petter Selasky

On 08/13/16 00:23, Ngie Cooper (yaneurabeya) wrote:



On Aug 12, 2016, at 11:38, Gleb Smirnoff  wrote:

 Hi!

 Sorry, I'm afraid this isn't a correct fix. Simply adding checks
against NULL to avoid panics at race conditions isn't a solution.

I can provide help with this problem. It must be related to my
callout changes, in case if this is a very recent problem.

Is it a recent problem or an old one?


I should have requested that the change be revised or further qualified first… 
as I said in the CR:

“””
In D7209#150056, @bz wrote:
Is this sudden problem possibly related to glebius' callout changes? I am not 
properly tracking things but if invariants changed and weren't reflected in the 
callers, that might explain.
I don't know to be honest.

I'll add glebius (I should have done that in the first place).
“””



Hi Ngie,

Is this problem reproducable with projects/hps_head?

--HPS

___
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: r303848 - head/sys/netgraph

2016-08-15 Thread Ngie Cooper
Hi Hans,

> On Aug 15, 2016, at 11:20, Hans Petter Selasky  wrote:

... 

> Hi Ngie,
> 
> Is this problem reproducable with projects/hps_head?

I never reproed the issue before.. I'd have to look at the suggested repro from 
the CR poster.

Thanks!
-Ngie
___
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: r304174 - head/sys/kern

2016-08-15 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 15 18:55:33 2016
New Revision: 304174
URL: https://svnweb.freebsd.org/changeset/base/304174

Log:
  VOP_FSYNC() does not take cred as an argument.  Correct comment.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/vfs_default.c

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Mon Aug 15 18:02:37 2016(r304173)
+++ head/sys/kern/vfs_default.c Mon Aug 15 18:55:33 2016(r304174)
@@ -640,7 +640,6 @@ int
 vop_stdfsync(ap)
struct vop_fsync_args /* {
struct vnode *a_vp;
-   struct ucred *a_cred;
int a_waitfor;
struct thread *a_td;
} */ *ap;
___
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: r304175 - head/contrib/netbsd-tests/lib/libc/gen

2016-08-15 Thread Ed Schouten
Author: ed
Date: Mon Aug 15 19:05:41 2016
New Revision: 304175
URL: https://svnweb.freebsd.org/changeset/base/304175

Log:
  Disable tests for non-standard behaviour of dirname(3)/basename(3).
  
  The NetBSD ATF tests explicitly check that these functions do not modify
  their input. These tests are NetBSD-specific. They test for something
  that is not part of POSIX.
  
  PR:   211873
  Reviewed by:  ngie
  Differential Revision:https://reviews.freebsd.org/D7506

Modified:
  head/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c

Modified: head/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c
==
--- head/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c  Mon Aug 15 
18:55:33 2016(r304174)
+++ head/contrib/netbsd-tests/lib/libc/gen/t_basedirname.c  Mon Aug 15 
19:05:41 2016(r304175)
@@ -111,6 +111,7 @@ ATF_TC_BODY(basename_posix, tc)
} else
base = basename(NULL);
 
+#ifdef __NetBSD__
/*
 * basename(3) is allowed to modify the input buffer.
 * However, that is considered hostile by some programs,
@@ -127,6 +128,7 @@ ATF_TC_BODY(basename_posix, tc)
test_basename_table[i].input);
atf_tc_fail("Input buffer was modified.");
}
+#endif
 
/* Make sure the result is correct. */
if (strcmp(test_basename_table[i].output, base) != 0) {
@@ -162,6 +164,7 @@ ATF_TC_BODY(dirname_posix, tc)
} else
base = dirname(NULL);
 
+#ifdef __NetBSD__
/*
 * dirname(3) is allowed to modify the input buffer.
 * However, that is considered hostile by some programs,
@@ -178,6 +181,7 @@ ATF_TC_BODY(dirname_posix, tc)
test_dirname_table[i].input);
atf_tc_fail("Input buffer was modified.");
}
+#endif
 
/* Make sure the result is correct. */
if (strcmp(test_dirname_table[i].output, base) != 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: r304176 - in head: include lib/libc/sys sys/compat/freebsd32 sys/kern

2016-08-15 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 15 19:08:51 2016
New Revision: 304176
URL: https://svnweb.freebsd.org/changeset/base/304176

Log:
  Add an implementation of fdatasync(2).
  
  The syscall is a trivial wrapper around new VOP_FDATASYNC(), sharing
  code with fsync(2).  For all filesystems, this commit provides the
  implementation which delegates the work of VOP_FDATASYNC() to
  VOP_FSYNC().  This is functionally correct but not efficient.
  
  This is not yet POSIX-compliant implementation, because it does not
  ensure that queued AIO requests are completed before returning.
  
  Reviewed by:  mckusick
  Discussed with:   avg (ZFS), jhb (AIO part)
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D7471

Modified:
  head/include/unistd.h
  head/lib/libc/sys/Symbol.map
  head/sys/compat/freebsd32/syscalls.master
  head/sys/kern/syscalls.master
  head/sys/kern/vfs_default.c
  head/sys/kern/vfs_syscalls.c
  head/sys/kern/vnode_if.src

Modified: head/include/unistd.h
==
--- head/include/unistd.h   Mon Aug 15 19:05:41 2016(r304175)
+++ head/include/unistd.h   Mon Aug 15 19:08:51 2016(r304176)
@@ -384,6 +384,7 @@ extern int optind, opterr, optopt;
 /* ISO/IEC 9945-1: 1996 */
 #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
 int fsync(int);
+int fdatasync(int);
 
 /*
  * ftruncate() was in the POSIX Realtime Extension (it's used for shared

Modified: head/lib/libc/sys/Symbol.map
==
--- head/lib/libc/sys/Symbol.mapMon Aug 15 19:05:41 2016
(r304175)
+++ head/lib/libc/sys/Symbol.mapMon Aug 15 19:08:51 2016
(r304176)
@@ -400,6 +400,10 @@ FBSD_1.4 {
recvmmsg;
 };
 
+FBSD_1.5 {
+fdatasync;
+};
+
 FBSDprivate_1.0 {
___acl_aclcheck_fd;
__sys___acl_aclcheck_fd;
@@ -594,6 +598,8 @@ FBSDprivate_1.0 {
__sys_fstatfs;
_fsync;
__sys_fsync;
+   _fdatasync;
+   __sys_fdatasync;
_futimes;
__sys_futimes;
_getaudit;

Modified: head/sys/compat/freebsd32/syscalls.master
==
--- head/sys/compat/freebsd32/syscalls.master   Mon Aug 15 19:05:41 2016
(r304175)
+++ head/sys/compat/freebsd32/syscalls.master   Mon Aug 15 19:08:51 2016
(r304176)
@@ -1081,3 +1081,4 @@
 549AUE_NULLNOPROTO { int numa_setaffinity(cpuwhich_t which, \
id_t id, \
const struct vm_domain_policy *policy); }
+550AUE_FSYNC   NOPROTO { int fdatasync(int fd); }

Modified: head/sys/kern/syscalls.master
==
--- head/sys/kern/syscalls.master   Mon Aug 15 19:05:41 2016
(r304175)
+++ head/sys/kern/syscalls.master   Mon Aug 15 19:08:51 2016
(r304176)
@@ -993,8 +993,9 @@
id_t id, \
struct vm_domain_policy_entry *policy); }
 549AUE_NULLSTD { int numa_setaffinity(cpuwhich_t which, \
-   id_t id, \
-   const struct vm_domain_policy_entry 
*policy); }
+   id_t id, const struct \
+   vm_domain_policy_entry *policy); }
+550AUE_FSYNC   STD { int fdatasync(int fd); }
 
 ; Please copy any additions and changes to the following compatability tables:
 ; sys/compat/freebsd32/syscalls.master

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Mon Aug 15 19:05:41 2016(r304175)
+++ head/sys/kern/vfs_default.c Mon Aug 15 19:08:51 2016(r304176)
@@ -83,6 +83,7 @@ static int vop_stdset_text(struct vop_se
 static int vop_stdunset_text(struct vop_unset_text_args *ap);
 static int vop_stdget_writecount(struct vop_get_writecount_args *ap);
 static int vop_stdadd_writecount(struct vop_add_writecount_args *ap);
+static int vop_stdfdatasync(struct vop_fdatasync_args *ap);
 static int vop_stdgetpages_async(struct vop_getpages_async_args *ap);
 
 /*
@@ -111,6 +112,7 @@ struct vop_vector default_vnodeops = {
.vop_bmap = vop_stdbmap,
.vop_close =VOP_NULL,
.vop_fsync =VOP_NULL,
+   .vop_fdatasync =vop_stdfdatasync,
.vop_getpages = vop_stdgetpages,
.vop_getpages_async =   vop_stdgetpages_async,
.vop_getwritemount =vop_stdgetwritemount,
@@ -726,6 +728,13 @@ loop2:
return (error);
 }
 
+static int
+vop_stdfdatasync(struct vop_fdatasync_args *ap)
+{
+
+   return (VOP_FSYNC(ap->a_vp, MNT_WAIT, ap->a_td

svn commit: r304177 - in head/sys: compat/freebsd32 kern sys

2016-08-15 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 15 19:15:46 2016
New Revision: 304177
URL: https://svnweb.freebsd.org/changeset/base/304177

Log:
  Regen after r304176, fdatasync(2) addition.

Modified:
  head/sys/compat/freebsd32/freebsd32_proto.h
  head/sys/compat/freebsd32/freebsd32_syscall.h
  head/sys/compat/freebsd32/freebsd32_syscalls.c
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/compat/freebsd32/freebsd32_systrace_args.c
  head/sys/kern/init_sysent.c
  head/sys/kern/syscalls.c
  head/sys/kern/systrace_args.c
  head/sys/sys/syscall.h
  head/sys/sys/syscall.mk
  head/sys/sys/sysproto.h

Modified: head/sys/compat/freebsd32/freebsd32_proto.h
==
--- head/sys/compat/freebsd32/freebsd32_proto.h Mon Aug 15 19:08:51 2016
(r304176)
+++ head/sys/compat/freebsd32/freebsd32_proto.h Mon Aug 15 19:15:46 2016
(r304177)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 
2016-08-03 06:33:04Z ed 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 304176 
2016-08-15 19:08:51Z kib 
  */
 
 #ifndef _FREEBSD32_SYSPROTO_H_

Modified: head/sys/compat/freebsd32/freebsd32_syscall.h
==
--- head/sys/compat/freebsd32/freebsd32_syscall.h   Mon Aug 15 19:08:51 
2016(r304176)
+++ head/sys/compat/freebsd32/freebsd32_syscall.h   Mon Aug 15 19:15:46 
2016(r304177)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 
2016-08-03 06:33:04Z ed 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 304176 
2016-08-15 19:08:51Z kib 
  */
 
 #defineFREEBSD32_SYS_syscall   0
@@ -457,4 +457,5 @@
 #defineFREEBSD32_SYS_freebsd32_utimensat   547
 #defineFREEBSD32_SYS_numa_getaffinity  548
 #defineFREEBSD32_SYS_numa_setaffinity  549
-#defineFREEBSD32_SYS_MAXSYSCALL550
+#defineFREEBSD32_SYS_fdatasync 550
+#defineFREEBSD32_SYS_MAXSYSCALL551

Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c
==
--- head/sys/compat/freebsd32/freebsd32_syscalls.c  Mon Aug 15 19:08:51 
2016(r304176)
+++ head/sys/compat/freebsd32/freebsd32_syscalls.c  Mon Aug 15 19:15:46 
2016(r304177)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 
2016-08-03 06:33:04Z ed 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 304176 
2016-08-15 19:08:51Z kib 
  */
 
 const char *freebsd32_syscallnames[] = {
@@ -583,4 +583,5 @@ const char *freebsd32_syscallnames[] = {
"freebsd32_utimensat",  /* 547 = freebsd32_utimensat */
"numa_getaffinity", /* 548 = numa_getaffinity */
"numa_setaffinity", /* 549 = numa_setaffinity */
+   "fdatasync",/* 550 = fdatasync */
 };

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cMon Aug 15 19:08:51 
2016(r304176)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cMon Aug 15 19:15:46 
2016(r304177)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 303699 
2016-08-03 06:33:04Z ed 
+ * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 304176 
2016-08-15 19:08:51Z kib 
  */
 
 #include "opt_compat.h"
@@ -626,4 +626,5 @@ struct sysent freebsd32_sysent[] = {
{ AS(freebsd32_utimensat_args), (sy_call_t *)freebsd32_utimensat, 
AUE_FUTIMESAT, NULL, 0, 0, 0, SY_THR_STATIC },/* 547 = 
freebsd32_utimensat */
{ AS(numa_getaffinity_args), (sy_call_t *)sys_numa_getaffinity, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 548 = numa_getaffinity */
{ AS(numa_setaffinity_args), (sy_call_t *)sys_numa_setaffinity, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 549 = numa_setaffinity */
+   { AS(fdatasync_args), (sy_call_t *)sys_fdatasync, AUE_FSYNC, NULL, 0, 
0, 0, SY_THR_STATIC },/* 550 = fdatasync */
 };

Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c
==
--- head/sys/compat/freebsd32/freebsd32_systrace_args.c Mon Aug 15 19:08:51 
2016(r304176)
+++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Mon Aug 15 19:15:46 
2016(r304177)
@@ -3316,6 +3316,13 @@ systrace_args(int sysnum, void *params, 
  

svn commit: r304178 - in head/sys: fs/msdosfs kern sys

2016-08-15 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 15 19:17:00 2016
New Revision: 304178
URL: https://svnweb.freebsd.org/changeset/base/304178

Log:
  Implement VOP_FDATASYNC() for msdosfs.
  
  Standard VOP_FSYNC() implementation just syncs data buffers, and due
  to this, is the correct and efficient implementation for msdosfs or
  any other filesystem which uses bufer cache trivially.  Provide
  globally visible wrapper vop_stdfdatasync_buf() for future consumption
  by other filesystems.
  
  Reviewed by:  mckusick
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D7471

Modified:
  head/sys/fs/msdosfs/msdosfs_vnops.c
  head/sys/kern/vfs_default.c
  head/sys/sys/vnode.h

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c
==
--- head/sys/fs/msdosfs/msdosfs_vnops.c Mon Aug 15 19:15:46 2016
(r304177)
+++ head/sys/fs/msdosfs/msdosfs_vnops.c Mon Aug 15 19:17:00 2016
(r304178)
@@ -1897,6 +1897,7 @@ struct vop_vector msdosfs_vnodeops = {
.vop_close =msdosfs_close,
.vop_create =   msdosfs_create,
.vop_fsync =msdosfs_fsync,
+   .vop_fdatasync =vop_stdfdatasync_buf,
.vop_getattr =  msdosfs_getattr,
.vop_inactive = msdosfs_inactive,
.vop_link = msdosfs_link,

Modified: head/sys/kern/vfs_default.c
==
--- head/sys/kern/vfs_default.c Mon Aug 15 19:15:46 2016(r304177)
+++ head/sys/kern/vfs_default.c Mon Aug 15 19:17:00 2016(r304178)
@@ -735,6 +735,17 @@ vop_stdfdatasync(struct vop_fdatasync_ar
return (VOP_FSYNC(ap->a_vp, MNT_WAIT, ap->a_td));
 }
 
+int
+vop_stdfdatasync_buf(struct vop_fdatasync_args *ap)
+{
+   struct vop_fsync_args apf;
+
+   apf.a_vp = ap->a_vp;
+   apf.a_waitfor = MNT_WAIT;
+   apf.a_td = ap->a_td;
+   return (vop_stdfsync(&apf));
+}
+
 /* XXX Needs good comment and more info in the manpage (VOP_GETPAGES(9)). */
 int
 vop_stdgetpages(ap)

Modified: head/sys/sys/vnode.h
==
--- head/sys/sys/vnode.hMon Aug 15 19:15:46 2016(r304177)
+++ head/sys/sys/vnode.hMon Aug 15 19:17:00 2016(r304178)
@@ -720,6 +720,7 @@ int vfs_write_suspend(struct mount *mp, 
 intvfs_write_suspend_umnt(struct mount *mp);
 void   vnlru_free(int, struct vfsops *);
 intvop_stdbmap(struct vop_bmap_args *);
+intvop_stdfdatasync_buf(struct vop_fdatasync_args *);
 intvop_stdfsync(struct vop_fsync_args *);
 intvop_stdgetwritemount(struct vop_getwritemount_args *);
 intvop_stdgetpages(struct vop_getpages_args *);
___
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: r304180 - head/sys/ufs/ffs

2016-08-15 Thread Konstantin Belousov
Author: kib
Date: Mon Aug 15 19:22:23 2016
New Revision: 304180
URL: https://svnweb.freebsd.org/changeset/base/304180

Log:
  Implement VOP_FDATASYNC() for UFS.
  
  Reviewed by:  mckusick
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks
  Differential revision:https://reviews.freebsd.org/D7471

Modified:
  head/sys/ufs/ffs/ffs_extern.h
  head/sys/ufs/ffs/ffs_vnops.c

Modified: head/sys/ufs/ffs/ffs_extern.h
==
--- head/sys/ufs/ffs/ffs_extern.h   Mon Aug 15 19:18:10 2016
(r304179)
+++ head/sys/ufs/ffs/ffs_extern.h   Mon Aug 15 19:22:23 2016
(r304180)
@@ -174,6 +174,11 @@ void   softdep_freework(struct workhead *)
  * deadlock when flushing snapshot inodes while holding snaplk.
  */
 #defineNO_INO_UPDT 0x0001
+/*
+ * Request data sync only from ffs_syncvnode(), not touching even more
+ * metadata than NO_INO_UPDT.
+ */
+#defineDATA_ONLY   0x0002
 
 intffs_rdonly(struct inode *);
 

Modified: head/sys/ufs/ffs/ffs_vnops.c
==
--- head/sys/ufs/ffs/ffs_vnops.cMon Aug 15 19:18:10 2016
(r304179)
+++ head/sys/ufs/ffs/ffs_vnops.cMon Aug 15 19:22:23 2016
(r304180)
@@ -103,6 +103,7 @@ __FBSDID("$FreeBSD$");
 extern int ffs_rawread(struct vnode *vp, struct uio *uio, int *workdone);
 #endif
 static vop_fsync_t ffs_fsync;
+static vop_fdatasync_t ffs_fdatasync;
 static vop_lock1_t ffs_lock;
 static vop_read_t  ffs_read;
 static vop_write_t ffs_write;
@@ -123,6 +124,7 @@ static vop_vptofh_t ffs_vptofh;
 struct vop_vector ffs_vnodeops1 = {
.vop_default =  &ufs_vnodeops,
.vop_fsync =ffs_fsync,
+   .vop_fdatasync =ffs_fdatasync,
.vop_getpages = vnode_pager_local_getpages,
.vop_getpages_async =   vnode_pager_local_getpages_async,
.vop_lock1 =ffs_lock,
@@ -135,6 +137,7 @@ struct vop_vector ffs_vnodeops1 = {
 struct vop_vector ffs_fifoops1 = {
.vop_default =  &ufs_fifoops,
.vop_fsync =ffs_fsync,
+   .vop_fdatasync =ffs_fdatasync,
.vop_reallocblks =  ffs_reallocblks, /* XXX: really ??? */
.vop_vptofh =   ffs_vptofh,
 };
@@ -143,6 +146,7 @@ struct vop_vector ffs_fifoops1 = {
 struct vop_vector ffs_vnodeops2 = {
.vop_default =  &ufs_vnodeops,
.vop_fsync =ffs_fsync,
+   .vop_fdatasync =ffs_fdatasync,
.vop_getpages = vnode_pager_local_getpages,
.vop_getpages_async =   vnode_pager_local_getpages_async,
.vop_lock1 =ffs_lock,
@@ -161,6 +165,7 @@ struct vop_vector ffs_vnodeops2 = {
 struct vop_vector ffs_fifoops2 = {
.vop_default =  &ufs_fifoops,
.vop_fsync =ffs_fsync,
+   .vop_fdatasync =ffs_fdatasync,
.vop_lock1 =ffs_lock,
.vop_reallocblks =  ffs_reallocblks,
.vop_strategy = ffsext_strategy,
@@ -216,10 +221,10 @@ ffs_syncvnode(struct vnode *vp, int wait
 {
struct inode *ip;
struct bufobj *bo;
-   struct buf *bp;
-   struct buf *nbp;
+   struct buf *bp, *nbp;
ufs_lbn_t lbn;
-   int error, wait, passes;
+   int error, passes;
+   bool still_dirty, wait;
 
ip = VTOI(vp);
ip->i_flag &= ~IN_NEEDSYNC;
@@ -238,7 +243,7 @@ ffs_syncvnode(struct vnode *vp, int wait
 */
error = 0;
passes = 0;
-   wait = 0;   /* Always do an async pass first. */
+   wait = false;   /* Always do an async pass first. */
lbn = lblkno(ip->i_fs, (ip->i_size + ip->i_fs->fs_bsize - 1));
BO_LOCK(bo);
 loop:
@@ -254,15 +259,23 @@ loop:
if ((bp->b_vflags & BV_SCANNED) != 0)
continue;
bp->b_vflags |= BV_SCANNED;
-   /* Flush indirects in order. */
+   /*
+* Flush indirects in order, if requested.
+*
+* Note that if only datasync is requested, we can
+* skip indirect blocks when softupdates are not
+* active.  Otherwise we must flush them with data,
+* since dependencies prevent data block writes.
+*/
if (waitfor == MNT_WAIT && bp->b_lblkno <= -NDADDR &&
-   lbn_level(bp->b_lblkno) >= passes)
+   (lbn_level(bp->b_lblkno) >= passes ||
+   ((flags & DATA_ONLY) != 0 && !DOINGSOFTDEP(vp
continue;
if (bp->b_lblkno > lbn)
panic("ffs_syncvnode: syncing truncated data.");
if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) == 0) {
BO_UNLOCK(bo);
- 

svn commit: r304181 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 19:37:18 2016
New Revision: 304181
URL: https://svnweb.freebsd.org/changeset/base/304181

Log:
  Restructure the grabbing functions into mere wrappers of new open and
  close functions.  Scattered calls to sc_cnputc() and sc_cngetc() were
  broken by turning the semi-reentrant inline context-switching code in
  these functions into the grabbing functions.  cncheckc() calls for
  panic dumps are the main broken case.  The grabbing functions have
  special behaviour (mainly screen switching in sc_cngrab()) which makes
  them unsuitable as replacements for the inline code.

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

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 19:22:23 2016
(r304180)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 19:37:18 2016
(r304181)
@@ -1645,8 +1645,12 @@ sc_cnterm(struct consdev *cp)
 sc_console = NULL;
 }
 
+struct sc_cnstate; /* not used yet */
+static void sccnclose(sc_softc_t *sc, struct sc_cnstate *sp);
+static void sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags);
+
 static void
-sc_cngrab(struct consdev *cp)
+sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags)
 {
 scr_stat *scp;
 int kbd_mode;
@@ -1662,9 +1666,6 @@ sc_cngrab(struct consdev *cp)
 if (scp->sc->kbd == NULL)
return;
 
-if (scp->sc->grab_level++ > 0)
-   return;
-
 /*
  * Make sure the keyboard is accessible even when the kbd device
  * driver is disabled.
@@ -1678,7 +1679,7 @@ sc_cngrab(struct consdev *cp)
 }
 
 static void
-sc_cnungrab(struct consdev *cp)
+sccnclose(sc_softc_t *sc, struct sc_cnstate *sp)
 {
 scr_stat *scp;
 
@@ -1686,9 +1687,6 @@ sc_cnungrab(struct consdev *cp)
 if (scp->sc->kbd == NULL)
return;
 
-if (--scp->sc->grab_level > 0)
-   return;
-
 /* Restore keyboard mode (for the current, possibly-changed scp). */
 kbdd_poll(scp->sc->kbd, FALSE);
 (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
@@ -1697,6 +1695,26 @@ sc_cnungrab(struct consdev *cp)
 }
 
 static void
+sc_cngrab(struct consdev *cp)
+{
+sc_softc_t *sc;
+
+sc = sc_console->sc;
+if (sc->grab_level++ == 0)
+   sccnopen(sc, NULL, 0);
+}
+
+static void
+sc_cnungrab(struct consdev *cp)
+{
+sc_softc_t *sc;
+
+sc = sc_console->sc;
+if (--sc->grab_level == 0)
+   sccnclose(sc, NULL);
+}
+
+static void
 sc_cnputc(struct consdev *cd, int c)
 {
 u_char buf[1];
___
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: r304182 - head/sys/compat/cloudabi

2016-08-15 Thread Ed Schouten
Author: ed
Date: Mon Aug 15 19:42:21 2016
New Revision: 304182
URL: https://svnweb.freebsd.org/changeset/base/304182

Log:
  Let CloudABI use fdatasync() as well.
  
  Now that FreeBSD supports fdatasync() natively, we can tidy up
  CloudABI's equivalent system call to use that instead.

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Mon Aug 15 19:37:18 2016
(r304181)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Mon Aug 15 19:42:21 2016
(r304182)
@@ -172,12 +172,11 @@ int
 cloudabi_sys_fd_datasync(struct thread *td,
 struct cloudabi_sys_fd_datasync_args *uap)
 {
-   struct fsync_args fsync_args = {
+   struct fdatasync_args fdatasync_args = {
.fd = uap->fd
};
 
-   /* Call into fsync(), as FreeBSD lacks fdatasync(). */
-   return (sys_fsync(td, &fsync_args));
+   return (sys_fdatasync(td, &fdatasync_args));
 }
 
 int
___
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: r304183 - head/cddl/usr.sbin/dtrace/tests/tools

2016-08-15 Thread Mark Johnston
Author: markj
Date: Mon Aug 15 19:47:04 2016
New Revision: 304183
URL: https://svnweb.freebsd.org/changeset/base/304183

Log:
  dtraceUtil/tst.DataModel32.d.ksh passes on amd64.

Modified:
  head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh

Modified: head/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
==
--- head/cddl/usr.sbin/dtrace/tests/tools/exclude.shMon Aug 15 19:42:21 
2016(r304182)
+++ head/cddl/usr.sbin/dtrace/tests/tools/exclude.shMon Aug 15 19:47:04 
2016(r304183)
@@ -27,7 +27,6 @@ exclude()
 }
 
 exclude EXFAIL common/aggs/tst.subr.d
-exclude EXFAIL common/dtraceUtil/tst.DataModel32.d.ksh
 exclude EXFAIL common/dtraceUtil/tst.ELFGenerationOut.d.ksh
 exclude EXFAIL common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
 exclude EXFAIL common/funcs/tst.copyin.d
___
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: r304182 - head/sys/compat/cloudabi

2016-08-15 Thread Konstantin Belousov
On Mon, Aug 15, 2016 at 07:42:21PM +, Ed Schouten wrote:
> Author: ed
> Date: Mon Aug 15 19:42:21 2016
> New Revision: 304182
> URL: https://svnweb.freebsd.org/changeset/base/304182
> 
> Log:
>   Let CloudABI use fdatasync() as well.
>   
>   Now that FreeBSD supports fdatasync() natively, we can tidy up
>   CloudABI's equivalent system call to use that instead.
> 
> Modified:
>   head/sys/compat/cloudabi/cloudabi_fd.c
> 
> Modified: head/sys/compat/cloudabi/cloudabi_fd.c
> ==
> --- head/sys/compat/cloudabi/cloudabi_fd.cMon Aug 15 19:37:18 2016
> (r304181)
> +++ head/sys/compat/cloudabi/cloudabi_fd.cMon Aug 15 19:42:21 2016
> (r304182)
> @@ -172,12 +172,11 @@ int
>  cloudabi_sys_fd_datasync(struct thread *td,
>  struct cloudabi_sys_fd_datasync_args *uap)
>  {
> - struct fsync_args fsync_args = {
> + struct fdatasync_args fdatasync_args = {
>   .fd = uap->fd
>   };
>  
> - /* Call into fsync(), as FreeBSD lacks fdatasync(). */
> - return (sys_fsync(td, &fsync_args));
> + return (sys_fdatasync(td, &fdatasync_args));
>  }
>  
Please make kern_fsync() non-static and use it instead of providing fake
fdatasync_args structure.
___
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: r304184 - head/sys/kern

2016-08-15 Thread Eric Badger
Author: badger
Date: Mon Aug 15 20:09:09 2016
New Revision: 304184
URL: https://svnweb.freebsd.org/changeset/base/304184

Log:
  sem_post(): wake up the sleeper only after adjusting has_waiters
  
  If the caller of sem_post() wakes up a thread sleeping via sem_wait()
  before it clears the has_waiters flag, the caller of sem_wait() has no way of
  knowing when it is safe to destroy the semaphore and reuse the memory. This is
  because the caller of sem_post() may be interrupted between the wake step and
  the clearing of has_waiters. It will then write into the has_waiters flag in
  userspace after being preempted for some unknown amount of time.
  
  Reviewed by:  jhb, kib, vangyzen
  Approved by:  kib (mentor), vangyzen (mentor)
  MFC after:2 weeks
  Sponsored by: Dell Inc.
  Differential Revision:https://reviews.freebsd.org/D7505

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Mon Aug 15 19:47:04 2016(r304183)
+++ head/sys/kern/kern_umtx.c   Mon Aug 15 20:09:09 2016(r304184)
@@ -3123,7 +3123,6 @@ do_sem_wake(struct thread *td, struct _u
umtxq_busy(&key);
cnt = umtxq_count(&key);
if (cnt > 0) {
-   umtxq_signal(&key, 1);
/*
 * Check if count is greater than 0, this means the memory is
 * still being referenced by user code, so we can safely
@@ -3136,6 +3135,7 @@ do_sem_wake(struct thread *td, struct _u
if (error == -1)
error = EFAULT;
}
+   umtxq_signal(&key, 1);
}
umtxq_unbusy(&key);
umtxq_unlock(&key);
@@ -3235,8 +3235,6 @@ do_sem2_wake(struct thread *td, struct _
umtxq_busy(&key);
cnt = umtxq_count(&key);
if (cnt > 0) {
-   umtxq_signal(&key, 1);
-
/*
 * If this was the last sleeping thread, clear the waiters
 * flag in _count.
@@ -3251,6 +3249,8 @@ do_sem2_wake(struct thread *td, struct _
error = EFAULT;
umtxq_lock(&key);
}
+
+   umtxq_signal(&key, 1);
}
umtxq_unbusy(&key);
umtxq_unlock(&key);
___
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: r304185 - in head/sys: compat/cloudabi compat/linux kern sys

2016-08-15 Thread Ed Schouten
Author: ed
Date: Mon Aug 15 20:11:52 2016
New Revision: 304185
URL: https://svnweb.freebsd.org/changeset/base/304185

Log:
  Eliminate use of sys_fsync() and sys_fdatasync().
  
  Make the kern_fsync() function public, so that it can be used by other
  parts of the kernel. Fix up existing consumers to make use of it.
  
  Requested by: kib

Modified:
  head/sys/compat/cloudabi/cloudabi_fd.c
  head/sys/compat/linux/linux_file.c
  head/sys/kern/vfs_syscalls.c
  head/sys/sys/syscallsubr.h

Modified: head/sys/compat/cloudabi/cloudabi_fd.c
==
--- head/sys/compat/cloudabi/cloudabi_fd.c  Mon Aug 15 20:09:09 2016
(r304184)
+++ head/sys/compat/cloudabi/cloudabi_fd.c  Mon Aug 15 20:11:52 2016
(r304185)
@@ -172,11 +172,8 @@ int
 cloudabi_sys_fd_datasync(struct thread *td,
 struct cloudabi_sys_fd_datasync_args *uap)
 {
-   struct fdatasync_args fdatasync_args = {
-   .fd = uap->fd
-   };
 
-   return (sys_fdatasync(td, &fdatasync_args));
+   return (kern_fsync(td, uap->fd, false));
 }
 
 int
@@ -556,9 +553,6 @@ cloudabi_sys_fd_stat_put(struct thread *
 int
 cloudabi_sys_fd_sync(struct thread *td, struct cloudabi_sys_fd_sync_args *uap)
 {
-   struct fsync_args fsync_args = {
-   .fd = uap->fd
-   };
 
-   return (sys_fsync(td, &fsync_args));
+   return (kern_fsync(td, uap->fd, true));
 }

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Mon Aug 15 20:09:09 2016
(r304184)
+++ head/sys/compat/linux/linux_file.c  Mon Aug 15 20:11:52 2016
(r304185)
@@ -1013,10 +1013,8 @@ linux_fdatasync(td, uap)
struct thread *td;
struct linux_fdatasync_args *uap;
 {
-   struct fsync_args bsd;
 
-   bsd.fd = uap->fd;
-   return (sys_fsync(td, &bsd));
+   return (kern_fsync(td, uap->fd, false));
 }
 
 int

Modified: head/sys/kern/vfs_syscalls.c
==
--- head/sys/kern/vfs_syscalls.cMon Aug 15 20:09:09 2016
(r304184)
+++ head/sys/kern/vfs_syscalls.cMon Aug 15 20:11:52 2016
(r304185)
@@ -3354,7 +3354,7 @@ freebsd6_ftruncate(struct thread *td, st
 }
 #endif
 
-static int
+int
 kern_fsync(struct thread *td, int fd, bool fullsync)
 {
struct vnode *vp;

Modified: head/sys/sys/syscallsubr.h
==
--- head/sys/sys/syscallsubr.h  Mon Aug 15 20:09:09 2016(r304184)
+++ head/sys/sys/syscallsubr.h  Mon Aug 15 20:11:52 2016(r304185)
@@ -100,6 +100,7 @@ int kern_fhstat(struct thread *td, fhand
 intkern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf);
 intkern_fstat(struct thread *td, int fd, struct stat *sbp);
 intkern_fstatfs(struct thread *td, int fd, struct statfs *buf);
+intkern_fsync(struct thread *td, int fd, bool fullsync);
 intkern_ftruncate(struct thread *td, int fd, off_t length);
 intkern_futimes(struct thread *td, int fd, struct timeval *tptr,
enum uio_seg tptrseg);
___
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: r304185 - in head/sys: compat/cloudabi compat/linux kern sys

2016-08-15 Thread Konstantin Belousov
On Mon, Aug 15, 2016 at 08:11:52PM +, Ed Schouten wrote:
> Author: ed
> Date: Mon Aug 15 20:11:52 2016
> New Revision: 304185
> URL: https://svnweb.freebsd.org/changeset/base/304185
> 
> Log:
>   Eliminate use of sys_fsync() and sys_fdatasync().
>   
>   Make the kern_fsync() function public, so that it can be used by other
>   parts of the kernel. Fix up existing consumers to make use of it.
>   
>   Requested by:   kib
> 
> Modified:
>   head/sys/compat/cloudabi/cloudabi_fd.c
>   head/sys/compat/linux/linux_file.c
>   head/sys/kern/vfs_syscalls.c
>   head/sys/sys/syscallsubr.h

Thank you, and esp. thank you for handling of linux.ko.
___
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: r304185 - in head/sys: compat/cloudabi compat/linux kern sys

2016-08-15 Thread Ed Schouten
2016-08-15 22:13 GMT+02:00 Konstantin Belousov :
> Thank you, and esp. thank you for handling of linux.ko.

And thank you for adding fdatasync() support in the first place. \o/

-- 
Ed Schouten 
Nuxi, 's-Hertogenbosch, the Netherlands
KvK-nr.: 62051717
___
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: r304186 - head/sys/dev/syscons

2016-08-15 Thread Bruce Evans
Author: bde
Date: Mon Aug 15 20:17:48 2016
New Revision: 304186
URL: https://svnweb.freebsd.org/changeset/base/304186

Log:
  Clean up the new sc cn open and close functions (old sc cn grab and ungrab
  functions).  Mainly, spell sc as itself instead of as scp->sc.

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

Modified: head/sys/dev/syscons/syscons.c
==
--- head/sys/dev/syscons/syscons.c  Mon Aug 15 20:11:52 2016
(r304185)
+++ head/sys/dev/syscons/syscons.c  Mon Aug 15 20:17:48 2016
(r304186)
@@ -1652,46 +1652,40 @@ static void sccnopen(sc_softc_t *sc, str
 static void
 sccnopen(sc_softc_t *sc, struct sc_cnstate *sp, int flags)
 {
-scr_stat *scp;
 int kbd_mode;
 
 if (!cold &&
-   sc_console->sc->cur_scp->index != sc_console->index &&
-   sc_console->sc->cur_scp->smode.mode == VT_AUTO &&
+   sc->cur_scp->index != sc_console->index &&
+   sc->cur_scp->smode.mode == VT_AUTO &&
sc_console->smode.mode == VT_AUTO)
-   sc_switch_scr(sc_console->sc, sc_console->index);
-
-scp = sc_console->sc->cur_scp;
+   sc_switch_scr(sc, sc_console->index);
 
-if (scp->sc->kbd == NULL)
+if (sc->kbd == NULL)
return;
 
 /*
  * Make sure the keyboard is accessible even when the kbd device
  * driver is disabled.
  */
-kbdd_enable(scp->sc->kbd);
+kbdd_enable(sc->kbd);
 
 /* Switch the keyboard to console mode (K_XLATE, polled) on all scp's. */
 kbd_mode = K_XLATE;
-(void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&kbd_mode);
-kbdd_poll(scp->sc->kbd, TRUE);
+(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&kbd_mode);
+kbdd_poll(sc->kbd, TRUE);
 }
 
 static void
 sccnclose(sc_softc_t *sc, struct sc_cnstate *sp)
 {
-scr_stat *scp;
-
-scp = sc_console->sc->cur_scp; /* XXX */
-if (scp->sc->kbd == NULL)
+if (sc->kbd == NULL)
return;
 
 /* Restore keyboard mode (for the current, possibly-changed scp). */
-kbdd_poll(scp->sc->kbd, FALSE);
-(void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
+kbdd_poll(sc->kbd, FALSE);
+(void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&sc->cur_scp->kbd_mode);
 
-kbdd_disable(scp->sc->kbd);
+kbdd_disable(sc->kbd);
 }
 
 static void
___
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: r304187 - in head: . share/man/man4 sys/conf sys/dev/mcd sys/modules sys/modules/mcd

2016-08-15 Thread John Baldwin
Author: jhb
Date: Mon Aug 15 20:38:02 2016
New Revision: 304187
URL: https://svnweb.freebsd.org/changeset/base/304187

Log:
  Remove the mcd(4) driver for Mitsumi CD-ROM players.
  
  This is a driver for a pre-ATAPI ISA CD-ROM adapter.  As noted in
  the manpage, this driver is only useful as a backend to cdcontrol to
  play audio CDs since it doesn't use DMA, so its data performance is
  "abysmal" (and that was true in the mid 90's).

Deleted:
  head/share/man/man4/mcd.4
  head/sys/dev/mcd/
  head/sys/modules/mcd/
Modified:
  head/ObsoleteFiles.inc
  head/share/man/man4/Makefile
  head/sys/conf/NOTES
  head/sys/conf/files
  head/sys/modules/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Aug 15 20:17:48 2016(r304186)
+++ head/ObsoleteFiles.inc  Mon Aug 15 20:38:02 2016(r304187)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20160815: Remove mcd(4)
+OLD_FILES+=usr/share/man/man4/mcd.4.gz
 # 20160703: POSIXify locales with variants
 OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_COLLATE
 OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_CTYPE

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileMon Aug 15 20:17:48 2016
(r304186)
+++ head/share/man/man4/MakefileMon Aug 15 20:38:02 2016
(r304187)
@@ -269,7 +269,6 @@ MAN=aac.4 \
mac_stub.4 \
mac_test.4 \
malo.4 \
-   mcd.4 \
md.4 \
mdio.4 \
me.4 \

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon Aug 15 20:17:48 2016(r304186)
+++ head/sys/conf/NOTES Mon Aug 15 20:38:02 2016(r304187)
@@ -2412,15 +2412,10 @@ options SND_OLDSTEREO
 # Miscellaneous hardware:
 #
 # scd: Sony CD-ROM using proprietary (non-ATAPI) interface
-# mcd: Mitsumi CD-ROM using proprietary (non-ATAPI) interface
 # bktr: Brooktree bt848/848a/849a/878/879 video capture and TV Tuner board
 # joy: joystick (including IO DATA PCJOY PC Card joystick)
 # cmx: OmniKey CardMan 4040 pccard smartcard reader
 
-# Mitsumi CD-ROM
-device mcd
-hint.mcd.0.at="isa"
-hint.mcd.0.port="0x300"
 # for the Sony CDU31/33A CDROM
 device scd
 hint.scd.0.at="isa"

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Aug 15 20:17:48 2016(r304186)
+++ head/sys/conf/files Mon Aug 15 20:38:02 2016(r304187)
@@ -2018,8 +2018,6 @@ dev/malo/if_malohal.c optional malo
 dev/malo/if_malo_pci.c optional malo pci
 dev/mc146818/mc146818.coptional mc146818
 dev/mca/mca_bus.c  optional mca
-dev/mcd/mcd.c  optional mcd isa nowerror
-dev/mcd/mcd_isa.c  optional mcd isa nowerror
 dev/md/md.coptional md
 dev/mdio/mdio_if.m optional miiproxy | mdio
 dev/mdio/mdio.coptional miiproxy | mdio

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Mon Aug 15 20:17:48 2016(r304186)
+++ head/sys/modules/Makefile   Mon Aug 15 20:38:02 2016(r304187)
@@ -224,7 +224,6 @@ SUBDIR= \
mac_stub \
mac_test \
malo \
-   mcd \
md \
mdio \
mem \
___
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: r304187 - in head: . share/man/man4 sys/conf sys/dev/mcd sys/modules sys/modules/mcd

2016-08-15 Thread John Baldwin
On Monday, August 15, 2016 08:38:02 PM John Baldwin wrote:
> Author: jhb
> Date: Mon Aug 15 20:38:02 2016
> New Revision: 304187
> URL: https://svnweb.freebsd.org/changeset/base/304187
> 
> Log:
>   Remove the mcd(4) driver for Mitsumi CD-ROM players.
>   
>   This is a driver for a pre-ATAPI ISA CD-ROM adapter.  As noted in
>   the manpage, this driver is only useful as a backend to cdcontrol to
>   play audio CDs since it doesn't use DMA, so its data performance is
>   "abysmal" (and that was true in the mid 90's).

No one stepped up to test patches for it either when I last posted patches to
convert it from timeout(9) to callout(9).  I have a few more drivers that are
both very old and that people have no business using in 12 (think ISA
adapters that don't do DMA and can't be used with pccard) that I will be
removing over the next little while.  I brought up a list of drivers on arch@
a couple of years ago and the conversation drifted off into the weeds about
trimming GENERIC, etc.  No one objected to the specific drivers I listed
though (and I got a few pleas of "please remove").  If someone shows up
desperately clutching an ISA adapter they can always dig up the source from
svn and deal with forward porting it for whatever API changes have happened
since it was removed.

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


Re: svn commit: r304187 - in head: . share/man/man4 sys/conf sys/dev/mcd sys/modules sys/modules/mcd

2016-08-15 Thread Jung-uk Kim
On 08/15/2016 16:54, John Baldwin wrote:
> On Monday, August 15, 2016 08:38:02 PM John Baldwin wrote:
>> Author: jhb
>> Date: Mon Aug 15 20:38:02 2016
>> New Revision: 304187
>> URL: https://svnweb.freebsd.org/changeset/base/304187
>>
>> Log:
>>   Remove the mcd(4) driver for Mitsumi CD-ROM players.
>>   
>>   This is a driver for a pre-ATAPI ISA CD-ROM adapter.  As noted in
>>   the manpage, this driver is only useful as a backend to cdcontrol to
>>   play audio CDs since it doesn't use DMA, so its data performance is
>>   "abysmal" (and that was true in the mid 90's).
> 
> No one stepped up to test patches for it either when I last posted patches to
> convert it from timeout(9) to callout(9).  I have a few more drivers that are
> both very old and that people have no business using in 12 (think ISA
> adapters that don't do DMA and can't be used with pccard) that I will be
> removing over the next little while.  I brought up a list of drivers on arch@
> a couple of years ago and the conversation drifted off into the weeds about
> trimming GENERIC, etc.  No one objected to the specific drivers I listed
> though (and I got a few pleas of "please remove").  If someone shows up
> desperately clutching an ISA adapter they can always dig up the source from
> svn and deal with forward porting it for whatever API changes have happened
> since it was removed.

I have one of these Mitsumi CD-ROM drives somewhere in my basement but I
haven't used it for many years.  I think I only used it with "PAO", though.

http://www.jp.freebsd.org/PAO/index.html

Maybe we should kill APM, too! ;-)

Jung-uk Kim



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r304045 - head/share/timedef

2016-08-15 Thread Jung-uk Kim
On 08/13/2016 11:59, Baptiste Daroussin wrote:
> Author: bapt
> Date: Sat Aug 13 15:59:18 2016
> New Revision: 304045
> URL: https://svnweb.freebsd.org/changeset/base/304045
> 
> Log:
>   Set date and time formats back to what they were before CLDR
...

This broke ko_KR.* and zh_* date formats.  Try

env LANG=ko_KR.UTF-8 date
env LANG=zh_CN.UTF-8 date

You'll see "" is repeated.

Jung-uk Kim
___
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: r304191 - head/contrib/elftoolchain/elfcopy

2016-08-15 Thread Ed Maste
Author: emaste
Date: Mon Aug 15 23:20:55 2016
New Revision: 304191
URL: https://svnweb.freebsd.org/changeset/base/304191

Log:
  elfcopy: correct comment typo in r304151

Modified:
  head/contrib/elftoolchain/elfcopy/ascii.c

Modified: head/contrib/elftoolchain/elfcopy/ascii.c
==
--- head/contrib/elftoolchain/elfcopy/ascii.c   Mon Aug 15 21:44:06 2016
(r304190)
+++ head/contrib/elftoolchain/elfcopy/ascii.c   Mon Aug 15 23:20:55 2016
(r304191)
@@ -251,7 +251,7 @@ create_elf_from_srec(struct elfcopy *ecp
sec_index = 1;
sec_addr = entry = 0;
while (fgets(line, _LINE_BUFSZ, ifp) != NULL) {
-   sz = 0; /* Silence GCC 5.3 unintialized variable warning */
+   sz = 0; /* Silence GCC 5.3 uninitialized variable warning */
if (line[0] == '\r' || line[0] == '\n')
continue;
if (line[0] == '$' && line[1] == '$') {
___
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: r304192 - head/share/timedef

2016-08-15 Thread Jung-uk Kim
Author: jkim
Date: Tue Aug 16 00:15:15 2016
New Revision: 304192
URL: https://svnweb.freebsd.org/changeset/base/304192

Log:
  Fix ko_KR, zh_CN, zh_HK, and zh_TW locales.  r304045 did not fully revert
  date/time formats for these locales.

Modified:
  head/share/timedef/ko_KR.UTF-8.src
  head/share/timedef/ko_KR.eucKR.src   (contents, props changed)
  head/share/timedef/zh_CN.GB2312.src   (contents, props changed)
  head/share/timedef/zh_CN.GBK.src   (contents, props changed)
  head/share/timedef/zh_CN.UTF-8.src
  head/share/timedef/zh_CN.eucCN.src   (contents, props changed)
  head/share/timedef/zh_HK.UTF-8.src   (contents, props changed)
  head/share/timedef/zh_TW.Big5.src   (contents, props changed)
  head/share/timedef/zh_TW.UTF-8.src   (contents, props changed)

Modified: head/share/timedef/ko_KR.UTF-8.src
==
--- head/share/timedef/ko_KR.UTF-8.src  Mon Aug 15 23:20:55 2016
(r304191)
+++ head/share/timedef/ko_KR.UTF-8.src  Tue Aug 16 00:15:15 2016
(r304192)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1월
- 2월
- 3월
- 4월
- 5월
- 6월
- 7월
- 8월
- 9월
-10월
-11월
-12월
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
 #
 # Long month names (as in a date)
 1월

Modified: head/share/timedef/ko_KR.eucKR.src
==
--- head/share/timedef/ko_KR.eucKR.src  Mon Aug 15 23:20:55 2016
(r304191)
+++ head/share/timedef/ko_KR.eucKR.src  Tue Aug 16 00:15:15 2016
(r304192)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1��
- 2��
- 3��
- 4��
- 5��
- 6��
- 7��
- 8��
- 9��
-10��
-11��
-12��
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
 #
 # Long month names (as in a date)
 1��

Modified: head/share/timedef/zh_CN.GB2312.src
==
--- head/share/timedef/zh_CN.GB2312.src Mon Aug 15 23:20:55 2016
(r304191)
+++ head/share/timedef/zh_CN.GB2312.src Tue Aug 16 00:15:15 2016
(r304192)
@@ -4,53 +4,53 @@
 # -
 #
 # Short month names
-!!#1TB
-!!#2TB
-!!#3TB
-!!#4TB
-!!#5TB
-!!#6TB
-!!#7TB
-!!#8TB
-!!#9TB
-#1#0TB
-#1#1TB
-#1#2TB
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
 #
 # Long month names (as in a date)
-R;TB
-6~TB
-H}TB
-KDTB
-NeTB
-AyTB
-F_TB
-0KTB
->ETB
-J.TB
-J.R;TB
-J.6~TB
+һ��
+
+
+
+
+
+
+
+
+ʮ��
+ʮһ��
+ʮ
 #
 # Short weekday names
-V\HU
-V\R;
-V\6~
-V\H}
-V\KD
-V\Ne
-V\Ay
+
+��һ
+�ܶ�
+
+
+
+
 #
 # Long weekday names
-PGFZHU
-PGFZR;
-PGFZ6~
-PGFZH}
-PGFZKD
-PGFZNe
-PGFZAy
+��
+һ
+���ڶ�
+��
+��
+��
+��
 #
 # X_fmt
-%Hʱ%M·Ö%SÃë
+%Hʱ%M��%S��
 #
 # x_fmt
 %Y/%m/%d
@@ -59,25 +59,25 @@ PGFZAy
 %a %b/%e %T %Y
 #
 # AM/PM
-IONg
-OBNg
+
+
 #
 # date_fmt
-%YÄê%bÔÂ%eÈÕ %A %X %Z
+%Y��%b��%e�� %A %X %Z
 #
 # Long month names (without case ending)
-R;TB
-6~TB
-H}TB
-KDTB
-NeTB
-AyTB
-F_TB
-0KTB
->ETB
-J.TB
-J.R;TB
-J.6~TB
+һ��
+
+
+
+
+
+
+
+
+ʮ��
+ʮһ��
+ʮ
 #
 # md_order
 md

Modified: head/share/timedef/zh_CN.GBK.src
==
--- head/share/timedef/zh_CN.GBK.srcMon Aug 15 23:20:55 2016
(r304191)
+++ head/share/timedef/zh_CN.GBK.srcTue Aug 16 00:15:15 2016
(r304192)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1��
- 2��
- 3��
- 4��
- 5��
- 6��
- 7��
- 8��
- 9��
-10��
-11��
-12��
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
 #
 # Long month names (as in a date)
 һ��

Modified: head/share/timedef/zh_CN.UTF-8.src
==
Binary file (source and/or target). No diff available.

Modified: head/share/timedef/zh_CN.eucCN.src
==
--- head/share/timedef/zh_CN.eucCN.src  Mon Aug 15 23:20:55 2016
(r304191)
+++ head/share/timedef/zh_CN.eucCN.src  Tue Aug 16 00:15:15 2016
(r304192)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
-��
-��
-��
-��
-��
-��
-��
-��
-��
-��
-��
-��
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+10
+11
+12
 #
 # Long month names (as in a date)
 һ��

Modified: head/share/timedef/zh_HK.UTF-8.src
==
--- head/share/timedef/zh_HK.UTF-8.src  Mon Aug 15 23:20:55 2016
(r304191)
+++ head/share/timedef/zh_HK.UTF-8.src  Tue Aug 16 00:15:15 2016
(r304192)
@@ -4,18 +4,18 @@
 # -

svn commit: r304194 - head/usr.bin/nfsstat

2016-08-15 Thread Rick Macklem
Author: rmacklem
Date: Tue Aug 16 00:48:13 2016
New Revision: 304194
URL: https://svnweb.freebsd.org/changeset/base/304194

Log:
  Fix r304026 so that it builds for gcc.
  
  Reported by:  np
  Tested by:np
  MFC after:1 month

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

Modified: head/usr.bin/nfsstat/nfsstat.c
==
--- head/usr.bin/nfsstat/nfsstat.c  Tue Aug 16 00:40:38 2016
(r304193)
+++ head/usr.bin/nfsstat/nfsstat.c  Tue Aug 16 00:48:13 2016
(r304194)
@@ -130,7 +130,8 @@ static void compute_new_stats(struct nfs
 struct stattypes {
int stat_type;
int nfs_type;
-} static statstruct[] = {
+};
+static struct stattypes statstruct[] = {
{STAT_TYPE_READ, NFSV4OP_READ},
{STAT_TYPE_WRITE, NFSV4OP_WRITE},
{STAT_TYPE_COMMIT, NFSV4OP_COMMIT}
___
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: r304195 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:14:36 2016
New Revision: 304195
URL: https://svnweb.freebsd.org/changeset/base/304195

Log:
  MFV r304056:
  5396 fix longjmp clobbering errors
  
  illumos/illumos-gate@67a4bb8f9ad4c49e9aa9e21e2114a7c093c3a73a
  
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Igor Kozhukhov 
  Approved by: Richard Lowe 
  Author: Gary Mills 

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Tue Aug 16 
00:48:13 2016(r304194)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Tue Aug 16 
02:14:36 2016(r304195)
@@ -23,6 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2013, Joyent Inc. All rights reserved.
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright 2015 Gary Mills
  */
 
 /*
@@ -2435,7 +2436,7 @@ dt_compile(dtrace_hdl_t *dtp, int contex
dt_node_t *dnp;
dt_decl_t *ddp;
dt_pcb_t pcb;
-   void *rv;
+   void *volatile rv;
int err;
 
if ((fp == NULL && s == NULL) || (cflags & ~DTRACE_C_MASK) != 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: r304196 - in head: cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars sys/cddl/contrib/opensolaris/uts/common/dtrace

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:16:54 2016
New Revision: 304196
URL: https://svnweb.freebsd.org/changeset/base/304196

Log:
  MFV r296989:
  6734 dtrace_canstore_statvar() fails for some valid static variables
  
  Reviewed by: Dan McDonald 
  Approved by: Richard Lowe 
  Author: Bryan Cantrill 
  
  illumos/illumos-gate@d65f2bb4e50559c6c375a2aa9f728cbc34379015
  
  MFC after:2 weeks

Added:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
 - copied unchanged from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d
 - copied unchanged from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d
Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)
  head/sys/cddl/contrib/opensolaris/   (props changed)

Copied: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
 (from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d
Tue Aug 16 02:16:54 2016(r304196, copy of r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16kglobal.d)
@@ -0,0 +1,32 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option strsize=16k
+
+char *k;
+
+BEGIN
+{
+   j = probeprov;
+   k = j;
+   k[0] = 'D';
+   k[1] = 'T';
+}
+
+BEGIN
+{
+   trace(stringof(k));
+   exit(k == "DTrace" ? 0 : 1);
+}

Copied: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d 
(from r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d 
Tue Aug 16 02:16:54 2016(r304196, copy of r296989, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/scalars/tst.16klocal.d)
@@ -0,0 +1,29 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source.  A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2016, Joyent, Inc. All rights reserved.
+ */
+
+#pragma D option strsize=16k
+
+BEGIN
+{
+   this->j = probeprov;
+   this->j[0] = 'D';
+   this->j[1] = 'T';
+}
+
+BEGIN
+{
+   trace(this->j);
+   exit(this->j == "DTrace" ? 0 : 1);
+}

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:14:36 2016(r304195)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:16:54 2016(r304196)
@@ -707,8 +707,8 @@ dtrace_canstore_statvar(uint64_t addr, s
if (nsvars == 0)
return (0);
 
-   maxglobalsize = dtrace_statvar_maxsize;
-   maxlocalsize = (maxglobalsize + sizeof (uint64_t)) * NCPU;
+   maxglobalsize = dtrace_statvar_maxsize + sizeof (uint64_t);
+   maxlocalsize = maxglobalsize * NCPU;
 
for (i = 0; i < nsvars; i++) {
dtrace_statvar_t *svar = svars[i];
@@ -726,8 +726,8 @@ dtrace_canstore_statvar(uint64_t addr, s
 * DTrace to escalate an orthogonal kernel heap corruption bug
 * into the ability to store to arbitrary locations in memory.
 */
-   VERIFY((scope == DIFV_SCOPE_GLOBAL && size < maxglobalsize) ||
-   (scope == DIFV_SCOPE_LOCAL && size < maxlocalsize));
+   VERIFY((scope == DIFV_SCOPE_GLOBAL && size <= maxglobalsize) ||
+   (scope == DIFV_SCOPE_LOCAL && size <= maxlocalsize));
 
if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size))
r

svn commit: r304197 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:18:34 2016
New Revision: 304197
URL: https://svnweb.freebsd.org/changeset/base/304197

Log:
  MFV r301524:
  7034 negative record sizes should be rejected
  
  Reviewed by: Patrick Mooney 
  Reviewed by: Bryan Cantrill 
  Approved by: Matthew Ahrens 
  Author: Alex Wilson 
  
  illumos/illumos-gate@0b8049bfb0e291160e960697b554596289d7f0bc
  
  MFC after:2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:16:54 2016(r304196)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:18:34 2016(r304197)
@@ -11017,7 +11017,7 @@ dtrace_ecb_enable(dtrace_ecb_t *ecb)
}
 }
 
-static void
+static int
 dtrace_ecb_resize(dtrace_ecb_t *ecb)
 {
dtrace_action_t *act;
@@ -11051,6 +11051,8 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
 
curneeded = P2ROUNDUP(curneeded, rec->dtrd_alignment);
rec->dtrd_offset = curneeded;
+   if (curneeded + rec->dtrd_size < curneeded)
+   return (EINVAL);
curneeded += rec->dtrd_size;
ecb->dte_needed = MAX(ecb->dte_needed, curneeded);
 
@@ -11075,6 +11077,8 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
}
curneeded = P2ROUNDUP(curneeded, rec->dtrd_alignment);
rec->dtrd_offset = curneeded;
+   if (curneeded + rec->dtrd_size < curneeded)
+   return (EINVAL);
curneeded += rec->dtrd_size;
} else {
/* tuples must be followed by an aggregation */
@@ -11084,6 +11088,8 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
ecb->dte_size = P2ROUNDUP(ecb->dte_size,
rec->dtrd_alignment);
rec->dtrd_offset = ecb->dte_size;
+   if (ecb->dte_size + rec->dtrd_size < ecb->dte_size)
+   return (EINVAL);
ecb->dte_size += rec->dtrd_size;
ecb->dte_needed = MAX(ecb->dte_needed, ecb->dte_size);
}
@@ -11103,6 +11109,7 @@ dtrace_ecb_resize(dtrace_ecb_t *ecb)
ecb->dte_needed = P2ROUNDUP(ecb->dte_needed, (sizeof (dtrace_epid_t)));
ecb->dte_state->dts_needed = MAX(ecb->dte_state->dts_needed,
ecb->dte_needed);
+   return (0);
 }
 
 static dtrace_action_t *
@@ -11788,7 +11795,10 @@ dtrace_ecb_create(dtrace_state_t *state,
}
}
 
-   dtrace_ecb_resize(ecb);
+   if ((enab->dten_error = dtrace_ecb_resize(ecb)) != 0) {
+   dtrace_ecb_destroy(ecb);
+   return (NULL);
+   }
 
return (dtrace_ecb_create_cache = ecb);
 }
___
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: r304198 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:20:02 2016
New Revision: 304198
URL: https://svnweb.freebsd.org/changeset/base/304198

Log:
  MFV r301525:
  7033 ustack helper should fault on bad return values
  
  Reviewed by: Patrick Mooney 
  Reviewed by: Bryan Cantrill 
  Approved by: Matthew Ahrens 
  Author: Alex Wilson 
  
  illumos/illumos-gate@a2f72b65ebc430aaf277ad797e554bb4deba9b95
  
  MFC after:2 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:18:34 2016(r304197)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:20:02 2016(r304198)
@@ -6929,6 +6929,7 @@ dtrace_action_ustack(dtrace_mstate_t *ms
uint64_t *pcs = &buf[1], *fps;
char *str = (char *)&pcs[nframes];
int size, offs = 0, i, j;
+   size_t rem;
uintptr_t old = mstate->dtms_scratch_ptr, saved;
uint16_t *flags = &cpu_core[curcpu].cpuc_dtrace_flags;
char *sym;
@@ -7000,12 +7001,18 @@ dtrace_action_ustack(dtrace_mstate_t *ms
continue;
}
 
+   if (!dtrace_strcanload((uintptr_t)sym, strsize, &rem, mstate,
+   &(state->dts_vstate))) {
+   str[offs++] = '\0';
+   continue;
+   }
+
DTRACE_CPUFLAG_SET(CPU_DTRACE_NOFAULT);
 
/*
 * Now copy in the string that the helper returned to us.
 */
-   for (j = 0; offs + j < strsize; j++) {
+   for (j = 0; offs + j < strsize && j < rem; j++) {
if ((str[offs + j] = sym[j]) == '\0')
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: r304199 - in head/sys/cddl/contrib/opensolaris/uts/common: dtrace sys

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:25:19 2016
New Revision: 304199
URL: https://svnweb.freebsd.org/changeset/base/304199

Log:
  MFV r301526:
  7035 string-related subroutines should validate input earlier
  
  Reviewed by: Alex Wilson 
  Reviewed by: Bryan Cantrill 
  Approved by: Matthew Ahrens 
  Author: Patrick Mooney 
  
  illumos/illumos-gate@771e39c3b1d6e2e0ba230442d782d83c60098296
  
  MFC after:2 weeks

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  head/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:20:02 2016(r304198)
+++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.cTue Aug 
16 02:25:19 2016(r304199)
@@ -480,6 +480,14 @@ static kmutex_t dtrace_errlock;
(testaddr) + (testsz) - (uintptr_t)(baseaddr) <= (basesz) && \
(testaddr) + (testsz) >= (testaddr))
 
+#defineDTRACE_RANGE_REMAIN(remp, addr, baseaddr, basesz)   
\
+do {   \
+   if ((remp) != NULL) {   \
+   *(remp) = (uintptr_t)(baseaddr) + (basesz) - (addr);\
+   }   \
+_NOTE(CONSTCOND) } while (0)
+
+
 /*
  * Test whether alloc_sz bytes will fit in the scratch region.  We isolate
  * alloc_sz on the righthand side of the comparison in order to avoid overflow
@@ -588,6 +596,10 @@ dtrace_dynvar_t *dtrace_dynvar(dtrace_ds
 uintptr_t dtrace_dif_varstr(uintptr_t, dtrace_state_t *, dtrace_mstate_t *);
 static int dtrace_priv_proc(dtrace_state_t *);
 static void dtrace_getf_barrier(void);
+static int dtrace_canload_remains(uint64_t, size_t, size_t *,
+dtrace_mstate_t *, dtrace_vstate_t *);
+static int dtrace_canstore_remains(uint64_t, size_t, size_t *,
+dtrace_mstate_t *, dtrace_vstate_t *);
 
 /*
  * DTrace Probe Context Functions
@@ -698,7 +710,7 @@ dtrace_inscratch(uintptr_t dest, size_t 
 }
 
 static int
-dtrace_canstore_statvar(uint64_t addr, size_t sz,
+dtrace_canstore_statvar(uint64_t addr, size_t sz, size_t *remain,
 dtrace_statvar_t **svars, int nsvars)
 {
int i;
@@ -729,8 +741,12 @@ dtrace_canstore_statvar(uint64_t addr, s
VERIFY((scope == DIFV_SCOPE_GLOBAL && size <= maxglobalsize) ||
(scope == DIFV_SCOPE_LOCAL && size <= maxlocalsize));
 
-   if (DTRACE_INRANGE(addr, sz, svar->dtsv_data, svar->dtsv_size))
+   if (DTRACE_INRANGE(addr, sz, svar->dtsv_data,
+   svar->dtsv_size)) {
+   DTRACE_RANGE_REMAIN(remain, addr, svar->dtsv_data,
+   svar->dtsv_size);
return (1);
+   }
}
 
return (0);
@@ -746,12 +762,26 @@ static int
 dtrace_canstore(uint64_t addr, size_t sz, dtrace_mstate_t *mstate,
 dtrace_vstate_t *vstate)
 {
+   return (dtrace_canstore_remains(addr, sz, NULL, mstate, vstate));
+}
+
+/*
+ * Implementation of dtrace_canstore which communicates the upper bound of the
+ * allowed memory region.
+ */
+static int
+dtrace_canstore_remains(uint64_t addr, size_t sz, size_t *remain,
+dtrace_mstate_t *mstate, dtrace_vstate_t *vstate)
+{
/*
 * First, check to see if the address is in scratch space...
 */
if (DTRACE_INRANGE(addr, sz, mstate->dtms_scratch_base,
-   mstate->dtms_scratch_size))
+   mstate->dtms_scratch_size)) {
+   DTRACE_RANGE_REMAIN(remain, addr, mstate->dtms_scratch_base,
+   mstate->dtms_scratch_size);
return (1);
+   }
 
/*
 * Now check to see if it's a dynamic variable.  This check will pick
@@ -804,6 +834,7 @@ dtrace_canstore(uint64_t addr, size_t sz
((dvar->dtdv_tuple.dtt_nkeys - 1) * sizeof (dtrace_key_t)))
return (0);
 
+   DTRACE_RANGE_REMAIN(remain, addr, dvar, dstate->dtds_chunksize);
return (1);
}
 
@@ -811,11 +842,11 @@ dtrace_canstore(uint64_t addr, size_t sz
 * Finally, check the static local and global variables.  These checks
 * take the longest, so we perform them last.
 */
-   if (dtrace_canstore_statvar(addr, sz,
+   if (dtrace_canstore_statvar(addr, sz, remain,
vstate->dtvs_locals, vstate->dtvs_nlocals))
return (1);
 
-   if (dtrace_canstore_statvar(addr, sz,
+   if (dtrace_canstore_statvar(addr, sz, remain,
vstate->dtvs_globals, vstate->dtvs_nglobals))
return (1);
 
@@ -836,6 +867,17 @@ static int
 dtrace_canload(uint

svn commit: r304200 - in head/cddl: contrib/opensolaris/cmd/dtrace/test/cmd/scripts contrib/opensolaris/cmd/dtrace/test/tst/common/sugar contrib/opensolaris/lib/libdtrace/common lib/libdtrace

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:30:19 2016
New Revision: 304200
URL: https://svnweb.freebsd.org/changeset/base/304200

Log:
  MFV r304057:
  7085 add support for "if" and "else" statements in dtrace
  
  illumos/illumos-gate@c3bd3abd8856e8e75d820f65c58031cd6cbac818
  
  Add syntactic sugar to dtrace: "if" and "else" statements. The sugar is
  baked down to standard dtrace features by adding additional clauses with
  the appropriate predicates.
  
  Reviewed by: Adam Leventhal 
  Reviewed by: Sebastien Roy 
  Reviewed by: Paul Dagnelie 
  Reviewed by: Bryan Cantrill 
  Approved by: Richard Lowe 
  Author: Matthew Ahrens 
  
  MFC after:2 weeks
  Relnotes: yes

Added:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/sugar/
 - copied from r304057, 
vendor/illumos/dist/cmd/dtrace/test/tst/common/sugar/
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_sugar.c
 - copied unchanged from r304057, 
vendor/illumos/dist/lib/libdtrace/common/dt_sugar.c
Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_grammar.y
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.h
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
  head/cddl/lib/libdtrace/Makefile
Directory Properties:
  head/cddl/contrib/opensolaris/   (props changed)

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl Tue Aug 
16 02:25:19 2016(r304199)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/cmd/scripts/dstyle.pl Tue Aug 
16 02:30:19 2016(r304200)
@@ -25,6 +25,10 @@
 # Use is subject to license terms.
 #
 
+#
+# Copyright (c) 2014, 2016 by Delphix. All rights reserved.
+#
+
 require 5.8.4;
 
 $PNAME = $0;
@@ -131,7 +135,8 @@ sub dstyle
}
 
if (!/^enum/ && !/^\t*struct/ && !/^\t*union/ && !/^typedef/ &&
-   !/^translator/ && !/^provider/) {
+   !/^translator/ && !/^provider/ && !/\tif / &&
+   !/ else /) {
if (/[\w\s]+{/) {
err "left brace not on its own line";
}
@@ -141,7 +146,7 @@ sub dstyle
}
}
 
-   if (!/;$/) {
+   if (!/;$/ && !/\t*}$/ && !/ else /) {
if (/[\w\s]+}/) {
err "right brace not on its own line";
}

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Tue Aug 16 
02:25:19 2016(r304199)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c  Tue Aug 16 
02:30:19 2016(r304200)
@@ -21,8 +21,8 @@
 
 /*
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2016 by Delphix. All rights reserved.
  * Copyright (c) 2013, Joyent Inc. All rights reserved.
- * Copyright (c) 2012 by Delphix. All rights reserved.
  * Copyright 2015 Gary Mills
  */
 
@@ -120,7 +120,6 @@ static const dtrace_diftype_t dt_int_rty
 static void *dt_compile(dtrace_hdl_t *, int, dtrace_probespec_t, void *,
 uint_t, int, char *const[], FILE *, const char *);
 
-
 /*ARGSUSED*/
 static int
 dt_idreset(dt_idhash_t *dhp, dt_ident_t *idp, void *ignored)
@@ -2519,6 +2518,28 @@ dt_compile(dtrace_hdl_t *dtp, int contex
}
 
/*
+* Perform sugar transformations (for "if" / "else") and replace the
+* existing clause chain with the new one.
+*/
+   if (context == DT_CTX_DPROG) {
+   dt_node_t *dnp, *next_dnp;
+   dt_node_t *new_list = NULL;
+
+   for (dnp = yypcb->pcb_root->dn_list;
+   dnp != NULL; dnp = next_dnp) {
+   /* remove this node from the list */
+   next_dnp = dnp->dn_list;
+   dnp->dn_list = NULL;
+
+   if (dnp->dn_kind == DT_NODE_CLAUSE)
+   dnp = dt_compile_sugar(dtp, dnp);
+   /* append node to the new list */
+   new_list = dt_node_link(new_list, dnp);
+   }
+   yypcb->pcb_root->dn_list = new_list;
+   }
+
+   /*
 * If we have successfully created a parse tree for a D program, loop
 * over the clauses and actions and instantiate the corresponding
 * libdtrace program.  If 

svn commit: r304201 - in head: cddl/usr.sbin/dtrace/tests/common cddl/usr.sbin/dtrace/tests/common/scalars cddl/usr.sbin/dtrace/tests/common/sugar etc/mtree

2016-08-15 Thread Mark Johnston
Author: markj
Date: Tue Aug 16 02:34:25 2016
New Revision: 304201
URL: https://svnweb.freebsd.org/changeset/base/304201

Log:
  Regenerate DTrace tests.

Added:
  head/cddl/usr.sbin/dtrace/tests/common/sugar/
  head/cddl/usr.sbin/dtrace/tests/common/sugar/Makefile   (contents, props 
changed)
Modified:
  head/cddl/usr.sbin/dtrace/tests/common/Makefile
  head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile
  head/etc/mtree/BSD.tests.dist

Modified: head/cddl/usr.sbin/dtrace/tests/common/Makefile
==
--- head/cddl/usr.sbin/dtrace/tests/common/Makefile Tue Aug 16 02:30:19 
2016(r304200)
+++ head/cddl/usr.sbin/dtrace/tests/common/Makefile Tue Aug 16 02:34:25 
2016(r304201)
@@ -69,6 +69,7 @@ TESTS_SUBDIRS+= aggs \
strlen \
strtoll \
struct \
+   sugar \
syscall \
tick-n \
trace \

Modified: head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile
==
--- head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Tue Aug 16 
02:30:19 2016(r304200)
+++ head/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile Tue Aug 16 
02:34:25 2016(r304201)
@@ -18,6 +18,8 @@ ${PACKAGE}FILES= \
  err.D_SYNTAX.declare.d  \
  err.bigglobal.d  \
  err.biglocal.d  \
+ tst.16kglobal.d  \
+ tst.16klocal.d  \
  tst.basicvar.d  \
  tst.basicvar.d.out  \
  tst.localvar.d  \

Added: head/cddl/usr.sbin/dtrace/tests/common/sugar/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/usr.sbin/dtrace/tests/common/sugar/Makefile   Tue Aug 16 
02:34:25 2016(r304201)
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by 
$srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+PACKAGE=   tests
+
+${PACKAGE}FILES= \
+ tst.else.d  \
+ tst.if.d  \
+ tst.if2.d  \
+ tst.if_before_after.d  \
+ tst.if_nested.d  \
+ tst.if_trailing_semicolon.d  \
+ tst.if_trailing_semicolon2.d  \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../dtrace.test.mk"

Modified: head/etc/mtree/BSD.tests.dist
==
--- head/etc/mtree/BSD.tests.dist   Tue Aug 16 02:30:19 2016
(r304200)
+++ head/etc/mtree/BSD.tests.dist   Tue Aug 16 02:34:25 2016
(r304201)
@@ -183,6 +183,8 @@
 ..
 struct
 ..
+sugar
+..
 syscall
 ..
 sysevent
___
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: r304202 - head/sys/netinet

2016-08-15 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Aug 16 06:40:27 2016
New Revision: 304202
URL: https://svnweb.freebsd.org/changeset/base/304202

Log:
  tcp/lro: Make # of LRO entries tunable
  
  Reviewed by:  hps, gallatin
  Obtained from:rrs, gallatin
  MFC after:2 weeks
  Sponsored by: Netflix (rrs, gallatin), Microsoft (sephe)
  Differential Revision:https://reviews.freebsd.org/D7499

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Tue Aug 16 02:34:25 2016(r304201)
+++ head/sys/netinet/tcp_lro.c  Tue Aug 16 06:40:27 2016(r304202)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -55,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -71,6 +73,14 @@ static void  tcp_lro_rx_done(struct lro_c
 static int tcp_lro_rx2(struct lro_ctrl *lc, struct mbuf *m,
uint32_t csum, int use_hash);
 
+SYSCTL_NODE(_net_inet_tcp, OID_AUTO, lro,  CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+"TCP LRO");
+
+static unsignedtcp_lro_entries = TCP_LRO_ENTRIES;
+SYSCTL_UINT(_net_inet_tcp_lro, OID_AUTO, entries,
+CTLFLAG_RDTUN | CTLFLAG_MPSAFE, &tcp_lro_entries, 0,
+"default number of LRO entries");
+
 static __inline void
 tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_head *bucket,
 struct lro_entry *le)
@@ -91,7 +101,7 @@ tcp_lro_active_remove(struct lro_entry *
 int
 tcp_lro_init(struct lro_ctrl *lc)
 {
-   return (tcp_lro_init_args(lc, NULL, TCP_LRO_ENTRIES, 0));
+   return (tcp_lro_init_args(lc, NULL, tcp_lro_entries, 0));
 }
 
 int
___
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"