svn commit: r211165 - stable/8/sys/conf

2010-08-11 Thread Bernhard Schmidt
Author: bschmidt
Date: Wed Aug 11 06:29:40 2010
New Revision: 211165
URL: http://svn.freebsd.org/changeset/base/211165

Log:
  MFC r211063:
  License ACK is not required for the wpifw module nor when building
  it into the kernel.
  
  PR:   conf/148758
  Submitted by: Joe Talbott josepht at dragonflybsd.org

Modified:
  stable/8/sys/conf/files
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/files
==
--- stable/8/sys/conf/files Wed Aug 11 06:22:18 2010(r211164)
+++ stable/8/sys/conf/files Wed Aug 11 06:29:40 2010(r211165)
@@ -1816,7 +1816,7 @@ dev/wi/if_wi_pccard.c optional wi pccar
 dev/wi/if_wi_pci.c optional wi pci
 dev/wl/if_wl.c optional wl isa
 wpifw.coptional wpifw  
\
-   compile-with${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:2144 
-lintel_wpi -mwpi -c${.TARGET} \
+   compile-with${AWK} -f $S/tools/fw_stub.awk wpi.fw:wpifw:2144 -mwpi 
-c${.TARGET} \
no-implicit-rule before-depend local\
clean   wpifw.c
 wpifw.fwo  optional wpifw  \
___
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: r211167 - head/sys/mips/mips

2010-08-11 Thread Jayachandran C.
Author: jchandra
Date: Wed Aug 11 06:43:14 2010
New Revision: 211167
URL: http://svn.freebsd.org/changeset/base/211167

Log:
  Fix compilation when DDB disabled. Adds 'ifdef DDB' around
  DB_SHOW_COMMAND definitions.

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

Modified: head/sys/mips/mips/pmap.c
==
--- head/sys/mips/mips/pmap.c   Wed Aug 11 06:33:38 2010(r211166)
+++ head/sys/mips/mips/pmap.c   Wed Aug 11 06:43:14 2010(r211167)
@@ -3052,6 +3052,7 @@ pmap_align_tlb(vm_offset_t *addr)
return;
 }
 
+#ifdef DDB
 DB_SHOW_COMMAND(ptable, ddb_pid_dump)
 {
pmap_t pmap;
@@ -3077,9 +3078,8 @@ DB_SHOW_COMMAND(ptable, ddb_pid_dump)
pmap = kernel_pmap;
 
db_printf(pmap:%p segtab:%p asid:%x generation:%x\n,
-   pmap, pmap-pm_segtab,
-  pmap-pm_asid[0].asid,
-  pmap-pm_asid[0].gen);
+   pmap, pmap-pm_segtab, pmap-pm_asid[0].asid,
+   pmap-pm_asid[0].gen);
for (i = 0; i  NPDEPG; i++) {
pd_entry_t *pdpe;
pt_entry_t *pde;
@@ -3112,7 +3112,7 @@ DB_SHOW_COMMAND(ptable, ddb_pid_dump)
}
}
 }
-
+#endif
 
 #if defined(DEBUG)
 
___
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: r211169 - stable/8/share/man/man4

2010-08-11 Thread Bernhard Schmidt
Author: bschmidt
Date: Wed Aug 11 07:02:08 2010
New Revision: 211169
URL: http://svn.freebsd.org/changeset/base/211169

Log:
  MFC r210959:
  Obviously the option is known as COMPAT_LINUX32 on amd64.
  
  PR:   docs/149182
  Pointed out by:   Fernando fernando.apesteguia at gmail.com

Modified:
  stable/8/share/man/man4/linux.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/linux.4
==
--- stable/8/share/man/man4/linux.4 Wed Aug 11 06:49:29 2010
(r211168)
+++ stable/8/share/man/man4/linux.4 Wed Aug 11 07:02:08 2010
(r211169)
@@ -31,13 +31,18 @@
 .Nm linux
 .Nd Linux ABI support
 .Sh SYNOPSIS
-To compile support for this ABI into the kernel,
+To compile support for this ABI into an i386 kernel
 place the following line in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd options COMPAT_LINUX
 .Ed
 .Pp
+for an amd64 kernel use:
+.Bd -ragged -offset indent
+.Cd options COMPAT_LINUX32
+.Ed
+.Pp
 Alternatively, to load the ABI as a
 module at boot time, place the following line in
 .Xr loader.conf 5 :
___
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: r211171 - in stable/8/sys: amd64/conf i386/conf

2010-08-11 Thread Bernhard Schmidt
Author: bschmidt
Date: Wed Aug 11 07:11:20 2010
New Revision: 211171
URL: http://svn.freebsd.org/changeset/base/211171

Log:
  MFC r210947:
  Fix whitespace nits.
  
  PR:   conf/148989
  Submitted by: pluknet pluknet at gmail.com

Modified:
  stable/8/sys/amd64/conf/GENERIC
  stable/8/sys/i386/conf/GENERIC
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/conf/GENERIC
==
--- stable/8/sys/amd64/conf/GENERIC Wed Aug 11 07:05:27 2010
(r211170)
+++ stable/8/sys/amd64/conf/GENERIC Wed Aug 11 07:11:20 2010
(r211171)
@@ -72,7 +72,7 @@ options   KBD_INSTALL_CDEV# install a CD
 optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
 optionsAUDIT   # Security event auditing
 optionsMAC # TrustedBSD MAC Framework
-optionsFLOWTABLE   # per-cpu routing cache
+optionsFLOWTABLE   # per-cpu routing cache
 #options   KDTRACE_FRAME   # Ensure frames are compiled in
 #options   KDTRACE_HOOKS   # Kernel DTrace hooks
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel

Modified: stable/8/sys/i386/conf/GENERIC
==
--- stable/8/sys/i386/conf/GENERIC  Wed Aug 11 07:05:27 2010
(r211170)
+++ stable/8/sys/i386/conf/GENERIC  Wed Aug 11 07:11:20 2010
(r211171)
@@ -73,7 +73,7 @@ options   KBD_INSTALL_CDEV# install a CD
 optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
 optionsAUDIT   # Security event auditing
 optionsMAC # TrustedBSD MAC Framework
-optionsFLOWTABLE   # per-cpu routing cache
+optionsFLOWTABLE   # per-cpu routing cache
 #options   KDTRACE_HOOKS   # Kernel DTrace hooks
 optionsINCLUDE_CONFIG_FILE # Include this file in kernel
 
___
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: r211172 - head/usr.sbin/kbdcontrol

2010-08-11 Thread Oliver Fromme
Author: olli
Date: Wed Aug 11 08:26:15 2010
New Revision: 211172
URL: http://svn.freebsd.org/changeset/base/211172

Log:
  Fix some typos: flush vs. flash, and some others.
  
  Approved by:  des (mentor, implicit)
  MFC after:1 week

Modified:
  head/usr.sbin/kbdcontrol/kbdcontrol.1

Modified: head/usr.sbin/kbdcontrol/kbdcontrol.1
==
--- head/usr.sbin/kbdcontrol/kbdcontrol.1   Wed Aug 11 07:11:20 2010
(r211171)
+++ head/usr.sbin/kbdcontrol/kbdcontrol.1   Wed Aug 11 08:26:15 2010
(r211172)
@@ -233,15 +233,15 @@ The following command will make the func
 .Dl kbdcontrol -f 10 \telnet myhost\
 .Pp
 In order to get the visual effect for bell, but prevent the screen
-from flushing if the bell is to ring in the background screen,
+from flashing if the bell is to ring in the background screen,
 run the following command.
 .Pp
 .Dl kbdcontrol -b quiet.visual
 .Pp
-To change the default console keyboard to the another keyboard,
+To change the default console keyboard to another keyboard,
 for example the first USB keyboard (see
 .Xr ukbd 4 ) ,
-use the following commands.
+use the following command.
 .Pp
 .Dl kbdcontrol -k /dev/ukbd0  /dev/console
 .Pp
___
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: r211173 - stable/8/sys/compat/freebsd32

2010-08-11 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 11 08:58:27 2010
New Revision: 211173
URL: http://svn.freebsd.org/changeset/base/211173

Log:
  MFC r210847:
  Fix style.

Modified:
  stable/8/sys/compat/freebsd32/freebsd32_misc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/8/sys/compat/freebsd32/freebsd32_misc.c  Wed Aug 11 08:26:15 
2010(r211172)
+++ stable/8/sys/compat/freebsd32/freebsd32_misc.c  Wed Aug 11 08:58:27 
2010(r211173)
@@ -1619,8 +1619,9 @@ freebsd32_sendfile(struct thread *td, st
 }
 
 static void
