svn commit: r237551 - head/sys/amd64/amd64

2012-06-25 Thread Alan Cox
Author: alc
Date: Mon Jun 25 07:13:25 2012
New Revision: 237551
URL: http://svn.freebsd.org/changeset/base/237551

Log:
  Add PV chunk and list locking to pmap_change_wiring(), pmap_protect(), and
  pmap_remove().  The execution of these functions is no longer serialized
  by the pvh global lock.
  
  Make some stylistic changes to the affected code for the sake of
  consistency with related code elsewhere in the pmap.

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Mon Jun 25 07:11:03 2012(r237550)
+++ head/sys/amd64/amd64/pmap.c Mon Jun 25 07:13:25 2012(r237551)
@@ -257,8 +257,11 @@ static voidfree_pv_chunk(struct pv_chun
 static voidfree_pv_entry(pmap_t pmap, pv_entry_t pv);
 static pv_entry_t get_pv_entry(pmap_t pmap, boolean_t try);
 static int popcnt_pc_map_elem(uint64_t elem);
-static voidreserve_pv_entry(pmap_t pmap, int needed);
-static voidpmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
+static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp);
+static voidreserve_pv_entries(pmap_t pmap, int needed,
+   struct rwlock **lockp);
+static voidpmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
+   struct rwlock **lockp);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
struct rwlock **lockp);
 static voidpmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
@@ -269,6 +272,8 @@ static int  pmap_pvh_wired_mappings(struc
 
 static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode);
 static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va);
+static boolean_t pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde,
+vm_offset_t va, struct rwlock **lockp);
 static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe,
 vm_offset_t va);
 static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m,
@@ -287,9 +292,10 @@ static boolean_t pmap_protect_pde(pmap_t
 vm_prot_t prot);
 static void pmap_pte_attr(pt_entry_t *pte, int cache_bits);
 static int pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva,
-   vm_page_t *free);
+   vm_page_t *free, struct rwlock **lockp);
 static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq,
-   vm_offset_t sva, pd_entry_t ptepde, vm_page_t *free);
+   vm_offset_t sva, pd_entry_t ptepde, vm_page_t *free,
+   struct rwlock **lockp);
 static void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte);
 static void pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde,
 vm_page_t *free);
@@ -2094,9 +2100,9 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_
  * exacerbating the shortage of free pv entries.
  */
 static vm_page_t
