svn commit: r253134 - head/sys/dev/hme

2013-07-10 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jul 10 06:46:46 2013
New Revision: 253134
URL: http://svnweb.freebsd.org/changeset/base/253134

Log:
  Avoid controller reinitialization which could be triggered by
  dhclient(8) or alias addresses are added.
  
  Tested by:dcx dcy dcb...@hotmail.com

Modified:
  head/sys/dev/hme/if_hme.c

Modified: head/sys/dev/hme/if_hme.c
==
--- head/sys/dev/hme/if_hme.c   Wed Jul 10 04:59:10 2013(r253133)
+++ head/sys/dev/hme/if_hme.c   Wed Jul 10 06:46:46 2013(r253134)
@@ -742,6 +742,10 @@ hme_init_locked(struct hme_softc *sc)
u_int32_t n, v;
 
HME_LOCK_ASSERT(sc, MA_OWNED);
+
+   if ((ifp-if_drv_flags  IFF_DRV_RUNNING) != 0)
+   return;
+
/*
 * Initialization sequence. The numbered steps below correspond
 * to the sequence outlined in section 6.3.5.1 in the Ethernet
@@ -1324,6 +1328,7 @@ hme_eint(struct hme_softc *sc, u_int sta
/* check for fatal errors that needs reset to unfreeze DMA engine */
if ((status  HME_SEB_STAT_FATAL_ERRORS) != 0) {
HME_WHINE(sc-sc_dev, error signaled, status=%#x\n, status);
+   sc-sc_ifp-if_drv_flags = ~IFF_DRV_RUNNING;
hme_init_locked(sc);
}
 }
@@ -1370,6 +1375,7 @@ hme_watchdog(struct hme_softc *sc)
device_printf(sc-sc_dev, device timeout (no link)\n);
++ifp-if_oerrors;
 
+   ifp-if_drv_flags = ~IFF_DRV_RUNNING;
hme_init_locked(sc);
hme_start_locked(ifp);
return (EJUSTRETURN);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253136 - head/sys/sys

2013-07-10 Thread Kevin Lo
Author: kevlo
Date: Wed Jul 10 07:15:39 2013
New Revision: 253136
URL: http://svnweb.freebsd.org/changeset/base/253136

Log:
  Add the ARM processor-specific section types.
  
  Reviewed by:  imp

Modified:
  head/sys/sys/elf_common.h

Modified: head/sys/sys/elf_common.h
==
--- head/sys/sys/elf_common.h   Wed Jul 10 07:12:55 2013(r253135)
+++ head/sys/sys/elf_common.h   Wed Jul 10 07:15:39 2013(r253136)
@@ -296,6 +296,13 @@ typedef struct {
 #defineSHT_HIOS0x6fff  /* Last of OS specific 
semantics */
 #defineSHT_LOPROC  0x7000  /* reserved range for 
processor */
 #defineSHT_AMD64_UNWIND0x7001  /* unwind information */
+#defineSHT_ARM_EXIDX   0x7001  /* Exception index 
table. */
+#defineSHT_ARM_PREEMPTMAP  0x7002  /* BPABI DLL dynamic 
linking 
+  pre-emption map. */
+#defineSHT_ARM_ATTRIBUTES  0x7003  /* Object file 
compatibility 
+  attributes. */
+#defineSHT_ARM_DEBUGOVERLAY0x7004  /* See DBGOVL for 
details. */
+#defineSHT_ARM_OVERLAYSECTION  0x7005  /* See DBGOVL for 
details. */
 #defineSHT_MIPS_REGINFO0x7006
 #defineSHT_MIPS_OPTIONS0x700d
 #defineSHT_MIPS_DWARF  0x701e  /* MIPS gcc uses 
MIPS_DWARF */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253138 - head/usr.sbin/authpf

2013-07-10 Thread Dag-Erling Smørgrav
Author: des
Date: Wed Jul 10 07:40:30 2013
New Revision: 253138
URL: http://svnweb.freebsd.org/changeset/base/253138

Log:
  Install authpf-noip.
  
  MFC after:3 days

Modified:
  head/usr.sbin/authpf/Makefile

Modified: head/usr.sbin/authpf/Makefile
==
--- head/usr.sbin/authpf/Makefile   Wed Jul 10 07:21:59 2013
(r253137)
+++ head/usr.sbin/authpf/Makefile   Wed Jul 10 07:40:30 2013
(r253138)
@@ -18,4 +18,7 @@ DPADD+= ${LIBM} ${LIBMD} ${LIBUTIL}
 
 WARNS?=3
 
+LINKS= ${BINDIR}/authpf ${BINDIR}/authpf-noip
+MLINKS=authpf.8 authpf-noip.8
+
 .include bsd.prog.mk
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253139 - in head: share/doc/legal share/doc/legal/realtek sys/conf sys/contrib/dev/urtwn sys/dev/usb/wlan sys/modules/usb/urtwnfw sys/modules/usb/urtwnfw/urtwnrtl8192cT sys/modules/usb...

2013-07-10 Thread Hiren Panchasara
Author: hiren
Date: Wed Jul 10 08:21:09 2013
New Revision: 253139
URL: http://svnweb.freebsd.org/changeset/base/253139

Log:
  Adding urtwn(4) firmware and related changes.
  
  Reviewed by:  rpaulo
  Approved by:  sbruno (mentor)

Added:
  head/share/doc/legal/realtek/
  head/share/doc/legal/realtek/Makefile   (contents, props changed)
  head/sys/contrib/dev/urtwn/
  head/sys/contrib/dev/urtwn/LICENSE
  head/sys/contrib/dev/urtwn/urtwn-rtl8192cfwT.fw.uu
  head/sys/contrib/dev/urtwn/urtwn-rtl8192cfwU.fw.uu
  head/sys/modules/usb/urtwnfw/
  head/sys/modules/usb/urtwnfw/Makefile   (contents, props changed)
  head/sys/modules/usb/urtwnfw/Makefile.inc   (contents, props changed)
  head/sys/modules/usb/urtwnfw/urtwnrtl8192cT/
  head/sys/modules/usb/urtwnfw/urtwnrtl8192cT/Makefile   (contents, props 
changed)
  head/sys/modules/usb/urtwnfw/urtwnrtl8192cU/
  head/sys/modules/usb/urtwnfw/urtwnrtl8192cU/Makefile   (contents, props 
changed)
Modified:
  head/share/doc/legal/Makefile
  head/sys/conf/WITHOUT_SOURCELESS_UCODE
  head/sys/conf/files
  head/sys/dev/usb/wlan/if_urtwn.c

Modified: head/share/doc/legal/Makefile
==
--- head/share/doc/legal/Makefile   Wed Jul 10 07:40:30 2013
(r253138)
+++ head/share/doc/legal/Makefile   Wed Jul 10 08:21:09 2013
(r253139)
@@ -3,6 +3,7 @@
 SUBDIR=intel_ipw \
intel_iwi \
intel_iwn \
-   intel_wpi
+   intel_wpi \
+   realtek
 
 .include bsd.subdir.mk

Added: head/share/doc/legal/realtek/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/share/doc/legal/realtek/Makefile   Wed Jul 10 08:21:09 2013
(r253139)
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+NO_OBJ=
+FILES= ${.CURDIR}/../../../../sys/contrib/dev/urtwn/LICENSE
+FILESDIR=  ${SHAREDIR}/doc/legal/realtek
+
+.include bsd.prog.mk

Modified: head/sys/conf/WITHOUT_SOURCELESS_UCODE
==
--- head/sys/conf/WITHOUT_SOURCELESS_UCODE  Wed Jul 10 07:40:30 2013
(r253138)
+++ head/sys/conf/WITHOUT_SOURCELESS_UCODE  Wed Jul 10 08:21:09 2013
(r253139)
@@ -39,3 +39,4 @@ nodevice  rum
 nodevice   uath
 nodevice   zyd
 nodevice   kue
+nodevice   urtwnfw

Modified: head/sys/conf/files
==
--- head/sys/conf/files Wed Jul 10 07:40:30 2013(r253138)
+++ head/sys/conf/files Wed Jul 10 08:21:09 2013(r253139)
@@ -2327,6 +2327,35 @@ dev/usb/wlan/if_upgt.c   optional upgt
 dev/usb/wlan/if_ural.c optional ural
 dev/usb/wlan/if_urtw.c optional urtw
 dev/usb/wlan/if_urtwn.coptional urtwn
+urtwnrtl8192cfwT.c optional urtwn-rtl8192cfwT | urtwnfw\
+   compile-with${AWK} -f $S/tools/fw_stub.awk 
urtwnrtl8192cT.fw:urtwnrtl8192cfwT -murtwnrtl8192cfwT -c${.TARGET} \
+   no-implicit-rule before-depend local\
+   clean   urtwnrtl8192cfwT.c
+urtwnrtl8192cfwT.fwo   optional urtwn-rtl8192cfwT | urtwnfw\
+   dependency  urtwnrtl8192cT.fw \
+   compile-with${NORMAL_FWO} \
+   no-implicit-rule\
+   clean   urtwnrtl8192cfwT.fwo
+urtwnrtl8192cT.fw  optional urtwn-rtl8192cfwT | urtwnfw\
+   dependency  $S/contrib/dev/urtwn/urtwn-rtl8192cfwT.fw.uu  \
+   compile-with${NORMAL_FW}  \
+   no-obj no-implicit-rule \
+   clean   urtwnrtl8192cT.fw
+urtwnrtl8192cfwU.c optional urtwn-rtl8192cfwU | urtwnfw\
+   compile-with${AWK} -f $S/tools/fw_stub.awk 
urtwnrtl8192cU.fw:urtwnrtl8192cfwU -murtwnrtl8192cfwU -c${.TARGET} \
+   no-implicit-rule before-depend local\
+   clean   urtwnrtl8192cfwU.c
+urtwnrtl8192cfwU.fwo   optional urtwn-rtl8192cfwU | urtwnfw\
+   dependency  urtwnrtl8192cU.fw \
+   compile-with${NORMAL_FWO} \
+   no-implicit-rule\
+   clean   urtwnrtl8192cfwU.fwo
+urtwnrtl8192cU.fw  optional urtwn-rtl8192cfwU | urtwnfw\
+   dependency  $S/contrib/dev/urtwn/urtwn-rtl8192cfwU.fw.uu  \
+   compile-with${NORMAL_FW}  \
+   no-obj no-implicit-rule \
+   clean   urtwnrtl8192cU.fw
+
 dev/usb/wlan/if_zyd.c  optional zyd
 #
 # USB serial and parallel port drivers

Added: head/sys/contrib/dev/urtwn/LICENSE

Re: svn commit: r252425 - head/sys/arm/arm

2013-07-10 Thread Bruce Evans

On Mon, 8 Jul 2013, Aleksandr Rybalko wrote:


On Mon, 1 Jul 2013 11:56:25 +1000 (EST)
Bruce Evans b...@optusnet.com.au wrote:


On Sun, 30 Jun 2013, Aleksandr Rybalko wrote:


Log:
 Decrypt magic numbers - define names for fields of Generic Timer's CNTKCTL reg.

 Submitted by:  Ruslan Bukin b...@bsdpad.com

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

Modified: head/sys/arm/arm/generic_timer.c
==
--- head/sys/arm/arm/generic_timer.cSun Jun 30 19:36:17 2013
(r252424)
+++ head/sys/arm/arm/generic_timer.cSun Jun 30 19:52:41 2013
(r252425)
@@ -66,7 +66,22 @@ __FBSDID($FreeBSD$);
#define GENERIC_TIMER_REG_CTRL  0
#define GENERIC_TIMER_REG_TVAL  1

-#defineCNTPSIRQ29
+#defineGENERIC_TIMER_CNTKCTL_PL0PTEN   (1  9) /* Physical timer 
registers
+   access from PL0 */
+#defineGENERIC_TIMER_CNTKCTL_PL0VTEN   (1  8) /* Virtual timer 
registers


With names like these, the magic numbers are better.  The prefix name
GENERIC_TIMER is especially bad.  GT would be good.


Changed in r252780.


Thanks.  It looks OK now.

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


svn commit: r253140 - head/sys/amd64/amd64

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 10 09:24:03 2013
New Revision: 253140
URL: http://svnweb.freebsd.org/changeset/base/253140

Log:
  Clear m-object for the page taken from the delayed free list for
  reuse as the pv chink page in reclaim_pv_chunk().  Having non-NULL
  m-object is wrong for page not owned by an object and confuses both
  vm_page_free_toq() and vm_page_remove() when the page is freed later.
  
  Reported and tested by:   pho
  Sponsored by: The FreeBSD Foundation
  MFC after:3 days

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Wed Jul 10 08:21:09 2013(r253139)
+++ head/sys/amd64/amd64/pmap.c Wed Jul 10 09:24:03 2013(r253140)
@@ -2234,6 +2234,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, str
if (m_pc == NULL  free != NULL) {
m_pc = free;
free = (void *)m_pc-object;
+   m_pc-object = NULL;
/* Recycle a freed page table page. */
m_pc-wire_count = 1;
atomic_add_int(cnt.v_wire_count, 1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253141 - head/sys/geom/journal

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Wed Jul 10 10:11:43 2013
New Revision: 253141
URL: http://svnweb.freebsd.org/changeset/base/253141

Log:
  When panicing due to the gjournal overflow, print the geom metadata
  journal id.
  
  Requested by: Andreas Longwitz longw...@incore.de
  MFC after:1 week

Modified:
  head/sys/geom/journal/g_journal.c

Modified: head/sys/geom/journal/g_journal.c
==
--- head/sys/geom/journal/g_journal.c   Wed Jul 10 09:24:03 2013
(r253140)
+++ head/sys/geom/journal/g_journal.c   Wed Jul 10 10:11:43 2013
(r253141)
@@ -341,7 +341,9 @@ g_journal_check_overflow(struct g_journa
(sc-sc_active.jj_offset  sc-sc_inactive.jj_offset 
 sc-sc_journal_offset = sc-sc_inactive.jj_offset 
 sc-sc_journal_offset  sc-sc_active.jj_offset)) {
-   panic(Journal overflow (joffset=%jd active=%jd inactive=%jd),
+   panic(Journal overflow 
+   (id = %u joffset=%jd active=%jd inactive=%jd),
+   (unsigned)sc-sc_id,
(intmax_t)sc-sc_journal_offset,
(intmax_t)sc-sc_active.jj_offset,
(intmax_t)sc-sc_inactive.jj_offset);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-07-10 Thread Aleksandr Rybalko
Author: ray
Date: Wed Jul 10 10:15:38 2013
New Revision: 253142
URL: http://svnweb.freebsd.org/changeset/base/253142

Log:
  Remove trailing whitespaces.

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

Modified: head/sys/arm/arm/trap.c
==
--- head/sys/arm/arm/trap.c Wed Jul 10 10:11:43 2013(r253141)
+++ head/sys/arm/arm/trap.c Wed Jul 10 10:15:38 2013(r253142)
@@ -238,7 +238,7 @@ data_abort_handler(trapframe_t *tf)
int error = 0;
struct ksig ksig;
struct proc *p;
-   
+
 
/* Grab FAR/FSR before enabling interrupts */
far = cpu_faultaddress();
@@ -262,10 +262,10 @@ data_abort_handler(trapframe_t *tf)
 
if (user) {
td-td_pticks = 0;
-   td-td_frame = tf;  
+   td-td_frame = tf;
if (td-td_ucred != td-td_proc-p_ucred)
cred_update_thread(td);
-   
+
}
/* Grab the current pcb */
pcb = td-td_pcb;
@@ -276,7 +276,7 @@ data_abort_handler(trapframe_t *tf)
if (__predict_true(tf-tf_spsr  F32_bit) == 0)
enable_interrupts(F32_bit);
}
-   
+
 
/* Invoke the appropriate handler, if necessary */
if (__predict_false(data_aborts[fsr  FAULT_TYPE_MASK].func != NULL)) {
@@ -720,7 +720,7 @@ prefetch_abort_handler(trapframe_t *tf)
printf(prefetch abort handler: %p %p\n, (void*)tf-tf_pc,
(void*)tf-tf_usr_lr);
 #endif
-   
+
td = curthread;
p = td-td_proc;
PCPU_INC(cnt.v_trap);
@@ -937,7 +937,7 @@ swi_handler(trapframe_t *frame)
struct thread *td = curthread;
 
td-td_frame = frame;
-   
+
td-td_pticks = 0;
/*
 * Make sure the program counter is correctly aligned so we
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253144 - head/sys/contrib/v4l

2013-07-10 Thread Alexander Leidinger
Author: netchild
Date: Wed Jul 10 10:40:52 2013
New Revision: 253144
URL: http://svnweb.freebsd.org/changeset/base/253144

Log:
  Fix build for gcc users by declaring variables for unions in structs which
  don't declare a variable. The size before/after this change of the structs
  doesn't change with gcc/clang.
  
  Noticed by:   several
  Suggested by: Gary Jennejohn gljennj...@googlemail.com

Modified:
  head/sys/contrib/v4l/videodev2.h

Modified: head/sys/contrib/v4l/videodev2.h
==
--- head/sys/contrib/v4l/videodev2.hWed Jul 10 10:38:43 2013
(r253143)
+++ head/sys/contrib/v4l/videodev2.hWed Jul 10 10:40:52 2013
(r253144)
@@ -427,7 +427,7 @@ struct v4l2_frmsizeenum {
union { /* Frame size */
struct v4l2_frmsize_discretediscrete;
struct v4l2_frmsize_stepwisestepwise;
-   };
+   } x;
 
__u32   reserved[2];/* Reserved space for future 
use */
 };
@@ -457,7 +457,7 @@ struct v4l2_frmivalenum {
union { /* Frame interval */
struct v4l2_fract   discrete;
struct v4l2_frmival_stepwisestepwise;
-   };
+   } x;
 
__u32   reserved[2];/* Reserved space for future 
use */
 };
@@ -834,7 +834,7 @@ struct v4l2_dv_timings {
union {
struct v4l2_bt_timings  bt;
__u32   reserved[32];
-   };
+   } x;
 } __attribute__ ((packed));
 
 /* Values for the type field */
