Re: svn commit: r197212 - head/sys/nfsclient

2009-09-14 Thread Bjoern A. Zeeb

On Tue, 15 Sep 2009, Qing Li wrote:


Author: qingli
Date: Tue Sep 15 02:22:57 2009
New Revision: 197212
URL: http://svn.freebsd.org/changeset/base/197212

Log:
 Simply remove the code instead of using "#if 0".

 Pointed out by sam


In this case the block just above that should probably removed as
well?



Modified:
 head/sys/nfsclient/nfs_vfsops.c

Modified: head/sys/nfsclient/nfs_vfsops.c
==
--- head/sys/nfsclient/nfs_vfsops.c Tue Sep 15 02:04:16 2009
(r197211)
+++ head/sys/nfsclient/nfs_vfsops.c Tue Sep 15 02:22:57 2009
(r197212)
@@ -464,12 +464,6 @@ nfs_mountroot(struct mount *mp)
}
#endif

-#if 0 /* QL: XXX */
-   error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
-   if (error)
-   panic("nfs_mountroot: SIOCAIFADDR: %d", error);
-#endif
-
if ((cp = getenv("boot.netif.mtu")) != NULL) {
ir.ifr_mtu = strtol(cp, NULL, 10);
bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);



--
Bjoern A. Zeeb   What was I talking about and who are you again?
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197214 - head/sys/dev/isp

2009-09-14 Thread Matt Jacob
Author: mjacob
Date: Tue Sep 15 02:25:03 2009
New Revision: 197214
URL: http://svn.freebsd.org/changeset/base/197214

Log:
  Accomodate old style XPT_IMMED_NOTIFY and XPT_NOTIFY_ACK so that
  we at least don't panic.
  
  We don't really support dual role mode (INITIATOR/TARGET) any more. We
  should but it's broken and will take a fair amount of effort to fix
  and correctly manage both initiator and target roles sharing the port
  database. So, for now, disallow it.

Modified:
  head/sys/dev/isp/isp.c
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Tue Sep 15 02:23:16 2009(r197213)
+++ head/sys/dev/isp/isp.c  Tue Sep 15 02:25:03 2009(r197214)
@@ -2771,21 +2771,15 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
/*
 * Make sure we're okay for doing this right now.
 */
-   if (fcp->isp_loopstate != LOOP_PDB_RCVD &&
-   fcp->isp_loopstate != LOOP_FSCAN_DONE &&
-   fcp->isp_loopstate != LOOP_LSCAN_DONE) {
-   isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d",
-   fcp->isp_loopstate);
+   if (fcp->isp_loopstate != LOOP_PDB_RCVD && fcp->isp_loopstate != 
LOOP_FSCAN_DONE && fcp->isp_loopstate != LOOP_LSCAN_DONE) {
+   isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: bad loopstate %d", 
fcp->isp_loopstate);
return (-1);
}
 
