Re: svn commit: r256850 - in head: bin/sh etc lib/libc/sys lib/libutil usr.bin/limits usr.bin/procstat

2013-11-02 Thread Konstantin Belousov
On Sat, Nov 02, 2013 at 07:43:52AM +0100, Stefan Neudorf wrote:
> Konstantin Belousov  writes:
> 
> > On Wed, Oct 30, 2013 at 10:20:52PM +0100, Jilles Tjoelker wrote:
> >
> >> On Wed, Oct 30, 2013 at 02:01:57PM +0100, Stefan Neudorf wrote:
> >> > Konstantin Belousov  writes:
> >> > > Modified: head/usr.bin/limits/limits.c
> >> > > ==
> >> > > --- head/usr.bin/limits/limits.c Mon Oct 21 16:44:53 2013
> >> > > (r256849)
> >> > > +++ head/usr.bin/limits/limits.c Mon Oct 21 16:46:12 2013
> >> > > (r256850)
> >> 
> >> > This adds limits -e support only for sh, csh, tcsh. What about other
> >> > shells that already support sbsize and swapuse extensions?
> >> 
> >> This can be done later; the kqueue rlimit need not be gated on it.
> >
> > I definitely do not want to go over the {pd,}ksh, zsh, bash, rc and
> > whatever else. Somebody who cares should contact the projects and
> > propose the changes.
> 
> Ah, you didn't catch my hint. There's no kqueues rlimit in contrib/tcsh.
> I've submitted one upstream but it'd take some time before the next
> release appears and we can update.
> 
> http://mx.gw.com/pipermail/tcsh-bugs/2013-October/000844.html
I can just apply the upstream patch to our contrib/tcsh, without
waiting for import of new version.  Can you point me to the way to get
the commit which was referenced in the mail above ?

> 
> Same for zsh which also has csh-like rlimits.
> 
> http://sourceforge.net/p/zsh/code/ci/790a4fe


pgpx4DJ072aq5.pgp
Description: PGP signature


svn commit: r257541 - head/sys/dev/e1000

2013-11-02 Thread Konstantin Belousov
Author: kib
Date: Sat Nov  2 09:16:11 2013
New Revision: 257541
URL: http://svnweb.freebsd.org/changeset/base/257541

Log:
  Fix several issues with the busdma(9) KPI use in the e1000 drivers.
  The problems do not affect bouncing busdma in a visible way, but are
  critical for the dmar backend.
  
  - The bus_dmamap_create(9) is not documented to take BUS_DMA_NOWAIT flag.
  - Unload descriptor map after receive.
  - Do not reset descriptor map to NULL, bus_dmamap_load(9) requires
valid map, and also this leaks the map.
  
  Reported and tested by:   pho
  Approved by:  jfv
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/dev/e1000/if_em.c
  head/sys/dev/e1000/if_igb.c
  head/sys/dev/e1000/if_lem.c

