svn commit: r205727 - in head/sys: ia64/conf modules

2010-03-27 Thread Marcel Moolenaar
Author: marcel
Date: Sat Mar 27 06:53:11 2010
New Revision: 205727
URL: http://svn.freebsd.org/changeset/base/205727

Log:
  Bring up-to-date:
  o   Switch to ITANIUM2 has the cpu. This has absolutely no effect
  on the code, but makes for a better example.
  o   Drop COMPAT_FREEBSD6. We're tier 2, so you're supposed to run
  8-stable or newer.
  o   Add PREEMPTION. It works now.
  o   Remove HWPMC_HOOKS. We don't have support for hwpmc yet.
  
  o   Add a bunch of new devices: atapist, hptiop, amr, ips, twa, igb,
  ixgbe, ae, age, alc, ale, bce, bfe, et, jme, msk, nge, sk, ste,
  stge, tx, vge, axe, rue, udav, fwip, and all USB serial.
  o   Remove legacy devices: le, vx, dc, pcn, rl, sis.
  
  Make sure to the module list is a superset of what goes into GENERIC.

Modified:
  head/sys/ia64/conf/GENERIC
  head/sys/modules/Makefile

Modified: head/sys/ia64/conf/GENERIC
==
--- head/sys/ia64/conf/GENERIC  Sat Mar 27 05:40:50 2010(r205726)
+++ head/sys/ia64/conf/GENERIC  Sat Mar 27 06:53:11 2010(r205727)
@@ -20,20 +20,21 @@
 #
 # $FreeBSD$
 
-cpuITANIUM
+cpuITANIUM2
 ident  GENERIC
 
 makeoptionsDEBUG=-g# Build kernel with debug information.
 
 optionsAUDIT   # Security event auditing
 optionsCD9660  # ISO 9660 Filesystem
-optionsCOMPAT_FREEBSD6 # Compatible with FreeBSD6
 optionsCOMPAT_FREEBSD7 # Compatible with FreeBSD7
 optionsDDB # Support DDB
 optionsDEADLKRES   # Enable the deadlock resolver
 optionsFFS # Berkeley Fast Filesystem
+optionsFLOWTABLE   # per-cpu routing cache
 optionsGDB # Support remote GDB
 optionsGEOM_LABEL  # Provides labelization
+optionsINCLUDE_CONFIG_FILE # Include this file in kernel
 optionsINET# InterNETworking
 optionsINET6   # IPv6 communications protocols
 optionsINVARIANTS  # Enable calls of extra sanity checking
@@ -44,9 +45,11 @@ options  MAC # TrustedBSD MAC Framework
 optionsMD_ROOT # MD usable as root device
 optionsMSDOSFS # MSDOS Filesystem
 optionsNFSCLIENT   # Network Filesystem Client
-optionsNFSSERVER   # Network Filesystem Server
 optionsNFSLOCKD# Network Lock Manager
+optionsNFSSERVER   # Network Filesystem Server
 optionsNFS_ROOT# NFS usable as root device
+optionsP1003_1B_SEMAPHORES # POSIX-style semaphores
+optionsPREEMPTION  # Enable kernel thread preemption
 optionsPRINTF_BUFR_SIZE=128  # Printf buffering to limit interspersion
 optionsPROCFS  # Process filesystem (/proc)
 optionsPSEUDOFS# Pseudo-filesystem framework
@@ -59,15 +62,12 @@ options STACK   # stack(9) support
 optionsSYSVMSG # SYSV-style message queues
 optionsSYSVSEM # SYSV-style semaphores
 optionsSYSVSHM # SYSV-style shared memory
-optionsP1003_1B_SEMAPHORES # POSIX-style semaphores
 optionsUFS_ACL # Support for access control lists
 optionsUFS_DIRHASH # Hash-based directory lookup scheme
 optionsUFS_GJOURNAL# Enable gjournal-based UFS journaling
 optionsWITNESS # Enable checks to detect deadlocks and cycles
 optionsWITNESS_SKIPSPIN # Don't run witness on spinlocks for speed
 options_KPOSIX_PRIORITY_SCHEDULING # Posix P1003_1B RT extensions
-optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
-optionsINCLUDE_CONFIG_FILE # Include this file in kernel
 
 # Various busses
 device firewire# FireWire bus code
@@ -81,20 +81,25 @@ device  ata # ATA controller
 device atadisk # ATA disk drives
 device atapicd # ATAPI CDROM drives
 device atapifd # ATAPI floppy drives
+device atapist # ATAPI tape drives
 device ataraid # ATA RAID drives
 
 # SCSI Controllers
 device ahc # AHA2940 and AIC7xxx devices
 device ahd # AHA39320/29320 and AIC79xx devices
+device hptiop  # Highpoint RocketRaid 3xxx series
 device isp # Qlogic family
 device mpt # LSI-Logic MPT-Fusion
 device sym # NCR/Symbios Logic
 
 # RAID controllers interfaced to the SCSI subsystem
+device amr # AMI MegaRAID
 device ciss# Compaq Smart RAID 5*
 device dpt # DPT Smartcache III, IV
 device iir # Intel Integrated RAID
+device ips # IBM (Adaptec) ServeRAID
 device mly # Mylex 

svn commit: r205728 - head/lib/libusbhid

2010-03-27 Thread Kai Wang
Author: kaiw
Date: Sat Mar 27 08:00:16 2010
New Revision: 205728
URL: http://svn.freebsd.org/changeset/base/205728

Log:
  Merge improvements from kernel HID parser to the userland usbhid(3)
  parser.  This merge does not change any API and should not break any
  native or thirdparty applications.
  
  Changes include:
  
  * Merge multiple report ID support and other improvements from kernel
HID parser.
  * Ignore rid argument in hid_start_parser, parse all the report items since
we now support multiple report ID.
  * Skip report ID byte in hid_get_data() and set report ID byte in
hid_set_data(), if report ID is non-zero.
  * Reimplement hid_get_report_id: instead get report id from uhid device
(which is always 0), try parsing the report descriptor and return the
first report ID encountered.
  
  Reviewed by:  hps
  Silent on:-usb mailing list

Modified:
  head/lib/libusbhid/data.c
  head/lib/libusbhid/descr.c
  head/lib/libusbhid/parse.c
  head/lib/libusbhid/usage.c
  head/lib/libusbhid/usbhid.h
  head/lib/libusbhid/usbvar.h

Modified: head/lib/libusbhid/data.c
==
--- head/lib/libusbhid/data.c   Sat Mar 27 06:53:11 2010(r205727)
+++ head/lib/libusbhid/data.c   Sat Mar 27 08:00:16 2010(r205728)
@@ -29,6 +29,7 @@
 #include sys/cdefs.h
 __FBSDID($FreeBSD$);
 
+#include sys/param.h
 #include assert.h
 #include stdlib.h
 #include usbhid.h