-copy_stat( struct stat *in, struct stat32 *out)
+copy_stat(struct stat *in, struct stat32 *out)
 {
+
CP(*in, *out, st_dev);
CP(*in, *out, st_ino);
CP(*in, *out, st_mode);
___
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: r211174 - stable/8/sys/compat/freebsd32

2010-08-11 Thread Konstantin Belousov
Author: kib
Date: Wed Aug 11 09:04:36 2010
New Revision: 211174
URL: http://svn.freebsd.org/changeset/base/211174

Log:
  MFC r210848:
  Copy inode birthtime to the struct stat32.

Modified:
  stable/8/sys/compat/freebsd32/freebsd32_misc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cam/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c
==
--- stable/8/sys/compat/freebsd32/freebsd32_misc.c  Wed Aug 11 08:58:27 
2010(r211173)
+++ stable/8/sys/compat/freebsd32/freebsd32_misc.c  Wed Aug 11 09:04:36 
2010(r211174)
@@ -1637,6 +1637,7 @@ copy_stat(struct stat *in, struct stat32
CP(*in, *out, st_blksize);
CP(*in, *out, st_flags);
CP(*in, *out, st_gen);
+   TS_CP(*in, *out, st_birthtimespec);
 }
 
 int
___
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: r211023 - head/usr.sbin/syslogd

2010-08-11 Thread Dag-Erling Smørgrav
M. Warner Losh i...@bsdimp.com writes:
 You'll find that a number of structures are potentially already
 allocated with less than required alignment.  There's about a dozen
 places in the tree that would start to fail if we did this, or the
 stronger form of __aligned(8).  We could add that to the other
 structures, but then we're breaking ABI rules, I think.

__aligned(4) won't affect struct addrinfo since the sockaddr immediately
follows a socklen_t, which is 32 bits wide and has 32-bit alignment.  A
sockaddr_* allocated with malloc() will already be aligned, and so will
a sockaddr_* created on the stack.  The only problem is sockaddr_un,
because its size is not a multiple of 4, so if you allocate an array of
sockaddr_un, every other element will be misaligned.

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r211175 - head/include

2010-08-11 Thread Kevin Lo
Author: kevlo
Date: Wed Aug 11 09:29:33 2010
New Revision: 211175
URL: http://svn.freebsd.org/changeset/base/211175

Log:
  Style: tabs after #define

Modified:
  head/include/unistd.h

Modified: head/include/unistd.h
==
--- head/include/unistd.h   Wed Aug 11 09:04:36 2010(r211174)
+++ head/include/unistd.h   Wed Aug 11 09:29:33 2010(r211175)
@@ -74,7 +74,7 @@ typedef   __useconds_tuseconds_t;
 #define_USECONDS_T_DECLARED
 #endif
 
-#define STDIN_FILENO   0   /* standard input file descriptor */
+#defineSTDIN_FILENO0   /* standard input file descriptor */
 #defineSTDOUT_FILENO   1   /* standard output file descriptor */
 #defineSTDERR_FILENO   2   /* standard error file descriptor */
 
___
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: r211176 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread Attilio Rao
Author: attilio
Date: Wed Aug 11 10:51:27 2010
New Revision: 211176
URL: http://svn.freebsd.org/changeset/base/211176

Log:
  IPI handlers may run generally with interrupts disabled because they
  are served via an interrupt gate.
  
  However, that doesn't explicitly prevent preemption and thread
  migration thus scheduler pinning may be necessary in some handlers.
  Fix that.
  
  Tested by:gianni
  MFC after:1 month

Modified:
  head/sys/amd64/amd64/mp_machdep.c
  head/sys/i386/i386/mp_machdep.c

Modified: head/sys/amd64/amd64/mp_machdep.c
==
--- head/sys/amd64/amd64/mp_machdep.c   Wed Aug 11 09:29:33 2010
(r211175)
+++ head/sys/amd64/amd64/mp_machdep.c   Wed Aug 11 10:51:27 2010
(r211176)
@@ -1324,8 +1324,10 @@ cpustop_handler(void)
cpumask_t cpumask;
u_int cpu;
 
+   sched_pin();
cpu = PCPU_GET(cpuid);
cpumask = PCPU_GET(cpumask);
+   sched_unpin();
 
savectx(stoppcbs[cpu]);
 
@@ -1356,8 +1358,10 @@ cpususpend_handler(void)
register_t cr3, rf;
u_int cpu;
 
+   sched_pin();
cpu = PCPU_GET(cpuid);
cpumask = PCPU_GET(cpumask);
+   sched_unpin();
 
rf = intr_disable();
cr3 = rcr3();
@@ -1535,10 +1539,14 @@ mp_grab_cpu_hlt(void)
 #endif
int retval;
 
-   mask = PCPU_GET(cpumask);
 #ifdef MP_WATCHDOG
+   sched_pin();
+   mask = PCPU_GET(cpumask);
cpuid = PCPU_GET(cpuid);
+   sched_unpin();
ap_watchdog(cpuid);
+#else
+   mask = PCPU_GET(cpumask);
 #endif
 
retval = mask  hlt_cpus_mask;

Modified: head/sys/i386/i386/mp_machdep.c
==
--- head/sys/i386/i386/mp_machdep.c Wed Aug 11 09:29:33 2010
(r211175)
+++ head/sys/i386/i386/mp_machdep.c Wed Aug 11 10:51:27 2010
(r211176)
@@ -1411,8 +1411,10 @@ cpustop_handler(void)
cpumask_t cpumask;
u_int cpu;
 
+   sched_pin();
cpu = PCPU_GET(cpuid);
cpumask = PCPU_GET(cpumask);
+   sched_unpin();
 
savectx(stoppcbs[cpu]);
 
@@ -1586,10 +1588,14 @@ mp_grab_cpu_hlt(void)
 #endif
int retval;
 
-   mask = PCPU_GET(cpumask);
 #ifdef MP_WATCHDOG
+   sched_pin();
+   mask = PCPU_GET(cpumask);
cpuid = PCPU_GET(cpuid);
+   sched_unpin();
ap_watchdog(cpuid);
+#else
+   mask = PCPU_GET(cpumask);
 #endif
 
retval = mask  hlt_cpus_mask;
___
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: r211176 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread Kostik Belousov
On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
 Author: attilio
 Date: Wed Aug 11 10:51:27 2010
 New Revision: 211176
 URL: http://svn.freebsd.org/changeset/base/211176
 
 Log:
   IPI handlers may run generally with interrupts disabled because they
   are served via an interrupt gate.
   
   However, that doesn't explicitly prevent preemption and thread
   migration thus scheduler pinning may be necessary in some handlers.
   Fix that.

How the preemption is supposed to happen ? Aside from the explicit
calls to mi_switch() from e.g. critical_exit().


pgpmnnaq0oUJo.pgp
Description: PGP signature


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

2010-08-11 Thread Attilio Rao
2010/8/11 Kostik Belousov kostik...@gmail.com:
 On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
 Author: attilio
 Date: Wed Aug 11 10:51:27 2010
 New Revision: 211176
 URL: http://svn.freebsd.org/changeset/base/211176

 Log:
   IPI handlers may run generally with interrupts disabled because they
   are served via an interrupt gate.

   However, that doesn't explicitly prevent preemption and thread
   migration thus scheduler pinning may be necessary in some handlers.
   Fix that.

 How the preemption is supposed to happen ? Aside from the explicit
 calls to mi_switch() from e.g. critical_exit().

IIRC it should be hardclock() willing to schedule the softclock(). It
is the critical_exit() in the thread_unlock() that may trigger it
(sorry for not digging more, it was a while back that I hacked this
part, but I guess you can verify on your own).
We already have other points within the kernel that take care of
dealing with preemption/migration like lapic_handle_timer(), for
example.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211176 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread Kostik Belousov
On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
 2010/8/11 Kostik Belousov kostik...@gmail.com:
  On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
  Author: attilio
  Date: Wed Aug 11 10:51:27 2010
  New Revision: 211176
  URL: http://svn.freebsd.org/changeset/base/211176
 
  Log:
    IPI handlers may run generally with interrupts disabled because they
    are served via an interrupt gate.
 
    However, that doesn't explicitly prevent preemption and thread
    migration thus scheduler pinning may be necessary in some handlers.
    Fix that.
 
  How the preemption is supposed to happen ? Aside from the explicit
  calls to mi_switch() from e.g. critical_exit().
 
 IIRC it should be hardclock() willing to schedule the softclock(). It
 is the critical_exit() in the thread_unlock() that may trigger it
 (sorry for not digging more, it was a while back that I hacked this
 part, but I guess you can verify on your own).
 We already have other points within the kernel that take care of
 dealing with preemption/migration like lapic_handle_timer(), for
 example.

Right, and if the interrupts are indeed disabled, I do not see how
the preemption may be triggered in the fragments like
cpu = PCPU_GET(cpuid);
cpumask = PCPU_GET(cpumask);


pgpU6zZENZKJ8.pgp
Description: PGP signature


Re: svn commit: r211023 - head/usr.sbin/syslogd

2010-08-11 Thread Oliver Fromme
Dag-Erling Smørgrav wrote:
  M. Warner Losh i...@bsdimp.com writes:
   You'll find that a number of structures are potentially already
   allocated with less than required alignment.  There's about a dozen
   places in the tree that would start to fail if we did this, or the
   stronger form of __aligned(8).  We could add that to the other
   structures, but then we're breaking ABI rules, I think.
  
  __aligned(4) won't affect struct addrinfo since the sockaddr immediately
  follows a socklen_t, which is 32 bits wide and has 32-bit alignment.  A
  sockaddr_* allocated with malloc() will already be aligned, and so will
  a sockaddr_* created on the stack.  The only problem is sockaddr_un,
  because its size is not a multiple of 4, so if you allocate an array of
  sockaddr_un, every other element will be misaligned.

I did a small survey of all the sockaddr_ variants:

structalign size modulo   where
-
osockaddr 2   16   16  sys/socket.h
sockaddr  1   16   16  sys/socket.h
sockaddr_at   2   16   16  netatalk/at.h
sockaddr_dl   2   542  net/if_dl.h
sockaddr_hci  1   342  netgraph/bluetooth/include/ng_btsocket.h
sockaddr_in   4   16   16  netinet/in.h
sockaddr_in6  4   284  netinet6/in6.h
sockaddr_inarp4   16   16  netinet/if_ether.h
sockaddr_ipx  2   16   16  netipx/ipx.h
sockaddr_l2cap2   102  netgraph/bluetooth/include/ng_btsocket.h
sockaddr_natm 2   222  netnatm/natm.h
sockaddr_nb   4   568  netsmb/netbios.h
sockaddr_ng   1   16   16  netgraph/ng_socket.h
sockaddr_rfcomm   191  netgraph/bluetooth/include/ng_btsocket.h
sockaddr_sco  188  netgraph/bluetooth/include/ng_btsocket.h
sockaddr_storage  8  128  128  sys/_sockaddr_storage.h
sockaddr_un   1  1062  sys/un.h

If we push struct sockaddr to align(4), then we will also
have to do the same with all others that are not already
aligned to at least 4 bytes.  That would be almost all of
them.

I agree that there will be ABI problems with those structs
whose size is not a multiple of 4 (that's the ones with a
value  4 in the modulo column above).  So we cannot do
that, right?

Best regards
   Oliver

-- 
``We are all but compressed light'' (Albert Einstein)
___
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: r211023 - head/usr.sbin/syslogd

2010-08-11 Thread Dag-Erling Smørgrav
Oliver Fromme o...@fromme.com writes:
 I did a small survey of all the sockaddr_ variants:

I only did _in, _in6 and _un; who cares about the others?  :P

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
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: r211146 - head

2010-08-11 Thread Ed Schouten
Hi Adrian,

* Adrian Chadd adr...@freebsd.org wrote:
 Modified:
   head/Makefile.mips

Can't this file be simply removed now?

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpiKFOyJWXl4.pgp
Description: PGP signature


Re: svn commit: r211023 - head/usr.sbin/syslogd

2010-08-11 Thread Ed Schouten
* Oliver Fromme o...@fromme.com wrote:
 If we push struct sockaddr to align(4), then we will also
 have to do the same with all others that are not already
 aligned to at least 4 bytes.  That would be almost all of
 them.

Maybe it's better to just use __attribute__((aligned))? That makes it
use the worst alignment possible.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgps7QIdT5Oqc.pgp
Description: PGP signature


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

2010-08-11 Thread Attilio Rao
2010/8/11 Kostik Belousov kostik...@gmail.com:
 On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
 2010/8/11 Kostik Belousov kostik...@gmail.com:
  On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
  Author: attilio
  Date: Wed Aug 11 10:51:27 2010
  New Revision: 211176
  URL: http://svn.freebsd.org/changeset/base/211176
 
  Log:
    IPI handlers may run generally with interrupts disabled because they
    are served via an interrupt gate.
 
    However, that doesn't explicitly prevent preemption and thread
    migration thus scheduler pinning may be necessary in some handlers.
    Fix that.
 
  How the preemption is supposed to happen ? Aside from the explicit
  calls to mi_switch() from e.g. critical_exit().

 IIRC it should be hardclock() willing to schedule the softclock(). It
 is the critical_exit() in the thread_unlock() that may trigger it
 (sorry for not digging more, it was a while back that I hacked this
 part, but I guess you can verify on your own).
 We already have other points within the kernel that take care of
 dealing with preemption/migration like lapic_handle_timer(), for
 example.

 Right, and if the interrupts are indeed disabled, I do not see how
 the preemption may be triggered in the fragments like
        cpu = PCPU_GET(cpuid);
        cpumask = PCPU_GET(cpumask);

I don't recall all the details and I have no time to dig now. However,
also spinlock_enter() does disable explicitly preemption via
critical_enter() after have disabled the interrupts.
Let me CC jhb as he implemented spinlock_enter() and may have a clue
about how preemption can happen with interrupts disabled.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211157 - in head/sys: modules modules/if_carp net netinet netinet6

2010-08-11 Thread Pawel Jakub Dawidek
On Wed, Aug 11, 2010 at 12:51:51AM +, Will Andrews wrote:
 Author: will
 Date: Wed Aug 11 00:51:50 2010
 New Revision: 211157
 URL: http://svn.freebsd.org/changeset/base/211157
 
 Log:
   Allow carp(4) to be loaded as a kernel module.  Follow precedent set by
   bridge(4), lagg(4) etc. and make use of function pointers and
   pf_proto_register() to hook carp into the network stack.
   
   Currently, because of the uncertainty about whether the unload path is free
   of race condition panics, unloads are disallowed by default.  Compiling with
   CARPMOD_CAN_UNLOAD in CFLAGS removes this anti foot shooting measure.

Wouldn't it be better to allow unload only if there are no carp(4)
interfaces? I'd be glad to destroy my carp interfaces before unloading
the module, but recompiling the kernel to unload it? Not so much.

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


pgp5qhokYFKRK.pgp
Description: PGP signature


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

2010-08-11 Thread Kostik Belousov
On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote:
 2010/8/11 Kostik Belousov kostik...@gmail.com:
  On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
  2010/8/11 Kostik Belousov kostik...@gmail.com:
   On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
   Author: attilio
   Date: Wed Aug 11 10:51:27 2010
   New Revision: 211176
   URL: http://svn.freebsd.org/changeset/base/211176
  
   Log:
     IPI handlers may run generally with interrupts disabled because they
     are served via an interrupt gate.
  
     However, that doesn't explicitly prevent preemption and thread
     migration thus scheduler pinning may be necessary in some handlers.
     Fix that.
  
   How the preemption is supposed to happen ? Aside from the explicit
   calls to mi_switch() from e.g. critical_exit().
 
  IIRC it should be hardclock() willing to schedule the softclock(). It
  is the critical_exit() in the thread_unlock() that may trigger it
  (sorry for not digging more, it was a while back that I hacked this
  part, but I guess you can verify on your own).
  We already have other points within the kernel that take care of
  dealing with preemption/migration like lapic_handle_timer(), for
  example.
 
  Right, and if the interrupts are indeed disabled, I do not see how
  the preemption may be triggered in the fragments like
         cpu = PCPU_GET(cpuid);
         cpumask = PCPU_GET(cpumask);
 
 I don't recall all the details and I have no time to dig now. However,
 also spinlock_enter() does disable explicitly preemption via
 critical_enter() after have disabled the interrupts.
 Let me CC jhb as he implemented spinlock_enter() and may have a clue
 about how preemption can happen with interrupts disabled.

spinlock_enter() disables preemption to handle the recursive
calls to spinlock_enter/leave, I think, to prevent switch on
leave.

I do understand the reason for your change.


pgpYlfGhTwWSx.pgp
Description: PGP signature


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

2010-08-11 Thread Kostik Belousov
On Wed, Aug 11, 2010 at 05:46:46PM +0300, Kostik Belousov wrote:
 On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote:
  2010/8/11 Kostik Belousov kostik...@gmail.com:
   On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
   2010/8/11 Kostik Belousov kostik...@gmail.com:
On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
Author: attilio
Date: Wed Aug 11 10:51:27 2010
New Revision: 211176
URL: http://svn.freebsd.org/changeset/base/211176
   
Log:
  IPI handlers may run generally with interrupts disabled because they
  are served via an interrupt gate.
   
  However, that doesn't explicitly prevent preemption and thread
  migration thus scheduler pinning may be necessary in some handlers.
  Fix that.
   
How the preemption is supposed to happen ? Aside from the explicit
calls to mi_switch() from e.g. critical_exit().
  
   IIRC it should be hardclock() willing to schedule the softclock(). It
   is the critical_exit() in the thread_unlock() that may trigger it
   (sorry for not digging more, it was a while back that I hacked this
   part, but I guess you can verify on your own).
   We already have other points within the kernel that take care of
   dealing with preemption/migration like lapic_handle_timer(), for
   example.
  
   Right, and if the interrupts are indeed disabled, I do not see how
   the preemption may be triggered in the fragments like
          cpu = PCPU_GET(cpuid);
          cpumask = PCPU_GET(cpumask);
  
  I don't recall all the details and I have no time to dig now. However,
  also spinlock_enter() does disable explicitly preemption via
  critical_enter() after have disabled the interrupts.
  Let me CC jhb as he implemented spinlock_enter() and may have a clue
  about how preemption can happen with interrupts disabled.
 
 spinlock_enter() disables preemption to handle the recursive
 calls to spinlock_enter/leave, I think, to prevent switch on
 leave.
 
 I do understand the reason for your change.
do _not_ understand. sorry.




pgpYGW9PCnRap.pgp
Description: PGP signature


svn commit: r211177 - head/tools/regression/fstest/tests

2010-08-11 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Aug 11 16:29:12 2010
New Revision: 211177
URL: http://svn.freebsd.org/changeset/base/211177

Log:
  Instead of hardcoding {NAME_MAX} as 255 and {PATH_MAX} as 1024 obtain those 
from
  pathconf(2) and properly generate too long file names.
  This should fix ENAMETOOLONG checks on Linux.

Modified:
  head/tools/regression/fstest/tests/misc.sh

Modified: head/tools/regression/fstest/tests/misc.sh
==
--- head/tools/regression/fstest/tests/misc.sh  Wed Aug 11 10:51:27 2010
(r211176)
+++ head/tools/regression/fstest/tests/misc.sh  Wed Aug 11 16:29:12 2010
(r211177)
@@ -2,13 +2,6 @@
 
 ntest=1
 
-name253=_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12
-name255=${name253}34
-name256=${name255}5
-path1021=${name255}/${name255}/${name255}/${name253}
-path1023=${path1021}/x
-path1024=${path1023}x
-
 case ${dir} in
 /*)
maindir=${dir}/../..
@@ -99,6 +92,52 @@ namegen()
echo fstest_`dd if=/dev/urandom bs=1k count=1 2/dev/null | openssl 
md5`
 }
 
+namegen_len()
+{
+   len=${1}
+
+   name=
+   while :; do
+   namepart=`dd if=/dev/urandom bs=64 count=1 2/dev/null | 
openssl md5`
+   name=${name}${namepart}
+   curlen=`printf %s ${name} | wc -c`
+   [ ${curlen} -lt ${len} ] || break
+   done
+   name=`echo ${name} | cut -b -${len}`
+   printf %s ${name}
+}
+
+# POSIX:
+# {NAME_MAX}
+# Maximum number of bytes in a filename (not including terminating null).
+namegen_max()
+{
+   name_max=`${fstest} pathconf . _PC_NAME_MAX`
+   namegen_len ${name_max}
+}
+
+# POSIX:
+# {PATH_MAX}
+# Maximum number of bytes in a pathname, including the terminating null 
character.
+dirgen_max()
+{
+   name_max=`${fstest} pathconf . _PC_NAME_MAX`
+   complen=$((name_max/2))
+   path_max=`${fstest} pathconf . _PC_PATH_MAX`
+   # ...including the terminating null character.
+   path_max=$((path_max-1))
+
+   name=
+   while :; do
+   name=${name}`namegen_len ${complen}`/
+   curlen=`printf %s ${name} | wc -c`
+   [ ${curlen} -lt ${path_max} ] || break
+   done
+   name=`echo ${name} | cut -b -${path_max}`
+   name=`echo ${name} | sed -E 's@/$...@x@'`
+   printf %s ${name}
+}
+
 quick_exit()
 {
echo 1..1
___
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: r211178 - in head/tools/regression/fstest/tests: chflags chmod chown link mkdir mkfifo mknod open rename rmdir symlink truncate unlink

2010-08-11 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Aug 11 16:33:17 2010
New Revision: 211178
URL: http://svn.freebsd.org/changeset/base/211178

Log:
  Make use of recently added dirgen_max() and namegen_max() to implement
  ENAMETOOLONG checks.

Modified:
  head/tools/regression/fstest/tests/chflags/02.t
  head/tools/regression/fstest/tests/chflags/03.t
  head/tools/regression/fstest/tests/chmod/02.t
  head/tools/regression/fstest/tests/chmod/03.t
  head/tools/regression/fstest/tests/chown/02.t
  head/tools/regression/fstest/tests/chown/03.t
  head/tools/regression/fstest/tests/link/02.t
  head/tools/regression/fstest/tests/link/03.t
  head/tools/regression/fstest/tests/mkdir/02.t
  head/tools/regression/fstest/tests/mkdir/03.t
  head/tools/regression/fstest/tests/mkfifo/02.t
  head/tools/regression/fstest/tests/mkfifo/03.t
  head/tools/regression/fstest/tests/mknod/02.t
  head/tools/regression/fstest/tests/mknod/03.t
  head/tools/regression/fstest/tests/open/02.t
  head/tools/regression/fstest/tests/open/03.t
  head/tools/regression/fstest/tests/rename/01.t
  head/tools/regression/fstest/tests/rename/02.t
  head/tools/regression/fstest/tests/rmdir/02.t
  head/tools/regression/fstest/tests/rmdir/03.t
  head/tools/regression/fstest/tests/symlink/02.t
  head/tools/regression/fstest/tests/symlink/03.t
  head/tools/regression/fstest/tests/truncate/02.t
  head/tools/regression/fstest/tests/truncate/03.t
  head/tools/regression/fstest/tests/unlink/02.t
  head/tools/regression/fstest/tests/unlink/03.t

Modified: head/tools/regression/fstest/tests/chflags/02.t
==
--- head/tools/regression/fstest/tests/chflags/02.t Wed Aug 11 16:29:12 
2010(r211177)
+++ head/tools/regression/fstest/tests/chflags/02.t Wed Aug 11 16:33:17 
2010(r211178)
@@ -1,18 +1,28 @@
 #!/bin/sh
 # $FreeBSD$
 
-desc=chflags returns ENAMETOOLONG if a component of a pathname exceeded 255 
characters
+desc=chflags returns ENAMETOOLONG if a component of a pathname exceeded 
{NAME_MAX} characters
 
 dir=`dirname $0`
 . ${dir}/../misc.sh
 
 require chflags
 
-echo 1..6
+echo 1..12
 
-expect 0 create ${name255} 0644
-expect 0 chflags ${name255} SF_IMMUTABLE
-expect SF_IMMUTABLE stat ${name255} flags
-expect 0 chflags ${name255} none
-expect 0 unlink ${name255}
-expect ENAMETOOLONG chflags ${name256} SF_IMMUTABLE
+nx=`namegen_max`
+nxx=${nx}x
+
+expect 0 create ${nx} 0644
+expect 0 chflags ${nx} SF_IMMUTABLE
+expect SF_IMMUTABLE stat ${nx} flags
+expect 0 chflags ${nx} none
+expect 0 unlink ${nx}
+expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE
+
+expect 0 create ${nx} 0644
+expect 0 lchflags ${nx} SF_IMMUTABLE
+expect SF_IMMUTABLE stat ${nx} flags
+expect 0 lchflags ${nx} none
+expect 0 unlink ${nx}
+expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE

Modified: head/tools/regression/fstest/tests/chflags/03.t
==
--- head/tools/regression/fstest/tests/chflags/03.t Wed Aug 11 16:29:12 
2010(r211177)
+++ head/tools/regression/fstest/tests/chflags/03.t Wed Aug 11 16:33:17 
2010(r211178)
@@ -1,25 +1,32 @@
 #!/bin/sh
 # $FreeBSD$
 
-desc=chflags returns ENAMETOOLONG if an entire path name exceeded 1023 
characters
+desc=chflags returns ENAMETOOLONG if an entire path name exceeded {PATH_MAX} 
characters
 
 dir=`dirname $0`
 . ${dir}/../misc.sh
 
 require chflags
 
-echo 1..13
+echo 1..12
 
-expect 0 mkdir ${name255} 0755
-expect 0 mkdir ${name255}/${name255} 0755
-expect 0 mkdir ${name255}/${name255}/${name255} 0755
-expect 0 mkdir ${path1021} 0755
-expect 0 create ${path1023} 0644
-expect 0 chflags ${path1023} SF_IMMUTABLE
-expect 0 chflags ${path1023} none
-expect 0 unlink ${path1023}
-expect ENAMETOOLONG chflags ${path1024} SF_IMMUTABLE
-expect 0 rmdir ${path1021}
-expect 0 rmdir ${name255}/${name255}/${name255}
-expect 0 rmdir ${name255}/${name255}
-expect 0 rmdir ${name255}
+nx=`dirgen_max`
+nxx=${nx}x
+
+mkdir -p ${nx%/*}
+
+expect 0 create ${nx} 0644
+expect 0 chflags ${nx} SF_IMMUTABLE
+expect SF_IMMUTABLE stat ${nx} flags
+expect 0 chflags ${nx} none
+expect 0 unlink ${nx}
+expect ENAMETOOLONG chflags ${nxx} SF_IMMUTABLE
+
+expect 0 create ${nx} 0644
+expect 0 lchflags ${nx} SF_IMMUTABLE
+expect SF_IMMUTABLE stat ${nx} flags
+expect 0 lchflags ${nx} none
+expect 0 unlink ${nx}
+expect ENAMETOOLONG lchflags ${nxx} SF_IMMUTABLE
+
+rm -rf ${nx%%/*}

Modified: head/tools/regression/fstest/tests/chmod/02.t
==
--- head/tools/regression/fstest/tests/chmod/02.t   Wed Aug 11 16:29:12 
2010(r211177)
+++ head/tools/regression/fstest/tests/chmod/02.t   Wed Aug 11 16:33:17 
2010(r211178)
@@ -1,15 +1,24 @@
 #!/bin/sh
 # $FreeBSD$
 
-desc=chmod returns ENAMETOOLONG if a component of a pathname exceeded 255 
characters
+desc=chmod returns ENAMETOOLONG if a component of a pathname exceeded 
{NAME_MAX} 

svn commit: r211179 - head/tools/regression/fstest/tests

2010-08-11 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Aug 11 16:34:26 2010
New Revision: 211179
URL: http://svn.freebsd.org/changeset/base/211179

Log:
  Move create_file() to misc.sh, as it is going to be used in more places.

Modified:
  head/tools/regression/fstest/tests/misc.sh

Modified: head/tools/regression/fstest/tests/misc.sh
==
--- head/tools/regression/fstest/tests/misc.sh  Wed Aug 11 16:33:17 2010
(r211178)
+++ head/tools/regression/fstest/tests/misc.sh  Wed Aug 11 16:34:26 2010
(r211179)
@@ -174,3 +174,38 @@ require()
fi
quick_exit
 }
+
+create_file() {
+   type=${1}
+   name=${2}
+   uid=${3}
+   gid=${4}
+
+   case ${type} in
+   none)
+   return
+   ;;
+   regular)
+   expect 0 create ${name} 0644
+   ;;
+   dir)
+   expect 0 mkdir ${name} 0755
+   ;;
+   fifo)
+   expect 0 mkfifo ${name} 0644
+   ;;
+   block)
+   expect 0 mknod ${name} b 0644 1 2
+   ;;
+   char)
+   expect 0 mknod ${name} c 0644 1 2
+   ;;
+   socket)
+   expect 0 bind ${name}
+   ;;
+   symlink)
+   expect 0 symlink test ${name}
+   ;;
+   esac
+   expect 0 lchown ${name} ${uid} ${gid}
+}
___
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: r211180 - in head/tools/regression/fstest/tests: chflags chown link rename

2010-08-11 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Aug 11 16:34:44 2010
New Revision: 211180
URL: http://svn.freebsd.org/changeset/base/211180

Log:
  More and more tests.

Modified:
  head/tools/regression/fstest/tests/chflags/00.t
  head/tools/regression/fstest/tests/chflags/10.t
  head/tools/regression/fstest/tests/chflags/11.t
  head/tools/regression/fstest/tests/chown/00.t
  head/tools/regression/fstest/tests/link/00.t
  head/tools/regression/fstest/tests/rename/09.t
  head/tools/regression/fstest/tests/rename/10.t
  head/tools/regression/fstest/tests/rename/21.t

Modified: head/tools/regression/fstest/tests/chflags/00.t
==
--- head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 16:34:26 
2010(r211179)
+++ head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 16:34:44 
2010(r211180)
@@ -14,14 +14,14 @@ FreeBSD:UFS)
userflags=UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
systemflags=SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
 
-   echo 1..247
+   echo 1..780
;;
 FreeBSD:ZFS)
allflags=UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
userflags=UF_NODUMP
systemflags=SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
 
-   echo 1..167
+   echo 1..520
;;
 *)
quick_exit
@@ -36,41 +36,39 @@ expect 0 mkdir ${n2} 0755
 cdir=`pwd`
 cd ${n2}
 
-expect 0 create ${n0} 0644
-expect none stat ${n0} flags
-expect 0 chflags ${n0} ${allflags}
-expect ${allflags} stat ${n0} flags
-expect 0 chflags ${n0} ${userflags}
-expect ${userflags} stat ${n0} flags
-expect 0 chflags ${n0} ${systemflags}
-expect ${systemflags} stat ${n0} flags
-expect 0 chflags ${n0} none
-expect none stat ${n0} flags
-expect 0 unlink ${n0}
-
-expect 0 mkdir ${n0} 0644
-expect none stat ${n0} flags
-expect 0 chflags ${n0} ${allflags}
-expect ${allflags} stat ${n0} flags
-expect 0 chflags ${n0} ${userflags}
-expect ${userflags} stat ${n0} flags
-expect 0 chflags ${n0} ${systemflags}
-expect ${systemflags} stat ${n0} flags
-expect 0 chflags ${n0} none
-expect none stat ${n0} flags
-expect 0 rmdir ${n0}
-
-expect 0 mkfifo ${n0} 0644
-expect none stat ${n0} flags
-expect 0 chflags ${n0} ${allflags}
-expect ${allflags} stat ${n0} flags
-expect 0 chflags ${n0} ${userflags}
-expect ${userflags} stat ${n0} flags
-expect 0 chflags ${n0} ${systemflags}
-expect ${systemflags} stat ${n0} flags
-expect 0 chflags ${n0} none
-expect none stat ${n0} flags
-expect 0 unlink ${n0}
+for type in regular dir fifo block char socket; do
+   create_file ${type} ${n0} 0 0
+   expect none stat ${n0} flags
+   expect 0 chflags ${n0} ${allflags}
+   expect ${allflags} stat ${n0} flags
+   expect 0 chflags ${n0} ${userflags}
+   expect ${userflags} stat ${n0} flags
+   expect 0 chflags ${n0} ${systemflags}
+   expect ${systemflags} stat ${n0} flags
+   expect 0 chflags ${n0} none
+   expect none stat ${n0} flags
+   if [ ${type} = dir ]; then
+   expect 0 rmdir ${n0}
+   else
+   expect 0 unlink ${n0}
+   fi
+
+   create_file ${type} ${n0} 0 0
+   expect none stat ${n0} flags
+   expect 0 lchflags ${n0} ${allflags}
+   expect ${allflags} stat ${n0} flags
+   expect 0 lchflags ${n0} ${userflags}
+   expect ${userflags} stat ${n0} flags
+   expect 0 lchflags ${n0} ${systemflags}
+   expect ${systemflags} stat ${n0} flags
+   expect 0 lchflags ${n0} none
+   expect none stat ${n0} flags
+   if [ ${type} = dir ]; then
+   expect 0 rmdir ${n0}
+   else
+   expect 0 unlink ${n0}
+   fi
+done
 
 expect 0 create ${n0} 0644
 expect 0 symlink ${n0} ${n1}
@@ -111,86 +109,70 @@ expect 0 unlink ${n1}
 expect 0 unlink ${n0}
 
 # successful chflags(2) updates ctime.
-expect 0 create ${n0} 0644
-for flag in `echo ${allflags},none | tr ',' ' '`; do
-   ctime1=`${fstest} stat ${n0} ctime`
-   sleep 1
-   expect 0 chflags ${n0} ${flag}
-   ctime2=`${fstest} stat ${n0} ctime`
-   test_check $ctime1 -lt $ctime2
+for type in regular dir fifo block char socket symlink; do
+   if [ ${type} != symlink ]; then
+   create_file ${type} ${n0} 0 0
+   for flag in `echo ${allflags},none | tr ',' ' '`; do
+   ctime1=`${fstest} stat ${n0} ctime`
+   sleep 1
+   expect 0 chflags ${n0} ${flag}
+   ctime2=`${fstest} stat ${n0} ctime`
+   test_check $ctime1 -lt $ctime2
+   done
+   if [ ${type} = dir ]; then
+   expect 0 rmdir ${n0}
+   else
+   expect 0 unlink ${n0}
+   fi
+   fi
+
+   create_file ${type} ${n0} 0 0
+   for flag in `echo ${allflags},none | tr ',' ' '`; do
+   ctime1=`${fstest} lstat ${n0} ctime`
+   sleep 1
+   expect 

svn commit: r211181 - head/sys/opencrypto

2010-08-11 Thread John Baldwin
Author: jhb
Date: Wed Aug 11 16:53:45 2010
New Revision: 211181
URL: http://svn.freebsd.org/changeset/base/211181

Log:
  Fix typo in comment.

Modified:
  head/sys/opencrypto/cryptodev.c

Modified: head/sys/opencrypto/cryptodev.c
==
--- head/sys/opencrypto/cryptodev.c Wed Aug 11 16:34:44 2010
(r211180)
+++ head/sys/opencrypto/cryptodev.c Wed Aug 11 16:53:45 2010
(r211181)
@@ -506,7 +506,7 @@ cryptof_ioctl(
}
}
 
-   /* NB: CIOGSESSION2 has the crid */
+   /* NB: CIOCGSESSION2 has the crid */
if (cmd == CIOCGSESSION2
 #ifdef COMPAT_FREEBSD32
|| cmd == CIOCGSESSION232
___
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: r211182 - head/sys/dev/iscsi/initiator

2010-08-11 Thread John Baldwin
Author: jhb
Date: Wed Aug 11 16:56:38 2010
New Revision: 211182
URL: http://svn.freebsd.org/changeset/base/211182

Log:
  Do not use %z to print a time_t.  Fixes build on architectures where time_t
  and size_t are different types.

Modified:
  head/sys/dev/iscsi/initiator/iscsi.c

Modified: head/sys/dev/iscsi/initiator/iscsi.c
==
--- head/sys/dev/iscsi/initiator/iscsi.cWed Aug 11 16:53:45 2010
(r211181)
+++ head/sys/dev/iscsi/initiator/iscsi.cWed Aug 11 16:56:38 2010
(r211182)
@@ -306,11 +306,11 @@ iscsi_read(struct cdev *dev, struct uio 
  int   i = 0;
  struct socket *so = sp-soc;
 #define pukeit(i, pq) do {\
-  sprintf(buf, %03d] %06x %02x %06x %06x %zd\n,\
+  sprintf(buf, %03d] %06x %02x %06x %06x %jd\n,\
   i, ntohl(pq-pdu.ipdu.bhs.CmdSN),\
   pq-pdu.ipdu.bhs.opcode, ntohl(pq-pdu.ipdu.bhs.itt),\
   ntohl(pq-pdu.ipdu.bhs.ExpStSN),\
-  pq-ts.sec);\
+  (intmax_t)pq-ts.sec);\
   } while(0)
 
  sprintf(buf, %d/%d / hld -/\n, sp-stats.nhld, 
sp-stats.max_hld);
___
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: r211176 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread Attilio Rao
2010/8/11 Kostik Belousov kostik...@gmail.com:
 On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote:
 2010/8/11 Kostik Belousov kostik...@gmail.com:
  On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
  2010/8/11 Kostik Belousov kostik...@gmail.com:
   On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
   Author: attilio
   Date: Wed Aug 11 10:51:27 2010
   New Revision: 211176
   URL: http://svn.freebsd.org/changeset/base/211176
  
   Log:
     IPI handlers may run generally with interrupts disabled because they
     are served via an interrupt gate.
  
     However, that doesn't explicitly prevent preemption and thread
     migration thus scheduler pinning may be necessary in some handlers.
     Fix that.
  
   How the preemption is supposed to happen ? Aside from the explicit
   calls to mi_switch() from e.g. critical_exit().
 
  IIRC it should be hardclock() willing to schedule the softclock(). It
  is the critical_exit() in the thread_unlock() that may trigger it
  (sorry for not digging more, it was a while back that I hacked this
  part, but I guess you can verify on your own).
  We already have other points within the kernel that take care of
  dealing with preemption/migration like lapic_handle_timer(), for
  example.
 
  Right, and if the interrupts are indeed disabled, I do not see how
  the preemption may be triggered in the fragments like
         cpu = PCPU_GET(cpuid);
         cpumask = PCPU_GET(cpumask);

 I don't recall all the details and I have no time to dig now. However,
 also spinlock_enter() does disable explicitly preemption via
 critical_enter() after have disabled the interrupts.
 Let me CC jhb as he implemented spinlock_enter() and may have a clue
 about how preemption can happen with interrupts disabled.

 spinlock_enter() disables preemption to handle the recursive
 calls to spinlock_enter/leave, I think, to prevent switch on
 leave.