@@ -927,7 +927,7 @@ struct v4l2_ext_control {
__s32 value;
__s64 value64;
char *string;
-   };
+   } x;
 } __attribute__ ((packed));
 
 struct v4l2_ext_controls {
@@ -1475,7 +1475,7 @@ struct v4l2_encoder_cmd {
struct {
__u32 data[8];
} raw;
-   };
+   } x;
 };
 
 #endif
@@ -1597,7 +1597,7 @@ struct v4l2_mpeg_vbi_fmt_ivtv {
union {
struct v4l2_mpeg_vbi_itv0 itv0;
struct v4l2_mpeg_vbi_ITV0 ITV0;
-   };
+   } x;
 } __attribute__ ((packed));
 
 /*
@@ -1648,7 +1648,7 @@ struct v4l2_dbg_match {
union { /* Match this chip, meaning determined by type */
__u32 addr;
char name[32];
-   };
+   } x;
 } __attribute__ ((packed));
 
 struct v4l2_dbg_register {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253149 - head/usr.bin/dtc

2013-07-10 Thread David Chisnall
Author: theraven
Date: Wed Jul 10 10:57:09 2013
New Revision: 253149
URL: http://svnweb.freebsd.org/changeset/base/253149

Log:
  Report error for out-of-range numerical inputs.  Requested by brooks.

Modified:
  head/usr.bin/dtc/fdt.cc

Modified: head/usr.bin/dtc/fdt.cc
==
--- head/usr.bin/dtc/fdt.cc Wed Jul 10 10:51:12 2013(r253148)
+++ head/usr.bin/dtc/fdt.cc Wed Jul 10 10:57:09 2013(r253149)
@@ -30,6 +30,8 @@
  * $FreeBSD$
  */
 
+#define __STDC_LIMIT_MACROS 1
+
 #include fdt.hh
 
 #include algorithm
@@ -281,6 +283,12 @@ property::parse_cells(input_buffer inpu
valid = false;
return;
}
+   if ((val  0) || (val  UINT32_MAX))
+   {
+   input.parse_error(Value out of range);
+   valid = false;
+   return;
+   }
push_big_endian(v.byte_data, (uint32_t)val);
input.next_token();
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253150 - head/sys/netinet

2013-07-10 Thread Andre Oppermann
Author: andre
Date: Wed Jul 10 12:06:01 2013
New Revision: 253150
URL: http://svnweb.freebsd.org/changeset/base/253150

Log:
  Extend debug logging of TCP timestamp related specification
  violations.
  
  Update related comments and style.

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_syncache.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Jul 10 10:57:09 2013
(r253149)
+++ head/sys/netinet/tcp_input.cWed Jul 10 12:06:01 2013
(r253150)
@@ -1446,6 +1446,8 @@ tcp_do_segment(struct mbuf *m, struct tc
int thflags, acked, ourfinisacked, needoutput = 0;
int rstreason, todrop, win;
u_long tiwin;
+   char *s;
+   struct in_conninfo *inc;
struct tcpopt to;
 
 #ifdef TCPDEBUG
@@ -1458,6 +1460,7 @@ tcp_do_segment(struct mbuf *m, struct tc
short ostate = 0;
 #endif
thflags = th-th_flags;
+   inc = tp-t_inpcb-inp_inc;
tp-sackhint.last_sack_ack = 0;
 
/*
@@ -1546,6 +1549,24 @@ tcp_do_segment(struct mbuf *m, struct tc
if (TSTMP_GT(to.to_tsecr, tcp_ts_getticks()))
to.to_tsecr = 0;
}
+   /*
+* If timestamps were negotiated during SYN/ACK they should
+* appear on every segment during this session and vice versa.
+*/
+   if ((tp-t_flags  TF_RCVD_TSTMP)  !(to.to_flags  TOF_TS)) {
+   if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+   log(LOG_DEBUG, %s; %s: Timestamp missing, 
+   no action\n, s, __func__);
+   free(s, M_TCPLOG);
+   }
+   }
+   if (!(tp-t_flags  TF_RCVD_TSTMP)  (to.to_flags  TOF_TS)) {
+   if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+   log(LOG_DEBUG, %s; %s: Timestamp not expected, 
+   no action\n, s, __func__);
+   free(s, M_TCPLOG);
+   }
+   }
 
/*
 * Process options only when we get SYN/ACK back. The SYN case
@@ -2213,15 +2234,14 @@ tcp_do_segment(struct mbuf *m, struct tc
 */
if ((so-so_state  SS_NOFDREF) 
tp-t_state  TCPS_CLOSE_WAIT  tlen) {
-   char *s;
-
KASSERT(ti_locked == TI_WLOCKED, (%s: SS_NOFDEREF  
CLOSE_WAIT  tlen ti_locked %d, __func__, ti_locked));
INP_INFO_WLOCK_ASSERT(V_tcbinfo);
 
-   if ((s = tcp_log_addrs(tp-t_inpcb-inp_inc, th, NULL, NULL))) 
{
-   log(LOG_DEBUG, %s; %s: %s: Received %d bytes of data 
after socket 
-   was closed, sending RST and removing tcpcb\n,
+   if ((s = tcp_log_addrs(inc, th, NULL, NULL))) {
+   log(LOG_DEBUG, %s; %s: %s: Received %d bytes of data 
+   after socket was closed, 
+   sending RST and removing tcpcb\n,
s, __func__, tcpstates[tp-t_state], tlen);
free(s, M_TCPLOG);
}

Modified: head/sys/netinet/tcp_syncache.c
==
--- head/sys/netinet/tcp_syncache.c Wed Jul 10 10:57:09 2013
(r253149)
+++ head/sys/netinet/tcp_syncache.c Wed Jul 10 12:06:01 2013
(r253150)
@@ -992,12 +992,29 @@ syncache_expand(struct in_conninfo *inc,
goto failed;
}
 
+   /*
+* If timestamps were not negotiated during SYN/ACK they
+* must not appear on any segment during this session.
+*/
if (!(sc-sc_flags  SCF_TIMESTAMP)  (to-to_flags  TOF_TS)) {
if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
log(LOG_DEBUG, %s; %s: Timestamp not expected, 
segment rejected\n, s, __func__);
goto failed;
}
+
+   /*
+* If timestamps were negotiated during SYN/ACK they should
+* appear on every segment during this session.
+* XXXAO: This is only informal as there have been unverified
+* reports of non-compliants stacks.
+*/
+   if ((sc-sc_flags  SCF_TIMESTAMP)  !(to-to_flags  TOF_TS)) {
+   if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
+   log(LOG_DEBUG, %s; %s: Timestamp missing, 
+   no action\n, s, __func__);
+   }
+
/*
 * If timestamps were negotiated the reflected timestamp
 * must be equal to what we actually sent in the SYN|ACK.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r253140 - head/sys/amd64/amd64

2013-07-10 Thread Alan Cox
On Jul 10, 2013, at 2:24 AM, Konstantin Belousov wrote:

 Author: kib
 Date: Wed Jul 10 09:24:03 2013
 New Revision: 253140
 URL: http://svnweb.freebsd.org/changeset/base/253140
 
 Log:
  Clear m-object for the page taken from the delayed free list for
  reuse as the pv chink page in reclaim_pv_chunk().  Having non-NULL
  m-object is wrong for page not owned by an object and confuses both
  vm_page_free_toq() and vm_page_remove() when the page is freed later.
 
  Reported and tested by:  pho
  Sponsored by:The FreeBSD Foundation
  MFC after:   3 days
 


This problem only exists in HEAD.  Older branches don't abuse the object field 
for this purpose.  They use one of the splay tree pointers that were eliminated 
from HEAD with the introduction of the radix tree.  On the other hand, the same 
problem must exist in HEAD's i386 pmap.  As an aside, I think it's better to 
abuse the page's pageq field rather its object field.


 Modified:
  head/sys/amd64/amd64/pmap.c
 
 Modified: head/sys/amd64/amd64/pmap.c
 ==
 --- head/sys/amd64/amd64/pmap.c   Wed Jul 10 08:21:09 2013
 (r253139)
 +++ head/sys/amd64/amd64/pmap.c   Wed Jul 10 09:24:03 2013
 (r253140)
 @@ -2234,6 +2234,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, str
   if (m_pc == NULL  free != NULL) {
   m_pc = free;
   free = (void *)m_pc-object;
 + m_pc-object = NULL;
   /* Recycle a freed page table page. */
   m_pc-wire_count = 1;
   atomic_add_int(cnt.v_wire_count, 1);
 

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


Re: svn commit: r253139 - in head: share/doc/legal share/doc/legal/realtek sys/conf sys/contrib/dev/urtwn sys/dev/usb/wlan sys/modules/usb/urtwnfw sys/modules/usb/urtwnfw/urtwnrtl8192cT sys/modules/us

2013-07-10 Thread Rui Paulo
On 10 Jul 2013, at 01:21, Hiren Panchasara hi...@freebsd.org wrote:

 Author: hiren
 Date: Wed Jul 10 08:21:09 2013
 New Revision: 253139
 URL: http://svnweb.freebsd.org/changeset/base/253139
 
 Log:
  Adding urtwn(4) firmware and related changes.
 
  Reviewed by: rpaulo
  Approved by: sbruno (mentor)


Approved by: core

--
Rui Paulo

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


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

2013-07-10 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul 10 15:35:25 2013
New Revision: 253158
URL: http://svnweb.freebsd.org/changeset/base/253158

Log:
  Add vfs_mounted and vfs_unmounted events so that components can be informed
  about mount and unmount events. This is used by Juniper to implement a more
  optimal implementation of NetBSD's veriexec.
  
  This change differs from r253224 in the following way:
  o   The vfs_mounted handler is called before mountcheckdirs() and with
  newdp locked. vp is unlocked.
  o   The event handlers are declared in sys/eventhandler.h and not in
  sys/mount.h. The sys/mount.h header is used in user land code
  that pretends to be kernel code and as such creates a very convoluted
  environment. It's hard to untangle.
  
  Submitted by: ste...@juniper.net
  Discussed with:   pjd@
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/kern/vfs_mount.c
  head/sys/sys/eventhandler.h

Modified: head/sys/kern/vfs_mount.c
==
--- head/sys/kern/vfs_mount.c   Wed Jul 10 14:16:39 2013(r253157)
+++ head/sys/kern/vfs_mount.c   Wed Jul 10 15:35:25 2013(r253158)
@@ -861,8 +861,9 @@ vfs_domount_first(
vfs_event_signal(NULL, VQ_MOUNT, 0);
if (VFS_ROOT(mp, LK_EXCLUSIVE, newdp))
panic(mount: lost mount);
-   VOP_UNLOCK(newdp, 0);
VOP_UNLOCK(vp, 0);
+   EVENTHANDLER_INVOKE(vfs_mounted, mp, newdp, td);
+   VOP_UNLOCK(newdp, 0);
mountcheckdirs(vp, newdp);
vrele(newdp);
if ((mp-mnt_flag  MNT_RDONLY) == 0)
@@ -1355,6 +1356,7 @@ dounmount(mp, flags, td)
mtx_lock(mountlist_mtx);
TAILQ_REMOVE(mountlist, mp, mnt_list);
mtx_unlock(mountlist_mtx);
+   EVENTHANDLER_INVOKE(vfs_unmounted, mp, td);
if (coveredvp != NULL) {
coveredvp-v_mountedhere = NULL;
vput(coveredvp);

Modified: head/sys/sys/eventhandler.h
==
--- head/sys/sys/eventhandler.h Wed Jul 10 14:16:39 2013(r253157)
+++ head/sys/sys/eventhandler.h Wed Jul 10 15:35:25 2013(r253158)
@@ -192,6 +192,17 @@ EVENTHANDLER_DECLARE(vm_lowmem, vm_lowme
 typedef void (*mountroot_handler_t)(void *);
 EVENTHANDLER_DECLARE(mountroot, mountroot_handler_t);
 
+/* File system mount events */
+struct mount;
+struct vnode;
+struct thread;
+typedef void (*vfs_mounted_notify_fn)(void *, struct mount *, struct vnode *,
+struct thread *);
+typedef void (*vfs_unmounted_notify_fn)(void *, struct mount *,
+struct thread *);
+EVENTHANDLER_DECLARE(vfs_mounted, vfs_mounted_notify_fn);
+EVENTHANDLER_DECLARE(vfs_unmounted, vfs_unmounted_notify_fn);
+
 /* VLAN state change events */
 struct ifnet;
 typedef void (*vlan_config_fn)(void *, struct ifnet *, uint16_t);
@@ -231,7 +242,6 @@ EVENTHANDLER_DECLARE(process_exec, execl
 /*
  * application dump event
  */
-struct thread;
 typedef void (*app_coredump_start_fn)(void *, struct thread *, char *name);
 typedef void (*app_coredump_progress_fn)(void *, struct thread *td, int 
byte_count);
 typedef void (*app_coredump_finish_fn)(void *, struct thread *td);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r253149 - head/usr.bin/dtc

2013-07-10 Thread John Baldwin
On Wednesday, July 10, 2013 6:57:09 am David Chisnall wrote:
 Author: theraven
 Date: Wed Jul 10 10:57:09 2013
 New Revision: 253149
 URL: http://svnweb.freebsd.org/changeset/base/253149
 
 Log:
   Report error for out-of-range numerical inputs.  Requested by brooks.
 
 Modified:
   head/usr.bin/dtc/fdt.cc
 
 Modified: head/usr.bin/dtc/fdt.cc
 
==
 --- head/usr.bin/dtc/fdt.cc   Wed Jul 10 10:51:12 2013(r253148)
 +++ head/usr.bin/dtc/fdt.cc   Wed Jul 10 10:57:09 2013(r253149)
 @@ -30,6 +30,8 @@
   * $FreeBSD$
   */
  
 +#define __STDC_LIMIT_MACROS 1
 +

Hmm, would it be better to use a newer -std= instead?

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


svn commit: r253159 - in head/contrib: libc++/include libc++/src libcxxrt

2013-07-10 Thread David Chisnall
Author: theraven
Date: Wed Jul 10 16:28:24 2013
New Revision: 253159
URL: http://svnweb.freebsd.org/changeset/base/253159

Log:
  Import new libcxxrt / libc++.  This brings some bug fixes, including a 
potential race condition for static initialisers.

Modified:
  head/contrib/libc++/include/__bit_reference
  head/contrib/libc++/include/__config
  head/contrib/libc++/include/__functional_base
  head/contrib/libc++/include/__hash_table
  head/contrib/libc++/include/__locale
  head/contrib/libc++/include/__split_buffer
  head/contrib/libc++/include/__std_stream
  head/contrib/libc++/include/__tree
  head/contrib/libc++/include/algorithm
  head/contrib/libc++/include/atomic
  head/contrib/libc++/include/deque
  head/contrib/libc++/include/forward_list
  head/contrib/libc++/include/functional
  head/contrib/libc++/include/future
  head/contrib/libc++/include/istream
  head/contrib/libc++/include/iterator
  head/contrib/libc++/include/list
  head/contrib/libc++/include/locale
  head/contrib/libc++/include/map
  head/contrib/libc++/include/memory
  head/contrib/libc++/include/random
  head/contrib/libc++/include/regex
  head/contrib/libc++/include/string
  head/contrib/libc++/include/type_traits
  head/contrib/libc++/include/unordered_map
  head/contrib/libc++/include/utility
  head/contrib/libc++/include/vector
  head/contrib/libc++/src/debug.cpp
  head/contrib/libc++/src/hash.cpp
  head/contrib/libc++/src/iostream.cpp
  head/contrib/libc++/src/locale.cpp
  head/contrib/libc++/src/stdexcept.cpp
  head/contrib/libc++/src/string.cpp
  head/contrib/libc++/src/thread.cpp
  head/contrib/libcxxrt/atomic.h
  head/contrib/libcxxrt/auxhelper.cc
  head/contrib/libcxxrt/cxxabi.h
  head/contrib/libcxxrt/dwarf_eh.h
  head/contrib/libcxxrt/exception.cc
  head/contrib/libcxxrt/guard.cc
  head/contrib/libcxxrt/memory.cc
Directory Properties:
  head/contrib/libc++/   (props changed)
  head/contrib/libcxxrt/   (props changed)

Modified: head/contrib/libc++/include/__bit_reference
==
--- head/contrib/libc++/include/__bit_reference Wed Jul 10 15:35:25 2013
(r253158)
+++ head/contrib/libc++/include/__bit_reference Wed Jul 10 16:28:24 2013
(r253159)
@@ -333,7 +333,7 @@ __fill_n_false(__bit_iterator_Cp, false
 }
 // do middle whole words
 __storage_type __nw = __n / __bits_per_word;
-_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
+_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * 
sizeof(__storage_type));
 __n -= __nw * __bits_per_word;
 // do last partial word
 if (__n  0)
@@ -363,7 +363,7 @@ __fill_n_true(__bit_iterator_Cp, false
 }
 // do middle whole words
 __storage_type __nw = __n / __bits_per_word;
-_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
+_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * 
sizeof(__storage_type));
 __n -= __nw * __bits_per_word;
 // do last partial word
 if (__n  0)
@@ -430,7 +430,9 @@ __copy_aligned(__bit_iterator_Cp, _IsCo
 // __first.__ctz_ == 0;
 // do middle words
 __storage_type __nw = __n / __bits_per_word;
-_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * 
sizeof(__storage_type));
+_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
+   _VSTD::__to_raw_pointer(__first.__seg_),
+   __nw * sizeof(__storage_type));
 __n -= __nw * __bits_per_word;
 __result.__seg_ += __nw;
 // do last word
@@ -569,7 +571,9 @@ __copy_backward_aligned(__bit_iterator_
 __storage_type __nw = __n / __bits_per_word;
 __result.__seg_ -= __nw;
 __last.__seg_ -= __nw;
-_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * 
sizeof(__storage_type));
+_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
+   _VSTD::__to_raw_pointer(__last.__seg_),
+   __nw * sizeof(__storage_type));
 __n -= __nw * __bits_per_word;
 // do last word
 if (__n  0)
@@ -870,6 +874,7 @@ struct __bit_array
 {
 typedef typename _Cp::difference_type difference_type;
 typedef typename _Cp::__storage_type  __storage_type;
+typedef typename _Cp::__storage_pointer __storage_pointer;
 typedef typename _Cp::iteratoriterator;
 static const unsigned __bits_per_word = _Cp::__bits_per_word;
 static const unsigned _Np = 4;
@@ -880,9 +885,15 @@ struct __bit_array
 _LIBCPP_INLINE_VISIBILITY static difference_type capacity()
 {return static_castdifference_type(_Np * __bits_per_word);}
 _LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : 
__size_(__s) {}
-_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
-_LIBCPP_INLINE_VISIBILITY iterator end()   {return iterator(__word_ + 
__size_ / __bits_per_word,
- 

svn commit: r253161 - head/sys/dev/uart

2013-07-10 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul 10 17:42:20 2013
New Revision: 253161
URL: http://svnweb.freebsd.org/changeset/base/253161

Log:
  Protect against broken hardware. In this particular case, protect against
  H/W not de-asserting the interrupt at all. On x86, and because of the
  following conditions, this results in a hard hang with interrupts disabled:
  1.  The uart(4) driver uses a spin lock to protect against concurrent
  access to the H/W. Spin locks disable and restore interrupts.
  2.  Restoring the interrupt on x86 always writes the flags register. Even
  if we're restoring the interrupt from disabled to disabled.
  3.  The x86 CPU has a short window in which interrupts are enabled when the
  flags register is written.
  4.  The uart(4) driver registers a fast interrupt by default.
  
  To catch this case, we first try to clear any pending H/W interrupts and in
  particular, before setting up the interrupt. This makes sure the interrupt
  is masked on the PIC. The interrupt handler now has a limit set on the
  number of iterations it'll go through to clear interrupt conditions. If the
  limit is hit, the handler will return FILTER_SCHEDULE_THREAD. The attach
  function will check for this return code and avoid setting up the interrupt
  and foce polling in that case.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/dev/uart/uart_core.c

Modified: head/sys/dev/uart/uart_core.c
==
--- head/sys/dev/uart/uart_core.c   Wed Jul 10 17:16:10 2013
(r253160)
+++ head/sys/dev/uart/uart_core.c   Wed Jul 10 17:42:20 2013
(r253161)
@@ -248,10 +248,14 @@ static int
 uart_intr(void *arg)
 {
struct uart_softc *sc = arg;
-   int flag = 0, ipend;
+   int cnt, ipend;
 
-   while (!sc-sc_leaving  (ipend = UART_IPEND(sc)) != 0) {
-   flag = 1;
+   if (sc-sc_leaving)
+   return (FILTER_STRAY);
+
+   cnt = 0;
+   while (cnt  20  (ipend = UART_IPEND(sc)) != 0) {
+   cnt++;
if (ipend  SER_INT_OVERRUN)
uart_intr_overrun(sc);
if (ipend  SER_INT_BREAK)
@@ -269,7 +273,8 @@ uart_intr(void *arg)
(timeout_t *)uart_intr, sc);
}
 
-   return((flag)?FILTER_HANDLED:FILTER_STRAY);
+   return ((cnt == 0) ? FILTER_STRAY :
+   ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED));
 }
 
 serdev_intr_t *
@@ -390,7 +395,7 @@ uart_bus_attach(device_t dev)
 {
struct uart_softc *sc, *sc0;
const char *sep;
-   int error;
+   int error, filt;
 
/*
 * The sc_class field defines the type of UART we're going to work
@@ -430,33 +435,6 @@ uart_bus_attach(device_t dev)
sc-sc_bas.bsh = rman_get_bushandle(sc-sc_rres);
sc-sc_bas.bst = rman_get_bustag(sc-sc_rres);
 
-   sc-sc_irid = 0;
-   sc-sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, sc-sc_irid,
-   RF_ACTIVE | RF_SHAREABLE);
-   if (sc-sc_ires != NULL) {
-   error = bus_setup_intr(dev,
-   sc-sc_ires, INTR_TYPE_TTY, 
-   uart_intr, NULL, sc, sc-sc_icookie);  
-   if (error)
-   error = bus_setup_intr(dev,
-   sc-sc_ires, INTR_TYPE_TTY | INTR_MPSAFE,
-   NULL, (driver_intr_t *)uart_intr, sc, 
sc-sc_icookie);
-   else
-   sc-sc_fastintr = 1;
-
-   if (error) {
-   device_printf(dev, could not activate interrupt\n);
-   bus_release_resource(dev, SYS_RES_IRQ, sc-sc_irid,
-   sc-sc_ires);
-   sc-sc_ires = NULL;
-   }
-   }
-   if (sc-sc_ires == NULL) {
-   /* No interrupt resource. Force polled mode. */
-   sc-sc_polled = 1;
-   callout_init(sc-sc_timer, 1);
-   }
-
/*
 * Ensure there is room for at least three full FIFOs of data in the
 * receive buffer (handles the case of low-level drivers with huge
@@ -487,20 +465,6 @@ uart_bus_attach(device_t dev)
printf(\n);
}
 
-   if (bootverbose  (sc-sc_fastintr || sc-sc_polled)) {
-   sep = ;
-   device_print_prettyname(dev);
-   if (sc-sc_fastintr) {
-   printf(%sfast interrupt, sep);
-   sep = , ;
-   }
-   if (sc-sc_polled) {
-   printf(%spolled mode, sep);
-   sep = , ;
-   }
-   printf(\n);
-   }
-
if (sc-sc_sysdev != NULL) {
if (sc-sc_sysdev-baudrate == 0) {
if (UART_IOCTL(sc, UART_IOCTL_BAUD,
@@ -529,6 +493,56 @@ uart_bus_attach(device_t dev)
sc-sc_pps.ppscap = PPS_CAPTUREBOTH;

Re: svn commit: r253161 - head/sys/dev/uart

2013-07-10 Thread John Baldwin
On Wednesday, July 10, 2013 1:42:20 pm Marcel Moolenaar wrote:
 Author: marcel
 Date: Wed Jul 10 17:42:20 2013
 New Revision: 253161
 URL: http://svnweb.freebsd.org/changeset/base/253161
 
 Log:
   Protect against broken hardware. In this particular case, protect against
   H/W not de-asserting the interrupt at all. On x86, and because of the
   following conditions, this results in a hard hang with interrupts disabled:
   1.  The uart(4) driver uses a spin lock to protect against concurrent
   access to the H/W. Spin locks disable and restore interrupts.
   2.  Restoring the interrupt on x86 always writes the flags register. Even
   if we're restoring the interrupt from disabled to disabled.
   3.  The x86 CPU has a short window in which interrupts are enabled when the
   flags register is written.

Do you have proof of this?  I have never seen anything like this documented.
It would be fundamentally broken if true.  In fact, if anything the evidence
I have seen is the exact opposite: that Intel is very careful to prevent races
of this sort.  Specifically, Intel CPUs have long had a feature of disabling
interrupts for the instruction following POP SS to permit atomic loads of
SS:ESP (for code that doesn't use LSS).  I highly doubt your claim is true.

In fact, I think you might be confused by the VME bits (VIP and VIF). The
POPF instruction is documented to clear VIP and VIF, but those flags only
matter when operating in virtual 86 mode.  They are not relevant to our
kernel.  I think you need to find a real explanation for the hang you are
seeing.

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


svn commit: r253162 - head/usr.sbin/nvram

2013-07-10 Thread Roman Divacky
Author: rdivacky
Date: Wed Jul 10 18:07:01 2013
New Revision: 253162
URL: http://svnweb.freebsd.org/changeset/base/253162

Log:
  Fix -Wmissing-variable-declarations compiler warning.

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

Modified: head/usr.sbin/nvram/nvram.c
==
--- head/usr.sbin/nvram/nvram.c Wed Jul 10 17:42:20 2013(r253161)
+++ head/usr.sbin/nvram/nvram.c Wed Jul 10 18:07:01 2013(r253162)
@@ -51,7 +51,7 @@ struct deletelist {
struct deletelist *last;
 };
 
-union {
+static union {
uint8_t buf[sizeof(struct chrp_header)];
struct chrp_header header;
 } conv;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r253161 - head/sys/dev/uart

2013-07-10 Thread John Baldwin
On Wednesday, July 10, 2013 2:05:43 pm John Baldwin wrote:
 On Wednesday, July 10, 2013 1:42:20 pm Marcel Moolenaar wrote:
  Author: marcel
  Date: Wed Jul 10 17:42:20 2013
  New Revision: 253161
  URL: http://svnweb.freebsd.org/changeset/base/253161
  
  Log:
Protect against broken hardware. In this particular case, protect against
H/W not de-asserting the interrupt at all. On x86, and because of the
following conditions, this results in a hard hang with interrupts 
  disabled:
1.  The uart(4) driver uses a spin lock to protect against concurrent
access to the H/W. Spin locks disable and restore interrupts.
2.  Restoring the interrupt on x86 always writes the flags register. Even
if we're restoring the interrupt from disabled to disabled.
3.  The x86 CPU has a short window in which interrupts are enabled when 
  the
flags register is written.
 
 Do you have proof of this?  I have never seen anything like this documented.
 It would be fundamentally broken if true.  In fact, if anything the evidence
 I have seen is the exact opposite: that Intel is very careful to prevent races
 of this sort.  Specifically, Intel CPUs have long had a feature of disabling
 interrupts for the instruction following POP SS to permit atomic loads of
 SS:ESP (for code that doesn't use LSS).  I highly doubt your claim is true.
 
 In fact, I think you might be confused by the VME bits (VIP and VIF). The
 POPF instruction is documented to clear VIP and VIF, but those flags only
 matter when operating in virtual 86 mode.  They are not relevant to our
 kernel.  I think you need to find a real explanation for the hang you are
 seeing.

Also, to be clear, if CPUs behave the way you described, our x86 ports would
have been horribly unstable since at least 5.0.  We depend on nested unlocks
not transparently enabling interrupts to prevent nested interrupt frames
(which can quickly exhaust the kernel stack and lead to a double fault, back
when doing early ithread work these were not hard to provoke).

I have not see a single report of a double fault due to this type of
recursion since 5.0 was released 

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


svn commit: r253167 - in head: . lib/libkvm

2013-07-10 Thread Mikolaj Golub
Author: trociny
Date: Wed Jul 10 19:44:43 2013
New Revision: 253167
URL: http://svnweb.freebsd.org/changeset/base/253167

Log:
  In r227839, when removing libkvm dependency on procfs(5),
  kvm_uread() function, used for reading from /proc/pid/mem, was
  removed too. But the function declaration remained in kvm.h
  public header and the soname was not bumped.
  
  Remove kvm_uread() from kvm.h and bump the soname.
  
  Reported by:  rmh
  Discussed on: arch

Modified:
  head/ObsoleteFiles.inc
  head/lib/libkvm/Makefile
  head/lib/libkvm/kvm.h

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Wed Jul 10 19:42:07 2013(r253166)
+++ head/ObsoleteFiles.inc  Wed Jul 10 19:44:43 2013(r253167)
@@ -38,6 +38,9 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20130710: libkvm version bump 
+OLD_LIBS+=lib/libkvm.so.5
+OLD_LIBS+=usr/lib32/libkvm.so.5
 # 20130623: dialog update from 1.1 to 1.2
 OLD_LIBS+=usr/lib/libdialog.so.7
 OLD_LIBS+=usr/lib32/libdialog.so.7

Modified: head/lib/libkvm/Makefile
==
--- head/lib/libkvm/MakefileWed Jul 10 19:42:07 2013(r253166)
+++ head/lib/libkvm/MakefileWed Jul 10 19:44:43 2013(r253167)
@@ -3,6 +3,7 @@
 
 LIB=   kvm
 SHLIBDIR?= /lib
+SHLIB_MAJOR=   6
 CFLAGS+=-DLIBC_SCCS -I${.CURDIR}
 
 .if exists(${.CURDIR}/kvm_${MACHINE_ARCH}.c)

Modified: head/lib/libkvm/kvm.h
==
--- head/lib/libkvm/kvm.h   Wed Jul 10 19:42:07 2013(r253166)
+++ head/lib/libkvm/kvm.h   Wed Jul 10 19:44:43 2013(r253167)
@@ -89,8 +89,6 @@ kvm_t  *kvm_openfiles
(const char *, const char *, const char *, int, char *);
 ssize_t  kvm_read(kvm_t *, unsigned long, void *, size_t);
 ssize_t  kvm_read_zpcpu(kvm_t *, void *, u_long, size_t, int);
-ssize_t  kvm_uread
-   (kvm_t *, const struct kinfo_proc *, unsigned long, char *, size_t);
 ssize_t  kvm_write(kvm_t *, unsigned long, const void *, size_t);
 __END_DECLS
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r253161 - head/sys/dev/uart

2013-07-10 Thread Marcel Moolenaar

On Jul 10, 2013, at 11:09 AM, John Baldwin j...@freebsd.org wrote:

 On Wednesday, July 10, 2013 2:05:43 pm John Baldwin wrote:
 On Wednesday, July 10, 2013 1:42:20 pm Marcel Moolenaar wrote:
 Author: marcel
 Date: Wed Jul 10 17:42:20 2013
 New Revision: 253161
 URL: http://svnweb.freebsd.org/changeset/base/253161
 
 Log:
  Protect against broken hardware. In this particular case, protect against
  H/W not de-asserting the interrupt at all. On x86, and because of the
  following conditions, this results in a hard hang with interrupts disabled:
  1.  The uart(4) driver uses a spin lock to protect against concurrent
  access to the H/W. Spin locks disable and restore interrupts.
  2.  Restoring the interrupt on x86 always writes the flags register. Even
  if we're restoring the interrupt from disabled to disabled.
  3.  The x86 CPU has a short window in which interrupts are enabled when the
  flags register is written.
 
 Do you have proof of this?

No. I only have proof of a hard hang during auto configuration that
cannot be fixed in any other way than not to setup the interrupt at
all.

-- 
Marcel Moolenaar
mar...@xcllnt.net


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


svn commit: r253172 - head/sys/boot/ficl

2013-07-10 Thread Marcel Moolenaar
Author: marcel
Date: Wed Jul 10 21:37:50 2013
New Revision: 253172
URL: http://svnweb.freebsd.org/changeset/base/253172

Log:
  Add 2 builtin words for working with directories:
isdir?  ( fd -- bool )
freaddir( fd -- ptr len TRUE | FALSE )
  
  The 'isdir?' word returns `true' if the file descriptor is for a
  directory and `false' otherwise.
  
  The 'freaddir' word reads the next directory entry and if successful,
  returns its name and 'true'. Otherwise 'false' is returned.
  
  These words give the loader the ability to scan directories and read
  files contained in them for 'rc.d'-like flexibility in handling which
  modules to load and/or which tunables to set.
  
  Obtained from:Juniper Networks, Inc.

Modified:
  head/sys/boot/ficl/loader.c

Modified: head/sys/boot/ficl/loader.c
==
--- head/sys/boot/ficl/loader.c Wed Jul 10 21:05:03 2013(r253171)
+++ head/sys/boot/ficl/loader.c Wed Jul 10 21:37:50 2013(r253172)
@@ -404,6 +404,34 @@ static void displayCellNoPad(FICL_VM *pV
 return;
 }
 
+/*  isdir? - Return whether an fd corresponds to a directory.
+ *
+ * isdir? ( fd -- bool )
+ */
+static void isdirQuestion(FICL_VM *pVM)
+{
+struct stat sb;
+FICL_INT flag;
+int fd;
+
+#if FICL_ROBUST  1
+vmCheckStack(pVM, 1, 1);
+#endif
+
+fd = stackPopINT(pVM-pStack);
+flag = FICL_FALSE;
+do {
+if (fd  0)
+break;
+if (fstat(fd, sb)  0)
+break;
+if (!S_ISDIR(sb.st_mode))
+break;
+flag = FICL_TRUE;
+} while (0);
+stackPushINT(pVM-pStack, flag);
+}
+
 /*  fopen - open a file and return new fd on stack.
  *
  * fopen ( ptr count mode -- fd )
@@ -477,6 +505,30 @@ static void pfread(FICL_VM *pVM)
 return;
 }
 
+/*  freaddir - read directory contents
+ *
+ * freaddir ( fd -- ptr len TRUE | FALSE )
+ */
+static void pfreaddir(FICL_VM *pVM)
+{
+struct dirent *d;
+int fd;
+
+#if FICL_ROBUST  1
+vmCheckStack(pVM, 1, 3);
+#endif
+
+fd = stackPopINT(pVM-pStack);
+d = readdirfd(fd);
+if (d != NULL) {
+stackPushPtr(pVM-pStack, d-d_name);
+stackPushINT(pVM-pStack, strlen(d-d_name));
+stackPushINT(pVM-pStack, FICL_TRUE);
+} else {
+stackPushINT(pVM-pStack, FICL_FALSE);
+}
+}
+
 /*  fload - interpret file contents
  *
  * fload  ( fd -- )
@@ -653,9 +705,11 @@ void ficlCompilePlatform(FICL_SYSTEM *pS
 assert (dp);
 
 dictAppendWord(dp, .#,displayCellNoPad,FW_DEFAULT);
+dictAppendWord(dp, isdir?,isdirQuestion,  FW_DEFAULT);
 dictAppendWord(dp, fopen,pfopen, FW_DEFAULT);
 dictAppendWord(dp, fclose,pfclose,   FW_DEFAULT);
 dictAppendWord(dp, fread,pfread, FW_DEFAULT);
+dictAppendWord(dp, freaddir,  pfreaddir, FW_DEFAULT);
 dictAppendWord(dp, fload,pfload, FW_DEFAULT);
 dictAppendWord(dp, fkey, fkey,   FW_DEFAULT);
 dictAppendWord(dp, fseek, pfseek,FW_DEFAULT);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-07-10 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Jul 10 22:03:01 2013
New Revision: 253173
URL: http://svnweb.freebsd.org/changeset/base/253173

Log:
  Implement 1003.1-2001 pathconf() keys.
  
  This is based on r106058 in UFS.
  
  MFC after:1 month

Modified:
  head/sys/fs/ext2fs/ext2_vnops.c

Modified: head/sys/fs/ext2fs/ext2_vnops.c
==
--- head/sys/fs/ext2fs/ext2_vnops.c Wed Jul 10 21:37:50 2013
(r253172)
+++ head/sys/fs/ext2fs/ext2_vnops.c Wed Jul 10 22:03:01 2013
(r253173)
@@ -1410,33 +1410,68 @@ ext2fifo_kqfilter(struct vop_kqfilter_ar
 static int
 ext2_pathconf(struct vop_pathconf_args *ap)
 {
+   int error = 0;
 
switch (ap-a_name) {
case _PC_LINK_MAX:
*ap-a_retval = EXT2_LINK_MAX;
-   return (0);
+   break;
case _PC_NAME_MAX:
*ap-a_retval = NAME_MAX;
-   return (0);
+   break;
case _PC_PATH_MAX:
*ap-a_retval = PATH_MAX;
-   return (0);
+   break;
case _PC_PIPE_BUF:
*ap-a_retval = PIPE_BUF;
-   return (0);
+   break;
case _PC_CHOWN_RESTRICTED:
*ap-a_retval = 1;
-   return (0);
+   break;
case _PC_NO_TRUNC:
*ap-a_retval = 1;
-   return (0);
+   break;
case _PC_MIN_HOLE_SIZE:
*ap-a_retval = ap-a_vp-v_mount-mnt_stat.f_iosize;
-   return(0);
+   break;
+   case _PC_ASYNC_IO:
+   /* _PC_ASYNC_IO should have been handled by upper layers. */
+   KASSERT(0, (_PC_ASYNC_IO should not get here));
+   error = EINVAL;
+   break;
+   case _PC_PRIO_IO:
+   *ap-a_retval = 0;
+   break;
+   case _PC_SYNC_IO:
+   *ap-a_retval = 0;
+   break;
+   case _PC_ALLOC_SIZE_MIN:
+   *ap-a_retval = ap-a_vp-v_mount-mnt_stat.f_bsize;
+   break;
+   case _PC_FILESIZEBITS:
+   *ap-a_retval = 64;
+   break;
+   case _PC_REC_INCR_XFER_SIZE:
+   *ap-a_retval = ap-a_vp-v_mount-mnt_stat.f_iosize;
+   break;
+   case _PC_REC_MAX_XFER_SIZE:
+   *ap-a_retval = -1; /* means ``unlimited'' */
+   break;
+   case _PC_REC_MIN_XFER_SIZE:
+   *ap-a_retval = ap-a_vp-v_mount-mnt_stat.f_iosize;
+   break;
+   case _PC_REC_XFER_ALIGN:
+   *ap-a_retval = PAGE_SIZE;
+   break;
+   case _PC_SYMLINK_MAX:
+   *ap-a_retval = MAXPATHLEN;
+   break;
+
default:
-   return (EINVAL);
+   error = EINVAL;
+   break;
}
-   /* NOTREACHED */
+   return (error);
 }
 
 /*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253174 - head/share/misc

2013-07-10 Thread John Marino
Author: marino (ports committer)
Date: Wed Jul 10 22:12:48 2013
New Revision: 253174
URL: http://svnweb.freebsd.org/changeset/base/253174

Log:
  Add John Marino to committers-port.dot
  
  Approved by:  bapt (mentor)

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

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotWed Jul 10 22:03:01 2013
(r253173)
+++ head/share/misc/committers-ports.dotWed Jul 10 22:12:48 2013
(r253174)
@@ -143,6 +143,7 @@ maho [label=Maho Nakata\nmaho@FreeBSD.o
 makc [label=Max Brazhnikov\nm...@freebsd.org\n2008/08/25]
 mandree [label=Matthias Andree\nmand...@freebsd.org\n2009/11/18]
 marcus [label=Joe Marcus Clarke\nmar...@freebsd.org\n2002/04/05]
+marino [label=John Marino\nmar...@freebsd.org\n2013/07/04]
 marius [label=Marius Strobl\nmar...@freebsd.org\n2012/12/29]
 markus [label=Markus Brueffer\nmar...@freebsd.org\n2004/02/21]
 martymac [label=Ganael Laplanche\nmarty...@freebsd.org\n2010/09/24]
@@ -247,6 +248,7 @@ bapt - bdrewery
 bapt - eadler
 bapt - jlaffaye
 bapt - marius
+bapt - marino
 
 beat - decke
 beat - marius
@@ -276,6 +278,7 @@ crees - tijl
 
 culot - jase
 culot - wg
+culot - marino
 
 db - tj
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253175 - head/usr.sbin/bsdconfig/share

2013-07-10 Thread Devin Teske
Author: dteske
Date: Wed Jul 10 22:45:07 2013
New Revision: 253175
URL: http://svnweb.freebsd.org/changeset/base/253175

Log:
  Introduce a new [yet unused] function for [efficiently] getting the path to
  an executable by-name without forking or using externals.
  
  In a performance benchmark of 10,000 runs on circa 2006 hardware, f_which
  out-performed `which' with an average completion time of ~2.5 seconds versus
  ~56 seconds.
  
  This should be handy for future use (not that I make it a habit to call
  `which' in a loop 10,000 times).

Modified:
  head/usr.sbin/bsdconfig/share/common.subr

Modified: head/usr.sbin/bsdconfig/share/common.subr
==
--- head/usr.sbin/bsdconfig/share/common.subr   Wed Jul 10 22:12:48 2013
(r253174)
+++ head/usr.sbin/bsdconfig/share/common.subr   Wed Jul 10 22:45:07 2013
(r253175)
@@ -212,6 +212,35 @@ f_have()
f_quietly type $@
 }
 
+# f_which $anything [$var_to_set]
+#
+# A fast built-in replacement for syntaxes such as foo=$( which bar ). In a
+# comparison of 10,000 runs of this function versus which, this function
+# completed in under 3 seconds, while `which' took almost a full minute.
+#
+# If $var_to_set is missing or NULL, output is (like which) to standard out.
+# Returns success if a match was found, failure otherwise.
+#
+f_which()
+{
+   local __name=$1 __var_to_set=$2
+   case $__name in */*|'') return $FAILURE; esac
+   local __p IFS=: __found=
+   for __p in $PATH; do
+   local __exec=$__p/$__name
+   [ -f $__exec -a -x $__exec ]  __found=1  break
+   done
+   if [ $__found ]; then
+   if [ $__var_to_set ]; then
+   setvar $__var_to_set $__exec
+   else
+   echo $__exec
+   fi
+   return $SUCCESS
+   fi
+   return $FAILURE
+}
+
 # f_getvar $var_to_get [$var_to_set]
 #
 # Utility function designed to go along with the already-builtin setvar.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253176 - head/sys/dev/ixgbe

2013-07-10 Thread Jack F Vogel
Author: jfv
Date: Wed Jul 10 23:14:24 2013
New Revision: 253176
URL: http://svnweb.freebsd.org/changeset/base/253176

Log:
  Fix to a panic found internally, bad pointer during rxeof
  processing. Thanks for John Baldwin for catching this. Not
  clearing the flag member of the rxbuf could result in a NULL
  mbuf pointer being used.
  
  MFC after:2 days (this needs to get into 9.2!)

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

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Wed Jul 10 22:45:07 2013(r253175)
+++ head/sys/dev/ixgbe/ixgbe.c  Wed Jul 10 23:14:24 2013(r253176)
@@ -3943,6 +3943,7 @@ ixgbe_free_receive_ring(struct rx_ring *
rxbuf-buf-m_flags |= M_PKTHDR;
m_freem(rxbuf-buf);
rxbuf-buf = NULL;
+   rxbuf-flag = 0;
}
}
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r253048 - in head/sys/ofed: drivers/net/mlx4 include/linux

2013-07-10 Thread Garrett Cooper
On Tue, Jul 9, 2013 at 8:20 AM, John Baldwin j...@freebsd.org wrote:

...

 I hadn't seen it.  I had wondered if the '\n' issue was a generic sysfs thing.
 It sounds like it is and I'd be happy to revert the mlx4 change and alter the
 sysfs bits to manage the newline directly if that is more appropriate.

I'll doublecheck this, but basically I'm really adverse to diverging
from Linux in this area -- hence that's why I did what I did in the PR
I mentioned.

 I'd also like this to use sysctl_handle_string() if at all possible.  Are you 
 in
 a position to test patches still?

Unfortunately I'm not right now :(. Anthony may or may not be able to
test this out (I used his machine when we were hacking around on IB
stuff).

 If so, maybe give this a whirl.  It's similar to yours except it uses
 sysctl_handle_string() and strlcat() rather than continuing to do things
 by hand.  It also outputs an empty string to userland if the attribute
 doesn't have a show method (your version would never pass out an old
 string in that case unlike the original code).

