Re: svn commit: r212076 - head/lib/libthr/thread

2010-09-02 Thread David Xu

Kostik Belousov wrote:

On Wed, Sep 01, 2010 at 02:18:33AM +, David Xu wrote:

Author: davidxu
Date: Wed Sep  1 02:18:33 2010
New Revision: 212076
URL: http://svn.freebsd.org/changeset/base/212076

Log:
  Add signal handler wrapper, the reason to add it becauses there are
  some cases we want to improve:
1) if a thread signal got a signal while in cancellation point,
   it is possible the TDP_WAKEUP may be eaten by signal handler
   if the handler called some interruptibly system calls.
2) In signal handler, we want to disable cancellation.
3) When thread holding some low level locks, it is better to
   disable signal, those code need not to worry reentrancy,
   sigprocmask system call is avoided because it is a bit expensive.
  The signal handler wrapper works in this way:
1) libthr installs its signal handler if user code invokes sigaction
   to install its handler, the user handler is recorded in internal
   array.
2) when a signal is delivered, libthr's signal handler is invoke,
   libthr checks if thread holds some low level lock or is in critical
   region, if it is true, the signal is buffered, and all signals are
   masked, once the thread leaves critical region, correct signal
   mask is restored and buffered signal is processed.
3) before user signal handler is invoked, cancellation is temporarily
   disabled, after user signal handler is returned, cancellation state
   is restored, and pending cancellation is rescheduled.



+static void
+thr_sighandler(int sig, siginfo_t *info, void *_ucp)
+{



+   if ((actp-sa_flags  SA_SIGINFO) != 0)
+   (*(sigfunc))(sig, info, ucp);
+   else {
+   ((ohandler)(*sigfunc))(
+   sig, info-si_code, (struct sigcontext *)ucp,
+   info-si_addr, (__sighandler_t *)sigfunc);
+   }


I do not think this is very important, but freebsd old-style signal
handler fourth argument is usually the faulted %eip value. This is
most likely irrelevant for any source that is linked with libthr.so
new enough to contain this change.


Isn't the si_addr in siginfo a fault address ? I remembered I saved
the fault address in ksiginfo_t which is converted to userland
siginfo, and fault address should be there. what's wrong here ?


___
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: r212076 - head/lib/libthr/thread

2010-09-02 Thread Kostik Belousov
On Thu, Sep 02, 2010 at 04:34:58PM +, David Xu wrote:
 Kostik Belousov wrote:
 On Wed, Sep 01, 2010 at 02:18:33AM +, David Xu wrote:
 Author: davidxu
 Date: Wed Sep  1 02:18:33 2010
 New Revision: 212076
 URL: http://svn.freebsd.org/changeset/base/212076
 
 Log:
   Add signal handler wrapper, the reason to add it becauses there are
   some cases we want to improve:
 1) if a thread signal got a signal while in cancellation point,
it is possible the TDP_WAKEUP may be eaten by signal handler
if the handler called some interruptibly system calls.
 2) In signal handler, we want to disable cancellation.
 3) When thread holding some low level locks, it is better to
disable signal, those code need not to worry reentrancy,
sigprocmask system call is avoided because it is a bit expensive.
   The signal handler wrapper works in this way:
 1) libthr installs its signal handler if user code invokes sigaction
to install its handler, the user handler is recorded in internal
array.
 2) when a signal is delivered, libthr's signal handler is invoke,
libthr checks if thread holds some low level lock or is in critical
region, if it is true, the signal is buffered, and all signals are
masked, once the thread leaves critical region, correct signal
mask is restored and buffered signal is processed.
 3) before user signal handler is invoked, cancellation is temporarily
disabled, after user signal handler is returned, cancellation state
is restored, and pending cancellation is rescheduled.
 
 +static void
 +thr_sighandler(int sig, siginfo_t *info, void *_ucp)
 +{
 
 +   if ((actp-sa_flags  SA_SIGINFO) != 0)
 +   (*(sigfunc))(sig, info, ucp);
 +   else {
 +   ((ohandler)(*sigfunc))(
 +   sig, info-si_code, (struct sigcontext *)ucp,
 +   info-si_addr, (__sighandler_t *)sigfunc);
 +   }
 
 I do not think this is very important, but freebsd old-style signal
 handler fourth argument is usually the faulted %eip value. This is
 most likely irrelevant for any source that is linked with libthr.so
 new enough to contain this change.
 
 Isn't the si_addr in siginfo a fault address ? I remembered I saved
 the fault address in ksiginfo_t which is converted to userland
 siginfo, and fault address should be there. what's wrong here ?
 
Oops, sorry, I miscalculated the position of the arguments :(.


pgpVWspBfkYtM.pgp
Description: PGP signature


Re: svn commit: r212076 - head/lib/libthr/thread

2010-09-02 Thread Kostik Belousov
On Thu, Sep 02, 2010 at 05:03:13PM +, David Xu wrote:
 Kostik Belousov wrote:
 On Thu, Sep 02, 2010 at 04:34:58PM +, David Xu wrote:
 Kostik Belousov wrote:
 On Wed, Sep 01, 2010 at 02:18:33AM +, David Xu wrote:
 Author: davidxu
 Date: Wed Sep  1 02:18:33 2010
 New Revision: 212076
 URL: http://svn.freebsd.org/changeset/base/212076
 
 Log:
  Add signal handler wrapper, the reason to add it becauses there are
  some cases we want to improve:
1) if a thread signal got a signal while in cancellation point,
   it is possible the TDP_WAKEUP may be eaten by signal handler
   if the handler called some interruptibly system calls.
2) In signal handler, we want to disable cancellation.
3) When thread holding some low level locks, it is better to
   disable signal, those code need not to worry reentrancy,
   sigprocmask system call is avoided because it is a bit expensive.
  The signal handler wrapper works in this way:
1) libthr installs its signal handler if user code invokes sigaction
   to install its handler, the user handler is recorded in internal
   array.
2) when a signal is delivered, libthr's signal handler is invoke,
   libthr checks if thread holds some low level lock or is in 
   critical
   region, if it is true, the signal is buffered, and all signals are
   masked, once the thread leaves critical region, correct signal
   mask is restored and buffered signal is processed.
