svn commit: r245413 - head/contrib/gcc/config/arm

2013-01-14 Thread Andrew Turner
Author: andrew
Date: Mon Jan 14 08:39:48 2013
New Revision: 245413
URL: http://svnweb.freebsd.org/changeset/base/245413

Log:
  Switch the default CPU to an arm9. This removes compiler support for the
  unsupported 26-bit addressing mode. This change is required for moving to
  the ARM EABI.

Modified:
  head/contrib/gcc/config/arm/freebsd.h

Modified: head/contrib/gcc/config/arm/freebsd.h
==
--- head/contrib/gcc/config/arm/freebsd.h   Mon Jan 14 07:17:38 2013
(r245412)
+++ head/contrib/gcc/config/arm/freebsd.h   Mon Jan 14 08:39:48 2013
(r245413)
@@ -97,7 +97,7 @@
 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/armv6 ELF)");
 #else
 #undef  SUBTARGET_CPU_DEFAULT
-#define SUBTARGET_CPU_DEFAULT  TARGET_CPU_strongarm
+#define SUBTARGET_CPU_DEFAULT  TARGET_CPU_arm9
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
 #endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245414 - head/sys/arm/arm

2013-01-14 Thread Andrew Turner
Author: andrew
Date: Mon Jan 14 09:11:18 2013
New Revision: 245414
URL: http://svnweb.freebsd.org/changeset/base/245414

Log:
  Update sigcode to use both the current ABI and FreeBSD's version of the
  ARM EABI syscall calling convention.
  
  The current ABI encodes the syscall number in the instruction. This causes
  issues with the thumb mode as it only has 8 bits to encode this value and
  we have too many system calls and by using a register will simplify the
  code to get the syscall number in the kernel.
  
  With the ARM EABI we reuse the Linux calling convention by storing the
  value in r7. Because of this we use both methods to encode the syscall
  number in this function.

Modified:
  head/sys/arm/arm/locore.S

Modified: head/sys/arm/arm/locore.S
==
--- head/sys/arm/arm/locore.S   Mon Jan 14 08:39:48 2013(r245413)
+++ head/sys/arm/arm/locore.S   Mon Jan 14 09:11:18 2013(r245414)
@@ -484,12 +484,29 @@ ENTRY_NP(abort)
 
 ENTRY_NP(sigcode)