Can you please pass along a patch to Anthony and me so we can try and
apply it to test it out (Gmail's going to taint the inline patch, as
is the EMC Exchange server with the patch attachment)? If Anthony
still has the machine setup, then I'd be more than happy to test out
the patch :).

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


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

2013-07-10 Thread Jim Harris
Author: jimharris
Date: Thu Jul 11 02:10:23 2013
New Revision: 253178
URL: http://svnweb.freebsd.org/changeset/base/253178

Log:
  Bump date for nvme(4) and nvd(4).
  
  MFC after:3 days

Modified:
  head/share/man/man4/nvd.4
  head/share/man/man4/nvme.4

Modified: head/share/man/man4/nvd.4
==
--- head/share/man/man4/nvd.4   Thu Jul 11 01:30:24 2013(r253177)
+++ head/share/man/man4/nvd.4   Thu Jul 11 02:10:23 2013(r253178)
@@ -33,7 +33,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 10, 2012
+.Dd July 9, 2013
 .Dt NVD 4
 .Os
 .Sh NAME

Modified: head/share/man/man4/nvme.4
==
--- head/share/man/man4/nvme.4  Thu Jul 11 01:30:24 2013(r253177)
+++ head/share/man/man4/nvme.4  Thu Jul 11 02:10:23 2013(r253178)
@@ -33,7 +33,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 10, 2012
+.Dd July 9, 2013
 .Dt NVME 4
 .Os
 .Sh NAME
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253179 - head/sys/dev/ixgbe

