svn commit: r213244 - stable/7/sys/dev/sym

2010-09-27 Thread Mike Silbersack
Author: silby
Date: Tue Sep 28 06:08:43 2010
New Revision: 213244
URL: http://svn.freebsd.org/changeset/base/213244

Log:
  MFC rev 198719:  Fix sym driver for 64-bit platforms with > 4GB of ram.

Modified:
  stable/7/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/sym/sym_hipd.c
==
--- stable/7/sys/dev/sym/sym_hipd.c Tue Sep 28 05:57:50 2010
(r213243)
+++ stable/7/sys/dev/sym/sym_hipd.c Tue Sep 28 06:08:43 2010
(r213244)
@@ -8587,7 +8587,7 @@ sym_pci_attach(device_t dev)
 *  Allocate a tag for the DMA of user data.
 */
if (bus_dma_tag_create(np->bus_dmat, 1, (1<<24),
-   BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
+   BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR,
NULL, NULL,
BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG,
(1<<24), 0, busdma_lock_mutex, &np->mtx,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r197244 - in head: sys/netinet usr.bin/netstat

2009-09-15 Thread Mike Silbersack
Author: silby
Date: Wed Sep 16 05:33:15 2009
New Revision: 197244
URL: http://svn.freebsd.org/changeset/base/197244

Log:
  Add the ability to see TCP timers via netstat -x.  This can be a useful
  feature when you have a seemingly stuck socket and want to figure
  out why it has not been closed yet.
  
  No plans to MFC this, as it changes the netstat sysctl ABI.
  
  Reviewed by:  andre, rwatson, Eric Van Gyzen

Modified:
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h
  head/sys/netinet/tcp_var.h
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/netstat.1

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Wed Sep 16 03:49:54 2009(r197243)
+++ head/sys/netinet/tcp_subr.c Wed Sep 16 05:33:15 2009(r197244)
@@ -1151,8 +1151,11 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
else if (inp->inp_flags & INP_TIMEWAIT) {
bzero((char *) &xt.xt_tp, sizeof xt.xt_tp);
xt.xt_tp.t_state = TCPS_TIME_WAIT;
-   } else
+   } else {
bcopy(inp_ppcb, &xt.xt_tp, sizeof xt.xt_tp);
+   if (xt.xt_tp.t_timers)
+   tcp_timer_to_xtimer(&xt.xt_tp, 
xt.xt_tp.t_timers, &xt.xt_timer);
+   }
if (inp->inp_socket != NULL)
sotoxsocket(inp->inp_socket, &xt.xt_socket);
else {

Modified: head/sys/netinet/tcp_timer.c
==
--- head/sys/netinet/tcp_timer.cWed Sep 16 03:49:54 2009
(r197243)
+++ head/sys/netinet/tcp_timer.cWed Sep 16 05:33:15 2009
(r197244)
@@ -659,3 +659,24 @@ tcp_timer_active(struct tcpcb *tp, int t
}
return callout_active(t_callout);
 }
+
+#defineticks_to_msecs(t)   (1000*(t) / hz)
+
+void
+tcp_timer_to_xtimer(struct tcpcb *tp, struct tcp_timer *timer, struct 
xtcp_timer *xtimer)
+{
+   bzero(xtimer, sizeof(struct xtcp_timer));
+   if (timer == NULL)
+   return;
+   if (callout_active(&timer->tt_delack))
+   xtimer->tt_delack = ticks_to_msecs(timer->tt_delack.c_time - 
ticks);
+   if (callout_active(&timer->tt_rexmt))
+   xtimer->tt_rexmt = ticks_to_msecs(timer->tt_rexmt.c_time - 
ticks);
+   if (callout_active(&timer->tt_persist))
+   xtimer->tt_persist = ticks_to_msecs(timer->tt_persist.c_time - 
ticks);
+   if (callout_active(&timer->tt_keep))
+   xtimer->tt_keep = ticks_to_msecs(timer->tt_keep.c_time - ticks);
+   if (callout_active(&timer->tt_2msl))
+   xtimer->tt_2msl = ticks_to_msecs(timer->tt_2msl.c_time - ticks);
+   xtimer->t_rcvtime = ticks_to_msecs(ticks - tp->t_rcvtime);
+}

Modified: head/sys/netinet/tcp_timer.h
==
--- head/sys/netinet/tcp_timer.hWed Sep 16 03:49:54 2009
(r197243)
+++ head/sys/netinet/tcp_timer.hWed Sep 16 05:33:15 2009
(r197244)
@@ -141,6 +141,8 @@ static const char *tcptimers[] =
 
 #ifdef _KERNEL
 
+struct xtcp_timer;
+
 struct tcp_timer {
struct  callout tt_rexmt;   /* retransmit timer */
struct  callout tt_persist; /* retransmit persistence */
@@ -177,6 +179,8 @@ voidtcp_timer_keep(void *xtp);
 void   tcp_timer_persist(void *xtp);
 void   tcp_timer_rexmt(void *xtp);
 void   tcp_timer_delack(void *xtp);
+void   tcp_timer_to_xtimer(struct tcpcb *tp, struct tcp_timer *timer,
+   struct xtcp_timer *xtimer);
 
 #endif /* _KERNEL */
 

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Wed Sep 16 03:49:54 2009(r197243)
+++ head/sys/netinet/tcp_var.h  Wed Sep 16 05:33:15 2009(r197244)
@@ -495,11 +495,20 @@ void  kmod_tcpstat_inc(int statnum);
  * included.  Not all of our clients do.
  */
 #if defined(_NETINET_IN_PCB_H_) && defined(_SYS_SOCKETVAR_H_)
+struct xtcp_timer {
+   int tt_rexmt;   /* retransmit timer */
+   int tt_persist; /* retransmit persistence */
+   int tt_keep;/* keepalive */
+   int tt_2msl;/* 2*msl TIME_WAIT timer */
+   int tt_delack;  /* delayed ACK timer */
+   int t_rcvtime;  /* Time since last packet received */
+};
 struct xtcpcb {
size_t  xt_len;
struct  inpcb   xt_inp;
struct  tcpcb   xt_tp;
struct  xsocket xt_socket;
+   struct  xtcp_timer xt_timer;
u_quad_txt_alignment_hack;
 };
 #endif

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/

svn commit: r197425 - head/usr.bin/netstat

2009-09-22 Thread Mike Silbersack
Author: silby
Date: Wed Sep 23 05:32:33 2009
New Revision: 197425
URL: http://svn.freebsd.org/changeset/base/197425

Log:
  In netstat -x, do not try to print out tcp timer status for udp sockets.

Modified:
  head/usr.bin/netstat/inet.c

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Wed Sep 23 02:45:02 2009(r197424)
+++ head/usr.bin/netstat/inet.c Wed Sep 23 05:32:33 2009(r197425)
@@ -355,6 +355,7 @@ protopr(u_long off, const char *name, in
} else {
inp = &((struct xinpcb *)xig)->xi_inp;
so = &((struct xinpcb *)xig)->xi_socket;
+   timer = NULL;
}
 
/* Ignore sockets for protocols other than the desired one. */
@@ -425,7 +426,7 @@ protopr(u_long off, const char *name, in
printf("%7.7s %7.7s %7.7s %7.7s %7.7s 
%7.7s %s\n",
"rexmt", "persist", "keep",
"2msl", "delack", "rcvtime",
-   "(state)");
+   "(state)");
} else
printf("(state)\n");
}
@@ -529,13 +530,14 @@ protopr(u_long off, const char *name, in
   so->so_rcv.sb_lowat, so->so_snd.sb_lowat,
   so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt,
   so->so_rcv.sb_mbmax, 
so->so_snd.sb_mbmax);
-   printf("%4d.%02d %4d.%02d %4d.%02d %4d.%02d 
%4d.%02d %4d.%02d ",
-   timer->tt_rexmt / 1000, 
(timer->tt_rexmt % 1000) / 10,
-   timer->tt_persist / 1000, 
(timer->tt_persist % 1000) / 10,
-   timer->tt_keep / 1000, (timer->tt_keep 
% 1000) / 10,
-   timer->tt_2msl / 1000, (timer->tt_2msl 
% 1000) / 10,
-   timer->tt_delack / 1000, 
(timer->tt_delack % 1000) / 10,
-   timer->t_rcvtime / 1000, 
(timer->t_rcvtime % 1000) / 10);
+   if (timer != NULL)
+   printf("%4d.%02d %4d.%02d %4d.%02d 
%4d.%02d %4d.%02d %4d.%02d ",
+   timer->tt_rexmt / 1000, 
(timer->tt_rexmt % 1000) / 10,
+   timer->tt_persist / 1000, 
(timer->tt_persist % 1000) / 10,
+   timer->tt_keep / 1000, 
(timer->tt_keep % 1000) / 10,
+   timer->tt_2msl / 1000, 
(timer->tt_2msl % 1000) / 10,
+   timer->tt_delack / 1000, 
(timer->tt_delack % 1000) / 10,
+   timer->t_rcvtime / 1000, 
(timer->t_rcvtime % 1000) / 10);
}
}
if (istcp && !Lflag) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r225069 - head/sys/x86/x86