3) before user signal handler is invoked, cancellation is temporarily
   disabled, after user signal handler is returned, cancellation 
   state
   is restored, and pending cancellation is rescheduled.
 +static void
 +thr_sighandler(int sig, siginfo_t *info, void *_ucp)
 +{
 + if ((actp-sa_flags  SA_SIGINFO) != 0)
 + (*(sigfunc))(sig, info, ucp);
 + else {
 + ((ohandler)(*sigfunc))(
 + sig, info-si_code, (struct sigcontext *)ucp,
 + info-si_addr, (__sighandler_t *)sigfunc);
 + }
 I do not think this is very important, but freebsd old-style signal
 handler fourth argument is usually the faulted %eip value. This is
 most likely irrelevant for any source that is linked with libthr.so
 new enough to contain this change.
 Isn't the si_addr in siginfo a fault address ? I remembered I saved
 the fault address in ksiginfo_t which is converted to userland
 siginfo, and fault address should be there. what's wrong here ?
 
 Oops, sorry, I miscalculated the position of the arguments :(.
 
 Sorry, I think I also misunderstood you too. :(
 I think kernel still has some compatible problems. I just skimmed
 it again, and I found a problem.
 
 In RELENG_4, I found sys/i386/i386/machdep.c has following code in
 sendsig():
 
 
   sf.sf_signum = sig;
   sf.sf_ucontext = (register_t)sfp-sf_uc;
   if (SIGISMEMBER(p-p_sigacts-ps_siginfo, sig)) {
   /* Signal handler installed with SA_SIGINFO. */
   sf.sf_siginfo = (register_t)sfp-sf_si;
   sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher;
 
   /* fill siginfo structure */
   sf.sf_si.si_signo = sig;
   sf.sf_si.si_code = code;
   sf.sf_si.si_addr = (void*)regs-tf_err;
   }
   else {
   /* Old FreeBSD-style arguments. */
   sf.sf_siginfo = code;
   sf.sf_addr = regs-tf_err; ---
   sf.sf_ahu.sf_handler = catcher;
   }
 
 the sf.sf_addr is assigned by tf_err here.
 
 In later branch ( I don't know which ), it seems it uses ksi.ksi_addr,
 
   /* Old FreeBSD-style arguments. */
 sf.sf_arg2 = ksi-ksi_code;
 sf.sf_addr = (register_t)ksi-ksi_addr;
 sf.sf_ahu.sf_handler = catcher;
 
 
 
 the tf_err may not be equal to ksi_addr! This may need to be fixed.
 
The change was introduced by
r151316 | davidxu | 2005-10-14
  /* Old FreeBSD-style arguments. */
- sf.sf_siginfo = code;
- sf.sf_addr = regs-tf_err;
+ sf.sf_siginfo = ksi-ksi_code;
+ sf.sf_addr = (register_t)ksi-ksi_addr;
  sf.sf_ahu.sf_handler = catcher;



pgpmiEJzfpDsl.pgp
Description: PGP signature


Re: svn commit: r212076 - head/lib/libthr/thread

2010-09-02 Thread David Xu

Kostik Belousov wrote:


the tf_err may not be equal to ksi_addr! This may need to be fixed.


The change was introduced by
r151316 | davidxu | 2005-10-14
  /* Old FreeBSD-style arguments. */
- sf.sf_siginfo = code;
- sf.sf_addr = regs-tf_err;
+ sf.sf_siginfo = ksi-ksi_code;
+ sf.sf_addr = (register_t)ksi-ksi_addr;
  sf.sf_ahu.sf_handler = catcher;


:(

___
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: r212076 - head/lib/libthr/thread

2010-09-02 Thread Kostik Belousov
On Wed, Sep 01, 2010 at 02:18:33AM +, David Xu wrote:
 Author: davidxu
 Date: Wed Sep  1 02:18:33 2010
 New Revision: 212076
 URL: http://svn.freebsd.org/changeset/base/212076
 
 Log:
   Add signal handler wrapper, the reason to add it becauses there are
   some cases we want to improve:
 1) if a thread signal got a signal while in cancellation point,
it is possible the TDP_WAKEUP may be eaten by signal handler
if the handler called some interruptibly system calls.
 2) In signal handler, we want to disable cancellation.
 3) When thread holding some low level locks, it is better to
disable signal, those code need not to worry reentrancy,
sigprocmask system call is avoided because it is a bit expensive.
   The signal handler wrapper works in this way:
 1) libthr installs its signal handler if user code invokes sigaction
to install its handler, the user handler is recorded in internal
array.
 2) when a signal is delivered, libthr's signal handler is invoke,
libthr checks if thread holds some low level lock or is in critical
region, if it is true, the signal is buffered, and all signals are
masked, once the thread leaves critical region, correct signal
mask is restored and buffered signal is processed.
 3) before user signal handler is invoked, cancellation is temporarily
disabled, after user signal handler is returned, cancellation state
is restored, and pending cancellation is rescheduled.

 +static void
 +thr_sighandler(int sig, siginfo_t *info, void *_ucp)
 +{

 + if ((actp-sa_flags  SA_SIGINFO) != 0)
 + (*(sigfunc))(sig, info, ucp);
 + else {
 + ((ohandler)(*sigfunc))(
 + sig, info-si_code, (struct sigcontext *)ucp,
 + info-si_addr, (__sighandler_t *)sigfunc);
 + }

I do not think this is very important, but freebsd old-style signal
handler fourth argument is usually the faulted %eip value. This is
most likely irrelevant for any source that is linked with libthr.so
new enough to contain this change.


pgpEdfSMyNL9S.pgp
Description: PGP signature


Re: svn commit: r212076 - head/lib/libthr/thread

2010-09-02 Thread Kostik Belousov
On Thu, Sep 02, 2010 at 05:35:39PM +, David Xu wrote:
 Kostik Belousov wrote:
 
 the tf_err may not be equal to ksi_addr! This may need to be fixed.
 
 The change was introduced by
 r151316 | davidxu | 2005-10-14
   /* Old FreeBSD-style arguments. */
 - sf.sf_siginfo = code;
 - sf.sf_addr = regs-tf_err;
 + sf.sf_siginfo = ksi-ksi_code;
 + sf.sf_addr = (register_t)ksi-ksi_addr;
   sf.sf_ahu.sf_handler = catcher;
 
 :(
The rollback looks straightforward. I explicitely decided to not change
any architecture that is not i386.

diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c
index d85a3bb..5ce6993 100644
--- a/sys/amd64/ia32/ia32_signal.c
+++ b/sys/amd64/ia32/ia32_signal.c
@@ -374,7 +374,7 @@ freebsd4_ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, 
sigset_t *mask)
} else {
/* Old FreeBSD-style arguments. */
sf.sf_siginfo = siginfo.si_code;
-   sf.sf_addr = (u_int32_t)siginfo.si_addr;
+   sf.sf_addr = regs-tf_err;
sf.sf_ah = (u_int32_t)(uintptr_t)catcher;
}
mtx_unlock(psp-ps_mtx);
@@ -495,7 +495,7 @@ ia32_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
} else {
/* Old FreeBSD-style arguments. */
sf.sf_siginfo = siginfo.si_code;
-   sf.sf_addr = (u_int32_t)siginfo.si_addr;
+   sf.sf_addr = regs-tf_err;
sf.sf_ah = (u_int32_t)(uintptr_t)catcher;
}
mtx_unlock(psp-ps_mtx);
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index ef229ca..6a5e4e6 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -390,7 +390,7 @@ osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
} else {
/* Old FreeBSD-style arguments. */
sf.sf_arg2 = ksi-ksi_code;
-   sf.sf_addr = (register_t)ksi-ksi_addr;
+   sf.sf_addr = regs-tf_err;
sf.sf_ahu.sf_handler = catcher;
}
mtx_unlock(psp-ps_mtx);
@@ -531,7 +531,7 @@ freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t 
*mask)
} else {
/* Old FreeBSD-style arguments. */
sf.sf_siginfo = ksi-ksi_code;
-   sf.sf_addr = (register_t)ksi-ksi_addr;
+   sf.sf_addr = regs-tf_err;
sf.sf_ahu.sf_handler = catcher;
}
mtx_unlock(psp-ps_mtx);
@@ -684,7 +684,7 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
} else {
/* Old FreeBSD-style arguments. */
sf.sf_siginfo = ksi-ksi_code;
-   sf.sf_addr = (register_t)ksi-ksi_addr;
+   sf.sf_addr = regs-tf_err;
sf.sf_ahu.sf_handler = catcher;
}
mtx_unlock(psp-ps_mtx);