2013-07-10 Thread Jack F Vogel
Author: jfv
Date: Thu Jul 11 03:44:06 2013
New Revision: 253179
URL: http://svnweb.freebsd.org/changeset/base/253179

Log:
  Fix my last commit, flags rather than flag... duh.
  
  MFC after: 2 days

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

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Thu Jul 11 02:10:23 2013(r253178)
+++ head/sys/dev/ixgbe/ixgbe.c  Thu Jul 11 03:44:06 2013(r253179)
@@ -3943,7 +3943,7 @@ ixgbe_free_receive_ring(struct rx_ring *
rxbuf-buf-m_flags |= M_PKTHDR;
m_freem(rxbuf-buf);
rxbuf-buf = NULL;
-   rxbuf-flag = 0;
+   rxbuf-flags = 0;
}
}
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2013-07-10 Thread Peter Grehan
Author: grehan
Date: Thu Jul 11 03:54:35 2013
New Revision: 253181
URL: http://svnweb.freebsd.org/changeset/base/253181

Log:
  Implement RTC CMOS nvram. Init some fields that are used
  by FreeBSD and UEFI.
  Tested with nvram(4).
  
  Reviewed by:  neel

Added:
  head/usr.sbin/bhyve/rtc.h   (contents, props changed)
Modified:
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyve/rtc.c