No.
Please look at how spinlock_enter() is implemented in ia32/amd64 in
order to see how it does handle recursion.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211176 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread Attilio Rao
2010/8/11 Attilio Rao atti...@freebsd.org:
 2010/8/11 Kostik Belousov kostik...@gmail.com:
 On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote:
 2010/8/11 Kostik Belousov kostik...@gmail.com:
  On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
  2010/8/11 Kostik Belousov kostik...@gmail.com:
   On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
   Author: attilio
   Date: Wed Aug 11 10:51:27 2010
   New Revision: 211176
   URL: http://svn.freebsd.org/changeset/base/211176
  
   Log:
     IPI handlers may run generally with interrupts disabled because they
     are served via an interrupt gate.
  
     However, that doesn't explicitly prevent preemption and thread
     migration thus scheduler pinning may be necessary in some handlers.
     Fix that.
  
   How the preemption is supposed to happen ? Aside from the explicit
   calls to mi_switch() from e.g. critical_exit().
 
  IIRC it should be hardclock() willing to schedule the softclock(). It
  is the critical_exit() in the thread_unlock() that may trigger it
  (sorry for not digging more, it was a while back that I hacked this
  part, but I guess you can verify on your own).
  We already have other points within the kernel that take care of
  dealing with preemption/migration like lapic_handle_timer(), for
  example.
 
  Right, and if the interrupts are indeed disabled, I do not see how
  the preemption may be triggered in the fragments like
         cpu = PCPU_GET(cpuid);
         cpumask = PCPU_GET(cpumask);

 I don't recall all the details and I have no time to dig now. However,
 also spinlock_enter() does disable explicitly preemption via
 critical_enter() after have disabled the interrupts.
 Let me CC jhb as he implemented spinlock_enter() and may have a clue
 about how preemption can happen with interrupts disabled.

 spinlock_enter() disables preemption to handle the recursive
 calls to spinlock_enter/leave, I think, to prevent switch on
 leave.

 No.
 Please look at how spinlock_enter() is implemented in ia32/amd64 in
 order to see how it does handle recursion.

