svn commit: r240158 - head/sys/netinet

2012-09-06 Thread Michael Tuexen
Author: tuexen
Date: Thu Sep  6 07:03:56 2012
New Revision: 240158
URL: http://svn.freebsd.org/changeset/base/240158

Log:
  Get rid of a gcc'ism.
  
  MFC after: 10 days

Modified:
  head/sys/netinet/sctp_cc_functions.c

Modified: head/sys/netinet/sctp_cc_functions.c
==
--- head/sys/netinet/sctp_cc_functions.cThu Sep  6 06:17:39 2012
(r240157)
+++ head/sys/netinet/sctp_cc_functions.cThu Sep  6 07:03:56 2012
(r240158)
@@ -1917,10 +1917,9 @@ measure_achieved_throughput(struct sctp_
return;
}
net-cc_mod.htcp_ca.bytecount += net-net_ack;
-
-   if (net-cc_mod.htcp_ca.bytecount = net-cwnd - 
((net-cc_mod.htcp_ca.alpha  7 ? : 1) * net-mtu)
-now - net-cc_mod.htcp_ca.lasttime = net-cc_mod.htcp_ca.minRTT
-net-cc_mod.htcp_ca.minRTT  0) {
+   if ((net-cc_mod.htcp_ca.bytecount = net-cwnd - 
(((net-cc_mod.htcp_ca.alpha  7) ? (net-cc_mod.htcp_ca.alpha  7) : 1) * 
net-mtu)) 
+   (now - net-cc_mod.htcp_ca.lasttime = net-cc_mod.htcp_ca.minRTT) 

+   (net-cc_mod.htcp_ca.minRTT  0)) {
uint32_t cur_Bi = net-cc_mod.htcp_ca.bytecount / net-mtu * hz 
/ (now - net-cc_mod.htcp_ca.lasttime);
 
if (htcp_ccount(net-cc_mod.htcp_ca) = 3) {
___
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: r240156 - head/lib/libproc

2012-09-06 Thread Gennady Proskurin
On Thu, Sep 06, 2012 at 03:19:49AM +, Rui Paulo wrote:
 Author: rpaulo
 Date: Thu Sep  6 03:19:48 2012
 New Revision: 240156
 URL: http://svn.freebsd.org/changeset/base/240156
 
 Log:
   Add support for demangling C++ symbols. This requires linking libproc with
   libc++rt/libsupc++.
   
   Discussed with: theraven
 
 Modified:
   head/lib/libproc/Makefile
   head/lib/libproc/proc_sym.c
 
 Modified: head/lib/libproc/Makefile
 ==
 --- head/lib/libproc/Makefile Thu Sep  6 02:07:58 2012(r240155)
 +++ head/lib/libproc/Makefile Thu Sep  6 03:19:48 2012(r240156)
 @@ -1,5 +1,7 @@
  # $FreeBSD$
  
 +.include bsd.own.mk
 +
  LIB= proc
  
  SRCS=proc_bkpt.c \
 @@ -13,6 +15,14 @@ INCS=  libproc.h
  
  CFLAGS+= -I${.CURDIR}
  
 +.if ${MK_LIBCPLUSPLUS} != no
 +LDADD+=  -lcxxrt
 +DPADD+=  ${LIBCXXRT}
 +.else
 +LDADD+=  -lsupc++
 +DPADD+=  ${LIBSTDCPLUSPLUS}
 +.endif
 +
  SHLIB_MAJOR= 2
  
  WITHOUT_MAN=
 
 Modified: head/lib/libproc/proc_sym.c
 ==
 --- head/lib/libproc/proc_sym.c   Thu Sep  6 02:07:58 2012
 (r240155)
 +++ head/lib/libproc/proc_sym.c   Thu Sep  6 03:19:48 2012
 (r240156)
 @@ -46,6 +46,8 @@
  
  #include _libproc.h
  
 +extern char *__cxa_demangle(const char *, char *, size_t *, int *);
 +
  static void  proc_rdl2prmap(rd_loadobj_t *, prmap_t *);
  
  static void
 @@ -266,7 +268,11 @@ proc_addr2sym(struct proc_handle *p, uin
   if (addr = rsym  addr = (rsym + sym.st_size)) {
   s = elf_strptr(e, dynsymstridx, sym.st_name);
   if (s) {
 - strlcpy(name, s, namesz);
 + if (strlen(s)  2  
 + s[0] == '_'  s[1] == 'Z')
checking strlen(s)  2 is useless and not optimal here, you can omit it 
completely
checking s[0] and s[1] is enough, it implies that length is =2
you may add something like s[2] != 0 if length should be strictly 2

 + __cxa_demangle(s, name, namesz, NULL);
 + else
 + strlcpy(name, s, namesz);
   memcpy(symcopy, sym, sizeof(sym));
   /*
* DTrace expects the st_value to contain
 @@ -302,7 +308,11 @@ symtab:
   if (addr = rsym  addr = (rsym + sym.st_size)) {
   s = elf_strptr(e, symtabstridx, sym.st_name);
   if (s) {
 - strlcpy(name, s, namesz);
 + if (strlen(s)  2  
 + s[0] == '_'  s[1] == 'Z')
 + __cxa_demangle(s, name, namesz, NULL);
 + else
 + strlcpy(name, s, namesz);
the same here

   memcpy(symcopy, sym, sizeof(sym));
   /*
* DTrace expects the st_value to contain
 ___
 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-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: r240156 - head/lib/libproc

2012-09-06 Thread Stefan Farfeleder
On Thu, Sep 06, 2012 at 03:19:49AM +, Rui Paulo wrote:
 @@ -266,7 +268,11 @@ proc_addr2sym(struct proc_handle *p, uin
   if (addr = rsym  addr = (rsym + sym.st_size)) {
   s = elf_strptr(e, dynsymstridx, sym.st_name);
   if (s) {
 - strlcpy(name, s, namesz);
 + if (strlen(s)  2  
 + s[0] == '_'  s[1] == 'Z')
 + __cxa_demangle(s, name, namesz, NULL);
 + else
 + strlcpy(name, s, namesz);
   memcpy(symcopy, sym, sizeof(sym));
   /*
* DTrace expects the st_value to contain

According to the documentation, __cxa_demangle will realloc the buffer
if it is too small and return the new buffer. This case is not handled
correctly.

Stefan
___
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: r240162 - head/sys/cddl/compat/opensolaris/sys

2012-09-06 Thread Martin Matuska
Author: mm
Date: Thu Sep  6 13:43:48 2012
New Revision: 240162
URL: http://svn.freebsd.org/changeset/base/240162

Log:
  Make r230454 more readable and vendor-like.
  
  PR:   kern/171380
  MFC after:3 days

Modified:
  head/sys/cddl/compat/opensolaris/sys/sid.h

Modified: head/sys/cddl/compat/opensolaris/sys/sid.h
==
--- head/sys/cddl/compat/opensolaris/sys/sid.h  Thu Sep  6 10:10:56 2012
(r240161)
+++ head/sys/cddl/compat/opensolaris/sys/sid.h  Thu Sep  6 13:43:48 2012
(r240162)
@@ -30,7 +30,8 @@
 #define_OPENSOLARIS_SYS_SID_H_
 
 typedef struct ksiddomain {
-   charkd_name[1]; /* Domain part of SID */
+   char*kd_name;   /* Domain part of SID */
+   uint_t  kd_len;
 } ksiddomain_t;
 typedef void   ksid_t;
 
@@ -38,8 +39,12 @@ static __inline ksiddomain_t *
 ksid_lookupdomain(const char *domain)
 {
ksiddomain_t *kd;
+   size_t len;
 
-   kd = kmem_alloc(sizeof(*kd) + strlen(domain), KM_SLEEP);
+   len = strlen(domain) + 1;
+   kd = kmem_alloc(sizeof(*kd), KM_SLEEP);
+   kd-kd_len = (uint_t)len;
+   kd-kd_name = kmem_alloc(len, KM_SLEEP);
strcpy(kd-kd_name, domain);
return (kd);
 }
@@ -48,6 +53,7 @@ static __inline void
 ksiddomain_rele(ksiddomain_t *kd)
 {
 
+   kmem_free(kd-kd_name, kd-kd_len);
kmem_free(kd, sizeof(*kd));
 }
 
___
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: r240163 - head/contrib/gdb/gdb

2012-09-06 Thread Ed Maste
Author: emaste
Date: Thu Sep  6 13:47:42 2012
New Revision: 240163
URL: http://svn.freebsd.org/changeset/base/240163

Log:
  Fix Corrupted DWARF expression from (k)gdb.
  
  Google turned up Debian bug 405116, which describes the problem in
  sufficient detail to identify the overflowing variables.
  
  MFC after:1 week

Modified:
  head/contrib/gdb/gdb/dwarf2loc.h

Modified: head/contrib/gdb/gdb/dwarf2loc.h
==
--- head/contrib/gdb/gdb/dwarf2loc.hThu Sep  6 13:43:48 2012
(r240162)
+++ head/contrib/gdb/gdb/dwarf2loc.hThu Sep  6 13:47:42 2012
(r240163)
@@ -38,7 +38,7 @@ struct dwarf2_locexpr_baton
   unsigned char *data;
 
   /* Length of the location expression.  */
-  unsigned short size;
+  unsigned long size;
 
   /* The objfile containing the symbol whose location we're computing.  */
   struct objfile *objfile;
@@ -54,7 +54,7 @@ struct dwarf2_loclist_baton
   unsigned char *data;
 
   /* Length of the location list.  */
-  unsigned short size;
+  unsigned long size;
 
   /* The objfile containing the symbol whose location we're computing.  */
   /* Used (only???) by thread local variables.  The objfile in which
___
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: r240164 - in head: lib/libpmc sys/dev/hwpmc sys/sys

2012-09-06 Thread Fabien Thomas
Author: fabient
Date: Thu Sep  6 13:54:01 2012
New Revision: 240164
URL: http://svn.freebsd.org/changeset/base/240164

Log:
  Add Intel Ivy Bridge support to hwpmc(9).
  Update offcore RSP token for Sandy Bridge.
  Note: No uncore support.
  
  Will works on Family 6 Model 3a.
  
  MFC after: 1 month
  Tested by: bapt, grehan

Added:
  head/lib/libpmc/pmc.ivybridge.3   (contents, props changed)
Modified:
  head/lib/libpmc/Makefile
  head/lib/libpmc/libpmc.c
  head/lib/libpmc/pmc.sandybridge.3
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/hwpmc_core.h
  head/sys/dev/hwpmc/hwpmc_intel.c
  head/sys/dev/hwpmc/pmc_events.h
  head/sys/sys/pmc.h

Modified: head/lib/libpmc/Makefile
==
--- head/lib/libpmc/MakefileThu Sep  6 13:47:42 2012(r240163)
+++ head/lib/libpmc/MakefileThu Sep  6 13:54:01 2012(r240164)
@@ -28,6 +28,7 @@ MAN+= pmc.atom.3
 MAN+=  pmc.core.3
 MAN+=  pmc.core2.3
 MAN+=  pmc.iaf.3
+MAN+=  pmc.ivybridge.3
 MAN+=  pmc.ucf.3
 MAN+=  pmc.k7.3
 MAN+=  pmc.k8.3

Modified: head/lib/libpmc/libpmc.c
==
--- head/lib/libpmc/libpmc.cThu Sep  6 13:47:42 2012(r240163)
+++ head/lib/libpmc/libpmc.cThu Sep  6 13:54:01 2012(r240164)
@@ -183,6 +183,11 @@ static const struct pmc_event_descr core
__PMC_EV_ALIAS_COREI7()
 };
 
+static const struct pmc_event_descr ivybridge_event_table[] =
+{
+   __PMC_EV_ALIAS_IVYBRIDGE()
+};
+
 static const struct pmc_event_descr sandybridge_event_table[] = 
 {
__PMC_EV_ALIAS_SANDYBRIDGE()
@@ -222,6 +227,7 @@ PMC_MDEP_TABLE(atom, IAP, PMC_CLASS_SOFT
 PMC_MDEP_TABLE(core, IAP, PMC_CLASS_SOFT, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
+PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC);
 PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
 PMC_MDEP_TABLE(westmere, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, 
PMC_CLASS_UCF, PMC_CLASS_UCP);
 PMC_MDEP_TABLE(k7, K7, PMC_CLASS_SOFT, PMC_CLASS_TSC);
@@ -259,6 +265,7 @@ PMC_CLASS_TABLE_DESC(atom, IAP, atom, ia
 PMC_CLASS_TABLE_DESC(core, IAP, core, iap);
 PMC_CLASS_TABLE_DESC(core2, IAP, core2, iap);
 PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap);
+PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap);
 PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap);
 PMC_CLASS_TABLE_DESC(westmere, IAP, westmere, iap);
 PMC_CLASS_TABLE_DESC(ucf, UCF, ucf, ucf);
@@ -365,14 +372,14 @@ static struct pmc_op_getdyneventinfo sof
 /* Event masks for events */
 struct pmc_masks {
const char  *pm_name;
-   const uint32_t  pm_value;
+   const uint64_t  pm_value;
 };
 #definePMCMASK(N,V){ .pm_name = #N, .pm_value = (V) }
 #defineNULLMASK{ .pm_name = NULL }
 
 #if defined(__amd64__) || defined(__i386__)
 static int
-pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint32_t *evmask)
+pmc_parse_mask(const struct pmc_masks *pmask, char *p, uint64_t *evmask)
 {
const struct pmc_masks *pm;
char *q, *r;
@@ -561,6 +568,8 @@ static struct pmc_event_alias core2_alia
 #defineatom_aliases_without_iafcore2_aliases_without_iaf
 #define corei7_aliases core2_aliases
 #define corei7_aliases_without_iaf core2_aliases_without_iaf
+#define ivybridge_aliases  core2_aliases
+#define ivybridge_aliases_without_iaf  core2_aliases_without_iaf
 #define sandybridge_aliasescore2_aliases
 #define sandybridge_aliases_without_iafcore2_aliases_without_iaf
 #define westmere_aliases   core2_aliases
@@ -663,7 +672,7 @@ static struct pmc_masks iap_transition_m
NULLMASK
 };
 
-static struct pmc_masks iap_rsp_mask[] = {
+static struct pmc_masks iap_rsp_mask_i7_wm[] = {
PMCMASK(DMND_DATA_RD,   (1   0)),
PMCMASK(DMND_RFO,   (1   1)),
PMCMASK(DMND_IFETCH,(1   2)),
@@ -682,12 +691,43 @@ static struct pmc_masks iap_rsp_mask[] =
NULLMASK
 };
 
+static struct pmc_masks iap_rsp_mask_sb_ib[] = {
+   PMCMASK(REQ_DMND_DATA_RD,   (1ULL   0)),
+   PMCMASK(REQ_DMND_RFO,   (1ULL   1)),
+   PMCMASK(REQ_DMND_IFETCH,(1ULL   2)),
+   PMCMASK(REQ_WB, (1ULL   3)),
+   PMCMASK(REQ_PF_DATA_RD, (1ULL   4)),
+   PMCMASK(REQ_PF_RFO, (1ULL   5)),
+   PMCMASK(REQ_PF_IFETCH,  (1ULL   6)),
+   PMCMASK(REQ_PF_LLC_DATA_RD, (1ULL   7)),
+   PMCMASK(REQ_PF_LLC_RFO, (1ULL   8)),
+   PMCMASK(REQ_PF_LLC_IFETCH,  (1ULL   9)),
+   PMCMASK(REQ_BUS_LOCKS,  (1ULL  10)),
+   PMCMASK(REQ_STRM_ST,(1ULL  11)),
+   

Re: svn commit: r239195 - head/lib/msun/src

2012-09-06 Thread Bruce Evans

On Sat, 11 Aug 2012, Dimitry Andric wrote:


Log:
 Add __always_inline to __ieee754_rem_pio2() and __ieee754_rem_pio2f(),
 since some older versions of gcc refuse to inline these otherwise.

 Requested by:  bde
 MFC after: 1 week


Thanks.  It works well to reduce unportabilities.

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: r240165 - head/usr.sbin/pc-sysinstall/backend

2012-09-06 Thread Josh Paetzel
Author: jpaetzel
Date: Thu Sep  6 14:59:53 2012
New Revision: 240165
URL: http://svn.freebsd.org/changeset/base/240165

Log:
  Add TRIM support, enabled by default.
  Fix a bug installing components from a localPath.
  Allow autosizing of any partition, not just the last partition.
  Adjust how ZFS is laid out to work with Boot Environments.
  
  Submitted by: kmoore
  Obtained from:PC-BSD
  MFC after:3 days

Modified:
  head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
  head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
  head/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
  head/usr.sbin/pc-sysinstall/backend/functions-newfs.sh

Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Sep  6 
13:54:01 2012(r240164)
+++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Sep  6 
14:59:53 2012(r240165)
@@ -164,6 +164,38 @@ gen_glabel_name()
   export VAL=${NAME}${NUM} 
 };
 
+# Function to determine the size we can safely use when 0 is specified
+get_autosize()
+{
+  # Disk tag to look for
+  dTag=$1
+
+  # Total MB Avail
+  get_disk_mediasize_mb $2
+  local _aSize=$VAL
+
+  while read line
+  do
+# Check for data on this slice
+echo $line | grep -q ^${_dTag}-part= 2/dev/null
+if [ $? -ne 0 ] ; then continue ; fi
+
+get_value_from_string ${line}
+STRING=$VAL
+
+# Get the size of this partition
+SIZE=`echo $STRING | tr -s '\t' ' ' | cut -d ' ' -f 2` 
+if [ $SIZE -eq 0 ] ; then continue ; fi
+_aSize=`expr $_aSize - $SIZE`
+  done ${CFGF}
+
+  # Pad the size a bit
+  _aSize=`expr $_aSize - 2`
+
+  VAL=$_aSize
+  export VAL
+};
+
 # Function to setup partitions using gpart
 setup_gpart_partitions()
 {
@@ -173,6 +205,7 @@ setup_gpart_partitions()
   local _sNum=$4
   local _pType=$5
   FOUNDPARTS=1
+  USEDAUTOSIZE=0
 
   # Lets read in the config file now and setup our partitions
   if [ ${_pType} = gpt ] ; then
@@ -245,7 +278,15 @@ setup_gpart_partitions()
 
   if [ $SIZE = 0 ]
   then
-SOUT=
+   if [ $USEDAUTOSIZE -eq 1 ] ; then
+  exit_err ERROR: You can not have two partitions with a size of 0 
specified!
+   fi
+case ${_pType} in
+ gpt|apm) get_autosize ${_dTag} $_pDisk ;;
+   *) get_autosize ${_dTag} $_wSlice ;;
+esac
+SOUT=-s ${VAL}M
+   USEDAUTOSIZE=1
   else
 SOUT=-s ${SIZE}M
   fi

Modified: head/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shThu Sep  6 
13:54:01 2012(r240164)
+++ head/usr.sbin/pc-sysinstall/backend/functions-cleanup.shThu Sep  6 
14:59:53 2012(r240165)
@@ -49,7 +49,7 @@ zfs_cleanup_unmount()
   # Creating a dedicated /boot partition
   cat ${FSMNT}/boot/loader.conf 2/dev/null | grep -q 
vfs.root.mountfrom= 2/dev/null
   if [ $? -ne 0 ] ; then
-echo vfs.root.mountfrom=\zfs:${ZPOOLNAME}\  
${FSMNT}/boot/loader.conf
+echo vfs.root.mountfrom=\zfs:${ZPOOLNAME}/ROOT/default\  
${FSMNT}/boot/loader.conf
   fi
   export FOUNDZFSROOT=${ZPOOLNAME}
 fi
@@ -195,8 +195,8 @@ setup_fstab()
 if [ $? -eq 0 ] ; then
   if [ ${PARTFS} = ZFS ] ; then
 ROOTFSTYPE=zfs
-XPOOLNAME=$(get_zpool_name ${PARTDEV})
-ROOTFS=${ZPOOLNAME}
+ZPOOLNAME=$(get_zpool_name ${PARTDEV})
+ROOTFS=${ZPOOLNAME}/ROOT/default
   else
 ROOTFS=${DEVICE}
 ROOTFSTYPE=ufs

Modified: head/usr.sbin/pc-sysinstall/backend/functions-disk.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Thu Sep  6 
13:54:01 2012(r240164)
+++ head/usr.sbin/pc-sysinstall/backend/functions-disk.sh   Thu Sep  6 
14:59:53 2012(r240165)
@@ -224,6 +224,15 @@ get_disk_mediasize()
   export VAL=${mediasize}
 };
 
+# Function which returns a target disks mediasize in megabytes
+get_disk_mediasize_mb()
+{
+  mediasize=`diskinfo -v ${1} | grep # mediasize in bytes | tr -s ' ' | cut 
-f 2`
+  mediasize=`expr $mediasize / 1024`
+  mediasize=`expr $mediasize / 1024`
+  export VAL=${mediasize}
+};
+
 # Function to delete all gparts before starting an install
 delete_all_gpart()
 {

Modified: head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
==
--- head/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh  Thu Sep 
 6 13:54:01 2012(r240164)
+++ 

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

2012-09-06 Thread Alan Cox
Author: alc
Date: Thu Sep  6 16:26:04 2012
New Revision: 240166
URL: http://svn.freebsd.org/changeset/base/240166

Log:
  There is no need to release the pvh global lock around calls to
  pmap_get_pv_entry().  In fact, some callers already held it around calls.
  (In earlier versions, the same statements would apply to the page queues
  lock.)
  
  While I'm here tidy up the style of a few nearby statements and revise
  some comments.
  
  Tested by:Ian Lepore

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

Modified: head/sys/arm/arm/pmap.c
==
--- head/sys/arm/arm/pmap.c Thu Sep  6 14:59:53 2012(r240165)
+++ head/sys/arm/arm/pmap.c Thu Sep  6 16:26:04 2012(r240166)
@@ -1584,13 +1584,13 @@ pmap_clearbit(struct vm_page *pg, u_int 
  *   pmap_remove_pv: remove a mappiing from a vm_page list
  *
  * NOTE: pmap_enter_pv expects to lock the pvh itself
- *   pmap_remove_pv expects te caller to lock the pvh before calling
+ *   pmap_remove_pv expects the caller to lock the pvh before calling
  */
 
 /*
  * pmap_enter_pv: enter a mapping onto a vm_page lst
  *
- * = caller should hold the proper lock on pmap_main_lock
+ * = caller should hold the proper lock on pvh_global_lock
  * = caller should have pmap locked
  * = we will gain the lock on the vm_page and allocate the new pv_entry
  * = caller should adjust ptp's wire_count before calling
@@ -1600,12 +1600,11 @@ static void
 pmap_enter_pv(struct vm_page *pg, struct pv_entry *pve, pmap_t pm,
 vm_offset_t va, u_int flags)
 {
-
int km;
 
rw_assert(pvh_global_lock, RA_WLOCKED);
 
-   if (pg-md.pv_kva) {
+   if (pg-md.pv_kva != 0) {
/* PMAP_ASSERT_LOCKED(pmap_kernel()); */
pve-pv_pmap = pmap_kernel();
pve-pv_va = pg-md.pv_kva;
@@ -1617,10 +1616,8 @@ pmap_enter_pv(struct vm_page *pg, struct
TAILQ_INSERT_HEAD(pg-md.pv_list, pve, pv_list);
TAILQ_INSERT_HEAD(pve-pv_pmap-pm_pvlist, pve, pv_plist);
PMAP_UNLOCK(pmap_kernel());
-   rw_wunlock(pvh_global_lock);
if ((pve = pmap_get_pv_entry()) == NULL)
-   panic(pmap_kenter_internal: no pv entries);
-   rw_wlock(pvh_global_lock);
+   panic(pmap_kenter_pv: no pv entries);
if (km)
PMAP_LOCK(pmap_kernel());
}
@@ -2824,22 +2821,20 @@ pmap_kenter_internal(vm_offset_t va, vm_
*pte |= L2_S_PROT_U;
PTE_SYNC(pte);
 
-   /* kernel direct mappings can be shared, so use a pv_entry
-* to ensure proper caching.
-*
-* The pvzone is used to delay the recording of kernel
-* mappings until the VM is running.
-*
-* This expects the physical memory to have vm_page_array entry.
-*/
-   if (pvzone != NULL  (m = vm_phys_paddr_to_vm_page(pa))) {
+   /*
+* A kernel mapping may not be the page's only mapping, so create a PV
+* entry to ensure proper caching.
+*
+* The existence test for the pvzone is used to delay the recording of
+* kernel mappings until the VM system is fully initialized.
+*
+* This expects the physical memory to have a vm_page_array entry.
+*/
+   if (pvzone != NULL  (m = vm_phys_paddr_to_vm_page(pa)) != NULL) {
rw_wlock(pvh_global_lock);
-   if (!TAILQ_EMPTY(m-md.pv_list) || m-md.pv_kva) {
-   /* release vm_page lock for pv_entry UMA */
-   rw_wunlock(pvh_global_lock);
+   if (!TAILQ_EMPTY(m-md.pv_list) || m-md.pv_kva != 0) {
if ((pve = pmap_get_pv_entry()) == NULL)
panic(pmap_kenter_internal: no pv entries);   
-   rw_wlock(pvh_global_lock);
PMAP_LOCK(pmap_kernel());
pmap_enter_pv(m, pve, pmap_kernel(), va,
PVF_WRITE | PVF_UNMAN);
___
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: r240165 - head/usr.sbin/pc-sysinstall/backend

2012-09-06 Thread Bryan Drewery
On 9/6/2012 9:59 AM, Josh Paetzel wrote:
 Author: jpaetzel
 Date: Thu Sep  6 14:59:53 2012
 New Revision: 240165
 URL: http://svn.freebsd.org/changeset/base/240165
 
 Log:
   Add TRIM support, enabled by default.
   Fix a bug installing components from a localPath.
   Allow autosizing of any partition, not just the last partition.
   Adjust how ZFS is laid out to work with Boot Environments.
   
   Submitted by:   kmoore
   Obtained from:  PC-BSD
   MFC after:  3 days

Thanks! The (UFS) TRIM and BE stuff is great to have here.

Bryan
___
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: r240170 - in head/sys/modules: . ct

2012-09-06 Thread John Baldwin
Author: jhb
Date: Thu Sep  6 18:02:32 2012
New Revision: 240170
URL: http://svn.freebsd.org/changeset/base/240170

Log:
  Add a kernel module on pc98 for the ct(4) driver.

Added:
  head/sys/modules/ct/
  head/sys/modules/ct/Makefile   (contents, props changed)
Modified:
  head/sys/modules/Makefile

Modified: head/sys/modules/Makefile
==
--- head/sys/modules/Makefile   Thu Sep  6 17:28:47 2012(r240169)
+++ head/sys/modules/Makefile   Thu Sep  6 18:02:32 2012(r240170)
@@ -78,6 +78,7 @@ SUBDIR=   \
${_crypto} \
${_cryptodev} \
${_cs} \
+   ${_ct} \
${_ctau} \
${_cxgb} \
cxgbe \
@@ -607,6 +608,7 @@ _x86bios=   x86bios
 .elif ${MACHINE} == pc98
 _canbepm=  canbepm
 _canbus=   canbus
+_ct=   ct
 _pmc=  pmc
 _snc=  snc
 .endif

Added: head/sys/modules/ct/Makefile
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/modules/ct/MakefileThu Sep  6 18:02:32 2012
(r240170)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.PATH: ${.CURDIR}/../../dev/ct
+
+KMOD=  ct
+SRCS=  bshw_machdep.c ct.c ct_isa.c
+SRCS+= device_if.h bus_if.h isa_if.h 
+SRCS+= opt_ct.h opt_cam.h opt_scsi.h opt_ddb.h
+
+.include bsd.kmod.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: r240172 - in head/sys: cam/scsi dev/ct dev/ncv dev/nsp dev/stg sys

2012-09-06 Thread John Baldwin
Author: jhb
Date: Thu Sep  6 18:53:33 2012
New Revision: 240172
URL: http://svn.freebsd.org/changeset/base/240172

Log:
  Remove NetBSD compat shims for drivers originally shared with NetBSD/pc98.
  NetBSD/pc98 was never merged into the main NetBSD tree and is no longer
  developed.  Adding locking to these drivers would have made the compat
  shims hard to impossible to maintain, so remove the shims to ease
  future changes.
  
  These changes were verified by md5.  Some additional shims can be removed
  that do affect the compiled results that I will probably do in another
  round.
  
  Approved by:  nyan (tentatively)

Deleted:
  head/sys/sys/device_port.h
Modified:
  head/sys/cam/scsi/scsi_low.c
  head/sys/cam/scsi/scsi_low.h
  head/sys/cam/scsi/scsi_low_pisa.c
  head/sys/cam/scsi/scsi_low_pisa.h
  head/sys/dev/ct/bshw_machdep.c
  head/sys/dev/ct/ct.c
  head/sys/dev/ct/ct_isa.c
  head/sys/dev/ct/ctvar.h
  head/sys/dev/ncv/ncr53c500.c
  head/sys/dev/ncv/ncr53c500_pccard.c
  head/sys/dev/ncv/ncr53c500var.h
  head/sys/dev/nsp/nsp.c
  head/sys/dev/nsp/nsp_pccard.c
  head/sys/dev/nsp/nspvar.h
  head/sys/dev/stg/tmc18c30.c
  head/sys/dev/stg/tmc18c30_pccard.c
  head/sys/dev/stg/tmc18c30var.h

Modified: head/sys/cam/scsi/scsi_low.c
==
--- head/sys/cam/scsi/scsi_low.cThu Sep  6 18:31:56 2012
(r240171)
+++ head/sys/cam/scsi/scsi_low.cThu Sep  6 18:53:33 2012
(r240172)
@@ -14,13 +14,7 @@ __FBSDID($FreeBSD$);
 /* #define SCSI_LOW_QCLEAR_AFTER_CA */
 /* #define SCSI_LOW_FLAGS_QUIRKS_OK */
 
-#ifdef __NetBSD__
-#defineSCSI_LOW_TARGET_OPEN
-#endif /* __NetBSD__ */
-
-#ifdef __FreeBSD__
 #defineSCSI_LOW_FLAGS_QUIRKS_OK
-#endif /* __FreeBSD__ */
 
 /*-
  * [NetBSD for NEC PC-98 series]
@@ -71,41 +65,12 @@ __FBSDID($FreeBSD$);
 #include sys/param.h
 #include sys/systm.h
 #include sys/kernel.h
-
-#ifdef __FreeBSD__
-#if __FreeBSD_version = 51
 #include sys/bio.h
-#else
-#include machine/clock.h
-#endif
-#endif /* __FreeBSD__ */
-
 #include sys/buf.h
 #include sys/queue.h
 #include sys/malloc.h
 #include sys/errno.h
 
-#ifdef __NetBSD__
-#include sys/device.h
-#include vm/vm.h
-
-#include machine/bus.h
-#include machine/intr.h
-#include machine/dvcfg.h
-
-#include dev/cons.h
-
-#include dev/scsipi/scsipi_all.h
-#include dev/scsipi/scsipiconf.h
-#include dev/scsipi/scsipi_disk.h
-#include dev/scsipi/scsi_all.h
-#include dev/scsipi/scsiconf.h
-#include sys/scsiio.h
-
-#include i386/Cbus/dev/scsi_low.h
-#endif /* __NetBSD__ */
-
-#ifdef __FreeBSD__
 #include cam/cam.h
 #include cam/cam_ccb.h
 #include cam/cam_sim.h
@@ -119,7 +84,6 @@ __FBSDID($FreeBSD$);
 #include cam/scsi/scsi_low.h
 
 #include sys/cons.h
-#endif /* __FreeBSD__ */
 
 /**
  * Constants
@@ -392,501 +356,6 @@ scsi_low_translate_error_code(cb, tp)
return tp-error_code;
 }
 
-#ifdef SCSI_LOW_INTERFACE_XS
-/**
- * SCSI INTERFACE (XS)
- **/
-#defineSCSI_LOW_MINPHYS0x1
-#defineSCSI_LOW_MALLOC(size)   malloc((size), M_SCSILOW, 
M_NOWAIT)
-#defineSCSI_LOW_FREE(pt)   free((pt), M_SCSILOW)
-#defineSCSI_LOW_ALLOC_CCB(flags)   scsi_low_get_ccb((flags))
-#defineSCSI_LOW_XS_POLL_HZ 1000
-
-static int scsi_low_poll_xs(struct scsi_low_softc *, struct slccb *);
-static void scsi_low_scsi_minphys_xs(struct buf *);
-#ifdef SCSI_LOW_TARGET_OPEN
-static int scsi_low_target_open(struct scsipi_link *, struct cfdata *);
-#endif /* SCSI_LOW_TARGET_OPEN */
-static int scsi_low_scsi_cmd_xs(struct scsipi_xfer *);
-static int scsi_low_enable_xs(void *, int);
-static int scsi_low_ioctl_xs(struct scsipi_link *, u_long, caddr_t, int, 
struct proc *);
-
-static int scsi_low_attach_xs(struct scsi_low_softc *);
-static int scsi_low_world_start_xs(struct scsi_low_softc *);
-static int scsi_low_dettach_xs(struct scsi_low_softc *);
-static int scsi_low_ccb_setup_xs(struct scsi_low_softc *, struct slccb *);
-static int scsi_low_done_xs(struct scsi_low_softc *, struct slccb *);
-static void scsi_low_timeout_xs(struct scsi_low_softc *, int, int);
-static u_int scsi_low_translate_quirks_xs(u_int);
-static void scsi_low_setup_quirks_xs(struct targ_info *, struct lun_info *, 
u_int);
-
-struct scsi_low_osdep_funcs scsi_low_osdep_funcs_xs = {
-   scsi_low_attach_xs,
-   scsi_low_world_start_xs,
-   scsi_low_dettach_xs,
-   scsi_low_ccb_setup_xs,
-   scsi_low_done_xs,
-   scsi_low_timeout_xs
-};
-   
-struct scsipi_device scsi_low_dev = {
-   NULL,   /* Use default error handler */
-   NULL,   /* have a queue, served by this */
-   NULL,   /* have no async handler */
-   NULL,   /* Use default 'done' routine */
-};
-
-struct scsi_low_error_code 

svn commit: r240173 - head/lib/libpmc

2012-09-06 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Sep  6 19:14:02 2012
New Revision: 240173
URL: http://svn.freebsd.org/changeset/base/240173

Log:
  Minor mdoc fix.

Modified:
  head/lib/libpmc/pmc.ivybridge.3

Modified: head/lib/libpmc/pmc.ivybridge.3
==
--- head/lib/libpmc/pmc.ivybridge.3 Thu Sep  6 18:53:33 2012
(r240172)
+++ head/lib/libpmc/pmc.ivybridge.3 Thu Sep  6 19:14:02 2012
(r240173)
@@ -58,7 +58,6 @@ determined at run time by calling
 Intel Ivy Bridge PMCs are documented in
 .Rs
 .%B Intel(R) 64 and IA-32 Architectures Software Developer's Manual
-Intel(R) 64 and IA-32 Architectures Software Developers Manual
 .%T Volume 3B: System Programming Guide, Part 2
 .%N Order Number: 253669-043US
 .%D May 2012
___
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: r240174 - head/lib/libpmc

2012-09-06 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Sep  6 19:24:48 2012
New Revision: 240174
URL: http://svn.freebsd.org/changeset/base/240174

Log:
  Remove trailing whitespace.

Modified:
  head/lib/libpmc/pmc.ivybridge.3

Modified: head/lib/libpmc/pmc.ivybridge.3
==
--- head/lib/libpmc/pmc.ivybridge.3 Thu Sep  6 19:14:02 2012
(r240173)
+++ head/lib/libpmc/pmc.ivybridge.3 Thu Sep  6 19:24:48 2012
(r240174)
@@ -199,40 +199,40 @@ Ivy Bridge programmable PMCs support the
 .Bl -tag -width indent
 .It Li LD_BLOCKS.STORE_FORWARD
 .Pq Event 03H , Umask 02H
-loads blocked by overlapping with store buffer that cannot be forwarded . 
+loads blocked by overlapping with store buffer that cannot be forwarded .
 .It Li MISALIGN_MEM_REF.LOADS
 .Pq Event 05H , Umask 01H
-Speculative cache-line split load uops dispatched to L1D. 
+Speculative cache-line split load uops dispatched to L1D.
 .It Li MISALIGN_MEM_REF.STORES
 .Pq Event 05H , Umask 02H
-Speculative cache-line split Store- address uops dispatched to L1D. 
+Speculative cache-line split Store- address uops dispatched to L1D.
 .It Li LD_BLOCKS_PARTIAL.ADDRESS_ALIAS
 .Pq Event 07H , Umask 01H
-False dependencies in MOB due to partial compare on address. 
+False dependencies in MOB due to partial compare on address.
 .It Li DTLB_LOAD_MISSES.DEMAND_LD_MISS_CAUSES_A_WALK
 .Pq Event 08H , Umask 81H
-Misses in all TLB levels that cause a page walk of any page size from demand 
loads. 
+Misses in all TLB levels that cause a page walk of any page size from demand 
loads.
 .It Li DTLB_LOAD_MISSES.DEMAND_LD_WALK_COMPLETED
 .Pq Event 08H , Umask 82H
-Misses in all TLB levels that caused page walk completed of any size by demand 
loads. 
+Misses in all TLB levels that caused page walk completed of any size by demand 
loads.
 .It Li DTLB_LOAD_MISSES.DEMAND_LD_WALK_DURATION
 .Pq Event 08H , Umask 84H
-Cycle PMH is busy with a walk due to demand loads. 
+Cycle PMH is busy with a walk due to demand loads.
 .It Li UOPS_ISSUED.ANY
 .Pq Event 0EH , Umask 01H
-Increments each cycle the # of Uops issued by the RAT to RS. 
+Increments each cycle the # of Uops issued by the RAT to RS.
 Set Cmask = 1, Inv = 1to count stalled cycles.
-Set Cmask = 1, Inv = 1, Any= 1to count stalled cycles of this core. 
+Set Cmask = 1, Inv = 1, Any= 1to count stalled cycles of this core.
 .It Li UOPS_ISSUED.FLAGS_MERGE
 .Pq Event 0EH , Umask 10H
-Number of flags-merge uops allocated. Such uops adds delay. 
+Number of flags-merge uops allocated. Such uops adds delay.
 .It Li UOPS_ISSUED.SLOW_LEA
 .Pq Event 0EH , Umask 20H
 Number of slow LEA or similar uops allocated. Such uop has 3 sources (e.g. 2
 sources + immediate) regardless if as a result of LEA instruction or not.
 .It Li UOPS_ISSUED.SINGLE_MUL
 .Pq Event 0EH , Umask 40H
-Number of multiply packed/scalar single precision uops allocated. 
+Number of multiply packed/scalar single precision uops allocated.
 .It Li ARITH.FPU_DIV_ACTIVE
 .Pq Event 14H , Umask 01H
 Cycles that the divider is active, includes INT and FP. Set 'edge =1,
@@ -245,31 +245,31 @@ Demand Data Read requests that hit L2 ca
 Counts any demand and L1 HW prefetch data load requests to L2.
 .It Li L2_RQSTS.RFO_HITS
 .Pq Event 24H , Umask 04H
-Counts the number of store RFO requests that hit the L2 cache. 
+Counts the number of store RFO requests that hit the L2 cache.
 .It Li L2_RQSTS.RFO_MISS
 .Pq Event 24H , Umask 08H
-Counts the number of store RFO requests that miss the L2 cache. 
+Counts the number of store RFO requests that miss the L2 cache.
 .It Li L2_RQSTS.ALL_RFO
 .Pq Event 24H , Umask 0CH
-Counts all L2 store RFO requests. 
+Counts all L2 store RFO requests.
 .It Li L2_RQSTS.CODE_RD_HIT
 .Pq Event 24H , Umask 10H
-Number of instruction fetches that hit the L2 cache. 
+Number of instruction fetches that hit the L2 cache.
 .It Li L2_RQSTS.CODE_RD_MISS
 .Pq Event 24H , Umask 20H
-Number of instruction fetches that missed the L2 cache. 
+Number of instruction fetches that missed the L2 cache.
 .It Li L2_RQSTS.ALL_CODE_RD
 .Pq Event 24H , Umask 30H
-Counts all L2 code requests. 
+Counts all L2 code requests.
 .It Li L2_RQSTS.PF_HIT
 .Pq Event 24H , Umask 40H
-Counts all L2 HW prefetcher requests that hit L2. 
+Counts all L2 HW prefetcher requests that hit L2.
 .It Li L2_RQSTS.PF_MISS
 .Pq Event 24H , Umask 80H
-Counts all L2 HW prefetcher requests that missed L2. 
+Counts all L2 HW prefetcher requests that missed L2.
 .It Li L2_RQSTS.ALL_PF
 .Pq Event 24H , Umask C0H
-Counts all L2 HW prefetcher requests. 
+Counts all L2 HW prefetcher requests.
 .It Li L2_STORE_LOCK_RQSTS.MISS
 .Pq Event 27H , Umask 01H
 RFOs that miss cache lines.
@@ -307,13 +307,13 @@ core frequency may change from time to t
 throttling.
 .It Li CPU_CLK_THREAD_UNHALTED.REF_XCLK
 .Pq Event 3CH , Umask 01H
-Increments at the frequency of XCLK (100 MHz) when not halted. 
+Increments at the frequency of XCLK (100 MHz) when not 

svn commit: r240175 - head/cddl/usr.sbin/plockstat

2012-09-06 Thread Joel Dahl
Author: joel (doc committer)
Date: Thu Sep  6 19:26:59 2012
New Revision: 240175
URL: http://svn.freebsd.org/changeset/base/240175

Log:
  Remove trailing whitespace.

Modified:
  head/cddl/usr.sbin/plockstat/plockstat.1

Modified: head/cddl/usr.sbin/plockstat/plockstat.1
==
--- head/cddl/usr.sbin/plockstat/plockstat.1Thu Sep  6 19:24:48 2012
(r240174)
+++ head/cddl/usr.sbin/plockstat/plockstat.1Thu Sep  6 19:26:59 2012
(r240175)
@@ -49,7 +49,7 @@
 .Op Fl s Ar depth
 .Op Fl e Ar secs
 .Op Fl x Ar opt Ns = Ns Ar val
-.Fl p Ar pid 
+.Fl p Ar pid
 .Sh DESCRIPTION
 The
 .Nm
___
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: r240156 - head/lib/libproc

2012-09-06 Thread Rui Paulo
On 6 Sep 2012, at 02:42, Gennady Proskurin gpr...@mail.ru wrote:

 On Thu, Sep 06, 2012 at 03:19:49AM +, Rui Paulo wrote:
 Author: rpaulo
 Date: Thu Sep  6 03:19:48 2012
 New Revision: 240156
 URL: http://svn.freebsd.org/changeset/base/240156
 
 Log:
  Add support for demangling C++ symbols. This requires linking libproc with
  libc++rt/libsupc++.
 
  Discussed with: theraven
 
 Modified:
  head/lib/libproc/Makefile
  head/lib/libproc/proc_sym.c
 
 Modified: head/lib/libproc/Makefile
 ==
 --- head/lib/libproc/MakefileThu Sep  6 02:07:58 2012
 (r240155)
 +++ head/lib/libproc/MakefileThu Sep  6 03:19:48 2012
 (r240156)
 @@ -1,5 +1,7 @@
 # $FreeBSD$
 
 +.include bsd.own.mk
 +
 LIB= proc
 
 SRCS=proc_bkpt.c \
 @@ -13,6 +15,14 @@ INCS= libproc.h
 
 CFLAGS+= -I${.CURDIR}
 
 +.if ${MK_LIBCPLUSPLUS} != no
 +LDADD+= -lcxxrt
 +DPADD+= ${LIBCXXRT}
 +.else
 +LDADD+= -lsupc++
 +DPADD+= ${LIBSTDCPLUSPLUS}
 +.endif
 +
 SHLIB_MAJOR= 2
 
 WITHOUT_MAN=
 
 Modified: head/lib/libproc/proc_sym.c
 ==
 --- head/lib/libproc/proc_sym.c  Thu Sep  6 02:07:58 2012
 (r240155)
 +++ head/lib/libproc/proc_sym.c  Thu Sep  6 03:19:48 2012
 (r240156)
 @@ -46,6 +46,8 @@
 
 #include _libproc.h
 
 +extern char *__cxa_demangle(const char *, char *, size_t *, int *);
 +
 static void  proc_rdl2prmap(rd_loadobj_t *, prmap_t *);
 
 static void
 @@ -266,7 +268,11 @@ proc_addr2sym(struct proc_handle *p, uin
  if (addr = rsym  addr = (rsym + sym.st_size)) {
  s = elf_strptr(e, dynsymstridx, sym.st_name);
  if (s) {
 -strlcpy(name, s, namesz);
 +if (strlen(s)  2  
 +s[0] == '_'  s[1] == 'Z')
 checking strlen(s)  2 is useless and not optimal here, you can omit it 
 completely
 checking s[0] and s[1] is enough, it implies that length is =2
 you may add something like s[2] != 0 if length should be strictly 2


It's not really useless but can be considered non-optimal, yes. That said, the 
C++ demangler we're calling doesn't really care about being fast :-) 

Regards,
--
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


Re: svn commit: r240156 - head/lib/libproc

2012-09-06 Thread Rui Paulo
On 6 Sep 2012, at 05:15, Stefan Farfeleder stef...@freebsd.org wrote:

 On Thu, Sep 06, 2012 at 03:19:49AM +, Rui Paulo wrote:
 @@ -266,7 +268,11 @@ proc_addr2sym(struct proc_handle *p, uin
  if (addr = rsym  addr = (rsym + sym.st_size)) {
  s = elf_strptr(e, dynsymstridx, sym.st_name);
  if (s) {
 -strlcpy(name, s, namesz);
 +if (strlen(s)  2  
 +s[0] == '_'  s[1] == 'Z')
 +__cxa_demangle(s, name, namesz, NULL);
 +else
 +strlcpy(name, s, namesz);
  memcpy(symcopy, sym, sizeof(sym));
  /*
   * DTrace expects the st_value to contain
 
 According to the documentation, __cxa_demangle will realloc the buffer
 if it is too small and return the new buffer. This case is not handled
 correctly.


You're right. In fact this happens all the time with libcxxrt.

Thanks,
--
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: r240176 - head/lib/libc/gen

2012-09-06 Thread Tom Rhodes
Author: trhodes
Date: Thu Sep  6 20:15:44 2012
New Revision: 240176
URL: http://svn.freebsd.org/changeset/base/240176

Log:
  Avoid segfault if name is invalid.  Basically, only
  check for CTL_USER if the sysctl fails with ENOENT.
  
  PR:   169056
  Reviewed by:  jhb

Modified:
  head/lib/libc/gen/sysctl.c

Modified: head/lib/libc/gen/sysctl.c
==
--- head/lib/libc/gen/sysctl.c  Thu Sep  6 19:26:59 2012(r240175)
+++ head/lib/libc/gen/sysctl.c  Thu Sep  6 20:15:44 2012(r240176)
@@ -50,8 +50,11 @@ int
 sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
 const void *newp, size_t newlen)
 {
-   if (name[0] != CTL_USER)
-   return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
+   int retval;
+
+   retval = __sysctl(name, namelen, oldp, oldlenp, newp, newlen);
+   if (retval != -1 || errno != ENOENT || name[0] != CTL_USER)
+   return (retval);
 
if (newp != NULL) {
errno = EPERM;
___
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: r240177 - in head/sys: arm/arm mips/mips

2012-09-06 Thread John Baldwin
Author: jhb
Date: Thu Sep  6 20:16:59 2012
New Revision: 240177
URL: http://svn.freebsd.org/changeset/base/240177

Log:
  Dynamically allocate the S/G lists passed to callback routines rather than
  allocating them on the stack of various bus_dmamap_load*() functions.  The
  S/G lists are stored in the DMA tags.  This matches the implementation on
  all other platforms.
  
  Discussed with:   scottl, gibbs
  Tested by:stas (arm@)

Modified:
  head/sys/arm/arm/busdma_machdep.c
  head/sys/mips/mips/busdma_machdep.c

Modified: head/sys/arm/arm/busdma_machdep.c
==
--- head/sys/arm/arm/busdma_machdep.c   Thu Sep  6 20:15:44 2012
(r240176)
+++ head/sys/arm/arm/busdma_machdep.c   Thu Sep  6 20:16:59 2012
(r240177)
@@ -81,6 +81,7 @@ struct bus_dma_tag {
int map_count;
bus_dma_lock_t  *lockfunc;
void*lockfuncarg;
+   bus_dma_segment_t   *segments;
/*
 * DMA range for this tag.  If the page doesn't fall within
 * one of these ranges, an error is returned.  The caller
@@ -374,6 +375,8 @@ bus_dma_tag_create(bus_dma_tag_t parent,
newtag-lockfunc = dflt_lock;
newtag-lockfuncarg = NULL;
}
+   newtag-segments = NULL;
+
 /*
 * Take into account any restrictions imposed by our parent tag
 */
@@ -447,7 +450,6 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
 #endif
 
if (dmat != NULL) {
-   
 if (dmat-map_count != 0)
 return (EBUSY);

@@ -457,6 +459,8 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
 parent = dmat-parent;
 atomic_subtract_int(dmat-ref_count, 1);
 if (dmat-ref_count == 0) {
+   if (dmat-segments != NULL)
+   free(dmat-segments, M_DEVBUF);
 free(dmat, M_DEVBUF);
 /*
  * Last reference count, so
@@ -484,6 +488,17 @@ bus_dmamap_create(bus_dma_tag_t dmat, in
bus_dmamap_t newmap;
int error = 0;
 
+   if (dmat-segments == NULL) {
+   dmat-segments = (bus_dma_segment_t *)malloc(
+   sizeof(bus_dma_segment_t) * dmat-nsegments, M_DEVBUF,
+   M_NOWAIT);
+   if (dmat-segments == NULL) {
+   CTR3(KTR_BUSDMA, %s: tag %p error %d,
+   __func__, dmat, ENOMEM);
+   return (ENOMEM);
+   }
+   }
+
newmap = _busdma_alloc_dmamap();
if (newmap == NULL) {
CTR3(KTR_BUSDMA, %s: tag %p error %d, __func__, dmat, ENOMEM);
@@ -585,6 +600,16 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, voi
mflags = M_NOWAIT;
else
mflags = M_WAITOK;
+   if (dmat-segments == NULL) {
+   dmat-segments = (bus_dma_segment_t *)malloc(
+   sizeof(bus_dma_segment_t) * dmat-nsegments, M_DEVBUF,
+   mflags);
+   if (dmat-segments == NULL) {
+   CTR4(KTR_BUSDMA, %s: tag %p tag flags 0x%x error %d,
+   __func__, dmat, dmat-flags, ENOMEM);
+   return (ENOMEM);
+   }
+   }
if (flags  BUS_DMA_ZERO)
mflags |= M_ZERO;
 
@@ -883,11 +908,6 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_
 {
vm_offset_t lastaddr = 0;
int error, nsegs = -1;
-#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
-   bus_dma_segment_t dm_segments[dmat-nsegments];
-#else
-   bus_dma_segment_t dm_segments[BUS_DMAMAP_NSEGS];
-#endif
 
KASSERT(dmat != NULL, (dmatag is NULL));
KASSERT(map != NULL, (dmamap is NULL));
@@ -898,14 +918,14 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_
map-buffer = buf;
map-len = buflen;
error = bus_dmamap_load_buffer(dmat,
-   dm_segments, map, buf, buflen, kernel_pmap,
+   dmat-segments, map, buf, buflen, kernel_pmap,
flags, lastaddr, nsegs);
if (error == EINPROGRESS)
return (error);
if (error)
(*callback)(callback_arg, NULL, 0, error);
else
-   (*callback)(callback_arg, dm_segments, nsegs + 1, error);
+   (*callback)(callback_arg, dmat-segments, nsegs + 1, error);

CTR5(KTR_BUSDMA, %s: tag %p tag flags 0x%x error %d nsegs %d,
__func__, dmat, dmat-flags, nsegs + 1, error);
@@ -921,11 +941,6 @@ bus_dmamap_load_mbuf(bus_dma_tag_t dmat,
 bus_dmamap_callback2_t *callback, void *callback_arg,
 int flags)
 {
-#ifdef __CC_SUPPORTS_DYNAMIC_ARRAY_INIT
-   bus_dma_segment_t dm_segments[dmat-nsegments];

svn commit: r240178 - in head/lib/libc/amd64: . gen sys

2012-09-06 Thread Jilles Tjoelker
Author: jilles
Date: Thu Sep  6 20:59:49 2012
New Revision: 240178
URL: http://svn.freebsd.org/changeset/base/240178

Log:
  libc/amd64: Do not export .cerror.
  
  For some reason, libc exports the symbol .cerror (HIDENAME(cerror)), albeit
  in the FBSDprivate_1.0 version. It looks like there is no reason for this
  since it is not used from other libraries. Given that it cannot be accessed
  from C and its strange calling convention, it is rather unlikely that other
  things rely on it. Perhaps it is from a time when symbols could not be
  hidden.
  
  Most of the amd64 assembler code jumps to .cerror using the GOT. It can jump
  to it directly now, as in non-PIC mode.
  
  There are also some minor size optimizations to instructions but they yield
  virtually no benefit in the size of libc.so.7 due to padding.
  
  Reviewed by:  kib

Modified:
  head/lib/libc/amd64/SYS.h
  head/lib/libc/amd64/Symbol.map
  head/lib/libc/amd64/gen/rfork_thread.S
  head/lib/libc/amd64/sys/brk.S
  head/lib/libc/amd64/sys/exect.S
  head/lib/libc/amd64/sys/getcontext.S
  head/lib/libc/amd64/sys/pipe.S
  head/lib/libc/amd64/sys/ptrace.S
  head/lib/libc/amd64/sys/reboot.S
  head/lib/libc/amd64/sys/sbrk.S
  head/lib/libc/amd64/sys/setlogin.S
  head/lib/libc/amd64/sys/vfork.S

Modified: head/lib/libc/amd64/SYS.h
==
--- head/lib/libc/amd64/SYS.h   Thu Sep  6 20:16:59 2012(r240177)
+++ head/lib/libc/amd64/SYS.h   Thu Sep  6 20:59:49 2012(r240178)
@@ -36,38 +36,20 @@
 #include sys/syscall.h
 #include machine/asm.h
 
-#ifdef PIC
 #defineRSYSCALL(x) ENTRY(__CONCAT(__sys_,x));  
\
.weak CNAME(x); \
.set CNAME(x),CNAME(__CONCAT(__sys_,x));\
.weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
-   2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \
+   mov __CONCAT($SYS_,x),%eax; KERNCALL;   \
+   jb HIDENAME(cerror); ret;   \
END(__CONCAT(__sys_,x))
 
 #definePSEUDO(x)   ENTRY(__CONCAT(__sys_,x));  
\
.weak CNAME(__CONCAT(_,x)); \
.set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret ; \
-   2: movq PIC_GOT(HIDENAME(cerror)),%rcx; jmp *%rcx; \
+   mov __CONCAT($SYS_,x),%eax; KERNCALL;   \
+   jb HIDENAME(cerror); ret;   \
END(__CONCAT(__sys_,x))
-#else
-#defineRSYSCALL(x) ENTRY(__CONCAT(__sys_,x));  
\
-   .weak CNAME(x); \
-   .set CNAME(x),CNAME(__CONCAT(__sys_,x));\
-   .weak CNAME(__CONCAT(_,x)); \
-   .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
-   2: jmp HIDENAME(cerror);\
-   END(__CONCAT(__sys_,x))
-
-#definePSEUDO(x)   ENTRY(__CONCAT(__sys_,x));  
\
-   .weak CNAME(__CONCAT(_,x)); \
-   .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \
-   mov __CONCAT($SYS_,x),%rax; KERNCALL; jb 2f; ret; \
-   2: jmp HIDENAME(cerror);\
-   END(__CONCAT(__sys_,x))
-#endif
 
 #define KERNCALL   movq %rcx, %r10; syscall

Modified: head/lib/libc/amd64/Symbol.map
==
--- head/lib/libc/amd64/Symbol.map  Thu Sep  6 20:16:59 2012
(r240177)
+++ head/lib/libc/amd64/Symbol.map  Thu Sep  6 20:59:49 2012
(r240178)
@@ -66,7 +66,6 @@ FBSDprivate_1.0 {
.curbrk;
.minbrk;
_brk;
-   .cerror;
_end;
__sys_vfork;
_vfork;

Modified: head/lib/libc/amd64/gen/rfork_thread.S
==
--- head/lib/libc/amd64/gen/rfork_thread.S  Thu Sep  6 20:16:59 2012
(r240177)
+++ head/lib/libc/amd64/gen/rfork_thread.S  Thu Sep  6 20:59:49 2012
(r240178)
@@ -93,12 +93,7 @@ ENTRY(rfork_thread)
 2:
popq%r12
popq%rbx
-#ifdef PIC
-   movqPIC_GOT(HIDENAME(cerror)), %rdx
-   jmp *%rdx
-#else
jmp HIDENAME(cerror)
-#endif
 

Re: svn commit: r240165 - head/usr.sbin/pc-sysinstall/backend

2012-09-06 Thread Jos Backus
On Thu, Sep 6, 2012 at 7:59 AM, Josh Paetzel jpaet...@freebsd.org wrote:

 Modified: head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh

 ==
 --- head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Sep  6
 13:54:01 2012(r240164)
 +++ head/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh   Thu Sep  6
 14:59:53 2012(r240165)
 ...
FOUNDPARTS=1
 +  USEDAUTOSIZE=0

# Lets read in the config file now and setup our partitions
if [ ${_pType} = gpt ] ; then
 @@ -245,7 +278,15 @@ setup_gpart_partitions()

if [ $SIZE = 0 ]
then
 -SOUT=
 +   if [ $USEDAUTOSIZE -eq 1 ] ; then


Style question: if $USEDAUTOSIZE is treated as a boolean value, why not use
`true' and `false' instead of `1' and `0'? No need to make shell code look
like C code. That way one can write:

if $USEDAUTOSIZE; then

Jos
-- 
Jos Backus
jos at catnook.com
___
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: r240180 - head/sys/dev/ath

2012-09-06 Thread Adrian Chadd
Author: adrian
Date: Fri Sep  7 00:24:27 2012
New Revision: 240180
URL: http://svn.freebsd.org/changeset/base/240180

Log:
  Ensure that single-frame aggregate session frames are retransmitted
  with the correct configuration.
  
  Occasionally an aggregate TX would fail and the first frame would be
  retransmitted as a non-AMPDU frame.  Since bfs_aggr=1 and bfs_nframes  1
  (from the previous AMPDU attempt), the aggr completion function would be
  called and be very confused about what's going on.
  
  Noticed by:   Kim w8hd...@gmail.com
  PR:   kern/171394

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cFri Sep  7 00:20:46 2012
(r240179)
+++ head/sys/dev/ath/if_ath_tx.cFri Sep  7 00:24:27 2012
(r240180)
@@ -2528,6 +2528,25 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
return;
}
 
+   /*
+* This is a temporary check and should be removed once
+* all the relevant code paths have been fixed.
+*
+* During aggregate retries, it's possible that the head
+* frame will fail (which has the bfs_aggr and bfs_nframes
+* fields set for said aggregate) and will be retried as
+* a single frame.  In this instance, the values should
+* be reset or the completion code will get upset with you.
+*/
+   if (bf-bf_state.bfs_aggr != 0 || bf-bf_state.bfs_nframes  1) {
+   device_printf(sc-sc_dev, %s: bfs_aggr=%d, bfs_nframes=%d\n,
+   __func__,
+   bf-bf_state.bfs_aggr,
+   bf-bf_state.bfs_nframes);
+   bf-bf_state.bfs_aggr = 0;
+   bf-bf_state.bfs_nframes = 1;
+   }
+
/* Direct dispatch to hardware */
ath_tx_do_ratelookup(sc, bf);
ath_tx_calc_duration(sc, bf);
@@ -2624,6 +2643,16 @@ ath_tx_swq(struct ath_softc *sc, struct 
if (txq-axq_depth  sc-sc_hwq_limit) {
bf = TAILQ_FIRST(atid-axq_q);
ATH_TXQ_REMOVE(atid, bf, bf_list);
+
+   /*
+* Ensure it's definitely treated as a non-AMPDU
+* frame - this information may have been left
+* over from a previous attempt.
+*/
+   bf-bf_state.bfs_aggr = 0;
+   bf-bf_state.bfs_nframes = 1;
+
+   /* Queue to the hardware */
ath_tx_xmit_aggr(sc, an, txq, bf);
DPRINTF(sc, ATH_DEBUG_SW_TX,
%s: xmit_aggr\n,
@@ -4018,7 +4047,23 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft
%s: non-baw packet\n,
__func__);
ATH_TXQ_REMOVE(tid, bf, bf_list);
+
+   if (bf-bf_state.bfs_nframes  1)
+   device_printf(sc-sc_dev,
+   %s: aggr=%d, nframes=%d\n,
+   __func__,
+   bf-bf_state.bfs_aggr,
+   bf-bf_state.bfs_nframes);
+
+   /*
+* This shouldn't happen - such frames shouldn't
+* ever have been queued as an aggregate in the
+* first place.  However, make sure the fields
+* are correctly setup just to be totally sure.
+*/
bf-bf_state.bfs_aggr = 0;
+   bf-bf_state.bfs_nframes = 1;
+
ath_tx_do_ratelookup(sc, bf);
ath_tx_calc_duration(sc, bf);
ath_tx_calc_protection(sc, bf);
___
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: r240181 - head/sys/arm/include

2012-09-06 Thread Alan Cox
Author: alc
Date: Fri Sep  7 01:33:25 2012
New Revision: 240181
URL: http://svn.freebsd.org/changeset/base/240181

Log:
  Eliminate an unused macro.

Modified:
  head/sys/arm/include/pmap.h

Modified: head/sys/arm/include/pmap.h
==
--- head/sys/arm/include/pmap.h Fri Sep  7 00:24:27 2012(r240180)
+++ head/sys/arm/include/pmap.h Fri Sep  7 01:33:25 2012(r240181)
@@ -124,13 +124,6 @@ struct md_page {
TAILQ_HEAD(,pv_entry)   pv_list;
 };
 
-#defineVM_MDPAGE_INIT(pg)  
\
-do {   \
-   TAILQ_INIT(pg-pv_list);   \
-   mtx_init((pg)-md_page.pvh_mtx, MDPAGE Mutex, NULL, MTX_DEV);\
-   (pg)-mdpage.pvh_attrs = 0; \
-} while (/*CONSTCOND*/0)
-
 struct l1_ttable;
 struct l2_dtable;
 
___
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: r240182 - head/lib/libproc

2012-09-06 Thread Rui Paulo
Author: rpaulo
Date: Fri Sep  7 02:38:07 2012
New Revision: 240182
URL: http://svn.freebsd.org/changeset/base/240182

Log:
  When calling the C++ demangler, make sure to free the returned buffer,
  which might have been reallocated.
  
  Pointed out by:   stefanf

Modified:
  head/lib/libproc/proc_sym.c

Modified: head/lib/libproc/proc_sym.c
==
--- head/lib/libproc/proc_sym.c Fri Sep  7 01:33:25 2012(r240181)
+++ head/lib/libproc/proc_sym.c Fri Sep  7 02:38:07 2012(r240182)
@@ -51,6 +51,26 @@ extern char *__cxa_demangle(const char *
 static voidproc_rdl2prmap(rd_loadobj_t *, prmap_t *);
 
 static void
+demangle(const char *symbol, char *buf, size_t len)
+{
+   char *dembuf;
+   size_t demlen = len;
+
+   dembuf = malloc(len);
+   if (!dembuf)
+   goto fail;
+   dembuf = __cxa_demangle(symbol, dembuf, demlen, NULL);
+   if (!dembuf)
+   goto fail;
+   strlcpy(buf, dembuf, len);
+   free(dembuf);
+
+   return;
+fail:
+   strlcpy(buf, symbol, len);
+}
+
+static void
 proc_rdl2prmap(rd_loadobj_t *rdl, prmap_t *map)
 {
map-pr_vaddr = rdl-rdl_saddr;
@@ -268,9 +288,8 @@ proc_addr2sym(struct proc_handle *p, uin
if (addr = rsym  addr = (rsym + sym.st_size)) {
s = elf_strptr(e, dynsymstridx, sym.st_name);
if (s) {
-   if (strlen(s)  2  
-   s[0] == '_'  s[1] == 'Z')
-   __cxa_demangle(s, name, namesz, NULL);
+   if (s[0] == '_'  s[1] == 'Z'  s[2])
+   demangle(s, name, namesz);
else
strlcpy(name, s, namesz);
memcpy(symcopy, sym, sizeof(sym));
@@ -308,9 +327,8 @@ symtab:
if (addr = rsym  addr = (rsym + sym.st_size)) {
s = elf_strptr(e, symtabstridx, sym.st_name);
if (s) {
-   if (strlen(s)  2  
-   s[0] == '_'  s[1] == 'Z')
-   __cxa_demangle(s, name, namesz, NULL);
+   if (s[0] == '_'  s[1] == 'Z'  s[2])
+   demangle(s, name, namesz);
else
strlcpy(name, s, namesz);
memcpy(symcopy, sym, sizeof(sym));
___
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