svn commit: r260222 - head/lib/libnv

2014-01-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan  3 09:07:03 2014
New Revision: 260222
URL: http://svnweb.freebsd.org/changeset/base/260222

Log:
  MFp4 @1189711:
  
  Fix resource leaks on nvlist_destroy().
  
  Reported by:  Mariusz Zaborski 
  MFC after:3 days

Modified:
  head/lib/libnv/nvlist.c

Modified: head/lib/libnv/nvlist.c
==
--- head/lib/libnv/nvlist.c Fri Jan  3 08:31:42 2014(r260221)
+++ head/lib/libnv/nvlist.c Fri Jan  3 09:07:03 2014(r260222)
@@ -125,8 +125,10 @@ nvlist_destroy(nvlist_t *nvl)
 
NVLIST_ASSERT(nvl);
 
-   while ((nvp = nvlist_first_nvpair(nvl)) != NULL)
+   while ((nvp = nvlist_first_nvpair(nvl)) != NULL) {
nvlist_remove_nvpair(nvl, nvp);
+   nvpair_free(nvp);
+   }
nvl->nvl_magic = 0;
free(nvl);
 
___
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: r260223 - head/lib/libcasper

2014-01-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Fri Jan  3 09:10:04 2014
New Revision: 260223
URL: http://svnweb.freebsd.org/changeset/base/260223

Log:
  MFp4 @1189741:
  
  - Add missing nvlist_destroy().
  - Don't override nvlout.
  
  Submitted by: Mariusz Zaborski 
  MFC after:3 days

Modified:
  head/lib/libcasper/libcasper.c

Modified: head/lib/libcasper/libcasper.c
==
--- head/lib/libcasper/libcasper.c  Fri Jan  3 09:07:03 2014
(r260222)
+++ head/lib/libcasper/libcasper.c  Fri Jan  3 09:10:04 2014
(r260223)
@@ -348,7 +348,6 @@ service_message(struct service *service,
error = 0;
}
} else {
-   nvlout = nvlist_create(0);
error = service->s_command(cmd,
service_connection_get_limits(sconn), nvlin, nvlout);
}
@@ -362,8 +361,9 @@ service_message(struct service *service,
if (cap_send_nvlist(service_connection_get_chan(sconn), nvlout) == -1) {
pjdlog_errno(LOG_ERR, "Unable to send message to client");
service_connection_remove(service, sconn);
-   return;
}
+
+   nvlist_destroy(nvlout);
 }
 
 static int
___
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: r260163 - head/sys/dev/ahci

2014-01-03 Thread Zbigniew Bodek
2014/1/2 John Baldwin :
> On Wednesday, January 01, 2014 3:18:03 pm Zbigniew Bodek wrote:
>> Author: zbb
>> Date: Wed Jan  1 20:18:03 2014
>> New Revision: 260163
>> URL: http://svnweb.freebsd.org/changeset/base/260163
>>
>> Log:
>>   Do not attach to PCI bridges in AHCI driver
>>
>>   Some vendors use the same VID:PID combination in AHCI and PCI bridge cards
>
> Would it be better to require the class to be PCIC_STORAGE instead?
>
> --
> John Baldwin

Hello John.

As you can see this is required indirectly when "checking for possible
AHCI candidate" but in the loop below the device can still be probed.
I will need to contact the person from "Submitted by" to ensure
whether adding AHCI_Q_NOFORCE quirk is not going to solve this issue
instead.

Best regards
zbb
___
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: r260224 - head/sys/netinet

2014-01-03 Thread Gleb Smirnoff
Author: glebius
Date: Fri Jan  3 11:03:12 2014
New Revision: 260224
URL: http://svnweb.freebsd.org/changeset/base/260224

Log:
  Make failure of ifpromisc() a non-fatal error. This makes it possible to
  run carp(4) on vtnet(4).
  
  Sponsored by: Nginx, Inc.

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Jan  3 09:10:04 2014(r260223)
+++ head/sys/netinet/ip_carp.c  Fri Jan  3 11:03:12 2014(r260224)
@@ -145,6 +145,8 @@ struct carp_if {
 #endif
struct ifnet*cif_ifp;
struct mtx  cif_mtx;
+   uint32_tcif_flags;
+#defineCIF_PROMISC 0x0001
 };
 
 #defineCARP_INET   0
@@ -1483,11 +1485,8 @@ carp_alloc(struct ifnet *ifp)
struct carp_softc *sc;
struct carp_if *cif;
 
-   if ((cif = ifp->if_carp) == NULL) {
+   if ((cif = ifp->if_carp) == NULL)
cif = carp_alloc_if(ifp);
-   if (cif == NULL)
-   return (NULL);
-   }
 
sc = malloc(sizeof(*sc), M_CARP, M_WAITOK|M_ZERO);
 
@@ -1572,11 +1571,15 @@ static struct carp_if*
 carp_alloc_if(struct ifnet *ifp)
 {
struct carp_if *cif;
+   int error;
 
cif = malloc(sizeof(*cif), M_CARP, M_WAITOK|M_ZERO);
 
-   if (ifpromisc(ifp, 1) != 0)
-   goto cleanup;
+   if ((error = ifpromisc(ifp, 1)) != 0)
+   printf("%s: ifpromisc(%s) failed: %d\n",
+   __func__, ifp->if_xname, error);
+   else
+   cif->cif_flags |= CIF_PROMISC;
 
CIF_LOCK_INIT(cif);
cif->cif_ifp = ifp;
@@ -1588,11 +1591,6 @@ carp_alloc_if(struct ifnet *ifp)
IF_ADDR_WUNLOCK(ifp);
 
return (cif);
-
-cleanup:
-   free(cif, M_CARP);
-
-   return (NULL);
 }
 
 static void
@@ -1610,7 +1608,8 @@ carp_free_if(struct carp_if *cif)
 
CIF_LOCK_DESTROY(cif);
 
-   ifpromisc(ifp, 0);
+   if (cif->cif_flags & CIF_PROMISC)
+   ifpromisc(ifp, 0);
if_rele(ifp);
 