And besides we have other patterns running with interrupts disabled
taking care of preemption as well (I think I already pointed to one, I
think you could find others easilly).

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211149 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread John Baldwin

Attilio Rao wrote:

Author: attilio
Date: Tue Aug 10 16:14:10 2010
New Revision: 211149
URL: http://svn.freebsd.org/changeset/base/211149

Log:
  Fix some places that may use cpumask_t while they still use 'int' types.
  While there, also fix some places assuming cpu type is 'int' while
  u_int is really meant.
  
  Note: this will also fix some possible races in per-cpu data accessings

  to be addressed in further commits.
  
  In collabouration with:	Yahoo! Incorporated (via sbruno and peter)

  Tested by:gianni
  MFC after:1 month


Ugh, I have a much larger patch for all architectures in p4 that I was 
doing universe builds on yesterday that this conflicts with.  I will 
commit my other patch shortly.


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


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

2010-08-11 Thread John Baldwin

Attilio Rao wrote:

Author: attilio
Date: Wed Aug 11 10:51:27 2010
New Revision: 211176
URL: http://svn.freebsd.org/changeset/base/211176

Log:
  IPI handlers may run generally with interrupts disabled because they
  are served via an interrupt gate.
  
  However, that doesn't explicitly prevent preemption and thread

  migration thus scheduler pinning may be necessary in some handlers.
  Fix that.
  
  Tested by:	gianni

  MFC after:1 month