pgpOiMg9tShWD.pgp
Description: PGP signature


Re: svn commit: r212076 - head/lib/libthr/thread

2010-09-02 Thread John Baldwin
On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote:
 On Thu, Sep 02, 2010 at 05:35:39PM +, David Xu wrote:
  Kostik Belousov wrote:
  
  the tf_err may not be equal to ksi_addr! This may need to be fixed.
  
  The change was introduced by
  r151316 | davidxu | 2005-10-14
/* Old FreeBSD-style arguments. */
  - sf.sf_siginfo = code;
  - sf.sf_addr = regs-tf_err;
  + sf.sf_siginfo = ksi-ksi_code;
  + sf.sf_addr = (register_t)ksi-ksi_addr;
sf.sf_ahu.sf_handler = catcher;
  
  :(
 The rollback looks straightforward. I explicitely decided to not change
 any architecture that is not i386.

It may not be this simple.  At one point we had a feature where we trashed 
tf_err in the trapframe to store the address so it could be passed to sendsig 
for this purpose.  I think once we started using ksi_addr here we removed the 
trashing of tf_err as it was no longer necessary.

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


Re: svn commit: r212076 - head/lib/libthr/thread

2010-09-02 Thread David Xu

John Baldwin wrote:

On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote:
  

On Thu, Sep 02, 2010 at 05:35:39PM +, David Xu wrote:


Kostik Belousov wrote:

  

the tf_err may not be equal to ksi_addr! This may need to be fixed.

  

The change was introduced by
r151316 | davidxu | 2005-10-14
 /* Old FreeBSD-style arguments. */
- sf.sf_siginfo = code;
- sf.sf_addr = regs-tf_err;
+ sf.sf_siginfo = ksi-ksi_code;
+ sf.sf_addr = (register_t)ksi-ksi_addr;
 sf.sf_ahu.sf_handler = catcher;



:(
  

The rollback looks straightforward. I explicitely decided to not change
any architecture that is not i386.



It may not be this simple.  At one point we had a feature where we trashed 
tf_err in the trapframe to store the address so it could be passed to sendsig 
for this purpose.  I think once we started using ksi_addr here we removed the 
trashing of tf_err as it was no longer necessary.


  
I saw RELENG_5 saved it at td_md.md_fault_address, but I really can not 
remember

which version has such feature. ;-)
By the way, I still can not find a  modern program uses this old style 
and wants to

know the exact fault address.
Kostik Belousov fixed the error I had made when I was implementing 
signal queue.


Thanks!

___
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: r212146 - head/sys/dev/ata/chipsets

2010-09-02 Thread Alexander Motin
Author: mav
Date: Thu Sep  2 12:32:29 2010
New Revision: 212146
URL: http://svn.freebsd.org/changeset/base/212146

Log:
  Add fix for SiI3114 and SiI3512 chips bug, which caused sending R_ERR in
  response to DMA activate FIS under certain circumstances. This is
  recommended fix from chip datasheet. If triggered, this bug most likely
  cause write command timeout.
  
  MFC after:2 weeks

Modified:
  head/sys/dev/ata/chipsets/ata-siliconimage.c

Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c
==
--- head/sys/dev/ata/chipsets/ata-siliconimage.cThu Sep  2 11:18:43 
2010(r212145)
+++ head/sys/dev/ata/chipsets/ata-siliconimage.cThu Sep  2 12:32:29 
2010(r212146)
@@ -365,7 +365,15 @@ ata_sii_status(device_t dev)
 static void
 ata_sii_reset(device_t dev)
 {
+struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
 struct ata_channel *ch = device_get_softc(dev);
+int offset = ((ch-unit  1)  7) + ((ch-unit  2)  8);
+uint32_t val;
+
+/* Apply R_ERR on DMA activate FIS errata workaround. */
+val = ATA_INL(ctlr-r_res2, 0x14c + offset);
+if ((val  0x3) == 0x1)
+   ATA_OUTL(ctlr-r_res2, 0x14c + offset, val  ~0x3);
 
 if (ata_sata_phy_reset(dev, -1, 1))
ata_generic_reset(dev);
___
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: r212076 - head/lib/libthr/thread

2010-09-02 Thread David Xu

John Baldwin wrote:

On Thursday, September 02, 2010 7:36:08 am David Xu wrote:
  

John Baldwin wrote:


On Thursday, September 02, 2010 6:22:18 am Kostik Belousov wrote:
  
  

On Thu, Sep 02, 2010 at 05:35:39PM +, David Xu wrote:



Kostik Belousov wrote:

  
  

the tf_err may not be equal to ksi_addr! This may need to be fixed.

  
  

The change was introduced by
r151316 | davidxu | 2005-10-14
 /* Old FreeBSD-style arguments. */
- sf.sf_siginfo = code;
- sf.sf_addr = regs-tf_err;
+ sf.sf_siginfo = ksi-ksi_code;
+ sf.sf_addr = (register_t)ksi-ksi_addr;
 sf.sf_ahu.sf_handler = catcher;




:(
  
  

The rollback looks straightforward. I explicitely decided to not change
any architecture that is not i386.


It may not be this simple.  At one point we had a feature where we 
  
trashed 
  
tf_err in the trapframe to store the address so it could be passed to 
  
sendsig 
  
for this purpose.  I think once we started using ksi_addr here we removed 
  
the 
  

trashing of tf_err as it was no longer necessary.

  
  
I saw RELENG_5 saved it at td_md.md_fault_address, but I really can not 
remember

which version has such feature. ;-)
By the way, I still can not find a  modern program uses this old style 
and wants to

know the exact fault address.
Kostik Belousov fixed the error I had made when I was implementing 
signal queue.



See revision 170688 for example:

r170688 | jhb | 2007-06-13 18:37:48 -0400 (Wed, 13 Jun 2007) | 6 lines

Don't clobber tf_err with the eva from a page fault as the page fault
address is saved in ksi_addr already.

PR: i386/101379
Submitted by:   Tijl Coosemans : tijl ulyssis org

Index: trap.c
===
--- trap.c  (revision 170687)
+++ trap.c  (revision 170688)
@@ -785,9 +785,6 @@
return (-1);
}
 
-   /* kludge to pass faulting virtual address to sendsig */

-   frame-tf_err = eva;
-
return((rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV);
 }

Given that, I think the existing code is correct and that there is no bug to 
be fixed.


  

Thanks for clarifying, I am really confused when Kostik Belousov mailed me,
I wish I had not made the mistake, after all it was 4 years 10 months 
ago, so I

can not remember exactly what had happened at that time.

___
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: r212152 - head/sys/net

2010-09-02 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Sep  2 16:11:12 2010
New Revision: 212152
URL: http://svn.freebsd.org/changeset/base/212152

Log:
  MFp4 CH=183259:
  
No reason to use if_free_type() as we don't change our type.
Just if_free() is fine.
  
  MFC after:3 days

Modified:
  head/sys/net/if_epair.c

Modified: head/sys/net/if_epair.c
==
--- head/sys/net/if_epair.c Thu Sep  2 16:09:46 2010(r212151)
+++ head/sys/net/if_epair.c Thu Sep  2 16:11:12 2010(r212152)
@@ -892,9 +892,9 @@ epair_clone_destroy(struct if_clone *ifc
 * we need to switch before freeing them.
 */
CURVNET_SET_QUIET(oifp-if_vnet);
-   if_free_type(oifp, IFT_ETHER);
+   if_free(oifp);
CURVNET_RESTORE();
-   if_free_type(ifp, IFT_ETHER);
+   if_free(ifp);
free(scb, M_EPAIR);
free(sca, M_EPAIR);
ifc_free_unit(ifc, unit);
___
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: r212153 - head/sys/kern

2010-09-02 Thread Matthew D Fleming
Author: mdf
Date: Thu Sep  2 16:23:05 2010
New Revision: 212153
URL: http://svn.freebsd.org/changeset/base/212153

Log:
  Fix UP build.
  
  MFC after:2 weeks

Modified:
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Thu Sep  2 16:11:12 2010(r212152)
+++ head/sys/kern/sched_ule.c   Thu Sep  2 16:23:05 2010(r212153)
@@ -1797,8 +1797,10 @@ sched_switch(struct thread *td, struct t
srqflag = (flags  SW_PREEMPT) ?
SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED :
SRQ_OURSELF|SRQ_YIELDING;
+#ifdef SMP
if (THREAD_CAN_MIGRATE(td)  !THREAD_CAN_SCHED(td, ts-ts_cpu))
ts-ts_cpu = sched_pickcpu(td, 0);
+#endif
if (ts-ts_cpu == cpuid)
tdq_runq_add(tdq, td, srqflag);
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


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

2010-09-02 Thread mdf
On Thu, Sep 2, 2010 at 9:23 AM, Matthew D Fleming m...@freebsd.org wrote:
 Author: mdf
 Date: Thu Sep  2 16:23:05 2010
 New Revision: 212153
 URL: http://svn.freebsd.org/changeset/base/212153

 Log:
  Fix UP build.

Noticed by b.f. (bf1783 at gmail dot com)

We apologize for the inconvenience.
matthew

  MFC after:    2 weeks

 Modified:
  head/sys/kern/sched_ule.c

 Modified: head/sys/kern/sched_ule.c
 ==
 --- head/sys/kern/sched_ule.c   Thu Sep  2 16:11:12 2010        (r212152)
 +++ head/sys/kern/sched_ule.c   Thu Sep  2 16:23:05 2010        (r212153)
 @@ -1797,8 +1797,10 @@ sched_switch(struct thread *td, struct t
                srqflag = (flags  SW_PREEMPT) ?
                    SRQ_OURSELF|SRQ_YIELDING|SRQ_PREEMPTED :
                    SRQ_OURSELF|SRQ_YIELDING;
 +#ifdef SMP
                if (THREAD_CAN_MIGRATE(td)  !THREAD_CAN_SCHED(td, 
 ts-ts_cpu))
                        ts-ts_cpu = sched_pickcpu(td, 0);
 +#endif
                if (ts-ts_cpu == cpuid)
                        tdq_runq_add(tdq, td, srqflag);
                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: r212156 - head/sys/dev/sis

2010-09-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep  2 17:51:41 2010
New Revision: 212156
URL: http://svn.freebsd.org/changeset/base/212156

Log:
  Fix the last endianness issue on handling station address which
  prevented driver from working on big-endian machines. Also rewrite
  station address programming to make it work on strict-alignment
  architectures. With this change, sis(4) now works on sparc64 and
  performance number looks good even though sis(4) have to apply
  fixup code to align received frames on 2 bytes boundary on sparc64.

Modified:
  head/sys/dev/sis/if_sis.c

Modified: head/sys/dev/sis/if_sis.c
==
--- head/sys/dev/sis/if_sis.c   Thu Sep  2 17:43:44 2010(r212155)
+++ head/sys/dev/sis/if_sis.c   Thu Sep  2 17:51:41 2010(r212156)
@@ -1057,7 +1057,12 @@ sis_attach(device_t dev)
tmp[2] = sis_reverse(tmp[2]);
tmp[1] = sis_reverse(tmp[1]);
 
-   bcopy((char *)tmp[1], eaddr, ETHER_ADDR_LEN);
+   eaddr[0] = (tmp[1]  0)  0xFF;
+   eaddr[1] = (tmp[1]  8)  0xFF;
+   eaddr[2] = (tmp[2]  0)  0xFF;
+   eaddr[3] = (tmp[2]  8)  0xFF;
+   eaddr[4] = (tmp[3]  0)  0xFF;
+   eaddr[5] = (tmp[3]  8)  0xFF;
}
break;
case SIS_VENDORID:
@@ -1967,6 +1972,7 @@ sis_initl(struct sis_softc *sc)
 {
struct ifnet*ifp = sc-sis_ifp;
struct mii_data *mii;
+   uint8_t *eaddr;
 
SIS_LOCK_ASSERT(sc);
 
@@ -1994,26 +2000,21 @@ sis_initl(struct sis_softc *sc)
mii = device_get_softc(sc-sis_miibus);
 
/* Set MAC address */
+   eaddr = IF_LLADDR(sc-sis_ifp);
if (sc-sis_type == SIS_TYPE_83815) {
CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR0);
-   CSR_WRITE_4(sc, SIS_RXFILT_DATA,
-   ((uint16_t *)IF_LLADDR(sc-sis_ifp))[0]);
+   CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[0] | eaddr[1]  8);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR1);
-   CSR_WRITE_4(sc, SIS_RXFILT_DATA,
-   ((uint16_t *)IF_LLADDR(sc-sis_ifp))[1]);
+   CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[2] | eaddr[3]  8);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_PAR2);
-   CSR_WRITE_4(sc, SIS_RXFILT_DATA,
-   ((uint16_t *)IF_LLADDR(sc-sis_ifp))[2]);
+   CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[4] | eaddr[5]  8);
} else {
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR0);
-   CSR_WRITE_4(sc, SIS_RXFILT_DATA,
-   ((uint16_t *)IF_LLADDR(sc-sis_ifp))[0]);
+   CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[0] | eaddr[1]  8);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR1);
-   CSR_WRITE_4(sc, SIS_RXFILT_DATA,
-   ((uint16_t *)IF_LLADDR(sc-sis_ifp))[1]);
+   CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[2] | eaddr[3]  8);
CSR_WRITE_4(sc, SIS_RXFILT_CTL, SIS_FILTADDR_PAR2);
-   CSR_WRITE_4(sc, SIS_RXFILT_DATA,
-   ((uint16_t *)IF_LLADDR(sc-sis_ifp))[2]);
+   CSR_WRITE_4(sc, SIS_RXFILT_DATA, eaddr[4] | eaddr[5]  8);
}
 
