Re: svn commit: r233937 - in head/sys: kern net security/mac

2012-04-16 Thread Alexander V. Chernikov

On 16.04.2012 01:17, Adrian Chadd wrote:

Hi,

This has broken (at least) net80211 and bpf, with LOR:

Yes, it is. Please try the attached patch


# ifconfig wlan1 destroy
panic: mutex bpf global lock now owned at ../net/bpf.c:656


The stack:

* ieee80211_vap_detach()
* ether_ifdetach()
* bpfdetach()
*something  - I bet this is bpf_detachd()
* _mtx_assert()



From 5e621db1dae528f228e94374702d03501138fb1b Mon Sep 17 00:00:00 2001
From: Alexander V. Chernikov melif...@ipfw.ru
Date: Wed, 11 Apr 2012 20:04:58 +0400
Subject: [PATCH 1/1] * Final BPF locks patch

---
 sys/net/bpf.c |  379 +++--
 sys/net/bpf.h |1 +
 sys/net/bpfdesc.h |2 +
 3 files changed, 283 insertions(+), 99 deletions(-)

diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index d87efc0..2556be4 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -147,6 +147,7 @@ static int  bpf_bpfd_cnt;
 
 static voidbpf_attachd(struct bpf_d *, struct bpf_if *);
 static voidbpf_detachd(struct bpf_d *);
+static voidbpf_detachd_locked(struct bpf_d *);
 static voidbpf_freed(struct bpf_d *);
 static int bpf_movein(struct uio *, int, struct ifnet *, struct mbuf **,
struct sockaddr *, int *, struct bpf_insn *);
@@ -206,6 +207,37 @@ static struct filterops bpfread_filtops = {
.f_event = filt_bpfread,
 };
 
+eventhandler_tag   bpf_ifdetach_cookie = NULL;
+
+/*
+ * LOCKING MODEL USED BY BPF:
+ * Locks:
+ * 1) global lock (BPF_LOCK). Mutex, used to protect interface 
addition/removal,
+ * some global counters and every bpf_if reference.
+ * 2) Interface lock. Rwlock, used to protect list of BPF descriptors and 
their filters.
+ * 3) Descriptor lock. Rwlock, used to protect BPF buffers and various 
structure fields
+ *   used by bpf_mtap code.
+ *
+ * Lock order:
+ *
+ * Global lock, interface lock, descriptor lock
+ *
+ * We have to acquire interface lock before descriptor main lock due to 
BPF_MTAP[2]
+ * working model. In many places (like bpf_detachd) we start with BPF 
descriptor
+ * (and we need to at least rlock it to get reliable interface pointer). This
+ * gives us potential LOR. As a result, we use global lock to protect from 
bpf_if
+ * change in every such place.
+ *
+ * Changing d-bd_bif is protected by 1) global lock, 2) interface lock and
+ * 3) descriptor main wlock.
+ * Reading bd_bif can be protected by any of these locks, typically global 
lock.
+ *
+ * Changing read/write BPF filter is protected by the same three locks,
+ * the same applies for reading.
+ *
+ * Sleeping in global lock is not allowed due to bpfdetach() using it.
+ */
+
 /*
  * Wrapper functions for various buffering methods.  If the set of buffer
  * modes expands, we will probably want to introduce a switch data structure
@@ -577,6 +609,14 @@ bad:
 static void
 bpf_attachd(struct bpf_d *d, struct bpf_if *bp)
 {
+   int op_w;
+
+   BPF_LOCK_ASSERT();
+
+   op_w = V_bpf_optimize_writers;
+
+   if (d-bd_bif != NULL)
+   bpf_detachd_locked(d);
/*
 * Point d at bp, and add d to the interface's list.
 * Since there are many applicaiotns using BPF for
@@ -584,11 +624,13 @@ bpf_attachd(struct bpf_d *d, struct bpf_if *bp)
 * we can delay adding d to the list of active listeners until
 * some filter is configured.
 */
-   d-bd_bif = bp;
 
BPFIF_WLOCK(bp);
+   BPFD_WLOCK(d);
+
+   d-bd_bif = bp;
 