2011-08-21 Thread Mike Silbersack
Author: silby
Date: Mon Aug 22 03:10:29 2011
New Revision: 225069
URL: http://svn.freebsd.org/changeset/base/225069

Log:
  Disable TSC usage inside SMP VM environments.  On my VMware ESXi 4.1
  environment with a core i5-2500K, operation in this mode causes timeouts
  from the mpt driver.  Switching to the ACPI-fast timer resolves this issue.
  Switching the VM back to single CPU mode also works, which is why I have
  not disabled the TSC in that mode.
  
  I did not test with KVM or other VM environments, but I am being cautious
  and assuming that the TSC is not reliable in SMP mode there as well.
  
  Reviewed by:  kib
  Approved by:  re (kib)
  MFC after:Not applicable, the timecounter code is new for 9.x

Modified:
  head/sys/x86/x86/tsc.c

Modified: head/sys/x86/x86/tsc.c
==
--- head/sys/x86/x86/tsc.c  Sun Aug 21 22:09:30 2011(r225068)
+++ head/sys/x86/x86/tsc.c  Mon Aug 22 03:10:29 2011(r225069)
@@ -464,11 +464,16 @@ init_TSC_tc(void)
 * synchronized.  If the user is sure that the system has synchronized
 * TSCs, set kern.timecounter.smp_tsc tunable to a non-zero value.
 * We also limit the frequency even lower to avoid "temporal anomalies"