/* Init circular TX/RX lists. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r212157 - head/sys/dev/sis

2010-09-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep  2 18:10:11 2010
New Revision: 212157
URL: http://svn.freebsd.org/changeset/base/212157

Log:
  Unlike most other controllers, NS DP83815/DP83816 controllers seem
  to pad with 0xFF when it encounter short frames.  According to RFC
  1042 the pad bytes should be 0x00.
  Because manual padding consumes extra CPU cycles, introduce a new
  tunable which controls the padding behavior. Turning this tunable
  on will have driver pad manually but it's disabled by default. Users
  can enable software padding by setting the following tunable to
  non-zero value.
  
  dev.sis.%d.manual_pad=1
  
  PR:   kern/35422 (patch not used)

Modified:
  head/sys/dev/sis/if_sis.c
  head/sys/dev/sis/if_sisreg.h

Modified: head/sys/dev/sis/if_sis.c
==
--- head/sys/dev/sis/if_sis.c   Thu Sep  2 17:51:41 2010(r212156)
+++ head/sys/dev/sis/if_sis.c   Thu Sep  2 18:10:11 2010(r212157)
@@ -73,6 +73,7 @@ __FBSDID($FreeBSD$);
 #include sys/module.h
 #include sys/socket.h
 #include sys/sockio.h
+#include sys/sysctl.h
 
 #include net/if.h
 #include net/if_arp.h
@@ -150,6 +151,7 @@ static int sis_rxeof(struct sis_softc *)
 static void sis_start(struct ifnet *);
 static void sis_startl(struct ifnet *);
 static void sis_stop(struct sis_softc *);
+static void sis_add_sysctls(struct sis_softc *);
 static void sis_watchdog(struct sis_softc *);
 
 
@@ -710,24 +712,24 @@ sis_miibus_statchg(device_t dev)
(ifp-if_drv_flags  IFF_DRV_RUNNING) == 0)
return;
 
-   sc-sis_link = 0;
+   sc-sis_flags = ~SIS_FLAG_LINK;
if ((mii-mii_media_status  (IFM_ACTIVE | IFM_AVALID)) ==
(IFM_ACTIVE | IFM_AVALID)) {
switch (IFM_SUBTYPE(mii-mii_media_active)) {
case IFM_10_T:
-   sc-sis_link++;
CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_10);
+   sc-sis_flags |= SIS_FLAG_LINK;
break;
case IFM_100_TX:
-   sc-sis_link++;
CSR_WRITE_4(sc, SIS_TX_CFG, SIS_TXCFG_100);
+   sc-sis_flags |= SIS_FLAG_LINK;
break;
default:
break;
}
}
 
-   if (sc-sis_link == 0) {
+   if ((sc-sis_flags  SIS_FLAG_LINK) == 0) {
/*
 * Stopping MACs seem to reset SIS_TX_LISTPTR and
 * SIS_RX_LISTPTR which in turn requires resetting
@@ -1122,6 +1124,8 @@ sis_attach(device_t dev)
break;
}
 
+   sis_add_sysctls(sc);
+
/* Allocate DMA'able memory. */
if ((error = sis_dma_alloc(sc)) != 0)
goto fail;
@@ -1698,7 +1702,7 @@ sis_tick(void *xsc)
mii = device_get_softc(sc-sis_miibus);
mii_tick(mii);
sis_watchdog(sc);
-   if (sc-sis_link == 0)
+   if ((sc-sis_flags  SIS_FLAG_LINK) == 0)
sis_miibus_statchg(sc-sis_dev);
callout_reset(sc-sis_stat_ch, hz,  sis_tick, sc);
 }