Actually that does prevent preemption if you do not call any code that 
would schedule a thread.  I think this change is all safe to revert.


--
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: r211183 - in head/tools/tools/vhba: . mptest

2010-08-11 Thread Matt Jacob
Author: mjacob
Date: Wed Aug 11 17:25:14 2010
New Revision: 211183
URL: http://svn.freebsd.org/changeset/base/211183

Log:
  Consistently set us to be SPC3 for our inquiry data.
  
  For mptest, add delays to I/O that simulate real disks better. This
  also allows us to simulate what happens when a device goes away
  with active transactions. It's pretty spectacular.
  
  Sponsored by: Panasas
  MFC after:1 month

Modified:
  head/tools/tools/vhba/mptest/vhba_mptest.c
  head/tools/tools/vhba/vhba.c

Modified: head/tools/tools/vhba/mptest/vhba_mptest.c
==
--- head/tools/tools/vhba/mptest/vhba_mptest.c  Wed Aug 11 16:56:38 2010
(r211182)
+++ head/tools/tools/vhba/mptest/vhba_mptest.c  Wed Aug 11 17:25:14 2010
(r211183)
@@ -31,6 +31,17 @@
 #include vhba.h
 #include sys/sysctl.h
 
+static int vhba_stop_lun;
+static int vhba_start_lun = 0;
+static int vhba_notify_stop = 1;
+static int vhba_notify_start = 1;
+static int vhba_inject_hwerr = 0;
+SYSCTL_INT(_debug, OID_AUTO, vhba_stop_lun, CTLFLAG_RW, vhba_stop_lun, 0, 
stop lun bitmap);
+SYSCTL_INT(_debug, OID_AUTO, vhba_start_lun, CTLFLAG_RW, vhba_start_lun, 0, 
start lun bitmap);
+SYSCTL_INT(_debug, OID_AUTO, vhba_notify_stop, CTLFLAG_RW, vhba_notify_stop, 
1, notify when luns go away);
+SYSCTL_INT(_debug, OID_AUTO, vhba_notify_start, CTLFLAG_RW, 
vhba_notify_start, 1, notify when luns arrive);
+SYSCTL_INT(_debug, OID_AUTO, vhba_inject_hwerr, CTLFLAG_RW, 
vhba_inject_hwerr, 0, inject hardware error on lost luns);
+
 #defineMAX_TGT 1
 #defineMAX_LUN 2
 #defineVMP_TIMEhz
@@ -49,8 +60,11 @@ typedef struct {
int luns[2];
struct callout  tick;
struct task qt;
+   TAILQ_HEAD(, ccb_hdr)   inproc;
+   int nact, nact_high;
 } mptest_t;
 
+static timeout_t vhba_iodelay;
 static timeout_t vhba_timer;
 static void vhba_task(void *, int);
 static void mptest_act(mptest_t *, struct ccb_scsiio *);
@@ -59,13 +73,17 @@ void
 vhba_init(vhba_softc_t *vhba)
 {
static mptest_t vhbastatic;
+
vhbastatic.vhba = vhba;
vhbastatic.disk_size = DISK_SIZE  20;
vhbastatic.disk = malloc(vhbastatic.disk_size, M_DEVBUF, 
M_WAITOK|M_ZERO);
vhba-private = vhbastatic;
callout_init_mtx(vhbastatic.tick, vhba-lock, 0);
callout_reset(vhbastatic.tick, VMP_TIME, vhba_timer, vhba);
+   TAILQ_INIT(vhbastatic.inproc);
TASK_INIT(vhbastatic.qt, 0, vhba_task, vhbastatic);
+   vhbastatic.luns[0] = 1;
+   vhbastatic.luns[1] = 1;
 }
 
 void