Modified: head/usr.sbin/bhyve/bhyverun.c
==
--- head/usr.sbin/bhyve/bhyverun.c  Thu Jul 11 03:49:14 2013
(r253180)
+++ head/usr.sbin/bhyve/bhyverun.c  Thu Jul 11 03:54:35 2013
(r253181)
@@ -59,6 +59,7 @@ __FBSDID($FreeBSD$);
 #include xmsr.h
 #include ioapic.h
 #include spinup_ap.h
+#include rtc.h
 
 #defineDEFAULT_GUEST_HZ100
 #defineDEFAULT_GUEST_TSLICE200
@@ -735,6 +736,8 @@ main(int argc, char *argv[])
init_mem();
init_inout();
 
+   rtc_init(ctx);
+
/*
 * Exit if a device emulation finds an error in it's initilization
 */

Modified: head/usr.sbin/bhyve/rtc.c
==
--- head/usr.sbin/bhyve/rtc.c   Thu Jul 11 03:49:14 2013(r253180)
+++ head/usr.sbin/bhyve/rtc.c   Thu Jul 11 03:54:35 2013(r253181)
@@ -33,10 +33,15 @@ __FBSDID($FreeBSD$);
 #include sys/time.h
 
 #include stdio.h
+#include string.h
 #include time.h
 #include assert.h
 