@@ -36,18 +37,27 @@ __FBSDID($FreeBSD$);
 int
 hid_get_data(const void *p, const hid_item_t *h)
 {
-   const unsigned char *buf;
-   unsigned int hpos;
-   unsigned int hsize;
-   int data;
+   const uint8_t *buf;
+   uint32_t hpos;
+   uint32_t hsize;
+   uint32_t data;
int i, end, offs;
 
buf = p;
+
+   /* Skip report ID byte. */
+   if (h-report_ID  0)
+   buf++;
+
hpos = h-pos;  /* bit position of data */
hsize = h-report_size; /* bit length of data */
 
+   /* Range check and limit */
if (hsize == 0)
return (0);
+   if (hsize  32)
+   hsize = 32;
+
offs = hpos / 8;
end = (hpos + hsize) / 8 - offs;
data = 0;
@@ -66,12 +76,17 @@ hid_get_data(const void *p, const hid_it
 void
 hid_set_data(void *p, const hid_item_t *h, int data)
 {
-   unsigned char *buf;
-   unsigned int hpos;
-   unsigned int hsize;
+   uint8_t *buf;
+   uint32_t hpos;
+   uint32_t hsize;
int i, end, offs, mask;
 
buf = p;
+
+   /* Set report ID byte. */
+   if (h-report_ID  0)
+   *buf++ = h-report_ID  0xff;
+
hpos = h-pos;  /* bit position of data */
hsize = h-report_size; /* bit length of data */
 
@@ -90,5 +105,5 @@ hid_set_data(void *p, const hid_item_t *
 
for (i = 0; i = end; i++)
buf[offs + i] = (buf[offs + i]  (mask  (i*8))) |
-   ((data  (i*8))  0xff);
+   ((data  (i*8))  0xff);
 }

Modified: head/lib/libusbhid/descr.c
==
--- head/lib/libusbhid/descr.c  Sat Mar 27 06:53:11 2010(r205727)
+++ head/lib/libusbhid/descr.c  Sat Mar 27 08:00:16 2010(r205728)
@@ -38,7 +38,6 @@ __FBSDID($FreeBSD$);
 #include unistd.h
 #include sys/time.h
 #include sys/ioctl.h
-
 #include dev/usb/usb_ioctl.h
 
 #include usbhid.h
@@ -59,9 +58,30 @@ hid_set_immed(int fd, int enable)
 int
 hid_get_report_id(int fd)
 {
+   report_desc_t rep;
+   hid_data_t d;
+   hid_item_t h;
+   int kindset;
int temp = -1;
int ret;
 
+   if ((rep = hid_get_report_desc(fd)) == NULL)
+   goto use_ioctl;
+   kindset = 1  hid_input | 1  hid_output | 1  hid_feature;
+   for (d = hid_start_parse(rep, kindset, 0); hid_get_item(d, h); ) {
+   /* Return the first report ID we met. */
+   if (h.report_ID != 0) {
+   temp = h.report_ID;
+   break;
+   }
+   }
+   hid_end_parse(d);
+   hid_dispose_report_desc(rep);
+
+   if (temp  0)
+   return (temp);
+
+use_ioctl:
ret = ioctl(fd, USB_GET_REPORT_ID, temp);
 #ifdef HID_COMPAT7
if (ret  0)

Modified: head/lib/libusbhid/parse.c
==
--- head/lib/libusbhid/parse.c  Sat Mar 27 06:53:11 2010(r205727)
+++ head/lib/libusbhid/parse.c  Sat Mar 27 08:00:16 2010(r205728)
@@ -40,42 +40,43 @@ __FBSDID($FreeBSD$);
 #include usbhid.h
 #include usbvar.h
 
-#define MAXUSAGE 100
-struct hid_data {
-   u_char *start;
-   u_char *end;
-   u_char *p;
-   hid_item_t cur;
-   unsigned int usages[MAXUSAGE];
-   int nusage;
-   int minset;
-   int logminsize;
-   int multi;
-   int multimax;

Re: I486_CPU and I586_CPU removed from GENERIC kernel [was Re: svn commit: r205307 - head/sys/i386/conf]

2010-03-27 Thread Bernd Walter
On Fri, Mar 19, 2010 at 05:28:06PM +0100, Ivan Voras wrote:
 On 19 March 2010 17:22, Valentin Nechayev ne...@netch.kiev.ua wrote:
   Fri, Mar 19, 2010 at 17:13:00, ivoras wrote about Re: I486_CPU and 
  I586_CPU removed from GENERIC kernel [was Re: svn commit: r205307 - 
  head/sys/i386/conf]:
 
  SSE in the userland you mean? Regardless, I don't think there is now
  reason for compiling everything as for i386. E.g. why not add at least
  -mtune=generic or even also -march=i686 to default gcc options?
 
  http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
 
  Having userland compiled with i686 will give the same effect as i686-only
  kernel: it won't boot on machines which doesn't conform to. If it is
  supposed to boot on i486 and higher, no more than -march=i486 can be used.
 
 Yes, this is how I read the change - the move from i386 to i686. I
 apologize if I got it wrong :)
 
 As it was pointed out earlier - small systems users and designers
 probably have special install procedures because of the nature of the
 business.

The assumption is wrong to my knowledge.
I think it is a fact that an old 586 usually can't boot our CDs.
It is also true that many embedded boards don't have CD boot support,
like Soekris systems.
But there are also some miniATX systems build on 586 class CPUs, which
have recent BIOS code and can boot from CD.
It is also quite common for unexeperienced users to binary install the
HDD in a modern system.
This is not business, because many home users run such small systems as
storage servers, gateways, dhcp, ... - there are many unexperienced
users with such systems.

-- 
B.Walter be...@bwct.de http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205729 - in head/contrib/bsnmp: gensnmpdef snmpd

2010-03-27 Thread Antoine Brodin
Author: antoine
Date: Sat Mar 27 13:43:18 2010
New Revision: 205729
URL: http://svn.freebsd.org/changeset/base/205729

Log:
  (S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
  Fix some wrong usages.
  Note: this does not affect generated binaries as this argument is not used.
  
  Approved by:  harti@

Modified:
  head/contrib/bsnmp/gensnmpdef/gensnmpdef.c
  head/contrib/bsnmp/snmpd/config.c

Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.c
==
--- head/contrib/bsnmp/gensnmpdef/gensnmpdef.c  Sat Mar 27 08:00:16 2010
(r205728)
+++ head/contrib/bsnmp/gensnmpdef/gensnmpdef.c  Sat Mar 27 13:43:18 2010
(r205729)
@@ -59,7 +59,7 @@ struct tdef {
SLIST_ENTRY(tdef) link;
 };
 
-static SLIST_HEAD(, tdef) tdefs = SLIST_HEAD_INITIALIZER(tdef);
+static SLIST_HEAD(, tdef) tdefs = SLIST_HEAD_INITIALIZER(tdefs);
 static int do_typedef = 0;
 
 static void print_node(SmiNode *n, u_int level);

Modified: head/contrib/bsnmp/snmpd/config.c
==
--- head/contrib/bsnmp/snmpd/config.c   Sat Mar 27 08:00:16 2010
(r205728)
+++ head/contrib/bsnmp/snmpd/config.c   Sat Mar 27 13:43:18 2010
(r205729)
@@ -134,7 +134,7 @@ struct macro {
LIST_ENTRY(macro) link;
int perm;
 };
-static LIST_HEAD(, macro) macros = LIST_HEAD_INITIALIZER(macros);
+static LIST_HEAD(, macro) macros = LIST_HEAD_INITIALIZER(macros);
 
 enum {
TOK_EOF = 0200,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205730 - stable/8/sys/dev/md

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 14:43:40 2010
New Revision: 205730
URL: http://svn.freebsd.org/changeset/base/205730

Log:
  MFC r204408:
  
  Fix panic on invalid 'mdconfig -at preload' usage.
  
  PR:   kern/80136

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

Modified: stable/8/sys/dev/md/md.c
==
--- stable/8/sys/dev/md/md.cSat Mar 27 13:43:18 2010(r205729)
+++ stable/8/sys/dev/md/md.cSat Mar 27 14:43:40 2010(r205730)
@@ -814,6 +814,8 @@ mdcreate_preload(struct md_s *sc, struct
 
if (mdio-md_options  ~(MD_AUTOUNIT | MD_FORCE))
return (EINVAL);
+   if (mdio-md_base == 0)
+   return (EINVAL);
sc-flags = mdio-md_options  MD_FORCE;
/* Cast to pointer size, then to pointer to avoid warning */
sc-pl_ptr = (u_char *)(uintptr_t)mdio-md_base;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205731 - stable/8/sys/amd64/ia32

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 14:58:28 2010
New Revision: 205731
URL: http://svn.freebsd.org/changeset/base/205731

Log:
  MFC r202919:
  
  Fix array overflow.  This routine is only called from procfs,
  which is not mounted by default, and I've been unable to trigger
  a panic without this fix applied anyway.
  
  Reviewed by:  kib, cperciva

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

Modified: stable/8/sys/amd64/ia32/ia32_reg.c
==
--- stable/8/sys/amd64/ia32/ia32_reg.c  Sat Mar 27 14:43:40 2010
(r205730)
+++ stable/8/sys/amd64/ia32/ia32_reg.c  Sat Mar 27 14:58:28 2010
(r205731)
@@ -213,8 +213,6 @@ fill_dbregs32(struct thread *td, struct 
err = fill_dbregs(td, dr);
for (i = 0; i  8; i++)
regs-dr[i] = dr.dr[i];
-   for (i = 8; i  16; i++)
-   regs-dr[i] = 0;
return (err);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205732 - stable/8/sys/contrib/ngatm/netnatm/api

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 15:02:28 2010
New Revision: 205732
URL: http://svn.freebsd.org/changeset/base/205732

Log:
  MFC r201818:
  
  Fix array overflow.
  
  Reviewed by:  philip

Modified:
  stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.c
==
--- stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.cSat Mar 27 14:58:28 
2010(r205731)
+++ stable/8/sys/contrib/ngatm/netnatm/api/cc_conn.cSat Mar 27 15:02:28 
2010(r205732)
@@ -768,7 +768,7 @@ cc_party_drop_ack_ind(struct ccconn *con
party = cc_party_find(conn, drop-epref.epref);
if (party == NULL) {
cc_party_log(party, no party for %s,
-   ptab[CONN_SIG_DROP_PARTY_ACK_IND]);
+   cc_conn_sigtab[CONN_SIG_DROP_PARTY_ACK_IND]);
return;
}
switch (party-state) {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205733 - stable/8/sys/security/mac_lomac

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 15:05:06 2010
New Revision: 205733
URL: http://svn.freebsd.org/changeset/base/205733

Log:
  MFC r201438:
  
  Make mac_lomac(4) able to interpret NFSv4 access bits.
  
  Reviewed by:  rwatson

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

Modified: stable/8/sys/security/mac_lomac/mac_lomac.c
==
--- stable/8/sys/security/mac_lomac/mac_lomac.c Sat Mar 27 15:02:28 2010
(r205732)
+++ stable/8/sys/security/mac_lomac/mac_lomac.c Sat Mar 27 15:05:06 2010
(r205733)
@@ -2470,7 +2470,7 @@ lomac_vnode_check_open(struct ucred *cre
obj = SLOT(vplabel);
 
/* XXX privilege override for admin? */
-   if (accmode  (VWRITE | VAPPEND | VADMIN)) {
+   if (accmode  VMODIFY_PERMS) {
if (!lomac_subject_dominate(subj, obj))
return (EACCES);
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205734 - head/sys/dev/sound/pcm

2010-03-27 Thread Alexander Motin
Author: mav
Date: Sat Mar 27 15:39:19 2010
New Revision: 205734
URL: http://svn.freebsd.org/changeset/base/205734

Log:
  Fix lock leakage.
  
  PR:   kern/145081

Modified:
  head/sys/dev/sound/pcm/dsp.c

Modified: head/sys/dev/sound/pcm/dsp.c
==
--- head/sys/dev/sound/pcm/dsp.cSat Mar 27 15:05:06 2010
(r205733)
+++ head/sys/dev/sound/pcm/dsp.cSat Mar 27 15:39:19 2010
(r205734)
@@ -1071,6 +1071,7 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd
if (IOCGROUP(cmd) == 'M') {
if (cmd == OSS_GETVERSION) {
*arg_i = SOUND_VERSION;
+   PCM_GIANT_EXIT(d);
return (0);
}
ret = dsp_ioctl_channel(i_dev, PCM_VOLCH(i_dev), cmd, arg);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205737 - in stable/8/sys: conf kern sys

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 16:31:49 2010
New Revision: 205737
URL: http://svn.freebsd.org/changeset/base/205737

Log:
  MFC r197405:
  
  Add pieces of infrastructure required for NFSv4 ACL support in UFS.
  
  Reviewed by:  rwatson

Modified:
  stable/8/sys/conf/files
  stable/8/sys/kern/subr_acl_nfs4.c
  stable/8/sys/sys/vnode.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/conf/files
==
--- stable/8/sys/conf/files Sat Mar 27 15:45:11 2010(r205736)
+++ stable/8/sys/conf/files Sat Mar 27 16:31:49 2010(r205737)
@@ -2098,6 +2098,7 @@ kern/sched_ule.c  optional sched_ule
 kern/serdev_if.m   standard
 kern/stack_protector.c standard \
compile-with ${NORMAL_C:N-fstack-protector*}
+kern/subr_acl_nfs4.c   standard
 kern/subr_acl_posix1e.cstandard
 kern/subr_autoconf.c   standard
 kern/subr_blist.c  standard

Modified: stable/8/sys/kern/subr_acl_nfs4.c
==
--- stable/8/sys/kern/subr_acl_nfs4.c   Sat Mar 27 15:45:11 2010
(r205736)
+++ stable/8/sys/kern/subr_acl_nfs4.c   Sat Mar 27 16:31:49 2010
(r205737)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008 Edward Tomasz Napierała tr...@freebsd.org
+ * Copyright (c) 2008-2009 Edward Tomasz Napierała tr...@freebsd.org
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -49,7 +49,213 @@ __FBSDID($FreeBSD$);
 #include sys/stat.h
 #define KASSERT(a, b) assert(a)
 #define CTASSERT(a)
-#endif
+#endif /* _KERNEL */
+
+#ifdef _KERNEL
+
+static struct {
+   accmode_t accmode;
+   int mask;
+} accmode2mask[] = {{VREAD, ACL_READ_DATA},
+   {VWRITE, ACL_WRITE_DATA},
+   {VAPPEND, ACL_APPEND_DATA},
+   {VEXEC, ACL_EXECUTE},
+   {VREAD_NAMED_ATTRS, ACL_READ_NAMED_ATTRS},
+   {VWRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS},
+   {VDELETE_CHILD, ACL_DELETE_CHILD},
+   {VREAD_ATTRIBUTES, ACL_READ_ATTRIBUTES},
+   {VWRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
+   {VDELETE, ACL_DELETE},
+   {VREAD_ACL, ACL_READ_ACL},
+   {VWRITE_ACL, ACL_WRITE_ACL},
+   {VWRITE_OWNER, ACL_WRITE_OWNER},
+   {VSYNCHRONIZE, ACL_SYNCHRONIZE},
+   {0, 0}};
+
+static int
+_access_mask_from_accmode(accmode_t accmode)
+{
+   int access_mask = 0, i;
+
+   for (i = 0; accmode2mask[i].accmode != 0; i++) {
+   if (accmode  accmode2mask[i].accmode)
+   access_mask |= accmode2mask[i].mask;
+   }
+
+   return (access_mask);
+}
+
+/*
+ * Return 0, iff access is allowed, 1 otherwise.
+ */
+static int
+_acl_denies(const struct acl *aclp, int access_mask, struct ucred *cred,
+int file_uid, int file_gid, int *denied_explicitly)
+{
+   int i;
+   const struct acl_entry *entry;
+
+   if (denied_explicitly != NULL)
+   *denied_explicitly = 0;
+
+   KASSERT(aclp-acl_cnt  0, (aclp-acl_cnt  0));
+   KASSERT(aclp-acl_cnt = ACL_MAX_ENTRIES,
+   (aclp-acl_cnt = ACL_MAX_ENTRIES));
+
+   for (i = 0; i  aclp-acl_cnt; i++) {
+   entry = (aclp-acl_entry[i]);
+
+   if (entry-ae_entry_type != ACL_ENTRY_TYPE_ALLOW 
+   entry-ae_entry_type != ACL_ENTRY_TYPE_DENY)
+   continue;
+   if (entry-ae_flags  ACL_ENTRY_INHERIT_ONLY)
+   continue;
+   switch (entry-ae_tag) {
+   case ACL_USER_OBJ:
+   if (file_uid != cred-cr_uid)
+   continue;
+   break;
+   case ACL_USER:
+   if (entry-ae_id != cred-cr_uid)
+   continue;
+   break;
+   case ACL_GROUP_OBJ:
+   if (!groupmember(file_gid, cred))
+   continue;
+   break;
+   case ACL_GROUP:
+   if (!groupmember(entry-ae_id, cred))
+   continue;
+   break;
+   default:
+   KASSERT(entry-ae_tag == ACL_EVERYONE,
+   (entry-ae_tag == ACL_EVERYONE));
+   }
+
+   if (entry-ae_entry_type == ACL_ENTRY_TYPE_DENY) {
+   if (entry-ae_perm  access_mask) {
+   

svn commit: r205738 - head/sbin/hastd

2010-03-27 Thread Pawel Jakub Dawidek
Author: pjd
Date: Sat Mar 27 16:35:07 2010
New Revision: 205738
URL: http://svn.freebsd.org/changeset/base/205738

Log:
  Don't hold connection lock when doing reconnects as it makes I/Os wait for
  connection timeouts.
  
  Reported by:  Kevin Day toa...@dragondata.com

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==
--- head/sbin/hastd/primary.c   Sat Mar 27 16:31:49 2010(r205737)
+++ head/sbin/hastd/primary.c   Sat Mar 27 16:35:07 2010(r205738)
@@ -460,9 +460,11 @@ init_local(struct hast_resource *res)
exit(EX_NOINPUT);
 }
 
-static void
-init_remote(struct hast_resource *res)
+static bool
+init_remote(struct hast_resource *res, struct proto_conn **inp,
+struct proto_conn **outp)
 {
+   struct proto_conn *in, *out;
struct nv *nvout, *nvin;
const unsigned char *token;
unsigned char *map;
@@ -472,13 +474,17 @@ init_remote(struct hast_resource *res)
uint32_t mapsize;
size_t size;
 
+   assert((inp == NULL  outp == NULL) || (inp != NULL  outp != NULL));
+
+   in = out = NULL;
+
/* Prepare outgoing connection with remote node. */
-   if (proto_client(res-hr_remoteaddr, res-hr_remoteout)  0) {
+   if (proto_client(res-hr_remoteaddr, out)  0) {
primary_exit(EX_OSERR, Unable to create connection to %s,
res-hr_remoteaddr);
}
/* Try to connect, but accept failure. */
-   if (proto_connect(res-hr_remoteout)  0) {
+   if (proto_connect(out)  0) {
pjdlog_errno(LOG_WARNING, Unable to connect to %s,
res-hr_remoteaddr);
goto close;
@@ -496,7 +502,7 @@ init_remote(struct hast_resource *res)
nv_free(nvout);
goto close;
}
-   if (hast_proto_send(res, res-hr_remoteout, nvout, NULL, 0)  0) {
+   if (hast_proto_send(res, out, nvout, NULL, 0)  0) {
pjdlog_errno(LOG_WARNING,
Unable to send handshake header to %s,
res-hr_remoteaddr);
@@ -504,7 +510,7 @@ init_remote(struct hast_resource *res)
goto close;
}
nv_free(nvout);
-   if (hast_proto_recv_hdr(res-hr_remoteout, nvin)  0) {
+   if (hast_proto_recv_hdr(out, nvin)  0) {
pjdlog_errno(LOG_WARNING,
Unable to receive handshake header from %s,
res-hr_remoteaddr);
@@ -536,12 +542,12 @@ init_remote(struct hast_resource *res)
 * Second handshake step.
 * Setup incoming connection with remote node.
 */
-   if (proto_client(res-hr_remoteaddr, res-hr_remotein)  0) {
+   if (proto_client(res-hr_remoteaddr, in)  0) {
pjdlog_errno(LOG_WARNING, Unable to create connection to %s,
res-hr_remoteaddr);
}
/* Try to connect, but accept failure. */
-   if (proto_connect(res-hr_remotein)  0) {
+   if (proto_connect(in)  0) {
pjdlog_errno(LOG_WARNING, Unable to connect to %s,
res-hr_remoteaddr);
goto close;
@@ -560,7 +566,7 @@ init_remote(struct hast_resource *res)
nv_free(nvout);
goto close;
}
-   if (hast_proto_send(res, res-hr_remotein, nvout, NULL, 0)  0) {
+   if (hast_proto_send(res, in, nvout, NULL, 0)  0) {
pjdlog_errno(LOG_WARNING,
Unable to send handshake header to %s,
res-hr_remoteaddr);
@@ -568,7 +574,7 @@ init_remote(struct hast_resource *res)
goto close;
}
nv_free(nvout);
-   if (hast_proto_recv_hdr(res-hr_remoteout, nvin)  0) {
+   if (hast_proto_recv_hdr(out, nvin)  0) {
pjdlog_errno(LOG_WARNING,
Unable to receive handshake header from %s,
res-hr_remoteaddr);
@@ -611,7 +617,7 @@ init_remote(struct hast_resource *res)
 * Remote node have some dirty extents on its own, lets
 * download its activemap.
 */
-   if (hast_proto_recv_data(res, res-hr_remoteout, nvin, map,
+   if (hast_proto_recv_data(res, out, nvin, map,
mapsize)  0) {
pjdlog_errno(LOG_ERR,
Unable to receive remote activemap);
@@ -631,18 +637,29 @@ init_remote(struct hast_resource *res)
(void)hast_activemap_flush(res);
}
pjdlog_info(Connected to %s., res-hr_remoteaddr);
+   if (inp != NULL  outp != NULL) {
+   *inp = in;
+   *outp = out;
+   } else {
+   res-hr_remotein = in;
+   res-hr_remoteout = out;
+   }
+   return (true);
+close:
+   proto_close(out);
+   if (in != NULL)
+   proto_close(in);
+   return 

svn commit: r205739 - stable/8/sys/fs/nfs

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 16:35:25 2010
New Revision: 205739
URL: http://svn.freebsd.org/changeset/base/205739

Log:
  MFC r197650:
  
  Fix typo in the comment.

Modified:
  stable/8/sys/fs/nfs/nfs_commonacl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_commonacl.c
==
--- stable/8/sys/fs/nfs/nfs_commonacl.c Sat Mar 27 16:35:07 2010
(r205738)
+++ stable/8/sys/fs/nfs/nfs_commonacl.c Sat Mar 27 16:35:25 2010
(r205739)
@@ -631,7 +631,7 @@ nfsrv_setacl(vnode_t vp, NFSACL_T *aclp,
if (nfsrv_useacl == 0 || !NFSHASNFS4ACL(vnode_mount(vp)))
return (NFSERR_ATTRNOTSUPP);
/*
-* With NFS4 ACLs, chmod(2) may need to add additional entries.
+* With NFSv4 ACLs, chmod(2) may need to add additional entries.
 * Make sure it has enough room for that - splitting every entry
 * into two and appending canonical six entries at the end.
 * Cribbed out of kern/vfs_acl.c - Rick M.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205740 - stable/8/share/man/man9

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 16:41:23 2010
New Revision: 205740
URL: http://svn.freebsd.org/changeset/base/205740

Log:
  MFC r197405, missing part:
  
  Add pieces of infrastructure required for NFSv4 ACL support in UFS.
  
  Reviewed by:  rwatson

Added:
  stable/8/share/man/man9/vaccess_acl_nfs4.9
 - copied unchanged from r197405, head/share/man/man9/vaccess_acl_nfs4.9
Modified:
  stable/8/share/man/man9/Makefile
  stable/8/share/man/man9/VOP_ACCESS.9
  stable/8/share/man/man9/acl.9
  stable/8/share/man/man9/vaccess.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/Makefile
==
--- stable/8/share/man/man9/MakefileSat Mar 27 16:35:25 2010
(r205739)
+++ stable/8/share/man/man9/MakefileSat Mar 27 16:41:23 2010
(r205740)
@@ -255,6 +255,7 @@ MAN=accept_filter.9 \
usbdi.9 \
utopia.9 \
vaccess.9 \
+   vaccess_acl_nfs4.9 \
vaccess_acl_posix1e.9 \
vcount.9 \
vflush.9 \

Modified: stable/8/share/man/man9/VOP_ACCESS.9
==
--- stable/8/share/man/man9/VOP_ACCESS.9Sat Mar 27 16:35:25 2010
(r205739)
+++ stable/8/share/man/man9/VOP_ACCESS.9Sat Mar 27 16:41:23 2010
(r205740)
@@ -29,7 +29,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd June 1, 2009
+.Dd September 18, 2009
 .Os
 .Dt VOP_ACCESS 9
 .Sh NAME
@@ -95,6 +95,7 @@ requested access.
 .El
 .Sh SEE ALSO
 .Xr vaccess 9 ,
+.Xr vaccess_acl_nfs4 9 ,
 .Xr vaccess_acl_posix1e 9 ,
 .Xr vnode 9
 .Sh AUTHORS

Modified: stable/8/share/man/man9/acl.9
==
--- stable/8/share/man/man9/acl.9   Sat Mar 27 16:35:25 2010
(r205739)
+++ stable/8/share/man/man9/acl.9   Sat Mar 27 16:41:23 2010
(r205740)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd December 23, 1999
+.Dd September 18, 2009
 .Os
 .Dt ACL 9
 .Sh NAME
@@ -207,6 +207,7 @@ The following values are valid:
 .El
 .Sh SEE ALSO
 .Xr acl 3 ,
+.Xr vaccess_acl_nfs4 9 ,
 .Xr vaccess_acl_posix1e 9 ,
 .Xr VFS 9 ,
 .Xr vnaccess 9 ,

Modified: stable/8/share/man/man9/vaccess.9
==
--- stable/8/share/man/man9/vaccess.9   Sat Mar 27 16:35:25 2010
(r205739)
+++ stable/8/share/man/man9/vaccess.9   Sat Mar 27 16:41:23 2010
(r205740)
@@ -25,7 +25,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd August 22, 2001
+.Dd September 18, 2009
 .Os
 .Dt VACCESS 9
 .Sh NAME
@@ -117,6 +117,7 @@ An attempt was made to perform an operat
 appropriate privileges or to the owner of a file or other resource.
 .El
 .Sh SEE ALSO
+.Xr vaccess_acl_nfs4 9 ,
 .Xr vaccess_acl_posix1e 9 ,
 .Xr vnode 9 ,
 .Xr VOP_ACCESS 9

Copied: stable/8/share/man/man9/vaccess_acl_nfs4.9 (from r197405, 
head/share/man/man9/vaccess_acl_nfs4.9)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/share/man/man9/vaccess_acl_nfs4.9  Sat Mar 27 16:41:23 2010
(r205740, copy of r197405, head/share/man/man9/vaccess_acl_nfs4.9)
@@ -0,0 +1,129 @@
+.\-
+.\ Copyright (c) 2001 Robert N. M. Watson
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\ SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd September 18, 2009
+.Os
+.Dt VACCESS_ACL_NFS4 9
+.Sh NAME
+.Nm vaccess_acl_nfs4
+.Nd generate a NFSv4 ACL access control decision using vnode parameters
+.Sh SYNOPSIS
+.In sys/param.h
+.In sys/vnode.h
+.In sys/acl.h
+.Ft int
+.Fo vaccess_acl_nfs4
+.Fa enum vtype type
+.Fa uid_t 

svn commit: r205744 - stable/8/sys/kern

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:11:06 2010
New Revision: 205744
URL: http://svn.freebsd.org/changeset/base/205744

Log:
  MFC r202123:
  
Change DDB show prison:
- name some columns more closely to the user space variables,
  as we do for host.* or allow.* (in the listing) already.
- print pr_childmax (children.max).
- prefix hex values with 0x.

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

Modified: stable/8/sys/kern/kern_jail.c
==
--- stable/8/sys/kern/kern_jail.c   Sat Mar 27 16:55:48 2010
(r205743)
+++ stable/8/sys/kern/kern_jail.c   Sat Mar 27 17:11:06 2010
(r205744)
@@ -4276,10 +4276,11 @@ db_show_prison(struct prison *pr)
 #endif
db_printf( root= %p\n, pr-pr_root);
db_printf( securelevel = %d\n, pr-pr_securelevel);
-   db_printf( childcount  = %d\n, pr-pr_childcount);
+   db_printf( children.max= %d\n, pr-pr_childmax);
+   db_printf( children.cur= %d\n, pr-pr_childcount);
db_printf( child   = %p\n, LIST_FIRST(pr-pr_children));
db_printf( sibling = %p\n, LIST_NEXT(pr, pr_sibling));
-   db_printf( flags   = %x, pr-pr_flags);
+   db_printf( flags   = 0x%x, pr-pr_flags);
for (fi = 0; fi  sizeof(pr_flag_names) / sizeof(pr_flag_names[0]);
fi++)
if (pr_flag_names[fi] != NULL  (pr-pr_flags  (1  fi)))
@@ -4294,7 +4295,7 @@ db_show_prison(struct prison *pr)
: (jsf == pr_flag_jailsys[fi].new) ? new
: inherit);
}
-   db_printf( allow   = %x, pr-pr_allow);
+   db_printf( allow   = 0x%x, pr-pr_allow);
for (fi = 0; fi  sizeof(pr_allow_names) / sizeof(pr_allow_names[0]);
fi++)
if (pr_allow_names[fi] != NULL  (pr-pr_allow  (1  fi)))
@@ -4309,14 +4310,14 @@ db_show_prison(struct prison *pr)
db_printf( ip4s= %d\n, pr-pr_ip4s);
for (ii = 0; ii  pr-pr_ip4s; ii++)
db_printf( %s %s\n,
-   ii == 0 ? ip4 = :  ,
+   ii == 0 ? ip4.addr= :  ,
inet_ntoa(pr-pr_ip4[ii]));
 #endif
 #ifdef INET6
db_printf( ip6s= %d\n, pr-pr_ip6s);
for (ii = 0; ii  pr-pr_ip6s; ii++)
db_printf( %s %s\n,
-   ii == 0 ? ip6 = :  ,
+   ii == 0 ? ip6.addr= :  ,
ip6_sprintf(ip6buf, pr-pr_ip6[ii]));
 #endif
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205745 - in stable/8/sys: amd64/conf i386/conf ia64/conf pc98/conf powerpc/conf sparc64/conf sun4v/conf

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:14:55 2010
New Revision: 205745
URL: http://svn.freebsd.org/changeset/base/205745

Log:
  MFC r201813:
  
In sys/arch/conf/Makefile set TARGET to arch. That allows
sys/conf/makeLINT.mk to only do certain things for certain
architectures.
  
Note that neither arm nor mips have the Makefile there, thus
essentially not (yet) supporting LINT.  This would enable them
do add special treatment to sys/conf/makeLINT.mk as well chosing
one of the many configurations as LINT.

Modified:
  stable/8/sys/amd64/conf/Makefile
  stable/8/sys/i386/conf/Makefile
  stable/8/sys/ia64/conf/Makefile
  stable/8/sys/pc98/conf/Makefile
  stable/8/sys/powerpc/conf/Makefile
  stable/8/sys/sparc64/conf/Makefile
  stable/8/sys/sun4v/conf/Makefile
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/amd64/conf/Makefile
==
--- stable/8/sys/amd64/conf/MakefileSat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/amd64/conf/MakefileSat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=amd64
+
 .include ${.CURDIR}/../../conf/makeLINT.mk

Modified: stable/8/sys/i386/conf/Makefile
==
--- stable/8/sys/i386/conf/Makefile Sat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/i386/conf/Makefile Sat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=i386
+
 .include ${.CURDIR}/../../conf/makeLINT.mk

Modified: stable/8/sys/ia64/conf/Makefile
==
--- stable/8/sys/ia64/conf/Makefile Sat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/ia64/conf/Makefile Sat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=ia64
+
 .include ${.CURDIR}/../../conf/makeLINT.mk

Modified: stable/8/sys/pc98/conf/Makefile
==
--- stable/8/sys/pc98/conf/Makefile Sat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/pc98/conf/Makefile Sat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=pc98
+
 .include ${.CURDIR}/../../conf/makeLINT.mk

Modified: stable/8/sys/powerpc/conf/Makefile
==
--- stable/8/sys/powerpc/conf/Makefile  Sat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/powerpc/conf/Makefile  Sat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=powerpc
+
 .include ${.CURDIR}/../../conf/makeLINT.mk

Modified: stable/8/sys/sparc64/conf/Makefile
==
--- stable/8/sys/sparc64/conf/Makefile  Sat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/sparc64/conf/Makefile  Sat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=sparc64
+
 .include ${.CURDIR}/../../conf/makeLINT.mk

Modified: stable/8/sys/sun4v/conf/Makefile
==
--- stable/8/sys/sun4v/conf/MakefileSat Mar 27 17:11:06 2010
(r205744)
+++ stable/8/sys/sun4v/conf/MakefileSat Mar 27 17:14:55 2010
(r205745)
@@ -1,3 +1,5 @@
 # $FreeBSD$
 
+TARGET=sun4v
+
 .include ${.CURDIR}/../../conf/makeLINT.mk
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:17:11 2010
New Revision: 205746
URL: http://svn.freebsd.org/changeset/base/205746

Log:
  MFC r201814:
  
Generate a second LINT configuration for i386 and amd64 in
sys/conf/makeLINT.mk, which includes LINT and sets options VIMAGE
so that we will have VIMAGE LINT builds. For now only do it for
those two architectures to avoid massive universe times for archs,
where people will less likely use VIMAGE or not at all.

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

Modified: stable/8/sys/conf/makeLINT.mk
==
--- stable/8/sys/conf/makeLINT.mk   Sat Mar 27 17:14:55 2010
(r205745)
+++ stable/8/sys/conf/makeLINT.mk   Sat Mar 27 17:17:11 2010
(r205746)
@@ -5,7 +5,15 @@ all:
 
 clean:
rm -f LINT
+.if ${TARGET} == amd64 || ${TARGET} == i386
+   rm -f LINT-VIMAGE
+.endif
 
 NOTES= ../../conf/NOTES NOTES
 LINT: ${NOTES} ../../conf/makeLINT.sed
cat ${NOTES} | sed -E -n -f ../../conf/makeLINT.sed  ${.TARGET}
+.if ${TARGET} == amd64 || ${TARGET} == i386
+   echo include ${.TARGET} ${.TARGET}-VIMAGE
+   echo ident ${.TARGET}-VIMAGE   ${.TARGET}-VIMAGE
+   echo options VIMAGE${.TARGET}-VIMAGE
+.endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205747 - stable/8

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:22:08 2010
New Revision: 205747
URL: http://svn.freebsd.org/changeset/base/205747

Log:
  MFC r201815:
  
To avoid hardcoding further kernel configuration names for
make universe, split the logic into two parts:
- 1st to build worlds and generate kernel configs like LINT.
- 2nd to build kernels for a given TARGET architecture correctly
  finding all newly generated configs, not knowing anything about
  LINT anymore.
  
  MFC rr201960:
  
Use uname -m [1] and rename BUILD_ARCH to XMACHINE[2].
  
Submitted by: nyan[1], imp[2]
  
  MFC r202095:
  
Rather than using an extra variable, only call uname if really needed and
then directly assign the result.
  
Submitted by: jmallett

Modified:
  stable/8/Makefile   (contents, props changed)

Modified: stable/8/Makefile
==
--- stable/8/Makefile   Sat Mar 27 17:17:11 2010(r205746)
+++ stable/8/Makefile   Sat Mar 27 17:22:08 2010(r205747)
@@ -278,7 +278,7 @@ tinderbox:
 # with a reasonable chance of success, regardless of how old your
 # existing system is.
 #
-.if make(universe) || make(tinderbox)
+.if make(universe) || make(universe_kernels) || make(tinderbox)
 TARGETS?=amd64 arm i386 ia64 mips pc98 powerpc sparc64 sun4v
 
 .if defined(DOING_TINDERBOX)
@@ -297,10 +297,6 @@ universe_prologue:
rm -f ${FAILFILE}
 .endif
 .for target in ${TARGETS}
-KERNCONFS!=cd ${.CURDIR}/sys/${target}/conf  \
-   find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
-   ! -name DEFAULTS ! -name LINT
-KERNCONFS:=${KERNCONFS:S/^NOTES$/LINT/}
 universe: universe_${target}
 .ORDER: universe_prologue universe_${target} universe_epilogue
 universe_${target}:
@@ -320,16 +316,26 @@ universe_${target}:
(echo ${target} 'make LINT' failed, \
check _.${target}.makeLINT for details| ${MAKEFAIL}))
 .endif
+   @cd ${.CURDIR}  ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
+   universe_kernels
+   @echo  ${target} completed on `LC_ALL=C date`
+.endfor
+universe_kernels: universe_kernconfs
+.if !defined(TARGET)
+TARGET!=   uname -m
+.endif
+KERNCONFS!=cd ${.CURDIR}/sys/${TARGET}/conf  \
+   find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
+   ! -name DEFAULTS ! -name NOTES
+universe_kernconfs:
 .for kernel in ${KERNCONFS}
@(cd ${.CURDIR}  env __MAKE_CONF=/dev/null \
${MAKE} ${JFLAG} buildkernel \
-   TARGET=${target} \
+   TARGET=${TARGET} \
KERNCONF=${kernel} \
-_.${target}.${kernel} 21 || \
-   (echo ${target} ${kernel} kernel failed, \
-   check _.${target}.${kernel} for details| ${MAKEFAIL}))
-.endfor
-   @echo  ${target} completed on `LC_ALL=C date`
+_.${TARGET}.${kernel} 21 || \
+   (echo ${TARGET} ${kernel} kernel failed, \
+   check _.${TARGET}.${kernel} for details| ${MAKEFAIL}))
 .endfor
 universe: universe_epilogue
 universe_epilogue:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205748 - in stable/8/sys: fs/fifofs kern sys

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 17:22:11 2010
New Revision: 205748
URL: http://svn.freebsd.org/changeset/base/205748

Log:
  MFC r197680:
  
  Provide default implementation for VOP_ACCESS(9), so that filesystems which
  want to provide VOP_ACCESSX(9) don't have to implement both.  Note that
  this commit makes implementation of either of these two mandatory.
  
  Reviewed by:  kib

Modified:
  stable/8/sys/fs/fifofs/fifo_vnops.c
  stable/8/sys/kern/subr_acl_posix1e.c
  stable/8/sys/kern/vfs_default.c
  stable/8/sys/kern/vfs_subr.c
  stable/8/sys/sys/vnode.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/fs/fifofs/fifo_vnops.c
==
--- stable/8/sys/fs/fifofs/fifo_vnops.c Sat Mar 27 17:22:08 2010
(r205747)
+++ stable/8/sys/fs/fifofs/fifo_vnops.c Sat Mar 27 17:22:11 2010
(r205748)
@@ -114,7 +114,6 @@ static struct filterops fifo_notsup_filt
 struct vop_vector fifo_specops = {
.vop_default =  default_vnodeops,
 
-   .vop_access =   VOP_EBADF,
.vop_advlock =  fifo_advlock,
.vop_close =fifo_close,
.vop_create =   VOP_PANIC,

Modified: stable/8/sys/kern/subr_acl_posix1e.c
==
--- stable/8/sys/kern/subr_acl_posix1e.cSat Mar 27 17:22:08 2010
(r205747)
+++ stable/8/sys/kern/subr_acl_posix1e.cSat Mar 27 17:22:11 2010
(r205748)
@@ -61,6 +61,9 @@ vaccess_acl_posix1e(enum vtype type, uid
accmode_t acl_mask_granted;
int group_matched, i;
 
+   KASSERT((accmode  ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
+   (invalid bit in accmode));
+
/*
 * Look for a normal, non-privileged way to access the file/directory
 * as requested.  If it exists, go with that.  Otherwise, attempt to

Modified: stable/8/sys/kern/vfs_default.c
==
--- stable/8/sys/kern/vfs_default.c Sat Mar 27 17:22:08 2010
(r205747)
+++ stable/8/sys/kern/vfs_default.c Sat Mar 27 17:22:11 2010
(r205748)
@@ -83,12 +83,17 @@ static int  dirent_exists(struct vnode *v
  *
  * If there is no specific entry here, we will return EOPNOTSUPP.
  *
+ * Note that every filesystem has to implement either vop_access
+ * or vop_accessx; failing to do so will result in immediate crash
+ * due to stack overflow, as vop_stdaccess() calls vop_stdaccessx(),
+ * which calls vop_stdaccess() etc.
  */
 
 struct vop_vector default_vnodeops = {
.vop_default =  NULL,
.vop_bypass =   VOP_EOPNOTSUPP,
 
+   .vop_access =   vop_stdaccess,
.vop_accessx =  vop_stdaccessx,
.vop_advlock =  vop_stdadvlock,
.vop_advlockasync = vop_stdadvlockasync,
@@ -326,6 +331,16 @@ out:
 }
 
 int
+vop_stdaccess(struct vop_access_args *ap)
+{
+
+   KASSERT((ap-a_accmode  ~(VEXEC | VWRITE | VREAD | VADMIN |
+   VAPPEND)) == 0, (invalid bit in accmode));
+
+   return (VOP_ACCESSX(ap-a_vp, ap-a_accmode, ap-a_cred, ap-a_td));
+}
+
+int
 vop_stdaccessx(struct vop_accessx_args *ap)
 {
int error;

Modified: stable/8/sys/kern/vfs_subr.c
==
--- stable/8/sys/kern/vfs_subr.cSat Mar 27 17:22:08 2010
(r205747)
+++ stable/8/sys/kern/vfs_subr.cSat Mar 27 17:22:11 2010
(r205748)
@@ -3523,6 +3523,9 @@ vaccess(enum vtype type, mode_t file_mod
accmode_t dac_granted;
accmode_t priv_granted;
 
+   KASSERT((accmode  ~(VEXEC | VWRITE | VREAD | VADMIN | VAPPEND)) == 0,
+   (invalid bit in accmode));
+
/*
 * Look for a normal, non-privileged way to access the file/directory
 * as requested.  If it exists, go with that.

Modified: stable/8/sys/sys/vnode.h
==
--- stable/8/sys/sys/vnode.hSat Mar 27 17:22:08 2010(r205747)
+++ stable/8/sys/sys/vnode.hSat Mar 27 17:22:11 2010(r205748)
@@ -685,6 +685,7 @@ int vop_stdlock(struct vop_lock1_args *)
 intvop_stdputpages(struct vop_putpages_args *);
 intvop_stdunlock(struct vop_unlock_args *);
 intvop_nopoll(struct vop_poll_args *);
+intvop_stdaccess(struct vop_access_args *ap);
 intvop_stdaccessx(struct vop_accessx_args *ap);
 intvop_stdadvlock(struct vop_advlock_args *ap);
 intvop_stdadvlockasync(struct vop_advlockasync_args *ap);
___

svn commit: r205749 - stable/8/share/man/man9

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 17:25:17 2010
New Revision: 205749
URL: http://svn.freebsd.org/changeset/base/205749

Log:
  MFC r197780:
  
  Make fetch(9) and store(9) manual pages closer to reality.

Modified:
  stable/8/share/man/man9/Makefile
  stable/8/share/man/man9/fetch.9
  stable/8/share/man/man9/store.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/Makefile
==
--- stable/8/share/man/man9/MakefileSat Mar 27 17:22:11 2010
(r205748)
+++ stable/8/share/man/man9/MakefileSat Mar 27 17:25:17 2010
(r205749)
@@ -610,8 +610,10 @@ MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECL
EVENTHANDLER.9 eventhandler_register.9
 MLINKS+=fetch.9 fubyte.9 \
fetch.9 fuswintr.9 \
-   fetch.9 fusword.9 \
-   fetch.9 fuword.9
+   fetch.9 fuword.9 \
+   fetch.9 fuword16.9 \
+   fetch.9 fuword32.9 \
+   fetch.9 fuword64.9
 MLINKS+=g_attach.9 g_detach.9
 MLINKS+=g_bio.9 g_clone_bio.9 \
g_bio.9 g_destroy_bio.9 \
@@ -1147,8 +1149,10 @@ MLINKS+=stack.9 stack_copy.9 \
stack.9 stack_zero.9
 MLINKS+=store.9 subyte.9 \
store.9 suswintr.9 \
-   store.9 susword.9 \
-   store.9 suword.9
+   store.9 suword.9 \
+   store.9 suword16.9 \
+   store.9 suword32.9 \
+   store.9 suword64.9
 MLINKS+=swi.9 swi_add.9 \
swi.9 swi_sched.9
 MLINKS+=sx.9 sx_assert.9 \

Modified: stable/8/share/man/man9/fetch.9
==
--- stable/8/share/man/man9/fetch.9 Sat Mar 27 17:22:11 2010
(r205748)
+++ stable/8/share/man/man9/fetch.9 Sat Mar 27 17:25:17 2010
(r205749)
@@ -34,29 +34,35 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 7, 1996
+.Dd October 5, 2009
 .Dt FETCH 9
 .Os
 .Sh NAME
 .Nm fetch ,
 .Nm fubyte ,
-.Nm fusword ,
 .Nm fuswintr ,
-.Nm fuword
+.Nm fuword ,
+.Nm fuword16 ,
+.Nm fuword32 ,
+.Nm fuword64
 .Nd fetch data from user-space
 .Sh SYNOPSIS
 .In sys/types.h
 .In sys/time.h
 .In sys/systm.h
-.In sys/resourcevar.h
 .Ft int
 .Fn fubyte const void *base
+.Ft long
+.Fn fuword const void *base
 .Ft int
-.Fn fusword void *base
+.Fn fuword16 void *base
+.Ft int32_t
+.Fn fuword32 const void *base
+.Ft int64_t
+.Fn fuword64 const void *base
+.In sys/resourcevar.h
 .Ft int
 .Fn fuswintr void *base
-.Ft long
-.Fn fuword const void *base
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,16 +75,22 @@ routines provide the following functiona
 .It Fn fubyte
 Fetches a byte of data from the user-space address
 .Pa base .
-.It Fn fusword
-Fetches a short word of data from the user-space address
+.It Fn fuword
+Fetches a word of data from the user-space address
+.Pa base .
+.It Fn fuword16
+Fetches 16 bits of data from the user-space address
+.Pa base .
+.It Fn fuword32
+Fetches 32 bits of data from the user-space address
+.Pa base .
+.It Fn fuword64
+Fetches 64 bits of data from the user-space address
 .Pa base .
 .It Fn fuswintr
 Fetches a short word of data from the user-space address
 .Pa base .
 This function is safe to call during an interrupt context.
-.It Fn fuword
-Fetches a word of data from the user-space address
-.Pa base .
 .El
 .Sh RETURN VALUES
 The

Modified: stable/8/share/man/man9/store.9
==
--- stable/8/share/man/man9/store.9 Sat Mar 27 17:22:11 2010
(r205748)
+++ stable/8/share/man/man9/store.9 Sat Mar 27 17:25:17 2010
(r205749)
@@ -34,13 +34,12 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd January 7, 1996
+.Dd October 5, 2009
 .Dt STORE 9
 .Os
 .Sh NAME
 .Nm store ,
 .Nm subyte ,
-.Nm susword ,
 .Nm suswintr ,
 .Nm suword
 .Nd store data to user-space
@@ -48,15 +47,19 @@
 .In sys/types.h
 .In sys/time.h
 .In sys/systm.h
-.In sys/resourcevar.h
 .Ft int
 .Fn subyte void *base int byte
 .Ft int
-.Fn susword void *base int word
+.Fn suword void *base long word
 .Ft int
-.Fn suswintr void *base int word
+.Fn suword16 void *base int word
 .Ft int
-.Fn suword void *base long word
+.Fn suword32 void *base int32_t word
+.Ft int
+.Fn suword64 void *base int64_t word
+.In sys/resourcevar.h
+.Ft int
+.Fn suswintr void *base int word
 .Sh DESCRIPTION
 The
 .Nm
@@ -69,16 +72,22 @@ routines provide the following functiona
 .It Fn subyte
 Stores a byte of data to the user-space address
 .Pa base .
-.It Fn susword
-Stores a short word of data to the user-space address
+.It Fn suword
+Stores a word of data to the user-space address
+.Pa base .
+.It Fn suword16
+Stores 16 bits of of data to the user-space address
+.Pa base .
+.It Fn suword32
+Stores 32 bits of of data to the user-space address
+.Pa base .
+.It Fn suword64
+Stores 64 bits of of data to the user-space address
 .Pa base .
 .It Fn suswintr
 Stores a short word of data to the user-space address
 .Pa base .
 This function is safe to call during an interrupt context.
-.It Fn suword
-Stores a word of data to 

svn commit: r205750 - stable/8/sys/netinet

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:26:31 2010
New Revision: 205750
URL: http://svn.freebsd.org/changeset/base/205750

Log:
  MFC r203724:
  
Properly free resources when destroying the TCP hostcache while
tearing down a network stack (in the VIMAGE jail+vnet case).
  
For that break out the logic from tcp_hc_purge() into an internal
function we can call from both, the sysctl handler and the
tcp_hc_destroy().
  
Reviewed by:  silby, lstewart

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

Modified: stable/8/sys/netinet/tcp_hostcache.c
==
--- stable/8/sys/netinet/tcp_hostcache.cSat Mar 27 17:25:17 2010
(r205749)
+++ stable/8/sys/netinet/tcp_hostcache.cSat Mar 27 17:26:31 2010
(r205750)
@@ -115,6 +115,7 @@ static VNET_DEFINE(struct callout, tcp_h
 static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *);
 static struct hc_metrics *tcp_hc_insert(struct in_conninfo *);
 static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS);
+static void tcp_hc_purge_internal(int);
 static void tcp_hc_purge(void *);
 
 SYSCTL_NODE(_net_inet_tcp, OID_AUTO, hostcache, CTLFLAG_RW, 0,
@@ -235,10 +236,19 @@ tcp_hc_init(void)
 void
 tcp_hc_destroy(void)
 {
-
-   /* XXX TODO walk the hashtable and free all entries  */
+   int i;
 
callout_drain(V_tcp_hc_callout);
+
+   /* Purge all hc entries. */
+   tcp_hc_purge_internal(1);
+
+   /* Free the uma zone and the allocated hash table. */
+   uma_zdestroy(V_tcp_hostcache.zone);
+
+   for (i = 0; i  V_tcp_hostcache.hashsize; i++)
+   mtx_destroy(V_tcp_hostcache.hashbase[i].hch_mtx);
+   free(V_tcp_hostcache.hashbase, M_HOSTCACHE);
 }
 #endif
 
@@ -633,22 +643,14 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
 }
 
 /*
- * Expire and purge (old|all) entries in the tcp_hostcache.  Runs
- * periodically from the callout.
+ * Caller has to make sure the curvnet is set properly.
  */
 static void
-tcp_hc_purge(void *arg)
+tcp_hc_purge_internal(int all)
 {
-   CURVNET_SET((struct vnet *) arg);
struct hc_metrics *hc_entry, *hc_next;
-   int all = 0;
int i;
 
-   if (V_tcp_hostcache.purgeall) {
-   all = 1;
-   V_tcp_hostcache.purgeall = 0;
-   }
-
for (i = 0; i  V_tcp_hostcache.hashsize; i++) {
THC_LOCK(V_tcp_hostcache.hashbase[i].hch_mtx);
TAILQ_FOREACH_SAFE(hc_entry,
@@ -664,6 +666,24 @@ tcp_hc_purge(void *arg)
}
THC_UNLOCK(V_tcp_hostcache.hashbase[i].hch_mtx);
}
+}
+
+/*
+ * Expire and purge (old|all) entries in the tcp_hostcache.  Runs
+ * periodically from the callout.
+ */
+static void
+tcp_hc_purge(void *arg)
+{
+   CURVNET_SET((struct vnet *) arg);
+   int all = 0;
+
+   if (V_tcp_hostcache.purgeall) {
+   all = 1;
+   V_tcp_hostcache.purgeall = 0;
+   }
+
+   tcp_hc_purge_internal(all);
 
callout_reset(V_tcp_hc_callout, V_tcp_hostcache.prune * hz,
tcp_hc_purge, arg);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205752 - stable/8/sys/net

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:31:54 2010
New Revision: 205752
URL: http://svn.freebsd.org/changeset/base/205752

Log:
  MFC r203729:
  
Add DDB support for printing vnet_sysinit and vnet_sysuninit
ordered call lists. Try to lookup function/symbol names and print
those in addition to the pointers, along with the constants for
subsystem and order.
This is useful for debugging vnet teardown ordering issues.
  
Make it possible to call the actual printing frunction from normal
code at runtime, ie. from vnet_sysuninit(), if DDB support is there.

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

Modified: stable/8/sys/net/vnet.c
==
--- stable/8/sys/net/vnet.c Sat Mar 27 17:29:50 2010(r205751)
+++ stable/8/sys/net/vnet.c Sat Mar 27 17:31:54 2010(r205752)
@@ -57,6 +57,7 @@ __FBSDID($FreeBSD$);
 
 #ifdef DDB
 #include ddb/ddb.h
+#include ddb/db_sym.h
 #endif
 
 #include net/if.h
@@ -219,6 +220,10 @@ SDT_PROBE_DEFINE2(vnet, functions, vnet_
 SDT_PROBE_DEFINE2(vnet, functions, vnet_destroy, entry, int, struct vnet 
*);
 SDT_PROBE_DEFINE1(vnet, functions, vnet_destroy, return, int);
 
+#ifdef DDB
+static void db_show_vnet_print_vs(struct vnet_sysinit *, int);
+#endif
+
 /*
  * Allocate a virtual network stack.
  */
@@ -713,6 +718,64 @@ DB_SHOW_COMMAND(vnets, db_show_vnets)
}
 }
 
+static void
+db_show_vnet_print_vs(struct vnet_sysinit *vs, int ddb)
+{
+   const char *vsname, *funcname;
+   c_db_sym_t sym;
+   db_expr_t  offset;
+
+#define xprint(...)\
+   if (ddb)\
+   db_printf(__VA_ARGS__); \
+   else\
+   printf(__VA_ARGS__)
+
+   if (vs == NULL) {
+   xprint(%s: no vnet_sysinit * given\n, __func__);
+   return;
+   }
+
+   sym = db_search_symbol((vm_offset_t)vs, DB_STGY_ANY, offset);
+   db_symbol_values(sym, vsname, NULL);
+   sym = db_search_symbol((vm_offset_t)vs-func, DB_STGY_PROC, offset);
+   db_symbol_values(sym, funcname, NULL);
+   xprint(%s(%p)\n, (vsname != NULL) ? vsname : , vs);
+   xprint(  0x%08x 0x%08x\n, vs-subsystem, vs-order);
+   xprint(  %p(%s)(%p)\n,
+   vs-func, (funcname != NULL) ? funcname : , vs-arg);
+#undef xprint
+}
+
+DB_SHOW_COMMAND(vnet_sysinit, db_show_vnet_sysinit)
+{
+   struct vnet_sysinit *vs;
+
+   db_printf(VNET_SYSINIT vs Name(Ptr)\n);
+   db_printf(  Subsystem  Order\n);
+   db_printf(  Function(Name)(Arg)\n);
+   TAILQ_FOREACH(vs, vnet_constructors, link) {
+   db_show_vnet_print_vs(vs, 1);
+   if (db_pager_quit)
+   break;
+   }
+}
+
+DB_SHOW_COMMAND(vnet_sysuninit, db_show_vnet_sysuninit)
+{
+   struct vnet_sysinit *vs;
+
+   db_printf(VNET_SYSUNINIT vs Name(Ptr)\n);
+   db_printf(  Subsystem  Order\n);
+   db_printf(  Function(Name)(Arg)\n);
+   TAILQ_FOREACH_REVERSE(vs, vnet_destructors, vnet_sysuninit_head,
+   link) {
+   db_show_vnet_print_vs(vs, 1);
+   if (db_pager_quit)
+   break;
+   }
+}
+
 #ifdef VNET_DEBUG
 DB_SHOW_COMMAND(vnetrcrs, db_show_vnetrcrs)
 {
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205753 - stable/8/sys/net

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:33:19 2010
New Revision: 205753
URL: http://svn.freebsd.org/changeset/base/205753

Log:
  MFC r204142:
  
Enhance a panic string to contain more useful debugging information.

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

Modified: stable/8/sys/net/if.c
==
--- stable/8/sys/net/if.c   Sat Mar 27 17:31:54 2010(r205752)
+++ stable/8/sys/net/if.c   Sat Mar 27 17:33:19 2010(r205753)
@@ -842,7 +842,8 @@ if_detach_internal(struct ifnet *ifp, in
IFNET_WUNLOCK();
if (!found) {
if (vmove)
-   panic(interface not in it's own ifnet list);
+   panic(%s: ifp=%p not on the ifnet tailq %p,
+   __func__, ifp, V_ifnet);
else
return; /* XXX this should panic as well? */
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205754 - stable/8/sys/netinet

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:34:57 2010
New Revision: 205754
URL: http://svn.freebsd.org/changeset/base/205754

Log:
  MFC r204140:
  
Split up ip_drain() into an outer lock and iterator part and
a locked version that will only handle a single network stack
instance. The latter is called directly from ip_destroy().
  
Hook up an ip_destroy() function to release resources from the
legacy IP network layer upon virtual network stack teardown.
  
Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/in_proto.c
  stable/8/sys/netinet/ip_input.c
  stable/8/sys/netinet/ip_var.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/in_proto.c
==
--- stable/8/sys/netinet/in_proto.c Sat Mar 27 17:33:19 2010
(r205753)
+++ stable/8/sys/netinet/in_proto.c Sat Mar 27 17:34:57 2010
(r205754)
@@ -114,6 +114,9 @@ struct protosw inetsw[] = {
.pr_domain =inetdomain,
.pr_protocol =  IPPROTO_IP,
.pr_init =  ip_init,
+#ifdef VIMAGE
+   .pr_destroy =   ip_destroy,
+#endif
.pr_slowtimo =  ip_slowtimo,
.pr_drain = ip_drain,
.pr_usrreqs =   nousrreqs

Modified: stable/8/sys/netinet/ip_input.c
==
--- stable/8/sys/netinet/ip_input.c Sat Mar 27 17:33:19 2010
(r205753)
+++ stable/8/sys/netinet/ip_input.c Sat Mar 27 17:34:57 2010
(r205754)
@@ -199,6 +199,7 @@ static struct mtx ipqlock;
 
 static voidmaxnipq_update(void);
 static voidipq_zone_change(void *);
+static voidip_drain_locked(void);
 
 SYSCTL_VNET_INT(_net_inet_ip, OID_AUTO, fragpackets, CTLFLAG_RD,
 VNET_NAME(nipq), 0,
@@ -368,6 +369,22 @@ ip_init(void)
netisr_register(ip_nh);
 }
 
+#ifdef VIMAGE
+void
+ip_destroy(void)
+{
+
+   /* Cleanup in_ifaddr hash table; should be empty. */
+   hashdestroy(V_in_ifaddrhashtbl, M_IFADDR, V_in_ifaddrhmask);
+
+   IPQ_LOCK();
+   ip_drain_locked();
+   IPQ_UNLOCK();
+
+   uma_zdestroy(V_ipq_zone);
+}
+#endif
+
 void
 ip_fini(void *xtp)
 {
@@ -1237,23 +1254,32 @@ ip_slowtimo(void)
 /*
  * Drain off all datagram fragments.
  */
+static void
+ip_drain_locked(void)
+{
+   int i;
+
+   IPQ_LOCK_ASSERT();
+
+   for (i = 0; i  IPREASS_NHASH; i++) {
+   while(!TAILQ_EMPTY(V_ipq[i])) {
+   IPSTAT_ADD(ips_fragdropped,
+   TAILQ_FIRST(V_ipq[i])-ipq_nfrags);
+   ip_freef(V_ipq[i], TAILQ_FIRST(V_ipq[i]));
+   }
+   }
+}
+
 void
 ip_drain(void)
 {
VNET_ITERATOR_DECL(vnet_iter);
-   int i;
 
VNET_LIST_RLOCK_NOSLEEP();
IPQ_LOCK();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
-   for (i = 0; i  IPREASS_NHASH; i++) {
-   while(!TAILQ_EMPTY(V_ipq[i])) {
-   IPSTAT_ADD(ips_fragdropped,
-   TAILQ_FIRST(V_ipq[i])-ipq_nfrags);
-   ip_freef(V_ipq[i], TAILQ_FIRST(V_ipq[i]));
-   }
-   }
+   ip_drain_locked();
CURVNET_RESTORE();
}
IPQ_UNLOCK();

Modified: stable/8/sys/netinet/ip_var.h
==
--- stable/8/sys/netinet/ip_var.h   Sat Mar 27 17:33:19 2010
(r205753)
+++ stable/8/sys/netinet/ip_var.h   Sat Mar 27 17:34:57 2010
(r205754)
@@ -212,6 +212,9 @@ int ip_fragment(struct ip *ip, struct mb
u_long if_hwassist_flags, int sw_csum);
 void   ip_forward(struct mbuf *m, int srcrt);
 void   ip_init(void);
+#ifdef VIMAGE
+void   ip_destroy(void);
+#endif
 extern int
(*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *,
struct ip_moptions *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205755 - stable/8/sys/netinet

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:36:52 2010
New Revision: 205755
URL: http://svn.freebsd.org/changeset/base/205755

Log:
  MFC r204143:
  
Upon virtual network stack teardown properly release the TCP syncache
resources.
  
Reviewed by:  rwatson

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

Modified: stable/8/sys/netinet/tcp_syncache.c
==
--- stable/8/sys/netinet/tcp_syncache.c Sat Mar 27 17:34:57 2010
(r205754)
+++ stable/8/sys/netinet/tcp_syncache.c Sat Mar 27 17:36:52 2010
(r205755)
@@ -278,11 +278,33 @@ syncache_init(void)
 void
 syncache_destroy(void)
 {
+   struct syncache_head *sch;
+   struct syncache *sc, *nsc;
+   int i;
+
+   /* Cleanup hash buckets: stop timers, free entries, destroy locks. */
+   for (i = 0; i  V_tcp_syncache.hashsize; i++) {
+
+   sch = V_tcp_syncache.hashbase[i];
+   callout_drain(sch-sch_timer);
+
+   SCH_LOCK(sch);
+   TAILQ_FOREACH_SAFE(sc, sch-sch_bucket, sc_hash, nsc)
+   syncache_drop(sc, sch);
+   SCH_UNLOCK(sch);
+   KASSERT(TAILQ_EMPTY(sch-sch_bucket),
+   (%s: sch-sch_bucket not empty, __func__));
+   KASSERT(sch-sch_length == 0, (%s: sch-sch_length %d not 0,
+   __func__, sch-sch_length));
+   mtx_destroy(sch-sch_mtx);
+   }
 
-   /* XXX walk the cache, free remaining objects, stop timers */
+   KASSERT(V_tcp_syncache.cache_count == 0, (%s: cache_count %d not 0,
+   __func__, V_tcp_syncache.cache_count));
 
+   /* Free the allocated global resources. */
uma_zdestroy(V_tcp_syncache.zone);
-   FREE(V_tcp_syncache.hashbase, M_SYNCACHE);
+   free(V_tcp_syncache.hashbase, M_SYNCACHE);
 }
 #endif
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205756 - stable/8/sys/net

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:39:02 2010
New Revision: 205756
URL: http://svn.freebsd.org/changeset/base/205756

Log:
  MFC r204145:
  
Start to implement ifnet DDB support:
- 'show ifnets' prints a list of ifnet *s per virtual network stack,
- 'show ifnet struct ifnet *' prints fields matching the given ifp.
  
We do not yet print the complete set of fields and might want to
factor this out to an extra if_debug.c file in case this grows
a lot[1]. We may also want to grow 'show ifnet if_xname' support[1].
  
Suggested by: rwatson [1]
Reviewed by:  rwatson

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

Modified: stable/8/sys/net/if.c
==
--- stable/8/sys/net/if.c   Sat Mar 27 17:36:52 2010(r205755)
+++ stable/8/sys/net/if.c   Sat Mar 27 17:39:02 2010(r205756)
@@ -34,6 +34,7 @@
 #include opt_inet6.h
 #include opt_inet.h
 #include opt_carp.h
+#include opt_ddb.h
 
 #include sys/param.h
 #include sys/types.h
@@ -62,6 +63,10 @@
 #include machine/stdarg.h
 #include vm/uma.h
 
+#ifdef DDB
+#include ddb/ddb.h
+#endif
+
 #include net/if.h
 #include net/if_arp.h
 #include net/if_clone.h
@@ -3396,3 +3401,78 @@ if_deregister_com_alloc(u_char type)
if_com_alloc[type] = NULL;
if_com_free[type] = NULL;
 }
+
+#ifdef DDB
+static void
+if_show_ifnet(struct ifnet *ifp)
+{
+
+   if (ifp == NULL)
+   return;
+   db_printf(%s:\n, ifp-if_xname);
+#defineIF_DB_PRINTF(f, e)  db_printf(   %s =  f \n, #e, 
ifp-e);
+   IF_DB_PRINTF(%s, if_dname);
+   IF_DB_PRINTF(%d, if_dunit);
+   IF_DB_PRINTF(%s, if_description);
+   IF_DB_PRINTF(%u, if_index);
+   IF_DB_PRINTF(%u, if_refcount);
+   IF_DB_PRINTF(%p, if_softc);
+   IF_DB_PRINTF(%p, if_l2com);
+   IF_DB_PRINTF(%p, if_vnet);
+   IF_DB_PRINTF(%p, if_home_vnet);
+   IF_DB_PRINTF(%p, if_addr);
+   IF_DB_PRINTF(%p, if_llsoftc);
+   IF_DB_PRINTF(%p, if_label);
+   IF_DB_PRINTF(%u, if_pcount);
+   IF_DB_PRINTF(0x%08x, if_flags);
+   IF_DB_PRINTF(0x%08x, if_drv_flags);
+   IF_DB_PRINTF(0x%08x, if_capabilities);
+   IF_DB_PRINTF(0x%08x, if_capenable);
+   IF_DB_PRINTF(%p, if_snd.ifq_head);
+   IF_DB_PRINTF(%p, if_snd.ifq_tail);
+   IF_DB_PRINTF(%d, if_snd.ifq_len);
+   IF_DB_PRINTF(%d, if_snd.ifq_maxlen);
+   IF_DB_PRINTF(%d, if_snd.ifq_drops);
+   IF_DB_PRINTF(%p, if_snd.ifq_drv_head);
+   IF_DB_PRINTF(%p, if_snd.ifq_drv_tail);
+   IF_DB_PRINTF(%d, if_snd.ifq_drv_len);
+   IF_DB_PRINTF(%d, if_snd.ifq_drv_maxlen);
+   IF_DB_PRINTF(%d, if_snd.altq_type);
+   IF_DB_PRINTF(%x, if_snd.altq_flags);
+#undef IF_DB_PRINTF
+}
+
+DB_SHOW_COMMAND(ifnet, db_show_ifnet)
+{
+
+   if (!have_addr) {
+   db_printf(usage: show ifnet struct ifnet *\n);
+   return;
+   }
+
+   if_show_ifnet((struct ifnet *)addr);
+}
+
+DB_SHOW_COMMAND(ifnets, db_show_ifnets)
+{
+   VNET_ITERATOR_DECL(vnet_iter);
+   struct ifnet *ifp;
+   u_short idx;
+
+   VNET_FOREACH(vnet_iter) {
+   CURVNET_SET_QUIET(vnet_iter);
+#ifdef VIMAGE
+   db_printf(vnet=%p\n, curvnet);
+#endif
+   for (idx = 1; idx = V_if_index; idx++) {
+   ifp = V_ifindex_table[idx].ife_ifnet;
+   if (ifp == NULL)
+   continue;
+   db_printf( %20s ifp=%p\n, ifp-if_xname, ifp);
+   if (db_pager_quit)
+   break;
+   }
+   CURVNET_RESTORE();
+   }
+}
+#endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205757 - stable/8/sys/net

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:40:28 2010
New Revision: 205757
URL: http://svn.freebsd.org/changeset/base/205757

Log:
  MFC r204279:
  
Use the DB_SHOW_ALL_COMMAND() macro to register the formerly 'show ifnets'
in the db_show_all_table as 'show all ifnets' and with that follow the
convention for showing complete lists.
  
Submitted by: thompsa

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

Modified: stable/8/sys/net/if.c
==
--- stable/8/sys/net/if.c   Sat Mar 27 17:39:02 2010(r205756)
+++ stable/8/sys/net/if.c   Sat Mar 27 17:40:28 2010(r205757)
@@ -3453,7 +3453,7 @@ DB_SHOW_COMMAND(ifnet, db_show_ifnet)
if_show_ifnet((struct ifnet *)addr);
 }
 
-DB_SHOW_COMMAND(ifnets, db_show_ifnets)
+DB_SHOW_ALL_COMMAND(ifnets, db_show_all_ifnets)
 {
VNET_ITERATOR_DECL(vnet_iter);
struct ifnet *ifp;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205758 - stable/8/sys/kern

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:42:04 2010
New Revision: 205758
URL: http://svn.freebsd.org/changeset/base/205758

Log:
  MFC r204147:
  
Set curvnet earlier so that it also covers calls to sodisconnect(), which
before were possibly panicing the system in ULP code in the VIMAGE case.
  
Submitted by: Igor (igor ispsystem.com)

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

Modified: stable/8/sys/kern/uipc_socket.c
==
--- stable/8/sys/kern/uipc_socket.c Sat Mar 27 17:40:28 2010
(r205757)
+++ stable/8/sys/kern/uipc_socket.c Sat Mar 27 17:42:04 2010
(r205758)
@@ -764,6 +764,8 @@ soconnect(struct socket *so, struct sock
 
if (so-so_options  SO_ACCEPTCONN)
return (EOPNOTSUPP);
+
+   CURVNET_SET(so-so_vnet);
/*
 * If protocol is connection-based, can only connect once.
 * Otherwise, if connected, try to disconnect first.  This allows
@@ -779,10 +781,9 @@ soconnect(struct socket *so, struct sock
 * biting us.
 */
so-so_error = 0;
-   CURVNET_SET(so-so_vnet);
error = (*so-so_proto-pr_usrreqs-pru_connect)(so, nam, td);
-   CURVNET_RESTORE();
}
+   CURVNET_RESTORE();
 
return (error);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205759 - stable/8/sys/netinet

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:46:06 2010
New Revision: 205759
URL: http://svn.freebsd.org/changeset/base/205759

Log:
  MFC r204807:
  
Destroy UDP UMA zones (empty or not) upon network stack teardown
to not leak them making UMA/vmstat -z unhappy with every stoped vnet.
We will still leak pages (especially as zones are marked NOFREE).

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

Modified: stable/8/sys/netinet/udp_usrreq.c
==
--- stable/8/sys/netinet/udp_usrreq.c   Sat Mar 27 17:42:04 2010
(r205758)
+++ stable/8/sys/netinet/udp_usrreq.c   Sat Mar 27 17:46:06 2010
(r205759)
@@ -245,6 +245,9 @@ udp_destroy(void)
V_udbinfo.ipi_hashmask);
hashdestroy(V_udbinfo.ipi_porthashbase, M_PCB,
V_udbinfo.ipi_porthashmask);
+
+   uma_zdestroy(V_udpcb_zone);
+   uma_zdestroy(V_udbinfo.ipi_zone);
INP_INFO_LOCK_DESTROY(V_udbinfo);
 }
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205760 - stable/8/sys/net

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:48:13 2010
New Revision: 205760
URL: http://svn.freebsd.org/changeset/base/205760

Log:
  MFC r204805:
  
Rework reference counting in case we queue into the netisr,
or overflow the netisr queue and fall back to the interface
queue so that we can garuantee that the ifnet pointer stays
valid.   Formerly we ended up with reference counts = 0 in
case the netisr had returned ENOBUFS.  The idea is to track
any packet in the netisr queue and only change the refount
on edge operations for the fallback interface queue. This
also avoids problems in case the if_snd.ifq_len lies to us.
  
Also rework refount assertions to make sure they trigger if
we go below 1. Formerly a negative refence count did not
trigger the assert as the refcount variable is u_int.

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

Modified: stable/8/sys/net/if_epair.c
==
--- stable/8/sys/net/if_epair.c Sat Mar 27 17:46:06 2010(r205759)
+++ stable/8/sys/net/if_epair.c Sat Mar 27 17:48:13 2010(r205760)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2008 The FreeBSD Foundation
- * Copyright (c) 2009 Bjoern A. Zeeb b...@freebsd.org
+ * Copyright (c) 2009-2010 Bjoern A. Zeeb b...@freebsd.org
  * All rights reserved.
  *
  * This software was developed by CK Software GmbH under sponsorship
@@ -256,6 +256,9 @@ epair_nh_sintr(struct mbuf *m)
(*ifp-if_input)(ifp, m);
sc = ifp-if_softc;
EPAIR_REFCOUNT_RELEASE(sc-refcount);
+   EPAIR_REFCOUNT_ASSERT((int)sc-refcount = 1,
+   (%s: ifp=%p sc-refcount not = 1: %d,
+   __func__, ifp, sc-refcount));
DPRINTF(ifp=%p refcount=%u\n, ifp, sc-refcount);
 }
 
@@ -292,8 +295,16 @@ epair_nh_drainedcpu(u_int cpuid)
 
IFQ_LOCK(ifp-if_snd);
if (IFQ_IS_EMPTY(ifp-if_snd)) {
+   struct epair_softc *sc;
+
STAILQ_REMOVE(epair_dpcpu-epair_ifp_drain_list,
elm, epair_ifp_drain, ifp_next);
+   /* The cached ifp goes off the list. */
+   sc = ifp-if_softc;
+   EPAIR_REFCOUNT_RELEASE(sc-refcount);
+   EPAIR_REFCOUNT_ASSERT((int)sc-refcount = 1,
+   (%s: ifp=%p sc-refcount not = 1: %d,
+   __func__, ifp, sc-refcount));
free(elm, M_EPAIR);
}
IFQ_UNLOCK(ifp-if_snd);
@@ -312,14 +323,50 @@ epair_nh_drainedcpu(u_int cpuid)
 /*
  * Network interface (`if') related functions.
  */
+static void
+epair_remove_ifp_from_draining(struct ifnet *ifp)
+{
+   struct epair_dpcpu *epair_dpcpu;
+   struct epair_ifp_drain *elm, *tvar;
+   u_int cpuid;
+
+   for (cpuid = 0; cpuid = mp_maxid; cpuid++) {
+   if (CPU_ABSENT(cpuid))
+   continue;
+
+   epair_dpcpu = DPCPU_ID_PTR(cpuid, epair_dpcpu);
+   EPAIR_LOCK(epair_dpcpu);
+   STAILQ_FOREACH_SAFE(elm, epair_dpcpu-epair_ifp_drain_list,
+   ifp_next, tvar) {
+   if (ifp == elm-ifp) {
+   struct epair_softc *sc;
+
+   STAILQ_REMOVE(
+   epair_dpcpu-epair_ifp_drain_list, elm,
+   epair_ifp_drain, ifp_next);
+   /* The cached ifp goes off the list. */
+   sc = ifp-if_softc;
+   EPAIR_REFCOUNT_RELEASE(sc-refcount);
+   EPAIR_REFCOUNT_ASSERT((int)sc-refcount = 1,
+   (%s: ifp=%p sc-refcount not = 1: %d,
+   __func__, ifp, sc-refcount));
+   free(elm, M_EPAIR);
+   }
+   }
+   EPAIR_UNLOCK(epair_dpcpu);
+   }
+}
+
 static int
 epair_add_ifp_for_draining(struct ifnet *ifp)
 {
struct epair_dpcpu *epair_dpcpu;
-   struct epair_softc *sc = sc = ifp-if_softc;
+   struct epair_softc *sc;
struct epair_ifp_drain *elm = NULL;
 
+   sc = ifp-if_softc;
epair_dpcpu = DPCPU_ID_PTR(sc-cpuid, epair_dpcpu);
+   EPAIR_LOCK_ASSERT(epair_dpcpu);
STAILQ_FOREACH(elm, epair_dpcpu-epair_ifp_drain_list, ifp_next)
if (elm-ifp == ifp)
break;
@@ -332,6 +379,8 @@ epair_add_ifp_for_draining(struct ifnet 
return (ENOMEM);
 
elm-ifp = ifp;
+   /* Add a 

svn commit: r205761 - stable/8/sys/netinet

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:50:02 2010
New Revision: 205761
URL: http://svn.freebsd.org/changeset/base/205761

Log:
  MFC r204838:
  
Destroy TCP UMA zones (empty or not) upon network stack teardown
to not leak them, otherwise making UMA/vmstat unhappy with every
stoped vnet.
We will still leak pages (especially for zones marked NOFREE).
  
Reshuffle cleanup order in tcp_destroy() to get rid of what we can
easily free first.
  
Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/tcp_reass.c
  stable/8/sys/netinet/tcp_subr.c
  stable/8/sys/netinet/tcp_timewait.c
  stable/8/sys/netinet/tcp_var.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/tcp_reass.c
==
--- stable/8/sys/netinet/tcp_reass.cSat Mar 27 17:48:13 2010
(r205760)
+++ stable/8/sys/netinet/tcp_reass.cSat Mar 27 17:50:02 2010
(r205761)
@@ -132,6 +132,15 @@ tcp_reass_init(void)
tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
 }
 
+#ifdef VIMAGE
+void
+tcp_reass_destroy(void)
+{
+
+   uma_zdestroy(V_tcp_reass_zone);
+}
+#endif
+
 int
 tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m)
 {

Modified: stable/8/sys/netinet/tcp_subr.c
==
--- stable/8/sys/netinet/tcp_subr.c Sat Mar 27 17:48:13 2010
(r205760)
+++ stable/8/sys/netinet/tcp_subr.c Sat Mar 27 17:50:02 2010
(r205761)
@@ -445,15 +445,21 @@ void
 tcp_destroy(void)
 {
 
-   tcp_tw_destroy();
+   tcp_reass_destroy();
tcp_hc_destroy();
syncache_destroy();
+   tcp_tw_destroy();
 
/* XXX check that hashes are empty! */
hashdestroy(V_tcbinfo.ipi_hashbase, M_PCB,
V_tcbinfo.ipi_hashmask);
hashdestroy(V_tcbinfo.ipi_porthashbase, M_PCB,
V_tcbinfo.ipi_porthashmask);
+
+   uma_zdestroy(V_sack_hole_zone);
+   uma_zdestroy(V_tcpcb_zone);
+   uma_zdestroy(V_tcbinfo.ipi_zone);
+
INP_INFO_LOCK_DESTROY(V_tcbinfo);
 }
 #endif

Modified: stable/8/sys/netinet/tcp_timewait.c
==
--- stable/8/sys/netinet/tcp_timewait.c Sat Mar 27 17:48:13 2010
(r205760)
+++ stable/8/sys/netinet/tcp_timewait.c Sat Mar 27 17:50:02 2010
(r205761)
@@ -185,6 +185,8 @@ tcp_tw_destroy(void)
while((tw = TAILQ_FIRST(V_twq_2msl)) != NULL)
tcp_twclose(tw, 0);
INP_INFO_WUNLOCK(V_tcbinfo);
+
+   uma_zdestroy(V_tcptw_zone);
 }
 #endif
 

Modified: stable/8/sys/netinet/tcp_var.h
==
--- stable/8/sys/netinet/tcp_var.h  Sat Mar 27 17:48:13 2010
(r205760)
+++ stable/8/sys/netinet/tcp_var.h  Sat Mar 27 17:50:02 2010
(r205761)
@@ -648,6 +648,9 @@ char*tcp_log_addrs(struct in_conninfo 
const void *);
 int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *);
 voidtcp_reass_init(void);
+#ifdef VIMAGE
+voidtcp_reass_destroy(void);
+#endif
 voidtcp_input(struct mbuf *, int);
 u_long  tcp_maxmtu(struct in_conninfo *, int *);
 u_long  tcp_maxmtu6(struct in_conninfo *, int *);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205762 - stable/8/sys/netinet

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:51:27 2010
New Revision: 205762
URL: http://svn.freebsd.org/changeset/base/205762

Log:
  MFC r205251:
  
Add pcb reference counting to the pcblist sysctl handler functions
to ensure type stability while caching the pcb pointers for the
copyout.
  
Reviewed by:  rwatson

Modified:
  stable/8/sys/netinet/ip_divert.c
  stable/8/sys/netinet/raw_ip.c
  stable/8/sys/netinet/tcp_subr.c
  stable/8/sys/netinet/udp_usrreq.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/netinet/ip_divert.c
==
--- stable/8/sys/netinet/ip_divert.cSat Mar 27 17:50:02 2010
(r205761)
+++ stable/8/sys/netinet/ip_divert.cSat Mar 27 17:51:27 2010
(r205762)
@@ -653,11 +653,13 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
INP_INFO_RLOCK(V_divcbinfo);
for (inp = LIST_FIRST(V_divcbinfo.ipi_listhead), i = 0; inp  i  n;
 inp = LIST_NEXT(inp, inp_list)) {
-   INP_RLOCK(inp);
+   INP_WLOCK(inp);
if (inp-inp_gencnt = gencnt 
-   cr_canseeinpcb(req-td-td_ucred, inp) == 0)
+   cr_canseeinpcb(req-td-td_ucred, inp) == 0) {
+   in_pcbref(inp);
inp_list[i++] = inp;
-   INP_RUNLOCK(inp);
+   }
+   INP_WUNLOCK(inp);
}
INP_INFO_RUNLOCK(V_divcbinfo);
n = i;
@@ -679,6 +681,15 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
} else
INP_RUNLOCK(inp);
}
+   INP_INFO_WLOCK(V_divcbinfo);
+   for (i = 0; i  n; i++) {
+   inp = inp_list[i];
+   INP_WLOCK(inp);
+   if (!in_pcbrele(inp))
+   INP_WUNLOCK(inp);
+   }
+   INP_INFO_WUNLOCK(V_divcbinfo);
+
if (!error) {
/*
 * Give the user an updated idea of our state.

Modified: stable/8/sys/netinet/raw_ip.c
==
--- stable/8/sys/netinet/raw_ip.c   Sat Mar 27 17:50:02 2010
(r205761)
+++ stable/8/sys/netinet/raw_ip.c   Sat Mar 27 17:51:27 2010
(r205762)
@@ -1025,13 +1025,13 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
INP_INFO_RLOCK(V_ripcbinfo);
for (inp = LIST_FIRST(V_ripcbinfo.ipi_listhead), i = 0; inp  i  n;
 inp = LIST_NEXT(inp, inp_list)) {
-   INP_RLOCK(inp);
+   INP_WLOCK(inp);
if (inp-inp_gencnt = gencnt 
cr_canseeinpcb(req-td-td_ucred, inp) == 0) {
-   /* XXX held references? */
+   in_pcbref(inp);
inp_list[i++] = inp;
}
-   INP_RUNLOCK(inp);
+   INP_WUNLOCK(inp);
}
INP_INFO_RUNLOCK(V_ripcbinfo);
n = i;
@@ -1054,6 +1054,15 @@ rip_pcblist(SYSCTL_HANDLER_ARGS)
} else
INP_RUNLOCK(inp);
}
+   INP_INFO_WLOCK(V_ripcbinfo);
+   for (i = 0; i  n; i++) {
+   inp = inp_list[i];
+   INP_WLOCK(inp);
+   if (!in_pcbrele(inp))
+   INP_WUNLOCK(inp);
+   }
+   INP_INFO_WUNLOCK(V_ripcbinfo);
+
if (!error) {
/*
 * Give the user an updated idea of our state.  If the

Modified: stable/8/sys/netinet/tcp_subr.c
==
--- stable/8/sys/netinet/tcp_subr.c Sat Mar 27 17:50:02 2010
(r205761)
+++ stable/8/sys/netinet/tcp_subr.c Sat Mar 27 17:51:27 2010
(r205762)
@@ -1102,7 +1102,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
INP_INFO_RLOCK(V_tcbinfo);
for (inp = LIST_FIRST(V_tcbinfo.ipi_listhead), i = 0;
inp != NULL  i  n; inp = LIST_NEXT(inp, inp_list)) {
-   INP_RLOCK(inp);
+   INP_WLOCK(inp);
if (inp-inp_gencnt = gencnt) {
/*
 * XXX: This use of cr_cansee(), introduced with
@@ -1117,10 +1117,12 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
error = EINVAL; /* Skip this inp. */
} else
error = cr_canseeinpcb(req-td-td_ucred, inp);
-   if (error == 0)
+   if (error == 0) {
+   in_pcbref(inp);
inp_list[i++] = inp;
+   }
}
-   INP_RUNLOCK(inp);
+   INP_WUNLOCK(inp);
}
  

svn commit: r205764 - stable/8/sys/kern

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:54:44 2010
New Revision: 205764
URL: http://svn.freebsd.org/changeset/base/205764

Log:
  MFC r205626:
  
Print the pointer to the lock with the panic message. The previous
  panic: rw lock not unlocked
was not really helpful for debugging. Now one can at least call
  show lock ptr
form ddb to learn more about the lock.

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

Modified: stable/8/sys/kern/kern_rwlock.c
==
--- stable/8/sys/kern/kern_rwlock.c Sat Mar 27 17:52:56 2010
(r205763)
+++ stable/8/sys/kern/kern_rwlock.c Sat Mar 27 17:54:44 2010
(r205764)
@@ -196,8 +196,8 @@ void
 rw_destroy(struct rwlock *rw)
 {
 
-   KASSERT(rw-rw_lock == RW_UNLOCKED, (rw lock not unlocked));
-   KASSERT(rw-rw_recurse == 0, (rw lock still recursed));
+   KASSERT(rw-rw_lock == RW_UNLOCKED, (rw lock %p not unlocked, rw));
+   KASSERT(rw-rw_recurse == 0, (rw lock %p still recursed, rw));
rw-rw_lock = RW_DESTROYED;
lock_destroy(rw-lock_object);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205765 - stable/8/sys/dev/fdc

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 17:56:45 2010
New Revision: 205765
URL: http://svn.freebsd.org/changeset/base/205765

Log:
  MFC r197945:
  
  Orphaning provider with EXDEV seems weird; perhaps the author meant
  ENXIO here?

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

Modified: stable/8/sys/dev/fdc/fdc.c
==
--- stable/8/sys/dev/fdc/fdc.c  Sat Mar 27 17:54:44 2010(r205764)
+++ stable/8/sys/dev/fdc/fdc.c  Sat Mar 27 17:56:45 2010(r205765)
@@ -864,7 +864,7 @@ fdc_worker(struct fdc_data *fdc)
fd-flags |= FD_NEWDISK;
mtx_unlock(fdc-fdc_mtx);
g_topology_lock();
-   g_orphan_provider(fd-fd_provider, EXDEV);
+   g_orphan_provider(fd-fd_provider, ENXIO);
fd-fd_provider-flags |= G_PF_WITHER;
fd-fd_provider =
g_new_providerf(fd-fd_geom, fd-fd_geom-name);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205766 - stable/8/sbin/mount

2010-03-27 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 27 17:57:17 2010
New Revision: 205766
URL: http://svn.freebsd.org/changeset/base/205766

Log:
  MFC r204840:
  
As statfs.f_flags are uint64_t the local variables should be as well.
We'll start noticing this with the next flag introduced as the lower
32bit are all used.
  
While here compare to 0 explicitly [1].
  
Suggested by: kib [1]
Reviewed by:  kib

Modified:
  stable/8/sbin/mount/mount.c
Directory Properties:
  stable/8/sbin/mount/   (props changed)

Modified: stable/8/sbin/mount/mount.c
==
--- stable/8/sbin/mount/mount.c Sat Mar 27 17:56:45 2010(r205765)
+++ stable/8/sbin/mount/mount.c Sat Mar 27 17:57:17 2010(r205766)
@@ -91,7 +91,7 @@ char   *flags2opts(int);
 
 /* Map from mount options to printable formats. */
 static struct opt {
-   int o_opt;
+   uint64_t o_opt;
const char *o_name;
 } optnames[] = {
{ MNT_ASYNC,asynchronous },
@@ -611,7 +611,7 @@ mountfs(const char *vfstype, const char 
 void
 prmount(struct statfs *sfp)
 {
-   int flags;
+   uint64_t flags;
unsigned int i;
struct opt *o;
struct passwd *pw;
@@ -620,7 +620,7 @@ prmount(struct statfs *sfp)
sfp-f_fstypename);
 
flags = sfp-f_flags  MNT_VISFLAGMASK;
-   for (o = optnames; flags  o-o_opt; o++)
+   for (o = optnames; flags != 0  o-o_opt != 0; o++)
if (flags  o-o_opt) {
(void)printf(, %s, o-o_name);
flags = ~o-o_opt;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205767 - stable/8/sbin/mount

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:01:38 2010
New Revision: 205767
URL: http://svn.freebsd.org/changeset/base/205767

Log:
  MFC r199182:
  
  Add links to zfs(8) and zpool(8) to mount(8) manual page.

Modified:
  stable/8/sbin/mount/mount.8
Directory Properties:
  stable/8/sbin/mount/   (props changed)

Modified: stable/8/sbin/mount/mount.8
==
--- stable/8/sbin/mount/mount.8 Sat Mar 27 17:57:17 2010(r205766)
+++ stable/8/sbin/mount/mount.8 Sat Mar 27 18:01:38 2010(r205767)
@@ -527,7 +527,9 @@ support for a particular file system mig
 .Xr mount_smbfs 8 ,
 .Xr mount_udf 8 ,
 .Xr mount_unionfs 8 ,
-.Xr umount 8
+.Xr umount 8 ,
+.Xr zfs 8 ,
+.Xr zpool 8
 .Sh CAVEATS
 After a successful
 .Nm ,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205768 - stable/8/sys/geom/label

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:04:33 2010
New Revision: 205768
URL: http://svn.freebsd.org/changeset/base/205768

Log:
  MFC r199875:
  
  Provide a set of sysctls and tunables to disable device node creation
  for specific kinds of disk labels - for example, GPT UUIDs.  Reason
  for this is that sometimes, other GEOM classes attach to these device
  nodes instead of the proper ones - e.g. they attach to /dev/gptid/XXX
  instead of /dev/ada0p2, which is annoying.
  
  Reviewed by:  pjd (earlier version)

Modified:
  stable/8/sys/geom/label/g_label.c
  stable/8/sys/geom/label/g_label.h
  stable/8/sys/geom/label/g_label_ext2fs.c
  stable/8/sys/geom/label/g_label_gpt.c
  stable/8/sys/geom/label/g_label_iso9660.c
  stable/8/sys/geom/label/g_label_msdosfs.c
  stable/8/sys/geom/label/g_label_ntfs.c
  stable/8/sys/geom/label/g_label_reiserfs.c
  stable/8/sys/geom/label/g_label_ufs.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/geom/label/g_label.c
==
--- stable/8/sys/geom/label/g_label.c   Sat Mar 27 18:01:38 2010
(r205767)
+++ stable/8/sys/geom/label/g_label.c   Sat Mar 27 18:04:33 2010
(r205768)
@@ -34,7 +34,6 @@ __FBSDID($FreeBSD$);
 #include sys/lock.h
 #include sys/mutex.h
 #include sys/bio.h
-#include sys/sysctl.h
 #include sys/malloc.h
 #include sys/libkern.h
 #include geom/geom.h
@@ -316,6 +315,8 @@ g_label_taste(struct g_class *mp, struct
for (i = 0; g_labels[i] != NULL; i++) {
char label[64];
 
+   if (g_labels[i]-ld_enabled == 0)
+   continue;
g_topology_unlock();
g_labels[i]-ld_taste(cp, label, sizeof(label));
g_topology_lock();

Modified: stable/8/sys/geom/label/g_label.h
==
--- stable/8/sys/geom/label/g_label.h   Sat Mar 27 18:01:38 2010
(r205767)
+++ stable/8/sys/geom/label/g_label.h   Sat Mar 27 18:04:33 2010
(r205768)
@@ -30,6 +30,9 @@
 #define_G_LABEL_H_
 
 #include sys/endian.h
+#ifdef _KERNEL
+#include sys/sysctl.h
+#endif
 
 #defineG_LABEL_CLASS_NAME  LABEL
 
@@ -56,23 +59,34 @@ extern u_int g_label_debug;
}   \
 } while (0)
 
+SYSCTL_DECL(_kern_geom_label);
+
+#defineG_LABEL_INIT(kind, label, descr)
\
+   SYSCTL_NODE(_kern_geom_label, OID_AUTO, kind, CTLFLAG_RD,   \
+   NULL, );  \
+   SYSCTL_INT(_kern_geom_label_##kind, OID_AUTO, enable,   \
+   CTLFLAG_RW, label.ld_enabled, 1, descr);   \
+   TUNABLE_INT(kern.geom.label. __XSTRING(kind) .enable,   \
+   label.ld_enabled)
+
 typedef void g_label_taste_t (struct g_consumer *cp, char *label, size_t size);
 
 struct g_label_desc {
g_label_taste_t *ld_taste;
char*ld_dir;
+   int  ld_enabled;
 };
 
 /* Supported labels. */
-extern const struct g_label_desc g_label_ufs_id;
-extern const struct g_label_desc g_label_ufs_volume;
-extern const struct g_label_desc g_label_iso9660;
-extern const struct g_label_desc g_label_msdosfs;
-extern const struct g_label_desc g_label_ext2fs;
-extern const struct g_label_desc g_label_reiserfs;
-extern const struct g_label_desc g_label_ntfs;
-extern const struct g_label_desc g_label_gpt;
-extern const struct g_label_desc g_label_gpt_uuid;
+extern struct g_label_desc g_label_ufs_id;
+extern struct g_label_desc g_label_ufs_volume;
+extern struct g_label_desc g_label_iso9660;
+extern struct g_label_desc g_label_msdosfs;
+extern struct g_label_desc g_label_ext2fs;
+extern struct g_label_desc g_label_reiserfs;
+extern struct g_label_desc g_label_ntfs;
+extern struct g_label_desc g_label_gpt;
+extern struct g_label_desc g_label_gpt_uuid;
 #endif /* _KERNEL */
 
 struct g_label_metadata {

Modified: stable/8/sys/geom/label/g_label_ext2fs.c
==
--- stable/8/sys/geom/label/g_label_ext2fs.cSat Mar 27 18:01:38 2010
(r205767)
+++ stable/8/sys/geom/label/g_label_ext2fs.cSat Mar 27 18:04:33 2010
(r205768)
@@ -86,7 +86,10 @@ exit_free:
g_free(fs);
 }
 
-const struct g_label_desc g_label_ext2fs = {
+struct g_label_desc g_label_ext2fs = {
.ld_taste = g_label_ext2fs_taste,
-   .ld_dir = ext2fs
+   .ld_dir = ext2fs,
+   .ld_enabled = 1
 };
+
+G_LABEL_INIT(ext2fs, g_label_ext2fs, Create device nodes for EXT2FS volumes);

Modified: 

svn commit: r205769 - stable/8/sys/kern

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:08:14 2010
New Revision: 205769
URL: http://svn.freebsd.org/changeset/base/205769

Log:
  MFC r200058:
  
  Add change that was somehow missed in r192586.  It could manifest by
  incorrectly returning EINVAL from acl_valid(3) for applications linked
  against pre-8.0 libc.

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

Modified: stable/8/sys/kern/vfs_acl.c
==
--- stable/8/sys/kern/vfs_acl.c Sat Mar 27 18:04:33 2010(r205768)
+++ stable/8/sys/kern/vfs_acl.c Sat Mar 27 18:08:14 2010(r205769)
@@ -173,7 +173,7 @@ acl_copyout(struct acl *kernel_acl, void
 
 /*
  * Convert old type - ACL_TYPE_{ACCESS,DEFAULT}_OLD - into its new
- * counterpart.  It's required for old (pre-NFS4 ACLs) libc to work
+ * counterpart.  It's required for old (pre-NFSv4 ACLs) libc to work
  * with new kernel.  Fixing 'type' for old binaries with new libc
  * is being done in lib/libc/posix1e/acl_support.c:_acl_type_unold().
  */
@@ -307,7 +307,8 @@ vacl_aclcheck(struct thread *td, struct 
error = acl_copyin(aclp, inkernelacl, type);
if (error)
goto out;
-   error = VOP_ACLCHECK(vp, type, inkernelacl, td-td_ucred, td);
+   error = VOP_ACLCHECK(vp, acl_type_unold(type), inkernelacl,
+   td-td_ucred, td);
 out:
acl_free(inkernelacl);
return (error);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205770 - stable/8/sys/kern

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:09:40 2010
New Revision: 205770
URL: http://svn.freebsd.org/changeset/base/205770

Log:
  MFC r200273:
  
  Don't add VAPPEND if the file is not being opened for writing.  Note that this
  only affects cases where open(2) is being used improperly - i.e. when the user
  specifies O_APPEND without O_WRONLY or O_RDWR.
  
  Reviewed by:  rwatson

Modified:
  stable/8/sys/kern/vfs_syscalls.c
  stable/8/sys/kern/vfs_vnops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/kern/vfs_syscalls.c
==
--- stable/8/sys/kern/vfs_syscalls.cSat Mar 27 18:08:14 2010
(r205769)
+++ stable/8/sys/kern/vfs_syscalls.cSat Mar 27 18:09:40 2010
(r205770)
@@ -4436,7 +4436,7 @@ fhopen(td, uap)
}
if (fmode  FREAD)
accmode |= VREAD;
-   if (fmode  O_APPEND)
+   if ((fmode  O_APPEND)  (fmode  FWRITE))
accmode |= VAPPEND;
 #ifdef MAC
error = mac_vnode_check_open(td-td_ucred, vp, accmode);

Modified: stable/8/sys/kern/vfs_vnops.c
==
--- stable/8/sys/kern/vfs_vnops.c   Sat Mar 27 18:08:14 2010
(r205769)
+++ stable/8/sys/kern/vfs_vnops.c   Sat Mar 27 18:09:40 2010
(r205770)
@@ -212,7 +212,7 @@ restart:
accmode |= VREAD;
if (fmode  FEXEC)
accmode |= VEXEC;
-   if (fmode  O_APPEND)
+   if ((fmode  O_APPEND)  (fmode  FWRITE))
accmode |= VAPPEND;
 #ifdef MAC
error = mac_vnode_check_open(cred, vp, accmode);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205771 - stable/8/sys/kern

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:12:00 2010
New Revision: 205771
URL: http://svn.freebsd.org/changeset/base/205771

Log:
  MFC r200723:
  
  Interpret VAPPEND correctly in vaccess_acl_nfs4(9).

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

Modified: stable/8/sys/kern/subr_acl_nfs4.c
==
--- stable/8/sys/kern/subr_acl_nfs4.c   Sat Mar 27 18:09:40 2010
(r205770)
+++ stable/8/sys/kern/subr_acl_nfs4.c   Sat Mar 27 18:12:00 2010
(r205771)
@@ -82,6 +82,13 @@ _access_mask_from_accmode(accmode_t accm
access_mask |= accmode2mask[i].mask;
}
 
+   /*
+* VAPPEND is just a modifier for VWRITE; if the caller asked
+* for 'VAPPEND | VWRITE', we want to check for ACL_APPEND_DATA only.
+*/
+   if (access_mask  ACL_APPEND_DATA)
+   access_mask = ~ACL_WRITE_DATA;
+
return (access_mask);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205772 - in stable/8/sbin/geom: class/cache core

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:15:18 2010
New Revision: 205772
URL: http://svn.freebsd.org/changeset/base/205772

Log:
  MFC r201432:
  
  Add manual page for gcache(8).

Added:
  stable/8/sbin/geom/class/cache/gcache.8
 - copied unchanged from r201432, head/sbin/geom/class/cache/gcache.8
Modified:
  stable/8/sbin/geom/class/cache/Makefile
  stable/8/sbin/geom/core/geom.8
Directory Properties:
  stable/8/sbin/geom/   (props changed)
  stable/8/sbin/geom/class/stripe/   (props changed)

Modified: stable/8/sbin/geom/class/cache/Makefile
==
--- stable/8/sbin/geom/class/cache/Makefile Sat Mar 27 18:12:00 2010
(r205771)
+++ stable/8/sbin/geom/class/cache/Makefile Sat Mar 27 18:15:18 2010
(r205772)
@@ -3,6 +3,5 @@
 .PATH: ${.CURDIR}/../../misc
 
 CLASS= cache
-NO_MAN=# notyet
 
 .include bsd.lib.mk

Copied: stable/8/sbin/geom/class/cache/gcache.8 (from r201432, 
head/sbin/geom/class/cache/gcache.8)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/8/sbin/geom/class/cache/gcache.8 Sat Mar 27 18:15:18 2010
(r205772, copy of r201432, head/sbin/geom/class/cache/gcache.8)
@@ -0,0 +1,192 @@
+.\-
+.\ Copyright (c) 2010 Edward Tomasz Napierala
+.\ All rights reserved.
+.\
+.\ Redistribution and use in source and binary forms, with or without
+.\ modification, are permitted provided that the following conditions
+.\ are met:
+.\ 1. Redistributions of source code must retain the above copyright
+.\notice, this list of conditions and the following disclaimer.
+.\ 2. Redistributions in binary form must reproduce the above copyright
+.\notice, this list of conditions and the following disclaimer in the
+.\documentation and/or other materials provided with the distribution.
+.\
+.\ THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\ ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE
+.\ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\ POSSIBILITY OF SUCH DAMAGE.
+.\
+.\ $FreeBSD$
+.\
+.Dd January 3, 2010
+.Dt GCACHE 8
+.Os
+.Sh NAME
+.Nm gcache
+.Nd control utility for CACHE GEOM class
+.Sh SYNOPSIS
+.Nm
+.Cm create
+.Op Fl v
+.Op Fl b Ar blocksize
+.Op Fl s Ar size
+.Ar name
+.Ar prov
+.Nm
+.Cm configure
+.Op Fl v
+.Op Fl b Ar blocksize
+.Op Fl s Ar size
+.Ar name
+.Nm
+.Cm destroy
+.Op Fl fv
+.Ar name
+.Nm
+.Cm label
+.Op Fl v
+.Op Fl b Ar blocksize
+.Op Fl s Ar size
+.Ar name
+.Ar prov
+.Nm
+.Cm stop
+.Op Fl fv
+.Ar name ...
+.Nm
+.Cm clear
+.Op Fl v
+.Ar prov ...
+.Nm
+.Cm dump
+.Ar prov ...
+.Nm
+.Cm list
+.Nm
+.Cm status
+.Op Fl s Ar name
+.Nm
+.Cm load
+.Op Fl v
+.Nm
+.Cm unload
+.Op Fl v
+.Sh DESCRIPTION
+The
+.Nm
+utility is used to control GEOM cache, which can
+speed up read performance by sending fixed size
+read requests to its consumer.  It has been developed to address
+the problem of a horrible read performance of a 64k blocksize FS
+residing on a RAID3 array with 8 data components, where a single
+disk component would only get 8k read requests, thus effectively
+killing disk performance under high load.
+.Pp
+Caching can be configured using two different methods:
+.Dq manual
+or
+.Dq automatic .
+When using the
+.Dq manual
+method, no metadata are stored on the devices, so the cached
+device has to be configured by hand every time it is needed.
+The
+.Dq automatic
+method uses on-disk metadata to detect devices.
+Once devices are labeled, they will be automatically detected and
+configured.
+.Pp
+The first argument to
+.Nm
+indicates an action to be performed:
+.Bl -tag -width .Cm destroy
+.It Cm create
+Cache the given devices with specified
+.Ar name .
+This is the
+.Dq manual
+method.
+The kernel module
+.Pa geom_cache.ko
+will be loaded if it is not loaded already.
+.It Cm label
+Cache the given devices with the specified
+.Ar name .
+This is the
+.Dq automatic
+method, where metadata are stored in every device's last sector.
+The kernel module
+.Pa geom_cache.ko
+will be loaded if it is not loaded already.
+.It Cm stop
+Turn off existing cache device by its
+.Ar name .
+This command does not touch on-disk metadata!
+.It Cm destroy
+Same as
+.Cm stop .
+.It Cm clear
+Clear metadata on the given devices.
+.It Cm dump
+Dump metadata stored on the given devices.
+.It Cm 

svn commit: r205773 - head/sys/i386/i386

2010-03-27 Thread Alan Cox
Author: alc
Date: Sat Mar 27 18:24:27 2010
New Revision: 205773
URL: http://svn.freebsd.org/changeset/base/205773

Log:
  Simplify pmap_growkernel(), making the i386 version more like the amd64
  version.
  
  MFC after:3 weeks

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

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Sat Mar 27 18:15:18 2010(r205772)
+++ head/sys/i386/i386/pmap.c   Sat Mar 27 18:24:27 2010(r205773)
@@ -207,8 +207,8 @@ vm_offset_t virtual_end;/* VA of last a
 int pgeflag = 0;   /* PG_G or-in */
 int pseflag = 0;   /* PG_PS or-in */
 
-static int nkpt;
-vm_offset_t kernel_vm_end;
+static int nkpt = NKPT;
+vm_offset_t kernel_vm_end = KERNBASE + NKPT * NBPDR;
 extern u_int32_t KERNend;
 extern u_int32_t KPTphys;
 
@@ -395,7 +395,6 @@ pmap_bootstrap(vm_paddr_t firstaddr)
mtx_lock_spin(allpmaps_lock);
LIST_INSERT_HEAD(allpmaps, kernel_pmap, pm_list);
mtx_unlock_spin(allpmaps_lock);
-   nkpt = NKPT;
 
/*
 * Reserve some special page table entries/VA space for temporary
@@ -2032,24 +2031,12 @@ pmap_growkernel(vm_offset_t addr)
pd_entry_t newpdir;
 
mtx_assert(kernel_map-system_mtx, MA_OWNED);
-   if (kernel_vm_end == 0) {
-   kernel_vm_end = KERNBASE;
-   nkpt = 0;
-   while (pdir_pde(PTD, kernel_vm_end)) {
-   kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG)  
~(PAGE_SIZE * NPTEPG - 1);
-   nkpt++;
-   if (kernel_vm_end - 1 = kernel_map-max_offset) {
-   kernel_vm_end = kernel_map-max_offset;
-   break;
-   }
-   }
-   }
-   addr = roundup2(addr, PAGE_SIZE * NPTEPG);
+   addr = roundup2(addr, NBPDR);
if (addr - 1 = kernel_map-max_offset)
addr = kernel_map-max_offset;
while (kernel_vm_end  addr) {
if (pdir_pde(PTD, kernel_vm_end)) {
-   kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG)  
~(PAGE_SIZE * NPTEPG - 1);
+   kernel_vm_end = (kernel_vm_end + NBPDR)  ~PDRMASK;
if (kernel_vm_end - 1 = kernel_map-max_offset) {
kernel_vm_end = kernel_map-max_offset;
break;
@@ -2072,7 +2059,7 @@ pmap_growkernel(vm_offset_t addr)
pdir_pde(KPTD, kernel_vm_end) = pgeflag | newpdir;
 
pmap_kenter_pde(kernel_vm_end, newpdir);
-   kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG)  
~(PAGE_SIZE * NPTEPG - 1);
+   kernel_vm_end = (kernel_vm_end + NBPDR)  ~PDRMASK;
if (kernel_vm_end - 1 = kernel_map-max_offset) {
kernel_vm_end = kernel_map-max_offset;
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205775 - stable/8/share/man/man9

2010-03-27 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Mar 27 18:45:53 2010
New Revision: 205775
URL: http://svn.freebsd.org/changeset/base/205775

Log:
  MFC r203122:
  
  Improve descriptions, remove turnstiles (since, from what I understand,
  they are only used to implement other synchronization primitives), tweak
  formatting.
  
  MFC r203127:
  
  Add description of bounded sleep vs unbounded sleep (aka blocking).  Move
  rules into their own section.
  
  MFC r203131:
  
  Cosmetic fixes.
  
  MFC r203759:
  
  Improve description for Giant and mention blocking inside interrupt threads.
  
  MFC r203762:
  
  Start sentences with a new line.
  
  Submitted by: brueffer
  
  MFC r203825:
  
  Remove list of locking primitives, which is kind of redundant, move
  information about witness(9) to the section about interactions, and
  expand 'contexts' table.
  
  MFC r203929:
  
  Some rewording and language fixes.
  
  PR:   docs/136918, docs/134074
  Submitted by: Ben Kaduk kaduk at mit dot edu, Haven Hash havenster at 
gmail dot com

Modified:
  stable/8/share/man/man9/locking.9
Directory Properties:
  stable/8/share/man/man9/   (props changed)

Modified: stable/8/share/man/man9/locking.9
==
--- stable/8/share/man/man9/locking.9   Sat Mar 27 18:40:08 2010
(r205774)
+++ stable/8/share/man/man9/locking.9   Sat Mar 27 18:45:53 2010
(r205775)
@@ -24,108 +24,52 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd March 14, 2007
+.Dd February 15, 2010
 .Dt LOCKING 9
 .Os
 .Sh NAME
 .Nm locking
 .Nd kernel synchronization primitives
-.Sh SYNOPSIS
-All sorts of stuff to go here.
-.Pp
 .Sh DESCRIPTION
 The
 .Em FreeBSD
 kernel is written to run across multiple CPUs and as such requires
 several different synchronization primitives to allow the developers
 to safely access and manipulate the many data types required.
-.Pp
-These include:
-.Bl -enum
-.It
-Spin Mutexes
-.It
-Sleep Mutexes
-.It
-pool Mutexes
-.It
-Shared-Exclusive locks
-.It
-Reader-Writer locks
-.It
-Read-Mostly locks
-.It
-Turnstiles
-.It
-Semaphores
-.It
-Condition variables
-.It
-Sleep/wakeup
-.It
-Giant
-.It
-Lockmanager locks
-.El
-.Pp
-The primitives interact and have a number of rules regarding how
-they can and can not be combined.
-There are too many for the average
-human mind and they keep changing.
-(if you disagree, please write replacement text)  :-)
-.Pp
-Some of these primitives may be used at the low (interrupt) level and
-some may not.
-.Pp
-There are strict ordering requirements and for some of the types this
-is checked using the
-.Xr witness 4
-code.
-.Pp
-.Ss SPIN Mutexes
-Mutexes are the basic primitive.
-You either hold it or you don't.
-If you don't own it then you just spin, waiting for the holder (on
-another CPU) to release it.
-Hopefully they are doing something fast.
-You 
-.Em must not
-do anything that deschedules the thread while you
-are holding a SPIN mutex.
 .Ss Mutexes
-Basically (regular) mutexes will deschedule the thread if the
-mutex can not be acquired.
-A non-spin mutex can be considered to be equivalent
-to getting a write lock on an 
-.Em rw_lock
-(see below), and in fact non-spin mutexes and rw_locks may soon become the 
same thing.
-As in spin mutexes, you either get it or you don't.
-You may only call the
-.Xr sleep 9
-call via
-.Fn msleep
-or the new
-.Fn mtx_sleep
-variant.
-These will atomically drop the mutex and reacquire it
-as part of waking up.
-This is often however a
-.Em BAD
-idea because it generally relies on you having
-such a good knowledge of all the call graph above you
-and what assumptions it is making that there are a lot
-of ways to make hard-to-find mistakes.
-For example you MUST re-test all the assumptions you made before,
-all the way up the call graph to where you got the lock.
-You can not just assume that mtx_sleep can be inserted anywhere.
-If any caller above you has any mutex or
-rwlock, your sleep, will cause a panic.
-If the sleep only happens rarely it may be years before the 
-bad code path is found.
-.Ss Pool Mutexes
-A variant of regular mutexes where the allocation of the mutex is handled
-more by the system.
-.Ss Rw_locks
+Mutexes (also called sleep mutexes) are the most commonly used
+synchronization primitive in the kernel.
+Thread acquires (locks) a mutex before accessing data shared with other
+threads (including interrupt threads), and releases (unlocks) it afterwards.
+If the mutex cannot be acquired, the thread requesting it will sleep.
+Mutexes fully support priority propagation.
+.Pp
+See
+.Xr mutex 9
+for details.
+.Ss Spin mutexes
+Spin mutexes are variation of basic mutexes; the main difference between
+the two is that spin mutexes never sleep - instead, they spin, waiting
+for the thread holding the lock, which runs on another CPU, to release it.
+Differently from ordinary mutex, spin mutexes disable interrupts when acquired.
+Since disabling interrupts is expensive, they are also generally slower.

svn commit: r205778 - in head/sys: amd64/amd64 i386/i386

2010-03-27 Thread Alan Cox
Author: alc
Date: Sat Mar 27 23:53:47 2010
New Revision: 205778
URL: http://svn.freebsd.org/changeset/base/205778

Log:
  Correctly handle preemption of pmap_update_pde_invalidate().
  
  X-MFC after:  r205573

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

Modified: head/sys/amd64/amd64/pmap.c
==
--- head/sys/amd64/amd64/pmap.c Sat Mar 27 20:25:50 2010(r205777)
+++ head/sys/amd64/amd64/pmap.c Sat Mar 27 23:53:47 2010(r205778)
@@ -880,9 +880,12 @@ pmap_update_pde_invalidate(vm_offset_t v
load_cr4(cr4  ~CR4_PGE);
/*
 * Although preemption at this point could be detrimental to
-* performance, it would not lead to an error.
+* performance, it would not lead to an error.  PG_G is simply
+* ignored if CR4.PGE is clear.  Moreover, in case this block
+* is re-entered, the load_cr4() either above or below will
+* modify CR4.PGE flushing the TLB.
 */
-   load_cr4(cr4);
+   load_cr4(cr4 | CR4_PGE);
}
 }
 #ifdef SMP

Modified: head/sys/i386/i386/pmap.c
==
--- head/sys/i386/i386/pmap.c   Sat Mar 27 20:25:50 2010(r205777)
+++ head/sys/i386/i386/pmap.c   Sat Mar 27 23:53:47 2010(r205778)
@@ -917,9 +917,12 @@ pmap_update_pde_invalidate(vm_offset_t v
load_cr4(cr4  ~CR4_PGE);
/*
 * Although preemption at this point could be detrimental to
-* performance, it would not lead to an error.
+* performance, it would not lead to an error.  PG_G is simply
+* ignored if CR4.PGE is clear.  Moreover, in case this block
+* is re-entered, the load_cr4() either above or below will
+* modify CR4.PGE flushing the TLB.
 */
-   load_cr4(cr4);
+   load_cr4(cr4 | CR4_PGE);
}
 }
 #ifdef SMP
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r205781 - head/sys/dev/bktr

2010-03-27 Thread Justin T. Gibbs
Author: gibbs
Date: Sun Mar 28 00:10:09 2010
New Revision: 205781
URL: http://svn.freebsd.org/changeset/base/205781

Log:
  Use standard types in preference to BSD types so that these header files
  can be used in applications compiled with only POSIX types visible.
  
  MFC after: 2 weeks

Modified:
  head/sys/dev/bktr/ioctl_bt848.h
  head/sys/dev/bktr/ioctl_meteor.h

Modified: head/sys/dev/bktr/ioctl_bt848.h
==
--- head/sys/dev/bktr/ioctl_bt848.h Sat Mar 27 23:58:53 2010
(r205780)
+++ head/sys/dev/bktr/ioctl_bt848.h Sun Mar 28 00:10:09 2010
(r205781)
@@ -89,9 +89,9 @@
  * EEProm stuff
  */
 struct eeProm {
-   short   offset;
-   short   count;
-   u_char  bytes[ 256 ];
+   short   offset;
+   short   count;
+   unsigned char   bytes[ 256 ];
 };
 
 
@@ -147,7 +147,7 @@ struct eeProm {
  * b23-b16:  i2c addr (write)
  * b31-b24:  1 = write, 0 = read 
  */
-#define BT848_I2CWR _IOWR('x', 57, u_long)/* i2c read-write */
+#define BT848_I2CWR _IOWR('x', 57, unsigned long)/* i2c read-write */
 
 struct bktr_msp_control {
unsigned char function;
@@ -192,10 +192,10 @@ typedef enum { METEOR_PIXTYPE_RGB, METEO
 
 
 struct meteor_pixfmt {
-   u_int  index; /* Index in supported pixfmt list */
+   unsigned int   index; /* Index in supported pixfmt list */
METEOR_PIXTYPE type;  /* What's the board gonna feed us */
-   u_int  Bpp;   /* Bytes per pixel*/
-   u_long masks[3];  /* R,G,B or Y,U,V masks, respectively */
+   unsigned int   Bpp;   /* Bytes per pixel*/
+   unsigned long  masks[3];  /* R,G,B or Y,U,V masks, respectively */
unsigned   swap_bytes :1; /* Bytes  swapped within shorts   */
unsigned   swap_shorts:1; /* Shorts swapped within longs*/
 };

Modified: head/sys/dev/bktr/ioctl_meteor.h
==
--- head/sys/dev/bktr/ioctl_meteor.hSat Mar 27 23:58:53 2010
(r205780)
+++ head/sys/dev/bktr/ioctl_meteor.hSun Mar 28 00:10:09 2010
(r205781)
@@ -50,27 +50,27 @@ struct meteor_capframe {
 
 /* structure for METEOR[GS]ETGEO - get/set geometry  */
 struct meteor_geomet {
-   u_short rows;
-   u_short columns;
-   u_short frames;
-   u_long  oformat;
+   unsigned short  rows;
+   unsigned short  columns;
+   unsigned short  frames;
+   unsigned long   oformat;
 } ;
 
 /* structure for METEORGCOUNT-get count of frames, fifo errors and dma errors 
*/
 struct meteor_counts {
-   u_long fifo_errors; /* count of fifo errors since open */
-   u_long dma_errors;  /* count of dma errors since open */
-   u_long frames_captured; /* count of frames captured since open */
-   u_long even_fields_captured; /* count of even fields captured */
-   u_long odd_fields_captured; /* count of odd fields captured */
+   unsigned long fifo_errors;  /* count of fifo errors since open */
+   unsigned long dma_errors;   /* count of dma errors since open */
+   unsigned long frames_captured;  /* count of frames captured since open 
*/
+   unsigned long even_fields_captured; /* count of even fields captured */
+   unsigned long odd_fields_captured; /* count of odd fields captured */
 } ;
 
 /* structure for getting and setting direct transfers to vram */
 struct meteor_video {
-   u_long  addr;   /* Address of location to dma to */
-   u_long  width;  /* Width of memory area */
-   u_long  banksize;   /* Size of Vram bank */
-   u_long  ramsize;/* Size of Vram */
+   unsigned long   addr;   /* Address of location to dma to */
+   unsigned long   width;  /* Width of memory area */
+   unsigned long   banksize;   /* Size of Vram bank */
+   unsigned long   ramsize;/* Size of Vram */
 };
 
 #define METEORCAPTUR _IOW('x', 1, int)  /* capture a frame */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org