@@ -89,15 +107,23 @@ vhba_task(void *arg, int pending)
 {
mptest_t *vhbas = arg;
struct ccb_hdr *ccbh;
+   int nadded = 0;
 
mtx_lock(vhbas-vhba-lock);
while ((ccbh = TAILQ_FIRST(vhbas-vhba-actv)) != NULL) {
TAILQ_REMOVE(vhbas-vhba-actv, ccbh, sim_links.tqe);
 mptest_act(vhbas, (struct ccb_scsiio *)ccbh);
+   nadded++;
+   ccbh-sim_priv.entries[0].ptr = vhbas;
+   callout_handle_init(ccbh-timeout_ch);
}
-   while ((ccbh = TAILQ_FIRST(vhbas-vhba-done)) != NULL) {
-   TAILQ_REMOVE(vhbas-vhba-done, ccbh, sim_links.tqe);
-   xpt_done((union ccb *)ccbh);
+   if (nadded) {
+   vhba_kick(vhbas-vhba);
+   } else {
+   while ((ccbh = TAILQ_FIRST(vhbas-vhba-done)) != NULL) {
+   TAILQ_REMOVE(vhbas-vhba-done, ccbh, sim_links.tqe);
+   xpt_done((union ccb *)ccbh);
+   }
}
mtx_unlock(vhbas-vhba-lock);
 }
@@ -108,10 +134,10 @@ mptest_act(mptest_t *vhbas, struct ccb_s
char junk[128];
cam_status camstatus;
uint8_t *cdb, *ptr, status;
-   uint32_t data_len;
+   uint32_t data_len, blkcmd;
uint64_t off;

-   data_len = 0;
+   blkcmd = data_len = 0;
status = SCSI_STATUS_OK;
 
memset(csio-sense_data, 0, sizeof (csio-sense_data));
@@ -122,6 +148,11 @@ mptest_act(mptest_t *vhbas, struct ccb_s
TAILQ_INSERT_TAIL(vhbas-vhba-done, csio-ccb_h, 
sim_links.tqe);
return;
}
+   if (vhba_inject_hwerr  csio-ccb_h.target_lun  MAX_LUN  
vhbas-luns[csio-ccb_h.target_lun] == 0) {
+   vhba_fill_sense(csio, SSD_KEY_HARDWARE_ERROR, 0x44, 0x0);
+   TAILQ_INSERT_TAIL(vhbas-vhba-done, csio-ccb_h, 
sim_links.tqe);
+   return;
+   }
if ((csio-ccb_h.target_lun = MAX_LUN || 
vhbas-luns[csio-ccb_h.target_lun] == 0)  cdb[0] != INQUIRY  cdb[0] != 
REPORT_LUNS  cdb[0] != REQUEST_SENSE) {
vhba_fill_sense(csio, SSD_KEY_ILLEGAL_REQUEST, 0x25, 0x0);
TAILQ_INSERT_TAIL(vhbas-vhba-done, csio-ccb_h, 
sim_links.tqe);
@@ -284,6 +315,11 @@ mptest_act(mptest_t *vhbas, struct ccb_s
vhba_fill_sense(csio, 

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

2010-08-11 Thread Attilio Rao
2010/8/11 John Baldwin j...@freebsd.org:
 Attilio Rao wrote:

 Author: attilio
 Date: Wed Aug 11 10:51:27 2010
 New Revision: 211176
 URL: http://svn.freebsd.org/changeset/base/211176

 Log:
  IPI handlers may run generally with interrupts disabled because they
  are served via an interrupt gate.
    However, that doesn't explicitly prevent preemption and thread
  migration thus scheduler pinning may be necessary in some handlers.
  Fix that.
    Tested by:  gianni
  MFC after:    1 month

 Actually that does prevent preemption if you do not call any code that would
 schedule a thread.  I think this change is all safe to revert.

Do you recall, then, why lapic_handle_timer() does critical section?
It seems to be catered by interrupt gate as well, and I don't see any
point re-enabling them explicitly.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211149 - in head/sys: amd64/amd64 i386/i386

2010-08-11 Thread Attilio Rao
2010/8/11 John Baldwin j...@freebsd.org:
 Attilio Rao wrote:

 Author: attilio
 Date: Tue Aug 10 16:14:10 2010
 New Revision: 211149
 URL: http://svn.freebsd.org/changeset/base/211149

 Log:
  Fix some places that may use cpumask_t while they still use 'int' types.
  While there, also fix some places assuming cpu type is 'int' while
  u_int is really meant.
    Note: this will also fix some possible races in per-cpu data accessings
  to be addressed in further commits.
    In collabouration with:     Yahoo! Incorporated (via sbruno and peter)
  Tested by:    gianni
  MFC after:    1 month

 Ugh, I have a much larger patch for all architectures in p4 that I was doing
 universe builds on yesterday that this conflicts with.  I will commit my
 other patch shortly.

Sorry, was unaware of that.
Let me know if you need assistance/have questions.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211184 - head/lib/libproc

2010-08-11 Thread Rui Paulo
Author: rpaulo
Date: Wed Aug 11 17:33:26 2010
New Revision: 211184
URL: http://svn.freebsd.org/changeset/base/211184

Log:
  Several fixes for libproc:
  o return the correct status in proc_wstatus()
  o proc_read takes a void *
  o correctly allocate the objs structure array
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/libproc/libproc.h
  head/lib/libproc/proc_bkpt.c
  head/lib/libproc/proc_rtld.c
  head/lib/libproc/proc_sym.c
  head/lib/libproc/proc_util.c

Modified: head/lib/libproc/libproc.h
==
--- head/lib/libproc/libproc.h  Wed Aug 11 17:25:14 2010(r211183)
+++ head/lib/libproc/libproc.h  Wed Aug 11 17:33:26 2010(r211184)
@@ -131,7 +131,7 @@ pid_t   proc_getpid(struct proc_handle *);
 intproc_wstatus(struct proc_handle *);
 intproc_getwstat(struct proc_handle *);
 char * proc_signame(int, char *, size_t);
-intproc_read(struct proc_handle *, char *, size_t, size_t);
+intproc_read(struct proc_handle *, void *, size_t, size_t);
 const lwpstatus_t *
proc_getlwpstatus(struct proc_handle *);
 void   proc_free(struct proc_handle *);

Modified: head/lib/libproc/proc_bkpt.c
==
--- head/lib/libproc/proc_bkpt.cWed Aug 11 17:25:14 2010
(r211183)
+++ head/lib/libproc/proc_bkpt.cWed Aug 11 17:33:26 2010
(r211184)
@@ -164,7 +164,8 @@ proc_bkptexec(struct proc_handle *phdl, 
warn(ERROR: ptrace step failed);
return (-1);
}
-   status = proc_wstatus(phdl);
+   proc_wstatus(phdl);
+   status = proc_getwstat(phdl);
if (!WIFSTOPPED(status)) {
warn(ERROR: don't know why process stopped);
return (-1);

Modified: head/lib/libproc/proc_rtld.c
==
--- head/lib/libproc/proc_rtld.cWed Aug 11 17:25:14 2010
(r211183)
+++ head/lib/libproc/proc_rtld.cWed Aug 11 17:33:26 2010
(r211184)
@@ -42,14 +42,13 @@ map_iter(const rd_loadobj_t *lop, void *
 {
struct proc_handle *phdl = arg;
 
-   phdl-nobjs++;
if (phdl-nobjs = phdl-rdobjsz) {
phdl-rdobjsz *= 2;
phdl-rdobjs = realloc(phdl-rdobjs, phdl-rdobjsz);
if (phdl-rdobjs == NULL)
return (-1);
}
-   memcpy(phdl-rdobjs[phdl-nobjs++], lop, sizeof(*phdl-rdobjs));
+   memcpy(phdl-rdobjs[phdl-nobjs++], lop, sizeof(*lop));
 
return (0);
 }
@@ -61,6 +60,7 @@ proc_rdagent(struct proc_handle *phdl)
phdl-status != PS_IDLE) {
if ((phdl-rdap = rd_new(phdl)) != NULL) {
phdl-rdobjs = malloc(sizeof(*phdl-rdobjs) * 64);
+   phdl-rdobjsz = 64;
if (phdl-rdobjs == NULL)
return (phdl-rdap);
rd_loadobj_iter(phdl-rdap, map_iter, phdl);
@@ -73,7 +73,8 @@ proc_rdagent(struct proc_handle *phdl)
 void
 proc_updatesyms(struct proc_handle *phdl)
 {
-   memset(phdl-rdobjs, 0, sizeof(*phdl-rdobjs) * phdl-rdobjsz);
+
+   memset(phdl-rdobjs, 0, sizeof(*phdl-rdobjs) * phdl-rdobjsz);
phdl-nobjs = 0;
rd_loadobj_iter(phdl-rdap, map_iter, phdl);
 }

Modified: head/lib/libproc/proc_sym.c
==
--- head/lib/libproc/proc_sym.c Wed Aug 11 17:25:14 2010(r211183)
+++ head/lib/libproc/proc_sym.c Wed Aug 11 17:33:26 2010(r211184)
@@ -110,14 +110,25 @@ proc_iter_objs(struct proc_handle *p, pr
rd_loadobj_t *rdl;
prmap_t map;
char path[MAXPATHLEN];
+   char last[MAXPATHLEN];
 
if (p-nobjs == 0)
return (-1);
+   memset(last, 0, sizeof(last));
for (i = 0; i  p-nobjs; i++) {
rdl = p-rdobjs[i];
proc_rdl2prmap(rdl, map);
basename_r(rdl-rdl_path, path);
+   /*
+* We shouldn't call the callback twice with the same object.
+* To do that we are assuming the fact that if there are
+* repeated object names (i.e. different mappings for the
+* same object) they occur next to each other.
+*/
+   if (strcmp(path, last) == 0)
+   continue;
(*func)(cd, map, path);
+   strlcpy(last, path, sizeof(last));
}
 
return (0);

Modified: head/lib/libproc/proc_util.c
==
--- head/lib/libproc/proc_util.cWed Aug 11 17:25:14 2010
(r211183)
+++ head/lib/libproc/proc_util.cWed Aug 11 17:33:26 2010
(r211184)
@@ -144,15 +144,17 @@ proc_wstatus(struct proc_handle *phdl)
 

svn commit: r211185 - head/tools/regression/fstest/tests

2010-08-11 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Aug 11 17:33:32 2010
New Revision: 211185
URL: http://svn.freebsd.org/changeset/base/211185

Log:
  Allow to specify uid, gid and mode for create_file().

Modified:
  head/tools/regression/fstest/tests/misc.sh

Modified: head/tools/regression/fstest/tests/misc.sh
==
--- head/tools/regression/fstest/tests/misc.sh  Wed Aug 11 17:33:26 2010
(r211184)
+++ head/tools/regression/fstest/tests/misc.sh  Wed Aug 11 17:33:32 2010
(r211185)
@@ -175,11 +175,14 @@ require()
quick_exit
 }
 
+# usage:
+#  create_file type name
+#  create_file type name mode
+#  create_file type name uid gid
+#  create_file type name mode uid gid
 create_file() {
type=${1}
name=${2}
-   uid=${3}
-   gid=${4}
 
case ${type} in
none)
@@ -207,5 +210,12 @@ create_file() {
expect 0 symlink test ${name}
;;
esac
-   expect 0 lchown ${name} ${uid} ${gid}
+   if [ -n ${3} -a -n ${4} -a -n ${5} ]; then
+   expect 0 lchmod ${name} ${3}
+   expect 0 lchown ${name} ${4} ${5}
+   elif [ -n ${3} -a -n ${4} ]; then
+   expect 0 lchown ${name} ${3} ${4}
+   elif [ -n ${3} ]; then
+   expect 0 lchmod ${name} ${3}
+   fi
 }
___
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: r211186 - in head/tools/regression/fstest/tests: chflags link mkdir open rename

2010-08-11 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Aug 11 17:34:58 2010
New Revision: 211186
URL: http://svn.freebsd.org/changeset/base/211186

Log:
  - Use loops where possible to avoid code duplication.
  - Don't pass uid and gid to create_file() if not needed.
  - More tests.

Modified:
  head/tools/regression/fstest/tests/chflags/00.t
  head/tools/regression/fstest/tests/chflags/10.t
  head/tools/regression/fstest/tests/chflags/11.t
  head/tools/regression/fstest/tests/link/00.t
  head/tools/regression/fstest/tests/mkdir/10.t
  head/tools/regression/fstest/tests/open/22.t
  head/tools/regression/fstest/tests/rename/00.t
  head/tools/regression/fstest/tests/rename/06.t
  head/tools/regression/fstest/tests/rename/07.t
  head/tools/regression/fstest/tests/rename/08.t
  head/tools/regression/fstest/tests/rename/13.t
  head/tools/regression/fstest/tests/rename/14.t
  head/tools/regression/fstest/tests/rename/15.t
  head/tools/regression/fstest/tests/rename/20.t

Modified: head/tools/regression/fstest/tests/chflags/00.t
==
--- head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 17:33:32 
2010(r211185)
+++ head/tools/regression/fstest/tests/chflags/00.t Wed Aug 11 17:34:58 
2010(r211186)
@@ -14,14 +14,14 @@ FreeBSD:UFS)
userflags=UF_NODUMP,UF_IMMUTABLE,UF_APPEND,UF_NOUNLINK,UF_OPAQUE
systemflags=SF_ARCHIVED,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
 
-   echo 1..780
+   echo 1..742
;;
 FreeBSD:ZFS)
allflags=UF_NODUMP,SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
userflags=UF_NODUMP
systemflags=SF_IMMUTABLE,SF_APPEND,SF_NOUNLINK
 
-   echo 1..520
+   echo 1..482
;;
 *)
quick_exit
@@ -37,7 +37,7 @@ cdir=`pwd`
 cd ${n2}
 
 for type in regular dir fifo block char socket; do
-   create_file ${type} ${n0} 0 0
+   create_file ${type} ${n0}
expect none stat ${n0} flags
expect 0 chflags ${n0} ${allflags}
expect ${allflags} stat ${n0} flags
@@ -53,7 +53,7 @@ for type in regular dir fifo block char 
expect 0 unlink ${n0}
fi
 
-   create_file ${type} ${n0} 0 0
+   create_file ${type} ${n0}
expect none stat ${n0} flags
expect 0 lchflags ${n0} ${allflags}
expect ${allflags} stat ${n0} flags
@@ -111,7 +111,7 @@ expect 0 unlink ${n0}
 # successful chflags(2) updates ctime.
 for type in regular dir fifo block char socket symlink; do
if [ ${type} != symlink ]; then
-   create_file ${type} ${n0} 0 0
+   create_file ${type} ${n0}
for flag in `echo ${allflags},none | tr ',' ' '`; do
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -126,7 +126,7 @@ for type in regular dir fifo block char 
fi
fi
 
-   create_file ${type} ${n0} 0 0
+   create_file ${type} ${n0}
for flag in `echo ${allflags},none | tr ',' ' '`; do
ctime1=`${fstest} lstat ${n0} ctime`
sleep 1
@@ -144,7 +144,7 @@ done
 # unsuccessful chflags(2) does not update ctime.
 for type in regular dir fifo block char socket symlink; do
if [ ${type} != symlink ]; then
-   create_file ${type} ${n0} 0 0
+   create_file ${type} ${n0}
for flag in `echo ${allflags},none | tr ',' ' '`; do
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
@@ -159,7 +159,7 @@ for type in regular dir fifo block char 
fi
fi
 
-   create_file ${type} ${n0} 0 0
+   create_file ${type} ${n0}
for flag in `echo ${allflags},none | tr ',' ' '`; do
ctime1=`${fstest} lstat ${n0} ctime`
sleep 1

Modified: head/tools/regression/fstest/tests/chflags/10.t
==
--- head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 17:33:32 
2010(r211185)
+++ head/tools/regression/fstest/tests/chflags/10.t Wed Aug 11 17:34:58 
2010(r211186)
@@ -8,7 +8,7 @@ dir=`dirname $0`
 
 require chflags
 
-echo 1..210
+echo 1..197
 
 n0=`namegen`
 n1=`namegen`
@@ -20,7 +20,7 @@ cd ${n0}
 
 for type in regular dir fifo block char socket symlink; do
if [ ${type} != symlink ]; then
-   create_file ${type} ${n1} 0 0
+   create_file ${type} ${n1}
expect 0 chown ${n1} 65534 65534
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
expect EPERM -u 65533 -g 65533 chflags ${n1} ${flag}
@@ -35,7 +35,7 @@ for type in regular dir fifo block char 
fi
fi
 
-   create_file ${type} ${n1} 0 0
+   create_file ${type} ${n1}
expect 0 lchown ${n1} 65534 65534
for flag in SF_IMMUTABLE SF_APPEND SF_NOUNLINK; do
expect EPERM -u 65533 -g 65533 lchflags ${n1} ${flag}


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

2010-08-11 Thread John Baldwin

Attilio Rao wrote:

2010/8/11 John Baldwin j...@freebsd.org:

Attilio Rao wrote:

Author: attilio
Date: Wed Aug 11 10:51:27 2010
New Revision: 211176
URL: http://svn.freebsd.org/changeset/base/211176

Log:
 IPI handlers may run generally with interrupts disabled because they
 are served via an interrupt gate.
   However, that doesn't explicitly prevent preemption and thread
 migration thus scheduler pinning may be necessary in some handlers.
 Fix that.
   Tested by:  gianni
 MFC after:1 month

Actually that does prevent preemption if you do not call any code that would
schedule a thread.  I think this change is all safe to revert.


Do you recall, then, why lapic_handle_timer() does critical section?
It seems to be catered by interrupt gate as well, and I don't see any
point re-enabling them explicitly.


Because hardclock() explicitly calls sched_add() via swi_sched() when 
scheduling the softclock swi.  The critical section there is just to 
ensure that the preemption to softclock happens after all of the clock 
interrupt handlers have finished.  However, PCPU_GET() does not call 
sched_add(), so it does not need to be protected.


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


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

2010-08-11 Thread Attilio Rao
2010/8/11 John Baldwin j...@freebsd.org:
 Attilio Rao wrote:

 2010/8/11 John Baldwin j...@freebsd.org:

 Attilio Rao wrote:

 Author: attilio
 Date: Wed Aug 11 10:51:27 2010
 New Revision: 211176
 URL: http://svn.freebsd.org/changeset/base/211176

 Log:
  IPI handlers may run generally with interrupts disabled because they
  are served via an interrupt gate.
   However, that doesn't explicitly prevent preemption and thread
  migration thus scheduler pinning may be necessary in some handlers.
  Fix that.
   Tested by:  gianni
  MFC after:    1 month

 Actually that does prevent preemption if you do not call any code that
 would
 schedule a thread.  I think this change is all safe to revert.

 Do you recall, then, why lapic_handle_timer() does critical section?
 It seems to be catered by interrupt gate as well, and I don't see any
 point re-enabling them explicitly.

 Because hardclock() explicitly calls sched_add() via swi_sched() when
 scheduling the softclock swi.  The critical section there is just to ensure
 that the preemption to softclock happens after all of the clock interrupt
 handlers have finished.  However, PCPU_GET() does not call sched_add(), so
 it does not need to be protected.

Oh, sorry, was looking at the -CURRENT code which had no explicit call
to hardclock (it uses the new timer infrastructure, so that was not so
obvious).

I understand now, so I will rever the change asap.

Thanks,
Attilio


-- 
Peace can only be achieved by understanding - A. Einstein
___
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: r211187 - in head/cddl/usr.bin: ctfconvert ctfdump ctfmerge

2010-08-11 Thread Rui Paulo
Author: rpaulo
Date: Wed Aug 11 18:00:45 2010
New Revision: 211187
URL: http://svn.freebsd.org/changeset/base/211187

Log:
  Add man pages for the CTF tools.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/cddl/usr.bin/ctfconvert/ctfconvert.1   (contents, props changed)
  head/cddl/usr.bin/ctfdump/ctfdump.1   (contents, props changed)
  head/cddl/usr.bin/ctfmerge/ctfmerge.1   (contents, props changed)
Modified:
  head/cddl/usr.bin/ctfconvert/Makefile
  head/cddl/usr.bin/ctfdump/Makefile
  head/cddl/usr.bin/ctfmerge/Makefile

Modified: head/cddl/usr.bin/ctfconvert/Makefile
==
--- head/cddl/usr.bin/ctfconvert/Makefile   Wed Aug 11 17:34:58 2010
(r211186)
+++ head/cddl/usr.bin/ctfconvert/Makefile   Wed Aug 11 18:00:45 2010
(r211187)
@@ -6,7 +6,6 @@
 DEBUG_FLAGS=   -g
 
 PROG=  ctfconvert
-NO_MAN=
 SRCS=  alist.c \
ctf.c \
ctfconvert.c \

Added: head/cddl/usr.bin/ctfconvert/ctfconvert.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/usr.bin/ctfconvert/ctfconvert.1   Wed Aug 11 18:00:45 2010
(r211187)
@@ -0,0 +1,85 @@
+.\
+.\ Copyright (c) 2010 The FreeBSD Foundation 
+.\ All rights reserved. 
+.\ 
+.\ This software was developed by Rui Paulo under sponsorship from the
+.\ FreeBSD Foundation. 
+.\  
+.\ Redistribution and use in source and binary forms, with or without 
+.\ modification, are permitted provided that the following conditions 
+.\ are met: 
+.\ 1. Redistributions of source code must retain the above copyright 
+.\notice, this list of conditions and the following disclaimer. 
+.\ 2. Redistributions in binary form must reproduce the above copyright 
+.\notice, this list of conditions and the following disclaimer in the 
+.\documentation and/or other materials provided with the distribution. 
+.\ 
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
+.\ SUCH DAMAGE. 
+.\
+.\ $FreeBSD$
+.\
+.Dd July 7, 2010
+.Dt CTFCONVERT 1
+.Os
+.Sh NAME
+.Nm ctfconvert
+.Nd convert debug data to CTF data
+.Sh SYNOPSIS
+.Nm
+.Op Fl gis
+.Fl l Ar label
+.Fl L Ar labelenv
+.Op Fl o Ar outfile
+object_file
+.Sh DESCRIPTION
+The
+.Nm
+utility converts debug information from a binary file to CTF data and replaces
+the debug section of that file with a CTF section called SUNW_ctf.
+This new section is added to the input file, unless the -o
+option is present.
+You can also opt to keep the original debugging section with the
+-g option.
+.Pp
+The following options are available:
+.Bl -tag -width indent
+.It Fl l Ar label
+Sets the label as
+.Ar label .
+.It Fl L Ar labelenv
+Instructs
+.Nm
+to read the label from the environment variable
+.Ar labelenv .
+.It Fl g
+Don't delete the original debugging section.
+.It Fl i
+Ignore object files built from other languages than C.
+.It Fl s
+Use the .dynsym ELF section instead of the .symtab ELF section.
+.It Fl o Ar outfile
+Write the output to file in
+.Ar outfile .
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh SEE ALSO
+.Xr ctfmerge 1 , 
+.Xr ctfdump 1
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 7.0 .
+.Sh AUTHORS
+The CTF utilities came from OpenSolaris.

Modified: head/cddl/usr.bin/ctfdump/Makefile
==
--- head/cddl/usr.bin/ctfdump/Makefile  Wed Aug 11 17:34:58 2010
(r211186)
+++ head/cddl/usr.bin/ctfdump/Makefile  Wed Aug 11 18:00:45 2010
(r211187)
@@ -4,7 +4,6 @@
 .PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/tools/ctf/dump
 
 PROG=  ctfdump
-NO_MAN=
 SRCS=  dump.c \
symbol.c \
utils.c

Added: head/cddl/usr.bin/ctfdump/ctfdump.1
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/cddl/usr.bin/ctfdump/ctfdump.1 Wed Aug 11 18:00:45 2010
(r211187)
@@ -0,0 +1,83 @@
+.\
+.\ Copyright (c) 2010 The FreeBSD Foundation 
+.\ All rights reserved. 
+.\ 
+.\ This software was developed by Rui Paulo under sponsorship from the
+.\ FreeBSD 

svn commit: r211188 - head/usr.bin/elfdump

2010-08-11 Thread Rui Paulo
Author: rpaulo
Date: Wed Aug 11 18:02:48 2010
New Revision: 211188
URL: http://svn.freebsd.org/changeset/base/211188

Log:
  Teach elfdump(1) about the SUNW_dof section.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/usr.bin/elfdump/elfdump.c

Modified: head/usr.bin/elfdump/elfdump.c
==
--- head/usr.bin/elfdump/elfdump.c  Wed Aug 11 18:00:45 2010
(r211187)
+++ head/usr.bin/elfdump/elfdump.c  Wed Aug 11 18:02:48 2010
(r211188)
@@ -322,6 +322,7 @@ sh_types(u_int64_t sht) {
case 18: return SHT_SYMTAB_SHNDX;
/* 0x6000 - 0x6fff operating system-specific semantics */
case 0x6ff0: return XXX:VERSYM;
+   case 0x6ff4: return SHT_SUNW_dof;
case 0x6ff7: return SHT_GNU_LIBLIST;
case 0x6ffc: return XXX:VERDEF;
case 0x6ffd: return SHT_SUNW(GNU)_verdef;
___
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: r211189 - head/usr.bin

2010-08-11 Thread Xin LI
Author: delphij
Date: Wed Aug 11 18:23:26 2010
New Revision: 211189
URL: http://svn.freebsd.org/changeset/base/211189

Log:
  Update a stale comment about grep.

Modified:
  head/usr.bin/Makefile

Modified: head/usr.bin/Makefile
==
--- head/usr.bin/Makefile   Wed Aug 11 18:02:48 2010(r211188)
+++ head/usr.bin/Makefile   Wed Aug 11 18:23:26 2010(r211189)
@@ -5,7 +5,7 @@
 
 # XXX MISSING: deroff diction graph learn plot
 #  spell spline struct xsend
-# XXX Use GNU versions: apropos diff grep ld man patch whatis
+# XXX Use GNU versions: apropos diff ld man patch whatis
 # Moved to secure: bdes
 #
 
___
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: r211157 - in head/sys: modules modules/if_carp net netinet netinet6

2010-08-11 Thread John Baldwin

Will Andrews wrote:

Author: will
Date: Wed Aug 11 00:51:50 2010
New Revision: 211157
URL: http://svn.freebsd.org/changeset/base/211157

Log:
  Allow carp(4) to be loaded as a kernel module.  Follow precedent set by
  bridge(4), lagg(4) etc. and make use of function pointers and
  pf_proto_register() to hook carp into the network stack.
  
  Currently, because of the uncertainty about whether the unload path is free

  of race condition panics, unloads are disallowed by default.  Compiling with
  CARPMOD_CAN_UNLOAD in CFLAGS removes this anti foot shooting measure.
  
  This commit requires IP6PROTOSPACER, introduced in r25.


This doesn't compile due to duplicate function pointer definitions (e.g. 
 if_bridge.c and if_ether.c).  You should move all the function pointer 
definitions to net/if.c and add declarations for them to a header 
instead of a bunch of 'extern' declarations in if_carp.c itself.


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


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

2010-08-11 Thread Kostik Belousov
On Wed, Aug 11, 2010 at 07:10:00PM +0200, Attilio Rao wrote:
 2010/8/11 Attilio Rao atti...@freebsd.org:
  2010/8/11 Kostik Belousov kostik...@gmail.com:
  On Wed, Aug 11, 2010 at 04:29:21PM +0200, Attilio Rao wrote:
  2010/8/11 Kostik Belousov kostik...@gmail.com:
   On Wed, Aug 11, 2010 at 01:21:46PM +0200, Attilio Rao wrote:
   2010/8/11 Kostik Belousov kostik...@gmail.com:
On Wed, Aug 11, 2010 at 10:51:27AM +, Attilio Rao wrote:
Author: attilio
Date: Wed Aug 11 10:51:27 2010
New Revision: 211176
URL: http://svn.freebsd.org/changeset/base/211176
   
Log:
  IPI handlers may run generally with interrupts disabled because 
they
  are served via an interrupt gate.
   
  However, that doesn't explicitly prevent preemption and thread
  migration thus scheduler pinning may be necessary in some 
handlers.
  Fix that.
   
How the preemption is supposed to happen ? Aside from the explicit
calls to mi_switch() from e.g. critical_exit().
  
   IIRC it should be hardclock() willing to schedule the softclock(). It
   is the critical_exit() in the thread_unlock() that may trigger it
   (sorry for not digging more, it was a while back that I hacked this
   part, but I guess you can verify on your own).
   We already have other points within the kernel that take care of
   dealing with preemption/migration like lapic_handle_timer(), for
   example.
  
   Right, and if the interrupts are indeed disabled, I do not see how
   the preemption may be triggered in the fragments like
          cpu = PCPU_GET(cpuid);
          cpumask = PCPU_GET(cpumask);
 
  I don't recall all the details and I have no time to dig now. However,
  also spinlock_enter() does disable explicitly preemption via
  critical_enter() after have disabled the interrupts.
  Let me CC jhb as he implemented spinlock_enter() and may have a clue
  about how preemption can happen with interrupts disabled.
 
  spinlock_enter() disables preemption to handle the recursive
  calls to spinlock_enter/leave, I think, to prevent switch on
  leave.
 
  No.
  Please look at how spinlock_enter() is implemented in ia32/amd64 in
  order to see how it does handle recursion.
 
 And besides we have other patterns running with interrupts disabled
 taking care of preemption as well (I think I already pointed to one, I
 think you could find others easilly).

Let me rephrase the original question: how the code of the kind
a = b;
c = d;
while executed with interrupts disabled, can be a subject to the kernel
preemption ? Well, the code are slightly more involved, because
evaluation of the right part of the assignment causes rebasing against
non-default segment register on x86oids, but the detail is irrelevant.


pgpVytPAzXed0.pgp
Description: PGP signature


Re: svn commit: r211157 - in head/sys: modules modules/if_carp net netinet netinet6

2010-08-11 Thread Will Andrews
On Wed, Aug 11, 2010 at 12:36 PM, John Baldwin j...@freebsd.org wrote:
 This doesn't compile due to duplicate function pointer definitions (e.g.
  if_bridge.c and if_ether.c).  You should move all the function pointer
 definitions to net/if.c and add declarations for them to a header instead of
 a bunch of 'extern' declarations in if_carp.c itself.

Working on it.

--Will.
___
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: r211190 - head/usr.sbin/lpr/lpd

2010-08-11 Thread Garance A Drosehn
Author: gad
Date: Wed Aug 11 19:32:49 2010
New Revision: 211190
URL: http://svn.freebsd.org/changeset/base/211190

Log:
  - Improve the wait4data() routine so it behaves better when checking
print-jobs which have last-modification times that are in the future.
This shouldn't happen, of course, but it can.  And when it did happen,
the previous check could cause completely-spooled jobs to sit in the
queue for 20 minutes per job.  The new code waits until the last-modify
time is not changing, instead of making decisions based on the specific
value of last-modify.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/lpr/lpd/printjob.c

Modified: head/usr.sbin/lpr/lpd/printjob.c
==
--- head/usr.sbin/lpr/lpd/printjob.cWed Aug 11 18:23:26 2010
(r211189)
+++ head/usr.sbin/lpr/lpd/printjob.cWed Aug 11 19:32:49 2010
(r211190)
@@ -1263,8 +1263,9 @@ wait4data(struct printer *pp, const char
 {
const char *cp;
int statres;
+   u_int sleepreq;
size_t dlen, hlen;
-   time_t amtslept, checktime;
+   time_t amtslept, cur_time, prev_mtime;
struct stat statdf;
 
/* Skip these checks if the print job is from the local host. */
@@ -1297,15 +1298,30 @@ wait4data(struct printer *pp, const char
 
/*
 * The file exists, so keep waiting until the data file has not
-* changed for some reasonable amount of time.
+* changed for some reasonable amount of time.  Extra care is
+* taken when computing wait-times, just in case there are data
+* files with a last-modify time in the future.  While that is
+* very unlikely to happen, it can happen when the system has
+* a flakey time-of-day clock.
 */
-   while (statres == 0  amtslept  MAXWAIT_4DATA) {
-   checktime = time(NULL) - MINWAIT_4DATA;
-   if (statdf.st_mtime = checktime)
-   break;
+   prev_mtime = statdf.st_mtime;
+   cur_time = time(NULL);
+   if (statdf.st_mtime = cur_time - MINWAIT_4DATA) {
+   if (statdf.st_mtime = cur_time)/* some TOD oddity */
+   sleepreq = MINWAIT_4DATA;
+   else
+   sleepreq = cur_time - statdf.st_mtime;
if (amtslept == 0)
pstatus(pp, Waiting for data file from remote host);
-   amtslept += MINWAIT_4DATA - sleep(MINWAIT_4DATA);
+   amtslept += sleepreq - sleep(sleepreq);
+   statres = stat(dfile, statdf);
+   }
+   sleepreq = MINWAIT_4DATA;
+   while (statres == 0  amtslept  MAXWAIT_4DATA) {
+   if (statdf.st_mtime == prev_mtime)
+   break;
+   prev_mtime = statdf.st_mtime;
+   amtslept += sleepreq - sleep(sleepreq);
statres = stat(dfile, statdf);
}
 
___
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: r211157 - in head/sys: modules modules/if_carp net netinet netinet6

2010-08-11 Thread Bjoern A. Zeeb

On Wed, 11 Aug 2010, Will Andrews wrote:


On Wed, Aug 11, 2010 at 8:34 AM, Pawel Jakub Dawidek p...@freebsd.org wrote:

Wouldn't it be better to allow unload only if there are no carp(4)
interfaces? I'd be glad to destroy my carp interfaces before unloading
the module, but recompiling the kernel to unload it? Not so much.


Well, in theory, if_clone_detach() is supposed to do that, and it's
called during the unload process prior to NULLing the fp's.  But I've
been unable to verify whether that is enough to prevent races.


In addition only the module, not the kernel needs to be recompiled.

Maybe I should add some more blah ...

Actually destroying most (cloned) interfaces is not save at the moment.
There could be an mbuf in a netisr queue with an ifp to that
interface, or just a packet being processed on another PU, so there is
more to this entire picture.

Assume that the current way and what is under the #ifdef is a temporary
thing and that we'll be able to flip the switch in the future.  But
there's still quite a bit of work into infratructure and details ahead,
some of that will come with more VIMAGE/vnet work on network stack
teardown, some might be done independently.

SeND will have the cleanup/check to allow to unload under
#ifdef __noyet__ as well, once it'll hit the tree, but for that the
hooks will need proper ND6 locking as well.

The point is, it's currently just not 100% save to just unload and
we've been very lenient and lazy with that in the past.   It's just
that times have changed and the races become true more easily so
adding new code/features need to be made aware of that or the pile
will just grow.  Unfortunately adding extra locking for all those
things is nothing you'd want either.

If you accept the risk for now that's fine but for the majority of our
users we'll have to err on the save side, while allowing them to use
freebsd-update now if it was only carp they needed (and not say IPSEC
as well) and they can just load the module and be happy w/o having to
recompile their own kernel.

/bz

--
Bjoern A. Zeeb   This signature is about you not me.
___
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: r211191 - head/sys/mips/rmi

2010-08-11 Thread Jayachandran C.
Author: jchandra
Date: Wed Aug 11 19:56:09 2010
New Revision: 211191
URL: http://svn.freebsd.org/changeset/base/211191

Log:
  Fix for 64 bit compile, with SMP enabled.

Modified:
  head/sys/mips/rmi/xlr_machdep.c

Modified: head/sys/mips/rmi/xlr_machdep.c
==
--- head/sys/mips/rmi/xlr_machdep.c Wed Aug 11 19:32:49 2010
(r211190)
+++ head/sys/mips/rmi/xlr_machdep.c Wed Aug 11 19:56:09 2010
(r211191)
@@ -428,7 +428,8 @@ platform_start(__register_t a0 __unused,
/* Wakeup Other cpus, and put them in bsd park code. */
wakeup = ((void (*) (void *, void *, unsigned int))
(unsigned long)(xlr_boot1_info.wakeup));
-   printf(Waking up CPUs 0x%llx.\n, xlr_boot1_info.cpu_online_map  
~(0x1U));
+   printf(Waking up CPUs 0x%jx.\n, 
+   (intmax_t)xlr_boot1_info.cpu_online_map  ~(0x1U));
if (xlr_boot1_info.cpu_online_map  ~(0x1U))
wakeup(mpwait, 0,
(unsigned int)xlr_boot1_info.cpu_online_map);
@@ -516,7 +517,7 @@ platform_init_ap(int cpuid)
stat |= MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT;
mips_wr_status(stat);
 
-   xlr_unmask_hard_irq((void *)platform_ipi_intrnum());
+   xlr_unmask_hard_irq((void *)IRQ_IPI);
xlr_unmask_hard_irq((void *)IRQ_TIMER);
if (xlr_thr_id() == 0) {
xlr_msgring_cpu_init(); 
___
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: r211192 - head/lib/libelf

2010-08-11 Thread Kai Wang
Author: kaiw
Date: Wed Aug 11 19:59:31 2010
New Revision: 211192
URL: http://svn.freebsd.org/changeset/base/211192

Log:
  Add translation support for section type SHT_SUNW_dof.
  
  Submitted by: rpaulo
  MFC after:2 weeks

Modified:
  head/lib/libelf/libelf_data.c

Modified: head/lib/libelf/libelf_data.c
==
--- head/lib/libelf/libelf_data.c   Wed Aug 11 19:56:09 2010
(r211191)
+++ head/lib/libelf/libelf_data.c   Wed Aug 11 19:59:31 2010
(r211192)
@@ -81,6 +81,8 @@ _libelf_xlate_shtype(uint32_t sht)
return (ELF_T_MOVE);
case SHT_SUNW_syminfo:
return (ELF_T_SYMINFO);
+   case SHT_SUNW_dof:
+   return (ELF_T_BYTE);
 #endif
case SHT_AMD64_UNWIND:  /* == SHT_IA_64_UNWIND */
return (ELF_T_BYTE);
___
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: r211193 - in head/sys: net netinet netinet6

2010-08-11 Thread Will Andrews
Author: will
Date: Wed Aug 11 20:18:19 2010
New Revision: 211193
URL: http://svn.freebsd.org/changeset/base/211193

Log:
  Unbreak LINT by moving all carp hooks to net/if.c / netinet/ip_carp.h, with
  the appropriate ifdefs.
  
  Reviewed by:  bz
  Approved by:  ken (mentor)

Modified:
  head/sys/net/if.c
  head/sys/net/if_bridge.c
  head/sys/net/if_ethersubr.c
  head/sys/netinet/if_ether.c
  head/sys/netinet/ip_carp.c
  head/sys/netinet/ip_carp.h
  head/sys/netinet6/nd6_nbr.c

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Wed Aug 11 19:59:31 2010(r211192)
+++ head/sys/net/if.c   Wed Aug 11 20:18:19 2010(r211193)
@@ -80,6 +80,7 @@
 /*XXX*/
 #include netinet/in.h
 #include netinet/in_var.h
+#include netinet/ip_carp.h
 #ifdef INET6
 #include netinet6/in6_var.h
 #include netinet6/in6_ifattach.h
@@ -124,7 +125,22 @@ SX_SYSINIT(ifdescr_sx, ifdescr_sx, ifn
 void   (*bstp_linkstate_p)(struct ifnet *ifp, int state);
 void   (*ng_ether_link_state_p)(struct ifnet *ifp, int state);
 void   (*lagg_linkstate_p)(struct ifnet *ifp, int state);
+/* These are external hooks for CARP. */
 void   (*carp_linkstate_p)(struct ifnet *ifp);
+#if defined(INET) || defined(INET6)
+struct ifnet *(*carp_forus_p)(struct ifnet *ifp, u_char *dhost);
+int(*carp_output_p)(struct ifnet *ifp, struct mbuf *m,
+struct sockaddr *sa, struct rtentry *rt);
+#endif
+#ifdef INET
+int (*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct in_addr *,
+u_int8_t **);
+#endif
+#ifdef INET6
+struct ifaddr *(*carp_iamatch6_p)(struct ifnet *ifp, struct in6_addr *taddr6);
+caddr_t (*carp_macmatch6_p)(struct ifnet *ifp, struct mbuf *m,
+const struct in6_addr *taddr);
+#endif
 
 struct mbuf *(*tbr_dequeue_ptr)(struct ifaltq *, int) = NULL;
 

Modified: head/sys/net/if_bridge.c
==
--- head/sys/net/if_bridge.cWed Aug 11 19:59:31 2010(r211192)
+++ head/sys/net/if_bridge.cWed Aug 11 20:18:19 2010(r211193)
@@ -2141,10 +2141,6 @@ drop:
m_freem(m);
 }
 
-#if defined(INET) || defined(INET6)
-int (*carp_forus_p)(struct carp_if *, u_char *);
-#endif
-
 /*
  * bridge_input:
  *
@@ -2256,10 +2252,10 @@ bridge_input(struct ifnet *ifp, struct m
 #if (defined(INET) || defined(INET6))
 #   define OR_CARP_CHECK_WE_ARE_DST(iface) \
|| ((iface)-if_carp \
-(*carp_forus_p)((iface)-if_carp, eh-ether_dhost))
+(*carp_forus_p)((iface), eh-ether_dhost))
 #   define OR_CARP_CHECK_WE_ARE_SRC(iface) \
|| ((iface)-if_carp \
-(*carp_forus_p)((iface)-if_carp, eh-ether_shost))
+(*carp_forus_p)((iface), eh-ether_shost))
 #else
 #   define OR_CARP_CHECK_WE_ARE_DST(iface)
 #   define OR_CARP_CHECK_WE_ARE_SRC(iface)

Modified: head/sys/net/if_ethersubr.c
==
--- head/sys/net/if_ethersubr.c Wed Aug 11 19:59:31 2010(r211192)
+++ head/sys/net/if_ethersubr.c Wed Aug 11 20:18:19 2010(r211193)
@@ -114,11 +114,6 @@ void   (*ng_ether_attach_p)(struct ifnet *
 void   (*ng_ether_detach_p)(struct ifnet *ifp);
 
 void   (*vlan_input_p)(struct ifnet *, struct mbuf *);
-#if defined(INET) || defined(INET6)
-int (*carp_forus_p)(struct ifnet *, u_char *);
-int (*carp_output_p)(struct ifnet *, struct mbuf *, struct sockaddr *,
-struct rtentry *);
-#endif
 
 /* if_bridge(4) support */
 struct mbuf *(*bridge_input_p)(struct ifnet *, struct mbuf *); 

Modified: head/sys/netinet/if_ether.c
==
--- head/sys/netinet/if_ether.c Wed Aug 11 19:59:31 2010(r211192)
+++ head/sys/netinet/if_ether.c Wed Aug 11 20:18:19 2010(r211193)
@@ -64,6 +64,9 @@ __FBSDID($FreeBSD$);
 #include netinet/in_var.h
 #include net/if_llatbl.h
 #include netinet/if_ether.h
+#if defined(INET) || defined(INET6)
+#include netinet/ip_carp.h
+#endif
 
 #include net/if_arc.h
 #include net/iso88025.h
@@ -118,10 +121,6 @@ static voidarptimer(void *);
 #ifdef INET
 static voidin_arpinput(struct mbuf *);
 #endif
-#if defined(INET) || defined(INET6)
-int(*carp_iamatch_p)(struct ifnet *, struct in_ifaddr *, struct 
in_addr *,
-   u_int8_t **);
-#endif
 
 static const struct netisr_handler arp_nh = {
.nh_name = arp,

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Wed Aug 11 19:59:31 2010(r211192)
+++ head/sys/netinet/ip_carp.c  Wed Aug 11 20:18:19 2010(r211193)
@@ -135,26 +135,6 @@ struct carp_softc {
 };
 #defineSC2IFP(sc)  ((sc)-sc_ifp)
 
-/* These are external networking stack hooks for CARP */
-/* net/if.c */
-extern void (*carp_linkstate_p)(struct ifnet *);
-/* net/if_bridge.c net/if_ethersubr.c */
-extern