-* as much as possible.
+* as much as possible.  The TSC seems unreliable in virtualized SMP
+* environments, so it is set to a negative quality in those cases.
 */
if (smp_cpus > 1) {
-   tsc_timecounter.tc_quality = test_smp_tsc();
-   max_freq >>= 8;
+   if (vm_guest != 0) {
+   tsc_timecounter.tc_quality = -100;
+   } else {
+   tsc_timecounter.tc_quality = test_smp_tsc();
+   max_freq >>= 8;
+   }
} else
 #endif
if (tsc_is_invariant)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r221346 - head/sys/netinet

2011-06-11 Thread Mike Silbersack


On Fri, 3 Jun 2011, John Baldwin wrote:


On Saturday, May 14, 2011 1:07:18 pm Mikolaj Golub wrote:


On Sat, 14 May 2011 10:37:51 -0400 John Baldwin wrote:

 JB> Can you capture a tcpdump (probably easiest to do from the other host)?

I replaced the asserts with log statements to make the host not panic and the
captured dump survive.


Please try this change.  What is happening is that you have a remaining
window that is smaller than the window scale.  You are receiving zero
window updates that are received ok (becuase the socket buffer isn't
completely empty), and that advance rcv_nxt.  However, tcp_output() is
not advancing rcv_adv because 'recwin' is calculated as zero.  My
invariants had assumed that the ACK that gets forced out for a reply
to a zero window probe would move rcv_adv, but that isn't happening.
This patch will allow rcv_adv to advance when a zero window probe is
ACK'd.  I'm not sure if this is the best way to fix this, but I think
it will fix it:

Index: tcp_output.c
===
--- tcp_output.c(revision 222565)
+++ tcp_output.c(working copy)
@@ -1331,7 +1331,7 @@ out:
 * then remember the size of the advertised window.
 * Any pending ACK has now been sent.
 */
-   if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv))
+   if (recwin >= 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv))
tp->rcv_adv = tp->rcv_nxt + recwin;
tp->last_ack_sent = tp->rcv_nxt;
tp->t_flags &= ~(TF_ACKNOW | TF_DELACK);


--
John Baldwin


This change looks ok to me.  I can't think of a better way to solve the 
problem, and I don't see it causing any major change in behavior.


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


Re: svn commit: r221346 - head/sys/netinet

2011-06-03 Thread Mike Silbersack


I'm heading out of town this weekend.  I can try to look at this on 
Tuesday, if nobody beats me to it.


-Mike

On Fri, 3 Jun 2011, John Baldwin wrote:


On Saturday, May 14, 2011 1:07:18 pm Mikolaj Golub wrote:


On Sat, 14 May 2011 10:37:51 -0400 John Baldwin wrote:

 JB> Can you capture a tcpdump (probably easiest to do from the other host)?

I replaced the asserts with log statements to make the host not panic and the
captured dump survive.


Please try this change.  What is happening is that you have a remaining
window that is smaller than the window scale.  You are receiving zero
window updates that are received ok (becuase the socket buffer isn't
completely empty), and that advance rcv_nxt.  However, tcp_output() is
not advancing rcv_adv because 'recwin' is calculated as zero.  My
invariants had assumed that the ACK that gets forced out for a reply
to a zero window probe would move rcv_adv, but that isn't happening.
This patch will allow rcv_adv to advance when a zero window probe is
ACK'd.  I'm not sure if this is the best way to fix this, but I think
it will fix it:

Index: tcp_output.c
===
--- tcp_output.c(revision 222565)
+++ tcp_output.c(working copy)
@@ -1331,7 +1331,7 @@ out:
 * then remember the size of the advertised window.
 * Any pending ACK has now been sent.
 */
-   if (recwin > 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv))
+   if (recwin >= 0 && SEQ_GT(tp->rcv_nxt + recwin, tp->rcv_adv))
tp->rcv_adv = tp->rcv_nxt + recwin;
tp->last_ack_sent = tp->rcv_nxt;
tp->t_flags &= ~(TF_ACKNOW | TF_DELACK);