-pmap_pv_reclaim(pmap_t locked_pmap)
+reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp)
 {
-   struct pch newtail;
+   struct pch new_tail;
struct pv_chunk *pc;
struct md_page *pvh;
pd_entry_t *pde;
@@ -2108,13 +2114,15 @@ pmap_pv_reclaim(pmap_t locked_pmap)
uint64_t inuse;
int bit, field, freed;

-   rw_assert(&pvh_global_lock, RA_WLOCKED);
+   rw_assert(&pvh_global_lock, RA_LOCKED);
PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED);
pmap = NULL;
free = m_pc = NULL;
-   TAILQ_INIT(&newtail);
+   TAILQ_INIT(&new_tail);
+   mtx_lock(&pv_chunks_mutex);
while ((pc = TAILQ_FIRST(&pv_chunks)) != NULL && free == NULL) {
TAILQ_REMOVE(&pv_chunks, pc, pc_lru);
+   mtx_unlock(&pv_chunks_mutex);
if (pmap != pc->pc_pmap) {
if (pmap != NULL) {
pmap_invalidate_all(pmap);
@@ -2123,11 +2131,17 @@ pmap_pv_reclaim(pmap_t locked_pmap)
}
pmap = pc->pc_pmap;
/* Avoid deadlock and lock recursion. */
-   if (pmap > locked_pmap)
+   if (pmap > locked_pmap) {
+   if (*lockp != NULL) {
+   rw_wunlock(*lockp);
+   *lockp = NULL;
+   }
PMAP_LOCK(pmap);
-   else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) {
+   } else if (pmap != locked_pmap &&
+   !PMAP_TRYLOCK(pmap)) {
pmap = NULL;
-   TAILQ_INSERT_TAIL(&newtail, pc, pc_lru);
+   TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru);
+   mtx_lock(&pv_chunks_mutex);
continue;
}

svn commit: r237560 - in head/sys/modules: rdma/krping toecore

2012-06-25 Thread Ulrich Spoerlein
Author: uqs
Date: Mon Jun 25 09:46:06 2012
New Revision: 237560
URL: http://svn.freebsd.org/changeset/base/237560

Log:
  Fix 'make depend'.

Modified:
  head/sys/modules/rdma/krping/Makefile
  head/sys/modules/toecore/Makefile

Modified: head/sys/modules/rdma/krping/Makefile
==
--- head/sys/modules/rdma/krping/Makefile   Mon Jun 25 09:41:47 2012
(r237559)
+++ head/sys/modules/rdma/krping/Makefile   Mon Jun 25 09:46:06 2012
(r237560)
@@ -5,8 +5,8 @@ RDMA= ${.CURDIR}/../../../contrib/rdma/k
 
 KMOD= krping
 SRCS= krping.c krping_dev.c getopt.c
-SRCS+=  bus_if.h device_if.h opt_sched.h pci_if.h pcib_if.h
-SRCS+=  vnode_if.h
-CFLAGS+= -I${.CURDIR}/../../../ofed/include 
+SRCS+=  bus_if.h device_if.h pci_if.h pcib_if.h vnode_if.h
+SRCS+=  opt_sched.h opt_inet.h opt_inet6.h
+CFLAGS+= -I${.CURDIR}/../../../ofed/include
 
 .include 

Modified: head/sys/modules/toecore/Makefile
==
--- head/sys/modules/toecore/Makefile   Mon Jun 25 09:41:47 2012
(r237559)
+++ head/sys/modules/toecore/Makefile   Mon Jun 25 09:46:06 2012
(r237560)
@@ -4,6 +4,6 @@
 
 KMOD=  toecore
 SRCS=  toecore.c
-SRCS+= opt_ofed.h
+SRCS+= opt_ofed.h opt_inet.h opt_inet6.h
 
 .include 
___
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: r237561 - head/sys/net80211

2012-06-25 Thread Monthadar Al Jaberi
Author: monthadar
Date: Mon Jun 25 11:52:26 2012
New Revision: 237561
URL: http://svn.freebsd.org/changeset/base/237561

Log:
  Mesh mode, potential garbage in QoS subfield.
  
  * qos[1] subfield is never assigned a value before this statement.
  qos[1] can potentially be OR:ed with garbage. Make it an assignment instead;
  * Remove brackets around if statement;
  
  Approved by: adrian

Modified:
  head/sys/net80211/ieee80211_output.c

Modified: head/sys/net80211/ieee80211_output.c
==
--- head/sys/net80211/ieee80211_output.cMon Jun 25 09:46:06 2012
(r237560)
+++ head/sys/net80211/ieee80211_output.cMon Jun 25 11:52:26 2012
(r237561)
@@ -1313,9 +1313,9 @@ ieee80211_encap(struct ieee80211vap *vap
if 
(ic->ic_wme.wme_wmeChanParams.cap_wmeParams[ac].wmep_noackPolicy)
qos[0] |= IEEE80211_QOS_ACKPOLICY_NOACK;
 #ifdef IEEE80211_SUPPORT_MESH
-   if (vap->iv_opmode == IEEE80211_M_MBSS) {
-   qos[1] |= IEEE80211_QOS_MC;
-   } else
+   if (vap->iv_opmode == IEEE80211_M_MBSS)
+   qos[1] = IEEE80211_QOS_MC;
+   else
 #endif
qos[1] = 0;
wh->i_fc[0] |= IEEE80211_FC0_SUBTYPE_QOS;
___
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: r237008 - head/sys/dev/pci

2012-06-25 Thread John Baldwin
On Saturday, June 23, 2012 6:16:26 pm Marius Strobl wrote:
> On Wed, Jun 13, 2012 at 03:04:50PM +, John Baldwin wrote:
> > Author: jhb
> > Date: Wed Jun 13 15:04:50 2012
> > New Revision: 237008
> > URL: http://svn.freebsd.org/changeset/base/237008
> > 
> > Log:
> >   Fix a couple of bugs that prevented windows in PCI-PCI bridges from
> >   growing "downward" (moving the start address down).  First, an off by
> >   one error caused the end address to be moved down an extra alignment
> >   chunk unnecessarily.  Second, when aligning the new candidate starting
> >   address, the wrong bits were masked off.
> >   
> 
> Unfortunately, this now panics a sparc64 machine on the first attempt
> to use a grown resource via bus_space(9) for me:
> pcib3:  at device 0.0 on pci2
> pcib2: allocated I/O port range (0x1000-0x1fff) for rid 1c of pcib3
> pcib2: allocated memory range (0x20-0x3ff) for rid 20 of pcib3
> pcib3:   domain0
> pcib3:   secondary bus 5
> pcib3:   subordinate bus   5
> pcib3:   I/O decode0x1000-0x1fff
> pcib3:   memory decode 0x20-0x3ff
> pcib3:   no prefetched decode
> pcib3:   Subtractively decoded bridge.
> <...>
> pci3:  on pcib3
> <...>
> isab0:  at device 30.0 on pci3
> isa0:  on isab0
> <...>
> rtc0:  at port 0x70-0x73 on isa0
> pcib3: attempting to grow I/O port window for (0x70-0x73,0x4)
> front candidate range: 0x70-0x73
> pcib3: grew I/O port window to 0x70-0x1fff
> panic: start address is not aligned
> Alternatively, this may also be a data access trap, which also indicates
> that some invalid address being used for the access.

I think this was fixed in the next commit to this file (I had gotten the
mask bits on 'front' wrong).  Yes, it should be fixed by r237271:

Old version:

(gdb) p/x (0x70 & (~(1ul << 12) - 1))
$1 = 0x70

Fixed version:

(gdb) p/x (0x70 & (~((1ul << 12) - 1)))
$2 = 0x0

> before:
> rtc0:  at port 0x70-0x73 on isa0
> pcib3: attempting to grow I/O port window for (0x70-0x73,0x4)
> pcib2: allocated I/O port range (0x70-0x73) for rid 0 of rtc0
> 
> Shouldn't a subtractively decoded resource actually be outside of
> the window of the parent PCI-PCI bridge, i.e. it seems we shouldn't
> try to grow the window in that case? The below patch fixes this for
> me, I'm not sure whether that actually is the right approach though.

Well, I've seen subtractive bridges with programmed windows, and the resource 
will decode properly either way.  What the current code does is allow the
request to pass up the tree if growing fails.

-- 
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: r237563 - head/sys/ofed/include/linux

2012-06-25 Thread Navdeep Parhar
Author: np
Date: Mon Jun 25 16:52:27 2012
New Revision: 237563
URL: http://svn.freebsd.org/changeset/base/237563

Log:
  Fix clang warning when compiling iw_cxgb.
  
  Reported by:  rene, dim

Modified:
  head/sys/ofed/include/linux/workqueue.h

Modified: head/sys/ofed/include/linux/workqueue.h
==
--- head/sys/ofed/include/linux/workqueue.h Mon Jun 25 12:30:51 2012
(r237562)
+++ head/sys/ofed/include/linux/workqueue.h Mon Jun 25 16:52:27 2012
(r237563)
@@ -129,7 +129,7 @@ _create_workqueue_common(char *name, int
wq = kmalloc(sizeof(*wq), M_WAITOK);
wq->taskqueue = taskqueue_create((name), M_WAITOK,
taskqueue_thread_enqueue,  &wq->taskqueue);
-   taskqueue_start_threads(&wq->taskqueue, cpus, PWAIT, (name));
+   taskqueue_start_threads(&wq->taskqueue, cpus, PWAIT, "%s", name);
 
return (wq);
 }
___
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: r237008 - head/sys/dev/pci

2012-06-25 Thread Marius Strobl
On Mon, Jun 25, 2012 at 10:00:08AM -0400, John Baldwin wrote:
> On Saturday, June 23, 2012 6:16:26 pm Marius Strobl wrote:
> > On Wed, Jun 13, 2012 at 03:04:50PM +, John Baldwin wrote:
> > > Author: jhb
> > > Date: Wed Jun 13 15:04:50 2012
> > > New Revision: 237008
> > > URL: http://svn.freebsd.org/changeset/base/237008
> > > 
> > > Log:
> > >   Fix a couple of bugs that prevented windows in PCI-PCI bridges from
> > >   growing "downward" (moving the start address down).  First, an off by
> > >   one error caused the end address to be moved down an extra alignment
> > >   chunk unnecessarily.  Second, when aligning the new candidate starting
> > >   address, the wrong bits were masked off.
> > >   
> > 
> > Unfortunately, this now panics a sparc64 machine on the first attempt
> > to use a grown resource via bus_space(9) for me:
> > pcib3:  at device 0.0 on pci2
> > pcib2: allocated I/O port range (0x1000-0x1fff) for rid 1c of pcib3
> > pcib2: allocated memory range (0x20-0x3ff) for rid 20 of pcib3
> > pcib3:   domain0
> > pcib3:   secondary bus 5
> > pcib3:   subordinate bus   5
> > pcib3:   I/O decode0x1000-0x1fff
> > pcib3:   memory decode 0x20-0x3ff
> > pcib3:   no prefetched decode
> > pcib3:   Subtractively decoded bridge.
> > <...>
> > pci3:  on pcib3
> > <...>
> > isab0:  at device 30.0 on pci3
> > isa0:  on isab0
> > <...>
> > rtc0:  at port 0x70-0x73 on isa0
> > pcib3: attempting to grow I/O port window for (0x70-0x73,0x4)
> > front candidate range: 0x70-0x73
> > pcib3: grew I/O port window to 0x70-0x1fff
> > panic: start address is not aligned
> > Alternatively, this may also be a data access trap, which also indicates
> > that some invalid address being used for the access.
> 
> I think this was fixed in the next commit to this file (I had gotten the
> mask bits on 'front' wrong).  Yes, it should be fixed by r237271:
> 
> Old version:
> 
> (gdb) p/x (0x70 & (~(1ul << 12) - 1))
> $1 = 0x70
> 
> Fixed version:
> 
> (gdb) p/x (0x70 & (~((1ul << 12) - 1)))
> $2 = 0x0

Well, a stock r237433 still panics with a data access trap when
trying to use the resource via bus_space(9). So while the math for
growing the window is probably right now, there still is a problem.

> 
> > before:
> > rtc0:  at port 0x70-0x73 on isa0
> > pcib3: attempting to grow I/O port window for (0x70-0x73,0x4)
> > pcib2: allocated I/O port range (0x70-0x73) for rid 0 of rtc0
> > 
> > Shouldn't a subtractively decoded resource actually be outside of
> > the window of the parent PCI-PCI bridge, i.e. it seems we shouldn't
> > try to grow the window in that case? The below patch fixes this for
> > me, I'm not sure whether that actually is the right approach though.
> 
> Well, I've seen subtractive bridges with programmed windows, and the resource 
> will decode properly either way.  What the current code does is allow the
> request to pass up the tree if growing fails.

By growing the window to 0x0-0x1fff in this case we are effectively
turning the formerly subtractively decoded resource in a positively
decodeded one. Maybe there's some additional bit, probably in the
PCI-ISA bridge, that needs to be switch for that, too? In any case,
growing the window in this case and by that changing the type of
decoding seems like a strange approach to me. Why do subtractive
decoders exist in the first place when the windows alternatively
could be grown/set up to only just do positive decoding instead?

Marius

___
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: r237565 - in head/sys: netinet netinet6

2012-06-25 Thread Michael Tuexen
Author: tuexen
Date: Mon Jun 25 17:15:09 2012
New Revision: 237565
URL: http://svn.freebsd.org/changeset/base/237565

Log:
  Whitespace cleanup.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_indata.c
  head/sys/netinet/sctp_input.c
  head/sys/netinet/sctp_output.c
  head/sys/netinet/sctp_sysctl.c
  head/sys/netinet/sctp_sysctl.h
  head/sys/netinet/sctp_usrreq.c
  head/sys/netinet/sctputil.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_indata.c
==
--- head/sys/netinet/sctp_indata.c  Mon Jun 25 17:12:51 2012
(r237564)
+++ head/sys/netinet/sctp_indata.c  Mon Jun 25 17:15:09 2012
(r237565)
@@ -1529,7 +1529,7 @@ sctp_process_a_data_chunk(struct sctp_tc
 */
if (stcb->sctp_socket->so_rcv.sb_cc) {
/* some to read, wake-up */
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
 
so = SCTP_INP_SO(stcb->sctp_ep);
@@ -1545,7 +1545,7 @@ sctp_process_a_data_chunk(struct sctp_tc
}
 #endif
sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
SCTP_SOCKET_UNLOCK(so, 1);
 #endif
}
@@ -3982,7 +3982,7 @@ sctp_express_handle_sack(struct sctp_tcb
}
/* sa_ignore NO_NULL_CHK */
if (stcb->sctp_socket) {
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
 
 #endif
@@ -3991,7 +3991,7 @@ sctp_express_handle_sack(struct sctp_tcb
/* sa_ignore NO_NULL_CHK */
sctp_wakeup_log(stcb, 1, SCTP_WAKESND_FROM_SACK);
}
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
so = SCTP_INP_SO(stcb->sctp_ep);
atomic_add_int(&stcb->asoc.refcnt, 1);
SCTP_TCB_UNLOCK(stcb);
@@ -4005,7 +4005,7 @@ sctp_express_handle_sack(struct sctp_tcb
}
 #endif
sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket);
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
SCTP_SOCKET_UNLOCK(so, 1);
 #endif
} else {
@@ -4734,7 +4734,7 @@ sctp_handle_sack(struct mbuf *m, int off
}
/* sa_ignore NO_NULL_CHK */
if ((wake_him) && (stcb->sctp_socket)) {
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
 
 #endif
@@ -4742,7 +4742,7 @@ sctp_handle_sack(struct mbuf *m, int off
if (SCTP_BASE_SYSCTL(sctp_logging_level) & 
SCTP_WAKE_LOGGING_ENABLE) {
sctp_wakeup_log(stcb, wake_him, SCTP_WAKESND_FROM_SACK);
}
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
so = SCTP_INP_SO(stcb->sctp_ep);
atomic_add_int(&stcb->asoc.refcnt, 1);
SCTP_TCB_UNLOCK(stcb);
@@ -4756,7 +4756,7 @@ sctp_handle_sack(struct mbuf *m, int off
}
 #endif
sctp_sowwakeup_locked(stcb->sctp_ep, stcb->sctp_socket);
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
SCTP_SOCKET_UNLOCK(so, 1);
 #endif
} else {

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Mon Jun 25 17:12:51 2012
(r237564)
+++ head/sys/netinet/sctp_input.c   Mon Jun 25 17:15:09 2012
(r237565)
@@ -757,7 +757,7 @@ static void
 sctp_handle_abort(struct sctp_abort_chunk *abort,
 struct sctp_tcb *stcb, struct sctp_nets *net)
 {
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
struct socket *so;
 
 #endif
@@ -807,7 +807,7 @@ sctp_handle_abort(struct sctp_abort_chun
 #ifdef SCTP_ASOCLOG_OF_TSNS
sctp_print_out_track_log(stcb);
 #endif
-#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
+#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING)
so = SCTP_INP_SO(stcb->sctp_ep);
atomic_add_int(&stcb->asoc.refcnt, 1);
SCTP_TCB_UNLOCK(stcb);
@@ -818,7 +818,7 @@ sctp_handle_abort(struct sctp_abort_chun
stcb->asoc.state |= SCTP_STATE_WAS_ABORTED;
(void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC,
SCTP_FROM_SCTP_INPUT + SCTP_LOC_6);
-#if defined (__APPLE__) || defined(SCTP_

svn commit: r237566 - head/sys/mips/mips

2012-06-25 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Mon Jun 25 17:50:11 2012
New Revision: 237566
URL: http://svn.freebsd.org/changeset/base/237566

Log:
  Handle case when result of pmap_pte is NULL. This issue was uncovered
  by r237367

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

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Mon Jun 25 17:15:09 2012(r237565)
+++ head/sys/mips/mips/pmap.c   Mon Jun 25 17:50:11 2012(r237566)
@@ -765,6 +765,7 @@ pmap_extract(pmap_t pmap, vm_offset_t va
 vm_page_t
 pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot)
 {
+   pt_entry_t *ptep;
pt_entry_t pte;
vm_page_t m;
vm_paddr_t pa;
@@ -773,8 +774,9 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
pa = 0;
PMAP_LOCK(pmap);
 retry:
-   pte = *pmap_pte(pmap, va);
-   if (pte != 0 && pte_test(&pte, PTE_V) &&
+   ptep = pmap_pte(pmap, va);
+   if ((ptep != NULL)  && ((pte = *ptep) != 0) && 
+   pte_test(&pte, PTE_V) &&
(pte_test(&pte, PTE_D) || (prot & VM_PROT_WRITE) == 0)) {
if (vm_page_pa_tryrelock(pmap, TLBLO_PTE_TO_PA(pte), &pa))
goto retry;
___
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: r237008 - head/sys/dev/pci

2012-06-25 Thread John Baldwin
On Monday, June 25, 2012 1:08:11 pm Marius Strobl wrote:
> On Mon, Jun 25, 2012 at 10:00:08AM -0400, John Baldwin wrote:
> > On Saturday, June 23, 2012 6:16:26 pm Marius Strobl wrote:
> > > On Wed, Jun 13, 2012 at 03:04:50PM +, John Baldwin wrote:
> > > > Author: jhb
> > > > Date: Wed Jun 13 15:04:50 2012
> > > > New Revision: 237008
> > > > URL: http://svn.freebsd.org/changeset/base/237008
> > > > 
> > > > Log:
> > > >   Fix a couple of bugs that prevented windows in PCI-PCI bridges from
> > > >   growing "downward" (moving the start address down).  First, an off by
> > > >   one error caused the end address to be moved down an extra alignment
> > > >   chunk unnecessarily.  Second, when aligning the new candidate starting
> > > >   address, the wrong bits were masked off.
> > > >   
> > > 
> > > Unfortunately, this now panics a sparc64 machine on the first attempt
> > > to use a grown resource via bus_space(9) for me:
> > > pcib3:  at device 0.0 on pci2
> > > pcib2: allocated I/O port range (0x1000-0x1fff) for rid 1c of pcib3
> > > pcib2: allocated memory range (0x20-0x3ff) for rid 20 of pcib3
> > > pcib3:   domain0
> > > pcib3:   secondary bus 5
> > > pcib3:   subordinate bus   5
> > > pcib3:   I/O decode0x1000-0x1fff
> > > pcib3:   memory decode 0x20-0x3ff
> > > pcib3:   no prefetched decode
> > > pcib3:   Subtractively decoded bridge.
> > > <...>
> > > pci3:  on pcib3
> > > <...>
> > > isab0:  at device 30.0 on pci3
> > > isa0:  on isab0
> > > <...>
> > > rtc0:  at port 0x70-0x73 on isa0
> > > pcib3: attempting to grow I/O port window for (0x70-0x73,0x4)
> > > front candidate range: 0x70-0x73
> > > pcib3: grew I/O port window to 0x70-0x1fff
> > > panic: start address is not aligned
> > > Alternatively, this may also be a data access trap, which also indicates
> > > that some invalid address being used for the access.
> > 
> > I think this was fixed in the next commit to this file (I had gotten the
> > mask bits on 'front' wrong).  Yes, it should be fixed by r237271:
> > 
> > Old version:
> > 
> > (gdb) p/x (0x70 & (~(1ul << 12) - 1))
> > $1 = 0x70
> > 
> > Fixed version:
> > 
> > (gdb) p/x (0x70 & (~((1ul << 12) - 1)))
> > $2 = 0x0
> 
> Well, a stock r237433 still panics with a data access trap when
> trying to use the resource via bus_space(9). So while the math for
> growing the window is probably right now, there still is a problem.

Hmm.  It would be interesting to know if it used to grow before (it might
not have due to the bugs I fixed in the growing code).

> > 
> > > before:
> > > rtc0:  at port 0x70-0x73 on isa0
> > > pcib3: attempting to grow I/O port window for (0x70-0x73,0x4)
> > > pcib2: allocated I/O port range (0x70-0x73) for rid 0 of rtc0
> > > 
> > > Shouldn't a subtractively decoded resource actually be outside of
> > > the window of the parent PCI-PCI bridge, i.e. it seems we shouldn't
> > > try to grow the window in that case? The below patch fixes this for
> > > me, I'm not sure whether that actually is the right approach though.
> > 
> > Well, I've seen subtractive bridges with programmed windows, and the 
> > resource 
> > will decode properly either way.  What the current code does is allow the
> > request to pass up the tree if growing fails.
> 
> By growing the window to 0x0-0x1fff in this case we are effectively
> turning the formerly subtractively decoded resource in a positively
> decodeded one. Maybe there's some additional bit, probably in the
> PCI-ISA bridge, that needs to be switch for that, too? In any case,
> growing the window in this case and by that changing the type of
> decoding seems like a strange approach to me. Why do subtractive
> decoders exist in the first place when the windows alternatively
> could be grown/set up to only just do positive decoding instead?

The PCI-ISA bridge should already be decoding that range.  Note that
subtractive decoding is slower (it has to wait for an extra cycle to
give other devices a chance to snag a request).  I would not mind a
tunable to control growing or not growing a window on a subtractively
decoded bridge.  Does the firmware assign a window to this bridge
btw?  We probably should not allocate a new window for a subtractively
decoded bridge, but if the firmware has already assigned a window,
growing an existing window seems less problematic.

-- 
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: r237568 - head/crypto/openssh

2012-06-25 Thread Xin LI
Author: delphij
Date: Mon Jun 25 19:01:04 2012
New Revision: 237568
URL: http://svn.freebsd.org/changeset/base/237568

Log:
  MFV (r237567):
  
  Fetch both ECDSA and RSA keys by default in ssh-keyscan(1).
  
  Approved by:  des
  Obtained from:OpenSSH portable
  MFC after:1 week

Modified:
  head/crypto/openssh/ssh-keyscan.1
  head/crypto/openssh/ssh-keyscan.c
Directory Properties:
  head/crypto/openssh/   (props changed)

Modified: head/crypto/openssh/ssh-keyscan.1
==
--- head/crypto/openssh/ssh-keyscan.1   Mon Jun 25 18:54:02 2012
(r237567)
+++ head/crypto/openssh/ssh-keyscan.1   Mon Jun 25 19:01:04 2012
(r237568)
@@ -1,4 +1,4 @@
-.\"$OpenBSD: ssh-keyscan.1,v 1.29 2010/08/31 11:54:45 djm Exp $
+.\"$OpenBSD: ssh-keyscan.1,v 1.30 2012/04/11 13:34:17 djm Exp $
 .\"$FreeBSD$
 .\"
 .\" Copyright 1995, 1996 by David Mazieres .
@@ -7,7 +7,7 @@
 .\" permitted provided that due credit is given to the author and the
 .\" OpenBSD project by leaving this copyright notice intact.
 .\"
-.Dd August 31, 2010
+.Dd April 11 2012
 .Dt SSH-KEYSCAN 1
 .Os
 .Sh NAME
@@ -95,8 +95,11 @@ or
 .Dq rsa
 for protocol version 2.
 Multiple values may be specified by separating them with commas.
-The default is
-.Dq rsa .
+The default is to fetch
+.Dq rsa
+and
+.Dq ecdsa
+keys.
 .It Fl v
 Verbose mode.
 Causes

Modified: head/crypto/openssh/ssh-keyscan.c
==
--- head/crypto/openssh/ssh-keyscan.c   Mon Jun 25 18:54:02 2012
(r237567)
+++ head/crypto/openssh/ssh-keyscan.c   Mon Jun 25 19:01:04 2012
(r237568)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.85 2011/03/15 10:36:02 okan Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.86 2012/04/11 13:34:17 djm Exp $ */
 /*
  * Copyright 1995, 1996 by David Mazieres .
  *
@@ -57,7 +57,7 @@ int ssh_port = SSH_DEFAULT_PORT;
 #define KT_RSA 4
 #define KT_ECDSA   8
 
-int get_keytypes = KT_RSA; /* Get only RSA keys by default */
+int get_keytypes = KT_RSA|KT_ECDSA;/* Get RSA and ECDSA keys by default */
 
 int hash_hosts = 0;/* Hash hostname on output */
 
___
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: r237569 - in head/sys: netinet netinet6

2012-06-25 Thread Michael Tuexen
Author: tuexen
Date: Mon Jun 25 19:13:43 2012
New Revision: 237569
URL: http://svn.freebsd.org/changeset/base/237569

Log:
  Unify sctp_input() and sctp6_input().
  
  MFC after: 3 days

Modified:
  head/sys/netinet/sctp_input.c
  head/sys/netinet6/sctp6_usrreq.c

Modified: head/sys/netinet/sctp_input.c
==
--- head/sys/netinet/sctp_input.c   Mon Jun 25 19:01:04 2012
(r237568)
+++ head/sys/netinet/sctp_input.c   Mon Jun 25 19:13:43 2012
(r237569)
@@ -5885,12 +5885,12 @@ sctp_input_with_port(struct mbuf *i_pak,
uint8_t ecn_bits;
struct ip *ip;
struct sctphdr *sh;
+   struct sctp_chunkhdr *ch;
struct sctp_inpcb *inp = NULL;
-   struct sctp_nets *net;
struct sctp_tcb *stcb = NULL;
-   struct sctp_chunkhdr *ch;
+   struct sctp_nets *net = NULL;
int refcount_up = 0;
-   int length, mlen, offset;
+   int length, offset;
uint32_t mflowid;
uint8_t use_mflowid;
 
@@ -5899,19 +5899,12 @@ sctp_input_with_port(struct mbuf *i_pak,
 
 #endif
 
+   iphlen = off;
if (SCTP_GET_PKT_VRFID(i_pak, vrf_id)) {
SCTP_RELEASE_PKT(i_pak);
return;
}
-   mlen = SCTP_HEADER_LEN(i_pak);
-   iphlen = off;
m = SCTP_HEADER_TO_CHAIN(i_pak);
-
-   net = NULL;
-   SCTP_STAT_INCR(sctps_recvpackets);
-   SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
-
-
 #ifdef SCTP_MBUF_LOGGING
/* Log in any input mbufs */
if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MBUF_LOGGING_ENABLE) {
@@ -5925,8 +5918,9 @@ sctp_input_with_port(struct mbuf *i_pak,
}
 #endif
 #ifdef SCTP_PACKET_LOGGING
-   if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING)
+   if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_LAST_PACKET_TRACING) {
sctp_packet_log(m);
+   }
 #endif
if (m->m_flags & M_FLOWID) {
mflowid = m->m_pkthdr.flowid;
@@ -5935,17 +5929,11 @@ sctp_input_with_port(struct mbuf *i_pak,
mflowid = 0;
use_mflowid = 0;
}
-   /*
-* Must take out the iphlen, since mlen expects this (only effect lb
-* case)
-*/
-   mlen -= iphlen;
-
-   /*
-* Get IP, SCTP, and first chunk header together in first mbuf.
-*/
+   SCTP_STAT_INCR(sctps_recvpackets);
+   SCTP_STAT_INCR_COUNTER64(sctps_inpackets);
+   /* Get IP, SCTP, and first chunk header together in the first mbuf. */
ip = mtod(m, struct ip *);
-   offset = iphlen + sizeof(*sh) + sizeof(*ch);
+   offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr);
if (SCTP_BUF_LEN(m) < offset) {
if ((m = m_pullup(m, offset)) == 0) {
SCTP_STAT_INCR(sctps_hdrops);
@@ -5953,28 +5941,26 @@ sctp_input_with_port(struct mbuf *i_pak,
}
ip = mtod(m, struct ip *);
}
-   /* validate mbuf chain length with IP payload length */
-   if (mlen < (SCTP_GET_IPV4_LENGTH(ip) - iphlen)) {
+   sh = (struct sctphdr *)((caddr_t)ip + iphlen);
+   ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(struct sctphdr));
+   offset -= sizeof(struct sctp_chunkhdr);
+   length = ip->ip_len + iphlen;
+   /* Validate mbuf chain length with IP payload length. */
+   if (SCTP_HEADER_LEN(i_pak) != length) {
+   SCTPDBG(SCTP_DEBUG_INPUT1,
+   "sctp_input() length:%d reported length:%d\n", length, 
SCTP_HEADER_LEN(i_pak));
SCTP_STAT_INCR(sctps_hdrops);
goto bad;
}
-   sh = (struct sctphdr *)((caddr_t)ip + iphlen);
-   ch = (struct sctp_chunkhdr *)((caddr_t)sh + sizeof(*sh));
-   SCTPDBG(SCTP_DEBUG_INPUT1,
-   "sctp_input() length:%d iphlen:%d\n", mlen, iphlen);
-
/* SCTP does not allow broadcasts or multicasts */
if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) {
goto bad;
}
if (SCTP_IS_IT_BROADCAST(ip->ip_dst, m)) {
-   /*
-* We only look at broadcast if its a front state, All
-* others we will not have a tcb for anyway.
-*/
goto bad;
}
-   /* validate SCTP checksum */
+   SCTPDBG(SCTP_DEBUG_INPUT1,
+   "sctp_input() length:%d iphlen:%d\n", length, iphlen);
SCTPDBG(SCTP_DEBUG_CRCOFFLOAD,
"sctp_input(): Packet of length %d received on %s with csum_flags 
0x%x.\n",
m->m_pkthdr.len,
@@ -5985,21 +5971,18 @@ sctp_input_with_port(struct mbuf *i_pak,
 #else
if (m->m_pkthdr.csum_flags & CSUM_SCTP_VALID) {
SCTP_STAT_INCR(sctps_recvhwcrc);
-   goto sctp_skip_csum_4;
+   goto sctp_skip_csum;
}
-   check = sh->checksum;   /* save incoming checksum */
-   sh->checksum = 0; 

svn commit: r237571 - head/sys/netinet6

2012-06-25 Thread Xin LI
Author: delphij
Date: Mon Jun 25 20:56:32 2012
New Revision: 237571
URL: http://svn.freebsd.org/changeset/base/237571

Log:
  Fix a LOR acquiring the if_afdata lock while holding an rtentry lock.
  Possibly do some entra work in case we would not get into the
  ifa0 != NULL paths later as we already do for the mltaddr before.
  
  XXX We should possibly error in case in6_setscope fails.
  
  Reference: 
http://lists.freebsd.org/pipermail/freebsd-net/2011-September/029829.html
  
  Submitted by: bz
  MFC after:1 week

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Mon Jun 25 19:59:08 2012(r237570)
+++ head/sys/netinet6/in6.c Mon Jun 25 20:56:32 2012(r237571)
@@ -1330,6 +1330,7 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
struct sockaddr_in6 mltaddr, mltmask;
struct in6_multi_mship *imm;
struct rtentry *rt;
+   struct sockaddr_in6 sin6;
int error;
 
/*
@@ -1356,6 +1357,19 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
if ((error = in6_setscope(&mltaddr.sin6_addr, ifp, NULL)) != 0)
return (error);
 
+   /*
+* As for the mltaddr above, proactively prepare the sin6 to avoid
+* rtentry un- and re-locking.
+*/
+   if (ifa0 != NULL) {
+   bzero(&sin6, sizeof(sin6));
+   sin6.sin6_len = sizeof(sin6);
+   sin6.sin6_family = AF_INET6;
+   memcpy(&sin6.sin6_addr, &satosin6(ifa0->ifa_addr)->sin6_addr, 
+   sizeof(sin6.sin6_addr));
+   in6_setscope(&sin6.sin6_addr, ifa0->ifa_ifp, NULL);
+   }
+
rt = in6_rtalloc1((struct sockaddr *)&mltaddr, 0, 0UL, RT_DEFAULT_FIB);
if (rt != NULL && rt->rt_gateway != NULL &&
(memcmp(&satosin6(rt->rt_gateway)->sin6_addr, 
@@ -1382,15 +1396,7 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
/*
 * Replace the gateway of the route.
 */
-   struct sockaddr_in6 sa;
-
-   bzero(&sa, sizeof(sa));
-   sa.sin6_len = sizeof(struct sockaddr_in6);
-   sa.sin6_family = AF_INET6;
-   memcpy(&sa.sin6_addr, 
&satosin6(ifa0->ifa_addr)->sin6_addr, 
-  sizeof(sa.sin6_addr));
-   in6_setscope(&sa.sin6_addr, ifa0->ifa_ifp, NULL);
-   memcpy(rt->rt_gateway, &sa, sizeof(sa));
+   memcpy(rt->rt_gateway, &sin6, sizeof(sin6));
RTFREE_LOCKED(rt);
}
} else {
@@ -1432,15 +1438,7 @@ in6_purgeaddr_mc(struct ifnet *ifp, stru
/*
 * Replace the gateway of the route.
 */
-   struct sockaddr_in6 sa;
-
-   bzero(&sa, sizeof(sa));
-   sa.sin6_len = sizeof(struct sockaddr_in6);
-   sa.sin6_family = AF_INET6;
-   memcpy(&sa.sin6_addr, 
&satosin6(ifa0->ifa_addr)->sin6_addr, 
-  sizeof(sa.sin6_addr));
-   in6_setscope(&sa.sin6_addr, ifa0->ifa_ifp, NULL);
-   memcpy(rt->rt_gateway, &sa, sizeof(sa));
+   memcpy(rt->rt_gateway, &sin6, sizeof(sin6));
RTFREE_LOCKED(rt);
}
} else {
___
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: r237572 - head/share/man/man4

2012-06-25 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Jun 25 21:33:45 2012
New Revision: 237572
URL: http://svn.freebsd.org/changeset/base/237572

Log:
  Add missing MLINKS for whatever -> if_whatever.
  
  Reviewed by:  brueffer
  MFC after:1 week

Modified:
  head/share/man/man4/Makefile

Modified: head/share/man/man4/Makefile
==
--- head/share/man/man4/MakefileMon Jun 25 20:56:32 2012
(r237571)
+++ head/share/man/man4/MakefileMon Jun 25 21:33:45 2012
(r237572)
@@ -547,8 +547,11 @@ MAN=   aac.4 \
 MLINKS=ae.4 if_ae.4
 MLINKS+=age.4 if_age.4
 MLINKS+=agp.4 agpgart.4
+MLINKS+=alc.4 if_alc.4
 MLINKS+=ale.4 if_ale.4
 MLINKS+=altq.4 ALTQ.4
+MLINKS+=ath.4 if_ath.4
+MLINKS+=ath_pci.4 if_ath_pci.4
 MLINKS+=an.4 if_an.4
 MLINKS+=aue.4 if_aue.4
 MLINKS+=axe.4 if_axe.4
@@ -558,9 +561,13 @@ MLINKS+=bge.4 if_bge.4
 MLINKS+=bktr.4 brooktree.4
 MLINKS+=bridge.4 if_bridge.4
 MLINKS+=bwi.4 if_bwi.4
+MLINKS+=bwn.4 if_bwn.4
 MLINKS+=cas.4 if_cas.4
+MLINKS+=cdce.4 if_cdce.4
 MLINKS+=crypto.4 cryptodev.4
 MLINKS+=cue.4 if_cue.4
+MLINKS+=cxgb.4 if_cxgb.4
+MLINKS+=cxgbe.4 if_cxgbe.4
 MLINKS+=dc.4 if_dc.4
 MLINKS+=de.4 if_de.4
 MLINKS+=disc.4 if_disc.4
@@ -606,14 +613,19 @@ MLINKS+=ixgbe.4 if_ixgbe.4
 MLINKS+=jme.4 if_jme.4
 MLINKS+=kue.4 if_kue.4
 MLINKS+=lagg.4 trunk.4
+MLINKS+=lagg.4 if_lagg.4
 MLINKS+=le.4 if_le.4
 MLINKS+=lge.4 if_lge.4
+MLINKS+=lmc.4 if_lmc.4
 MLINKS+=lo.4 loop.4
 MLINKS+=lp.4 plip.4
 MLINKS+=malo.4 if_malo.4
 MLINKS+=md.4 vn.4
 MLINKS+=mem.4 kmem.4
 MLINKS+=mn.4 if_mn.4
+MLINKS+=mos.4 if_mos.4
+MLINKS+=msk.4 if_msk.4
+MLINKS+=mwl.4 if_mwl.4
 MLINKS+=mxge.4 if_mxge.4
 MLINKS+=my.4 if_my.4
 MLINKS+=${_ndis.4} ${_if_ndis.4}
@@ -633,11 +645,13 @@ MLINKS+=re.4 if_re.4
 MLINKS+=rl.4 if_rl.4
 MLINKS+=rue.4 if_rue.4
 MLINKS+=rum.4 if_rum.4
+MLINKS+=run.4 if_run.4
 MLINKS+=scsi.4 CAM.4 \
scsi.4 cam.4 \
scsi.4 scbus.4 \
scsi.4 SCSI.4
 MLINKS+=sf.4 if_sf.4
+MLINKS+=sge.4 if_sge.4
 MLINKS+=sis.4 if_sis.4
 MLINKS+=sk.4 if_sk.4
 MLINKS+=smp.4 SMP.4
@@ -669,6 +683,7 @@ MLINKS+=vge.4 if_vge.4
 MLINKS+=vlan.4 if_vlan.4
 MLINKS+=vpo.4 imm.4
 MLINKS+=vr.4 if_vr.4
+MLINKS+=vte.4 if_vte.4
 MLINKS+=${_vtnet.4} ${_if_vtnet.4}
 MLINKS+=${_vxge.4} ${_if_vxge.4}
 MLINKS+=watchdog.4 SW_WATCHDOG.4
@@ -749,6 +764,9 @@ MLINKS+=lindev.4 full.4
 .if ${MACHINE_CPUARCH} == "amd64"
 _qlxgb.4=  qlxgb.4
 _sfxge.4=  sfxge.4
+
+MLINKS+=qlxgb.4 if_qlxgb.4
+MLINKS+=sfxge.4 if_sfxge.4
 .endif
 
 .if ${MACHINE_CPUARCH} == "powerpc"
___
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: r237412 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/dis

2012-06-25 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 2012-06-24 14:13:48 -0400, Ruslan Bukin wrote:
> On Fri, Jun 22, 2012 at 11:53:30AM -0400, Jung-uk Kim wrote:
>> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1
>> 
>> On 2012-06-22 05:58:47 -0400, Konstantin Belousov wrote:
>>> On Fri, Jun 22, 2012 at 12:40:45AM +, Jung-uk Kim wrote:
 Author: jkim Date: Fri Jun 22 00:40:44 2012 New Revision:
 237412 URL: http://svn.freebsd.org/changeset/base/237412
 
 Log: Merge ACPICA 20120620.
>>> 
>>> I think it is caused by import, malloc is called while spinlock
>>> is held:
>>> 
>>> ACPI: Executed 1 blocks of module-level executable AML code
>>> acpi0: Power Button (fixed) panic: blockable sleep lock (sleep
>>> mutex) 16 @ 
>>> /usr/home/kostik/work/build/bsd/DEV/src/sys/vm/uma_core.c:2040
>>>  cpuid = 0 KDB: stack backtrace: db_trace_self_wrapper() at 
>>> 0x80279d0a = db_trace_self_wrapper+0x2a panic() at 
>>> 0x80325a28 = panic+0x1d8 witness_checkorder() at 
>>> 0x80377938 = witness_checkorder+0x1d8 _mtx_lock_flags()
>>> at 0x80313777 = _mtx_lock_flags+0x87 uma_zalloc_arg()
>>> at 0x804db97a = uma_zalloc_arg+0x2ea malloc() at 
>>> 0x8030f7cd = malloc+0xbd AcpiUtAllocate() at 
>>> 0x802704f1 = AcpiUtAllocate+0x31 AcpiUtAllocateZeroed()
>>> at 0x80270559 = AcpiUtAllocateZeroed+0x19 
>>> AcpiSetupGpeForWake() at 0x8025becc = 
>>> AcpiSetupGpeForWake+0xfc acpi_probe_child() at
>>> 0x802848e9 = acpi_probe_child+0x2b9
>>> AcpiNsWalkNamespace() at 0x802686ef =
>>> AcpiNsWalkNamespace+0x15f AcpiWalkNamespace() at 
>>> 0x80268c0f = AcpiWalkNamespace+0xbf acpi_attach() at 
>>> 0x80283e43 = acpi_attach+0x993 device_attach() at 
>>> 0x8035ab62 = device_attach+0x72 bus_generic_attach()
>>> at 0x8035bd3a = bus_generic_attach+0x1a
>>> nexus_acpi_attach() at 0x804fbd89 =
>>> nexus_acpi_attach+0x69 device_attach() at 0x8035ab62 =
>>> device_attach+0x72 bus_generic_new_pass() at 0x8035bf46
>>> = bus_generic_new_pass+0xd6 bus_set_pass() at 
>>> 0x803597ba = bus_set_pass+0x7a configure() at 
>>> 0x804fd51a = configure+0xa mi_startup() at 
>>> 0x802d5c17 = mi_startup+0x77 btext() at
>>> 0x802531cc = btext+0x2c KDB: enter: panic [ thread pid
>>> 0 tid 10 ] Stopped at  0x8035fffb =
>>> kdb_enter+0x3b:movq $0,0x1027d62(%rip) db> show alllocks
>>> Process 0 (kernel) thread 0x80837cc0 (10) exclusive
>>> sleep mutex Giant (Giant) r = 0 (0x8133a900) locked @ 
>>> /usr/home/kostik/work/build/bsd/DEV/src/sys/kern/kern_module.c:116
>>>  exclusive spin mutex ACPI lock (0xfe000321da80) (ACPI
>>> lock (0xfe000321da80)) r = 0 (0xfe000321da80) locked @ 
>>> /usr/home/kostik/work/build/bsd/DEV/src/sys/dev/acpica/Osd/OsdSynch.c:535
>>
>>
>>> 
Hmm...
>>> 
>> I was afraid it might happen.  I'll look into it ASAP.
>> 
>> Sorry for the trouble,
>> 
> 
> I have the same problem on server & laptop
> 
> -Ruslan .
> 

I submitted this patch and I am waiting for confirmation:

http://people.freebsd.org/~jkim/evxfgpe.diff

Jung-uk Kim
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.19 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/o2i4ACgkQmlay1b9qnVOQxwCcDkT6IRp7BhI0OqC2drumJ7wP
R3kAoISjm6sEyxQ6TF6hbgNxv9JA07Xe
=ityD
-END PGP SIGNATURE-
___
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: r237573 - in head/lib/libc: stdlib stdtime

2012-06-25 Thread Isabell Long
Author: issyl0 (doc committer)
Date: Mon Jun 25 21:51:40 2012
New Revision: 237573
URL: http://svn.freebsd.org/changeset/base/237573

Log:
  Add more locale-specific functions to the relevant man pages and
  Makefiles:
  - libc/stdtime/strftime.3
  - libc/stdtime/strptime.3
  - libc/stdlib/strfmon.3
  
  Reviewed by:  theraven
  Approved by:  gabor (mentor)

Modified:
  head/lib/libc/stdlib/Makefile.inc
  head/lib/libc/stdlib/strfmon.3
  head/lib/libc/stdtime/Makefile.inc
  head/lib/libc/stdtime/strftime.3
  head/lib/libc/stdtime/strptime.3

Modified: head/lib/libc/stdlib/Makefile.inc
==
--- head/lib/libc/stdlib/Makefile.inc   Mon Jun 25 21:33:45 2012
(r237572)
+++ head/lib/libc/stdlib/Makefile.inc   Mon Jun 25 21:51:40 2012
(r237573)
@@ -42,6 +42,7 @@ MLINKS+=rand.3 rand_r.3 rand.3 srand.3 r
 MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \
random.3 srandomdev.3
 MLINKS+=radixsort.3 sradixsort.3
+MLINKS+=strfmon.3 strfmon_l.3
 MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3
 MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3
 MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3

Modified: head/lib/libc/stdlib/strfmon.3
==
--- head/lib/libc/stdlib/strfmon.3  Mon Jun 25 21:33:45 2012
(r237572)
+++ head/lib/libc/stdlib/strfmon.3  Mon Jun 25 21:51:40 2012
(r237573)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 12, 2002
+.Dd June 25, 2012
 .Dt STRFMON 3
 .Os
 .Sh NAME
@@ -36,6 +36,8 @@
 .In monetary.h
 .Ft ssize_t
 .Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict 
format" "..."
+.Ft ssize_t
+.Fn strfmon_l "char * restrict s" "size_t maxsize" "locale_t loc" "const char 
* restrict format" "..."
 .Sh DESCRIPTION
 The
 .Fn strfmon
@@ -47,6 +49,12 @@ No more than
 .Fa maxsize
 bytes are placed into the array.
 .Pp
+The
+.Fn strfmon_l
+function does the same as
+.Fn strfmon
+but takes an explicit locale rather than using the current locale. 
+.Pp
 The format string is composed of zero or more directives:
 ordinary characters (not
 .Cm % ) ,
@@ -129,6 +137,11 @@ the contents of the array are indetermin
 and
 .Va errno
 is set to indicate the error.
+.Pp
+The
+.Fn strfmon_l
+function returns the same values as
+.Fn strfmon .
 .Sh ERRORS
 The
 .Fn strfmon
@@ -149,6 +162,10 @@ The
 function
 conforms to
 .St -p1003.1-2001 .
+The
+.Fn strfmon_l
+function conforms to
+.St -p1003.1-2008 .
 .Sh AUTHORS
 .An -nosplit
 The

Modified: head/lib/libc/stdtime/Makefile.inc
==
--- head/lib/libc/stdtime/Makefile.inc  Mon Jun 25 21:33:45 2012
(r237572)
+++ head/lib/libc/stdtime/Makefile.inc  Mon Jun 25 21:51:40 2012
(r237573)
@@ -18,4 +18,6 @@ MLINKS+=ctime.3 asctime.3 ctime.3 diffti
ctime.3 localtime.3 ctime.3 mktime.3 ctime.3 timegm.3 \
ctime.3 ctime_r.3 ctime.3 localtime_r.3 ctime.3 gmtime_r.3 \
ctime.3 asctime_r.3
+MLINKS+=strftime.3 strftime_l.3
+MLINKS+=strptime.3 strptime_l.3
 MLINKS+=time2posix.3 posix2time.3

Modified: head/lib/libc/stdtime/strftime.3
==
--- head/lib/libc/stdtime/strftime.3Mon Jun 25 21:33:45 2012
(r237572)
+++ head/lib/libc/stdtime/strftime.3Mon Jun 25 21:51:40 2012
(r237573)
@@ -32,7 +32,7 @@
 .\" @(#)strftime.3 8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd November 4, 2004
+.Dd June 25, 2012
 .Dt STRFTIME 3
 .Os
 .Sh NAME
@@ -49,6 +49,8 @@
 .Fa "const char * restrict format"
 .Fa "const struct tm * restrict timeptr"
 .Fc
+.Ft size_t
+.Fn strftime_l "char *restrict buf" "size_t maxsize" "const char * restrict 
format" "const struct tm *restrict timeptr" "locale_t loc"
 .Sh DESCRIPTION
 The
 .Fn strftime
@@ -58,6 +60,11 @@ into the buffer
 .Fa buf
 according to the string pointed to by
 .Fa format .
+The function
+.Fn strftime_l
+does the same as
+.Fn strftime
+but takes an explicit locale rather than using the current locale.
 .Pp
 The
 .Fa format
@@ -268,6 +275,10 @@ The peculiar week number and year in the
 and
 .Ql \&%V
 are defined in ISO 8601: 1988.
+The
+.Fn strftime_l
+function conforms to
+.St -p1003.1-2008 .
 .Sh BUGS
 There is no conversion specification for the phase of the moon.
 .Pp

Modified: head/lib/libc/stdtime/strptime.3
==
--- head/lib/libc/stdtime/strptime.3Mon Jun 25 21:33:45 2012
(r237572)
+++ head/lib/libc/stdtime/strptime.3Mon Jun 25 21:51:40 2012
(r237573)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\" "
-.Dd January 4, 2003
+.Dd June 25, 2012
 .Dt STRPTIME 3
 .Os
 .Sh NAME
@@ -41,6 +41,10 @@
 .Fa "const char * restrict format"
 .Fa "struct tm * restrict timeptr"
 .Fc
+.In time.h
+.In xlocal

svn commit: r237574 - in head: share/mk usr.sbin/crunch/crunchgen

2012-06-25 Thread David E. O'Brien
Author: obrien
Date: Mon Jun 25 21:56:36 2012
New Revision: 237574
URL: http://svn.freebsd.org/changeset/base/237574

Log:
  Ensure crunchen uses the same make binary as the rest of the build.
  
  Submitted by: Simon Gerraty 

Modified:
  head/share/mk/bsd.crunchgen.mk
  head/usr.sbin/crunch/crunchgen/crunchgen.c

Modified: head/share/mk/bsd.crunchgen.mk
==
--- head/share/mk/bsd.crunchgen.mk  Mon Jun 25 21:51:40 2012
(r237573)
+++ head/share/mk/bsd.crunchgen.mk  Mon Jun 25 21:56:36 2012
(r237574)
@@ -105,7 +105,7 @@ $(CONF): Makefile
 .MAKEFLAGS:= ${.MAKEFLAGS:N-P}
 .ORDER: $(OUTPUTS) objs
 $(OUTPUTS): $(CONF)
-   MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \
+   MAKE=${MAKE} MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \
-c $(OUTC) $(CONF)
 
 $(PROG): $(OUTPUTS) objs

Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c
==
--- head/usr.sbin/crunch/crunchgen/crunchgen.c  Mon Jun 25 21:51:40 2012
(r237573)
+++ head/usr.sbin/crunch/crunchgen/crunchgen.c  Mon Jun 25 21:56:36 2012
(r237574)
@@ -92,6 +92,7 @@ char outmkname[MAXPATHLEN], outcfname[MA
 char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN];
 char outhdrname[MAXPATHLEN] ;  /* user-supplied header for *.mk */
 char *objprefix;   /* where are the objects ? */
+char *path_make;
 int linenum = -1;
 int goterror = 0;
 
@@ -127,6 +128,10 @@ int main(int argc, char **argv)
readcache = 1;
*outmkname = *outcfname = *execfname = '\0';
 
+   path_make = getenv("MAKE");
+   if (path_make == NULL || *path_make == '\0')
+   path_make = "make";
+
p = getenv("MAKEOBJDIRPREFIX");
if (p == NULL || *p == '\0')
objprefix = "/usr/obj"; /* default */
@@ -599,7 +604,8 @@ void gen_outputs(void)
gen_output_makefile();
status("");
fprintf(stderr,
-   "Run \"make -f %s\" to build crunched binary.\n", outmkname);
+   "Run \"%s -f %s\" to build crunched binary.\n",
+   path_make, outmkname);
 }
 
 /*
@@ -720,16 +726,16 @@ void fillin_program_objs(prog_t *p, char
fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar);
 
fprintf(f, "crunchgen_objs:\n"
-   "\t@cd %s && make -f %s $(BUILDOPTS) $(%s_OPTS)",
-   p->srcdir, tempfname, p->ident);
+   "\t@cd %s && %s -f %s $(BUILDOPTS) $(%s_OPTS)",
+   p->srcdir, path_make, tempfname, p->ident);
for (s = p->buildopts; s != NULL; s = s->next)
fprintf(f, " %s", s->str);
fprintf(f, " loop\n");
 
fclose(f);
 
-   snprintf(line, MAXLINELEN, "cd %s && make -f %s -B crunchgen_objs",
-   p->srcdir, tempfname);
+   snprintf(line, MAXLINELEN, "cd %s && %s -f %s -B crunchgen_objs",
+p->srcdir, path_make, tempfname);
if ((f = popen(line, "r")) == NULL) {
warn("submake pipe");
goterror = 1;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r237573 - in head/lib/libc: stdlib stdtime

2012-06-25 Thread Isabell Long
On Mon, Jun 25, 2012 at 09:51:40PM +, Isabell Long wrote:
> Author: issyl0 (doc committer)
> Date: Mon Jun 25 21:51:40 2012
> New Revision: 237573
> URL: http://svn.freebsd.org/changeset/base/237573
> 
> Log:
>   Add more locale-specific functions to the relevant man pages and
>   Makefiles:
>   - libc/stdtime/strftime.3
>   - libc/stdtime/strptime.3
>   - libc/stdlib/strfmon.3

I forgot to add the MFC time!  5 days.  :-)
___
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: r237581 - head/share/man/man5

2012-06-25 Thread Benjamin Kaduk
Author: bjk (doc committer)
Date: Mon Jun 25 22:39:37 2012
New Revision: 237581
URL: http://svn.freebsd.org/changeset/base/237581

Log:
  Explicitly mention that setting the change and expiry times to zero is
  equivalent to leaving the time unset. [1]
  
  Wordsmith in the compat support section.
  
  Use a full path to nologin(8) in the context of setting it as a user's shell,
  keeping a separate cross-reference.
  
  PR:   docs/169354 [1]
  Approved by:  hrs (mentor)
  MFC after:3 weeks

Modified:
  head/share/man/man5/passwd.5

Modified: head/share/man/man5/passwd.5
==
--- head/share/man/man5/passwd.5Mon Jun 25 22:22:39 2012
(r237580)
+++ head/share/man/man5/passwd.5Mon Jun 25 22:39:37 2012
(r237581)
@@ -35,7 +35,7 @@
 .\" From: @(#)passwd.5 8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd May 8, 2007
+.Dd June 23, 2012
 .Dt PASSWD 5
 .Os
 .Sh NAME
@@ -203,7 +203,8 @@ field is the number of seconds from the 
 .Dv UTC ,
 until the
 password for the account must be changed.
-This field may be left empty to turn off the password aging feature.
+This field may be left empty to turn off the password aging feature;
+a value of zero is equivalent to leaving the field empty.
 .Pp
 The
 .Ar expire
@@ -211,7 +212,8 @@ field is the number of seconds from the 
 .Dv UTC ,
 until the
 account expires.
-This field may be left empty to turn off the account aging feature.
+This field may be left empty to turn off the account aging feature;
+a value of zero is equivalent to leaving the field empty.
 .Pp
 The
 .Ar gecos
@@ -271,7 +273,8 @@ as it is done for system accounts,
 is to set its
 .Ar shell
 to
-.Xr nologin 8 .
+.Pa /sbin/nologin
+.Pq see Xr nologin 8 .
 .Sh HESIOD SUPPORT
 If
 .Sq Li dns
@@ -363,7 +366,7 @@ fields, the specified numbers will overr
 from the Hesiod domain or the
 .Tn NIS
 maps.
-As well, if the
+Likewise, if the
 .Ar gecos ,
 .Ar dir
 or
@@ -399,7 +402,8 @@ The additional fields
 .Ar change
 and
 .Ar expire
-are added, but are turned off by default.
+are added, but are turned off by default
+.Pq setting these fields to zero is equivalent to leaving them blank .
 Class is currently not implemented, but change and expire are; to set them,
 use the current day in seconds from the epoch + whatever number of seconds
 of offset you want.
___
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: r237581 - head/share/man/man5

2012-06-25 Thread Benjamin Kaduk

On Mon, 25 Jun 2012, Benjamin Kaduk wrote:


Author: bjk (doc committer)
Date: Mon Jun 25 22:39:37 2012
New Revision: 237581
URL: http://svn.freebsd.org/changeset/base/237581

Log:
 Explicitly mention that setting the change and expiry times to zero is
 equivalent to leaving the time unset. [1]

 Wordsmith in the compat support section.

 Use a full path to nologin(8) in the context of setting it as a user's shell,
 keeping a separate cross-reference.

 PR:docs/169354 [1]
 Approved by:   hrs (mentor)
 MFC after: 3 weeks


Due to popular request, I am dropping the MFC timer to 5 days.

-Ben
___
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: r237587 - head/sys/dev/cxgbe

2012-06-25 Thread Navdeep Parhar
Author: np
Date: Tue Jun 26 00:34:34 2012
New Revision: 237587
URL: http://svn.freebsd.org/changeset/base/237587

Log:
  Allow cxgbe(4) running within a VM to attach to its devices that have been
  exported via PCI passthrough.
  
  - Do not check for a specific physical function (PF) before claiming a device.
Different PFs have different device-ids so this check is redundant anyway.
  
  - Obtain the PF# from the WHOAMI register instead of pci_get_function().
  
  - Setup the memory windows using the real BAR0 address, not what the VM says 
it
is.
  
  Obtained from:Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cMon Jun 25 23:40:58 2012
(r237586)
+++ head/sys/dev/cxgbe/t4_main.cTue Jun 26 00:34:34 2012
(r237587)
@@ -355,21 +355,20 @@ static int t4_mod_event(module_t, int, v
 
 struct t4_pciids {
uint16_t device;
-   uint8_t mpf;
char *desc;
 } t4_pciids[] = {
-   {0xa000, 0, "Chelsio Terminator 4 FPGA"},
-   {0x4400, 4, "Chelsio T440-dbg"},
-   {0x4401, 4, "Chelsio T420-CR"},
-   {0x4402, 4, "Chelsio T422-CR"},
-   {0x4403, 4, "Chelsio T440-CR"},
-   {0x4404, 4, "Chelsio T420-BCH"},
-   {0x4405, 4, "Chelsio T440-BCH"},
-   {0x4406, 4, "Chelsio T440-CH"},
-   {0x4407, 4, "Chelsio T420-SO"},
-   {0x4408, 4, "Chelsio T420-CX"},
-   {0x4409, 4, "Chelsio T420-BT"},
-   {0x440a, 4, "Chelsio T404-BT"},
+   {0xa000, "Chelsio Terminator 4 FPGA"},
+   {0x4400, "Chelsio T440-dbg"},
+   {0x4401, "Chelsio T420-CR"},
+   {0x4402, "Chelsio T422-CR"},
+   {0x4403, "Chelsio T440-CR"},
+   {0x4404, "Chelsio T420-BCH"},
+   {0x4405, "Chelsio T440-BCH"},
+   {0x4406, "Chelsio T440-CH"},
+   {0x4407, "Chelsio T420-SO"},
+   {0x4408, "Chelsio T420-CX"},
+   {0x4409, "Chelsio T420-BT"},
+   {0x440a, "Chelsio T404-BT"},
 };
 
 #ifdef TCP_OFFLOAD
@@ -387,13 +386,17 @@ t4_probe(device_t dev)
int i;
uint16_t v = pci_get_vendor(dev);
uint16_t d = pci_get_device(dev);
+   uint8_t f = pci_get_function(dev);
 
if (v != PCI_VENDOR_ID_CHELSIO)
return (ENXIO);
 
+   /* Attach only to PF0 of the FPGA */
+   if (d == 0xa000 && f != 0)
+   return (ENXIO);
+
for (i = 0; i < ARRAY_SIZE(t4_pciids); i++) {
-   if (d == t4_pciids[i].device &&
-   pci_get_function(dev) == t4_pciids[i].mpf) {
+   if (d == t4_pciids[i].device) {
device_set_desc(dev, t4_pciids[i].desc);
return (BUS_PROBE_DEFAULT);
}
@@ -415,8 +418,6 @@ t4_attach(device_t dev)
 
sc = device_get_softc(dev);
sc->dev = dev;
-   sc->pf = pci_get_function(dev);
-   sc->mbox = sc->pf;
 
pci_enable_busmaster(dev);
if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) {
@@ -443,6 +444,15 @@ t4_attach(device_t dev)
if (rc != 0)
goto done; /* error message displayed already */
 
+   /*
+* This is the real PF# to which we're attaching.  Works from within PCI
+* passthrough environments too, where pci_get_function() could return a
+* different PF# depending on the passthrough configuration.  We need to
+* use the real PF# in all our communication with the firmware.
+*/
+   sc->pf = G_SOURCEPF(t4_read_reg(sc, A_PL_WHOAMI));
+   sc->mbox = sc->pf;
+
memset(sc->chan_map, 0xff, sizeof(sc->chan_map));
sc->an_handler = an_not_handled;
for (i = 0; i < ARRAY_SIZE(sc->cpl_handler); i++)
@@ -1277,9 +1287,17 @@ map_bars(struct adapter *sc)
 static void
 setup_memwin(struct adapter *sc)
 {
-   u_long bar0;
+   uint32_t bar0;
 
-   bar0 = rman_get_start(sc->regs_res);
+   /*
+* Read low 32b of bar0 indirectly via the hardware backdoor mechanism.
+* Works from within PCI passthrough environments too, where
+* rman_get_start() can return a different value.  We need to program
+* the memory window decoders with the actual addresses that will be
+* coming across the PCIe link.
+*/
+   bar0 = t4_hw_pci_read_cfg4(sc, PCIR_BAR(0));
+   bar0 &= (uint32_t) PCIM_BAR_MEM_BASE;
 
t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, 0),
 (bar0 + MEMWIN0_BASE) | V_BIR(0) |
@@ -1292,6 +1310,9 @@ setup_memwin(struct adapter *sc)
t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, 2),
 (bar0 + MEMWIN2_BASE) | V_BIR(0) |
 V_WINDOW(ilog2(MEMWIN2_APERTURE) - 10));
+
+   /* flush */
+   t4_read_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, 2));
 }
 
 static int
_

svn commit: r237591 - head/lib/libc/stdlib

2012-06-25 Thread Joel Dahl
Author: joel (doc committer)
Date: Tue Jun 26 05:34:31 2012
New Revision: 237591
URL: http://svn.freebsd.org/changeset/base/237591

Log:
  Remove end of line whitespace.

Modified:
  head/lib/libc/stdlib/strfmon.3

Modified: head/lib/libc/stdlib/strfmon.3
==
--- head/lib/libc/stdlib/strfmon.3  Tue Jun 26 03:05:42 2012
(r237590)
+++ head/lib/libc/stdlib/strfmon.3  Tue Jun 26 05:34:31 2012
(r237591)
@@ -53,7 +53,7 @@ The
 .Fn strfmon_l
 function does the same as
 .Fn strfmon
-but takes an explicit locale rather than using the current locale. 
+but takes an explicit locale rather than using the current locale.
 .Pp
 The format string is composed of zero or more directives:
 ordinary characters (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"


svn commit: r237592 - head/sys/amd64/amd64

2012-06-25 Thread Alan Cox
Author: alc
Date: Tue Jun 26 06:02:43 2012
New Revision: 237592
URL: http://svn.freebsd.org/changeset/base/237592

Log:
  Add PV list locking to pmap_enter().  Its execution is no longer serialized
  by the pvh global lock.
  
  Add a needed atomic operation to pmap_object_init_pt().

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Tue Jun 26 05:34:31 2012(r237591)
+++ head/sys/amd64/amd64/pmap.c Tue Jun 26 06:02:43 2012(r237592)
@@ -264,7 +264,8 @@ static void pmap_pv_demote_pde(pmap_t pm
struct rwlock **lockp);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
struct rwlock **lockp);
-static voidpmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
+static voidpmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
+   struct rwlock **lockp);
 static voidpmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va);
 static pv_entry_t pmap_pvh_remove(struct md_page *pvh, pmap_t pmap,
vm_offset_t va);
@@ -287,7 +288,8 @@ static boolean_t pmap_is_referenced_pvh(
 static void pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mode);
 static vm_page_t pmap_lookup_pt_page(pmap_t pmap, vm_offset_t va);
 static void pmap_pde_attr(pd_entry_t *pde, int cache_bits);
-static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va);
+static void pmap_promote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
+struct rwlock **lockp);
 static boolean_t pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t 
sva,
 vm_prot_t prot);
 static void pmap_pte_attr(pt_entry_t *pte, int cache_bits);
@@ -305,10 +307,13 @@ static void pmap_update_pde(pmap_t pmap,
 pd_entry_t newpde);
 static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde);
 
-static vm_page_t pmap_allocpde(pmap_t pmap, vm_offset_t va, int flags);
-static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags);
+static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex,
+   struct rwlock **lockp);
+static vm_page_t pmap_allocpde(pmap_t pmap, vm_offset_t va,
+   struct rwlock **lockp);
+static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va,
+   struct rwlock **lockp);
 
-static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags);
 static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
 vm_page_t* free);
 static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, vm_page_t *);