-   if (V_bpf_optimize_writers != 0) {
+   if (op_w != 0) {
/* Add to writers-only list */
LIST_INSERT_HEAD(bp-bif_wlist, d, bd_next);
/*
@@ -600,16 +642,15 @@ bpf_attachd(struct bpf_d *d, struct bpf_if *bp)
} else
LIST_INSERT_HEAD(bp-bif_dlist, d, bd_next);
 
+   BPFD_WUNLOCK(d);
BPFIF_WUNLOCK(bp);
 
-   BPF_LOCK();
bpf_bpfd_cnt++;
-   BPF_UNLOCK();
 
CTR3(KTR_NET, %s: bpf_attach called by pid %d, adding to %s list,
__func__, d-bd_pid, d-bd_writer ? writer : active);
 
-   if (V_bpf_optimize_writers == 0)
+   if (op_w == 0)
EVENTHANDLER_INVOKE(bpf_track, bp-bif_ifp, bp-bif_dlt, 1);
 }
 
@@ -622,8 +663,20 @@ bpf_upgraded(struct bpf_d *d)
 {
struct bpf_if *bp;
 
+   BPF_LOCK_ASSERT();
bp = d-bd_bif;
 
+   /*
+* Filter can be set several times without specifying interface.
+* Mark d as reader and exit.
+*/
+   if (bp == NULL) {
+   BPFD_WLOCK(d);
+   d-bd_writer = 0;
+   BPFD_WUNLOCK(d);
+   return;
+   }
+
BPFIF_WLOCK(bp);
BPFD_WLOCK(d);
 
@@ -647,15 +700,26 @@ bpf_upgraded(struct bpf_d *d)
 static void
 bpf_detachd(struct bpf_d *d)
 {
+   BPF_LOCK();
+   bpf_detachd_locked(d);
+   BPF_UNLOCK();
+}
+
+/*
+ * Detach a file from its interface.
+ */
+static void
+bpf_detachd_locked(struct bpf_d *d)
+{
int 

Re: svn commit: r234329 - head/lib/libc/net

2012-04-16 Thread Gleb Smirnoff
On Sun, Apr 15, 2012 at 11:56:04PM +, Eitan Adler wrote:
E Author: eadler
E Date: Sun Apr 15 23:56:03 2012
E New Revision: 234329
E URL: http://svn.freebsd.org/changeset/base/234329
E 
E Log:
E   When searching for uninitialized memory usage add ensure that the entire
E   struct is set to zero.
E   
E   PR:bin/166483
E   Submitted by:  Roy Marples r...@marples.name
E   Reviewed by:   delphij
E   Approved by:   cperciva
E   MFC after: 3 days
E 
E Modified:
E   head/lib/libc/net/if_nametoindex.c
E 
E Modified: head/lib/libc/net/if_nametoindex.c
E 
==
E --- head/lib/libc/net/if_nametoindex.c   Sun Apr 15 23:50:13 2012
(r234328)
E +++ head/lib/libc/net/if_nametoindex.c   Sun Apr 15 23:56:03 2012
(r234329)
E @@ -70,6 +70,9 @@ if_nametoindex(const char *ifname)
E  
E  s = _socket(AF_INET, SOCK_DGRAM, 0);
E  if (s != -1) {
E +#ifdef PURIFY
E +memset(ifr, 0, sizeof(ifr));
E +#endif
E  strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
E  if (_ioctl(s, SIOCGIFINDEX, ifr) != -1) {
E  _close(s);

Is that PURIFY documented anywhere?

-- 
Totus tuus, Glebius.
___
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: r234336 - head/cddl/contrib/opensolaris/cmd/zpool

2012-04-16 Thread Martin Matuska
Author: mm
Date: Mon Apr 16 08:19:43 2012
New Revision: 234336
URL: http://svn.freebsd.org/changeset/base/234336

Log:
  Fix typo miror - mirror
  
  Reported by:  Glen Barber g...@freebsd.org
  MFC after:3 days

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool.8

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8
==
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Apr 16 04:33:37 
2012(r234335)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Apr 16 08:19:43 
2012(r234336)
@@ -1779,7 +1779,7 @@ The following command creates a
 storage pool consisting of two, two-way
 mirrors and mirrored log devices:
 .Bd -literal -offset 2n
-.Li # Ic zpool create pool mirror da0 da1 mirror da2 da3 log miror da4 da5
+.Li # Ic zpool create pool mirror da0 da1 mirror da2 da3 log mirror da4 da5
 .Ed
 .It Sy Example 14 No Adding Cache Devices to a Tn ZFS No Pool
 .Pp
___
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: r234337 - in head: lib/libc/arm/gen sys/arm/include

2012-04-16 Thread Andrew Turner
Author: andrew
Date: Mon Apr 16 09:38:20 2012
New Revision: 234337
URL: http://svn.freebsd.org/changeset/base/234337

Log:
  Replace the C implementation of __aeabi_read_tp with an assembly version.
  This ensures we follow the ABI by preserving registers r1-r3.
  
  Reviewed by:  jmallett, imp

Added:
  head/lib/libc/arm/gen/__aeabi_read_tp.S   (contents, props changed)
Deleted:
  head/lib/libc/arm/gen/__aeabi_read_tp.c
Modified:
  head/lib/libc/arm/gen/Makefile.inc
  head/sys/arm/include/armreg.h
  head/sys/arm/include/sysarch.h

Modified: head/lib/libc/arm/gen/Makefile.inc
==
--- head/lib/libc/arm/gen/Makefile.inc  Mon Apr 16 08:19:43 2012
(r234336)
+++ head/lib/libc/arm/gen/Makefile.inc  Mon Apr 16 09:38:20 2012
(r234337)
@@ -3,4 +3,4 @@
 
 SRCS+= _ctx_start.S _setjmp.S _set_tp.c alloca.S fabs.c \
getcontextx.c infinity.c ldexp.c makecontext.c \
-   __aeabi_read_tp.c setjmp.S signalcontext.c sigsetjmp.S divsi3.S 
flt_rounds.c
+   __aeabi_read_tp.S setjmp.S signalcontext.c sigsetjmp.S divsi3.S 
flt_rounds.c

Added: head/lib/libc/arm/gen/__aeabi_read_tp.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/lib/libc/arm/gen/__aeabi_read_tp.S Mon Apr 16 09:38:20 2012
(r234337)
@@ -0,0 +1,40 @@
+/*-
+ * Copyright (c) 2012 Oleksandr Tymoshenko
+ * Copyright (c) 2012 Andrew Turner
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include machine/asm.h
+__FBSDID($FreeBSD$);
+
+#include machine/sysarch.h
+
+ENTRY(__aeabi_read_tp)
+   ldr r0, .Larm_tp_address
+   ldr r0, [r0]
+   RET
+
+.Larm_tp_address:
+   .word ARM_TP_ADDRESS
+

Modified: head/sys/arm/include/armreg.h
==
--- head/sys/arm/include/armreg.h   Mon Apr 16 08:19:43 2012
(r234336)
+++ head/sys/arm/include/armreg.h   Mon Apr 16 09:38:20 2012
(r234337)
@@ -316,8 +316,13 @@
 /*
  * Address of the vector page, low and high versions.
  */
+#ifndef __ASSEMBLER__
 #defineARM_VECTORS_LOW 0xU
 #defineARM_VECTORS_HIGH0xU
+#else
+#defineARM_VECTORS_LOW 0
+#defineARM_VECTORS_HIGH0x
+#endif
 
 /*
  * ARM Instructions

Modified: head/sys/arm/include/sysarch.h
==
--- head/sys/arm/include/sysarch.h  Mon Apr 16 08:19:43 2012
(r234336)
+++ head/sys/arm/include/sysarch.h  Mon Apr 16 09:38:20 2012
(r234337)
@@ -55,6 +55,7 @@
 #define ARM_RAS_END(ARM_TP_ADDRESS + 8)
 
 #ifndef LOCORE
+#ifndef __ASSEMBLER__
 
 #include sys/cdefs.h
 
@@ -85,6 +86,7 @@ int   sysarch(int, void *);
 __END_DECLS
 #endif
 
+#endif /* __ASSEMBLER__ */
 #endif /* LOCORE */
 
 #endif /* !_ARM_SYSARCH_H_ */
___
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: r234338 - head/sys/pci

2012-04-16 Thread Andriy Gapon
Author: avg
Date: Mon Apr 16 10:33:46 2012
New Revision: 234338
URL: http://svn.freebsd.org/changeset/base/234338

Log:
  intpm: add ATI IXP400 pci id
  
  PR:   kern/136762
  Submitted by: Aurelien Mere free...@amc-os.com
  Tested by:Jens Link jens.l...@gmx.de
  MFC after:5 days

Modified:
  head/sys/pci/intpm.c

Modified: head/sys/pci/intpm.c
==
--- head/sys/pci/intpm.cMon Apr 16 09:38:20 2012(r234337)
+++ head/sys/pci/intpm.cMon Apr 16 10:33:46 2012(r234338)
@@ -98,6 +98,9 @@ intsmb_probe(device_t dev)
 #endif
device_set_desc(dev, Intel PIIX4 SMBUS Interface);
break;
+   case 0x43721002:
+   device_set_desc(dev, ATI IXP400 SMBus Controller);
+   break;
case 0x43851002:
/* SB800 and newer can not be configured in a compatible way. */
if (pci_get_revid(dev) = 0x40)
___
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: r234339 - head/sys/boot/i386/zfsboot

2012-04-16 Thread Andriy Gapon
Author: avg
Date: Mon Apr 16 10:43:06 2012
New Revision: 234339
URL: http://svn.freebsd.org/changeset/base/234339

Log:
  zfsboot: honor -q if it's present in boot.config
  
  Before r228267 the option was honored but the original content of
  boot.config was not preserved.  I tried to fix that but missed the idea.
  Now the proper way of doing things is taken from i386/boo2.
  Also, a comment is added to explain this a little bit unobvious
  behavior.
  
  Inspired by:  jhb
  MFC after:5 days

Modified:
  head/sys/boot/i386/zfsboot/zfsboot.c

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cMon Apr 16 10:33:46 2012
(r234338)
+++ head/sys/boot/i386/zfsboot/zfsboot.cMon Apr 16 10:43:06 2012
(r234339)
@@ -93,6 +93,7 @@ static const char *const dev_nm[NDEV] = 
 static const unsigned char dev_maj[NDEV] = {30, 4, 2};
 
 static char cmd[512];
+static char cmddup[512];
 static char kname[1024];
 static int comspeed = SIOSPD;
 static struct bootinfo bootinfo;
@@ -541,10 +542,15 @@ main(void)
 }
 
 if (*cmd) {
-   if (!OPT_CHECK(RBX_QUIET))
-   printf(%s: %s, PATH_CONFIG, cmd);
+   /*
+* Note that parse() is destructive to cmd[] and we also want
+* to honor RBX_QUIET option that could be present in cmd[].
+*/
+   memcpy(cmddup, cmd, sizeof(cmd));
if (parse())
autoboot = 0;
+   if (!OPT_CHECK(RBX_QUIET))
+   printf(%s: %s, PATH_CONFIG, cmddup);
/* Do not process this command twice */
*cmd = 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: r234341 - head/sys/netgraph

2012-04-16 Thread Marko Zec
Author: zec
Date: Mon Apr 16 13:41:46 2012
New Revision: 234341
URL: http://svn.freebsd.org/changeset/base/234341

Log:
  #include net/vnet.h is no longer needed here.
  
  Spotted by:   Ed Maste
  MFC after:3 days.

Modified:
  head/sys/netgraph/ng_source.c

Modified: head/sys/netgraph/ng_source.c
==
--- head/sys/netgraph/ng_source.c   Mon Apr 16 12:49:19 2012
(r234340)
+++ head/sys/netgraph/ng_source.c   Mon Apr 16 13:41:46 2012
(r234341)
@@ -68,7 +68,6 @@ __FBSDID($FreeBSD$);
 #include sys/syslog.h
 #include net/if.h
 #include net/if_var.h
-#include net/vnet.h
 #include netgraph/ng_message.h
 #include netgraph/netgraph.h
 #include netgraph/ng_parse.h
___
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: r234342 - head/sys/netinet

2012-04-16 Thread Gleb Smirnoff
Author: glebius
Date: Mon Apr 16 13:49:03 2012
New Revision: 234342
URL: http://svn.freebsd.org/changeset/base/234342

Log:
  When we receive an ICMP unreach need fragmentation datagram, we take
  proposed MTU value from it and update the TCP host cache. Then
  tcp_mss_update() is called on the corresponding tcpcb. It finds the
  just allocated entry in the TCP host cache and updates MSS on the
  tcpcb. And then we do a fast retransmit of what we have in the tcp
  send buffer.
  
  This sequence gets broken if the TCP host cache is exausted. In this
  case allocation fails, and later called tcp_mss_update() finds nothing
  in cache. The fast retransmit is done with not reduced MSS and is
  immidiately replied by remote host with new ICMP datagrams and the
  cycle repeats. This ping-pong can go up to wirespeed.
  
  To fix this:
  - tcp_mss_update() gets new parameter - mtuoffer, that is like
offer, but needs to have min_protoh subtracted.
  - tcp_mtudisc() as notification method renamed to tcp_mtudisc_notify().
  - tcp_mtudisc() now accepts not a useless error argument, but proposed
MTU value, that is passed to tcp_mss_update() as mtuoffer.
  
  Reported by:  az
  Reported by:  Andrey Zonov andrey zonov.org
  Reviewed by:  andre (previous version of patch)

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_output.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cMon Apr 16 13:41:46 2012
(r234341)
+++ head/sys/netinet/tcp_input.cMon Apr 16 13:49:03 2012
(r234342)
@@ -3288,22 +3288,19 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt
  * are present.  Store the upper limit of the length of options plus
  * data in maxopd.
  *
- * In case of T/TCP, we call this routine during implicit connection
- * setup as well (offer = -1), to initialize maxseg from the cached
- * MSS of our peer.
- *
  * NOTE that this routine is only called when we process an incoming
- * segment. Outgoing SYN/ACK MSS settings are handled in tcp_mssopt().
+ * segment, or an ICMP need fragmentation datagram. Outgoing SYN/ACK MSS
+ * settings are handled in tcp_mssopt().
  */
 void
-tcp_mss_update(struct tcpcb *tp, int offer,
+tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
 struct hc_metrics_lite *metricptr, int *mtuflags)
 {
int mss = 0;
u_long maxmtu = 0;
struct inpcb *inp = tp-t_inpcb;
struct hc_metrics_lite metrics;
-   int origoffer = offer;
+   int origoffer;
 #ifdef INET6
int isipv6 = ((inp-inp_vflag  INP_IPV6) != 0) ? 1 : 0;
size_t min_protoh = isipv6 ?
@@ -3315,6 +3312,12 @@ tcp_mss_update(struct tcpcb *tp, int off
 
INP_WLOCK_ASSERT(tp-t_inpcb);
 
+   if (mtuoffer != -1) {
+   KASSERT(offer == -1, (%s: conflict, __func__));
+   offer = mtuoffer - min_protoh;
+   }
+   origoffer = offer;
+
/* Initialize. */
 #ifdef INET6
if (isipv6) {
@@ -3473,7 +3476,7 @@ tcp_mss(struct tcpcb *tp, int offer)
 
KASSERT(tp != NULL, (%s: tp == NULL, __func__));

-   tcp_mss_update(tp, offer, metrics, mtuflags);
+   tcp_mss_update(tp, offer, -1, metrics, mtuflags);
 
mss = tp-t_maxseg;
inp = tp-t_inpcb;

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Mon Apr 16 13:41:46 2012
(r234341)
+++ head/sys/netinet/tcp_output.c   Mon Apr 16 13:49:03 2012
(r234342)
@@ -1293,7 +1293,7 @@ out:
 */
if (tso)
tp-t_flags = ~TF_TSO;
-   tcp_mtudisc(tp-t_inpcb, 0);
+   tcp_mtudisc(tp-t_inpcb, -1);
return (0);
case EHOSTDOWN:
case EHOSTUNREACH:

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Mon Apr 16 13:41:46 2012(r234341)
+++ head/sys/netinet/tcp_subr.c Mon Apr 16 13:49:03 2012(r234342)
@@ -222,6 +222,7 @@ VNET_DEFINE(uma_zone_t, sack_hole_zone);
 VNET_DEFINE(struct hhook_head *, tcp_hhh[HHOOK_TCP_LAST+1]);
 
 static struct inpcb *tcp_notify(struct inpcb *, int);
+static struct inpcb *tcp_mtudisc_notify(struct inpcb *, int);
 static char *  tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th,
void *ip4hdr, const void *ip6hdr);
 
@@ -1337,7 +1338,7 @@ tcp_ctlinput(int cmd, struct sockaddr *s
return;
 
if (cmd == PRC_MSGSIZE)
-   notify = tcp_mtudisc;
+   notify = tcp_mtudisc_notify;
else if (V_icmp_may_rst  (cmd == PRC_UNREACH_ADMIN_PROHIB ||
cmd == PRC_UNREACH_PORT || cmd == 

Re: svn commit: r234280 - head/sys/kern

2012-04-16 Thread John Baldwin
On Saturday, April 14, 2012 7:21:24 am Marius Strobl wrote:
 Author: marius
 Date: Sat Apr 14 11:21:24 2012
 New Revision: 234280
 URL: http://svn.freebsd.org/changeset/base/234280
 
 Log:
   Fix !DDB build after r234190.
 
 Modified:
   head/sys/kern/subr_turnstile.c

Doh, thanks for fixing!

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


Re: svn commit: r234074 - in head/sys: amd64/amd64 i386/i386

2012-04-16 Thread John Baldwin
On Saturday, April 14, 2012 7:05:35 pm Justin T. Gibbs wrote:
 
 On Apr 10, 2012, at 5:41 AM, Marius Strobl wrote:
 
  On Tue, Apr 10, 2012 at 01:03:56AM +0100, Attilio Rao wrote:
  Il 10 aprile 2012 00:09, Marius Strobl mar...@alchemy.franken.de ha 
scritto:
  On Mon, Apr 09, 2012 at 10:41:19PM +, Attilio Rao wrote:
  Author: attilio
  Date: Mon Apr ??9 22:41:19 2012
  New Revision: 234074
  URL: http://svn.freebsd.org/changeset/base/234074
  
  Log:
  ?? BSP is not added to the mask of valid target CPUs for interrupts
  ?? in set_apic_interrupt_ids(). Besides, set_apic_interrupts_ids() is 
not
  ?? called in the !SMP case too.
  ?? Fix this by:
  ?? - Adding the BSP as an interrupt target directly in cpu_startup().
  ?? - Remove an obsolete optimization where the BSP are skipped in
  ?? ?? set_apic_interrupt_ids().
  
  ?? Reported by: ?? ?? ?? ??jh
  ?? Reviewed by: ?? ?? ?? ??jhb
  ?? MFC after: ??3 days
  ?? X-MFC: ?? ?? ?? ?? ?? ?? ??r233961
  ?? Pointy hat to: ?? ?? ??me
  
  Modified:
  ?? head/sys/amd64/amd64/machdep.c
  ?? head/sys/amd64/amd64/mp_machdep.c
  ?? head/sys/i386/i386/machdep.c
  ?? head/sys/i386/i386/mp_machdep.c
  
  Modified: head/sys/amd64/amd64/machdep.c
  
==
  --- head/sys/amd64/amd64/machdep.c ?? ??Mon Apr ??9 22:01:43 2012 ?? ?? 
?? ??(r234073)
  +++ head/sys/amd64/amd64/machdep.c ?? ??Mon Apr ??9 22:41:19 2012 ?? ?? 
?? ??(r234074)
  @@ -295,6 +295,11 @@ cpu_startup(dummy)
  ?? ?? ?? vm_pager_bufferinit();
  
  ?? ?? ?? cpu_setregs();
  +
  + ?? ?? /*
  + ?? ?? ??* Add BSP as an interrupt target.
  + ?? ?? ??*/
  + ?? ?? intr_add_cpu(0);
  ??}
  
  If I'm not mistaken, intr_add_cpu() is under #ifdef SMP, so it should be
  here as well.
  
  You are right, sorry, I did forgot to test without SMP.
  I think we still need intr_add_cpu() on cpu_startup() because of the
  case smp_disabled = 1.
  I think the attached patch should make its dirty job, opinion?
  
  I currently fail to see why the latter approach would be necessary,
  i.e. IMO wrapping the intr_add_cpu() calls in cpu_startup() should
  be sufficient. In case the kernel is compiled without SMP support,
  interrupt balancing support isn't available in the first place and
  the BSP is always the only available target (see the UP version of
  intr_next_cpu() at the end of x86/x86/intr_machdep.c), so there's
  no need to add the BSP as a valid target. If an SMP kernel is run
  on a UP machine or with SMP disabled, interrupt balancing support
  is available but the intr_add_cpu() calls in cpu_startup() will add
  the BSP as (the only) target, so everything should be fine. Maybe
  you can elaborate on why you think an SMP kernel with SMP disabled
  needs special handling.
  
  Marius
 
 While functionally correct, I believe that wrapping intr_add_cpu()
 in machdep.c in SMP ifdefs is inferior to calling it in all cases.
 It invites questions like, In the UP case, don't we have to ensure
 that CPU0 is a valid interrupt target?  This is because casual
 visitors to this file don't know that intr_add_cpu() only impacts
 interrupt distribution.  Of course, this is just an artifact of the
 current implementation.  #ifdefs should be as close to the implemenation
 as possible.  This simplifies the task of making future enhancments.
 This is why I'd prefer to see these within the body of intr_add_cpu()
 than where they are now.
 
 I also think the comment could be improved to be something like:
 
   /*
* The BSP/CPU0 is always an interrupt target even if
* our probe of MP hardware fails or MP mode is disabled.
*/
   intr_add_cpu(0);

This is why my original patch had this all self-contained inside the
#ifdef SMP in sys/x86/x86/intr_machdep.c via a new SYSINIT().

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


svn commit: r234343 - head/share/misc

2012-04-16 Thread Armin Pirkovitsch
Author: sperber (ports committer)
Date: Mon Apr 16 15:08:01 2012
New Revision: 234343
URL: http://svn.freebsd.org/changeset/base/234343

Log:
  Add myself to committers-ports
  
  Approved by:  beat (mentor)

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

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotMon Apr 16 13:49:03 2012
(r234342)
+++ head/share/misc/committers-ports.dotMon Apr 16 15:08:01 2012
(r234343)
@@ -173,6 +173,7 @@ shaun [label=Shaun Amott\nshaun@FreeBSD
 simon [label=Simon L. Nielsen\nsi...@freebsd.org\n2005/01/08]
 skreuzer [label=Steven Kreuzer\nskreu...@freebsd.org\n2009/03/25]
 sobomax[label=Maxim Sobolev\nsobo...@freebsd.org\n2000/05/17]
+sperber[label=Armin Pirkovitsch\nsper...@freebsd.org\n2012/04/15]
 stas [label=Stanislav Sedov\ns...@freebsd.org\n2006/09/18]
 stefan [label=Stefan Walter\nste...@freebsd.org\n2006/05/07]
 stephen [label=Stephen Montgomery-Smith\nstep...@freebsd.org\n2011/06/13]
@@ -224,6 +225,7 @@ bapt - eadler
 bapt - jlaffaye
 
 beat - decke
+beat - sperber
 beat - uqs
 
 beech - glarkin
@@ -243,6 +245,8 @@ clsung - tabthorpe
 crees - jgh
 crees - madpilot
 
+decke - sperber
+
 delphij - nemoliu
 delphij - rafan
 
@@ -370,6 +374,7 @@ miwi - nox
 miwi - pawel
 miwi - rm
 miwi - sbz
+miwi - sperber
 miwi - sylvio
 miwi - tabthorpe
 miwi - trasz
___
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: r234329 - head/lib/libc/net

2012-04-16 Thread Eitan Adler
2012/4/16 Gleb Smirnoff gleb...@freebsd.org:
 Is that PURIFY documented anywhere?

I'm uncertain, but it isn't the only use in the source tree.


-- 
Eitan Adler
Source  Ports committer
X11, Bugbusting teams
___
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: r234329 - head/lib/libc/net

2012-04-16 Thread Gleb Smirnoff
On Mon, Apr 16, 2012 at 11:48:49AM -0400, Eitan Adler wrote:
E 2012/4/16 Gleb Smirnoff gleb...@freebsd.org:
E  Is that PURIFY documented anywhere?
E 
E I'm uncertain, but it isn't the only use in the source tree.

Is there any build with it? (rhetoric question)

I'm just afraid that committing fix under ifdef won't satisfy submitter
of the patch.

-- 
Totus tuus, Glebius.
___
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: r234345 - head/sbin/fdisk

2012-04-16 Thread Dmitry Morozovsky
Author: marck (doc committer)
Date: Mon Apr 16 17:30:19 2012
New Revision: 234345
URL: http://svn.freebsd.org/changeset/base/234345

Log:
  VMware environment is frequent nowadays.  Add VMFS id.
  
  MFC after:2 weeks

Modified:
  head/sbin/fdisk/fdisk.c

Modified: head/sbin/fdisk/fdisk.c
==
--- head/sbin/fdisk/fdisk.c Mon Apr 16 15:43:31 2012(r234344)
+++ head/sbin/fdisk/fdisk.c Mon Apr 16 17:30:19 2012(r234345)
@@ -218,6 +218,7 @@ static const char *const part_types[256]
[0xF1] = SpeedStor,
[0xF2] = DOS 3.3+ Secondary,
[0xF4] = SpeedStor large partition,
+   [0xFB] = VMware VMFS,
[0xFE] = SpeedStor 1024 cyl. or LANstep,
[0xFF] = Xenix bad blocks table,
 };
___
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: r234346 - head/sys/fs/tmpfs

2012-04-16 Thread Jaakko Heinonen
Author: jh
Date: Mon Apr 16 18:07:42 2012
New Revision: 234346
URL: http://svn.freebsd.org/changeset/base/234346

Log:
  tmpfs: Allow update mounts only for certain options.
  
  Since r230208 update mounts were allowed if the list of mount options
  contained the export option. This is not correct as tmpfs doesn't
  really support updating all options.
  
  Reviewed by:  kevlo, trociny

Modified:
  head/sys/fs/tmpfs/tmpfs.h
  head/sys/fs/tmpfs/tmpfs_vfsops.c

Modified: head/sys/fs/tmpfs/tmpfs.h
==
--- head/sys/fs/tmpfs/tmpfs.h   Mon Apr 16 17:30:19 2012(r234345)
+++ head/sys/fs/tmpfs/tmpfs.h   Mon Apr 16 18:07:42 2012(r234346)
@@ -387,6 +387,9 @@ struct tmpfs_mount {
 * tmpfs_pool.c. */
uma_zone_t  tm_dirent_pool;
uma_zone_t  tm_node_pool;
+
+   /* Read-only status. */
+   int tm_ronly;
 };
 #define TMPFS_LOCK(tm) mtx_lock((tm)-allnode_lock)
 #define TMPFS_UNLOCK(tm) mtx_unlock((tm)-allnode_lock)

Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c
==
--- head/sys/fs/tmpfs/tmpfs_vfsops.cMon Apr 16 17:30:19 2012
(r234345)
+++ head/sys/fs/tmpfs/tmpfs_vfsops.cMon Apr 16 18:07:42 2012
(r234346)
@@ -82,6 +82,10 @@ static const char *tmpfs_opts[] = {
NULL
 };
 
+static const char *tmpfs_updateopts[] = {
+   from, export, NULL
+};
+
 /* - */
 
 static int
@@ -150,12 +154,13 @@ tmpfs_mount(struct mount *mp)
return (EINVAL);
 
if (mp-mnt_flag  MNT_UPDATE) {
-   /*
-* Only support update mounts for NFS export.
-*/
-   if (vfs_flagopt(mp-mnt_optnew, export, NULL, 0))
-   return (0);
-   return (EOPNOTSUPP);
+   /* Only support update mounts for certain options. */
+   if (vfs_filteropt(mp-mnt_optnew, tmpfs_updateopts) != 0)
+   return (EOPNOTSUPP);
+   if (vfs_flagopt(mp-mnt_optnew, ro, NULL, 0) !=
+   ((struct tmpfs_mount *)mp-mnt_data)-tm_ronly)
+   return (EOPNOTSUPP);
+   return (0);
}
 
vn_lock(mp-mnt_vnodecovered, LK_SHARED | LK_RETRY);
@@ -228,6 +233,7 @@ tmpfs_mount(struct mount *mp)
tmpfs_node_ctor, tmpfs_node_dtor,
tmpfs_node_init, tmpfs_node_fini,
UMA_ALIGN_PTR, 0);
+   tmp-tm_ronly = (mp-mnt_flag  MNT_RDONLY) != 0;
 
/* Allocate the root node. */
error = tmpfs_alloc_node(tmp, VDIR, root_uid,
___
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: r234347 - head/sys/fs/tmpfs

2012-04-16 Thread Jaakko Heinonen
Author: jh
Date: Mon Apr 16 18:10:34 2012
New Revision: 234347
URL: http://svn.freebsd.org/changeset/base/234347

Log:
  Sync tmpfs_chflags() with the recent changes to UFS:
  
  - Add a check for unsupported file flags.
  - Return EPERM when an user without PRIV_VFS_SYSFLAGS privilege attempts
to toggle SF_SETTABLE flags.

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Mon Apr 16 18:07:42 2012
(r234346)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Mon Apr 16 18:10:34 2012
(r234347)
@@ -1078,6 +1078,11 @@ tmpfs_chflags(struct vnode *vp, int flag
 
node = VP_TO_TMPFS_NODE(vp);
 
+   if ((flags  ~(UF_NODUMP | UF_IMMUTABLE | UF_APPEND | UF_OPAQUE |
+   UF_NOUNLINK | SF_ARCHIVED | SF_IMMUTABLE | SF_APPEND |
+   SF_NOUNLINK | SF_SNAPSHOT)) != 0)
+   return (EOPNOTSUPP);
+
/* Disallow this operation if the file system is mounted read-only. */
if (vp-v_mount-mnt_flag  MNT_RDONLY)
return EROFS;
@@ -1093,27 +1098,22 @@ tmpfs_chflags(struct vnode *vp, int flag
 * flags, or modify flags if any system flags are set.
 */
if (!priv_check_cred(cred, PRIV_VFS_SYSFLAGS, 0)) {
-   if (node-tn_flags
-  (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) {
+   if (node-tn_flags 
+   (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) {
error = securelevel_gt(cred, 0);
if (error)
return (error);
}
-   /* Snapshot flag cannot be set or cleared */
-   if (((flags  SF_SNAPSHOT) != 0 
- (node-tn_flags  SF_SNAPSHOT) == 0) ||
- ((flags  SF_SNAPSHOT) == 0 
- (node-tn_flags  SF_SNAPSHOT) != 0))
+   /* The snapshot flag cannot be toggled. */
+   if ((flags ^ node-tn_flags)  SF_SNAPSHOT)
return (EPERM);
-   node-tn_flags = flags;
} else {
-   if (node-tn_flags
-  (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
- (flags  UF_SETTABLE) != flags)
+   if (node-tn_flags 
+   (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) ||
+   ((flags ^ node-tn_flags)  SF_SETTABLE))
return (EPERM);
-   node-tn_flags = SF_SETTABLE;
-   node-tn_flags |= (flags  UF_SETTABLE);
}
+   node-tn_flags = flags;
node-tn_status |= TMPFS_NODE_CHANGED;
 
MPASS(VOP_ISLOCKED(vp));
___
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: r234349 - head/sys/dev/virtio/block

2012-04-16 Thread Peter Grehan
Author: grehan
Date: Mon Apr 16 18:29:12 2012
New Revision: 234349
URL: http://svn.freebsd.org/changeset/base/234349

Log:
  Sync with Bryan Venteicher's virtio git repo:
  
  d04e609bdd1973cc7d2e8b38b7dcfae057b0962d
virtio_blk: Use correct temporary variable in vtblk_poll_request
  
  Obtained from:Bryan Venteicher  bryanv at daemoninthecloset dot org

Modified:
  head/sys/dev/virtio/block/virtio_blk.c

Modified: head/sys/dev/virtio/block/virtio_blk.c
==
--- head/sys/dev/virtio/block/virtio_blk.c  Mon Apr 16 18:29:07 2012
(r234348)
+++ head/sys/dev/virtio/block/virtio_blk.c  Mon Apr 16 18:29:12 2012
(r234349)
@@ -997,6 +997,7 @@ vtblk_poll_request(struct vtblk_softc *s
 {
device_t dev;
struct virtqueue *vq;
+   struct vtblk_request *r;
int error;
 
dev = sc-vtblk_dev;
@@ -1011,7 +1012,8 @@ vtblk_poll_request(struct vtblk_softc *s
 
virtqueue_notify(vq);
 
-   req = virtqueue_poll(vq, NULL);
+   r = virtqueue_poll(vq, NULL);
+   KASSERT(r == req, (unexpected request response));
 
error = vtblk_request_error(req);
if (error  bootverbose) {
___
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: r234348 - head/sys/sparc64/conf

2012-04-16 Thread Marius Strobl
Author: marius
Date: Mon Apr 16 18:29:07 2012
New Revision: 234348
URL: http://svn.freebsd.org/changeset/base/234348

Log:
  Turn on PREEMPTION by default. After fixing several bugs over time, the
  last show-stopper keeping PREEMPTION from being usable on sparc64 should
  have been dealt with in r230662.
  At least on 2-way systems, PREEMPTION causes a little bit of a degradation
  in worldstone performance. However, FreeBSD seems to have started building
  up regressions in !PREEMPTION cases so sparc64 better should not be an
  oddball in this regard.
  
  MFC after:1 week

Modified:
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Mon Apr 16 18:10:34 2012
(r234347)
+++ head/sys/sparc64/conf/GENERIC   Mon Apr 16 18:29:07 2012
(r234348)
@@ -27,7 +27,7 @@ makeoptions   DEBUG=-g# Build kernel wit
 #  At this time all platforms are supported, as-is.
 
 optionsSCHED_ULE   # ULE scheduler
-#options   PREEMPTION  # Enable kernel thread preemption
+optionsPREEMPTION  # Enable kernel thread preemption
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsSCTP# Stream Control Transmission Protocol
___
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: r234350 - head/sys/i386/i386

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 19:31:44 2012
New Revision: 234350
URL: http://svn.freebsd.org/changeset/base/234350

Log:
  - When interrupt is not requested for VM86 call, make a fake exit point and
  push the address onto stack as we do for INTn emulation.  This avoids stack
  underflow when we encounter RETF instruction in VM86 mode.  Lack of this
  exit point actually caused page fault in VM86 mode with VESA module when we
  resume from suspend state[1].
  - Remove unnecessary CLI and STI instructions from BIOS interrupt emulation.
  INTn and IRET must be able to emulate the flag correctly.
  
  Reported by:  gavin [1]
  Tested by:gavin (early revision)
  MFC after:3 days

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

Modified: head/sys/i386/i386/vm86.c
==
--- head/sys/i386/i386/vm86.c   Mon Apr 16 18:29:12 2012(r234349)
+++ head/sys/i386/i386/vm86.c   Mon Apr 16 19:31:44 2012(r234350)
@@ -512,22 +512,27 @@ full:
 void
 vm86_prepcall(struct vm86frame *vmf)
 {
-   uintptr_t addr[] = { 0xA00, 0x1000 };   /* code, stack */
-   u_char intcall[] = {
-   CLI, INTn, 0x00, STI, HLT
-   };
struct vm86_kernel *vm86;
+   uint32_t *stack;
+   uint8_t *code;
 
+   code = (void *)0xa00;
+   stack = (void *)(0x1000 - 2);   /* keep aligned */
if ((vmf-vmf_trapno  PAGE_MASK) = 0xff) {
/* interrupt call requested */
-   intcall[2] = (u_char)(vmf-vmf_trapno  0xff);
-   memcpy((void *)addr[0], (void *)intcall, sizeof(intcall));
-   vmf-vmf_ip = addr[0];
+   code[0] = INTn;
+   code[1] = vmf-vmf_trapno  0xff;
+   code[2] = HLT;
+   vmf-vmf_ip = (uintptr_t)code;
vmf-vmf_cs = 0;
+   } else {
+   code[0] = HLT;
+   stack--;
+   stack[0] = MAKE_VEC(0, (uintptr_t)code);
}
-   vmf-vmf_sp = addr[1] - 2;  /* keep aligned */
-   vmf-kernel_fs = vmf-kernel_es = vmf-kernel_ds = 0;
+   vmf-vmf_sp = (uintptr_t)stack;
vmf-vmf_ss = 0;
+   vmf-kernel_fs = vmf-kernel_es = vmf-kernel_ds = 0;
vmf-vmf_eflags = PSL_VIF | PSL_VM | PSL_USER;
 
vm86 = PCPU_GET(curpcb)-pcb_ext-ext_vm86;
___
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: r234337 - in head: lib/libc/arm/gen sys/arm/include

2012-04-16 Thread Juli Mallett
On Mon, Apr 16, 2012 at 02:38, Andrew Turner and...@freebsd.org wrote:
 Log:
  Replace the C implementation of __aeabi_read_tp with an assembly version.
  This ensures we follow the ABI by preserving registers r1-r3.

 +ENTRY(__aeabi_read_tp)
 +       ldr     r0, .Larm_tp_address
 +       ldr     r0, [r0]
 +       RET
 +
 +.Larm_tp_address:
 +       .word ARM_TP_ADDRESS
 +

Why is this indirection required?  Can't you just use ARM_TP_ADDRESS
instead of loading it from data?  Also, is our convention for ARM to
use END() with ENTRY() or not?
___
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: r234337 - in head: lib/libc/arm/gen sys/arm/include

2012-04-16 Thread Bjoern A. Zeeb

On 16. Apr 2012, at 19:41 , Juli Mallett wrote:

 On Mon, Apr 16, 2012 at 02:38, Andrew Turner and...@freebsd.org wrote:
 Log:
  Replace the C implementation of __aeabi_read_tp with an assembly version.
  This ensures we follow the ABI by preserving registers r1-r3.
 
 +ENTRY(__aeabi_read_tp)
 +   ldr r0, .Larm_tp_address
 +   ldr r0, [r0]
 +   RET
 +
 +.Larm_tp_address:
 +   .word ARM_TP_ADDRESS
 +
 
 Why is this indirection required?  Can't you just use ARM_TP_ADDRESS
 instead of loading it from data?  Also, is our convention for ARM to
 use END() with ENTRY() or not?

Don't you generally want END() . ?

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
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: r234337 - in head: lib/libc/arm/gen sys/arm/include

2012-04-16 Thread Ian Lepore
On Mon, 2012-04-16 at 12:41 -0700, Juli Mallett wrote:
 On Mon, Apr 16, 2012 at 02:38, Andrew Turner and...@freebsd.org wrote:
  Log:
   Replace the C implementation of __aeabi_read_tp with an assembly version.
   This ensures we follow the ABI by preserving registers r1-r3.
 
  +ENTRY(__aeabi_read_tp)
  +   ldr r0, .Larm_tp_address
  +   ldr r0, [r0]
  +   RET
  +
  +.Larm_tp_address:
  +   .word ARM_TP_ADDRESS
  +
 
 Why is this indirection required?  Can't you just use ARM_TP_ADDRESS
 instead of loading it from data?  Also, is our convention for ARM to
 use END() with ENTRY() or not?

It used to be possible to directly load ARM_TP_ADDRESS into a register
when it had a cleverly-crafted value that made use of ARM's ability to
encode a constant value into an instruction if it can be expressed as an
8-bit value shifted by anything up to 31 bits.  (iirc, it used to be
0xe000).  At some point that address became a problem for someone
and it got changed to a value which can no longer be encoded within the
instruction.  The alternative is to load it with a single instruction by
using a pc-relative address, or use a series of load-and-shift
instructions to form the new more complex constant.

Ick.

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


Re: svn commit: r234337 - in head: lib/libc/arm/gen sys/arm/include

2012-04-16 Thread Andrew Turner
On Mon, 16 Apr 2012 12:41:38 -0700
Juli Mallett jmall...@freebsd.org wrote:

 On Mon, Apr 16, 2012 at 02:38, Andrew Turner and...@freebsd.org
 wrote:
  Log:
   Replace the C implementation of __aeabi_read_tp with an assembly
  version. This ensures we follow the ABI by preserving registers
  r1-r3.
 
  +ENTRY(__aeabi_read_tp)
  +       ldr     r0, .Larm_tp_address
  +       ldr     r0, [r0]
  +       RET
  +
  +.Larm_tp_address:
  +       .word ARM_TP_ADDRESS
  +
 
 Why is this indirection required?  Can't you just use ARM_TP_ADDRESS
 instead of loading it from data?
ARM will let us load a limited number of values straight into registers
with a move instruction. Unfortunately the value of ARM_TP_ADDRESS is
not one of them.

  Also, is our convention for ARM to
 use END() with ENTRY() or not?
There is no END() macro for ARM.

Andrew
___
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: r234352 - in head/sys: amd64/linux32 compat/linux i386/linux kern

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 21:22:02 2012
New Revision: 234352
URL: http://svn.freebsd.org/changeset/base/234352

Log:
  - Implement pipe2 syscall for Linuxulator.  This syscall appeared in 2.6.27
  but GNU libc used it without checking its kernel version, e. g., Fedora 10.
  - Move pipe(2) implementation for Linuxulator from MD files to MI file,
  sys/compat/linux/linux_file.c.  There is no MD code for this syscall at all.
  - Correct an argument type for pipe() from l_ulong * to l_int *.  Probably
  this was the source of MI/MD confusion.
  
  Reviewed by:  emulation

Modified:
  head/sys/amd64/linux32/linux32_dummy.c
  head/sys/amd64/linux32/linux32_machdep.c
  head/sys/amd64/linux32/syscalls.master
  head/sys/compat/linux/linux_file.c
  head/sys/i386/linux/linux_dummy.c
  head/sys/i386/linux/linux_machdep.c
  head/sys/i386/linux/syscalls.master
  head/sys/kern/sys_pipe.c

Modified: head/sys/amd64/linux32/linux32_dummy.c
==
--- head/sys/amd64/linux32/linux32_dummy.c  Mon Apr 16 20:41:25 2012
(r234351)
+++ head/sys/amd64/linux32/linux32_dummy.c  Mon Apr 16 21:22:02 2012
(r234352)
@@ -122,7 +122,6 @@ DUMMY(signalfd4);
 DUMMY(eventfd2);
 DUMMY(epoll_create1);
 DUMMY(dup3);
-DUMMY(pipe2);
 DUMMY(inotify_init1);
 /* linux 2.6.30: */
 DUMMY(preadv);

Modified: head/sys/amd64/linux32/linux32_machdep.c
==
--- head/sys/amd64/linux32/linux32_machdep.cMon Apr 16 20:41:25 2012
(r234351)
+++ head/sys/amd64/linux32/linux32_machdep.cMon Apr 16 21:22:02 2012
(r234352)
@@ -698,25 +698,6 @@ linux_iopl(struct thread *td, struct lin
 }
 
 int
-linux_pipe(struct thread *td, struct linux_pipe_args *args)
-{
-   int error;
-   int fildes[2];
-
-#ifdef DEBUG
-   if (ldebug(pipe))
-   printf(ARGS(pipe, *));
-#endif
-
-   error = kern_pipe(td, fildes);
-   if (error)
-   return (error);
-
-   /* XXX: Close descriptors on error. */
-   return (copyout(fildes, args-pipefds, sizeof fildes));
-}
-
-int
 linux_sigaction(struct thread *td, struct linux_sigaction_args *args)
 {
l_osigaction_t osa;

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Mon Apr 16 20:41:25 2012
(r234351)
+++ head/sys/amd64/linux32/syscalls.master  Mon Apr 16 21:22:02 2012
(r234352)
@@ -95,7 +95,7 @@
 39 AUE_MKDIR   STD { int linux_mkdir(char *path, l_int mode); }
 40 AUE_RMDIR   STD { int linux_rmdir(char *path); }
 41 AUE_DUP NOPROTO { int dup(u_int fd); }
-42 AUE_PIPESTD { int linux_pipe(l_ulong *pipefds); }
+42 AUE_PIPESTD { int linux_pipe(l_int *pipefds); }
 43 AUE_NULLSTD { int linux_times(struct l_times_argv *buf); }
 44 AUE_NULLUNIMPL  prof
 45 AUE_NULLSTD { int linux_brk(l_ulong dsend); }
@@ -536,7 +536,7 @@
 328AUE_NULLSTD { int linux_eventfd2(void); }
 329AUE_NULLSTD { int linux_epoll_create1(void); }
 330AUE_NULLSTD { int linux_dup3(void); }
-331AUE_NULLSTD { int linux_pipe2(void); }
+331AUE_NULLSTD { int linux_pipe2(l_int *pipefds, l_int flags); 
}
 332AUE_NULLSTD { int linux_inotify_init1(void); }
 ; linux 2.6.30:
 333AUE_NULLSTD { int linux_preadv(void); }

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Mon Apr 16 20:41:25 2012
(r234351)
+++ head/sys/compat/linux/linux_file.c  Mon Apr 16 21:22:02 2012
(r234352)
@@ -69,6 +69,9 @@ __FBSDID($FreeBSD$);
 #include compat/linux/linux_util.h
 #include compat/linux/linux_file.h
 
+/* XXX */
+intdo_pipe(struct thread *td, int fildes[2], int flags);
+
 int
 linux_creat(struct thread *td, struct linux_creat_args *args)
 {
@@ -1575,3 +1578,49 @@ linux_fadvise64_64(struct thread *td, st
return (kern_posix_fadvise(td, args-fd, args-offset, args-len,
advice));
 }
+
+int
+linux_pipe(struct thread *td, struct linux_pipe_args *args)
+{
+   int fildes[2];
+   int error;
+
+#ifdef DEBUG
+   if (ldebug(pipe))
+   printf(ARGS(pipe, *));
+#endif
+
+   error = do_pipe(td, fildes, 0);
+   if (error)
+   return (error);
+
+   /* XXX: Close descriptors on error. */
+   return (copyout(fildes, args-pipefds, sizeof(fildes)));
+}
+
+int
+linux_pipe2(struct thread *td, struct linux_pipe2_args *args)
+{
+   int fildes[2];
+   int error, flags;
+
+#ifdef DEBUG
+   if (ldebug(pipe2))
+   printf(ARGS(pipe2, *, %d), args-flags);
+#endif
+
+   if ((args-flags  

svn commit: r234354 - in head/sys: amd64/linux32 i386/linux

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 21:24:23 2012
New Revision: 234354
URL: http://svn.freebsd.org/changeset/base/234354

Log:
  Regen for r234352.

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Mon Apr 16 21:23:25 2012
(r234353)
+++ head/sys/amd64/linux32/linux32_proto.h  Mon Apr 16 21:24:23 2012
(r234354)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 232799 
2012-03-10 23:10:18Z netchild 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -153,7 +153,7 @@ struct linux_rmdir_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
 };
 struct linux_pipe_args {
-   char pipefds_l_[PADL_(l_ulong *)]; l_ulong * pipefds; char 
pipefds_r_[PADR_(l_ulong *)];
+   char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char 
pipefds_r_[PADR_(l_int *)];
 };
 struct linux_times_args {
char buf_l_[PADL_(struct l_times_argv *)]; struct l_times_argv * buf; 
char buf_r_[PADR_(struct l_times_argv *)];
@@ -1046,7 +1046,8 @@ struct linux_dup3_args {
register_t dummy;
 };
 struct linux_pipe2_args {
-   register_t dummy;
+   char pipefds_l_[PADL_(l_int *)]; l_int * pipefds; char 
pipefds_r_[PADR_(l_int *)];
+   char flags_l_[PADL_(l_int)]; l_int flags; char flags_r_[PADR_(l_int)];
 };
 struct linux_inotify_init1_args {
register_t dummy;

Modified: head/sys/amd64/linux32/linux32_syscall.h
==
--- head/sys/amd64/linux32/linux32_syscall.hMon Apr 16 21:23:25 2012
(r234353)
+++ head/sys/amd64/linux32/linux32_syscall.hMon Apr 16 21:24:23 2012
(r234354)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 232799 
2012-03-10 23:10:18Z netchild 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
  */
 
 #defineLINUX_SYS_exit  1

Modified: head/sys/amd64/linux32/linux32_syscalls.c
==
--- head/sys/amd64/linux32/linux32_syscalls.c   Mon Apr 16 21:23:25 2012
(r234353)
+++ head/sys/amd64/linux32/linux32_syscalls.c   Mon Apr 16 21:24:23 2012
(r234354)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 232799 
2012-03-10 23:10:18Z netchild 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
  */
 
 const char *linux_syscallnames[] = {

Modified: head/sys/amd64/linux32/linux32_sysent.c
==
--- head/sys/amd64/linux32/linux32_sysent.c Mon Apr 16 21:23:25 2012
(r234353)
+++ head/sys/amd64/linux32/linux32_sysent.c Mon Apr 16 21:24:23 2012
(r234354)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 232799 
2012-03-10 23:10:18Z netchild 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
  */
 
 #include opt_compat.h
@@ -350,7 +350,7 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_eventfd2, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 328 = linux_eventfd2 */
{ 0, (sy_call_t *)linux_epoll_create1, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 329 = linux_epoll_create1 */
{ 0, (sy_call_t *)linux_dup3, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, 
/* 330 = linux_dup3 */
-   { 0, (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC 
},/* 331 = linux_pipe2 */
+   { AS(linux_pipe2_args), (sy_call_t *)linux_pipe2, AUE_NULL, NULL, 0, 0, 
0, SY_THR_STATIC }, /* 331 = linux_pipe2 */
{ 0, (sy_call_t *)linux_inotify_init1, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },/* 332 = linux_inotify_init1 */
{ 0, (sy_call_t *)linux_preadv, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC 
},   /* 333 = linux_preadv */
{ 0, (sy_call_t *)linux_pwritev, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC 
},  /* 334 = 

svn commit: r234355 - head/sys/sys

2012-04-16 Thread Dimitry Andric
Author: dim
Date: Mon Apr 16 21:28:04 2012
New Revision: 234355
URL: http://svn.freebsd.org/changeset/base/234355

Log:
  Bump __FreeBSD_version due to the import of a new clang 3.1 prerelease
  snapshot.

Modified:
  head/sys/sys/param.h

Modified: head/sys/sys/param.h
==
--- head/sys/sys/param.hMon Apr 16 21:24:23 2012(r234354)
+++ head/sys/sys/param.hMon Apr 16 21:28:04 2012(r234355)
@@ -58,7 +58,7 @@
  * in the range 5 to 9.
  */
 #undef __FreeBSD_version
-#define __FreeBSD_version 110  /* Master, propagated to newvers */
+#define __FreeBSD_version 111  /* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
___
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: r233937 - in head/sys: kern net security/mac

2012-04-16 Thread Adrian Chadd
On 15 April 2012 23:33, Alexander V. Chernikov melif...@freebsd.org wrote:
 On 16.04.2012 01:17, Adrian Chadd wrote:

 Hi,

 This has broken (at least) net80211 and bpf, with LOR:

 Yes, it is. Please try the attached patch

Hi,

This seems like a very, very complicated diff.

* You've removed BPF_LOCK_ASSERT() inside bpf_detachd_locked() - why'd
you do that?
* You removed a comment (We're already protected by the global lock)
which is still relevant/valid
* There are lots of modifications to the read/write locks here - I'm
not sure whether they're at all relevant to my immediate problem and
may belong in separate commits

Is there a document somewhere which describes what the new style BPF
locking should be?

I just added BPF_LOCK() / BPF_UNLOCK() around all the calls to
bpf_detachd() which weren't locked (there were a few.)

One final question - should the BPF global lock be recursive?

thanks,



Adrian
___
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: r234356 - in head: gnu/lib/csu lib/clang lib/csu/powerpc

2012-04-16 Thread Dimitry Andric
Author: dim
Date: Mon Apr 16 21:36:55 2012
New Revision: 234356
URL: http://svn.freebsd.org/changeset/base/234356

Log:
  Work around an issue on 32-bit PowerPC, where clang executable can get
  too big, causing 'relocation truncated to fit' errors at link time.
  
  Reviewed by:  nwhitehorn

Modified:
  head/gnu/lib/csu/Makefile
  head/lib/clang/clang.build.mk
  head/lib/csu/powerpc/Makefile

Modified: head/gnu/lib/csu/Makefile
==
--- head/gnu/lib/csu/Makefile   Mon Apr 16 21:28:04 2012(r234355)
+++ head/gnu/lib/csu/Makefile   Mon Apr 16 21:36:55 2012(r234356)
@@ -34,6 +34,7 @@ CFLAGS+=  -include osreldate.h
 .if ${MACHINE_CPUARCH} == powerpc
 TGTOBJS=   crtsavres.o
 SRCS+= crtsavres.asm
+CFLAGS+=   -mlongcall
 .endif
 .if ${MACHINE_CPUARCH} == sparc64
 TGTOBJS=   crtfastmath.o

Modified: head/lib/clang/clang.build.mk
==
--- head/lib/clang/clang.build.mk   Mon Apr 16 21:28:04 2012
(r234355)
+++ head/lib/clang/clang.build.mk   Mon Apr 16 21:36:55 2012
(r234356)
@@ -11,6 +11,12 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG
 # LLVM is not strict aliasing safe as of 12/31/2011
 CFLAGS+= -fno-strict-aliasing
 
+# Work around an issue on 32-bit PowerPC, where the clang executable can get
+# too big, causing 'relocation truncated to fit' errors at link time.
+.if ${MACHINE_ARCH} == powerpc
+CFLAGS+=-mlongcall
+.endif
+
 TARGET_ARCH?=  ${MACHINE_ARCH}
 
CFLAGS+=-DLLVM_DEFAULT_TARGET_TRIPLE=\${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0\
 

Modified: head/lib/csu/powerpc/Makefile
==
--- head/lib/csu/powerpc/Makefile   Mon Apr 16 21:28:04 2012
(r234355)
+++ head/lib/csu/powerpc/Makefile   Mon Apr 16 21:36:55 2012
(r234356)
@@ -6,7 +6,8 @@ SRCS=   crt1.c crti.S crtn.S
 OBJS=  ${SRCS:N*.h:R:S/$/.o/g}
 OBJS+= Scrt1.o gcrt1.o
 CFLAGS+=   -I${.CURDIR}/../common \
-   -I${.CURDIR}/../../libc/include
+   -I${.CURDIR}/../../libc/include \
+   -mlongcall
 
 all: ${OBJS}
 
___
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: r234355 - head/sys/sys

2012-04-16 Thread Bjoern A. Zeeb

On 16. Apr 2012, at 21:28 , Dimitry Andric wrote:

 Author: dim
 Date: Mon Apr 16 21:28:04 2012
 New Revision: 234355
 URL: http://svn.freebsd.org/changeset/base/234355
 
 Log:
  Bump __FreeBSD_version due to the import of a new clang 3.1 prerelease
  snapshot.
 


With SVN can we please try to get these bumps done more atomically with the 
real changes and if we do not maybe reference which revision forced the bump?

That said, why does 3.1-pre need a bump?



 Modified:
  head/sys/sys/param.h
 
 Modified: head/sys/sys/param.h
 ==
 --- head/sys/sys/param.h  Mon Apr 16 21:24:23 2012(r234354)
 +++ head/sys/sys/param.h  Mon Apr 16 21:28:04 2012(r234355)
 @@ -58,7 +58,7 @@
  *in the range 5 to 9.
  */
 #undef __FreeBSD_version
 -#define __FreeBSD_version 110/* Master, propagated to newvers */
 +#define __FreeBSD_version 111/* Master, propagated to newvers */
 
 /*
  * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,

-- 
Bjoern A. Zeeb You have to have visions!
   It does not matter how good you are. It matters what good you do!

___
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: r234357 - in head/sys: amd64/linux32 i386/linux

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 22:58:28 2012
New Revision: 234357
URL: http://svn.freebsd.org/changeset/base/234357

Log:
  Correct arguments of stat64, fstat64 and lstat64 syscalls for Linuxulator.

Modified:
  head/sys/amd64/linux32/syscalls.master
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Mon Apr 16 21:36:55 2012
(r234356)
+++ head/sys/amd64/linux32/syscalls.master  Mon Apr 16 22:58:28 2012
(r234357)
@@ -351,12 +351,12 @@
l_loff_t length); }
 194AUE_FTRUNCATE   STD { int linux_ftruncate64(l_uint fd, \
l_loff_t length); }
-195AUE_STATSTD { int linux_stat64(char *filename, \
-   struct l_stat64 *statbuf, l_long flags); }
-196AUE_LSTAT   STD { int linux_lstat64(char *filename, \
-   struct l_stat64 *statbuf, l_long flags); }
-197AUE_FSTAT   STD { int linux_fstat64(l_ulong fd, \
-   struct l_stat64 *statbuf, l_long flags); }
+195AUE_STATSTD { int linux_stat64(const char *filename, \
+   struct l_stat64 *statbuf); }
+196AUE_LSTAT   STD { int linux_lstat64(const char *filename, \
+   struct l_stat64 *statbuf); }
+197AUE_FSTAT   STD { int linux_fstat64(l_int fd, \
+   struct l_stat64 *statbuf); }
 198AUE_LCHOWN  STD { int linux_lchown(char *path, l_uid_t uid, \
l_gid_t gid); }
 199AUE_GETUID  STD { int linux_getuid(void); }

Modified: head/sys/i386/linux/syscalls.master
==
--- head/sys/i386/linux/syscalls.master Mon Apr 16 21:36:55 2012
(r234356)
+++ head/sys/i386/linux/syscalls.master Mon Apr 16 22:58:28 2012
(r234357)
@@ -353,12 +353,12 @@
l_loff_t length); }
 194AUE_FTRUNCATE   STD { int linux_ftruncate64(l_uint fd, \
l_loff_t length); }
-195AUE_STATSTD { int linux_stat64(char *filename, \
-   struct l_stat64 *statbuf, l_long flags); }
-196AUE_LSTAT   STD { int linux_lstat64(char *filename, \
-   struct l_stat64 *statbuf, l_long flags); }
-197AUE_FSTAT   STD { int linux_fstat64(l_ulong fd, \
-   struct l_stat64 *statbuf, l_long flags); }
+195AUE_STATSTD { int linux_stat64(const char *filename, \
+   struct l_stat64 *statbuf); }
+196AUE_LSTAT   STD { int linux_lstat64(const char *filename, \
+   struct l_stat64 *statbuf); }
+197AUE_FSTAT   STD { int linux_fstat64(l_int fd, \
+   struct l_stat64 *statbuf); }
 198AUE_LCHOWN  STD { int linux_lchown(char *path, l_uid_t uid, \
l_gid_t gid); }
 199AUE_GETUID  STD { int linux_getuid(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: r234358 - in head/sys: amd64/linux32 i386/linux

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 22:59:51 2012
New Revision: 234358
URL: http://svn.freebsd.org/changeset/base/234358

Log:
  Regen for r234357.

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Mon Apr 16 22:58:28 2012
(r234357)
+++ head/sys/amd64/linux32/linux32_proto.h  Mon Apr 16 22:59:51 2012
(r234358)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -628,19 +628,16 @@ struct linux_ftruncate64_args {
char length_l_[PADL_(l_loff_t)]; l_loff_t length; char 
length_r_[PADR_(l_loff_t)];
 };
 struct linux_stat64_args {
-   char filename_l_[PADL_(char *)]; char * filename; char 
filename_r_[PADR_(char *)];
+   char filename_l_[PADL_(const char *)]; const char * filename; char 
filename_r_[PADR_(const char *)];
char statbuf_l_[PADL_(struct l_stat64 *)]; struct l_stat64 * statbuf; 
char statbuf_r_[PADR_(struct l_stat64 *)];
-   char flags_l_[PADL_(l_long)]; l_long flags; char 
flags_r_[PADR_(l_long)];
 };
 struct linux_lstat64_args {
-   char filename_l_[PADL_(char *)]; char * filename; char 
filename_r_[PADR_(char *)];
+   char filename_l_[PADL_(const char *)]; const char * filename; char 
filename_r_[PADR_(const char *)];
char statbuf_l_[PADL_(struct l_stat64 *)]; struct l_stat64 * statbuf; 
char statbuf_r_[PADR_(struct l_stat64 *)];
-   char flags_l_[PADL_(l_long)]; l_long flags; char 
flags_r_[PADR_(l_long)];
 };
 struct linux_fstat64_args {
-   char fd_l_[PADL_(l_ulong)]; l_ulong fd; char fd_r_[PADR_(l_ulong)];
+   char fd_l_[PADL_(l_int)]; l_int fd; char fd_r_[PADR_(l_int)];
char statbuf_l_[PADL_(struct l_stat64 *)]; struct l_stat64 * statbuf; 
char statbuf_r_[PADR_(struct l_stat64 *)];
-   char flags_l_[PADL_(l_long)]; l_long flags; char 
flags_r_[PADR_(l_long)];
 };
 struct linux_lchown_args {
char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];

Modified: head/sys/amd64/linux32/linux32_syscall.h
==
--- head/sys/amd64/linux32/linux32_syscall.hMon Apr 16 22:58:28 2012
(r234357)
+++ head/sys/amd64/linux32/linux32_syscall.hMon Apr 16 22:59:51 2012
(r234358)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
  */
 
 #defineLINUX_SYS_exit  1

Modified: head/sys/amd64/linux32/linux32_syscalls.c
==
--- head/sys/amd64/linux32/linux32_syscalls.c   Mon Apr 16 22:58:28 2012
(r234357)
+++ head/sys/amd64/linux32/linux32_syscalls.c   Mon Apr 16 22:59:51 2012
(r234358)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
  */
 
 const char *linux_syscallnames[] = {

Modified: head/sys/amd64/linux32/linux32_sysent.c
==
--- head/sys/amd64/linux32/linux32_sysent.c Mon Apr 16 22:58:28 2012
(r234357)
+++ head/sys/amd64/linux32/linux32_sysent.c Mon Apr 16 22:59:51 2012
(r234358)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234352 
2012-04-16 21:22:02Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
  */
 
 #include opt_compat.h

Modified: head/sys/amd64/linux32/linux32_systrace_args.c
==
--- head/sys/amd64/linux32/linux32_systrace_args.c  Mon Apr 16 22:58:28 
2012(r234357)
+++ head/sys/amd64/linux32/linux32_systrace_args.c  Mon Apr 16 22:59:51 
2012(r234358)
@@ -1355,28 

svn commit: r234359 - in head/sys: amd64/linux32 i386/linux

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 23:16:18 2012
New Revision: 234359
URL: http://svn.freebsd.org/changeset/base/234359

Log:
  Correct an argument type of iopl syscall for Linuxulator.  This also fixes
  a warning from Clang, i. e., args-level  0 is always false.

Modified:
  head/sys/amd64/linux32/syscalls.master
  head/sys/i386/linux/syscalls.master

Modified: head/sys/amd64/linux32/syscalls.master
==
--- head/sys/amd64/linux32/syscalls.master  Mon Apr 16 22:59:51 2012
(r234358)
+++ head/sys/amd64/linux32/syscalls.master  Mon Apr 16 23:16:18 2012
(r234359)
@@ -202,7 +202,7 @@
struct l_newstat *buf); }
 ; 109: olduname
 109AUE_NULLSTD { int linux_uname(void); }
-110AUE_NULLSTD { int linux_iopl(l_ulong level); }
+110AUE_NULLSTD { int linux_iopl(l_int level); }
 111AUE_NULLSTD { int linux_vhangup(void); }
 112AUE_NULLUNIMPL  idle
 113AUE_NULLUNIMPL  vm86old

Modified: head/sys/i386/linux/syscalls.master
==
--- head/sys/i386/linux/syscalls.master Mon Apr 16 22:59:51 2012
(r234358)
+++ head/sys/i386/linux/syscalls.master Mon Apr 16 23:16:18 2012
(r234359)
@@ -203,7 +203,7 @@
struct l_newstat *buf); }
 ; 109: olduname
 109AUE_NULLSTD { int linux_uname(void); }
-110AUE_NULLSTD { int linux_iopl(l_ulong level); }
+110AUE_NULLSTD { int linux_iopl(l_int level); }
 111AUE_NULLSTD { int linux_vhangup(void); }
 112AUE_NULLUNIMPL  idle
 113AUE_NULLSTD { int linux_vm86old(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: r234360 - in head/sys: amd64/linux32 i386/linux

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 23:17:29 2012
New Revision: 234360
URL: http://svn.freebsd.org/changeset/base/234360

Log:
  Regen for r234359.

Modified:
  head/sys/amd64/linux32/linux32_proto.h
  head/sys/amd64/linux32/linux32_syscall.h
  head/sys/amd64/linux32/linux32_syscalls.c
  head/sys/amd64/linux32/linux32_sysent.c
  head/sys/amd64/linux32/linux32_systrace_args.c
  head/sys/i386/linux/linux_proto.h
  head/sys/i386/linux/linux_syscall.h
  head/sys/i386/linux/linux_syscalls.c
  head/sys/i386/linux/linux_sysent.c
  head/sys/i386/linux/linux_systrace_args.c

Modified: head/sys/amd64/linux32/linux32_proto.h
==
--- head/sys/amd64/linux32/linux32_proto.h  Mon Apr 16 23:16:18 2012
(r234359)
+++ head/sys/amd64/linux32/linux32_proto.h  Mon Apr 16 23:17:29 2012
(r234360)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234359 
2012-04-16 23:16:18Z jkim 
  */
 
 #ifndef _LINUX_SYSPROTO_H_
@@ -344,7 +344,7 @@ struct linux_uname_args {
register_t dummy;
 };
 struct linux_iopl_args {
-   char level_l_[PADL_(l_ulong)]; l_ulong level; char 
level_r_[PADR_(l_ulong)];
+   char level_l_[PADL_(l_int)]; l_int level; char level_r_[PADR_(l_int)];
 };
 struct linux_vhangup_args {
register_t dummy;

Modified: head/sys/amd64/linux32/linux32_syscall.h
==
--- head/sys/amd64/linux32/linux32_syscall.hMon Apr 16 23:16:18 2012
(r234359)
+++ head/sys/amd64/linux32/linux32_syscall.hMon Apr 16 23:17:29 2012
(r234360)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234359 
2012-04-16 23:16:18Z jkim 
  */
 
 #defineLINUX_SYS_exit  1

Modified: head/sys/amd64/linux32/linux32_syscalls.c
==
--- head/sys/amd64/linux32/linux32_syscalls.c   Mon Apr 16 23:16:18 2012
(r234359)
+++ head/sys/amd64/linux32/linux32_syscalls.c   Mon Apr 16 23:17:29 2012
(r234360)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234359 
2012-04-16 23:16:18Z jkim 
  */
 
 const char *linux_syscallnames[] = {

Modified: head/sys/amd64/linux32/linux32_sysent.c
==
--- head/sys/amd64/linux32/linux32_sysent.c Mon Apr 16 23:16:18 2012
(r234359)
+++ head/sys/amd64/linux32/linux32_sysent.c Mon Apr 16 23:17:29 2012
(r234360)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234357 
2012-04-16 22:58:28Z jkim 
+ * created from FreeBSD: head/sys/amd64/linux32/syscalls.master 234359 
2012-04-16 23:16:18Z jkim 
  */
 
 #include opt_compat.h

Modified: head/sys/amd64/linux32/linux32_systrace_args.c
==
--- head/sys/amd64/linux32/linux32_systrace_args.c  Mon Apr 16 23:16:18 
2012(r234359)
+++ head/sys/amd64/linux32/linux32_systrace_args.c  Mon Apr 16 23:17:29 
2012(r234360)
@@ -748,7 +748,7 @@ systrace_args(int sysnum, void *params, 
/* linux_iopl */
case 110: {
struct linux_iopl_args *p = params;
-   iarg[0] = p-level; /* l_ulong */
+   iarg[0] = p-level; /* l_int */
*n_args = 1;
break;
}
@@ -3392,7 +3392,7 @@ systrace_entry_setargdesc(int sysnum, in
case 110:
switch(ndx) {
case 0:
-   p = l_ulong;
+   p = l_int;
break;
default:
break;

Modified: head/sys/i386/linux/linux_proto.h
==
--- head/sys/i386/linux/linux_proto.h   Mon Apr 16 23:16:18 2012
(r234359)
+++ head/sys/i386/linux/linux_proto.h   Mon Apr 16 23:17:29 2012
(r234360)
@@ -3,7 +3,7 @@
  *
  * DO NOT EDIT-- this file is automatically generated.
  * $FreeBSD$
- * created from FreeBSD: head/sys/i386/linux/syscalls.master 234357 2012-04-16 
22:58:28Z jkim 
+ * created from FreeBSD: head/sys/i386/linux/syscalls.master 234359 2012-04-16 
23:16:18Z jkim 
  */
 
 #ifndef 

svn commit: r234362 - head/sys/dev/fb

2012-04-16 Thread Jung-uk Kim
Author: jkim
Date: Mon Apr 16 23:29:12 2012
New Revision: 234362
URL: http://svn.freebsd.org/changeset/base/234362

Log:
  Fix a Clang warning.
  
  Submitted by: arundel

Modified:
  head/sys/dev/fb/s3_pci.c

Modified: head/sys/dev/fb/s3_pci.c
==
--- head/sys/dev/fb/s3_pci.cMon Apr 16 23:19:21 2012(r234361)
+++ head/sys/dev/fb/s3_pci.cMon Apr 16 23:29:12 2012(r234362)
@@ -513,7 +513,7 @@ s3pci_attach(device_t dev)
/* Attach the driver to the VGA/VESA framework
 */
for (i = 0; (adp = vid_get_adapter(i)) != NULL; ++i) {
-   if ((adp-va_type == KD_VGA))
+   if (adp-va_type == KD_VGA)
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


svn commit: r234364 - head/sys/x86/include

2012-04-16 Thread Peter Grehan
Author: grehan
Date: Tue Apr 17 00:54:38 2012
New Revision: 234364
URL: http://svn.freebsd.org/changeset/base/234364

Log:
  Add x2apic MSR definitions
  
  Reviewed by:  jhb
  Obtained from:bhyve via Neel via NetApp

Modified:
  head/sys/x86/include/specialreg.h

Modified: head/sys/x86/include/specialreg.h
==
--- head/sys/x86/include/specialreg.h   Mon Apr 16 23:32:12 2012
(r234363)
+++ head/sys/x86/include/specialreg.h   Tue Apr 17 00:54:38 2012
(r234364)
@@ -359,10 +359,44 @@
 #defineMSR_MC4_MISC0x413
 
 /*
+ * X2APIC MSRs
+ */
+#defineMSR_APIC_ID 0x802
+#defineMSR_APIC_VERSION0x803
+#defineMSR_APIC_TPR0x808
+#defineMSR_APIC_EOI0x80b
+#defineMSR_APIC_LDR0x80d
+#defineMSR_APIC_SVR0x80f
+#defineMSR_APIC_ISR0   0x810
+#defineMSR_APIC_ISR1   0x811
+#defineMSR_APIC_ISR2   0x812
+#defineMSR_APIC_ISR3   0x813
+#defineMSR_APIC_ISR4   0x814
+#defineMSR_APIC_ISR5   0x815
+#defineMSR_APIC_ISR6   0x816
+#defineMSR_APIC_ISR7   0x817
+#defineMSR_APIC_TMR0   0x818
+#defineMSR_APIC_IRR0   0x820
+#defineMSR_APIC_ESR0x828
+#defineMSR_APIC_LVT_CMCI   0x82F
+#defineMSR_APIC_ICR0x830
+#defineMSR_APIC_LVT_TIMER  0x832
+#defineMSR_APIC_LVT_THERMAL0x833
+#defineMSR_APIC_LVT_PCINT  0x834
+#defineMSR_APIC_LVT_LINT0  0x835
+#defineMSR_APIC_LVT_LINT1  0x836
+#defineMSR_APIC_LVT_ERROR  0x837
+#defineMSR_APIC_ICR_TIMER  0x838
+#defineMSR_APIC_CCR_TIMER  0x839
+#defineMSR_APIC_DCR_TIMER  0x83e
+#defineMSR_APIC_SELF_IPI   0x83f
+
+/*
  * Constants related to MSR's.
  */
-#defineAPICBASE_RESERVED   0x06ff
+#defineAPICBASE_RESERVED   0x02ff
 #defineAPICBASE_BSP0x0100
+#defineAPICBASE_X2APIC 0x0400
 #defineAPICBASE_ENABLED0x0800
 #defineAPICBASE_ADDRESS0xf000
 
___
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: r234365 - head/sys/mips/atheros

2012-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 17 01:22:59 2012
New Revision: 234365
URL: http://svn.freebsd.org/changeset/base/234365

Log:
  Protect the PCI space registers behind a mutex.
  
  Obtained from:Linux/OpenWRT, Atheros

Modified:
  head/sys/mips/atheros/ar71xx_pci.c

Modified: head/sys/mips/atheros/ar71xx_pci.c
==
--- head/sys/mips/atheros/ar71xx_pci.c  Tue Apr 17 00:54:38 2012
(r234364)
+++ head/sys/mips/atheros/ar71xx_pci.c  Tue Apr 17 01:22:59 2012
(r234365)
@@ -39,6 +39,8 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/module.h
 #include sys/rman.h
+#include sys/lock.h
+#include sys/mutex.h
 
 #include vm/vm.h
 #include vm/pmap.h
@@ -72,6 +74,10 @@ __FBSDID($FreeBSD$);
 #define dprintf(x, arg...)
 #endif
 
+struct mtx ar71xx_pci_mtx;
+MTX_SYSINIT(ar71xx_pci_mtx, ar71xx_pci_mtx, ar71xx PCI space mutex,
+MTX_SPIN);
+
 struct ar71xx_pci_softc {
device_tsc_dev;
 
@@ -97,6 +103,7 @@ ar71xx_pci_mask_irq(void *source)
uint32_t reg;
unsigned int irq = (unsigned int)source;
 
+   /* XXX is the PCI lock required here? */
reg = ATH_READ_REG(AR71XX_PCI_INTR_MASK);
/* flush */
reg = ATH_READ_REG(AR71XX_PCI_INTR_MASK);
@@ -109,6 +116,7 @@ ar71xx_pci_unmask_irq(void *source)
uint32_t reg;
unsigned int irq = (unsigned int)source;
 
+   /* XXX is the PCI lock required here? */
reg = ATH_READ_REG(AR71XX_PCI_INTR_MASK);
ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, reg | (1  irq));
/* flush */
@@ -140,6 +148,9 @@ static int 
 ar71xx_pci_check_bus_error(void)
 {
uint32_t error, addr, has_errors = 0;
+
+   mtx_assert(ar71xx_pci_mtx, MA_OWNED);
+
error = ATH_READ_REG(AR71XX_PCI_ERROR)  0x3;
dprintf(%s: PCI error = %02x\n, __func__, error);
if (error) {
@@ -185,7 +196,9 @@ ar71xx_pci_conf_setup(int bus, int slot,
 {
uint32_t addr = ar71xx_pci_make_addr(bus, slot, func, (reg  ~3));
cmd |= (ar71xx_get_bytes_to_read(reg, bytes)  4);
-   
+
+   mtx_assert(ar71xx_pci_mtx, MA_OWNED);
+
ATH_WRITE_REG(AR71XX_PCI_CONF_ADDR, addr);
ATH_WRITE_REG(AR71XX_PCI_CONF_CMD, cmd);
 
@@ -216,11 +229,13 @@ ar71xx_pci_read_config(device_t dev, u_i
dprintf(%s: tag (%x, %x, %x) reg %d(%d)\n, __func__, bus, slot, 
func, reg, bytes);
 
+   mtx_lock_spin(ar71xx_pci_mtx);
 if (ar71xx_pci_conf_setup(bus, slot, func, reg, bytes, 
 PCI_CONF_CMD_READ) == 0)
 data = ATH_READ_REG(AR71XX_PCI_CONF_READ_DATA);
 else
 data = -1;
+   mtx_unlock_spin(ar71xx_pci_mtx);
 
/* get request bytes from 32-bit word */
data = (data  shift)  mask;
@@ -241,8 +256,10 @@ ar71xx_pci_local_write(device_t dev, uin
 
cmd = PCI_LCONF_CMD_WRITE | (reg  ~3);
cmd |= (ar71xx_get_bytes_to_read(reg, bytes)  20);
+   mtx_lock_spin(ar71xx_pci_mtx);
ATH_WRITE_REG(AR71XX_PCI_LCONF_CMD, cmd);
ATH_WRITE_REG(AR71XX_PCI_LCONF_WRITE_DATA, data);
+   mtx_unlock_spin(ar71xx_pci_mtx);
 }
 
 static void
@@ -255,9 +272,11 @@ ar71xx_pci_write_config(device_t dev, u_
 
data = data  (8*(reg % 4));
 
+   mtx_lock_spin(ar71xx_pci_mtx);
 if (ar71xx_pci_conf_setup(bus, slot, func, reg, bytes,
 PCI_CONF_CMD_WRITE) == 0)
 ATH_WRITE_REG(AR71XX_PCI_CONF_WRITE_DATA, data);
+   mtx_unlock_spin(ar71xx_pci_mtx);
 }
 
 #ifdef AR71XX_ATH_EEPROM
@@ -457,7 +476,9 @@ ar71xx_pci_attach(device_t dev)
ATH_WRITE_REG(AR71XX_PCI_WINDOW7, PCI_WINDOW7_CONF_ADDR);
DELAY(10);
 
+   mtx_lock_spin(ar71xx_pci_mtx);
ar71xx_pci_check_bus_error();
+   mtx_unlock_spin(ar71xx_pci_mtx);
 
/* Fixup internal PCI bridge */
ar71xx_pci_local_write(dev, PCIR_COMMAND,
___
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: r234366 - head/sys/mips/atheros

2012-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 17 01:34:49 2012
New Revision: 234366
URL: http://svn.freebsd.org/changeset/base/234366

Log:
  Style(9) and white space fixes.

Modified:
  head/sys/mips/atheros/ar71xx_pci.c

Modified: head/sys/mips/atheros/ar71xx_pci.c
==
--- head/sys/mips/atheros/ar71xx_pci.c  Tue Apr 17 01:22:59 2012
(r234365)
+++ head/sys/mips/atheros/ar71xx_pci.c  Tue Apr 17 01:34:49 2012
(r234366)
@@ -67,11 +67,11 @@ __FBSDID($FreeBSD$);
 #include sys/firmware.h
 #endif /* AR71XX_ATH_EEPROM */
 
-#undef AR71XX_PCI_DEBUG
-#ifdef AR71XX_PCI_DEBUG
-#define dprintf printf
+#undef AR71XX_PCI_DEBUG
+#ifdef AR71XX_PCI_DEBUG
+#definedprintf printf
 #else
-#define dprintf(x, arg...)
+#definedprintf(x, arg...)
 #endif
 
 struct mtx ar71xx_pci_mtx;
@@ -97,7 +97,7 @@ static int ar71xx_pci_teardown_intr(devi
void *);
 static int ar71xx_pci_intr(void *);
 
-static void 
+static void
 ar71xx_pci_mask_irq(void *source)
 {
uint32_t reg;
@@ -110,7 +110,7 @@ ar71xx_pci_mask_irq(void *source)
ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, reg  ~(1  irq));
 }
 
-static void 
+static void
 ar71xx_pci_unmask_irq(void *source)
 {
uint32_t reg;
@@ -123,15 +123,16 @@ ar71xx_pci_unmask_irq(void *source)
reg = ATH_READ_REG(AR71XX_PCI_INTR_MASK);
 }
 
-/* 
- * get bitmask for bytes of interest: 
- *   0 - we want this byte, 1 - ignore it. e.g: we read 1 byte 
+/*
+ * get bitmask for bytes of interest:
+ *   0 - we want this byte, 1 - ignore it. e.g: we read 1 byte
  *   from register 7. Bitmask would be: 0111
  */
 static uint32_t
 ar71xx_get_bytes_to_read(int reg, int bytes)
 {
uint32_t bytes_to_read = 0;
+
if ((bytes % 4) == 0)
bytes_to_read = 0;
else if ((bytes % 4) == 1)
@@ -144,7 +145,7 @@ ar71xx_get_bytes_to_read(int reg, int by
return (bytes_to_read);
 }
 
-static int 
+static int
 ar71xx_pci_check_bus_error(void)
 {
uint32_t error, addr, has_errors = 0;
@@ -185,20 +186,20 @@ ar71xx_pci_make_addr(int bus, int slot, 
if (bus == 0) {
return ((1  slot) | (func  8) | (reg  ~3));
} else {
-   return ((bus  16) | (slot  11) | (func  8) 
+   return ((bus  16) | (slot  11) | (func  8)
| (reg   ~3) | 1);
}
 }
 
 static int
-ar71xx_pci_conf_setup(int bus, int slot, int func, int reg, int bytes, 
+ar71xx_pci_conf_setup(int bus, int slot, int func, int reg, int bytes,
 uint32_t cmd)
 {
uint32_t addr = ar71xx_pci_make_addr(bus, slot, func, (reg  ~3));
-   cmd |= (ar71xx_get_bytes_to_read(reg, bytes)  4);
 
mtx_assert(ar71xx_pci_mtx, MA_OWNED);
 
+   cmd |= (ar71xx_get_bytes_to_read(reg, bytes)  4);
ATH_WRITE_REG(AR71XX_PCI_CONF_ADDR, addr);
ATH_WRITE_REG(AR71XX_PCI_CONF_CMD, cmd);
 
@@ -209,7 +210,7 @@ ar71xx_pci_conf_setup(int bus, int slot,
 }
 
 static uint32_t
-ar71xx_pci_read_config(device_t dev, u_int bus, u_int slot, u_int func, 
+ar71xx_pci_read_config(device_t dev, u_int bus, u_int slot, u_int func,
 u_int reg, int bytes)
 {
uint32_t data;
@@ -240,7 +241,7 @@ ar71xx_pci_read_config(device_t dev, u_i
/* get request bytes from 32-bit word */
data = (data  shift)  mask;
 
-   dprintf(%s: read 0x%x\n, __func__, data);
+   dprintf(%s: read 0x%x\n, __func__, data);
 
return (data);
 }
@@ -253,7 +254,6 @@ ar71xx_pci_local_write(device_t dev, uin
dprintf(%s: local write reg %d(%d)\n, __func__, reg, bytes);
 
data = data  (8*(reg % 4));
-
cmd = PCI_LCONF_CMD_WRITE | (reg  ~3);
cmd |= (ar71xx_get_bytes_to_read(reg, bytes)  20);
mtx_lock_spin(ar71xx_pci_mtx);
@@ -271,7 +271,6 @@ ar71xx_pci_write_config(device_t dev, u_
func, reg, bytes);
 
data = data  (8*(reg % 4));
-
mtx_lock_spin(ar71xx_pci_mtx);
 if (ar71xx_pci_conf_setup(bus, slot, func, reg, bytes,
 PCI_CONF_CMD_WRITE) == 0)
@@ -453,7 +452,7 @@ ar71xx_pci_attach(device_t dev)
 
if ((bus_setup_intr(dev, sc-sc_irq, INTR_TYPE_MISC,
ar71xx_pci_intr, NULL, sc, sc-sc_ih))) {
-   device_printf(dev, 
+   device_printf(dev,
WARNING: unable to register interrupt handler\n);
return ENXIO;
}
@@ -501,7 +500,8 @@ ar71xx_pci_attach(device_t dev)
 }
 
 static int
-ar71xx_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t 
*result)
+ar71xx_pci_read_ivar(device_t dev, device_t child, int which,
+uintptr_t *result)
 {
struct ar71xx_pci_softc *sc = device_get_softc(dev);
 
@@ -518,7 +518,8 @@ ar71xx_pci_read_ivar(device_t dev, devic
 }
 
 static int
-ar71xx_pci_write_ivar(device_t dev, device_t child, int which, uintptr_t 
result)
+ar71xx_pci_write_ivar(device_t dev, device_t child, int which,
+uintptr_t result)
 {

svn commit: r234367 - head/sys/dev/mwl

2012-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 17 04:31:50 2012
New Revision: 234367
URL: http://svn.freebsd.org/changeset/base/234367

Log:
  Add missing #include

Modified:
  head/sys/dev/mwl/if_mwl.c

Modified: head/sys/dev/mwl/if_mwl.c
==
--- head/sys/dev/mwl/if_mwl.c   Tue Apr 17 01:34:49 2012(r234366)
+++ head/sys/dev/mwl/if_mwl.c   Tue Apr 17 04:31:50 2012(r234367)
@@ -37,6 +37,7 @@ __FBSDID($FreeBSD$);
 
 #include opt_inet.h
 #include opt_mwl.h
+#include opt_wlan.h
 
 #include sys/param.h
 #include sys/systm.h 
___
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: r234368 - head/sys/dev/mwl

2012-04-16 Thread Adrian Chadd
Author: adrian
Date: Tue Apr 17 04:52:57 2012
New Revision: 234368
URL: http://svn.freebsd.org/changeset/base/234368

Log:
  Fix the RX free list locking creation and destruction to be consistent
  even in the face of errors.
  
  If the RX descriptor list fails, the RX lock won't be initialised, but
  then the DMA free path wil try freeing it.
  
  This commit is brought to you by a working mwl(4).

Modified:
  head/sys/dev/mwl/if_mwl.c

Modified: head/sys/dev/mwl/if_mwl.c
==
--- head/sys/dev/mwl/if_mwl.c   Tue Apr 17 04:31:50 2012(r234367)
+++ head/sys/dev/mwl/if_mwl.c   Tue Apr 17 04:52:57 2012(r234368)
@@ -310,6 +310,12 @@ mwl_attach(uint16_t devid, struct mwl_so
}
ic = ifp-if_l2com;
 
+   /*
+* Setup the RX free list lock early, so it can be consistently
+* removed.
+*/
+   MWL_RXFREE_INIT(sc);
+
/* set these up early for if_printf use */
if_initname(ifp, device_get_name(sc-sc_dev),
device_get_unit(sc-sc_dev));
@@ -531,6 +537,7 @@ bad2:
 bad1:
mwl_hal_detach(mh);
 bad:
+   MWL_RXFREE_DESTROY(sc);
if_free(ifp);
sc-sc_invalid = 1;
return error;
@@ -561,6 +568,7 @@ mwl_detach(struct mwl_softc *sc)
ieee80211_ifdetach(ic);
callout_drain(sc-sc_watchdog);
mwl_dma_cleanup(sc);
+   MWL_RXFREE_DESTROY(sc);
mwl_tx_cleanup(sc);
mwl_hal_detach(sc-sc_mh);
if_free(ifp);
@@ -2274,7 +2282,6 @@ mwl_rxdma_setup(struct mwl_softc *sc)
SLIST_INSERT_HEAD(sc-sc_rxfree, rbuf, next);
sc-sc_nrxfree++;
}
-   MWL_RXFREE_INIT(sc);
return 0;
 }
 #undef DS2PHYS
@@ -2298,7 +2305,6 @@ mwl_rxdma_cleanup(struct mwl_softc *sc)
}
if (sc-sc_rxdma.dd_desc_len != 0)
mwl_desc_cleanup(sc, sc-sc_rxdma);
-   MWL_RXFREE_DESTROY(sc);
 }
 
 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: r234355 - head/sys/sys

2012-04-16 Thread Dimitry Andric

On 2012-04-17 00:38, Bjoern A. Zeeb wrote:

On 16. Apr 2012, at 21:28 , Dimitry Andric wrote:

Author: dim
Date: Mon Apr 16 21:28:04 2012
New Revision: 234355
URL: http://svn.freebsd.org/changeset/base/234355

Log:
  Bump __FreeBSD_version due to the import of a new clang 3.1 prerelease
  snapshot.


With SVN can we please try to get these bumps done more atomically with the 
real changes and if we do not maybe reference which revision forced the bump?


I thought it was clearer to do this in a separate commit, since the
import modifies a large number of files, sort of drowning out this
change.



That said, why does 3.1-pre need a bump?


To make it easier for ports people to detect there is a new version.

Some command line options have changed, some new behaviour has been
introduced, etc.
___
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