--
John Baldwin


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


svn commit: r190299 - stable/7/sys/kern

2009-03-22 Thread Mike Silbersack
Author: silby
Date: Sun Mar 22 23:00:00 2009
New Revision: 190299
URL: http://svn.freebsd.org/changeset/base/190299

Log:
  Fix unp_gc so that it recognizes file descriptors
  that are currently in the process of being passed
  between processes as alive and does not
  try to garbage collect them.
  
  The full description of the problem and a test
  program to reproduce it can be found in PR 112554.
  
  This fix was inspired by similar fixes in NetBSD and BSD/OS.
  However, it does not apply to FreeBSD 8 and above -
  when this code was rewritten and optimized, the bug
  was fixed in a different way.  The test program in the
  PR passes on 8-current with flying colors.
  
  PR:   112554
  Submitted by: Spencer Minear
  Reviewed by:  Mike Silbersack
  Obtained from:Secure Computing Corp
  MFC after:4 weeks

Modified:
  stable/7/sys/kern/uipc_usrreq.c

Modified: stable/7/sys/kern/uipc_usrreq.c
==
--- stable/7/sys/kern/uipc_usrreq.c Sun Mar 22 22:57:53 2009
(r190298)
+++ stable/7/sys/kern/uipc_usrreq.c Sun Mar 22 23:00:00 2009
(r190299)
@@ -1878,6 +1878,7 @@ unp_gc(__unused void *arg, int pending)
 {
struct file *fp, *nextfp;
struct socket *so;
+   struct socket *soa;
struct file **extra_ref, **fpp;
int nunref, i;
int nfiles_snap;
@@ -1984,6 +1985,20 @@ unp_gc(__unused void *arg, int pending)
SOCKBUF_UNLOCK(&so->so_rcv);
 
/*
+* If socket is in listening state, then sockets
+* in its accept queue are accessible, and so
+* are any descriptors in those sockets' receive
+* queues.
+*/
+   ACCEPT_LOCK();
+   TAILQ_FOREACH(soa, &so->so_comp, so_list) {
+   SOCKBUF_LOCK(&soa->so_rcv);
+   unp_scan(soa->so_rcv.sb_mb, unp_mark);
+   SOCKBUF_UNLOCK(&soa->so_rcv);
+   }
+   ACCEPT_UNLOCK();
+
+   /*
 * Wake up any threads waiting in fdrop().
 */
FILE_LOCK(fp);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r190299 - stable/7/sys/kern

2009-03-22 Thread Mike Silbersack


On Sun, 22 Mar 2009, Robert Watson wrote:


On Sun, 22 Mar 2009, Mike Silbersack wrote:


 Fix unp_gc so that it recognizes file descriptors
 that are currently in the process of being passed
 between processes as alive and does not
 try to garbage collect them.

 The full description of the problem and a test
 program to reproduce it can be found in PR 112554.

 This fix was inspired by similar fixes in NetBSD and BSD/OS.
 However, it does not apply to FreeBSD 8 and above -
 when this code was rewritten and optimized, the bug
 was fixed in a different way.  The test program in the
 PR passes on 8-current with flying colors.


We have a UNIX domain socket-passing regression test that creates various 
contortion-esque situations and then looks to see if sockets were leaked.  If 
it doesn't yet capture this failure mode, could you add it to that test?


Robert N M Watson
Computer Laboratory
University of Cambridge


I've been meaning to do that for two years, that's what delayed me from 
committing this.  I finally decided to get it in before I missed another 
release.


So I can try, but I won't make any guarantees.

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


Re: svn commit: r190872 - head/sys/dev/e1000

2009-04-12 Thread Mike Silbersack


Jack, either this or some other recent change to the em driver caused it 
to stop working correctly on the e1000 virtual device inside VMware ESX. 
Unfortunately, I have not updated my 8.x VMs recently, so I don't know 
when this broke.


I got the message about an invalid MAC address.  I modified 
em_is_valid_ether_addr to always return True, but it looks like the effect 
of that was to cause the driver to load, but give the NIC a MAC of 
00:00:00:00:00:00.  However, if I manually set a MAC after that, the 
virtual NIC IS functional.  So I think the sole problem may just be that 
the code which reads the MAC is incompatible with the ESX emulation.


Do you want me to try a kernel from immediately before this change to 
confirm that this was the cause of the problem?


Mike "Silby" Silbersack

On Fri, 10 Apr 2009, Jack F Vogel wrote:


Author: jfv
Date: Fri Apr 10 00:05:46 2009
New Revision: 190872
URL: http://svn.freebsd.org/changeset/base/190872

Log:
 This delta syncs the em and igb drivers with Intel,
 adds header split and SCTP support into the igb driver.
 Various small improvements and fixes.


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


Re: svn commit: r190872 - head/sys/dev/e1000

2009-04-12 Thread Mike Silbersack


To followup, I csup'd to this date:
date=2009.04.08.00.00.00

and the resulting kernel works perfectly with the ESX virtual e1000.

What can I do to help debug this problem?

Mike "Silby" Silbersack

On Mon, 13 Apr 2009, Mike Silbersack wrote:



Jack, either this or some other recent change to the em driver caused it to 
stop working correctly on the e1000 virtual device inside VMware ESX. 
Unfortunately, I have not updated my 8.x VMs recently, so I don't know when 
this broke.


I got the message about an invalid MAC address.  I modified 
em_is_valid_ether_addr to always return True, but it looks like the effect of 
that was to cause the driver to load, but give the NIC a MAC of 
00:00:00:00:00:00.  However, if I manually set a MAC after that, the virtual 
NIC IS functional.  So I think the sole problem may just be that the code 
which reads the MAC is incompatible with the ESX emulation.


Do you want me to try a kernel from immediately before this change to confirm 
that this was the cause of the problem?


Mike "Silby" Silbersack

On Fri, 10 Apr 2009, Jack F Vogel wrote:


Author: jfv
Date: Fri Apr 10 00:05:46 2009
New Revision: 190872
URL: http://svn.freebsd.org/changeset/base/190872

Log:
 This delta syncs the em and igb drivers with Intel,
 adds header split and SCTP support into the igb driver.
 Various small improvements and fixes.




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


Re: svn commit: r190872 - head/sys/dev/e1000

2009-04-13 Thread Mike Silbersack


On Sun, 12 Apr 2009, Jack Vogel wrote:


There is quite a bit of shared code changes to support alternate mac
addressing, if
you look at the diffs you'll notice in attach I inserted a reset, and then
also moved
where hardware init is called, this is because the shared code now requires
RAR(0)
to have a valid address in it when it does setup, reset causes that, but
init_hardware
will zero the RAR array out.

I have no idea what your environment is, but it sounds like it may be
related.

If you have a driver that works, you could try taking the new if_em.* and
drop
them in, see if that solves it. But right now my guess is this issue is in
the shared
code and not the core.

Let me know what you find,

Jack


Ok, I will try to help narrow it down.  I saved a working kernel (from 4 
days ago), so I can reboot with that one when I need network connectivity.


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


svn commit: r240128 - head/sys/dev/bxe

2012-09-04 Thread Mike Silbersack
Author: silby
Date: Wed Sep  5 06:51:28 2012
New Revision: 240128
URL: http://svn.freebsd.org/changeset/base/240128

Log:
  Only stop the BXE controller if it was first started.  Stopping
  an uninitialized controller can cause IPMI bus errors on some
  systems.
  
  Reviewed by:  yongari
  Obtained from:McAfee, Inc.
  MFC after:2 weeks

Modified:
  head/sys/dev/bxe/if_bxe.c

Modified: head/sys/dev/bxe/if_bxe.c
==
--- head/sys/dev/bxe/if_bxe.c   Wed Sep  5 06:15:15 2012(r240127)
+++ head/sys/dev/bxe/if_bxe.c   Wed Sep  5 06:51:28 2012(r240128)
@@ -3554,8 +3554,14 @@ bxe_shutdown(device_t dev)
sc = device_get_softc(dev);
DBENTER(BXE_INFO_LOAD | BXE_INFO_RESET | BXE_INFO_UNLOAD);
 
+   /* Stop the controller, but only if it was ever started.
+* Stopping an uninitialized controller can cause
+* IPMI bus errors on some systems.
+*/
BXE_CORE_LOCK(sc);
-   bxe_stop_locked(sc, UNLOAD_NORMAL);
+   if (sc->state != BXE_STATE_CLOSED) {
+   bxe_stop_locked(sc, UNLOAD_NORMAL);
+   }
BXE_CORE_UNLOCK(sc);
 
DBEXIT(BXE_INFO_LOAD | BXE_INFO_RESET | BXE_INFO_UNLOAD);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r186026 - head/sys/dev/acpica

2008-12-12 Thread Mike Silbersack
Author: silby
Date: Sat Dec 13 06:04:34 2008
New Revision: 186026
URL: http://svn.freebsd.org/changeset/base/186026

Log:
  Add the sysctl debug.acpi.batt.batt_sleep_ms.
  
  On some laptops with smart batteries, enabling battery monitoring
  software causes keystrokes from atkbd to be lost.  This has also been
  reported on Linux, and is apparently due to the keyboard and I2C line
  for the battery being routed through the same chip.  Whether that's
  accurate or not, adding extra sleeps to the status checking code
  causes the problem to go away.
  
  I've been running this for nearly six months now on my laptop,
  it works like a charm.
  
  Reviewed by:  Nate Lawson (in a previous revision)
  MFC after:2 weeks

Modified:
  head/sys/dev/acpica/acpi_smbat.c

Modified: head/sys/dev/acpica/acpi_smbat.c
==
--- head/sys/dev/acpica/acpi_smbat.cSat Dec 13 06:01:54 2008
(r186025)
+++ head/sys/dev/acpica/acpi_smbat.cSat Dec 13 06:04:34 2008
(r186026)
@@ -61,6 +61,23 @@ static int   acpi_smbat_get_bst(device_t d
 
 ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery");
 
+SYSCTL_DECL(_debug_acpi);
+SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, "Battery 
debugging");
+
+/* On some laptops with smart batteries, enabling battery monitoring
+ * software causes keystrokes from atkbd to be lost.  This has also been
+ * reported on Linux, and is apparently due to the keyboard and I2C line
+ * for the battery being routed through the same chip.  Whether that's
+ * accurate or not, adding extra sleeps to the status checking code
+ * causes the problem to go away.
+ *
+ * If you experience that problem, try a value of 10ms and move up
+ * from there.
+ */
+static int  batt_sleep_ms;
+SYSCTL_INT(_debug_acpi_batt, OID_AUTO, batt_sleep_ms, CTLFLAG_RW, 
&batt_sleep_ms, 0,
+"Sleep during battery status updates to prevent keystroke loss.");
+
 static device_method_t acpi_smbat_methods[] = {
/* device interface */
DEVMETHOD(device_probe, acpi_smbat_probe),
@@ -176,6 +193,9 @@ acpi_smbus_read_2(struct acpi_smbat_soft
 
ACPI_SERIAL_ASSERT(smbat);
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
val = addr;
error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR,
val, 1);
@@ -194,6 +214,9 @@ acpi_smbus_read_2(struct acpi_smbat_soft
if (error)
goto out;
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
for (to = SMBUS_TIMEOUT; to != 0; to--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL,
&val, 1);
@@ -239,6 +262,9 @@ acpi_smbus_read_multi_1(struct acpi_smba
 
ACPI_SERIAL_ASSERT(smbat);
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
val = addr;
error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR,
val, 1);
@@ -257,6 +283,9 @@ acpi_smbus_read_multi_1(struct acpi_smba
if (error)
goto out;
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
for (to = SMBUS_TIMEOUT; to != 0; to--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL,
&val, 1);
@@ -292,6 +321,9 @@ acpi_smbus_read_multi_1(struct acpi_smba
if (len > val)
len = val;
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
while (len--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_DATA
+ len, &val, 1);
@@ -299,6 +331,8 @@ acpi_smbus_read_multi_1(struct acpi_smba
goto out;
 
ptr[len] = val;
+   if (batt_sleep_ms)
+   AcpiOsSleep(1);
}
 
 out:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r186031 - head/sys/dev/acpica

2008-12-12 Thread Mike Silbersack
Author: silby
Date: Sat Dec 13 07:45:48 2008
New Revision: 186031
URL: http://svn.freebsd.org/changeset/base/186031

Log:
  Quick change to r186026.  One of the conditionals was:
  
  if (batt_sleep_ms)
AcpiOsSleep(1);
  
  where the rest are all:
  
  if (batt_sleep_ms)
AcpiOsSleep(batt_sleep_ms);
  
  I can't recall why that one was different, so change it
  to match the rest.
  
  Pointed out by:   Christoph Mallon
  MFC after:2 weeks

Modified:
  head/sys/dev/acpica/acpi_smbat.c

Modified: head/sys/dev/acpica/acpi_smbat.c
==
--- head/sys/dev/acpica/acpi_smbat.cSat Dec 13 07:23:55 2008
(r186030)
+++ head/sys/dev/acpica/acpi_smbat.cSat Dec 13 07:45:48 2008
(r186031)
@@ -332,7 +332,7 @@ acpi_smbus_read_multi_1(struct acpi_smba
 
ptr[len] = val;
if (batt_sleep_ms)
-   AcpiOsSleep(1);
+   AcpiOsSleep(batt_sleep_ms);
}
 
 out:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r187355 - in stable/7/sys: . contrib/pf dev/acpica dev/ath/ath_hal dev/cxgb

2009-01-16 Thread Mike Silbersack
Author: silby
Date: Sat Jan 17 06:53:57 2009
New Revision: 187355
URL: http://svn.freebsd.org/changeset/base/187355

Log:
  Merge r186026 - add the debug.batt.batt_sleep_ms sysctl.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpica/acpi_smbat.c
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/acpica/acpi_smbat.c
==
--- stable/7/sys/dev/acpica/acpi_smbat.cSat Jan 17 05:38:14 2009
(r187354)
+++ stable/7/sys/dev/acpica/acpi_smbat.cSat Jan 17 06:53:57 2009
(r187355)
@@ -61,6 +61,23 @@ static int   acpi_smbat_get_bst(device_t d
 
 ACPI_SERIAL_DECL(smbat, "ACPI Smart Battery");
 
+SYSCTL_DECL(_debug_acpi);
+SYSCTL_NODE(_debug_acpi, OID_AUTO, batt, CTLFLAG_RD, NULL, "Battery 
debugging");
+
+/* On some laptops with smart batteries, enabling battery monitoring
+ * software causes keystrokes from atkbd to be lost.  This has also been
+ * reported on Linux, and is apparently due to the keyboard and I2C line
+ * for the battery being routed through the same chip.  Whether that's
+ * accurate or not, adding extra sleeps to the status checking code
+ * causes the problem to go away.
+ *
+ * If you experience that problem, try a value of 10ms and move up
+ * from there.
+ */
+static int  batt_sleep_ms;
+SYSCTL_INT(_debug_acpi_batt, OID_AUTO, batt_sleep_ms, CTLFLAG_RW, 
&batt_sleep_ms, 0,
+"Sleep during battery status updates to prevent keystroke loss.");
+
 static device_method_t acpi_smbat_methods[] = {
/* device interface */
DEVMETHOD(device_probe, acpi_smbat_probe),
@@ -176,6 +193,9 @@ acpi_smbus_read_2(struct acpi_smbat_soft
 
ACPI_SERIAL_ASSERT(smbat);
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
val = addr;
error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR,
val, 1);
@@ -194,6 +214,9 @@ acpi_smbus_read_2(struct acpi_smbat_soft
if (error)
goto out;
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
for (to = SMBUS_TIMEOUT; to != 0; to--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL,
&val, 1);
@@ -239,6 +262,9 @@ acpi_smbus_read_multi_1(struct acpi_smba
 
ACPI_SERIAL_ASSERT(smbat);
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
val = addr;
error = ACPI_EC_WRITE(sc->ec_dev, sc->sb_base_addr + SMBUS_ADDR,
val, 1);
@@ -257,6 +283,9 @@ acpi_smbus_read_multi_1(struct acpi_smba
if (error)
goto out;
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
for (to = SMBUS_TIMEOUT; to != 0; to--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_PRTCL,
&val, 1);
@@ -292,6 +321,9 @@ acpi_smbus_read_multi_1(struct acpi_smba
if (len > val)
len = val;
 
+   if (batt_sleep_ms)
+   AcpiOsSleep(batt_sleep_ms);
+
while (len--) {
error = ACPI_EC_READ(sc->ec_dev, sc->sb_base_addr + SMBUS_DATA
+ len, &val, 1);
@@ -299,6 +331,8 @@ acpi_smbus_read_multi_1(struct acpi_smba
goto out;
 
ptr[len] = val;
+   if (batt_sleep_ms)
+   AcpiOsSleep(1);
}
 
 out:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r187356 - in stable/7/sys: . contrib/pf dev/acpica dev/ath/ath_hal dev/cxgb

2009-01-16 Thread Mike Silbersack
Author: silby
Date: Sat Jan 17 06:55:28 2009
New Revision: 187356
URL: http://svn.freebsd.org/changeset/base/187356

Log:
  Merge r186031 - quick change to r186026

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/acpica/acpi_smbat.c
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/acpica/acpi_smbat.c
==
--- stable/7/sys/dev/acpica/acpi_smbat.cSat Jan 17 06:53:57 2009
(r187355)
+++ stable/7/sys/dev/acpica/acpi_smbat.cSat Jan 17 06:55:28 2009
(r187356)
@@ -332,7 +332,7 @@ acpi_smbus_read_multi_1(struct acpi_smba
 
ptr[len] = val;
if (batt_sleep_ms)
-   AcpiOsSleep(1);
+   AcpiOsSleep(batt_sleep_ms);
}
 
 out:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r195430 - head/sys/kern

2009-07-07 Thread Mike Silbersack
Author: silby
Date: Wed Jul  8 01:09:12 2009
New Revision: 195430
URL: http://svn.freebsd.org/changeset/base/195430

Log:
  Increase HZ_VM from 10 to 100.  While 10 hz saves cpu time
  under VM environments, it's too slow for FreeBSD to work
  properly.  For example, ping at 10hz pings about every 600ms
  instead of about every second.
  
  Approved by:  re (kib)

Modified:
  head/sys/kern/subr_param.c

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Tue Jul  7 19:55:09 2009(r195429)
+++ head/sys/kern/subr_param.c  Wed Jul  8 01:09:12 2009(r195430)
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$");
 #defineHZ 100
 #  endif
 #  ifndef HZ_VM
-#defineHZ_VM 10
+#defineHZ_VM 100
 #  endif
 #else
 #  ifndef HZ_VM
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r266205 - head/sys/netinet

2014-05-15 Thread Mike Silbersack
Author: silby
Date: Fri May 16 01:38:38 2014
New Revision: 266205
URL: http://svnweb.freebsd.org/changeset/base/266205

Log:
  Remove the function tcp_twrecycleable; it has been #if 0'd for
  eight years.  The original concept was to improve the
  corner case where you run out of ephemeral ports, but it
  was causing performance problems and the mechanism
  of limiting the number of time_wait sockets serves
  the same purpose in the end.
  
  Reviewed by:  bz

Modified:
  head/sys/netinet/tcp_timewait.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_timewait.c
==
--- head/sys/netinet/tcp_timewait.c Fri May 16 01:30:30 2014
(r266204)
+++ head/sys/netinet/tcp_timewait.c Fri May 16 01:38:38 2014
(r266205)
@@ -357,39 +357,6 @@ tcp_twstart(struct tcpcb *tp)
INP_WUNLOCK(inp);
 }
 
-#if 0
-/*
- * The appromixate rate of ISN increase of Microsoft TCP stacks;
- * the actual rate is slightly higher due to the addition of
- * random positive increments.
- *
- * Most other new OSes use semi-randomized ISN values, so we
- * do not need to worry about them.
- */
-#defineMS_ISN_BYTES_PER_SECOND 25
-
-/*
- * Determine if the ISN we will generate has advanced beyond the last
- * sequence number used by the previous connection.  If so, indicate
- * that it is safe to recycle this tw socket by returning 1.
- */
-int
-tcp_twrecycleable(struct tcptw *tw)
-{
-   tcp_seq new_iss = tw->iss;
-   tcp_seq new_irs = tw->irs;
-
-   INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
-   new_iss += (ticks - tw->t_starttime) * (ISN_BYTES_PER_SECOND / hz);
-   new_irs += (ticks - tw->t_starttime) * (MS_ISN_BYTES_PER_SECOND / hz);
-
-   if (SEQ_GT(new_iss, tw->snd_nxt) && SEQ_GT(new_irs, tw->rcv_nxt))
-   return (1);
-   else
-   return (0);
-}
-#endif
-
 /*
  * Returns 1 if the TIME_WAIT state was killed and we should start over,
  * looking for a pcb in the listen state.  Returns 0 otherwise.

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Fri May 16 01:30:30 2014(r266204)
+++ head/sys/netinet/tcp_var.h  Fri May 16 01:38:38 2014(r266205)
@@ -635,9 +635,6 @@ struct tcpcb *
 tcp_close(struct tcpcb *);
 voidtcp_discardcb(struct tcpcb *);
 voidtcp_twstart(struct tcpcb *);
-#if 0
-int tcp_twrecycleable(struct tcptw *tw);
-#endif
 voidtcp_twclose(struct tcptw *_tw, int _reuse);
 voidtcp_ctlinput(int, struct sockaddr *, void *);
 int tcp_ctloutput(struct socket *, struct sockopt *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r329362 - head/sbin/savecore

2018-02-15 Thread Mike Silbersack
Author: silby
Date: Fri Feb 16 06:51:39 2018
New Revision: 329362
URL: https://svnweb.freebsd.org/changeset/base/329362

Log:
  Prevent savecore from reading bounds from the current directory.
  
  Rev 244218 removed the requirement that you provide a dump
  directory when checking if there is a coredump ready to be written.
  That had the side-effect of causing the bounds file to be read
  from the current working directory instead of the dump directory.
  As the bounds file is irrelevant when just checking, the simplest
  fix is to not read the bounds file when checking.
  
  Reviewed by:  markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D14383

Modified:
  head/sbin/savecore/savecore.c

Modified: head/sbin/savecore/savecore.c
==
--- head/sbin/savecore/savecore.c   Fri Feb 16 05:48:45 2018
(r329361)
+++ head/sbin/savecore/savecore.c   Fri Feb 16 06:51:39 2018
(r329362)
@@ -172,6 +172,13 @@ getbounds(void)
char buf[6];
int ret;
 
+   /*
+* If we are just checking, then we haven't done a chdir to the dump
+* directory and we should not try to read a bounds file.
+*/
+   if (checkfor)
+   return (0);
+
ret = 0;
 
if ((fp = fopen("bounds", "r")) == NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r329998 - stable/11/sbin/savecore

2018-02-25 Thread Mike Silbersack
Author: silby
Date: Mon Feb 26 02:12:09 2018
New Revision: 329998
URL: https://svnweb.freebsd.org/changeset/base/329998

Log:
  MFC r329362:
  Prevent savecore from reading bounds from the current directory.

Modified:
  stable/11/sbin/savecore/savecore.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/savecore/savecore.c
==
--- stable/11/sbin/savecore/savecore.c  Mon Feb 26 00:34:56 2018
(r329997)
+++ stable/11/sbin/savecore/savecore.c  Mon Feb 26 02:12:09 2018
(r329998)
@@ -155,6 +155,13 @@ getbounds(void)
char buf[6];
int ret;
 
+   /*
+* If we are just checking, then we haven't done a chdir to the dump
+* directory and we should not try to read a bounds file.
+*/
+   if (checkfor)
+   return (0);
+
ret = 0;
 
if ((fp = fopen("bounds", "r")) == NULL) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"