@@ -1686,8 +1691,10 @@ pmap_pinit(pmap_t pmap)
 }
 
 /*
- * this routine is called if the page table page is not
- * mapped correctly.
+ * This routine is called if the desired page table page does not exist.
+ *
+ * If page table page allocation fails, this routine may sleep before
+ * returning NULL.  It sleeps only if a lock pointer was given.
  *
  * Note: If a page allocation fails at page table level two or three,
  * one or two pages may be held during the wait, only to be released
@@ -1695,25 +1702,26 @@ pmap_pinit(pmap_t pmap)
  * race conditions.
  */
 static vm_page_t
-_pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
+_pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp)
 {
vm_page_t m, pdppg, pdpg;
 
-   KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT ||
-   (flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK,
-   ("_pmap_allocpte: flags is neither M_NOWAIT nor M_WAITOK"));
-
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+
/*
 * Allocate a page table page.
 */
if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ |
VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) {
-   if (flags & M_WAITOK) {
+   if (lockp != NULL) {
+   if (*lockp != NULL) {
+   rw_wunlock(*lockp);
+   *lockp = NULL;
+   }
PMAP_UNLOCK(pmap);
-   rw_wunlock(&pvh_global_lock);
+   rw_runlock(&pvh_global_lock);
VM_WAIT;
-   rw_wlock(&pvh_global_lock);
+   rw_rlock(&pvh_global_lock);
PMAP_LOCK(pmap);
}
 
@@ -1754,7 +1762,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
if ((*pml4 & PG_V) == 0) {
/* Have to allocate a new pdp, recurse */
if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index,
-   flags) == NULL) {
+   lockp) == NULL) {
--m->wire_count;
atomic_subtract_int(&cnt.v_wire_count, 1);
vm_pag