+#include machine/vmm.h
+#include vmmapi.h
+
 #include inout.h
+#include rtc.h
 
 #defineIO_RTC  0x70
 
@@ -64,16 +69,30 @@ __FBSDID($FreeBSD$);
 #define RTC_STATUSD0x0d/* status register D (R) Lost Power */
 #define  RTCSD_PWR  0x80   /* clock power OK */
 
-#defineRTC_DIAG0x0e
+#defineRTC_NVRAM_START 0x0e
+#defineRTC_NVRAM_END   0x7f
+#define RTC_NVRAM_SZ   (128 - RTC_NVRAM_START)
+#definenvoff(x)((x) - RTC_NVRAM_START)
 
+#defineRTC_DIAG0x0e
 #define RTC_RSTCODE0x0f
-
 #defineRTC_EQUIPMENT   0x14
+#defineRTC_LMEM_LSB0x34
+#defineRTC_LMEM_MSB0x35
+#defineRTC_HMEM_LSB0x5b
+#defineRTC_HMEM_SB 0x5c
+#defineRTC_HMEM_MSB0x5d
+
+#define m_64KB (64*1024)
+#definem_16MB  (16*1024*1024)
+#definem_4GB   (4ULL*1024*1024*1024)
 
 static int addr;
 
+static uint8_t rtc_nvram[RTC_NVRAM_SZ];
+
 /* XXX initialize these to default values as they would be from BIOS */