@@ -1829,9 +1833,41 @@ sis_encap(struct sis_softc *sc, struct m
bus_dma_segment_t   segs[SIS_MAXTXSEGS];
bus_dmamap_tmap;
int error, i, frag, nsegs, prod;
+   int padlen;
 
prod = sc-sis_tx_prod;
txd = sc-sis_txdesc[prod];
+   if ((sc-sis_flags  SIS_FLAG_MANUAL_PAD) != 0 
+   (*m_head)-m_pkthdr.len  SIS_MIN_FRAMELEN) {
+   m = *m_head;
+   padlen = SIS_MIN_FRAMELEN - m-m_pkthdr.len;
+   if (M_WRITABLE(m) == 0) {
+   /* Get a writable copy. */
+   m = m_dup(*m_head, M_DONTWAIT);
+   m_freem(*m_head);
+   if (m == NULL) {
+   *m_head = NULL;
+   return (ENOBUFS);
+   }
+   *m_head = m;
+   }
+   if (m-m_next != NULL || M_TRAILINGSPACE(m)  padlen) {
+   m = m_defrag(m, M_DONTWAIT);
+   if (m == NULL) {
+   m_freem(*m_head);
+   *m_head = NULL;
+   return (ENOBUFS);
+   }
+   }
+   /*
+* Manually pad short frames, and zero the pad space
+* to avoid leaking data.
+*/
+   bzero(mtod(m, char *) + m-m_pkthdr.len, padlen);
+   m-m_pkthdr.len += padlen;
+   m-m_len = m-m_pkthdr.len;
+   *m_head = m;
+   }
error = bus_dmamap_load_mbuf_sg(sc-sis_tx_tag, txd-tx_dmamap,
*m_head, segs, nsegs, 0);
if (error == EFBIG) {
@@ -1918,7 +1954,7 @@ sis_startl(struct ifnet *ifp)
SIS_LOCK_ASSERT(sc);
 
if 

svn commit: r212158 - head/sys/sparc64/conf

2010-09-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep  2 18:12:54 2010
New Revision: 212158
URL: http://svn.freebsd.org/changeset/base/212158

Log:
  Enable sis(4). sis(4) should work on all architectures.

Modified:
  head/sys/sparc64/conf/GENERIC

Modified: head/sys/sparc64/conf/GENERIC
==
--- head/sys/sparc64/conf/GENERIC   Thu Sep  2 18:10:11 2010
(r212157)
+++ head/sys/sparc64/conf/GENERIC   Thu Sep  2 18:12:54 2010
(r212158)
@@ -185,7 +185,7 @@ device  nge # NatSemi DP83820 
gigabit E
 device re  # RealTek 8139C+/8169/8169S/8110S
 device rl  # RealTek 8129/8139
 device sf  # Adaptec AIC-6915 (``Starfire'')
-#devicesis # Silicon Integrated Systems SiS 
900/SiS 7016
+device sis # Silicon Integrated Systems SiS 900/SiS 7016
 device sk  # SysKonnect SK-984x  SK-982x gigabit Ethernet
 device ste # Sundance ST201 (D-Link DFE-550TX)
 device stge# Sundance/Tamarack TC9021 gigabit Ethernet
___
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: r212159 - head/share/man/man4

2010-09-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep  2 18:22:06 2010
New Revision: 212159
URL: http://svn.freebsd.org/changeset/base/212159

Log:
  Document tunable dev.sis.%unit.manual_pad
  While I'm here Xref vlan(4) as sis(4) supports VLAN oversized
  frames.

Modified:
  head/share/man/man4/sis.4

Modified: head/share/man/man4/sis.4
==
--- head/share/man/man4/sis.4   Thu Sep  2 18:12:54 2010(r212158)
+++ head/share/man/man4/sis.4   Thu Sep  2 18:22:06 2010(r212159)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd October 28, 2006
+.Dd September 2, 2010
 .Dt SIS 4
 .Os
 .Sh NAME
@@ -145,6 +145,22 @@ SiS 630, 635, and 735 motherboard chipse
 .It
 Soekris Engineering net45xx, net48xx, lan1621, and lan1641
 .El
+.Sh SYSCTL VARIABLES
+The following variable is available as both
+.Xr sysctl 8
+variable and
+.Xr loader 8
+tunable:
+.Bl -tag -width indent
+.It Va dev.sis.%unit.manual_pad
+This variable controls how to pad short frames for DP83815/DP83816
+controllers on the specified device.
+DP83815/DP83816 controllers are known to pad 0xFF for short frames
+which is violation of RFC 1042.
+A non-zero value have driver manually pad zeros for short frames
+with the cost of extra CPU cycles.
+The default valus is 0 to let hardware automatically pad short frames.
+.El
 .Sh DIAGNOSTICS
 .Bl -diag
 .It sis%d: couldn't map ports/memory
@@ -190,6 +206,7 @@ the card should be configured correctly.
 .Xr netintro 4 ,
 .Xr ng_ether 4 ,
 .Xr polling 4 ,
+.Xr vlan 4 ,
 .Xr ifconfig 8
 .Rs
 .%T SiS 900 and SiS 7016 datasheets
___
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: r212157 - head/sys/dev/sis

2010-09-02 Thread Pyun YongHyeon
On Thu, Sep 02, 2010 at 06:10:11PM +, Pyun YongHyeon wrote:
 Author: yongari
 Date: Thu Sep  2 18:10:11 2010
 New Revision: 212157
 URL: http://svn.freebsd.org/changeset/base/212157
 
 Log:
   Unlike most other controllers, NS DP83815/DP83816 controllers seem
   to pad with 0xFF when it encounter short frames.  According to RFC
   1042 the pad bytes should be 0x00.
   Because manual padding consumes extra CPU cycles, introduce a new
   tunable which controls the padding behavior. Turning this tunable
   on will have driver pad manually but it's disabled by default. Users
   can enable software padding by setting the following tunable to
   non-zero value.
   
   dev.sis.%d.manual_pad=1
   
   PR: kern/35422 (patch not used)

Opps, it should be read kern/35442.
___
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: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched kern sys

2010-09-02 Thread Justin T. Gibbs
Author: gibbs
Date: Thu Sep  2 19:40:28 2010
New Revision: 212160
URL: http://svn.freebsd.org/changeset/base/212160

Log:
  Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic.
  Add the BIO_ORDERED flag for struct bio and update bio clients to use it.
  
  The barrier semantics of bioq_insert_tail() were broken in two ways:
  
   o In bioq_disksort(), an added bio could be inserted at the head of
 the queue, even when a barrier was present, if the sort key for
 the new entry was less than that of the last queued barrier bio.
  
   o The last_offset used to generate the sort key for newly queued bios
 did not stay at the position of the barrier until either the
 barrier was de-queued, or a new barrier (which updates last_offset)
 was queued.  When a barrier is in effect, we know that the disk
 will pass through the barrier position just before the
 blocked bios are released, so using the barrier's offset for
 last_offset is the optimal choice.
  
  sys/geom/sched/subr_disk.c:
  sys/kern/subr_disk.c:
o Update last_offset in bioq_insert_tail().
  
o Only update last_offset in bioq_remove() if the removed bio is
  at the head of the queue (typically due to a call via
  bioq_takefirst()) and no barrier is active.
  
o In bioq_disksort(), if we have a barrier (insert_point is non-NULL),
  set prev to the barrier and cur to it's next element.  Now that
  last_offset is kept at the barrier position, this change isn't
  strictly necessary, but since we have to take a decision branch
  anyway, it does avoid one, no-op, loop iteration in the while
  loop that immediately follows.
  
o In bioq_disksort(), bypass the normal sort for bios with the
  BIO_ORDERED attribute and instead insert them into the queue
  with bioq_insert_tail().  bioq_insert_tail() not only gives
  the desired command order during insertion, but also provides
  barrier semantics so that commands disksorted in the future
  cannot pass the just enqueued transaction.
  
  sys/sys/bio.h:
Add BIO_ORDERED as bit 4 of the bio_flags field in struct bio.
  
  sys/cam/ata/ata_da.c:
  sys/cam/scsi/scsi_da.c
Use an ordered command for SCSI/ATA-NCQ commands issued in
response to bios with the BIO_ORDERED flag set.
  
  sys/cam/scsi/scsi_da.c
Use an ordered tag when issuing a synchronize cache command.
  
Wrap some lines to 80 columns.
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  sys/geom/geom_io.c
Mark bios with the BIO_FLUSH command as BIO_ORDERED.
  
  Sponsored by: Spectra Logic Corporation
  MFC after:1 month

Modified:
  head/sys/cam/ata/ata_da.c
  head/sys/cam/scsi/scsi_da.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  head/sys/geom/geom_io.c
  head/sys/geom/sched/subr_disk.c
  head/sys/kern/subr_disk.c
  head/sys/sys/bio.h

Modified: head/sys/cam/ata/ata_da.c
==
--- head/sys/cam/ata/ata_da.c   Thu Sep  2 18:22:06 2010(r212159)
+++ head/sys/cam/ata/ata_da.c   Thu Sep  2 19:40:28 2010(r212160)
@@ -874,7 +874,8 @@ adastart(struct cam_periph *periph, unio
}
bioq_remove(softc-bio_queue, bp);
 
-   if ((softc-flags  ADA_FLAG_NEED_OTAG) != 0) {
+   if ((bp-bio_flags  BIO_ORDERED) != 0
+|| (softc-flags  ADA_FLAG_NEED_OTAG) != 0) {
softc-flags = ~ADA_FLAG_NEED_OTAG;
softc-ordered_tag_count++;
tag_code = 0;

Modified: head/sys/cam/scsi/scsi_da.c
==
--- head/sys/cam/scsi/scsi_da.c Thu Sep  2 18:22:06 2010(r212159)
+++ head/sys/cam/scsi/scsi_da.c Thu Sep  2 19:40:28 2010(r212160)
@@ -1354,7 +1354,8 @@ dastart(struct cam_periph *periph, union
 
bioq_remove(softc-bio_queue, bp);
 
-   if ((softc-flags  DA_FLAG_NEED_OTAG) != 0) {
+   if ((bp-bio_flags  BIO_ORDERED) != 0
+|| (softc-flags  DA_FLAG_NEED_OTAG) != 0) {
softc-flags = ~DA_FLAG_NEED_OTAG;
softc-ordered_tag_count++;
tag_code = MSG_ORDERED_Q_TAG;
@@ -1368,7 +1369,8 @@ dastart(struct cam_periph *periph, union
/*retries*/da_retry_count,
/*cbfcnp*/dadone,
/*tag_action*/tag_code,
-   /*read_op*/bp-bio_cmd == 
BIO_READ,
+   /*read_op*/bp-bio_cmd
+   == 

svn commit: r212161 - head/share/man/man4

2010-09-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep  2 20:43:01 2010
New Revision: 212161
URL: http://svn.freebsd.org/changeset/base/212161

Log:
  Better wording.
  
  Submitted by: jkim

Modified:
  head/share/man/man4/sis.4

Modified: head/share/man/man4/sis.4
==
--- head/share/man/man4/sis.4   Thu Sep  2 19:40:28 2010(r212160)
+++ head/share/man/man4/sis.4   Thu Sep  2 20:43:01 2010(r212161)
@@ -157,9 +157,9 @@ This variable controls how to pad short 
 controllers on the specified device.
 DP83815/DP83816 controllers are known to pad 0xFF for short frames
 which is violation of RFC 1042.
-A non-zero value have driver manually pad zeros for short frames
-with the cost of extra CPU cycles.
-The default valus is 0 to let hardware automatically pad short frames.
+Set this variable to a non-zero value to let driver manually pad
+each short frame with zeros at the cost of extra CPU cycles.
+The default value is 0 to let hardware perform automatic padding.
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
___
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: r212162 - head/usr.bin/split

2010-09-02 Thread Gavin Atkinson
Author: gavin
Date: Thu Sep  2 21:29:50 2010
New Revision: 212162
URL: http://svn.freebsd.org/changeset/base/212162

Log:
  Correct spelling mistake, int - into
  
  MFC after:3 days

Modified:
  head/usr.bin/split/split.1

Modified: head/usr.bin/split/split.1
==
--- head/usr.bin/split/split.1  Thu Sep  2 20:43:01 2010(r212161)
+++ head/usr.bin/split/split.1  Thu Sep  2 21:29:50 2010(r212162)
@@ -32,7 +32,7 @@
 .\@(#)split.1 8.3 (Berkeley) 4/16/94
 .\ $FreeBSD$
 .\
-.Dd January 23, 2009
+.Dd September 2, 2010
 .Dt SPLIT 1
 .Os
 .Sh NAME
@@ -117,7 +117,7 @@ Create split files
 .Ar line_count
 lines in length.
 .It Fl n Ar chunk_count
-Split file int
+Split file into
 .Ar chunk_count
 smaller files.
 .It Fl p Ar pattern
___
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: r212160 - in head/sys: cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs geom geom/sched kern sys

2010-09-02 Thread Pawel Jakub Dawidek
On Thu, Sep 02, 2010 at 07:40:28PM +, Justin T. Gibbs wrote:
 Author: gibbs
 Date: Thu Sep  2 19:40:28 2010
 New Revision: 212160
 URL: http://svn.freebsd.org/changeset/base/212160
 
 Log:
   Correct bioq_disksort so that bioq_insert_tail() offers barrier semantic.

Thank you for working on this, Justin!

   sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
   sys/geom/geom_io.c
   Mark bios with the BIO_FLUSH command as BIO_ORDERED.
[...]

Don't you think it would be better to set the flag from within
g_io_request()? This way every BIO_FLUSH consumer doesn't have to
remember to set it. Or am I missing something?

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
p...@freebsd.org   http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!


pgp5sqEY0awxy.pgp
Description: PGP signature


svn commit: r212165 - head/sys/boot/ofw/libofw

2010-09-02 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Thu Sep  2 22:26:49 2010
New Revision: 212165
URL: http://svn.freebsd.org/changeset/base/212165

Log:
  In the case of non-sequential mappings, ofw_mapmem() could ask Open
  Firmware to map a memory region with negative length, causing crashes
  and Undefined Behavior. Add the appropriate check to make the behavior
  defined.

Modified:
  head/sys/boot/ofw/libofw/ofw_copy.c

Modified: head/sys/boot/ofw/libofw/ofw_copy.c
==
--- head/sys/boot/ofw/libofw/ofw_copy.c Thu Sep  2 21:52:43 2010
(r212164)
+++ head/sys/boot/ofw/libofw/ofw_copy.c Thu Sep  2 22:26:49 2010
(r212165)
@@ -68,7 +68,7 @@ ofw_mapmem(vm_offset_t dest, const size_
/*
 * Trim area covered by existing mapping, if any
 */
-   if (dest  (last_dest + last_len)) {
+   if (dest  (last_dest + last_len)  dest = last_dest) {
nlen -= (last_dest + last_len) - dest;
dest = last_dest + last_len;
}
___
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: r212166 - head/sys/dev/sis

2010-09-02 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep  2 22:37:13 2010
New Revision: 212166
URL: http://svn.freebsd.org/changeset/base/212166

Log:
  Implement initial device suspend/resume method.

Modified:
  head/sys/dev/sis/if_sis.c

Modified: head/sys/dev/sis/if_sis.c
==
--- head/sys/dev/sis/if_sis.c   Thu Sep  2 22:26:49 2010(r212165)
+++ head/sys/dev/sis/if_sis.c   Thu Sep  2 22:37:13 2010(r212166)
@@ -2393,6 +2393,35 @@ sis_shutdown(device_t dev)
return (0);
 }
 
+static int
+sis_suspend(device_t dev)
+{
+   struct sis_softc*sc;
+
+   sc = device_get_softc(dev);
+   SIS_LOCK(sc);
+   sis_stop(sc);
+   SIS_UNLOCK(sc);
+   return (0);
+}
+
+static int
+sis_resume(device_t dev)
+{
+   struct sis_softc*sc;
+   struct ifnet*ifp;
+
+   sc = device_get_softc(dev);
+   SIS_LOCK(sc);
+   ifp = sc-sis_ifp;
+   if ((ifp-if_flags  IFF_UP) != 0) {
+   ifp-if_drv_flags = ~IFF_DRV_RUNNING;
+   sis_initl(sc);
+   }
+   SIS_UNLOCK(sc);
+   return (0);
+}
+
 static void
 sis_add_sysctls(struct sis_softc *sc)
 {
@@ -2425,6 +2454,8 @@ static device_method_t sis_methods[] = {
DEVMETHOD(device_attach,sis_attach),
DEVMETHOD(device_detach,sis_detach),
DEVMETHOD(device_shutdown,  sis_shutdown),
+   DEVMETHOD(device_suspend,   sis_suspend),
+   DEVMETHOD(device_resume,sis_resume),
 
/* bus interface */
DEVMETHOD(bus_print_child,  bus_generic_print_child),
___
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: r212169 - head/tools/tools/nanobsd

2010-09-02 Thread Warner Losh
Author: imp
Date: Fri Sep  3 03:48:06 2010
New Revision: 212169
URL: http://svn.freebsd.org/changeset/base/212169

Log:
  Allow / in the NANO_DEVICE
  
  PR:   149729
  Submitted by: Thomas Quinot tho...@cuivre.fr.eu.org

Modified:
  head/tools/tools/nanobsd/nanobsd.sh

Modified: head/tools/tools/nanobsd/nanobsd.sh
==
--- head/tools/tools/nanobsd/nanobsd.sh Fri Sep  3 03:20:34 2010
(r212168)
+++ head/tools/tools/nanobsd/nanobsd.sh Fri Sep  3 03:48:06 2010
(r212169)
@@ -503,7 +503,7 @@ create_i386_diskimage ( ) (
mount /dev/${MD}s2a ${MNT}
for f in ${MNT}/etc/fstab ${MNT}/conf/base/etc/fstab
do
-   sed -i  s/${NANO_DRIVE}s1/${NANO_DRIVE}s2/g $f
+   sed -i  s=${NANO_DRIVE}s1=${NANO_DRIVE}s2=g $f
done
umount ${MNT}
fi
___
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: r212170 - in head/sys/powerpc: conf include powerpc

2010-09-02 Thread Peter Grehan
Author: grehan
Date: Fri Sep  3 03:56:09 2010
New Revision: 212170
URL: http://svn.freebsd.org/changeset/base/212170

Log:
  - Bump MAXCPU to 4. Tested on a quad G5 with both 32 and 64-bit kernels.
  A make buildkernel -j4 uses ~360% CPU.
  - Bracket the AP spinup printf with a mutex to avoid garbled output.
  - Enable SMP by default on powerpc64.
  
  Reviewed by:  nwhitehorn

Modified:
  head/sys/powerpc/conf/GENERIC64
  head/sys/powerpc/include/param.h
  head/sys/powerpc/powerpc/mp_machdep.c

Modified: head/sys/powerpc/conf/GENERIC64
==
--- head/sys/powerpc/conf/GENERIC64 Fri Sep  3 03:48:06 2010
(r212169)
+++ head/sys/powerpc/conf/GENERIC64 Fri Sep  3 03:56:09 2010
(r212170)
@@ -76,8 +76,8 @@ options   WITNESS #Enable checks to det
 optionsWITNESS_SKIPSPIN#Don't run witness on spinlocks for 
speed
 optionsMALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
 
-# To make an SMP kernel, the next line is needed
-#options   SMP # Symmetric MultiProcessor Kernel
+# Make an SMP-capable kernel by default
+optionsSMP # Symmetric MultiProcessor Kernel
 
 # CPU frequency control
 device cpufreq

Modified: head/sys/powerpc/include/param.h
==
--- head/sys/powerpc/include/param.hFri Sep  3 03:48:06 2010
(r212169)
+++ head/sys/powerpc/include/param.hFri Sep  3 03:56:09 2010
(r212170)
@@ -68,7 +68,7 @@
 #endif
 
 #if defined(SMP) || defined(KLD_MODULE)
-#defineMAXCPU  2
+#defineMAXCPU  4   
 #else
 #defineMAXCPU  1
 #endif /* SMP || KLD_MODULE */

Modified: head/sys/powerpc/powerpc/mp_machdep.c
==
--- head/sys/powerpc/powerpc/mp_machdep.c   Fri Sep  3 03:48:06 2010
(r212169)
+++ head/sys/powerpc/powerpc/mp_machdep.c   Fri Sep  3 03:56:09 2010
(r212170)
@@ -32,6 +32,8 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/ktr.h
 #include sys/bus.h
+#include sys/lock.h
+#include sys/mutex.h
 #include sys/pcpu.h
 #include sys/proc.h
 #include sys/sched.h
@@ -60,6 +62,7 @@ volatile static u_int ap_letgo;
 volatile static uint32_t ap_decr;
 volatile static u_quad_t ap_timebase;
 static u_int ipi_msg_cnt[32];
+static struct mtx ap_boot_mtx;
 
 void
 machdep_ap_bootstrap(void)
@@ -80,8 +83,11 @@ machdep_ap_bootstrap(void)
mttb(ap_timebase);
__asm __volatile(mtdec %0 :: r(ap_decr));
 
-   atomic_add_int(ap_awake, 1);
+   /* Serialize console output and AP count increment */
+   mtx_lock_spin(ap_boot_mtx);
+   ap_awake++;
printf(SMP: AP CPU #%d launched\n, PCPU_GET(cpuid));
+   mtx_unlock_spin(ap_boot_mtx);
 
/* Initialize curthread */
PCPU_SET(curthread, PCPU_GET(idlethread));
@@ -203,6 +209,8 @@ cpu_mp_unleash(void *dummy)
if (mp_ncpus = 1)
return;
 
+   mtx_init(ap_boot_mtx, ap boot, NULL, MTX_SPIN);
+
cpus = 0;
smp_cpus = 0;
SLIST_FOREACH(pc, cpuhead, pc_allcpu) {
___
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