mov r0, sp
+
+   /*
+* Call the sigreturn system call.
+* 
+* We have to load r7 manually rather than using
+* "ldr r7, =SYS_sigreturn" to ensure the value of szsigcode is
+* correct. Using the alternative places esigcode at the address
+* of the data rather than the address one past the data.
+*/
+
+   ldr r7, [pc, #12]   /* Load SYS_sigreturn */
swi SYS_sigreturn
 
/* Well if that failed we better exit quick ! */
 
+   ldr r7, [pc, #8]/* Load SYS_exit */
swi SYS_exit
-   b   . - 8
+
+   /* Branch back to retry SYS_sigreturn */
+   b   . - 16
+
+   .word   SYS_sigreturn
+   .word   SYS_exit
 
.align  0
.global _C_LABEL(esigcode)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245418 - head/usr.bin/stdbuf

2013-01-14 Thread Jeremie Le Hen
Author: jlh
Date: Mon Jan 14 11:03:13 2013
New Revision: 245418
URL: http://svnweb.freebsd.org/changeset/base/245418

Log:
  Allow commands without any additional arguments, as stated in the
  manpage.  While here, exit early when there is nothing to do.
  
  PR:168415
  Submitted by:  Zhihao Yuan (initial version)
  MFC after: 1 week
  Approved by:   kib (mentor)

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

Modified: head/usr.bin/stdbuf/stdbuf.c
==
--- head/usr.bin/stdbuf/stdbuf.cMon Jan 14 11:00:06 2013
(r245417)
+++ head/usr.bin/stdbuf/stdbuf.cMon Jan 14 11:03:13 2013
(r245418)
@@ -72,8 +72,8 @@ main(int argc, char *argv[])
}
argc -= optind;
argv += optind;
-   if (argc < 2)
-   usage(0);
+   if (argc == 0)
+   exit(0);
 
if (ibuf != NULL && setenv("_STDBUF_I", ibuf, 1) == -1)
warn("Failed to set environment variable: %s=%s",
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245419 - head/usr.bin/stdbuf

2013-01-14 Thread Jeremie Le Hen
Author: jlh
Date: Mon Jan 14 11:06:50 2013
New Revision: 245419
URL: http://svnweb.freebsd.org/changeset/base/245419

Log:
  Remove stray tabs.
  
  Submitted by: kib
  Approved by:  kib (mentor)
  MFC after:1 week

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

Modified: head/usr.bin/stdbuf/stdbuf.c
==
--- head/usr.bin/stdbuf/stdbuf.cMon Jan 14 11:03:13 2013
(r245418)
+++ head/usr.bin/stdbuf/stdbuf.cMon Jan 14 11:06:50 2013
(r245419)
@@ -39,7 +39,7 @@ extern char *__progname;
 static void
 usage(int s)
 {
-   
+
fprintf(stderr, "Usage: %s [-e 0|L|] [-i 0|L|] [-o 0|L|] "
" [args ...]\n", __progname);
exit(s);
@@ -94,7 +94,7 @@ main(int argc, char *argv[])
 
if (i < 0 || putenv(preload1) == -1)
warn("Failed to set environment variable: LD_PRELOAD");
-   
+
preload0 = getenv("LD_32_PRELOAD");
if (preload0 == NULL)
i = asprintf(&preload1, "LD_32_PRELOAD=" LIBSTDBUF32);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245421 - head/sys/vm

2013-01-14 Thread Andrey Zonov
Author: zont
Date: Mon Jan 14 12:12:56 2013
New Revision: 245421
URL: http://svnweb.freebsd.org/changeset/base/245421

Log:
  - Get rid of unused function vmspace_wired_count().
  
  Reviewed by:  alc
  Approved by:  kib (mentor)
  MFC after:1 week

Modified:
  head/sys/vm/vm_map.c
  head/sys/vm/vm_map.h

Modified: head/sys/vm/vm_map.c
==
--- head/sys/vm/vm_map.cMon Jan 14 11:13:31 2013(r245420)
+++ head/sys/vm/vm_map.cMon Jan 14 12:12:56 2013(r245421)
@@ -726,12 +726,6 @@ vmspace_resident_count(struct vmspace *v
return pmap_resident_count(vmspace_pmap(vmspace));
 }
 
-long
-vmspace_wired_count(struct vmspace *vmspace)
-{
-   return pmap_wired_count(vmspace_pmap(vmspace));
-}
-
 /*
  * vm_map_create:
  *

Modified: head/sys/vm/vm_map.h
==
--- head/sys/vm/vm_map.hMon Jan 14 11:13:31 2013(r245420)
+++ head/sys/vm/vm_map.hMon Jan 14 12:12:56 2013(r245421)
@@ -298,7 +298,6 @@ void vm_map_wait_busy(vm_map_t map);
_vm_map_lock_downgrade(map, LOCK_FILE, LOCK_LINE)
 
 long vmspace_resident_count(struct vmspace *vmspace);
-long vmspace_wired_count(struct vmspace *vmspace);
 #endif /* _KERNEL */
 
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245422 - in head: bin/sh tools/regression/bin/sh/expansion

2013-01-14 Thread Jilles Tjoelker
Author: jilles
Date: Mon Jan 14 12:20:55 2013
New Revision: 245422
URL: http://svnweb.freebsd.org/changeset/base/245422

Log:
  sh: Pass $? to command substitution containing compound/multiple commands.
  
  Example:
false; echo $(echo $?; :)

Added:
  head/tools/regression/bin/sh/expansion/cmdsubst17.0   (contents, props 
changed)
Modified:
  head/bin/sh/eval.c

Modified: head/bin/sh/eval.c
==
--- head/bin/sh/eval.c  Mon Jan 14 12:12:56 2013(r245421)
+++ head/bin/sh/eval.c  Mon Jan 14 12:20:55 2013(r245422)
@@ -624,8 +624,8 @@ evalbackcmd(union node *n, struct backcm
exitstatus = 0;
goto out;
}
+   exitstatus = oexitstatus;
if (is_valid_fast_cmdsubst(n)) {
-   exitstatus = oexitstatus;
savelocalvars = localvars;
localvars = NULL;
forcelocal++;
@@ -649,7 +649,6 @@ evalbackcmd(union node *n, struct backcm
poplocalvars();
localvars = savelocalvars;
} else {
-   exitstatus = 0;
if (pipe(pip) < 0)
error("Pipe call failed: %s", strerror(errno));
jp = makejob(n, 1);

Added: head/tools/regression/bin/sh/expansion/cmdsubst17.0
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/tools/regression/bin/sh/expansion/cmdsubst17.0 Mon Jan 14 12:20:55 
2013(r245422)
@@ -0,0 +1,5 @@
+# $FreeBSD$
+
+f() { return 3; }
+f
+[ `echo $?; :` = 3 ]
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245423 - head/sys/geom/raid

2013-01-14 Thread Alexander Motin
Author: mav
Date: Mon Jan 14 13:06:35 2013
New Revision: 245423
URL: http://svnweb.freebsd.org/changeset/base/245423

Log:
  Print some more metadata fields.

Modified:
  head/sys/geom/raid/md_intel.c

Modified: head/sys/geom/raid/md_intel.c
==
--- head/sys/geom/raid/md_intel.c   Mon Jan 14 12:20:55 2013
(r245422)
+++ head/sys/geom/raid/md_intel.c   Mon Jan 14 13:06:35 2013
(r245423)
@@ -179,7 +179,7 @@ struct intel_raid_conf {
uint8_t error_log_pos;
uint8_t dummy_2[1];
uint32_tcache_size;
-   uint32_torig_family_num;
+   uint32_torig_config_id;
uint32_tpwr_cycle_count;
uint32_tbbm_log_size;
uint32_tfiller_0[35];
@@ -385,14 +385,17 @@ g_raid_md_intel_print(struct intel_raid_
printf("attributes  0x%08x\n", meta->attributes);
printf("total_disks %u\n", meta->total_disks);
printf("total_volumes   %u\n", meta->total_volumes);
-   printf("orig_family_num 0x%08x\n", meta->orig_family_num);
+   printf("error_log_pos   %u\n", meta->error_log_pos);
+   printf("cache_size  %u\n", meta->cache_size);
+   printf("orig_config_id  0x%08x\n", meta->orig_config_id);
+   printf("pwr_cycle_count %u\n", meta->pwr_cycle_count);
printf("bbm_log_size%u\n", meta->bbm_log_size);
-   printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags\n");
+   printf("DISK#   serial disk_sectors disk_sectors_hi disk_id flags 
owner\n");
for (i = 0; i < meta->total_disks; i++ ) {
-   printf("%d   <%.16s> %u %u 0x%08x 0x%08x\n", i,
+   printf("%d   <%.16s> %u %u 0x%08x 0x%08x %08x\n", i,
meta->disk[i].serial, meta->disk[i].sectors,
-   meta->disk[i].sectors_hi,
-   meta->disk[i].id, meta->disk[i].flags);
+   meta->disk[i].sectors_hi, meta->disk[i].id,
+   meta->disk[i].flags, meta->disk[i].owner_cfg_num);
}
for (i = 0; i < meta->total_volumes; i++) {
mvol = intel_get_volume(meta, i);
@@ -414,6 +417,9 @@ g_raid_md_intel_print(struct intel_raid_
printf(" migr_state %u\n", mvol->migr_state);
printf(" migr_type  %u\n", mvol->migr_type);
printf(" dirty  %u\n", mvol->dirty);
+   printf(" fs_state   %u\n", mvol->fs_state);
+   printf(" verify_errors  %u\n", mvol->verify_errors);
+   printf(" bad_blocks %u\n", mvol->bad_blocks);
 
for (j = 0; j < (mvol->migr_state ? 2 : 1); j++) {
printf("  *** Map %d ***\n", j);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Andre Oppermann

On 13.01.2013 11:10, Alan Cox wrote:

On 01/07/2013 12:47, Oleksandr Tymoshenko wrote:

On 12/27/2012 6:46 PM, Oleksandr Tymoshenko wrote:

On 12/18/2012 1:59 AM, Alan Cox wrote:

On 12/17/2012 23:40, Oleksandr Tymoshenko wrote:

On 2012-12-08, at 1:21 PM, Alan Cox  wrote:

That makes sense.  However, "virtual_avail" isn't the start of the
kernel address space.  The kernel map always starts at
VM_MIN_KERNEL_ADDRESS.  (See kmem_init().)  "virtual_avail" represents
the next unallocated virtual address in the kernel address space at an
early point in initialization.  "virtual_avail" and "virtual_end"
aren't
used after that, or outside the VM system.  Please use
vm_map_min(kernel_map) and vm_map_max(kernel_map) instead.


I checked: kernel_map is not available (NULL) at this point.  So we
can't use it to
determine real KVA size. Closest thing we can get is
virtual_avail/virtual_end pair.

Andre, could you approve attached patch for commit or suggest better
solution?


Any update on this one? Can I proceed with commit?



Yes, I've now spent a little bit of time looking at this, and I don't
see why these calculations and tunable_mbinit() need to be performed
before the kernel map is initialized.

Let me summarize what I found:

1. The function tunable_mbinit() now has a dependency on the global
variable maxmbufmem.  tunable_mbinit() is executed under
SI_SUB_TUNABLES.  tunable_mbinit() defines the global variable
nmbclusters.  The statements made in the comment at the head of
tunable_mbinit() all appear to be false:

/*
  * tunable_mbinit() has to be run before init_maxsockets() thus
  * the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets()
  * runs at SI_ORDER_ANY.
  *
  * NB: This has to be done before VM init.
  */

I don't see anything in init_maxsockets() that depends on
tunable_mbinit().  Moreover, the statement about "VM init" is only
correct if you regard the initialization of the kernel's malloc as "VM
init".


This seems to be historic cruft.  The dependency on maxsockets was
removed recently with the autotuning improvements.

A patch moving the maxmbufmem calculation into tunable_mbinit() and
changing it to SI_SUB_KMEM which comes after the VM initialization is
attached.


2. The function kmeminit() in kern/kern_malloc.c has a dependency on the
global variable nmbclusters.  kmeminit() is executed under SI_SUB_KMEM,
which comes after the initialization of the virtual memory system,
including the kernel map.


The use of nmbclusters in kmeminit seems to be bogus.  I think it comes
from the times when the mbuf allocator was directly layered on top of
the VM, that is before UMA.

kmeminit() should not use nmbclusters.  The computations done in kmeminit()
do not make a whole lot of sense to me. But I'm no expert in that area.


3. The function vm_ksubmap_init() has a dependency on the global
variable maxpipekva.  vm_ksubmap_init() is executed under SI_SUB_CPU,
which comes after SI_SUB_KMEM.

Am I missing anything?

I'm attaching a patch that defers the calculation of maxpipekva until we
actually need it in vm_ksubmap_init().  Any comments on this patch are
welcome.


Looks good to me.  Perhaps the whole calculation and setup of the pipe_map
could be moved to kern/sys_pipe.c:pipeinit() to have it all together.

--
Andre

Index: sys/mbuf.h
===
--- sys/mbuf.h  (revision 245423)
+++ sys/mbuf.h  (working copy)
@@ -384,7 +384,6 @@
  *
  * The rest of it is defined in kern/kern_mbuf.c
  */
-extern quad_t  maxmbufmem;
 extern uma_zone_t  zone_mbuf;
 extern uma_zone_t  zone_clust;
 extern uma_zone_t  zone_pack;
Index: kern/kern_mbuf.c
===
--- kern/kern_mbuf.c(revision 245423)
+++ kern/kern_mbuf.c(working copy)
@@ -47,6 +47,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -104,16 +105,25 @@
 struct mbstat mbstat;
 
 /*
- * tunable_mbinit() has to be run before init_maxsockets() thus
- * the SYSINIT order below is SI_ORDER_MIDDLE while init_maxsockets()
- * runs at SI_ORDER_ANY.
- *
- * NB: This has to be done before VM init.
+ * tunable_mbinit() has to be run before any mbuf allocations are done.
  */
 static void
 tunable_mbinit(void *dummy)
 {
+   quad_t realmem, maxmbufmem;
 
+   /*
+* The default limit for all mbuf related memory is 1/2 of all
+* available kernel memory (physical or kmem).
+* At most it can be 3/4 of available kernel memory.
+*/
+   realmem = qmin((quad_t)physmem * PAGE_SIZE,
+   vm_map_max(kernel_map) - vm_map_min(kernel_map));
+   maxmbufmem = realmem / 2;
+   TUNABLE_QUAD_FETCH("kern.maxmbufmem", &maxmbufmem);
+   if (maxmbufmem > realmem / 4 * 3)
+   maxmbufmem = realmem / 4 * 3;
+
TUNABLE_INT_FETCH("kern.ipc.nmbclusters", &nmbclusters);
if (nmbclusters == 0)
nmbclusters = maxmbufmem

svn commit: r245424 - head/sys/boot/i386/libi386

2013-01-14 Thread Sean Bruno
Author: sbruno
Date: Mon Jan 14 15:05:22 2013
New Revision: 245424
URL: http://svnweb.freebsd.org/changeset/base/245424

Log:
  Quiesce some clang warnings while we're here doing stuff.
  
  Submitted by: Hiren Panchasara 
  Obtained from:Yahoo! Inc

Modified:
  head/sys/boot/i386/libi386/bootinfo64.c
  head/sys/boot/i386/libi386/devicename.c
  head/sys/boot/i386/libi386/pxe.c

Modified: head/sys/boot/i386/libi386/bootinfo64.c
==
--- head/sys/boot/i386/libi386/bootinfo64.c Mon Jan 14 13:06:35 2013
(r245423)
+++ head/sys/boot/i386/libi386/bootinfo64.c Mon Jan 14 15:05:22 2013
(r245424)
@@ -134,7 +134,8 @@ bi_checkcpu(void)
 {
 char *cpu_vendor;
 int vendor[3];
-int eflags, regs[4];
+int eflags;
+unsigned int regs[4];
 
 /* Check for presence of "cpuid". */
 eflags = read_eflags();

Modified: head/sys/boot/i386/libi386/devicename.c
==
--- head/sys/boot/i386/libi386/devicename.c Mon Jan 14 13:06:35 2013
(r245423)
+++ head/sys/boot/i386/libi386/devicename.c Mon Jan 14 15:05:22 2013
(r245424)
@@ -128,7 +128,7 @@ i386_parsedev(struct i386_devdesc **dev,
goto fail;
}
} else {
-   cp = np;
+   cp = (char *)np;
}
if (*cp && (*cp != ':')) {
err = EINVAL;

Modified: head/sys/boot/i386/libi386/pxe.c
==
--- head/sys/boot/i386/libi386/pxe.cMon Jan 14 13:06:35 2013
(r245423)
+++ head/sys/boot/i386/libi386/pxe.cMon Jan 14 15:05:22 2013
(r245424)
@@ -88,6 +88,12 @@ static int   pxe_netif_get(struct iodesc *
 static int pxe_netif_put(struct iodesc *desc, void *pkt, size_t len);
 static voidpxe_netif_end(struct netif *nif);
 
+#ifdef OLD_NFSV2
+int nfs_getrootfh(struct iodesc*, char*, u_char*);
+#else
+int nfs_getrootfh(struct iodesc*, char*, uint32_t*, u_char*);
+#endif
+
 extern struct netif_stats  pxe_st[];
 extern u_int16_t   __bangpxeseg;
 extern u_int16_t   __bangpxeoff;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Andre Oppermann

On 13.01.2013 19:06, Alfred Perlstein wrote:

On 1/12/13 10:32 PM, Adrian Chadd wrote:

On 12 January 2013 11:45, Alfred Perlstein  wrote:


I'm not sure if regressing to the waterfall method of development is a good
idea at this point.

I see a light at the end of the tunnel and we to continue to just handle
these minor corner cases as we progress.

If we move to a model where a minor bug is grounds to completely remove
helpful code then nothing will ever get done.


Allocating 512MB worth of callwheels on a 16GB MIPS machine is a
little silly, don't you think?

That suggests to me that the extent of which maxfiles/maxusers/etc
percolates the codebase wasn't totally understood by those who wish to
change it.

I'd rather see some more investigative work into outlining things that
need fixing and start fixing those, rather than "just change stuff and
fix whatever issues creep up."

I kinda hope we all understand what we're working on in the kernel a
little better than that.


Cool!   I'm glad people are now aware of the callwheel allocation being insane 
with large maxusers.

I saw this about a month ago (if not longer), but since there were half a dozen 
people calling me an
imbecile who hadn't really yet read the code I didn't want to inflame them more 
by fixing that with
"a hack". (actually a simple fix).

A simple fix is to clamp callwheel size to the previous result of a maxusers of 
384 and call it a day.

However the simplicity of that approach would probably inflame too many 
feelings so I am unsure as
how to proceed.

Any ideas?


I noticed the callwheel dependency as well and asked mav@ about it
in a short email exchange.  He said it has only little use and goes
away with the calloutng import.  While that is outstanding we need
to clamp it to a sane value.

However I don't know what a sane value would be and why its size is
directly derived from maxproc and maxfiles.  If there can be one
callout per process and open file descriptor in the system, then
it probably has to be so big.  If it can deal with 'collisions'
in the wheel it can be much smaller.

--
Andre

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


Re: svn commit: r245424 - head/sys/boot/i386/libi386

2013-01-14 Thread Garrett Cooper
Thanks for taking care of these. I have a pr open to handle more issues, but 
this took care of a chunk of them.
Thanks,
-Garrett

Sent from my iPhone

On Jan 14, 2013, at 7:05 AM, Sean Bruno  wrote:

> Author: sbruno
> Date: Mon Jan 14 15:05:22 2013
> New Revision: 245424
> URL: http://svnweb.freebsd.org/changeset/base/245424
> 
> Log:
>  Quiesce some clang warnings while we're here doing stuff.
> 
>  Submitted by:Hiren Panchasara 
>  Obtained from:Yahoo! Inc
> 
> Modified:
>  head/sys/boot/i386/libi386/bootinfo64.c
>  head/sys/boot/i386/libi386/devicename.c
>  head/sys/boot/i386/libi386/pxe.c
> 
> Modified: head/sys/boot/i386/libi386/bootinfo64.c
> ==
> --- head/sys/boot/i386/libi386/bootinfo64.cMon Jan 14 13:06:35 2013
> (r245423)
> +++ head/sys/boot/i386/libi386/bootinfo64.cMon Jan 14 15:05:22 2013
> (r245424)
> @@ -134,7 +134,8 @@ bi_checkcpu(void)
> {
> char *cpu_vendor;
> int vendor[3];
> -int eflags, regs[4];
> +int eflags;
> +unsigned int regs[4];
> 
> /* Check for presence of "cpuid". */
> eflags = read_eflags();
> 
> Modified: head/sys/boot/i386/libi386/devicename.c
> ==
> --- head/sys/boot/i386/libi386/devicename.cMon Jan 14 13:06:35 2013
> (r245423)
> +++ head/sys/boot/i386/libi386/devicename.cMon Jan 14 15:05:22 2013
> (r245424)
> @@ -128,7 +128,7 @@ i386_parsedev(struct i386_devdesc **dev,
>goto fail;
>}
>} else {
> -cp = np;
> +cp = (char *)np;
>}
>if (*cp && (*cp != ':')) {
>err = EINVAL;
> 
> Modified: head/sys/boot/i386/libi386/pxe.c
> ==
> --- head/sys/boot/i386/libi386/pxe.cMon Jan 14 13:06:35 2013(r245423)
> +++ head/sys/boot/i386/libi386/pxe.cMon Jan 14 15:05:22 2013(r245424)
> @@ -88,6 +88,12 @@ static intpxe_netif_get(struct iodesc *
> static intpxe_netif_put(struct iodesc *desc, void *pkt, size_t len);
> static voidpxe_netif_end(struct netif *nif);
> 
> +#ifdef OLD_NFSV2
> +int nfs_getrootfh(struct iodesc*, char*, u_char*);
> +#else
> +int nfs_getrootfh(struct iodesc*, char*, uint32_t*, u_char*);
> +#endif
> +
> extern struct netif_statspxe_st[];
> extern u_int16_t__bangpxeseg;
> extern u_int16_t__bangpxeoff;
> ___
> svn-src-head@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Alfred Perlstein

On 1/14/13 10:09 AM, Andre Oppermann wrote:

On 13.01.2013 19:06, Alfred Perlstein wrote:

On 1/12/13 10:32 PM, Adrian Chadd wrote:

On 12 January 2013 11:45, Alfred Perlstein  wrote:

I'm not sure if regressing to the waterfall method of development 
is a good

idea at this point.

I see a light at the end of the tunnel and we to continue to just 
handle

these minor corner cases as we progress.

If we move to a model where a minor bug is grounds to completely 
remove

helpful code then nothing will ever get done.


Allocating 512MB worth of callwheels on a 16GB MIPS machine is a
little silly, don't you think?

That suggests to me that the extent of which maxfiles/maxusers/etc
percolates the codebase wasn't totally understood by those who wish to
change it.

I'd rather see some more investigative work into outlining things that
need fixing and start fixing those, rather than "just change stuff and
fix whatever issues creep up."

I kinda hope we all understand what we're working on in the kernel a
little better than that.


Cool!   I'm glad people are now aware of the callwheel allocation 
being insane with large maxusers.


I saw this about a month ago (if not longer), but since there were 
half a dozen people calling me an
imbecile who hadn't really yet read the code I didn't want to inflame 
them more by fixing that with

"a hack". (actually a simple fix).

A simple fix is to clamp callwheel size to the previous result of a 
maxusers of 384 and call it a day.


However the simplicity of that approach would probably inflame too 
many feelings so I am unsure as

how to proceed.

Any ideas?


I noticed the callwheel dependency as well and asked mav@ about it
in a short email exchange.  He said it has only little use and goes
away with the calloutng import.  While that is outstanding we need
to clamp it to a sane value.

However I don't know what a sane value would be and why its size is
directly derived from maxproc and maxfiles.  If there can be one
callout per process and open file descriptor in the system, then
it probably has to be so big.  If it can deal with 'collisions'
in the wheel it can be much smaller.

If it really goes away with calloutng, then we should probably leave it 
be in -current.


As far as clipping it when/if we push maxusers fixes in -stable (which 
we must do) then my impression (although maybe wrong) is that the 
callwheels (cc_callwheel) are just arrays of hash buckets based on what 
tick will be fired next MOD callwheelmask.  This means that if 
cc_callwheel is way too small, then we will wind up with collisions, 
however if it's enormous then we wind up with a window that is so large 
it can accommodate something like hundreds of ticks into the future.


Example:

Loaded symbols for /boot/kernel/profile.ko
#0  sched_switch (td=0x81373e40, newtd=0xfe001aab5960,
flags=) at ../../../kern/sched_ule.c:1954
1954cpuid = PCPU_GET(cpuid);
(kgdb) p callwheelsize
$1 = 2097152
Current language:  auto; currently minimal
(kgdb) # .(16:06:31)(root@dan)
/usr/home/alfred # sysctl -a | grep hz
kern.clockrate: { hz = 1000, tick = 1000, profhz = 8128, stathz = 127 }
kern.dcons.poll_hz: 25
kern.hz: 1000
debug.psm.hz: 20
.(16:06:37)(root@dan)
/usr/home/alfred # 2097152
.(16:06:40)(root@dan)
/usr/home/alfred # bc
2097152 / 1000
2097
^D# .(16:06:56)(root@dan)
/usr/home/alfred # sysctl kern.maxusers
kern.maxusers: 3406


So basically on this box there are enough callwheel slots for something 
like 2097 seconds, or 34 minutes into the future.


I would assume that a machine that was capped at 384 maxusers would wind 
up with something that could handle callouts up to ~3 minutes in the 
future without wraparound and collisions.


As far as the ncallout, that is for timeout(9) support.  At a glance I'm 
not aware of any users of timeout(9) that are not "per device" so 
there's unlikely to be a need for a timeout(9) supporting pre-allocated 
timeout per prorcess/file, more likely something like N-devices*4, which 
is fine at something way lower than the max allocated at 384 maxusers 
from before all the changes we have made.


I could be wrong.. but I still believe that it would be quite the system 
that would need more than 
callout=get_callout_from_maxusers(min(maxusers, 384));


Functions calling this function: timeout

Functions calling this function: timeout

  File Function  Line
0 si.c si_start  1439 pp->lstart_ch = 
timeout(si_lstart, (caddr_t)pp, time);
1 sio.csiobusycheck  1269 
timeout(siobusycheck, com, hz / 100);
2 sio.csiopoll   1744 
timeout(siobusycheck, com, hz / 100);
3 sio.csiosettimeout 2203 sio_timeout_handle 
= timeout(comwakeup, (void *)NULL,
4 sio.ccomwakeup 2220 sio_timeout_handle 
= timeout(comwakeup, (void *)NULL, sio_timeout);
5 syscons.cscrn_timer 

svn commit: r245425 - head/sys/geom/raid

2013-01-14 Thread Alexander Motin
Author: mav
Date: Mon Jan 14 16:38:43 2013
New Revision: 245425
URL: http://svnweb.freebsd.org/changeset/base/245425

Log:
  Small cosmetic tuning of the IRRT status constants.

Modified:
  head/sys/geom/raid/md_intel.c

Modified: head/sys/geom/raid/md_intel.c
==
--- head/sys/geom/raid/md_intel.c   Mon Jan 14 15:05:22 2013
(r245424)
+++ head/sys/geom/raid/md_intel.c   Mon Jan 14 16:38:43 2013
(r245425)
@@ -98,8 +98,9 @@ struct intel_raid_vol {
uint8_t cng_master_disk;
uint16_tcache_policy;
uint8_t cng_state;
-#define INTEL_SNGST_NEEDS_UPDATE   1
-#define INTEL_SNGST_MASTER_MISSING 2
+#define INTEL_CNGST_UPDATED0
+#define INTEL_CNGST_NEEDS_UPDATE   1
+#define INTEL_CNGST_MASTER_MISSING 2
uint8_t cng_sub_state;
uint32_tfiller_0[10];
 
@@ -2366,9 +2367,11 @@ g_raid_md_write_intel(struct g_raid_md_o
mvol->cng_master_disk = pv->pv_cng_master_disk;
if (vol->v_subdisks[pv->pv_cng_master_disk].sd_state ==
G_RAID_SUBDISK_S_NONE)
-   mvol->cng_state = INTEL_SNGST_MASTER_MISSING;
+   mvol->cng_state = INTEL_CNGST_MASTER_MISSING;
else if (vol->v_state != G_RAID_VOLUME_S_OPTIMAL)
-   mvol->cng_state = INTEL_SNGST_NEEDS_UPDATE;
+   mvol->cng_state = INTEL_CNGST_NEEDS_UPDATE;
+   else
+   mvol->cng_state = INTEL_CNGST_UPDATED;
}
 
/* Check for any recovery in progress. */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245426 - head/bin/sh

2013-01-14 Thread Jilles Tjoelker
Author: jilles
Date: Mon Jan 14 16:40:50 2013
New Revision: 245426
URL: http://svnweb.freebsd.org/changeset/base/245426

Log:
  sh: Simplify cd-hash interaction.
  
  Instead of rechecking relative paths for all hashed utilities after a cd,
  track if any utility in cmdtable depends on a relative path in PATH.
  If there is such a utility, cd clears the entire table.
  
  As a result, the '*' in hash no longer happens.

Modified:
  head/bin/sh/exec.c
  head/bin/sh/sh.1

Modified: head/bin/sh/exec.c
==
--- head/bin/sh/exec.c  Mon Jan 14 16:38:43 2013(r245425)
+++ head/bin/sh/exec.c  Mon Jan 14 16:40:50 2013(r245426)
@@ -86,12 +86,12 @@ struct tblentry {
union param param;  /* definition of builtin function */
int special;/* flag for special builtin commands */
signed char cmdtype;/* index identifying command */
-   char rehash;/* if set, cd done since entry created */
char cmdname[]; /* name of command */
 };
 
 
 static struct tblentry *cmdtable[CMDTABLESIZE];
+static int cmdtable_cd = 0;/* cmdtable contains cd-dependent entries */
 int exerrno = 0;   /* Last exec error */
 
 
@@ -305,8 +305,6 @@ printentry(struct tblentry *cmdp, int ve
error("internal error: cmdtype %d", cmdp->cmdtype);
 #endif
}
-   if (cmdp->rehash)
-   out1c('*');
out1c('\n');
 }
 
@@ -323,12 +321,12 @@ find_command(const char *name, struct cm
 {
struct tblentry *cmdp, loc_cmd;
int idx;
-   int prev;
char *fullname;
struct stat statb;
int e;
int i;
int spec;
+   int cd;
 
/* If name contains a slash, don't use the hash table */
if (strchr(name, '/') != NULL) {
@@ -337,8 +335,10 @@ find_command(const char *name, struct cm
return;
}
 
+   cd = 0;
+
/* If name is in the table, and not invalidated by cd, we're done */
-   if ((cmdp = cmdlookup(name, 0)) != NULL && cmdp->rehash == 0) {
+   if ((cmdp = cmdlookup(name, 0)) != NULL) {
if (cmdp->cmdtype == CMDFUNCTION && act & DO_NOFUNC)
cmdp = NULL;
else
@@ -359,13 +359,6 @@ find_command(const char *name, struct cm
}
 
/* We have to search path. */
-   prev = -1;  /* where to start */
-   if (cmdp) { /* doing a rehash */
-   if (cmdp->cmdtype == CMDBUILTIN)
-   prev = -1;
-   else
-   prev = cmdp->param.index;
-   }
 
e = ENOENT;
idx = -1;
@@ -380,13 +373,8 @@ loop:
goto loop;  /* ignore unimplemented options 
*/
}
}
-   /* if rehash, don't redo absolute path names */
-   if (fullname[0] == '/' && idx <= prev) {
-   if (idx < prev)
-   goto loop;
-   TRACE(("searchexec \"%s\": no change\n", name));
-   goto success;
-   }
+   if (fullname[0] != '/')
+   cd = 1;
if (stat(fullname, &statb) < 0) {
if (errno != ENOENT && errno != ENOTDIR)
e = errno;
@@ -426,9 +414,6 @@ loop:
goto success;
}
 
-   /* We failed.  If there was an entry for this command, delete it */
-   if (cmdp && cmdp->cmdtype != CMDFUNCTION)
-   delete_cmd_entry();
if (act & DO_ERR) {
if (e == ENOENT || e == ENOTDIR)
outfmt(out2, "%s: not found\n", name);
@@ -440,7 +425,8 @@ loop:
return;
 
 success:
-   cmdp->rehash = 0;
+   if (cd)
+   cmdtable_cd = 1;
entry->cmdtype = cmdp->cmdtype;
entry->u = cmdp->param;
entry->special = cmdp->special;
@@ -469,22 +455,15 @@ find_builtin(const char *name, int *spec
 
 
 /*
- * Called when a cd is done.  Marks all commands so the next time they
- * are executed they will be rehashed.
+ * Called when a cd is done.  If any entry in cmdtable depends on the current
+ * directory, simply clear cmdtable completely.
  */
 
 void
 hashcd(void)
 {
-   struct tblentry **pp;
-   struct tblentry *cmdp;
-
-   for (pp = cmdtable ; pp < &cmdtable[CMDTABLESIZE] ; pp++) {
-   for (cmdp = *pp ; cmdp ; cmdp = cmdp->next) {
-   if (cmdp->cmdtype == CMDNORMAL)
-   cmdp->rehash = 1;
-   }
-   }
+   if (cmdtable_cd)
+   clearcmdentry();
 }
 
 
@@ -526,6 +505,7 @@ clearcmdentry(void)
}
}
}
+   cmdtable_cd = 0;
INTON;
 }
 
@@ -566,7 +546,6 @@ cmdlookup(const char *name, int add

Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Alexander Motin
On 14.01.2013 17:09, Andre Oppermann wrote:
> On 13.01.2013 19:06, Alfred Perlstein wrote:
>> On 1/12/13 10:32 PM, Adrian Chadd wrote:
>>> On 12 January 2013 11:45, Alfred Perlstein  wrote:
>>>
 I'm not sure if regressing to the waterfall method of development is
 a good
 idea at this point.

 I see a light at the end of the tunnel and we to continue to just
 handle
 these minor corner cases as we progress.

 If we move to a model where a minor bug is grounds to completely remove
 helpful code then nothing will ever get done.

>>> Allocating 512MB worth of callwheels on a 16GB MIPS machine is a
>>> little silly, don't you think?
>>>
>>> That suggests to me that the extent of which maxfiles/maxusers/etc
>>> percolates the codebase wasn't totally understood by those who wish to
>>> change it.
>>>
>>> I'd rather see some more investigative work into outlining things that
>>> need fixing and start fixing those, rather than "just change stuff and
>>> fix whatever issues creep up."
>>>
>>> I kinda hope we all understand what we're working on in the kernel a
>>> little better than that.
>>
>> Cool!   I'm glad people are now aware of the callwheel allocation
>> being insane with large maxusers.
>>
>> I saw this about a month ago (if not longer), but since there were
>> half a dozen people calling me an
>> imbecile who hadn't really yet read the code I didn't want to inflame
>> them more by fixing that with
>> "a hack". (actually a simple fix).
>>
>> A simple fix is to clamp callwheel size to the previous result of a
>> maxusers of 384 and call it a day.
>>
>> However the simplicity of that approach would probably inflame too
>> many feelings so I am unsure as
>> how to proceed.
>>
>> Any ideas?
> 
> I noticed the callwheel dependency as well and asked mav@ about it
> in a short email exchange.  He said it has only little use and goes
> away with the calloutng import.  While that is outstanding we need
> to clamp it to a sane value.
> 
> However I don't know what a sane value would be and why its size is
> directly derived from maxproc and maxfiles.  If there can be one
> callout per process and open file descriptor in the system, then
> it probably has to be so big.  If it can deal with 'collisions'
> in the wheel it can be much smaller.

As I've actually written, there are two different things:
 ncallout -- number of preallocated callout structures for purposes of
timeout() calls. That is a legacy API that is probably not very much
used now, so that value don't need to be too big. But that allocation is
static and if it will ever be exhausted system will panic. That is why
it was set quite high. The right way now would be to analyze where that
API is still used and estimate the really required number.

 callwheelsize -- number of slots in the callwheel. That is purely
optimizational value. If set too low, it will just increase number of
hash collisions without effects other then some slowdown. Optimal value
here does depend on number of callouts in system, but not only. Since
array index there is not really a hash, it is practically useless to set
array size it higher then median callout interval divided by hz (or by
1ms in calloutng). The problem is to estimate that median value, that
completely depends on workload.

Each one ncallout cost 32-52 bytes, while one callwheelsize only 8-16
and could probably be reduced to 4-8 by replacing TAILQ with LIST. So
that is ncallout and respective timeout() API what should be managed in
first order.

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


svn commit: r245427 - in head/sys/dev/usb: . serial

2013-01-14 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jan 14 17:41:04 2013
New Revision: 245427
URL: http://svnweb.freebsd.org/changeset/base/245427

Log:
  Add new u3g device quirk.
  
  Submitted by: Lowell Gilbert
  MFC after:1 week

Modified:
  head/sys/dev/usb/serial/u3g.c
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/serial/u3g.c
==
--- head/sys/dev/usb/serial/u3g.c   Mon Jan 14 16:40:50 2013
(r245426)
+++ head/sys/dev/usb/serial/u3g.c   Mon Jan 14 17:41:04 2013
(r245427)
@@ -356,6 +356,7 @@ static const STRUCT_USB_HOST_ID u3g_devs
U3G_DEV(NOVATEL, V740, 0),
U3G_DEV(NOVATEL, X950D, 0),
U3G_DEV(NOVATEL, XU870, 0),
+   U3G_DEV(MOTOROLA2, MB886, U3GINIT_SCSIEJECT),
U3G_DEV(OPTION, E6500, 0),
U3G_DEV(OPTION, E6501, 0),
U3G_DEV(OPTION, E6601, 0),

Modified: head/sys/dev/usb/usbdevs
==
--- head/sys/dev/usb/usbdevsMon Jan 14 16:40:50 2013(r245426)
+++ head/sys/dev/usb/usbdevsMon Jan 14 17:41:04 2013(r245427)
@@ -2939,6 +2939,7 @@ product MOTOROLA2 A41XV32X0x2a22  A41x/V
 product MOTOROLA2 E398 0x4810  E398 Mobile Phone
 product MOTOROLA2 USBLAN   0x600c  USBLAN
 product MOTOROLA2 USBLAN2  0x6027  USBLAN
+product MOTOROLA2 MB8860x710f  MB886 Mobile Phone (Atria HD)
 product MOTOROLA4 RT2770   0x9031  RT2770
 product MOTOROLA4 RT3070   0x9032  RT3070
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245428 - head/include

2013-01-14 Thread Dimitry Andric
Author: dim
Date: Mon Jan 14 18:01:19 2013
New Revision: 245428
URL: http://svnweb.freebsd.org/changeset/base/245428

Log:
  Add CLOCK_PROCESS_CPUTIME_ID to , to synchronize the CLOCK_*
  values with those in .  Otherwise, if a program includes
   before , the CLOCK_PROCESS_CPUTIME_ID macro never
  gets defined.
  
  Reviewed by:  davidxu
  X-MFC-With:   239347

Modified:
  head/include/time.h

Modified: head/include/time.h
==
--- head/include/time.h Mon Jan 14 17:41:04 2013(r245427)
+++ head/include/time.h Mon Jan 14 18:01:19 2013(r245428)
@@ -112,6 +112,7 @@ typedef __pid_t pid_t;
 #define CLOCK_MONOTONIC_FAST   12  /* FreeBSD-specific. */
 #define CLOCK_SECOND   13  /* FreeBSD-specific. */
 #define CLOCK_THREAD_CPUTIME_ID14
+#defineCLOCK_PROCESS_CPUTIME_ID15
 #endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
 
 #if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Andre Oppermann

On 14.01.2013 16:51, Alexander Motin wrote:

On 14.01.2013 17:09, Andre Oppermann wrote:

On 13.01.2013 19:06, Alfred Perlstein wrote:

On 1/12/13 10:32 PM, Adrian Chadd wrote:

On 12 January 2013 11:45, Alfred Perlstein  wrote:


I'm not sure if regressing to the waterfall method of development is
a good
idea at this point.

I see a light at the end of the tunnel and we to continue to just
handle
these minor corner cases as we progress.

If we move to a model where a minor bug is grounds to completely remove
helpful code then nothing will ever get done.


Allocating 512MB worth of callwheels on a 16GB MIPS machine is a
little silly, don't you think?

That suggests to me that the extent of which maxfiles/maxusers/etc
percolates the codebase wasn't totally understood by those who wish to
change it.

I'd rather see some more investigative work into outlining things that
need fixing and start fixing those, rather than "just change stuff and
fix whatever issues creep up."

I kinda hope we all understand what we're working on in the kernel a
little better than that.


Cool!   I'm glad people are now aware of the callwheel allocation
being insane with large maxusers.

I saw this about a month ago (if not longer), but since there were
half a dozen people calling me an
imbecile who hadn't really yet read the code I didn't want to inflame
them more by fixing that with
"a hack". (actually a simple fix).

A simple fix is to clamp callwheel size to the previous result of a
maxusers of 384 and call it a day.

However the simplicity of that approach would probably inflame too
many feelings so I am unsure as
how to proceed.

Any ideas?


I noticed the callwheel dependency as well and asked mav@ about it
in a short email exchange.  He said it has only little use and goes
away with the calloutng import.  While that is outstanding we need
to clamp it to a sane value.

However I don't know what a sane value would be and why its size is
directly derived from maxproc and maxfiles.  If there can be one
callout per process and open file descriptor in the system, then
it probably has to be so big.  If it can deal with 'collisions'
in the wheel it can be much smaller.


As I've actually written, there are two different things:
  ncallout -- number of preallocated callout structures for purposes of
timeout() calls. That is a legacy API that is probably not very much
used now, so that value don't need to be too big. But that allocation is
static and if it will ever be exhausted system will panic. That is why
it was set quite high. The right way now would be to analyze where that
API is still used and estimate the really required number.


Can timeout() be emulated on top of another API so we can do away with it?


  callwheelsize -- number of slots in the callwheel. That is purely
optimizational value. If set too low, it will just increase number of
hash collisions without effects other then some slowdown. Optimal value
here does depend on number of callouts in system, but not only. Since
array index there is not really a hash, it is practically useless to set
array size it higher then median callout interval divided by hz (or by
1ms in calloutng). The problem is to estimate that median value, that
completely depends on workload.


OK.  So for example a large number of TCP connection would use up a
large number of slots in the callwheel.  I'll try to come up with a
reasonable sane scaling value.


Each one ncallout cost 32-52 bytes, while one callwheelsize only 8-16
and could probably be reduced to 4-8 by replacing TAILQ with LIST. So
that is ncallout and respective timeout() API what should be managed in
first order.


I'll give it a try.

--
Andre

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


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Alfred Perlstein

On 1/14/13 11:05 AM, Andre Oppermann wrote:


Can timeout() be emulated on top of another API so we can do away with 
it?


yes, this is what callout(9) is for.

there are a few consumers left (see the email I just sent out).

those consumers would just have to allocate their own callout 
handle/struct and pass that to callout instead of using timeout(9).


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


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Alexander Motin
On 14.01.2013 18:05, Andre Oppermann wrote:
> On 14.01.2013 16:51, Alexander Motin wrote:
>> As I've actually written, there are two different things:
>>   ncallout -- number of preallocated callout structures for purposes of
>> timeout() calls. That is a legacy API that is probably not very much
>> used now, so that value don't need to be too big. But that allocation is
>> static and if it will ever be exhausted system will panic. That is why
>> it was set quite high. The right way now would be to analyze where that
>> API is still used and estimate the really required number.
> 
> Can timeout() be emulated on top of another API so we can do away with it?

It is already emulated on top of callout_init()/callout_reset(). The
problem is that callout_init()/callout_reset() assume storage memory to
be allocated by consumer, while timeout() assumes it to be allocated by
subsystem. The only way to solve it is to rewrite remaining timeout()
consumers to use callout_init()/callout_reset() API directly.

>>   callwheelsize -- number of slots in the callwheel. That is purely
>> optimizational value. If set too low, it will just increase number of
>> hash collisions without effects other then some slowdown. Optimal value
>> here does depend on number of callouts in system, but not only. Since
>> array index there is not really a hash, it is practically useless to set
>> array size it higher then median callout interval divided by hz (or by
>> 1ms in calloutng). The problem is to estimate that median value, that
>> completely depends on workload.
> 
> OK.  So for example a large number of TCP connection would use up a
> large number of slots in the callwheel.  I'll try to come up with a
> reasonable sane scaling value.

Yes, it _may_ use, but that also depends on time intervals. If most of
these TCP timeouts will be few seconds long for ACK timeout, there will
be no any performance difference between having callwheelsize of 100*hz
and 1*hz. Same time, if periods are measured in hours, like for
keep-alives, increasing callwheelsize may be effective.

>> Each one ncallout cost 32-52 bytes, while one callwheelsize only 8-16
>> and could probably be reduced to 4-8 by replacing TAILQ with LIST. So
>> that is ncallout and respective timeout() API what should be managed in
>> first order.
> 
> I'll give it a try.

Thanks.

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


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread John Baldwin
On Monday, January 14, 2013 10:51:27 am Alexander Motin wrote:
> As I've actually written, there are two different things:
>  ncallout -- number of preallocated callout structures for purposes of
> timeout() calls. That is a legacy API that is probably not very much
> used now, so that value don't need to be too big. But that allocation is
> static and if it will ever be exhausted system will panic. That is why
> it was set quite high. The right way now would be to analyze where that
> API is still used and estimate the really required number.

FYI, I have slowly been working through the tree fixing users of timeout()
to use callout_*() instead.

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


Re: svn commit: r245426 - head/bin/sh

2013-01-14 Thread Eitan Adler
On 14 January 2013 11:40, Jilles Tjoelker  wrote:
> Author: jilles
> Date: Mon Jan 14 16:40:50 2013
> New Revision: 245426
> URL: http://svnweb.freebsd.org/changeset/base/245426
>
> Log:
>   sh: Simplify cd-hash interaction.
>
>   Instead of rechecking relative paths for all hashed utilities after a cd,
>   track if any utility in cmdtable depends on a relative path in PATH.
>   If there is such a utility, cd clears the entire table.

Why not clear just these entries instead of the entire table?

-- 
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Alfred Perlstein

On 1/14/13 12:55 PM, John Baldwin wrote:

On Monday, January 14, 2013 10:51:27 am Alexander Motin wrote:

As I've actually written, there are two different things:
  ncallout -- number of preallocated callout structures for purposes of
timeout() calls. That is a legacy API that is probably not very much
used now, so that value don't need to be too big. But that allocation is
static and if it will ever be exhausted system will panic. That is why
it was set quite high. The right way now would be to analyze where that
API is still used and estimate the really required number.

FYI, I have slowly been working through the tree fixing users of timeout()
to use callout_*() instead.

We would surely be in a bad place had you not taken so much time to fix 
nearly all those instances.  It is very much appreciated.


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


svn commit: r245433 - head/sys/geom/raid

2013-01-14 Thread Alexander Motin
Author: mav
Date: Mon Jan 14 20:31:45 2013
New Revision: 245433
URL: http://svnweb.freebsd.org/changeset/base/245433

Log:
  Keep value of orig_config_id metadata field.  Windows driver writes there
  previous value of config_id when it is changed in some cases.  I guess it
  may be used do avoid some split-brain conditions.

Modified:
  head/sys/geom/raid/md_intel.c

Modified: head/sys/geom/raid/md_intel.c
==
--- head/sys/geom/raid/md_intel.c   Mon Jan 14 20:26:50 2013
(r245432)
+++ head/sys/geom/raid/md_intel.c   Mon Jan 14 20:31:45 2013
(r245433)
@@ -216,6 +216,7 @@ struct g_raid_md_intel_pervolume {
 struct g_raid_md_intel_object {
struct g_raid_md_object  mdio_base;
uint32_t mdio_config_id;
+   uint32_t mdio_orig_config_id;
uint32_t mdio_generation;
struct intel_raid_conf  *mdio_meta;
struct callout   mdio_start_co; /* STARTING state timer. */
@@ -717,7 +718,7 @@ intel_meta_write_spare(struct g_consumer
memcpy(&meta->version[0], INTEL_VERSION_1000,
sizeof(INTEL_VERSION_1000) - 1);
meta->config_size = INTEL_MAX_MD_SIZE(1);
-   meta->config_id = arc4random();
+   meta->config_id = meta->orig_config_id = arc4random();
meta->generation = 1;
meta->total_disks = 1;
meta->disk[0] = *d;
@@ -1318,7 +1319,7 @@ g_raid_md_create_intel(struct g_raid_md_
char name[16];
 
mdi = (struct g_raid_md_intel_object *)md;
-   mdi->mdio_config_id = arc4random();
+   mdi->mdio_config_id = mdi->mdio_orig_config_id = arc4random();
mdi->mdio_generation = 0;
snprintf(name, sizeof(name), "Intel-%08x", mdi->mdio_config_id);
sc = g_raid_create_node(mp, name, md);
@@ -1463,6 +1464,7 @@ search:
} else { /* Not found matching node -- create one. */
result = G_RAID_MD_TASTE_NEW;
mdi->mdio_config_id = meta->config_id;
+   mdi->mdio_orig_config_id = meta->orig_config_id;
snprintf(name, sizeof(name), "Intel-%08x", meta->config_id);
sc = g_raid_create_node(mp, name, md);
md->mdo_softc = sc;
@@ -2292,6 +2294,7 @@ g_raid_md_write_intel(struct g_raid_md_o
memcpy(&meta->intel_id[0], INTEL_MAGIC, sizeof(INTEL_MAGIC) - 1);
meta->config_size = INTEL_MAX_MD_SIZE(numdisks);
meta->config_id = mdi->mdio_config_id;
+   meta->orig_config_id = mdi->mdio_orig_config_id;
meta->generation = mdi->mdio_generation;
meta->attributes = INTEL_ATTR_CHECKSUM;
meta->total_disks = numdisks;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245434 - in head/sys: dev/cxgbe dev/cxgbe/common dev/cxgbe/tom modules/cxgbe/tom

2013-01-14 Thread Navdeep Parhar
Author: np
Date: Mon Jan 14 20:36:22 2013
New Revision: 245434
URL: http://svnweb.freebsd.org/changeset/base/245434

Log:
  cxgbe(4): Updates to the hardware L2 table management code.
  
  - Add full support for IPv6 addresses.
  
  - Read the size of the L2 table during attach.  Do not assume that PCIe
physical function 4 of the card has all of the table to itself.
  
  - Use FNV instead of Jenkins to hash L3 addresses and drop the private
copy of jhash.h from the driver.
  
  MFC after:1 week

Deleted:
  head/sys/dev/cxgbe/common/jhash.h
Modified:
  head/sys/dev/cxgbe/offload.h
  head/sys/dev/cxgbe/t4_l2t.c
  head/sys/dev/cxgbe/t4_l2t.h
  head/sys/dev/cxgbe/t4_main.c
  head/sys/dev/cxgbe/tom/t4_tom_l2t.c
  head/sys/modules/cxgbe/tom/Makefile

Modified: head/sys/dev/cxgbe/offload.h
==
--- head/sys/dev/cxgbe/offload.hMon Jan 14 20:31:45 2013
(r245433)
+++ head/sys/dev/cxgbe/offload.hMon Jan 14 20:36:22 2013
(r245434)
@@ -104,8 +104,8 @@ struct tid_info {
 };
 
 struct t4_range {
-   unsigned int start;
-   unsigned int size;
+   u_int start;
+   u_int size;
 };
 
 struct t4_virt_res {  /* virtualized HW resources */
@@ -117,6 +117,7 @@ struct t4_virt_res {
struct t4_range qp;
struct t4_range cq;
struct t4_range ocq;
+   struct t4_range l2t;
 };
 
 #ifdef TCP_OFFLOAD

Modified: head/sys/dev/cxgbe/t4_l2t.c
==
--- head/sys/dev/cxgbe/t4_l2t.c Mon Jan 14 20:31:45 2013(r245433)
+++ head/sys/dev/cxgbe/t4_l2t.c Mon Jan 14 20:36:22 2013(r245434)
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "common/common.h"
-#include "common/jhash.h"
 #include "common/t4_msg.h"
 #include "t4_l2t.h"
 
@@ -78,7 +77,7 @@ t4_alloc_l2e(struct l2t_data *d)
return (NULL);
 
/* there's definitely a free entry */
-   for (e = d->rover, end = &d->l2tab[L2T_SIZE]; e != end; ++e)
+   for (e = d->rover, end = &d->l2tab[d->l2t_size]; e != end; ++e)
if (atomic_load_acq_int(&e->refcnt) == 0)
goto found;
 
@@ -115,6 +114,7 @@ t4_write_l2e(struct adapter *sc, struct 
 {
struct wrqe *wr;
struct cpl_l2t_write_req *req;
+   int idx = e->idx + sc->vres.l2t.start;
 
mtx_assert(&e->lock, MA_OWNED);
 
@@ -124,10 +124,10 @@ t4_write_l2e(struct adapter *sc, struct 
req = wrtod(wr);
 
INIT_TP_WR(req, 0);
-   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, e->idx |
+   OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_L2T_WRITE_REQ, idx |
V_SYNC_WR(sync) | V_TID_QID(sc->sge.fwq.abs_id)));
req->params = htons(V_L2T_W_PORT(e->lport) | V_L2T_W_NOREPLY(!sync));
-   req->l2t_idx = htons(e->idx);
+   req->l2t_idx = htons(idx);
req->vlan = htons(e->vlan);
memcpy(req->dst_mac, e->dmac, sizeof(req->dst_mac));
 
@@ -183,18 +183,24 @@ t4_l2t_set_switching(struct adapter *sc,
 int
 t4_init_l2t(struct adapter *sc, int flags)
 {
-   int i;
+   int i, l2t_size;
struct l2t_data *d;
 
-   d = malloc(sizeof(*d), M_CXGBE, M_ZERO | flags);
+   l2t_size = sc->vres.l2t.size;
+   if (l2t_size < 2)   /* At least 1 bucket for IP and 1 for IPv6 */
+   return (EINVAL);
+
+   d = malloc(sizeof(*d) + l2t_size * sizeof (struct l2t_entry), M_CXGBE,
+   M_ZERO | flags);
if (!d)
return (ENOMEM);
 
+   d->l2t_size = l2t_size;
d->rover = d->l2tab;
-   atomic_store_rel_int(&d->nfree, L2T_SIZE);
+   atomic_store_rel_int(&d->nfree, l2t_size);
rw_init(&d->lock, "L2T");
 
-   for (i = 0; i < L2T_SIZE; i++) {
+   for (i = 0; i < l2t_size; i++) {
struct l2t_entry *e = &d->l2tab[i];
 
e->idx = i;
@@ -215,7 +221,7 @@ t4_free_l2t(struct l2t_data *d)
 {
int i;
 
-   for (i = 0; i < L2T_SIZE; i++)
+   for (i = 0; i < d->l2t_size; i++)
mtx_destroy(&d->l2tab[i].lock);
rw_destroy(&d->lock);
free(d, M_CXGBE);
@@ -229,11 +235,11 @@ do_l2t_write_rpl(struct sge_iq *iq, cons
 {
const struct cpl_l2t_write_rpl *rpl = (const void *)(rss + 1);
unsigned int tid = GET_TID(rpl);
-   unsigned int idx = tid & (L2T_SIZE - 1);
+   unsigned int idx = tid % L2T_SIZE;
 
if (__predict_false(rpl->status != CPL_ERR_NONE)) {
log(LOG_ERR,
-   "Unexpected L2T_WRITE_RPL status %u for entry %u\n",
+   "Unexpected L2T_WRITE_RPL (%u) for entry at hw_idx %u\n",
rpl->status, idx);
return (EINVAL);
}
@@ -269,7 +275,7 @@ sysctl_l2t(SYSCTL_HANDLER_ARGS)
struct l2t_entry *e;
struct sbuf *sb;
int rc, i, header = 0;
-   char ip[6

svn commit: r245435 - in head: share/man/man5 tools/build/options

2013-01-14 Thread Brooks Davis
Author: brooks
Date: Mon Jan 14 20:38:32 2013
New Revision: 245435
URL: http://svnweb.freebsd.org/changeset/base/245435

Log:
  Remember the . in .\" in the WITH_NMTREE file and regenerate the output.
  
  Reported by:  joeld

Modified:
  head/share/man/man5/src.conf.5
  head/tools/build/options/WITH_NMTREE

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Jan 14 20:36:22 2013
(r245434)
+++ head/share/man/man5/src.conf.5  Mon Jan 14 20:38:32 2013
(r245435)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 236279 2012-05-30 02:37:20Z 
gjb
 .\" $FreeBSD$
-.Dd January 9, 2013
+.Dd January 14, 2013
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -805,7 +805,7 @@ Set to not build NLS catalogs.
 Set to not build NLS catalog support for
 .Xr csh 1 .
 .It Va WITH_NMTREE
-\" $FreeBSD$
+.\" from FreeBSD: head/tools/build/options/WITH_NMTREE 245241 2013-01-09 
21:07:08Z brooks
 Set to install
 .Xr nmtree 8
 as

Modified: head/tools/build/options/WITH_NMTREE
==
--- head/tools/build/options/WITH_NMTREEMon Jan 14 20:36:22 2013
(r245434)
+++ head/tools/build/options/WITH_NMTREEMon Jan 14 20:38:32 2013
(r245435)
@@ -1,4 +1,4 @@
-\" $FreeBSD$
+.\" $FreeBSD$
 Set to install
 .Xr nmtree 8
 as
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245437 - in head/usr.sbin/bsdconfig: console password password/share share startup startup/share usermgmt usermgmt/share

2013-01-14 Thread Devin Teske
Author: dteske
Date: Mon Jan 14 21:03:34 2013
New Revision: 245437
URL: http://svnweb.freebsd.org/changeset/base/245437

Log:
  Don't use f_show_msg() unless printf(1) syntax is required (this reduces the
  number of unnecessary forks).

Modified:
  head/usr.sbin/bsdconfig/console/ttys
  head/usr.sbin/bsdconfig/password/password
  head/usr.sbin/bsdconfig/password/share/password.subr
  head/usr.sbin/bsdconfig/share/mustberoot.subr
  head/usr.sbin/bsdconfig/share/variable.subr
  head/usr.sbin/bsdconfig/startup/misc
  head/usr.sbin/bsdconfig/startup/rcdelete
  head/usr.sbin/bsdconfig/startup/rcvar
  head/usr.sbin/bsdconfig/startup/share/rcconf.subr
  head/usr.sbin/bsdconfig/startup/share/rcedit.subr
  head/usr.sbin/bsdconfig/usermgmt/groupinput
  head/usr.sbin/bsdconfig/usermgmt/share/group_input.subr
  head/usr.sbin/bsdconfig/usermgmt/share/user_input.subr
  head/usr.sbin/bsdconfig/usermgmt/userinput

Modified: head/usr.sbin/bsdconfig/console/ttys
==
--- head/usr.sbin/bsdconfig/console/ttysMon Jan 14 20:49:37 2013
(r245436)
+++ head/usr.sbin/bsdconfig/console/ttysMon Jan 14 21:03:34 2013
(r245437)
@@ -192,7 +192,7 @@ while :; do
err=$( ttys_set_type "$consterm" 2>&1 )
[ "$err" ] || break
 
-   f_show_msg "%s" "$err"
+   f_dialog_msgbox "$err"
 done
 
 exit $SUCCESS

Modified: head/usr.sbin/bsdconfig/password/password
==
--- head/usr.sbin/bsdconfig/password/password   Mon Jan 14 20:49:37 2013
(r245436)
+++ head/usr.sbin/bsdconfig/password/password   Mon Jan 14 21:03:34 2013
(r245437)
@@ -72,7 +72,7 @@ f_mustberoot_init
 if f_dialog_input_password; then
err=$( echo "$pw_password" | pw usermod $USER_ROOT -h 0 2>&1 ) ||
f_die $? "%s" "$err"
-   f_show_msg "$msg_password_changed"
+   f_dialog_msgbox "$msg_password_changed"
 fi
 
 return $SUCCESS

Modified: head/usr.sbin/bsdconfig/password/share/password.subr
==
--- head/usr.sbin/bsdconfig/password/share/password.subrMon Jan 14 
20:49:37 2013(r245436)
+++ head/usr.sbin/bsdconfig/password/share/password.subrMon Jan 14 
21:03:34 2013(r245437)
@@ -108,13 +108,13 @@ f_dialog_input_password()
 
# Check for NULL entry
if ! [ "$_password1" -o "$_password2" ]; then
-   f_show_msg "$msg_password_is_empty"
+   f_dialog_msgbox "$msg_password_is_empty"
continue
fi
 
# Check for password mismatch
if [ "$_password1" != "$_password2" ]; then
-   f_show_msg "$msg_passwords_do_not_match"
+   f_dialog_msgbox "$msg_passwords_do_not_match"
continue
fi
 

Modified: head/usr.sbin/bsdconfig/share/mustberoot.subr
==
--- head/usr.sbin/bsdconfig/share/mustberoot.subr   Mon Jan 14 20:49:37 
2013(r245436)
+++ head/usr.sbin/bsdconfig/share/mustberoot.subr   Mon Jan 14 21:03:34 
2013(r245437)
@@ -128,7 +128,7 @@ f_become_root_via_sudo()
1) # Always try sudo(8) when run as $user
local err
if ! err=$( touch "$checkpath" 2>&1 ); then
-   f_show_msg "%s" "$err"
+   f_dialog_msgbox "$err"
else
f_show_msg "$msg_created_path" "$checkpath"
fi

Modified: head/usr.sbin/bsdconfig/share/variable.subr
==
--- head/usr.sbin/bsdconfig/share/variable.subr Mon Jan 14 20:49:37 2013
(r245436)
+++ head/usr.sbin/bsdconfig/share/variable.subr Mon Jan 14 21:03:34 2013
(r245437)
@@ -118,7 +118,7 @@ f_variable_set_defaults()
 #
 # Dump a list of registered/advertised variables and their respective values to
 # $VARIABLE_DUMPFILE. Returns success unless the file couldn't be written. If
-# an error occurs, it is displayed using f_show_msg() (from common.subr).
+# an error occurs, it is displayed using f_dialog_msgbox() (from dialog.subr).
 #
 f_dump_variables()
 {
@@ -131,7 +131,7 @@ f_dump_variables()
printf "%s='%s'\n" "$var" "$value"
  done > "$VARIABLE_DUMPFILE" ) 2>&1
); then
-   f_show_msg "%s" "$err"
+   f_dialog_msgbox "$err"
return $FAILURE
fi
 }

Modified: head/usr.sbin/bsdconfig/startup/misc
==
--- head/usr.sbin/bsdconfig/startup/miscMon Jan 14 20:49:37 2013
(r2454

Re: svn commit: r245269 - head/share/mk

2013-01-14 Thread Steve Kargl
On Thu, Jan 10, 2013 at 10:44:19PM +, Dag-Erling Smørgrav wrote:
> Author: des
> Date: Thu Jan 10 22:44:19 2013
> New Revision: 245269
> URL: http://svnweb.freebsd.org/changeset/base/245269
> 
> Log:
>   Remove all support for legacy NOFOO and NO_FOO build options.
> 

This commit caused

===> kerberos5/doc (buildincludes)
===> kerberos5/lib (buildincludes)
===> kerberos5/lib/libasn1 (buildincludes)
compile_et 
/usr/src/kerberos5/lib/libasn1/../../../crypto/heimdal/lib/asn1/asn1_err.et
compile_et: No such file or directory
*** [asn1_err.h] Error code 1

Stop in /usr/src/kerberos5/lib/libasn1.
*** [buildincludes] Error code 1

Stop in /usr/src/kerberos5/lib.
*** [buildincludes] Error code 1

because I had forgotten that several years ago I added 
NO_KERBEROS to my /etc/make.conf.  After wasting a day
trying to figure out how and who broke world, including
reading the top of src/UPDATING, I recalled this commit
and checked my /etc/make.conf.  Setting WITHOUT_KERBEROS="YES"
in /etc/make.conf allowed buildworld to complete.  I 
suggest adding a blurb to src/UPDATING to help others
with memory loss issues.

Index: UPDATING
===
--- UPDATING(revision 245426)
+++ UPDATING(working copy)
@@ -26,6 +26,13 @@
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+
+20130110:
+   Revision 245269 removed the legacy support for NOFOO and NO_FOO 
+   build options.  Individuals should review their /etc/make.conf
+   and /etc/src.conf for (long forgotten) NOFOO and NO_FOO, and 
+   changes these to WITHOUT_FOO.
+
 20121223:
After switching to Clang as the default compiler some users of ZFS
on i386 systems started to experience stack overflow kernel panics.


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


Re: svn commit: r245426 - head/bin/sh

2013-01-14 Thread Jilles Tjoelker
On Mon, Jan 14, 2013 at 01:38:51PM -0500, Eitan Adler wrote:
> On 14 January 2013 11:40, Jilles Tjoelker  wrote:
> > Author: jilles
> > Date: Mon Jan 14 16:40:50 2013
> > New Revision: 245426
> > URL: http://svnweb.freebsd.org/changeset/base/245426

> > Log:
> >   sh: Simplify cd-hash interaction.

> >   Instead of rechecking relative paths for all hashed utilities after a cd,
> >   track if any utility in cmdtable depends on a relative path in PATH.
> >   If there is such a utility, cd clears the entire table.

> Why not clear just these entries instead of the entire table?

Clearing too much might affect performance but not correctness. The
utilities will be looked up again if necessary.

Because it is uncommon nowadays to include a relative pathname in PATH,
I handle this case in a very simple manner.

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


svn commit: r245440 - in head: . etc

2013-01-14 Thread Brooks Davis
Author: brooks
Date: Tue Jan 15 00:12:34 2013
New Revision: 245440
URL: http://svnweb.freebsd.org/changeset/base/245440

Log:
  Add an option DB_FROM_SRC to use src/etc's user/group databases when
  installing.  This allows things like running installworld for 10-CURRENT
  on a 9.0-RELEASE system without adding extra users and groups to the
  passwd and group files.
  
  To prevent potentially risky uid/gid mismatches on systems with
  non-standard local values, require that DESTDIR be set if DB_FROM_SRC is
  set.
  
  Sponsored by: DARPA, AFRL
  Reviewed by:  peter

Modified:
  head/Makefile.inc1
  head/etc/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Mon Jan 14 22:00:43 2013(r245439)
+++ head/Makefile.inc1  Tue Jan 15 00:12:34 2013(r245440)
@@ -13,6 +13,8 @@
 #  -DNO_PORTSUPDATE do not update ports in ${MAKE} update
 #  -DNO_DOCUPDATE do not update doc in ${MAKE} update
 #  -DNO_WWWUPDATE do not update www in ${MAKE} update
+#  -DDB_FROM_SRC use the user/group databases in src/etc instead of
+#  the system database when installing.
 #  -DNO_CTF do not run the DTrace CTF conversion tools on built objects
 #  LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
 #  LOCAL_LIB_DIRS="list of dirs" to add additional dirs to libraries target
@@ -340,12 +342,13 @@ LIB32WMAKEFLAGS+= \
 
 LIB32WMAKE=${LIB32WMAKEENV} ${MAKE} ${LIB32WMAKEFLAGS} \
-DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO -DWITHOUT_HTML
-LIB32IMAKE=${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS
+LIB32IMAKE=${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS \
+   ${IMAKE_INSTALL}
 .endif
 
-# install stage
 IMAKEENV=  ${CROSSENV:N_LDSCRIPTROOT=*}
-IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1
+IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 \
+   ${IMAKE_INSTALL} ${IMAKE_MTREE}
 .if empty(.MAKEFLAGS:M-n)
 IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \
LD_LIBRARY_PATH=${INSTALLTMP} \
@@ -354,6 +357,10 @@ IMAKE+=__MAKE_SHELL=${INSTALLTMP}/sh
 .else
 IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMP}
 .endif
+.if defined(DB_FROM_SRC)
+IMAKE_INSTALL= INSTALL="install -N ${.CURDIR}/etc"
+IMAKE_MTREE=   MTREE_CMD="nmtree -N ${.CURDIR}/etc"
+.endif
 
 # kernel stage
 KMAKEENV=  ${WMAKEENV}
@@ -595,9 +602,11 @@ kernel-toolchain: ${TOOLCHAIN_TGTS:N_inc
 installcheck:
 
 #
-# Require DESTDIR to be set if installing for a different architecture.
+# Require DESTDIR to be set if installing for a different architecture or
+# using the user/group database in the source tree.
 #
-.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE}
+.if ${TARGET_ARCH} != ${MACHINE_ARCH} || ${TARGET} != ${MACHINE} || \
+defined(DB_FROM_SRC)
 .if !make(distributeworld)
 installcheck: installcheck_DESTDIR
 installcheck_DESTDIR:
@@ -608,6 +617,7 @@ installcheck_DESTDIR:
 .endif
 .endif
 
+.if !defined(DB_FROM_SRC)
 #
 # Check for missing UIDs/GIDs.
 #
@@ -635,6 +645,7 @@ installcheck_UGID:
false; \
fi
 .endfor
+.endif
 
 #
 # Required install tools to be saved in a scratch dir for safety.
@@ -692,6 +703,7 @@ distributeworld installworld: installche
done); \
cp $$libs $$progs ${INSTALLTMP}
cp -R $${PATH_LOCALE:-"/usr/share/locale"} ${INSTALLTMP}/locale
+   rm -f ${METALOG}
 .if make(distributeworld)
 .for dist in ${EXTRA_DISTRIBUTIONS}
-mkdir ${DESTDIR}/${DISTDIR}/${dist}
@@ -753,7 +765,8 @@ redistribute:
 .endif
 
 distrib-dirs distribution:
-   cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} ${.TARGET}
+   cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \
+   ${IMAKE_INSTALL} ${.TARGET}
 
 #
 # buildkernel and installkernel
@@ -1059,6 +1072,11 @@ _lex=usr.bin/lex
 _yacc= usr.bin/yacc
 .endif
 
+.if defined(DB_FROM_SRC) && ${BOOTSTRAPPING} < 126
+_nmtree=   lib/libnetbsd \
+   usr.sbin/nmtree
+.endif
+
 .if ${BOOTSTRAPPING} >= 900040 && ${BOOTSTRAPPING} < 900041
 _awk=  usr.bin/awk
 .endif
@@ -1120,7 +1138,8 @@ bootstrap-tools:
 ${_lex} \
 usr.bin/xinstall \
 ${_gensnmptree} \
-usr.sbin/config
+usr.sbin/config \
+${_nmtree}
${_+_}@${ECHODIR} "===> ${_tool} (obj,depend,all,install)"; \
cd ${.CURDIR}/${_tool}; \
${MAKE} DIRPRFX=${_tool}/ obj; \

Modified: head/etc/Makefile
==
--- head/etc/Makefile   Mon Jan 14 22:00:43 2013(r245439)
+++ head/etc/Makefile   Tue Jan 15 00:12:34 2013(r245440)
@@ -291,25 +291,27 @@ distribution:
${DESTDIR}/etc/nsswitch.conf
 .endif
 
+MTREE_CMD?=mtree
+
 distrib-dirs:
-   mtree -eU ${MTREE_FOLLOWS_SYMLINKS} -f ${.CURDIR}/mtree/BSD.root.dist 

svn commit: r245441 - head/sys/dev/cxgbe/tom

2013-01-14 Thread Navdeep Parhar
Author: np
Date: Tue Jan 15 00:24:01 2013
New Revision: 245441
URL: http://svnweb.freebsd.org/changeset/base/245441

Log:
  cxgbe/tom: Miscellaneous updates for TOE+IPv6 support (more to follow).
  
  - Teach find_best_mtu_idx() to deal with IPv6 endpoints.
  
  - Install correct protosw in offloaded TCP/IPv6 sockets when DDP is
enabled.
  
  - Move set_tcp_ddp_ulp_mode to t4_tom.c so that t4_tom.h can be included
without having to drag in t4_msg.h too.  This was bothering the iWARP
driver for some reason.
  
  MFC after:1 week

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 15 00:12:34 2013
(r245440)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 15 00:24:01 2013
(r245441)
@@ -29,6 +29,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
+#include "opt_inet6.h"
 
 #include 
 #include 
@@ -43,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #define TCPSTATES
 #include 
@@ -58,6 +60,9 @@ __FBSDID("$FreeBSD$");
 static struct protosw ddp_protosw;
 static struct pr_usrreqs ddp_usrreqs;
 
+static struct protosw ddp6_protosw;
+static struct pr_usrreqs ddp6_usrreqs;
+
 /* Module ops */
 static int t4_tom_mod_load(void);
 static int t4_tom_mod_unload(void);
@@ -170,8 +175,12 @@ offload_socket(struct socket *so, struct
sb = &so->so_rcv;
SOCKBUF_LOCK(sb);
sb->sb_flags |= SB_NOCOALESCE;
-   if (toep->ulp_mode == ULP_MODE_TCPDDP)
-   so->so_proto = &ddp_protosw;
+   if (toep->ulp_mode == ULP_MODE_TCPDDP) {
+   if (inp->inp_vflag & INP_IPV6)
+   so->so_proto = &ddp6_protosw;
+   else
+   so->so_proto = &ddp_protosw;
+   }
SOCKBUF_UNLOCK(sb);
 
/* Update TCP PCB */
@@ -394,7 +403,7 @@ int
 find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc, int pmss)
 {
unsigned short *mtus = &sc->params.mtus[0];
-   int i = 0, mss;
+   int i, mss, n;
 
KASSERT(inc != NULL || pmss > 0,
("%s: at least one of inc/pmss must be specified", __func__));
@@ -403,8 +412,13 @@ find_best_mtu_idx(struct adapter *sc, st
if (pmss > 0 && mss > pmss)
mss = pmss;
 
-   while (i < NMTUS - 1 && mtus[i + 1] <= mss + 40)
-   ++i;
+   if (inc->inc_flags & INC_ISIPV6)
+   n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
+   else
+   n = sizeof(struct ip) + sizeof(struct tcphdr);
+
+   for (i = 0; i < NMTUS - 1 && mtus[i + 1] <= mss + n; i++)
+   continue;
 
return (i);
 }
@@ -513,6 +527,15 @@ select_ntuple(struct port_info *pi, stru
return (htobe32(ntuple));
 }
 
+void
+set_tcpddp_ulp_mode(struct toepcb *toep)
+{
+
+   toep->ulp_mode = ULP_MODE_TCPDDP;
+   toep->ddp_flags = DDP_OK;
+   toep->ddp_score = DDP_LOW_SCORE;
+}
+
 static int
 alloc_tid_tabs(struct tid_info *t)
 {
@@ -698,17 +721,24 @@ static int
 t4_tom_mod_load(void)
 {
int rc;
-   struct protosw *tcp_protosw;
+   struct protosw *tcp_protosw, *tcp6_protosw;
 
tcp_protosw = pffindproto(PF_INET, IPPROTO_TCP, SOCK_STREAM);
if (tcp_protosw == NULL)
return (ENOPROTOOPT);
-
bcopy(tcp_protosw, &ddp_protosw, sizeof(ddp_protosw));
bcopy(tcp_protosw->pr_usrreqs, &ddp_usrreqs, sizeof(ddp_usrreqs));
ddp_usrreqs.pru_soreceive = t4_soreceive_ddp;
ddp_protosw.pr_usrreqs = &ddp_usrreqs;
 
+   tcp6_protosw = pffindproto(PF_INET6, IPPROTO_TCP, SOCK_STREAM);
+   if (tcp6_protosw == NULL)
+   return (ENOPROTOOPT);
+   bcopy(tcp6_protosw, &ddp6_protosw, sizeof(ddp6_protosw));
+   bcopy(tcp6_protosw->pr_usrreqs, &ddp6_usrreqs, sizeof(ddp6_usrreqs));
+   ddp6_usrreqs.pru_soreceive = t4_soreceive_ddp;
+   ddp6_protosw.pr_usrreqs = &ddp6_usrreqs;
+
rc = t4_register_uld(&tom_uld_info);
if (rc != 0)
t4_tom_mod_unload();

Modified: head/sys/dev/cxgbe/tom/t4_tom.h
==
--- head/sys/dev/cxgbe/tom/t4_tom.h Tue Jan 15 00:12:34 2013
(r245440)
+++ head/sys/dev/cxgbe/tom/t4_tom.h Tue Jan 15 00:24:01 2013
(r245441)
@@ -140,15 +140,6 @@ struct flowc_tx_params {
 #defineDDP_LOW_SCORE   1
 #defineDDP_HIGH_SCORE  3
 
-static inline void
-set_tcpddp_ulp_mode(struct toepcb *toep)
-{
-
-   toep->ulp_mode = ULP_MODE_TCPDDP;
-   toep->ddp_flags = DDP_OK;
-   toep->ddp_score = DDP_LOW_SCORE;
-}
-
 /*
  * Compressed state for embryonic connections for a listener.  Barely fits in
  * 64B, try not to grow it further.
@@ -234,6 +225,7 @@ int select_rcv_wscale(void);
 uint64_t calc_opt0(struct socket *, struct port_inf

svn commit: r245443 - head/sys/geom/mirror

2013-01-14 Thread Alexander Motin
Author: mav
Date: Tue Jan 15 01:13:55 2013
New Revision: 245443
URL: http://svnweb.freebsd.org/changeset/base/245443

Log:
  Alike to r242314 for GRAID make GMIRROR more aggressive in marking volumes
  as clean on shutdown and move that action from shutdown_pre_sync stage to
  shutdown_post_sync to avoid extra flapping.
  
  ZFS tends to not close devices on shutdown, that doesn't allow GEOM RAID
  to shutdown gracefully.  To handle that, mark volume as clean just when
  shutdown time comes and there are no active writes.
  
  PR:   kern/113957
  MFC after:2 weeks

Modified:
  head/sys/geom/mirror/g_mirror.c

Modified: head/sys/geom/mirror/g_mirror.c
==
--- head/sys/geom/mirror/g_mirror.c Tue Jan 15 00:39:15 2013
(r245442)
+++ head/sys/geom/mirror/g_mirror.c Tue Jan 15 01:13:55 2013
(r245443)
@@ -81,7 +81,8 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO,
G_MIRROR_DEBUG(4, "%s: Woken up %p.", __func__, (ident));   \
 } while (0)
 
-static eventhandler_tag g_mirror_pre_sync = NULL;
+static eventhandler_tag g_mirror_post_sync = NULL;
+static int g_mirror_shutdown = 0;
 
 static int g_mirror_destroy_geom(struct gctl_req *req, struct g_class *mp,
 struct g_geom *gp);
@@ -815,7 +816,7 @@ g_mirror_idle(struct g_mirror_softc *sc,
return (0);
if (acw > 0 || (acw == -1 && sc->sc_provider->acw > 0)) {
timeout = g_mirror_idletime - (time_uptime - sc->sc_last_write);
-   if (timeout > 0)
+   if (!g_mirror_shutdown && timeout > 0)
return (timeout);
}
sc->sc_idle = 1;
@@ -2821,7 +2822,7 @@ g_mirror_access(struct g_provider *pp, i
error = ENXIO;
goto end;
}
-   if (dcw == 0 && !sc->sc_idle)
+   if (dcw == 0)
g_mirror_idle(sc, dcw);
if ((sc->sc_flags & G_MIRROR_DEVICE_FLAG_DESTROYING) != 0) {
if (acr > 0 || acw > 0 || ace > 0) {
@@ -3232,7 +3233,7 @@ g_mirror_dumpconf(struct sbuf *sb, const
 }
 
 static void
-g_mirror_shutdown_pre_sync(void *arg, int howto)
+g_mirror_shutdown_post_sync(void *arg, int howto)
 {
struct g_class *mp;
struct g_geom *gp, *gp2;
@@ -3242,6 +3243,7 @@ g_mirror_shutdown_pre_sync(void *arg, in
mp = arg;
DROP_GIANT();
g_topology_lock();
+   g_mirror_shutdown = 1;
LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
if ((sc = gp->softc) == NULL)
continue;
@@ -3250,6 +3252,7 @@ g_mirror_shutdown_pre_sync(void *arg, in
continue;
g_topology_unlock();
sx_xlock(&sc->sc_lock);
+   g_mirror_idle(sc, -1);
g_cancel_event(sc);
error = g_mirror_destroy(sc, G_MIRROR_DESTROY_DELAYED);
if (error != 0)
@@ -3264,9 +3267,9 @@ static void
 g_mirror_init(struct g_class *mp)
 {
 
-   g_mirror_pre_sync = EVENTHANDLER_REGISTER(shutdown_pre_sync,
-   g_mirror_shutdown_pre_sync, mp, SHUTDOWN_PRI_FIRST);
-   if (g_mirror_pre_sync == NULL)
+   g_mirror_post_sync = EVENTHANDLER_REGISTER(shutdown_post_sync,
+   g_mirror_shutdown_post_sync, mp, SHUTDOWN_PRI_FIRST);
+   if (g_mirror_post_sync == NULL)
G_MIRROR_DEBUG(0, "Warning! Cannot register shutdown event.");
 }
 
@@ -3274,8 +3277,8 @@ static void
 g_mirror_fini(struct g_class *mp)
 {
 
-   if (g_mirror_pre_sync != NULL)
-   EVENTHANDLER_DEREGISTER(shutdown_pre_sync, g_mirror_pre_sync);
+   if (g_mirror_post_sync != NULL)
+   EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_mirror_post_sync);
 }
 
 DECLARE_GEOM_CLASS(g_mirror_class, g_mirror);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245444 - head/sys/geom/raid3

2013-01-14 Thread Alexander Motin
Author: mav
Date: Tue Jan 15 01:27:04 2013
New Revision: 245444
URL: http://svnweb.freebsd.org/changeset/base/245444

Log:
  Alike to r242314 for GRAID make GRAID3 more aggressive in marking volumes
  as clean on shutdown and move that action from shutdown_pre_sync stage to
  shutdown_post_sync to avoid extra flapping.
  
  ZFS tends to not close devices on shutdown, that doesn't allow GEOM RAID
  to shutdown gracefully.  To handle that, mark volume as clean just when
  shutdown time comes and there are no active writes.
  
  MFC after:2 weeks

Modified:
  head/sys/geom/raid3/g_raid3.c

Modified: head/sys/geom/raid3/g_raid3.c
==
--- head/sys/geom/raid3/g_raid3.c   Tue Jan 15 01:13:55 2013
(r245443)
+++ head/sys/geom/raid3/g_raid3.c   Tue Jan 15 01:27:04 2013
(r245444)
@@ -104,7 +104,8 @@ SYSCTL_UINT(_kern_geom_raid3_stat, OID_A
G_RAID3_DEBUG(4, "%s: Woken up %p.", __func__, (ident));\
 } while (0)
 
-static eventhandler_tag g_raid3_pre_sync = NULL;
+static eventhandler_tag g_raid3_post_sync = NULL;
+static int g_raid3_shutdown = 0;
 
 static int g_raid3_destroy_geom(struct gctl_req *req, struct g_class *mp,
 struct g_geom *gp);
@@ -876,7 +877,7 @@ g_raid3_idle(struct g_raid3_softc *sc, i
return (0);
if (acw > 0 || (acw == -1 && sc->sc_provider->acw > 0)) {
timeout = g_raid3_idletime - (time_uptime - sc->sc_last_write);
-   if (timeout > 0)
+   if (!g_raid3_shutdown && timeout > 0)
return (timeout);
}
sc->sc_idle = 1;
@@ -3098,7 +3099,7 @@ g_raid3_access(struct g_provider *pp, in
error = ENXIO;
goto end;
}
-   if (dcw == 0 && !sc->sc_idle)
+   if (dcw == 0)
g_raid3_idle(sc, dcw);
if ((sc->sc_flags & G_RAID3_DEVICE_FLAG_DESTROYING) != 0) {
if (acr > 0 || acw > 0 || ace > 0) {
@@ -3544,7 +3545,7 @@ g_raid3_dumpconf(struct sbuf *sb, const 
 }
 
 static void
-g_raid3_shutdown_pre_sync(void *arg, int howto)
+g_raid3_shutdown_post_sync(void *arg, int howto)
 {
struct g_class *mp;
struct g_geom *gp, *gp2;
@@ -3554,6 +3555,7 @@ g_raid3_shutdown_pre_sync(void *arg, int
mp = arg;
DROP_GIANT();
g_topology_lock();
+   g_raid3_shutdown = 1;
LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
if ((sc = gp->softc) == NULL)
continue;
@@ -3562,6 +3564,7 @@ g_raid3_shutdown_pre_sync(void *arg, int
continue;
g_topology_unlock();
sx_xlock(&sc->sc_lock);
+   g_raid3_idle(sc, -1);
g_cancel_event(sc);
error = g_raid3_destroy(sc, G_RAID3_DESTROY_DELAYED);
if (error != 0)
@@ -3576,9 +3579,9 @@ static void
 g_raid3_init(struct g_class *mp)
 {
 
-   g_raid3_pre_sync = EVENTHANDLER_REGISTER(shutdown_pre_sync,
-   g_raid3_shutdown_pre_sync, mp, SHUTDOWN_PRI_FIRST);
-   if (g_raid3_pre_sync == NULL)
+   g_raid3_post_sync = EVENTHANDLER_REGISTER(shutdown_post_sync,
+   g_raid3_shutdown_post_sync, mp, SHUTDOWN_PRI_FIRST);
+   if (g_raid3_post_sync == NULL)
G_RAID3_DEBUG(0, "Warning! Cannot register shutdown event.");
 }
 
@@ -3586,8 +3589,8 @@ static void
 g_raid3_fini(struct g_class *mp)
 {
 
-   if (g_raid3_pre_sync != NULL)
-   EVENTHANDLER_DEREGISTER(shutdown_pre_sync, g_raid3_pre_sync);
+   if (g_raid3_post_sync != NULL)
+   EVENTHANDLER_DEREGISTER(shutdown_post_sync, g_raid3_post_sync);
 }
 
 DECLARE_GEOM_CLASS(g_raid3_class, g_raid3);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245446 - head/sys/dev/ata

2013-01-14 Thread Alexander Motin
Author: mav
Date: Tue Jan 15 02:18:04 2013
New Revision: 245446
URL: http://svnweb.freebsd.org/changeset/base/245446

Log:
  In case somebody still use it, fix legacy ataraid(4) to work on combined
  PATA+AHCI controllers, such as JMicron JMB363.
  
  PR:   kern/159271
  MFC after:1 week

Modified:
  head/sys/dev/ata/ata-raid.c

Modified: head/sys/dev/ata/ata-raid.c
==
--- head/sys/dev/ata/ata-raid.c Tue Jan 15 01:33:19 2013(r245445)
+++ head/sys/dev/ata/ata-raid.c Tue Jan 15 02:18:04 2013(r245446)
@@ -1351,10 +1351,11 @@ static int
 ata_raid_read_metadata(device_t subdisk)
 {
 devclass_t pci_devclass = devclass_find("pci");
+devclass_t atapci_devclass = devclass_find("atapci");
 devclass_t devclass=device_get_devclass(GRANDPARENT(GRANDPARENT(subdisk)));
 
 /* prioritize vendor native metadata layout if possible */
-if (devclass == pci_devclass) {
+if (devclass == pci_devclass || devclass == atapci_devclass) {
switch (pci_get_vendor(GRANDPARENT(device_get_parent(subdisk {
case ATA_HIGHPOINT_ID: 
if (ata_raid_hptv3_read_meta(subdisk, ata_raid_arrays))
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r243631 - in head/sys: kern sys

2013-01-14 Thread Bruce Evans

On Mon, 14 Jan 2013, John Baldwin wrote:


On Monday, January 14, 2013 10:51:27 am Alexander Motin wrote:

As I've actually written, there are two different things:
 ncallout -- number of preallocated callout structures for purposes of
timeout() calls. That is a legacy API that is probably not very much
used now, so that value don't need to be too big. But that allocation is
static and if it will ever be exhausted system will panic. That is why
it was set quite high. The right way now would be to analyze where that
API is still used and estimate the really required number.


FYI, I have slowly been working through the tree fixing users of timeout()
to use callout_*() instead.


But timeout() is a better API, starting with its name, for the simple
cases that it handles.  It is easier to use since the storage allocation
for it is handled automatically.  Since it returns a handle, the
automatic storage allocation for it doesn't need to be static.  (The
allocation is not quite static, since ncallout is variable, but I will
describe it as static.)  The static allocation is just a minor
optimization for efficiency and simplicity (the callout API gives
further minor optimizations by allocating even more statically in
callers, so that no linked list management is needed and there is
better locality).  It can be replaced by a malloc() on every call to
timeout(), or maybe a buffer pool.  The static allocation is equivalent
to a buffer pool that is never expanded and has no fallback to malloc()
when it is too small.  Since there is no fallback, the pool has to be
very large (but not 512MB) to prevent panics.  Since use of timeout()
has rotted, there aren't many callers of it left, so if there was a
fallback then a very small buffer pool of size say 16 entries would
suffice.  Larger systems and newer ones that start using the better
timeout() API might need as many as 256 entries.  However, buffer pools
are what you use when the system's malloc() is too slow to use.  Since
malloc(9) or at least uma_zalloc(9) is not all that slow, it is probably
efficient enough to just use it, at least while timeout() is just a
compatibility wrapper.  There are already some minor efficiencies from
using the wrapper.  By using the system's malloc() and not using a
buffer pool, timeout() becomes even simpler than before: delete ncallout
and all associated code, and replace the linked list by malloc()'s
internal management:

% struct callout_handle
% timeout(ftn, arg, to_ticks)
%   timeout_t *ftn;
%   void *arg;
%   int to_ticks;
% {
%   struct callout_cpu *cc;
%   struct callout *new;
%   struct callout_handle handle;
% 
% 	cc = CC_CPU(timeout_cpu);

%   CC_LOCK(cc);

All the locking becomes unnecessary too.  The locking might be just as
slow as dynamic allocation, especially if the lock is contended.

%   /* Fill in the next free callout structure. */
%   new = SLIST_FIRST(&cc->cc_callfree);

This would have to be malloc()ed.  There seems to be a problem with
waiting being impossible in some contexts, so malloc() might fail, but
this function can't fail.  So a large buffer pool might be needed after
all to handle cases where malloc() fails :-(.  Also, it must be checked
that there are no caller's of timeout() before malloc() is initialized,
or else the current early initialization of the buffer pool is still
needed for these early callers.

%   if (new == NULL)
%   /* XXX Attempt to malloc first */
%   panic("timeout table full");

This code always knew that it shouldn't panic.

%   SLIST_REMOVE_HEAD(&cc->cc_callfree, c_links.sle);
%   callout_reset(new, to_ticks, ftn, arg);
%   handle.callout = new;
%   CC_UNLOCK(cc);
% 
% 	return (handle);

% }

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


svn commit: r245447 - in head: share/misc usr.bin/calendar/calendars

2013-01-14 Thread David Naylor
Author: dbn (ports committer)
Date: Tue Jan 15 05:33:40 2013
New Revision: 245447
URL: http://svnweb.freebsd.org/changeset/base/245447

Log:
  Add myself as a port committer (with eadler@ and bdrewery@ as mentors).
  
  While in the repository, add myself to calendar.freebsd.
  
  Approved by:  eadler/bdrewery (mentor)

Modified:
  head/share/misc/committers-ports.dot
  head/usr.bin/calendar/calendars/calendar.freebsd

Modified: head/share/misc/committers-ports.dot
==
--- head/share/misc/committers-ports.dotTue Jan 15 02:18:04 2013
(r245446)
+++ head/share/misc/committers-ports.dotTue Jan 15 05:33:40 2013
(r245447)
@@ -77,6 +77,7 @@ culot [label="Frederic Culot\nculot@Free
 daichi [label="Daichi Goto\ndai...@freebsd.org\n2002/10/17"]
 danfe [label="Alexey Dokuchaev\nda...@freebsd.org\n2004/08/20"]
 db [label="Diane Bruce\n...@freebsd.org\n2007/01/18"]
+dbn [label="David Naylor\n...@freebsd.org\n2013/01/14"]
 decke [label="Bernhard Froehlich\nde...@freebsd.org\n2010/03/21"]
 delphij [label="Xin Li\ndelp...@freebsd.org\n2006/05/01"]
 demon [label="Dmitry Sivachenko\nde...@freebsd.org\n2000/11/13"]
@@ -233,6 +234,8 @@ asami -> obrien
 avilla -> jhale
 avilla -> rakuco
 
+bdrewery -> dbn
+
 bapt -> bdrewery
 bapt -> eadler
 bapt -> jlaffaye
@@ -274,6 +277,7 @@ delphij -> rafan
 demon -> mat
 
 eadler -> ak
+eadler -> dbn
 eadler -> bdrewery
 eadler -> gjb
 eadler -> tj

Modified: head/usr.bin/calendar/calendars/calendar.freebsd
==
--- head/usr.bin/calendar/calendars/calendar.freebsdTue Jan 15 02:18:04 
2013(r245446)
+++ head/usr.bin/calendar/calendars/calendar.freebsdTue Jan 15 05:33:40 
2013(r245447)
@@ -165,6 +165,7 @@
 05/22  Clive Tong-I Lin  born in Changhua, Taiwan, Republic 
of China, 1978
 05/22  Michael Bushkov  born in Rostov-on-Don, Russian 
Federation, 1985
 05/22  Rui Paulo  born in Evora, Portugal, 1986
+05/22  David Naylor  born in Johannesburg, South Africa, 1988
 05/23  Munechika Sumikawa  born in Osaka, Osaka, Japan, 
1972
 05/24  Duncan McLennan Barclay  born in London, Middlesex, 
United Kingdom, 1970
 05/24  Oliver Lehmann  born in Karlsburg, Germany, 1981
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r245448 - head/sys/dev/cxgbe/tom

2013-01-14 Thread Navdeep Parhar
Author: np
Date: Tue Jan 15 07:07:29 2013
New Revision: 245448
URL: http://svnweb.freebsd.org/changeset/base/245448

Log:
  cxgbe/tom: Basic CLIP table management.
  
  This is the Compressed Local IPv6 table on the chip.  To save space, the
  chip uses an index into this table instead of a full IPv6 address in
  some of its hardware data structures.
  
  For now the driver fills this table with all the local IPv6 addresses
  that it sees at the time the table is initialized.  I'll improve this
  later so that the table is updated whenever new IPv6 addresses are
  configured or existing ones deleted.
  
  MFC after:1 week

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/dev/cxgbe/tom/t4_tom.h

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 15 05:33:40 2013
(r245447)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Jan 15 07:07:29 2013
(r245448)
@@ -41,11 +41,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #define TCPSTATES
 #include 
 #include 
@@ -82,6 +85,11 @@ static void queue_tid_release(struct ada
 static void release_offload_resources(struct toepcb *);
 static int alloc_tid_tabs(struct tid_info *);
 static void free_tid_tabs(struct tid_info *);
+static int add_lip(struct adapter *, struct in6_addr *);
+static int delete_lip(struct adapter *, struct in6_addr *);
+static struct clip_entry *search_lip(struct tom_data *, struct in6_addr *);
+static void init_clip_table(struct adapter *, struct tom_data *);
+static void destroy_clip_table(struct adapter *, struct tom_data *);
 static void free_tom_data(struct adapter *, struct tom_data *);
 
 struct toepcb *
@@ -246,8 +254,8 @@ release_offload_resources(struct toepcb 
KASSERT(!(toep->flags & TPF_ATTACHED),
("%s: %p is still attached.", __func__, toep));
 
-   CTR4(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p)",
-   __func__, toep, tid, toep->l2te);
+   CTR5(KTR_CXGBE, "%s: toep %p (tid %d, l2te %p, ce %p)",
+   __func__, toep, tid, toep->l2te, toep->ce);
 
if (toep->ulp_mode == ULP_MODE_TCPDDP)
release_ddp_resources(toep);
@@ -260,6 +268,9 @@ release_offload_resources(struct toepcb 
release_tid(sc, tid, toep->ctrlq);
}
 
+   if (toep->ce)
+   release_lip(td, toep->ce);
+
mtx_lock(&td->toep_list_lock);
TAILQ_REMOVE(&td->toep_list, toep, link);
mtx_unlock(&td->toep_list_lock);
@@ -588,9 +599,157 @@ free_tid_tabs(struct tid_info *t)
mtx_destroy(&t->stid_lock);
 }
 
+static int
+add_lip(struct adapter *sc, struct in6_addr *lip)
+{
+struct fw_clip_cmd c;
+
+   ASSERT_SYNCHRONIZED_OP(sc);
+   /* mtx_assert(&td->clip_table_lock, MA_OWNED); */
+
+memset(&c, 0, sizeof(c));
+   c.op_to_write = htonl(V_FW_CMD_OP(FW_CLIP_CMD) | F_FW_CMD_REQUEST |
+   F_FW_CMD_WRITE);
+c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_ALLOC | FW_LEN16(c));
+c.ip_hi = *(uint64_t *)&lip->s6_addr[0];
+c.ip_lo = *(uint64_t *)&lip->s6_addr[8];
+
+   return (t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c));
+}
+
+static int
+delete_lip(struct adapter *sc, struct in6_addr *lip)
+{
+   struct fw_clip_cmd c;
+
+   ASSERT_SYNCHRONIZED_OP(sc);
+   /* mtx_assert(&td->clip_table_lock, MA_OWNED); */
+
+   memset(&c, 0, sizeof(c));
+   c.op_to_write = htonl(V_FW_CMD_OP(FW_CLIP_CMD) | F_FW_CMD_REQUEST |
+   F_FW_CMD_READ);
+c.alloc_to_len16 = htonl(F_FW_CLIP_CMD_FREE | FW_LEN16(c));
+c.ip_hi = *(uint64_t *)&lip->s6_addr[0];
+c.ip_lo = *(uint64_t *)&lip->s6_addr[8];
+
+   return (t4_wr_mbox_ns(sc, sc->mbox, &c, sizeof(c), &c));
+}
+
+static struct clip_entry *
+search_lip(struct tom_data *td, struct in6_addr *lip)
+{
+   struct clip_entry *ce;
+
+   mtx_assert(&td->clip_table_lock, MA_OWNED);
+
+   TAILQ_FOREACH(ce, &td->clip_table, link) {
+   if (IN6_ARE_ADDR_EQUAL(&ce->lip, lip))
+   return (ce);
+   }
+
+   return (NULL);
+}
+
+struct clip_entry *
+hold_lip(struct tom_data *td, struct in6_addr *lip)
+{
+   struct clip_entry *ce;
+
+   mtx_lock(&td->clip_table_lock);
+   ce = search_lip(td, lip);
+   if (ce != NULL)
+   ce->refcount++;
+   mtx_unlock(&td->clip_table_lock);
+
+   return (ce);
+}
+
+void
+release_lip(struct tom_data *td, struct clip_entry *ce)
+{
+
+   mtx_lock(&td->clip_table_lock);
+   KASSERT(search_lip(td, &ce->lip) == ce,
+   ("%s: CLIP entry %p p not in CLIP table.", __func__, ce));
+   KASSERT(ce->refcount > 0,
+   ("%s: CLIP entry %p has refcount 0", __func__, ce));
+   --ce->refcount;
+   mtx_unlock(&td->clip_table_lock);
+}
+
+static void
+init_clip_table(struct