Modified: head/sys/dev/e1000/if_em.c
==
--- head/sys/dev/e1000/if_em.c  Sat Nov  2 02:38:32 2013(r257540)
+++ head/sys/dev/e1000/if_em.c  Sat Nov  2 09:16:11 2013(r257541)
@@ -4059,8 +4059,7 @@ em_allocate_receive_buffers(struct rx_ri
rxbuf = rxr->rx_buffers;
for (int i = 0; i < adapter->num_rx_desc; i++, rxbuf++) {
rxbuf = &rxr->rx_buffers[i];
-   error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT,
-   &rxbuf->map);
+   error = bus_dmamap_create(rxr->rxtag, 0, &rxbuf->map);
if (error) {
device_printf(dev, "%s: bus_dmamap_create failed: %d\n",
__func__, error);
@@ -4467,6 +4466,7 @@ em_rxeof(struct rx_ring *rxr, int count,
em_rx_discard(rxr, i);
goto next_desc;
}
+   bus_dmamap_unload(rxr->rxtag, rxr->rx_buffers[i].map);
 
/* Assign correct length to the current fragment */
mp = rxr->rx_buffers[i].m_head;
@@ -4553,6 +4553,8 @@ em_rx_discard(struct rx_ring *rxr, int i
struct em_buffer*rbuf;
 
rbuf = &rxr->rx_buffers[i];
+   bus_dmamap_unload(rxr->rxtag, rbuf->map);
+
/* Free any previous pieces */
if (rxr->fmp != NULL) {
rxr->fmp->m_flags |= M_PKTHDR;

Modified: head/sys/dev/e1000/if_igb.c
==
--- head/sys/dev/e1000/if_igb.c Sat Nov  2 02:38:32 2013(r257540)
+++ head/sys/dev/e1000/if_igb.c Sat Nov  2 09:16:11 2013(r257541)
@@ -3996,7 +3996,6 @@ igb_txeof(struct tx_ring *txr)
buf->map);
m_freem(buf->m_head);
buf->m_head = NULL;
-   buf->map = NULL;
}
buf->eop = NULL;
++txr->tx_avail;
@@ -4022,7 +4021,6 @@ igb_txeof(struct tx_ring *txr)
buf->map);
m_freem(buf->m_head);
buf->m_head = NULL;
-   buf->map = NULL;
}
++txr->tx_avail;
buf->eop = NULL;
@@ -4230,15 +4228,13 @@ igb_allocate_receive_buffers(struct rx_r
 
for (i = 0; i < adapter->num_rx_desc; i++) {
rxbuf = &rxr->rx_buffers[i];
-   error = bus_dmamap_create(rxr->htag,
-   BUS_DMA_NOWAIT, &rxbuf->hmap);
+   error = bus_dmamap_create(rxr->htag, 0, &rxbuf->hmap);
if (error) {
device_printf(dev,
"Unable to create RX head DMA maps\n");
goto fail;
}
-   error = bus_dmamap_create(rxr->ptag,
-   BUS_DMA_NOWAIT, &rxbuf->pmap);
+   error = bus_dmamap_create(rxr->ptag, 0, &rxbuf->pmap);
if (error) {
device_printf(dev,
"Unable to create RX packet DMA maps\n");
@@ -4758,11 +4754,13 @@ igb_rx_discard(struct rx_ring *rxr, int 
if (rbuf->m_head) {
m_free(rbuf->m_head);
rbuf->m_head = NULL;
+   bus_dmamap_unload(rxr->htag, rbuf->hmap);
}
 
if (rbuf->m_pack) {
m_free(rbuf->m_pack);
rbuf->m_pack = NULL;
+   bus_dmamap_unload(rxr->ptag, rbuf->pmap);
}
 
return;
@@ -4887,6 +4885,7 @@ igb_rxeof(struct igb_queue *que, int cou
** case only the first header is valid.
*/
if (rxr->hdr_split && rxr->fmp == NULL) {
+   bus_dmamap_unload(rxr->htag, rxbuf->hmap);
hlen = (hdr & E1000_RXDADV_HDRBUFLEN_MASK) >>
E1000_RXDADV_HDRBUFLEN_SHIFT;
if (hlen > IGB_HDR_BUF)
@@ -4919,6 +4918,7 @@ igb_rxeof(struct igb_queue *que, int cou
/* clear buf info for refresh */
 

Re: svn commit: r257535 - head/sys/netgraph

2013-11-02 Thread Mark R V Murray

On 2 Nov 2013, at 05:53, Adrian Chadd  wrote:

> Hm! A good question!
> 
> On 1 November 2013 22:22, Bruce Evans  wrote:
> 
>>>if (harvest.point_to_point)
>>> -   random_harvest(&(m->m_data), 12, 2, RANDOM_NET_NG);
>> 
>> 
>> '&(m->m_data)' is not just a pair of style bugs.  It gives address of
>> the pointer (somewhere in the mbuf header), not the address of pointed-
>> to data, so the randomness was almost null.  The style bugs are
>> excessive parentheses and chumminess with the implementation (non-use
>> of the accessor function mtod()).
>> 
>> 
>>> +   random_harvest(mtod(m, const void *), 12, 2,
>>> RANDOM_NET_NG);
>> 
>> 
>> Presumably you really do want to harvest the pointed-to data and there
>> are at least 12 bytes of it, so the semantic fix isn't backwards or a
>> buffer overrun.
>> 
> 
> 
> Mark - did you initially mean the address of the mbuf m_data pointer,
> or the data payload itself?

As Bruce says - the address of payload data itself. We don’t have 12-byte 
pointers in FreeBSD. :-)

M
-- 
Mark R V Murray



signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: svn commit: r257535 - head/sys/netgraph

2013-11-02 Thread Mark R V Murray

On 2 Nov 2013, at 09:32, Mark R V Murray  wrote:
>> Mark - did you initially mean the address of the mbuf m_data pointer,
>> or the data payload itself?
> 
> As Bruce says - the address of payload data itself. We don’t have 12-byte 
> pointers in FreeBSD. :-)

Cancel that.

The address passed must be the address of the m_data field in the mbuf 
structure. The harvested data is 12 bytes from that address forward, so not the 
data pointed to by that m_data pointer but the pointer value itself and some 
following junk too.

M
-- 
Mark R V Murray



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r257542 - head/sys/ofed/drivers/net/mlx4

2013-11-02 Thread Alfred Perlstein
Author: alfred
Date: Sat Nov  2 10:49:47 2013
New Revision: 257542
URL: http://svnweb.freebsd.org/changeset/base/257542

Log:
  Fix API mismatch exposed by lagg.
  
  When destroying a lagg the driver tries to restore the old mac and
  fails due to API mismatch

Modified:
  head/sys/ofed/drivers/net/mlx4/en_netdev.c

Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c
==
--- head/sys/ofed/drivers/net/mlx4/en_netdev.c  Sat Nov  2 09:16:11 2013
(r257541)
+++ head/sys/ofed/drivers/net/mlx4/en_netdev.c  Sat Nov  2 10:49:47 2013
(r257542)
@@ -633,8 +633,8 @@ int mlx4_en_start_port(struct net_device
en_dbg(DRV, priv, "Setting mac for port %d\n", priv->port);
err = mlx4_register_mac(mdev->dev, priv->port,
mlx4_en_mac_to_u64(IF_LLADDR(dev)));
-   if (err) {
-   en_err(priv, "Failed setting port mac\n");
+   if (err < 0) {
+   en_err(priv, "Failed setting port mac err=%d\n", err);
goto tx_err;
}
mdev->mac_removed[priv->port] = 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: r257543 - head/sys/dev/usb/wlan

2013-11-02 Thread Alfred Perlstein
Author: alfred
Date: Sat Nov  2 11:37:16 2013
New Revision: 257543
URL: http://svnweb.freebsd.org/changeset/base/257543

Log:
  Add device ID for 'Sanoxy 802.11N' usb

Modified:
  head/sys/dev/usb/wlan/if_urtwn.c

Modified: head/sys/dev/usb/wlan/if_urtwn.c
==
--- head/sys/dev/usb/wlan/if_urtwn.cSat Nov  2 10:49:47 2013
(r257542)
+++ head/sys/dev/usb/wlan/if_urtwn.cSat Nov  2 11:37:16 2013
(r257543)
@@ -139,6 +139,7 @@ static const STRUCT_USB_HOST_ID urtwn_de
URTWN_DEV(REALTEK,  RTL8191CU),
URTWN_DEV(REALTEK,  RTL8192CE),
URTWN_DEV(REALTEK,  RTL8192CU),
+   URTWN_DEV(REALTEK,  RTL8188CU_0),
URTWN_DEV(SITECOMEU,RTL8188CU_1),
URTWN_DEV(SITECOMEU,RTL8188CU_2),
URTWN_DEV(SITECOMEU,RTL8192CU),
___
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: r257535 - head/sys/netgraph

2013-11-02 Thread Adrian Chadd
Okay. I'll go and re-fix things.

Thanks,


-a

On 2 November 2013 02:44, Mark R V Murray  wrote:
>
> On 2 Nov 2013, at 09:32, Mark R V Murray  wrote:
>>> Mark - did you initially mean the address of the mbuf m_data pointer,
>>> or the data payload itself?
>>
>> As Bruce says - the address of payload data itself. We don’t have 12-byte 
>> pointers in FreeBSD. :-)
>
> Cancel that.
>
> The address passed must be the address of the m_data field in the mbuf 
> structure. The harvested data is 12 bytes from that address forward, so not 
> the data pointed to by that m_data pointer but the pointer value itself and 
> some following junk too.
>
> M
> --
> Mark R V Murray
>
___
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: r257548 - in head/sys: net netgraph

2013-11-02 Thread Adrian Chadd
Author: adrian
Date: Sat Nov  2 15:13:02 2013
New Revision: 257548
URL: http://svnweb.freebsd.org/changeset/base/257548

Log:
  Restore the entropy gathering from the m_data pointer value, not the
  m_data payload.
  
  After talking with markm/bde, this is what markm actually intended.

Modified:
  head/sys/net/if_ethersubr.c
  head/sys/net/if_tun.c
  head/sys/netgraph/ng_iface.c

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Sat Nov  2 14:20:29 2013(r257547)
+++ head/sys/net/if_ethersubr.c Sat Nov  2 15:13:02 2013(r257548)
@@ -642,7 +642,7 @@ ether_input_internal(struct ifnet *ifp, 
}
 
if (harvest.ethernet)
-   random_harvest(mtod(m, const void *), 12, 2, RANDOM_NET_ETHER);
+   random_harvest(&(m->m_data), 12, 2, RANDOM_NET_ETHER);
 
ether_demux(ifp, m);
CURVNET_RESTORE();

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Sat Nov  2 14:20:29 2013(r257547)
+++ head/sys/net/if_tun.c   Sat Nov  2 15:13:02 2013(r257548)
@@ -919,7 +919,7 @@ tunwrite(struct cdev *dev, struct uio *u
return (EAFNOSUPPORT);
}
if (harvest.point_to_point)
-   random_harvest(mtod(m, const void *), 12, 2, RANDOM_NET_TUN);
+   random_harvest(&(m->m_data), 12, 2, RANDOM_NET_TUN);
ifp->if_ibytes += m->m_pkthdr.len;
ifp->if_ipackets++;
CURVNET_SET(ifp->if_vnet);

Modified: head/sys/netgraph/ng_iface.c
==
--- head/sys/netgraph/ng_iface.cSat Nov  2 14:20:29 2013
(r257547)
+++ head/sys/netgraph/ng_iface.cSat Nov  2 15:13:02 2013
(r257548)
@@ -776,7 +776,7 @@ ng_iface_rcvdata(hook_p hook, item_p ite
return (EAFNOSUPPORT);
}
if (harvest.point_to_point)
-   random_harvest(mtod(m, const void *), 12, 2, RANDOM_NET_NG);
+   random_harvest(&(m->m_data), 12, 2, RANDOM_NET_NG);
M_SETFIB(m, ifp->if_fib);
netisr_dispatch(isr, m);
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: r257549 - head/sys/arm/include

2013-11-02 Thread Alan Cox
Author: alc
Date: Sat Nov  2 17:08:20 2013
New Revision: 257549
URL: http://svnweb.freebsd.org/changeset/base/257549

Log:
  Don't create a distinct free page pool for segregating allocations that are
  accessed through the direct map unless the kernel configuration actually
  includes a direct map.  Only a few configurations do, and for the rest the
  unnecessary free page pool is a small pessimization.
  
  Tested by:zbb
  MFC after:6 weeks

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

Modified: head/sys/arm/include/vmparam.h
==
--- head/sys/arm/include/vmparam.h  Sat Nov  2 15:13:02 2013
(r257548)
+++ head/sys/arm/include/vmparam.h  Sat Nov  2 17:08:20 2013
(r257549)
@@ -82,15 +82,21 @@
 #defineVM_PHYSSEG_DENSE
 
 /*
- * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool
- * from which physical pages are allocated and VM_FREEPOOL_DIRECT is
- * the pool from which physical pages for small UMA objects are
- * allocated.
+ * Create two or three free page pools depending on the existence of a direct
+ * map: VM_FREEPOOL_DEFAULT is the default pool from which physical pages are
+ * allocated, and VM_FREEPOOL_DIRECT is the pool from which physical pages for
+ * small UMA objects are allocated.
  */
+#ifdef ARM_USE_SMALL_ALLOC
 #defineVM_NFREEPOOL3
 #defineVM_FREEPOOL_CACHE   2
-#defineVM_FREEPOOL_DEFAULT 0
 #defineVM_FREEPOOL_DIRECT  1
+#else
+#defineVM_NFREEPOOL2
+#defineVM_FREEPOOL_CACHE   1
+#defineVM_FREEPOOL_DIRECT  0
+#endif
+#defineVM_FREEPOOL_DEFAULT 0
 
 /*
  * we support 2 free lists:
___
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: r257550 - head/sys/dev/netmap

2013-11-02 Thread Luigi Rizzo
Author: luigi
Date: Sat Nov  2 18:03:21 2013
New Revision: 257550
URL: http://svnweb.freebsd.org/changeset/base/257550

Log:
  circumvent a couple of warnings:
  - on line 2550 intentionally overriding a const qualifier
  - on line 3219 intentionally converting uint64_t to a pointer

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

Modified: head/sys/dev/netmap/netmap.c
==
--- head/sys/dev/netmap/netmap.cSat Nov  2 17:08:20 2013
(r257549)
+++ head/sys/dev/netmap/netmap.cSat Nov  2 18:03:21 2013
(r257550)
@@ -2547,7 +2547,7 @@ netmap_ioctl(struct cdev *dev, u_long cm
}
if (memflags & NETMAP_MEM_PRIVATE) {
nmr->nr_ringid |= NETMAP_PRIV_MEM;
-   *(uint32_t *)&nifp->ni_flags |= NI_PRIV_MEM;
+   *(uint32_t *)(uintptr_t)&nifp->ni_flags |= 
NI_PRIV_MEM;
}
nmr->nr_offset = netmap_mem_if_offset(na->nm_mem, nifp);
} while (0);
@@ -3216,7 +3216,7 @@ nm_bdg_preflush(struct netmap_adapter *n
/* this slot goes into a list so initialize the link field */
ft[ft_i].ft_next = NM_FT_NULL;
buf = ft[ft_i].ft_buf = (slot->flags & NS_INDIRECT) ?
-   (void *)slot->ptr : BDG_NMB(na->nm_mem, slot);
+   (void *)(uintptr_t)slot->ptr : BDG_NMB(na->nm_mem, 
slot);
prefetch(buf);
++ft_i;
if (slot->flags & NS_MOREFRAG) {
___
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: r257555 - in head/sys: netinet netinet6

2013-11-02 Thread Michael Tuexen
Author: tuexen
Date: Sat Nov  2 20:12:19 2013
New Revision: 257555
URL: http://svnweb.freebsd.org/changeset/base/257555

Log:
  Changes from upstream to improve compilation when INET or INET6
  or none of them is defined.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_asconf.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_pcb.c
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_asconf.c
==
--- head/sys/netinet/sctp_asconf.c  Sat Nov  2 20:06:17 2013
(r257554)
+++ head/sys/netinet/sctp_asconf.c  Sat Nov  2 20:12:19 2013
(r257555)
@@ -150,7 +150,12 @@ sctp_process_asconf_add_ip(struct sockad
struct mbuf *m_reply = NULL;
struct sockaddr_storage sa_store;
struct sctp_paramhdr *ph;
-   uint16_t param_type, param_length, aparam_length;
+   uint16_t param_type, aparam_length;
+
+#if defined(INET) || defined(INET6)
+   uint16_t param_length;
+
+#endif
struct sockaddr *sa;
int zero_address = 0;
int bad_address = 0;
@@ -169,8 +174,9 @@ sctp_process_asconf_add_ip(struct sockad
aparam_length = ntohs(aph->ph.param_length);
ph = (struct sctp_paramhdr *)(aph + 1);
param_type = ntohs(ph->param_type);
+#if defined(INET) || defined(INET6)
param_length = ntohs(ph->param_length);
-
+#endif
sa = (struct sockaddr *)&sa_store;
switch (param_type) {
 #ifdef INET
@@ -298,7 +304,12 @@ sctp_process_asconf_delete_ip(struct soc
struct mbuf *m_reply = NULL;
struct sockaddr_storage sa_store;
struct sctp_paramhdr *ph;
-   uint16_t param_type, param_length, aparam_length;
+   uint16_t param_type, aparam_length;
+
+#if defined(INET) || defined(INET6)
+   uint16_t param_length;
+
+#endif
struct sockaddr *sa;
int zero_address = 0;
int result;
@@ -317,8 +328,9 @@ sctp_process_asconf_delete_ip(struct soc
aparam_length = ntohs(aph->ph.param_length);
ph = (struct sctp_paramhdr *)(aph + 1);
param_type = ntohs(ph->param_type);
+#if defined(INET) || defined(INET6)
param_length = ntohs(ph->param_length);
-
+#endif
sa = (struct sockaddr *)&sa_store;
switch (param_type) {
 #ifdef INET
@@ -427,7 +439,12 @@ sctp_process_asconf_set_primary(struct s
struct mbuf *m_reply = NULL;
struct sockaddr_storage sa_store;
struct sctp_paramhdr *ph;
-   uint16_t param_type, param_length, aparam_length;
+   uint16_t param_type, aparam_length;
+
+#if defined(INET) || defined(INET6)
+   uint16_t param_length;
+
+#endif
struct sockaddr *sa;
int zero_address = 0;
 
@@ -445,8 +462,9 @@ sctp_process_asconf_set_primary(struct s
aparam_length = ntohs(aph->ph.param_length);
ph = (struct sctp_paramhdr *)(aph + 1);
param_type = ntohs(ph->param_type);
+#if defined(INET) || defined(INET6)
param_length = ntohs(ph->param_length);
-
+#endif
sa = (struct sockaddr *)&sa_store;
switch (param_type) {
 #ifdef INET
@@ -860,10 +878,12 @@ sctp_asconf_addr_match(struct sctp_ascon
 static uint32_t
 sctp_addr_match(struct sctp_paramhdr *ph, struct sockaddr *sa)
 {
+#if defined(INET) || defined(INET6)
uint16_t param_type, param_length;
 
param_type = ntohs(ph->param_type);
param_length = ntohs(ph->param_length);
+#endif
switch (sa->sa_family) {
 #ifdef INET6
case AF_INET6:
@@ -874,7 +894,7 @@ sctp_addr_match(struct sctp_paramhdr *ph
 
v6addr = (struct sctp_ipv6addr_param *)ph;
if ((param_type == SCTP_IPV6_ADDRESS) &&
-   param_length == sizeof(struct sctp_ipv6addr_param) 
&&
+   (param_length == sizeof(struct 
sctp_ipv6addr_param)) &&
(memcmp(&v6addr->addr, &sin6->sin6_addr,
sizeof(struct in6_addr)) == 0)) {
return (1);
@@ -890,7 +910,7 @@ sctp_addr_match(struct sctp_paramhdr *ph
 
v4addr = (struct sctp_ipv4addr_param *)ph;
if ((param_type == SCTP_IPV4_ADDRESS) &&
-   param_length == sizeof(struct sctp_ipv4addr_param) 
&&
+   (param_length == sizeof(struct 
sctp_ipv4addr_param)) &&
(memcmp(&v4addr->addr, &sin->sin_addr,
sizeof(struct in_addr)) == 0)) {
return (1);

Modified: head/sys/netinet/sctp_output.c
==
--- head/sys/netinet/sctp_output.c  Sat Nov  2 20:06:17 2013
(r257554)
+++ head/sys/netinet/sctp_output.c  Sat Nov  2 20:12:19 2013
(r257555)
@@ -1937,10 +1937,13 @@ sctp_is_address_in_

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

2013-11-02 Thread Ian Lepore
Author: ian
Date: Sat Nov  2 20:14:39 2013
New Revision: 257556
URL: http://svnweb.freebsd.org/changeset/base/257556

Log:
  Arrange for uart_cpu_fdt's probe() routine to use the same table of compat
  strings as uart_bus_fdt's probe().
  
  The bus code uses ofw_bus_search_compatible() and that's not an option in
  cpu (console) code -- it runs way before the ofw routines are usable.  So
  the console probe has its own loop to search the table, but now at least
  there's only one table to be maintained when new devices are added.

Modified:
  head/sys/dev/uart/uart.h
  head/sys/dev/uart/uart_bus_fdt.c
  head/sys/dev/uart/uart_cpu_fdt.c

Modified: head/sys/dev/uart/uart.h
==
--- head/sys/dev/uart/uart.hSat Nov  2 20:12:19 2013(r257555)
+++ head/sys/dev/uart/uart.hSat Nov  2 20:14:39 2013(r257556)
@@ -76,6 +76,11 @@ extern struct uart_class uart_pl011_clas
 extern struct uart_class uart_cdnc_class __attribute__((weak));
 extern struct uart_class uart_ti8250_class __attribute__((weak));
 
+#ifdef FDT
+struct ofw_compat_data;
+extern const struct ofw_compat_data *uart_fdt_compat_data;
+#endif
+
 #ifdef PC98
 struct uart_class *uart_pc98_getdev(u_long port);
 #endif

Modified: head/sys/dev/uart/uart_bus_fdt.c
==
--- head/sys/dev/uart/uart_bus_fdt.cSat Nov  2 20:12:19 2013
(r257555)
+++ head/sys/dev/uart/uart_bus_fdt.cSat Nov  2 20:14:39 2013
(r257556)
@@ -30,6 +30,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_platform.h"
+
 #include 
 #include 
 #include 
@@ -85,6 +87,9 @@ static struct ofw_compat_data compat_dat
{NULL,  (uintptr_t)NULL},
 };
 
+/* Export the compat_data table for use by the uart_cpu_fdt.c probe routine. */
+const struct ofw_compat_data *uart_fdt_compat_data = compat_data;
+
 static int
 uart_fdt_get_clock(phandle_t node, pcell_t *cell)
 {

Modified: head/sys/dev/uart/uart_cpu_fdt.c
==
--- head/sys/dev/uart/uart_cpu_fdt.cSat Nov  2 20:12:19 2013
(r257555)
+++ head/sys/dev/uart/uart_cpu_fdt.cSat Nov  2 20:14:39 2013
(r257556)
@@ -30,6 +30,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_platform.h"
+
 #include 
 #include 
 #include 
@@ -118,6 +120,7 @@ uart_cpu_getdev(int devtype, struct uart
const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout",
"stdin-path", "stdin", NULL};
const char **name;
+   const struct ofw_compat_data *cd;
struct uart_class *class;
phandle_t node, chosen;
pcell_t shift, br, rclk;
@@ -166,22 +169,13 @@ uart_cpu_getdev(int devtype, struct uart
/*
 * Finalize configuration.
 */
-   if (fdt_is_compatible(node, "fsl,imx-uart"))
-   class = &uart_imx_class;
-   else if (fdt_is_compatible(node, "quicc"))
-   class = &uart_quicc_class;
-   else if (fdt_is_compatible(node, "lpc"))
-   class = &uart_lpc_class;
-   else if (fdt_is_compatible(node, "arm,pl011"))
-   class = &uart_pl011_class;
-   else if (fdt_is_compatible(node, "exynos"))
-   class = &uart_s3c2410_class;
-   else if (fdt_is_compatible(node, "cadence,uart"))
-   class = &uart_cdnc_class;
-   else if (fdt_is_compatible(node, "ti,ns16550"))
-   class = &uart_ti8250_class;
-   else if (fdt_is_compatible(node, "ns16550"))
-   class = &uart_ns8250_class;
+   for (cd = uart_fdt_compat_data; cd->ocd_str != NULL; ++cd) {
+   if (fdt_is_compatible(node, cd->ocd_str))
+   break;
+   }
+   if (cd->ocd_str == NULL)
+   return (ENXIO);
+   class = (struct uart_class *)cd->ocd_data;
 
di->bas.chan = 0;
di->bas.regshft = (u_int)shift;
___
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: r257557 - head/sys/arm/freescale/imx

2013-11-02 Thread Ian Lepore
Author: ian
Date: Sat Nov  2 21:07:39 2013
New Revision: 257557
URL: http://svnweb.freebsd.org/changeset/base/257557

Log:
  Add a missing register definition.

Modified:
  head/sys/arm/freescale/imx/imx6_anatopreg.h

Modified: head/sys/arm/freescale/imx/imx6_anatopreg.h
==
--- head/sys/arm/freescale/imx/imx6_anatopreg.h Sat Nov  2 20:14:39 2013
(r257556)
+++ head/sys/arm/freescale/imx/imx6_anatopreg.h Sat Nov  2 21:07:39 2013
(r257557)
@@ -81,6 +81,17 @@
 #defineIMX6_ANALOG_CCM_PFD_528_SET 0x104
 #defineIMX6_ANALOG_CCM_PFD_528_CLR 0x108
 #defineIMX6_ANALOG_CCM_PFD_528_TOG 0x10C
+#defineIMX6_ANALOG_PMU_REG_CORE0x140
+#define  IMX6_ANALOG_PMU_REG2_TARG_SHIFT 18
+#define  IMX6_ANALOG_PMU_REG2_TARG_MASK   \
+(0x1f << IMX6_ANALOG_PMU_REG2_TARG_SHIFT)
+#define  IMX6_ANALOG_PMU_REG1_TARG_SHIFT  9
+#define  IMX6_ANALOG_PMU_REG1_TARG_MASK   \
+(0x1f << IMX6_ANALOG_PMU_REG1_TARG_SHIFT)
+#define  IMX6_ANALOG_PMU_REG0_TARG_SHIFT  0
+#define  IMX6_ANALOG_PMU_REG0_TARG_MASK   \
+(0x1f << IMX6_ANALOG_PMU_REG0_TARG_SHIFT)
+
 #defineIMX6_ANALOG_CCM_MISC0   0x150
 #defineIMX6_ANALOG_CCM_MISC0_SET   0x154
 #defineIMX6_ANALOG_CCM_MISC0_CLR   0x158
___
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: r256849 - in head/sys: kern sys

2013-11-02 Thread Jilles Tjoelker
On Mon, Oct 21, 2013 at 04:44:53PM +, Konstantin Belousov wrote:
> Author: kib
> Date: Mon Oct 21 16:44:53 2013
> New Revision: 256849
> URL: http://svnweb.freebsd.org/changeset/base/256849

> Log:
>   Add a resource limit for the total number of kqueues available to the
>   user.  Kqueue now saves the ucred of the allocating thread, to
>   correctly decrement the counter on close.

>   Under some specific and not real-world use scenario for kqueue, it is
>   possible for the kqueues to consume memory proportional to the square
>   of the number of the filedescriptors available to the process.  Limit
>   allows administrator to prevent the abuse.

>   This is kernel-mode side of the change, with the user-mode enabling
>   commit following.

>   Reported and tested by: pho
>   Discussed with: jmg
>   Sponsored by:   The FreeBSD Foundation
>   MFC after:  2 weeks

> [snip]
> + if (!chgkqcnt(cred->cr_ruidinfo, 1, lim_cur(td->td_proc,
> + RLIMIT_KQUEUES))) {
> + PROC_UNLOCK(p);
> + crfree(cred);
> + return (EMFILE);
> + }

Perhaps this error should be [ENOMEM] instead of [EMFILE] as it is
unrelated to the number of file descriptors in the process. This error
is already listed in the kqueue(2) man page but appears to be not
generated. The rlimit can then be mentioned in the man page.

-- 
Jilles Tjoelker
___
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: r256849 - in head/sys: kern sys

2013-11-02 Thread Konstantin Belousov
On Sat, Nov 02, 2013 at 10:17:27PM +0100, Jilles Tjoelker wrote:
> On Mon, Oct 21, 2013 at 04:44:53PM +, Konstantin Belousov wrote:
> > Author: kib
> > Date: Mon Oct 21 16:44:53 2013
> > New Revision: 256849
> > URL: http://svnweb.freebsd.org/changeset/base/256849
> 
> > Log:
> >   Add a resource limit for the total number of kqueues available to the
> >   user.  Kqueue now saves the ucred of the allocating thread, to
> >   correctly decrement the counter on close.
> 
> >   Under some specific and not real-world use scenario for kqueue, it is
> >   possible for the kqueues to consume memory proportional to the square
> >   of the number of the filedescriptors available to the process.  Limit
> >   allows administrator to prevent the abuse.
> 
> >   This is kernel-mode side of the change, with the user-mode enabling
> >   commit following.
> 
> >   Reported and tested by:   pho
> >   Discussed with:   jmg
> >   Sponsored by: The FreeBSD Foundation
> >   MFC after:2 weeks
> 
> > [snip]
> > +   if (!chgkqcnt(cred->cr_ruidinfo, 1, lim_cur(td->td_proc,
> > +   RLIMIT_KQUEUES))) {
> > +   PROC_UNLOCK(p);
> > +   crfree(cred);
> > +   return (EMFILE);
> > +   }
> 
> Perhaps this error should be [ENOMEM] instead of [EMFILE] as it is
> unrelated to the number of file descriptors in the process. This error
> is already listed in the kqueue(2) man page but appears to be not
> generated. The rlimit can then be mentioned in the man page.

This is reasonable.  Would you make the change yourself, please ?



pgpFVUtUxKY6f.pgp
Description: PGP signature


Re: svn commit: r257535 - head/sys/netgraph

2013-11-02 Thread Bruce Evans

On Sat, 2 Nov 2013, Mark R V Murray wrote:


On 2 Nov 2013, at 09:32, Mark R V Murray  wrote:

Mark - did you initially mean the address of the mbuf m_data pointer,
or the data payload itself?


As Bruce says - the address of payload data itself. We don?t have 12-byte 
pointers in FreeBSD. :-)


Cancel that.

The address passed must be the address of the m_data field in the mbuf 
structure. The harvested data is 12 bytes from that address forward, so not the 
data pointed to by that m_data pointer but the pointer value itself and some 
following junk too.


Is that really worth using?  The mbuf data pointer is only slightly more
random than the mbuf pointer (equally non-random if the data is in the
mbuf).  The bytes following it are even less random.

I think the mbuf pointer usually points to an IP header.  12 bytes
gives everything except the source and destination addresses.  20 would
cover those too.  There can't be buffer overruns in practice, even with
a much larger size since small buffers go in the mbuf.

In the mbuf header starting at the data pointer, there are always 16
bytes in the header alone, and many more after the header.  On 32-bit
systems, the header has 2 more bytes in mh_type after the 12 followed
by 2 bytes of unnamed padding.  The padding might be random but is
more likely to be always 0.  16 altogether.  On 64-bit systems, the
header has 4 more bytes in mh_flags after the 12, then 2+2 for mh_type
and padding as above, then 4 more of unnamed padding.  24 altogether.

So why 12?

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

Re: svn commit: r257535 - head/sys/netgraph

2013-11-02 Thread Mark R V Murray

On 2 Nov 2013, at 22:28, Bruce Evans  wrote:

> On Sat, 2 Nov 2013, Mark R V Murray wrote:
> 
>> On 2 Nov 2013, at 09:32, Mark R V Murray  wrote:
 Mark - did you initially mean the address of the mbuf m_data pointer,
 or the data payload itself?
>>> 
>>> As Bruce says - the address of payload data itself. We don’t have 12-byte 
>>> pointers in FreeBSD. :-)
>> 
>> Cancel that.
>> 
>> The address passed must be the address of the m_data field in the mbuf 
>> structure. The harvested data is 12 bytes from that address forward, so not 
>> the data pointed to by that m_data pointer but the pointer value itself and 
>> some following junk too.
> 
> Is that really worth using?

Yes. Most of the value comes from the timing. The 12 bytes we snatch on the way 
past are opportunistic, and hopefully cheap due to being in-cache.

M
-- 
-- 
Mark R V Murray



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r257561 - head/sys/arm/freescale/imx

2013-11-02 Thread Ian Lepore
Author: ian
Date: Sat Nov  2 22:44:35 2013
New Revision: 257561
URL: http://svnweb.freebsd.org/changeset/base/257561

Log:
  Bugfix:  the attach routine needs to use the same table of fdt compat
  strings that the probe routine used.

Modified:
  head/sys/arm/freescale/imx/imx_sdhci.c

Modified: head/sys/arm/freescale/imx/imx_sdhci.c
==
--- head/sys/arm/freescale/imx/imx_sdhci.c  Sat Nov  2 22:18:41 2013
(r257560)
+++ head/sys/arm/freescale/imx/imx_sdhci.c  Sat Nov  2 22:44:35 2013
(r257561)
@@ -558,13 +558,9 @@ imx_sdhci_attach(device_t dev)
 
sc->dev = dev;
 
-   if (ofw_bus_is_compatible(dev, "fsl,imx51-esdhc")) {
-   sc->hwtype = HWTYPE_ESDHC;
-   } else if (ofw_bus_is_compatible(dev, "fsl,imx-usdhc")) {
-   sc->hwtype = HWTYPE_USDHC;
-   } else {
+   sc->hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+   if (sc->hwtype == HWTYPE_NONE)
panic("Impossible: not compatible in imx_sdhci_attach()");
-   }
 
rid = 0;
sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
___
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: this breaks builds of head on stable/9 (Re: svn commit: r257268 - head/gnu/usr.bin/binutils/ld

2013-11-02 Thread Simon J. Gerraty

On Fri, 1 Nov 2013 17:15:32 -0500, Brooks Davis writes:
>(In practice WITHOUT_BMAKE is broken and corrupts your object tree with a
>make that fails until manually deleted.) 

That's new? it worked last time I checked - which was around the time
I made sure the make thus built was named for the flavor (fmake or
bmake) desired so wouldn't accidentally be used when you change your
mind.

>We should decide if it should be fixed or removed before 10 goes out.

AFAIK I committed workarounds for all the functional differences
that worried people, before 10 was branched.
So perhaps WITHOUT_BMAKE can be deprecated.



___
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: this breaks builds of head on stable/9 (Re: svn commit: r257268 - head/gnu/usr.bin/binutils/ld

2013-11-02 Thread Simon J. Gerraty
>told me what was wrong.  The issue is that the :U modifer I used is a
>bmake feature and that the toolchain target doesn't bootstrap bmake (or
>perhaps doesn't do it early enough).  I plan to commit a workaround for

Hmmm toolchain is in the same TGTS list as buildworld, so should depend
on upgrade_checks which is how the needed make gets built.
Oh, that only applies if ALWAYS_CHECK_MAKE is defined.

Might be a good idea to set ALWAYS_CHECK_MAKE is host isn't head?

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