-   if (fcp->isp_topo == TOPO_FL_PORT ||
-   fcp->isp_topo == TOPO_NL_PORT ||
-   fcp->isp_topo == TOPO_N_PORT) {
+   if (fcp->isp_topo == TOPO_FL_PORT || fcp->isp_topo == TOPO_NL_PORT || 
fcp->isp_topo == TOPO_N_PORT) {
if (fcp->isp_loopstate < LOOP_LSCAN_DONE) {
if (isp_scan_loop(isp, chan) != 0) {
-   isp_prt(isp, ISP_LOGWARN,
-   "isp_pdb_sync: isp_scan_loop failed");
+   isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: 
isp_scan_loop failed");
return (-1);
}
}
@@ -2794,15 +2788,13 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
if (fcp->isp_topo == TOPO_F_PORT || fcp->isp_topo == TOPO_FL_PORT) {
if (fcp->isp_loopstate < LOOP_FSCAN_DONE) {
if (isp_scan_fabric(isp, chan) != 0) {
-   isp_prt(isp, ISP_LOGWARN,
-   "isp_pdb_sync: isp_scan_fabric failed");
+   isp_prt(isp, ISP_LOGWARN, "isp_pdb_sync: 
isp_scan_fabric failed");
return (-1);
}
}
}
 
-   isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0,
-   "Chan %d Synchronizing PDBs", chan);
+   isp_prt(isp, ISP_LOGSANCFG|ISP_LOGDEBUG0, "Chan %d Synchronizing PDBs", 
chan);
 
fcp->isp_loopstate = LOOP_SYNCING_PDB;
 
@@ -2831,11 +2823,7 @@ isp_pdb_sync(ispsoftc_t *isp, int chan)
lp->state = FC_PORTDB_STATE_NIL;
isp_async(isp, ISPASYNC_DEV_GONE, chan, lp);
if (lp->autologin == 0) {
-   (void) isp_plogx(isp, chan, lp->handle,
-   lp->portid,
-   PLOGX_FLG_CMD_LOGO |
-   PLOGX_FLG_IMPLICIT |
-   PLOGX_FLG_FREE_NPHDL, 0);
+   (void) isp_plogx(isp, chan, lp->handle, 
lp->portid, PLOGX_FLG_CMD_LOGO | PLOGX_FLG_IMPLICIT | PLOGX_FLG_FREE_NPHDL, 0);
} else {
lp->autologin = 0;
}
@@ -3081,8 +3069,7 @@ isp_scan_loop(ispsoftc_t *isp, int chan)
for (i = 0; i < MAX_FC_TARG; i++) {
lp = &fcp->portdb[i];
 
-   if (lp->state == FC_PORTDB_STATE_NIL ||
-   lp->target_mode) {
+   if (lp->state == FC_PORTDB_STATE_NIL || 
lp->target_mode) {
continue;
}
if (lp->node_wwn != tmp.node_wwn) {
@@ -3600,8 +3587,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
for (dbidx = 0; dbidx < MAX_FC_TARG; dbidx++) {
lp = &fcp->portdb[dbidx];
 
-   if (lp->state != FC_PORTDB_STATE_PROBATIONAL ||
-   lp->target_mode) {
+   if (lp->state != FC_PORTDB_STATE_PROBATIONAL || 
lp->target_mode) {
continue;
}
if (lp->portid == portid) {
@@ -3838,8 +3824,7 @@ isp_scan_fabric(ispsoftc_t *isp, int cha
if (fcp->portdb[dbidx].target_mode) {
continue;
   

svn commit: r197213 - stable/7/sys/cam

2009-09-14 Thread Ed Maste
Author: emaste
Date: Tue Sep 15 02:23:16 2009
New Revision: 197213
URL: http://svn.freebsd.org/changeset/base/197213

Log:
  MFC r195685:
  
  Fix leaks in probestart, probedone, and scsi_scan_bus.  Also free
  page_list using the matching malloc type for the allocation.
  
  (In HEAD these functions have moved to scsi_xpt.c)
  
  Reviewed by:  scottl

Modified:
  stable/7/sys/cam/cam_xpt.c

Modified: stable/7/sys/cam/cam_xpt.c
==
--- stable/7/sys/cam/cam_xpt.c  Tue Sep 15 02:22:57 2009(r197212)
+++ stable/7/sys/cam/cam_xpt.c  Tue Sep 15 02:23:16 2009(r197213)
@@ -5240,6 +5240,7 @@ xpt_scan_bus(struct cam_periph *periph, 
}
work_ccb = xpt_alloc_ccb_nowait();
if (work_ccb == NULL) {
+   xpt_free_ccb((union ccb *)scan_info->cpi);
free(scan_info, M_CAMXPT);
xpt_free_path(path);
request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
@@ -5360,6 +5361,7 @@ xpt_scan_bus(struct cam_periph *periph, 
}
 
if ((scan_info->cpi->hba_misc & PIM_SEQSCAN) == 0) {
+   xpt_free_ccb(request_ccb);
break;
}
status = xpt_create_path(&path, xpt_periph,
@@ -5828,8 +5830,11 @@ probestart(struct cam_periph *periph, un
 
serial_buf = NULL;
device = periph->path->device;
-   device->serial_num = NULL;
-   device->serial_num_len = 0;
+   if (device->serial_num != NULL) {
+   free(device->serial_num, M_CAMXPT);
+   device->serial_num = NULL;
+   device->serial_num_len = 0;
+   }
 
serial_buf = (struct scsi_vpd_unit_serial_number *)
malloc(sizeof(*serial_buf), M_CAMXPT, M_NOWAIT|M_ZERO);
@@ -6168,7 +6173,7 @@ probedone(struct cam_periph *periph, uni
}
 
if (page_list != NULL)
-   free(page_list, M_DEVBUF);
+   free(page_list, M_CAMXPT);
 
if (serialnum_supported) {
xpt_release_ccb(done_ccb);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197212 - head/sys/nfsclient

2009-09-14 Thread Qing Li
Author: qingli
Date: Tue Sep 15 02:22:57 2009
New Revision: 197212
URL: http://svn.freebsd.org/changeset/base/197212

Log:
  Simply remove the code instead of using "#if 0".
  
  Pointed out by sam

Modified:
  head/sys/nfsclient/nfs_vfsops.c

Modified: head/sys/nfsclient/nfs_vfsops.c
==
--- head/sys/nfsclient/nfs_vfsops.c Tue Sep 15 02:04:16 2009
(r197211)
+++ head/sys/nfsclient/nfs_vfsops.c Tue Sep 15 02:22:57 2009
(r197212)
@@ -464,12 +464,6 @@ nfs_mountroot(struct mount *mp)
}
 #endif
 
-#if 0 /* QL: XXX */
-   error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
-   if (error)
-   panic("nfs_mountroot: SIOCAIFADDR: %d", error);
-#endif
-
if ((cp = getenv("boot.netif.mtu")) != NULL) {
ir.ifr_mtu = strtol(cp, NULL, 10);
bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197210 - in head/sys: netinet nfsclient

2009-09-14 Thread Qing Li
Author: qingli
Date: Tue Sep 15 01:01:03 2009
New Revision: 197210
URL: http://svn.freebsd.org/changeset/base/197210

Log:
  The bootp code installs an interface address and the nfs client
  module tries to install the same address again. This extra code
  is removed, which was discovered by the removal of a call to
  in_ifscrub() in r196714. This call to in_ifscrub is put back here
  because the SIOCAIFADDR command can be used to change the prefix
  length of an existing alias.
  
  Reviewed by:kmacy

Modified:
  head/sys/netinet/in.c
  head/sys/nfsclient/nfs_vfsops.c

Modified: head/sys/netinet/in.c
==
--- head/sys/netinet/in.c   Tue Sep 15 00:26:23 2009(r197209)
+++ head/sys/netinet/in.c   Tue Sep 15 01:01:03 2009(r197210)
@@ -536,6 +536,16 @@ in_control(struct socket *so, u_long cmd
hostIsNew = 0;
}
if (ifra->ifra_mask.sin_len) {
+   /* 
+* QL: XXX
+* Need to scrub the prefix here in case
+* the issued command is SIOCAIFADDR with
+* the same address, but with a different
+* prefix length. And if the prefix length
+* is the same as before, then the call is 
+* un-necessarily executed here.
+*/
+   in_ifscrub(ifp, ia);
ia->ia_sockmask = ifra->ifra_mask;
ia->ia_sockmask.sin_family = AF_INET;
ia->ia_subnetmask =
@@ -544,6 +554,7 @@ in_control(struct socket *so, u_long cmd
}
if ((ifp->if_flags & IFF_POINTOPOINT) &&
(ifra->ifra_dstaddr.sin_family == AF_INET)) {
+   in_ifscrub(ifp, ia);
ia->ia_dstaddr = ifra->ifra_dstaddr;
maskIsNew  = 1; /* We lie; but the effect's the same */
}

Modified: head/sys/nfsclient/nfs_vfsops.c
==
--- head/sys/nfsclient/nfs_vfsops.c Tue Sep 15 00:26:23 2009
(r197209)
+++ head/sys/nfsclient/nfs_vfsops.c Tue Sep 15 01:01:03 2009
(r197210)
@@ -463,9 +463,13 @@ nfs_mountroot(struct mount *mp)
break;
}
 #endif
+
+#if 0 /* QL: XXX */
error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td);
if (error)
panic("nfs_mountroot: SIOCAIFADDR: %d", error);
+#endif
+
if ((cp = getenv("boot.netif.mtu")) != NULL) {
ir.ifr_mtu = strtol(cp, NULL, 10);
bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197208 - head/sys/cam

2009-09-14 Thread Kenneth D. Merry
Author: ken
Date: Tue Sep 15 00:15:24 2009
New Revision: 197208
URL: http://svn.freebsd.org/changeset/base/197208

Log:
  Fix some instances where CAM rescans get hung up or take a long time to
  complete.
  
  Also, allow xpt_rescan() to rescan a LUN instead of a full bus.
  
  MFC after:3 days
  Sponsored by: Copan Systems, Inc.

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Mon Sep 14 23:46:40 2009(r197207)
+++ head/sys/cam/cam_xpt.c  Tue Sep 15 00:15:24 2009(r197208)
@@ -794,8 +794,9 @@ xpt_scanner_thread(void *dummy)
 * processed.
 */
xpt_lock_buses();
-   msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO,
-   "ccb_scanq", 0);
+   if (TAILQ_EMPTY(&xsoftc.ccb_scanq))
+   msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO,
+  "ccb_scanq", 0);
TAILQ_INIT(&queue);
TAILQ_CONCAT(&queue, &xsoftc.ccb_scanq, sim_links.tqe);
xpt_unlock_buses();
@@ -806,9 +807,12 @@ xpt_scanner_thread(void *dummy)
sim = ccb->ccb_h.path->bus->sim;
CAM_SIM_LOCK(sim);
 
-   ccb->ccb_h.func_code = XPT_SCAN_BUS;
+   if( ccb->ccb_h.path->target->target_id == 
CAM_TARGET_WILDCARD )
+   ccb->ccb_h.func_code = XPT_SCAN_BUS;
+   else
+   ccb->ccb_h.func_code = XPT_SCAN_LUN;
ccb->ccb_h.cbfcnp = xptdone;
-   xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 5);
+   xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 1);
cam_periph_runccb(ccb, NULL, 0, 0, NULL);
xpt_free_path(ccb->ccb_h.path);
xpt_free_ccb(ccb);
@@ -828,6 +832,7 @@ xpt_rescan(union ccb *ccb)
xpt_lock_buses();
TAILQ_FOREACH(hdr, &xsoftc.ccb_scanq, sim_links.tqe) {
if (xpt_path_comp(hdr->path, ccb->ccb_h.path) == 0) {
+   wakeup(&xsoftc.ccb_scanq);
xpt_unlock_buses();
xpt_print(ccb->ccb_h.path, "rescan already queued\n");
xpt_free_path(ccb->ccb_h.path);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197205 - head/sys/dev/amdtemp

2009-09-14 Thread Jung-uk Kim
Author: jkim
Date: Mon Sep 14 23:08:19 2009
New Revision: 197205
URL: http://svn.freebsd.org/changeset/base/197205

Log:
  Restore (undocumented) support for early revisions and add more comments.
  
  Reported by:  kris

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

Modified: head/sys/dev/amdtemp/amdtemp.c
==
--- head/sys/dev/amdtemp/amdtemp.c  Mon Sep 14 22:49:48 2009
(r197204)
+++ head/sys/dev/amdtemp/amdtemp.c  Mon Sep 14 23:08:19 2009
(r197205)
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -58,10 +59,14 @@ typedef enum {
 
 struct amdtemp_softc {
device_tsc_dev;
-   uint32_tsc_mask;
int sc_ncores;
int sc_ntemps;
-   int sc_swap;
+   int sc_flags;
+#defineAMDTEMP_FLAG_DO_QUIRK   0x01/* DiodeOffset may be 
incorrect. */
+#defineAMDTEMP_FLAG_DO_ZERO0x02/* DiodeOffset starts from 0C. 
*/
+#defineAMDTEMP_FLAG_DO_SIGN0x04/* DiodeOffsetSignBit is 
present. */
+#defineAMDTEMP_FLAG_CS_SWAP0x08/* ThermSenseCoreSel is 
inverted. */
+#defineAMDTEMP_FLAG_CT_10BIT   0x10/* CurTmp is 10-bit wide. */
int32_t (*sc_gettemp)(device_t, amdsensor_t);
struct sysctl_oid *sc_sysctl_cpu[MAXCPU];
struct intr_config_hook sc_ich;
@@ -168,30 +173,22 @@ amdtemp_identify(driver_t *driver, devic
 static int
 amdtemp_probe(device_t dev)
 {
-   uint32_t cpuid, family, model, temp;
+   uint32_t family, model;
 
if (resource_disabled("amdtemp", 0))
return (ENXIO);
 
-   cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
-   family = CPUID_TO_FAMILY(cpuid);
-   model = CPUID_TO_MODEL(cpuid);
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
 
switch (family) {
case 0x0f:
-   if ((model == 0x04 && (cpuid & CPUID_STEPPING) == 0) ||
-   (model == 0x05 && (cpuid & CPUID_STEPPING) <= 1))
+   if ((model == 0x04 && (cpu_id & CPUID_STEPPING) == 0) ||
+   (model == 0x05 && (cpu_id & CPUID_STEPPING) <= 1))
return (ENXIO);
break;
case 0x10:
case 0x11:
-   /*
-* DiodeOffset must be non-zero if thermal diode is supported.
-*/
-   temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
-   temp = (temp >> 8) & 0x7f;
-   if (temp == 0)
-   return (ENXIO);
break;
default:
return (ENXIO);
@@ -207,32 +204,66 @@ amdtemp_attach(device_t dev)
struct amdtemp_softc *sc = device_get_softc(dev);
struct sysctl_ctx_list *sysctlctx;
struct sysctl_oid *sysctlnode;
+   uint32_t regs[4];
uint32_t cpuid, family, model;
 
-   cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
-   family = CPUID_TO_FAMILY(cpuid);
-   model = CPUID_TO_MODEL(cpuid);
+   /*
+* Errata #154: Incorect Diode Offset
+*/
+   if (cpu_id == 0x20f32) {
+   do_cpuid(0x8001, regs);
+   if ((regs[1] & 0xfff) == 0x2c)
+   sc->sc_flags |= AMDTEMP_FLAG_DO_QUIRK;
+   }
+
+   /*
+* CPUID Register is available from Revision F.
+*/
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
+   if (family != 0x0f || model >= 0x40) {
+   cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
+   family = CPUID_TO_FAMILY(cpuid);
+   model = CPUID_TO_MODEL(cpuid);
+   }
 
switch (family) {
case 0x0f:
/*
-* Thermaltrip Status Register - CurTmp
+* Thermaltrip Status Register
+*
+* - DiodeOffsetSignBit
+*
+* Revision D & E:  bit 24
+* Other:   N/A
+*
+* - ThermSenseCoreSel
+*
+* Revision F & G:  0 - Core1, 1 - Core0
+* Other:   0 - Core0, 1 - Core1
+*
+* - CurTmp
 *
 * Revision G:  bits 23-14
-* Earlier: bits 23-16
-*/
-   if (model >= 0x60 && model != 0xc1)
-   sc->sc_mask = 0x3ff << 14;
-   else
-   sc->sc_mask = 0xff << 16;
-
-   /*
-* Thermaltrip Status Register - ThermSenseCoreSel
+* Other:   bits 23-16
 *
-* Revision F:  0 - Core1, 1 - Core0
-* Earlier: 0 - Core0, 1 - Core1
+

svn commit: r197203 - head/sys/netinet

2009-09-14 Thread Qing Li
Author: qingli
Date: Mon Sep 14 22:19:47 2009
New Revision: 197203
URL: http://svn.freebsd.org/changeset/base/197203

Log:
  Previously local end of point-to-point interface is not reachable
  within the system that owns the interface. Packets destined to
  the local end point leak to the wire towards the default gateway
  if one exists. This behavior is changed as part of the L2/L3
  rewrite efforts. The local end point is now reachable within the
  system. The inpcb code needs to consider this fact during the
  address selection process.
  
  Reviewed by:  bz
  MFC after:immediately

Modified:
  head/sys/netinet/in_pcb.c

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Mon Sep 14 21:33:00 2009(r197202)
+++ head/sys/netinet/in_pcb.c   Mon Sep 14 22:19:47 2009(r197203)
@@ -701,6 +701,8 @@ in_pcbladdr(struct inpcb *inp, struct in
ia = ifatoia(ifa_ifwithdstaddr(sintosa(&sain)));
if (ia == NULL)
ia = ifatoia(ifa_ifwithnet(sintosa(&sain)));
+   if (ia == NULL)
+   ia = ifatoia(ifa_ifwithaddr(sintosa(&sain)));
 
if (cred == NULL || !prison_flag(cred, PR_IP4)) {
if (ia == NULL) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197202 - head/sys/dev/asmc

2009-09-14 Thread Rui Paulo
Author: rpaulo
Date: Mon Sep 14 21:33:00 2009
New Revision: 197202
URL: http://svn.freebsd.org/changeset/base/197202

Log:
  Use %zu for size_t.
  Fix printf format string (again)
  
  Pointed out by:   bde, ed

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

Modified: head/sys/dev/asmc/asmc.c
==
--- head/sys/dev/asmc/asmc.cMon Sep 14 21:10:40 2009(r197201)
+++ head/sys/dev/asmc/asmc.cMon Sep 14 21:33:00 2009(r197202)
@@ -823,8 +823,9 @@ out:
type[0] = ' ';
type[5] = 0;
if (maxlen > sizeof(v)) {   
-   device_printf(dev, "WARNING: cropping maxlen "
-   "from %u to %lu\n", maxlen, sizeof(v));
+   device_printf(dev,
+   "WARNING: cropping maxlen from %d to %zu\n",
+   maxlen, sizeof(v));
maxlen = sizeof(v);
}
for (i = 0; i < sizeof(v); i++) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197201 - in head: . sys/cddl/compat/opensolaris/kern sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2009-09-14 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Sep 14 21:10:40 2009
New Revision: 197201
URL: http://svn.freebsd.org/changeset/base/197201

Log:
  - Mount ZFS snapshots with MNT_IGNORE flag, so they are not visible in regular
df(1) and mount(8) output. This is a bit smilar to OpenSolaris and follows
ZFS route of not listing snapshots by default with 'zfs list' command.
  - Add UPDATING entry to note that ZFS snapshots are no longer visible in
mount(8) and df(1) output by default.
  
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/UPDATING
  head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
  head/sys/cddl/compat/opensolaris/sys/vfs.h
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/UPDATING
==
--- head/UPDATING   Mon Sep 14 21:08:22 2009(r197200)
+++ head/UPDATING   Mon Sep 14 21:10:40 2009(r197201)
@@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
machines to maximize performance.  (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
 
+20090910:
+   ZFS snapshots are now mounted with MNT_IGNORE flag. Use -v option for
+   mount(8) and -a option for df(1) to see them.
+
 20090825:
The old tunable hw.bus.devctl_disable has been superseded by
hw.bus.devctl_queue.  hw.bus.devctl_disable=1 in loader.conf should be

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 14 
21:08:22 2009(r197200)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Mon Sep 14 
21:10:40 2009(r197201)
@@ -112,12 +112,13 @@ vfs_optionisset(const vfs_t *vfsp, const
 }
 
 int
-domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath,
+mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
 char *fspec, int fsflags)
 {
struct mount *mp;
struct vfsconf *vfsp;
struct ucred *cr;
+   vnode_t *vp;
int error;
 
/*
@@ -132,23 +133,28 @@ domount(kthread_t *td, vnode_t *vp, cons
if (vfsp == NULL)
return (ENODEV);
 
+   vp = *vpp;
if (vp->v_type != VDIR)
return (ENOTDIR);
+   /*
+* We need vnode lock to protect v_mountedhere and vnode interlock
+* to protect v_iflag.
+*/
+   vn_lock(vp, LK_SHARED | LK_RETRY);
VI_LOCK(vp);
-   if ((vp->v_iflag & VI_MOUNT) != 0 ||
-   vp->v_mountedhere != NULL) {
+   if ((vp->v_iflag & VI_MOUNT) != 0 || vp->v_mountedhere != NULL) {
VI_UNLOCK(vp);
+   VOP_UNLOCK(vp, 0);
return (EBUSY);
}
vp->v_iflag |= VI_MOUNT;
VI_UNLOCK(vp);
+   VOP_UNLOCK(vp, 0);
 
/*
 * Allocate and initialize the filesystem.
 */
-   vn_lock(vp, LK_SHARED | LK_RETRY);
mp = vfs_mount_alloc(vp, vfsp, fspath, td->td_ucred);
-   VOP_UNLOCK(vp, 0);
 
mp->mnt_optnew = NULL;
vfs_setmntopt(mp, "from", fspec, 0);
@@ -158,11 +164,18 @@ domount(kthread_t *td, vnode_t *vp, cons
/*
 * Set the mount level flags.
 */
-   if (fsflags & MNT_RDONLY)
-   mp->mnt_flag |= MNT_RDONLY;
-   mp->mnt_flag &=~ MNT_UPDATEMASK;
+   mp->mnt_flag &= ~MNT_UPDATEMASK;
mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE | MNT_ROOTFS);
/*
+* Snapshots are always read-only.
+*/
+   mp->mnt_flag |= MNT_RDONLY;
+   /*
+* We don't want snapshots to be visible in regular
+* mount(8) and df(1) output.
+*/
+   mp->mnt_flag |= MNT_IGNORE;
+   /*
 * Unprivileged user can trigger mounting a snapshot, but we don't want
 * him to unmount it, so we switch to privileged of original mount.
 */
@@ -170,11 +183,6 @@ domount(kthread_t *td, vnode_t *vp, cons
mp->mnt_cred = crdup(vp->v_mount->mnt_cred);
mp->mnt_stat.f_owner = mp->mnt_cred->cr_uid;
/*
-* Mount the filesystem.
-* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
-* get.  No freeing of cn_pnbuf.
-*/
-   /*
 * XXX: This is evil, but we can't mount a snapshot as a regular user.
 * XXX: Is is safe when snapshot is mounted from within a jail?
 */
@@ -183,7 +191,7 @@ domount(kthread_t *td, vnode_t *vp, cons
error = VFS_MOUNT(mp);
td->td_ucred = cr;
 
-   if (!error) {
+   if (error == 0) {
if (mp->mnt_opt != NULL)
vfs_freeopts(mp->mnt_opt);
mp->mnt_opt = mp->mnt_optnew;
@@ -195,42 +203,33 @@ domount(kthread_t *td, vnode_t *vp, cons
*/
mp->mnt_optnew = NULL;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
-   

svn commit: r197200 - head/sbin/mount

2009-09-14 Thread Pawel Jakub Dawidek
Author: pjd
Date: Mon Sep 14 21:08:22 2009
New Revision: 197200
URL: http://svn.freebsd.org/changeset/base/197200

Log:
  Modify mount(8) to skip MNT_IGNORE file systems by default, just like df(1)
  does. This is not POLA violation, because there is no single file system in 
the
  base that use MNT_IGNORE currently, although ZFS snapshots will be mounted 
with
  MNT_IGNORE after next commit.
  
  Reviewed by:  kib
  MFC after:3 days

Modified:
  head/sbin/mount/mount.8
  head/sbin/mount/mount.c

Modified: head/sbin/mount/mount.8
==
--- head/sbin/mount/mount.8 Mon Sep 14 17:49:59 2009(r197199)
+++ head/sbin/mount/mount.8 Mon Sep 14 21:08:22 2009(r197200)
@@ -469,6 +469,12 @@ or
 option.
 .It Fl v
 Verbose mode.
+If the
+.Fl v
+is used alone, show all file systems, including those that were mounted with 
the
+.Dv MNT_IGNORE
+flag and show additional information about each file system (including fsid
+when run by root).
 .It Fl w
 The file system object is to be read and write.
 .El

Modified: head/sbin/mount/mount.c
==
--- head/sbin/mount/mount.c Mon Sep 14 17:49:59 2009(r197199)
+++ head/sbin/mount/mount.c Mon Sep 14 21:08:22 2009(r197200)
@@ -348,6 +348,9 @@ main(int argc, char *argv[])
if (checkvfsname(mntbuf[i].f_fstypename,
vfslist))
continue;
+   if (!verbose &&
+   (mntbuf[i].f_flags & MNT_IGNORE) != 0)
+   continue;
prmount(&mntbuf[i]);
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r197102 - head/sys/dev/amdtemp

2009-09-14 Thread Jung-uk Kim
On Monday 14 September 2009 04:08 pm, Jung-uk Kim wrote:
> Please try the attached patch.  I tried to implement all the quirks
> in Revision Guide carefully but I must admit that I haven't tried
> it on anything earlier than Revision F.

This patch has one typo:

+   /*
+* Errata #154: Incorect Diode Offset
+*/
+   if (cpu_id == 0x20f32) {
+   do_cpuid(0x8001, regs);
+   if ((regs[1] && 0xfff) == 0x2c)
 ^^
 &
+   sc->sc_flags |= AMDTEMP_FLAG_DO_QUIRK;
+   }

Today is not my day. :-(

Sorry again,

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


Re: svn commit: r197102 - head/sys/dev/amdtemp

2009-09-14 Thread Jung-uk Kim
On Monday 14 September 2009 12:38 pm, Jung-uk Kim wrote:
> On Monday 14 September 2009 12:29 pm, Jung-uk Kim wrote:
> > On Sunday 13 September 2009 12:12 pm, Kris Kennaway wrote:
> > > Jung-uk Kim wrote:
> > > > Author: jkim
> > > > Date: Fri Sep 11 21:47:44 2009
> > > > New Revision: 197102
> > > > URL: http://svn.freebsd.org/changeset/base/197102
> > > >
> > > > Log:
> > > >   Improve amdtemp(4) significantly:
> > > >
> > > >   - Improve newer AMD processor support (Family 0Fh Revision
> > > > F and later). - Adjust offset if DiodeOffet is set and valid.
> > > > Note it is experimental but it seems to give us more
> > > > realistic temperatures.  Newer Linux driver blindly adds 21C
> > > > for Family 0Fh desktop processors, however. - Always populate
> > > > dev.cpu and dev.amdtemp sysctl trees regardless of probe
> > > > order for consistency.  Previously, dev.cpu.N.temperature was
> > > > not populated if amdtemp was loaded later than ACPI CPU
> > > > driver and temperatures were not accessible from
> > > > dev.amdtemp.N.sensor0 tree for Family 10h/11h processors. -
> > > > Read the CPUID from PCI register instead of CPUID instruction
> > > > to prevent possible revision mismatches on multi-socket
> > > > system.
> > > >   - Change macros and variables to make them closer to AMD
> > > > documents. - Fix style(9) nits and improve comments.
> > >
> > > It no longer appears to work for me.  The old version reported:
> > >
> > > dev.amdtemp.0.%desc: AMD K8 Thermal Sensors
> > > dev.amdtemp.0.%driver: amdtemp
> > > dev.amdtemp.0.%parent: hostb9
> > > dev.amdtemp.0.sensor0.core0: 38.0C
> > > dev.amdtemp.0.sensor0.core1: 45.0C
> > > dev.amdtemp.0.sensor1.core0: 38.0C
> > > dev.amdtemp.0.sensor1.core1: 45.0C
> > > dev.cpu.0.temperature: 38.0C
> > > dev.cpu.1.temperature: 38.0C
> > >
> > > but none of those sysctl nodes are now present.
> > >
> > > CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4600+
> > > (2400.10-MHz K8-class CPU)
> > >Origin = "AuthenticAMD"  Id = 0x20f32  Stepping = 2
> > >
> > > Features=0x178bfbff > >,M TR R,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
> > > Features2=0x1
> > >AMD
> > > Features=0xe2500800
> > > AMD Features2=0x3
> > > ACPI APIC Table: 
> >
> > Arg...  This is a Socket 939, Revision E processor and Revision
> > C/D/E seems to have different DiodeOffset encoding.  Please try
> > the attached patch until I fix it properly.
>
> Please ignore this patch.  I need some time to think and fix it
> properly.  There are too many families and revisions. :-(

Please try the attached patch.  I tried to implement all the quirks in 
Revision Guide carefully but I must admit that I haven't tried it on 
anything earlier than Revision F.

Thanks,

Jung-uk Kim
--- sys/dev/amdtemp/amdtemp.c
+++ sys/dev/amdtemp/amdtemp.c
@@ -42,6 +42,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -58,10 +59,14 @@
 
 struct amdtemp_softc {
device_tsc_dev;
-   uint32_tsc_mask;
+   int sc_flags;
+#defineAMDTEMP_FLAG_DO_QUIRK   0x01/* DiodeOffset is incorrect. */
+#defineAMDTEMP_FLAG_DO_ZERO0x02/* DiodeOffset starts from 0C. 
*/
+#defineAMDTEMP_FLAG_DO_SIGN0x04/* DiodeOffsetSignBit is 
present. */
+#defineAMDTEMP_FLAG_CSWAP  0x08/* Core0/Core1 selector is 
swapped. */
+#defineAMDTEMP_FLAG_10BIT  0x10/* CurTmp is 10-bit wide. */
int sc_ncores;
int sc_ntemps;
-   int sc_swap;
int32_t (*sc_gettemp)(device_t, amdsensor_t);
struct sysctl_oid *sc_sysctl_cpu[MAXCPU];
struct intr_config_hook sc_ich;
@@ -168,30 +173,22 @@
 static int
 amdtemp_probe(device_t dev)
 {
-   uint32_t cpuid, family, model, temp;
+   uint32_t family, model;
 
if (resource_disabled("amdtemp", 0))
return (ENXIO);
 
-   cpuid = pci_read_config(dev, AMDTEMP_CPUID, 4);
-   family = CPUID_TO_FAMILY(cpuid);
-   model = CPUID_TO_MODEL(cpuid);
+   family = CPUID_TO_FAMILY(cpu_id);
+   model = CPUID_TO_MODEL(cpu_id);
 
switch (family) {
case 0x0f:
-   if ((model == 0x04 && (cpuid & CPUID_STEPPING) == 0) ||
-   (model == 0x05 && (cpuid & CPUID_STEPPING) <= 1))
+   if ((model == 0x04 && (cpu_id & CPUID_STEPPING) == 0) ||
+   (model == 0x05 && (cpu_id & CPUID_STEPPING) <= 1))
return (ENXIO);
break;
case 0x10:
case 0x11:
-   /*
-* DiodeOffset must be non-zero if thermal diode is supported.
-*/
-   temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
-   temp = (temp >> 8) & 0x7f;
-   if (temp == 0)
-   return (ENXIO);
break;
default:
return (ENXIO);
@@ -207,34 +204,59 @@
struct amdtemp_softc *sc = 

Re: svn commit: r197195 - head/sys/dev/asmc

2009-09-14 Thread Bruce Evans

On Mon, 14 Sep 2009, Rui Paulo wrote:


Log:
 Fix previous commit. I got it backwards.


It is still unfixed.


 MFC after: 1 week

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

Modified: head/sys/dev/asmc/asmc.c
==
--- head/sys/dev/asmc/asmc.cMon Sep 14 16:13:12 2009(r197194)
+++ head/sys/dev/asmc/asmc.cMon Sep 14 16:16:07 2009(r197195)
@@ -824,7 +824,7 @@ out:
type[5] = 0;
if (maxlen > sizeof(v)) {
device_printf(dev, "WARNING: cropping maxlen "
-   "from %u to %u\n", maxlen, sizeof(v));
+   "from %u to %lu\n", maxlen, sizeof(v));
maxlen = sizeof(v);
}


This printf has the following errors:

Fatal printf format error: values of type size_t should be printed
using %zu, but here sizeof(v) is printed using %lu.  Printing it using
%u would be fatal on different systems.

Non-fatal printf format error: maxlen has type uint8_t, so its default
promotion is int, and this should be printed using %d like it was 2
commits ago.  %u will work since the value is representable using both
int and u_int, but this is not easy to see (in fact, I can't see it
in C99 -- I can only see where C99 requires va_arg(ap, u_int) to work
on a u_int).

Format-printf error (style bug).  The message is obfuscated using C90
string concatenation.

Fixed version:

device_printf(dev,
"WARNING: cropping maxlen from %d to %zu\n",
maxlen, sizeof(v));

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


svn commit: r197199 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/xen/xenpci

2009-09-14 Thread John Baldwin
Author: jhb
Date: Mon Sep 14 17:49:59 2009
New Revision: 197199
URL: http://svn.freebsd.org/changeset/base/197199

Log:
  Fix botched mergeinfo.
  
  Approved by:  re (kib, bz)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/coretemp/coretemp.c   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197198 - stable/7/sys/sys

2009-09-14 Thread John Baldwin
Author: jhb
Date: Mon Sep 14 17:45:58 2009
New Revision: 197198
URL: http://svn.freebsd.org/changeset/base/197198

Log:
  Bump __FreeBSD_version to 702106 for the recent PAT, d_mmap_single(), and
  OBJT_SG changes.

Modified:
  stable/7/sys/sys/param.h

Modified: stable/7/sys/sys/param.h
==
--- stable/7/sys/sys/param.hMon Sep 14 17:34:49 2009(r197197)
+++ stable/7/sys/sys/param.hMon Sep 14 17:45:58 2009(r197198)
@@ -57,7 +57,7 @@
  * is created, otherwise 1.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 702105   /* Master, propagated to newvers */
+#define __FreeBSD_version 702106   /* Master, propagated to newvers */
 
 #ifndef LOCORE
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197197 - in stable/7: sys sys/amd64/amd64 sys/arm/arm sys/conf sys/contrib/pf sys/fs/procfs sys/i386/i386 sys/ia64/ia64 sys/kern sys/sparc64/sparc64 sys/sys sys/vm usr.bin/procstat

2009-09-14 Thread John Baldwin
Author: jhb
Date: Mon Sep 14 17:34:49 2009
New Revision: 197197
URL: http://svn.freebsd.org/changeset/base/197197

Log:
  MFC 195840, 195844, and 196637:
  Add a new type of VM object: OBJT_SG.  An OBJT_SG object is very similar to
  a device pager (OBJT_DEVICE) object in that it uses fictitious pages to
  provide aliases to other memory addresses.  The primary difference is that
  it uses an sglist(9) to determine the physical addresses for a given offset
  into the object instead of invoking the d_mmap() method in a device driver.

Added:
  stable/7/sys/vm/sg_pager.c
 - copied, changed from r195840, head/sys/vm/sg_pager.c
Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/amd64/amd64/pmap.c
  stable/7/sys/arm/arm/pmap.c
  stable/7/sys/conf/files
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/fs/procfs/procfs_map.c
  stable/7/sys/i386/i386/pmap.c
  stable/7/sys/ia64/ia64/pmap.c
  stable/7/sys/kern/kern_proc.c
  stable/7/sys/sparc64/sparc64/pmap.c
  stable/7/sys/sys/user.h
  stable/7/sys/vm/vm.h
  stable/7/sys/vm/vm_fault.c
  stable/7/sys/vm/vm_map.c
  stable/7/sys/vm/vm_meter.c
  stable/7/sys/vm/vm_object.c
  stable/7/sys/vm/vm_object.h
  stable/7/sys/vm/vm_page.c
  stable/7/sys/vm/vm_pageout.c
  stable/7/sys/vm/vm_pager.c
  stable/7/sys/vm/vm_pager.h
  stable/7/usr.bin/procstat/   (props changed)
  stable/7/usr.bin/procstat/procstat_vm.c

Modified: stable/7/sys/amd64/amd64/pmap.c
==
--- stable/7/sys/amd64/amd64/pmap.c Mon Sep 14 16:52:38 2009
(r197196)
+++ stable/7/sys/amd64/amd64/pmap.c Mon Sep 14 17:34:49 2009
(r197197)
@@ -3350,7 +3350,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
int pat_mode;
 
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
-   KASSERT(object->type == OBJT_DEVICE,
+   KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG,
("pmap_object_init_pt: non-device object"));
if ((addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) {
if (!vm_object_populate(object, pindex, pindex + atop(size)))
@@ -4592,7 +4592,8 @@ vm_offset_t
 pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size)
 {
 
-   if ((obj == NULL) || (size < NBPDR) || (obj->type != OBJT_DEVICE)) {
+   if ((obj == NULL) || (size < NBPDR) ||
+   (obj->type != OBJT_DEVICE && obj->type != OBJT_SG)) {
return addr;
}
 

Modified: stable/7/sys/arm/arm/pmap.c
==
--- stable/7/sys/arm/arm/pmap.c Mon Sep 14 16:52:38 2009(r197196)
+++ stable/7/sys/arm/arm/pmap.c Mon Sep 14 17:34:49 2009(r197197)
@@ -3071,7 +3071,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
 {
 
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
-   KASSERT(object->type == OBJT_DEVICE,
+   KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG,
("pmap_object_init_pt: non-device object"));
 }
 

Modified: stable/7/sys/conf/files
==
--- stable/7/sys/conf/files Mon Sep 14 16:52:38 2009(r197196)
+++ stable/7/sys/conf/files Mon Sep 14 17:34:49 2009(r197197)
@@ -2210,6 +2210,7 @@ vm/default_pager.cstandard
 vm/device_pager.c  standard
 vm/phys_pager.cstandard
 vm/redzone.c   optional DEBUG_REDZONE
+vm/sg_pager.c  standard
 vm/swap_pager.cstandard
 vm/uma_core.c  standard
 vm/uma_dbg.c   standard

Modified: stable/7/sys/fs/procfs/procfs_map.c
==
--- stable/7/sys/fs/procfs/procfs_map.c Mon Sep 14 16:52:38 2009
(r197196)
+++ stable/7/sys/fs/procfs/procfs_map.c Mon Sep 14 17:34:49 2009
(r197197)
@@ -177,6 +177,7 @@ procfs_doprocmap(PFS_FILL_ARGS)
type = "swap";
vp = NULL;
break;
+   case OBJT_SG:
case OBJT_DEVICE:
type = "device";
vp = NULL;

Modified: stable/7/sys/i386/i386/pmap.c
==
--- stable/7/sys/i386/i386/pmap.c   Mon Sep 14 16:52:38 2009
(r197196)
+++ stable/7/sys/i386/i386/pmap.c   Mon Sep 14 17:34:49 2009
(r197197)
@@ -3474,7 +3474,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
int pat_mode;
 
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
-   KASSERT(object->type == OBJT_DEVICE,
+   KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG,
("pmap_object_init_pt: non-device object"));
if (pseflag && 
(addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 

svn commit: r197196 - head/etc/rc.d

2009-09-14 Thread Ed Maste
Author: emaste
Date: Mon Sep 14 16:52:38 2009
New Revision: 197196
URL: http://svn.freebsd.org/changeset/base/197196

Log:
  Protect cross-script invocation by checking that the target script exists.
  This allows pruning of rc.d scripts without getting too many ugly boottime
  error messages.
  
  Inspired by phk's r128714 change to netif.

Modified:
  head/etc/rc.d/ppp

Modified: head/etc/rc.d/ppp
==
--- head/etc/rc.d/ppp   Mon Sep 14 16:16:07 2009(r197195)
+++ head/etc/rc.d/ppp   Mon Sep 14 16:52:38 2009(r197196)
@@ -95,8 +95,12 @@ ppp_poststart()
 {
# Re-Sync ipfilter and pf so they pick up any new network interfaces
#
-   /etc/rc.d/ipfilter quietresync
-   /etc/rc.d/pf quietresync
+   if [ -f /etc/rc.d/ipfilter ]; then
+   /etc/rc.d/ipfilter quietresync
+   fi
+   if [ -f /etc/rc.d/pf ]; then
+   /etc/rc.d/pf quietresync
+   fi
 }
 
 ppp_stop_profile() {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197194 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/syscons/daemon dev/xen/xenpci

2009-09-14 Thread John Baldwin
Author: jhb
Date: Mon Sep 14 16:13:12 2009
New Revision: 197194
URL: http://svn.freebsd.org/changeset/base/197194

Log:
  MFC 197062:
  Don't malloc a buffer while holding the prison0 mutex.  Instead, use a loop
  where we figure out the hostname length under the lock, malloc the buffer
  with the lock dropped, then recheck the length under the lock and loop again
  if the buffer is now too small.
  
  Approved by:  re (kib)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/coretemp/coretemp.c   (props changed)
  stable/8/sys/dev/syscons/daemon/daemon_saver.c
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/syscons/daemon/daemon_saver.c
==
--- stable/8/sys/dev/syscons/daemon/daemon_saver.c  Mon Sep 14 15:53:30 
2009(r197193)
+++ stable/8/sys/dev/syscons/daemon/daemon_saver.c  Mon Sep 14 16:13:12 
2009(r197194)
@@ -351,11 +351,23 @@ daemon_saver(video_adapter_t *adp, int b
 static int
 daemon_init(video_adapter_t *adp)
 {
+   size_t hostlen;
 
mtx_lock(&prison0.pr_mtx);
-   messagelen = strlen(prison0.pr_hostname) + 3 + strlen(ostype) + 1 + 
-   strlen(osrelease);
-   message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
+   for (;;) {
+   hostlen = strlen(prison0.pr_hostname);
+   mtx_unlock(&prison0.pr_mtx);
+   
+   messagelen = hostlen + 3 + strlen(ostype) + 1 +
+   strlen(osrelease);
+   message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
+   mtx_lock(&prison0.pr_mtx);
+   if (hostlen < strlen(prison0.pr_hostname)) {
+   free(message, M_DEVBUF);
+   continue;
+   }
+   break;
+   }
sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease);
mtx_unlock(&prison0.pr_mtx);
blanked = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197193 - head/sys/dev/asmc

2009-09-14 Thread Rui Paulo
Author: rpaulo
Date: Mon Sep 14 15:53:30 2009
New Revision: 197193
URL: http://svn.freebsd.org/changeset/base/197193

Log:
  Fix printf format string in asmc_key_dump().
  
  Spotted by:   tinderbox
  MFC after:1 week

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

Modified: head/sys/dev/asmc/asmc.c
==
--- head/sys/dev/asmc/asmc.cMon Sep 14 15:16:17 2009(r197192)
+++ head/sys/dev/asmc/asmc.cMon Sep 14 15:53:30 2009(r197193)
@@ -824,7 +824,7 @@ out:
type[5] = 0;
if (maxlen > sizeof(v)) {   
device_printf(dev, "WARNING: cropping maxlen "
-   "from %d to %lud\n", maxlen, sizeof(v));
+   "from %u to %u\n", maxlen, sizeof(v));
maxlen = sizeof(v);
}
for (i = 0; i < sizeof(v); i++) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197195 - head/sys/dev/asmc

2009-09-14 Thread Rui Paulo
Author: rpaulo
Date: Mon Sep 14 16:16:07 2009
New Revision: 197195
URL: http://svn.freebsd.org/changeset/base/197195

Log:
  Fix previous commit. I got it backwards.
  
  MFC after:1 week

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

Modified: head/sys/dev/asmc/asmc.c
==
--- head/sys/dev/asmc/asmc.cMon Sep 14 16:13:12 2009(r197194)
+++ head/sys/dev/asmc/asmc.cMon Sep 14 16:16:07 2009(r197195)
@@ -824,7 +824,7 @@ out:
type[5] = 0;
if (maxlen > sizeof(v)) {   
device_printf(dev, "WARNING: cropping maxlen "
-   "from %u to %u\n", maxlen, sizeof(v));
+   "from %u to %lu\n", maxlen, sizeof(v));
maxlen = sizeof(v);
}
for (i = 0; i < sizeof(v); i++) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197192 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/xen/xenpci fs/nfsclient nfsclient

2009-09-14 Thread Rick Macklem
Author: rmacklem
Date: Mon Sep 14 15:16:17 2009
New Revision: 197192
URL: http://svn.freebsd.org/changeset/base/197192

Log:
  MFC r197048:
  Add LK_NOWITNESS to the vn_lock() calls done on newly created nfs
  vnodes, since these nodes are not linked into the mount queue and,
  as such, the vn_lock() cannot cause a deadlock so LORs are harmless.
  
  Suggested by: kib
  Approved by:  re (kensmith), kib (mentor)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/coretemp/coretemp.c   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/nfsclient/nfs_clnode.c
  stable/8/sys/fs/nfsclient/nfs_clport.c
  stable/8/sys/nfsclient/nfs_node.c

Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c
==
--- stable/8/sys/fs/nfsclient/nfs_clnode.c  Mon Sep 14 13:16:16 2009
(r197191)
+++ stable/8/sys/fs/nfsclient/nfs_clnode.c  Mon Sep 14 15:16:17 2009
(r197192)
@@ -157,7 +157,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
M_NFSFH, M_WAITOK);
bcopy(fhp, np->n_fhp->nfh_fh, fhsize);
np->n_fhp->nfh_len = fhsize;
-   lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
+   lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
error = insmntque(vp, mntp);
if (error != 0) {
*npp = NULL;

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==
--- stable/8/sys/fs/nfsclient/nfs_clport.c  Mon Sep 14 13:16:16 2009
(r197191)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c  Mon Sep 14 15:16:17 2009
(r197192)
@@ -232,7 +232,7 @@ nfscl_nget(struct mount *mntp, struct vn
 */
VN_LOCK_AREC(vp);
VN_LOCK_ASHARE(vp);
-   lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
+   lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
error = insmntque(vp, mntp);
if (error != 0) {
*npp = NULL;

Modified: stable/8/sys/nfsclient/nfs_node.c
==
--- stable/8/sys/nfsclient/nfs_node.c   Mon Sep 14 13:16:16 2009
(r197191)
+++ stable/8/sys/nfsclient/nfs_node.c   Mon Sep 14 15:16:17 2009
(r197192)
@@ -158,7 +158,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh
np->n_fhp = &np->n_fh;
bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize);
np->n_fhsize = fhsize;
-   lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL);
+   lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL);
error = insmntque(vp, mntp);
if (error != 0) {
*npp = NULL;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r197102 - head/sys/dev/amdtemp

2009-09-14 Thread Jung-uk Kim
On Monday 14 September 2009 12:29 pm, Jung-uk Kim wrote:
> On Sunday 13 September 2009 12:12 pm, Kris Kennaway wrote:
> > Jung-uk Kim wrote:
> > > Author: jkim
> > > Date: Fri Sep 11 21:47:44 2009
> > > New Revision: 197102
> > > URL: http://svn.freebsd.org/changeset/base/197102
> > >
> > > Log:
> > >   Improve amdtemp(4) significantly:
> > >
> > >   - Improve newer AMD processor support (Family 0Fh Revision F
> > > and later). - Adjust offset if DiodeOffet is set and valid. 
> > > Note it is experimental but it seems to give us more realistic
> > > temperatures.  Newer Linux driver blindly adds 21C for Family
> > > 0Fh desktop processors, however. - Always populate dev.cpu and
> > > dev.amdtemp sysctl trees regardless of probe order for
> > > consistency.  Previously, dev.cpu.N.temperature was not
> > > populated if amdtemp was loaded later than ACPI CPU driver and
> > > temperatures were not accessible from dev.amdtemp.N.sensor0
> > > tree for Family 10h/11h processors. - Read the CPUID from PCI
> > > register instead of CPUID instruction to prevent possible
> > > revision mismatches on multi-socket system.
> > >   - Change macros and variables to make them closer to AMD
> > > documents. - Fix style(9) nits and improve comments.
> >
> > It no longer appears to work for me.  The old version reported:
> >
> > dev.amdtemp.0.%desc: AMD K8 Thermal Sensors
> > dev.amdtemp.0.%driver: amdtemp
> > dev.amdtemp.0.%parent: hostb9
> > dev.amdtemp.0.sensor0.core0: 38.0C
> > dev.amdtemp.0.sensor0.core1: 45.0C
> > dev.amdtemp.0.sensor1.core0: 38.0C
> > dev.amdtemp.0.sensor1.core1: 45.0C
> > dev.cpu.0.temperature: 38.0C
> > dev.cpu.1.temperature: 38.0C
> >
> > but none of those sysctl nodes are now present.
> >
> > CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ (2400.10-MHz
> > K8-class CPU)
> >Origin = "AuthenticAMD"  Id = 0x20f32  Stepping = 2
> >
> > Features=0x178bfbff >TR R,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
> > Features2=0x1
> >AMD
> > Features=0xe2500800 AMD
> > Features2=0x3
> > ACPI APIC Table: 
>
> Arg...  This is a Socket 939, Revision E processor and Revision
> C/D/E seems to have different DiodeOffset encoding.  Please try the
> attached patch until I fix it properly.

Please ignore this patch.  I need some time to think and fix it 
properly.  There are too many families and revisions. :-(

Sorry,

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


Re: svn commit: r197102 - head/sys/dev/amdtemp

2009-09-14 Thread Jung-uk Kim
On Sunday 13 September 2009 12:12 pm, Kris Kennaway wrote:
> Jung-uk Kim wrote:
> > Author: jkim
> > Date: Fri Sep 11 21:47:44 2009
> > New Revision: 197102
> > URL: http://svn.freebsd.org/changeset/base/197102
> >
> > Log:
> >   Improve amdtemp(4) significantly:
> >
> >   - Improve newer AMD processor support (Family 0Fh Revision F
> > and later). - Adjust offset if DiodeOffet is set and valid.  Note
> > it is experimental but it seems to give us more realistic
> > temperatures.  Newer Linux driver blindly adds 21C for Family 0Fh
> > desktop processors, however. - Always populate dev.cpu and
> > dev.amdtemp sysctl trees regardless of probe order for
> > consistency.  Previously, dev.cpu.N.temperature was not populated
> > if amdtemp was loaded later than ACPI CPU driver and temperatures
> > were not accessible from dev.amdtemp.N.sensor0 tree for Family
> > 10h/11h processors. - Read the CPUID from PCI register instead of
> > CPUID instruction to prevent possible revision mismatches on
> > multi-socket system.
> >   - Change macros and variables to make them closer to AMD
> > documents. - Fix style(9) nits and improve comments.
>
> It no longer appears to work for me.  The old version reported:
>
> dev.amdtemp.0.%desc: AMD K8 Thermal Sensors
> dev.amdtemp.0.%driver: amdtemp
> dev.amdtemp.0.%parent: hostb9
> dev.amdtemp.0.sensor0.core0: 38.0C
> dev.amdtemp.0.sensor0.core1: 45.0C
> dev.amdtemp.0.sensor1.core0: 38.0C
> dev.amdtemp.0.sensor1.core1: 45.0C
> dev.cpu.0.temperature: 38.0C
> dev.cpu.1.temperature: 38.0C
>
> but none of those sysctl nodes are now present.
>
> CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4600+ (2400.10-MHz
> K8-class CPU)
>Origin = "AuthenticAMD"  Id = 0x20f32  Stepping = 2
>
> Features=0x178bfbffR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
> Features2=0x1
>AMD Features=0xe2500800
>AMD Features2=0x3
> ACPI APIC Table: 

Arg...  This is a Socket 939, Revision E processor and Revision C/D/E 
seems to have different DiodeOffset encoding.  Please try the 
attached patch until I fix it properly.

Sorry for the inconvenience.

Jung-uk Kim
--- sys/dev/amdtemp/amdtemp.c
+++ sys/dev/amdtemp/amdtemp.c
@@ -185,13 +185,6 @@ amdtemp_probe(device_t dev)
break;
case 0x10:
case 0x11:
-   /*
-* DiodeOffset must be non-zero if thermal diode is supported.
-*/
-   temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
-   temp = (temp >> 8) & 0x7f;
-   if (temp == 0)
-   return (ENXIO);
break;
default:
return (ENXIO);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r197191 - head/sys/dev/agp

2009-09-14 Thread Robert Noland
On Mon, 2009-09-14 at 13:16 +, Nick Hibma wrote:
> Author: n_hibma
> Date: Mon Sep 14 13:16:16 2009
> New Revision: 197191
> URL: http://svn.freebsd.org/changeset/base/197191
> 
> Log:
>   John Baldwin suggested that 'stolen memory' only happens in the case of
>   i810 and therefore is useful info there. Aperture size and stolen memory
>   are now printed on one line.
>   
>   Submitted by:   jhb

This is fine, thanks.

robert.

> Modified:
>   head/sys/dev/agp/agp_i810.c
> 
> Modified: head/sys/dev/agp/agp_i810.c
> ==
> --- head/sys/dev/agp/agp_i810.c   Mon Sep 14 11:46:43 2009
> (r197190)
> +++ head/sys/dev/agp/agp_i810.c   Mon Sep 14 13:16:16 2009
> (r197191)
> @@ -667,14 +667,12 @@ agp_i810_attach(device_t dev)
>   gatt->ag_physical = pgtblctl & ~1;
>   }
>  
> - if (bootverbose) {
> - device_printf(dev, "aperture size is %dM",
> - sc->initial_aperture / 1024 / 1024);
> - if (sc->stolen > 0)
> - printf(", detected %dk stolen memory\n", sc->stolen * 
> 4);
> - else
> - printf("\n");
> - }
> + device_printf(dev, "aperture size is %dM",
> + sc->initial_aperture / 1024 / 1024);
> + if (sc->stolen > 0)
> + printf(", detected %dk stolen memory\n", sc->stolen * 4);
> + else
> + printf("\n");
>  
>   if (0)
>   agp_i810_dump_regs(dev);
-- 
Robert Noland 
FreeBSD

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


svn commit: r197191 - head/sys/dev/agp

2009-09-14 Thread Nick Hibma
Author: n_hibma
Date: Mon Sep 14 13:16:16 2009
New Revision: 197191
URL: http://svn.freebsd.org/changeset/base/197191

Log:
  John Baldwin suggested that 'stolen memory' only happens in the case of
  i810 and therefore is useful info there. Aperture size and stolen memory
  are now printed on one line.
  
  Submitted by: jhb

Modified:
  head/sys/dev/agp/agp_i810.c

Modified: head/sys/dev/agp/agp_i810.c
==
--- head/sys/dev/agp/agp_i810.c Mon Sep 14 11:46:43 2009(r197190)
+++ head/sys/dev/agp/agp_i810.c Mon Sep 14 13:16:16 2009(r197191)
@@ -667,14 +667,12 @@ agp_i810_attach(device_t dev)
gatt->ag_physical = pgtblctl & ~1;
}
 
-   if (bootverbose) {
-   device_printf(dev, "aperture size is %dM",
-   sc->initial_aperture / 1024 / 1024);
-   if (sc->stolen > 0)
-   printf(", detected %dk stolen memory\n", sc->stolen * 
4);
-   else
-   printf("\n");
-   }
+   device_printf(dev, "aperture size is %dM",
+   sc->initial_aperture / 1024 / 1024);
+   if (sc->stolen > 0)
+   printf(", detected %dk stolen memory\n", sc->stolen * 4);
+   else
+   printf("\n");
 
if (0)
agp_i810_dump_regs(dev);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197190 - head/sys/dev/asmc

2009-09-14 Thread Rui Paulo
Author: rpaulo
Date: Mon Sep 14 11:46:43 2009
New Revision: 197190
URL: http://svn.freebsd.org/changeset/base/197190

Log:
  Make the sudden motion sensor work on older models and add a bit of
  debugging.
  
  Submitted by: Christoph Langguth 
  MFC after:1 week

Modified:
  head/sys/dev/asmc/asmc.c
  head/sys/dev/asmc/asmcvar.h

Modified: head/sys/dev/asmc/asmc.c
==
--- head/sys/dev/asmc/asmc.cMon Sep 14 11:20:45 2009(r197189)
+++ head/sys/dev/asmc/asmc.cMon Sep 14 11:46:43 2009(r197190)
@@ -86,6 +86,10 @@ static void  asmc_sms_handler(void *arg)
 #endif
 static voidasmc_sms_printintr(device_t dev, uint8_t);
 static voidasmc_sms_task(void *arg, int pending);
+#ifdef DEBUG
+void   asmc_dumpall(device_t);
+static int asmc_key_dump(device_t, int);
+#endif
 
 /*
  * Model functions.
@@ -532,6 +536,17 @@ asmc_detach(device_t dev)
return (0);
 }
 
+#ifdef DEBUG
+void asmc_dumpall(device_t dev)
+{
+   int i;
+
+   /* XXX magic number */
+   for (i=0; i < 0x100; i++)
+   asmc_key_dump(dev, i);
+}
+#endif
+
 static int
 asmc_init(device_t dev)
 {
@@ -584,13 +599,17 @@ asmc_init(device_t dev)
asmc_key_write(dev, ASMC_KEY_SMS_FLAG, buf, 1);
DELAY(100);
 
+   sc->sc_sms_intr_works = 0;
+   
/*
-* Wait up to 5 seconds for SMS initialization.
+* Retry SMS initialization 1000 times
+* (takes approx. 2 seconds in worst case)
 */
-   for (i = 0; i < 1; i++) {
+   for (i = 0; i < 1000; i++) {
if (asmc_key_read(dev, ASMC_KEY_SMS, buf, 2) == 0 && 
-   (buf[0] != 0x00 || buf[1] != 0x00)) {
+   (buf[0] == ASMC_SMS_INIT1 && buf[1] == ASMC_SMS_INIT2)) {
error = 0;
+   sc->sc_sms_intr_works = 1;
goto out;
}
buf[0] = ASMC_SMS_INIT1;
@@ -620,6 +639,10 @@ nosms:
device_printf(dev, "number of keys: %d\n", buf[3]);
} 
 
+#ifdef DEBUG
+   asmc_dumpall(dev);
+#endif
+
return (error);
 }
 
@@ -729,6 +752,99 @@ out:
return (error);
 }
 
+#ifdef DEBUG
+static int
+asmc_key_dump(device_t dev, int number)
+{
+   struct asmc_softc *sc = device_get_softc(dev);
+   char key[5] = { 0 };
+   char type[7] = { 0 };
+   uint8_t index[4];
+   uint8_t v[32];
+   uint8_t maxlen;
+   int i, error = 1, try = 0;
+
+   mtx_lock_spin(&sc->sc_mtx);
+
+   index[0] = (number >> 24) & 0xff;
+   index[1] = (number >> 16) & 0xff;
+   index[2] = (number >> 8) & 0xff;
+   index[3] = (number) & 0xff;
+
+begin:
+   if (asmc_command(dev, 0x12))
+   goto out;
+
+   for (i = 0; i < 4; i++) {
+   ASMC_DATAPORT_WRITE(sc, index[i]);
+   if (asmc_wait(dev, 0x04))
+   goto out;
+   }
+
+   ASMC_DATAPORT_WRITE(sc, 4);
+
+   for (i = 0; i < 4; i++) {
+   if (asmc_wait(dev, 0x05))
+   goto out;
+   key[i] = ASMC_DATAPORT_READ(sc);
+   }
+
+   /* get type */
+   if (asmc_command(dev, 0x13))
+   goto out;
+
+   for (i = 0; i < 4; i++) {
+   ASMC_DATAPORT_WRITE(sc, key[i]);
+   if (asmc_wait(dev, 0x04))
+   goto out;
+   }
+
+   ASMC_DATAPORT_WRITE(sc, 6);
+
+   for (i = 0; i < 6; i++) {
+   if (asmc_wait(dev, 0x05))
+   goto out;
+   type[i] = ASMC_DATAPORT_READ(sc);
+   }
+
+   error = 0;
+out:
+   if (error) {
+   if (++try < 10) goto begin;
+   device_printf(dev,"%s for key %s failed %d times, giving up\n",
+   __func__, key, try);
+   mtx_unlock_spin(&sc->sc_mtx);
+   }
+   else {
+   char buf[1024];
+   char buf2[8];
+   mtx_unlock_spin(&sc->sc_mtx);
+   maxlen = type[0];
+   type[0] = ' ';
+   type[5] = 0;
+   if (maxlen > sizeof(v)) {   
+   device_printf(dev, "WARNING: cropping maxlen "
+   "from %d to %lud\n", maxlen, sizeof(v));
+   maxlen = sizeof(v);
+   }
+   for (i = 0; i < sizeof(v); i++) {
+   v[i] = 0;
+   }
+   asmc_key_read(dev, key, v, maxlen);
+   snprintf(buf, sizeof(buf), "key %d is: %s, type %s "
+   "(len %d), data", number, key, type, maxlen);
+   for (i = 0; i < maxlen; i++) {
+   snprintf(buf2, sizeof(buf), " %02x", v[i]);
+   strlcat(buf, buf2, sizeof(buf));
+   }
+   strlcat(buf, " \n", sizeof(buf));
+   device_printf(dev, buf)

svn commit: r197189 - head/lib/libc/stdtime

2009-09-14 Thread Edwin Groothuis
Author: edwin
Date: Mon Sep 14 11:20:45 2009
New Revision: 197189
URL: http://svn.freebsd.org/changeset/base/197189

Log:
  Improve the way failure of pthread_key_create() gets detected.
  
  PR:   threads/138603
  Submitted by: Mikulas Patocka
  MFC after:1 week

Modified:
  head/lib/libc/stdtime/localtime.c

Modified: head/lib/libc/stdtime/localtime.c
==
--- head/lib/libc/stdtime/localtime.c   Mon Sep 14 11:01:15 2009
(r197188)
+++ head/lib/libc/stdtime/localtime.c   Mon Sep 14 11:20:45 2009
(r197189)
@@ -21,6 +21,7 @@ __FBSDID("$FreeBSD$");
 #include "namespace.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "private.h"
@@ -1413,13 +1414,16 @@ const time_t * consttimep;
static pthread_mutex_t localtime_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t localtime_key = -1;
struct tm *p_tm;
+   int r;
 
if (__isthreaded != 0) {
if (localtime_key < 0) {
_pthread_mutex_lock(&localtime_mutex);
if (localtime_key < 0) {
-   if (_pthread_key_create(&localtime_key, free) < 
0) {
+   if ((r = _pthread_key_create(&localtime_key,
+   free)) != 0) {
_pthread_mutex_unlock(&localtime_mutex);
+   errno = r;
return(NULL);
}
}
@@ -1512,13 +1516,16 @@ const time_t * consttimep;
static pthread_mutex_t gmtime_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_key_t gmtime_key = -1;
struct tm *p_tm;
+   int r;
 
if (__isthreaded != 0) {
if (gmtime_key < 0) {
_pthread_mutex_lock(&gmtime_mutex);
if (gmtime_key < 0) {
-   if (_pthread_key_create(&gmtime_key, free) < 0) 
{
+   if ((r = _pthread_key_create(&gmtime_key,
+   free)) != 0) {
_pthread_mutex_unlock(&gmtime_mutex);
+   errno = r;
return(NULL);
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197188 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/xen/xenpci fs/pseudofs

2009-09-14 Thread Konstantin Belousov
Author: kib
Date: Mon Sep 14 11:01:15 2009
New Revision: 197188
URL: http://svn.freebsd.org/changeset/base/197188

Log:
  MFC r196921:
  Do not decrement pfs_vncache_entries for the vnode that was not in the
  pfs_vncache list.
  
  Approved by:  re (bz)

Modified:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/coretemp/coretemp.c   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)
  stable/8/sys/fs/pseudofs/pseudofs_vncache.c

Modified: stable/8/sys/fs/pseudofs/pseudofs_vncache.c
==
--- stable/8/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 14 08:04:48 2009
(r197187)
+++ stable/8/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 14 11:01:15 2009
(r197188)
@@ -246,11 +246,13 @@ pfs_vncache_free(struct vnode *vp)
KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n"));
if (pvd->pvd_next)
pvd->pvd_next->pvd_prev = pvd->pvd_prev;
-   if (pvd->pvd_prev)
+   if (pvd->pvd_prev) {
pvd->pvd_prev->pvd_next = pvd->pvd_next;
-   else if (pfs_vncache == pvd)
+   --pfs_vncache_entries;
+   } else if (pfs_vncache == pvd) {
pfs_vncache = pvd->pvd_next;
-   --pfs_vncache_entries;
+   --pfs_vncache_entries;
+   }
mtx_unlock(&pfs_vncache_mutex);
 
free(pvd, M_PFSVNCACHE);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"