-static uint8_t status_a, status_b, rstcode;
+static uint8_t status_a, status_b;
 
 static u_char const bin2bcd_data[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
@@ -135,14 +154,11 @@ rtc_addr_handler(struct vmctx *ctx, int 
case RTC_DAY:
case RTC_MONTH:
case RTC_YEAR:
-   case RTC_CENTURY:
case RTC_STATUSA:
case RTC_STATUSB:
case RTC_INTR:
case RTC_STATUSD:
-   case RTC_DIAG:
-   case RTC_RSTCODE:
-   case RTC_EQUIPMENT:
+   case RTC_NVRAM_START ... RTC_NVRAM_END:
break;
default:
return (-1);
@@ -217,9 +233,6 @@ rtc_data_handler(struct vmctx *ctx, int 
case RTC_YEAR:
*eax = rtcout(tm.tm_year % 100);
return (0);
-   case RTC_CENTURY:
-   *eax = rtcout(tm.tm_year / 100);
-   break;
case RTC_STATUSA:
*eax = status_a;
return (0);
@@ -232,14 +245,8 @@ rtc_data_handler(struct vmctx *ctx, int 
case RTC_STATUSD:
*eax = RTCSD_PWR;
return (0);
-   case RTC_DIAG:
-   *eax = 0;
-   return (0);
-   case RTC_RSTCODE:
-   *eax = rstcode;
-   return (0);
-   case RTC_EQUIPMENT:
-   *eax = 0;
+   case RTC_NVRAM_START ... RTC_NVRAM_END:
+   *eax = rtc_nvram[addr - RTC_NVRAM_START];
return (0);
default:
return (-1);
@@ -259,9 +266,6 @@ rtc_data_handler(struct vmctx *ctx, int 
case RTC_STATUSD:
/* ignore write */
break;
-   case RTC_RSTCODE:
-   rstcode = *eax;
-   break;
case RTC_SEC:
case RTC_MIN:
case RTC_HRS:
@@ -269,16 +273,58 @@ rtc_data_handler(struct vmctx *ctx, int 
case RTC_DAY:
case RTC_MONTH:
case RTC_YEAR:
-   case RTC_CENTURY:
/*
 * Ignore writes to the time of day registers
 */
break;
+   case RTC_NVRAM_START ... RTC_NVRAM_END:
+   rtc_nvram[addr - RTC_NVRAM_START] = *eax;
+   

svn commit: r253185 - head/sys/i386/i386

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:10:36 2013
New Revision: 253185
URL: http://svnweb.freebsd.org/changeset/base/253185

Log:
  MFamd64 r253140:
  Clear m-object for the page taken from the delayed free list in
  pmap_pv_reclaim().
  
  Noted by: alc

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

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul 11 04:57:08 2013(r253184)
+++ head/sys/i386/i386/pmap.c   Thu Jul 11 05:10:36 2013(r253185)
@@ -2311,6 +2311,7 @@ out:
if (m_pc == NULL  pv_vafree != 0  free != NULL) {
m_pc = free;
free = (void *)m_pc-object;
+   m_pc-object = NULL;
/* Recycle a freed page table page. */
m_pc-wire_count = 1;
atomic_add_int(cnt.v_wire_count, 1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253186 - head/sys/i386/i386

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:15:30 2013
New Revision: 253186
URL: http://svnweb.freebsd.org/changeset/base/253186

Log:
  Explicitely panic instead of possibly doing undefined things when
  ptelist KVA is exhausted.  Currently this cannot happen, the added
  panic serves as assert.
  
  Discussed with:   alc
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Thu Jul 11 05:10:36 2013(r253185)
+++ head/sys/i386/i386/pmap.c   Thu Jul 11 05:15:30 2013(r253186)
@@ -680,7 +680,7 @@ pmap_ptelist_alloc(vm_offset_t *head)
 
va = *head;
if (va == 0)
-   return (va);/* Out of memory */
+   panic(pmap_ptelist_alloc: exhausted ptelist KVA);
pte = vtopte(va);
*head = *pte;
if (*head  PG_V)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253187 - head/sys/kern

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:36:26 2013
New Revision: 253187
URL: http://svnweb.freebsd.org/changeset/base/253187

Log:
  Do not invalidate page of the B_NOCACHE buffer or buffer after an I/O
  error if any user wired mappings exist.  Doing the invalidation
  destroys the user wiring.
  
  The change is the temporal measure to close the bug, the more proper
  fix is to delegate the invalidation of the page to upper layers
  always.
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==
--- head/sys/kern/vfs_bio.c Thu Jul 11 05:15:30 2013(r253186)
+++ head/sys/kern/vfs_bio.c Thu Jul 11 05:36:26 2013(r253187)
@@ -1692,7 +1692,8 @@ brelse(struct buf *bp)
 
KASSERT(presid = 0, (brelse: extra page));
VM_OBJECT_WLOCK(obj);
-   vm_page_set_invalid(m, poffset, presid);
+   if (pmap_page_wired_mappings(m) == 0)
+   vm_page_set_invalid(m, poffset, presid);
VM_OBJECT_WUNLOCK(obj);
if (had_bogus)
printf(avoided corruption bug in 
bogus_page/brelse code\n);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253188 - head/sys/vm

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:38:39 2013
New Revision: 253188
URL: http://svnweb.freebsd.org/changeset/base/253188

Log:
  In the vm_page_set_invalid() function, do not assert that the page is
  not busy, since its only caller brelse() can legitimately call it on
  busy page.  This happens for VOP_PUTPAGES() on filesystems that use
  buffers and which VOP_WRITE() method marked the buffer containing page
  as non-cacheable.
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Jul 11 05:36:26 2013(r253187)
+++ head/sys/vm/vm_page.c   Thu Jul 11 05:38:39 2013(r253188)
@@ -2631,8 +2631,6 @@ vm_page_set_invalid(vm_page_t m, int bas
vm_page_bits_t bits;
 
VM_OBJECT_ASSERT_WLOCKED(m-object);
-   KASSERT((m-oflags  VPO_BUSY) == 0,
-   (vm_page_set_invalid: page %p is busy, m));
bits = vm_page_bits(base, size);
if (m-valid == VM_PAGE_BITS_ALL  bits != 0)
pmap_remove_all(m);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253189 - head/sys/vm

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:47:26 2013
New Revision: 253189
URL: http://svnweb.freebsd.org/changeset/base/253189

Log:
  Never remove user-wired pages from an object when doing
  msync(MS_INVALIDATE).  The vm_fault_copy_entry() requires that object
  range which corresponds to the user-wired vm_map_entry, is always
  fully populated.
  
  Add OBJPR_NOTWIRED flag for vm_object_page_remove() to request the
  preserving behaviour, use it when calling vm_object_page_remove() from
  vm_object_sync().
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_object.c
  head/sys/vm/vm_object.h

Modified: head/sys/vm/vm_object.c
==
--- head/sys/vm/vm_object.c Thu Jul 11 05:38:39 2013(r253188)
+++ head/sys/vm/vm_object.c Thu Jul 11 05:47:26 2013(r253189)
@@ -1054,9 +1054,9 @@ vm_object_sync(vm_object_t object, vm_oo
 */
flags = OBJPR_NOTMAPPED;
else if (old_msync)
-   flags = 0;
+   flags = OBJPR_NOTWIRED;
else
-   flags = OBJPR_CLEANONLY;
+   flags = OBJPR_CLEANONLY | OBJPR_NOTWIRED;
vm_object_page_remove(object, OFF_TO_IDX(offset),
OFF_TO_IDX(offset + size + PAGE_MASK), flags);
}
@@ -1892,7 +1892,8 @@ again:
vm_page_lock(p);
if ((wirings = p-wire_count) != 0 
(wirings = pmap_page_wired_mappings(p)) != p-wire_count) {
-   if ((options  OBJPR_NOTMAPPED) == 0) {
+   if ((options  (OBJPR_NOTWIRED | OBJPR_NOTMAPPED)) ==
+   0) {
pmap_remove_all(p);
/* Account for removal of wired mappings. */
if (wirings != 0)
@@ -1902,8 +1903,7 @@ again:
p-valid = 0;
vm_page_undirty(p);
}
-   vm_page_unlock(p);
-   continue;
+   goto next;
}
if (vm_page_sleep_if_busy(p, TRUE, vmopar))
goto again;
@@ -1912,12 +1912,12 @@ again:
if ((options  OBJPR_CLEANONLY) != 0  p-valid != 0) {
if ((options  OBJPR_NOTMAPPED) == 0)
pmap_remove_write(p);
-   if (p-dirty) {
-   vm_page_unlock(p);
-   continue;
-   }
+   if (p-dirty)
+   goto next;
}
if ((options  OBJPR_NOTMAPPED) == 0) {
+   if ((options  OBJPR_NOTWIRED) != 0  wirings != 0)
+   goto next;
pmap_remove_all(p);
/* Account for removal of wired mappings. */
if (wirings != 0) {
@@ -1929,6 +1929,7 @@ again:
}
}
vm_page_free(p);
+next:
vm_page_unlock(p);
}
vm_object_pip_wakeup(object);

Modified: head/sys/vm/vm_object.h
==
--- head/sys/vm/vm_object.h Thu Jul 11 05:38:39 2013(r253188)
+++ head/sys/vm/vm_object.h Thu Jul 11 05:47:26 2013(r253189)
@@ -205,6 +205,7 @@ struct vm_object {
  */
 #defineOBJPR_CLEANONLY 0x1 /* Don't remove dirty pages. */
 #defineOBJPR_NOTMAPPED 0x2 /* Don't unmap pages. */
+#defineOBJPR_NOTWIRED  0x4 /* Don't remove wired pages. */
 
 TAILQ_HEAD(object_q, vm_object);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r253190 - head/sys/vm

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:55:08 2013
New Revision: 253190
URL: http://svnweb.freebsd.org/changeset/base/253190

Log:
  The mlockall() or VM_MAP_WIRE_HOLESOK does not interact properly with
  parallel creation of the map entries, e.g. by mmap() or stack growing.
  It also breaks when other entry is wired in parallel.
  
  The vm_map_wire() iterates over the map entries in the region, and
  assumes that map entries it finds are marked as in transition before,
  also that any entry marked as in transition, are marked by the current
  invocation of vm_map_wire().  This is not true for new entries in the
  holes.
  
  Add the thread owner of the MAP_ENTRY_IN_TRANSITION flag to struct
  vm_map_entry.  In vm_map_wire() and vm_map_unwire(), only process the
  entries which transition owner is the current thread.
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cThu Jul 11 05:47:26 2013(r253189)
+++ head/sys/vm/vm_map.cThu Jul 11 05:55:08 2013(r253190)
@@ -2281,6 +2281,7 @@ vm_map_unwire(vm_map_t map, vm_offset_t 
 * above.)
 */
entry-eflags |= MAP_ENTRY_IN_TRANSITION;
+   entry-wiring_thread = curthread;
/*
 * Check the map for holes in the specified region.
 * If VM_MAP_WIRE_HOLESOK was specified, skip this check.
@@ -2313,8 +2314,24 @@ done:
else
KASSERT(result, (vm_map_unwire: lookup failed));
}
-   entry = first_entry;
-   while (entry != map-header  entry-start  end) {
+   for (entry = first_entry; entry != map-header  entry-start  end;
+   entry = entry-next) {
+   /*
+* If VM_MAP_WIRE_HOLESOK was specified, an empty
+* space in the unwired region could have been mapped
+* while the map lock was dropped for draining
+* MAP_ENTRY_IN_TRANSITION.  Moreover, another thread
+* could be simultaneously wiring this new mapping
+* entry.  Detect these cases and skip any entries
+* marked as in transition by us.
+*/
+   if ((entry-eflags  MAP_ENTRY_IN_TRANSITION) == 0 ||
+   entry-wiring_thread != curthread) {
+   KASSERT((flags  VM_MAP_WIRE_HOLESOK) != 0,
+   (vm_map_unwire: !HOLESOK and new/changed entry));
+   continue;
+   }
+
if (rv == KERN_SUCCESS  (!user_unwire ||
(entry-eflags  MAP_ENTRY_USER_WIRED))) {
if (user_unwire)
@@ -2330,15 +2347,15 @@ done:
OBJ_FICTITIOUS) != 0);
}
}
-   KASSERT(entry-eflags  MAP_ENTRY_IN_TRANSITION,
-   (vm_map_unwire: in-transition flag missing));
+   KASSERT((entry-eflags  MAP_ENTRY_IN_TRANSITION) != 0,
+   (vm_map_unwire: in-transition flag missing));
entry-eflags = ~MAP_ENTRY_IN_TRANSITION;
+   entry-wiring_thread = NULL;
if (entry-eflags  MAP_ENTRY_NEEDS_WAKEUP) {
entry-eflags = ~MAP_ENTRY_NEEDS_WAKEUP;
need_wakeup = TRUE;
}
vm_map_simplify_entry(map, entry);
-   entry = entry-next;
}
vm_map_unlock(map);
if (need_wakeup)
@@ -2432,6 +2449,7 @@ vm_map_wire(vm_map_t map, vm_offset_t st
 * above.)
 */
entry-eflags |= MAP_ENTRY_IN_TRANSITION;
+   entry-wiring_thread = curthread;
if ((entry-protection  (VM_PROT_READ | VM_PROT_EXECUTE)) == 0
|| (entry-protection  prot) != prot) {
entry-eflags |= MAP_ENTRY_WIRE_SKIPPED;
@@ -2523,10 +2541,27 @@ done:
else
KASSERT(result, (vm_map_wire: lookup failed));
}
-   entry = first_entry;
-   while (entry != map-header  entry-start  end) {
+   for (entry = first_entry; entry != map-header  entry-start  end;
+   entry = entry-next) {
if ((entry-eflags  MAP_ENTRY_WIRE_SKIPPED) != 0)
goto next_entry_done;
+
+   /*
+* If VM_MAP_WIRE_HOLESOK was specified, an empty
+* space in the unwired region could have been mapped
+* while the map lock was dropped for faulting in the
+* pages or draining MAP_ENTRY_IN_TRANSITION.
+* Moreover, another thread could be simultaneously
+  

svn commit: r253191 - head/sys/vm

2013-07-10 Thread Konstantin Belousov
Author: kib
Date: Thu Jul 11 05:58:28 2013
New Revision: 253191
URL: http://svnweb.freebsd.org/changeset/base/253191

Log:
  The vm_fault() should not be allowed to proceed on the map entry which
  is being wired now.  The entry wired count is changed to non-zero in
  advance, before the map lock is dropped.  This makes the vm_fault() to
  perceive the entry as wired, and breaks the fragment which moves the
  wire count from the shadowed page, to the upper page, making the code
  unwiring non-wired page.
  
  On the other hand, the vm_fault() calls from vm_fault_wire() should be
  allowed to proceed, so only drain MAP_ENTRY_IN_TRANSITION from
  vm_fault() when wiring_thread is not current.
  
  Reported and tested by:   pho
  Reviewed by:  alc
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==
--- head/sys/vm/vm_fault.c  Thu Jul 11 05:55:08 2013(r253190)
+++ head/sys/vm/vm_fault.c  Thu Jul 11 05:58:28 2013(r253191)
@@ -280,6 +280,19 @@ RetryFault:;
(u_long)vaddr);
}
 
+   if (fs.entry-eflags  MAP_ENTRY_IN_TRANSITION 
+   fs.entry-wiring_thread != curthread) {
+   vm_map_unlock_read(fs.map);
+   vm_map_lock(fs.map);
+   if (vm_map_lookup_entry(fs.map, vaddr, fs.entry) 
+   (fs.entry-eflags  MAP_ENTRY_IN_TRANSITION)) {
+   fs.entry-eflags |= MAP_ENTRY_NEEDS_WAKEUP;
+   vm_map_unlock_and_wait(fs.map, 0);
+   } else
+   vm_map_unlock(fs.map);
+   goto RetryFault;
+   }
+
/*
 * Make a reference to this object to prevent its disposal while we
 * are messing with it.  Once we have the reference, the map is free
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org