free(cif, M_CARP);
@@ -1683,11 +1682,6 @@ carp_ioctl(struct ifreq *ifr, u_long cmd
}
if (sc == NULL) {
sc = carp_alloc(ifp);
-   if (sc == NULL) {
-   error = EINVAL; /* XXX: ifpromisc failed */
-   break;
-   }
-
CARP_LOCK(sc);
sc->sc_vhid = carpr.carpr_vhid;
LLADDR(&sc->sc_addr)[0] = 0;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r260225 - head/sys/netgraph

2014-01-03 Thread Gleb Smirnoff
Author: glebius
Date: Fri Jan  3 12:06:54 2014
New Revision: 260225
URL: http://svnweb.freebsd.org/changeset/base/260225

Log:
  Fix circular math macro.
  
  Submitted by: Lutz Donnerhacke via Dmitry Luhtionov
  German lesson at: 
http://lutz.donnerhacke.de/Blog/Der-Fluch-der-Stabilitaet
  PR:   146082

Modified:
  head/sys/netgraph/ng_l2tp.c

Modified: head/sys/netgraph/ng_l2tp.c
==
--- head/sys/netgraph/ng_l2tp.c Fri Jan  3 11:03:12 2014(r260224)
+++ head/sys/netgraph/ng_l2tp.c Fri Jan  3 12:06:54 2014(r260225)
@@ -98,7 +98,7 @@ static MALLOC_DEFINE(M_NETGRAPH_L2TP, "n
 #define L2TP_ENABLE_DSEQ   1   /* enable data seq # */
 
 /* Compare sequence numbers using circular math */
-#define L2TP_SEQ_DIFF(x, y)((int)((int16_t)(x) - (int16_t)(y)))
+#define L2TP_SEQ_DIFF(x, y)((int16_t)((x) - (y)))
 
 #define SESSHASHSIZE   0x0020
 #define SESSHASH(x)(((x) ^ ((x) >> 8)) & (SESSHASHSIZE - 1))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r260228 - head/sys/net

2014-01-03 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri Jan  3 14:33:25 2014
New Revision: 260228
URL: http://svnweb.freebsd.org/changeset/base/260228

Log:
  Remove useless register variable modifiers.
  Do some more style(9).
  
  MFC after:2 weeks

Modified:
  head/sys/net/radix.c

Modified: head/sys/net/radix.c
==
--- head/sys/net/radix.cFri Jan  3 14:30:24 2014(r260227)
+++ head/sys/net/radix.cFri Jan  3 14:33:25 2014(r260228)
@@ -148,12 +148,10 @@ static intrn_satisfies_leaf(char *trial
  * Search a node in the tree matching the key.
  */
 static struct radix_node *
-rn_search(v_arg, head)
-   void *v_arg;
-   struct radix_node *head;
+rn_search(void *v_arg, struct radix_node *head)
 {
-   register struct radix_node *x;
-   register caddr_t v;
+   struct radix_node *x;
+   caddr_t v;
 
for (x = head, v = v_arg; x->rn_bit >= 0;) {
if (x->rn_bmask & v[x->rn_offset])
@@ -169,12 +167,10 @@ rn_search(v_arg, head)
  * XXX note this function is used only once.
  */
 static struct radix_node *
-rn_search_m(v_arg, head, m_arg)
-   struct radix_node *head;
-   void *v_arg, *m_arg;
+rn_search_m(void *v_arg, struct radix_node *head, void *m_arg)
 {
-   register struct radix_node *x;
-   register caddr_t v = v_arg, m = m_arg;
+   struct radix_node *x;
+   caddr_t v = v_arg, m = m_arg;
 
for (x = head; x->rn_bit >= 0;) {
if ((x->rn_bmask & m[x->rn_offset]) &&
@@ -183,15 +179,14 @@ rn_search_m(v_arg, head, m_arg)
else
x = x->rn_left;
}
-   return x;
+   return (x);
 }
 
 int
-rn_refines(m_arg, n_arg)
-   void *m_arg, *n_arg;
+rn_refines(void *m_arg, void *n_arg)
 {
-   register caddr_t m = m_arg, n = n_arg;
-   register caddr_t lim, lim2 = lim = n + LEN(n);
+   caddr_t m = m_arg, n = n_arg;
+   caddr_t lim, lim2 = lim = n + LEN(n);
int longer = LEN(n++) - LEN(m++);
int masks_are_equal = 1;
 
@@ -199,26 +194,24 @@ rn_refines(m_arg, n_arg)
lim -= longer;
while (n < lim) {
if (*n & ~(*m))
-   return 0;
+   return (0);
if (*n++ != *m++)
masks_are_equal = 0;
}
while (n < lim2)
if (*n++)
-   return 0;
+   return (0);
if (masks_are_equal && (longer < 0))
for (lim2 = m - longer; m < lim2; )
if (*m++)
-   return 1;
+   return (1);
return (!masks_are_equal);
 }
 
 struct radix_node *
-rn_lookup(v_arg, m_arg, head)
-   void *v_arg, *m_arg;
-   struct radix_node_head *head;
+rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
 {
-   register struct radix_node *x;
+   struct radix_node *x;
caddr_t netmask = 0;
 
if (m_arg) {
@@ -233,16 +226,13 @@ rn_lookup(v_arg, m_arg, head)
while (x && x->rn_mask != netmask)
x = x->rn_dupedkey;
}
-   return x;
+   return (x);
 }
 
 static int
-rn_satisfies_leaf(trial, leaf, skip)
-   char *trial;
-   register struct radix_node *leaf;
-   int skip;
+rn_satisfies_leaf(char *trial, struct radix_node *leaf, int skip)
 {
-   register char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask;
+   char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask;
char *cplim;
int length = min(LEN(cp), LEN(cp2));
 
@@ -253,22 +243,20 @@ rn_satisfies_leaf(trial, leaf, skip)
cplim = cp + length; cp3 += skip; cp2 += skip;
for (cp += skip; cp < cplim; cp++, cp2++, cp3++)
if ((*cp ^ *cp2) & *cp3)
-   return 0;
-   return 1;
+   return (0);
+   return (1);
 }
 
 struct radix_node *
-rn_match(v_arg, head)
-   void *v_arg;
-   struct radix_node_head *head;
+rn_match(void *v_arg, struct radix_node_head *head)
 {
caddr_t v = v_arg;
-   register struct radix_node *t = head->rnh_treetop, *x;
-   register caddr_t cp = v, cp2;
+   struct radix_node *t = head->rnh_treetop, *x;
+   caddr_t cp = v, cp2;
caddr_t cplim;
struct radix_node *saved_t, *top = t;
int off = t->rn_offset, vlen = LEN(cp), matched_off;
-   register int test, b, rn_bit;
+   int test, b, rn_bit;
 
/*
 * Open code rn_search(v, top) to avoid overhead of extra
@@ -306,7 +294,7 @@ rn_match(v_arg, head)
 */
if (t->rn_flags & RNF_ROOT)
t = t->rn_dupedkey;
-   return t;
+   return (t);
 on1:
test = (*cp ^ *cp2) & 0xff; /* find first bit that differs */
for (b = 7; (test >>= 1) > 0;)
@@ -327,13 +315,13 @@ on1:
 */
  

svn commit: r260229 - in head/sys: fs/nfs fs/nfsserver rpc

2014-01-03 Thread Alexander Motin
Author: mav
Date: Fri Jan  3 15:09:59 2014
New Revision: 260229
URL: http://svnweb.freebsd.org/changeset/base/260229

Log:
  Rework NFS Duplicate Request Cache cleanup logic.
  
   - Introduce additional hash to group requests by hash of sockref.  This
  allows to process TCP acknowledgements without looping though all the cache,
  and as result allows to do it every time.
   - Indroduce additional callbacks to notify application layer about sockets
  disconnection.  Without this last few requests processed just before socket
  disconnection never processed their ACKs and stuck in cache for many hours.
   - Implement transport-specific method for tracking reply acknowledgements.
  New implementation does not cross multiple stack layers to get the data and
  does not have race conditions that previously made some requests stuck
  in cache.  This could be done more efficiently at sockbuf layer, but that
  would broke some KBIs, while I don't know other consumers for it aside NFS.
   - Instead of traversing all DRC twice per request, run cleaning only once
  per request, and except in some conditions traverse only single hash slot
  at a time.
  
  Together this limits NFS DRC growth only to situations of real connectivity
  problems.  If network is working well, and so all replies are acknowledged,
  cache remains almost empty even after hours of heavy load.  Without this
  change on the same test cache was growing to many thousand requests even
  with perfectly working local network.
  
  As another result this reduces CPU time spent on the DRC handling during
  SPEC NFS benchmark from about 10% to 0.5%.
  
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfs/nfsrvcache.h
  head/sys/fs/nfsserver/nfs_nfsdcache.c
  head/sys/fs/nfsserver/nfs_nfsdkrpc.c
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdsubs.c
  head/sys/rpc/svc.c
  head/sys/rpc/svc.h
  head/sys/rpc/svc_dg.c
  head/sys/rpc/svc_vc.c

Modified: head/sys/fs/nfs/nfs_var.h
==
--- head/sys/fs/nfs/nfs_var.h   Fri Jan  3 14:33:25 2014(r260228)
+++ head/sys/fs/nfs/nfs_var.h   Fri Jan  3 15:09:59 2014(r260229)
@@ -218,14 +218,14 @@ void nfsrvd_dorpc(struct nfsrv_descript 
 
 /* nfs_nfsdcache.c */
 void nfsrvd_initcache(void);
-int nfsrvd_getcache(struct nfsrv_descript *, struct socket *);
-struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *,
-struct socket *);
-void nfsrvd_sentcache(struct nfsrvcache *, struct socket *, int);
+int nfsrvd_getcache(struct nfsrv_descript *);
+struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *);
+void nfsrvd_sentcache(struct nfsrvcache *, uint32_t);
 void nfsrvd_cleancache(void);
 void nfsrvd_refcache(struct nfsrvcache *);
 void nfsrvd_derefcache(struct nfsrvcache *);
 void nfsrvd_delcache(struct nfsrvcache *);
+void nfsrc_trimcache(uint64_t, uint32_t, int);
 
 /* nfs_commonsubs.c */
 void newnfs_init(void);
@@ -327,9 +327,6 @@ int nfsd_checkrootexp(struct nfsrv_descr
 void nfscl_retopts(struct nfsmount *, char *, size_t);
 
 /* nfs_commonport.c */
-int nfsrv_checksockseqnum(struct socket *, tcp_seq);
-int nfsrv_getsockseqnum(struct socket *, tcp_seq *);
-int nfsrv_getsocksndseq(struct socket *, tcp_seq *, tcp_seq *);
 int nfsrv_lookupfilename(struct nameidata *, char *, NFSPROC_T *);
 void nfsrv_object_create(vnode_t, NFSPROC_T *);
 int nfsrv_mallocmget_limit(void);

Modified: head/sys/fs/nfs/nfsrvcache.h
==
--- head/sys/fs/nfs/nfsrvcache.hFri Jan  3 14:33:25 2014
(r260228)
+++ head/sys/fs/nfs/nfsrvcache.hFri Jan  3 15:09:59 2014
(r260229)
@@ -46,6 +46,7 @@
 /* Cache table entry. */
 struct nfsrvcache {
LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */
+   LIST_ENTRY(nfsrvcache) rc_ahash;/* ACK hash chain */
TAILQ_ENTRY(nfsrvcache) rc_lru; /* UDP lru chain */
u_int32_t   rc_xid; /* rpc id number */
time_t  rc_timestamp;   /* Time done */
@@ -64,6 +65,7 @@ struct nfsrvcache {
int16_t refcnt;
u_int16_t   cksum;
time_t  cachetime;
+   int acked;
} ot;
} rc_un2;
u_int16_t   rc_proc;/* rpc proc number */
@@ -81,6 +83,13 @@ struct nfsrvcache {
 #definerc_reqlen   rc_un2.ot.len
 #definerc_cksumrc_un2.ot.cksum
 #definerc_cachetimerc_un2.ot.cachetime
+#definerc_ackedrc_un2.ot.acked
+
+/* TCP ACK values */
+#defineRC_NO_SEQ   0
+#defineRC_NO_ACK   1
+#defineRC_ACK  2
+#defineRC_NACK 3
 
 /* Return values */
 #defineRC_DROPIT   0
@@

svn commit: r260232 - head/sys/kern

2014-01-03 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan  3 16:34:16 2014
New Revision: 260232
URL: http://svnweb.freebsd.org/changeset/base/260232

Log:
  Don't check for fd limits in fdgrowtable_exp.
  
  Callers do that already and additional check races with process
  decreasing limits and can result in not growing the table at all, which
  is currently not handled.
  
  MFC after:3 days

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cFri Jan  3 15:55:20 2014
(r260231)
+++ head/sys/kern/kern_descrip.cFri Jan  3 16:34:16 2014
(r260232)
@@ -1481,18 +1481,13 @@ filecaps_validate(const struct filecaps 
 static void
 fdgrowtable_exp(struct filedesc *fdp, int nfd)
 {
-   int nfd1, maxfd;
+   int nfd1;
 
FILEDESC_XLOCK_ASSERT(fdp);
 
nfd1 = fdp->fd_nfiles * 2;
if (nfd1 < nfd)
nfd1 = nfd;
-   maxfd = getmaxfd(curproc);
-   if (maxfd < nfd1)
-   nfd1 = maxfd;
-   KASSERT(nfd <= nfd1,
-   ("too low nfd1 %d %d %d %d", nfd, fdp->fd_nfiles, maxfd, nfd1));
fdgrowtable(fdp, nfd1);
 }
 
___
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: r260233 - head/sys/kern

2014-01-03 Thread Mateusz Guzik
Author: mjg
Date: Fri Jan  3 16:36:55 2014
New Revision: 260233
URL: http://svnweb.freebsd.org/changeset/base/260233

Log:
  Plug a memory leak in dup2 when both old and new fd have ioctl caps.
  
  Reviewed by:  pjd
  MFC after:3 days

Modified:
  head/sys/kern/kern_descrip.c

Modified: head/sys/kern/kern_descrip.c
==
--- head/sys/kern/kern_descrip.cFri Jan  3 16:34:16 2014
(r260232)
+++ head/sys/kern/kern_descrip.cFri Jan  3 16:36:55 2014
(r260233)
@@ -878,6 +878,7 @@ do_dup(struct thread *td, int flags, int
/*
 * Duplicate the source descriptor.
 */
+   filecaps_free(&newfde->fde_caps);
*newfde = *oldfde;
filecaps_copy(&oldfde->fde_caps, &newfde->fde_caps);
if ((flags & DUP_CLOEXEC) != 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r260165 - head/sys/dev/ahci

2014-01-03 Thread Ian Lepore
On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote:
> On Wed, Jan 01, 2014 at 08:26:08PM +, Zbigniew Bodek wrote:
> > Author: zbb
> > Date: Wed Jan  1 20:26:08 2014
> > New Revision: 260165
> > URL: http://svnweb.freebsd.org/changeset/base/260165
> > 
> > Log:
> >   Use only mapped BIOs on ARM
> >   
> >   Using unmapped BIOs causes failure inside bus_dmamap_sync, since
> >   this function requires valid MVA address, which is not present
> >   if mapping is not set up.
> >   
> >   Submitted by: Wojciech Macek 
> >   Obtained from:Semihalf
> > 
> > Modified:
> >   head/sys/dev/ahci/ahci.c
> > 
> > Modified: head/sys/dev/ahci/ahci.c
> > ==
> > --- head/sys/dev/ahci/ahci.cWed Jan  1 20:22:29 2014
> > (r260164)
> > +++ head/sys/dev/ahci/ahci.cWed Jan  1 20:26:08 2014
> > (r260165)
> > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc
> > if (ch->caps & AHCI_CAP_SPM)
> > cpi->hba_inquiry |= PI_SATAPM;
> > cpi->target_sprt = 0;
> > +#ifdef __arm__
> > +   /*
> > +* Do not use unmapped buffers on ARM. Doing so will cause
> > +* failure inside bus_dmamap_sync due to lack of VA.
> > +*/
> > +   cpi->hba_misc = PIM_SEQSCAN;
> > +#else
> > cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
> > +#endif
> > cpi->hba_eng_cnt = 0;
> > if (ch->caps & AHCI_CAP_SPM)
> > cpi->max_target = 15;
> 
> I think this is wrong. If bus_dmamap_sync(9) is not functional on arm,
> then unmapped io should be disabled on arm unconditionally, using
> unmapped_buf_allowed.  Why ahci(4) is special in this regard, leaving
> other controllers broken for arm ?

I think this entire concept is wrong, and the fix should be in armv6
busdma or pmap code.  An unmapped page is, by definition, not cached.
The only way data becomes cached is because flags in a mapping indicated
the memory is cacheable.  If we have data from unmapped pages in the
cache, that's a bug in the armv6 pmap implementation, I think.

-- Ian


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

2014-01-03 Thread Alexander Motin
Author: mav
Date: Fri Jan  3 18:08:31 2014
New Revision: 260234
URL: http://svnweb.freebsd.org/changeset/base/260234

Log:
  Remove extra conversion to nanoseconds from ddi_get_lbolt64().
  
  As result this uses one multiplication and shifts instead of one division
  and two multiplications.

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

Modified: head/sys/cddl/compat/opensolaris/sys/time.h
==
--- head/sys/cddl/compat/opensolaris/sys/time.h Fri Jan  3 16:36:55 2014
(r260233)
+++ head/sys/cddl/compat/opensolaris/sys/time.h Fri Jan  3 18:08:31 2014
(r260234)
@@ -70,12 +70,13 @@ gethrtime(void) {
 #definegethrtime_waitfree()gethrtime()
 
 extern int nsec_per_tick;  /* nanoseconds per clock tick */
+extern int hz; /* clock ticks per second */
 
 static __inline int64_t
 ddi_get_lbolt64(void)
 {
 
-   return (gethrtime() / nsec_per_tick);
+   return (((getsbinuptime() >> 16) * hz) >> 16);
 }
 
 static __inline clock_t
___
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: r260165 - head/sys/dev/ahci

2014-01-03 Thread Konstantin Belousov
On Fri, Jan 03, 2014 at 09:49:12AM -0700, Ian Lepore wrote:
> On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote:
> > On Wed, Jan 01, 2014 at 08:26:08PM +, Zbigniew Bodek wrote:
> > > Author: zbb
> > > Date: Wed Jan  1 20:26:08 2014
> > > New Revision: 260165
> > > URL: http://svnweb.freebsd.org/changeset/base/260165
> > > 
> > > Log:
> > >   Use only mapped BIOs on ARM
> > >   
> > >   Using unmapped BIOs causes failure inside bus_dmamap_sync, since
> > >   this function requires valid MVA address, which is not present
> > >   if mapping is not set up.
> > >   
> > >   Submitted by:   Wojciech Macek 
> > >   Obtained from:  Semihalf
> > > 
> > > Modified:
> > >   head/sys/dev/ahci/ahci.c
> > > 
> > > Modified: head/sys/dev/ahci/ahci.c
> > > ==
> > > --- head/sys/dev/ahci/ahci.c  Wed Jan  1 20:22:29 2014
> > > (r260164)
> > > +++ head/sys/dev/ahci/ahci.c  Wed Jan  1 20:26:08 2014
> > > (r260165)
> > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc
> > >   if (ch->caps & AHCI_CAP_SPM)
> > >   cpi->hba_inquiry |= PI_SATAPM;
> > >   cpi->target_sprt = 0;
> > > +#ifdef __arm__
> > > + /*
> > > +  * Do not use unmapped buffers on ARM. Doing so will cause
> > > +  * failure inside bus_dmamap_sync due to lack of VA.
> > > +  */
> > > + cpi->hba_misc = PIM_SEQSCAN;
> > > +#else
> > >   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
> > > +#endif
> > >   cpi->hba_eng_cnt = 0;
> > >   if (ch->caps & AHCI_CAP_SPM)
> > >   cpi->max_target = 15;
> > 
> > I think this is wrong. If bus_dmamap_sync(9) is not functional on arm,
> > then unmapped io should be disabled on arm unconditionally, using
> > unmapped_buf_allowed.  Why ahci(4) is special in this regard, leaving
> > other controllers broken for arm ?
> 
> I think this entire concept is wrong, and the fix should be in armv6
> busdma or pmap code.  An unmapped page is, by definition, not cached.
> The only way data becomes cached is because flags in a mapping indicated
> the memory is cacheable.  If we have data from unmapped pages in the
> cache, that's a bug in the armv6 pmap implementation, I think.

I agree with the statement that the fix must be in busdma MD code,
possibly with some cooperation with pmap code. On the other hand, I do
not understand later claims.

BIO unmapped attribute only means that bio does not carry a pointer to
(some) mapping of the bio_ma pages. In other words, unmapped BIO does
not imply globally unmapped page, and CPU cache might contain the lines
from the BIO pages.


pgpIGark2z2SK.pgp
Description: PGP signature


svn commit: r260235 - head/sys/boot/fdt/dts

2014-01-03 Thread Ian Lepore
Author: ian
Date: Fri Jan  3 18:36:19 2014
New Revision: 260235
URL: http://svnweb.freebsd.org/changeset/base/260235

Log:
  Update the dockstar DTS to reflect just NAND flash (no SPI NOR flash, and
  the LED specification was just misplaced).  The rather odd memory mappings
  that were in place used an undocumented attribute value (0x0f) that caused
  problems with the system.
  
  Submitted by: Markus Pfeiffer 

Modified:
  head/sys/boot/fdt/dts/dockstar.dts

Modified: head/sys/boot/fdt/dts/dockstar.dts
==
--- head/sys/boot/fdt/dts/dockstar.dts  Fri Jan  3 18:08:31 2014
(r260234)
+++ head/sys/boot/fdt/dts/dockstar.dts  Fri Jan  3 18:36:19 2014
(r260235)
@@ -76,44 +76,17 @@
#size-cells = <1>;
compatible = "mrvl,lbc";
 
-   /* This reflects CPU decode windows setup. */
-   ranges = <0x0 0x0f 0xf930 0x0010
- 0x1 0x1e 0xfa00 0x0010
- 0x2 0x1d 0xfa10 0x0200
- 0x3 0x1b 0xfc10 0x0400>;
+   /* This reflects CPU decode windows setup for NAND access. */
+   ranges = <0x0 0x2f 0xf930 0x0010>;
 
-   nor@0,0 {
+   nand@0,0 {
#address-cells = <1>;
#size-cells = <1>;
-   compatible = "cfi-flash";
+   compatible = "mrvl,nfc";
reg = <0x0 0x0 0x0010>;
bank-width = <2>;
device-width = <1>;
};
-
-   led@1,0 {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   compatible = "led";
-   reg = <0x1 0x0 0x0010>;
-   };
-
-   nor@2,0 {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   compatible = "cfi-flash";
-   reg = <0x2 0x0 0x0200>;
-   bank-width = <2>;
-   device-width = <1>;
-   };
-
-   nand@3,0 {
-   #address-cells = <1>;
-   #size-cells = <1>;
-   reg = <0x3 0x0 0x0010>;
-   bank-width = <2>;
-   device-width = <1>;
-   };
};
 
SOC: soc88f6281@f100 {
___
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: r260236 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-01-03 Thread Alexander Motin
Author: mav
Date: Fri Jan  3 18:44:37 2014
New Revision: 260236
URL: http://svnweb.freebsd.org/changeset/base/260236

Log:
  In dmu_zfetch_stream_reclaim() replace division with multiplication and
  move it out of the loop and lock.

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.cFri Jan 
 3 18:36:19 2014(r260235)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.cFri Jan 
 3 18:44:37 2014(r260236)
@@ -604,14 +604,16 @@ static zstream_t *
 dmu_zfetch_stream_reclaim(zfetch_t *zf)
 {
zstream_t   *zs;
+   clock_t ticks;
 
+   ticks = zfetch_min_sec_reap * hz;
if (! rw_tryenter(&zf->zf_rwlock, RW_WRITER))
return (0);
 
for (zs = list_head(&zf->zf_stream); zs;
zs = list_next(&zf->zf_stream, zs)) {
 
-   if (((ddi_get_lbolt() - zs->zst_last)/hz) > zfetch_min_sec_reap)
+   if (ddi_get_lbolt() - zs->zst_last > ticks)
break;
}
 
___
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: r260165 - head/sys/dev/ahci

2014-01-03 Thread Ian Lepore
On Fri, 2014-01-03 at 20:21 +0200, Konstantin Belousov wrote:
> On Fri, Jan 03, 2014 at 09:49:12AM -0700, Ian Lepore wrote:
> > On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote:
> > > On Wed, Jan 01, 2014 at 08:26:08PM +, Zbigniew Bodek wrote:
> > > > Author: zbb
> > > > Date: Wed Jan  1 20:26:08 2014
> > > > New Revision: 260165
> > > > URL: http://svnweb.freebsd.org/changeset/base/260165
> > > > 
> > > > Log:
> > > >   Use only mapped BIOs on ARM
> > > >   
> > > >   Using unmapped BIOs causes failure inside bus_dmamap_sync, since
> > > >   this function requires valid MVA address, which is not present
> > > >   if mapping is not set up.
> > > >   
> > > >   Submitted by: Wojciech Macek 
> > > >   Obtained from:Semihalf
> > > > 
> > > > Modified:
> > > >   head/sys/dev/ahci/ahci.c
> > > > 
> > > > Modified: head/sys/dev/ahci/ahci.c
> > > > ==
> > > > --- head/sys/dev/ahci/ahci.cWed Jan  1 20:22:29 2014
> > > > (r260164)
> > > > +++ head/sys/dev/ahci/ahci.cWed Jan  1 20:26:08 2014
> > > > (r260165)
> > > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc
> > > > if (ch->caps & AHCI_CAP_SPM)
> > > > cpi->hba_inquiry |= PI_SATAPM;
> > > > cpi->target_sprt = 0;
> > > > +#ifdef __arm__
> > > > +   /*
> > > > +* Do not use unmapped buffers on ARM. Doing so will 
> > > > cause
> > > > +* failure inside bus_dmamap_sync due to lack of VA.
> > > > +*/
> > > > +   cpi->hba_misc = PIM_SEQSCAN;
> > > > +#else
> > > > cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
> > > > +#endif
> > > > cpi->hba_eng_cnt = 0;
> > > > if (ch->caps & AHCI_CAP_SPM)
> > > > cpi->max_target = 15;
> > > 
> > > I think this is wrong. If bus_dmamap_sync(9) is not functional on arm,
> > > then unmapped io should be disabled on arm unconditionally, using
> > > unmapped_buf_allowed.  Why ahci(4) is special in this regard, leaving
> > > other controllers broken for arm ?
> > 
> > I think this entire concept is wrong, and the fix should be in armv6
> > busdma or pmap code.  An unmapped page is, by definition, not cached.
> > The only way data becomes cached is because flags in a mapping indicated
> > the memory is cacheable.  If we have data from unmapped pages in the
> > cache, that's a bug in the armv6 pmap implementation, I think.
> 
> I agree with the statement that the fix must be in busdma MD code,
> possibly with some cooperation with pmap code. On the other hand, I do
> not understand later claims.
> 
> BIO unmapped attribute only means that bio does not carry a pointer to
> (some) mapping of the bio_ma pages. In other words, unmapped BIO does
> not imply globally unmapped page, and CPU cache might contain the lines
> from the BIO pages.

Oh, I didn't realize that.  I thought with unmapped IO it was implicit
that there were no mappings of the page in the kernel or any userland
vmspace.  If the page can be mapped, that does indeed imply that
unmapped IO needs to be globally disabled for ARM -- the hardware
performs cache maintenance by virtual address.

Hmm, or we could plumb up some new interface between arm busdma and pmap
implementations, so that busdma can get any virtual addresses associated
with the page and do the cache flushes.  It looks like pmap has the
required info in the pv_table, easily accessible by physical address.  I
wonder if any benefits from unmapped IO will get lost in the extra work
required at the busdma level?

-- Ian


___
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: r260237 - head/sys/amd64/vmm/io

2014-01-03 Thread Neel Natu
Author: neel
Date: Fri Jan  3 19:25:52 2014
New Revision: 260237
URL: http://svnweb.freebsd.org/changeset/base/260237

Log:
  Fix a bug in the HPET emulation where a timer interrupt could be lost when the
  guest disables the HPET.
  
  The HPET timer interrupt is triggered from the callout handler associated with
  the timer. It is possible for the callout handler to be delayed before it gets
  a chance to execute. If the guest disables the HPET during this window then 
the
  handler never gets a chance to execute and the timer interrupt is lost.
  
  This is now fixed by injecting a timer interrupt into the guest if the callout
  time is detected to be in the past when the HPET is disabled.

Modified:
  head/sys/amd64/vmm/io/vhpet.c

Modified: head/sys/amd64/vmm/io/vhpet.c
==
--- head/sys/amd64/vmm/io/vhpet.c   Fri Jan  3 18:44:37 2014
(r260236)
+++ head/sys/amd64/vmm/io/vhpet.c   Fri Jan  3 19:25:52 2014
(r260237)
@@ -77,8 +77,8 @@ struct vhpet {
 
uint64_tconfig; /* Configuration */
uint64_tisr;/* Interrupt Status */
-   uint32_tcounter;/* HPET Counter */
-   sbintime_t  counter_sbt;
+   uint32_tcountbase;  /* HPET counter base value */
+   sbintime_t  countbase_sbt;  /* uptime corresponding to base value */
 
struct {
uint64_tcap_config; /* Configuration */
@@ -86,6 +86,7 @@ struct vhpet {
uint32_tcompval;/* Comparator */
uint32_tcomprate;
struct callout  callout;
+   sbintime_t  callout_sbt;/* time when counter==compval */
struct vhpet_callout_arg arg;
} timer[VHPET_NUM_TIMERS];
 };
@@ -93,6 +94,9 @@ struct vhpet {
 #defineVHPET_LOCK(vhp) mtx_lock(&((vhp)->mtx))
 #defineVHPET_UNLOCK(vhp)   mtx_unlock(&((vhp)->mtx))
 
+static void vhpet_start_timer(struct vhpet *vhpet, int n, uint32_t counter,
+sbintime_t now);
+
 static uint64_t
 vhpet_capabilities(void)
 {
@@ -164,30 +168,28 @@ vhpet_timer_ioapic_pin(struct vhpet *vhp
 }
 
 static uint32_t
-vhpet_counter(struct vhpet *vhpet, bool latch)
+vhpet_counter(struct vhpet *vhpet, sbintime_t *nowptr)
 {
uint32_t val;
-   sbintime_t cur_sbt, delta_sbt;
+   sbintime_t now, delta;
 
-   val = vhpet->counter;
+   val = vhpet->countbase;
if (vhpet_counter_enabled(vhpet)) {
-   cur_sbt = sbinuptime();
-   delta_sbt = cur_sbt - vhpet->counter_sbt;
-   KASSERT(delta_sbt >= 0,
-   ("vhpet counter went backwards: %#lx to %#lx",
-   vhpet->counter_sbt, cur_sbt));
-   val += delta_sbt / vhpet->freq_sbt;
-
+   now = sbinuptime();
+   delta = now - vhpet->countbase_sbt;
+   KASSERT(delta >= 0, ("vhpet_counter: uptime went backwards: "
+   "%#lx to %#lx", vhpet->countbase_sbt, now));
+   val += delta / vhpet->freq_sbt;
+   if (nowptr != NULL)
+   *nowptr = now;
+   } else {
/*
-* Keep track of the last value of the main counter that
-* was read by the guest.
+* The sbinuptime corresponding to the 'countbase' is
+* meaningless when the counter is disabled. Make sure
+* that the the caller doesn't want to use it.
 */
-   if (latch) {
-   vhpet->counter = val;
-   vhpet->counter_sbt = cur_sbt;
-   }
+   KASSERT(nowptr == NULL, ("vhpet_counter: nowptr must be NULL"));
}
-
return (val);
 }
 
@@ -305,7 +307,7 @@ vhpet_handler(void *a)
 {
int n;
uint32_t counter;
-   sbintime_t sbt;
+   sbintime_t now;
struct vhpet *vhpet;
struct callout *callout;
struct vhpet_callout_arg *arg;
@@ -330,14 +332,8 @@ vhpet_handler(void *a)
if (!vhpet_counter_enabled(vhpet))
panic("vhpet(%p) callout with counter disabled", vhpet);
 
-   counter = vhpet_counter(vhpet, false);
-
-   /* Update the accumulator for periodic timers */
-   if (vhpet->timer[n].comprate != 0)
-   vhpet_adjust_compval(vhpet, n, counter);
-
-   sbt = (vhpet->timer[n].compval - counter) * vhpet->freq_sbt;
-   callout_reset_sbt(callout, sbt, 0, vhpet_handler, arg, 0);
+   counter = vhpet_counter(vhpet, &now);
+   vhpet_start_timer(vhpet, n, counter, now);
vhpet_timer_interrupt(vhpet, n);
 done:
VHPET_UNLOCK(vhpet);
@@ -345,45 +341,47 @@ done:
 }
 
 static void
-vhpet_stop_timer(struct vhpet *vhpet, int n)
+vhpet_stop_timer(struct vhpet *vhpet, int n, sbintime_t now)
 {
 
+   VM_CTR1(vhpet->vm, "hpet t%d stopped

svn commit: r260238 - head/sys/amd64/vmm/intel

2014-01-03 Thread Neel Natu
Author: neel
Date: Fri Jan  3 19:29:33 2014
New Revision: 260238
URL: http://svnweb.freebsd.org/changeset/base/260238

Log:
  Use the same label name for ENTRY() and END() macros for 'vmx_enter_guest'.
  
  Pointed out by:   rmh@

Modified:
  head/sys/amd64/vmm/intel/vmx_support.S

Modified: head/sys/amd64/vmm/intel/vmx_support.S
==
--- head/sys/amd64/vmm/intel/vmx_support.S  Fri Jan  3 19:25:52 2014
(r260237)
+++ head/sys/amd64/vmm/intel/vmx_support.S  Fri Jan  3 19:29:33 2014
(r260238)
@@ -187,7 +187,7 @@ inst_error:
 
VMX_HOST_RESTORE(%r10)
ret
-END(vmx_execute_guest)
+END(vmx_enter_guest)
 
 /*
  * void vmx_exit_guest(void)
___
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: r260239 - head/usr.sbin/bhyve

2014-01-03 Thread Peter Grehan
Author: grehan
Date: Fri Jan  3 19:31:40 2014
New Revision: 260239
URL: http://svnweb.freebsd.org/changeset/base/260239

Log:
  Cosmetic change - switch over to vertical SRCS to make it
  easier to keep files in alpha order.
  
  Reviewed by:  neel

Modified:
  head/usr.sbin/bhyve/Makefile

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileFri Jan  3 19:29:33 2014
(r260238)
+++ head/usr.sbin/bhyve/MakefileFri Jan  3 19:31:40 2014
(r260239)
@@ -7,11 +7,37 @@ PROG= bhyve
 DEBUG_FLAGS= -g -O0 
 
 MAN=   bhyve.8
-SRCS=  acpi.c atpic.c bhyverun.c block_if.c consport.c dbgport.c elcr.c
-SRCS+=  inout.c legacy_irq.c mem.c mevent.c mptbl.c pci_ahci.c
-SRCS+= pci_emul.c pci_hostbridge.c pci_lpc.c pci_passthru.c pci_virtio_block.c
-SRCS+= pci_virtio_net.c pci_uart.c pit_8254.c pm.c pmtmr.c post.c rtc.c
-SRCS+= uart_emul.c virtio.c xmsr.c spinup_ap.c
+
+SRCS=  \
+   acpi.c  \
+   atpic.c \
+   bhyverun.c  \
+   block_if.c  \
+   consport.c  \
+   dbgport.c   \
+   elcr.c  \
+   inout.c \
+   legacy_irq.c\
+   mem.c   \
+   mevent.c\
+   mptbl.c \
+   pci_ahci.c  \
+   pci_emul.c  \
+   pci_hostbridge.c\
+   pci_lpc.c   \
+   pci_passthru.c  \
+   pci_virtio_block.c  \
+   pci_virtio_net.c\
+   pci_uart.c  \
+   pit_8254.c  \
+   pm.c\
+   pmtmr.c \
+   post.c  \
+   rtc.c   \
+   uart_emul.c \
+   virtio.c\
+   xmsr.c  \
+   spinup_ap.c
 
 .PATH: ${.CURDIR}/../../sys/amd64/vmm
 SRCS+= vmm_instruction_emul.c
___
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: r260165 - head/sys/dev/ahci

2014-01-03 Thread Konstantin Belousov
On Fri, Jan 03, 2014 at 12:08:01PM -0700, Ian Lepore wrote:
> On Fri, 2014-01-03 at 20:21 +0200, Konstantin Belousov wrote:
> > On Fri, Jan 03, 2014 at 09:49:12AM -0700, Ian Lepore wrote:
> > > On Wed, 2014-01-01 at 22:32 +0200, Konstantin Belousov wrote:
> > > > On Wed, Jan 01, 2014 at 08:26:08PM +, Zbigniew Bodek wrote:
> > > > > Author: zbb
> > > > > Date: Wed Jan  1 20:26:08 2014
> > > > > New Revision: 260165
> > > > > URL: http://svnweb.freebsd.org/changeset/base/260165
> > > > > 
> > > > > Log:
> > > > >   Use only mapped BIOs on ARM
> > > > >   
> > > > >   Using unmapped BIOs causes failure inside bus_dmamap_sync, since
> > > > >   this function requires valid MVA address, which is not present
> > > > >   if mapping is not set up.
> > > > >   
> > > > >   Submitted by:   Wojciech Macek 
> > > > >   Obtained from:  Semihalf
> > > > > 
> > > > > Modified:
> > > > >   head/sys/dev/ahci/ahci.c
> > > > > 
> > > > > Modified: head/sys/dev/ahci/ahci.c
> > > > > ==
> > > > > --- head/sys/dev/ahci/ahci.c  Wed Jan  1 20:22:29 2014
> > > > > (r260164)
> > > > > +++ head/sys/dev/ahci/ahci.c  Wed Jan  1 20:26:08 2014
> > > > > (r260165)
> > > > > @@ -3066,7 +3066,15 @@ ahciaction(struct cam_sim *sim, union cc
> > > > >   if (ch->caps & AHCI_CAP_SPM)
> > > > >   cpi->hba_inquiry |= PI_SATAPM;
> > > > >   cpi->target_sprt = 0;
> > > > > +#ifdef __arm__
> > > > > + /*
> > > > > +  * Do not use unmapped buffers on ARM. Doing so will 
> > > > > cause
> > > > > +  * failure inside bus_dmamap_sync due to lack of VA.
> > > > > +  */
> > > > > + cpi->hba_misc = PIM_SEQSCAN;
> > > > > +#else
> > > > >   cpi->hba_misc = PIM_SEQSCAN | PIM_UNMAPPED;
> > > > > +#endif
> > > > >   cpi->hba_eng_cnt = 0;
> > > > >   if (ch->caps & AHCI_CAP_SPM)
> > > > >   cpi->max_target = 15;
> > > > 
> > > > I think this is wrong. If bus_dmamap_sync(9) is not functional on arm,
> > > > then unmapped io should be disabled on arm unconditionally, using
> > > > unmapped_buf_allowed.  Why ahci(4) is special in this regard, leaving
> > > > other controllers broken for arm ?
> > > 
> > > I think this entire concept is wrong, and the fix should be in armv6
> > > busdma or pmap code.  An unmapped page is, by definition, not cached.
> > > The only way data becomes cached is because flags in a mapping indicated
> > > the memory is cacheable.  If we have data from unmapped pages in the
> > > cache, that's a bug in the armv6 pmap implementation, I think.
> > 
> > I agree with the statement that the fix must be in busdma MD code,
> > possibly with some cooperation with pmap code. On the other hand, I do
> > not understand later claims.
> > 
> > BIO unmapped attribute only means that bio does not carry a pointer to
> > (some) mapping of the bio_ma pages. In other words, unmapped BIO does
> > not imply globally unmapped page, and CPU cache might contain the lines
> > from the BIO pages.
> 
> Oh, I didn't realize that.  I thought with unmapped IO it was implicit
> that there were no mappings of the page in the kernel or any userland
> vmspace.  If the page can be mapped, that does indeed imply that
> unmapped IO needs to be globally disabled for ARM -- the hardware
> performs cache maintenance by virtual address.
> 
> Hmm, or we could plumb up some new interface between arm busdma and pmap
> implementations, so that busdma can get any virtual addresses associated
> with the page and do the cache flushes.  It looks like pmap has the
> required info in the pv_table, easily accessible by physical address.  I
> wonder if any benefits from unmapped IO will get lost in the extra work
> required at the busdma level?

Yes, I started mumbling about MI busdma code and pmap helper from the
very beginning.

The benefits can be only measured, it is impossible to speculate about it.
Still, the normal reads for non-mmaped pages should pass the buffer pages
which are not mapped anywhere, and unmaped code would be still a win.

For arm, since we do not support SMP AFAIK, mapping and unmapping buffer
pages is not as costly as for the large SMP machines.  Keeping the feature
working would be benefitial in future.


pgp6OtGt_wWhz.pgp
Description: PGP signature


svn commit: r260243 - head/sys/dev/aacraid

2014-01-03 Thread Sean Bruno
Author: sbruno
Date: Fri Jan  3 20:45:56 2014
New Revision: 260243
URL: http://svnweb.freebsd.org/changeset/base/260243

Log:
  Wrap this debug statement in debug defines.  Else, this driver
  will refuse to load.
  
  MFC after:2 weeks
  Sponsored by: Yahoo! Inc.

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

Modified: head/sys/dev/aacraid/aacraid.c
==
--- head/sys/dev/aacraid/aacraid.c  Fri Jan  3 20:27:15 2014
(r260242)
+++ head/sys/dev/aacraid/aacraid.c  Fri Jan  3 20:45:56 2014
(r260243)
@@ -1728,7 +1728,9 @@ aac_check_firmware(struct aac_softc *sc)
device_printf(sc->aac_dev, "Enable 64-bit array\n");
}
 
+#ifdef AACRAID_DEBUG
aacraid_get_fw_debug_buffer(sc);
+#endif
return (0);
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r260243 - head/sys/dev/aacraid

2014-01-03 Thread Sean Bruno
On Fri, 2014-01-03 at 20:45 +, Sean Bruno wrote:
> Author: sbruno
> Date: Fri Jan  3 20:45:56 2014
> New Revision: 260243
> URL: http://svnweb.freebsd.org/changeset/base/260243
> 
> Log:
>   Wrap this debug statement in debug defines.  Else, this driver
>   will refuse to load.

should have read "will refuse to load as a module"

link_elf_obj: symbol aacraid_get_fw_debug_buffer undefined
linker_load_file: Unsupported file type


sean


>   
>   MFC after:  2 weeks
>   Sponsored by:   Yahoo! Inc.
> 
> Modified:
>   head/sys/dev/aacraid/aacraid.c
> 
> Modified: head/sys/dev/aacraid/aacraid.c
> ==
> --- head/sys/dev/aacraid/aacraid.cFri Jan  3 20:27:15 2014
> (r260242)
> +++ head/sys/dev/aacraid/aacraid.cFri Jan  3 20:45:56 2014
> (r260243)
> @@ -1728,7 +1728,9 @@ aac_check_firmware(struct aac_softc *sc)
>   device_printf(sc->aac_dev, "Enable 64-bit array\n");
>   }
>  
> +#ifdef AACRAID_DEBUG
>   aacraid_get_fw_debug_buffer(sc);
> +#endif
>   return (0);
>  }
>  


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


svn commit: r260245 - head/sys/arm/ti/am335x

2014-01-03 Thread Ian Lepore
Author: ian
Date: Fri Jan  3 21:38:33 2014
New Revision: 260245
URL: http://svnweb.freebsd.org/changeset/base/260245

Log:
  Fix a typo that caused a loop to run beyond the end of the array it was
  searching.  If you didn't configure a timer capture pin you'd get a data
  abort as it wandered into the weeds, now you get a nice warning message
  about your config, as originally intended.

Modified:
  head/sys/arm/ti/am335x/am335x_dmtimer.c

Modified: head/sys/arm/ti/am335x/am335x_dmtimer.c
==
--- head/sys/arm/ti/am335x/am335x_dmtimer.c Fri Jan  3 20:47:51 2014
(r260244)
+++ head/sys/arm/ti/am335x/am335x_dmtimer.c Fri Jan  3 21:38:33 2014
(r260245)
@@ -372,7 +372,7 @@ am335x_dmtimer_pps_init(device_t dev, st
 * yet from ti_scm.h.
 */
timer_num = 0;
-   for (i = 0; nitems(padinfo) && timer_num == 0; ++i) {
+   for (i = 0; i < nitems(padinfo) && timer_num == 0; ++i) {
if (ti_scm_padconf_get(padinfo[i].ballname, &padmux, 
&padstate) == 0) {
if (strcasecmp(padinfo[i].muxname, padmux) == 0 &&
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r260246 - head/bin/sh

2014-01-03 Thread Jilles Tjoelker
Author: jilles
Date: Fri Jan  3 22:56:23 2014
New Revision: 260246
URL: http://svnweb.freebsd.org/changeset/base/260246

Log:
  sh(1): Discourage use of -e.
  
  Also, do not say that ! before a pipeline is an operator, because it is
  syntactically a keyword.

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Fri Jan  3 21:38:33 2014(r260245)
+++ head/bin/sh/sh.1Fri Jan  3 22:56:23 2014(r260246)
@@ -32,7 +32,7 @@
 .\"from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd November 1, 2013
+.Dd January 3, 2014
 .Dt SH 1
 .Os
 .Sh NAME
@@ -235,10 +235,16 @@ or
 .Dq Li ||
 operator; or if the command is a pipeline preceded by the
 .Ic !\&
-operator.
+keyword.
 If a shell function is executed and its exit status is explicitly
 tested, all commands of the function are considered to be tested as
 well.
+.Pp
+It is recommended to check for failures explicitly
+instead of relying on
+.Fl e
+because it tends to behave in unexpected ways,
+particularly in larger scripts.
 .It Fl f Li noglob
 Disable pathname expansion.
 .It Fl h Li trackall
___
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: r260247 - head/sys/netpfil/ipfw

2014-01-03 Thread Alexander V. Chernikov
Author: melifaro
Date: Fri Jan  3 23:11:26 2014
New Revision: 260247
URL: http://svnweb.freebsd.org/changeset/base/260247

Log:
  Use rnh_matchaddr instead of rnh_lookup for longest-prefix match.
  rnh_lookup is effectively the same as rnh_matchaddr if called with
  empy network mask.
  
  MFC after:2 weeks

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

Modified: head/sys/netpfil/ipfw/ip_fw_table.c
==
--- head/sys/netpfil/ipfw/ip_fw_table.c Fri Jan  3 22:56:23 2014
(r260246)
+++ head/sys/netpfil/ipfw/ip_fw_table.c Fri Jan  3 23:11:26 2014
(r260247)
@@ -542,7 +542,7 @@ ipfw_lookup_table(struct ip_fw_chain *ch
return (0);
KEY_LEN(sa) = KEY_LEN_INET;
sa.sin_addr.s_addr = addr;
-   ent = (struct table_entry *)(rnh->rnh_lookup(&sa, NULL, rnh));
+   ent = (struct table_entry *)(rnh->rnh_matchaddr(&sa, rnh));
if (ent != NULL) {
*val = ent->value;
return (1);
@@ -568,7 +568,7 @@ ipfw_lookup_table_extended(struct ip_fw_
case IPFW_TABLE_CIDR:
KEY_LEN(sa6) = KEY_LEN_INET6;
memcpy(&sa6.sin6_addr, paddr, sizeof(struct in6_addr));
-   xent = (struct table_xentry *)(rnh->rnh_lookup(&sa6, NULL, 
rnh));
+   xent = (struct table_xentry *)(rnh->rnh_matchaddr(&sa6, rnh));
break;
 
case IPFW_TABLE_INTERFACE:
@@ -576,7 +576,7 @@ ipfw_lookup_table_extended(struct ip_fw_
strlcpy(iface.ifname, (char *)paddr, IF_NAMESIZE) + 1;
/* Assume direct match */
/* FIXME: Add interface pattern matching */
-   xent = (struct table_xentry *)(rnh->rnh_lookup(&iface, NULL, 
rnh));
+   xent = (struct table_xentry *)(rnh->rnh_matchaddr(&iface, rnh));
break;
 
default:
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r260248 - head/share/i18n/esdb/UTF

2014-01-03 Thread Peter Wemm
Author: peter
Date: Fri Jan  3 23:35:01 2014
New Revision: 260248
URL: http://svnweb.freebsd.org/changeset/base/260248

Log:
  Revert r258254: Alias WCHAR_T to UCS-4-INTERNAL.

Modified:
  head/share/i18n/esdb/UTF/UTF.alias

Modified: head/share/i18n/esdb/UTF/UTF.alias
==
--- head/share/i18n/esdb/UTF/UTF.alias  Fri Jan  3 23:11:26 2014
(r260247)
+++ head/share/i18n/esdb/UTF/UTF.alias  Fri Jan  3 23:35:01 2014
(r260248)
@@ -28,7 +28,6 @@
 16LE   utf16le
 
 32-INTERNALucs-4-internal
-32-INTERNALwchar_t
 
 32-SWAPPED ucs-4-swapped
 
___
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: r260250 - head/usr.sbin/rpc.lockd

2014-01-03 Thread Xin LI
Author: delphij
Date: Sat Jan  4 01:08:10 2014
New Revision: 260250
URL: http://svnweb.freebsd.org/changeset/base/260250

Log:
  Use prototype.

Modified:
  head/usr.sbin/rpc.lockd/kern.c
  head/usr.sbin/rpc.lockd/lock_proc.c

Modified: head/usr.sbin/rpc.lockd/kern.c
==
--- head/usr.sbin/rpc.lockd/kern.c  Fri Jan  3 23:36:03 2014
(r260249)
+++ head/usr.sbin/rpc.lockd/kern.c  Sat Jan  4 01:08:10 2014
(r260250)
@@ -97,8 +97,7 @@ nfslockdans(int vers, struct lockd_ans *
 #define d_args (debug_level > 2)
 
 static const char *
-from_addr(saddr)
-   struct sockaddr *saddr;
+from_addr(struct sockaddr *saddr)
 {
static char inet_buf[INET6_ADDRSTRLEN];
 
@@ -231,9 +230,7 @@ err:
 }
 
 void
-set_auth(cl, xucred)
-   CLIENT *cl;
-   struct xucred *xucred;
+set_auth(CLIENT *cl, struct xucred *xucred)
 {
int ngroups;
 

Modified: head/usr.sbin/rpc.lockd/lock_proc.c
==
--- head/usr.sbin/rpc.lockd/lock_proc.c Fri Jan  3 23:36:03 2014
(r260249)
+++ head/usr.sbin/rpc.lockd/lock_proc.c Sat Jan  4 01:08:10 2014
(r260250)
@@ -76,9 +76,7 @@ static intaddrcmp(struct sockaddr *, st
  * passed in as part of the called procedure specification
  */
 static void
-log_from_addr(fun_name, req)
-   const char *fun_name;
-   struct svc_req *req;
+log_from_addr(const char *fun_name, struct svc_req *req)
 {
struct sockaddr *addr;
char hostname_buf[NI_MAXHOST];
@@ -99,8 +97,7 @@ log_from_addr(fun_name, req)
  * a debug subsystem.
 */
 static void
-log_netobj(obj)
-   netobj *obj;
+log_netobj(netobj *obj)
 {
char objvalbuffer[(sizeof(char)*2)*MAX_NETOBJ_SZ+2];
char objascbuffer[sizeof(char)*MAX_NETOBJ_SZ+1];
@@ -161,9 +158,7 @@ static rpcvers_t clnt_cache_vers[CLIENT_
 static int clnt_cache_next_to_use = 0;
 
 static int
-addrcmp(sa1, sa2)
-   struct sockaddr *sa1;
-   struct sockaddr *sa2;
+addrcmp(struct sockaddr *sa1, struct sockaddr *sa2)
 {
int len;
void *p1, *p2;
@@ -190,9 +185,7 @@ addrcmp(sa1, sa2)
 }
 
 CLIENT *
-get_client(host_addr, vers)
-   struct sockaddr *host_addr;
-   rpcvers_t vers;
+get_client(struct sockaddr *host_addr, rpcvers_t vers)
 {
CLIENT *client;
struct timeval retry_time, time_now;
@@ -327,10 +320,7 @@ get_client(host_addr, vers)
  * without expecting a result
  */
 void
-transmit_result(opcode, result, addr)
-   int opcode;
-   nlm_res *result;
-   struct sockaddr *addr;
+transmit_result(int opcode, nlm_res *result, struct sockaddr *addr)
 {
static char dummy;
CLIENT *cli;
@@ -358,10 +348,7 @@ transmit_result(opcode, result, addr)
  * without expecting a result
  */
 void
-transmit4_result(opcode, result, addr)
-   int opcode;
-   nlm4_res *result;
-   struct sockaddr *addr;
+transmit4_result(int opcode, nlm4_res *result, struct sockaddr *addr)
 {
static char dummy;
CLIENT *cli;
@@ -385,11 +372,8 @@ transmit4_result(opcode, result, addr)
 /*
  * converts a struct nlm_lock to struct nlm4_lock
  */
-static void nlmtonlm4(struct nlm_lock *, struct nlm4_lock *);
 static void
-nlmtonlm4(arg, arg4)
-   struct nlm_lock *arg;
-   struct nlm4_lock *arg4;
+nlmtonlm4(struct nlm_lock *arg, struct nlm4_lock *arg4)
 {
arg4->caller_name = arg->caller_name;
arg4->fh = arg->fh;
@@ -432,9 +416,7 @@ nlmtonlm4(arg, arg4)
  * Notes:
  */
 nlm_testres *
-nlm_test_1_svc(arg, rqstp)
-   nlm_testargs *arg;
-   struct svc_req *rqstp;
+nlm_test_1_svc(nlm_testargs *arg, struct svc_req *rqstp)
 {
static nlm_testres res;
struct nlm4_lock arg4;
@@ -466,9 +448,7 @@ nlm_test_1_svc(arg, rqstp)
 }
 
 void *
-nlm_test_msg_1_svc(arg, rqstp)
-   nlm_testargs *arg;
-   struct svc_req *rqstp;
+nlm_test_msg_1_svc(nlm_testargs *arg, struct svc_req *rqstp)
 {
nlm_testres res;
static char dummy;
@@ -523,9 +503,7 @@ nlm_test_msg_1_svc(arg, rqstp)
  * Notes:  *** grace period support missing
  */
 nlm_res *
-nlm_lock_1_svc(arg, rqstp)
-   nlm_lockargs *arg;
-   struct svc_req *rqstp;
+nlm_lock_1_svc(nlm_lockargs *arg, struct svc_req *rqstp)
 {
static nlm_res res;
struct nlm4_lockargs arg4;
@@ -547,9 +525,7 @@ nlm_lock_1_svc(arg, rqstp)
 }
 
 void *
-nlm_lock_msg_1_svc(arg, rqstp)
-   nlm_lockargs *arg;
-   struct svc_req *rqstp;
+nlm_lock_msg_1_svc(nlm_lockargs *arg, struct svc_req *rqstp)
 {
static nlm_res res;
struct nlm4_lockargs arg4;
@@ -578,9 +554,7 @@ nlm_lock_msg_1_svc(arg, rqstp)
  * Notes:
  */
 nlm_res *
-nlm_cancel_1_svc(arg, rqstp)
-   nlm_cancargs *arg;
-   struct svc_req *rqstp;
+nlm_cancel_1_svc(nlm_cancargs *arg, struct svc_req *rqstp)
 {
static nlm_res res;
struct nlm4_lock arg4;

svn commit: r260251 - head/usr.sbin/rpc.lockd

2014-01-03 Thread Xin LI
Author: delphij
Date: Sat Jan  4 01:12:28 2014
New Revision: 260251
URL: http://svnweb.freebsd.org/changeset/base/260251

Log:
  Make a copy instead using constant string directly when assigning to char *.
  
  While I'm there also remove a few prototypes that are unused.

Modified:
  head/usr.sbin/rpc.lockd/lockd.c

Modified: head/usr.sbin/rpc.lockd/lockd.c
==
--- head/usr.sbin/rpc.lockd/lockd.c Sat Jan  4 01:08:10 2014
(r260250)
+++ head/usr.sbin/rpc.lockd/lockd.c Sat Jan  4 01:12:28 2014
(r260251)
@@ -101,10 +101,6 @@ static voidcomplete_service(struct netc
 static voidclearout_service(void);
 void   lookup_addresses(struct netconfig *nconf);
 void   init_nsm(void);
-void   nlm_prog_0(struct svc_req *, SVCXPRT *);
-void   nlm_prog_1(struct svc_req *, SVCXPRT *);
-void   nlm_prog_3(struct svc_req *, SVCXPRT *);
-void   nlm_prog_4(struct svc_req *, SVCXPRT *);
 void   out_of_mem(void);
 void   usage(void);
 
@@ -228,7 +224,7 @@ main(int argc, char **argv)
if (hosts == NULL)
out_of_mem();
 
-   hosts[0] = "*";
+   hosts[0] = strdup("*");
nhosts = 1;
} else {
hosts_bak = hosts;
@@ -244,7 +240,7 @@ main(int argc, char **argv)
hosts = hosts_bak;
 
nhosts += 2;
-   hosts[nhosts - 2] = "::1";
+   hosts[nhosts - 2] = strdup("::1");
} else {
hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char 
*));
if (hosts_bak == NULL) {
@@ -258,7 +254,7 @@ main(int argc, char **argv)
hosts = hosts_bak;
}
}
-   hosts[nhosts - 1] = "127.0.0.1";
+   hosts[nhosts - 1] = strdup("127.0.0.1");
}
 
if (kernel_lockd) {
___
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"