From kensmith at FreeBSD.org Fri May 1 02:16:07 2009
From: kensmith at FreeBSD.org (Ken Smith)
Date: Fri May 1 02:16:19 2009
Subject: svn commit: r191712 - stable/7
Message-ID: <200905010216.n412G57S028976@svn.freebsd.org>
Author: kensmith
Date: Fri May 1 02:16:05 2009
New Revision: 191712
URL: http://svn.freebsd.org/changeset/base/191712
Log:
Predict announcement day for 7.2-RELEASE.
Approved by: re (implicit)
Modified:
stable/7/UPDATING
Modified: stable/7/UPDATING
==============================================================================
--- stable/7/UPDATING Thu Apr 30 22:43:21 2009 (r191711)
+++ stable/7/UPDATING Fri May 1 02:16:05 2009 (r191712)
@@ -8,6 +8,9 @@ Items affecting the ports and packages s
/usr/ports/UPDATING. Please read that file before running
portupgrade.
+20090504:
+ FreeBSD 7.2-RELEASE
+
20090326:
Following bug-fixes to TCP connection state flags, netstat, systat,
and sockstat will need to be rebuilt in order to properly print
From hrs at FreeBSD.org Sat May 2 16:23:46 2009
From: hrs at FreeBSD.org (Hiroki Sato)
Date: Sat May 2 16:23:52 2009
Subject: svn commit: r191748 - in stable/7/release/doc:
en_US.ISO8859-1/errata en_US.ISO8859-1/relnotes share/sgml
Message-ID: <200905021623.n42GNjvR089580@svn.freebsd.org>
Author: hrs
Date: Sat May 2 16:23:44 2009
New Revision: 191748
URL: http://svn.freebsd.org/changeset/base/191748
Log:
- Update Errata for 7.2R: disc1 booting problem on some motherboards.
- Update &release.*;
- Fix a typo.
Approved by: re (implicit)
Modified:
stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml
stable/7/release/doc/share/sgml/release.ent
Modified: stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
==============================================================================
--- stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Sat May 2 15:37:46 2009 (r191747)
+++ stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Sat May 2 16:23:44 2009 (r191748)
@@ -16,7 +16,7 @@
%release;
-
+
]>
@@ -163,191 +163,15 @@
Open Issues
- [20090105] As in the Announcement of 7.1-RELEASE, certain Intel NICs
- will come up as &man.igb.4; instead of &man.em.4; in this
- release. There are only 3 PCI ID's that should have
- their name changed from &man.em.4; to &man.igb.4;:
-
-
-
- 0x10A78086
-
-
-
- 0x10A98086
-
-
-
- 0x10D68086
-
-
-
- You should be able to determine if your card will
- change names by running the following command:
-
- &prompt.user; pciconf -l
-. . .
-em0@pci0:0:25:0: class=0x020000 card=0x02381028 chip=0x10c08086 rev=0x02 hdr=0x00
-
- and for the line representing your NIC (should be named
- em on older systems,
- e.g. em0 or em1, etc)
- check the fourth column. If that says
- chip=0x10a78086 (or one of the other two IDs
- given above) you will have the adapter's name change.
-
+ [20090501] Some machines do not recognize the i386 disc1 as
+ bootable and fall through to booting off the next boot device.
+ All affected machines did see the other discs as bootable. As a
+ workaround, you can boot using the bootonly or livefs CDROM and
+ then swap in disc1 once sysinstall starts.Late-Breaking News and Corrections
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned that the &man.procstat.1; utility has been added.
- This is a process inspection utility which provides both some of
- the missing functionality from &man.procfs.5; and new
- functionality for monitoring and debugging specific
- processes.
-
- [20090105] The Release Notes for 7.1-RELEASE should have mentioned
- changes that the &man.ae.4; driver has been added to provide support
- for the Attansic/Atheros L2 FastEthernet controllers.
- This driver is not enabled in GENERIC
- kernels for this release.
-
- [20090105] The Release Notes for 7.1-RELEASE included the
- following misdescriptions:
-
-
-
- In the entry of &man.linux.4; ABI support,
- get_setaffinity() should have been
- sched_setaffinity().
-
-
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned changes that the &man.jme.4; driver has been added to
- provide support for PCIe adapters based on JMicron JMC250
- gigabit Ethernet and JMC260 fast Ethernet controllers.
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned changes that the &man.age.4; driver has been added to
- provide support for Attansic/Atheros L1 gigabit Ethernet
- controller.
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned changes that the &man.malo.4; driver has been added to
- provide support for Marvell Libertas 88W8335 based PCI network
- adapters.
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned changes that the bm(4) driver has been added to
- provide support for Apple Big Mac (BMAC) Ethernet controller,
- found on various Apple G3 models.
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned changes that the et(4) driver has been added to
- provide support for Agere ET1310 10/100/Gigabit Ethernet
- controller.
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned changes that the &man.glxsb.4; driver has been added
- to provide support for the Security Block in AMD Geode LX
- processors.
-
- [20090105] The Release Notes for 7.1-RELEASE should have
- mentioned that &os; now supports multiple routing tables. To
- enable this, the following steps are needed:
-
-
-
- Add the following kernel configuration option and
- rebuild the kernel. The 2 is the number
- of FIB (Forward Information Base, synonym for a routing
- table here). The maximum value is 16.
-
- options ROUTETABLES=2
-
- The procedure for rebuilding the &os; kernel is
- described in the &os;
- Handbook.
-
- This number can be modified on boot time. To do so, add
- the following to /boot/loader.conf and
- reboot the system:
-
- net.fibs=6
-
-
-
- Set a loader tunable net.my_fibnum if
- needed. This means the default number of routing tables.
- If not specified, 0 will be used.
-
-
-
- Set a loader tunable
- net.add_addr_allfibs if needed. This
- enables to add routes to all FIBs for new interfaces by
- default. When this is set to 0, it will
- only allocate routes on interface changes for the FIB of the
- caller when adding a new set of addresses to an interface.
- Note that this tunable is set to 1 by
- default.
-
-
-
- To select one of the FIBs, the new &man.setfib.1; utility
- can be used. This set an associated FIB with the process. For
- example:
-
- &prompt.root; setfib -3 ping target.example.com
-
- The FIB #3 will be used for the &man.ping.8; command.
-
- The FIB which the packet will be associated with will be
- determined in the following rules:
-
-
-
- All packets which have a FIB associated with them will
- use the FIB. If not, FIB #0 will be used.
-
-
-
- A packet received on an interface for forwarding uses
- FIB #0.
-
-
-
- A TCP listen socket associated with an FIB will generate
- accept sockets which are associated with the same FIB.
-
-
-
- A packet generated in response to other packet uses the
- FIB associated with the packet being responded to.
-
-
-
- A packet generated on tunnel interfaces such as
- &man.gif.4; and &man.tun.4; will be encapsulated using the
- FIB of the process which set up the tunnel.
-
-
-
- Routing messages will be associated with the process's
- FIB.
-
-
-
- Also, the &man.ipfw.8; now supports an action rule
- setfib. The following action:
-
- setfib fibnum
-
- will make the matched packet use the FIB specified in
- fibnum. The rule processing
- continues at the next rule.
+ No news.
Modified: stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml
==============================================================================
--- stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat May 2 15:37:46 2009 (r191747)
+++ stable/7/release/doc/en_US.ISO8859-1/relnotes/article.sgml Sat May 2 16:23:44 2009 (r191748)
@@ -226,7 +226,7 @@
will update unmodified userland utilities, as well as unmodified
GENERIC or SMP kernels distributed as a part of an official &os;
release. The &man.freebsd-update.8; utility requires that the
- host being upgraded have Internet connectivity.
+ host being upgraded has Internet connectivity.
An older form of binary upgrade is supported through the
Upgrade option from the main
Modified: stable/7/release/doc/share/sgml/release.ent
==============================================================================
--- stable/7/release/doc/share/sgml/release.ent Sat May 2 15:37:46 2009 (r191747)
+++ stable/7/release/doc/share/sgml/release.ent Sat May 2 16:23:44 2009 (r191748)
@@ -6,12 +6,12 @@
-
+
-
+
-
+
@@ -39,7 +39,7 @@
-
+
From anders at FreeBSD.org Sat May 2 21:53:33 2009
From: anders at FreeBSD.org (Anders Nordby)
Date: Sat May 2 21:53:41 2009
Subject: svn commit: r187198 - in stable/7: sys/boot/i386/boot0
usr.sbin/boot0cfg
In-Reply-To: <200901132228.n0DMSnai018184@svn.freebsd.org>
References: <200901132228.n0DMSnai018184@svn.freebsd.org>
Message-ID: <20090502213551.GA52946@fupp.net>
Hi,
It seems that recent commits to boot0cfg and/or loader in RELENG_7,
makes the -s for boot0cfg not work anymore. At least, in my setup,
currdev and loaddev in loader is always set to disk0s1a (the first
partition), no matter if I try to boot another partition. Did you try
boot0cfg -s option since doing your updates?
Regards,
Anders.
On Tue, Jan 13, 2009 at 10:28:49PM +0000, Luigi Rizzo wrote:
> Author: luigi
> Date: Tue Jan 13 22:28:48 2009
> New Revision: 187198
> URL: http://svn.freebsd.org/changeset/base/187198
>
> Log:
> MFC: a number of small fixes and enhancements to the boot0 code,
> and matching modifications to boot0cfg.
>
> The most noticeable features are preserving the 4-byte volume ID
> that certain Windows versions put in the MBR, and an option (F6)
> to boot through INT18 that on some modern BIOSes invokes PXE.
>
> Modified:
> stable/7/sys/boot/i386/boot0/boot0.S
> stable/7/usr.sbin/boot0cfg/boot0cfg.8
> stable/7/usr.sbin/boot0cfg/boot0cfg.c
>
> Modified: stable/7/sys/boot/i386/boot0/boot0.S
> ==============================================================================
> --- stable/7/sys/boot/i386/boot0/boot0.S Tue Jan 13 22:15:47 2009 (r187197)
> +++ stable/7/sys/boot/i386/boot0/boot0.S Tue Jan 13 22:28:48 2009 (r187198)
> @@ -1,4 +1,5 @@
> /*
> + * Copyright (c) 2008 Luigi Rizzo (mostly documentation)
> * Copyright (c) 2002 Bruce M. Simpson
> * Copyright (c) 1998 Robert Nordier
> * All rights reserved.
> @@ -16,50 +17,166 @@
> * $FreeBSD$
> */
>
> -/* A 512-byte boot manager. */
> -#ifdef SIO
> -/* ... using a serial console on COM1. */
> +/* build options: */
> +#ifdef SIO /* use serial console on COM1. */
> #endif
>
> +#ifdef PXE /* enable PXE/INT18 booting with F6 */
> +#define SAVE_MORE_MEMORY
> +#endif
> +
> +#ifdef CHECK_DRIVE /* make sure we boot from a HD. */
> +#endif
> +
> +#ifdef ONLY_F_KEYS /* Only F1..F6, no digits on console */
> +#endif
> +
> +#ifdef VOLUME_SERIAL /* support Volume serial number */
> +#define B0_BASE 0x1ae /* move the internal data area */
> +#define SAVE_MEMORY
> +#else
> +#define B0_BASE 0x1b2
> +#endif
> +
> +#ifdef TEST /* enable some test code */
> +#define SAVE_MEMORY
> +#define SAVE_MORE_MEMORY
> +#endif
> +
> +/*
> + * Note - this code uses many tricks to save space and fit in one sector.
> + * This includes using side effects of certain instructions, reusing
> + * register values from previous operations, etc.
> + * Be extremely careful when changing the code, even for simple things.
> + */
> +
> +/*
> + * BOOT BLOCK STRUCTURE
> + *
> + * This code implements a Master Boot Record (MBR) for an Intel/PC disk.
> + * It is 512 bytes long and it is normally loaded by the BIOS (or another
> + * bootloader) at 0:0x7c00. This code depends on %cs:%ip being 0:0x7c00
> + *
> + * The initial chunk of instructions is used as a signature by external
> + * tools (e.g. boot0cfg) which can manipulate the block itself.
> + *
> + * The area at offset 0x1b2 contains a magic string ('Drive '), also
> + * used as a signature to detect the block, and some variables that can
> + * be updated by boot0cfg (and optionally written back to the disk).
> + * These variables control the operation of the bootloader itself,
> + * e.g. which partitions to enable, the timeout, the use of LBA
> + * (called 'packet') or CHS mode, whether to force a drive number,
> + * and whether to write back the user's selection back to disk.
> + *
> + * As in every Master Boot Record, the partition table is at 0x1be,
> + * made of four 16-byte entries each containing:
> + *
> + * OFF SIZE DESCRIPTION
> + * 0 1 status (0x80: bootable, 0: non bootable)
> + * 1 3 start sector CHS
> + * 8:head, 6:sector, 2:cyl bit 9..8, 8:cyl bit 7..0
> + * 4 1 partition type
> + * 5 3 end sector CHS
> + * 8 4 LBA of first sector
> + * 12 4 partition size in sectors
> + *
> + * and followed by the two bytes 0x55, 0xAA (MBR signature).
> + */
> +
> +
> +/*
> + * BOOT BLOCK OPERATION
> + *
> + * On entry, the registers contain the following values:
> + *
> + * %cs:%ip 0:0x7c00
> + * %dl drive number (0x80, 0x81, ... )
> + * %si pointer to the partition table from which we were loaded.
> + * Some boot code (e.g. syslinux) use this info to relocate
> + * themselves, so we want to pass a valid one to the next stage.
> + * NOTE: the use of %si is not a standard.
> + *
> + * This boot block first relocates itself at a different address (0:0x600),
> + * to free the space at 0:0x7c00 for the next stage boot block.
> + *
> + * It then initializes some memory at 0:0x800 and above (pointed by %bp)
> + * to store the original drive number (%dl) passed to us, and to construct a
> + * fake partition entry. The latter is used by the disk I/O routine and,
> + * in some cases, passed in %si to the next stage boot code.
> + *
> + * The variables at 0x1b2 are accessed as negative offsets from %bp.
> + *
> + * After the relocation, the code scans the partition table printing
> + * out enabled partition or disks, and waits for user input.
> + *
> + * When a partition is selected, or a timeout expires, the currently
> + * selected partition is used to load the next stage boot code,
> + * %dl and %si are set appropriately as when we were called, and
> + * control is transferred to the newly loaded code at 0:0x7c00.
> + */
> +
> +/*
> + * CONSTANTS
> + *
> + * NHRDRV is the address in segment 0 where the BIOS writes the
> + * total number of hard disks in the system.
> + * LOAD is the original load address and cannot be changed.
> + * ORIGIN is the relocation address. If you change it, you also need
> + * to change the value passed to the linker in the Makefile
> + * PRT_OFF is the location of the partition table (from the MBR standard).
> + * B0_OFF is the location of the data area, known to boot0cfg so
> + * it cannot be changed. Computed as a negative offset from 0x200
> + * MAGIC is the signature of a boot block.
> + */
> +
> .set NHRDRV,0x475 # Number of hard drives
> .set ORIGIN,0x600 # Execution address
> - .set FAKE,0x800 # Partition entry
> .set LOAD,0x7c00 # Load address
>
> .set PRT_OFF,0x1be # Partition table
> -
> - .set TBL0SZ,0x3 # Table 0 size
> - .set TBL1SZ,0xa # Table 1 size
> + .set B0_OFF,(B0_BASE-0x200) # Offset of boot0 data
>
> .set MAGIC,0xaa55 # Magic: bootable
> - .set B0MAGIC,0xbb66 # Identification
>
> .set KEY_ENTER,0x1c # Enter key scan code
> .set KEY_F1,0x3b # F1 key scan code
> .set KEY_1,0x02 # #1 key scan code
>
> - .set ASCII_BEL,0x07 # ASCII code for
> + .set ASCII_BEL,'#' # ASCII code for
> .set ASCII_CR,0x0D # ASCII code for
>
> /*
> - * Addresses in the sector of embedded data values.
> - * Accessed with negative offsets from the end of the relocated sector (%ebp).
> - */
> - .set _NXTDRV,-0x48 # Next drive
> - .set _OPT,-0x47 # Default option
> - .set _SETDRV,-0x46 # Drive to force
> - .set _FLAGS,-0x45 # Flags
> - .set _TICKS,-0x44 # Timeout ticks
> - .set _FAKE,0x0 # Fake partition entry
> - .set _MNUOPT,0xc # Menu options
> + * Offsets of variables in the block at B0_OFF, and in the volatile
> + * data area, computed as displacement from %bp.
> + * We need to define them as constant as the assembler cannot
> + * compute them in its single pass.
> + */
> + .set _NXTDRV, B0_OFF+6 # Next drive
> + .set _OPT, B0_OFF+7 # Default option
> + .set _SETDRV, B0_OFF+8 # Drive to force
> + .set _FLAGS, B0_OFF+9 # Flags
> + .set SETDRV, 0x20 # the 'setdrv' flag
> + .set NOUPDATE, 0x40 # the 'noupdate' flag
> + .set USEPACKET, 0x80 # the 'packet' flag
> +
> + /* ticks is at a fixed position */
> + .set _TICKS, (PRT_OFF - 0x200 - 2) # Timeout ticks
> + .set _MNUOPT, 0x10 # Saved menu entries
>
> + .set TLEN, (desc_ofs - bootable_ids) # size of bootable ids
> .globl start # Entry point
> .code16 # This runs in real mode
>
> /*
> + * MAIN ENTRY POINT
> * Initialise segments and registers to known values.
> * segments start at 0.
> * The stack is immediately below the address we were loaded to.
> + * NOTE: the initial section of the code (up to movw $LOAD,%sp)
> + * is used by boot0cfg, together with the 'Drive ' string and
> + * the 0x55, 0xaa at the end, as an identifier for version 1.0
> + * of the boot code. Do not change it.
> + * In version 1.0 the parameter table (_NEXTDRV etc) is at 0x1b9
> */
> start: cld # String ops inc
> xorw %ax,%ax # Zero
> @@ -69,7 +186,7 @@ start: cld # String ops inc
> movw $LOAD,%sp # stack
>
> /*
> - * Copy this code to the address it was linked for
> + * Copy this code to the address it was linked for, 0x600 by default.
> */
> movw %sp,%si # Source
> movw $start,%di # Destination
> @@ -77,248 +194,301 @@ start: cld # String ops inc
> rep # Relocate
> movsw # code
> /*
> - * Set address for variable space beyond code, and clear it.
> - * Notice that this is also used to point to the values embedded in the block,
> - * by using negative offsets.
> + * After the code, (i.e. at %di+0, 0x800) create a partition entry,
> + * initialized to LBA 0 / CHS 0:0:1.
> + * Set %bp to point to the partition and also, with negative offsets,
> + * to the variables embedded in the bootblock (nextdrv and so on).
> */
> movw %di,%bp # Address variables
> movb $0x8,%cl # Words to clear
> rep # Zero
> stosw # them
> -/*
> - * Relocate to the new copy of the code.
> - */
> - incb -0xe(%di) # Sector number
> - jmp main-LOAD+ORIGIN # To relocated code
> + incb -0xe(%di) # Set the S field to 1
> +
> + jmp main-LOAD+ORIGIN # Jump to relocated code
>
> main:
> #if defined(SIO) && COMSPEED != 0
> /*
> - * Initialize the serial port. bioscom preserves the driver number in DX.
> + * Init the serial port. bioscom preserves the driver number in DX.
> */
> movw $COMSPEED,%ax # defined by Makefile
> callw bioscom
> #endif
> +
> /*
> - * Check what flags were loaded with us, specifically if a predefined drive
> - * number should be used. If what the bios gives us is bad, use the '0' in
> - * the block instead.
> - */
> - testb $0x20,_FLAGS(%bp) # Set drive number?
> - jnz main.1 # Yes
> + * If the 'setdrv' flag is set in the boot sector, use the drive
> + * number from the boot sector at 'setdrv_num'.
> + * Optionally, do the same if the BIOS gives us an invalid number
> + * (note though that the override prevents booting from a floppy
> + * or a ZIP/flash drive in floppy emulation).
> + * The test costs 4 bytes of code so it is disabled by default.
> + */
> + testb $SETDRV,_FLAGS(%bp) # Set drive number?
> +#ifndef CHECK_DRIVE /* disable drive checks */
> + jz save_curdrive # no, use the default
> +#else
> + jnz disable_update # Yes
> testb %dl,%dl # Drive number valid?
> - js main.2 # Possibly (0x80 set)
> + js save_curdrive # Possibly (0x80 set)
> +#endif
> /*
> - * Only update the boot-sector when there is a valid drive number or
> - * the drive number is set manually.
> + * Disable updates if the drive number is forced.
> */
> - orb $0x40,_FLAGS(%bp) # Disable updates
> -main.1: movb _SETDRV(%bp),%dl # Drive number to use
> +disable_update: orb $NOUPDATE,_FLAGS(%bp) # Disable updates
> + movb _SETDRV(%bp),%dl # Use stored drive number
> +
> /*
> - * Whatever we decided to use, now store it into the fake
> - * partition entry that lives in the data space above us.
> - */
> -main.2: movb %dl,_FAKE(%bp) # Save drive number
> - callw putn # To new line
> - pushw %dx # Save drive number
> + * Whatever drive we decided to use, store it at (%bp). The byte
> + * is normally used for the state of the partition (0x80 or 0x00),
> + * but we abuse it as it is very convenient to access at offset 0.
> + * The value is read back after 'check_selection'
> + */
> +save_curdrive: movb %dl, (%bp) # Save drive number
> + pushw %dx # Also in the stack
> +#ifdef TEST /* test code, print internal bios drive */
> + rolb $1, %dl
> + movw $drive, %si
> + call putkey
> +#endif
> + callw putn # Print a newline
> /*
> * Start out with a pointer to the 4th byte of the first table entry
> * so that after 4 iterations it's beyond the end of the sector
> - * and beyond a 256 byte boundary and has overflowed 8 bits (see next comment).
> - * Remember that the table starts 2 bytes earlier than you would expect
> - * as the bootable flag is after it in the block.
> + * and beyond a 256 byte boundary. We use the latter trick to check for
> + * end of the loop without using an extra register (see start.5).
> */
> movw $(partbl+0x4),%bx # Partition table (+4)
> xorw %dx,%dx # Item number
> +
> /*
> * Loop around on the partition table, printing values until we
> - * pass a 256 byte boundary. The end of loop test is at main.5.
> + * pass a 256 byte boundary.
> */
> -main.3: movb %ch,-0x4(%bx) # Zero active flag (ch == 0)
> +read_entry: movb %ch,-0x4(%bx) # Zero active flag (ch == 0)
> btw %dx,_FLAGS(%bp) # Entry enabled?
> - jnc main.5 # No
> -/*
> - * If any of the entries in the table are the same as the 'type' in the slice
> - * table entry, then this is an empty or non bootable partition. Skip it.
> - */
> + jnc next_entry # No
> movb (%bx),%al # Load type
> - movw $tables,%di # Lookup tables
> - movb $TBL0SZ,%cl # Number of entries
> - repne # Exclude
> - scasb # partition?
> - je main.5 # Yes
> + test %al, %al # skip empty partition
> + jz next_entry
> /*
> - * Now scan the table of known types
> + * Scan the table of bootable ids, which starts at %di and has
> + * length TLEN. On a match, %di points to the element following the
> + * match; the corresponding offset to the description is $(TLEN-1)
> + * bytes ahead. We use a count of TLEN+1 so if we don't find a match
> + * within the first TLEN entries, we hit the 'unknown' entry.
> */
> - movb $TBL1SZ+1,%cl # Number of entries
> + movw $bootable_ids,%di # Lookup tables
> + movb $(TLEN+1),%cl # Number of entries
> repne # Locate
> scasb # type
> /*
> * Get the matching element in the next array.
> + * The byte at $(TLEN-1)(%di) contains the offset of the description
> + * string from %di, so we add the number and print the string.
> */
> - addw $TBL1SZ-1, %di # Adjust
> + addw $(TLEN-1), %di # Adjust
> movb (%di),%cl # Partition
> addw %cx,%di # description
> callw putx # Display it
> -main.5: incw %dx # Next item
> +
> +next_entry: incw %dx # Next item
> addb $0x10,%bl # Next entry
> - jnc main.3 # Till done
> + jnc read_entry # Till done
> /*
> - * Passed a 256 byte boundary; the table is finished.
> + * We are past a 256 byte boundary: the partition table is finished.
> * Add one to the drive number and check it is valid.
> + * Note that if we started from a floppy, %dl was 0 so we still
> + * get an entry for the next drive, which is the first Hard Disk.
> */
> popw %ax # Drive number
> subb $0x80-0x1,%al # Does next
> cmpb NHRDRV,%al # drive exist? (from BIOS?)
> - jb main.6 # Yes
> + jb print_drive # Yes
> /*
> * If this is the only drive, don't display it as an option.
> */
> decw %ax # Already drive 0?
> - jz main.7 # Yes
> + jz print_prompt # Yes
> /*
> * If it was illegal or we cycled through them, go back to drive 0.
> */
> xorb %al,%al # Drive 0
> /*
> - * Whatever drive we selected, make it an ascii digit and save it back to the
> - * "next drive" location in the loaded block in case we want to save it later
> - * for next time. This also is part of the printed drive string so add 0x80
> + * Whatever drive we selected, make it an ascii digit and save it
> + * back to the "nxtdrv" location in case we want to save it to disk.
> + * This digit is also part of the printed drive string, so add 0x80
> * to indicate end of string.
> */
> -main.6: addb $'0'|0x80,%al # Save next
> +print_drive: addb $'0'|0x80,%al # Save next
> movb %al,_NXTDRV(%bp) # drive number
> movw $drive,%di # Display
> callw putx # item
> /*
> - * Now that we've printed the drive (if we needed to), display a prompt.
> + * Menu is complete, display a prompt followed by current selection.
> + * 'decw %si' makes the register point to the space after 'Boot: '
> + * so we do not see an extra CRLF on the screen.
> */
> -main.7: movw $prompt,%si # Display
> +print_prompt: movw $prompt,%si # Display
> callw putstr # prompt
> movb _OPT(%bp),%dl # Display
> decw %si # default
> callw putkey # key
> - jmp main.7_1 # Skip beep
> + jmp start_input # Skip beep
> +
> /*
> - * Users's last try was bad, beep in displeasure.
> + * Here we have the code waiting for user input or a timeout.
> */
> -main.10: movb $ASCII_BEL,%al # Signal
> - callw putchr # beep!
> +beep: movb $ASCII_BEL,%al # Input error, print or beep
> + callw putchr
> +
> +start_input:
> /*
> - * Start of input loop. Take note of time
> + * Actual Start of input loop. Take note of time
> */
> -main.7_1: xorb %ah,%ah # BIOS: Get
> + xorb %ah,%ah # BIOS: Get
> int $0x1a # system time
> movw %dx,%di # Ticks when
> addw _TICKS(%bp),%di # timeout
> +read_key:
> /*
> * Busy loop, looking for keystrokes but keeping one eye on the time.
> */
> -main.8:
> #ifndef SIO
> movb $0x1,%ah # BIOS: Check
> int $0x16 # for keypress
> - jnz main.11 # Have one
> #else /* SIO */
> movb $0x03,%ah # BIOS: Read COM
> call bioscom
> testb $0x01,%ah # Check line status
> - jnz main.11 # (bit 1 indicates input)
> + # (bit 1 indicates input)
> #endif /* SIO */
> - xorb %ah,%ah # BIOS: Get
> - int $0x1a # system time
> + jnz got_key # Have input
> + xorb %ah,%ah # BIOS: int 0x1a, 00
> + int $0x1a # get system time
> cmpw %di,%dx # Timeout?
> - jb main.8 # No
> + jb read_key # No
> +
> /*
> - * If timed out or defaulting, come here.
> + * Timed out or default selection
> */
> -main.9: movb _OPT(%bp),%al # Load default
> - jmp main.12 # Join common code
> +use_default: movb _OPT(%bp),%al # Load default
> + orb $NOUPDATE,_FLAGS(%bp) # Disable updates
> + jmp check_selection # Join common code
> +
> /*
> * Get the keystroke.
> + * ENTER or CR confirm the current selection (same as a timeout).
> + * Otherwise convert F1..F6 (or '1'..'6') to 0..5 and check if the
> + * selection is valid.
> + * The SIO code uses ascii chars, the console code uses scancodes.
> */
> -main.11:
> +got_key:
> #ifndef SIO
> - xorb %ah,%ah # BIOS: Get
> - int $0x16 # keypress
> - movb %ah,%al # Scan code
> + xorb %ah,%ah # BIOS: int 0x16, 00
> + int $0x16 # get keypress
> + movb %ah,%al # move scan code to %al
> + cmpb $KEY_ENTER,%al
> #else
> movb $0x02,%ah # BIOS: Receive
> call bioscom
> + cmpb $ASCII_CR,%al
> #endif
> + je use_default # enter -> default
> /*
> - * If it's CR act as if timed out.
> - */
> -#ifndef SIO
> - cmpb $KEY_ENTER,%al # Enter pressed?
> -#else
> - cmpb $ASCII_CR,%al # Enter pressed?
> -#endif
> - je main.9 # Yes
> -/*
> - * Otherwise check if legal. If not ask again.
> - */
> -#ifndef SIO
> - subb $KEY_F1,%al # Less F1 scan code
> - cmpb $0x4,%al # F1..F5?
> - jna main.12 # Yes
> + * Check if the key is acceptable, and loop back if not.
> + * The console (non-SIO) code looks at scancodes and accepts
> + * both F1..F6 and 1..6 (the latter costs 6 bytes of code),
> + * relying on the fact that F1..F6 have higher scancodes than 1..6
> + * The SIO code only takes 1..6
> + */
> +#ifdef SIO /* SIO mode, use ascii values */
> + subb $'1',%al # Subtract '1' ascii code
> +#else /* console mode -- use scancodes */
> + subb $KEY_F1,%al /* Subtract F1 scan code */
> +#if !defined(ONLY_F_KEYS)
> + cmpb $0x5,%al # F1..F6
> + jna 3f # Yes
> subb $(KEY_1 - KEY_F1),%al # Less #1 scan code
> -#else
> - subb $'1',%al # Less '1' ascii character
> -#endif
> - cmpb $0x4,%al # #1..#5?
> - ja main.10 # No
> + 3:
> +#endif /* ONLY_F_KEYS */
> +#endif /* SIO */
> + cmpb $0x5,%al # F1..F6 or 1..6 ?
> +#ifdef PXE /* enable PXE/INT18 using F6 */
> + jne 1f;
> + int $0x18 # found F6, try INT18
> + 1:
> +#endif /* PXE */
> + jae beep # Not in F1..F5, beep
> +
> +check_selection:
> /*
> * We have a selection. If it's a bad selection go back to complain.
> * The bits in MNUOPT were set when the options were printed.
> * Anything not printed is not an option.
> */
> -main.12: cbtw # Option
> - btw %ax,_MNUOPT(%bp) # enabled?
> - jnc main.10 # No
> + cbtw # Extend (%ah=0 used later)
> + btw %ax,_MNUOPT(%bp) # Option enabled?
> + jnc beep # No
> /*
> * Save the info in the original tables
> * for rewriting to the disk.
> */
> movb %al,_OPT(%bp) # Save option
> - movw $FAKE,%si # Partition for write
> - movb (%si),%dl # Drive number
> +
> + /*
> + * Make %si and %bx point to the fake partition at LBA 0 (CHS 0:0:1).
> + * Because the correct address is already in %bp, just use it.
> + * Set %dl with the drive number saved in byte 0.
> + * If we have pressed F5 or 5, then this is a good, fake value
> + * to present to the next stage boot code.
> + */
> + movw %bp,%si # Partition for write
> + movb (%si),%dl # Drive number, saved above
> movw %si,%bx # Partition for read
> cmpb $0x4,%al # F5/#5 pressed?
> - pushf # Save
> - je main.13 # Yes
> + pushf # Save results for later
> + je 1f # Yes, F5
> +
> + /*
> + * F1..F4 was pressed, so make %bx point to the currently
> + * selected partition, and leave the drive number unchanged.
> + */
> shlb $0x4,%al # Point to
> addw $partbl,%ax # selected
> xchgw %bx,%ax # partition
> movb $0x80,(%bx) # Flag active
> /*
> * If not asked to do a write-back (flags 0x40) don't do one.
> + * Around the call, save the partition pointer to %bx and
> + * restore to %si which is where the next stage expects it.
> */
> -main.13: pushw %bx # Save
> - testb $0x40,_FLAGS(%bp) # No updates?
> - jnz main.14 # Yes
> + 1: pushw %bx # Save
> + testb $NOUPDATE,_FLAGS(%bp) # No updates?
> + jnz 2f # skip update
> movw $start,%bx # Data to write
> movb $0x3,%ah # Write sector
> callw intx13 # to disk
> -main.14: popw %si # Restore
> - popf # Restore
> + 2: popw %si # Restore
> +
> /*
> * If going to next drive, replace drive with selected one.
> * Remember to un-ascii it. Hey 0x80 is already set, cool!
> */
> - jne main.15 # If not F5/#5
> + popf # Restore %al test results
> + jne 3f # If not F5/#5
> movb _NXTDRV(%bp),%dl # Next drive
> subb $'0',%dl # number
> /*
> - * Load selected bootsector to the LOAD location in RAM.
> - * If it fails to read or isn't marked bootable, treat it as a bad selection.
> + * Load selected bootsector to the LOAD location in RAM. If read
> + * fails or there is no 0x55aa marker, treat it as a bad selection.
> */
> -main.15: movw $LOAD,%bx # Address for read
> + 3: movw $LOAD,%bx # Address for read
> movb $0x2,%ah # Read sector
> callw intx13 # from disk
> - jc main.10 # If error
> + jc beep # If error
> cmpw $MAGIC,0x1fe(%bx) # Bootable?
> - jne main.10 # No
> + jne beep # No
> pushw %si # Save ptr to selected part.
> callw putn # Leave some space
> popw %si # Restore, next stage uses it
> @@ -326,64 +496,80 @@ main.15: movw $LOAD,%bx # Address for
>
> /*
> * Display routines
> + * putkey prints the option selected in %dl (F1..F5 or 1..5) followed by
> + * the string at %si
> + * putx: print the option in %dl followed by the string at %di
> + * also record the drive as valid.
> + * putn: print a crlf
> + * putstr: print the string at %si
> + * putchr: print the char in al
> */
> -putkey:
> -#ifndef SIO
> - movb $'F',%al # Display
> - callw putchr # 'F'
> -#endif
> - movb $'1',%al # Prepare
> - addb %dl,%al # digit
> - jmp putstr.1 # Display the rest
>
> /*
> - * Display the option and note that it is a valid option.
> - * That last point is a bit tricky..
> + * Display the option and record the drive as valid in the options.
> + * That last point is done using the btsw instruction which does
> + * a test and set. We don't care for the test part.
> */
> putx: btsw %dx,_MNUOPT(%bp) # Enable menu option
> movw $item,%si # Display
> callw putkey # key
> movw %di,%si # Display the rest
> -
> -puts: callw putstr # Display string
> + callw putstr # Display string
>
> putn: movw $crlf,%si # To next line
> + jmp putstr
> +
> +putkey:
> +#ifndef SIO
> + movb $'F',%al # Display
> + callw putchr # 'F'
> +#endif
> + movb $'1',%al # Prepare
> + addb %dl,%al # digit
>
> +putstr.1: callw putchr # Display char
> putstr: lodsb # Get byte
> testb $0x80,%al # End of string?
> - jnz putstr.2 # Yes
> -putstr.1: callw putchr # Display char
> - jmp putstr # Continue
> -putstr.2: andb $~0x80,%al # Clear MSB
> + jz putstr.1 # No
> + andb $~0x80,%al # Clear MSB then print last
>
> -#ifndef SIO
> putchr:
> +#ifndef SIO
> pushw %bx # Save
> movw $0x7,%bx # Page:attribute
> movb $0xe,%ah # BIOS: Display
> int $0x10 # character
> popw %bx # Restore
> - retw # To caller
> #else /* SIO */
> -putchr:
> movb $0x01,%ah # BIOS: Send
> bioscom:
> pushw %dx # Save
> xorw %dx,%dx # Use COM1
> int $0x14 # Character
> popw %dx # Restore
> - retw # To caller
> #endif /* SIO */
> + retw # To caller
>
> /* One-sector disk I/O routine */
>
> -intx13: movb 0x1(%si),%dh # Load head
> +/*
> + * %dl: drive, %si partition entry, %es:%bx transfer buffer.
> + * Load the CHS values and possibly the LBA address from the block
> + * at %si, and use the appropriate method to load the sector.
> + * Don't use packet mode for a floppy.
> + */
> +intx13: # Prepare CHS parameters
> + movb 0x1(%si),%dh # Load head
> movw 0x2(%si),%cx # Load cylinder:sector
> movb $0x1,%al # Sector count
> pushw %si # Save
> movw %sp,%di # Save
> - testb $0x80,_FLAGS(%bp) # Use packet interface?
> - jz intx13.1 # No
> +#ifndef CHECK_DRIVE /* floppy support */
> + testb %dl, %dl # is this a floppy ?
> + jz 1f # Yes, use CHS mode
> +#endif
> + testb $USEPACKET,_FLAGS(%bp) # Use packet interface?
> + jz 1f # No
> pushl $0x0 # Set the
> pushl 0x8(%si) # LBA address
> pushw %es # Set the transfer
> @@ -393,73 +579,104 @@ intx13: movb 0x1(%si),%dh # Load head
> movw %sp,%si # Packet pointer
> decw %ax # Verify off
> orb $0x40,%ah # Use disk packet
> -intx13.1: int $0x13 # BIOS: Disk I/O
> + 1: int $0x13 # BIOS: Disk I/O
> movw %di,%sp # Restore
> popw %si # Restore
> retw # To caller
>
> -/* Menu strings */
> -
> +/*
> + * Various menu strings. 'item' goes after 'prompt' to save space.
> + * Also use shorter versions to make room for the PXE/INT18 code.
> + */
> +prompt:
> +#ifdef PXE
> + .ascii "\nF6 PXE\r"
> +#endif
> + .ascii "\nBoot:"
> item: .ascii " "; .byte ' '|0x80
> -prompt: .ascii "\nDefault:"; .byte ' '|0x80
> crlf: .ascii "\r"; .byte '\n'|0x80
>
> /* Partition type tables */
>
> -tables:
> +bootable_ids:
> /*
> - * These entries identify invalid or NON BOOT types and partitions.
> - */
> - .byte 0x0, 0x5, 0xf
> + * These values indicate bootable types we know about.
> + * Corresponding descriptions are at desc_ofs:
> + * Entries don't need to be sorted.
> + */
> + .byte 0x83, 0xa5, 0xa6, 0xa9, 0x06, 0x07, 0x0b
> +#ifndef SAVE_MORE_MEMORY
> + .byte 0x05 # extended partition
> +#endif
> +#ifndef SAVE_MEMORY /* other DOS partitions */
> + .byte 0x01 # FAT12
> + .byte 0x04 # FAT16 < 32M
> +#endif
> +
> +desc_ofs:
> /*
> - * These values indicate bootable types we know the names of.
> - */
> - .byte 0x1, 0x6, 0x7, 0xb, 0xc, 0xe, 0x83
> - .byte 0xa5, 0xa6, 0xa9
> -/*
> - * These are offsets that match the known names above and point to the strings
> - * that will be printed. os_misc will be used if the search of the above table
> - * runs over.
> - */
> - .byte os_dos-. # DOS
> - .byte os_dos-. # DOS
> - .byte os_dos-. # Windows
> - .byte os_dos-. # Windows
> - .byte os_dos-. # Windows
> - .byte os_dos-. # Windows
> - .byte os_linux-. # Linux
> - .byte os_freebsd-. # FreeBSD
> - .byte os_bsd-. # OpenBSD
> - .byte os_bsd-. # NetBSD
> + * Offsets that match the known types above, used to point to the
> + * actual partition name. The last entry must point to os_misc,
> + * which is used for non-matching names.
> + */
> + .byte os_linux-. # 131, Linux
> + .byte os_freebsd-. # 165, FreeBSD
> + .byte os_bsd-. # 166, OpenBSD
> + .byte os_bsd-. # 169, NetBSD
> + .byte os_dos-. # 6, FAT16 >= 32M
> + .byte os_win-. # 7, NTFS
> + .byte os_win-. # 11, FAT32
> +
> +#ifndef SAVE_MORE_MEMORY
> + .byte os_ext-. # 5, DOS Ext
> +#endif
> +#ifndef SAVE_MEMORY
> + .byte os_dos-. # 1, FAT12 DOS
> + .byte os_dos-. # 4, FAT16 <32M
> +#endif
> .byte os_misc-. # Unknown
> +
> /*
> - * And here are the strings themselves. 0x80 or'd into a byte indicates
> - * the end of the string. (not so great for Russians but...)
> + * And here are the strings themselves. The last byte of
> + * the string has bit 7 set.
> */
> -os_misc: .ascii "?"; .byte '?'|0x80
> -os_dos: .ascii "DO"; .byte 'S'|0x80
> +os_misc: .byte '?'|0x80
> +os_dos:
> +#ifndef SAVE_MORE_MEMORY /* 'DOS' remapped to 'WIN' if no room */
> + .ascii "DO"; .byte 'S'|0x80
> +#endif
> +os_win: .ascii "Wi"; .byte 'n'|0x80
> os_linux: .ascii "Linu"; .byte 'x'|0x80
> os_freebsd: .ascii "Free"
> os_bsd: .ascii "BS"; .byte 'D'|0x80
> +#ifndef SAVE_MORE_MEMORY
> +os_ext: .ascii "EX"; .byte 'T'|0x80
> +#endif
>
> - .org PRT_OFF-0xe,0x90
> -
> - .word B0MAGIC # Magic number
> -
> + .org (0x200 + B0_OFF),0x90
> /*
> - * These values are sometimes changed before writing back to the drive
> + * The boot0 version 1.0 parameter table.
> + * Do not move it nor change the "Drive " string, boot0cfg
> + * uses its offset and content to identify the boot sector.
> + * The other fields are sometimes changed before writing back to the drive
> * Be especially careful that nxtdrv: must come after drive:, as it
> * is part of the same string.
> */
> drive: .ascii "Drive "
> nxtdrv: .byte 0x0 # Next drive number
> opt: .byte 0x0 # Option
> -setdrv: .byte 0x80 # Drive to force
> +setdrv_num: .byte 0x80 # Drive to force
> flags: .byte FLAGS # Flags
> +#ifdef VOLUME_SERIAL
> + .byte 0xa8,0xa8,0xa8,0xa8 # Volume Serial Number
> +#endif
> ticks: .word TICKS # Delay
>
> + .org PRT_OFF
> /*
> * Here is the 64 byte partition table that fdisk would fiddle with.
> */
> partbl: .fill 0x40,0x1,0x0 # Partition table
> .word MAGIC # Magic number
> + .org 0x200 # again, safety check
> +endblock:
>
> Modified: stable/7/usr.sbin/boot0cfg/boot0cfg.8
> ==============================================================================
> --- stable/7/usr.sbin/boot0cfg/boot0cfg.8 Tue Jan 13 22:15:47 2009 (r187197)
> +++ stable/7/usr.sbin/boot0cfg/boot0cfg.8 Tue Jan 13 22:28:48 2009 (r187198)
> @@ -24,7 +24,7 @@
> .\"
> .\" $FreeBSD$
> .\"
> -.Dd June 7, 2007
> +.Dd January 13, 2009
> .Dt BOOT0CFG 8
> .Os
> .Sh NAME
> @@ -35,7 +35,9 @@
> .Op Fl Bv
> .Op Fl b Ar boot0
> .Op Fl d Ar drive
> +.Op Fl e Ar bell character
> .Op Fl f Ar file
> +.Op Fl i Ar volume-id
> .Op Fl m Ar mask
> .Op Fl o Ar options
> .Op Fl s Ar slice
> @@ -96,10 +98,17 @@ which contains the specified
> Typically this will be 0x80 for the first hard drive, 0x81 for the
> second hard drive, and so on; however any integer between 0 and 0xff
> is acceptable here.
> +.It Fl e Ar bell character
> +Set the character to be printed in case of input error.
> .It Fl f Ar file
> Specify that a backup copy of the preexisting MBR should be written to
> .Ar file .
> This file is created if it does not exist, and replaced if it does.
> +.It Fl i Ar volume-id
> +Specifies a volume-id (in the form XXXX-XXXX) to be saved at location
> +0x1b8 in the MBR. This information is sometimes used by NT, XP and Vista
> +to identify the disk drive. The option is only compatible with version 2.00
> +of the 512-byte boot block.
> .It Fl m Ar mask
> Specify slices to be enabled/disabled, where
> .Ar mask
> @@ -144,6 +153,21 @@ Set the timeout value to
> .It Fl v
> Verbose: display information about the slices defined, etc.
> .El
> +.Sh NOTE
> +Protection mechanisms in the
> +.Xr geom 4
> +subsystem might prevent
> +.Nm
> +from being able to update the MBR on a mounted disk.
> +Instructions for temporarily disabling these protection mechanisms
> +can be found in the
> +.Xr geom 4
> +manpage. Specifically, do a
> +.Pp
> +.Dl sysctl kern.geom.debugflags=0x10
> +.Pp
> +to allow writing to the MBR, and restore it to 0 afterwards.
> +.Pp
> .Sh FILES
> .Bl -tag -width /boot/boot0sio -compact
> .It Pa /boot/boot0
> @@ -177,16 +201,6 @@ to install the default MBR:
> .Sh AUTHORS
> .An Robert Nordier Aq rnordier@FreeBSD.org .
> .Sh BUGS
> -Protection mechanisms in the
> -.Xr geom 4
> -subsystem might prevent
> -.Nm
> -from being able to update the MBR on a mounted disk.
> -Instructions for temporarily disabling these protection mechanisms
> -can be found in the
> -.Xr geom 4
> -manpage.
> -.Pp
> Use of the
> .Sq packet
> option may cause
> @@ -195,6 +209,6 @@ to fail, depending on the nature of BIOS
> .Pp
> Use of the
> .Sq setdrv
> -option with an incorrect -d operand may cause the MBR to be written
> -to the wrong disk.
> -Be careful!
> +option with an incorrect -d operand may cause the boot0 code
> +to write the MBR to the wrong disk, thus trashing its previous
> +content. Be careful.
>
> Modified: stable/7/usr.sbin/boot0cfg/boot0cfg.c
> ==============================================================================
> --- stable/7/usr.sbin/boot0cfg/boot0cfg.c Tue Jan 13 22:15:47 2009 (r187197)
> +++ stable/7/usr.sbin/boot0cfg/boot0cfg.c Tue Jan 13 22:28:48 2009 (r187198)
> @@ -1,4 +1,5 @@
> /*
> + * Copyright (c) 2008 Luigi Rizzo
> * Copyright (c) 1999 Robert Nordier
> * All rights reserved.
> *
> @@ -44,13 +45,34 @@ __FBSDID("$FreeBSD$");
>
> #define MBRSIZE 512 /* master boot record size */
>
> -#define OFF_VERSION 0x1b0 /* offset: version number */
> -#define OFF_OPT 0x1b9 /* offset: default boot option */
> -#define OFF_DRIVE 0x1ba /* offset: setdrv drive */
> -#define OFF_FLAGS 0x1bb /* offset: option flags */
> -#define OFF_TICKS 0x1bc /* offset: clock ticks */
> +#define OFF_VERSION 0x1b0 /* offset: version number, only boot0version */
> +#define OFF_SERIAL 0x1b8 /* offset: volume serial number */
> #define OFF_PTBL 0x1be /* offset: partition table */
> #define OFF_MAGIC 0x1fe /* offset: magic number */
> +/*
> + * Offsets to the parameters of the 512-byte boot block.
> + * For historical reasons they are set as macros
> + */
> +struct opt_offsets {
> + int opt;
> + int drive;
> + int flags;
> + int ticks;
> +};
> +
> +struct opt_offsets b0_ofs[] = {
> + { 0x0, 0x0, 0x0, 0x0 }, /* no boot block */
> + { 0x1b9, 0x1ba, 0x1bb, 0x1bc }, /* original block */
> + { 0x1b5, 0x1b6, 0x1b7, 0x1bc }, /* NT_SERIAL block */
> +};
> +
> +int b0_ver; /* boot block version set by boot0bs */
> +
> +#define OFF_OPT (b0_ofs[b0_ver].opt) /* default boot option */
> +#define OFF_DRIVE (b0_ofs[b0_ver].drive) /* setdrv drive */
> +#define OFF_FLAGS (b0_ofs[b0_ver].flags) /* option flags */
> +#define OFF_TICKS (b0_ofs[b0_ver].ticks) /* clock ticks */
> +
>
> #define cv2(p) ((p)[0] | (p)[1] << 010)
>
> @@ -82,8 +104,12 @@ static int boot0bs(const u_int8_t *);
>
> *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
> _______________________________________________
> svn-src-stable-7@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7
> To unsubscribe, send any mail to "svn-src-stable-7-unsubscribe@freebsd.org"
--
Anders.
From kib at FreeBSD.org Sun May 3 17:51:39 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Sun May 3 17:51:51 2009
Subject: svn commit: r191767 - in stable/7/lib/libc: . stdlib string
Message-ID: <200905031751.n43HpcGV020175@svn.freebsd.org>
Author: kib
Date: Sun May 3 17:51:38 2009
New Revision: 191767
URL: http://svn.freebsd.org/changeset/base/191767
Log:
MFC r185514 (by jasone):
Fix a lock order reversal bug that could cause deadlock during fork(2).
Reported and tested by: makc
Approved by: re (kensmith)
Modified:
stable/7/lib/libc/ (props changed)
stable/7/lib/libc/stdlib/malloc.c
stable/7/lib/libc/string/ffsll.c (props changed)
stable/7/lib/libc/string/flsll.c (props changed)
Modified: stable/7/lib/libc/stdlib/malloc.c
==============================================================================
--- stable/7/lib/libc/stdlib/malloc.c Sun May 3 17:47:21 2009 (r191766)
+++ stable/7/lib/libc/stdlib/malloc.c Sun May 3 17:51:38 2009 (r191767)
@@ -4715,16 +4715,41 @@ _malloc_thread_cleanup(void)
void
_malloc_prefork(void)
{
- unsigned i;
+ bool again;
+ unsigned i, j;
+ arena_t *larenas[narenas], *tarenas[narenas];
/* Acquire all mutexes in a safe order. */
- malloc_spin_lock(&arenas_lock);
- for (i = 0; i < narenas; i++) {
- if (arenas[i] != NULL)
- malloc_spin_lock(&arenas[i]->lock);
- }
- malloc_spin_unlock(&arenas_lock);
+ /*
+ * arenas_lock must be acquired after all of the arena mutexes, in
+ * order to avoid potential deadlock with arena_lock_balance[_hard]().
+ * Since arenas_lock protects the arenas array, the following code has
+ * to race with arenas_extend() callers until it succeeds in locking
+ * all arenas before locking arenas_lock.
+ */
+ memset(larenas, 0, sizeof(arena_t *) * narenas);
+ do {
+ again = false;
+
+ malloc_spin_lock(&arenas_lock);
+ for (i = 0; i < narenas; i++) {
+ if (arenas[i] != larenas[i]) {
+ memcpy(tarenas, arenas, sizeof(arena_t *) *
+ narenas);
+ malloc_spin_unlock(&arenas_lock);
+ for (j = 0; j < narenas; j++) {
+ if (larenas[j] != tarenas[j]) {
+ larenas[j] = tarenas[j];
+ malloc_spin_lock(
+ &larenas[j]->lock);
+ }
+ }
+ again = true;
+ break;
+ }
+ }
+ } while (again);
malloc_mutex_lock(&base_mtx);
@@ -4739,6 +4764,7 @@ void
_malloc_postfork(void)
{
unsigned i;
+ arena_t *larenas[narenas];
/* Release all mutexes, now that fork() has completed. */
@@ -4750,12 +4776,12 @@ _malloc_postfork(void)
malloc_mutex_unlock(&base_mtx);
- malloc_spin_lock(&arenas_lock);
+ memcpy(larenas, arenas, sizeof(arena_t *) * narenas);
+ malloc_spin_unlock(&arenas_lock);
for (i = 0; i < narenas; i++) {
- if (arenas[i] != NULL)
- malloc_spin_unlock(&arenas[i]->lock);
+ if (larenas[i] != NULL)
+ malloc_spin_unlock(&larenas[i]->lock);
}
- malloc_spin_unlock(&arenas_lock);
}
/*
From kostikbel at gmail.com Sun May 3 18:22:08 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Sun May 3 18:22:19 2009
Subject: svn commit: r191767 - in stable/7/lib/libc: . stdlib string
In-Reply-To: <200905031751.n43HpcGV020175@svn.freebsd.org>
References: <200905031751.n43HpcGV020175@svn.freebsd.org>
Message-ID: <20090503175506.GM17826@deviant.kiev.zoral.com.ua>
On Sun, May 03, 2009 at 05:51:38PM +0000, Konstantin Belousov wrote:
> Author: kib
> Date: Sun May 3 17:51:38 2009
> New Revision: 191767
> URL: http://svn.freebsd.org/changeset/base/191767
>
> Log:
> MFC r185514 (by jasone):
> Fix a lock order reversal bug that could cause deadlock during fork(2).
>
> Reported and tested by: makc
> Approved by: re (kensmith)
It was diagnosed and tested after the 7.2 release passed the point of
no return. We expect to issue errata notice after the patch settles
in stable/7 shortly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090503/b5eaf317/attachment.pgp
From hrs at FreeBSD.org Sun May 3 21:21:18 2009
From: hrs at FreeBSD.org (Hiroki Sato)
Date: Sun May 3 21:21:29 2009
Subject: svn commit: r191769 - stable/7/release/doc/en_US.ISO8859-1/errata
Message-ID: <200905032121.n43LLHif024824@svn.freebsd.org>
Author: hrs
Date: Sun May 3 21:21:17 2009
New Revision: 191769
URL: http://svn.freebsd.org/changeset/base/191769
Log:
Add an entry for a lock order reversal that can cause a deadlock.
Reviewed by: kib
Approved by: re (implicit)
Modified:
stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
Modified: stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
==============================================================================
--- stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Sun May 3 18:29:04 2009 (r191768)
+++ stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Sun May 3 21:21:17 2009 (r191769)
@@ -169,6 +169,14 @@
workaround, you can boot using the bootonly or livefs CDROM and
then swap in disc1 once sysinstall starts.
+ [20090504] A lock handling error has been found in
+ interaction between &man.malloc.3; implementation and threading
+ library. When a multi-threaded process calls the &man.fork.2;
+ system call in a thread and the &man.malloc.3; function in
+ another thread, it can cause a deadlock in the child process.
+ An Errata Notice to fix this problem is planned for this problem
+ after the release.
+
Late-Breaking News and Corrections
From kensmith at FreeBSD.org Mon May 4 00:19:01 2009
From: kensmith at FreeBSD.org (Ken Smith)
Date: Mon May 4 00:19:18 2009
Subject: svn commit: r191770 - stable/7/sys/conf
Message-ID: <200905040019.n440J0JZ028259@svn.freebsd.org>
Author: kensmith
Date: Mon May 4 00:19:00 2009
New Revision: 191770
URL: http://svn.freebsd.org/changeset/base/191770
Log:
7.2-RELEASE is done, shift over to -STABLE.
Approved by: re (implicit)
Modified:
stable/7/sys/conf/newvers.sh
Modified: stable/7/sys/conf/newvers.sh
==============================================================================
--- stable/7/sys/conf/newvers.sh Sun May 3 21:21:17 2009 (r191769)
+++ stable/7/sys/conf/newvers.sh Mon May 4 00:19:00 2009 (r191770)
@@ -32,7 +32,7 @@
TYPE="FreeBSD"
REVISION="7.2"
-BRANCH="PRERELEASE"
+BRANCH="STABLE"
if [ "X${BRANCH_OVERRIDE}" != "X" ]; then
BRANCH=${BRANCH_OVERRIDE}
fi
From rink at FreeBSD.org Mon May 4 10:15:35 2009
From: rink at FreeBSD.org (Rink Springer)
Date: Mon May 4 10:15:47 2009
Subject: svn commit: r191767 - in stable/7/lib/libc: . stdlib string
In-Reply-To: <20090503175506.GM17826@deviant.kiev.zoral.com.ua>
References: <200905031751.n43HpcGV020175@svn.freebsd.org>
<20090503175506.GM17826@deviant.kiev.zoral.com.ua>
Message-ID: <20090504095806.GD78380@rink.nu>
On Sun, May 03, 2009 at 08:55:06PM +0300, Kostik Belousov wrote:
> On Sun, May 03, 2009 at 05:51:38PM +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Sun May 3 17:51:38 2009
> > New Revision: 191767
> > URL: http://svn.freebsd.org/changeset/base/191767
> >
> > Log:
> > MFC r185514 (by jasone):
> > Fix a lock order reversal bug that could cause deadlock during fork(2).
> >
> > Reported and tested by: makc
> > Approved by: re (kensmith)
>
> It was diagnosed and tested after the 7.2 release passed the point of
> no return. We expect to issue errata notice after the patch settles
> in stable/7 shortly.
Is this the same malloc/fork deadlock bug bug I reported about 6 months
ago?
--
Rink P.W. Springer - http://rink.nu
"Talk to me."
- Horatio Caine
From kostikbel at gmail.com Mon May 4 11:39:03 2009
From: kostikbel at gmail.com (Kostik Belousov)
Date: Mon May 4 11:39:14 2009
Subject: svn commit: r191767 - in stable/7/lib/libc: . stdlib string
In-Reply-To: <20090504095806.GD78380@rink.nu>
References: <200905031751.n43HpcGV020175@svn.freebsd.org>
<20090503175506.GM17826@deviant.kiev.zoral.com.ua>
<20090504095806.GD78380@rink.nu>
Message-ID: <20090504113851.GA1948@deviant.kiev.zoral.com.ua>
On Mon, May 04, 2009 at 11:58:06AM +0200, Rink Springer wrote:
> On Sun, May 03, 2009 at 08:55:06PM +0300, Kostik Belousov wrote:
> > On Sun, May 03, 2009 at 05:51:38PM +0000, Konstantin Belousov wrote:
> > > Author: kib
> > > Date: Sun May 3 17:51:38 2009
> > > New Revision: 191767
> > > URL: http://svn.freebsd.org/changeset/base/191767
> > >
> > > Log:
> > > MFC r185514 (by jasone):
> > > Fix a lock order reversal bug that could cause deadlock during fork(2).
> > >
> > > Reported and tested by: makc
> > > Approved by: re (kensmith)
> >
> > It was diagnosed and tested after the 7.2 release passed the point of
> > no return. We expect to issue errata notice after the patch settles
> > in stable/7 shortly.
>
> Is this the same malloc/fork deadlock bug bug I reported about 6 months
> ago?
This was one of the bugs that was fixed after the investigation of
your issues.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-stable-7/attachments/20090504/20feca63/attachment.pgp
From jhb at FreeBSD.org Mon May 4 17:25:54 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 4 17:26:00 2009
Subject: svn commit: r191785 - stable/7/lib/libstand
Message-ID: <200905041725.n44HPrft051559@svn.freebsd.org>
Author: jhb
Date: Mon May 4 17:25:53 2009
New Revision: 191785
URL: http://svn.freebsd.org/changeset/base/191785
Log:
MFC: Fix an off-by-one buffer overflow in ngets().
Modified:
stable/7/lib/libstand/ (props changed)
stable/7/lib/libstand/gets.c
Modified: stable/7/lib/libstand/gets.c
==============================================================================
--- stable/7/lib/libstand/gets.c Mon May 4 16:10:37 2009 (r191784)
+++ stable/7/lib/libstand/gets.c Mon May 4 17:25:53 2009 (r191785)
@@ -74,7 +74,7 @@ ngets(char *buf, int n)
putchar('\n');
break;
default:
- if ((n < 1) || ((lp - buf) < n)) {
+ if ((n < 1) || ((lp - buf) < n - 1)) {
*lp++ = c;
putchar(c);
}
From lulf at FreeBSD.org Mon May 4 18:35:53 2009
From: lulf at FreeBSD.org (Ulf Lilleengen)
Date: Mon May 4 18:36:09 2009
Subject: svn commit: r191790 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb geom
Message-ID: <200905041835.n44IZqJS053600@svn.freebsd.org>
Author: lulf
Date: Mon May 4 18:35:52 2009
New Revision: 191790
URL: http://svn.freebsd.org/changeset/base/191790
Log:
MFC r179094:
Play nice with DDB pager.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/geom/geom_subr.c
Modified: stable/7/sys/geom/geom_subr.c
==============================================================================
--- stable/7/sys/geom/geom_subr.c Mon May 4 18:14:45 2009 (r191789)
+++ stable/7/sys/geom/geom_subr.c Mon May 4 18:35:52 2009 (r191790)
@@ -1157,8 +1157,11 @@ db_show_geom_provider(int indent, struct
printf("\n");
}
if (!LIST_EMPTY(&pp->consumers)) {
- LIST_FOREACH(cp, &pp->consumers, consumers)
+ LIST_FOREACH(cp, &pp->consumers, consumers) {
db_show_geom_consumer(indent + 2, cp);
+ if (db_pager_quit)
+ break;
+ }
}
}
@@ -1189,12 +1192,18 @@ db_show_geom_geom(int indent, struct g_g
printf("\n");
}
if (!LIST_EMPTY(&gp->provider)) {
- LIST_FOREACH(pp, &gp->provider, provider)
+ LIST_FOREACH(pp, &gp->provider, provider) {
db_show_geom_provider(indent + 2, pp);
+ if (db_pager_quit)
+ break;
+ }
}
if (!LIST_EMPTY(&gp->consumer)) {
- LIST_FOREACH(cp, &gp->consumer, consumer)
+ LIST_FOREACH(cp, &gp->consumer, consumer) {
db_show_geom_consumer(indent + 2, cp);
+ if (db_pager_quit)
+ break;
+ }
}
}
@@ -1204,8 +1213,11 @@ db_show_geom_class(struct g_class *mp)
struct g_geom *gp;
printf("class: %s (%p)\n", mp->name, mp);
- LIST_FOREACH(gp, &mp->geom, geom)
+ LIST_FOREACH(gp, &mp->geom, geom) {
db_show_geom_geom(2, gp);
+ if (db_pager_quit)
+ break;
+ }
}
/*
@@ -1220,6 +1232,8 @@ DB_SHOW_COMMAND(geom, db_show_geom)
LIST_FOREACH(mp, &g_classes, class) {
db_show_geom_class(mp);
printf("\n");
+ if (db_pager_quit)
+ break;
}
} else {
switch (g_valid_obj((void *)addr)) {
From hrs at FreeBSD.org Mon May 4 19:00:30 2009
From: hrs at FreeBSD.org (Hiroki Sato)
Date: Mon May 4 19:00:46 2009
Subject: svn commit: r191791 - stable/7/release/doc/en_US.ISO8859-1/errata
Message-ID: <200905041900.n44J0PlF054228@svn.freebsd.org>
Author: hrs
Date: Mon May 4 19:00:25 2009
New Revision: 191791
URL: http://svn.freebsd.org/changeset/base/191791
Log:
Update 7.2R Errata:
Document bce(4) + lagg(4) issue, and
A patch for lock order reversal committed.
Modified:
stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
Modified: stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
==============================================================================
--- stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Mon May 4 18:35:52 2009 (r191790)
+++ stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Mon May 4 19:00:25 2009 (r191791)
@@ -167,19 +167,28 @@
bootable and fall through to booting off the next boot device.
All affected machines did see the other discs as bootable. As a
workaround, you can boot using the bootonly or livefs CDROM and
- then swap in disc1 once sysinstall starts.
+ then swap in disc1 once &man.sysinstall.8; starts.
[20090504] A lock handling error has been found in
interaction between &man.malloc.3; implementation and threading
library. When a multi-threaded process calls the &man.fork.2;
system call in a thread and the &man.malloc.3; function in
another thread, it can cause a deadlock in the child process.
- An Errata Notice to fix this problem is planned for this problem
- after the release.
+ An Errata Notice to fix this problem is planned after the
+ release.
+
+ [20090505] A bug was found in the &man.bce.4; driver. This
+ prevents it from working with the &man.lagg.4; driver in the
+ LACP (IEEE 802.3ad Link Aggregation Control Protocol) mode. An
+ Errata Notice to fix this problem is planned after the
+ release.Late-Breaking News and Corrections
- No news.
+ [20090504] A patch to solve the locking issue in the
+ &man.malloc.3; implementation and threading library has been
+ committed to the RELENG_7 branch for public
+ testing.
From jhb at FreeBSD.org Mon May 4 19:19:14 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 4 19:19:35 2009
Subject: svn commit: r191793 - in stable/7/sys: . amd64/amd64 contrib/pf
dev/ath/ath_hal dev/cxgb i386/isa
Message-ID: <200905041919.n44JJDws054687@svn.freebsd.org>
Author: jhb
Date: Mon May 4 19:19:13 2009
New Revision: 191793
URL: http://svn.freebsd.org/changeset/base/191793
Log:
MFC: More refinements to the x86 FPU support:
- Rename (fpu|npx)_cleanstate to (fpu|npx)_initialstate to better reflect
their purpose.
- Fix a few nits in the earlier changes to prevent local information leakage
in AMD FPUs.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/amd64/fpu.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/isa/npx.c
Modified: stable/7/sys/amd64/amd64/fpu.c
==============================================================================
--- stable/7/sys/amd64/amd64/fpu.c Mon May 4 19:06:05 2009 (r191792)
+++ stable/7/sys/amd64/amd64/fpu.c Mon May 4 19:19:13 2009 (r191793)
@@ -101,7 +101,7 @@ static void fpu_clean_state(void);
SYSCTL_INT(_hw, HW_FLOATINGPT, floatingpoint, CTLFLAG_RD,
NULL, 1, "Floating point instructions executed in hardware");
-static struct savefpu fpu_cleanstate;
+static struct savefpu fpu_initialstate;
/*
* Initialize the floating point unit. On the boot CPU we generate a
@@ -123,13 +123,13 @@ fpuinit(void)
mxcsr = __INITIAL_MXCSR__;
ldmxcsr(mxcsr);
if (PCPU_GET(cpuid) == 0) {
- fxsave(&fpu_cleanstate);
- if (fpu_cleanstate.sv_env.en_mxcsr_mask)
- cpu_mxcsr_mask = fpu_cleanstate.sv_env.en_mxcsr_mask;
+ fxsave(&fpu_initialstate);
+ if (fpu_initialstate.sv_env.en_mxcsr_mask)
+ cpu_mxcsr_mask = fpu_initialstate.sv_env.en_mxcsr_mask;
else
cpu_mxcsr_mask = 0xFFBF;
- bzero(fpu_cleanstate.sv_fp, sizeof(fpu_cleanstate.sv_fp));
- bzero(fpu_cleanstate.sv_xmm, sizeof(fpu_cleanstate.sv_xmm));
+ bzero(fpu_initialstate.sv_fp, sizeof(fpu_initialstate.sv_fp));
+ bzero(fpu_initialstate.sv_xmm, sizeof(fpu_initialstate.sv_xmm));
}
start_emulating();
intr_restore(savecrit);
@@ -416,10 +416,11 @@ fpudna(void)
if ((pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
/*
- * This is the first time this thread has used the FPU,
- * explicitly load sanitized registers.
+ * This is the first time this thread has used the FPU or
+ * the PCB doesn't contain a clean FPU state. Explicitly
+ * load an initial state.
*/
- fxrstor(&fpu_cleanstate);
+ fxrstor(&fpu_initialstate);
if (pcb->pcb_initial_fpucw != __INITIAL_FPUCW__)
fldcw(&pcb->pcb_initial_fpucw);
pcb->pcb_flags |= PCB_FPUINITDONE;
@@ -453,7 +454,7 @@ fpugetregs(struct thread *td, struct sav
register_t s;
if ((td->td_pcb->pcb_flags & PCB_FPUINITDONE) == 0) {
- bcopy(&fpu_cleanstate, addr, sizeof(fpu_cleanstate));
+ bcopy(&fpu_initialstate, addr, sizeof(fpu_initialstate));
addr->sv_env.en_cw = td->td_pcb->pcb_initial_fpucw;
return (_MC_FPOWNED_NONE);
}
@@ -479,7 +480,6 @@ fpusetregs(struct thread *td, struct sav
s = intr_disable();
if (td == PCPU_GET(fpcurthread)) {
- fpu_clean_state();
fxrstor(addr);
intr_restore(s);
} else {
@@ -498,10 +498,10 @@ fpusetregs(struct thread *td, struct sav
* In order to avoid leaking this information across processes, we clean
* these values by performing a dummy load before executing fxrstor().
*/
-static double dummy_variable = 0.0;
static void
fpu_clean_state(void)
{
+ static float dummy_variable = 0.0;
u_short status;
/*
Modified: stable/7/sys/i386/isa/npx.c
==============================================================================
--- stable/7/sys/i386/isa/npx.c Mon May 4 19:06:05 2009 (r191792)
+++ stable/7/sys/i386/isa/npx.c Mon May 4 19:19:13 2009 (r191793)
@@ -172,7 +172,7 @@ SYSCTL_INT(_hw, HW_FLOATINGPT, floatingp
static volatile u_int npx_intrs_while_probing;
static volatile u_int npx_traps_while_probing;
-static union savefpu npx_cleanstate;
+static union savefpu npx_initialstate;
static bool_t npx_ex16;
static bool_t npx_exists;
static bool_t npx_irq13;
@@ -414,24 +414,24 @@ npx_attach(dev)
s = intr_disable();
stop_emulating();
- fpusave(&npx_cleanstate);
+ fpusave(&npx_initialstate);
start_emulating();
#ifdef CPU_ENABLE_SSE
if (cpu_fxsr) {
- if (npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask)
+ if (npx_initialstate.sv_xmm.sv_env.en_mxcsr_mask)
cpu_mxcsr_mask =
- npx_cleanstate.sv_xmm.sv_env.en_mxcsr_mask;
+ npx_initialstate.sv_xmm.sv_env.en_mxcsr_mask;
else
cpu_mxcsr_mask = 0xFFBF;
- bzero(npx_cleanstate.sv_xmm.sv_fp,
- sizeof(npx_cleanstate.sv_xmm.sv_fp));
- bzero(npx_cleanstate.sv_xmm.sv_xmm,
- sizeof(npx_cleanstate.sv_xmm.sv_xmm));
+ bzero(npx_initialstate.sv_xmm.sv_fp,
+ sizeof(npx_initialstate.sv_xmm.sv_fp));
+ bzero(npx_initialstate.sv_xmm.sv_xmm,
+ sizeof(npx_initialstate.sv_xmm.sv_xmm));
/* XXX might need even more zeroing. */
} else
#endif
- bzero(npx_cleanstate.sv_87.sv_ac,
- sizeof(npx_cleanstate.sv_87.sv_ac));
+ bzero(npx_initialstate.sv_87.sv_ac,
+ sizeof(npx_initialstate.sv_87.sv_ac));
intr_restore(s);
#ifdef I586_CPU_XXX
if (cpu_class == CPUCLASS_586 && npx_ex16 &&
@@ -785,13 +785,18 @@ npxdna(void)
PCPU_SET(fpcurthread, curthread);
pcb = PCPU_GET(curpcb);
+#ifdef CPU_ENABLE_SSE
+ if (cpu_fxsr)
+ fpu_clean_state();
+#endif
+
if ((pcb->pcb_flags & PCB_NPXINITDONE) == 0) {
/*
* This is the first time this thread has used the FPU or
* the PCB doesn't contain a clean FPU state. Explicitly
- * load sanitized registers.
+ * load an initial state.
*/
- fpurstor(&npx_cleanstate);
+ fpurstor(&npx_initialstate);
if (pcb->pcb_initial_npxcw != __INITIAL_NPXCW__)
fldcw(&pcb->pcb_initial_npxcw);
pcb->pcb_flags |= PCB_NPXINITDONE;
@@ -891,7 +896,7 @@ npxgetregs(td, addr)
return (_MC_FPOWNED_NONE);
if ((td->td_pcb->pcb_flags & PCB_NPXINITDONE) == 0) {
- bcopy(&npx_cleanstate, addr, sizeof(npx_cleanstate));
+ bcopy(&npx_initialstate, addr, sizeof(npx_initialstate));
SET_FPU_CW(addr, td->td_pcb->pcb_initial_npxcw);
return (_MC_FPOWNED_NONE);
}
@@ -967,10 +972,10 @@ fpusave(addr)
* In order to avoid leaking this information across processes, we clean
* these values by performing a dummy load before executing fxrstor().
*/
-static double dummy_variable = 0.0;
static void
fpu_clean_state(void)
{
+ static float dummy_variable = 0.0;
u_short status;
/*
@@ -996,10 +1001,9 @@ fpurstor(addr)
{
#ifdef CPU_ENABLE_SSE
- if (cpu_fxsr) {
- fpu_clean_state();
+ if (cpu_fxsr)
fxrstor(addr);
- } else
+ else
#endif
frstor(addr);
}
From jhb at FreeBSD.org Mon May 4 20:36:01 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 4 20:36:13 2009
Subject: svn commit: r191795 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/pci
Message-ID: <200905042036.n44Ka08v056369@svn.freebsd.org>
Author: jhb
Date: Mon May 4 20:35:59 2009
New Revision: 191795
URL: http://svn.freebsd.org/changeset/base/191795
Log:
MFC: Various fixes to the PCI resource allocation code:
- Disabling decoding of BARs via the PCI command register before writing
to the BARs to size them.
- Don't free resources decoded by a BAR when the device driver releases a
BAR. Instead, the PCI bus now owns unclaimed BARs and gives them to
drivers on demand. When a driver releases a BAR, the PCI bus reclaims
it and leaves the resource range allocated. This also prevents drivers
from allocating the same resource multiple times.
- Move the activation of BARs by enabling decoding in the PCI command
register into bus_activate_resource() so that it always happens after the
BAR is fully programmed.
- Always read/write the full 64-bit value of 64-bit BARs.
- Consolidate duplicated code for reading and sizing BARs and writing base
address to BARs.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/pci/pci.c
stable/7/sys/dev/pci/pci_private.h
stable/7/sys/dev/pci/pcireg.h
Modified: stable/7/sys/dev/pci/pci.c
==============================================================================
--- stable/7/sys/dev/pci/pci.c Mon May 4 20:25:56 2009 (r191794)
+++ stable/7/sys/dev/pci/pci.c Mon May 4 20:35:59 2009 (r191795)
@@ -71,18 +71,17 @@ __FBSDID("$FreeBSD$");
#define ACPI_PWR_FOR_SLEEP(x, y, z)
#endif
-static uint32_t pci_mapbase(unsigned mapreg);
-static const char *pci_maptype(unsigned mapreg);
-static int pci_mapsize(unsigned testval);
-static int pci_maprange(unsigned mapreg);
+static pci_addr_t pci_mapbase(uint64_t mapreg);
+static const char *pci_maptype(uint64_t mapreg);
+static int pci_mapsize(uint64_t testval);
+static int pci_maprange(uint64_t mapreg);
static void pci_fixancient(pcicfgregs *cfg);
-static int pci_porten(device_t pcib, int b, int s, int f);
-static int pci_memen(device_t pcib, int b, int s, int f);
+static int pci_porten(device_t dev);
+static int pci_memen(device_t dev);
static void pci_assign_interrupt(device_t bus, device_t dev,
int force_route);
-static int pci_add_map(device_t pcib, device_t bus, device_t dev,
- int b, int s, int f, int reg,
+static int pci_add_map(device_t bus, device_t dev, int reg,
struct resource_list *rl, int force, int prefetch);
static int pci_probe(device_t dev);
static int pci_attach(device_t dev);
@@ -136,7 +135,7 @@ static device_method_t pci_methods[] = {
DEVMETHOD(bus_delete_resource, pci_delete_resource),
DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
+ DEVMETHOD(bus_activate_resource, pci_activate_resource),
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method),
DEVMETHOD(bus_child_location_str, pci_child_location_str_method),
@@ -316,8 +315,8 @@ pci_find_device(uint16_t vendor, uint16_
/* return base address of memory or port map */
-static uint32_t
-pci_mapbase(uint32_t mapreg)
+static pci_addr_t
+pci_mapbase(uint64_t mapreg)
{
if (PCI_BAR_MEM(mapreg))
@@ -329,7 +328,7 @@ pci_mapbase(uint32_t mapreg)
/* return map type of memory or port map */
static const char *
-pci_maptype(unsigned mapreg)
+pci_maptype(uint64_t mapreg)
{
if (PCI_BAR_IO(mapreg))
@@ -342,7 +341,7 @@ pci_maptype(unsigned mapreg)
/* return log2 of map size decoded for memory or port map */
static int
-pci_mapsize(uint32_t testval)
+pci_mapsize(uint64_t testval)
{
int ln2size;
@@ -361,7 +360,7 @@ pci_mapsize(uint32_t testval)
/* return log2 of address range supported by map register */
static int
-pci_maprange(unsigned mapreg)
+pci_maprange(uint64_t mapreg)
{
int ln2range = 0;
@@ -2257,17 +2256,75 @@ pci_print_verbose(struct pci_devinfo *di
}
static int
-pci_porten(device_t pcib, int b, int s, int f)
+pci_porten(device_t dev)
{
- return (PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2)
- & PCIM_CMD_PORTEN) != 0;
+ return (pci_read_config(dev, PCIR_COMMAND, 2) & PCIM_CMD_PORTEN) != 0;
}
static int
-pci_memen(device_t pcib, int b, int s, int f)
+pci_memen(device_t dev)
{
- return (PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2)
- & PCIM_CMD_MEMEN) != 0;
+ return (pci_read_config(dev, PCIR_COMMAND, 2) & PCIM_CMD_MEMEN) != 0;
+}
+
+static void
+pci_read_bar(device_t dev, int reg, pci_addr_t *mapp, pci_addr_t *testvalp)
+{
+ pci_addr_t map, testval;
+ int ln2range;
+ uint16_t cmd;
+
+ map = pci_read_config(dev, reg, 4);
+ ln2range = pci_maprange(map);
+ if (ln2range == 64)
+ map |= (pci_addr_t)pci_read_config(dev, reg + 4, 4) << 32;
+
+ /*
+ * Disable decoding via the command register before
+ * determining the BAR's length since we will be placing it in
+ * a weird state.
+ */
+ cmd = pci_read_config(dev, PCIR_COMMAND, 2);
+ pci_write_config(dev, PCIR_COMMAND,
+ cmd & ~(PCI_BAR_MEM(map) ? PCIM_CMD_MEMEN : PCIM_CMD_PORTEN), 2);
+
+ /*
+ * Determine the BAR's length by writing all 1's. The bottom
+ * log_2(size) bits of the BAR will stick as 0 when we read
+ * the value back.
+ */
+ pci_write_config(dev, reg, 0xffffffff, 4);
+ testval = pci_read_config(dev, reg, 4);
+ if (ln2range == 64) {
+ pci_write_config(dev, reg + 4, 0xffffffff, 4);
+ testval |= (pci_addr_t)pci_read_config(dev, reg + 4, 4) << 32;
+ }
+
+ /*
+ * Restore the original value of the BAR. We may have reprogrammed
+ * the BAR of the low-level console device and when booting verbose,
+ * we need the console device addressable.
+ */
+ pci_write_config(dev, reg, map, 4);
+ if (ln2range == 64)
+ pci_write_config(dev, reg + 4, map >> 32, 4);
+ pci_write_config(dev, PCIR_COMMAND, cmd, 2);
+
+ *mapp = map;
+ *testvalp = testval;
+}
+
+static void
+pci_write_bar(device_t dev, int reg, pci_addr_t base)
+{
+ pci_addr_t map;
+ int ln2range;
+
+ map = pci_read_config(dev, reg, 4);
+ ln2range = pci_maprange(map);
+ pci_write_config(dev, reg, base, 4);
+ if (ln2range == 64)
+ pci_write_config(dev, reg + 4, base >> 32, 4);
}
/*
@@ -2275,36 +2332,26 @@ pci_memen(device_t pcib, int b, int s, i
* register is a 32bit map register or 2 if it is a 64bit register.
*/
static int
-pci_add_map(device_t pcib, device_t bus, device_t dev,
- int b, int s, int f, int reg, struct resource_list *rl, int force,
- int prefetch)
+pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl,
+ int force, int prefetch)
{
- uint32_t map;
- pci_addr_t base;
+ pci_addr_t base, map, testval;
pci_addr_t start, end, count;
- uint8_t ln2size;
- uint8_t ln2range;
- uint32_t testval;
+ int barlen, maprange, mapsize, type;
uint16_t cmd;
- int type;
- int barlen;
struct resource *res;
- map = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4);
- PCIB_WRITE_CONFIG(pcib, b, s, f, reg, 0xffffffff, 4);
- testval = PCIB_READ_CONFIG(pcib, b, s, f, reg, 4);
- PCIB_WRITE_CONFIG(pcib, b, s, f, reg, map, 4);
-
+ pci_read_bar(dev, reg, &map, &testval);
if (PCI_BAR_MEM(map)) {
type = SYS_RES_MEMORY;
if (map & PCIM_BAR_MEM_PREFETCH)
prefetch = 1;
} else
type = SYS_RES_IOPORT;
- ln2size = pci_mapsize(testval);
- ln2range = pci_maprange(testval);
+ mapsize = pci_mapsize(testval);
base = pci_mapbase(map);
- barlen = ln2range == 64 ? 2 : 1;
+ maprange = pci_maprange(map);
+ barlen = maprange == 64 ? 2 : 1;
/*
* For I/O registers, if bottom bit is set, and the next bit up
@@ -2315,19 +2362,16 @@ pci_add_map(device_t pcib, device_t bus,
*/
if (PCI_BAR_IO(testval) && (testval & PCIM_BAR_IO_RESERVED) != 0)
return (barlen);
- if ((type == SYS_RES_MEMORY && ln2size < 4) ||
- (type == SYS_RES_IOPORT && ln2size < 2))
+ if ((type == SYS_RES_MEMORY && mapsize < 4) ||
+ (type == SYS_RES_IOPORT && mapsize < 2))
return (barlen);
- if (ln2range == 64)
- /* Read the other half of a 64bit map register */
- base |= (uint64_t) PCIB_READ_CONFIG(pcib, b, s, f, reg + 4, 4) << 32;
if (bootverbose) {
printf("\tmap[%02x]: type %s, range %2d, base %#jx, size %2d",
- reg, pci_maptype(map), ln2range, (uintmax_t)base, ln2size);
- if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f))
+ reg, pci_maptype(map), maprange, (uintmax_t)base, mapsize);
+ if (type == SYS_RES_IOPORT && !pci_porten(dev))
printf(", port disabled\n");
- else if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f))
+ else if (type == SYS_RES_MEMORY && !pci_memen(dev))
printf(", memory disabled\n");
else
printf(", enabled\n");
@@ -2349,7 +2393,8 @@ pci_add_map(device_t pcib, device_t bus,
if ((u_long)base != base) {
device_printf(bus,
"pci%d:%d:%d:%d bar %#x too many address bits",
- pci_get_domain(dev), b, s, f, reg);
+ pci_get_domain(dev), pci_get_bus(dev), pci_get_slot(dev),
+ pci_get_function(dev), reg);
return (barlen);
}
@@ -2362,30 +2407,30 @@ pci_add_map(device_t pcib, device_t bus,
*/
if (pci_enable_io_modes) {
/* Turn on resources that have been left off by a lazy BIOS */
- if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f)) {
- cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2);
+ if (type == SYS_RES_IOPORT && !pci_porten(dev)) {
+ cmd = pci_read_config(dev, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_PORTEN;
- PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2);
+ pci_write_config(dev, PCIR_COMMAND, cmd, 2);
}
- if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f)) {
- cmd = PCIB_READ_CONFIG(pcib, b, s, f, PCIR_COMMAND, 2);
+ if (type == SYS_RES_MEMORY && !pci_memen(dev)) {
+ cmd = pci_read_config(dev, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_MEMEN;
- PCIB_WRITE_CONFIG(pcib, b, s, f, PCIR_COMMAND, cmd, 2);
+ pci_write_config(dev, PCIR_COMMAND, cmd, 2);
}
} else {
- if (type == SYS_RES_IOPORT && !pci_porten(pcib, b, s, f))
+ if (type == SYS_RES_IOPORT && !pci_porten(dev))
return (barlen);
- if (type == SYS_RES_MEMORY && !pci_memen(pcib, b, s, f))
+ if (type == SYS_RES_MEMORY && !pci_memen(dev))
return (barlen);
}
- count = 1 << ln2size;
+ count = 1 << mapsize;
if (base == 0 || base == pci_mapbase(testval)) {
start = 0; /* Let the parent decide. */
end = ~0ULL;
} else {
start = base;
- end = base + (1 << ln2size) - 1;
+ end = base + (1 << mapsize) - 1;
}
resource_list_add(rl, type, reg, start, end, count);
@@ -2406,11 +2451,11 @@ pci_add_map(device_t pcib, device_t bus,
*/
resource_list_delete(rl, type, reg);
start = 0;
- } else
+ } else {
start = rman_get_start(res);
- pci_write_config(dev, reg, start, 4);
- if (ln2range == 64)
- pci_write_config(dev, reg + 4, start >> 32, 4);
+ rman_set_device(res, bus);
+ }
+ pci_write_bar(dev, reg, start);
return (barlen);
}
@@ -2422,9 +2467,10 @@ pci_add_map(device_t pcib, device_t bus,
* addressing mode.
*/
static void
-pci_ata_maps(device_t pcib, device_t bus, device_t dev, int b,
- int s, int f, struct resource_list *rl, int force, uint32_t prefetchmask)
+pci_ata_maps(device_t bus, device_t dev, struct resource_list *rl, int force,
+ uint32_t prefetchmask)
{
+ struct resource *r;
int rid, type, progif;
#if 0
/* if this device supports PCI native addressing use it */
@@ -2440,38 +2486,42 @@ pci_ata_maps(device_t pcib, device_t bus
progif = pci_read_config(dev, PCIR_PROGIF, 1);
type = SYS_RES_IOPORT;
if (progif & PCIP_STORAGE_IDE_MODEPRIM) {
- pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(0), rl, force,
+ pci_add_map(bus, dev, PCIR_BAR(0), rl, force,
prefetchmask & (1 << 0));
- pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(1), rl, force,
+ pci_add_map(bus, dev, PCIR_BAR(1), rl, force,
prefetchmask & (1 << 1));
} else {
rid = PCIR_BAR(0);
resource_list_add(rl, type, rid, 0x1f0, 0x1f7, 8);
- resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7, 8,
- 0);
+ r = resource_list_alloc(rl, bus, dev, type, &rid, 0x1f0, 0x1f7,
+ 8, 0);
+ rman_set_device(r, bus);
rid = PCIR_BAR(1);
resource_list_add(rl, type, rid, 0x3f6, 0x3f6, 1);
- resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6, 1,
- 0);
+ r = resource_list_alloc(rl, bus, dev, type, &rid, 0x3f6, 0x3f6,
+ 1, 0);
+ rman_set_device(r, bus);
}
if (progif & PCIP_STORAGE_IDE_MODESEC) {
- pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(2), rl, force,
+ pci_add_map(bus, dev, PCIR_BAR(2), rl, force,
prefetchmask & (1 << 2));
- pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(3), rl, force,
+ pci_add_map(bus, dev, PCIR_BAR(3), rl, force,
prefetchmask & (1 << 3));
} else {
rid = PCIR_BAR(2);
resource_list_add(rl, type, rid, 0x170, 0x177, 8);
- resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177, 8,
- 0);
+ r = resource_list_alloc(rl, bus, dev, type, &rid, 0x170, 0x177,
+ 8, 0);
+ rman_set_device(r, bus);
rid = PCIR_BAR(3);
resource_list_add(rl, type, rid, 0x376, 0x376, 1);
- resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376, 1,
- 0);
+ r = resource_list_alloc(rl, bus, dev, type, &rid, 0x376, 0x376,
+ 1, 0);
+ rman_set_device(r, bus);
}
- pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(4), rl, force,
+ pci_add_map(bus, dev, PCIR_BAR(4), rl, force,
prefetchmask & (1 << 4));
- pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(5), rl, force,
+ pci_add_map(bus, dev, PCIR_BAR(5), rl, force,
prefetchmask & (1 << 5));
}
@@ -2526,18 +2576,11 @@ pci_assign_interrupt(device_t bus, devic
void
pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask)
{
- device_t pcib;
struct pci_devinfo *dinfo = device_get_ivars(dev);
pcicfgregs *cfg = &dinfo->cfg;
struct resource_list *rl = &dinfo->resources;
struct pci_quirk *q;
- int b, i, f, s;
-
- pcib = device_get_parent(bus);
-
- b = cfg->bus;
- s = cfg->slot;
- f = cfg->func;
+ int i;
/* ATA devices needs special map treatment */
if ((pci_get_class(dev) == PCIC_STORAGE) &&
@@ -2545,11 +2588,11 @@ pci_add_resources(device_t bus, device_t
((pci_get_progif(dev) & PCIP_STORAGE_IDE_MASTERDEV) ||
(!pci_read_config(dev, PCIR_BAR(0), 4) &&
!pci_read_config(dev, PCIR_BAR(2), 4))) )
- pci_ata_maps(pcib, bus, dev, b, s, f, rl, force, prefetchmask);
+ pci_ata_maps(bus, dev, rl, force, prefetchmask);
else
for (i = 0; i < cfg->nummaps;)
- i += pci_add_map(pcib, bus, dev, b, s, f, PCIR_BAR(i),
- rl, force, prefetchmask & (1 << i));
+ i += pci_add_map(bus, dev, PCIR_BAR(i), rl, force,
+ prefetchmask & (1 << i));
/*
* Add additional, quirked resources.
@@ -2557,8 +2600,7 @@ pci_add_resources(device_t bus, device_t
for (q = &pci_quirks[0]; q->devid; q++) {
if (q->devid == ((cfg->device << 16) | cfg->vendor)
&& q->type == PCI_QUIRK_MAP_REG)
- pci_add_map(pcib, bus, dev, b, s, f, q->arg1, rl,
- force, 0);
+ pci_add_map(bus, dev, q->arg1, rl, force, 0);
}
if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) {
@@ -3401,21 +3443,12 @@ pci_alloc_map(device_t dev, device_t chi
* it fails here, that other code is broken.
*/
res = NULL;
- map = pci_read_config(child, *rid, 4);
- pci_write_config(child, *rid, 0xffffffff, 4);
- testval = pci_read_config(child, *rid, 4);
- if (pci_maprange(testval) == 64)
- map |= (pci_addr_t)pci_read_config(child, *rid + 4, 4) << 32;
+ pci_read_bar(child, *rid, &map, &testval);
+
+ /* Ignore a BAR with a base of 0. */
if (pci_mapbase(testval) == 0)
goto out;
- /*
- * Restore the original value of the BAR. We may have reprogrammed
- * the BAR of the low-level console device and when booting verbose,
- * we need the console device addressable.
- */
- pci_write_config(child, *rid, map, 4);
-
if (PCI_BAR_MEM(testval)) {
if (type != SYS_RES_MEMORY) {
if (bootverbose)
@@ -3435,6 +3468,7 @@ pci_alloc_map(device_t dev, device_t chi
goto out;
}
}
+
/*
* For real BARs, we need to override the size that
* the driver requests, because that's what the BAR
@@ -3454,13 +3488,14 @@ pci_alloc_map(device_t dev, device_t chi
* appropriate bar for that resource.
*/
res = BUS_ALLOC_RESOURCE(device_get_parent(dev), child, type, rid,
- start, end, count, flags);
+ start, end, count, flags & ~RF_ACTIVE);
if (res == NULL) {
device_printf(child,
"%#lx bytes of rid %#x res %d failed (%#lx, %#lx).\n",
count, *rid, type, start, end);
goto out;
}
+ rman_set_device(res, dev);
resource_list_add(rl, type, *rid, start, end, count);
rle = resource_list_find(rl, type, *rid);
if (rle == NULL)
@@ -3474,10 +3509,8 @@ pci_alloc_map(device_t dev, device_t chi
"Lazy allocation of %#lx bytes rid %#x type %d at %#lx\n",
count, *rid, type, rman_get_start(res));
map = rman_get_start(res);
+ pci_write_bar(child, *rid, map);
out:;
- pci_write_config(child, *rid, map, 4);
- if (pci_maprange(testval) == 64)
- pci_write_config(child, *rid + 4, map >> 32, 4);
return (res);
}
@@ -3489,68 +3522,63 @@ pci_alloc_resource(device_t dev, device_
struct pci_devinfo *dinfo = device_get_ivars(child);
struct resource_list *rl = &dinfo->resources;
struct resource_list_entry *rle;
+ struct resource *res;
pcicfgregs *cfg = &dinfo->cfg;
+ if (device_get_parent(child) != dev)
+ return (BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
+ type, rid, start, end, count, flags));
+
/*
* Perform lazy resource allocation
*/
- if (device_get_parent(child) == dev) {
- switch (type) {
- case SYS_RES_IRQ:
- /*
- * Can't alloc legacy interrupt once MSI messages
- * have been allocated.
- */
- if (*rid == 0 && (cfg->msi.msi_alloc > 0 ||
- cfg->msix.msix_alloc > 0))
+ switch (type) {
+ case SYS_RES_IRQ:
+ /*
+ * Can't alloc legacy interrupt once MSI messages have
+ * been allocated.
+ */
+ if (*rid == 0 && (cfg->msi.msi_alloc > 0 ||
+ cfg->msix.msix_alloc > 0))
+ return (NULL);
+
+ /*
+ * If the child device doesn't have an interrupt
+ * routed and is deserving of an interrupt, try to
+ * assign it one.
+ */
+ if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) &&
+ (cfg->intpin != 0))
+ pci_assign_interrupt(dev, child, 0);
+ break;
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ /* Allocate resources for this BAR if needed. */
+ rle = resource_list_find(rl, type, *rid);
+ if (rle == NULL) {
+ res = pci_alloc_map(dev, child, type, rid, start, end,
+ count, flags);
+ if (res == NULL)
return (NULL);
- /*
- * If the child device doesn't have an
- * interrupt routed and is deserving of an
- * interrupt, try to assign it one.
- */
- if (*rid == 0 && !PCI_INTERRUPT_VALID(cfg->intline) &&
- (cfg->intpin != 0))
- pci_assign_interrupt(dev, child, 0);
- break;
- case SYS_RES_IOPORT:
- case SYS_RES_MEMORY:
- if (*rid < PCIR_BAR(cfg->nummaps)) {
- /*
- * Enable the I/O mode. We should
- * also be assigning resources too
- * when none are present. The
- * resource_list_alloc kind of sorta does
- * this...
- */
- if (PCI_ENABLE_IO(dev, child, type))
- return (NULL);
- }
rle = resource_list_find(rl, type, *rid);
- if (rle == NULL)
- return (pci_alloc_map(dev, child, type, rid,
- start, end, count, flags));
- break;
}
+
/*
- * If we've already allocated the resource, then
- * return it now. But first we may need to activate
- * it, since we don't allocate the resource as active
- * above. Normally this would be done down in the
- * nexus, but since we short-circuit that path we have
- * to do its job here. Not sure if we should free the
- * resource if it fails to activate.
+ * If the resource belongs to the bus, then give it to
+ * the child. We need to activate it if requested
+ * since the bus always allocates inactive resources.
*/
- rle = resource_list_find(rl, type, *rid);
- if (rle != NULL && rle->res != NULL) {
+ if (rle != NULL && rle->res != NULL &&
+ rman_get_device(rle->res) == dev) {
if (bootverbose)
device_printf(child,
"Reserved %#lx bytes for rid %#x type %d at %#lx\n",
rman_get_size(rle->res), *rid, type,
rman_get_start(rle->res));
+ rman_set_device(rle->res, child);
if ((flags & RF_ACTIVE) &&
- bus_generic_activate_resource(dev, child, type,
- *rid, rle->res) != 0)
+ bus_activate_resource(child, type, *rid,
+ rle->res) != 0)
return (NULL);
return (rle->res);
}
@@ -3559,6 +3587,59 @@ pci_alloc_resource(device_t dev, device_
start, end, count, flags));
}
+int
+pci_release_resource(device_t dev, device_t child, int type, int rid,
+ struct resource *r)
+{
+ int error;
+
+ if (device_get_parent(child) != dev)
+ return (BUS_RELEASE_RESOURCE(device_get_parent(dev), child,
+ type, rid, r));
+
+ /*
+ * For BARs we don't actually want to release the resource.
+ * Instead, we deactivate the resource if needed and then give
+ * ownership of the BAR back to the bus.
+ */
+ switch (type) {
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ if (rman_get_device(r) != child)
+ return (EINVAL);
+ if (rman_get_flags(r) & RF_ACTIVE) {
+ error = bus_deactivate_resource(child, type, rid, r);
+ if (error)
+ return (error);
+ }
+ rman_set_device(r, dev);
+ return (0);
+ }
+ return (bus_generic_rl_release_resource(dev, child, type, rid, r));
+}
+
+int
+pci_activate_resource(device_t dev, device_t child, int type, int rid,
+ struct resource *r)
+{
+ int error;
+
+ error = bus_generic_activate_resource(dev, child, type, rid, r);
+ if (error)
+ return (error);
+
+ /* Enable decoding in the command register when activating BARs. */
+ if (device_get_parent(child) == dev) {
+ switch (type) {
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ error = PCI_ENABLE_IO(dev, child, type);
+ break;
+ }
+ }
+ return (error);
+}
+
void
pci_delete_resource(device_t dev, device_t child, int type, int rid)
{
@@ -3572,27 +3653,33 @@ pci_delete_resource(device_t dev, device
dinfo = device_get_ivars(child);
rl = &dinfo->resources;
rle = resource_list_find(rl, type, rid);
- if (rle) {
- if (rle->res) {
- if (rman_get_device(rle->res) != dev ||
- rman_get_flags(rle->res) & RF_ACTIVE) {
- device_printf(dev, "delete_resource: "
- "Resource still owned by child, oops. "
- "(type=%d, rid=%d, addr=%lx)\n",
- rle->type, rle->rid,
- rman_get_start(rle->res));
- return;
- }
- bus_release_resource(dev, type, rid, rle->res);
+ if (rle == NULL)
+ return;
+
+ if (rle->res) {
+ if (rman_get_device(rle->res) != dev ||
+ rman_get_flags(rle->res) & RF_ACTIVE) {
+ device_printf(dev, "delete_resource: "
+ "Resource still owned by child, oops. "
+ "(type=%d, rid=%d, addr=%lx)\n",
+ rle->type, rle->rid,
+ rman_get_start(rle->res));
+ return;
}
- resource_list_delete(rl, type, rid);
+
+ /*
+ * If this is a BAR, clear the BAR so it stops
+ * decoding before releasing the resource.
+ */
+ switch (type) {
+ case SYS_RES_IOPORT:
+ case SYS_RES_MEMORY:
+ pci_write_bar(child, rid, 0);
+ break;
+ }
+ bus_release_resource(dev, type, rid, rle->res);
}
- /*
- * Why do we turn off the PCI configuration BAR when we delete a
- * resource? -- imp
- */
- pci_write_config(child, rid, 0, 4);
- BUS_DELETE_RESOURCE(device_get_parent(dev), child, type, rid);
+ resource_list_delete(rl, type, rid);
}
struct resource_list *
Modified: stable/7/sys/dev/pci/pci_private.h
==============================================================================
--- stable/7/sys/dev/pci/pci_private.h Mon May 4 20:25:56 2009 (r191794)
+++ stable/7/sys/dev/pci/pci_private.h Mon May 4 20:35:59 2009 (r191795)
@@ -82,6 +82,10 @@ int pci_msix_count_method(device_t dev,
struct resource *pci_alloc_resource(device_t dev, device_t child,
int type, int *rid, u_long start, u_long end, u_long count,
u_int flags);
+int pci_release_resource(device_t dev, device_t child, int type,
+ int rid, struct resource *r);
+int pci_activate_resource(device_t dev, device_t child, int type,
+ int rid, struct resource *r);
void pci_delete_resource(device_t dev, device_t child,
int type, int rid);
struct resource_list *pci_get_resource_list (device_t dev, device_t child);
Modified: stable/7/sys/dev/pci/pcireg.h
==============================================================================
--- stable/7/sys/dev/pci/pcireg.h Mon May 4 20:25:56 2009 (r191794)
+++ stable/7/sys/dev/pci/pcireg.h Mon May 4 20:35:59 2009 (r191795)
@@ -130,7 +130,7 @@
#define PCIM_BAR_MEM_1MB 2 /* Locate below 1MB in PCI <= 2.1 */
#define PCIM_BAR_MEM_64 4
#define PCIM_BAR_MEM_PREFETCH 0x00000008
-#define PCIM_BAR_MEM_BASE 0xfffffff0
+#define PCIM_BAR_MEM_BASE 0xfffffffffffffff0ULL
#define PCIM_BAR_IO_RESERVED 0x00000002
#define PCIM_BAR_IO_BASE 0xfffffffc
#define PCIR_CIS 0x28
From emax at FreeBSD.org Mon May 4 20:48:08 2009
From: emax at FreeBSD.org (Maksim Yevmenkin)
Date: Mon May 4 20:48:25 2009
Subject: svn commit: r191796 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905042048.n44Km7tA056703@svn.freebsd.org>
Author: emax
Date: Mon May 4 20:48:07 2009
New Revision: 191796
URL: http://svn.freebsd.org/changeset/base/191796
Log:
MFC r191366
Fix sbappendrecord_locked().
The main problem is that sbappendrecord_locked() relies on sbcompress()
to set sb_mbtail. This will not happen if sbappendrecord_locked() is
called with mbuf chain made of exactly one mbuf (i.e. m0->m_next == NULL).
In this case sbcompress() will be called with m == NULL and will do
nothing. I'm not entirely sure if m == NULL is a valid argument for
sbcompress(), and, it rather pointless to call it like that, but keep
calling it so it can do SBLASTMBUFCHK().
PR: kern/126742
Investigated by: pluknet < pluknet -at- gmail -dot- com >
No response from: freebsd-current@, freebsd-bluetooth@
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/uipc_sockbuf.c
Modified: stable/7/sys/kern/uipc_sockbuf.c
==============================================================================
--- stable/7/sys/kern/uipc_sockbuf.c Mon May 4 20:35:59 2009 (r191795)
+++ stable/7/sys/kern/uipc_sockbuf.c Mon May 4 20:48:07 2009 (r191796)
@@ -576,10 +576,6 @@ sbappendrecord_locked(struct sockbuf *sb
if (m0 == 0)
return;
- m = sb->sb_mb;
- if (m)
- while (m->m_nextpkt)
- m = m->m_nextpkt;
/*
* Put the first mbuf on the queue. Note this permits zero length
* records.
@@ -587,16 +583,14 @@ sbappendrecord_locked(struct sockbuf *sb
sballoc(sb, m0);
SBLASTRECORDCHK(sb);
SBLINKRECORD(sb, m0);
- if (m)
- m->m_nextpkt = m0;
- else
- sb->sb_mb = m0;
+ sb->sb_mbtail = m0;
m = m0->m_next;
m0->m_next = 0;
if (m && (m0->m_flags & M_EOR)) {
m0->m_flags &= ~M_EOR;
m->m_flags |= M_EOR;
}
+ /* always call sbcompress() so it can do SBLASTMBUFCHK() */
sbcompress(sb, m, m0);
}
From emax at FreeBSD.org Mon May 4 20:53:21 2009
From: emax at FreeBSD.org (Maksim Yevmenkin)
Date: Mon May 4 20:53:27 2009
Subject: svn commit: r191797 - stable/7/lib/libbluetooth
Message-ID: <200905042053.n44KrJjg056851@svn.freebsd.org>
Author: emax
Date: Mon May 4 20:53:19 2009
New Revision: 191797
URL: http://svn.freebsd.org/changeset/base/191797
Log:
MFC r191388
Implement low-level Bluetooth HCI API.
This should make it easier to make Linux BlueZ libhci port.
Reviewed by: Iain Hibbert < plunky -at- rya-online -dot- net > of NetBSD
Inspired by: Linux BlueZ
Inspired by: NetBSD
Modified:
stable/7/lib/libbluetooth/ (props changed)
stable/7/lib/libbluetooth/Makefile
stable/7/lib/libbluetooth/bluetooth.3
stable/7/lib/libbluetooth/bluetooth.h
stable/7/lib/libbluetooth/hci.c
Modified: stable/7/lib/libbluetooth/Makefile
==============================================================================
--- stable/7/lib/libbluetooth/Makefile Mon May 4 20:48:07 2009 (r191796)
+++ stable/7/lib/libbluetooth/Makefile Mon May 4 20:53:19 2009 (r191797)
@@ -33,6 +33,19 @@ MLINKS+= bluetooth.3 bt_devname.3
MLINKS+= bluetooth.3 bt_devinfo.3
MLINKS+= bluetooth.3 bt_devenum.3
+MLINKS+= bluetooth.3 bt_devopen.3
+MLINKS+= bluetooth.3 bt_devclose.3
+MLINKS+= bluetooth.3 bt_devsend.3
+MLINKS+= bluetooth.3 bt_devreq.3
+MLINKS+= bluetooth.3 bt_devfilter.3
+MLINKS+= bluetooth.3 bt_devfilter_pkt_set.3
+MLINKS+= bluetooth.3 bt_devfilter_pkt_clr.3
+MLINKS+= bluetooth.3 bt_devfilter_pkt_tst.3
+MLINKS+= bluetooth.3 bt_devfilter_evt_set.3
+MLINKS+= bluetooth.3 bt_devfilter_evt_clr.3
+MLINKS+= bluetooth.3 bt_devfilter_evt_tst.3
+MLINKS+= bluetooth.3 bt_devinquiry.3
+
MLINKS+= bluetooth.3 bdaddr_same.3
MLINKS+= bluetooth.3 bdaddr_any.3
MLINKS+= bluetooth.3 bdaddr_copy.3
Modified: stable/7/lib/libbluetooth/bluetooth.3
==============================================================================
--- stable/7/lib/libbluetooth/bluetooth.3 Mon May 4 20:48:07 2009 (r191796)
+++ stable/7/lib/libbluetooth/bluetooth.3 Mon May 4 20:53:19 2009 (r191797)
@@ -25,7 +25,7 @@
.\" $Id: bluetooth.3,v 1.5 2003/05/20 23:04:30 max Exp $
.\" $FreeBSD$
.\"
-.Dd February 13, 2009
+.Dd April 9, 2009
.Dt BLUETOOTH 3
.Os
.Sh NAME
@@ -41,6 +41,23 @@
.Nm bt_endprotoent ,
.Nm bt_aton ,
.Nm bt_ntoa ,
+.Nm bt_devaddr ,
+.Nm bt_devname ,
+.Nm bt_devinfo ,
+.Nm bt_devenum ,
+.Nm bt_devopen ,
+.Nm bt_devclose ,
+.Nm bt_devsend ,
+.Nm bt_devrecv ,
+.Nm bt_devreq ,
+.Nm bt_devfilter ,
+.Nm bt_devfilter_pkt_set ,
+.Nm bt_devfilter_pkt_clr ,
+.Nm bt_devfilter_pkt_tst ,
+.Nm bt_devfilter_evt_set ,
+.Nm bt_devfilter_evt_clr ,
+.Nm bt_devfilter_evt_tst ,
+.Nm bt_devinquiry ,
.Nm bdaddr_same ,
.Nm bdaddr_any ,
.Nm bdaddr_copy
@@ -84,6 +101,32 @@
.Ft int
.Fn bt_devenum "bt_devenum_cb_t *cb" "void *arg"
.Ft int
+.Fn bt_devopen "char const *devname"
+.Ft int
+.Fn bt_devclose "int s"
+.Ft int
+.Fn bt_devsend "int s" "uint16_t opcode" "void *param" "size_t plen"
+.Ft ssize_t
+.Fn bt_devrecv "int s" "void *buf" "size_t size" "time_t to"
+.Ft int
+.Fn bt_devreq "int s" "struct bt_devreq *r" "time_t to"
+.Ft int
+.Fn bt_devfilter "int s" "struct bt_devfilter const *new" "struct bt_devfilter *old"
+.Ft void
+.Fn bt_devfilter_pkt_set "struct bt_devfilter *filter" "uint8_t type"
+.Ft void
+.Fn bt_devfilter_pkt_clt "struct bt_devfilter *filter" "uint8_t type"
+.Ft int
+.Fn bt_devfilter_pkt_tst "struct bt_devfilter const *filter" "uint8_t type"
+.Ft void
+.Fn bt_devfilter_evt_set "struct bt_devfilter *filter" "uint8_t event"
+.Ft void
+.Fn bt_devfilter_evt_clt "struct bt_devfilter *filter" "uint8_t event"
+.Ft int
+.Fn bt_devfilter_evt_tst "struct bt_devfilter const *filter" "uint8_t event"
+.Ft int
+.Fn bt_devinquiry "char const *devname" "time_t length" "int num_rsp" "struct bt_devinquiry **ii"
+.Ft int
.Fn bdaddr_same "const bdaddr_t *a" "const bdaddr_t *b"
.Ft int
.Fn bdaddr_any "const bdaddr_t *a"
@@ -311,6 +354,240 @@ The function returns number of successfu
or -1 if an error occurred.
.Pp
The
+.Fn bt_devopen
+function opens a Bluetooth device with the given
+.Fa devname
+and returns a connected and bound
+.Dv HCI
+socket handle.
+The function returns -1 if an error has occurred.
+.Pp
+The
+.Fn bt_devclose
+closes the passed
+.Dv HCI
+socket handle
+.Fa s ,
+previously obtained with
+.Xr bt_devopen 3 .
+.Pp
+The
+.Fn bt_devsend
+function sends a Bluetooth
+.Dv HCI
+command with the given
+.Fa opcode
+to the provided socket
+.Fa s ,
+previously obtained with
+.Xr bt_devopen 3 .
+The
+.Fa opcode
+parameter is exppected to be in the host byte order.
+The
+.Fa param
+and
+.Fa plen
+parameters specify command parameters.
+The
+.Fn bt_devsend
+function does not modify the
+.Dv HCI
+filter on the provided socket
+.Fa s .
+The function returns 0 on success,
+or -1 if an error occurred.
+.Pp
+The
+.Fn bt_devrecv
+function receives one Bluetooth
+.Dv HCI
+packet from the socket
+.Fa s ,
+previously obtained with
+.Xr bt_devopen 3 .
+The packet is placed into the provided buffer
+.Fa buf
+of size
+.Fa size .
+The
+.Fa to
+parameter specifies receive timeout in seconds.
+Infinite timeout can be specified by passing negative value in the
+.Fa to
+parameter.
+The
+.Fn bt_devrecv
+function does not modify the
+.Dv HCI
+filter on the provided socket
+.Fa s .
+The function returns total number of bytes recevied,
+or -1 if an error occurred.
+.Pp
+The
+.Fn bt_devreq
+function makes a Bluetooth
+.Dv HCI
+request to the socket
+.Fa s ,
+previously obtained with
+.Xr bt_devopen 3 .
+The function will send the specified command and will wait for the specified
+event,
+or timeout
+.Fa to
+seconds to occur.
+The
+.Vt bt_devreq
+structure is defined as follows
+.Bd -literal -offset indent
+struct bt_devreq
+{
+ uint16_t opcode;
+ uint8_t event;
+ void *cparam;
+ size_t clen;
+ void *rparam;
+ size_t rlen;
+};
+.Ed
+.Pp
+The
+.Fa opcode
+field specifies the command and is expected to be in the host byte order.
+The
+.Fa cparam
+and
+.Fa clen
+fields specify command parameters data and command parameters data size
+respectively.
+The
+.Fa event
+field specifies which Bluetooth
+.Dv HCI
+event ID the function should wait for, otherwise it should be set to zero.
+The
+.Dv HCI
+Command Complete and Command Status events are enabled by default.
+The
+.Fa rparam
+and
+.Fa rlen
+parameters specify buffer and buffer size respectively where return
+parameters should be placed.
+The
+.Fn bt_devreq
+function temporarily modifies filter on the provided
+.Dv HCI
+socket
+.Fa s .
+The function returns 0 on success, or -1 if an error occurred.
+.Pp
+The
+.Fn bt_devfilter
+controls the local
+.Dv HCI
+filter associated with the socket
+.Fa s ,
+previously obtained with
+.Xr bt_devopen 3 .
+Filtering can be done on packet types, i.e.
+.Dv ACL ,
+.Dv SCO or
+.Dv HCI ,
+command and event packets, and, in addition, on
+.Dv HCI
+event IDs.
+Before applying the
+.Fa new
+filter (if provided) the function will try to obtain the current filter
+from the socket
+.Fa s
+and place it into the
+.Fa old
+parameter (if provided).
+The function returns 0 on success, or -1 if an error occurred.
+.Pp
+The
+.Fn bt_devfilter_pkt_set ,
+.Fn bt_devfilter_pkt_clr
+and
+.Fn bt_devfilter_pkt_tst
+functions can be used to modify and test the
+.Dv HCI
+filter
+.Fa filter .
+The
+.Fa type
+parameter specifies
+.Dv HCI
+packet type.
+.Pp
+The
+.Fn bt_devfilter_evt_set ,
+.Fn bt_devfilter_evt_clr
+and
+.Fn bt_devfilter_evt_tst
+functions can be used to modify and test the
+.Dv HCI
+event filter
+.Fa filter .
+The
+.Fa event
+parameter specifies
+.Dv HCI
+event ID.
+.Pp
+The
+.Fn bt_devinquiry
+function performs Bluetooth inquiry.
+The
+.Fa devname
+parameter specifies which local Bluetooth device should perform an inquiry.
+If not secified, i.e.
+.Dv NULL ,
+then first available device will be used.
+The
+.Fa length
+parameters specifies the total length of an inquiry in seconds.
+If not specified, i.e. 0, default value will be used.
+The
+.Fa num_rsp
+parameter specifies the number of responses that can be received before
+the inquiry is halted.
+If not specified, i.e. 0, default value will be used.
+The
+.Fa ii
+parameter specifies where to place inquiry results.
+On success, the function will return total number of inquiry results,
+will allocate,
+using
+.Xr calloc 3 ,
+buffer to store all the inquiry results and
+will return pointer to the allocated buffer in the
+.Fa ii
+parameter.
+It is up to the caller of the function to dispose of the buffer using
+.Xr free 3
+call.
+The function returns -1 if an error has occurred.
+The
+.Vt bt_devinquiry
+structure is defined as follows
+.Bd -literal -offset indent
+struct bt_devinquiry {
+ bdaddr_t bdaddr;
+ uint8_t pscan_rep_mode;
+ uint8_t pscan_period_mode;
+ uint8_t dev_class[3];
+ uint16_t clock_offset;
+ int8_t rssi;
+ uint8_t data[240];
+};
+.Ed
+.Pp
+The
.Fn bdaddr_same ,
.Fn bdaddr_any
and
@@ -444,6 +721,6 @@ will be bound and connected to the Bluet
.Sh AUTHORS
.An Maksim Yevmenkin Aq m_evmenkin@yahoo.com
.Sh BUGS
-These functions use static data storage;
+Some of those functions use static data storage;
if the data is needed for future use, it should be
copied before any subsequent calls overwrite it.
Modified: stable/7/lib/libbluetooth/bluetooth.h
==============================================================================
--- stable/7/lib/libbluetooth/bluetooth.h Mon May 4 20:48:07 2009 (r191796)
+++ stable/7/lib/libbluetooth/bluetooth.h Mon May 4 20:53:19 2009 (r191797)
@@ -39,6 +39,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -46,6 +47,7 @@
#include
#include
#include
+#include
__BEGIN_DECLS
@@ -129,8 +131,48 @@ struct bt_devinfo
uint8_t _padding[20]; /* leave space for future additions */
};
+struct bt_devreq
+{
+ uint16_t opcode;
+ uint8_t event;
+ void *cparam;
+ size_t clen;
+ void *rparam;
+ size_t rlen;
+};
+
+struct bt_devfilter {
+ bitstr_t bit_decl(packet_mask, 8);
+ bitstr_t bit_decl(event_mask, 256);
+};
+
+struct bt_devinquiry {
+ bdaddr_t bdaddr;
+ uint8_t pscan_rep_mode;
+ uint8_t pscan_period_mode;
+ uint8_t dev_class[3];
+ uint16_t clock_offset;
+ int8_t rssi;
+ uint8_t data[240];
+};
+
typedef int (bt_devenum_cb_t)(int, struct bt_devinfo const *, void *);
+int bt_devopen (char const *devname);
+int bt_devclose(int s);
+int bt_devsend (int s, uint16_t opcode, void *param, size_t plen);
+ssize_t bt_devrecv (int s, void *buf, size_t size, time_t to);
+int bt_devreq (int s, struct bt_devreq *r, time_t to);
+int bt_devfilter(int s, struct bt_devfilter const *new,
+ struct bt_devfilter *old);
+void bt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type);
+void bt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type);
+int bt_devfilter_pkt_tst(struct bt_devfilter const *filter, uint8_t type);
+void bt_devfilter_evt_set(struct bt_devfilter *filter, uint8_t event);
+void bt_devfilter_evt_clr(struct bt_devfilter *filter, uint8_t event);
+int bt_devfilter_evt_tst(struct bt_devfilter const *filter, uint8_t event);
+int bt_devinquiry(char const *devname, time_t length, int num_rsp,
+ struct bt_devinquiry **ii);
int bt_devinfo (struct bt_devinfo *di);
int bt_devenum (bt_devenum_cb_t *cb, void *arg);
Modified: stable/7/lib/libbluetooth/hci.c
==============================================================================
--- stable/7/lib/libbluetooth/hci.c Mon May 4 20:48:07 2009 (r191796)
+++ stable/7/lib/libbluetooth/hci.c Mon May 4 20:53:19 2009 (r191797)
@@ -30,15 +30,505 @@
* $FreeBSD$
*/
+#include
#include
+#include
#include
#include
#include
#include
+#undef MIN
+#define MIN(a, b) (((a) < (b))? (a) : (b))
+
+static int bt_devany_cb(int s, struct bt_devinfo const *di, void *xdevname);
static char * bt_dev2node (char const *devname, char *nodename, int nnlen);
int
+bt_devopen(char const *devname)
+{
+ struct sockaddr_hci ha;
+ bdaddr_t ba;
+ int s;
+
+ if (devname == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ memset(&ha, 0, sizeof(ha));
+ ha.hci_len = sizeof(ha);
+ ha.hci_family = AF_BLUETOOTH;
+
+ if (bt_aton(devname, &ba)) {
+ if (!bt_devname(ha.hci_node, &ba))
+ return (-1);
+ } else if (bt_dev2node(devname, ha.hci_node,
+ sizeof(ha.hci_node)) == NULL) {
+ errno = ENXIO;
+ return (-1);
+ }
+
+ s = socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI);
+ if (s < 0)
+ return (-1);
+
+ if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 ||
+ connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0) {
+ close(s);
+ return (-1);
+ }
+
+ return (s);
+}
+
+int
+bt_devclose(int s)
+{
+ return (close(s));
+}
+
+int
+bt_devsend(int s, uint16_t opcode, void *param, size_t plen)
+{
+ ng_hci_cmd_pkt_t h;
+ struct iovec iv[2];
+ int ivn;
+
+ if ((plen == 0 && param != NULL) ||
+ (plen > 0 && param == NULL) ||
+ plen > UINT8_MAX) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ iv[0].iov_base = &h;
+ iv[0].iov_len = sizeof(h);
+ ivn = 1;
+
+ h.type = NG_HCI_CMD_PKT;
+ h.opcode = htole16(opcode);
+ if (plen > 0) {
+ h.length = plen;
+
+ iv[1].iov_base = param;
+ iv[1].iov_len = plen;
+ ivn = 2;
+ } else
+ h.length = 0;
+
+ while (writev(s, iv, ivn) < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+
+ return (-1);
+ }
+
+ return (0);
+}
+
+ssize_t
+bt_devrecv(int s, void *buf, size_t size, time_t to)
+{
+ ssize_t n;
+
+ if (buf == NULL || size == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (to >= 0) {
+ fd_set rfd;
+ struct timeval tv;
+
+ FD_ZERO(&rfd);
+ FD_SET(s, &rfd);
+
+ tv.tv_sec = to;
+ tv.tv_usec = 0;
+
+ while ((n = select(s + 1, &rfd, NULL, NULL, &tv)) < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+
+ return (-1);
+ }
+
+ if (n == 0) {
+ errno = ETIMEDOUT;
+ return (-1);
+ }
+
+ assert(FD_ISSET(s, &rfd));
+ }
+
+ while ((n = read(s, buf, size)) < 0) {
+ if (errno == EAGAIN || errno == EINTR)
+ continue;
+
+ return (-1);
+ }
+
+ switch (*((uint8_t *) buf)) {
+ case NG_HCI_CMD_PKT: {
+ ng_hci_cmd_pkt_t *h = (ng_hci_cmd_pkt_t *) buf;
+
+ if (n >= sizeof(*h) && n == (sizeof(*h) + h->length))
+ return (n);
+ } break;
+
+ case NG_HCI_ACL_DATA_PKT: {
+ ng_hci_acldata_pkt_t *h = (ng_hci_acldata_pkt_t *) buf;
+
+ if (n >= sizeof(*h) && n == (sizeof(*h) + le16toh(h->length)))
+ return (n);
+ } break;
+
+ case NG_HCI_SCO_DATA_PKT: {
+ ng_hci_scodata_pkt_t *h = (ng_hci_scodata_pkt_t *) buf;
+
+ if (n >= sizeof(*h) && n == (sizeof(*h) + h->length))
+ return (n);
+ } break;
+
+ case NG_HCI_EVENT_PKT: {
+ ng_hci_event_pkt_t *h = (ng_hci_event_pkt_t *) buf;
+
+ if (n >= sizeof(*h) && n == (sizeof(*h) + h->length))
+ return (n);
+ } break;
+ }
+
+ errno = EIO;
+ return (-1);
+}
+
+int
+bt_devreq(int s, struct bt_devreq *r, time_t to)
+{
+ uint8_t buf[320]; /* more than enough */
+ ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) buf;
+ ng_hci_command_compl_ep *cc = (ng_hci_command_compl_ep *)(e+1);
+ ng_hci_command_status_ep *cs = (ng_hci_command_status_ep*)(e+1);
+ struct bt_devfilter old, new;
+ time_t t_end;
+ uint16_t opcode;
+ ssize_t n;
+ int error;
+
+ if (s < 0 || r == NULL || to < 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if ((r->rlen == 0 && r->rparam != NULL) ||
+ (r->rlen > 0 && r->rparam == NULL)) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ memset(&new, 0, sizeof(new));
+ bt_devfilter_pkt_set(&new, NG_HCI_EVENT_PKT);
+ bt_devfilter_evt_set(&new, NG_HCI_EVENT_COMMAND_COMPL);
+ bt_devfilter_evt_set(&new, NG_HCI_EVENT_COMMAND_STATUS);
+ if (r->event != 0)
+ bt_devfilter_evt_set(&new, r->event);
+
+ if (bt_devfilter(s, &new, &old) < 0)
+ return (-1);
+
+ error = 0;
+
+ n = bt_devsend(s, r->opcode, r->cparam, r->clen);
+ if (n < 0) {
+ error = errno;
+ goto out;
+ }
+
+ opcode = htole16(r->opcode);
+ t_end = time(NULL) + to;
+
+ do {
+ to = t_end - time(NULL);
+ if (to < 0)
+ to = 0;
+
+ n = bt_devrecv(s, buf, sizeof(buf), to);
+ if (n < 0) {
+ error = errno;
+ goto out;
+ }
+
+ if (e->type != NG_HCI_EVENT_PKT) {
+ error = EIO;
+ goto out;
+ }
+
+ n -= sizeof(*e);
+
+ switch (e->event) {
+ case NG_HCI_EVENT_COMMAND_COMPL:
+ if (cc->opcode == opcode) {
+ n -= sizeof(*cc);
+
+ if (r->rlen >= n) {
+ r->rlen = n;
+ memcpy(r->rparam, cc + 1, r->rlen);
+ }
+
+ goto out;
+ }
+ break;
+
+ case NG_HCI_EVENT_COMMAND_STATUS:
+ if (cs->opcode == opcode) {
+ if (r->event != NG_HCI_EVENT_COMMAND_STATUS) {
+ if (cs->status != 0) {
+ error = EIO;
+ goto out;
+ }
+ } else {
+ if (r->rlen >= n) {
+ r->rlen = n;
+ memcpy(r->rparam, cs, r->rlen);
+ }
+
+ goto out;
+ }
+ }
+ break;
+
+ default:
+ if (e->event == r->event) {
+ if (r->rlen >= n) {
+ r->rlen = n;
+ memcpy(r->rparam, e + 1, r->rlen);
+ }
+
+ goto out;
+ }
+ break;
+ }
+ } while (to > 0);
+
+ error = ETIMEDOUT;
+out:
+ bt_devfilter(s, &old, NULL);
+
+ if (error != 0) {
+ errno = error;
+ return (-1);
+ }
+
+ return (0);
+}
+
+int
+bt_devfilter(int s, struct bt_devfilter const *new, struct bt_devfilter *old)
+{
+ struct ng_btsocket_hci_raw_filter f;
+ socklen_t len;
+
+ if (new == NULL && old == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (old != NULL) {
+ len = sizeof(f);
+ if (getsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, &f, &len) < 0)
+ return (-1);
+
+ memset(old, 0, sizeof(*old));
+ memcpy(old->packet_mask, &f.packet_mask,
+ MIN(sizeof(old->packet_mask), sizeof(f.packet_mask)));
+ memcpy(old->event_mask, &f.event_mask,
+ MIN(sizeof(old->event_mask), sizeof(f.packet_mask)));
+ }
+
+ if (new != NULL) {
+ memset(&f, 0, sizeof(f));
+ memcpy(&f.packet_mask, new->packet_mask,
+ MIN(sizeof(f.packet_mask), sizeof(new->event_mask)));
+ memcpy(&f.event_mask, new->event_mask,
+ MIN(sizeof(f.event_mask), sizeof(new->event_mask)));
+
+ len = sizeof(f);
+ if (setsockopt(s, SOL_HCI_RAW, SO_HCI_RAW_FILTER, &f, len) < 0)
+ return (-1);
+ }
+
+ return (0);
+}
+
+void
+bt_devfilter_pkt_set(struct bt_devfilter *filter, uint8_t type)
+{
+ bit_set(filter->packet_mask, type - 1);
+}
+
+void
+bt_devfilter_pkt_clr(struct bt_devfilter *filter, uint8_t type)
+{
+ bit_clear(filter->packet_mask, type - 1);
+}
+
+int
+bt_devfilter_pkt_tst(struct bt_devfilter const *filter, uint8_t type)
+{
+ return (bit_test(filter->packet_mask, type - 1));
+}
+
+void
+bt_devfilter_evt_set(struct bt_devfilter *filter, uint8_t event)
+{
+ bit_set(filter->event_mask, event - 1);
+}
+
+void
+bt_devfilter_evt_clr(struct bt_devfilter *filter, uint8_t event)
+{
+ bit_clear(filter->event_mask, event - 1);
+}
+
+int
+bt_devfilter_evt_tst(struct bt_devfilter const *filter, uint8_t event)
+{
+ return (bit_test(filter->event_mask, event - 1));
+}
+
+int
+bt_devinquiry(char const *devname, time_t length, int num_rsp,
+ struct bt_devinquiry **ii)
+{
+ uint8_t buf[320];
+ char _devname[HCI_DEVNAME_SIZE];
+ struct bt_devfilter f;
+ ng_hci_inquiry_cp *cp = (ng_hci_inquiry_cp *) buf;
+ ng_hci_event_pkt_t *e = (ng_hci_event_pkt_t *) buf;
+ ng_hci_inquiry_result_ep *ep = (ng_hci_inquiry_result_ep *)(e+1);
+ ng_hci_inquiry_response *ir;
+ struct bt_devinquiry *i;
+ int s, n;
+ time_t to;
+
+ if (ii == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ if (devname == NULL) {
+ memset(_devname, 0, sizeof(_devname));
+ devname = _devname;
+
+ n = bt_devenum(bt_devany_cb, _devname);
+ if (n <= 0) {
+ if (n == 0)
+ *ii = NULL;
+
+ return (n);
+ }
+ }
+
+ s = bt_devopen(devname);
+ if (s < 0)
+ return (-1);
+
+ if (bt_devfilter(s, NULL, &f) < 0) {
+ bt_devclose(s);
+ return (-1);
+ }
+
+ bt_devfilter_evt_set(&f, NG_HCI_EVENT_INQUIRY_COMPL);
+ bt_devfilter_evt_set(&f, NG_HCI_EVENT_INQUIRY_RESULT);
+
+ if (bt_devfilter(s, &f, NULL) < 0) {
+ bt_devclose(s);
+ return (-1);
+ }
+
+ /* Always use GIAC LAP */
+ cp->lap[0] = 0x33;
+ cp->lap[1] = 0x8b;
+ cp->lap[2] = 0x9e;
+
+ /* Calculate inquire length in 1.28 second units */
+ to = (time_t) ((double) length / 1.28);
+ if (to <= 0)
+ cp->inquiry_length = 4; /* 5.12 seconds */
+ else if (to > 254)
+ cp->inquiry_length = 255; /* 326.40 seconds */
+ else
+ cp->inquiry_length = to + 1;
+
+ to = (time_t)((double) cp->inquiry_length * 1.28) + 1;
+
+ if (num_rsp <= 0 || num_rsp > 255)
+ num_rsp = 8;
+ cp->num_responses = (uint8_t) num_rsp;
+
+ i = *ii = calloc(num_rsp, sizeof(struct bt_devinquiry));
+ if (i == NULL) {
+ bt_devclose(s);
+ errno = ENOMEM;
+ return (-1);
+ }
+
+ if (bt_devsend(s,
+ NG_HCI_OPCODE(NG_HCI_OGF_LINK_CONTROL, NG_HCI_OCF_INQUIRY),
+ cp, sizeof(*cp)) < 0) {
+ free(i);
+ bt_devclose(s);
+ return (-1);
+ }
+
+wait_for_more:
+
+ n = bt_devrecv(s, buf, sizeof(buf), to);
+ if (n < 0) {
+ free(i);
+ bt_devclose(s);
+ return (-1);
+ }
+
+ if (n < sizeof(ng_hci_event_pkt_t)) {
+ free(i);
+ bt_devclose(s);
+ errno = EIO;
+ return (-1);
+ }
+
+ switch (e->event) {
+ case NG_HCI_EVENT_INQUIRY_COMPL:
+ break;
+
+ case NG_HCI_EVENT_INQUIRY_RESULT:
+ ir = (ng_hci_inquiry_response *)(ep + 1);
+
+ for (n = 0; n < MIN(ep->num_responses, num_rsp); n ++) {
+ bdaddr_copy(&i->bdaddr, &ir->bdaddr);
+ i->pscan_rep_mode = ir->page_scan_rep_mode;
+ i->pscan_period_mode = ir->page_scan_period_mode;
+ memcpy(i->dev_class, ir->uclass, sizeof(i->dev_class));
+ i->clock_offset = le16toh(ir->clock_offset);
+
+ ir ++;
+ i ++;
+ num_rsp --;
+ }
+ /* FALLTHROUGH */
+
+ default:
+ goto wait_for_more;
+ /* NOT REACHED */
+ }
+
+ bt_devclose(s);
+
+ return (i - *ii);
+}
+
+int
bt_devinfo(struct bt_devinfo *di)
{
union {
@@ -53,6 +543,7 @@ bt_devinfo(struct bt_devinfo *di)
struct ng_btsocket_hci_raw_node_debug r8;
} rp;
struct sockaddr_hci ha;
+ socklen_t halen;
int s, rval;
if (di == NULL) {
@@ -60,27 +551,14 @@ bt_devinfo(struct bt_devinfo *di)
return (-1);
}
- memset(&ha, 0, sizeof(ha));
- ha.hci_len = sizeof(ha);
- ha.hci_family = AF_BLUETOOTH;
-
- if (bt_aton(di->devname, &rp.r1.bdaddr)) {
- if (!bt_devname(ha.hci_node, &rp.r1.bdaddr))
- return (-1);
- } else if (bt_dev2node(di->devname, ha.hci_node,
- sizeof(ha.hci_node)) == NULL) {
- errno = ENXIO;
- return (-1);
- }
-
- s = socket(PF_BLUETOOTH, SOCK_RAW, BLUETOOTH_PROTO_HCI);
+ s = bt_devopen(di->devname);
if (s < 0)
return (-1);
rval = -1;
- if (bind(s, (struct sockaddr *) &ha, sizeof(ha)) < 0 ||
- connect(s, (struct sockaddr *) &ha, sizeof(ha)) < 0)
+ halen = sizeof(ha);
+ if (getsockname(s, (struct sockaddr *) &ha, &halen) < 0)
goto bad;
strlcpy(di->devname, ha.hci_node, sizeof(di->devname));
@@ -138,7 +616,7 @@ bt_devinfo(struct bt_devinfo *di)
rval = 0;
bad:
- close(s);
+ bt_devclose(s);
return (rval);
}
@@ -205,6 +683,13 @@ bt_devenum(bt_devenum_cb_t cb, void *arg
return (count);
}
+static int
+bt_devany_cb(int s, struct bt_devinfo const *di, void *xdevname)
+{
+ strlcpy((char *) xdevname, di->devname, HCI_DEVNAME_SIZE);
+ return (1);
+}
+
static char *
bt_dev2node(char const *devname, char *nodename, int nnlen)
{
From emax at FreeBSD.org Mon May 4 21:00:45 2009
From: emax at FreeBSD.org (Maksim Yevmenkin)
Date: Mon May 4 21:00:50 2009
Subject: svn commit: r191798 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/syscons
Message-ID: <200905042100.n44L0icR057077@svn.freebsd.org>
Author: emax
Date: Mon May 4 21:00:43 2009
New Revision: 191798
URL: http://svn.freebsd.org/changeset/base/191798
Log:
MFC r190868
Remove obsolete/bogus layering.
Reviewed by: freebsd-current@, freebsd-hackers@
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/syscons/syscons.c
Modified: stable/7/sys/dev/syscons/syscons.c
==============================================================================
--- stable/7/sys/dev/syscons/syscons.c Mon May 4 20:53:19 2009 (r191797)
+++ stable/7/sys/dev/syscons/syscons.c Mon May 4 21:00:43 2009 (r191798)
@@ -184,7 +184,6 @@ static void scshutdown(void *arg, int ho
static u_int scgetc(sc_softc_t *sc, u_int flags);
#define SCGETC_CN 1
#define SCGETC_NONBLOCK 2
-static int sccngetch(int flags);
static void sccnupdate(scr_stat *scp);
static scr_stat *alloc_scp(sc_softc_t *sc, int vty);
static void init_scp(sc_softc_t *sc, int vty, scr_stat *scp);
@@ -1569,12 +1568,6 @@ sc_cnputc(struct consdev *cd, int c)
static int
sc_cngetc(struct consdev *cd)
{
- return sccngetch(SCGETC_NONBLOCK);
-}
-
-static int
-sccngetch(int flags)
-{
static struct fkeytab fkey;
static int fkeycp;
scr_stat *scp;
@@ -1615,7 +1608,7 @@ sccngetch(int flags)
kbd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode);
kbd_poll(scp->sc->kbd, TRUE);
- c = scgetc(scp->sc, SCGETC_CN | flags);
+ c = scgetc(scp->sc, SCGETC_CN | SCGETC_NONBLOCK);
kbd_poll(scp->sc->kbd, FALSE);
scp->kbd_mode = cur_mode;
From jhb at FreeBSD.org Mon May 4 21:04:30 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 4 21:04:43 2009
Subject: svn commit: r191799 - in stable/7/sys: . amd64/include amd64/pci
contrib/pf dev/acpica dev/ath/ath_hal dev/cxgb i386/include i386/pci
Message-ID: <200905042104.n44L4TcW057206@svn.freebsd.org>
Author: jhb
Date: Mon May 4 21:04:29 2009
New Revision: 191799
URL: http://svn.freebsd.org/changeset/base/191799
Log:
MFC: Expand the support for PCI-e memory mapped configuration space access.
Note that unlike in HEAD, this defaults to off and must be explicitly
enabled by setting the loader tunable hw.pci.mcfg=1.
- Add support for the Intel 915GM chipsets by reading the BAR.
- Add parsing of the ACPI MCFG table to discover memory mapped configuration
access on modern machines.
- Port the memory mapped config acess to amd64. On amd64 it uses the direct
map.
- For config requests to busses not listed in ACPI's min/max valid buses,
fall back to using type #1 configuration access instead.
- Add a workaround for some K8 chipsets that do not expose all devices on
bus 0 via MCFG and fall back to type #1 for those devices instead.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/include/pci_cfgreg.h
stable/7/sys/amd64/pci/pci_cfgreg.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/acpica/acpi.c
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/include/pci_cfgreg.h
stable/7/sys/i386/pci/pci_cfgreg.c
Modified: stable/7/sys/amd64/include/pci_cfgreg.h
==============================================================================
--- stable/7/sys/amd64/include/pci_cfgreg.h Mon May 4 21:00:43 2009 (r191798)
+++ stable/7/sys/amd64/include/pci_cfgreg.h Mon May 4 21:04:29 2009 (r191799)
@@ -37,6 +37,7 @@
#define CONF1_ENABLE_MSK1 0x80000001ul
#define CONF1_ENABLE_RES1 0x80000000ul
+int pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus);
int pci_cfgregopen(void);
u_int32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes);
void pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes);
Modified: stable/7/sys/amd64/pci/pci_cfgreg.c
==============================================================================
--- stable/7/sys/amd64/pci/pci_cfgreg.c Mon May 4 21:00:43 2009 (r191798)
+++ stable/7/sys/amd64/pci/pci_cfgreg.c Mon May 4 21:04:29 2009 (r191799)
@@ -33,15 +33,36 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
#include
+#include
+#include
#include
+enum {
+ CFGMECH_NONE = 0,
+ CFGMECH_1,
+ CFGMECH_PCIE,
+};
+
+static uint32_t pci_docfgregread(int bus, int slot, int func, int reg,
+ int bytes);
+static int pciereg_cfgread(int bus, unsigned slot, unsigned func,
+ unsigned reg, unsigned bytes);
+static void pciereg_cfgwrite(int bus, unsigned slot, unsigned func,
+ unsigned reg, int data, unsigned bytes);
static int pcireg_cfgread(int bus, int slot, int func, int reg, int bytes);
static void pcireg_cfgwrite(int bus, int slot, int func, int reg, int data, int bytes);
+static int cfgmech;
+static vm_offset_t pcie_base;
+static int pcie_minbus, pcie_maxbus;
+static uint32_t pcie_badslots;
static struct mtx pcicfg_mtx;
+static int mcfg_enable = 0;
+TUNABLE_INT("hw.pci.mcfg", &mcfg_enable);
/*
* Initialise access to PCI configuration space
@@ -49,15 +70,62 @@ static struct mtx pcicfg_mtx;
int
pci_cfgregopen(void)
{
- static int opened = 0;
+ static int once = 0;
+ uint64_t pciebar;
+ uint16_t did, vid;
+
+ if (!once) {
+ mtx_init(&pcicfg_mtx, "pcicfg", NULL, MTX_SPIN);
+ once = 1;
+ }
- if (opened)
+ if (cfgmech != CFGMECH_NONE)
return (1);
- mtx_init(&pcicfg_mtx, "pcicfg", NULL, MTX_SPIN);
- opened = 1;
+ cfgmech = CFGMECH_1;
+
+ /*
+ * Grope around in the PCI config space to see if this is a
+ * chipset that is capable of doing memory-mapped config cycles.
+ * This also implies that it can do PCIe extended config cycles.
+ */
+
+ /* Check for supported chipsets */
+ vid = pci_cfgregread(0, 0, 0, PCIR_VENDOR, 2);
+ did = pci_cfgregread(0, 0, 0, PCIR_DEVICE, 2);
+ switch (vid) {
+ case 0x8086:
+ switch (did) {
+ case 0x3590:
+ case 0x3592:
+ /* Intel 7520 or 7320 */
+ pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
+ pcie_cfgregopen(pciebar, 0, 255);
+ break;
+ case 0x2580:
+ case 0x2584:
+ case 0x2590:
+ /* Intel 915, 925, or 915GM */
+ pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
+ pcie_cfgregopen(pciebar, 0, 255);
+ break;
+ }
+ }
+
return (1);
}
+static uint32_t
+pci_docfgregread(int bus, int slot, int func, int reg, int bytes)
+{
+
+ if (cfgmech == CFGMECH_PCIE &&
+ (bus >= pcie_minbus && bus <= pcie_maxbus) &&
+ (bus != 0 || !(1 << slot & pcie_badslots)))
+ return (pciereg_cfgread(bus, slot, func, reg, bytes));
+ else
+ return (pcireg_cfgread(bus, slot, func, reg, bytes));
+}
+
/*
* Read configuration space register
*/
@@ -75,12 +143,12 @@ pci_cfgregread(int bus, int slot, int fu
* as an invalid IRQ.
*/
if (reg == PCIR_INTLINE && bytes == 1) {
- line = pcireg_cfgread(bus, slot, func, PCIR_INTLINE, 1);
+ line = pci_docfgregread(bus, slot, func, PCIR_INTLINE, 1);
if (line == 0 || line >= 128)
line = PCI_INVALID_IRQ;
return (line);
}
- return (pcireg_cfgread(bus, slot, func, reg, bytes));
+ return (pci_docfgregread(bus, slot, func, reg, bytes));
}
/*
@@ -90,7 +158,12 @@ void
pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes)
{
- pcireg_cfgwrite(bus, slot, func, reg, data, bytes);
+ if (cfgmech == CFGMECH_PCIE &&
+ (bus >= pcie_minbus && bus <= pcie_maxbus) &&
+ (bus != 0 || !(1 << slot & pcie_badslots)))
+ pciereg_cfgwrite(bus, slot, func, reg, data, bytes);
+ else
+ pcireg_cfgwrite(bus, slot, func, reg, data, bytes);
}
/*
@@ -173,3 +246,106 @@ pcireg_cfgwrite(int bus, int slot, int f
}
mtx_unlock_spin(&pcicfg_mtx);
}
+
+int
+pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
+{
+ uint32_t val1, val2;
+ int slot;
+
+ if (!mcfg_enable)
+ return (0);
+
+ if (minbus != 0)
+ return (0);
+
+ if (bootverbose)
+ printf("PCIe: Memory Mapped configuration base @ 0x%lx\n",
+ base);
+
+ /* XXX: We should make sure this really fits into the direct map. */
+ pcie_base = (vm_offset_t)pmap_mapdev(base, (maxbus + 1) << 20);
+ pcie_minbus = minbus;
+ pcie_maxbus = maxbus;
+ cfgmech = CFGMECH_PCIE;
+
+ /*
+ * On some AMD systems, some of the devices on bus 0 are
+ * inaccessible using memory-mapped PCI config access. Walk
+ * bus 0 looking for such devices. For these devices, we will
+ * fall back to using type 1 config access instead.
+ */
+ if (pci_cfgregopen() != 0) {
+ for (slot = 0; slot < 32; slot++) {
+ val1 = pcireg_cfgread(0, slot, 0, 0, 4);
+ if (val1 == 0xffffffff)
+ continue;
+
+ val2 = pciereg_cfgread(0, slot, 0, 0, 4);
+ if (val2 != val1)
+ pcie_badslots |= (1 << slot);
+ }
+ }
+
+ return (1);
+}
+
+#define PCIE_VADDR(base, reg, bus, slot, func) \
+ ((base) + \
+ ((((bus) & 0xff) << 20) | \
+ (((slot) & 0x1f) << 15) | \
+ (((func) & 0x7) << 12) | \
+ ((reg) & 0xfff)))
+
+static int
+pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
+ unsigned bytes)
+{
+ volatile vm_offset_t va;
+ int data = -1;
+
+ if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
+ func > PCI_FUNCMAX || reg >= 0x1000)
+ return (-1);
+
+ va = PCIE_VADDR(pcie_base, reg, bus, slot, func);
+
+ switch (bytes) {
+ case 4:
+ data = *(volatile uint32_t *)(va);
+ break;
+ case 2:
+ data = *(volatile uint16_t *)(va);
+ break;
+ case 1:
+ data = *(volatile uint8_t *)(va);
+ break;
+ }
+
+ return (data);
+}
+
+static void
+pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
+ unsigned bytes)
+{
+ volatile vm_offset_t va;
+
+ if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
+ func > PCI_FUNCMAX || reg >= 0x1000)
+ return;
+
+ va = PCIE_VADDR(pcie_base, reg, bus, slot, func);
+
+ switch (bytes) {
+ case 4:
+ *(volatile uint32_t *)(va) = data;
+ break;
+ case 2:
+ *(volatile uint16_t *)(va) = data;
+ break;
+ case 1:
+ *(volatile uint8_t *)(va) = data;
+ break;
+ }
+}
Modified: stable/7/sys/dev/acpica/acpi.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi.c Mon May 4 21:00:43 2009 (r191798)
+++ stable/7/sys/dev/acpica/acpi.c Mon May 4 21:04:29 2009 (r191799)
@@ -48,6 +48,9 @@ __FBSDID("$FreeBSD$");
#include
#include
+#if defined(__i386__) || defined(__amd64__)
+#include
+#endif
#include
#include
#include
@@ -153,6 +156,9 @@ static int acpi_child_location_str_metho
char *buf, size_t buflen);
static int acpi_child_pnpinfo_str_method(device_t acdev, device_t child,
char *buf, size_t buflen);
+#if defined(__i386__) || defined(__amd64__)
+static void acpi_enable_pcie(void);
+#endif
static device_method_t acpi_methods[] = {
/* Device interface */
@@ -455,6 +461,11 @@ acpi_attach(device_t dev)
goto out;
}
+#if defined(__i386__) || defined(__amd64__)
+ /* Handle MCFG table if present. */
+ acpi_enable_pcie();
+#endif
+
/* Install the default address space handlers. */
status = AcpiInstallAddressSpaceHandler(ACPI_ROOT_OBJECT,
ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_DEFAULT_HANDLER, NULL, NULL);
@@ -1473,6 +1484,36 @@ acpi_isa_pnp_probe(device_t bus, device_
return_VALUE (result);
}
+#if defined(__i386__) || defined(__amd64__)
+/*
+ * Look for a MCFG table. If it is present, use the settings for
+ * domain (segment) 0 to setup PCI config space access via the memory
+ * map.
+ */
+static void
+acpi_enable_pcie(void)
+{
+ ACPI_TABLE_HEADER *hdr;
+ ACPI_MCFG_ALLOCATION *alloc, *end;
+ ACPI_STATUS status;
+
+ status = AcpiGetTable(ACPI_SIG_MCFG, 1, &hdr);
+ if (ACPI_FAILURE(status))
+ return;
+
+ end = (ACPI_MCFG_ALLOCATION *)((char *)hdr + hdr->Length);
+ alloc = (ACPI_MCFG_ALLOCATION *)((ACPI_TABLE_MCFG *)hdr + 1);
+ while (alloc < end) {
+ if (alloc->PciSegment == 0) {
+ pcie_cfgregopen(alloc->Address, alloc->StartBusNumber,
+ alloc->EndBusNumber);
+ return;
+ }
+ alloc++;
+ }
+}
+#endif
+
/*
* Scan all of the ACPI namespace and attach child devices.
*
Modified: stable/7/sys/i386/include/pci_cfgreg.h
==============================================================================
--- stable/7/sys/i386/include/pci_cfgreg.h Mon May 4 21:00:43 2009 (r191798)
+++ stable/7/sys/i386/include/pci_cfgreg.h Mon May 4 21:04:29 2009 (r191799)
@@ -43,6 +43,7 @@
#define CONF2_ENABLE_CHK 0x0e
#define CONF2_ENABLE_RES 0x0e
+int pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus);
int pci_cfgregopen(void);
u_int32_t pci_cfgregread(int bus, int slot, int func, int reg, int bytes);
void pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes);
Modified: stable/7/sys/i386/pci/pci_cfgreg.c
==============================================================================
--- stable/7/sys/i386/pci/pci_cfgreg.c Mon May 4 21:00:43 2009 (r191798)
+++ stable/7/sys/i386/pci/pci_cfgreg.c Mon May 4 21:04:29 2009 (r191799)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
#include
@@ -75,20 +76,24 @@ enum {
};
static TAILQ_HEAD(pcie_cfg_list, pcie_cfg_elem) pcie_list[MAXCPU];
-static uint32_t pciebar;
+static uint64_t pcie_base;
+static int pcie_minbus, pcie_maxbus;
+static uint32_t pcie_badslots;
static int cfgmech;
static int devmax;
static struct mtx pcicfg_mtx;
+static int mcfg_enable = 0;
+TUNABLE_INT("hw.pci.mcfg", &mcfg_enable);
+static uint32_t pci_docfgregread(int bus, int slot, int func, int reg,
+ int bytes);
static int pcireg_cfgread(int bus, int slot, int func, int reg, int bytes);
static void pcireg_cfgwrite(int bus, int slot, int func, int reg, int data, int bytes);
static int pcireg_cfgopen(void);
-
-static int pciereg_cfgopen(void);
-static int pciereg_cfgread(int bus, int slot, int func, int reg,
- int bytes);
-static void pciereg_cfgwrite(int bus, int slot, int func, int reg,
- int data, int bytes);
+static int pciereg_cfgread(int bus, unsigned slot, unsigned func,
+ unsigned reg, unsigned bytes);
+static void pciereg_cfgwrite(int bus, unsigned slot, unsigned func,
+ unsigned reg, int data, unsigned bytes);
/*
* Some BIOS writers seem to want to ignore the spec and put
@@ -133,14 +138,15 @@ int
pci_cfgregopen(void)
{
static int opened = 0;
+ uint64_t pciebar;
u_int16_t vid, did;
u_int16_t v;
if (opened)
- return(1);
+ return (1);
- if (pcireg_cfgopen() == 0)
- return(0);
+ if (cfgmech == CFGMECH_NONE && pcireg_cfgopen() == 0)
+ return (0);
v = pcibios_get_version();
if (v > 0)
@@ -153,6 +159,9 @@ pci_cfgregopen(void)
if (v >= 0x0210)
pci_pir_open();
+ if (cfgmech == CFGMECH_PCIE)
+ return (1);
+
/*
* Grope around in the PCI config space to see if this is a
* chipset that is capable of doing memory-mapped config cycles.
@@ -162,21 +171,40 @@ pci_cfgregopen(void)
/* Check for supported chipsets */
vid = pci_cfgregread(0, 0, 0, PCIR_VENDOR, 2);
did = pci_cfgregread(0, 0, 0, PCIR_DEVICE, 2);
- if (vid == 0x8086) {
- if (did == 0x3590 || did == 0x3592) {
+ switch (vid) {
+ case 0x8086:
+ switch (did) {
+ case 0x3590:
+ case 0x3592:
/* Intel 7520 or 7320 */
pciebar = pci_cfgregread(0, 0, 0, 0xce, 2) << 16;
- pciereg_cfgopen();
- } else if (did == 0x2580 || did == 0x2584) {
- /* Intel 915 or 925 */
+ pcie_cfgregopen(pciebar, 0, 255);
+ break;
+ case 0x2580:
+ case 0x2584:
+ case 0x2590:
+ /* Intel 915, 925, or 915GM */
pciebar = pci_cfgregread(0, 0, 0, 0x48, 4);
- pciereg_cfgopen();
+ pcie_cfgregopen(pciebar, 0, 255);
+ break;
}
}
return(1);
}
+static uint32_t
+pci_docfgregread(int bus, int slot, int func, int reg, int bytes)
+{
+
+ if (cfgmech == CFGMECH_PCIE &&
+ (bus >= pcie_minbus && bus <= pcie_maxbus) &&
+ (bus != 0 || !(1 << slot & pcie_badslots)))
+ return (pciereg_cfgread(bus, slot, func, reg, bytes));
+ else
+ return (pcireg_cfgread(bus, slot, func, reg, bytes));
+}
+
/*
* Read configuration space register
*/
@@ -191,10 +219,10 @@ pci_cfgregread(int bus, int slot, int fu
* the code uses 255 as an invalid IRQ.
*/
if (reg == PCIR_INTLINE && bytes == 1) {
- line = pcireg_cfgread(bus, slot, func, PCIR_INTLINE, 1);
+ line = pci_docfgregread(bus, slot, func, PCIR_INTLINE, 1);
return (pci_i386_map_intline(line));
}
- return (pcireg_cfgread(bus, slot, func, reg, bytes));
+ return (pci_docfgregread(bus, slot, func, reg, bytes));
}
/*
@@ -204,7 +232,12 @@ void
pci_cfgregwrite(int bus, int slot, int func, int reg, u_int32_t data, int bytes)
{
- pcireg_cfgwrite(bus, slot, func, reg, data, bytes);
+ if (cfgmech == CFGMECH_PCIE &&
+ (bus >= pcie_minbus && bus <= pcie_maxbus) &&
+ (bus != 0 || !(1 << slot & pcie_badslots)))
+ pciereg_cfgwrite(bus, slot, func, reg, data, bytes);
+ else
+ pcireg_cfgwrite(bus, slot, func, reg, data, bytes);
}
/*
@@ -258,6 +291,7 @@ pci_cfgenable(unsigned bus, unsigned slo
&& (unsigned) bytes <= 4
&& (reg & (bytes - 1)) == 0) {
switch (cfgmech) {
+ case CFGMECH_PCIE:
case CFGMECH_1:
outl(CONF1_ADDR_PORT, (1 << 31)
| (bus << 16) | (slot << 11)
@@ -279,6 +313,7 @@ static void
pci_cfgdisable(void)
{
switch (cfgmech) {
+ case CFGMECH_PCIE:
case CFGMECH_1:
/*
* Do nothing for the config mechanism 1 case.
@@ -299,11 +334,6 @@ pcireg_cfgread(int bus, int slot, int fu
int data = -1;
int port;
- if (cfgmech == CFGMECH_PCIE) {
- data = pciereg_cfgread(bus, slot, func, reg, bytes);
- return (data);
- }
-
mtx_lock_spin(&pcicfg_mtx);
port = pci_cfgenable(bus, slot, func, reg, bytes);
if (port != 0) {
@@ -329,11 +359,6 @@ pcireg_cfgwrite(int bus, int slot, int f
{
int port;
- if (cfgmech == CFGMECH_PCIE) {
- pciereg_cfgwrite(bus, slot, func, reg, data, bytes);
- return;
- }
-
mtx_lock_spin(&pcicfg_mtx);
port = pci_cfgenable(bus, slot, func, reg, bytes);
if (port != 0) {
@@ -481,8 +506,8 @@ pcireg_cfgopen(void)
return (cfgmech);
}
-static int
-pciereg_cfgopen(void)
+int
+pcie_cfgregopen(uint64_t base, uint8_t minbus, uint8_t maxbus)
{
struct pcie_cfg_list *pcielist;
struct pcie_cfg_elem *pcie_array, *elem;
@@ -490,10 +515,28 @@ pciereg_cfgopen(void)
struct pcpu *pc;
#endif
vm_offset_t va;
- int i;
+ uint32_t val1, val2;
+ int i, slot;
+ if (!mcfg_enable)
+ return (0);
+
+ if (minbus != 0)
+ return (0);
+
+#ifndef PAE
+ if (base >= 0x100000000) {
+ if (bootverbose)
+ printf(
+ "PCI: Memory Mapped PCI configuration area base 0x%jx too high\n",
+ (uintmax_t)base);
+ return (0);
+ }
+#endif
+
if (bootverbose)
- printf("Setting up PCIe mappings for BAR 0x%x\n", pciebar);
+ printf("PCIe: Memory Mapped configuration base @ 0x%jx\n",
+ (uintmax_t)base);
#ifdef SMP
SLIST_FOREACH(pc, &cpuhead, pc_allcpu)
@@ -525,9 +568,30 @@ pciereg_cfgopen(void)
}
}
-
+ pcie_base = base;
+ pcie_minbus = minbus;
+ pcie_maxbus = maxbus;
cfgmech = CFGMECH_PCIE;
devmax = 32;
+
+ /*
+ * On some AMD systems, some of the devices on bus 0 are
+ * inaccessible using memory-mapped PCI config access. Walk
+ * bus 0 looking for such devices. For these devices, we will
+ * fall back to using type 1 config access instead.
+ */
+ if (pci_cfgregopen() != 0) {
+ for (slot = 0; slot < 32; slot++) {
+ val1 = pcireg_cfgread(0, slot, 0, 0, 4);
+ if (val1 == 0xffffffff)
+ continue;
+
+ val2 = pciereg_cfgread(0, slot, 0, 0, 4);
+ if (val2 != val1)
+ pcie_badslots |= (1 << slot);
+ }
+ }
+
return (1);
}
@@ -574,15 +638,20 @@ pciereg_findelem(vm_paddr_t papage)
}
static int
-pciereg_cfgread(int bus, int slot, int func, int reg, int bytes)
+pciereg_cfgread(int bus, unsigned slot, unsigned func, unsigned reg,
+ unsigned bytes)
{
struct pcie_cfg_elem *elem;
volatile vm_offset_t va;
vm_paddr_t pa, papage;
- int data;
+ int data = -1;
+
+ if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
+ func > PCI_FUNCMAX || reg >= 0x1000 || bytes > 4 || bytes == 3)
+ return (-1);
critical_enter();
- pa = PCIE_PADDR(pciebar, reg, bus, slot, func);
+ pa = PCIE_PADDR(pcie_base, reg, bus, slot, func);
papage = pa & ~PAGE_MASK;
elem = pciereg_findelem(papage);
va = elem->vapage | (pa & PAGE_MASK);
@@ -597,8 +666,6 @@ pciereg_cfgread(int bus, int slot, int f
case 1:
data = *(volatile uint8_t *)(va);
break;
- default:
- panic("pciereg_cfgread: invalid width");
}
critical_exit();
@@ -606,14 +673,19 @@ pciereg_cfgread(int bus, int slot, int f
}
static void
-pciereg_cfgwrite(int bus, int slot, int func, int reg, int data, int bytes)
+pciereg_cfgwrite(int bus, unsigned slot, unsigned func, unsigned reg, int data,
+ unsigned bytes)
{
struct pcie_cfg_elem *elem;
volatile vm_offset_t va;
vm_paddr_t pa, papage;
+ if (bus < pcie_minbus || bus > pcie_maxbus || slot >= 32 ||
+ func > PCI_FUNCMAX || reg >= 0x1000)
+ return;
+
critical_enter();
- pa = PCIE_PADDR(pciebar, reg, bus, slot, func);
+ pa = PCIE_PADDR(pcie_base, reg, bus, slot, func);
papage = pa & ~PAGE_MASK;
elem = pciereg_findelem(papage);
va = elem->vapage | (pa & PAGE_MASK);
@@ -628,8 +700,6 @@ pciereg_cfgwrite(int bus, int slot, int
case 1:
*(volatile uint8_t *)(va) = data;
break;
- default:
- panic("pciereg_cfgwrite: invalid width");
}
critical_exit();
From emax at FreeBSD.org Mon May 4 21:13:07 2009
From: emax at FreeBSD.org (Maksim Yevmenkin)
Date: Mon May 4 21:13:19 2009
Subject: svn commit: r191800 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/kbd
Message-ID: <200905042113.n44LD6gt057440@svn.freebsd.org>
Author: emax
Date: Mon May 4 21:13:06 2009
New Revision: 191800
URL: http://svn.freebsd.org/changeset/base/191800
Log:
MFC r190869
Introduce KB_POLLED flag to struct keyboard's kb_flags field.
Reviewed by: freebsd-current@, freebsd-hackers@
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/kbd/kbdreg.h
Modified: stable/7/sys/dev/kbd/kbdreg.h
==============================================================================
--- stable/7/sys/dev/kbd/kbdreg.h Mon May 4 21:04:29 2009 (r191799)
+++ stable/7/sys/dev/kbd/kbdreg.h Mon May 4 21:13:06 2009 (r191800)
@@ -60,6 +60,7 @@ struct keyboard {
#define KB_INITIALIZED (1 << 19) /* device initialized */
#define KB_REGISTERED (1 << 20) /* device registered to kbdio */
#define KB_BUSY (1 << 21) /* device used by a client */
+#define KB_POLLED (1 << 22) /* device is polled */
int kb_active; /* 0: inactive */
void *kb_token; /* id of the current client */
keyboard_callback_t kb_callback;/* callback function */
@@ -107,6 +108,9 @@ struct keyboard {
#define KBD_IS_BUSY(k) ((k)->kb_flags & KB_BUSY)
#define KBD_BUSY(k) ((k)->kb_flags |= KB_BUSY)
#define KBD_UNBUSY(k) ((k)->kb_flags &= ~KB_BUSY)
+#define KBD_IS_POLLED(k) ((k)->kb_flags & KB_POLLED)
+#define KBD_POLL(k) ((k)->kb_flags |= KB_POLLED)
+#define KBD_UNPOLL(k) ((k)->kb_flags &= ~KB_POLLED)
#define KBD_IS_ACTIVE(k) ((k)->kb_active)
#define KBD_ACTIVATE(k) (++(k)->kb_active)
#define KBD_DEACTIVATE(k) (--(k)->kb_active)
From jhb at FreeBSD.org Mon May 4 21:58:33 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 4 21:58:45 2009
Subject: svn commit: r191801 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905042158.n44LwWjX058513@svn.freebsd.org>
Author: jhb
Date: Mon May 4 21:58:32 2009
New Revision: 191801
URL: http://svn.freebsd.org/changeset/base/191801
Log:
MFC: When a file lookup fails due to encountering a doomed vnode from a
forced unmount, consistently return ENOENT rather than EBADF.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/vfs_cache.c
stable/7/sys/kern/vfs_lookup.c
Modified: stable/7/sys/kern/vfs_cache.c
==============================================================================
--- stable/7/sys/kern/vfs_cache.c Mon May 4 21:13:06 2009 (r191800)
+++ stable/7/sys/kern/vfs_cache.c Mon May 4 21:58:32 2009 (r191801)
@@ -318,7 +318,7 @@ cache_zap(ncp)
* (negative cacheing), a status of ENOENT is returned. If the lookup
* fails, a status of zero is returned. If the directory vnode is
* recycled out from under us due to a forced unmount, a status of
- * EBADF is returned.
+ * ENOENT is returned.
*
* vpp is locked and ref'd on return. If we're looking up DOTDOT, dvp is
* unlocked. If we're looking up . an extra ref is taken, but the lock is
@@ -466,7 +466,7 @@ success:
/* forced unmount */
vrele(*vpp);
*vpp = NULL;
- return (EBADF);
+ return (ENOENT);
}
} else
vn_lock(*vpp, LK_DOWNGRADE | LK_RETRY, td);
@@ -939,7 +939,7 @@ vn_fullpath1(struct thread *td, struct v
while (vp != rdir && vp != rootvnode) {
if (vp->v_vflag & VV_ROOT) {
if (vp->v_iflag & VI_DOOMED) { /* forced unmount */
- error = EBADF;
+ error = ENOENT;
break;
}
vp = vp->v_mount->mnt_vnodecovered;
Modified: stable/7/sys/kern/vfs_lookup.c
==============================================================================
--- stable/7/sys/kern/vfs_lookup.c Mon May 4 21:13:06 2009 (r191800)
+++ stable/7/sys/kern/vfs_lookup.c Mon May 4 21:58:32 2009 (r191801)
@@ -532,7 +532,7 @@ dirloop:
if ((dp->v_vflag & VV_ROOT) == 0)
break;
if (dp->v_iflag & VI_DOOMED) { /* forced unmount */
- error = EBADF;
+ error = ENOENT;
goto bad;
}
tdp = dp;
@@ -691,9 +691,11 @@ unionlookup:
*ndp->ni_next == '/')) {
cnp->cn_flags |= ISSYMLINK;
if (dp->v_iflag & VI_DOOMED) {
- /* We can't know whether the directory was mounted with
- * NOSYMFOLLOW, so we can't follow safely. */
- error = EBADF;
+ /*
+ * We can't know whether the directory was mounted with
+ * NOSYMFOLLOW, so we can't follow safely.
+ */
+ error = ENOENT;
goto bad2;
}
if (dp->v_mount->mnt_flag & MNT_NOSYMFOLLOW) {
From dchagin at FreeBSD.org Tue May 5 03:49:31 2009
From: dchagin at FreeBSD.org (Dmitry Chagin)
Date: Tue May 5 03:49:48 2009
Subject: svn commit: r191804 - in stable/7/sys: . amd64/linux32 contrib/pf
dev/ath/ath_hal dev/cxgb i386/linux
Message-ID: <200905050349.n453nUCR066177@svn.freebsd.org>
Author: dchagin
Date: Tue May 5 03:49:30 2009
New Revision: 191804
URL: http://svn.freebsd.org/changeset/base/191804
Log:
Merge r178257 (jkim) from HEAD to stable/7:
Add stubs for syscalls introduced in Linux 2.6.17 kernel.
Some GNU libc version started using them before 2.6.17
was officially out.
Approved by: kib (mentor)
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/linux32/linux32_dummy.c
stable/7/sys/amd64/linux32/syscalls.master
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/linux/linux_dummy.c
stable/7/sys/i386/linux/syscalls.master
Modified: stable/7/sys/amd64/linux32/linux32_dummy.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_dummy.c Tue May 5 01:13:20 2009 (r191803)
+++ stable/7/sys/amd64/linux32/linux32_dummy.c Tue May 5 03:49:30 2009 (r191804)
@@ -111,6 +111,12 @@ DUMMY(faccessat);
DUMMY(pselect6);
DUMMY(ppoll);
DUMMY(unshare);
+DUMMY(set_robust_list);
+DUMMY(get_robust_list);
+DUMMY(splice);
+DUMMY(sync_file_range);
+DUMMY(tee);
+DUMMY(vmsplice);
#define DUMMY_XATTR(s) \
int \
Modified: stable/7/sys/amd64/linux32/syscalls.master
==============================================================================
--- stable/7/sys/amd64/linux32/syscalls.master Tue May 5 01:13:20 2009 (r191803)
+++ stable/7/sys/amd64/linux32/syscalls.master Tue May 5 03:49:30 2009 (r191804)
@@ -482,3 +482,9 @@
308 AUE_NULL STD { int linux_pselect6(void); }
309 AUE_NULL STD { int linux_ppoll(void); }
310 AUE_NULL STD { int linux_unshare(void); }
+311 AUE_NULL STD { int linux_set_robust_list(void); }
+312 AUE_NULL STD { int linux_get_robust_list(void); }
+313 AUE_NULL STD { int linux_splice(void); }
+314 AUE_NULL STD { int linux_sync_file_range(void); }
+315 AUE_NULL STD { int linux_tee(void); }
+316 AUE_NULL STD { int linux_vmsplice(void); }
Modified: stable/7/sys/i386/linux/linux_dummy.c
==============================================================================
--- stable/7/sys/i386/linux/linux_dummy.c Tue May 5 01:13:20 2009 (r191803)
+++ stable/7/sys/i386/linux/linux_dummy.c Tue May 5 03:49:30 2009 (r191804)
@@ -102,6 +102,12 @@ DUMMY(faccessat);
DUMMY(pselect6);
DUMMY(ppoll);
DUMMY(unshare);
+DUMMY(set_robust_list);
+DUMMY(get_robust_list);
+DUMMY(splice);
+DUMMY(sync_file_range);
+DUMMY(tee);
+DUMMY(vmsplice);
#define DUMMY_XATTR(s) \
int \
Modified: stable/7/sys/i386/linux/syscalls.master
==============================================================================
--- stable/7/sys/i386/linux/syscalls.master Tue May 5 01:13:20 2009 (r191803)
+++ stable/7/sys/i386/linux/syscalls.master Tue May 5 03:49:30 2009 (r191804)
@@ -492,3 +492,9 @@
308 AUE_NULL STD { int linux_pselect6(void); }
309 AUE_NULL STD { int linux_ppoll(void); }
310 AUE_NULL STD { int linux_unshare(void); }
+311 AUE_NULL STD { int linux_set_robust_list(void); }
+312 AUE_NULL STD { int linux_get_robust_list(void); }
+313 AUE_NULL STD { int linux_splice(void); }
+314 AUE_NULL STD { int linux_sync_file_range(void); }
+315 AUE_NULL STD { int linux_tee(void); }
+316 AUE_NULL STD { int linux_vmsplice(void); }
From dchagin at FreeBSD.org Tue May 5 03:51:42 2009
From: dchagin at FreeBSD.org (Dmitry Chagin)
Date: Tue May 5 03:51:54 2009
Subject: svn commit: r191805 - in stable/7/sys: amd64/linux32 i386/linux
Message-ID: <200905050351.n453pfbQ066263@svn.freebsd.org>
Author: dchagin
Date: Tue May 5 03:51:41 2009
New Revision: 191805
URL: http://svn.freebsd.org/changeset/base/191805
Log:
Regenerate syscall table after r191804.
Approved by: kib (mentor)
Modified:
stable/7/sys/amd64/linux32/linux32_proto.h
stable/7/sys/amd64/linux32/linux32_syscall.h
stable/7/sys/amd64/linux32/linux32_sysent.c
stable/7/sys/i386/linux/linux_proto.h
stable/7/sys/i386/linux/linux_syscall.h
stable/7/sys/i386/linux/linux_sysent.c
Modified: stable/7/sys/amd64/linux32/linux32_proto.h
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_proto.h Tue May 5 03:49:30 2009 (r191804)
+++ stable/7/sys/amd64/linux32/linux32_proto.h Tue May 5 03:51:41 2009 (r191805)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 184075 2008-10-20 11:15:57Z kib
+ * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -936,6 +936,24 @@ struct linux_ppoll_args {
struct linux_unshare_args {
register_t dummy;
};
+struct linux_set_robust_list_args {
+ register_t dummy;
+};
+struct linux_get_robust_list_args {
+ register_t dummy;
+};
+struct linux_splice_args {
+ register_t dummy;
+};
+struct linux_sync_file_range_args {
+ register_t dummy;
+};
+struct linux_tee_args {
+ register_t dummy;
+};
+struct linux_vmsplice_args {
+ register_t dummy;
+};
#define nosys linux_nosys
int linux_fork(struct thread *, struct linux_fork_args *);
int linux_open(struct thread *, struct linux_open_args *);
@@ -1172,6 +1190,12 @@ int linux_faccessat(struct thread *, str
int linux_pselect6(struct thread *, struct linux_pselect6_args *);
int linux_ppoll(struct thread *, struct linux_ppoll_args *);
int linux_unshare(struct thread *, struct linux_unshare_args *);
+int linux_set_robust_list(struct thread *, struct linux_set_robust_list_args *);
+int linux_get_robust_list(struct thread *, struct linux_get_robust_list_args *);
+int linux_splice(struct thread *, struct linux_splice_args *);
+int linux_sync_file_range(struct thread *, struct linux_sync_file_range_args *);
+int linux_tee(struct thread *, struct linux_tee_args *);
+int linux_vmsplice(struct thread *, struct linux_vmsplice_args *);
#ifdef COMPAT_43
@@ -1428,6 +1452,12 @@ int linux_unshare(struct thread *, struc
#define LINUX_SYS_AUE_linux_pselect6 AUE_NULL
#define LINUX_SYS_AUE_linux_ppoll AUE_NULL
#define LINUX_SYS_AUE_linux_unshare AUE_NULL
+#define LINUX_SYS_AUE_linux_set_robust_list AUE_NULL
+#define LINUX_SYS_AUE_linux_get_robust_list AUE_NULL
+#define LINUX_SYS_AUE_linux_splice AUE_NULL
+#define LINUX_SYS_AUE_linux_sync_file_range AUE_NULL
+#define LINUX_SYS_AUE_linux_tee AUE_NULL
+#define LINUX_SYS_AUE_linux_vmsplice AUE_NULL
#undef PAD_
#undef PADL_
Modified: stable/7/sys/amd64/linux32/linux32_syscall.h
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_syscall.h Tue May 5 03:49:30 2009 (r191804)
+++ stable/7/sys/amd64/linux32/linux32_syscall.h Tue May 5 03:51:41 2009 (r191805)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 184075 2008-10-20 11:15:57Z kib
+ * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
*/
#define LINUX_SYS_exit 1
@@ -283,4 +283,10 @@
#define LINUX_SYS_linux_pselect6 308
#define LINUX_SYS_linux_ppoll 309
#define LINUX_SYS_linux_unshare 310
-#define LINUX_SYS_MAXSYSCALL 311
+#define LINUX_SYS_linux_set_robust_list 311
+#define LINUX_SYS_linux_get_robust_list 312
+#define LINUX_SYS_linux_splice 313
+#define LINUX_SYS_linux_sync_file_range 314
+#define LINUX_SYS_linux_tee 315
+#define LINUX_SYS_linux_vmsplice 316
+#define LINUX_SYS_MAXSYSCALL 317
Modified: stable/7/sys/amd64/linux32/linux32_sysent.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysent.c Tue May 5 03:49:30 2009 (r191804)
+++ stable/7/sys/amd64/linux32/linux32_sysent.c Tue May 5 03:51:41 2009 (r191805)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 184075 2008-10-20 11:15:57Z kib
+ * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
*/
#include "opt_compat.h"
@@ -330,4 +330,10 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 }, /* 308 = linux_pselect6 */
{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 }, /* 309 = linux_ppoll */
{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 }, /* 310 = linux_unshare */
+ { 0, (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */
+ { 0, (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */
+ { 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0 }, /* 313 = linux_splice */
+ { 0, (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0 }, /* 314 = linux_sync_file_range */
+ { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0 }, /* 315 = linux_tee */
+ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0 }, /* 316 = linux_vmsplice */
};
Modified: stable/7/sys/i386/linux/linux_proto.h
==============================================================================
--- stable/7/sys/i386/linux/linux_proto.h Tue May 5 03:49:30 2009 (r191804)
+++ stable/7/sys/i386/linux/linux_proto.h Tue May 5 03:51:41 2009 (r191805)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 184075 2008-10-20 11:15:57Z kib
+ * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -955,6 +955,24 @@ struct linux_ppoll_args {
struct linux_unshare_args {
register_t dummy;
};
+struct linux_set_robust_list_args {
+ register_t dummy;
+};
+struct linux_get_robust_list_args {
+ register_t dummy;
+};
+struct linux_splice_args {
+ register_t dummy;
+};
+struct linux_sync_file_range_args {
+ register_t dummy;
+};
+struct linux_tee_args {
+ register_t dummy;
+};
+struct linux_vmsplice_args {
+ register_t dummy;
+};
#define nosys linux_nosys
int linux_fork(struct thread *, struct linux_fork_args *);
int linux_open(struct thread *, struct linux_open_args *);
@@ -1192,6 +1210,12 @@ int linux_faccessat(struct thread *, str
int linux_pselect6(struct thread *, struct linux_pselect6_args *);
int linux_ppoll(struct thread *, struct linux_ppoll_args *);
int linux_unshare(struct thread *, struct linux_unshare_args *);
+int linux_set_robust_list(struct thread *, struct linux_set_robust_list_args *);
+int linux_get_robust_list(struct thread *, struct linux_get_robust_list_args *);
+int linux_splice(struct thread *, struct linux_splice_args *);
+int linux_sync_file_range(struct thread *, struct linux_sync_file_range_args *);
+int linux_tee(struct thread *, struct linux_tee_args *);
+int linux_vmsplice(struct thread *, struct linux_vmsplice_args *);
#ifdef COMPAT_43
@@ -1449,6 +1473,12 @@ int linux_unshare(struct thread *, struc
#define LINUX_SYS_AUE_linux_pselect6 AUE_NULL
#define LINUX_SYS_AUE_linux_ppoll AUE_NULL
#define LINUX_SYS_AUE_linux_unshare AUE_NULL
+#define LINUX_SYS_AUE_linux_set_robust_list AUE_NULL
+#define LINUX_SYS_AUE_linux_get_robust_list AUE_NULL
+#define LINUX_SYS_AUE_linux_splice AUE_NULL
+#define LINUX_SYS_AUE_linux_sync_file_range AUE_NULL
+#define LINUX_SYS_AUE_linux_tee AUE_NULL
+#define LINUX_SYS_AUE_linux_vmsplice AUE_NULL
#undef PAD_
#undef PADL_
Modified: stable/7/sys/i386/linux/linux_syscall.h
==============================================================================
--- stable/7/sys/i386/linux/linux_syscall.h Tue May 5 03:49:30 2009 (r191804)
+++ stable/7/sys/i386/linux/linux_syscall.h Tue May 5 03:51:41 2009 (r191805)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 184075 2008-10-20 11:15:57Z kib
+ * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
*/
#define LINUX_SYS_exit 1
@@ -290,4 +290,10 @@
#define LINUX_SYS_linux_pselect6 308
#define LINUX_SYS_linux_ppoll 309
#define LINUX_SYS_linux_unshare 310
-#define LINUX_SYS_MAXSYSCALL 311
+#define LINUX_SYS_linux_set_robust_list 311
+#define LINUX_SYS_linux_get_robust_list 312
+#define LINUX_SYS_linux_splice 313
+#define LINUX_SYS_linux_sync_file_range 314
+#define LINUX_SYS_linux_tee 315
+#define LINUX_SYS_linux_vmsplice 316
+#define LINUX_SYS_MAXSYSCALL 317
Modified: stable/7/sys/i386/linux/linux_sysent.c
==============================================================================
--- stable/7/sys/i386/linux/linux_sysent.c Tue May 5 03:49:30 2009 (r191804)
+++ stable/7/sys/i386/linux/linux_sysent.c Tue May 5 03:51:41 2009 (r191805)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 184075 2008-10-20 11:15:57Z kib
+ * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
*/
#include
@@ -329,4 +329,10 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 }, /* 308 = linux_pselect6 */
{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 }, /* 309 = linux_ppoll */
{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 }, /* 310 = linux_unshare */
+ { 0, (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */
+ { 0, (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */
+ { 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0 }, /* 313 = linux_splice */
+ { 0, (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0 }, /* 314 = linux_sync_file_range */
+ { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0 }, /* 315 = linux_tee */
+ { 0, (sy_call_t *)linux_vmsplice, AUE_NULL, NULL, 0, 0 }, /* 316 = linux_vmsplice */
};
From edwin at FreeBSD.org Tue May 5 07:05:14 2009
From: edwin at FreeBSD.org (Edwin Groothuis)
Date: Tue May 5 07:05:25 2009
Subject: svn commit: r191807 - stable/7/share/zoneinfo
Message-ID: <200905050705.n4575Dtk070167@svn.freebsd.org>
Author: edwin
Date: Tue May 5 07:05:13 2009
New Revision: 191807
URL: http://svn.freebsd.org/changeset/base/191807
Log:
MFC of tzdata2009g:
Egypt will have DST till the end of September the coming years.
Modified:
stable/7/share/zoneinfo/ (props changed)
stable/7/share/zoneinfo/africa
Modified: stable/7/share/zoneinfo/africa
==============================================================================
--- stable/7/share/zoneinfo/africa Tue May 5 05:49:08 2009 (r191806)
+++ stable/7/share/zoneinfo/africa Tue May 5 07:05:13 2009 (r191807)
@@ -1,4 +1,4 @@
-# @(#)africa 8.18
+# @(#)africa 8.19
#
# This data is by no means authoritative; if you think you know better,
@@ -236,7 +236,46 @@ Rule Egypt 2007 only - Sep Thu>=1 23:00s
# unless discontinued, next DST may end Thursday 28 August 2008.
# From Paul Eggert (2007-08-17):
# For lack of better info, assume the new rule is last Thursday in August.
-Rule Egypt 2008 max - Aug lastThu 23:00s 0 -
+
+# From Petr Machata (2009-04-06):
+# The following appeared in Red Hat bugzilla[1] (edited):
+#
+# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
+# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 21:59:59 2009 UTC =3D Thu =
+# Apr 23
+# > 23:59:59 2009 EET isdst=3D0 gmtoff=3D7200
+# > /usr/share/zoneinfo/Africa/Cairo Thu Apr 23 22:00:00 2009 UTC =3D Fri =
+# Apr 24
+# > 01:00:00 2009 EEST isdst=3D1 gmtoff=3D10800
+# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 20:59:59 2009 UTC =3D Thu =
+# Aug 27
+# > 23:59:59 2009 EEST isdst=3D1 gmtoff=3D10800
+# > /usr/share/zoneinfo/Africa/Cairo Thu Aug 27 21:00:00 2009 UTC =3D Thu =
+# Aug 27
+# > 23:00:00 2009 EET isdst=3D0 gmtoff=3D7200
+#
+# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
+# :59)
+# > http://support.microsoft.com/kb/958729/
+#
+# timeanddate[2] and another site I've found[3] also support that.
+#
+# [1]
+# https://bugzilla.redhat.com/show_bug.cgi?id=3D492263
+#
+# [2]
+# http://www.timeanddate.com/worldclock/clockchange.html?n=3D53
+#
+# [3]
+# http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
+#
+
+# From Arthur David Olson (2009-04-20):
+# In 2009 (and for the next several years), Ramadan ends before the fourth
+# Thursday in September; Egypt is expected to revert to the last Thursday
+# in September.
+Rule Egypt 2008 only - Aug lastThu 23:00s 0 -
+Rule Egypt 2009 max - Sep lastThu 23:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Cairo 2:05:00 - LMT 1900 Oct
From kib at FreeBSD.org Tue May 5 09:08:38 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 09:08:49 2009
Subject: svn commit: r191809 - in stable/7/sys: . amd64/amd64 arm/arm
contrib/pf dev/ath/ath_hal dev/cxgb i386/i386 ia64/ia64
Message-ID: <200905050908.n4598bHc072718@svn.freebsd.org>
Author: kib
Date: Tue May 5 09:08:37 2009
New Revision: 191809
URL: http://svn.freebsd.org/changeset/base/191809
Log:
MFC r191011:
The bus_dmamap_load_uio(9) shall use pmap of the thread recorded in the
uio_td to extract pages from, instead of unconditionally use kernel
pmap.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/amd64/busdma_machdep.c
stable/7/sys/arm/arm/busdma_machdep.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/i386/busdma_machdep.c
stable/7/sys/ia64/ia64/busdma_machdep.c
Modified: stable/7/sys/amd64/amd64/busdma_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/busdma_machdep.c Tue May 5 08:30:38 2009 (r191808)
+++ stable/7/sys/amd64/amd64/busdma_machdep.c Tue May 5 09:08:37 2009 (r191809)
@@ -602,7 +602,10 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
- paddr = pmap_kextract(vaddr);
+ if (pmap)
+ paddr = pmap_extract(pmap, vaddr);
+ else
+ paddr = pmap_kextract(vaddr);
if (run_filter(dmat, paddr) != 0)
map->pagesneeded++;
vaddr += PAGE_SIZE;
Modified: stable/7/sys/arm/arm/busdma_machdep.c
==============================================================================
--- stable/7/sys/arm/arm/busdma_machdep.c Tue May 5 08:30:38 2009 (r191808)
+++ stable/7/sys/arm/arm/busdma_machdep.c Tue May 5 09:08:37 2009 (r191809)
@@ -663,8 +663,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
}
static int
-_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
- bus_size_t buflen, int flags)
+_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
+ void *buf, bus_size_t buflen, int flags)
{
vm_offset_t vaddr;
vm_offset_t vendaddr;
@@ -683,7 +683,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
- paddr = pmap_kextract(vaddr);
+ if (pmap != NULL)
+ paddr = pmap_extract(pmap, vaddr);
+ else
+ paddr = pmap_kextract(vaddr);
if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
run_filter(dmat, paddr) != 0)
map->pagesneeded++;
@@ -739,7 +742,8 @@ bus_dmamap_load_buffer(bus_dma_tag_t dma
bmask = ~(dmat->boundary - 1);
if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
- error = _bus_dmamap_count_pages(dmat, map, buf, buflen, flags);
+ error = _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen,
+ flags);
if (error)
return (error);
}
Modified: stable/7/sys/i386/i386/busdma_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/busdma_machdep.c Tue May 5 08:30:38 2009 (r191808)
+++ stable/7/sys/i386/i386/busdma_machdep.c Tue May 5 09:08:37 2009 (r191809)
@@ -141,8 +141,8 @@ static bus_addr_t add_bounce_page(bus_dm
vm_offset_t vaddr, bus_size_t size);
static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage);
int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
-int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
- bus_size_t buflen, int flags);
+int _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
+ void *buf, bus_size_t buflen, int flags);
/*
* Return true if a match is made.
@@ -568,8 +568,8 @@ bus_dmamem_free(bus_dma_tag_t dmat, void
}
int
-_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
- bus_size_t buflen, int flags)
+_bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap,
+ void *buf, bus_size_t buflen, int flags)
{
vm_offset_t vaddr;
vm_offset_t vendaddr;
@@ -589,7 +589,10 @@ _bus_dmamap_count_pages(bus_dma_tag_t dm
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
- paddr = pmap_kextract(vaddr);
+ if (pmap)
+ paddr = pmap_extract(pmap, vaddr);
+ else
+ paddr = pmap_kextract(vaddr);
if (((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) &&
run_filter(dmat, paddr) != 0) {
map->pagesneeded++;
@@ -651,7 +654,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
map = &nobounce_dmamap;
if ((dmat->flags & BUS_DMA_COULD_BOUNCE) != 0) {
- error = _bus_dmamap_count_pages(dmat, map, buf, buflen, flags);
+ error = _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen, flags);
if (error)
return (error);
}
Modified: stable/7/sys/ia64/ia64/busdma_machdep.c
==============================================================================
--- stable/7/sys/ia64/ia64/busdma_machdep.c Tue May 5 08:30:38 2009 (r191808)
+++ stable/7/sys/ia64/ia64/busdma_machdep.c Tue May 5 09:08:37 2009 (r191809)
@@ -527,7 +527,10 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dm
vendaddr = (vm_offset_t)buf + buflen;
while (vaddr < vendaddr) {
- paddr = pmap_kextract(vaddr);
+ if (pmap != NULL)
+ paddr = pmap_extract(pmap, vaddr);
+ else
+ paddr = pmap_kextract(vaddr);
if (run_filter(dmat, paddr, 0) != 0)
map->pagesneeded++;
vaddr += PAGE_SIZE;
From kib at FreeBSD.org Tue May 5 09:16:58 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 09:17:14 2009
Subject: svn commit: r191810 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb vm
Message-ID: <200905050916.n459GvbI072939@svn.freebsd.org>
Author: kib
Date: Tue May 5 09:16:57 2009
New Revision: 191810
URL: http://svn.freebsd.org/changeset/base/191810
Log:
MFC r190886:
When vm_map_wire(9) is allowed to skip holes in the wired region, skip
the mappings without any of read and execution rights, in particular,
the PROT_NONE entries. This makes mlockall(2) work for the process
address space that has such mappings.
Since protection mode of the entry may change between setting
MAP_ENTRY_IN_TRANSITION and final pass over the region that records
the wire status of the entries, allocate new map entry flag
MAP_ENTRY_WIRE_SKIPPED to mark the skipped PROT_NONE entries.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/vm/vm_map.c
stable/7/sys/vm/vm_map.h
Modified: stable/7/sys/vm/vm_map.c
==============================================================================
--- stable/7/sys/vm/vm_map.c Tue May 5 09:08:37 2009 (r191809)
+++ stable/7/sys/vm/vm_map.c Tue May 5 09:16:57 2009 (r191810)
@@ -2059,6 +2059,16 @@ vm_map_wire(vm_map_t map, vm_offset_t st
*
*/
if (entry->wired_count == 0) {
+ if ((entry->protection & (VM_PROT_READ|VM_PROT_EXECUTE))
+ == 0) {
+ if ((flags & VM_MAP_WIRE_HOLESOK) == 0) {
+ end = entry->end;
+ rv = KERN_INVALID_ADDRESS;
+ goto done;
+ }
+ entry->eflags |= MAP_ENTRY_WIRE_SKIPPED;
+ goto next_entry;
+ }
entry->wired_count++;
saved_start = entry->start;
saved_end = entry->end;
@@ -2116,6 +2126,7 @@ vm_map_wire(vm_map_t map, vm_offset_t st
* Check the map for holes in the specified region.
* If VM_MAP_WIRE_HOLESOK was specified, skip this check.
*/
+ next_entry:
if (((flags & VM_MAP_WIRE_HOLESOK) == 0) &&
(entry->end < end && (entry->next == &map->header ||
entry->next->start > entry->end))) {
@@ -2137,6 +2148,8 @@ done:
}
entry = first_entry;
while (entry != &map->header && entry->start < end) {
+ if ((entry->eflags & MAP_ENTRY_WIRE_SKIPPED) != 0)
+ goto next_entry_done;
if (rv == KERN_SUCCESS) {
if (user_wire)
entry->eflags |= MAP_ENTRY_USER_WIRED;
@@ -2159,9 +2172,10 @@ done:
entry->object.vm_object->type == OBJT_DEVICE);
}
}
+ next_entry_done:
KASSERT(entry->eflags & MAP_ENTRY_IN_TRANSITION,
("vm_map_wire: in-transition flag missing"));
- entry->eflags &= ~MAP_ENTRY_IN_TRANSITION;
+ entry->eflags &= ~(MAP_ENTRY_IN_TRANSITION|MAP_ENTRY_WIRE_SKIPPED);
if (entry->eflags & MAP_ENTRY_NEEDS_WAKEUP) {
entry->eflags &= ~MAP_ENTRY_NEEDS_WAKEUP;
need_wakeup = TRUE;
Modified: stable/7/sys/vm/vm_map.h
==============================================================================
--- stable/7/sys/vm/vm_map.h Tue May 5 09:08:37 2009 (r191809)
+++ stable/7/sys/vm/vm_map.h Tue May 5 09:16:57 2009 (r191810)
@@ -138,6 +138,8 @@ struct vm_map_entry {
#define MAP_ENTRY_GROWS_DOWN 0x1000 /* Top-down stacks */
#define MAP_ENTRY_GROWS_UP 0x2000 /* Bottom-up stacks */
+#define MAP_ENTRY_WIRE_SKIPPED 0x4000
+
#ifdef _KERNEL
static __inline u_char
vm_map_entry_behavior(vm_map_entry_t entry)
From kib at FreeBSD.org Tue May 5 09:20:09 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 09:20:16 2009
Subject: svn commit: r191811 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb ufs/ffs
Message-ID: <200905050920.n459K7Tg073052@svn.freebsd.org>
Author: kib
Date: Tue May 5 09:20:07 2009
New Revision: 191811
URL: http://svn.freebsd.org/changeset/base/191811
Log:
MFC r190690:
When removing or renaming snaphost, do not delve into request_cleanup().
The later may need blocks from the underlying device that belongs
to normal files, that should not be locked while snap lock is held.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/ufs/ffs/ffs_softdep.c
Modified: stable/7/sys/ufs/ffs/ffs_softdep.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_softdep.c Tue May 5 09:16:57 2009 (r191810)
+++ stable/7/sys/ufs/ffs/ffs_softdep.c Tue May 5 09:20:07 2009 (r191811)
@@ -3315,7 +3315,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirre
* the number of freefile and freeblks structures.
*/
ACQUIRE_LOCK(&lk);
- if (num_dirrem > max_softdeps / 2)
+ if (!(ip->i_flags & SF_SNAPSHOT) && num_dirrem > max_softdeps / 2)
(void) request_cleanup(ITOV(dp)->v_mount, FLUSH_REMOVE);
num_dirrem += 1;
FREE_LOCK(&lk);
From kib at FreeBSD.org Tue May 5 09:24:21 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 09:24:37 2009
Subject: svn commit: r191812 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905050924.n459OK2f073193@svn.freebsd.org>
Author: kib
Date: Tue May 5 09:24:20 2009
New Revision: 191812
URL: http://svn.freebsd.org/changeset/base/191812
Log:
MFC r191313:
On the exit of the child process which parent either set SA_NOCLDWAIT
or ignored SIGCHLD, unconditionally wake up the parent instead of doing
this only when the child is a last child.
MFC r191319:
Fix typo.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/kern_exit.c
Modified: stable/7/sys/kern/kern_exit.c
==============================================================================
--- stable/7/sys/kern/kern_exit.c Tue May 5 09:20:07 2009 (r191811)
+++ stable/7/sys/kern/kern_exit.c Tue May 5 09:24:20 2009 (r191812)
@@ -511,13 +511,13 @@ retry:
proc_reparent(p, initproc);
p->p_sigparent = SIGCHLD;
PROC_LOCK(p->p_pptr);
+
/*
- * If this was the last child of our parent, notify
- * parent, so in case he was wait(2)ing, he will
+ * Notify parent, so in case he was wait(2)ing or
+ * executing waitpid(2) with our pid, he will
* continue.
*/
- if (LIST_EMPTY(&pp->p_children))
- wakeup(pp);
+ wakeup(pp);
} else
mtx_unlock(&p->p_pptr->p_sigacts->ps_mtx);
From kib at FreeBSD.org Tue May 5 10:34:44 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 10:34:57 2009
Subject: svn commit: r191813 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb gnu/fs/xfs/FreeBSD kern sys ufs/ffs
Message-ID: <200905051034.n45AYild074736@svn.freebsd.org>
Author: kib
Date: Tue May 5 10:34:43 2009
New Revision: 191813
URL: http://svn.freebsd.org/changeset/base/191813
Log:
MFC r189878:
Fix two issues with bufdaemon, often causing the processes to hang in
the "nbufkv" sleep.
Do not retry request for the new block from ffs_bufwrite() when write is done
from bufdaemon and there is a buffer shortage.
In getnewbuf(), help bufdaemon to flush dirty buffers owned by the vnode
locked by curthread.
For MFC, default value for sysctl vfs.flushbufqtarget is set to -1,
disabling the helpers. The TDP_BUFNEED flag value from HEAD conflicts
with TDP_UPCALLING KSE bit, so it is moved to the end of allocated bits.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c
stable/7/sys/kern/vfs_bio.c
stable/7/sys/sys/buf.h
stable/7/sys/sys/proc.h
stable/7/sys/ufs/ffs/ffs_vfsops.c
Modified: stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c
==============================================================================
--- stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c Tue May 5 09:24:20 2009 (r191812)
+++ stable/7/sys/gnu/fs/xfs/FreeBSD/xfs_buf.c Tue May 5 10:34:43 2009 (r191813)
@@ -81,7 +81,7 @@ xfs_buf_get_empty(size_t size, xfs_buft
{
struct buf *bp;
- bp = geteblk(0);
+ bp = geteblk(0, 0);
if (bp != NULL) {
bp->b_bufsize = size;
bp->b_bcount = size;
@@ -101,7 +101,7 @@ xfs_buf_get_noaddr(size_t len, xfs_bufta
if (len >= MAXPHYS)
return (NULL);
- bp = geteblk(len);
+ bp = geteblk(len, 0);
if (bp != NULL) {
KASSERT(BUF_REFCNT(bp) == 1,
("xfs_buf_get_empty: bp %p not locked",bp));
Modified: stable/7/sys/kern/vfs_bio.c
==============================================================================
--- stable/7/sys/kern/vfs_bio.c Tue May 5 09:24:20 2009 (r191812)
+++ stable/7/sys/kern/vfs_bio.c Tue May 5 10:34:43 2009 (r191813)
@@ -105,7 +105,8 @@ static void vfs_setdirty_locked_object(s
static void vfs_vmio_release(struct buf *bp);
static int vfs_bio_clcheck(struct vnode *vp, int size,
daddr_t lblkno, daddr_t blkno);
-static int flushbufqueues(int, int);
+static int buf_do_flush(struct vnode *vp);
+static int flushbufqueues(struct vnode *, int, int);
static void buf_daemon(void);
static void bremfreel(struct buf *bp);
@@ -187,6 +188,9 @@ SYSCTL_INT(_vfs, OID_AUTO, getnewbufcall
static int getnewbufrestarts;
SYSCTL_INT(_vfs, OID_AUTO, getnewbufrestarts, CTLFLAG_RW, &getnewbufrestarts, 0,
"Number of times getnewbuf has had to restart a buffer aquisition");
+static int flushbufqtarget = -1;
+SYSCTL_INT(_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW, &flushbufqtarget, 0,
+ "Amount of work to do in flushbufqueues when helping bufdaemon");
/*
* Wakeup point for bufdaemon, as well as indicator of whether it is already
@@ -258,6 +262,7 @@ static struct mtx bpinlock;
#define QUEUE_DIRTY_GIANT 3 /* B_DELWRI buffers that need giant */
#define QUEUE_EMPTYKVA 4 /* empty buffer headers w/KVA assignment */
#define QUEUE_EMPTY 5 /* empty buffer headers */
+#define QUEUE_SENTINEL 1024 /* not an queue index, but mark for sentinel */
/* Queues for free buffers with various properties */
static TAILQ_HEAD(bqueues, buf) bufqueues[BUFFER_QUEUES] = { { 0 } };
@@ -1707,21 +1712,23 @@ vfs_bio_awrite(struct buf *bp)
*/
static struct buf *
-getnewbuf(int slpflag, int slptimeo, int size, int maxsize)
+getnewbuf(struct vnode *vp, int slpflag, int slptimeo, int size, int maxsize,
+ int gbflags)
{
+ struct thread *td;
struct buf *bp;
struct buf *nbp;
int defrag = 0;
int nqindex;
static int flushingbufs;
+ td = curthread;
/*
* We can't afford to block since we might be holding a vnode lock,
* which may prevent system daemons from running. We deal with
* low-memory situations by proactively returning memory and running
* async I/O rather then sync I/O.
*/
-
atomic_add_int(&getnewbufcalls, 1);
atomic_subtract_int(&getnewbufrestarts, 1);
restart:
@@ -1953,8 +1960,9 @@ restart:
*/
if (bp == NULL) {
- int flags;
+ int flags, norunbuf;
char *waitmsg;
+ int fl;
if (defrag) {
flags = VFS_BIO_NEED_BUFSPACE;
@@ -1972,9 +1980,35 @@ restart:
mtx_unlock(&bqlock);
bd_speedup(); /* heeeelp */
+ if (gbflags & GB_NOWAIT_BD)
+ return (NULL);
mtx_lock(&nblock);
while (needsbuffer & flags) {
+ if (vp != NULL && (td->td_pflags & TDP_BUFNEED) == 0) {
+ mtx_unlock(&nblock);
+ /*
+ * getblk() is called with a vnode
+ * locked, and some majority of the
+ * dirty buffers may as well belong to
+ * the vnode. Flushing the buffers
+ * there would make a progress that
+ * cannot be achieved by the
+ * buf_daemon, that cannot lock the
+ * vnode.
+ */
+ norunbuf = ~(TDP_BUFNEED | TDP_NORUNNINGBUF) |
+ (td->td_pflags & TDP_NORUNNINGBUF);
+ /* play bufdaemon */
+ td->td_pflags |= TDP_BUFNEED | TDP_NORUNNINGBUF;
+ fl = buf_do_flush(vp);
+ td->td_pflags &= norunbuf;
+ mtx_lock(&nblock);
+ if (fl != 0)
+ continue;
+ if ((needsbuffer & flags) == 0)
+ break;
+ }
if (msleep(&needsbuffer, &nblock,
(PRIBIO + 4) | slpflag, waitmsg, slptimeo)) {
mtx_unlock(&nblock);
@@ -2043,6 +2077,35 @@ static struct kproc_desc buf_kp = {
};
SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp);
+static int
+buf_do_flush(struct vnode *vp)
+{
+ int flushed;
+
+ flushed = flushbufqueues(vp, QUEUE_DIRTY, 0);
+ /* The list empty check here is slightly racy */
+ if (!TAILQ_EMPTY(&bufqueues[QUEUE_DIRTY_GIANT])) {
+ mtx_lock(&Giant);
+ flushed += flushbufqueues(vp, QUEUE_DIRTY_GIANT, 0);
+ mtx_unlock(&Giant);
+ }
+ if (flushed == 0) {
+ /*
+ * Could not find any buffers without rollback
+ * dependencies, so just write the first one
+ * in the hopes of eventually making progress.
+ */
+ flushbufqueues(vp, QUEUE_DIRTY, 1);
+ if (!TAILQ_EMPTY(
+ &bufqueues[QUEUE_DIRTY_GIANT])) {
+ mtx_lock(&Giant);
+ flushbufqueues(vp, QUEUE_DIRTY_GIANT, 1);
+ mtx_unlock(&Giant);
+ }
+ }
+ return (flushed);
+}
+
static void
buf_daemon()
{
@@ -2056,7 +2119,7 @@ buf_daemon()
/*
* This process is allowed to take the buffer cache to the limit
*/
- curthread->td_pflags |= TDP_NORUNNINGBUF;
+ curthread->td_pflags |= TDP_NORUNNINGBUF | TDP_BUFNEED;
mtx_lock(&bdlock);
for (;;) {
bd_request = 0;
@@ -2071,30 +2134,8 @@ buf_daemon()
* normally would so they can run in parallel with our drain.
*/
while (numdirtybuffers > lodirtybuffers) {
- int flushed;
-
- flushed = flushbufqueues(QUEUE_DIRTY, 0);
- /* The list empty check here is slightly racy */
- if (!TAILQ_EMPTY(&bufqueues[QUEUE_DIRTY_GIANT])) {
- mtx_lock(&Giant);
- flushed += flushbufqueues(QUEUE_DIRTY_GIANT, 0);
- mtx_unlock(&Giant);
- }
- if (flushed == 0) {
- /*
- * Could not find any buffers without rollback
- * dependencies, so just write the first one
- * in the hopes of eventually making progress.
- */
- flushbufqueues(QUEUE_DIRTY, 1);
- if (!TAILQ_EMPTY(
- &bufqueues[QUEUE_DIRTY_GIANT])) {
- mtx_lock(&Giant);
- flushbufqueues(QUEUE_DIRTY_GIANT, 1);
- mtx_unlock(&Giant);
- }
+ if (buf_do_flush(NULL) == 0)
break;
- }
uio_yield();
}
@@ -2140,7 +2181,7 @@ SYSCTL_INT(_vfs, OID_AUTO, flushwithdeps
0, "Number of buffers flushed with dependecies that require rollbacks");
static int
-flushbufqueues(int queue, int flushdeps)
+flushbufqueues(struct vnode *lvp, int queue, int flushdeps)
{
struct thread *td = curthread;
struct buf sentinel;
@@ -2151,20 +2192,37 @@ flushbufqueues(int queue, int flushdeps)
int flushed;
int target;
- target = numdirtybuffers - lodirtybuffers;
- if (flushdeps && target > 2)
- target /= 2;
+ if (lvp == NULL) {
+ target = numdirtybuffers - lodirtybuffers;
+ if (flushdeps && target > 2)
+ target /= 2;
+ } else
+ target = flushbufqtarget;
flushed = 0;
bp = NULL;
+ sentinel.b_qindex = QUEUE_SENTINEL;
mtx_lock(&bqlock);
- TAILQ_INSERT_TAIL(&bufqueues[queue], &sentinel, b_freelist);
+ TAILQ_INSERT_HEAD(&bufqueues[queue], &sentinel, b_freelist);
while (flushed != target) {
- bp = TAILQ_FIRST(&bufqueues[queue]);
- if (bp == &sentinel)
+ bp = TAILQ_NEXT(&sentinel, b_freelist);
+ if (bp != NULL) {
+ TAILQ_REMOVE(&bufqueues[queue], &sentinel, b_freelist);
+ TAILQ_INSERT_AFTER(&bufqueues[queue], bp, &sentinel,
+ b_freelist);
+ } else
break;
- TAILQ_REMOVE(&bufqueues[queue], bp, b_freelist);
- TAILQ_INSERT_TAIL(&bufqueues[queue], bp, b_freelist);
-
+ /*
+ * Skip sentinels inserted by other invocations of the
+ * flushbufqueues(), taking care to not reorder them.
+ */
+ if (bp->b_qindex == QUEUE_SENTINEL)
+ continue;
+ /*
+ * Only flush the buffers that belong to the
+ * vnode locked by the curthread.
+ */
+ if (lvp != NULL && bp->b_vp != lvp)
+ continue;
if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL) != 0)
continue;
if (bp->b_pin_count > 0) {
@@ -2212,16 +2270,28 @@ flushbufqueues(int queue, int flushdeps)
BUF_UNLOCK(bp);
continue;
}
- if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT, td) == 0) {
+ if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT | LK_CANRECURSE,
+ td) == 0) {
mtx_unlock(&bqlock);
CTR3(KTR_BUF, "flushbufqueue(%p) vp %p flags %X",
bp, bp->b_vp, bp->b_flags);
- vfs_bio_awrite(bp);
+ if (curproc == bufdaemonproc)
+ vfs_bio_awrite(bp);
+ else {
+ bremfree(bp);
+ bwrite(bp);
+ }
vn_finished_write(mp);
VOP_UNLOCK(vp, 0, td);
flushwithdeps += hasdeps;
flushed++;
- waitrunningbufspace();
+
+ /*
+ * Sleeping on runningbufspace while holding
+ * vnode lock leads to deadlock.
+ */
+ if (curproc == bufdaemonproc)
+ waitrunningbufspace();
numdirtywakeup((lodirtybuffers + hidirtybuffers) / 2);
mtx_lock(&bqlock);
continue;
@@ -2603,7 +2673,7 @@ loop:
maxsize = vmio ? size + (offset & PAGE_MASK) : size;
maxsize = imax(maxsize, bsize);
- bp = getnewbuf(slpflag, slptimeo, size, maxsize);
+ bp = getnewbuf(vp, slpflag, slptimeo, size, maxsize, flags);
if (bp == NULL) {
if (slpflag || slptimeo)
return NULL;
@@ -2678,14 +2748,17 @@ loop:
* set to B_INVAL.
*/
struct buf *
-geteblk(int size)
+geteblk(int size, int flags)
{
struct buf *bp;
int maxsize;
maxsize = (size + BKVAMASK) & ~BKVAMASK;
- while ((bp = getnewbuf(0, 0, size, maxsize)) == 0)
- continue;
+ while ((bp = getnewbuf(NULL, 0, 0, size, maxsize, flags)) == NULL) {
+ if ((flags & GB_NOWAIT_BD) &&
+ (curthread->td_pflags & TDP_BUFNEED) != 0)
+ return (NULL);
+ }
allocbuf(bp, size);
bp->b_flags |= B_INVAL; /* b_dep cleared by getnewbuf() */
KASSERT(BUF_REFCNT(bp) == 1, ("geteblk: bp %p not locked",bp));
Modified: stable/7/sys/sys/buf.h
==============================================================================
--- stable/7/sys/sys/buf.h Tue May 5 09:24:20 2009 (r191812)
+++ stable/7/sys/sys/buf.h Tue May 5 10:34:43 2009 (r191813)
@@ -475,6 +475,7 @@ buf_countdeps(struct buf *bp, int i)
*/
#define GB_LOCK_NOWAIT 0x0001 /* Fail if we block on a buf lock. */
#define GB_NOCREAT 0x0002 /* Don't create a buf if not found. */
+#define GB_NOWAIT_BD 0x0004 /* Do not wait for bufdaemon */
#ifdef _KERNEL
extern int nbuf; /* The number of buffer headers */
@@ -519,7 +520,7 @@ struct buf * getpbuf(int *);
struct buf *incore(struct bufobj *, daddr_t);
struct buf *gbincore(struct bufobj *, daddr_t);
struct buf *getblk(struct vnode *, daddr_t, int, int, int, int);
-struct buf *geteblk(int);
+struct buf *geteblk(int, int);
int bufwait(struct buf *);
int bufwrite(struct buf *);
void bufdone(struct buf *);
Modified: stable/7/sys/sys/proc.h
==============================================================================
--- stable/7/sys/sys/proc.h Tue May 5 09:24:20 2009 (r191812)
+++ stable/7/sys/sys/proc.h Tue May 5 10:34:43 2009 (r191813)
@@ -380,6 +380,7 @@ do { \
#define TDP_INBDFLUSH 0x00100000 /* Already in BO_BDFLUSH, do not recurse */
#define TDP_IGNSUSP 0x00800000 /* Permission to ignore the MNTK_SUSPEND* */
#define TDP_AUDITREC 0x01000000 /* Audit record pending on thread */
+#define TDP_BUFNEED 0x02000000 /* Do not recurse into the buf flush */
/*
* Reasons that the current thread can not be run yet.
Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_vfsops.c Tue May 5 09:24:20 2009 (r191812)
+++ stable/7/sys/ufs/ffs/ffs_vfsops.c Tue May 5 10:34:43 2009 (r191813)
@@ -1842,7 +1842,9 @@ ffs_bufwrite(struct buf *bp)
("bufwrite: needs chained iodone (%p)", bp->b_iodone));
/* get a new block */
- newbp = geteblk(bp->b_bufsize);
+ newbp = geteblk(bp->b_bufsize, GB_NOWAIT_BD);
+ if (newbp == NULL)
+ goto normal_write;
/*
* set it to be identical to the old block. We have to
@@ -1882,6 +1884,7 @@ ffs_bufwrite(struct buf *bp)
}
/* Let the normal bufwrite do the rest for us */
+normal_write:
return (bufwrite(bp));
}
From kib at FreeBSD.org Tue May 5 10:43:15 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 10:43:27 2009
Subject: svn commit: r191814 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905051043.n45AhE9E078962@svn.freebsd.org>
Author: kib
Date: Tue May 5 10:43:14 2009
New Revision: 191814
URL: http://svn.freebsd.org/changeset/base/191814
Log:
MFC r191135:
Export the number of times bufdaemon got help from the normal threads.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/vfs_bio.c
Modified: stable/7/sys/kern/vfs_bio.c
==============================================================================
--- stable/7/sys/kern/vfs_bio.c Tue May 5 10:34:43 2009 (r191813)
+++ stable/7/sys/kern/vfs_bio.c Tue May 5 10:43:14 2009 (r191814)
@@ -191,6 +191,9 @@ SYSCTL_INT(_vfs, OID_AUTO, getnewbufrest
static int flushbufqtarget = -1;
SYSCTL_INT(_vfs, OID_AUTO, flushbufqtarget, CTLFLAG_RW, &flushbufqtarget, 0,
"Amount of work to do in flushbufqueues when helping bufdaemon");
+static long notbufdflashes;
+SYSCTL_LONG(_vfs, OID_AUTO, notbufdflashes, CTLFLAG_RD, ¬bufdflashes, 0,
+ "Number of dirty buffer flushes done by the bufdaemon helpers");
/*
* Wakeup point for bufdaemon, as well as indicator of whether it is already
@@ -2280,6 +2283,7 @@ flushbufqueues(struct vnode *lvp, int qu
else {
bremfree(bp);
bwrite(bp);
+ notbufdflashes++;
}
vn_finished_write(mp);
VOP_UNLOCK(vp, 0, td);
From kib at FreeBSD.org Tue May 5 10:46:50 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Tue May 5 10:47:02 2009
Subject: svn commit: r191815 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905051046.n45Akn7l079094@svn.freebsd.org>
Author: kib
Date: Tue May 5 10:46:49 2009
New Revision: 191815
URL: http://svn.freebsd.org/changeset/base/191815
Log:
MFC r191136:
In flushbufqueues(), do not allocate sentinel buffer on the stack,
struct buf is large. Use sleeping malloc(9) call, and zero the allocated
buf as a debugging feature.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/vfs_bio.c
Modified: stable/7/sys/kern/vfs_bio.c
==============================================================================
--- stable/7/sys/kern/vfs_bio.c Tue May 5 10:43:14 2009 (r191814)
+++ stable/7/sys/kern/vfs_bio.c Tue May 5 10:46:49 2009 (r191815)
@@ -2187,7 +2187,7 @@ static int
flushbufqueues(struct vnode *lvp, int queue, int flushdeps)
{
struct thread *td = curthread;
- struct buf sentinel;
+ struct buf *sentinel;
struct vnode *vp;
struct mount *mp;
struct buf *bp;
@@ -2203,14 +2203,15 @@ flushbufqueues(struct vnode *lvp, int qu
target = flushbufqtarget;
flushed = 0;
bp = NULL;
- sentinel.b_qindex = QUEUE_SENTINEL;
+ sentinel = malloc(sizeof(struct buf), M_TEMP, M_WAITOK | M_ZERO);
+ sentinel->b_qindex = QUEUE_SENTINEL;
mtx_lock(&bqlock);
- TAILQ_INSERT_HEAD(&bufqueues[queue], &sentinel, b_freelist);
+ TAILQ_INSERT_HEAD(&bufqueues[queue], sentinel, b_freelist);
while (flushed != target) {
- bp = TAILQ_NEXT(&sentinel, b_freelist);
+ bp = TAILQ_NEXT(sentinel, b_freelist);
if (bp != NULL) {
- TAILQ_REMOVE(&bufqueues[queue], &sentinel, b_freelist);
- TAILQ_INSERT_AFTER(&bufqueues[queue], bp, &sentinel,
+ TAILQ_REMOVE(&bufqueues[queue], sentinel, b_freelist);
+ TAILQ_INSERT_AFTER(&bufqueues[queue], bp, sentinel,
b_freelist);
} else
break;
@@ -2303,8 +2304,9 @@ flushbufqueues(struct vnode *lvp, int qu
vn_finished_write(mp);
BUF_UNLOCK(bp);
}
- TAILQ_REMOVE(&bufqueues[queue], &sentinel, b_freelist);
+ TAILQ_REMOVE(&bufqueues[queue], sentinel, b_freelist);
mtx_unlock(&bqlock);
+ free(sentinel, M_TEMP);
return (flushed);
}
From jhb at FreeBSD.org Tue May 5 14:46:19 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue May 5 14:46:26 2009
Subject: svn commit: r191819 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/pci
Message-ID: <200905051446.n45EkIhZ084178@svn.freebsd.org>
Author: jhb
Date: Tue May 5 14:46:18 2009
New Revision: 191819
URL: http://svn.freebsd.org/changeset/base/191819
Log:
MFC: Sync with HEAD
- Proxy PCI MSI/MSI-X requests and bus interrupt requests for child devices
instead of passing them through directly. This allows child devices to use
MSI/MSI-X interrupts.
- Proxy PCI VPD requests.
- Proxy bus resource allocation requests to allow multiple child devices to
share access to a BAR.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/pci/vga_pci.c
Modified: stable/7/sys/dev/pci/vga_pci.c
==============================================================================
--- stable/7/sys/dev/pci/vga_pci.c Tue May 5 13:48:53 2009 (r191818)
+++ stable/7/sys/dev/pci/vga_pci.c Tue May 5 14:46:18 2009 (r191819)
@@ -42,10 +42,22 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
#include
#include
+struct vga_resource {
+ struct resource *vr_res;
+ int vr_refs;
+};
+
+struct vga_pci_softc {
+ device_t vga_msi_child; /* Child driver using MSI. */
+ struct vga_resource vga_res[PCIR_MAX_BAR_0 + 1];
+};
+
static int
vga_pci_probe(device_t dev)
{
@@ -106,11 +118,47 @@ vga_pci_write_ivar(device_t dev, device_
return (EINVAL);
}
+static int
+vga_pci_setup_intr(device_t dev, device_t child, struct resource *irq,
+ int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg,
+ void **cookiep)
+{
+ return (BUS_SETUP_INTR(device_get_parent(dev), dev, irq, flags,
+ filter, intr, arg, cookiep));
+}
+
+static int
+vga_pci_teardown_intr(device_t dev, device_t child, struct resource *irq,
+ void *cookie)
+{
+ return (BUS_TEARDOWN_INTR(device_get_parent(dev), dev, irq, cookie));
+}
+
static struct resource *
vga_pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
u_long start, u_long end, u_long count, u_int flags)
{
+ struct vga_pci_softc *sc;
+ int bar;
+ switch (type) {
+ case SYS_RES_MEMORY:
+ case SYS_RES_IOPORT:
+ /*
+ * For BARs, we cache the resource so that we only allocate it
+ * from the PCI bus once.
+ */
+ bar = PCI_RID2BAR(*rid);
+ if (bar < 0 || bar > PCIR_MAX_BAR_0)
+ return (NULL);
+ sc = device_get_softc(dev);
+ if (sc->vga_res[bar].vr_res == NULL)
+ sc->vga_res[bar].vr_res = bus_alloc_resource(dev, type,
+ rid, start, end, count, flags);
+ if (sc->vga_res[bar].vr_res != NULL)
+ sc->vga_res[bar].vr_refs++;
+ return (sc->vga_res[bar].vr_res);
+ }
return (bus_alloc_resource(dev, type, rid, start, end, count, flags));
}
@@ -118,6 +166,37 @@ static int
vga_pci_release_resource(device_t dev, device_t child, int type, int rid,
struct resource *r)
{
+ struct vga_pci_softc *sc;
+ int bar, error;
+
+ switch (type) {
+ case SYS_RES_MEMORY:
+ case SYS_RES_IOPORT:
+ /*
+ * For BARs, we release the resource from the PCI bus
+ * when the last child reference goes away.
+ */
+ bar = PCI_RID2BAR(rid);
+ if (bar < 0 || bar > PCIR_MAX_BAR_0)
+ return (EINVAL);
+ sc = device_get_softc(dev);
+ if (sc->vga_res[bar].vr_res == NULL)
+ return (EINVAL);
+ KASSERT(sc->vga_res[bar].vr_res == r,
+ ("vga_pci resource mismatch"));
+ if (sc->vga_res[bar].vr_refs > 1) {
+ sc->vga_res[bar].vr_refs--;
+ return (0);
+ }
+ KASSERT(sc->vga_res[bar].vr_refs > 0,
+ ("vga_pci resource reference count underflow"));
+ error = bus_release_resource(dev, type, rid, r);
+ if (error == 0) {
+ sc->vga_res[bar].vr_res = NULL;
+ sc->vga_res[bar].vr_refs = 0;
+ }
+ return (error);
+ }
return (bus_release_resource(dev, type, rid, r));
}
@@ -176,6 +255,21 @@ vga_pci_disable_io(device_t dev, device_
}
static int
+vga_pci_get_vpd_ident(device_t dev, device_t child, const char **identptr)
+{
+
+ return (pci_get_vpd_ident(dev, identptr));
+}
+
+static int
+vga_pci_get_vpd_readonly(device_t dev, device_t child, const char *kw,
+ const char **vptr)
+{
+
+ return (pci_get_vpd_readonly(dev, kw, vptr));
+}
+
+static int
vga_pci_set_powerstate(device_t dev, device_t child, int state)
{
@@ -210,6 +304,77 @@ vga_pci_find_extcap(device_t dev, device
return (pci_find_extcap(dev, capability, capreg));
}
+static int
+vga_pci_alloc_msi(device_t dev, device_t child, int *count)
+{
+ struct vga_pci_softc *sc;
+ int error;
+
+ sc = device_get_softc(dev);
+ if (sc->vga_msi_child != NULL)
+ return (EBUSY);
+ error = pci_alloc_msi(dev, count);
+ if (error == 0)
+ sc->vga_msi_child = child;
+ return (error);
+}
+
+static int
+vga_pci_alloc_msix(device_t dev, device_t child, int *count)
+{
+ struct vga_pci_softc *sc;
+ int error;
+
+ sc = device_get_softc(dev);
+ if (sc->vga_msi_child != NULL)
+ return (EBUSY);
+ error = pci_alloc_msix(dev, count);
+ if (error == 0)
+ sc->vga_msi_child = child;
+ return (error);
+}
+
+static int
+vga_pci_remap_msix(device_t dev, device_t child, int count,
+ const u_int *vectors)
+{
+ struct vga_pci_softc *sc;
+
+ sc = device_get_softc(dev);
+ if (sc->vga_msi_child != child)
+ return (ENXIO);
+ return (pci_remap_msix(dev, count, vectors));
+}
+
+static int
+vga_pci_release_msi(device_t dev, device_t child)
+{
+ struct vga_pci_softc *sc;
+ int error;
+
+ sc = device_get_softc(dev);
+ if (sc->vga_msi_child != child)
+ return (ENXIO);
+ error = pci_release_msi(dev);
+ if (error == 0)
+ sc->vga_msi_child = NULL;
+ return (error);
+}
+
+static int
+vga_pci_msi_count(device_t dev, device_t child)
+{
+
+ return (pci_msi_count(dev));
+}
+
+static int
+vga_pci_msix_count(device_t dev, device_t child)
+{
+
+ return (pci_msix_count(dev));
+}
+
static device_method_t vga_pci_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, vga_pci_probe),
@@ -221,8 +386,8 @@ static device_method_t vga_pci_methods[]
/* Bus interface */
DEVMETHOD(bus_read_ivar, vga_pci_read_ivar),
DEVMETHOD(bus_write_ivar, vga_pci_write_ivar),
- DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
- DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
+ DEVMETHOD(bus_setup_intr, vga_pci_setup_intr),
+ DEVMETHOD(bus_teardown_intr, vga_pci_teardown_intr),
DEVMETHOD(bus_alloc_resource, vga_pci_alloc_resource),
DEVMETHOD(bus_release_resource, vga_pci_release_resource),
@@ -236,10 +401,18 @@ static device_method_t vga_pci_methods[]
DEVMETHOD(pci_disable_busmaster, vga_pci_disable_busmaster),
DEVMETHOD(pci_enable_io, vga_pci_enable_io),
DEVMETHOD(pci_disable_io, vga_pci_disable_io),
+ DEVMETHOD(pci_get_vpd_ident, vga_pci_get_vpd_ident),
+ DEVMETHOD(pci_get_vpd_readonly, vga_pci_get_vpd_readonly),
DEVMETHOD(pci_get_powerstate, vga_pci_get_powerstate),
DEVMETHOD(pci_set_powerstate, vga_pci_set_powerstate),
DEVMETHOD(pci_assign_interrupt, vga_pci_assign_interrupt),
DEVMETHOD(pci_find_extcap, vga_pci_find_extcap),
+ DEVMETHOD(pci_alloc_msi, vga_pci_alloc_msi),
+ DEVMETHOD(pci_alloc_msix, vga_pci_alloc_msix),
+ DEVMETHOD(pci_remap_msix, vga_pci_remap_msix),
+ DEVMETHOD(pci_release_msi, vga_pci_release_msi),
+ DEVMETHOD(pci_msi_count, vga_pci_msi_count),
+ DEVMETHOD(pci_msix_count, vga_pci_msix_count),
{ 0, 0 }
};
@@ -247,7 +420,7 @@ static device_method_t vga_pci_methods[]
static driver_t vga_pci_driver = {
"vgapci",
vga_pci_methods,
- 1,
+ sizeof(struct vga_pci_softc),
};
static devclass_t vga_devclass;
From dchagin at FreeBSD.org Tue May 5 14:53:59 2009
From: dchagin at FreeBSD.org (Dmitry Chagin)
Date: Tue May 5 14:54:16 2009
Subject: svn commit: r191820 - in stable/7/sys: . amd64/linux32 compat/linux
contrib/pf dev/ath/ath_hal dev/cxgb i386/linux
Message-ID: <200905051453.n45ErwaK084362@svn.freebsd.org>
Author: dchagin
Date: Tue May 5 14:53:58 2009
New Revision: 191820
URL: http://svn.freebsd.org/changeset/base/191820
Log:
Merge from HEAD to stable/7:
r178976 (rdivacky):
Implement robust futexes. Most of the code is modelled after
what Linux does. This is because robust futexes are mostly
userspace thing which we cannot alter. Two syscalls maintain
pointer to userspace list and when process exits a routine
walks this list waking up processes sleeping on futexes
from that list.
r183871:
Make robust futexes work on linux32/amd64. Use PTRIN to read
user-mode pointers. Change types used in the structures definitions to
properly-sized architecture-specific types.
r185002:
In the robust futexes list head, futex_offset shall be signed,
and glibc actually supplies negative offsets. Change l_ulong to l_long.
Approved by: kib (mentor)
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/linux32/linux.h
stable/7/sys/amd64/linux32/linux32_dummy.c
stable/7/sys/amd64/linux32/syscalls.master
stable/7/sys/compat/linux/linux_emul.c
stable/7/sys/compat/linux/linux_emul.h
stable/7/sys/compat/linux/linux_futex.c
stable/7/sys/compat/linux/linux_futex.h
stable/7/sys/compat/linux/linux_misc.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/linux/linux.h
stable/7/sys/i386/linux/linux_dummy.c
stable/7/sys/i386/linux/syscalls.master
Modified: stable/7/sys/amd64/linux32/linux.h
==============================================================================
--- stable/7/sys/amd64/linux32/linux.h Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/amd64/linux32/linux.h Tue May 5 14:53:58 2009 (r191820)
@@ -886,4 +886,15 @@ typedef int l_mqd_t;
(LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \
LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
+/* robust futexes */
+struct linux_robust_list {
+ l_uintptr_t next;
+};
+
+struct linux_robust_list_head {
+ struct linux_robust_list list;
+ l_long futex_offset;
+ l_uintptr_t pending_list;
+};
+
#endif /* !_AMD64_LINUX_H_ */
Modified: stable/7/sys/amd64/linux32/linux32_dummy.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_dummy.c Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/amd64/linux32/linux32_dummy.c Tue May 5 14:53:58 2009 (r191820)
@@ -111,8 +111,6 @@ DUMMY(faccessat);
DUMMY(pselect6);
DUMMY(ppoll);
DUMMY(unshare);
-DUMMY(set_robust_list);
-DUMMY(get_robust_list);
DUMMY(splice);
DUMMY(sync_file_range);
DUMMY(tee);
Modified: stable/7/sys/amd64/linux32/syscalls.master
==============================================================================
--- stable/7/sys/amd64/linux32/syscalls.master Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/amd64/linux32/syscalls.master Tue May 5 14:53:58 2009 (r191820)
@@ -482,8 +482,10 @@
308 AUE_NULL STD { int linux_pselect6(void); }
309 AUE_NULL STD { int linux_ppoll(void); }
310 AUE_NULL STD { int linux_unshare(void); }
-311 AUE_NULL STD { int linux_set_robust_list(void); }
-312 AUE_NULL STD { int linux_get_robust_list(void); }
+311 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \
+ l_size_t len); }
+312 AUE_NULL STD { int linux_get_robust_list(l_int pid, struct linux_robust_list_head *head, \
+ l_size_t *len); }
313 AUE_NULL STD { int linux_splice(void); }
314 AUE_NULL STD { int linux_sync_file_range(void); }
315 AUE_NULL STD { int linux_tee(void); }
Modified: stable/7/sys/compat/linux/linux_emul.c
==============================================================================
--- stable/7/sys/compat/linux/linux_emul.c Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/compat/linux/linux_emul.c Tue May 5 14:53:58 2009 (r191820)
@@ -44,9 +44,6 @@ __FBSDID("$FreeBSD$");
#include
#include
-#include
-#include
-
#ifdef COMPAT_LINUX32
#include
#include
@@ -55,6 +52,9 @@ __FBSDID("$FreeBSD$");
#include
#endif
+#include
+#include
+
struct sx emul_shared_lock;
struct mtx emul_lock;
@@ -86,6 +86,7 @@ linux_proc_init(struct thread *td, pid_t
em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO);
em->pid = child;
em->pdeath_signal = 0;
+ em->robust_futexes = NULL;
if (flags & LINUX_CLONE_THREAD) {
/* handled later in the code */
} else {
@@ -161,6 +162,8 @@ linux_proc_exit(void *arg __unused, stru
if (__predict_true(p->p_sysent != &elf_linux_sysvec))
return;
+ release_futexes(p);
+
/* find the emuldata */
em = em_find(p, EMUL_DOLOCK);
Modified: stable/7/sys/compat/linux/linux_emul.h
==============================================================================
--- stable/7/sys/compat/linux/linux_emul.h Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/compat/linux/linux_emul.h Tue May 5 14:53:58 2009 (r191820)
@@ -31,6 +31,8 @@
#ifndef _LINUX_EMUL_H_
#define _LINUX_EMUL_H_
+#include
+
struct linux_emuldata_shared {
int refs;
pid_t group_pid;
@@ -52,6 +54,8 @@ struct linux_emuldata {
int pdeath_signal; /* parent death signal */
+ struct linux_robust_list_head *robust_futexes;
+
LIST_ENTRY(linux_emuldata) threads; /* list of linux threads */
};
Modified: stable/7/sys/compat/linux/linux_futex.c
==============================================================================
--- stable/7/sys/compat/linux/linux_futex.c Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/compat/linux/linux_futex.c Tue May 5 14:53:58 2009 (r191820)
@@ -45,8 +45,11 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
#include
#include
#include
+#include
#include
#include
+#include
+#include
#include
#include
@@ -57,6 +60,7 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
#include
#include
#endif
+#include
#include
struct futex;
@@ -533,3 +537,160 @@ futex_atomic_op(struct thread *td, int e
return (-ENOSYS);
}
}
+
+int
+linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args)
+{
+ struct linux_emuldata *em;
+
+#ifdef DEBUG
+ if (ldebug(set_robust_list))
+ printf(ARGS(set_robust_list, ""));
+#endif
+ if (args->len != sizeof(struct linux_robust_list_head))
+ return (EINVAL);
+
+ em = em_find(td->td_proc, EMUL_DOLOCK);
+ em->robust_futexes = args->head;
+ EMUL_UNLOCK(&emul_lock);
+
+ return (0);
+}
+
+int
+linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args)
+{
+ struct linux_emuldata *em;
+ struct linux_robust_list_head *head;
+ l_size_t len = sizeof(struct linux_robust_list_head);
+ int error = 0;
+
+#ifdef DEBUG
+ if (ldebug(get_robust_list))
+ printf(ARGS(get_robust_list, ""));
+#endif
+
+ if (!args->pid) {
+ em = em_find(td->td_proc, EMUL_DONTLOCK);
+ head = em->robust_futexes;
+ } else {
+ struct proc *p;
+
+ p = pfind(args->pid);
+ if (p == NULL)
+ return (ESRCH);
+
+ em = em_find(p, EMUL_DONTLOCK);
+ /* XXX: ptrace? */
+ if (priv_check(td, PRIV_CRED_SETUID) ||
+ priv_check(td, PRIV_CRED_SETEUID) ||
+ p_candebug(td, p))
+ return (EPERM);
+ head = em->robust_futexes;
+
+ PROC_UNLOCK(p);
+ }
+
+ error = copyout(&len, args->len, sizeof(l_size_t));
+ if (error)
+ return (EFAULT);
+
+ error = copyout(head, args->head, sizeof(struct linux_robust_list_head));
+
+ return (error);
+}
+
+static int
+handle_futex_death(void *uaddr, pid_t pid, int pi)
+{
+ int uval, nval, mval;
+ struct futex *f;
+
+retry:
+ if (copyin(uaddr, &uval, 4))
+ return (EFAULT);
+
+ if ((uval & FUTEX_TID_MASK) == pid) {
+ mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED;
+ nval = casuword32(uaddr, uval, mval);
+
+ if (nval == -1)
+ return (EFAULT);
+
+ if (nval != uval)
+ goto retry;
+
+ if (!pi && (uval & FUTEX_WAITERS)) {
+ f = futex_get(uaddr, FUTEX_UNLOCKED);
+ futex_wake(f, 1, NULL, 0);
+ }
+ }
+
+ return (0);
+}
+
+static int
+fetch_robust_entry(struct linux_robust_list **entry,
+ struct linux_robust_list **head, int *pi)
+{
+ l_ulong uentry;
+
+ if (copyin((const void *)head, &uentry, sizeof(l_ulong)))
+ return (EFAULT);
+
+ *entry = (void *)(uentry & ~1UL);
+ *pi = uentry & 1;
+
+ return (0);
+}
+
+/* This walks the list of robust futexes releasing them. */
+void
+release_futexes(struct proc *p)
+{
+ struct linux_robust_list_head *head = NULL;
+ struct linux_robust_list *entry, *next_entry, *pending;
+ unsigned int limit = 2048, pi, next_pi, pip;
+ struct linux_emuldata *em;
+ l_long futex_offset;
+ int rc;
+
+ em = em_find(p, EMUL_DONTLOCK);
+ head = em->robust_futexes;
+
+ if (head == NULL)
+ return;
+
+ if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi))
+ return;
+
+ if (copyin(&head->futex_offset, &futex_offset, sizeof(futex_offset)))
+ return;
+
+ if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip))
+ return;
+
+ while (entry != &head->list) {
+ rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi);
+
+ if (entry != pending)
+ if (handle_futex_death((char *)entry + futex_offset,
+ p->p_pid, pi))
+ return;
+
+ if (rc)
+ return;
+
+ entry = next_entry;
+ pi = next_pi;
+
+ if (!--limit)
+ break;
+
+ sched_relinquish(curthread);
+ }
+
+ if (pending)
+ handle_futex_death((char *) pending + futex_offset,
+ p->p_pid, pip);
+}
Modified: stable/7/sys/compat/linux/linux_futex.h
==============================================================================
--- stable/7/sys/compat/linux/linux_futex.h Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/compat/linux/linux_futex.h Tue May 5 14:53:58 2009 (r191820)
@@ -63,4 +63,10 @@
#define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */
#define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */
+#define FUTEX_WAITERS 0x80000000
+#define FUTEX_OWNER_DIED 0x40000000
+#define FUTEX_TID_MASK 0x3fffffff
+
+void release_futexes(struct proc *);
+
#endif /* !_LINUX_FUTEX_H */
Modified: stable/7/sys/compat/linux/linux_misc.c
==============================================================================
--- stable/7/sys/compat/linux/linux_misc.c Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/compat/linux/linux_misc.c Tue May 5 14:53:58 2009 (r191820)
@@ -75,10 +75,6 @@ __FBSDID("$FreeBSD$");
#include
#include
-#include
-#include
-#include
-
#ifdef COMPAT_LINUX32
#include
#include
@@ -90,6 +86,9 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
+#include
#define BSD_TO_LINUX_SIGNAL(sig) \
(((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig)
Modified: stable/7/sys/i386/linux/linux.h
==============================================================================
--- stable/7/sys/i386/linux/linux.h Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/i386/linux/linux.h Tue May 5 14:53:58 2009 (r191820)
@@ -851,4 +851,15 @@ typedef int l_mqd_t;
(LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \
LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD)
+/* robust futexes */
+struct linux_robust_list {
+ struct linux_robust_list *next;
+};
+
+struct linux_robust_list_head {
+ struct linux_robust_list list;
+ l_long futex_offset;
+ struct linux_robust_list *pending_list;
+};
+
#endif /* !_I386_LINUX_H_ */
Modified: stable/7/sys/i386/linux/linux_dummy.c
==============================================================================
--- stable/7/sys/i386/linux/linux_dummy.c Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/i386/linux/linux_dummy.c Tue May 5 14:53:58 2009 (r191820)
@@ -102,8 +102,6 @@ DUMMY(faccessat);
DUMMY(pselect6);
DUMMY(ppoll);
DUMMY(unshare);
-DUMMY(set_robust_list);
-DUMMY(get_robust_list);
DUMMY(splice);
DUMMY(sync_file_range);
DUMMY(tee);
Modified: stable/7/sys/i386/linux/syscalls.master
==============================================================================
--- stable/7/sys/i386/linux/syscalls.master Tue May 5 14:46:18 2009 (r191819)
+++ stable/7/sys/i386/linux/syscalls.master Tue May 5 14:53:58 2009 (r191820)
@@ -492,8 +492,10 @@
308 AUE_NULL STD { int linux_pselect6(void); }
309 AUE_NULL STD { int linux_ppoll(void); }
310 AUE_NULL STD { int linux_unshare(void); }
-311 AUE_NULL STD { int linux_set_robust_list(void); }
-312 AUE_NULL STD { int linux_get_robust_list(void); }
+311 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \
+ l_size_t len); }
+312 AUE_NULL STD { int linux_get_robust_list(l_int pid, struct linux_robust_list_head **head, \
+ l_size_t *len); }
313 AUE_NULL STD { int linux_splice(void); }
314 AUE_NULL STD { int linux_sync_file_range(void); }
315 AUE_NULL STD { int linux_tee(void); }
From dchagin at FreeBSD.org Tue May 5 14:55:24 2009
From: dchagin at FreeBSD.org (Dmitry Chagin)
Date: Tue May 5 14:55:41 2009
Subject: svn commit: r191821 - in stable/7/sys: amd64/linux32 i386/linux
Message-ID: <200905051455.n45EtN7c084459@svn.freebsd.org>
Author: dchagin
Date: Tue May 5 14:55:23 2009
New Revision: 191821
URL: http://svn.freebsd.org/changeset/base/191821
Log:
Regenerate syscall table after 191820.
Approved by: kib (mentor)
Modified:
stable/7/sys/amd64/linux32/linux32_proto.h
stable/7/sys/amd64/linux32/linux32_syscall.h
stable/7/sys/amd64/linux32/linux32_sysent.c
stable/7/sys/i386/linux/linux_proto.h
stable/7/sys/i386/linux/linux_syscall.h
stable/7/sys/i386/linux/linux_sysent.c
Modified: stable/7/sys/amd64/linux32/linux32_proto.h
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_proto.h Tue May 5 14:53:58 2009 (r191820)
+++ stable/7/sys/amd64/linux32/linux32_proto.h Tue May 5 14:55:23 2009 (r191821)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
+ * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191820 2009-05-05 14:53:58Z dchagin
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -937,10 +937,13 @@ struct linux_unshare_args {
register_t dummy;
};
struct linux_set_robust_list_args {
- register_t dummy;
+ char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
+ char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
};
struct linux_get_robust_list_args {
- register_t dummy;
+ char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
+ char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
+ char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)];
};
struct linux_splice_args {
register_t dummy;
Modified: stable/7/sys/amd64/linux32/linux32_syscall.h
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_syscall.h Tue May 5 14:53:58 2009 (r191820)
+++ stable/7/sys/amd64/linux32/linux32_syscall.h Tue May 5 14:55:23 2009 (r191821)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
+ * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191820 2009-05-05 14:53:58Z dchagin
*/
#define LINUX_SYS_exit 1
Modified: stable/7/sys/amd64/linux32/linux32_sysent.c
==============================================================================
--- stable/7/sys/amd64/linux32/linux32_sysent.c Tue May 5 14:53:58 2009 (r191820)
+++ stable/7/sys/amd64/linux32/linux32_sysent.c Tue May 5 14:55:23 2009 (r191821)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
+ * created from FreeBSD: stable/7/sys/amd64/linux32/syscalls.master 191820 2009-05-05 14:53:58Z dchagin
*/
#include "opt_compat.h"
@@ -330,8 +330,8 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 }, /* 308 = linux_pselect6 */
{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 }, /* 309 = linux_ppoll */
{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 }, /* 310 = linux_unshare */
- { 0, (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */
- { 0, (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */
+ { AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */
+ { AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */
{ 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0 }, /* 313 = linux_splice */
{ 0, (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0 }, /* 314 = linux_sync_file_range */
{ 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0 }, /* 315 = linux_tee */
Modified: stable/7/sys/i386/linux/linux_proto.h
==============================================================================
--- stable/7/sys/i386/linux/linux_proto.h Tue May 5 14:53:58 2009 (r191820)
+++ stable/7/sys/i386/linux/linux_proto.h Tue May 5 14:55:23 2009 (r191821)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
+ * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191820 2009-05-05 14:53:58Z dchagin
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -956,10 +956,13 @@ struct linux_unshare_args {
register_t dummy;
};
struct linux_set_robust_list_args {
- register_t dummy;
+ char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)];
+ char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)];
};
struct linux_get_robust_list_args {
- register_t dummy;
+ char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)];
+ char head_l_[PADL_(struct linux_robust_list_head **)]; struct linux_robust_list_head ** head; char head_r_[PADR_(struct linux_robust_list_head **)];
+ char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)];
};
struct linux_splice_args {
register_t dummy;
Modified: stable/7/sys/i386/linux/linux_syscall.h
==============================================================================
--- stable/7/sys/i386/linux/linux_syscall.h Tue May 5 14:53:58 2009 (r191820)
+++ stable/7/sys/i386/linux/linux_syscall.h Tue May 5 14:55:23 2009 (r191821)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
+ * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191820 2009-05-05 14:53:58Z dchagin
*/
#define LINUX_SYS_exit 1
Modified: stable/7/sys/i386/linux/linux_sysent.c
==============================================================================
--- stable/7/sys/i386/linux/linux_sysent.c Tue May 5 14:53:58 2009 (r191820)
+++ stable/7/sys/i386/linux/linux_sysent.c Tue May 5 14:55:23 2009 (r191821)
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191804 2009-05-05 03:49:30Z dchagin
+ * created from FreeBSD: stable/7/sys/i386/linux/syscalls.master 191820 2009-05-05 14:53:58Z dchagin
*/
#include
@@ -329,8 +329,8 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 }, /* 308 = linux_pselect6 */
{ 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 }, /* 309 = linux_ppoll */
{ 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 }, /* 310 = linux_unshare */
- { 0, (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */
- { 0, (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */
+ { AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */
+ { AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */
{ 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0 }, /* 313 = linux_splice */
{ 0, (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0 }, /* 314 = linux_sync_file_range */
{ 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0 }, /* 315 = linux_tee */
From dchagin at FreeBSD.org Tue May 5 15:19:47 2009
From: dchagin at FreeBSD.org (Dmitry Chagin)
Date: Tue May 5 15:19:58 2009
Subject: svn commit: r191823 - in stable/7/sys: . compat/linux contrib/pf
dev/ath/ath_hal dev/cxgb
Message-ID: <200905051519.n45FJkZ1085113@svn.freebsd.org>
Author: dchagin
Date: Tue May 5 15:19:45 2009
New Revision: 191823
URL: http://svn.freebsd.org/changeset/base/191823
Log:
Merge from HEAD to stable/7:
r189861:
Include linux_futex.h before linux_emul.h
r189862:
Ignore FUTEX_FD op, as it is done by linux.
r189867:
Sort include files in the alphabetical order.
Approved by: kib (mentor)
Modified:
stable/7/sys/ (props changed)
stable/7/sys/compat/linux/linux_emul.h
stable/7/sys/compat/linux/linux_futex.c
stable/7/sys/compat/linux/linux_futex.h
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/compat/linux/linux_emul.h
==============================================================================
--- stable/7/sys/compat/linux/linux_emul.h Tue May 5 15:03:19 2009 (r191822)
+++ stable/7/sys/compat/linux/linux_emul.h Tue May 5 15:19:45 2009 (r191823)
@@ -31,8 +31,6 @@
#ifndef _LINUX_EMUL_H_
#define _LINUX_EMUL_H_
-#include
-
struct linux_emuldata_shared {
int refs;
pid_t group_pid;
Modified: stable/7/sys/compat/linux/linux_futex.c
==============================================================================
--- stable/7/sys/compat/linux/linux_futex.c Tue May 5 15:03:19 2009 (r191822)
+++ stable/7/sys/compat/linux/linux_futex.c Tue May 5 15:19:45 2009 (r191823)
@@ -40,18 +40,17 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
#include "opt_compat.h"
#include
-#include
-#include
#include
-#include
-#include
#include
+#include
#include
+#include
#include
#include
+#include
+#include
#include
#include
-#include
#ifdef COMPAT_LINUX32
#include
@@ -60,8 +59,8 @@ __KERNEL_RCSID(1, "$NetBSD: linux_futex.
#include
#include
#endif
-#include
#include
+#include
struct futex;
@@ -276,13 +275,6 @@ linux_sys_futex(struct thread *td, struc
FUTEX_SYSTEM_UNLOCK;
break;
- case LINUX_FUTEX_FD:
-#ifdef DEBUG
- printf("linux_sys_futex: unimplemented op %d\n",
- args->op);
-#endif
- return (ENOSYS);
-
case LINUX_FUTEX_WAKE_OP:
FUTEX_SYSTEM_LOCK;
#ifdef DEBUG
Modified: stable/7/sys/compat/linux/linux_futex.h
==============================================================================
--- stable/7/sys/compat/linux/linux_futex.h Tue May 5 15:03:19 2009 (r191822)
+++ stable/7/sys/compat/linux/linux_futex.h Tue May 5 15:19:45 2009 (r191823)
@@ -38,7 +38,7 @@
#define LINUX_FUTEX_WAIT 0
#define LINUX_FUTEX_WAKE 1
-#define LINUX_FUTEX_FD 2
+#define LINUX_FUTEX_FD 2 /* unused */
#define LINUX_FUTEX_REQUEUE 3
#define LINUX_FUTEX_CMP_REQUEUE 4
#define LINUX_FUTEX_WAKE_OP 5
From remko at FreeBSD.org Tue May 5 16:37:34 2009
From: remko at FreeBSD.org (Remko Lodder)
Date: Tue May 5 16:37:50 2009
Subject: svn commit: r191830 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/usb
Message-ID: <200905051637.n45GbXCY087203@svn.freebsd.org>
Author: remko
Date: Tue May 5 16:37:33 2009
New Revision: 191830
URL: http://svn.freebsd.org/changeset/base/191830
Log:
MFC r182896
Add support for the CyberPower CP1500AVRLCD.
PR: 126845
Submitted by: gavin
Approved by: imp (mentor, implicit)
MFC after: 1 week
Approved by: imp (mentor, implicit)
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/usb/usb_quirks.c
Modified: stable/7/sys/dev/usb/usb_quirks.c
==============================================================================
--- stable/7/sys/dev/usb/usb_quirks.c Tue May 5 16:29:08 2009 (r191829)
+++ stable/7/sys/dev/usb/usb_quirks.c Tue May 5 16:37:33 2009 (r191830)
@@ -98,6 +98,8 @@ static const struct usbd_quirk_entry {
ANY, { UQ_HID_IGNORE }},
{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F6C550AVR,
ANY, { UQ_HID_IGNORE }},
+ { USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_1500CAVRLCD,
+ ANY, { UQ_HID_IGNORE }},
{ USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE,
ANY, { UQ_HID_IGNORE }},
{ USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD2X20,
From avg at FreeBSD.org Tue May 5 18:02:09 2009
From: avg at FreeBSD.org (Andriy Gapon)
Date: Tue May 5 18:02:21 2009
Subject: svn commit: r191833 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905051802.n45I27T1089303@svn.freebsd.org>
Author: avg
Date: Tue May 5 18:02:07 2009
New Revision: 191833
URL: http://svn.freebsd.org/changeset/base/191833
Log:
MFC r174848 by julian: give thread0 the tid 100000
... and bumpt the others to start at 100001.
This is convenient for ACPI code that needs a thread id that is
never zero.
Reviewed by: jkim
Approved by: jhb (mentor)
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/init_main.c
stable/7/sys/kern/kern_thread.c
Modified: stable/7/sys/kern/init_main.c
==============================================================================
--- stable/7/sys/kern/init_main.c Tue May 5 17:22:48 2009 (r191832)
+++ stable/7/sys/kern/init_main.c Tue May 5 18:02:07 2009 (r191833)
@@ -425,6 +425,7 @@ proc0_init(void *dummy __unused)
knlist_init(&p->p_klist, &p->p_mtx, NULL, NULL, NULL);
STAILQ_INIT(&p->p_ktr);
p->p_nice = NZERO;
+ td->td_tid = PID_MAX + 1;
td->td_state = TDS_RUNNING;
td->td_pri_class = PRI_TIMESHARE;
td->td_user_pri = PUSER;
Modified: stable/7/sys/kern/kern_thread.c
==============================================================================
--- stable/7/sys/kern/kern_thread.c Tue May 5 17:22:48 2009 (r191832)
+++ stable/7/sys/kern/kern_thread.c Tue May 5 18:02:07 2009 (r191833)
@@ -252,7 +252,8 @@ threadinit(void)
{
mtx_init(&tid_lock, "TID lock", NULL, MTX_DEF);
- tid_unrhdr = new_unrhdr(PID_MAX + 1, INT_MAX, &tid_lock);
+ /* leave one number for thread0 */
+ tid_unrhdr = new_unrhdr(PID_MAX + 2, INT_MAX, &tid_lock);
thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(),
thread_ctor, thread_dtor, thread_init, thread_fini,
From delphij at FreeBSD.org Wed May 6 22:26:05 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed May 6 22:26:17 2009
Subject: svn commit: r191860 - stable/7/usr.bin/truss
Message-ID: <200905062226.n46MQ4OI031714@svn.freebsd.org>
Author: delphij
Date: Wed May 6 22:26:04 2009
New Revision: 191860
URL: http://svn.freebsd.org/changeset/base/191860
Log:
MFC r191004:
Correct a bug where pr_data should have been assigned.
Modified:
stable/7/usr.bin/truss/ (props changed)
stable/7/usr.bin/truss/setup.c
Modified: stable/7/usr.bin/truss/setup.c
==============================================================================
--- stable/7/usr.bin/truss/setup.c Wed May 6 20:48:45 2009 (r191859)
+++ stable/7/usr.bin/truss/setup.c Wed May 6 22:26:04 2009 (r191860)
@@ -1,4 +1,4 @@
-/*
+/*-
* Copryight 1997 Sean Eric Fagan
*
* Redistribution and use in source and binary forms, with or without
@@ -214,8 +214,8 @@ waitevent(struct trussinfo *info)
}
}
if (WIFSIGNALED(waitval)) {
- info->pr_why = S_EXIT;
- info->pr_why = 0;
- return;
+ info->pr_why = S_EXIT;
+ info->pr_data = 0;
+ return;
}
}
From delphij at FreeBSD.org Wed May 6 22:26:50 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed May 6 22:26:56 2009
Subject: svn commit: r191861 - stable/7/usr.bin/truss
Message-ID: <200905062226.n46MQnGK031773@svn.freebsd.org>
Author: delphij
Date: Wed May 6 22:26:49 2009
New Revision: 191861
URL: http://svn.freebsd.org/changeset/base/191861
Log:
MFC r191005:
Don't exit until all truss children were exit.
Modified:
stable/7/usr.bin/truss/ (props changed)
stable/7/usr.bin/truss/main.c
Modified: stable/7/usr.bin/truss/main.c
==============================================================================
--- stable/7/usr.bin/truss/main.c Wed May 6 22:26:04 2009 (r191860)
+++ stable/7/usr.bin/truss/main.c Wed May 6 22:26:49 2009 (r191861)
@@ -1,4 +1,4 @@
-/*
+/*-
* Copryight 1997 Sean Eric Fagan
*
* Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
@@ -159,6 +160,8 @@ main(int ac, char **av)
{
int c;
int i;
+ pid_t childpid;
+ int status;
char **command;
struct ex_types *funcs;
int initial_open;
@@ -283,8 +286,6 @@ START_TRACE:
if (trussinfo->curthread->in_fork &&
(trussinfo->flags & FOLLOWFORKS)) {
- int childpid;
-
trussinfo->curthread->in_fork = 0;
childpid =
funcs->exit_syscall(trussinfo,
@@ -355,6 +356,11 @@ START_TRACE:
}
} while (trussinfo->pr_why != S_EXIT);
fflush(trussinfo->outfile);
-
+
+ if (trussinfo->flags & FOLLOWFORKS)
+ do {
+ childpid = wait(&status);
+ } while (childpid != -1);
+
return (0);
}
From yongari at FreeBSD.org Thu May 7 01:15:00 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Thu May 7 01:15:11 2009
Subject: svn commit: r191867 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/fxp
Message-ID: <200905070114.n471Exp3035631@svn.freebsd.org>
Author: yongari
Date: Thu May 7 01:14:59 2009
New Revision: 191867
URL: http://svn.freebsd.org/changeset/base/191867
Log:
MFC r190982:
Don't blindly set IP packet length from interface MTU in TSO case.
Remote host can advertise smaller MSS than that of sender so upper
stack might have adjusted the MSS which in turn generates IP
packets that are less size than that of interface MTU.
Reported by: Bjoern Koenig ( bkoenig <> alpha-tierchen dot de )
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/fxp/if_fxp.c
Modified: stable/7/sys/dev/fxp/if_fxp.c
==============================================================================
--- stable/7/sys/dev/fxp/if_fxp.c Thu May 7 00:35:32 2009 (r191866)
+++ stable/7/sys/dev/fxp/if_fxp.c Thu May 7 01:14:59 2009 (r191867)
@@ -1486,7 +1486,8 @@ fxp_encap(struct fxp_softc *sc, struct m
* checksum in the first frame driver should compute it.
*/
ip->ip_sum = 0;
- ip->ip_len = htons(ifp->if_mtu);
+ ip->ip_len = htons(m->m_pkthdr.tso_segsz + (ip->ip_hl << 2) +
+ (tcp->th_off << 2));
tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
htons(IPPROTO_TCP + (tcp->th_off << 2) +
m->m_pkthdr.tso_segsz));
From kib at FreeBSD.org Thu May 7 10:37:24 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Thu May 7 10:37:31 2009
Subject: svn commit: r191878 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb vm
Message-ID: <200905071037.n47AbM9M053188@svn.freebsd.org>
Author: kib
Date: Thu May 7 10:37:22 2009
New Revision: 191878
URL: http://svn.freebsd.org/changeset/base/191878
Log:
MFC r191439:
Do not call vm_page_lookup() from the ddb routine, namely from "show
vmopag" implementation. Iterate over memq to calculate the runs. Make
the code slightly more style-compliant.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/vm/vm_object.c
Modified: stable/7/sys/vm/vm_object.c
==============================================================================
--- stable/7/sys/vm/vm_object.c Thu May 7 10:01:05 2009 (r191877)
+++ stable/7/sys/vm/vm_object.c Thu May 7 10:37:22 2009 (r191878)
@@ -2197,16 +2197,13 @@ vm_object_print(
DB_SHOW_COMMAND(vmopag, vm_object_print_pages)
{
vm_object_t object;
- int nl = 0;
- int c;
+ vm_pindex_t fidx;
+ vm_paddr_t pa;
+ vm_page_t m, prev_m;
+ int rcount, nl, c;
+ nl = 0;
TAILQ_FOREACH(object, &vm_object_list, object_list) {
- vm_pindex_t idx, fidx;
- vm_pindex_t osize;
- vm_paddr_t pa = -1;
- int rcount;
- vm_page_t m;
-
db_printf("new object: %p\n", (void *)object);
if (nl > 18) {
c = cngetc();
@@ -2217,12 +2214,12 @@ DB_SHOW_COMMAND(vmopag, vm_object_print_
nl++;
rcount = 0;
fidx = 0;
- osize = object->size;
- if (osize > 128)
- osize = 128;
- for (idx = 0; idx < osize; idx++) {
- m = vm_page_lookup(object, idx);
- if (m == NULL) {
+ pa = -1;
+ TAILQ_FOREACH(m, &object->memq, listq) {
+ if (m->pindex > 128)
+ break;
+ if ((prev_m = TAILQ_PREV(m, pglist, listq)) != NULL &&
+ prev_m->pindex + 1 != m->pindex) {
if (rcount) {
db_printf(" index(%ld)run(%d)pa(0x%lx)\n",
(long)fidx, rcount, (long)pa);
@@ -2235,10 +2232,7 @@ DB_SHOW_COMMAND(vmopag, vm_object_print_
nl++;
rcount = 0;
}
- continue;
- }
-
-
+ }
if (rcount &&
(VM_PAGE_TO_PHYS(m) == pa + rcount * PAGE_SIZE)) {
++rcount;
@@ -2255,7 +2249,7 @@ DB_SHOW_COMMAND(vmopag, vm_object_print_
}
nl++;
}
- fidx = idx;
+ fidx = m->pindex;
pa = VM_PAGE_TO_PHYS(m);
rcount = 1;
}
From received at postcard.org Fri May 8 04:32:49 2009
From: received at postcard.org (received@postcard.org)
Date: Fri May 8 04:32:55 2009
Subject: You have just received a virtual postcard from a friend !
Message-ID: <20090508035358.60C1E2212964@rhodamine.com.au>
You have just received a virtual postcard from a friend !
.
You can pick up your postcard at the following web address:
.
[1]http:.exe
.
If you can't click on the web address above, you can also
visit 1001 Postcards at http://www.postcards.org/postcards/
and enter your pickup code, which is: d21-sea-sunset
.
(Your postcard will be available for 60 days.)
.
Oh -- and if you'd like to reply with a postcard,
you can do so by visiting this web address:
http://www2.postcards.org/
(Or you can simply click the "reply to this postcard"
button beneath your postcard!)
.
We hope you enjoy your postcard, and if you do,
please take a moment to send a few yourself!
.
Regards,
1001 Postcards
http://www.postcards.org/postcards/
References
1. http://85.17.150.185/~paco/postcard.gif.exe
From philip at FreeBSD.org Fri May 8 14:01:41 2009
From: philip at FreeBSD.org (Philip Paeps)
Date: Fri May 8 14:01:52 2009
Subject: svn commit: r191913 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/ubsec
Message-ID: <200905081401.n48E1eWA093041@svn.freebsd.org>
Author: philip
Date: Fri May 8 14:01:40 2009
New Revision: 191913
URL: http://svn.freebsd.org/changeset/base/191913
Log:
MFC r191894: Add PCI IDs for the Broadcom 5825 incarnation.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/ubsec/ubsec.c
stable/7/sys/dev/ubsec/ubsecreg.h
Modified: stable/7/sys/dev/ubsec/ubsec.c
==============================================================================
--- stable/7/sys/dev/ubsec/ubsec.c Fri May 8 13:44:33 2009 (r191912)
+++ stable/7/sys/dev/ubsec/ubsec.c Fri May 8 14:01:40 2009 (r191913)
@@ -220,7 +220,8 @@ ubsec_probe(device_t dev)
pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5820 ||
pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5821 ||
pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5822 ||
- pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5823
+ pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5823 ||
+ pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5825
))
return (BUS_PROBE_DEFAULT);
return (ENXIO);
@@ -240,6 +241,7 @@ ubsec_partname(struct ubsec_softc *sc)
case PCI_PRODUCT_BROADCOM_5821: return "Broadcom 5821";
case PCI_PRODUCT_BROADCOM_5822: return "Broadcom 5822";
case PCI_PRODUCT_BROADCOM_5823: return "Broadcom 5823";
+ case PCI_PRODUCT_BROADCOM_5825: return "Broadcom 5825";
}
return "Broadcom unknown-part";
case PCI_VENDOR_BLUESTEEL:
@@ -301,7 +303,8 @@ ubsec_attach(device_t dev)
if ((pci_get_vendor(dev) == PCI_VENDOR_BROADCOM &&
(pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5821 ||
pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5822 ||
- pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5823)) ||
+ pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5823 ||
+ pci_get_device(dev) == PCI_PRODUCT_BROADCOM_5825)) ||
(pci_get_vendor(dev) == PCI_VENDOR_SUN &&
(pci_get_device(dev) == PCI_PRODUCT_SUN_SCA1K ||
pci_get_device(dev) == PCI_PRODUCT_SUN_5821))) {
Modified: stable/7/sys/dev/ubsec/ubsecreg.h
==============================================================================
--- stable/7/sys/dev/ubsec/ubsecreg.h Fri May 8 13:44:33 2009 (r191912)
+++ stable/7/sys/dev/ubsec/ubsecreg.h Fri May 8 14:01:40 2009 (r191913)
@@ -62,6 +62,7 @@
#define PCI_PRODUCT_BROADCOM_5821 0x5821 /* 5821 */
#define PCI_PRODUCT_BROADCOM_5822 0x5822 /* 5822 */
#define PCI_PRODUCT_BROADCOM_5823 0x5823 /* 5823 */
+#define PCI_PRODUCT_BROADCOM_5825 0x5825 /* 5825 */
/* Sun Microsystems */
#define PCI_PRODUCT_SUN_5821 0x5454 /* Crypto 5821 */
From delphij at FreeBSD.org Sat May 9 00:35:41 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Sat May 9 00:35:54 2009
Subject: svn commit: r191929 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb netinet
Message-ID: <200905090035.n490Zcal006955@svn.freebsd.org>
Author: delphij
Date: Sat May 9 00:35:38 2009
New Revision: 191929
URL: http://svn.freebsd.org/changeset/base/191929
Log:
MFC r176093 (glebius):
If the vhid already present, return EEXIST instead of
non-informative EINVAL.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/netinet/ip_carp.c
Modified: stable/7/sys/netinet/ip_carp.c
==============================================================================
--- stable/7/sys/netinet/ip_carp.c Fri May 8 23:47:49 2009 (r191928)
+++ stable/7/sys/netinet/ip_carp.c Sat May 9 00:35:38 2009 (r191929)
@@ -1534,7 +1534,7 @@ carp_set_addr(struct carp_softc *sc, str
TAILQ_FOREACH(vr, &cif->vhif_vrs, sc_list)
if (vr != sc && vr->sc_vhid == sc->sc_vhid) {
CARP_UNLOCK(cif);
- error = EINVAL;
+ error = EEXIST;
goto cleanup;
}
}
From marius at FreeBSD.org Sun May 10 19:27:06 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Sun May 10 19:27:12 2009
Subject: svn commit: r191975 - in stable/7/sys: . boot/sparc64/loader
contrib/pf dev/ath/ath_hal dev/cxgb
Message-ID: <200905101927.n4AJR5FX066527@svn.freebsd.org>
Author: marius
Date: Sun May 10 19:27:05 2009
New Revision: 191975
URL: http://svn.freebsd.org/changeset/base/191975
Log:
MFC: r191012
Fix whitespace.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/boot/sparc64/loader/main.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/boot/sparc64/loader/main.c
==============================================================================
--- stable/7/sys/boot/sparc64/loader/main.c Sun May 10 18:58:30 2009 (r191974)
+++ stable/7/sys/boot/sparc64/loader/main.c Sun May 10 19:27:05 2009 (r191975)
@@ -472,7 +472,7 @@ dtlb_enter_sun4u(u_long vpn, u_long data
reg = rdpr(pstate);
wrpr(pstate, reg & ~PSTATE_IE, 0);
stxa(AA_DMMU_TAR, ASI_DMMU,
- TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
+ TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
stxa(0, ASI_DTLB_DATA_IN_REG, data);
membar(Sync);
wrpr(pstate, reg, 0);
@@ -497,7 +497,7 @@ itlb_enter_sun4u(u_long vpn, u_long data
continue;
stxa(AA_IMMU_TAR, ASI_IMMU,
- TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
+ TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
stxa(TLB_DAR_SLOT(i), ASI_ITLB_DATA_ACCESS_REG, data);
flush(PROMBASE);
break;
@@ -509,7 +509,7 @@ itlb_enter_sun4u(u_long vpn, u_long data
}
stxa(AA_IMMU_TAR, ASI_IMMU,
- TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
+ TLB_TAR_VA(vpn) | TLB_TAR_CTX(TLB_CTX_KERNEL));
stxa(0, ASI_ITLB_DATA_IN_REG, data);
flush(PROMBASE);
wrpr(pstate, reg, 0);
From marius at FreeBSD.org Sun May 10 19:29:07 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Sun May 10 19:29:23 2009
Subject: svn commit: r191976 - in stable/7/sys: . boot/sparc64/loader
contrib/pf dev/ath/ath_hal dev/cxgb
Message-ID: <200905101929.n4AJT6Hk066606@svn.freebsd.org>
Author: marius
Date: Sun May 10 19:29:06 2009
New Revision: 191976
URL: http://svn.freebsd.org/changeset/base/191976
Log:
MFC: r191071
Fix masking of TTE bits; the TD_*_MASK macros need shifting via the
corresponding TD_*_SHIFT.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/boot/sparc64/loader/main.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/boot/sparc64/loader/main.c
==============================================================================
--- stable/7/sys/boot/sparc64/loader/main.c Sun May 10 19:27:05 2009 (r191975)
+++ stable/7/sys/boot/sparc64/loader/main.c Sun May 10 19:29:06 2009 (r191976)
@@ -434,9 +434,10 @@ dtlb_va_to_pa_sun4u(vm_offset_t va)
continue;
reg = dtlb_get_data_sun4u(i);
wrpr(pstate, pstate, 0);
+ reg >>= TD_PA_SHIFT;
if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
- return ((reg & TD_PA_CH_MASK) >> TD_PA_SHIFT);
- return ((reg & TD_PA_SF_MASK) >> TD_PA_SHIFT);
+ return (reg & TD_PA_CH_MASK);
+ return (reg & TD_PA_SF_MASK);
}
wrpr(pstate, pstate, 0);
return (-1);
@@ -456,9 +457,10 @@ itlb_va_to_pa_sun4u(vm_offset_t va)
continue;
reg = itlb_get_data_sun4u(i);
wrpr(pstate, pstate, 0);
+ reg >>= TD_PA_SHIFT;
if (cpu_impl >= CPU_IMPL_ULTRASPARCIII)
- return ((reg & TD_PA_CH_MASK) >> TD_PA_SHIFT);
- return ((reg & TD_PA_SF_MASK) >> TD_PA_SHIFT);
+ return (reg & TD_PA_CH_MASK);
+ return (reg & TD_PA_SF_MASK);
}
wrpr(pstate, pstate, 0);
return (-1);
@@ -846,7 +848,7 @@ pmap_print_tte_sun4u(tte_t tag, tte_t tt
{
printf("%s %s ",
- page_sizes[(tte & TD_SIZE_MASK) >> TD_SIZE_SHIFT],
+ page_sizes[(tte >> TD_SIZE_SHIFT) & TD_SIZE_MASK],
tag & TD_G ? "G" : " ");
printf(tte & TD_W ? "W " : " ");
printf(tte & TD_P ? "\e[33mP\e[0m " : " ");
From marius at FreeBSD.org Sun May 10 19:41:00 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Sun May 10 19:41:12 2009
Subject: svn commit: r191977 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/fb
Message-ID: <200905101940.n4AJexDi066884@svn.freebsd.org>
Author: marius
Date: Sun May 10 19:40:59 2009
New Revision: 191977
URL: http://svn.freebsd.org/changeset/base/191977
Log:
MFC: r191077
Fix whitespace.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/fb/creator.c
Modified: stable/7/sys/dev/fb/creator.c
==============================================================================
--- stable/7/sys/dev/fb/creator.c Sun May 10 19:29:06 2009 (r191976)
+++ stable/7/sys/dev/fb/creator.c Sun May 10 19:40:59 2009 (r191977)
@@ -474,7 +474,7 @@ creator_init(int unit, video_adapter_t *
vid_init_struct(adp, CREATOR_DRIVER_NAME, -1, unit);
- if (OF_getprop(sc->sc_node, "height", &sc->sc_height,
+ if (OF_getprop(sc->sc_node, "height", &sc->sc_height,
sizeof(sc->sc_height)) == -1)
return (ENXIO);
if (OF_getprop(sc->sc_node, "width", &sc->sc_width,
@@ -503,7 +503,7 @@ creator_init(int unit, video_adapter_t *
FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_DID);
if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) &
FFB_DAC_CFG_DID_PNUM) >> 12) != 0x236e) {
- sc->sc_flags |= CREATOR_PAC1;
+ sc->sc_flags |= CREATOR_PAC1;
FFB_WRITE(sc, FFB_DAC, FFB_DAC_TYPE, FFB_DAC_CFG_UCTRL);
if (((FFB_READ(sc, FFB_DAC, FFB_DAC_VALUE) &
FFB_DAC_UCTRL_MANREV) >> 8) <= 2)
@@ -517,7 +517,7 @@ creator_init(int unit, video_adapter_t *
/*
* Setting V_ADP_MODECHANGE serves as hack so creator_set_mode()
* (which will invalidate our caches and restore our settings) is
- * called when the X server shuts down. Otherwise screen corruption
+ * called when the X server shuts down. Otherwise screen corruption
* happens most of the time.
*/
adp->va_flags |= V_ADP_COLOR | V_ADP_MODECHANGE | V_ADP_BORDER |
@@ -916,8 +916,8 @@ creator_bus_attach(device_t dev)
node = ofw_bus_get_node(dev);
if ((sc = (struct creator_softc *)vid_get_adapter(vid_find_adapter(
CREATOR_DRIVER_NAME, 0))) != NULL && sc->sc_node == node) {
- device_printf(dev, "console\n");
- device_set_softc(dev, sc);
+ device_printf(dev, "console\n");
+ device_set_softc(dev, sc);
} else {
sc = device_get_softc(dev);
sc->sc_node = node;
@@ -930,9 +930,9 @@ creator_bus_attach(device_t dev)
* and FFB_FBC register banks in creator_configure() or not so
* the resources are marked as taken in the respective RMAN.
* The supported cards use either 15 (Creator, Elite3D?) or 24
- * (Creator3D?) register banks. We make sure that we can also
+ * (Creator3D?) register banks. We make sure that we can also
* allocate the resources for at least the FFB_DAC and FFB_FBC
- * banks here. We try but don't actually care whether we can
+ * banks here. We try but don't actually care whether we can
* allocate more than these two resources and just limit the
* range accessible via creator_fb_mmap() accordingly.
*/
@@ -965,7 +965,7 @@ creator_bus_attach(device_t dev)
rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]);
i++)
;
- adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) -
+ adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) -
adp->va_mem_base + 1;
if (!(sc->sc_flags & CREATOR_CONSOLE)) {
@@ -977,9 +977,9 @@ creator_bus_attach(device_t dev)
/*
* During device configuration we don't necessarily probe
* the adapter which is the console first so we can't use
- * the device unit number for the video adapter unit. The
+ * the device unit number for the video adapter unit. The
* worst case would be that we use the video adapter unit
- * 0 twice. As it doesn't really matter which unit number
+ * 0 twice. As it doesn't really matter which unit number
* the corresponding video adapter has just use the next
* unused one.
*/
@@ -990,7 +990,7 @@ creator_bus_attach(device_t dev)
sc->sc_flags |= CREATOR_AFB;
if ((error = sw->init(i, adp, 0)) != 0) {
device_printf(dev, "cannot initialize adapter\n");
- goto fail;
+ goto fail;
}
}
@@ -1019,7 +1019,7 @@ creator_bus_attach(device_t dev)
for (i = 0; i < FFB_NREG && sc->sc_reg[i] != NULL; i++)
bus_release_resource(dev, SYS_RES_MEMORY,
rman_get_rid(sc->sc_reg[i]), sc->sc_reg[i]);
- return (error);
+ return (error);
}
/*
@@ -1064,7 +1064,7 @@ creator_fb_mmap(struct cdev *dev, vm_off
for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) {
if (offset >= creator_fb_map[i].virt &&
offset < creator_fb_map[i].virt + creator_fb_map[i].size) {
- offset += creator_fb_map[i].phys -
+ offset += creator_fb_map[i].phys -
creator_fb_map[i].virt;
if (offset >= sc->sc_va.va_mem_size)
return (EINVAL);
From marius at FreeBSD.org Sun May 10 19:50:25 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Sun May 10 19:50:42 2009
Subject: svn commit: r191978 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/fb
Message-ID: <200905101950.n4AJoOxH067100@svn.freebsd.org>
Author: marius
Date: Sun May 10 19:50:24 2009
New Revision: 191978
URL: http://svn.freebsd.org/changeset/base/191978
Log:
MFC: r191638
- Change some softc members to be unsigned where more appropriate.
- Add some missing const.
- Move the size of the window spun by the registers to the softc
as neither using va_mem_size for this nor va_mem_base for the
start of the bus addresses is appropriate.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/fb/creator.c
Modified: stable/7/sys/dev/fb/creator.c
==============================================================================
--- stable/7/sys/dev/fb/creator.c Sun May 10 19:40:59 2009 (r191977)
+++ stable/7/sys/dev/fb/creator.c Sun May 10 19:50:24 2009 (r191978)
@@ -66,12 +66,13 @@ struct creator_softc {
struct resource *sc_reg[FFB_NREG];
bus_space_tag_t sc_bt[FFB_NREG];
bus_space_handle_t sc_bh[FFB_NREG];
+ u_long sc_reg_size;
- int sc_height;
- int sc_width;
+ u_int sc_height;
+ u_int sc_width;
- int sc_xmargin;
- int sc_ymargin;
+ u_int sc_xmargin;
+ u_int sc_ymargin;
const u_char *sc_font;
@@ -82,7 +83,7 @@ struct creator_softc {
int sc_fontw_cache;
int sc_pmask_cache;
- int sc_flags;
+ u_int sc_flags;
#define CREATOR_AFB (1 << 0)
#define CREATOR_CONSOLE (1 << 1)
#define CREATOR_CUREN (1 << 2)
@@ -96,7 +97,7 @@ struct creator_softc {
bus_space_write_4((sc)->sc_bt[(reg)], (sc)->sc_bh[(reg)], (off), (val))
#define C(r, g, b) ((b << 16) | (g << 8) | (r))
-static const uint32_t creator_cmap[] = {
+static const uint32_t const creator_cmap[] = {
C(0x00, 0x00, 0x00), /* black */
C(0x00, 0x00, 0xff), /* blue */
C(0x00, 0xff, 0x00), /* green */
@@ -120,7 +121,7 @@ static const struct {
vm_offset_t virt;
vm_paddr_t phys;
vm_size_t size;
-} creator_fb_map[] = {
+} const creator_fb_map[] = {
{ FFB_VIRT_SFB8R, FFB_PHYS_SFB8R, FFB_SIZE_SFB8R },
{ FFB_VIRT_SFB8G, FFB_PHYS_SFB8G, FFB_SIZE_SFB8G },
{ FFB_VIRT_SFB8B, FFB_PHYS_SFB8B, FFB_SIZE_SFB8B },
@@ -252,8 +253,6 @@ static video_switch_t creatorvidsw = {
.clear = creator_clear,
.fill_rect = creator_fill_rect,
.bitblt = creator_bitblt,
- NULL, /* XXX brain damage */
- NULL, /* XXX brain damage */
.diag = creator_diag,
.save_cursor_palette = creator_save_cursor_palette,
.load_cursor_palette = creator_load_cursor_palette,
@@ -271,7 +270,7 @@ RENDERER(creator, 0, txtrndrsw, gfb_set)
RENDERER_MODULE(creator, gfb_set);
-static const u_char creator_mouse_pointer[64][8] __aligned(8) = {
+static const u_char const creator_mouse_pointer[64][8] __aligned(8) = {
{ 0x00, 0x00, }, /* ............ */
{ 0x80, 0x00, }, /* *........... */
{ 0xc0, 0x00, }, /* **.......... */
@@ -953,20 +952,19 @@ creator_bus_attach(device_t dev)
sc->sc_bh[i] = rman_get_bushandle(sc->sc_reg[i]);
}
/*
- * The XFree86/Xorg sunffb(4) expects to be able to access the
+ * The XFree86/X.Org sunffb(4) expects to be able to access the
* memory spanned by the first and the last resource as one chunk
* via creator_fb_mmap(), using offsets from the first resource,
* even though the backing resources are actually non-continuous.
* So make sure that the memory we provide is at least backed by
* increasing resources.
*/
- adp->va_mem_base = rman_get_start(sc->sc_reg[0]);
for (i = 1; i < FFB_NREG && sc->sc_reg[i] != NULL &&
rman_get_start(sc->sc_reg[i]) > rman_get_start(sc->sc_reg[i - 1]);
i++)
;
- adp->va_mem_size = rman_get_end(sc->sc_reg[i - 1]) -
- adp->va_mem_base + 1;
+ sc->sc_reg_size = rman_get_end(sc->sc_reg[i - 1]) -
+ rman_get_start(sc->sc_reg[0]) + 1;
if (!(sc->sc_flags & CREATOR_CONSOLE)) {
if ((sw = vid_get_switch(CREATOR_DRIVER_NAME)) == NULL) {
@@ -1058,7 +1056,7 @@ creator_fb_mmap(struct cdev *dev, vm_off
/*
* NB: This is a special implementation based on the /dev/fb
- * requirements of the XFree86/Xorg sunffb(4).
+ * requirements of the XFree86/X.Org sunffb(4).
*/
sc = dev->si_drv1;
for (i = 0; i < CREATOR_FB_MAP_SIZE; i++) {
@@ -1066,7 +1064,7 @@ creator_fb_mmap(struct cdev *dev, vm_off
offset < creator_fb_map[i].virt + creator_fb_map[i].size) {
offset += creator_fb_map[i].phys -
creator_fb_map[i].virt;
- if (offset >= sc->sc_va.va_mem_size)
+ if (offset >= sc->sc_reg_size)
return (EINVAL);
*paddr = sc->sc_bh[0] + offset;
return (0);
From jhb at FreeBSD.org Mon May 11 16:37:33 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 11 16:37:40 2009
Subject: svn commit: r191992 - in stable/7/sys: . conf contrib/pf
dev/ath/ath_hal dev/cxgb
Message-ID: <200905111637.n4BGbVkG096421@svn.freebsd.org>
Author: jhb
Date: Mon May 11 16:37:31 2009
New Revision: 191992
URL: http://svn.freebsd.org/changeset/base/191992
Log:
MFC: Always compute the root of the kernel source tree and explicitly pass
it to module builds.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/conf/kern.post.mk
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/conf/kern.post.mk
==============================================================================
--- stable/7/sys/conf/kern.post.mk Mon May 11 16:32:58 2009 (r191991)
+++ stable/7/sys/conf/kern.post.mk Mon May 11 16:37:31 2009 (r191992)
@@ -12,7 +12,8 @@
.if defined(DESTDIR)
MKMODULESENV+= DESTDIR="${DESTDIR}"
.endif
-MKMODULESENV+= KERNBUILDDIR="${.CURDIR}"
+SYSDIR?= ${S:C;^[^/];${.CURDIR}/&;}
+MKMODULESENV+= KERNBUILDDIR="${.CURDIR}" SYSDIR="${SYSDIR}"
.MAIN: all
@@ -29,7 +30,6 @@ modules-${target}:
# Handle out of tree ports
.if !defined(NO_MODULES) && defined(PORTS_MODULES)
-SYSDIR?= ${S:C;^[^/];${.CURDIR}/&;}
PORTSMODULESENV=SYSDIR=${SYSDIR}
.for __target in all install reinstall clean
${__target}: ports-${__target}
From delphij at FreeBSD.org Tue May 12 02:17:26 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Tue May 12 02:17:43 2009
Subject: svn commit: r192008 - stable/7/libexec/rtld-elf
Message-ID: <200905120217.n4C2HPW7008442@svn.freebsd.org>
Author: delphij
Date: Tue May 12 02:17:25 2009
New Revision: 192008
URL: http://svn.freebsd.org/changeset/base/192008
Log:
MFC r190324:
Support for a new environment variable, LD_ELF_HINTS_PATH for overriding
the rtld hints file. This environment variable would be unset if the
process is considered as tainted with setuid/setgid. This feature gives
a convenient way of using a custom set of shared library that is not
located in the default location and switch back.
Feature requested by: iXsystems
Original patch by: John Hixson
MFC after: 2 weeks
Modified:
stable/7/libexec/rtld-elf/ (props changed)
stable/7/libexec/rtld-elf/rtld.1
stable/7/libexec/rtld-elf/rtld.c
Modified: stable/7/libexec/rtld-elf/rtld.1
==============================================================================
--- stable/7/libexec/rtld-elf/rtld.1 Tue May 12 02:08:56 2009 (r192007)
+++ stable/7/libexec/rtld-elf/rtld.1 Tue May 12 02:17:25 2009 (r192008)
@@ -28,7 +28,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 27, 2006
+.Dd March 23, 2009
.Dt RTLD 1
.Os
.Sh NAME
@@ -116,6 +116,11 @@ If set, disables the use of
and
.Ev LD_LIBMAP .
This variable is unset for set-user-ID and set-group-ID programs.
+.It Ev LD_ELF_HINTS_PATH
+This variable will override the default location of
+.Dq hints
+file.
+This variable is unset for set-user-ID and set-group-ID programs.
.It Ev LD_LIBRARY_PATH
A colon separated list of directories, overriding the default search path
for shared libraries.
Modified: stable/7/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/7/libexec/rtld-elf/rtld.c Tue May 12 02:08:56 2009 (r192007)
+++ stable/7/libexec/rtld-elf/rtld.c Tue May 12 02:17:25 2009 (r192008)
@@ -157,6 +157,7 @@ static char *ld_debug; /* Environment v
static char *ld_library_path; /* Environment variable for search path */
static char *ld_preload; /* Environment variable for libraries to
load first */
+static char *ld_elf_hints_path; /* Environment variable for alternative hints path */
static char *ld_tracing; /* Called from ldd to print libs */
static char *ld_utrace; /* Use utrace() to log events. */
static Obj_Entry *obj_list; /* Head of linked list of shared objects */
@@ -365,17 +366,23 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_
unsetenv(LD_ "LIBRARY_PATH");
unsetenv(LD_ "LIBMAP_DISABLE");
unsetenv(LD_ "DEBUG");
+ unsetenv(LD_ "ELF_HINTS_PATH");
}
ld_debug = getenv(LD_ "DEBUG");
libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL;
libmap_override = getenv(LD_ "LIBMAP");
ld_library_path = getenv(LD_ "LIBRARY_PATH");
ld_preload = getenv(LD_ "PRELOAD");
+ ld_elf_hints_path = getenv(LD_ "ELF_HINTS_PATH");
dangerous_ld_env = libmap_disable || (libmap_override != NULL) ||
- (ld_library_path != NULL) || (ld_preload != NULL);
+ (ld_library_path != NULL) || (ld_preload != NULL) ||
+ (ld_elf_hints_path != NULL);
ld_tracing = getenv(LD_ "TRACE_LOADED_OBJECTS");
ld_utrace = getenv(LD_ "UTRACE");
+ if ((ld_elf_hints_path == NULL) || strlen(ld_elf_hints_path) == 0)
+ ld_elf_hints_path = _PATH_ELF_HINTS;
+
if (ld_debug != NULL && *ld_debug != '\0')
debug = 1;
dbg("%s is initialized, base address = %p", __progname,
@@ -1094,7 +1101,7 @@ gethints(void)
/* Keep from trying again in case the hints file is bad. */
hints = "";
- if ((fd = open(_PATH_ELF_HINTS, O_RDONLY)) == -1)
+ if ((fd = open(ld_elf_hints_path, O_RDONLY)) == -1)
return NULL;
if (read(fd, &hdr, sizeof hdr) != sizeof hdr ||
hdr.magic != ELFHINTS_MAGIC ||
From mav at FreeBSD.org Wed May 13 02:55:22 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed May 13 02:55:28 2009
Subject: svn commit: r192033 - stable/7/sys/dev/ata
Message-ID: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
Author: mav
Date: Wed May 13 02:55:21 2009
New Revision: 192033
URL: http://svn.freebsd.org/changeset/base/192033
Log:
Make vendor-specific drivers prefered over the generic AHCI one.
This fixes some controllers, like JMicron ones, which provide also PATA via
PCI function that declared as AHCI controller.
This is not an MFC, but the same was already done in 8-CURRENT in other way.
PR: kern/132082
Modified:
stable/7/sys/dev/ata/ata-pci.c
Modified: stable/7/sys/dev/ata/ata-pci.c
==============================================================================
--- stable/7/sys/dev/ata/ata-pci.c Wed May 13 02:26:34 2009 (r192032)
+++ stable/7/sys/dev/ata/ata-pci.c Wed May 13 02:55:21 2009 (r192033)
@@ -76,12 +76,6 @@ ata_pci_probe(device_t dev)
if (pci_get_class(dev) != PCIC_STORAGE)
return ENXIO;
- /* if this is an AHCI chipset grab it */
- if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) {
- if (!ata_ahci_ident(dev))
- return ATA_PROBE_OK;
- }
-
/* run through the vendor specific drivers */
switch (pci_get_vendor(dev)) {
case ATA_ACARD_ID:
@@ -178,6 +172,12 @@ ata_pci_probe(device_t dev)
break;
}
+ /* if this is an AHCI chipset grab it */
+ if (pci_get_subclass(dev) == PCIS_STORAGE_SATA) {
+ if (!ata_ahci_ident(dev))
+ return ATA_PROBE_OK;
+ }
+
/* unknown chipset, try generic DMA if it seems possible */
if (pci_get_subclass(dev) == PCIS_STORAGE_IDE) {
if (!ata_generic_ident(dev))
From marius at FreeBSD.org Wed May 13 19:26:05 2009
From: marius at FreeBSD.org (Marius Strobl)
Date: Wed May 13 19:26:16 2009
Subject: svn commit: r192060 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/isp
Message-ID: <200905131926.n4DJQ4e5065319@svn.freebsd.org>
Author: marius
Date: Wed May 13 19:26:04 2009
New Revision: 192060
URL: http://svn.freebsd.org/changeset/base/192060
Log:
MFC: r191979
Change uses of the struct ccb_hdr timeout_ch missed when isp(4) was
adapted to MPSAFE cam(4) to a isp(4) specific callout structure.
Thanks to Florian Smeets for providing access to a machine exhibiting
this problem for debugging.
Approved by: mjacob
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/isp/isp_freebsd.c
Modified: stable/7/sys/dev/isp/isp_freebsd.c
==============================================================================
--- stable/7/sys/dev/isp/isp_freebsd.c Wed May 13 18:42:49 2009 (r192059)
+++ stable/7/sys/dev/isp/isp_freebsd.c Wed May 13 19:26:04 2009 (r192060)
@@ -1988,7 +1988,8 @@ isp_watchdog_work(ispsoftc_t *isp, XS_T
isp_done(xs);
} else {
XS_CMD_C_WDOG(xs);
- xs->ccb_h.timeout_ch = timeout(isp_watchdog, xs, hz);
+ callout_reset(&PISP_PCMD((union ccb *)xs)->wdog, hz,
+ isp_watchdog, xs);
XS_CMD_S_GRACE(xs);
isp->isp_sendmarker |= 1 << XS_CHANNEL(xs);
}
@@ -3004,7 +3005,7 @@ isp_done(struct ccb_scsiio *sccb)
XS_CMD_S_DONE(sccb);
if (XS_CMD_WDOG_P(sccb) == 0) {
- untimeout(isp_watchdog, sccb, sccb->ccb_h.timeout_ch);
+ callout_stop(&PISP_PCMD(sccb)->wdog);
if (XS_CMD_GRACE_P(sccb)) {
isp_prt(isp, ISP_LOGDEBUG2,
"finished command on borrowed time");
From des at FreeBSD.org Thu May 14 01:35:45 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 01:36:01 2009
Subject: svn commit: r192068 - in stable/7: etc etc/mtree etc/rc.d
gnu/usr.bin/man gnu/usr.bin/man/man
Message-ID: <200905140135.n4E1ZhQG072751@svn.freebsd.org>
Author: des
Date: Thu May 14 01:35:43 2009
New Revision: 192068
URL: http://svn.freebsd.org/changeset/base/192068
Log:
MFC r183696, r183698: enable UTF-8 for man pages.
Modified:
stable/7/etc/ (props changed)
stable/7/etc/Makefile
stable/7/etc/mtree/BSD.usr.dist
stable/7/etc/rc.d/ (props changed)
stable/7/gnu/usr.bin/man/ (props changed)
stable/7/gnu/usr.bin/man/man/man.c
Modified: stable/7/etc/Makefile
==============================================================================
--- stable/7/etc/Makefile Thu May 14 00:34:26 2009 (r192067)
+++ stable/7/etc/Makefile Thu May 14 01:35:43 2009 (r192068)
@@ -261,6 +261,7 @@ distrib-dirs:
.endif
cd ${DESTDIR}/; rm -f ${DESTDIR}/sys; ln -s usr/src/sys sys
cd ${DESTDIR}/usr/share/man/en.ISO8859-1; ln -sf ../man* .
+ cd ${DESTDIR}/usr/share/man/en.UTF-8; ln -sf ../man* .
cd ${DESTDIR}/usr/share/man; \
set - `grep "^[a-zA-Z]" ${.CURDIR}/man.alias`; \
while [ $$# -gt 0 ] ; \
Modified: stable/7/etc/mtree/BSD.usr.dist
==============================================================================
--- stable/7/etc/mtree/BSD.usr.dist Thu May 14 00:34:26 2009 (r192067)
+++ stable/7/etc/mtree/BSD.usr.dist Thu May 14 01:35:43 2009 (r192068)
@@ -752,6 +752,46 @@
cat9
..
..
+ en.UTF-8 uname=root
+ cat1
+ ..
+ cat1aout
+ ..
+ cat2
+ ..
+ cat3
+ ..
+ cat4
+ amd64
+ ..
+ arm
+ ..
+ i386
+ ..
+ powerpc
+ ..
+ sparc64
+ ..
+ ..
+ cat5
+ ..
+ cat6
+ ..
+ cat7
+ ..
+ cat8
+ amd64
+ ..
+ i386
+ ..
+ powerpc
+ ..
+ sparc64
+ ..
+ ..
+ cat9
+ ..
+ ..
ja uname=root
cat1
..
Modified: stable/7/gnu/usr.bin/man/man/man.c
==============================================================================
--- stable/7/gnu/usr.bin/man/man/man.c Thu May 14 00:34:26 2009 (r192067)
+++ stable/7/gnu/usr.bin/man/man/man.c Thu May 14 01:35:43 2009 (r192068)
@@ -105,6 +105,7 @@ static struct ltable ltable[] = {
{"KOI8-R", "koi8-r"},
{"ISO8859-1", "latin1"},
{"ISO8859-15", "latin1"},
+ {"UTF-8", "utf8"},
{NULL}
};
#endif
From des at FreeBSD.org Thu May 14 01:38:07 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 01:38:25 2009
Subject: svn commit: r192069 - stable/7/lib/libutil
Message-ID: <200905140138.n4E1c6px072838@svn.freebsd.org>
Author: des
Date: Thu May 14 01:38:06 2009
New Revision: 192069
URL: http://svn.freebsd.org/changeset/base/192069
Log:
MFC r184633, r184635, r184683: WARNS cleanup
Modified:
stable/7/lib/libutil/ (props changed)
stable/7/lib/libutil/Makefile
stable/7/lib/libutil/login_cap.c
stable/7/lib/libutil/login_class.c
stable/7/lib/libutil/realhostname.c
Modified: stable/7/lib/libutil/Makefile
==============================================================================
--- stable/7/lib/libutil/Makefile Thu May 14 01:35:43 2009 (r192068)
+++ stable/7/lib/libutil/Makefile Thu May 14 01:38:06 2009 (r192069)
@@ -16,6 +16,8 @@ SRCS= _secure_path.c auth.c gr_util.c ex
stub.c trimdomain.c uucplock.c
INCS= libutil.h login_cap.h
+WARNS?= 6
+
CFLAGS+= -DLIBC_SCCS
.if ${MK_INET6_SUPPORT} != "no"
Modified: stable/7/lib/libutil/login_cap.c
==============================================================================
--- stable/7/lib/libutil/login_cap.c Thu May 14 01:35:43 2009 (r192068)
+++ stable/7/lib/libutil/login_cap.c Thu May 14 01:38:06 2009 (r192069)
@@ -61,6 +61,8 @@ static char * internal_string = NULL;
static size_t internal_arraysz = 0;
static const char ** internal_array = NULL;
+static char path_login_conf[] = _PATH_LOGIN_CONF;
+
static char *
allocstr(const char *str)
{
@@ -215,15 +217,14 @@ login_getclassbyname(char const *name, c
if (dir && snprintf(userpath, MAXPATHLEN, "%s/%s", dir,
_FILE_LOGIN_CONF) < MAXPATHLEN) {
- login_dbarray[i] = userpath;
if (_secure_path(userpath, pwd->pw_uid, pwd->pw_gid) != -1)
- i++; /* only use 'secure' data */
+ login_dbarray[i++] = userpath;
}
/*
* XXX: Why to add the system database if the class is `me'?
*/
- if (_secure_path(_PATH_LOGIN_CONF, 0, 0) != -1)
- login_dbarray[i++] = _PATH_LOGIN_CONF;
+ if (_secure_path(path_login_conf, 0, 0) != -1)
+ login_dbarray[i++] = path_login_conf;
login_dbarray[i] = NULL;
memset(lc, 0, sizeof(login_cap_t));
Modified: stable/7/lib/libutil/login_class.c
==============================================================================
--- stable/7/lib/libutil/login_class.c Thu May 14 01:35:43 2009 (r192068)
+++ stable/7/lib/libutil/login_class.c Thu May 14 01:38:06 2009 (r192069)
@@ -137,14 +137,13 @@ substvar(const char * var, const struct
int tildes = 0;
int dollas = 0;
char *p;
+ const char *q;
if (pwd != NULL) {
- /* Count the number of ~'s in var to substitute */
- for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++)
- ++tildes;
- /* Count the number of $'s in var to substitute */
- for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++)
- ++dollas;
+ for (q = var; *q != '\0'; ++q) {
+ tildes += (*q == '~');
+ dollas += (*q == '$');
+ }
}
np = malloc(strlen(var) + (dollas * nlen)
Modified: stable/7/lib/libutil/realhostname.c
==============================================================================
--- stable/7/lib/libutil/realhostname.c Thu May 14 01:35:43 2009 (r192068)
+++ stable/7/lib/libutil/realhostname.c Thu May 14 01:38:06 2009 (r192069)
@@ -84,6 +84,18 @@ realhostname(char *host, size_t hsize, c
return result;
}
+/*
+ * struct sockaddr has very lax alignment requirements, since all its
+ * members are char or equivalent. This is a problem when trying to
+ * dereference a struct sockaddr_in6 * that was passed in as a struct
+ * sockaddr *. Although we know (or trust) that the passed-in struct was
+ * properly aligned, the compiler doesn't, and (rightly) complains. These
+ * macros perform the cast in a way that the compiler will accept.
+ */
+#define SOCKADDR_IN6(p) ((struct sockaddr_in6 *)(void *)(p))
+#define SOCKADDR_IN(p) ((struct sockaddr_in *)(void *)(p))
+#define SOCKINET(p) ((struct sockinet *)(void *)(p))
+
int
realhostname_sa(char *host, size_t hsize, struct sockaddr *addr, int addrlen)
{
@@ -97,10 +109,10 @@ realhostname_sa(char *host, size_t hsize
/* IPv4 mapped IPv6 addr consideraton, specified in rfc2373. */
if (addr->sa_family == AF_INET6 &&
addrlen == sizeof(struct sockaddr_in6) &&
- IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)addr)->sin6_addr)) {
+ IN6_IS_ADDR_V4MAPPED(&SOCKADDR_IN6(addr)->sin6_addr)) {
struct sockaddr_in6 *sin6;
- sin6 = (struct sockaddr_in6 *)addr;
+ sin6 = SOCKADDR_IN6(addr);
memset(&lsin, 0, sizeof(lsin));
lsin.sin_len = sizeof(struct sockaddr_in);
@@ -143,15 +155,16 @@ realhostname_sa(char *host, size_t hsize
}
if (sa->sa_len == addrlen &&
sa->sa_family == addr->sa_family) {
- ((struct sockinet *)sa)->si_port = ((struct sockinet *)addr)->si_port;
+ SOCKINET(sa)->si_port = SOCKINET(addr)->si_port;
#ifdef INET6
/*
* XXX: sin6_socpe_id may not been
* filled by DNS
*/
if (sa->sa_family == AF_INET6 &&
- ((struct sockaddr_in6 *)sa)->sin6_scope_id == 0)
- ((struct sockaddr_in6 *)sa)->sin6_scope_id = ((struct sockaddr_in6 *)addr)->sin6_scope_id;
+ SOCKADDR_IN6(sa)->sin6_scope_id == 0)
+ SOCKADDR_IN6(sa)->sin6_scope_id =
+ SOCKADDR_IN6(addr)->sin6_scope_id;
#endif
if (!memcmp(sa, addr, sa->sa_len)) {
result = HOSTNAME_FOUND;
From des at FreeBSD.org Thu May 14 01:40:37 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 01:40:50 2009
Subject: svn commit: r192070 - stable/7/libexec/rpc.rquotad
Message-ID: <200905140140.n4E1eacL072946@svn.freebsd.org>
Author: des
Date: Thu May 14 01:40:36 2009
New Revision: 192070
URL: http://svn.freebsd.org/changeset/base/192070
Log:
MFC r184638: style and WARNS cleanup
Modified:
stable/7/libexec/rpc.rquotad/ (props changed)
stable/7/libexec/rpc.rquotad/Makefile
stable/7/libexec/rpc.rquotad/rquotad.c
Modified: stable/7/libexec/rpc.rquotad/Makefile
==============================================================================
--- stable/7/libexec/rpc.rquotad/Makefile Thu May 14 01:38:06 2009 (r192069)
+++ stable/7/libexec/rpc.rquotad/Makefile Thu May 14 01:40:36 2009 (r192070)
@@ -4,6 +4,8 @@ PROG = rpc.rquotad
SRCS = rquotad.c
MAN = rpc.rquotad.8
+WARNS ?= 6
+
DPADD= ${LIBRPCSVC}
LDADD= -lrpcsvc
Modified: stable/7/libexec/rpc.rquotad/rquotad.c
==============================================================================
--- stable/7/libexec/rpc.rquotad/rquotad.c Thu May 14 01:38:06 2009 (r192069)
+++ stable/7/libexec/rpc.rquotad/rquotad.c Thu May 14 01:40:36 2009 (r192070)
@@ -1,39 +1,35 @@
/*
* by Manuel Bouyer (bouyer@ensta.fr)
- *
+ *
* There is no copyright, you can use it as you want.
*/
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
+#include
+__FBSDID("$FreeBSD$");
#include
-#include
#include
#include
#include
#include
-#include
+
+#include
+#include
+#include
+#include
+#include
#include
#include
#include
#include
#include
+#include
#include
#include
#include
-#include
-
#include
-
-#include
-#include
-#include
-#include
-#include
+#include
void rquota_service(struct svc_req *request, SVCXPRT *transp);
void sendquota(struct svc_req *request, SVCXPRT *transp);
@@ -56,15 +52,17 @@ struct fs_stat *fs_begin = NULL;
int from_inetd = 1;
-void
+static void
cleanup(int sig)
{
+
+ (void) sig;
(void) rpcb_unset(RQUOTAPROG, RQUOTAVERS, NULL);
exit(0);
}
int
-main(int argc, char *argv[])
+main(void)
{
SVCXPRT *transp;
int ok;
@@ -101,19 +99,22 @@ main(int argc, char *argv[])
ok = svc_create(rquota_service,
RQUOTAPROG, RQUOTAVERS, "udp");
if (!ok) {
- syslog(LOG_ERR, "unable to register (RQUOTAPROG, RQUOTAVERS, %s)", (!from_inetd)?"udp":"(inetd)");
+ syslog(LOG_ERR,
+ "unable to register (RQUOTAPROG, RQUOTAVERS, %s)",
+ from_inetd ? "(inetd)" : "udp");
exit(1);
}
- initfs(); /* init the fs_stat list */
+ initfs();
svc_run();
syslog(LOG_ERR, "svc_run returned");
exit(1);
}
-void
+void
rquota_service(struct svc_req *request, SVCXPRT *transp)
{
+
switch (request->rq_proc) {
case NULLPROC:
(void)svc_sendreply(transp, (xdrproc_t)xdr_void, (char *)NULL);
@@ -133,7 +134,7 @@ rquota_service(struct svc_req *request,
}
/* read quota for the specified id, and send it */
-void
+void
sendquota(struct svc_req *request, SVCXPRT *transp)
{
struct getquota_args getq_args;
@@ -183,7 +184,7 @@ sendquota(struct svc_req *request, SVCXP
}
}
-void
+void
printerr_reply(SVCXPRT *transp) /* when a reply to a request failed */
{
char name[INET6_ADDRSTRLEN];
@@ -203,7 +204,7 @@ printerr_reply(SVCXPRT *transp) /* when
}
/* initialise the fs_tab list from entries in /etc/fstab */
-void
+void
initfs(void)
{
struct fs_stat *fs_current = NULL;
@@ -222,10 +223,12 @@ initfs(void)
fs_current = (struct fs_stat *) malloc(sizeof(struct fs_stat));
fs_current->fs_next = fs_next; /* next element */
- fs_current->fs_file = malloc(sizeof(char) * (strlen(fs->fs_file) + 1));
+ fs_current->fs_file =
+ malloc(sizeof(char) * (strlen(fs->fs_file) + 1));
strcpy(fs_current->fs_file, fs->fs_file);
- fs_current->qfpathname = malloc(sizeof(char) * (strlen(qfpathname) + 1));
+ fs_current->qfpathname =
+ malloc(sizeof(char) * (strlen(qfpathname) + 1));
strcpy(fs_current->qfpathname, qfpathname);
stat(fs_current->fs_file, &st);
@@ -242,7 +245,7 @@ initfs(void)
* Return 0 if fail, 1 otherwise
*/
int
-getfsquota(long id, char *path, struct dqblk *dqblk)
+getfsquota(long id, char *path, struct dqblk *dqblk)
{
struct stat st_path;
struct fs_stat *fs;
@@ -301,8 +304,8 @@ hasquota(struct fstab *fs, char **qfnam
{
static char initname, usrname[100];
static char buf[BUFSIZ];
- char *opt, *cp;
- char *qfextension[] = INITQFNAMES;
+ char *opt, *cp;
+ const char *qfextension[] = INITQFNAMES;
if (!initname) {
sprintf(usrname, "%s%s", qfextension[USRQUOTA], QUOTAFILENAME);
@@ -321,7 +324,8 @@ hasquota(struct fstab *fs, char **qfnam
*qfnamep = cp;
return (1);
}
- sprintf(buf, "%s/%s.%s", fs->fs_file, QUOTAFILENAME, qfextension[USRQUOTA]);
+ sprintf(buf, "%s/%s.%s", fs->fs_file, QUOTAFILENAME,
+ qfextension[USRQUOTA]);
*qfnamep = buf;
return (1);
}
From des at FreeBSD.org Thu May 14 01:41:55 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 01:42:13 2009
Subject: svn commit: r192071 - stable/7/share/man/man9
Message-ID: <200905140141.n4E1fsdM073019@svn.freebsd.org>
Author: des
Date: Thu May 14 01:41:54 2009
New Revision: 192071
URL: http://svn.freebsd.org/changeset/base/192071
Log:
MFC r184690: missing email address
Modified:
stable/7/share/man/man9/ (props changed)
stable/7/share/man/man9/pseudofs.9
Modified: stable/7/share/man/man9/pseudofs.9
==============================================================================
--- stable/7/share/man/man9/pseudofs.9 Thu May 14 01:40:36 2009 (r192070)
+++ stable/7/share/man/man9/pseudofs.9 Thu May 14 01:41:54 2009 (r192071)
@@ -67,4 +67,4 @@ module appeared in
The
.Nm
module and this manual page were written by
-.An Dag-Erling Sm\(/orgrav .
+.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
From des at FreeBSD.org Thu May 14 02:00:51 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:01:08 2009
Subject: svn commit: r192072 - in stable/7/sys: . compat/linprocfs
contrib/pf dev/ath/ath_hal dev/cxgb
Message-ID: <200905140200.n4E20oui073433@svn.freebsd.org>
Author: des
Date: Thu May 14 02:00:50 2009
New Revision: 192072
URL: http://svn.freebsd.org/changeset/base/192072
Log:
MFC r184691: convert to UTF-8.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/compat/linprocfs/linprocfs.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/7/sys/compat/linprocfs/linprocfs.c Thu May 14 01:41:54 2009 (r192071)
+++ stable/7/sys/compat/linprocfs/linprocfs.c Thu May 14 02:00:50 2009 (r192072)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav
* Copyright (c) 1999 Pierre Beyssac
* Copyright (c) 1993 Jan-Simon Pendry
* Copyright (c) 1993
From des at FreeBSD.org Thu May 14 02:07:42 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:07:49 2009
Subject: svn commit: r192073 - stable/7/usr.bin/fetch
Message-ID: <200905140207.n4E27fHo073613@svn.freebsd.org>
Author: des
Date: Thu May 14 02:07:41 2009
New Revision: 192073
URL: http://svn.freebsd.org/changeset/base/192073
Log:
MFC 185912: Apply the same defaults to HTTPS as to HTTP.
MFC 187361: Fix FTP / HTTP timeouts
Modified:
stable/7/usr.bin/fetch/ (props changed)
stable/7/usr.bin/fetch/fetch.c
Modified: stable/7/usr.bin/fetch/fetch.c
==============================================================================
--- stable/7/usr.bin/fetch/fetch.c Thu May 14 02:00:50 2009 (r192072)
+++ stable/7/usr.bin/fetch/fetch.c Thu May 14 02:07:41 2009 (r192073)
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
+ * Copyright (c) 2000-2004 Dag-Erling Coïdan Smørgrav
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include
#define MINBUFSIZE 4096
+#define TIMEOUT 120
/* Option flags */
int A_flag; /* -A: do not follow 302 redirects */
@@ -75,7 +76,7 @@ int R_flag; /* -R: don't delete part
int r_flag; /* -r: restart previously interrupted transfer */
off_t S_size; /* -S: require size to match */
int s_flag; /* -s: show size, don't fetch */
-long T_secs = 120; /* -T: transfer timeout in seconds */
+long T_secs; /* -T: transfer timeout in seconds */
int t_flag; /*! -t: workaround TCP bug */
int U_flag; /* -U: do not use high ports */
int v_level = 1; /* -v: verbosity level */
@@ -88,8 +89,8 @@ int sigalrm; /* SIGALRM received */
int siginfo; /* SIGINFO received */
int sigint; /* SIGINT received */
-long ftp_timeout; /* default timeout for FTP transfers */
-long http_timeout; /* default timeout for HTTP transfers */
+long ftp_timeout = TIMEOUT; /* default timeout for FTP transfers */
+long http_timeout = TIMEOUT; /* default timeout for HTTP transfers */
char *buf; /* transfer buffer */
@@ -376,7 +377,8 @@ fetch(char *URL, const char *path)
}
/* HTTP specific flags */
- if (strcmp(url->scheme, SCHEME_HTTP) == 0) {
+ if (strcmp(url->scheme, SCHEME_HTTP) == 0 ||
+ strcmp(url->scheme, SCHEME_HTTPS) == 0) {
if (d_flag)
strcat(flags, "d");
if (A_flag)
From des at FreeBSD.org Thu May 14 02:09:10 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:09:27 2009
Subject: svn commit: r192074 - stable/7/share/man/man9
Message-ID: <200905140209.n4E299x9073684@svn.freebsd.org>
Author: des
Date: Thu May 14 02:09:09 2009
New Revision: 192074
URL: http://svn.freebsd.org/changeset/base/192074
Log:
MFC r186224: exeunt
Modified:
stable/7/share/man/man9/ (props changed)
stable/7/share/man/man9/style.9
Modified: stable/7/share/man/man9/style.9
==============================================================================
--- stable/7/share/man/man9/style.9 Thu May 14 02:07:41 2009 (r192073)
+++ stable/7/share/man/man9/style.9 Thu May 14 02:09:09 2009 (r192074)
@@ -26,7 +26,7 @@
.\" From: @(#)style 1.14 (Berkeley) 4/28/95
.\" $FreeBSD$
.\"
-.Dd February 10, 2005
+.Dd December 17, 2008
.Dt STYLE 9
.Os
.Sh NAME
@@ -602,11 +602,9 @@ Do YOU understand the following?
k = !(l & FLAGS);
.Ed
.Pp
-Exits should be 0 on success, or according to the predefined
-values in
-.Xr sysexits 3 .
+Exits should be 0 on success, or 1 on failure.
.Bd -literal
- exit(EX_OK); /*
+ exit(0); /*
* Avoid obvious comments such as
* "Exit 0 on success."
*/
@@ -806,7 +804,7 @@ placed in a single set of brackets.
.Ed
.Bd -literal
(void)fprintf(stderr, "usage: f [-ab]\en");
- exit(EX_USAGE);
+ exit(1);
}
.Ed
.Pp
@@ -840,7 +838,6 @@ and produce minimal warnings.
.Xr indent 1 ,
.Xr lint 1 ,
.Xr err 3 ,
-.Xr sysexits 3 ,
.Xr warn 3 ,
.Xr style.Makefile 5
.Sh HISTORY
From des at FreeBSD.org Thu May 14 02:10:32 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:10:49 2009
Subject: svn commit: r192075 - stable/7/usr.bin/sockstat
Message-ID: <200905140210.n4E2AW5S073769@svn.freebsd.org>
Author: des
Date: Thu May 14 02:10:31 2009
New Revision: 192075
URL: http://svn.freebsd.org/changeset/base/192075
Log:
MFC r187915: make sure columns don't run into each other.
PR: bin/129318
Modified:
stable/7/usr.bin/sockstat/ (props changed)
stable/7/usr.bin/sockstat/sockstat.c
Modified: stable/7/usr.bin/sockstat/sockstat.c
==============================================================================
--- stable/7/usr.bin/sockstat/sockstat.c Thu May 14 02:09:09 2009 (r192074)
+++ stable/7/usr.bin/sockstat/sockstat.c Thu May 14 02:10:31 2009 (r192075)
@@ -584,25 +584,25 @@ display(void)
continue;
pos = 0;
if ((pwd = getpwuid(xf->xf_uid)) == NULL)
- pos += xprintf("%lu", (u_long)xf->xf_uid);
+ pos += xprintf("%lu ", (u_long)xf->xf_uid);
else
- pos += xprintf("%s", pwd->pw_name);
+ pos += xprintf("%s ", pwd->pw_name);
while (pos < 9)
pos += xprintf(" ");
pos += xprintf("%.10s", getprocname(xf->xf_pid));
while (pos < 20)
pos += xprintf(" ");
- pos += xprintf("%lu", (u_long)xf->xf_pid);
+ pos += xprintf("%lu ", (u_long)xf->xf_pid);
while (pos < 26)
pos += xprintf(" ");
- pos += xprintf("%d", xf->xf_fd);
+ pos += xprintf("%d ", xf->xf_fd);
while (pos < 29)
pos += xprintf(" ");
pos += xprintf("%s", s->protoname);
if (s->vflag & INP_IPV4)
- pos += xprintf("4");
+ pos += xprintf("4 ");
if (s->vflag & INP_IPV6)
- pos += xprintf("6");
+ pos += xprintf("6 ");
while (pos < 36)
pos += xprintf(" ");
switch (s->family) {
From des at FreeBSD.org Thu May 14 02:14:47 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:14:52 2009
Subject: svn commit: r192076 - in stable/7/etc: . rc.d
Message-ID: <200905140214.n4E2EkAI073893@svn.freebsd.org>
Author: des
Date: Thu May 14 02:14:46 2009
New Revision: 192076
URL: http://svn.freebsd.org/changeset/base/192076
Log:
MFC r190032: add hostid
Modified:
stable/7/etc/ (props changed)
stable/7/etc/netstart
stable/7/etc/rc.d/ (props changed)
Modified: stable/7/etc/netstart
==============================================================================
--- stable/7/etc/netstart Thu May 14 02:10:31 2009 (r192075)
+++ stable/7/etc/netstart Thu May 14 02:14:46 2009 (r192076)
@@ -38,6 +38,7 @@
load_rc_config 'XXX'
/etc/rc.d/devd start
+/etc/rc.d/hostid start
/etc/rc.d/hostname start
/etc/rc.d/ipmon start
/etc/rc.d/ipfilter start
From des at FreeBSD.org Thu May 14 02:20:38 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:20:55 2009
Subject: svn commit: r192077 - stable/7/share/timedef
Message-ID: <200905140220.n4E2Kblu074046@svn.freebsd.org>
Author: des
Date: Thu May 14 02:20:37 2009
New Revision: 192077
URL: http://svn.freebsd.org/changeset/base/192077
Log:
MFC r190774: fix ISO8859-15 links for nb_NO / no_NO.
Modified:
stable/7/share/timedef/ (props changed)
stable/7/share/timedef/Makefile
Modified: stable/7/share/timedef/Makefile
==============================================================================
--- stable/7/share/timedef/Makefile Thu May 14 02:14:46 2009 (r192076)
+++ stable/7/share/timedef/Makefile Thu May 14 02:20:37 2009 (r192077)
@@ -126,10 +126,9 @@ GB2312_GBK= zh_CN
ISO8859-1_ISO8859-1= ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} \
${NL_LINKS} ${NO_LINKS} en_US:af_ZA
ISO8859-1_ISO8859-15= ca_ES da_DK de_AT de_DE en_GB en_US es_ES eu_ES \
- fi_FI fr_FR is_IS it_IT la_LN nl_NL nn_NO no_NO pt_PT \
+ fi_FI fr_FR is_IS it_IT la_LN nb_NO nl_NL nn_NO no_NO pt_PT \
sv_SE \
- ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} ${NL_LINKS} \
- ${NO_LINKS}
+ ${DE_LINKS} ${FR_LINKS} ${GB_LINKS} ${IT_LINKS} ${NL_LINKS}
ISO8859-1_US-ASCII= ${GB_LINKS} en_GB en_US la_LN
ISO8859-1_ISO8859-2= la_LN
ISO8859-1_ISO8859-4= la_LN
From des at FreeBSD.org Thu May 14 02:27:39 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:27:57 2009
Subject: svn commit: r192078 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/ichwd
Message-ID: <200905140227.n4E2RcjA074228@svn.freebsd.org>
Author: des
Date: Thu May 14 02:27:38 2009
New Revision: 192078
URL: http://svn.freebsd.org/changeset/base/192078
Log:
MFC r190030: rename a couple of functions, add comments
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/ichwd/ichwd.c
Modified: stable/7/sys/dev/ichwd/ichwd.c
==============================================================================
--- stable/7/sys/dev/ichwd/ichwd.c Thu May 14 02:20:37 2009 (r192077)
+++ stable/7/sys/dev/ichwd/ichwd.c Thu May 14 02:27:38 2009 (r192078)
@@ -141,26 +141,55 @@ static devclass_t ichwd_devclass;
device_printf(dev, __VA_ARGS__);\
} while (0)
+/*
+ * Disable the watchdog timeout SMI handler.
+ *
+ * Apparently, some BIOSes install handlers that reset or disable the
+ * watchdog timer instead of resetting the system, so we disable the SMI
+ * (by clearing the SMI_TCO_EN bit of the SMI_EN register) to prevent this
+ * from happening.
+ */
static __inline void
-ichwd_intr_enable(struct ichwd_softc *sc)
+ichwd_smi_disable(struct ichwd_softc *sc)
{
ichwd_write_smi_4(sc, SMI_EN, ichwd_read_smi_4(sc, SMI_EN) & ~SMI_TCO_EN);
}
+/*
+ * Enable the watchdog timeout SMI handler. See above for details.
+ */
static __inline void
-ichwd_intr_disable(struct ichwd_softc *sc)
+ichwd_smi_enable(struct ichwd_softc *sc)
{
ichwd_write_smi_4(sc, SMI_EN, ichwd_read_smi_4(sc, SMI_EN) | SMI_TCO_EN);
}
+/*
+ * Reset the watchdog status bits.
+ */
static __inline void
ichwd_sts_reset(struct ichwd_softc *sc)
{
+ /*
+ * The watchdog status bits are set to 1 by the hardware to
+ * indicate various conditions. They can be cleared by software
+ * by writing a 1, not a 0.
+ */
ichwd_write_tco_2(sc, TCO1_STS, TCO_TIMEOUT);
+ /*
+ * XXX The datasheet says that TCO_SECOND_TO_STS must be cleared
+ * before TCO_BOOT_STS, not the other way around.
+ */
ichwd_write_tco_2(sc, TCO2_STS, TCO_BOOT_STS);
ichwd_write_tco_2(sc, TCO2_STS, TCO_SECOND_TO_STS);
}
+/*
+ * Enable the watchdog timer by clearing the TCO_TMR_HALT bit in the
+ * TCO1_CNT register. This is complicated by the need to preserve bit 9
+ * of that same register, and the requirement that all other bits must be
+ * written back as zero.
+ */
static __inline void
ichwd_tmr_enable(struct ichwd_softc *sc)
{
@@ -172,6 +201,9 @@ ichwd_tmr_enable(struct ichwd_softc *sc)
ichwd_verbose_printf(sc->device, "timer enabled\n");
}
+/*
+ * Disable the watchdog timer. See above for details.
+ */
static __inline void
ichwd_tmr_disable(struct ichwd_softc *sc)
{
@@ -183,6 +215,11 @@ ichwd_tmr_disable(struct ichwd_softc *sc
ichwd_verbose_printf(sc->device, "timer disabled\n");
}
+/*
+ * Reload the watchdog timer: writing anything to any of the lower five
+ * bits of the TCO_RLD register reloads the timer from the last value
+ * written to TCO_TMR.
+ */
static __inline void
ichwd_tmr_reload(struct ichwd_softc *sc)
{
@@ -194,6 +231,10 @@ ichwd_tmr_reload(struct ichwd_softc *sc)
ichwd_verbose_printf(sc->device, "timer reloaded\n");
}
+/*
+ * Set the initial timeout value. Note that this must always be followed
+ * by a reload.
+ */
static __inline void
ichwd_tmr_set(struct ichwd_softc *sc, unsigned int timeout)
{
@@ -262,7 +303,8 @@ ichwd_clear_noreboot(struct ichwd_softc
}
/*
- * Watchdog event handler.
+ * Watchdog event handler - called by the framework to enable or disable
+ * the watchdog or change the initial timeout value.
*/
static void
ichwd_event(void *arg, unsigned int cmd, int *error)
@@ -426,6 +468,13 @@ ichwd_attach(device_t dev)
device_printf(dev, "%s (ICH%d or equivalent)\n",
device_get_desc(dev), sc->ich_version);
+ /*
+ * XXX we should check the status registers (specifically, the
+ * TCO_SECOND_TO_STS bit in the TCO2_STS register) to see if we
+ * just came back from a watchdog-induced reset, and let the user
+ * know.
+ */
+
/* reset the watchdog status registers */
ichwd_sts_reset(sc);
@@ -435,8 +484,8 @@ ichwd_attach(device_t dev)
/* register the watchdog event handler */
sc->ev_tag = EVENTHANDLER_REGISTER(watchdog_list, ichwd_event, sc, 0);
- /* enable watchdog timeout interrupts */
- ichwd_intr_enable(sc);
+ /* disable the SMI handler */
+ ichwd_smi_disable(sc);
return (0);
fail:
@@ -466,8 +515,8 @@ ichwd_detach(device_t dev)
if (sc->active)
ichwd_tmr_disable(sc);
- /* disable watchdog timeout interrupts */
- ichwd_intr_disable(sc);
+ /* enable the SMI handler */
+ ichwd_smi_enable(sc);
/* deregister event handler */
if (sc->ev_tag != NULL)
From des at FreeBSD.org Thu May 14 02:42:32 2009
From: des at FreeBSD.org (Dag-Erling Smorgrav)
Date: Thu May 14 02:42:38 2009
Subject: svn commit: r192079 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb fs/procfs fs/pseudofs
Message-ID: <200905140242.n4E2gTCr074630@svn.freebsd.org>
Author: des
Date: Thu May 14 02:42:29 2009
New Revision: 192079
URL: http://svn.freebsd.org/changeset/base/192079
Log:
MFC r188677: always call pfs_attr if defined
MFC r190806: fix incorrect KASSERT, add more
MFC r188677: remove incorrect locking
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/fs/procfs/procfs.c
stable/7/sys/fs/pseudofs/pseudofs_vnops.c
Modified: stable/7/sys/fs/procfs/procfs.c
==============================================================================
--- stable/7/sys/fs/procfs/procfs.c Thu May 14 02:27:38 2009 (r192078)
+++ stable/7/sys/fs/procfs/procfs.c Thu May 14 02:42:29 2009 (r192079)
@@ -99,7 +99,6 @@ procfs_docurproc(PFS_FILL_ARGS)
int
procfs_attr(PFS_ATTR_ARGS)
{
- PROC_LOCK_ASSERT(p, MA_OWNED);
/* XXX inefficient, split into separate functions */
if (strcmp(pn->pn_name, "ctl") == 0 ||
@@ -112,11 +111,12 @@ procfs_attr(PFS_ATTR_ARGS)
strcmp(pn->pn_name, "fpregs") == 0)
vap->va_mode = 0600;
- if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
- vap->va_mode = 0;
+ if (p != NULL) {
+ PROC_LOCK_ASSERT(p, MA_OWNED);
- vap->va_uid = p->p_ucred->cr_uid;
- vap->va_gid = p->p_ucred->cr_gid;
+ if ((p->p_flag & P_SUGID) && pn->pn_type != pfstype_procdir)
+ vap->va_mode = 0;
+ }
return (0);
}
Modified: stable/7/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- stable/7/sys/fs/pseudofs/pseudofs_vnops.c Thu May 14 02:27:38 2009 (r192078)
+++ stable/7/sys/fs/pseudofs/pseudofs_vnops.c Thu May 14 02:42:29 2009 (r192079)
@@ -52,6 +52,20 @@ __FBSDID("$FreeBSD$");
#include
#include
+#define KASSERT_PN_IS_DIR(pn) \
+ KASSERT((pn)->pn_type == pfstype_root || \
+ (pn)->pn_type == pfstype_dir || \
+ (pn)->pn_type == pfstype_procdir, \
+ ("%s(): VDIR vnode refers to non-directory pfs_node", __func__))
+
+#define KASSERT_PN_IS_FILE(pn) \
+ KASSERT((pn)->pn_type == pfstype_file, \
+ ("%s(): VREG vnode refers to non-file pfs_node", __func__))
+
+#define KASSERT_PN_IS_LINK(pn) \
+ KASSERT((pn)->pn_type == pfstype_symlink, \
+ ("%s(): VLNK vnode refers to non-link pfs_node", __func__))
+
/*
* Returns the fileno, adjusted for target pid
*/
@@ -226,14 +240,17 @@ pfs_getattr(struct vop_getattr_args *va)
if (proc != NULL) {
vap->va_uid = proc->p_ucred->cr_ruid;
vap->va_gid = proc->p_ucred->cr_rgid;
- if (pn->pn_attr != NULL)
- error = pn_attr(va->a_td, proc, pn, vap);
- PROC_UNLOCK(proc);
} else {
vap->va_uid = 0;
vap->va_gid = 0;
}
+ if (pn->pn_attr != NULL)
+ error = pn_attr(va->a_td, proc, pn, vap);
+
+ if(proc != NULL)
+ PROC_UNLOCK(proc);
+
PFS_RETURN (error);
}
@@ -254,6 +271,7 @@ pfs_ioctl(struct vop_ioctl_args *va)
if (vn->v_type != VREG)
PFS_RETURN (EINVAL);
+ KASSERT_PN_IS_FILE(pn);
if (pn->pn_ioctl == NULL)
PFS_RETURN (ENOTTY);
@@ -330,6 +348,7 @@ pfs_lookup(struct vop_cachedlookup_args
if (vn->v_type != VDIR)
PFS_RETURN (ENOTDIR);
+ KASSERT_PN_IS_DIR(pd);
error = VOP_ACCESS(vn, VEXEC, cnp->cn_cred, cnp->cn_thread);
if (error)
@@ -484,6 +503,7 @@ pfs_read(struct vop_read_args *va)
if (vn->v_type != VREG)
PFS_RETURN (EINVAL);
+ KASSERT_PN_IS_FILE(pn);
if (!(pn->pn_flags & PFS_RD))
PFS_RETURN (EBADF);
@@ -626,6 +646,7 @@ pfs_readdir(struct vop_readdir_args *va)
if (vn->v_type != VDIR)
PFS_RETURN (ENOTDIR);
+ KASSERT_PN_IS_DIR(pd);
uio = va->a_uio;
/* only allow reading entire entries */
@@ -734,6 +755,7 @@ pfs_readlink(struct vop_readlink_args *v
if (vn->v_type != VLNK)
PFS_RETURN (EINVAL);
+ KASSERT_PN_IS_LINK(pn);
if (pn->pn_fill == NULL)
PFS_RETURN (EIO);
@@ -819,8 +841,7 @@ pfs_write(struct vop_write_args *va)
if (vn->v_type != VREG)
PFS_RETURN (EINVAL);
- KASSERT(pn->pn_type != pfstype_file,
- ("%s(): VREG vnode refers to non-file pfs_node", __func__));
+ KASSERT_PN_IS_FILE(pn);
if (!(pn->pn_flags & PFS_WR))
PFS_RETURN (EBADF);
@@ -840,9 +861,7 @@ pfs_write(struct vop_write_args *va)
}
if (pn->pn_flags & PFS_RAWWR) {
- pfs_lock(pn);
error = pn_fill(curthread, proc, pn, NULL, uio);
- pfs_unlock(pn);
if (proc != NULL)
PRELE(proc);
PFS_RETURN (error);
From vanhu at FreeBSD.org Thu May 14 07:32:34 2009
From: vanhu at FreeBSD.org (VANHULLEBUS Yvan)
Date: Thu May 14 07:32:51 2009
Subject: svn commit: r192088 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb netipsec
Message-ID: <200905140732.n4E7WXpn080800@svn.freebsd.org>
Author: vanhu
Date: Thu May 14 07:32:33 2009
New Revision: 192088
URL: http://svn.freebsd.org/changeset/base/192088
Log:
MFC: Fixed deletion of sav entries in key_delsah()
Approved by: gnn(mentor)
Obtained from: NETASQ
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/netipsec/key.c
Modified: stable/7/sys/netipsec/key.c
==============================================================================
--- stable/7/sys/netipsec/key.c Thu May 14 06:50:30 2009 (r192087)
+++ stable/7/sys/netipsec/key.c Thu May 14 07:32:33 2009 (r192088)
@@ -2654,7 +2654,12 @@ key_delsah(sah)
if (sav->refcnt == 0) {
/* sanity check */
KEY_CHKSASTATE(state, sav->state, __func__);
- KEY_FREESAV(&sav);
+ /*
+ * do NOT call KEY_FREESAV here:
+ * it will only delete the sav if refcnt == 1,
+ * where we already know that refcnt == 0
+ */
+ key_delsav(sav);
} else {
/* give up to delete this sa */
zombie++;
@@ -4086,6 +4091,7 @@ key_flush_sad(time_t now)
/* if LARVAL entry doesn't become MATURE, delete it. */
LIST_FOREACH_SAFE(sav, &sah->savtree[SADB_SASTATE_LARVAL], chain, nextsav) {
+ /* Need to also check refcnt for a larval SA ??? */
if (now - sav->created > key_larval_lifetime)
KEY_FREESAV(&sav);
}
From kib at FreeBSD.org Thu May 14 11:03:07 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Thu May 14 11:03:18 2009
Subject: svn commit: r192095 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905141103.n4EB36g2089216@svn.freebsd.org>
Author: kib
Date: Thu May 14 11:03:05 2009
New Revision: 192095
URL: http://svn.freebsd.org/changeset/base/192095
Log:
MFC r192001:
Prevent overflow of uio_resid.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/vfs_syscalls.c
Modified: stable/7/sys/kern/vfs_syscalls.c
==============================================================================
--- stable/7/sys/kern/vfs_syscalls.c Thu May 14 10:54:57 2009 (r192094)
+++ stable/7/sys/kern/vfs_syscalls.c Thu May 14 11:03:05 2009 (r192095)
@@ -2360,6 +2360,9 @@ kern_readlink(struct thread *td, char *p
struct nameidata nd;
int vfslocked;
+ if (count > INT_MAX)
+ return (EINVAL);
+
NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKSHARED | LOCKLEAF | MPSAFE |
AUDITVNODE1, pathseg, path, td);
if ((error = namei(&nd)) != 0)
From ed at FreeBSD.org Thu May 14 22:01:02 2009
From: ed at FreeBSD.org (Ed Schouten)
Date: Thu May 14 22:01:08 2009
Subject: svn commit: r192123 - stable/7/usr.sbin/pstat
Message-ID: <200905142201.n4EM10EM003735@svn.freebsd.org>
Author: ed
Date: Thu May 14 22:01:00 2009
New Revision: 192123
URL: http://svn.freebsd.org/changeset/base/192123
Log:
Make the layout of pstat -t less awful.
Right now we have a device named "consolectl", but pstat only reserves 7
columns for the device name. Increase it to 10 to make it fit.
This patch only applies to pre-MPSAFE TTY.
Modified:
stable/7/usr.sbin/pstat/pstat.c
Modified: stable/7/usr.sbin/pstat/pstat.c
==============================================================================
--- stable/7/usr.sbin/pstat/pstat.c Thu May 14 21:53:35 2009 (r192122)
+++ stable/7/usr.sbin/pstat/pstat.c Thu May 14 22:01:00 2009 (r192123)
@@ -215,7 +215,7 @@ static const char fhdr64[] =
/* c000000000000000 ------ RWAI 123 123 c000000000000000 1000000000000000 */
static const char hdr[] =
-" LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n";
+" LINE RAW CAN OUT IHIWT ILOWT OHWT LWT COL STATE SESS PGID DISC\n";
static void
ttymode_kvm(void)
@@ -348,9 +348,9 @@ ttyprt(struct xtty *xt)
errx(1, "struct xtty size mismatch");
if (usenumflag || xt->xt_dev == 0 ||
(name = devname(xt->xt_dev, S_IFCHR)) == NULL)
- printf(" %2d,%-2d", major(xt->xt_dev), minor(xt->xt_dev));
+ printf("%5d,%4d ", major(xt->xt_dev), minor(xt->xt_dev));
else
- (void)printf("%7s ", name);
+ (void)printf("%10s ", name);
(void)printf("%2ld %3ld ", xt->xt_rawcc, xt->xt_cancc);
(void)printf("%3ld %5d %5d %4d %3d %7d ", xt->xt_outcc,
xt->xt_ihiwat, xt->xt_ilowat, xt->xt_ohiwat, xt->xt_olowat,
From bms at FreeBSD.org Fri May 15 05:31:01 2009
From: bms at FreeBSD.org (Bruce Simpson)
Date: Fri May 15 05:31:33 2009
Subject: svn commit: r192033 - stable/7/sys/dev/ata
In-Reply-To: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
References: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
Message-ID: <4A0CF9EA.6080403@FreeBSD.org>
Hi,
Could this commit have broken boot on my amd64 system with an ULi SATA
controller?
I have not fully bisected (and to be honest, who really has time to do
this for production machines, unless
The panic I get with RELENG_7 sources as of yesterday after this commit
is 'resource list busy'. If you need any more information let me know, I
have transcribed the backtrace and posted it to stable@.
thanks,
BMS
Alexander Motin wrote:
> Author: mav
> Date: Wed May 13 02:55:21 2009
> New Revision: 192033
> URL: http://svn.freebsd.org/changeset/base/192033
>
> Log:
> Make vendor-specific drivers prefered over the generic AHCI one.
> This fixes some controllers, like JMicron ones, which provide also PATA via
> PCI function that declared as AHCI controller.
>
> This is not an MFC, but the same was already done in 8-CURRENT in other way.
>
> PR: kern/132082
>
> ...
>
From kib at FreeBSD.org Fri May 15 10:45:53 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Fri May 15 10:46:13 2009
Subject: svn commit: r192140 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb fs/fdescfs
Message-ID: <200905151045.n4FAjqIw019934@svn.freebsd.org>
Author: kib
Date: Fri May 15 10:45:52 2009
New Revision: 192140
URL: http://svn.freebsd.org/changeset/base/192140
Log:
MFC r192012:
Return controlled EINVAL when the fdescfs lookup routine is given string
representing too large integer, instead of overflowing and possibly
returning a random but valid vnode.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/fs/fdescfs/fdesc_vnops.c
Modified: stable/7/sys/fs/fdescfs/fdesc_vnops.c
==============================================================================
--- stable/7/sys/fs/fdescfs/fdesc_vnops.c Fri May 15 10:11:54 2009 (r192139)
+++ stable/7/sys/fs/fdescfs/fdesc_vnops.c Fri May 15 10:45:52 2009 (r192140)
@@ -264,7 +264,7 @@ fdesc_lookup(ap)
struct thread *td = cnp->cn_thread;
struct file *fp;
int nlen = cnp->cn_namelen;
- u_int fd;
+ u_int fd, fd1;
int error;
struct vnode *fvp;
@@ -296,7 +296,12 @@ fdesc_lookup(ap)
error = ENOENT;
goto bad;
}
- fd = 10 * fd + *pname++ - '0';
+ fd1 = 10 * fd + *pname++ - '0';
+ if (fd1 < fd) {
+ error = ENOENT;
+ goto bad;
+ }
+ fd = fd1;
}
if ((error = fget(td, fd, &fp)) != 0)
From dfr at FreeBSD.org Fri May 15 13:58:46 2009
From: dfr at FreeBSD.org (Doug Rabson)
Date: Fri May 15 13:59:04 2009
Subject: svn commit: r192142 - stable/7/sys/rpc
Message-ID: <200905151358.n4FDwjoX025344@svn.freebsd.org>
Author: dfr
Date: Fri May 15 13:58:45 2009
New Revision: 192142
URL: http://svn.freebsd.org/changeset/base/192142
Log:
Back port a change to the locking model used to manage active transports from
FreeBSD-current to avoid a deadlock.
PR: 130628
Modified:
stable/7/sys/rpc/svc.c
stable/7/sys/rpc/svc.h
stable/7/sys/rpc/svc_dg.c
stable/7/sys/rpc/svc_vc.c
Modified: stable/7/sys/rpc/svc.c
==============================================================================
--- stable/7/sys/rpc/svc.c Fri May 15 13:26:54 2009 (r192141)
+++ stable/7/sys/rpc/svc.c Fri May 15 13:58:45 2009 (r192142)
@@ -178,18 +178,23 @@ xprt_active(SVCXPRT *xprt)
}
void
-xprt_inactive(SVCXPRT *xprt)
+xprt_inactive_locked(SVCXPRT *xprt)
{
SVCPOOL *pool = xprt->xp_pool;
- mtx_lock(&pool->sp_lock);
-
if (xprt->xp_active) {
TAILQ_REMOVE(&pool->sp_active, xprt, xp_alink);
xprt->xp_active = FALSE;
}
- wakeup(&pool->sp_active);
+}
+void
+xprt_inactive(SVCXPRT *xprt)
+{
+ SVCPOOL *pool = xprt->xp_pool;
+
+ mtx_lock(&pool->sp_lock);
+ xprt_inactive_locked(xprt);
mtx_unlock(&pool->sp_lock);
}
Modified: stable/7/sys/rpc/svc.h
==============================================================================
--- stable/7/sys/rpc/svc.h Fri May 15 13:26:54 2009 (r192141)
+++ stable/7/sys/rpc/svc.h Fri May 15 13:58:45 2009 (r192142)
@@ -47,6 +47,7 @@
#include
#include
#include
+#include
#endif
/*
@@ -128,7 +129,7 @@ struct __rpc_svcpool;
*/
typedef struct __rpc_svcxprt {
#ifdef _KERNEL
- struct mtx xp_lock;
+ struct sx xp_lock;
struct __rpc_svcpool *xp_pool; /* owning pool (see below) */
TAILQ_ENTRY(__rpc_svcxprt) xp_link;
TAILQ_ENTRY(__rpc_svcxprt) xp_alink;
@@ -332,6 +333,7 @@ __END_DECLS
__BEGIN_DECLS
extern void xprt_active(SVCXPRT *);
extern void xprt_inactive(SVCXPRT *);
+extern void xprt_inactive_locked(SVCXPRT *);
__END_DECLS
#endif
Modified: stable/7/sys/rpc/svc_dg.c
==============================================================================
--- stable/7/sys/rpc/svc_dg.c Fri May 15 13:26:54 2009 (r192141)
+++ stable/7/sys/rpc/svc_dg.c Fri May 15 13:58:45 2009 (r192142)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
@@ -118,7 +119,7 @@ svc_dg_create(SVCPOOL *pool, struct sock
xprt = mem_alloc(sizeof (SVCXPRT));
memset(xprt, 0, sizeof (SVCXPRT));
- mtx_init(&xprt->xp_lock, "xprt->xp_lock", NULL, MTX_DEF);
+ sx_init(&xprt->xp_lock, "xprt->xp_lock");
xprt->xp_pool = pool;
xprt->xp_socket = so;
xprt->xp_p1 = NULL;
@@ -161,6 +162,9 @@ static enum xprt_stat
svc_dg_stat(SVCXPRT *xprt)
{
+ if (soreadable(xprt->xp_socket))
+ return (XPRT_MOREREQS);
+
return (XPRT_IDLE);
}
@@ -173,22 +177,17 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms
int error, rcvflag;
/*
+ * Serialise access to the socket.
+ */
+ sx_xlock(&xprt->xp_lock);
+
+ /*
* The socket upcall calls xprt_active() which will eventually
* cause the server to call us here. We attempt to read a
* packet from the socket and process it. If the read fails,
* we have drained all pending requests so we call
* xprt_inactive().
- *
- * The lock protects us in the case where a new packet arrives
- * on the socket after our call to soreceive fails with
- * EWOULDBLOCK - the call to xprt_active() in the upcall will
- * happen only after our call to xprt_inactive() which ensures
- * that we will remain active. It might be possible to use
- * SOCKBUF_LOCK for this - its not clear to me what locks are
- * held during the upcall.
*/
- mtx_lock(&xprt->xp_lock);
-
uio.uio_resid = 1000000000;
uio.uio_td = curthread;
mreq = NULL;
@@ -196,8 +195,19 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms
error = soreceive(xprt->xp_socket, &raddr, &uio, &mreq, NULL, &rcvflag);
if (error == EWOULDBLOCK) {
- xprt_inactive(xprt);
- mtx_unlock(&xprt->xp_lock);
+ /*
+ * We must re-test for readability after taking the
+ * lock to protect us in the case where a new packet
+ * arrives on the socket after our call to soreceive
+ * fails with EWOULDBLOCK. The pool lock protects us
+ * from racing the upcall after our soreadable() call
+ * returns false.
+ */
+ mtx_lock(&xprt->xp_pool->sp_lock);
+ if (!soreadable(xprt->xp_socket))
+ xprt_inactive_locked(xprt);
+ mtx_unlock(&xprt->xp_pool->sp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
@@ -208,11 +218,11 @@ svc_dg_recv(SVCXPRT *xprt, struct rpc_ms
xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL;
SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
xprt_inactive(xprt);
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
KASSERT(raddr->sa_len < xprt->xp_rtaddr.maxlen,
("Unexpected remote address length"));
@@ -301,7 +311,7 @@ svc_dg_destroy(SVCXPRT *xprt)
xprt_unregister(xprt);
- mtx_destroy(&xprt->xp_lock);
+ sx_destroy(&xprt->xp_lock);
if (xprt->xp_socket)
(void)soclose(xprt->xp_socket);
@@ -328,7 +338,5 @@ svc_dg_soupcall(struct socket *so, void
{
SVCXPRT *xprt = (SVCXPRT *) arg;
- mtx_lock(&xprt->xp_lock);
xprt_active(xprt);
- mtx_unlock(&xprt->xp_lock);
}
Modified: stable/7/sys/rpc/svc_vc.c
==============================================================================
--- stable/7/sys/rpc/svc_vc.c Fri May 15 13:26:54 2009 (r192141)
+++ stable/7/sys/rpc/svc_vc.c Fri May 15 13:58:45 2009 (r192142)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
#include
@@ -142,7 +143,7 @@ svc_vc_create(SVCPOOL *pool, struct sock
}
xprt = mem_alloc(sizeof(SVCXPRT));
- mtx_init(&xprt->xp_lock, "xprt->xp_lock", NULL, MTX_DEF);
+ sx_init(&xprt->xp_lock, "xprt->xp_lock");
xprt->xp_pool = pool;
xprt->xp_socket = so;
xprt->xp_p1 = NULL;
@@ -219,7 +220,7 @@ svc_vc_create_conn(SVCPOOL *pool, struct
cd->strm_stat = XPRT_IDLE;
xprt = mem_alloc(sizeof(SVCXPRT));
- mtx_init(&xprt->xp_lock, "xprt->xp_lock", NULL, MTX_DEF);
+ sx_init(&xprt->xp_lock, "xprt->xp_lock");
xprt->xp_pool = pool;
xprt->xp_socket = so;
xprt->xp_p1 = cd;
@@ -255,9 +256,9 @@ svc_vc_create_conn(SVCPOOL *pool, struct
* Throw the transport into the active list in case it already
* has some data buffered.
*/
- mtx_lock(&xprt->xp_lock);
+ sx_xlock(&xprt->xp_lock);
xprt_active(xprt);
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (xprt);
cleanup_svc_vc_create:
@@ -347,22 +348,27 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st
* connection from the socket and turn it into a new
* transport. If the accept fails, we have drained all pending
* connections so we call xprt_inactive().
- *
- * The lock protects us in the case where a new connection arrives
- * on the socket after our call to accept fails with
- * EWOULDBLOCK - the call to xprt_active() in the upcall will
- * happen only after our call to xprt_inactive() which ensures
- * that we will remain active. It might be possible to use
- * SOCKBUF_LOCK for this - its not clear to me what locks are
- * held during the upcall.
*/
- mtx_lock(&xprt->xp_lock);
+ sx_xlock(&xprt->xp_lock);
error = svc_vc_accept(xprt->xp_socket, &so);
if (error == EWOULDBLOCK) {
- xprt_inactive(xprt);
- mtx_unlock(&xprt->xp_lock);
+ /*
+ * We must re-test for new connections after taking
+ * the lock to protect us in the case where a new
+ * connection arrives after our call to accept fails
+ * with EWOULDBLOCK. The pool lock protects us from
+ * racing the upcall after our TAILQ_EMPTY() call
+ * returns false.
+ */
+ ACCEPT_LOCK();
+ mtx_lock(&xprt->xp_pool->sp_lock);
+ if (TAILQ_EMPTY(&xprt->xp_socket->so_comp))
+ xprt_inactive_locked(xprt);
+ mtx_unlock(&xprt->xp_pool->sp_lock);
+ ACCEPT_UNLOCK();
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
@@ -373,11 +379,11 @@ svc_vc_rendezvous_recv(SVCXPRT *xprt, st
xprt->xp_socket->so_rcv.sb_flags &= ~SB_UPCALL;
SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
xprt_inactive(xprt);
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
sa = 0;
error = soaccept(so, &sa);
@@ -422,7 +428,7 @@ svc_vc_destroy_common(SVCXPRT *xprt)
xprt_unregister(xprt);
- mtx_destroy(&xprt->xp_lock);
+ sx_destroy(&xprt->xp_lock);
if (xprt->xp_socket)
(void)soclose(xprt->xp_socket);
@@ -483,21 +489,29 @@ svc_vc_stat(SVCXPRT *xprt)
/*
* Return XPRT_MOREREQS if we have buffered data and we are
- * mid-record or if we have enough data for a record marker.
+ * mid-record or if we have enough data for a record
+ * marker. Since this is only a hint, we read mpending and
+ * resid outside the lock. We do need to take the lock if we
+ * have to traverse the mbuf chain.
*/
if (cd->mpending) {
if (cd->resid)
return (XPRT_MOREREQS);
n = 0;
+ sx_xlock(&xprt->xp_lock);
m = cd->mpending;
while (m && n < sizeof(uint32_t)) {
n += m->m_len;
m = m->m_next;
}
+ sx_xunlock(&xprt->xp_lock);
if (n >= sizeof(uint32_t))
return (XPRT_MOREREQS);
}
+ if (soreadable(xprt->xp_socket))
+ return (XPRT_MOREREQS);
+
return (XPRT_IDLE);
}
@@ -509,6 +523,12 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
struct mbuf *m;
int error, rcvflag;
+ /*
+ * Serialise access to the socket and our own record parsing
+ * state.
+ */
+ sx_xlock(&xprt->xp_lock);
+
for (;;) {
/*
* If we have an mbuf chain in cd->mpending, try to parse a
@@ -584,6 +604,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
*/
xdrmbuf_create(&xprt->xp_xdrreq, cd->mreq, XDR_DECODE);
cd->mreq = NULL;
+ sx_xunlock(&xprt->xp_lock);
if (! xdr_callmsg(&xprt->xp_xdrreq, msg)) {
XDR_DESTROY(&xprt->xp_xdrreq);
return (FALSE);
@@ -602,17 +623,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
* the result in cd->mpending. If the read fails,
* we have drained both cd->mpending and the socket so
* we can call xprt_inactive().
- *
- * The lock protects us in the case where a new packet arrives
- * on the socket after our call to soreceive fails with
- * EWOULDBLOCK - the call to xprt_active() in the upcall will
- * happen only after our call to xprt_inactive() which ensures
- * that we will remain active. It might be possible to use
- * SOCKBUF_LOCK for this - its not clear to me what locks are
- * held during the upcall.
*/
- mtx_lock(&xprt->xp_lock);
-
uio.uio_resid = 1000000000;
uio.uio_td = curthread;
m = NULL;
@@ -621,8 +632,20 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
&rcvflag);
if (error == EWOULDBLOCK) {
- xprt_inactive(xprt);
- mtx_unlock(&xprt->xp_lock);
+ /*
+ * We must re-test for readability after
+ * taking the lock to protect us in the case
+ * where a new packet arrives on the socket
+ * after our call to soreceive fails with
+ * EWOULDBLOCK. The pool lock protects us from
+ * racing the upcall after our soreadable()
+ * call returns false.
+ */
+ mtx_lock(&xprt->xp_pool->sp_lock);
+ if (!soreadable(xprt->xp_socket))
+ xprt_inactive_locked(xprt);
+ mtx_unlock(&xprt->xp_pool->sp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
@@ -634,7 +657,7 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
xprt_inactive(xprt);
cd->strm_stat = XPRT_DIED;
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
@@ -642,8 +665,9 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
/*
* EOF - the other end has closed the socket.
*/
+ xprt_inactive(xprt);
cd->strm_stat = XPRT_DIED;
- mtx_unlock(&xprt->xp_lock);
+ sx_xunlock(&xprt->xp_lock);
return (FALSE);
}
@@ -651,8 +675,6 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
m_last(cd->mpending)->m_next = m;
else
cd->mpending = m;
-
- mtx_unlock(&xprt->xp_lock);
}
}
@@ -739,9 +761,7 @@ svc_vc_soupcall(struct socket *so, void
{
SVCXPRT *xprt = (SVCXPRT *) arg;
- mtx_lock(&xprt->xp_lock);
xprt_active(xprt);
- mtx_unlock(&xprt->xp_lock);
}
#if 0
From mav at FreeBSD.org Fri May 15 15:25:36 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Fri May 15 15:25:47 2009
Subject: svn commit: r192033 - stable/7/sys/dev/ata
In-Reply-To: <4A0CF9EA.6080403@FreeBSD.org>
References: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
<4A0CF9EA.6080403@FreeBSD.org>
Message-ID: <4A0D7B50.4090602@FreeBSD.org>
Bruce Simpson wrote:
> Could this commit have broken boot on my amd64 system with an ULi SATA
> controller?
This commit could change driver used for controller and so expose some
other bug in ALI driver. As I can see, there is present vendor-specific
driver for this chip, but without pciconf output I can't say if AHCI
driver is also able to attach it.
> I have not fully bisected (and to be honest, who really has time to do
> this for production machines, unless
>
> The panic I get with RELENG_7 sources as of yesterday after this commit
> is 'resource list busy'. If you need any more information let me know, I
> have transcribed the backtrace and posted it to stable@.
Which revision was working for you before this? If, as you have said,
reverting rev 192033 does not helped, then there should be something
different. May be not in ATA, as there was very few merges into 7-STABLE
ATA last months.
--
Alexander Motin
From jhb at FreeBSD.org Fri May 15 18:50:31 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri May 15 18:50:43 2009
Subject: svn commit: r192149 - in stable/7: share/man/man4 sys
sys/contrib/pf sys/dev/ath/ath_hal sys/dev/cxgb
sys/dev/ichsmb sys/dev/ipmi sys/dev/smbus sys/sys
Message-ID: <200905151850.n4FIoULn031343@svn.freebsd.org>
Author: jhb
Date: Fri May 15 18:50:30 2009
New Revision: 192149
URL: http://svn.freebsd.org/changeset/base/192149
Log:
MFC: Change ichsmb(4) to follow the format of all the other smbus
controllers for slave addressing by using left-adjusted slave addresses
(i.e. xxxxxxx0b).
Modified:
stable/7/share/man/man4/ (props changed)
stable/7/share/man/man4/igb.4 (props changed)
stable/7/share/man/man4/smb.4
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/ichsmb/ichsmb.c
stable/7/sys/dev/ipmi/ipmi_acpi.c
stable/7/sys/dev/ipmi/ipmi_smbios.c
stable/7/sys/dev/smbus/smb.c
stable/7/sys/sys/param.h
Modified: stable/7/share/man/man4/smb.4
==============================================================================
--- stable/7/share/man/man4/smb.4 Fri May 15 18:25:44 2009 (r192148)
+++ stable/7/share/man/man4/smb.4 Fri May 15 18:50:30 2009 (r192149)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd October 25, 1998
+.Dd February 6, 2009
.Dt SMB 4
.Os
.Sh NAME
@@ -72,6 +72,9 @@ The
.Fa slave
field is always used, and provides the address of the
SMBus slave device to talk to.
+The slave address is specified in the seven most significant bits
+.Pq i.e. Dq "left-justified" .
+The least significant bit of the slave address must be zero.
.Pp
.Bl -column ".Dv SMB_QUICK_WRITE" -compact
.It Em Ioctl Ta Em Description
Modified: stable/7/sys/dev/ichsmb/ichsmb.c
==============================================================================
--- stable/7/sys/dev/ichsmb/ichsmb.c Fri May 15 18:25:44 2009 (r192148)
+++ stable/7/sys/dev/ichsmb/ichsmb.c Fri May 15 18:50:30 2009 (r192149)
@@ -182,7 +182,7 @@ ichsmb_quick(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_QUICK;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | (how == SMB_QREAD ?
+ slave | (how == SMB_QREAD ?
ICH_XMIT_SLVA_READ : ICH_XMIT_SLVA_WRITE));
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -208,7 +208,7 @@ ichsmb_sendb(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_WRITE);
+ slave | ICH_XMIT_SLVA_WRITE);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, byte);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -230,7 +230,7 @@ ichsmb_recvb(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_READ);
+ slave | ICH_XMIT_SLVA_READ);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
if ((smb_error = ichsmb_wait(sc)) == SMB_ENOERR)
@@ -253,7 +253,7 @@ ichsmb_writeb(device_t dev, u_char slave
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_WRITE);
+ slave | ICH_XMIT_SLVA_WRITE);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, byte);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
@@ -277,7 +277,7 @@ ichsmb_writew(device_t dev, u_char slave
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_WRITE);
+ slave | ICH_XMIT_SLVA_WRITE);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, word & 0xff);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, word >> 8);
@@ -301,7 +301,7 @@ ichsmb_readb(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BYTE_DATA;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_READ);
+ slave | ICH_XMIT_SLVA_READ);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -324,7 +324,7 @@ ichsmb_readw(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_WORD_DATA;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_READ);
+ slave | ICH_XMIT_SLVA_READ);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
ICH_HST_CNT_START | ICH_HST_CNT_INTREN | sc->ich_cmd);
@@ -352,7 +352,7 @@ ichsmb_pcall(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_PROC_CALL;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_WRITE);
+ slave | ICH_XMIT_SLVA_WRITE);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, sdata & 0xff);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D1, sdata >> 8);
@@ -403,7 +403,7 @@ ichsmb_bwrite(device_t dev, u_char slave
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_WRITE);
+ slave | ICH_XMIT_SLVA_WRITE);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, count);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_BLOCK_DB, buf[0]);
@@ -434,7 +434,7 @@ ichsmb_bread(device_t dev, u_char slave,
mtx_lock(&sc->mutex);
sc->ich_cmd = ICH_HST_CNT_SMB_CMD_BLOCK;
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_XMIT_SLVA,
- (slave << 1) | ICH_XMIT_SLVA_READ);
+ slave | ICH_XMIT_SLVA_READ);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CMD, cmd);
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_D0, *count); /* XXX? */
bus_space_write_1(sc->io_bst, sc->io_bsh, ICH_HST_CNT,
Modified: stable/7/sys/dev/ipmi/ipmi_acpi.c
==============================================================================
--- stable/7/sys/dev/ipmi/ipmi_acpi.c Fri May 15 18:25:44 2009 (r192148)
+++ stable/7/sys/dev/ipmi/ipmi_acpi.c Fri May 15 18:50:30 2009 (r192149)
@@ -104,7 +104,7 @@ ipmi_acpi_attach(device_t dev)
case SSIF_MODE:
if (ACPI_FAILURE(acpi_GetInteger(devh, "_ADR", &flags)))
return (ENXIO);
- info.address = flags >> 1;
+ info.address = flags;
device_printf(dev, "SSIF interface not supported on ACPI\n");
return (0);
default:
Modified: stable/7/sys/dev/ipmi/ipmi_smbios.c
==============================================================================
--- stable/7/sys/dev/ipmi/ipmi_smbios.c Fri May 15 18:25:44 2009 (r192148)
+++ stable/7/sys/dev/ipmi/ipmi_smbios.c Fri May 15 18:50:30 2009 (r192149)
@@ -154,10 +154,10 @@ smbios_t38_proc_info(uint8_t *p, char **
case SSIF_MODE:
if ((s->base_address & 0xffffffffffffff00) != 0) {
printf("SMBIOS: Invalid SSIF SMBus address, using BMC I2C slave address instead\n");
- info->address = s->i2c_slave_address >> 1;
+ info->address = s->i2c_slave_address;
break;
}
- info->address = IPMI_BAR_ADDR(s->base_address) >> 1;
+ info->address = IPMI_BAR_ADDR(s->base_address);
break;
default:
return;
Modified: stable/7/sys/dev/smbus/smb.c
==============================================================================
--- stable/7/sys/dev/smbus/smb.c Fri May 15 18:25:44 2009 (r192148)
+++ stable/7/sys/dev/smbus/smb.c Fri May 15 18:50:30 2009 (r192149)
@@ -195,6 +195,10 @@ smbioctl(struct cdev *dev, u_long cmd, c
parent = device_get_parent(smbdev);
+ /* Make sure that LSB bit is cleared. */
+ if (s->slave & 0x1)
+ return (EINVAL);
+
/* Allocate the bus. */
if ((error = smbus_request_bus(parent, smbdev,
(flags & O_NONBLOCK) ? SMB_DONTWAIT : (SMB_WAIT | SMB_INTR))))
Modified: stable/7/sys/sys/param.h
==============================================================================
--- stable/7/sys/sys/param.h Fri May 15 18:25:44 2009 (r192148)
+++ stable/7/sys/sys/param.h Fri May 15 18:50:30 2009 (r192149)
@@ -57,7 +57,7 @@
* is created, otherwise 1.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 702100 /* Master, propagated to newvers */
+#define __FreeBSD_version 702101 /* Master, propagated to newvers */
#ifndef LOCORE
#include
From jhb at FreeBSD.org Fri May 15 19:19:28 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri May 15 19:19:37 2009
Subject: svn commit: r192150 - stable/7/usr.bin/top
Message-ID: <200905151919.n4FJJRgn032065@svn.freebsd.org>
Author: jhb
Date: Fri May 15 19:19:27 2009
New Revision: 192150
URL: http://svn.freebsd.org/changeset/base/192150
Log:
MFC: Expand the CPU column to two chars and print in decimal rather than
hex.
Modified:
stable/7/usr.bin/top/ (props changed)
stable/7/usr.bin/top/machine.c
Modified: stable/7/usr.bin/top/machine.c
==============================================================================
--- stable/7/usr.bin/top/machine.c Fri May 15 18:50:30 2009 (r192149)
+++ stable/7/usr.bin/top/machine.c Fri May 15 19:19:27 2009 (r192150)
@@ -106,12 +106,12 @@ static char io_header[] =
"%5d%s %-*.*s %6ld %6ld %6ld %6ld %6ld %6ld %6.2f%% %.*s"
static char smp_header_thr[] =
- " PID%s %-*.*s THR PRI NICE SIZE RES STATE C TIME %6s COMMAND";
+ " PID%s %-*.*s THR PRI NICE SIZE RES STATE C TIME %6s COMMAND";
static char smp_header[] =
- " PID%s %-*.*s " "PRI NICE SIZE RES STATE C TIME %6s COMMAND";
+ " PID%s %-*.*s " "PRI NICE SIZE RES STATE C TIME %6s COMMAND";
#define smp_Proc_format \
- "%5d%s %-*.*s %s%3d %4s%7s %6s %-6.6s %1x%7s %5.2f%% %.*s"
+ "%5d%s %-*.*s %s%3d %4s%7s %6s %-6.6s %2d%7s %5.2f%% %.*s"
static char up_header_thr[] =
" PID%s %-*.*s THR PRI NICE SIZE RES STATE TIME %6s COMMAND";
From jhb at FreeBSD.org Fri May 15 19:54:21 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri May 15 19:54:28 2009
Subject: svn commit: r192154 - in stable/7: sys sys/contrib/pf
sys/dev/ath/ath_hal sys/dev/cxgb sys/kern sys/sys sys/ufs/ffs
sys/vm usr.bin/systat usr.bin/top
Message-ID: <200905151954.n4FJsJE1032919@svn.freebsd.org>
Author: jhb
Date: Fri May 15 19:54:19 2009
New Revision: 192154
URL: http://svn.freebsd.org/changeset/base/192154
Log:
MFC: Adjust some variables (mostly related to the buffer cache) that hold
address space sizes to be longs instead of ints. This includes an ABI
compat shim for the kern.bufspace sysctl for old binaries.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/subr_param.c
stable/7/sys/kern/sys_pipe.c
stable/7/sys/kern/vfs_bio.c
stable/7/sys/sys/buf.h
stable/7/sys/sys/pipe.h
stable/7/sys/ufs/ffs/ffs_snapshot.c
stable/7/sys/ufs/ffs/ffs_vfsops.c
stable/7/sys/vm/vm_init.c
stable/7/sys/vm/vnode_pager.c
stable/7/usr.bin/systat/ (props changed)
stable/7/usr.bin/systat/vmstat.c
stable/7/usr.bin/top/ (props changed)
stable/7/usr.bin/top/machine.c
Modified: stable/7/sys/kern/subr_param.c
==============================================================================
--- stable/7/sys/kern/subr_param.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/kern/subr_param.c Fri May 15 19:54:19 2009 (r192154)
@@ -76,9 +76,9 @@ int maxfilesperproc; /* per-proc open f
int ncallout; /* maximum # of timer events */
int nbuf;
int nswbuf;
-int maxswzone; /* max swmeta KVA storage */
-int maxbcache; /* max buffer cache KVA storage */
-int maxpipekva; /* Limit on pipe KVA */
+long maxswzone; /* max swmeta KVA storage */
+long maxbcache; /* max buffer cache KVA storage */
+long maxpipekva; /* Limit on pipe KVA */
u_long maxtsiz; /* max text size */
u_long dfldsiz; /* initial data size limit */
u_long maxdsiz; /* max data size */
@@ -94,9 +94,9 @@ SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLA
"Number of buffers in the buffer cache");
SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0,
"Number of swap buffers");
-SYSCTL_INT(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0,
+SYSCTL_LONG(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0,
"Maximum memory for swap metadata");
-SYSCTL_INT(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0,
+SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0,
"Maximum value of vfs.maxbufspace");
SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RDTUN, &maxtsiz, 0,
"Maximum text size");
@@ -132,11 +132,11 @@ init_param1(void)
#ifdef VM_SWZONE_SIZE_MAX
maxswzone = VM_SWZONE_SIZE_MAX;
#endif
- TUNABLE_INT_FETCH("kern.maxswzone", &maxswzone);
+ TUNABLE_LONG_FETCH("kern.maxswzone", &maxswzone);
#ifdef VM_BCACHE_SIZE_MAX
maxbcache = VM_BCACHE_SIZE_MAX;
#endif
- TUNABLE_INT_FETCH("kern.maxbcache", &maxbcache);
+ TUNABLE_LONG_FETCH("kern.maxbcache", &maxbcache);
maxtsiz = MAXTSIZ;
TUNABLE_ULONG_FETCH("kern.maxtsiz", &maxtsiz);
@@ -211,5 +211,5 @@ init_param3(long kmempages)
maxpipekva = (kmempages / 20) * PAGE_SIZE;
if (maxpipekva < 512 * 1024)
maxpipekva = 512 * 1024;
- TUNABLE_INT_FETCH("kern.ipc.maxpipekva", &maxpipekva);
+ TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
}
Modified: stable/7/sys/kern/sys_pipe.c
==============================================================================
--- stable/7/sys/kern/sys_pipe.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/kern/sys_pipe.c Fri May 15 19:54:19 2009 (r192154)
@@ -175,15 +175,15 @@ static struct filterops pipe_wfiltops =
#define MINPIPESIZE (PIPE_SIZE/3)
#define MAXPIPESIZE (2*PIPE_SIZE/3)
-static int amountpipekva;
+static long amountpipekva;
static int pipefragretry;
static int pipeallocfail;
static int piperesizefail;
static int piperesizeallowed = 1;
-SYSCTL_INT(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN,
+SYSCTL_LONG(_kern_ipc, OID_AUTO, maxpipekva, CTLFLAG_RDTUN,
&maxpipekva, 0, "Pipe KVA limit");
-SYSCTL_INT(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
+SYSCTL_LONG(_kern_ipc, OID_AUTO, pipekva, CTLFLAG_RD,
&amountpipekva, 0, "Pipe KVA usage");
SYSCTL_INT(_kern_ipc, OID_AUTO, pipefragretry, CTLFLAG_RD,
&pipefragretry, 0, "Pipe allocation retries due to fragmentation");
@@ -458,7 +458,7 @@ retry:
cpipe->pipe_buffer.in = cnt;
cpipe->pipe_buffer.out = 0;
cpipe->pipe_buffer.cnt = cnt;
- atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size);
+ atomic_add_long(&amountpipekva, cpipe->pipe_buffer.size);
return (0);
}
@@ -1437,7 +1437,7 @@ pipe_free_kmem(cpipe)
("pipe_free_kmem: pipe mutex locked"));
if (cpipe->pipe_buffer.buffer != NULL) {
- atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size);
+ atomic_subtract_long(&amountpipekva, cpipe->pipe_buffer.size);
vm_map_remove(pipe_map,
(vm_offset_t)cpipe->pipe_buffer.buffer,
(vm_offset_t)cpipe->pipe_buffer.buffer + cpipe->pipe_buffer.size);
Modified: stable/7/sys/kern/vfs_bio.c
==============================================================================
--- stable/7/sys/kern/vfs_bio.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/kern/vfs_bio.c Fri May 15 19:54:19 2009 (r192154)
@@ -109,30 +109,31 @@ static int buf_do_flush(struct vnode *vp
static int flushbufqueues(struct vnode *, int, int);
static void buf_daemon(void);
static void bremfreel(struct buf *bp);
+static int sysctl_bufspace(SYSCTL_HANDLER_ARGS);
int vmiodirenable = TRUE;
SYSCTL_INT(_vfs, OID_AUTO, vmiodirenable, CTLFLAG_RW, &vmiodirenable, 0,
"Use the VM system for directory writes");
-int runningbufspace;
-SYSCTL_INT(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0,
+long runningbufspace;
+SYSCTL_LONG(_vfs, OID_AUTO, runningbufspace, CTLFLAG_RD, &runningbufspace, 0,
"Amount of presently outstanding async buffer io");
-static int bufspace;
-SYSCTL_INT(_vfs, OID_AUTO, bufspace, CTLFLAG_RD, &bufspace, 0,
- "Virtual memory used for buffers");
-static int maxbufspace;
-SYSCTL_INT(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0,
+static long bufspace;
+SYSCTL_PROC(_vfs, OID_AUTO, bufspace, CTLTYPE_LONG|CTLFLAG_MPSAFE|CTLFLAG_RD,
+ &bufspace, 0, sysctl_bufspace, "L", "Virtual memory used for buffers");
+static long maxbufspace;
+SYSCTL_LONG(_vfs, OID_AUTO, maxbufspace, CTLFLAG_RD, &maxbufspace, 0,
"Maximum allowed value of bufspace (including buf_daemon)");
-static int bufmallocspace;
-SYSCTL_INT(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0,
+static long bufmallocspace;
+SYSCTL_LONG(_vfs, OID_AUTO, bufmallocspace, CTLFLAG_RD, &bufmallocspace, 0,
"Amount of malloced memory for buffers");
-static int maxbufmallocspace;
-SYSCTL_INT(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0,
+static long maxbufmallocspace;
+SYSCTL_LONG(_vfs, OID_AUTO, maxmallocbufspace, CTLFLAG_RW, &maxbufmallocspace, 0,
"Maximum amount of malloced memory for buffers");
-static int lobufspace;
-SYSCTL_INT(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0,
+static long lobufspace;
+SYSCTL_LONG(_vfs, OID_AUTO, lobufspace, CTLFLAG_RD, &lobufspace, 0,
"Minimum amount of buffers we want to have");
-int hibufspace;
-SYSCTL_INT(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0,
+long hibufspace;
+SYSCTL_LONG(_vfs, OID_AUTO, hibufspace, CTLFLAG_RD, &hibufspace, 0,
"Maximum allowed value of bufspace (excluding buf_daemon)");
static int bufreusecnt;
SYSCTL_INT(_vfs, OID_AUTO, bufreusecnt, CTLFLAG_RW, &bufreusecnt, 0,
@@ -143,11 +144,11 @@ SYSCTL_INT(_vfs, OID_AUTO, buffreekvacnt
static int bufdefragcnt;
SYSCTL_INT(_vfs, OID_AUTO, bufdefragcnt, CTLFLAG_RW, &bufdefragcnt, 0,
"Number of times we have had to repeat buffer allocation to defragment");
-static int lorunningspace;
-SYSCTL_INT(_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW, &lorunningspace, 0,
+static long lorunningspace;
+SYSCTL_LONG(_vfs, OID_AUTO, lorunningspace, CTLFLAG_RW, &lorunningspace, 0,
"Minimum preferred space used for in-progress I/O");
-static int hirunningspace;
-SYSCTL_INT(_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW, &hirunningspace, 0,
+static long hirunningspace;
+SYSCTL_LONG(_vfs, OID_AUTO, hirunningspace, CTLFLAG_RW, &hirunningspace, 0,
"Maximum amount of space to use for in-progress I/O");
int dirtybufferflushes;
SYSCTL_INT(_vfs, OID_AUTO, dirtybufferflushes, CTLFLAG_RW, &dirtybufferflushes,
@@ -284,6 +285,22 @@ const char *buf_wmesg = BUF_WMESG;
#define VFS_BIO_NEED_FREE 0x04 /* wait for free bufs, hi hysteresis */
#define VFS_BIO_NEED_BUFSPACE 0x08 /* wait for buf space, lo hysteresis */
+static int
+sysctl_bufspace(SYSCTL_HANDLER_ARGS)
+{
+ long lvalue;
+ int ivalue;
+
+ if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long))
+ return (sysctl_handle_long(oidp, arg1, arg2, req));
+ lvalue = *(long *)arg1;
+ if (lvalue > INT_MAX)
+ /* On overflow, still write out a long to trigger ENOMEM. */
+ return (sysctl_handle_long(oidp, &lvalue, 0, req));
+ ivalue = lvalue;
+ return (sysctl_handle_int(oidp, &ivalue, 0, req));
+}
+
#ifdef DIRECTIO
extern void ffs_rawread_setup(void);
#endif /* DIRECTIO */
@@ -343,7 +360,7 @@ runningbufwakeup(struct buf *bp)
{
if (bp->b_runningbufspace) {
- atomic_subtract_int(&runningbufspace, bp->b_runningbufspace);
+ atomic_subtract_long(&runningbufspace, bp->b_runningbufspace);
bp->b_runningbufspace = 0;
mtx_lock(&rbreqlock);
if (runningbufreq && runningbufspace <= lorunningspace) {
@@ -463,7 +480,8 @@ bd_speedup(void)
caddr_t
kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est)
{
- int maxbuf;
+ int tuned_nbuf;
+ long maxbuf;
/*
* physmem_est is in pages. Convert it to kilobytes (assumes
@@ -493,11 +511,17 @@ kern_vfs_bio_buffer_alloc(caddr_t v, lon
if (maxbcache && nbuf > maxbcache / BKVASIZE)
nbuf = maxbcache / BKVASIZE;
+ tuned_nbuf = 1;
+ } else
+ tuned_nbuf = 0;
- /* XXX Avoid integer overflows later on with maxbufspace. */
- maxbuf = (INT_MAX / 3) / BKVASIZE;
- if (nbuf > maxbuf)
- nbuf = maxbuf;
+ /* XXX Avoid unsigned long overflows later on with maxbufspace. */
+ maxbuf = (LONG_MAX / 3) / BKVASIZE;
+ if (nbuf > maxbuf) {
+ if (!tuned_nbuf)
+ printf("Warning: nbufs lowered from %d to %ld\n", nbuf,
+ maxbuf);
+ nbuf = maxbuf;
}
#if 0
@@ -582,8 +606,8 @@ bufinit(void)
* this may result in KVM fragmentation which is not handled optimally
* by the system.
*/
- maxbufspace = nbuf * BKVASIZE;
- hibufspace = imax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10);
+ maxbufspace = (long)nbuf * BKVASIZE;
+ hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBSIZE * 10);
lobufspace = hibufspace - MAXBSIZE;
lorunningspace = 512 * 1024;
@@ -611,7 +635,7 @@ bufinit(void)
* be met. We try to size hidirtybuffers to 3/4 our buffer space assuming
* BKVASIZE'd (8K) buffers.
*/
- while (hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) {
+ while ((long)hidirtybuffers * BKVASIZE > 3 * hibufspace / 4) {
hidirtybuffers >>= 1;
}
lodirtybuffers = hidirtybuffers / 2;
@@ -647,7 +671,7 @@ bfreekva(struct buf *bp)
if (bp->b_kvasize) {
atomic_add_int(&buffreekvacnt, 1);
- atomic_subtract_int(&bufspace, bp->b_kvasize);
+ atomic_subtract_long(&bufspace, bp->b_kvasize);
vm_map_remove(buffer_map, (vm_offset_t) bp->b_kvabase,
(vm_offset_t) bp->b_kvabase + bp->b_kvasize);
bp->b_kvasize = 0;
@@ -872,7 +896,7 @@ bufwrite(struct buf *bp)
* Normal bwrites pipeline writes
*/
bp->b_runningbufspace = bp->b_bufsize;
- atomic_add_int(&runningbufspace, bp->b_runningbufspace);
+ atomic_add_long(&runningbufspace, bp->b_runningbufspace);
if (!TD_IS_IDLETHREAD(curthread))
curthread->td_ru.ru_oublock++;
@@ -2054,7 +2078,7 @@ restart:
bp->b_kvabase = (caddr_t) addr;
bp->b_kvasize = maxsize;
- atomic_add_int(&bufspace, bp->b_kvasize);
+ atomic_add_long(&bufspace, bp->b_kvasize);
atomic_add_int(&bufreusecnt, 1);
}
vm_map_unlock(buffer_map);
@@ -2822,7 +2846,7 @@ allocbuf(struct buf *bp, int size)
} else {
free(bp->b_data, M_BIOBUF);
if (bp->b_bufsize) {
- atomic_subtract_int(
+ atomic_subtract_long(
&bufmallocspace,
bp->b_bufsize);
bufspacewakeup();
@@ -2859,7 +2883,7 @@ allocbuf(struct buf *bp, int size)
bp->b_bufsize = mbsize;
bp->b_bcount = size;
bp->b_flags |= B_MALLOC;
- atomic_add_int(&bufmallocspace, mbsize);
+ atomic_add_long(&bufmallocspace, mbsize);
return 1;
}
origbuf = NULL;
@@ -2873,7 +2897,7 @@ allocbuf(struct buf *bp, int size)
origbufsize = bp->b_bufsize;
bp->b_data = bp->b_kvabase;
if (bp->b_bufsize) {
- atomic_subtract_int(&bufmallocspace,
+ atomic_subtract_long(&bufmallocspace,
bp->b_bufsize);
bufspacewakeup();
bp->b_bufsize = 0;
Modified: stable/7/sys/sys/buf.h
==============================================================================
--- stable/7/sys/sys/buf.h Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/sys/buf.h Fri May 15 19:54:19 2009 (r192154)
@@ -479,10 +479,10 @@ buf_countdeps(struct buf *bp, int i)
#ifdef _KERNEL
extern int nbuf; /* The number of buffer headers */
-extern int maxswzone; /* Max KVA for swap structures */
-extern int maxbcache; /* Max KVA for buffer cache */
-extern int runningbufspace;
-extern int hibufspace;
+extern long maxswzone; /* Max KVA for swap structures */
+extern long maxbcache; /* Max KVA for buffer cache */
+extern long runningbufspace;
+extern long hibufspace;
extern int dirtybufthresh;
extern int bdwriteskip;
extern int dirtybufferflushes;
Modified: stable/7/sys/sys/pipe.h
==============================================================================
--- stable/7/sys/sys/pipe.h Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/sys/pipe.h Fri May 15 19:54:19 2009 (r192154)
@@ -56,7 +56,7 @@
/*
* See sys_pipe.c for info on what these limits mean.
*/
-extern int maxpipekva;
+extern long maxpipekva;
/*
* Pipe buffer information.
Modified: stable/7/sys/ufs/ffs/ffs_snapshot.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_snapshot.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/ufs/ffs/ffs_snapshot.c Fri May 15 19:54:19 2009 (r192154)
@@ -2272,7 +2272,7 @@ ffs_copyonwrite(devvp, bp)
VI_UNLOCK(devvp);
if (saved_runningbufspace != 0) {
bp->b_runningbufspace = saved_runningbufspace;
- atomic_add_int(&runningbufspace,
+ atomic_add_long(&runningbufspace,
bp->b_runningbufspace);
}
return (0); /* Snapshot gone */
@@ -2397,7 +2397,7 @@ ffs_copyonwrite(devvp, bp)
*/
if (saved_runningbufspace != 0) {
bp->b_runningbufspace = saved_runningbufspace;
- atomic_add_int(&runningbufspace, bp->b_runningbufspace);
+ atomic_add_long(&runningbufspace, bp->b_runningbufspace);
}
return (error);
}
Modified: stable/7/sys/ufs/ffs/ffs_vfsops.c
==============================================================================
--- stable/7/sys/ufs/ffs/ffs_vfsops.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/ufs/ffs/ffs_vfsops.c Fri May 15 19:54:19 2009 (r192154)
@@ -1919,7 +1919,7 @@ ffs_geom_strategy(struct bufobj *bo, str
}
}
bp->b_runningbufspace = bp->b_bufsize;
- atomic_add_int(&runningbufspace,
+ atomic_add_long(&runningbufspace,
bp->b_runningbufspace);
} else {
error = ffs_copyonwrite(vp, bp);
Modified: stable/7/sys/vm/vm_init.c
==============================================================================
--- stable/7/sys/vm/vm_init.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/vm/vm_init.c Fri May 15 19:54:19 2009 (r192154)
@@ -186,12 +186,12 @@ again:
panic("startup: table size inconsistency");
clean_map = kmem_suballoc(kernel_map, &kmi->clean_sva, &kmi->clean_eva,
- nbuf * BKVASIZE + nswbuf * MAXPHYS, FALSE);
+ (long)nbuf * BKVASIZE + (long)nswbuf * MAXPHYS, FALSE);
buffer_map = kmem_suballoc(clean_map, &kmi->buffer_sva,
- &kmi->buffer_eva, nbuf * BKVASIZE, FALSE);
+ &kmi->buffer_eva, (long)nbuf * BKVASIZE, FALSE);
buffer_map->system_map = 1;
pager_map = kmem_suballoc(clean_map, &kmi->pager_sva, &kmi->pager_eva,
- nswbuf * MAXPHYS, FALSE);
+ (long)nswbuf * MAXPHYS, FALSE);
pager_map->system_map = 1;
exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
exec_map_entries * (ARG_MAX + (PAGE_SIZE * 3)), FALSE);
Modified: stable/7/sys/vm/vnode_pager.c
==============================================================================
--- stable/7/sys/vm/vnode_pager.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/sys/vm/vnode_pager.c Fri May 15 19:54:19 2009 (r192154)
@@ -526,7 +526,7 @@ vnode_pager_input_smlfs(object, m)
bp->b_bcount = bsize;
bp->b_bufsize = bsize;
bp->b_runningbufspace = bp->b_bufsize;
- atomic_add_int(&runningbufspace, bp->b_runningbufspace);
+ atomic_add_long(&runningbufspace, bp->b_runningbufspace);
/* do the input */
bp->b_iooffset = dbtob(bp->b_blkno);
@@ -906,7 +906,7 @@ vnode_pager_generic_getpages(vp, m, byte
bp->b_bcount = size;
bp->b_bufsize = size;
bp->b_runningbufspace = bp->b_bufsize;
- atomic_add_int(&runningbufspace, bp->b_runningbufspace);
+ atomic_add_long(&runningbufspace, bp->b_runningbufspace);
PCPU_INC(cnt.v_vnodein);
PCPU_ADD(cnt.v_vnodepgsin, count);
Modified: stable/7/usr.bin/systat/vmstat.c
==============================================================================
--- stable/7/usr.bin/systat/vmstat.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/usr.bin/systat/vmstat.c Fri May 15 19:54:19 2009 (r192154)
@@ -115,7 +115,7 @@ static struct Info {
struct nchstats nchstats;
long nchcount;
long *intrcnt;
- int bufspace;
+ long bufspace;
int desiredvnodes;
long numvnodes;
long freevnodes;
Modified: stable/7/usr.bin/top/machine.c
==============================================================================
--- stable/7/usr.bin/top/machine.c Fri May 15 19:41:10 2009 (r192153)
+++ stable/7/usr.bin/top/machine.c Fri May 15 19:54:19 2009 (r192154)
@@ -433,7 +433,7 @@ get_system_info(struct system_info *si)
static unsigned int swap_delay = 0;
static int swapavail = 0;
static int swapfree = 0;
- static int bufspace = 0;
+ static long bufspace = 0;
static int nspgsin, nspgsout;
GETSYSCTL("vfs.bufspace", bufspace);
From jhb at FreeBSD.org Fri May 15 20:13:16 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri May 15 20:13:32 2009
Subject: svn commit: r192155 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern
Message-ID: <200905152013.n4FKDFwh033347@svn.freebsd.org>
Author: jhb
Date: Fri May 15 20:13:15 2009
New Revision: 192155
URL: http://svn.freebsd.org/changeset/base/192155
Log:
MFC: Update comment above _fget() now that FWRITE failures return EBADF.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/kern_descrip.c
Modified: stable/7/sys/kern/kern_descrip.c
==============================================================================
--- stable/7/sys/kern/kern_descrip.c Fri May 15 19:54:19 2009 (r192154)
+++ stable/7/sys/kern/kern_descrip.c Fri May 15 20:13:15 2009 (r192155)
@@ -2040,10 +2040,8 @@ closef(struct file *fp, struct thread *t
* Extract the file pointer associated with the specified descriptor for the
* current user process.
*
- * If the descriptor doesn't exist, EBADF is returned.
- *
- * If the descriptor exists but doesn't match 'flags' then return EBADF for
- * read attempts and EINVAL for write attempts.
+ * If the descriptor doesn't exist or doesn't match 'flags', EBADF is
+ * returned.
*
* If 'hold' is set (non-zero) the file's refcount will be bumped on return.
* It should be dropped with fdrop(). If it is not set, then the refcount
From jhb at FreeBSD.org Fri May 15 20:36:55 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri May 15 20:37:02 2009
Subject: svn commit: r192156 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern nfsclient sys
Message-ID: <200905152036.n4FKashg033833@svn.freebsd.org>
Author: jhb
Date: Fri May 15 20:36:54 2009
New Revision: 192156
URL: http://svn.freebsd.org/changeset/base/192156
Log:
MFC: Add caching of -ve lookups to the NFS client. To prevent clients from
not noticing new files created by another client for a "long" time, reduce
the default timeout for caching attributes of directories from 30 seconds
to 3 seconds.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/vfs_cache.c
stable/7/sys/nfsclient/nfs.h
stable/7/sys/nfsclient/nfs_vnops.c
stable/7/sys/nfsclient/nfsnode.h
stable/7/sys/sys/vnode.h
Modified: stable/7/sys/kern/vfs_cache.c
==============================================================================
--- stable/7/sys/kern/vfs_cache.c Fri May 15 20:13:15 2009 (r192155)
+++ stable/7/sys/kern/vfs_cache.c Fri May 15 20:36:54 2009 (r192156)
@@ -700,6 +700,24 @@ cache_purge(vp)
}
/*
+ * Invalidate all negative entries for a particular directory vnode.
+ */
+void
+cache_purge_negative(vp)
+ struct vnode *vp;
+{
+ struct namecache *cp, *ncp;
+
+ CTR1(KTR_VFS, "cache_purge_negative(%p)", vp);
+ CACHE_LOCK();
+ LIST_FOREACH_SAFE(cp, &vp->v_cache_src, nc_src, ncp) {
+ if (cp->nc_vp == NULL)
+ cache_zap(cp);
+ }
+ CACHE_UNLOCK();
+}
+
+/*
* Flush all entries referencing a particular filesystem.
*/
void
Modified: stable/7/sys/nfsclient/nfs.h
==============================================================================
--- stable/7/sys/nfsclient/nfs.h Fri May 15 20:13:15 2009 (r192155)
+++ stable/7/sys/nfsclient/nfs.h Fri May 15 20:36:54 2009 (r192156)
@@ -63,7 +63,7 @@
#define NFS_MAXATTRTIMO 60
#endif
#ifndef NFS_MINDIRATTRTIMO
-#define NFS_MINDIRATTRTIMO 30 /* VDIR attrib cache timeout in sec */
+#define NFS_MINDIRATTRTIMO 3 /* VDIR attrib cache timeout in sec */
#endif
#ifndef NFS_MAXDIRATTRTIMO
#define NFS_MAXDIRATTRTIMO 60
Modified: stable/7/sys/nfsclient/nfs_vnops.c
==============================================================================
--- stable/7/sys/nfsclient/nfs_vnops.c Fri May 15 20:13:15 2009 (r192155)
+++ stable/7/sys/nfsclient/nfs_vnops.c Fri May 15 20:36:54 2009 (r192156)
@@ -862,6 +862,7 @@ nfs_lookup(struct vop_lookup_args *ap)
struct componentname *cnp = ap->a_cnp;
struct vnode *dvp = ap->a_dvp;
struct vnode **vpp = ap->a_vpp;
+ struct vattr vattr;
int flags = cnp->cn_flags;
struct vnode *newvp;
struct nfsmount *nmp;
@@ -890,16 +891,20 @@ nfs_lookup(struct vop_lookup_args *ap)
if (error > 0 && error != ENOENT)
return (error);
if (error == -1) {
- struct vattr vattr;
-
+ /*
+ * We only accept a positive hit in the cache if the
+ * change time of the file matches our cached copy.
+ * Otherwise, we discard the cache entry and fallback
+ * to doing a lookup RPC.
+ */
newvp = *vpp;
if (!VOP_GETATTR(newvp, &vattr, cnp->cn_cred, td)
- && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
- nfsstats.lookupcache_hits++;
- if (cnp->cn_nameiop != LOOKUP &&
- (flags & ISLASTCN))
- cnp->cn_flags |= SAVENAME;
- return (0);
+ && vattr.va_ctime.tv_sec == VTONFS(newvp)->n_ctime) {
+ nfsstats.lookupcache_hits++;
+ if (cnp->cn_nameiop != LOOKUP &&
+ (flags & ISLASTCN))
+ cnp->cn_flags |= SAVENAME;
+ return (0);
}
cache_purge(newvp);
if (dvp != newvp)
@@ -907,6 +912,22 @@ nfs_lookup(struct vop_lookup_args *ap)
else
vrele(newvp);
*vpp = NULLVP;
+ } else if (error == ENOENT) {
+ /*
+ * We only accept a negative hit in the cache if the
+ * modification time of the parent directory matches
+ * our cached copy. Otherwise, we discard all of the
+ * negative cache entries for this directory.
+ */
+ if (VOP_GETATTR(dvp, &vattr, cnp->cn_cred, td) == 0 &&
+ vattr.va_mtime.tv_sec == np->n_dmtime) {
+ nfsstats.lookupcache_hits++;
+ return (ENOENT);
+ }
+ cache_purge_negative(dvp);
+ mtx_lock(&np->n_mtx);
+ np->n_dmtime = 0;
+ mtx_unlock(&np->n_mtx);
}
error = 0;
newvp = NULLVP;
@@ -992,16 +1013,40 @@ nfsmout:
vput(newvp);
*vpp = NULLVP;
}
+
+ if (error != ENOENT)
+ goto done;
+
+ /* The requested file was not found. */
if ((cnp->cn_nameiop == CREATE || cnp->cn_nameiop == RENAME) &&
- (flags & ISLASTCN) && error == ENOENT) {
+ (flags & ISLASTCN)) {
+ /*
+ * XXX: UFS does a full VOP_ACCESS(dvp,
+ * VWRITE) here instead of just checking
+ * MNT_RDONLY.
+ */
if (dvp->v_mount->mnt_flag & MNT_RDONLY)
- error = EROFS;
- else
- error = EJUSTRETURN;
- }
- if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN))
+ return (EROFS);
cnp->cn_flags |= SAVENAME;
+ return (EJUSTRETURN);
+ }
+
+ if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) {
+ /*
+ * Maintain n_dmtime as the modification time
+ * of the parent directory when the oldest -ve
+ * name cache entry for this directory was
+ * added.
+ */
+ mtx_lock(&np->n_mtx);
+ if (np->n_dmtime == 0)
+ np->n_dmtime = np->n_vattr.va_mtime.tv_sec;
+ mtx_unlock(&np->n_mtx);
+ cache_enter(dvp, NULL, cnp);
+ }
+ return (ENOENT);
}
+done:
return (error);
}
Modified: stable/7/sys/nfsclient/nfsnode.h
==============================================================================
--- stable/7/sys/nfsclient/nfsnode.h Fri May 15 20:13:15 2009 (r192155)
+++ stable/7/sys/nfsclient/nfsnode.h Fri May 15 20:36:54 2009 (r192156)
@@ -109,6 +109,7 @@ struct nfsnode {
time_t n_modestamp; /* mode cache timestamp */
struct timespec n_mtime; /* Prev modify time. */
time_t n_ctime; /* Prev create time. */
+ time_t n_dmtime; /* Prev dir modify time. */
time_t n_expiry; /* Lease expiry time */
nfsfh_t *n_fhp; /* NFS File Handle */
struct vnode *n_vnode; /* associated vnode */
Modified: stable/7/sys/sys/vnode.h
==============================================================================
--- stable/7/sys/sys/vnode.h Fri May 15 20:13:15 2009 (r192155)
+++ stable/7/sys/sys/vnode.h Fri May 15 20:36:54 2009 (r192156)
@@ -564,6 +564,7 @@ void cache_enter(struct vnode *dvp, stru
int cache_lookup(struct vnode *dvp, struct vnode **vpp,
struct componentname *cnp);
void cache_purge(struct vnode *vp);
+void cache_purge_negative(struct vnode *vp);
void cache_purgevfs(struct mount *mp);
int change_dir(struct vnode *vp, struct thread *td);
int change_root(struct vnode *vp, struct thread *td);
From jhb at FreeBSD.org Fri May 15 20:58:53 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Fri May 15 20:59:00 2009
Subject: svn commit: r192157 - in stable/7: sys sys/contrib/pf
sys/dev/ath/ath_hal sys/dev/cxgb sys/kern sys/sys
usr.bin/kdump usr.bin/ktrace
Message-ID: <200905152058.n4FKwqCL034361@svn.freebsd.org>
Author: jhb
Date: Fri May 15 20:58:52 2009
New Revision: 192157
URL: http://svn.freebsd.org/changeset/base/192157
Log:
MFC: Add a new type of KTRACE record for sysctl(3) invocations.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/kern_ktrace.c
stable/7/sys/kern/kern_sysctl.c
stable/7/sys/sys/ktrace.h
stable/7/usr.bin/kdump/ (props changed)
stable/7/usr.bin/kdump/kdump.1
stable/7/usr.bin/kdump/kdump.c
stable/7/usr.bin/ktrace/ (props changed)
stable/7/usr.bin/ktrace/ktrace.1
stable/7/usr.bin/ktrace/ktrace.h
stable/7/usr.bin/ktrace/subr.c
Modified: stable/7/sys/kern/kern_ktrace.c
==============================================================================
--- stable/7/sys/kern/kern_ktrace.c Fri May 15 20:36:54 2009 (r192156)
+++ stable/7/sys/kern/kern_ktrace.c Fri May 15 20:58:52 2009 (r192157)
@@ -111,6 +111,7 @@ static int data_lengths[] = {
sizeof(struct ktr_csw), /* KTR_CSW */
0, /* KTR_USER */
0, /* KTR_STRUCT */
+ 0, /* KTR_SYSCTL */
};
static STAILQ_HEAD(, ktr_request) ktr_free;
@@ -319,7 +320,7 @@ ktr_enqueuerequest(struct thread *td, st
* is used both internally before committing other records, and also on
* system call return. We drain all the ones we can find at the time when
* drain is requested, but don't keep draining after that as those events
- * may me approximately "after" the current event.
+ * may be approximately "after" the current event.
*/
static void
ktr_drain(struct thread *td)
@@ -481,6 +482,40 @@ ktrnamei(path)
}
void
+ktrsysctl(name, namelen)
+ int *name;
+ u_int namelen;
+{
+ struct ktr_request *req;
+ u_int mib[CTL_MAXNAME + 2];
+ char *mibname;
+ size_t mibnamelen;
+ int error;
+
+ /* Lookup name of mib. */
+ KASSERT(namelen <= CTL_MAXNAME, ("sysctl MIB too long"));
+ mib[0] = 0;
+ mib[1] = 1;
+ bcopy(name, mib + 2, namelen * sizeof(*name));
+ mibnamelen = 128;
+ mibname = malloc(mibnamelen, M_KTRACE, M_WAITOK);
+ error = kernel_sysctl(curthread, mib, namelen + 2, mibname, &mibnamelen,
+ NULL, 0, &mibnamelen, 0);
+ if (error) {
+ free(mibname, M_KTRACE);
+ return;
+ }
+ req = ktr_getrequest(KTR_SYSCTL);
+ if (req == NULL) {
+ free(mibname, M_KTRACE);
+ return;
+ }
+ req->ktr_header.ktr_len = mibnamelen;
+ req->ktr_buffer = mibname;
+ ktr_submitrequest(curthread, req);
+}
+
+void
ktrgenio(fd, rw, uio, error)
int fd;
enum uio_rw rw;
@@ -925,6 +960,9 @@ ktr_writerequest(struct thread *td, stru
mtx_unlock(&ktrace_mtx);
kth = &req->ktr_header;
+ KASSERT(((u_short)kth->ktr_type & ~KTR_DROP) <
+ sizeof(data_lengths) / sizeof(data_lengths[0]),
+ ("data_lengths array overflow"));
datalen = data_lengths[(u_short)kth->ktr_type & ~KTR_DROP];
buflen = kth->ktr_len;
auio.uio_iov = &aiov[0];
Modified: stable/7/sys/kern/kern_sysctl.c
==============================================================================
--- stable/7/sys/kern/kern_sysctl.c Fri May 15 20:36:54 2009 (r192156)
+++ stable/7/sys/kern/kern_sysctl.c Fri May 15 20:58:52 2009 (r192157)
@@ -39,6 +39,7 @@
__FBSDID("$FreeBSD$");
#include "opt_compat.h"
+#include "opt_ktrace.h"
#include "opt_mac.h"
#include
@@ -53,6 +54,9 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#ifdef KTRACE
+#include
+#endif
#include
@@ -757,7 +761,7 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS)
static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD, sysctl_sysctl_next, "");
static int
-name2oid (char *name, int *oid, int *len, struct sysctl_oid **oidpp)
+name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp)
{
int i;
struct sysctl_oid *oidp;
@@ -1498,6 +1502,11 @@ userland_sysctl(struct thread *td, int *
req.newfunc = sysctl_new_user;
req.lock = REQ_LOCKED;
+#ifdef KTRACE
+ if (KTRPOINT(curthread, KTR_SYSCTL))
+ ktrsysctl(name, namelen);
+#endif
+
SYSCTL_XLOCK();
for (;;) {
Modified: stable/7/sys/sys/ktrace.h
==============================================================================
--- stable/7/sys/sys/ktrace.h Fri May 15 20:36:54 2009 (r192156)
+++ stable/7/sys/sys/ktrace.h Fri May 15 20:58:52 2009 (r192157)
@@ -158,6 +158,12 @@ struct sockaddr;
struct stat;
/*
+ * KTR_SYSCTL - name of a sysctl MIB
+ */
+#define KTR_SYSCTL 9
+ /* record contains null-terminated MIB name */
+
+/*
* KTR_DROP - If this bit is set in ktr_type, then at least one event
* between the previous record and this record was dropped.
*/
@@ -175,6 +181,8 @@ struct stat;
#define KTRFAC_CSW (1<ktr_type);
type = unknown;
Modified: stable/7/usr.bin/ktrace/ktrace.1
==============================================================================
--- stable/7/usr.bin/ktrace/ktrace.1 Fri May 15 20:36:54 2009 (r192156)
+++ stable/7/usr.bin/ktrace/ktrace.1 Fri May 15 20:58:52 2009 (r192157)
@@ -125,6 +125,10 @@ trace various structures
userland traces
.It Cm w
context switches
+.It Cm y
+trace
+.Xr sysctl 3
+requests
.It Cm +
trace the default set of trace points -
.Cm c , n , i , s , t , u
Modified: stable/7/usr.bin/ktrace/ktrace.h
==============================================================================
--- stable/7/usr.bin/ktrace/ktrace.h Fri May 15 20:36:54 2009 (r192156)
+++ stable/7/usr.bin/ktrace/ktrace.h Fri May 15 20:58:52 2009 (r192157)
@@ -35,7 +35,8 @@
*/
#define DEF_POINTS (KTRFAC_SYSCALL | KTRFAC_SYSRET | KTRFAC_NAMEI | \
- KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | KTRFAC_STRUCT)
+ KTRFAC_GENIO | KTRFAC_PSIG | KTRFAC_USER | \
+ KTRFAC_STRUCT | KTRFAC_SYSCTL)
#define ALL_POINTS (DEF_POINTS | KTRFAC_CSW)
Modified: stable/7/usr.bin/ktrace/subr.c
==============================================================================
--- stable/7/usr.bin/ktrace/subr.c Fri May 15 20:36:54 2009 (r192156)
+++ stable/7/usr.bin/ktrace/subr.c Fri May 15 20:58:52 2009 (r192157)
@@ -83,6 +83,9 @@ getpoints(char *s)
case 'w':
facs |= KTRFAC_CSW;
break;
+ case 'y':
+ facs |= KTRFAC_SYSCTL;
+ break;
case '+':
facs |= DEF_POINTS;
break;
From kib at FreeBSD.org Sat May 16 17:15:27 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Sat May 16 17:15:34 2009
Subject: svn commit: r192200 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb ufs/ufs
Message-ID: <200905161715.n4GHFQvU064896@svn.freebsd.org>
Author: kib
Date: Sat May 16 17:15:26 2009
New Revision: 192200
URL: http://svn.freebsd.org/changeset/base/192200
Log:
MFC r191137:
Verify that '..' still exists with the same inode number after
VFS_VGET() has returned in ufs_lookup().
MFC r191260:
When verifying '..' after VFS_VGET() in ufs_lookup(), do not return
error if '..' is still there but changed between lookup and check.
Start relookup instead.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/ufs/ufs/ufs_lookup.c
Modified: stable/7/sys/ufs/ufs/ufs_lookup.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 15:21:08 2009 (r192199)
+++ stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 17:15:26 2009 (r192200)
@@ -77,6 +77,9 @@ SYSCTL_INT(_debug, OID_AUTO, dircheck, C
/* true if old FS format...*/
#define OFSFMT(vp) ((vp)->v_mount->mnt_maxsymlinklen <= 0)
+static int ufs_lookup_(struct vnode *, struct vnode **, struct componentname *,
+ ino_t *);
+
/*
* Convert a component of a pathname into a pointer to a locked inode.
* This is a very central and rather complicated routine.
@@ -130,7 +133,14 @@ ufs_lookup(ap)
struct componentname *a_cnp;
} */ *ap;
{
- struct vnode *vdp; /* vnode for directory being searched */
+
+ return (ufs_lookup_(ap->a_dvp, ap->a_vpp, ap->a_cnp, NULL));
+}
+
+static int
+ufs_lookup_(struct vnode *vdp, struct vnode **vpp, struct componentname *cnp,
+ ino_t *dd_ino)
+{
struct inode *dp; /* inode for directory being searched */
struct buf *bp; /* a buffer of directory entries */
struct direct *ep; /* the current directory entry */
@@ -150,24 +160,16 @@ ufs_lookup(ap)
doff_t enduseful; /* pointer past last used dir slot */
u_long bmask; /* block offset mask */
int namlen, error;
- struct vnode **vpp = ap->a_vpp;
- struct componentname *cnp = ap->a_cnp;
struct ucred *cred = cnp->cn_cred;
int flags = cnp->cn_flags;
int nameiop = cnp->cn_nameiop;
struct thread *td = cnp->cn_thread;
- ino_t ino;
+ ino_t ino, ino1;
int ltype;
- bp = NULL;
- slotoffset = -1;
-/*
- * XXX there was a soft-update diff about this I couldn't merge.
- * I think this was the equiv.
- */
- *vpp = NULL;
+ if (vpp != NULL)
+ *vpp = NULL;
- vdp = ap->a_dvp;
dp = VTOI(vdp);
/*
@@ -178,6 +180,12 @@ ufs_lookup(ap)
*/
vnode_create_vobject(vdp, DIP(dp, i_size), cnp->cn_thread);
+ bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
+
+restart:
+ bp = NULL;
+ slotoffset = -1;
+
/*
* We now have a segment name to search for, and a directory to search.
*
@@ -195,7 +203,6 @@ ufs_lookup(ap)
slotstatus = NONE;
slotneeded = DIRECTSIZ(cnp->cn_namelen);
}
- bmask = VFSTOUFS(vdp->v_mount)->um_mountp->mnt_stat.f_iosize - 1;
#ifdef UFS_DIRHASH
/*
@@ -364,7 +371,7 @@ foundentry:
slotoffset = i_offset;
slotsize = ep->d_reclen;
enduseful = dp->i_size;
- ap->a_cnp->cn_flags |= ISWHITEOUT;
+ cnp->cn_flags |= ISWHITEOUT;
numdirpasses--;
goto notfound;
}
@@ -398,8 +405,8 @@ notfound:
*/
if ((nameiop == CREATE || nameiop == RENAME ||
(nameiop == DELETE &&
- (ap->a_cnp->cn_flags & DOWHITEOUT) &&
- (ap->a_cnp->cn_flags & ISWHITEOUT))) &&
+ (cnp->cn_flags & DOWHITEOUT) &&
+ (cnp->cn_flags & ISWHITEOUT))) &&
(flags & ISLASTCN) && dp->i_effnlink != 0) {
/*
* Access for write is interpreted as allowing
@@ -454,7 +461,7 @@ notfound:
* Insert name into cache (as non-existent) if appropriate.
*/
if ((cnp->cn_flags & MAKEENTRY) && nameiop != CREATE)
- cache_enter(vdp, *vpp, cnp);
+ cache_enter(vdp, NULL, cnp);
return (ENOENT);
found:
@@ -480,6 +487,11 @@ found:
if ((flags & ISLASTCN) && nameiop == LOOKUP)
dp->i_diroff = i_offset &~ (DIRBLKSIZ - 1);
+ if (dd_ino != NULL) {
+ *dd_ino = ino;
+ return (0);
+ }
+
/*
* If deleting, and at end of pathname, return
* parameters which can be used to remove file.
@@ -581,6 +593,22 @@ found:
error = vn_vget_ino(pdp, ino, cnp->cn_lkflags, &tdp);
if (error)
return (error);
+
+ /*
+ * Recheck that ".." entry in the vdp directory points
+ * to the inode we looked up before vdp lock was
+ * dropped.
+ */
+ error = ufs_lookup_(pdp, NULL, cnp, &ino1);
+ if (error) {
+ vput(tdp);
+ return (error);
+ }
+ if (ino1 != ino) {
+ vput(tdp);
+ goto restart;
+ }
+
*vpp = tdp;
} else if (dp->i_number == ino) {
VREF(vdp); /* we want ourself, ie "." */
From kib at FreeBSD.org Sat May 16 17:22:05 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Sat May 16 17:22:16 2009
Subject: svn commit: r192201 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb ufs/ufs
Message-ID: <200905161722.n4GHM3CS065067@svn.freebsd.org>
Author: kib
Date: Sat May 16 17:22:03 2009
New Revision: 192201
URL: http://svn.freebsd.org/changeset/base/192201
Log:
MFC r191315:
In ufs_checkpath(), recheck that '..' still points to the inode with
the same inode number after VFS_VGET() and relock of the vp. If '..'
changed, redo the lookup.
Supply the source inode number as an argument to ufs_checkpath() instead
of the source inode itself.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/ufs/ufs/ufs_extern.h
stable/7/sys/ufs/ufs/ufs_lookup.c
stable/7/sys/ufs/ufs/ufs_vnops.c
Modified: stable/7/sys/ufs/ufs/ufs_extern.h
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_extern.h Sat May 16 17:15:26 2009 (r192200)
+++ stable/7/sys/ufs/ufs/ufs_extern.h Sat May 16 17:22:03 2009 (r192201)
@@ -58,7 +58,7 @@ int ufs_bmap(struct vop_bmap_args *);
int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *,
struct buf *, int *, int *);
int ufs_fhtovp(struct mount *, struct ufid *, struct vnode **);
-int ufs_checkpath(struct inode *, struct inode *, struct ucred *);
+int ufs_checkpath(ino_t, struct inode *, struct ucred *);
void ufs_dirbad(struct inode *, doff_t, char *);
int ufs_dirbadentry(struct vnode *, struct direct *, int);
int ufs_dirempty(struct inode *, ino_t, struct ucred *);
Modified: stable/7/sys/ufs/ufs/ufs_lookup.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 17:15:26 2009 (r192200)
+++ stable/7/sys/ufs/ufs/ufs_lookup.c Sat May 16 17:22:03 2009 (r192201)
@@ -1238,69 +1238,81 @@ ufs_dirempty(ip, parentino, cred)
return (1);
}
+static int
+ufs_dir_dd_ino(struct vnode *vp, struct ucred *cred, ino_t *dd_ino)
+{
+ struct dirtemplate dirbuf;
+ int error, namlen;
+
+ if (vp->v_type != VDIR)
+ return (ENOTDIR);
+ error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf,
+ sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE,
+ IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, (int *)0, NULL);
+ if (error != 0)
+ return (error);
+#if (BYTE_ORDER == LITTLE_ENDIAN)
+ if (OFSFMT(vp))
+ namlen = dirbuf.dotdot_type;
+ else
+ namlen = dirbuf.dotdot_namlen;
+#else
+ namlen = dirbuf.dotdot_namlen;
+#endif
+ if (namlen != 2 || dirbuf.dotdot_name[0] != '.' ||
+ dirbuf.dotdot_name[1] != '.')
+ return (ENOTDIR);
+ *dd_ino = dirbuf.dotdot_ino;
+ return (0);
+}
+
/*
* Check if source directory is in the path of the target directory.
* Target is supplied locked, source is unlocked.
* The target is always vput before returning.
*/
int
-ufs_checkpath(source, target, cred)
- struct inode *source, *target;
- struct ucred *cred;
+ufs_checkpath(ino_t source_ino, struct inode *target, struct ucred *cred)
{
- struct vnode *vp;
- int error, namlen;
- ino_t rootino;
- struct dirtemplate dirbuf;
+ struct vnode *vp, *vp1;
+ int error;
+ ino_t dd_ino;
vp = ITOV(target);
- if (target->i_number == source->i_number) {
+ if (target->i_number == source_ino) {
error = EEXIST;
goto out;
}
- rootino = ROOTINO;
error = 0;
- if (target->i_number == rootino)
+ if (target->i_number == ROOTINO)
goto out;
for (;;) {
- if (vp->v_type != VDIR) {
- error = ENOTDIR;
- break;
- }
- error = vn_rdwr(UIO_READ, vp, (caddr_t)&dirbuf,
- sizeof (struct dirtemplate), (off_t)0, UIO_SYSSPACE,
- IO_NODELOCKED | IO_NOMACCHECK, cred, NOCRED, (int *)0,
- (struct thread *)0);
+ error = ufs_dir_dd_ino(vp, cred, &dd_ino);
if (error != 0)
break;
-# if (BYTE_ORDER == LITTLE_ENDIAN)
- if (OFSFMT(vp))
- namlen = dirbuf.dotdot_type;
- else
- namlen = dirbuf.dotdot_namlen;
-# else
- namlen = dirbuf.dotdot_namlen;
-# endif
- if (namlen != 2 ||
- dirbuf.dotdot_name[0] != '.' ||
- dirbuf.dotdot_name[1] != '.') {
- error = ENOTDIR;
- break;
- }
- if (dirbuf.dotdot_ino == source->i_number) {
+ if (dd_ino == source_ino) {
error = EINVAL;
break;
}
- if (dirbuf.dotdot_ino == rootino)
+ if (dd_ino == ROOTINO)
break;
- vput(vp);
- error = VFS_VGET(vp->v_mount, dirbuf.dotdot_ino,
- LK_EXCLUSIVE, &vp);
- if (error) {
- vp = NULL;
+ error = vn_vget_ino(vp, dd_ino, LK_EXCLUSIVE, &vp1);
+ if (error != 0)
+ break;
+ /* Recheck that ".." still points to vp1 after relock of vp */
+ error = ufs_dir_dd_ino(vp, cred, &dd_ino);
+ if (error != 0) {
+ vput(vp1);
break;
}
+ /* Redo the check of ".." if directory was reparented */
+ if (dd_ino != VTOI(vp1)->i_number) {
+ vput(vp1);
+ continue;
+ }
+ vput(vp);
+ vp = vp1;
}
out:
Modified: stable/7/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- stable/7/sys/ufs/ufs/ufs_vnops.c Sat May 16 17:15:26 2009 (r192200)
+++ stable/7/sys/ufs/ufs/ufs_vnops.c Sat May 16 17:22:03 2009 (r192201)
@@ -1029,6 +1029,7 @@ ufs_rename(ap)
struct direct newdir;
int doingdirectory = 0, oldparent = 0, newparent = 0;
int error = 0, ioflag;
+ ino_t fvp_ino;
#ifdef INVARIANTS
if ((tcnp->cn_flags & HASBUF) == 0 ||
@@ -1139,6 +1140,7 @@ abortit:
* call to checkpath().
*/
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
+ fvp_ino = ip->i_number;
VOP_UNLOCK(fvp, 0, td);
if (oldparent != dp->i_number)
newparent = dp->i_number;
@@ -1147,7 +1149,7 @@ abortit:
goto bad;
if (xp != NULL)
vput(tvp);
- error = ufs_checkpath(ip, dp, tcnp->cn_cred);
+ error = ufs_checkpath(fvp_ino, dp, tcnp->cn_cred);
if (error)
goto out;
if ((tcnp->cn_flags & SAVESTART) == 0)
From fabient at FreeBSD.org Sun May 17 11:45:39 2009
From: fabient at FreeBSD.org (Fabien Thomas)
Date: Sun May 17 11:45:55 2009
Subject: svn commit: r192248 - stable/7/lib/libpmc
Message-ID: <200905171145.n4HBjbQC026986@svn.freebsd.org>
Author: fabient
Date: Sun May 17 11:45:37 2009
New Revision: 192248
URL: http://svn.freebsd.org/changeset/base/192248
Log:
MFC 190395: Allow compile from c++ for libpmc
Reviewed by: jkoshy (mentor)
Modified:
stable/7/lib/libpmc/ (props changed)
stable/7/lib/libpmc/pmc.h
stable/7/lib/libpmc/pmclog.h
Modified: stable/7/lib/libpmc/pmc.h
==============================================================================
--- stable/7/lib/libpmc/pmc.h Sun May 17 10:58:50 2009 (r192247)
+++ stable/7/lib/libpmc/pmc.h Sun May 17 11:45:37 2009 (r192248)
@@ -29,6 +29,7 @@
#ifndef _PMC_H_
#define _PMC_H_
+#include
#include
/*
@@ -68,6 +69,7 @@ struct pmc_pmcinfo {
* Prototypes
*/
+__BEGIN_DECLS
int pmc_allocate(const char *_ctrspec, enum pmc_mode _mode, uint32_t _flags,
int _cpu, pmc_id_t *_pmcid);
int pmc_attach(pmc_id_t _pmcid, pid_t _pid);
@@ -105,5 +107,6 @@ const char *pmc_name_of_state(enum pmc_s
int pmc_event_names_of_class(enum pmc_class _cl, const char ***_eventnames,
int *_nevents);
+__END_DECLS
#endif
Modified: stable/7/lib/libpmc/pmclog.h
==============================================================================
--- stable/7/lib/libpmc/pmclog.h Sun May 17 10:58:50 2009 (r192247)
+++ stable/7/lib/libpmc/pmclog.h Sun May 17 11:45:37 2009 (r192248)
@@ -29,6 +29,7 @@
#ifndef _PMCLOG_H_
#define _PMCLOG_H_
+#include
#include
enum pmclog_state {
@@ -145,10 +146,12 @@ struct pmclog_ev {
#define PMCLOG_FD_NONE (-1)
+__BEGIN_DECLS
void *pmclog_open(int _fd);
int pmclog_feed(void *_cookie, char *_data, int _len);
int pmclog_read(void *_cookie, struct pmclog_ev *_ev);
void pmclog_close(void *_cookie);
+__END_DECLS
#endif
From bms at FreeBSD.org Sun May 17 15:42:42 2009
From: bms at FreeBSD.org (Bruce M Simpson)
Date: Sun May 17 15:42:53 2009
Subject: svn commit: r192251 - stable/7/lib/libc/net
Message-ID: <200905171542.n4HFgfqj031720@svn.freebsd.org>
Author: bms
Date: Sun May 17 15:42:41 2009
New Revision: 192251
URL: http://svn.freebsd.org/changeset/base/192251
Log:
MFC rev 191654:
Fix an obvious bug in getsourcefilter()'s use of struct __msfilterreq;
the kernel will return in msfr_nsrcs the number of source filters
in-mode for a given multicast group.
However, the filters themselves were never copied out, as the libc
function clobbers this field with zero, causing the kernel to assume
the provided vector of struct sockaddr_storage has zero length.
This bug would only affect users of SSM multicast, which is shimmed
in 7.x.
Picked up during mtest(8) refactoring.
Modified:
stable/7/lib/libc/net/sourcefilter.c
Modified: stable/7/lib/libc/net/sourcefilter.c
==============================================================================
--- stable/7/lib/libc/net/sourcefilter.c Sun May 17 12:30:25 2009 (r192250)
+++ stable/7/lib/libc/net/sourcefilter.c Sun May 17 15:42:41 2009 (r192251)
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 2007 Bruce M. Simpson.
- * All rights reserved
+ * Copyright (c) 2007-2009 Bruce Simpson.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,21 +10,18 @@
* 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.
- * 4. Neither the name of Bruce M. Simpson nor the names of other
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY BRUCE M. SIMPSON AND AFFILIATES
- * ``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 BRUCE M. SIMPSON 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.
+ * 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.
*/
#include
@@ -340,7 +337,7 @@ getsourcefilter(int s, uint32_t interfac
{
struct __msfilterreq msfr;
sockunion_t *psu;
- int err, level, optlen, optname;
+ int err, level, nsrcs, optlen, optname;
if (interface == 0 || group == NULL || numsrc == NULL ||
fmode == NULL) {
@@ -348,6 +345,7 @@ getsourcefilter(int s, uint32_t interfac
return (-1);
}
+ nsrcs = *numsrc;
*numsrc = 0;
*fmode = 0;
@@ -385,7 +383,7 @@ getsourcefilter(int s, uint32_t interfac
memset(&msfr, 0, optlen);
msfr.msfr_ifindex = interface;
msfr.msfr_fmode = 0;
- msfr.msfr_nsrcs = *numsrc;
+ msfr.msfr_nsrcs = nsrcs;
memcpy(&msfr.msfr_group, &psu->ss, psu->ss.ss_len);
/*
From bms at incunabulum.net Sun May 17 16:16:05 2009
From: bms at incunabulum.net (Bruce Simpson)
Date: Sun May 17 16:16:18 2009
Subject: svn commit: r192033 - stable/7/sys/dev/ata
In-Reply-To: <4A0D7B50.4090602@FreeBSD.org>
References: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
<4A0CF9EA.6080403@FreeBSD.org> <4A0D7B50.4090602@FreeBSD.org>
Message-ID: <4A103429.8040906@incunabulum.net>
Alexander Motin wrote:
> Bruce Simpson wrote:
>> Could this commit have broken boot on my amd64 system with an ULi
>> SATA controller?
>
> This commit could change driver used for controller and so expose some
> other bug in ALI driver. As I can see, there is present
> vendor-specific driver for this chip, but without pciconf output I
> can't say if AHCI driver is also able to attach it.
...
isab0@pci0:0:30:0: class=0x060100 card=0x81561043 chip=0x157310b9
rev=0x31 hdr=0x00
vendor = 'Acer Labs Incorporated (ALi/ULi)'
device = 'ALI M1573 South Bridge with Hypertransport Support'
class = bridge
subclass = PCI-ISA
none0@pci0:0:30:1: class=0x068000 card=0x81561043 chip=0x710110b9
rev=0x00 hdr=0x00
vendor = 'Acer Labs Incorporated (ALi/ULi)'
device = 'ALI M7101 Power Management Controller'
class = bridge
atapci0@pci0:0:31:0: class=0x01018a card=0x81561043 chip=0x522910b9
rev=0xc7 hdr=0x00
vendor = 'Acer Labs Incorporated (ALi/ULi)'
device = 'M5229 Southbridge EIDE Controller'
class = mass storage
subclass = ATA
atapci1@pci0:0:31:1: class=0x010400 card=0x81561043 chip=0x528710b9
rev=0x02 hdr=0x00
vendor = 'Acer Labs Incorporated (ALi/ULi)'
device = '52871849 ALI SATA controller'
class = mass storage
subclass = RAID
... FreeBSD boots from ad4.
anglepoise:~ % devinfo
nexus0
apic0
ram0
acpi0
cpu0
acpi_throttle0
cpufreq0
pcib0
pci0
hostb0
pcib1
pci1
vgapci0
vgapci1
pcib2
pci2
mskc0
msk0
miibus0
e1000phy0
pcib3
pci3
hostb1
hostb2
hostb3
hostb4
pcib4
pci4
ohci0
usb0
uhub0
ohci1
usb1
uhub1
uhub4
ums0
ohci2
usb2
uhub2
ehci0
usb3
uhub3
hdac0
pcm0
pcm1
pcm2
isab0
isa0
sc0
vga0
orm0
atapci0
ata0
ad0
subdisk0
ata1
acd0
atapci1
ata2
ad4
subdisk4
ata3
ata4
ata5
atpic0
atdma0
attimer0
attimer1
fpupnp0
fdc0
fd0
ppc0
ppbus0
acpi_sysresource0
atkbdc0
atkbd0
acpi_sysresource1
sio0
acpi_sysresource2
acpi_sysresource3
acpi_sysresource4
acpi_button0
pci_link0
pci_link1
pci_link2
pci_link3
pci_link4
pci_link5
pci_link6
pci_link7
pci_link8
acpi_timer0
>
>> I have not fully bisected (and to be honest, who really has time to
>> do this for production machines, unless
>>
>> The panic I get with RELENG_7 sources as of yesterday after this
>> commit is 'resource list busy'. If you need any more information let
>> me know, I have transcribed the backtrace and posted it to stable@.
>
> Which revision was working for you before this? If, as you have said,
> reverting rev 192033 does not helped, then there should be something
> different. May be not in ATA, as there was very few merges into
> 7-STABLE ATA last months.
anglepoise:~ % uname -a
FreeBSD anglepoise.lon.incunabulum.net 7.2-PRERELEASE FreeBSD
7.2-PRERELEASE #1: Tue Apr 21 07:41:58 BST 2009
root@anglepoise.lon.incunabulum.net:/home/obj/usr/src/sys/ANGLEPOISE amd64
anglepoise:~ % ident /boot/kernel/kernel | grep ata
$FreeBSD: src/sys/cam/cam_queue.c,v 1.9 2005/07/01 15:21:29 avatar
Exp $
$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.280.2.8 2009/03/03 08:14:43
mav Exp $
$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.202.2.19 2009/03/25
14:26:38 mav Exp $
$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.204.2.3 2008/04/08
10:48:21 phk Exp $
$FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.147.2.2 2008/01/09 08:54:47
delphij Exp $
$FreeBSD: src/sys/dev/ata/ata-isa.c,v 1.31 2007/02/21 19:07:18 sos
Exp $
$FreeBSD: src/sys/dev/ata/ata-lowlevel.c,v 1.79.2.1 2008/01/09
08:54:48 delphij Exp $
$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.121.2.2 2007/11/21 21:15:00
sos Exp $
$FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.69.2.1 2009/03/03
08:14:43 mav Exp $
$FreeBSD: src/sys/dev/ata/ata-raid.c,v 1.124.2.1 2009/03/01
16:50:46 scottl Exp $
$FreeBSD: src/sys/dev/ata/atapi-cd.c,v 1.193.2.3 2009/03/17
19:38:40 marcel Exp $
$FreeBSD: src/sys/dev/puc/pucdata.c,v 1.59.2.6 2009/03/19 15:35:33
jhb Exp $
Let me know if you need any more info...
cheers
BMS
From mav at FreeBSD.org Sun May 17 22:57:44 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Sun May 17 22:57:56 2009
Subject: svn commit: r192033 - stable/7/sys/dev/ata
In-Reply-To: <4A103429.8040906@incunabulum.net>
References: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
<4A0CF9EA.6080403@FreeBSD.org> <4A0D7B50.4090602@FreeBSD.org>
<4A103429.8040906@incunabulum.net>
Message-ID: <4A109662.9060909@FreeBSD.org>
Bruce Simpson wrote:
> Alexander Motin wrote:
>> Bruce Simpson wrote:
>>> Could this commit have broken boot on my amd64 system with an ULi
>>> SATA controller?
>>
>> This commit could change driver used for controller and so expose some
>> other bug in ALI driver. As I can see, there is present
>> vendor-specific driver for this chip, but without pciconf output I
>> can't say if AHCI driver is also able to attach it.
>
> atapci1@pci0:0:31:1: class=0x010400 card=0x81561043 chip=0x528710b9
> rev=0x02 hdr=0x00
> vendor = 'Acer Labs Incorporated (ALi/ULi)'
> device = '52871849 ALI SATA controller'
> class = mass storage
> subclass = RAID
This change is not anyhow related to your system. Looks like the real
reason found by jhb@ on stable@. Probably something become more strict
in system resource management last time and this driver violates now.
--
Alexander Motin
From bms at incunabulum.net Sun May 17 23:52:08 2009
From: bms at incunabulum.net (Bruce Simpson)
Date: Sun May 17 23:52:25 2009
Subject: svn commit: r192033 - stable/7/sys/dev/ata
In-Reply-To: <4A109662.9060909@FreeBSD.org>
References: <200905130255.n4D2tMQZ040010@svn.freebsd.org>
<4A0CF9EA.6080403@FreeBSD.org> <4A0D7B50.4090602@FreeBSD.org>
<4A103429.8040906@incunabulum.net> <4A109662.9060909@FreeBSD.org>
Message-ID: <4A10A324.5040501@incunabulum.net>
Alexander Motin wrote:
> ...
> This change is not anyhow related to your system. Looks like the real
> reason found by jhb@ on stable@. Probably something become more strict
> in system resource management last time and this driver violates now.
>
Thanks... I reckon John is probably on the money with this but have not
looked closely. Hopefully the fix is backportable... I will try to find
time to test HEAD, I need to do some HEAD testing on this box anyway,
using a USB key is possible for this with NanoBSD now :-)
cheers,
BMS
From alc at FreeBSD.org Mon May 18 07:24:07 2009
From: alc at FreeBSD.org (Alan Cox)
Date: Mon May 18 07:24:18 2009
Subject: svn commit: r192300 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb kern vm
Message-ID: <200905180724.n4I7O6MO053640@svn.freebsd.org>
Author: alc
Date: Mon May 18 07:24:06 2009
New Revision: 192300
URL: http://svn.freebsd.org/changeset/base/192300
Log:
MFC r180308
Enable the creation of a kmem map larger than 4GB.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/kern/kern_malloc.c
stable/7/sys/vm/vm_kern.h
Modified: stable/7/sys/kern/kern_malloc.c
==============================================================================
--- stable/7/sys/kern/kern_malloc.c Mon May 18 07:13:42 2009 (r192299)
+++ stable/7/sys/kern/kern_malloc.c Mon May 18 07:24:06 2009 (r192300)
@@ -181,19 +181,19 @@ struct {
*/
static uma_zone_t mt_zone;
-u_int vm_kmem_size;
-SYSCTL_UINT(_vm, OID_AUTO, kmem_size, CTLFLAG_RD, &vm_kmem_size, 0,
+u_long vm_kmem_size;
+SYSCTL_ULONG(_vm, OID_AUTO, kmem_size, CTLFLAG_RD, &vm_kmem_size, 0,
"Size of kernel memory");
-u_int vm_kmem_size_min;
-SYSCTL_UINT(_vm, OID_AUTO, kmem_size_min, CTLFLAG_RD, &vm_kmem_size_min, 0,
+static u_long vm_kmem_size_min;
+SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_min, CTLFLAG_RD, &vm_kmem_size_min, 0,
"Minimum size of kernel memory");
-u_int vm_kmem_size_max;
-SYSCTL_UINT(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RD, &vm_kmem_size_max, 0,
+static u_long vm_kmem_size_max;
+SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RD, &vm_kmem_size_max, 0,
"Maximum size of kernel memory");
-u_int vm_kmem_size_scale;
+static u_int vm_kmem_size_scale;
SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RD, &vm_kmem_size_scale, 0,
"Scale factor for kernel memory size");
@@ -589,7 +589,7 @@ kmeminit(void *dummy)
#if defined(VM_KMEM_SIZE_MIN)
vm_kmem_size_min = VM_KMEM_SIZE_MIN;
#endif
- TUNABLE_INT_FETCH("vm.kmem_size_min", &vm_kmem_size_min);
+ TUNABLE_ULONG_FETCH("vm.kmem_size_min", &vm_kmem_size_min);
if (vm_kmem_size_min > 0 && vm_kmem_size < vm_kmem_size_min) {
vm_kmem_size = vm_kmem_size_min;
}
@@ -597,16 +597,16 @@ kmeminit(void *dummy)
#if defined(VM_KMEM_SIZE_MAX)
vm_kmem_size_max = VM_KMEM_SIZE_MAX;
#endif
- TUNABLE_INT_FETCH("vm.kmem_size_max", &vm_kmem_size_max);
+ TUNABLE_ULONG_FETCH("vm.kmem_size_max", &vm_kmem_size_max);
if (vm_kmem_size_max > 0 && vm_kmem_size >= vm_kmem_size_max)
vm_kmem_size = vm_kmem_size_max;
/* Allow final override from the kernel environment */
#ifndef BURN_BRIDGES
- if (TUNABLE_INT_FETCH("kern.vm.kmem.size", &vm_kmem_size) != 0)
+ if (TUNABLE_ULONG_FETCH("kern.vm.kmem.size", &vm_kmem_size) != 0)
printf("kern.vm.kmem.size is now called vm.kmem_size!\n");
#endif
- TUNABLE_INT_FETCH("vm.kmem_size", &vm_kmem_size);
+ TUNABLE_ULONG_FETCH("vm.kmem_size", &vm_kmem_size);
/*
* Limit kmem virtual size to twice the physical memory.
Modified: stable/7/sys/vm/vm_kern.h
==============================================================================
--- stable/7/sys/vm/vm_kern.h Mon May 18 07:13:42 2009 (r192299)
+++ stable/7/sys/vm/vm_kern.h Mon May 18 07:24:06 2009 (r192300)
@@ -69,6 +69,6 @@ extern vm_map_t kernel_map;
extern vm_map_t kmem_map;
extern vm_map_t exec_map;
extern vm_map_t pipe_map;
-extern u_int vm_kmem_size;
+extern u_long vm_kmem_size;
#endif /* _VM_VM_KERN_H_ */
From kib at FreeBSD.org Mon May 18 08:42:01 2009
From: kib at FreeBSD.org (Konstantin Belousov)
Date: Mon May 18 08:42:11 2009
Subject: svn commit: r192301 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb fs/devfs
Message-ID: <200905180842.n4I8g0hF055224@svn.freebsd.org>
Author: kib
Date: Mon May 18 08:41:59 2009
New Revision: 192301
URL: http://svn.freebsd.org/changeset/base/192301
Log:
MFC r192151:
Initialize f_vnode before calling d_fdopen() cdevsw method.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/fs/devfs/devfs_vnops.c
Modified: stable/7/sys/fs/devfs/devfs_vnops.c
==============================================================================
--- stable/7/sys/fs/devfs/devfs_vnops.c Mon May 18 07:24:06 2009 (r192300)
+++ stable/7/sys/fs/devfs/devfs_vnops.c Mon May 18 08:41:59 2009 (r192301)
@@ -890,6 +890,7 @@ devfs_open(struct vop_open_args *ap)
if (fp != NULL) {
FILE_LOCK(fp);
fp->f_data = dev;
+ fp->f_vnode = vp;
FILE_UNLOCK(fp);
}
fpop = td->td_fpop;
From jhb at FreeBSD.org Mon May 18 17:14:25 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 18 17:14:37 2009
Subject: svn commit: r192311 - in stable/7/sys: . amd64/amd64 arm/arm
contrib/pf dev/ath/ath_hal dev/cxgb i386/i386 ia64/ia64 kern
powerpc/powerpc sparc64/sparc64 sys
Message-ID: <200905181714.n4IHEN1o068422@svn.freebsd.org>
Author: jhb
Date: Mon May 18 17:14:23 2009
New Revision: 192311
URL: http://svn.freebsd.org/changeset/base/192311
Log:
MFC: Simplify the interrupt code a bit by always including the ie_disable
and ie_eoi methods and collapsing down to a single intr_event_create()
routine.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/amd64/intr_machdep.c
stable/7/sys/arm/arm/intr.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/i386/intr_machdep.c
stable/7/sys/ia64/ia64/interrupt.c
stable/7/sys/kern/kern_intr.c
stable/7/sys/powerpc/powerpc/intr_machdep.c
stable/7/sys/sparc64/sparc64/intr_machdep.c
stable/7/sys/sys/interrupt.h
Modified: stable/7/sys/amd64/amd64/intr_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/intr_machdep.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/amd64/amd64/intr_machdep.c Mon May 18 17:14:23 2009 (r192311)
@@ -77,12 +77,6 @@ static struct sx intr_table_lock;
static struct mtx intrcnt_lock;
static STAILQ_HEAD(, pic) pics;
-#ifdef INTR_FILTER
-static void intr_eoi_src(void *arg);
-static void intr_disab_eoi_src(void *arg);
-static void intr_event_stray(void *cookie);
-#endif
-
#ifdef SMP
static int assign_cpu;
@@ -90,6 +84,10 @@ static void intr_assign_next_cpu(struct
#endif
static int intr_assign_cpu(void *arg, u_char cpu);
+static void intr_disable_src(void *arg);
+#ifdef INTR_FILTER
+static void intr_event_stray(void *cookie);
+#endif
static void intr_init(void *__dummy);
static int intr_pic_registered(struct pic *pic);
static void intrcnt_setname(const char *name, int index);
@@ -144,16 +142,10 @@ intr_register_source(struct intsrc *isrc
vector = isrc->is_pic->pic_vector(isrc);
if (interrupt_sources[vector] != NULL)
return (EEXIST);
-#ifdef INTR_FILTER
- error = intr_event_create(&isrc->is_event, isrc, 0,
- (mask_fn)isrc->is_pic->pic_enable_source,
- intr_eoi_src, intr_disab_eoi_src, intr_assign_cpu, "irq%d:",
- vector);
-#else
error = intr_event_create(&isrc->is_event, isrc, 0,
- (mask_fn)isrc->is_pic->pic_enable_source, intr_assign_cpu, "irq%d:",
+ intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source,
+ (mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:",
vector);
-#endif
if (error)
return (error);
sx_xlock(&intr_table_lock);
@@ -237,6 +229,15 @@ intr_config_intr(int vector, enum intr_t
return (isrc->is_pic->pic_config_intr(isrc, trig, pol));
}
+static void
+intr_disable_src(void *arg)
+{
+ struct intsrc *isrc;
+
+ isrc = arg;
+ isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
+}
+
#ifdef INTR_FILTER
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
@@ -289,24 +290,6 @@ intr_event_stray(void *cookie)
"too many stray irq %d's: not logging anymore\n",
isrc->is_pic->pic_vector(isrc));
}
-
-static void
-intr_eoi_src(void *arg)
-{
- struct intsrc *isrc;
-
- isrc = arg;
- isrc->is_pic->pic_eoi_source(isrc);
-}
-
-static void
-intr_disab_eoi_src(void *arg)
-{
- struct intsrc *isrc;
-
- isrc = arg;
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
-}
#else
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
Modified: stable/7/sys/arm/arm/intr.c
==============================================================================
--- stable/7/sys/arm/arm/intr.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/arm/arm/intr.c Mon May 18 17:14:23 2009 (r192311)
@@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$");
#include
#include
+typedef void (*mask_fn)(void *);
+
static struct intr_event *intr_events[NIRQ];
static int intrcnt_tab[NIRQ];
static int intrcnt_index = 0;
@@ -57,27 +59,6 @@ static int last_printed = 0;
void arm_handler_execute(struct trapframe *, int);
-#ifdef INTR_FILTER
-static void
-intr_disab_eoi_src(void *arg)
-{
- uintptr_t nb;
-
- nb = (uintptr_t)arg;
- arm_mask_irq(nb);
-}
-
-static void
-intr_eoi_src(void *arg)
-{
- uintptr_t nb;
-
- nb = (uintptr_t)arg;
- arm_unmask_irq(nb);
-}
-
-#endif
-
void
arm_setup_irqhandler(const char *name, driver_filter_t *filt,
void (*hand)(void*), void *arg, int irq, int flags, void **cookiep)
@@ -89,14 +70,9 @@ arm_setup_irqhandler(const char *name, d
return;
event = intr_events[irq];
if (event == NULL) {
-#ifdef INTR_FILTER
- error = intr_event_create(&event, (void *)irq, 0,
- (void (*)(void *))arm_unmask_irq, intr_eoi_src,
- intr_disab_eoi_src, NULL, "intr%d:", irq);
-#else
error = intr_event_create(&event, (void *)irq, 0,
- (void (*)(void *))arm_unmask_irq, NULL, "intr%d:", irq);
-#endif
+ (mask_fn)arm_mask_irq, (mask_fn)arm_unmask_irq,
+ (mask_fn)arm_unmask_irq, NULL, "intr%d:", irq);
if (error)
return;
intr_events[irq] = event;
Modified: stable/7/sys/i386/i386/intr_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/intr_machdep.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/i386/i386/intr_machdep.c Mon May 18 17:14:23 2009 (r192311)
@@ -68,12 +68,6 @@ static struct sx intr_table_lock;
static struct mtx intrcnt_lock;
static STAILQ_HEAD(, pic) pics;
-#ifdef INTR_FILTER
-static void intr_eoi_src(void *arg);
-static void intr_disab_eoi_src(void *arg);
-static void intr_event_stray(void *cookie);
-#endif
-
#ifdef SMP
static int assign_cpu;
@@ -81,6 +75,10 @@ static void intr_assign_next_cpu(struct
#endif
static int intr_assign_cpu(void *arg, u_char cpu);
+static void intr_disable_src(void *arg);
+#ifdef INTR_FILTER
+static void intr_event_stray(void *cookie);
+#endif
static void intr_init(void *__dummy);
static int intr_pic_registered(struct pic *pic);
static void intrcnt_setname(const char *name, int index);
@@ -135,16 +133,10 @@ intr_register_source(struct intsrc *isrc
vector = isrc->is_pic->pic_vector(isrc);
if (interrupt_sources[vector] != NULL)
return (EEXIST);
-#ifdef INTR_FILTER
- error = intr_event_create(&isrc->is_event, isrc, 0,
- (mask_fn)isrc->is_pic->pic_enable_source,
- intr_eoi_src, intr_disab_eoi_src, intr_assign_cpu, "irq%d:",
- vector);
-#else
error = intr_event_create(&isrc->is_event, isrc, 0,
- (mask_fn)isrc->is_pic->pic_enable_source, intr_assign_cpu, "irq%d:",
+ intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source,
+ (mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:",
vector);
-#endif
if (error)
return (error);
sx_xlock(&intr_table_lock);
@@ -228,6 +220,15 @@ intr_config_intr(int vector, enum intr_t
return (isrc->is_pic->pic_config_intr(isrc, trig, pol));
}
+static void
+intr_disable_src(void *arg)
+{
+ struct intsrc *isrc;
+
+ isrc = arg;
+ isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
+}
+
#ifdef INTR_FILTER
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
@@ -280,24 +281,6 @@ intr_event_stray(void *cookie)
"too many stray irq %d's: not logging anymore\n",
isrc->is_pic->pic_vector(isrc));
}
-
-static void
-intr_eoi_src(void *arg)
-{
- struct intsrc *isrc;
-
- isrc = arg;
- isrc->is_pic->pic_eoi_source(isrc);
-}
-
-static void
-intr_disab_eoi_src(void *arg)
-{
- struct intsrc *isrc;
-
- isrc = arg;
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
-}
#else
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
Modified: stable/7/sys/ia64/ia64/interrupt.c
==============================================================================
--- stable/7/sys/ia64/ia64/interrupt.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/ia64/ia64/interrupt.c Mon May 18 17:14:23 2009 (r192311)
@@ -340,10 +340,7 @@ ia64_setup_intr(const char *name, int ir
return (ENOMEM);
error = intr_event_create(&i->event, (void *)(uintptr_t)vector,
- 0, ia64_intr_unmask,
-#ifdef INTR_FILTER
- ia64_intr_eoi, ia64_intr_mask,
-#endif
+ 0, ia64_intr_mask, ia64_intr_unmask, ia64_intr_eoi,
NULL, "irq%u:", irq);
if (error) {
free(i, M_DEVBUF);
Modified: stable/7/sys/kern/kern_intr.c
==============================================================================
--- stable/7/sys/kern/kern_intr.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/kern/kern_intr.c Mon May 18 17:14:23 2009 (r192311)
@@ -238,43 +238,9 @@ intr_event_update(struct intr_event *ie)
CTR2(KTR_INTR, "%s: updated %s", __func__, ie->ie_fullname);
}
-#ifndef INTR_FILTER
-int
-intr_event_create(struct intr_event **event, void *source, int flags,
- void (*enable)(void *), int (*assign_cpu)(void *, u_char), const char *fmt,
- ...)
-{
- struct intr_event *ie;
- va_list ap;
-
- /* The only valid flag during creation is IE_SOFT. */
- if ((flags & ~IE_SOFT) != 0)
- return (EINVAL);
- ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO);
- ie->ie_source = source;
- ie->ie_enable = enable;
- ie->ie_assign_cpu = assign_cpu;
- ie->ie_flags = flags;
- ie->ie_cpu = NOCPU;
- TAILQ_INIT(&ie->ie_handlers);
- mtx_init(&ie->ie_lock, "intr event", NULL, MTX_DEF);
-
- va_start(ap, fmt);
- vsnprintf(ie->ie_name, sizeof(ie->ie_name), fmt, ap);
- va_end(ap);
- strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname));
- mtx_pool_lock(mtxpool_sleep, &event_list);
- TAILQ_INSERT_TAIL(&event_list, ie, ie_list);
- mtx_pool_unlock(mtxpool_sleep, &event_list);
- if (event != NULL)
- *event = ie;
- CTR2(KTR_INTR, "%s: created %s", __func__, ie->ie_name);
- return (0);
-}
-#else
int
-intr_event_create(struct intr_event **event, void *source, int flags,
- void (*enable)(void *), void (*eoi)(void *), void (*disab)(void *),
+intr_event_create(struct intr_event **event, void *source,int flags,
+ void (*disable)(void *), void (*enable)(void *), void (*eoi)(void *),
int (*assign_cpu)(void *, u_char), const char *fmt, ...)
{
struct intr_event *ie;
@@ -285,10 +251,10 @@ intr_event_create(struct intr_event **ev
return (EINVAL);
ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO);
ie->ie_source = source;
+ ie->ie_disable = disable;
ie->ie_enable = enable;
- ie->ie_assign_cpu = assign_cpu;
ie->ie_eoi = eoi;
- ie->ie_disab = disab;
+ ie->ie_assign_cpu = assign_cpu;
ie->ie_flags = flags;
ie->ie_cpu = NOCPU;
TAILQ_INIT(&ie->ie_handlers);
@@ -306,7 +272,6 @@ intr_event_create(struct intr_event **ev
CTR2(KTR_INTR, "%s: created %s", __func__, ie->ie_name);
return (0);
}
-#endif
/*
* Bind an interrupt event to the specified CPU. Note that not all
@@ -945,13 +910,8 @@ swi_add(struct intr_event **eventp, cons
if (!(ie->ie_flags & IE_SOFT))
return (EINVAL);
} else {
-#ifdef INTR_FILTER
error = intr_event_create(&ie, NULL, IE_SOFT,
NULL, NULL, NULL, NULL, "swi%d:", pri);
-#else
- error = intr_event_create(&ie, NULL, IE_SOFT,
- NULL, NULL, "swi%d:", pri);
-#endif
if (error)
return (error);
if (eventp != NULL)
@@ -1408,8 +1368,8 @@ intr_event_handle(struct intr_event *ie,
if (ie->ie_eoi != NULL)
ie->ie_eoi(ie->ie_source);
} else {
- if (ie->ie_disab != NULL)
- ie->ie_disab(ie->ie_source);
+ if (ie->ie_disable != NULL)
+ ie->ie_disable(ie->ie_source);
}
critical_exit();
Modified: stable/7/sys/powerpc/powerpc/intr_machdep.c
==============================================================================
--- stable/7/sys/powerpc/powerpc/intr_machdep.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/powerpc/powerpc/intr_machdep.c Mon May 18 17:14:23 2009 (r192311)
@@ -105,7 +105,6 @@ intrcnt_setname(const char *name, int in
MAXCOMLEN, name);
}
-#ifdef INTR_FILTER
static void
powerpc_intr_eoi(void *arg)
{
@@ -121,7 +120,6 @@ powerpc_intr_mask(void *arg)
PIC_MASK(pic, irq);
}
-#endif
static void
powerpc_intr_unmask(void *arg)
@@ -187,10 +185,7 @@ powerpc_setup_intr(const char *name, u_i
return (ENOMEM);
}
error = intr_event_create(&i->event, (void *)irq, 0,
- powerpc_intr_unmask,
-#ifdef INTR_FILTER
- powerpc_intr_eoi, powerpc_intr_mask,
-#endif
+ powerpc_intr_mask, powerpc_intr_unmask, powerpc_intr_eoi,
NULL, "irq%u:", irq);
if (error) {
/* XXX unlock */
Modified: stable/7/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/intr_machdep.c Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/sparc64/sparc64/intr_machdep.c Mon May 18 17:14:23 2009 (r192311)
@@ -345,12 +345,8 @@ intr_controller_register(int vec, const
sx_xunlock(&intr_table_lock);
if (ie != NULL)
return (EEXIST);
- error = intr_event_create(&ie, iv, 0, ic->ic_clear,
-#ifdef INTR_FILTER
- ic->ic_clear, NULL, intr_assign_cpu, "vec%d:", vec);
-#else
- intr_assign_cpu, "vec%d:", vec);
-#endif
+ error = intr_event_create(&ie, iv, 0, NULL, ic->ic_clear,
+ ic->ic_clear, intr_assign_cpu, "vec%d:", vec);
if (error != 0)
return (error);
sx_xlock(&intr_table_lock);
Modified: stable/7/sys/sys/interrupt.h
==============================================================================
--- stable/7/sys/sys/interrupt.h Mon May 18 17:10:26 2009 (r192310)
+++ stable/7/sys/sys/interrupt.h Mon May 18 17:14:23 2009 (r192311)
@@ -72,12 +72,10 @@ struct intr_event {
struct mtx ie_lock;
void *ie_source; /* Cookie used by MD code. */
struct intr_thread *ie_thread; /* Thread we are connected to. */
+ void (*ie_disable)(void *);
void (*ie_enable)(void *);
- int (*ie_assign_cpu)(void *, u_char);
-#ifdef INTR_FILTER
void (*ie_eoi)(void *);
- void (*ie_disab)(void *);
-#endif
+ int (*ie_assign_cpu)(void *, u_char);
int ie_flags;
int ie_count; /* Loop counter. */
int ie_warncnt; /* Rate-check interrupt storm warns. */
@@ -130,18 +128,11 @@ int intr_event_add_handler(struct intr_e
driver_filter_t filter, driver_intr_t handler, void *arg,
u_char pri, enum intr_type flags, void **cookiep);
int intr_event_bind(struct intr_event *ie, u_char cpu);
-#ifndef INTR_FILTER
-int intr_event_create(struct intr_event **event, void *source,
- int flags, void (*enable)(void *),
- int (*assign_cpu)(void *, u_char), const char *fmt, ...)
- __printflike(6, 7);
-#else
int intr_event_create(struct intr_event **event, void *source,
- int flags, void (*enable)(void *), void (*eoi)(void *),
- void (*disab)(void *), int (*assign_cpu)(void *, u_char),
+ int flags, void (*disable)(void *), void (*enable)(void *),
+ void (*eoi)(void *), int (*assign_cpu)(void *, u_char),
const char *fmt, ...)
__printflike(8, 9);
-#endif
int intr_event_destroy(struct intr_event *ie);
int intr_event_remove_handler(void *cookie);
#ifndef INTR_FILTER
From jhb at FreeBSD.org Mon May 18 17:39:13 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 18 17:39:30 2009
Subject: svn commit: r192316 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb sys
Message-ID: <200905181739.n4IHdCui069699@svn.freebsd.org>
Author: jhb
Date: Mon May 18 17:39:12 2009
New Revision: 192316
URL: http://svn.freebsd.org/changeset/base/192316
Log:
MFC: Use __null for NULL for GNU C++ 4.x and use the same value for NULL
in the kernel as in userland.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/sys/_null.h
Modified: stable/7/sys/sys/_null.h
==============================================================================
--- stable/7/sys/sys/_null.h Mon May 18 17:37:27 2009 (r192315)
+++ stable/7/sys/sys/_null.h Mon May 18 17:39:12 2009 (r192316)
@@ -28,14 +28,18 @@
#ifndef NULL
-#if defined(_KERNEL) || !defined(__cplusplus)
+#if !defined(__cplusplus)
#define NULL ((void *)0)
#else
+#if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
+#define NULL __null
+#else
#if defined(__LP64__)
#define NULL (0L)
#else
#define NULL 0
#endif /* __LP64__ */
-#endif /* _KERNEL || !__cplusplus */
+#endif /* __GNUG__ */
+#endif /* !__cplusplus */
#endif
From jhb at FreeBSD.org Mon May 18 20:23:17 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 18 20:23:23 2009
Subject: svn commit: r192336 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb netinet
Message-ID: <200905182023.n4IKNGZ2073804@svn.freebsd.org>
Author: jhb
Date: Mon May 18 20:23:16 2009
New Revision: 192336
URL: http://svn.freebsd.org/changeset/base/192336
Log:
MFC: Convert IPFW_DEFAULT_TO_ACCEPT into a loader tunable.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/netinet/ip_fw2.c
Modified: stable/7/sys/netinet/ip_fw2.c
==============================================================================
--- stable/7/sys/netinet/ip_fw2.c Mon May 18 19:56:06 2009 (r192335)
+++ stable/7/sys/netinet/ip_fw2.c Mon May 18 20:23:16 2009 (r192336)
@@ -111,6 +111,11 @@ static int fw_verbose;
static struct callout ipfw_timeout;
static int verbose_limit;
+#ifdef IPFIREWALL_DEFAULT_TO_ACCEPT
+static int default_to_accept = 1;
+#else
+static int default_to_accept;
+#endif
static uma_zone_t ipfw_dyn_rule_zone;
/*
@@ -170,6 +175,9 @@ SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, d
NULL, IPFW_DEFAULT_RULE, "The default/max possible rule number.");
SYSCTL_UINT(_net_inet_ip_fw, OID_AUTO, tables_max, CTLFLAG_RD,
NULL, IPFW_TABLES_MAX, "The maximum number of tables.");
+SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, default_to_accept, CTLFLAG_RDTUN,
+ &default_to_accept, 0, "Make the default rule accept all packets.");
+TUNABLE_INT("net.inet.ip.fw.default_to_accept", &default_to_accept);
#endif /* SYSCTL_NODE */
/*
@@ -4514,11 +4522,7 @@ ipfw_init(void)
default_rule.set = RESVD_SET;
default_rule.cmd[0].len = 1;
- default_rule.cmd[0].opcode =
-#ifdef IPFIREWALL_DEFAULT_TO_ACCEPT
- 1 ? O_ACCEPT :
-#endif
- O_DENY;
+ default_rule.cmd[0].opcode = default_to_accept ? O_ACCEPT : O_DENY;
error = add_rule(&layer3_chain, &default_rule);
if (error != 0) {
From jhb at FreeBSD.org Mon May 18 21:44:34 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Mon May 18 21:44:51 2009
Subject: svn commit: r192340 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb net
Message-ID: <200905182144.n4ILiXeh075592@svn.freebsd.org>
Author: jhb
Date: Mon May 18 21:44:33 2009
New Revision: 192340
URL: http://svn.freebsd.org/changeset/base/192340
Log:
MFC: Remove dependency of vlan.ko on miibus.ko.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/net/if_vlan.c
Modified: stable/7/sys/net/if_vlan.c
==============================================================================
--- stable/7/sys/net/if_vlan.c Mon May 18 21:36:17 2009 (r192339)
+++ stable/7/sys/net/if_vlan.c Mon May 18 21:44:33 2009 (r192340)
@@ -567,7 +567,6 @@ static moduledata_t vlan_mod = {
DECLARE_MODULE(if_vlan, vlan_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
MODULE_VERSION(if_vlan, 3);
-MODULE_DEPEND(if_vlan, miibus, 1, 1, 1);
static struct ifnet *
vlan_clone_match_ethertag(struct if_clone *ifc, const char *name, int *tag)
From marcel at FreeBSD.org Mon May 18 22:45:10 2009
From: marcel at FreeBSD.org (Marcel Moolenaar)
Date: Mon May 18 22:45:26 2009
Subject: svn commit: r192352 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/uart
Message-ID: <200905182245.n4IMj9WM077354@svn.freebsd.org>
Author: marcel
Date: Mon May 18 22:45:09 2009
New Revision: 192352
URL: http://svn.freebsd.org/changeset/base/192352
Log:
MFC r190834:
Fix hangs caused by hardware that signals receive errors
(framing, parity, etc), but does not indicate characters
being received. Since no chracters have been received,
ignore the line errors.
PR: 131006
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/uart/uart_dev_ns8250.c
Modified: stable/7/sys/dev/uart/uart_dev_ns8250.c
==============================================================================
--- stable/7/sys/dev/uart/uart_dev_ns8250.c Mon May 18 22:34:44 2009 (r192351)
+++ stable/7/sys/dev/uart/uart_dev_ns8250.c Mon May 18 22:45:09 2009 (r192352)
@@ -50,14 +50,16 @@ __FBSDID("$FreeBSD$");
static void
ns8250_clrint(struct uart_bas *bas)
{
- uint8_t iir;
+ uint8_t iir, lsr;
iir = uart_getreg(bas, REG_IIR);
while ((iir & IIR_NOPEND) == 0) {
iir &= IIR_IMASK;
- if (iir == IIR_RLS)
- (void)uart_getreg(bas, REG_LSR);
- else if (iir == IIR_RXRDY || iir == IIR_RXTOUT)
+ if (iir == IIR_RLS) {
+ lsr = uart_getreg(bas, REG_LSR);
+ if (lsr & (LSR_BI|LSR_FE|LSR_PE))
+ (void)uart_getreg(bas, REG_DATA);
+ } else if (iir == IIR_RXRDY || iir == IIR_RXTOUT)
(void)uart_getreg(bas, REG_DATA);
else if (iir == IIR_MLSC)
(void)uart_getreg(bas, REG_MSR);
@@ -563,7 +565,6 @@ ns8250_bus_ipend(struct uart_softc *sc)
ipend = 0;
if (iir & IIR_RXRDY) {
lsr = uart_getreg(bas, REG_LSR);
- uart_unlock(sc->sc_hwmtx);
if (lsr & LSR_OE)
ipend |= SER_INT_OVERRUN;
if (lsr & LSR_BI)
@@ -571,12 +572,14 @@ ns8250_bus_ipend(struct uart_softc *sc)
if (lsr & LSR_RXRDY)
ipend |= SER_INT_RXREADY;
} else {
- uart_unlock(sc->sc_hwmtx);
if (iir & IIR_TXRDY)
ipend |= SER_INT_TXIDLE;
else
ipend |= SER_INT_SIGCHG;
}
+ if (ipend == 0)
+ ns8250_clrint(bas);
+ uart_unlock(sc->sc_hwmtx);
return ((sc->sc_leaving) ? 0 : ipend);
}
From jhb at FreeBSD.org Tue May 19 14:01:58 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue May 19 14:02:15 2009
Subject: svn commit: r192378 - in stable/7: sys sys/contrib/pf
sys/dev/ath/ath_hal sys/dev/cxgb sys/dev/pci usr.sbin/pciconf
Message-ID: <200905191401.n4JE1vtR099601@svn.freebsd.org>
Author: jhb
Date: Tue May 19 14:01:57 2009
New Revision: 192378
URL: http://svn.freebsd.org/changeset/base/192378
Log:
MFC: Add more PCI-express capability registers and display additional
details about PCI-express devices.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/pci/pcireg.h
stable/7/usr.sbin/pciconf/ (props changed)
stable/7/usr.sbin/pciconf/cap.c
Modified: stable/7/sys/dev/pci/pcireg.h
==============================================================================
--- stable/7/sys/dev/pci/pcireg.h Tue May 19 12:42:01 2009 (r192377)
+++ stable/7/sys/dev/pci/pcireg.h Tue May 19 14:01:57 2009 (r192378)
@@ -594,8 +594,36 @@
#define PCIM_EXP_TYPE_UPSTREAM_PORT 0x0050
#define PCIM_EXP_TYPE_DOWNSTREAM_PORT 0x0060
#define PCIM_EXP_TYPE_PCI_BRIDGE 0x0070
+#define PCIM_EXP_TYPE_PCIE_BRIDGE 0x0080
+#define PCIM_EXP_TYPE_ROOT_INT_EP 0x0090
+#define PCIM_EXP_TYPE_ROOT_EC 0x00a0
#define PCIM_EXP_FLAGS_SLOT 0x0100
#define PCIM_EXP_FLAGS_IRQ 0x3e00
+#define PCIR_EXPRESS_DEVICE_CAP 0x4
+#define PCIM_EXP_CAP_MAX_PAYLOAD 0x0007
+#define PCIR_EXPRESS_DEVICE_CTL 0x8
+#define PCIM_EXP_CTL_MAX_PAYLOAD 0x00e0
+#define PCIM_EXP_CTL_MAX_READ_REQUEST 0x7000
+#define PCIR_EXPRESS_DEVICE_STA 0xa
+#define PCIR_EXPRESS_LINK_CAP 0xc
+#define PCIM_LINK_CAP_MAX_SPEED 0x0000000f
+#define PCIM_LINK_CAP_MAX_WIDTH 0x000003f0
+#define PCIM_LINK_CAP_ASPM 0x00000c00
+#define PCIM_LINK_CAP_L0S_EXIT 0x00007000
+#define PCIM_LINK_CAP_L1_EXIT 0x00038000
+#define PCIM_LINK_CAP_PORT 0xff000000
+#define PCIR_EXPRESS_LINK_CTL 0x10
+#define PCIR_EXPRESS_LINK_STA 0x12
+#define PCIM_LINK_STA_SPEED 0x000f
+#define PCIM_LINK_STA_WIDTH 0x03f0
+#define PCIM_LINK_STA_TRAINING_ERROR 0x0400
+#define PCIM_LINK_STA_TRAINING 0x0800
+#define PCIM_LINK_STA_SLOT_CLOCK 0x1000
+#define PCIR_EXPRESS_SLOT_CAP 0x14
+#define PCIR_EXPRESS_SLOT_CTL 0x18
+#define PCIR_EXPRESS_SLOT_STA 0x1a
+#define PCIR_EXPRESS_ROOT_CTL 0x1c
+#define PCIR_EXPRESS_ROOT_STA 0x20
/* MSI-X definitions */
#define PCIR_MSIX_CTRL 0x2
Modified: stable/7/usr.sbin/pciconf/cap.c
==============================================================================
--- stable/7/usr.sbin/pciconf/cap.c Tue May 19 12:42:01 2009 (r192377)
+++ stable/7/usr.sbin/pciconf/cap.c Tue May 19 14:01:57 2009 (r192378)
@@ -151,7 +151,9 @@ cap_pcix(int fd, struct pci_conf *p, uin
printf("64-bit ");
if ((p->pc_hdr & PCIM_HDRTYPE) == 1)
printf("bridge ");
- printf("supports");
+ if ((p->pc_hdr & PCIM_HDRTYPE) != 1 || (status & (PCIXM_STATUS_133CAP |
+ PCIXM_STATUS_266CAP | PCIXM_STATUS_533CAP)) != 0)
+ printf("supports");
comma = 0;
if (status & PCIXM_STATUS_133CAP) {
printf("%s 133MHz", comma ? "," : "");
@@ -357,9 +359,12 @@ cap_subvendor(int fd, struct pci_conf *p
printf("PCI Bridge card=0x%08x", id);
}
+#define MAX_PAYLOAD(field) (128 << (field))
+
static void
cap_express(int fd, struct pci_conf *p, uint8_t ptr)
{
+ uint32_t val;
uint16_t flags;
flags = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_FLAGS, 2);
@@ -383,12 +388,30 @@ cap_express(int fd, struct pci_conf *p,
case PCIM_EXP_TYPE_PCI_BRIDGE:
printf("PCI bridge");
break;
+ case PCIM_EXP_TYPE_PCIE_BRIDGE:
+ printf("PCI to PCIe bridge");
+ break;
+ case PCIM_EXP_TYPE_ROOT_INT_EP:
+ printf("root endpoint");
+ break;
+ case PCIM_EXP_TYPE_ROOT_EC:
+ printf("event collector");
+ break;
default:
- printf("type %d", (flags & PCIM_EXP_FLAGS_TYPE) >> 8);
+ printf("type %d", (flags & PCIM_EXP_FLAGS_TYPE) >> 4);
break;
}
if (flags & PCIM_EXP_FLAGS_IRQ)
- printf(" IRQ %d", (flags & PCIM_EXP_FLAGS_IRQ) >> 17);
+ printf(" IRQ %d", (flags & PCIM_EXP_FLAGS_IRQ) >> 8);
+ val = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_DEVICE_CAP, 4);
+ flags = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_DEVICE_CTL, 2);
+ printf(" max data %d(%d)",
+ MAX_PAYLOAD((flags & PCIM_EXP_CTL_MAX_PAYLOAD) >> 5),
+ MAX_PAYLOAD(val & PCIM_EXP_CAP_MAX_PAYLOAD));
+ val = read_config(fd, &p->pc_sel, ptr + PCIR_EXPRESS_LINK_CAP, 4);
+ flags = read_config(fd, &p->pc_sel, ptr+ PCIR_EXPRESS_LINK_STA, 2);
+ printf(" link x%d(x%d)", (flags & PCIM_LINK_STA_WIDTH) >> 4,
+ (val & PCIM_LINK_CAP_MAX_WIDTH) >> 4);
}
static void
From jhb at FreeBSD.org Tue May 19 15:33:42 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue May 19 15:33:48 2009
Subject: svn commit: r192386 - in stable/7: sys sys/contrib/pf
sys/dev/ath/ath_hal sys/dev/cxgb sys/dev/pci usr.sbin/pciconf
Message-ID: <200905191533.n4JFXf2e001935@svn.freebsd.org>
Author: jhb
Date: Tue May 19 15:33:41 2009
New Revision: 192386
URL: http://svn.freebsd.org/changeset/base/192386
Log:
MFC: Add SATA and PCI Advanced Features capabilities reporting.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/pci/pcireg.h
stable/7/usr.sbin/pciconf/ (props changed)
stable/7/usr.sbin/pciconf/cap.c
Modified: stable/7/sys/dev/pci/pcireg.h
==============================================================================
--- stable/7/sys/dev/pci/pcireg.h Tue May 19 14:51:48 2009 (r192385)
+++ stable/7/sys/dev/pci/pcireg.h Tue May 19 15:33:41 2009 (r192386)
@@ -113,6 +113,8 @@
#define PCIY_SECDEV 0x0f /* Secure Device */
#define PCIY_EXPRESS 0x10 /* PCI Express */
#define PCIY_MSIX 0x11 /* MSI-X */
+#define PCIY_SATA 0x12 /* SATA */
+#define PCIY_PCIAF 0x13 /* PCI Advanced Features */
/* config registers for header type 0 devices */
@@ -640,3 +642,12 @@
#define PCIM_MSIX_BIR_BAR_20 4
#define PCIM_MSIX_BIR_BAR_24 5
#define PCIM_MSIX_VCTRL_MASK 0x1
+
+/* PCI Advanced Features definitions */
+#define PCIR_PCIAF_CAP 0x3
+#define PCIM_PCIAFCAP_TP 0x01
+#define PCIM_PCIAFCAP_FLR 0x02
+#define PCIR_PCIAF_CTRL 0x4
+#define PCIR_PCIAFCTRL_FLR 0x01
+#define PCIR_PCIAF_STATUS 0x5
+#define PCIR_PCIAFSTATUS_TP 0x01
Modified: stable/7/usr.sbin/pciconf/cap.c
==============================================================================
--- stable/7/usr.sbin/pciconf/cap.c Tue May 19 14:51:48 2009 (r192385)
+++ stable/7/usr.sbin/pciconf/cap.c Tue May 19 15:33:41 2009 (r192386)
@@ -437,6 +437,24 @@ cap_msix(int fd, struct pci_conf *p, uin
printf(" enabled");
}
+static void
+cap_sata(int fd, struct pci_conf *p, uint8_t ptr)
+{
+
+ printf("SATA Index-Data Pair");
+}
+
+static void
+cap_pciaf(int fd, struct pci_conf *p, uint8_t ptr)
+{
+ uint8_t cap;
+
+ cap = read_config(fd, &p->pc_sel, ptr + PCIR_PCIAF_CAP, 1);
+ printf("PCI Advanced Features:%s%s",
+ cap & PCIM_PCIAFCAP_FLR ? " FLR" : "",
+ cap & PCIM_PCIAFCAP_TP ? " TP" : "");
+}
+
void
list_caps(int fd, struct pci_conf *p)
{
@@ -499,6 +517,12 @@ list_caps(int fd, struct pci_conf *p)
case PCIY_MSIX:
cap_msix(fd, p, ptr);
break;
+ case PCIY_SATA:
+ cap_sata(fd, p, ptr);
+ break;
+ case PCIY_PCIAF:
+ cap_pciaf(fd, p, ptr);
+ break;
default:
printf("unknown");
break;
From jhb at FreeBSD.org Tue May 19 15:47:43 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue May 19 15:47:49 2009
Subject: svn commit: r192387 - in stable/7/sys: . contrib/pf dev/ata
dev/ath/ath_hal dev/cxgb
Message-ID: <200905191547.n4JFlgcT002274@svn.freebsd.org>
Author: jhb
Date: Tue May 19 15:47:42 2009
New Revision: 192387
URL: http://svn.freebsd.org/changeset/base/192387
Log:
MFC:
- Add a void pointer to the ata-pci controller softc to allow
chipset-specific code to attach chipset-specific data.
- Use chipset-specific data in the acard and promise chipsets rather than
changing the ivars of ATA PCI devices.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ata/ata-chipset.c
stable/7/sys/dev/ata/ata-pci.h
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/ata/ata-chipset.c
==============================================================================
--- stable/7/sys/dev/ata/ata-chipset.c Tue May 19 15:33:41 2009 (r192386)
+++ stable/7/sys/dev/ata/ata-chipset.c Tue May 19 15:47:42 2009 (r192387)
@@ -50,6 +50,12 @@ __FBSDID("$FreeBSD$");
#include
#include
+struct ata_serialize {
+ struct mtx locked_mtx;
+ int locked_ch;
+ int restart_ch;
+};
+
/* local prototypes */
/* ata-chipset.c */
static int ata_generic_chipinit(device_t dev);
@@ -186,6 +192,7 @@ static struct ata_chip_id *ata_match_chi
static struct ata_chip_id *ata_find_chip(device_t dev, struct ata_chip_id *index, int slot);
static int ata_setup_interrupt(device_t dev);
static int ata_serialize(device_t dev, int flags);
+static void ata_serialize_init(struct ata_serialize *serial);
static void ata_print_cable(device_t dev, u_int8_t *who);
static int ata_atapi(device_t dev);
static int ata_check_80pin(device_t dev, int mode);
@@ -919,6 +926,7 @@ static int
ata_acard_chipinit(device_t dev)
{
struct ata_pci_controller *ctlr = device_get_softc(dev);
+ struct ata_serialize *serial;
if (ata_setup_interrupt(dev))
return ENXIO;
@@ -927,6 +935,10 @@ ata_acard_chipinit(device_t dev)
if (ctlr->chip->cfg1 == ATPOLD) {
ctlr->setmode = ata_acard_850_setmode;
ctlr->locking = ata_serialize;
+ serial = malloc(sizeof(struct ata_serialize),
+ M_TEMP, M_WAITOK | M_ZERO);
+ ata_serialize_init(serial);
+ ctlr->chipset_data = serial;
}
else
ctlr->setmode = ata_acard_86X_setmode;
@@ -3461,7 +3473,7 @@ ata_promise_chipinit(device_t dev)
mtx_init(&hpkt->mtx, "ATA promise HPKT lock", NULL, MTX_DEF);
TAILQ_INIT(&hpkt->queue);
hpkt->busy = 0;
- device_set_ivars(dev, hpkt);
+ ctlr->chipset_data = hpkt;
ctlr->allocate = ata_promise_mio_allocate;
ctlr->reset = ata_promise_mio_reset;
ctlr->dmainit = ata_promise_mio_dmainit;
@@ -3908,7 +3920,7 @@ ata_promise_mio_reset(device_t dev)
case PRSX4X:
/* softreset channel ATA module */
- hpktp = device_get_ivars(ctlr->dev);
+ hpktp = ctlr->chipset_data;
ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7), ch->unit + 1);
ata_udelay(1000);
ATA_OUTL(ctlr->r_res2, 0xc0260 + (ch->unit << 7),
@@ -4247,7 +4259,7 @@ ata_promise_apkt(u_int8_t *bytep, struct
static void
ata_promise_queue_hpkt(struct ata_pci_controller *ctlr, u_int32_t hpkt)
{
- struct ata_promise_sx4 *hpktp = device_get_ivars(ctlr->dev);
+ struct ata_promise_sx4 *hpktp = ctlr->chipset_data;
mtx_lock(&hpktp->mtx);
if (hpktp->busy) {
@@ -4266,7 +4278,7 @@ ata_promise_queue_hpkt(struct ata_pci_co
static void
ata_promise_next_hpkt(struct ata_pci_controller *ctlr)
{
- struct ata_promise_sx4 *hpktp = device_get_ivars(ctlr->dev);
+ struct ata_promise_sx4 *hpktp = ctlr->chipset_data;
struct host_packet *hp;
mtx_lock(&hpktp->mtx);
@@ -5841,11 +5853,14 @@ ata_setup_interrupt(device_t dev)
return 0;
}
-struct ata_serialize {
- struct mtx locked_mtx;
- int locked_ch;
- int restart_ch;
-};
+static void
+ata_serialize_init(struct ata_serialize *serial)
+{
+
+ mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF);
+ serial->locked_ch = -1;
+ serial->restart_ch = -1;
+}
static int
ata_serialize(device_t dev, int flags)
@@ -5853,20 +5868,9 @@ ata_serialize(device_t dev, int flags)
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
struct ata_serialize *serial;
- static int inited = 0;
int res;
- if (!inited) {
- serial = malloc(sizeof(struct ata_serialize),
- M_TEMP, M_NOWAIT | M_ZERO);
- mtx_init(&serial->locked_mtx, "ATA serialize lock", NULL, MTX_DEF);
- serial->locked_ch = -1;
- serial->restart_ch = -1;
- device_set_ivars(ctlr->dev, serial);
- inited = 1;
- }
- else
- serial = device_get_ivars(ctlr->dev);
+ serial = ctlr->chipset_data;
mtx_lock(&serial->locked_mtx);
switch (flags) {
Modified: stable/7/sys/dev/ata/ata-pci.h
==============================================================================
--- stable/7/sys/dev/ata/ata-pci.h Tue May 19 15:33:41 2009 (r192386)
+++ stable/7/sys/dev/ata/ata-pci.h Tue May 19 15:47:42 2009 (r192387)
@@ -59,6 +59,7 @@ struct ata_pci_controller {
void (*function)(void *);
void *argument;
} interrupt[8]; /* XXX SOS max ch# for now */
+ void *chipset_data;
};
/* structure for SATA connection update hotplug/hotswap support */
From scottl at FreeBSD.org Tue May 19 18:14:06 2009
From: scottl at FreeBSD.org (Scott Long)
Date: Tue May 19 18:14:23 2009
Subject: svn commit: r192402 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/ciss dev/cxgb
Message-ID: <200905191814.n4JIE5LO006057@svn.freebsd.org>
Author: scottl
Date: Tue May 19 18:14:04 2009
New Revision: 192402
URL: http://svn.freebsd.org/changeset/base/192402
Log:
Merge PCI ID additions from vendor
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/ciss/ciss.c
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/ciss/ciss.c
==============================================================================
--- stable/7/sys/dev/ciss/ciss.c Tue May 19 17:54:32 2009 (r192401)
+++ stable/7/sys/dev/ciss/ciss.c Tue May 19 18:14:04 2009 (r192402)
@@ -292,17 +292,20 @@ static struct
{ 0x103C, 0x3234, CISS_BOARD_SA5, "HP Smart Array P400" },
{ 0x103C, 0x3235, CISS_BOARD_SA5, "HP Smart Array P400i" },
{ 0x103C, 0x3236, CISS_BOARD_SA5, "HP Smart Array" },
- { 0x103C, 0x3237, CISS_BOARD_SA5, "HP Smart Array" },
+ { 0x103C, 0x3237, CISS_BOARD_SA5, "HP Smart Array E500" },
{ 0x103C, 0x3238, CISS_BOARD_SA5, "HP Smart Array" },
{ 0x103C, 0x3239, CISS_BOARD_SA5, "HP Smart Array" },
{ 0x103C, 0x323A, CISS_BOARD_SA5, "HP Smart Array" },
{ 0x103C, 0x323B, CISS_BOARD_SA5, "HP Smart Array" },
{ 0x103C, 0x323C, CISS_BOARD_SA5, "HP Smart Array" },
+ { 0x103C, 0x323D, CISS_BOARD_SA5, "HP Smart Array P700m" },
{ 0x103C, 0x3241, CISS_BOARD_SA5, "HP Smart Array P212" },
{ 0x103C, 0x3243, CISS_BOARD_SA5, "HP Smart Array P410" },
{ 0x103C, 0x3245, CISS_BOARD_SA5, "HP Smart Array P410i" },
{ 0x103C, 0x3247, CISS_BOARD_SA5, "HP Smart Array P411" },
{ 0x103C, 0x3249, CISS_BOARD_SA5, "HP Smart Array P812" },
+ { 0x103C, 0x324A, CISS_BOARD_SA5, "HP Smart Array P712m" },
+ { 0x103C, 0x324B, CISS_BOARD_SA5, "HP Smart Array" },
{ 0, 0, 0, NULL }
};
From jhb at FreeBSD.org Tue May 19 19:45:38 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue May 19 19:45:54 2009
Subject: svn commit: r192406 - in stable/7/sys: . amd64/amd64 arm/arm
contrib/pf dev/ath/ath_hal dev/cxgb i386/i386 ia64/ia64 kern
powerpc/powerpc sparc64/sparc64 sun4v/sun4v sys
Message-ID: <200905191945.n4JJjb0Q008111@svn.freebsd.org>
Author: jhb
Date: Tue May 19 19:45:36 2009
New Revision: 192406
URL: http://svn.freebsd.org/changeset/base/192406
Log:
MFC: Add a MI intr_event_handle() routine for the non-INTR_FILTER case.
This allows all the INTR_FILTER #ifdef's to be removed from the MD
interrupt code.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/amd64/intr_machdep.c
stable/7/sys/arm/arm/intr.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/i386/intr_machdep.c
stable/7/sys/ia64/ia64/interrupt.c
stable/7/sys/kern/kern_intr.c
stable/7/sys/powerpc/powerpc/intr_machdep.c
stable/7/sys/sparc64/sparc64/intr_machdep.c
stable/7/sys/sun4v/sun4v/intr_machdep.c
stable/7/sys/sys/interrupt.h
Modified: stable/7/sys/amd64/amd64/intr_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/intr_machdep.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/amd64/amd64/intr_machdep.c Tue May 19 19:45:36 2009 (r192406)
@@ -85,9 +85,6 @@ static void intr_assign_next_cpu(struct
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
-#ifdef INTR_FILTER
-static void intr_event_stray(void *cookie);
-#endif
static void intr_init(void *__dummy);
static int intr_pic_registered(struct pic *pic);
static void intrcnt_setname(const char *name, int index);
@@ -238,66 +235,12 @@ intr_disable_src(void *arg)
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
}
-#ifdef INTR_FILTER
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
{
- struct thread *td;
struct intr_event *ie;
- int vector;
-
- td = curthread;
-
- /*
- * We count software interrupts when we process them. The
- * code here follows previous practice, but there's an
- * argument for counting hardware interrupts when they're
- * processed too.
- */
- (*isrc->is_count)++;
- PCPU_INC(cnt.v_intr);
-
- ie = isrc->is_event;
-
- /*
- * XXX: We assume that IRQ 0 is only used for the ISA timer
- * device (clk).
- */
- vector = isrc->is_pic->pic_vector(isrc);
- if (vector == 0)
- clkintr_pending = 1;
-
- if (intr_event_handle(ie, frame) != 0)
- intr_event_stray(isrc);
-}
-
-static void
-intr_event_stray(void *cookie)
-{
- struct intsrc *isrc;
-
- isrc = cookie;
- /*
- * For stray interrupts, mask and EOI the source, bump the
- * stray count, and log the condition.
- */
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- (*isrc->is_straycount)++;
- if (*isrc->is_straycount < MAX_STRAY_LOG)
- log(LOG_ERR, "stray irq%d\n", isrc->is_pic->pic_vector(isrc));
- else if (*isrc->is_straycount == MAX_STRAY_LOG)
- log(LOG_CRIT,
- "too many stray irq %d's: not logging anymore\n",
- isrc->is_pic->pic_vector(isrc));
-}
-#else
-void
-intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
-{
struct thread *td;
- struct intr_event *ie;
- struct intr_handler *ih;
- int error, vector, thread, ret;
+ int vector;
td = curthread;
@@ -324,7 +267,7 @@ intr_execute_handlers(struct intsrc *isr
* For stray interrupts, mask and EOI the source, bump the
* stray count, and log the condition.
*/
- if (ie == NULL || TAILQ_EMPTY(&ie->ie_handlers)) {
+ if (intr_event_handle(ie, frame) != 0) {
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
(*isrc->is_straycount)++;
if (*isrc->is_straycount < MAX_STRAY_LOG)
@@ -333,60 +276,8 @@ intr_execute_handlers(struct intsrc *isr
log(LOG_CRIT,
"too many stray irq %d's: not logging anymore\n",
vector);
- return;
}
-
- /*
- * Execute fast interrupt handlers directly.
- * To support clock handlers, if a handler registers
- * with a NULL argument, then we pass it a pointer to
- * a trapframe as its argument.
- */
- td->td_intr_nesting_level++;
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument == NULL ? frame :
- ih->ih_argument, ih->ih_name);
- if (ih->ih_argument == NULL)
- ret = ih->ih_filter(frame);
- else
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- /*
- * If there are any threaded handlers that need to run,
- * mask the source as well as sending it an EOI. Otherwise,
- * just send it an EOI but leave it unmasked.
- */
- if (thread)
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- else
- isrc->is_pic->pic_eoi_source(isrc);
-
- /* Schedule the ithread if needed. */
- if (thread) {
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("bad stray interrupt"));
- }
- critical_exit();
- td->td_intr_nesting_level--;
}
-#endif
void
intr_resume(void)
Modified: stable/7/sys/arm/arm/intr.c
==============================================================================
--- stable/7/sys/arm/arm/intr.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/arm/arm/intr.c Tue May 19 19:45:36 2009 (r192406)
@@ -72,7 +72,7 @@ arm_setup_irqhandler(const char *name, d
if (event == NULL) {
error = intr_event_create(&event, (void *)irq, 0,
(mask_fn)arm_mask_irq, (mask_fn)arm_unmask_irq,
- (mask_fn)arm_unmask_irq, NULL, "intr%d:", irq);
+ NULL, NULL, "intr%d:", irq);
if (error)
return;
intr_events[irq] = event;
@@ -106,57 +106,17 @@ arm_handler_execute(struct trapframe *fr
{
struct intr_event *event;
struct thread *td = curthread;
-#ifdef INTR_FILTER
int i;
-#else
- int i, thread, ret;
- struct intr_handler *ih;
-#endif
PCPU_INC(cnt.v_intr);
td->td_intr_nesting_level++;
while ((i = arm_get_next_irq()) != -1) {
-#ifndef INTR_FILTER
- arm_mask_irq(i);
-#endif
intrcnt[intrcnt_tab[i]]++;
event = intr_events[i];
- if (!event || TAILQ_EMPTY(&event->ie_handlers)) {
-#ifdef INTR_FILTER
+ if (intr_event_handle(event, frame) != 0) {
+ /* XXX: Log stray IRQs */
arm_mask_irq(i);
-#endif
- continue;
}
-
-#ifdef INTR_FILTER
- intr_event_handle(event, frame);
- /* XXX: Log stray IRQs */
-#else
- /* Execute fast handlers. */
- ret = 0;
- thread = 0;
- TAILQ_FOREACH(ih, &event->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL)
- thread = 1;
- else
- ret = ih->ih_filter(ih->ih_argument ?
- ih->ih_argument : frame);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- /* Schedule thread if needed. */
- if (thread)
- intr_event_schedule_thread(event);
- else
- arm_unmask_irq(i);
-#endif
}
td->td_intr_nesting_level--;
}
Modified: stable/7/sys/i386/i386/intr_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/intr_machdep.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/i386/i386/intr_machdep.c Tue May 19 19:45:36 2009 (r192406)
@@ -76,9 +76,6 @@ static void intr_assign_next_cpu(struct
static int intr_assign_cpu(void *arg, u_char cpu);
static void intr_disable_src(void *arg);
-#ifdef INTR_FILTER
-static void intr_event_stray(void *cookie);
-#endif
static void intr_init(void *__dummy);
static int intr_pic_registered(struct pic *pic);
static void intrcnt_setname(const char *name, int index);
@@ -229,66 +226,12 @@ intr_disable_src(void *arg)
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
}
-#ifdef INTR_FILTER
void
intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
{
- struct thread *td;
struct intr_event *ie;
- int vector;
-
- td = curthread;
-
- /*
- * We count software interrupts when we process them. The
- * code here follows previous practice, but there's an
- * argument for counting hardware interrupts when they're
- * processed too.
- */
- (*isrc->is_count)++;
- PCPU_INC(cnt.v_intr);
-
- ie = isrc->is_event;
-
- /*
- * XXX: We assume that IRQ 0 is only used for the ISA timer
- * device (clk).
- */
- vector = isrc->is_pic->pic_vector(isrc);
- if (vector == 0)
- clkintr_pending = 1;
-
- if (intr_event_handle(ie, frame) != 0)
- intr_event_stray(isrc);
-}
-
-static void
-intr_event_stray(void *cookie)
-{
- struct intsrc *isrc;
-
- isrc = cookie;
- /*
- * For stray interrupts, mask and EOI the source, bump the
- * stray count, and log the condition.
- */
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- (*isrc->is_straycount)++;
- if (*isrc->is_straycount < MAX_STRAY_LOG)
- log(LOG_ERR, "stray irq%d\n", isrc->is_pic->pic_vector(isrc));
- else if (*isrc->is_straycount == MAX_STRAY_LOG)
- log(LOG_CRIT,
- "too many stray irq %d's: not logging anymore\n",
- isrc->is_pic->pic_vector(isrc));
-}
-#else
-void
-intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame)
-{
struct thread *td;
- struct intr_event *ie;
- struct intr_handler *ih;
- int error, vector, thread, ret;
+ int vector;
td = curthread;
@@ -315,7 +258,7 @@ intr_execute_handlers(struct intsrc *isr
* For stray interrupts, mask and EOI the source, bump the
* stray count, and log the condition.
*/
- if (ie == NULL || TAILQ_EMPTY(&ie->ie_handlers)) {
+ if (intr_event_handle(ie, frame) != 0) {
isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
(*isrc->is_straycount)++;
if (*isrc->is_straycount < MAX_STRAY_LOG)
@@ -324,70 +267,8 @@ intr_execute_handlers(struct intsrc *isr
log(LOG_CRIT,
"too many stray irq %d's: not logging anymore\n",
vector);
- return;
}
-
- /*
- * Execute fast interrupt handlers directly.
- * To support clock handlers, if a handler registers
- * with a NULL argument, then we pass it a pointer to
- * a trapframe as its argument.
- */
- td->td_intr_nesting_level++;
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument == NULL ? frame :
- ih->ih_argument, ih->ih_name);
- if (ih->ih_argument == NULL)
- ret = ih->ih_filter(frame);
- else
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special handling:
- *
- * in some particular cases (like pccard and pccbb),
- * the _real_ device handler is wrapped in a couple of
- * functions - a filter wrapper and an ithread wrapper.
- * In this case (and just in this case), the filter wrapper
- * could ask the system to schedule the ithread and mask
- * the interrupt source if the wrapped handler is composed
- * of just an ithread handler.
- *
- * TODO: write a generic wrapper to avoid people rolling
- * their own
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- /*
- * If there are any threaded handlers that need to run,
- * mask the source as well as sending it an EOI. Otherwise,
- * just send it an EOI but leave it unmasked.
- */
- if (thread)
- isrc->is_pic->pic_disable_source(isrc, PIC_EOI);
- else
- isrc->is_pic->pic_eoi_source(isrc);
-
- /* Schedule the ithread if needed. */
- if (thread) {
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("bad stray interrupt"));
- }
- critical_exit();
- td->td_intr_nesting_level--;
}
-#endif
void
intr_resume(void)
Modified: stable/7/sys/ia64/ia64/interrupt.c
==============================================================================
--- stable/7/sys/ia64/ia64/interrupt.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/ia64/ia64/interrupt.c Tue May 19 19:45:36 2009 (r192406)
@@ -385,10 +385,6 @@ ia64_dispatch_intr(void *frame, u_int ve
{
struct ia64_intr *i;
struct intr_event *ie; /* our interrupt event */
-#ifndef INTR_FILTER
- struct intr_handler *ih;
- int error, thread, ret;
-#endif
/*
* Find the interrupt thread for this vector.
@@ -401,52 +397,14 @@ ia64_dispatch_intr(void *frame, u_int ve
ie = i->event;
KASSERT(ie != NULL, ("%s: interrupt without event", __func__));
-#ifdef INTR_FILTER
if (intr_event_handle(ie, frame) != 0) {
- ia64_intr_mask((void *)(uintptr_t)vector);
- log(LOG_ERR, "stray irq%u\n", i->irq);
- }
-#else
- /*
- * As an optimization, if an event has no handlers, don't
- * schedule it to run.
- */
- if (TAILQ_EMPTY(&ie->ie_handlers))
- return;
-
- /*
- * Execute all fast interrupt handlers directly without Giant. Note
- * that this means that any fast interrupt handler must be MP safe.
- */
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument, ih->ih_name);
- ret = ih->ih_filter(ih->ih_argument);
/*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
+ * XXX: The pre-INTR_FILTER code didn't mask stray
+ * interrupts.
*/
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- if (thread) {
ia64_intr_mask((void *)(uintptr_t)vector);
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("%s: impossible stray", __func__));
- } else
- ia64_intr_eoi((void *)(uintptr_t)vector);
- critical_exit();
-#endif
+ log(LOG_ERR, "stray irq%u\n", i->irq);
+ }
}
#ifdef DDB
Modified: stable/7/sys/kern/kern_intr.c
==============================================================================
--- stable/7/sys/kern/kern_intr.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/kern/kern_intr.c Tue May 19 19:45:36 2009 (r192406)
@@ -94,9 +94,14 @@ static TAILQ_HEAD(, intr_event) event_li
static void intr_event_update(struct intr_event *ie);
#ifdef INTR_FILTER
+static int intr_event_schedule_thread(struct intr_event *ie,
+ struct intr_thread *ithd);
+static int intr_filter_loop(struct intr_event *ie,
+ struct trapframe *frame, struct intr_thread **ithd);
static struct intr_thread *ithread_create(const char *name,
struct intr_handler *ih);
#else
+static int intr_event_schedule_thread(struct intr_event *ie);
static struct intr_thread *ithread_create(const char *name);
#endif
static void ithread_destroy(struct intr_thread *ithread);
@@ -240,8 +245,9 @@ intr_event_update(struct intr_event *ie)
int
intr_event_create(struct intr_event **event, void *source,int flags,
- void (*disable)(void *), void (*enable)(void *), void (*eoi)(void *),
- int (*assign_cpu)(void *, u_char), const char *fmt, ...)
+ void (*pre_ithread)(void *), void (*post_ithread)(void *),
+ void (*post_filter)(void *), int (*assign_cpu)(void *, u_char),
+ const char *fmt, ...)
{
struct intr_event *ie;
va_list ap;
@@ -251,9 +257,9 @@ intr_event_create(struct intr_event **ev
return (EINVAL);
ie = malloc(sizeof(struct intr_event), M_ITHREAD, M_WAITOK | M_ZERO);
ie->ie_source = source;
- ie->ie_disable = disable;
- ie->ie_enable = enable;
- ie->ie_eoi = eoi;
+ ie->ie_pre_ithread = pre_ithread;
+ ie->ie_post_ithread = post_ithread;
+ ie->ie_post_filter = post_filter;
ie->ie_assign_cpu = assign_cpu;
ie->ie_flags = flags;
ie->ie_cpu = NOCPU;
@@ -678,7 +684,7 @@ ok:
return (0);
}
-int
+static int
intr_event_schedule_thread(struct intr_event *ie)
{
struct intr_entropy entropy;
@@ -835,7 +841,7 @@ ok:
return (0);
}
-int
+static int
intr_event_schedule_thread(struct intr_event *ie, struct intr_thread *it)
{
struct intr_entropy entropy;
@@ -1078,8 +1084,8 @@ ithread_execute_handlers(struct proc *p,
* Now that all the handlers have had a chance to run, reenable
* the interrupt source.
*/
- if (ie->ie_enable != NULL)
- ie->ie_enable(ie->ie_source);
+ if (ie->ie_post_ithread != NULL)
+ ie->ie_post_ithread(ie->ie_source);
}
#ifndef INTR_FILTER
@@ -1166,6 +1172,90 @@ ithread_loop(void *arg)
thread_unlock(td);
}
}
+
+/*
+ * Main interrupt handling body.
+ *
+ * Input:
+ * o ie: the event connected to this interrupt.
+ * o frame: some archs (i.e. i386) pass a frame to some.
+ * handlers as their main argument.
+ * Return value:
+ * o 0: everything ok.
+ * o EINVAL: stray interrupt.
+ */
+int
+intr_event_handle(struct intr_event *ie, struct trapframe *frame)
+{
+ struct intr_handler *ih;
+ struct thread *td;
+ int error, ret, thread;
+
+ td = curthread;
+
+ /* An interrupt with no event or handlers is a stray interrupt. */
+ if (ie == NULL || TAILQ_EMPTY(&ie->ie_handlers))
+ return (EINVAL);
+
+ /*
+ * Execute fast interrupt handlers directly.
+ * To support clock handlers, if a handler registers
+ * with a NULL argument, then we pass it a pointer to
+ * a trapframe as its argument.
+ */
+ td->td_intr_nesting_level++;
+ thread = 0;
+ ret = 0;
+ critical_enter();
+ TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
+ if (ih->ih_filter == NULL) {
+ thread = 1;
+ continue;
+ }
+ CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
+ ih->ih_filter, ih->ih_argument == NULL ? frame :
+ ih->ih_argument, ih->ih_name);
+ if (ih->ih_argument == NULL)
+ ret = ih->ih_filter(frame);
+ else
+ ret = ih->ih_filter(ih->ih_argument);
+ /*
+ * Wrapper handler special handling:
+ *
+ * in some particular cases (like pccard and pccbb),
+ * the _real_ device handler is wrapped in a couple of
+ * functions - a filter wrapper and an ithread wrapper.
+ * In this case (and just in this case), the filter wrapper
+ * could ask the system to schedule the ithread and mask
+ * the interrupt source if the wrapped handler is composed
+ * of just an ithread handler.
+ *
+ * TODO: write a generic wrapper to avoid people rolling
+ * their own
+ */
+ if (!thread) {
+ if (ret == FILTER_SCHEDULE_THREAD)
+ thread = 1;
+ }
+ }
+
+ if (thread) {
+ if (ie->ie_pre_ithread != NULL)
+ ie->ie_pre_ithread(ie->ie_source);
+ } else {
+ if (ie->ie_post_filter != NULL)
+ ie->ie_post_filter(ie->ie_source);
+ }
+
+ /* Schedule the ithread if needed. */
+ if (thread) {
+ error = intr_event_schedule_thread(ie);
+ KASSERT(error == 0, ("bad stray interrupt"));
+ }
+ critical_exit();
+ td->td_intr_nesting_level--;
+ return (0);
+}
#else
/*
* This is the main code for interrupt threads.
@@ -1281,7 +1371,7 @@ ithread_loop(void *arg)
* scheduled.
*/
-int
+static int
intr_filter_loop(struct intr_event *ie, struct trapframe *frame,
struct intr_thread **ithd)
{
@@ -1357,19 +1447,13 @@ intr_event_handle(struct intr_event *ie,
td->td_intr_nesting_level++;
thread = 0;
critical_enter();
- thread = intr_filter_loop(ie, frame, &ithd);
-
- /*
- * If the interrupt was fully served, send it an EOI but leave
- * it unmasked. Otherwise, mask the source as well as sending
- * it an EOI.
- */
+ thread = intr_filter_loop(ie, frame, &ithd);
if (thread & FILTER_HANDLED) {
- if (ie->ie_eoi != NULL)
- ie->ie_eoi(ie->ie_source);
+ if (ie->ie_post_filter != NULL)
+ ie->ie_post_filter(ie->ie_source);
} else {
- if (ie->ie_disable != NULL)
- ie->ie_disable(ie->ie_source);
+ if (ie->ie_pre_ithread != NULL)
+ ie->ie_pre_ithread(ie->ie_source);
}
critical_exit();
Modified: stable/7/sys/powerpc/powerpc/intr_machdep.c
==============================================================================
--- stable/7/sys/powerpc/powerpc/intr_machdep.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/powerpc/powerpc/intr_machdep.c Tue May 19 19:45:36 2009 (r192406)
@@ -228,10 +228,6 @@ powerpc_dispatch_intr(u_int vector, stru
{
struct powerpc_intr *i;
struct intr_event *ie;
-#ifndef INTR_FILTER
- struct intr_handler *ih;
- int error, sched, ret;
-#endif
i = powerpc_intrs[vector];
if (i == NULL)
@@ -242,55 +238,15 @@ powerpc_dispatch_intr(u_int vector, stru
ie = i->event;
KASSERT(ie != NULL, ("%s: interrupt without an event", __func__));
-#ifdef INTR_FILTER
if (intr_event_handle(ie, tf) != 0) {
- PIC_MASK(pic, i->irq);
- log(LOG_ERR, "stray irq%u\n", i->irq);
- }
-#else
- if (TAILQ_EMPTY(&ie->ie_handlers))
goto stray;
-
- /*
- * Execute all fast interrupt handlers directly without Giant. Note
- * that this means that any fast interrupt handler must be MP safe.
- */
- ret = 0;
- sched = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- sched = 1;
- continue;
- }
- CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__,
- ih->ih_filter, ih->ih_argument, ih->ih_name);
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!sched) {
- if (ret == FILTER_SCHEDULE_THREAD)
- sched = 1;
- }
}
-
- if (sched) {
- PIC_MASK(pic, i->irq);
- error = intr_event_schedule_thread(ie);
- KASSERT(error == 0, ("%s: impossible stray interrupt",
- __func__));
- } else
- PIC_EOI(pic, i->irq);
- critical_exit();
-#endif
return;
stray:
stray_count++;
if (stray_count <= MAX_STRAY_LOG) {
- printf("stray irq %d\n", i->irq);
+ printf("stray irq %d\n", i ? i->irq : -1);
if (stray_count >= MAX_STRAY_LOG) {
printf("got %d stray interrupts, not logging anymore\n",
MAX_STRAY_LOG);
Modified: stable/7/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/intr_machdep.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/sparc64/sparc64/intr_machdep.c Tue May 19 19:45:36 2009 (r192406)
@@ -275,57 +275,9 @@ static void
intr_execute_handlers(void *cookie)
{
struct intr_vector *iv;
-#ifndef INTR_FILTER
- struct intr_event *ie;
- struct intr_handler *ih;
- int error, thread, ret;
-#endif
iv = cookie;
-#ifndef INTR_FILTER
- ie = iv->iv_event;
- if (iv->iv_ic == NULL || ie == NULL) {
- intr_stray_vector(iv);
- return;
- }
-
- /* Execute fast interrupt handlers directly. */
- ret = 0;
- thread = 0;
- critical_enter();
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- MPASS(ih->ih_filter != NULL && ih->ih_argument != NULL);
- CTR3(KTR_INTR, "%s: executing handler %p(%p)", __func__,
- ih->ih_filter, ih->ih_argument);
- ret = ih->ih_filter(ih->ih_argument);
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
- if (!thread)
- iv->iv_ic->ic_clear(iv);
-
- /* Schedule a heavyweight interrupt process. */
- if (thread)
- error = intr_event_schedule_thread(ie);
- else if (TAILQ_EMPTY(&ie->ie_handlers))
- error = EINVAL;
- else
- error = 0;
- critical_exit();
- if (error == EINVAL)
-#else
if (iv->iv_ic == NULL || intr_event_handle(iv->iv_event, NULL) != 0)
-#endif
intr_stray_vector(iv);
}
Modified: stable/7/sys/sun4v/sun4v/intr_machdep.c
==============================================================================
--- stable/7/sys/sun4v/sun4v/intr_machdep.c Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/sun4v/sun4v/intr_machdep.c Tue May 19 19:45:36 2009 (r192406)
@@ -101,12 +101,6 @@ struct intr_vector intr_vectors[IV_MAX];
uint16_t intr_countp[IV_MAX];
static u_long intr_stray_count[IV_MAX];
-struct ithread_vector_handler {
- iv_func_t *ivh_handler;
- void *ivh_arg;
- u_int ivh_vec;
-};
-
static char *pil_names[] = {
"stray",
"low", /* PIL_LOW */
@@ -276,63 +270,23 @@ intr_init(void)
}
SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL);
+static void
+intr_enable(void *cookie)
+{
+ int vec;
+
+ vec = (uintptr_t)cookie;
+ hv_intr_setstate(vec, HV_INTR_IDLE_STATE);
+}
static void
intr_execute_handlers(void *cookie)
{
struct intr_vector *iv;
- struct intr_event *ie;
- struct intr_handler *ih;
- int fast, thread, ret;
iv = cookie;
- ie = iv->iv_event;
- if (ie == NULL) {
- intr_stray_vector(iv);
- return;
- }
-
- ret = 0;
- fast = thread = 0;
- TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
- if (ih->ih_filter == NULL) {
- thread = 1;
- continue;
- }
- MPASS(ih->ih_filter != NULL && ih->ih_argument != NULL);
- CTR3(KTR_INTR, "%s: executing handler %p(%p)", __func__,
- ih->ih_filter, ih->ih_argument);
- ret = ih->ih_filter(ih->ih_argument);
- fast = 1;
- /*
- * Wrapper handler special case: see
- * i386/intr_machdep.c::intr_execute_handlers()
- */
- if (!thread) {
- if (ret == FILTER_SCHEDULE_THREAD)
- thread = 1;
- }
- }
-
- /* Schedule a heavyweight interrupt process. */
- if (thread)
- intr_event_schedule_thread(ie);
- else if (TAILQ_EMPTY(&ie->ie_handlers))
+ if (intr_event_handle(iv->iv_event, NULL) != 0)
intr_stray_vector(iv);
-
- if (fast)
- hv_intr_setstate(iv->iv_vec, HV_INTR_IDLE_STATE);
-
-}
-
-static void
-ithread_wrapper(void *arg)
-{
- struct ithread_vector_handler *ivh = (struct ithread_vector_handler *)arg;
-
- ivh->ivh_handler(ivh->ivh_arg);
- /* re-enable interrupt */
- hv_intr_setstate(ivh->ivh_vec, HV_INTR_IDLE_STATE);
}
int
@@ -342,13 +296,8 @@ inthand_add(const char *name, int vec, d
struct intr_vector *iv;
struct intr_event *ie; /* descriptor for the IRQ */
struct intr_event *orphan;
- struct ithread_vector_handler *ivh;
int errcode, pil;
- if (filt != NULL && handler != NULL) {
- printf("both filt and handler set is not valid\n");
- return (EINVAL);
- }
/*
* Work around a race where more than one CPU may be registering
* handlers on the same IRQ at the same time.
@@ -359,7 +308,7 @@ inthand_add(const char *name, int vec, d
mtx_unlock_spin(&intr_table_lock);
if (ie == NULL) {
errcode = intr_event_create(&ie, (void *)(intptr_t)vec, 0, NULL,
- NULL, "vec%d:", vec);
+ intr_enable, intr_enable, NULL, "vec%d:", vec);
if (errcode)
return (errcode);
mtx_lock_spin(&intr_table_lock);
@@ -374,26 +323,12 @@ inthand_add(const char *name, int vec, d
}
}
- if (filt == NULL) {
- ivh = (struct ithread_vector_handler *)
- malloc(sizeof(struct ithread_vector_handler), M_DEVBUF, M_WAITOK);
- ivh->ivh_handler = (driver_intr_t *)handler;
- ivh->ivh_arg = arg;
- ivh->ivh_vec = vec;
- errcode = intr_event_add_handler(ie, name, NULL, ithread_wrapper, ivh,
- intr_priority(flags), flags, cookiep);
- } else {
- ivh = NULL;
- errcode = intr_event_add_handler(ie, name, filt, NULL, arg,
- intr_priority(flags), flags,
- cookiep);
- }
+ errcode = intr_event_add_handler(ie, name, filt, handler, arg,
+ intr_priority(flags), flags, cookiep);
- if (errcode) {
- if (ivh)
- free(ivh, M_DEVBUF);
+ if (errcode)
return (errcode);
- }
+
pil = (filt != NULL) ? PIL_FAST : PIL_ITHREAD;
intr_setup(pil, intr_fast, vec, intr_execute_handlers, iv);
Modified: stable/7/sys/sys/interrupt.h
==============================================================================
--- stable/7/sys/sys/interrupt.h Tue May 19 19:27:07 2009 (r192405)
+++ stable/7/sys/sys/interrupt.h Tue May 19 19:45:36 2009 (r192406)
@@ -63,6 +63,33 @@ struct intr_handler {
/*
* Describe an interrupt event. An event holds a list of handlers.
+ * The 'pre_ithread', 'post_ithread', 'post_filter', and 'assign_cpu'
+ * hooks are used to invoke MD code for certain operations.
+ *
+ * The 'pre_ithread' hook is called when an interrupt thread for
+ * handlers without filters is scheduled. It is responsible for
+ * ensuring that 1) the system won't be swamped with an interrupt
+ * storm from the associated source while the ithread runs and 2) the
+ * current CPU is able to receive interrupts from other interrupt
+ * sources. The first is usually accomplished by disabling
+ * level-triggered interrupts until the ithread completes. The second
+ * is accomplished on some platforms by acknowledging the interrupt
+ * via an EOI.
+ *
+ * The 'post_ithread' hook is invoked when an ithread finishes. It is
+ * responsible for ensuring that the associated interrupt source will
+ * trigger an interrupt when it is asserted in the future. Usually
+ * this is implemented by enabling a level-triggered interrupt that
+ * was previously disabled via the 'pre_ithread' hook.
+ *
+ * The 'post_filter' hook is invoked when a filter handles an
+ * interrupt. It is responsible for ensuring that the current CPU is
+ * able to receive interrupts again. On some platforms this is done
+ * by acknowledging the interrupts via an EOI.
+ *
+ * The 'assign_cpu' hook is used to bind an interrupt source to a
+ * specific CPU. If the interrupt cannot be bound, this function may
+ * return an error.
*/
struct intr_event {
TAILQ_ENTRY(intr_event) ie_list;
@@ -72,9 +99,9 @@ struct intr_event {
struct mtx ie_lock;
void *ie_source; /* Cookie used by MD code. */
struct intr_thread *ie_thread; /* Thread we are connected to. */
- void (*ie_disable)(void *);
- void (*ie_enable)(void *);
- void (*ie_eoi)(void *);
+ void (*ie_pre_ithread)(void *);
+ void (*ie_post_ithread)(void *);
+ void (*ie_post_filter)(void *);
int (*ie_assign_cpu)(void *, u_char);
int ie_flags;
int ie_count; /* Loop counter. */
@@ -118,29 +145,19 @@ extern char intrnames[]; /* string tabl
#ifdef DDB
void db_dump_intr_event(struct intr_event *ie, int handlers);
#endif
-#ifdef INTR_FILTER
-int intr_filter_loop(struct intr_event *ie, struct trapframe *frame,
- struct intr_thread **ithd);
-int intr_event_handle(struct intr_event *ie, struct trapframe *frame);
-#endif
u_char intr_priority(enum intr_type flags);
int intr_event_add_handler(struct intr_event *ie, const char *name,
driver_filter_t filter, driver_intr_t handler, void *arg,
u_char pri, enum intr_type flags, void **cookiep);
int intr_event_bind(struct intr_event *ie, u_char cpu);
int intr_event_create(struct intr_event **event, void *source,
- int flags, void (*disable)(void *), void (*enable)(void *),
- void (*eoi)(void *), int (*assign_cpu)(void *, u_char),
- const char *fmt, ...)
+ int flags, void (*pre_ithread)(void *),
+ void (*post_ithread)(void *), void (*post_filter)(void *),
+ int (*assign_cpu)(void *, u_char), const char *fmt, ...)
__printflike(8, 9);
int intr_event_destroy(struct intr_event *ie);
+int intr_event_handle(struct intr_event *ie, struct trapframe *frame);
int intr_event_remove_handler(void *cookie);
-#ifndef INTR_FILTER
-int intr_event_schedule_thread(struct intr_event *ie);
-#else
-int intr_event_schedule_thread(struct intr_event *ie,
- struct intr_thread *ithd);
-#endif
void *intr_handler_source(void *cookie);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
From jhb at FreeBSD.org Tue May 19 22:07:56 2009
From: jhb at FreeBSD.org (John Baldwin)
Date: Tue May 19 22:08:19 2009
Subject: svn commit: r192409 - in stable/7: sys sys/amd64/amd64 sys/arm/arm
sys/contrib/pf sys/dev/ath/ath_hal sys/dev/cxgb sys/i386/i386
sys/ia64/ia64 sys/kern sys/powerpc/powerpc
sys/sparc64/sparc64 sys/s...
Message-ID: <200905192207.n4JM7spY011238@svn.freebsd.org>
Author: jhb
Date: Tue May 19 22:07:54 2009
New Revision: 192409
URL: http://svn.freebsd.org/changeset/base/192409
Log:
MFC:
- Add the interrupt vector number to intr_event_create so MI code can
lookup hard interrupt events by number.
- Add support to cpuset for binding hardware interrupts.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/amd64/amd64/intr_machdep.c
stable/7/sys/arm/arm/intr.c
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/i386/i386/intr_machdep.c
stable/7/sys/ia64/ia64/interrupt.c
stable/7/sys/kern/kern_cpuset.c
stable/7/sys/kern/kern_intr.c
stable/7/sys/powerpc/powerpc/intr_machdep.c
stable/7/sys/sparc64/sparc64/intr_machdep.c
stable/7/sys/sun4v/sun4v/intr_machdep.c
stable/7/sys/sys/cpuset.h
stable/7/sys/sys/interrupt.h
stable/7/usr.bin/cpuset/ (props changed)
stable/7/usr.bin/cpuset/cpuset.1
stable/7/usr.bin/cpuset/cpuset.c
Modified: stable/7/sys/amd64/amd64/intr_machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/intr_machdep.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/amd64/amd64/intr_machdep.c Tue May 19 22:07:54 2009 (r192409)
@@ -139,7 +139,7 @@ intr_register_source(struct intsrc *isrc
vector = isrc->is_pic->pic_vector(isrc);
if (interrupt_sources[vector] != NULL)
return (EEXIST);
- error = intr_event_create(&isrc->is_event, isrc, 0,
+ error = intr_event_create(&isrc->is_event, isrc, 0, vector,
intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source,
(mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:",
vector);
Modified: stable/7/sys/arm/arm/intr.c
==============================================================================
--- stable/7/sys/arm/arm/intr.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/arm/arm/intr.c Tue May 19 22:07:54 2009 (r192409)
@@ -70,7 +70,7 @@ arm_setup_irqhandler(const char *name, d
return;
event = intr_events[irq];
if (event == NULL) {
- error = intr_event_create(&event, (void *)irq, 0,
+ error = intr_event_create(&event, (void *)irq, 0, irq,
(mask_fn)arm_mask_irq, (mask_fn)arm_unmask_irq,
NULL, NULL, "intr%d:", irq);
if (error)
Modified: stable/7/sys/i386/i386/intr_machdep.c
==============================================================================
--- stable/7/sys/i386/i386/intr_machdep.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/i386/i386/intr_machdep.c Tue May 19 22:07:54 2009 (r192409)
@@ -130,7 +130,7 @@ intr_register_source(struct intsrc *isrc
vector = isrc->is_pic->pic_vector(isrc);
if (interrupt_sources[vector] != NULL)
return (EEXIST);
- error = intr_event_create(&isrc->is_event, isrc, 0,
+ error = intr_event_create(&isrc->is_event, isrc, 0, vector,
intr_disable_src, (mask_fn)isrc->is_pic->pic_enable_source,
(mask_fn)isrc->is_pic->pic_eoi_source, intr_assign_cpu, "irq%d:",
vector);
Modified: stable/7/sys/ia64/ia64/interrupt.c
==============================================================================
--- stable/7/sys/ia64/ia64/interrupt.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/ia64/ia64/interrupt.c Tue May 19 22:07:54 2009 (r192409)
@@ -340,7 +340,7 @@ ia64_setup_intr(const char *name, int ir
return (ENOMEM);
error = intr_event_create(&i->event, (void *)(uintptr_t)vector,
- 0, ia64_intr_mask, ia64_intr_unmask, ia64_intr_eoi,
+ 0, irq, ia64_intr_mask, ia64_intr_unmask, ia64_intr_eoi,
NULL, "irq%u:", irq);
if (error) {
free(i, M_DEVBUF);
Modified: stable/7/sys/kern/kern_cpuset.c
==============================================================================
--- stable/7/sys/kern/kern_cpuset.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/kern/kern_cpuset.c Tue May 19 22:07:54 2009 (r192409)
@@ -469,6 +469,8 @@ cpuset_which(cpuwhich_t which, id_t id,
}
return (ESRCH);
}
+ case CPU_WHICH_IRQ:
+ return (0);
default:
return (EINVAL);
}
@@ -875,6 +877,8 @@ cpuset_getid(struct thread *td, struct c
case CPU_WHICH_CPUSET:
case CPU_WHICH_JAIL:
break;
+ case CPU_WHICH_IRQ:
+ return (EINVAL);
}
switch (uap->level) {
case CPU_LEVEL_ROOT:
@@ -936,6 +940,9 @@ cpuset_getaffinity(struct thread *td, st
case CPU_WHICH_CPUSET:
case CPU_WHICH_JAIL:
break;
+ case CPU_WHICH_IRQ:
+ error = EINVAL;
+ goto out;
}
if (uap->level == CPU_LEVEL_ROOT)
nset = cpuset_refroot(set);
@@ -964,6 +971,9 @@ cpuset_getaffinity(struct thread *td, st
case CPU_WHICH_JAIL:
CPU_COPY(&set->cs_mask, mask);
break;
+ case CPU_WHICH_IRQ:
+ error = intr_getaffinity(uap->id, mask);
+ break;
}
break;
default:
@@ -1041,6 +1051,9 @@ cpuset_setaffinity(struct thread *td, st
case CPU_WHICH_CPUSET:
case CPU_WHICH_JAIL:
break;
+ case CPU_WHICH_IRQ:
+ error = EINVAL;
+ goto out;
}
if (uap->level == CPU_LEVEL_ROOT)
nset = cpuset_refroot(set);
@@ -1067,6 +1080,9 @@ cpuset_setaffinity(struct thread *td, st
cpuset_rel(set);
}
break;
+ case CPU_WHICH_IRQ:
+ error = intr_setaffinity(uap->id, mask);
+ break;
default:
error = EINVAL;
break;
Modified: stable/7/sys/kern/kern_intr.c
==============================================================================
--- stable/7/sys/kern/kern_intr.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/kern/kern_intr.c Tue May 19 22:07:54 2009 (r192409)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
#include
@@ -91,6 +92,8 @@ SYSCTL_INT(_hw, OID_AUTO, intr_storm_thr
"Number of consecutive interrupts before storm protection is enabled");
static TAILQ_HEAD(, intr_event) event_list =
TAILQ_HEAD_INITIALIZER(event_list);
+static struct mtx event_lock;
+MTX_SYSINIT(intr_event_list, &event_lock, "intr event list", MTX_DEF);
static void intr_event_update(struct intr_event *ie);
#ifdef INTR_FILTER
@@ -244,7 +247,7 @@ intr_event_update(struct intr_event *ie)
}
int
-intr_event_create(struct intr_event **event, void *source,int flags,
+intr_event_create(struct intr_event **event, void *source, int flags, int irq,
void (*pre_ithread)(void *), void (*post_ithread)(void *),
void (*post_filter)(void *), int (*assign_cpu)(void *, u_char),
const char *fmt, ...)
@@ -262,6 +265,7 @@ intr_event_create(struct intr_event **ev
ie->ie_post_filter = post_filter;
ie->ie_assign_cpu = assign_cpu;
ie->ie_flags = flags;
+ ie->ie_irq = irq;
ie->ie_cpu = NOCPU;
TAILQ_INIT(&ie->ie_handlers);
mtx_init(&ie->ie_lock, "intr event", NULL, MTX_DEF);
@@ -270,9 +274,9 @@ intr_event_create(struct intr_event **ev
vsnprintf(ie->ie_name, sizeof(ie->ie_name), fmt, ap);
va_end(ap);
strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname));
- mtx_pool_lock(mtxpool_sleep, &event_list);
+ mtx_lock(&event_lock);
TAILQ_INSERT_TAIL(&event_list, ie, ie_list);
- mtx_pool_unlock(mtxpool_sleep, &event_list);
+ mtx_unlock(&event_lock);
if (event != NULL)
*event = ie;
CTR2(KTR_INTR, "%s: created %s", __func__, ie->ie_name);
@@ -290,7 +294,8 @@ intr_event_create(struct intr_event **ev
int
intr_event_bind(struct intr_event *ie, u_char cpu)
{
- struct thread *td;
+ cpuset_t mask;
+ lwpid_t id;
int error;
/* Need a CPU to bind to. */
@@ -299,28 +304,95 @@ intr_event_bind(struct intr_event *ie, u
if (ie->ie_assign_cpu == NULL)
return (EOPNOTSUPP);
-
- /* Don't allow a bind request if the interrupt is already bound. */
+ /*
+ * If we have any ithreads try to set their mask first since this
+ * can fail.
+ */
mtx_lock(&ie->ie_lock);
- if (ie->ie_cpu != NOCPU && cpu != NOCPU) {
+ if (ie->ie_thread != NULL) {
+ CPU_ZERO(&mask);
+ if (cpu == NOCPU)
+ CPU_COPY(cpuset_root, &mask);
+ else
+ CPU_SET(cpu, &mask);
+ id = ie->ie_thread->it_thread->td_tid;
+ mtx_unlock(&ie->ie_lock);
+ error = cpuset_setthread(id, &mask);
+ if (error)
+ return (error);
+ } else
mtx_unlock(&ie->ie_lock);
- return (EBUSY);
- }
- mtx_unlock(&ie->ie_lock);
-
error = ie->ie_assign_cpu(ie->ie_source, cpu);
if (error)
return (error);
mtx_lock(&ie->ie_lock);
- if (ie->ie_thread != NULL)
- td = ie->ie_thread->it_thread;
- else
- td = NULL;
- if (td != NULL)
- thread_lock(td);
ie->ie_cpu = cpu;
- if (td != NULL)
- thread_unlock(td);
+ mtx_unlock(&ie->ie_lock);
+
+ return (error);
+}
+
+static struct intr_event *
+intr_lookup(int irq)
+{
+ struct intr_event *ie;
+
+ mtx_lock(&event_lock);
+ TAILQ_FOREACH(ie, &event_list, ie_list)
+ if (ie->ie_irq == irq &&
+ (ie->ie_flags & IE_SOFT) == 0 &&
+ TAILQ_FIRST(&ie->ie_handlers) != NULL)
+ break;
+ mtx_unlock(&event_lock);
+ return (ie);
+}
+
+int
+intr_setaffinity(int irq, void *m)
+{
+ struct intr_event *ie;
+ cpuset_t *mask;
+ u_char cpu;
+ int n;
+
+ mask = m;
+ cpu = NOCPU;
+ /*
+ * If we're setting all cpus we can unbind. Otherwise make sure
+ * only one cpu is in the set.
+ */
+ if (CPU_CMP(cpuset_root, mask)) {
+ for (n = 0; n < CPU_SETSIZE; n++) {
+ if (!CPU_ISSET(n, mask))
+ continue;
+ if (cpu != NOCPU)
+ return (EINVAL);
+ cpu = (u_char)n;
+ }
+ }
+ ie = intr_lookup(irq);
+ if (ie == NULL)
+ return (ESRCH);
+ intr_event_bind(ie, cpu);
+ return (0);
+}
+
+int
+intr_getaffinity(int irq, void *m)
+{
+ struct intr_event *ie;
+ cpuset_t *mask;
+
+ mask = m;
+ ie = intr_lookup(irq);
+ if (ie == NULL)
+ return (ESRCH);
+ CPU_ZERO(mask);
+ mtx_lock(&ie->ie_lock);
+ if (ie->ie_cpu == NOCPU)
+ CPU_COPY(cpuset_root, mask);
+ else
+ CPU_SET(ie->ie_cpu, mask);
mtx_unlock(&ie->ie_lock);
return (0);
}
@@ -329,14 +401,14 @@ int
intr_event_destroy(struct intr_event *ie)
{
+ mtx_lock(&event_lock);
mtx_lock(&ie->ie_lock);
if (!TAILQ_EMPTY(&ie->ie_handlers)) {
mtx_unlock(&ie->ie_lock);
+ mtx_unlock(&event_lock);
return (EBUSY);
}
- mtx_pool_lock(mtxpool_sleep, &event_list);
TAILQ_REMOVE(&event_list, ie, ie_list);
- mtx_pool_unlock(mtxpool_sleep, &event_list);
#ifndef notyet
if (ie->ie_thread != NULL) {
ithread_destroy(ie->ie_thread);
@@ -344,6 +416,7 @@ intr_event_destroy(struct intr_event *ie
}
#endif
mtx_unlock(&ie->ie_lock);
+ mtx_unlock(&event_lock);
mtx_destroy(&ie->ie_lock);
free(ie, M_ITHREAD);
return (0);
@@ -916,7 +989,7 @@ swi_add(struct intr_event **eventp, cons
if (!(ie->ie_flags & IE_SOFT))
return (EINVAL);
} else {
- error = intr_event_create(&ie, NULL, IE_SOFT,
+ error = intr_event_create(&ie, NULL, IE_SOFT, 0,
NULL, NULL, NULL, NULL, "swi%d:", pri);
if (error)
return (error);
@@ -1099,7 +1172,6 @@ ithread_loop(void *arg)
struct intr_event *ie;
struct thread *td;
struct proc *p;
- u_char cpu;
td = curthread;
p = td->td_proc;
@@ -1108,7 +1180,6 @@ ithread_loop(void *arg)
("%s: ithread and proc linkage out of sync", __func__));
ie = ithd->it_event;
ie->ie_count = 0;
- cpu = NOCPU;
/*
* As long as we have interrupts outstanding, go through the
@@ -1154,21 +1225,6 @@ ithread_loop(void *arg)
ie->ie_count = 0;
mi_switch(SW_VOL, NULL);
}
-
-#ifdef SMP
- /*
- * Ensure we are bound to the correct CPU. We can't
- * move ithreads until SMP is running however, so just
- * leave interrupts on the boor CPU during boot.
- */
- if (ie->ie_cpu != cpu && smp_started) {
- cpu = ie->ie_cpu;
- if (cpu == NOCPU)
- sched_unbind(td);
- else
- sched_bind(td, cpu);
- }
-#endif
thread_unlock(td);
}
}
@@ -1269,7 +1325,6 @@ ithread_loop(void *arg)
struct thread *td;
struct proc *p;
int priv;
- u_char cpu;
td = curthread;
p = td->td_proc;
@@ -1280,7 +1335,6 @@ ithread_loop(void *arg)
("%s: ithread and proc linkage out of sync", __func__));
ie = ithd->it_event;
ie->ie_count = 0;
- cpu = NOCPU;
/*
* As long as we have interrupts outstanding, go through the
@@ -1329,21 +1383,6 @@ ithread_loop(void *arg)
ie->ie_count = 0;
mi_switch(SW_VOL, NULL);
}
-
-#ifdef SMP
- /*
- * Ensure we are bound to the correct CPU. We can't
- * move ithreads until SMP is running however, so just
- * leave interrupts on the boor CPU during boot.
- */
- if (!priv && ie->ie_cpu != cpu && smp_started) {
- cpu = ie->ie_cpu;
- if (cpu == NOCPU)
- sched_unbind(td);
- else
- sched_bind(td, cpu);
- }
-#endif
thread_unlock(td);
}
}
@@ -1573,8 +1612,6 @@ db_dump_intr_event(struct intr_event *ie
db_printf("(pid %d)", it->it_thread->td_proc->p_pid);
else
db_printf("(no thread)");
- if (ie->ie_cpu != NOCPU)
- db_printf(" (CPU %d)", ie->ie_cpu);
if ((ie->ie_flags & (IE_SOFT | IE_ENTROPY | IE_ADDING_THREAD)) != 0 ||
(it != NULL && it->it_need)) {
db_printf(" {");
Modified: stable/7/sys/powerpc/powerpc/intr_machdep.c
==============================================================================
--- stable/7/sys/powerpc/powerpc/intr_machdep.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/powerpc/powerpc/intr_machdep.c Tue May 19 22:07:54 2009 (r192409)
@@ -184,7 +184,7 @@ powerpc_setup_intr(const char *name, u_i
/* XXX unlock */
return (ENOMEM);
}
- error = intr_event_create(&i->event, (void *)irq, 0,
+ error = intr_event_create(&i->event, (void *)irq, 0, irq,
powerpc_intr_mask, powerpc_intr_unmask, powerpc_intr_eoi,
NULL, "irq%u:", irq);
if (error) {
Modified: stable/7/sys/sparc64/sparc64/intr_machdep.c
==============================================================================
--- stable/7/sys/sparc64/sparc64/intr_machdep.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/sparc64/sparc64/intr_machdep.c Tue May 19 22:07:54 2009 (r192409)
@@ -297,7 +297,7 @@ intr_controller_register(int vec, const
sx_xunlock(&intr_table_lock);
if (ie != NULL)
return (EEXIST);
- error = intr_event_create(&ie, iv, 0, NULL, ic->ic_clear,
+ error = intr_event_create(&ie, iv, 0, vec, NULL, ic->ic_clear,
ic->ic_clear, intr_assign_cpu, "vec%d:", vec);
if (error != 0)
return (error);
Modified: stable/7/sys/sun4v/sun4v/intr_machdep.c
==============================================================================
--- stable/7/sys/sun4v/sun4v/intr_machdep.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/sun4v/sun4v/intr_machdep.c Tue May 19 22:07:54 2009 (r192409)
@@ -307,8 +307,8 @@ inthand_add(const char *name, int vec, d
ie = iv->iv_event;
mtx_unlock_spin(&intr_table_lock);
if (ie == NULL) {
- errcode = intr_event_create(&ie, (void *)(intptr_t)vec, 0, NULL,
- intr_enable, intr_enable, NULL, "vec%d:", vec);
+ errcode = intr_event_create(&ie, (void *)(intptr_t)vec, 0, vec,
+ NULL, intr_enable, intr_enable, NULL, "vec%d:", vec);
if (errcode)
return (errcode);
mtx_lock_spin(&intr_table_lock);
Modified: stable/7/sys/sys/cpuset.h
==============================================================================
--- stable/7/sys/sys/cpuset.h Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/sys/cpuset.h Tue May 19 22:07:54 2009 (r192409)
@@ -131,7 +131,7 @@ typedef struct _cpuset {
#define CPU_WHICH_TID 1 /* Specifies a thread id. */
#define CPU_WHICH_PID 2 /* Specifies a process id. */
#define CPU_WHICH_CPUSET 3 /* Specifies a set id. */
-/* CPU_WHICH_IRQ */
+#define CPU_WHICH_IRQ 4 /* Specifies an irq #. */
#define CPU_WHICH_JAIL 5 /* Specifies a jail id. */
/*
Modified: stable/7/sys/sys/interrupt.h
==============================================================================
--- stable/7/sys/sys/interrupt.h Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/sys/sys/interrupt.h Tue May 19 22:07:54 2009 (r192409)
@@ -107,6 +107,7 @@ struct intr_event {
int ie_count; /* Loop counter. */
int ie_warncnt; /* Rate-check interrupt storm warns. */
struct timeval ie_warntm;
+ int ie_irq; /* Physical irq number if !SOFT. */
u_char ie_cpu; /* CPU this event is bound to. */
};
@@ -151,14 +152,16 @@ int intr_event_add_handler(struct intr_e
u_char pri, enum intr_type flags, void **cookiep);
int intr_event_bind(struct intr_event *ie, u_char cpu);
int intr_event_create(struct intr_event **event, void *source,
- int flags, void (*pre_ithread)(void *),
+ int flags, int irq, void (*pre_ithread)(void *),
void (*post_ithread)(void *), void (*post_filter)(void *),
int (*assign_cpu)(void *, u_char), const char *fmt, ...)
- __printflike(8, 9);
+ __printflike(9, 10);
int intr_event_destroy(struct intr_event *ie);
int intr_event_handle(struct intr_event *ie, struct trapframe *frame);
int intr_event_remove_handler(void *cookie);
+int intr_getaffinity(int irq, void *mask);
void *intr_handler_source(void *cookie);
+int intr_setaffinity(int irq, void *mask);
int swi_add(struct intr_event **eventp, const char *name,
driver_intr_t handler, void *arg, int pri, enum intr_type flags,
void **cookiep);
Modified: stable/7/usr.bin/cpuset/cpuset.1
==============================================================================
--- stable/7/usr.bin/cpuset/cpuset.1 Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/usr.bin/cpuset/cpuset.1 Tue May 19 22:07:54 2009 (r192409)
@@ -35,7 +35,7 @@
.Nm
.Op Fl l Ar cpu-list
.Op Fl s Ar setid
-.Ar cmd
+.Ar cmd ...
.Nm
.Op Fl l Ar cpu-list
.Op Fl s Ar setid
@@ -43,10 +43,10 @@
.Nm
.Op Fl cr
.Op Fl l Ar cpu-list
-.Op Fl j Ar jailid | Fl p Ar pid | Fl r Ar tid | Fl s Ar setid | Fl x Ar irq
+.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
.Nm
.Op Fl cgir
-.Op Fl j Ar jailid | Fl p Ar pid | Fl r Ar tid | Fl s Ar setid | Fl x Ar irq
+.Op Fl j Ar jailid | Fl p Ar pid | Fl t Ar tid | Fl s Ar setid | Fl x Ar irq
.Sh DESCRIPTION
The
.Nm
@@ -104,7 +104,7 @@ target specifier.
.It Fl g
Causes
.Nm
-to print either a list of valid CPUs or, using
+to print either a list of valid CPUs or, using
.Fl i ,
the id of the target.
.It Fl i
@@ -116,17 +116,17 @@ Specifies a jail id as the target of the
.It Fl l Ar cpu-list
Specifies a list of CPUs to apply to a target.
Specification may include
-numbers seperated by '-' for ranges and commas separating individual numbers.
+numbers separated by '-' for ranges and commas separating individual numbers.
.It Fl p Ar pid
Specifies a pid as the target of the operation.
-.It Fl s Ar setid
+.It Fl s Ar setid
Specifies a set id as the target of the operation.
.It Fl r
The requested operation should reference the root set available via the
target specifier.
.It Fl t Ar tid
Specifies a thread id as the target of the operation.
-.It Fl x Ar irq
+.It Fl x Ar irq
Specifies an irq as the target of the operation.
.El
.Sh EXIT STATUS
Modified: stable/7/usr.bin/cpuset/cpuset.c
==============================================================================
--- stable/7/usr.bin/cpuset/cpuset.c Tue May 19 20:23:32 2009 (r192408)
+++ stable/7/usr.bin/cpuset/cpuset.c Tue May 19 22:07:54 2009 (r192409)
@@ -2,6 +2,9 @@
* Copyright (c) 2007, 2008 Jeffrey Roberson
* All rights reserved.
*
+ * Copyright (c) 2008 Nokia Corporation
+ * All rights reserved.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -52,6 +55,7 @@ int pflag;
int rflag;
int sflag;
int tflag;
+int xflag;
id_t id;
cpulevel_t level;
cpuwhich_t which;
@@ -150,7 +154,7 @@ printset(cpuset_t *mask)
printf("\n");
}
-const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "N/A", "jail" };
+const char *whichnames[] = { NULL, "tid", "pid", "cpuset", "irq", "jail" };
const char *levelnames[] = { NULL, " root", " cpuset", "" };
static void
@@ -195,7 +199,7 @@ main(int argc, char *argv[])
level = CPU_LEVEL_WHICH;
which = CPU_WHICH_PID;
id = pid = tid = setid = -1;
- while ((ch = getopt(argc, argv, "cgij:l:p:rs:t:")) != -1) {
+ while ((ch = getopt(argc, argv, "cgij:l:p:rs:t:x:")) != -1) {
switch (ch) {
case 'c':
if (rflag)
@@ -239,6 +243,11 @@ main(int argc, char *argv[])
which = CPU_WHICH_TID;
id = tid = atoi(optarg);
break;
+ case 'x':
+ xflag = 1;
+ which = CPU_WHICH_IRQ;
+ id = atoi(optarg);
+ break;
default:
usage();
}
@@ -249,7 +258,7 @@ main(int argc, char *argv[])
if (argc || lflag)
usage();
/* Only one identity specifier. */
- if (jflag + sflag + pflag + tflag > 1)
+ if (jflag + xflag + sflag + pflag + tflag > 1)
usage();
if (iflag)
printsetid();
@@ -263,7 +272,7 @@ main(int argc, char *argv[])
* The user wants to run a command with a set and possibly cpumask.
*/
if (argc) {
- if (pflag | rflag | tflag | jflag)
+ if (pflag | rflag | tflag | xflag | jflag)
usage();
if (sflag) {
if (cpuset_setid(CPU_WHICH_PID, -1, setid))
@@ -289,7 +298,10 @@ main(int argc, char *argv[])
if (!lflag && !sflag)
usage();
/* You can only set a mask on a thread. */
- if (tflag && (sflag | pflag | jflag))
+ if (tflag && (sflag | pflag | xflag | jflag))
+ usage();
+ /* You can only set a mask on an irq. */
+ if (xflag && (jflag | pflag | sflag | tflag))
usage();
if (pflag && sflag) {
if (cpuset_setid(CPU_WHICH_PID, pid, setid))
@@ -319,8 +331,8 @@ usage(void)
fprintf(stderr,
" cpuset [-l cpu-list] [-s setid] -p pid\n");
fprintf(stderr,
- " cpuset [-cr] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid]\n");
+ " cpuset [-cr] [-l cpu-list] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
fprintf(stderr,
- " cpuset [-cgir] [-j jailid | -p pid | -t tid | -s setid]\n");
+ " cpuset [-cgir] [-j jailid | -p pid | -t tid | -s setid | -x irq]\n");
exit(1);
}
From hrs at FreeBSD.org Wed May 20 00:55:29 2009
From: hrs at FreeBSD.org (Hiroki Sato)
Date: Wed May 20 00:55:46 2009
Subject: svn commit: r192411 - stable/7/release/doc/en_US.ISO8859-1/errata
Message-ID: <200905200055.n4K0tQBK014328@svn.freebsd.org>
Author: hrs
Date: Wed May 20 00:55:26 2009
New Revision: 192411
URL: http://svn.freebsd.org/changeset/base/192411
Log:
Document fxp(4) TSO issue on 7.2R.
Submitted by: delphij
Modified:
stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
Modified: stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml
==============================================================================
--- stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Tue May 19 22:28:33 2009 (r192410)
+++ stable/7/release/doc/en_US.ISO8859-1/errata/article.sgml Wed May 20 00:55:26 2009 (r192411)
@@ -183,6 +183,15 @@
Errata Notice to fix this problem is planned after the
release.
+ [20090507] A bug was found in the &man.fxp.4; driver. This
+ would cause poor TCP performance when TSO is enabled, and the
+ receiver has a smaller MSS than the interface MTU setting. To
+ workaround this issue, one can disable TSO by using
+ &man.ifconfig.8; parameter (per interface
+ basis) or setting net.inet.tcp.tso to
+ 0 (globally on the system). An Errata Notice
+ to fix this problem is planned after the release.
+
Late-Breaking News and Corrections
@@ -190,5 +199,10 @@
&man.malloc.3; implementation and threading library has been
committed to the RELENG_7 branch for public
testing.
+
+ [20090507] A patch to solve the bug in the &man.fxp.4;
+ driver that caused poor TCP performance has been committed to
+ the RELENG_7 branch for public
+ testing.
From yongari at FreeBSD.org Wed May 20 02:13:02 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed May 20 02:13:13 2009
Subject: svn commit: r192412 - in stable/7/sys: . contrib/pf dev/age
dev/ath/ath_hal dev/cxgb
Message-ID: <200905200213.n4K2D2V1015873@svn.freebsd.org>
Author: yongari
Date: Wed May 20 02:13:01 2009
New Revision: 192412
URL: http://svn.freebsd.org/changeset/base/192412
Log:
MFC r190303:
Fix inversed logic. pci_find_extcap() returns 0 when it finds
specified capability.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/age/if_age.c
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/age/if_age.c
==============================================================================
--- stable/7/sys/dev/age/if_age.c Wed May 20 00:55:26 2009 (r192411)
+++ stable/7/sys/dev/age/if_age.c Wed May 20 02:13:01 2009 (r192412)
@@ -1369,7 +1369,7 @@ age_setwol(struct age_softc *sc)
AGE_LOCK_ASSERT(sc);
- if (pci_find_extcap(sc->age_dev, PCIY_PMG, &pmc) == 0) {
+ if (pci_find_extcap(sc->age_dev, PCIY_PMG, &pmc) != 0) {
CSR_WRITE_4(sc, AGE_WOL_CFG, 0);
/*
* No PME capability, PHY power down.
From yongari at FreeBSD.org Wed May 20 02:18:28 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed May 20 02:18:47 2009
Subject: svn commit: r192413 - in stable/7/sys: . contrib/pf dev/age
dev/ath/ath_hal dev/cxgb
Message-ID: <200905200218.n4K2IQZ3016008@svn.freebsd.org>
Author: yongari
Date: Wed May 20 02:18:26 2009
New Revision: 192413
URL: http://svn.freebsd.org/changeset/base/192413
Log:
MFC r190499:
o Don't access VPD even if hardware advertised the capability.
It seems that some revision of controller hang while accessing
the VPD. Because VPD access routine are unused, nuke it.
o Let TWSI reload EEPROM if VPD capability is detected. Reloading
EEPROM will also set ethernet address so age(4) now reads AGE_PAR0
and AGE_PAR1 register to get ethernet address. This removes a lot
of hack and enhance readability a lot.
o Double PHY reset timeout as it takes more time to take PHY out of
power-saving state.
o Explicitly check power-saving state by checking undocumented PHY
registers. If link is not up, poke undocumented registers to take
PHY out of power-saving state. This is the same way what Linux
does. On resume, make sure to wake up PHY.
o Don't rely on auto-clearing feature of master reset bit, just wait
1ms and check idle status of MAC.
o Add PCI device revision information in bootverbose mode.
This should fix occasional controller hang in device attach phase.
Reported by: barbara < barbara.xxx1975 at libero DOT it >
Tested by: barbara < barbara.xxx1975 at libero DOT it >
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/age/if_age.c
stable/7/sys/dev/age/if_agereg.h
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/age/if_age.c
==============================================================================
--- stable/7/sys/dev/age/if_age.c Wed May 20 02:13:01 2009 (r192412)
+++ stable/7/sys/dev/age/if_age.c Wed May 20 02:18:26 2009 (r192413)
@@ -106,8 +106,6 @@ static int age_miibus_writereg(device_t,
static void age_miibus_statchg(device_t);
static void age_mediastatus(struct ifnet *, struct ifmediareq *);
static int age_mediachange(struct ifnet *);
-static int age_read_vpd_word(struct age_softc *, uint32_t, uint32_t,
- uint32_t *);
static int age_probe(device_t);
static void age_get_macaddr(struct age_softc *);
static void age_phy_reset(struct age_softc *);
@@ -321,29 +319,6 @@ age_mediachange(struct ifnet *ifp)
}
static int
-age_read_vpd_word(struct age_softc *sc, uint32_t vpdc, uint32_t offset,
- uint32_t *word)
-{
- int i;
-
- pci_write_config(sc->age_dev, vpdc + PCIR_VPD_ADDR, offset, 2);
- for (i = AGE_TIMEOUT; i > 0; i--) {
- DELAY(10);
- if ((pci_read_config(sc->age_dev, vpdc + PCIR_VPD_ADDR, 2) &
- 0x8000) == 0x8000)
- break;
- }
- if (i == 0) {
- device_printf(sc->age_dev, "VPD read timeout!\n");
- *word = 0;
- return (ETIMEDOUT);
- }
-
- *word = pci_read_config(sc->age_dev, vpdc + PCIR_VPD_DATA, 4);
- return (0);
-}
-
-static int
age_probe(device_t dev)
{
struct age_dev *sp;
@@ -368,8 +343,8 @@ age_probe(device_t dev)
static void
age_get_macaddr(struct age_softc *sc)
{
- uint32_t ea[2], off, reg, word;
- int vpd_error, match, vpdc;
+ uint32_t ea[2], reg;
+ int i, vpdc;
reg = CSR_READ_4(sc, AGE_SPI_CTRL);
if ((reg & SPI_VPD_ENB) != 0) {
@@ -378,123 +353,114 @@ age_get_macaddr(struct age_softc *sc)
CSR_WRITE_4(sc, AGE_SPI_CTRL, reg);
}
- vpd_error = 0;
- ea[0] = ea[1] = 0;
- if ((vpd_error = pci_find_extcap(sc->age_dev, PCIY_VPD, &vpdc)) == 0) {
+ if (pci_find_extcap(sc->age_dev, PCIY_VPD, &vpdc) == 0) {
/*
- * PCI VPD capability exists, but it seems that it's
- * not in the standard form as stated in PCI VPD
- * specification such that driver could not use
- * pci_get_vpd_readonly(9) with keyword 'NA'.
- * Search VPD data starting at address 0x0100. The data
- * should be used as initializers to set AGE_PAR0,
- * AGE_PAR1 register including other PCI configuration
- * registers.
+ * PCI VPD capability found, let TWSI reload EEPROM.
+ * This will set ethernet address of controller.
*/
- word = 0;
- match = 0;
- reg = 0;
- for (off = AGE_VPD_REG_CONF_START; off < AGE_VPD_REG_CONF_END;
- off += sizeof(uint32_t)) {
- vpd_error = age_read_vpd_word(sc, vpdc, off, &word);
- if (vpd_error != 0)
- break;
- if (match != 0) {
- switch (reg) {
- case AGE_PAR0:
- ea[0] = word;
- break;
- case AGE_PAR1:
- ea[1] = word;
- break;
- default:
- break;
- }
- match = 0;
- } else if ((word & 0xFF) == AGE_VPD_REG_CONF_SIG) {
- match = 1;
- reg = word >> 16;
- } else
+ CSR_WRITE_4(sc, AGE_TWSI_CTRL, CSR_READ_4(sc, AGE_TWSI_CTRL) |
+ TWSI_CTRL_SW_LD_START);
+ for (i = 100; i > 0; i--) {
+ DELAY(1000);
+ reg = CSR_READ_4(sc, AGE_TWSI_CTRL);
+ if ((reg & TWSI_CTRL_SW_LD_START) == 0)
break;
}
- if (off >= AGE_VPD_REG_CONF_END)
- vpd_error = ENOENT;
- if (vpd_error == 0) {
- /*
- * Don't blindly trust ethernet address obtained
- * from VPD. Check whether ethernet address is
- * valid one. Otherwise fall-back to reading
- * PAR register.
- */
- ea[1] &= 0xFFFF;
- if ((ea[0] == 0 && ea[1] == 0) ||
- (ea[0] == 0xFFFFFFFF && ea[1] == 0xFFFF)) {
- if (bootverbose)
- device_printf(sc->age_dev,
- "invalid ethernet address "
- "returned from VPD.\n");
- vpd_error = EINVAL;
- }
- }
- if (vpd_error != 0 && (bootverbose))
- device_printf(sc->age_dev, "VPD access failure!\n");
+ if (i == 0)
+ device_printf(sc->age_dev,
+ "reloading EEPROM timeout!\n");
} else {
if (bootverbose)
device_printf(sc->age_dev,
"PCI VPD capability not found!\n");
}
- /*
- * It seems that L1 also provides a way to extract ethernet
- * address via SPI flash interface. Because SPI flash memory
- * device of different vendors vary in their instruction
- * codes for read ID instruction, it's very hard to get
- * instructions codes without detailed information for the
- * flash memory device used on ethernet controller. To simplify
- * code, just read AGE_PAR0/AGE_PAR1 register to get ethernet
- * address which is supposed to be set by hardware during
- * power on reset.
- */
- if (vpd_error != 0) {
- /*
- * VPD is mapped to SPI flash memory or BIOS set it.
- */
- ea[0] = CSR_READ_4(sc, AGE_PAR0);
- ea[1] = CSR_READ_4(sc, AGE_PAR1);
- }
-
- ea[1] &= 0xFFFF;
- if ((ea[0] == 0 && ea[1] == 0) ||
- (ea[0] == 0xFFFFFFFF && ea[1] == 0xFFFF)) {
- device_printf(sc->age_dev,
- "generating fake ethernet address.\n");
- ea[0] = arc4random();
- /* Set OUI to ASUSTek COMPUTER INC. */
- sc->age_eaddr[0] = 0x00;
- sc->age_eaddr[1] = 0x1B;
- sc->age_eaddr[2] = 0xFC;
- sc->age_eaddr[3] = (ea[0] >> 16) & 0xFF;
- sc->age_eaddr[4] = (ea[0] >> 8) & 0xFF;
- sc->age_eaddr[5] = (ea[0] >> 0) & 0xFF;
- } else {
- sc->age_eaddr[0] = (ea[1] >> 8) & 0xFF;
- sc->age_eaddr[1] = (ea[1] >> 0) & 0xFF;
- sc->age_eaddr[2] = (ea[0] >> 24) & 0xFF;
- sc->age_eaddr[3] = (ea[0] >> 16) & 0xFF;
- sc->age_eaddr[4] = (ea[0] >> 8) & 0xFF;
- sc->age_eaddr[5] = (ea[0] >> 0) & 0xFF;
- }
+ ea[0] = CSR_READ_4(sc, AGE_PAR0);
+ ea[1] = CSR_READ_4(sc, AGE_PAR1);
+ sc->age_eaddr[0] = (ea[1] >> 8) & 0xFF;
+ sc->age_eaddr[1] = (ea[1] >> 0) & 0xFF;
+ sc->age_eaddr[2] = (ea[0] >> 24) & 0xFF;
+ sc->age_eaddr[3] = (ea[0] >> 16) & 0xFF;
+ sc->age_eaddr[4] = (ea[0] >> 8) & 0xFF;
+ sc->age_eaddr[5] = (ea[0] >> 0) & 0xFF;
}
static void
age_phy_reset(struct age_softc *sc)
{
+ uint16_t reg, pn;
+ int i, linkup;
/* Reset PHY. */
CSR_WRITE_4(sc, AGE_GPHY_CTRL, GPHY_CTRL_RST);
- DELAY(1000);
+ DELAY(2000);
CSR_WRITE_4(sc, AGE_GPHY_CTRL, GPHY_CTRL_CLR);
- DELAY(1000);
+ DELAY(2000);
+
+#define ATPHY_DBG_ADDR 0x1D
+#define ATPHY_DBG_DATA 0x1E
+#define ATPHY_CDTC 0x16
+#define PHY_CDTC_ENB 0x0001
+#define PHY_CDTC_POFF 8
+#define ATPHY_CDTS 0x1C
+#define PHY_CDTS_STAT_OK 0x0000
+#define PHY_CDTS_STAT_SHORT 0x0100
+#define PHY_CDTS_STAT_OPEN 0x0200
+#define PHY_CDTS_STAT_INVAL 0x0300
+#define PHY_CDTS_STAT_MASK 0x0300
+
+ /* Check power saving mode. Magic from Linux. */
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr, MII_BMCR, BMCR_RESET);
+ for (linkup = 0, pn = 0; pn < 4; pn++) {
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr, ATPHY_CDTC,
+ (pn << PHY_CDTC_POFF) | PHY_CDTC_ENB);
+ for (i = 200; i > 0; i--) {
+ DELAY(1000);
+ reg = age_miibus_readreg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_CDTC);
+ if ((reg & PHY_CDTC_ENB) == 0)
+ break;
+ }
+ DELAY(1000);
+ reg = age_miibus_readreg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_CDTS);
+ if ((reg & PHY_CDTS_STAT_MASK) != PHY_CDTS_STAT_OPEN) {
+ linkup++;
+ break;
+ }
+ }
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr, MII_BMCR,
+ BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);
+ if (linkup == 0) {
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_ADDR, 0);
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_DATA, 0x124E);
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_ADDR, 1);
+ reg = age_miibus_readreg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_DATA);
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_DATA, reg | 0x03);
+ /* XXX */
+ DELAY(1500 * 1000);
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_ADDR, 0);
+ age_miibus_writereg(sc->age_dev, sc->age_phyaddr,
+ ATPHY_DBG_DATA, 0x024E);
+ }
+
+#undef ATPHY_DBG_ADDR
+#undef ATPHY_DBG_DATA
+#undef ATPHY_CDTC
+#undef PHY_CDTC_ENB
+#undef PHY_CDTC_POFF
+#undef ATPHY_CDTS
+#undef PHY_CDTS_STAT_OK
+#undef PHY_CDTS_STAT_SHORT
+#undef PHY_CDTS_STAT_OPEN
+#undef PHY_CDTS_STAT_INVAL
+#undef PHY_CDTS_STAT_MASK
}
static int
@@ -539,7 +505,8 @@ age_attach(device_t dev)
sc->age_chip_rev = CSR_READ_4(sc, AGE_MASTER_CFG) >>
MASTER_CHIP_REV_SHIFT;
if (bootverbose) {
- device_printf(dev, "PCI device revision : 0x%04x\n", sc->age_rev);
+ device_printf(dev, "PCI device revision : 0x%04x\n",
+ sc->age_rev);
device_printf(dev, "Chip id/revision : 0x%04x\n",
sc->age_chip_rev);
}
@@ -1524,6 +1491,9 @@ age_resume(device_t dev)
cmd &= ~0x0400;
pci_write_config(sc->age_dev, PCIR_COMMAND, cmd, 2);
}
+ AGE_UNLOCK(sc);
+ age_phy_reset(sc);
+ AGE_LOCK(sc);
ifp = sc->age_ifp;
if ((ifp->if_flags & IFF_UP) != 0)
age_init_locked(sc);
@@ -2544,14 +2514,8 @@ age_reset(struct age_softc *sc)
int i;
CSR_WRITE_4(sc, AGE_MASTER_CFG, MASTER_RESET);
- for (i = AGE_RESET_TIMEOUT; i > 0; i--) {
- DELAY(1);
- if ((CSR_READ_4(sc, AGE_MASTER_CFG) & MASTER_RESET) == 0)
- break;
- }
- if (i == 0)
- device_printf(sc->age_dev, "master reset timeout!\n");
-
+ CSR_READ_4(sc, AGE_MASTER_CFG);
+ DELAY(1000);
for (i = AGE_RESET_TIMEOUT; i > 0; i--) {
if ((reg = CSR_READ_4(sc, AGE_IDLE_STATUS)) == 0)
break;
Modified: stable/7/sys/dev/age/if_agereg.h
==============================================================================
--- stable/7/sys/dev/age/if_agereg.h Wed May 20 02:13:01 2009 (r192412)
+++ stable/7/sys/dev/age/if_agereg.h Wed May 20 02:18:26 2009 (r192413)
@@ -91,6 +91,9 @@
#define AGE_SPI_OP_READ 0x217 /* 8bits */
#define AGE_TWSI_CTRL 0x218
+#define TWSI_CTRL_SW_LD_START 0x00000800
+#define TWSI_CTRL_HW_LD_START 0x00001000
+#define TWSI_CTRL_LD_EXIST 0x00400000
#define AGE_DEV_MISC_CTRL 0x21C
From yongari at FreeBSD.org Wed May 20 02:24:10 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed May 20 02:24:28 2009
Subject: svn commit: r192414 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb dev/sk
Message-ID: <200905200224.n4K2O9LQ016223@svn.freebsd.org>
Author: yongari
Date: Wed May 20 02:24:09 2009
New Revision: 192414
URL: http://svn.freebsd.org/changeset/base/192414
Log:
MFC r191716:
Separate multicast filtering of SysKonnect GENESIS and Marvell
Yukon from common multicast handling code. Yukon uses hash-based
multicast filtering(big endian form) but GENESIS uses perfect
multicast filtering as well as hash-based one(little endian form).
Due to the differences of multicast filtering there is no much
sense to have a common code.
o Remove sk_setmulti() and introduce sk_rxfilter_yukon(),
sk_rxfilter_yukon() that handles multicast filtering setup.
o Have sk_rxfilter_{yukon, genesis} handle promiscuous mode and
nuke sk_setpromisc(). This simplifies ioctl handler as well as
giving a chance to check validity of Rx control register of
Yukon.
o Don't reinitialize controller when IFF_ALLMULTI flags is changed.
o Nuke sk_gmchash(), it's not needed anymore.
o Always reconfigure Rx control register whenever a new multicast
filtering condition is changed. This fixes multicast filtering
setup on Yukon.
PR: kern/134051
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/dev/sk/if_sk.c
Modified: stable/7/sys/dev/sk/if_sk.c
==============================================================================
--- stable/7/sys/dev/sk/if_sk.c Wed May 20 02:18:26 2009 (r192413)
+++ stable/7/sys/dev/sk/if_sk.c Wed May 20 02:24:09 2009 (r192414)
@@ -255,10 +255,10 @@ static int sk_marv_miibus_writereg(struc
static void sk_marv_miibus_statchg(struct sk_if_softc *);
static uint32_t sk_xmchash(const uint8_t *);
-static uint32_t sk_gmchash(const uint8_t *);
static void sk_setfilt(struct sk_if_softc *, u_int16_t *, int);
-static void sk_setmulti(struct sk_if_softc *);
-static void sk_setpromisc(struct sk_if_softc *);
+static void sk_rxfilter(struct sk_if_softc *);
+static void sk_rxfilter_genesis(struct sk_if_softc *);
+static void sk_rxfilter_yukon(struct sk_if_softc *);
static int sysctl_int_range(SYSCTL_HANDLER_ARGS, int low, int high);
static int sysctl_hw_sk_int_mod(SYSCTL_HANDLER_ARGS);
@@ -697,19 +697,6 @@ sk_xmchash(addr)
return (~crc & ((1 << HASH_BITS) - 1));
}
-/* gmchash is just a big endian crc */
-static u_int32_t
-sk_gmchash(addr)
- const uint8_t *addr;
-{
- uint32_t crc;
-
- /* Compute CRC for the address value. */
- crc = ether_crc32_be(addr, ETHER_ADDR_LEN);
-
- return (crc & ((1 << HASH_BITS) - 1));
-}
-
static void
sk_setfilt(sc_if, addr, slot)
struct sk_if_softc *sc_if;
@@ -728,12 +715,26 @@ sk_setfilt(sc_if, addr, slot)
}
static void
-sk_setmulti(sc_if)
+sk_rxfilter(sc_if)
+ struct sk_if_softc *sc_if;
+{
+ struct sk_softc *sc;
+
+ SK_IF_LOCK_ASSERT(sc_if);
+
+ sc = sc_if->sk_softc;
+ if (sc->sk_type == SK_GENESIS)
+ sk_rxfilter_genesis(sc_if);
+ else
+ sk_rxfilter_yukon(sc_if);
+}
+
+static void
+sk_rxfilter_genesis(sc_if)
struct sk_if_softc *sc_if;
{
- struct sk_softc *sc = sc_if->sk_softc;
struct ifnet *ifp = sc_if->sk_ifp;
- u_int32_t hashes[2] = { 0, 0 };
+ u_int32_t hashes[2] = { 0, 0 }, mode;
int h = 0, i;
struct ifmultiaddr *ifma;
u_int16_t dummy[] = { 0, 0, 0 };
@@ -741,124 +742,96 @@ sk_setmulti(sc_if)
SK_IF_LOCK_ASSERT(sc_if);
- /* First, zot all the existing filters. */
- switch(sc->sk_type) {
- case SK_GENESIS:
- for (i = 1; i < XM_RXFILT_MAX; i++)
- sk_setfilt(sc_if, dummy, i);
-
- SK_XM_WRITE_4(sc_if, XM_MAR0, 0);
- SK_XM_WRITE_4(sc_if, XM_MAR2, 0);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- SK_YU_WRITE_2(sc_if, YUKON_MCAH1, 0);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH2, 0);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH3, 0);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH4, 0);
- break;
- }
+ mode = SK_XM_READ_4(sc_if, XM_MODE);
+ mode &= ~(XM_MODE_RX_PROMISC | XM_MODE_RX_USE_HASH |
+ XM_MODE_RX_USE_PERFECT);
+ /* First, zot all the existing perfect filters. */
+ for (i = 1; i < XM_RXFILT_MAX; i++)
+ sk_setfilt(sc_if, dummy, i);
/* Now program new ones. */
if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) {
+ if (ifp->if_flags & IFF_ALLMULTI)
+ mode |= XM_MODE_RX_USE_HASH;
+ if (ifp->if_flags & IFF_PROMISC)
+ mode |= XM_MODE_RX_PROMISC;
hashes[0] = 0xFFFFFFFF;
hashes[1] = 0xFFFFFFFF;
} else {
i = 1;
IF_ADDR_LOCK(ifp);
- TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) {
+ TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead,
+ ifma_link) {
if (ifma->ifma_addr->sa_family != AF_LINK)
continue;
/*
* Program the first XM_RXFILT_MAX multicast groups
- * into the perfect filter. For all others,
- * use the hash table.
+ * into the perfect filter.
*/
- if (sc->sk_type == SK_GENESIS && i < XM_RXFILT_MAX) {
- bcopy(LLADDR(
- (struct sockaddr_dl *)ifma->ifma_addr),
- maddr, ETHER_ADDR_LEN);
+ bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr),
+ maddr, ETHER_ADDR_LEN);
+ if (i < XM_RXFILT_MAX) {
sk_setfilt(sc_if, maddr, i);
+ mode |= XM_MODE_RX_USE_PERFECT;
i++;
continue;
}
-
- switch(sc->sk_type) {
- case SK_GENESIS:
- bcopy(LLADDR(
- (struct sockaddr_dl *)ifma->ifma_addr),
- maddr, ETHER_ADDR_LEN);
- h = sk_xmchash((const uint8_t *)maddr);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- bcopy(LLADDR(
- (struct sockaddr_dl *)ifma->ifma_addr),
- maddr, ETHER_ADDR_LEN);
- h = sk_gmchash((const uint8_t *)maddr);
- break;
- }
+ h = sk_xmchash((const uint8_t *)maddr);
if (h < 32)
hashes[0] |= (1 << h);
else
hashes[1] |= (1 << (h - 32));
+ mode |= XM_MODE_RX_USE_HASH;
}
IF_ADDR_UNLOCK(ifp);
}
- switch(sc->sk_type) {
- case SK_GENESIS:
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_USE_HASH|
- XM_MODE_RX_USE_PERFECT);
- SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]);
- SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]);
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff);
- SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff);
- break;
- }
-
- return;
+ SK_XM_WRITE_4(sc_if, XM_MODE, mode);
+ SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]);
+ SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]);
}
static void
-sk_setpromisc(sc_if)
+sk_rxfilter_yukon(sc_if)
struct sk_if_softc *sc_if;
{
- struct sk_softc *sc = sc_if->sk_softc;
- struct ifnet *ifp = sc_if->sk_ifp;
+ struct ifnet *ifp;
+ u_int32_t crc, hashes[2] = { 0, 0 }, mode;
+ struct ifmultiaddr *ifma;
SK_IF_LOCK_ASSERT(sc_if);
- switch(sc->sk_type) {
- case SK_GENESIS:
- if (ifp->if_flags & IFF_PROMISC) {
- SK_XM_SETBIT_4(sc_if, XM_MODE, XM_MODE_RX_PROMISC);
- } else {
- SK_XM_CLRBIT_4(sc_if, XM_MODE, XM_MODE_RX_PROMISC);
- }
- break;
- case SK_YUKON:
- case SK_YUKON_LITE:
- case SK_YUKON_LP:
- if (ifp->if_flags & IFF_PROMISC) {
- SK_YU_CLRBIT_2(sc_if, YUKON_RCR,
- YU_RCR_UFLEN | YU_RCR_MUFLEN);
- } else {
- SK_YU_SETBIT_2(sc_if, YUKON_RCR,
- YU_RCR_UFLEN | YU_RCR_MUFLEN);
+ ifp = sc_if->sk_ifp;
+ mode = SK_YU_READ_2(sc_if, YUKON_RCR);
+ if (ifp->if_flags & IFF_PROMISC)
+ mode &= ~(YU_RCR_UFLEN | YU_RCR_MUFLEN);
+ else if (ifp->if_flags & IFF_ALLMULTI) {
+ mode |= YU_RCR_UFLEN | YU_RCR_MUFLEN;
+ hashes[0] = 0xFFFFFFFF;
+ hashes[1] = 0xFFFFFFFF;
+ } else {
+ mode |= YU_RCR_UFLEN;
+ IF_ADDR_LOCK(ifp);
+ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+ if (ifma->ifma_addr->sa_family != AF_LINK)
+ continue;
+ crc = ether_crc32_be(LLADDR((struct sockaddr_dl *)
+ ifma->ifma_addr), ETHER_ADDR_LEN);
+ /* Just want the 6 least significant bits. */
+ crc &= 0x3f;
+ /* Set the corresponding bit in the hash table. */
+ hashes[crc >> 5] |= 1 << (crc & 0x1f);
}
- break;
+ IF_ADDR_UNLOCK(ifp);
+ if (hashes[0] != 0 || hashes[1] != 0)
+ mode |= YU_RCR_MUFLEN;
}
- return;
+ SK_YU_WRITE_2(sc_if, YUKON_MCAH1, hashes[0] & 0xffff);
+ SK_YU_WRITE_2(sc_if, YUKON_MCAH2, (hashes[0] >> 16) & 0xffff);
+ SK_YU_WRITE_2(sc_if, YUKON_MCAH3, hashes[1] & 0xffff);
+ SK_YU_WRITE_2(sc_if, YUKON_MCAH4, (hashes[1] >> 16) & 0xffff);
+ SK_YU_WRITE_2(sc_if, YUKON_RCR, mode);
}
static int
@@ -1166,10 +1139,8 @@ sk_ioctl(ifp, command, data)
if (ifp->if_flags & IFF_UP) {
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
if ((ifp->if_flags ^ sc_if->sk_if_flags)
- & IFF_PROMISC) {
- sk_setpromisc(sc_if);
- sk_setmulti(sc_if);
- }
+ & (IFF_PROMISC | IFF_ALLMULTI))
+ sk_rxfilter(sc_if);
} else
sk_init_locked(sc_if);
} else {
@@ -1183,7 +1154,7 @@ sk_ioctl(ifp, command, data)
case SIOCDELMULTI:
SK_IF_LOCK(sc_if);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
- sk_setmulti(sc_if);
+ sk_rxfilter(sc_if);
SK_IF_UNLOCK(sc_if);
break;
case SIOCGIFMEDIA:
@@ -3302,11 +3273,8 @@ sk_init_xmac(sc_if)
*/
SK_XM_WRITE_2(sc_if, XM_TX_REQTHRESH, SK_XM_TX_FIFOTHRESH);
- /* Set promiscuous mode */
- sk_setpromisc(sc_if);
-
- /* Set multicast filter */
- sk_setmulti(sc_if);
+ /* Set Rx filter */
+ sk_rxfilter_genesis(sc_if);
/* Clear and enable interrupts */
SK_XM_READ_2(sc_if, XM_ISR);
@@ -3447,11 +3415,8 @@ sk_init_yukon(sc_if)
SK_YU_WRITE_2(sc_if, YUKON_SAL2 + i * 4, reg);
}
- /* Set promiscuous mode */
- sk_setpromisc(sc_if);
-
- /* Set multicast filter */
- sk_setmulti(sc_if);
+ /* Set Rx filter */
+ sk_rxfilter_yukon(sc_if);
/* enable interrupt mask for counter overflows */
SK_YU_WRITE_2(sc_if, YUKON_TIMR, 0);
From mav at FreeBSD.org Wed May 20 02:48:54 2009
From: mav at FreeBSD.org (Alexander Motin)
Date: Wed May 20 02:49:11 2009
Subject: svn commit: r192415 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/cxgb netgraph/netflow
Message-ID: <200905200248.n4K2mrKF016736@svn.freebsd.org>
Author: mav
Date: Wed May 20 02:48:53 2009
New Revision: 192415
URL: http://svn.freebsd.org/changeset/base/192415
Log:
MFC rev. 192032
Fix copy-paste bug in NGM_NETFLOW_SETCONFIG argument size verification.
PR: kern/134220
Submitted by: Eugene Mychlo
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
stable/7/sys/netgraph/netflow/ng_netflow.c
Modified: stable/7/sys/netgraph/netflow/ng_netflow.c
==============================================================================
--- stable/7/sys/netgraph/netflow/ng_netflow.c Wed May 20 02:24:09 2009 (r192414)
+++ stable/7/sys/netgraph/netflow/ng_netflow.c Wed May 20 02:48:53 2009 (r192415)
@@ -422,7 +422,7 @@ ng_netflow_rcvmsg (node_p node, item_p i
{
struct ng_netflow_setconfig *set;
- if (msg->header.arglen != sizeof(struct ng_netflow_settimeouts))
+ if (msg->header.arglen != sizeof(struct ng_netflow_setconfig))
ERROUT(EINVAL);
set = (struct ng_netflow_setconfig *)msg->data;
From yongari at FreeBSD.org Wed May 20 03:28:36 2009
From: yongari at FreeBSD.org (Pyun YongHyeon)
Date: Wed May 20 03:28:48 2009
Subject: svn commit: r192417 - in stable/7/sys: . contrib/pf dev/ale
dev/ath/ath_hal dev/cxgb
Message-ID: <200905200328.n4K3SZRF017808@svn.freebsd.org>
Author: yongari
Date: Wed May 20 03:28:35 2009
New Revision: 192417
URL: http://svn.freebsd.org/changeset/base/192417
Log:
MFC r189379:
Now pci(4) handles PCIM_CMD_INTxDIS so there is no need to poke
this bit in driver.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ale/if_ale.c
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/ale/if_ale.c
==============================================================================
--- stable/7/sys/dev/ale/if_ale.c Wed May 20 02:51:48 2009 (r192416)
+++ stable/7/sys/dev/ale/if_ale.c Wed May 20 03:28:35 2009 (r192417)
@@ -1543,20 +1543,11 @@ ale_resume(device_t dev)
struct ale_softc *sc;
struct ifnet *ifp;
int pmc;
- uint16_t cmd, pmstat;
+ uint16_t pmstat;
sc = device_get_softc(dev);
ALE_LOCK(sc);
- /*
- * Clear INTx emulation disable for hardwares that
- * is set in resume event. From Linux.
- */
- cmd = pci_read_config(sc->ale_dev, PCIR_COMMAND, 2);
- if ((cmd & 0x0400) != 0) {
- cmd &= ~0x0400;
- pci_write_config(sc->ale_dev, PCIR_COMMAND, cmd, 2);
- }
if (pci_find_extcap(sc->ale_dev, PCIY_PMG, &pmc) == 0) {
/* Disable PME and clear PME status. */
pmstat = pci_read_config(sc->ale_dev,
From brueffer at FreeBSD.org Wed May 20 10:04:20 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed May 20 10:04:31 2009
Subject: svn commit: r192434 - stable/7/share/man/man4
Message-ID: <200905201004.n4KA4HZu026600@svn.freebsd.org>
Author: brueffer
Date: Wed May 20 10:04:17 2009
New Revision: 192434
URL: http://svn.freebsd.org/changeset/base/192434
Log:
MFC: r192220
Sync up to rev. 1.25 from OpenBSD:
1.19: nop
1.20: nop
1.21: nop
1.22: typo fixed
1.23: license clauses 3 and 4 nuked
1.24: nop
1.25: Sun Crypto Accelerator 1000 has a 5821 chip on it
Obtained from: OpenBSD
Modified:
stable/7/share/man/man4/ (props changed)
stable/7/share/man/man4/igb.4 (props changed)
stable/7/share/man/man4/ubsec.4
Modified: stable/7/share/man/man4/ubsec.4
==============================================================================
--- stable/7/share/man/man4/ubsec.4 Wed May 20 09:44:32 2009 (r192433)
+++ stable/7/share/man/man4/ubsec.4 Wed May 20 10:04:17 2009 (r192434)
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ubsec.4,v 1.18 2002/09/26 07:55:41 miod Exp $
+.\" $OpenBSD: ubsec.4,v 1.25 2003/08/12 19:42:46 jason Exp $
.\"
.\" Copyright (c) 2000 Jason L. Wright (jason@thought.net)
.\" All rights reserved.
@@ -11,11 +11,6 @@
.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Jason L. Wright
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -31,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 1, 2006
+.Dd May 16, 2009
.Dt UBSEC 4
.Os
.Sh NAME
@@ -84,7 +79,7 @@ driver supports cards containing any of
.It Bluesteel 5501
The original chipset, no longer made.
This extremely rare unit
-was not very fast, lacked a RNG, and had a number of other bugs.
+was not very fast, lacked an RNG, and had a number of other bugs.
.It Bluesteel 5601
A faster and fixed version of the original, with a random number
unit and large number engine added.
@@ -98,6 +93,7 @@ Faster version of Bluesteel 5601.
64 bit version of the chip, and significantly more advanced.
.It Broadcom BCM5821
Faster version of the BCM5820.
+This is the chip found on the Sun Crypto Accelerator 1000.
.It Broadcom BCM5822
Faster version of the BCM5820.
.It Broadcom BCM5823
From brueffer at FreeBSD.org Wed May 20 10:05:46 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed May 20 10:05:58 2009
Subject: svn commit: r192435 - stable/7/share/man/man4
Message-ID: <200905201005.n4KA5jQm026690@svn.freebsd.org>
Author: brueffer
Date: Wed May 20 10:05:44 2009
New Revision: 192435
URL: http://svn.freebsd.org/changeset/base/192435
Log:
MFC: r192228
Drop clause 3 of the license as per rev. 1.35 from OpenBSD.
Obtained from: OpenBSD
Modified:
stable/7/share/man/man4/ (props changed)
stable/7/share/man/man4/hifn.4
stable/7/share/man/man4/igb.4 (props changed)
Modified: stable/7/share/man/man4/hifn.4
==============================================================================
--- stable/7/share/man/man4/hifn.4 Wed May 20 10:04:17 2009 (r192434)
+++ stable/7/share/man/man4/hifn.4 Wed May 20 10:05:44 2009 (r192435)
@@ -11,8 +11,6 @@
.\" 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.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
From brueffer at FreeBSD.org Wed May 20 10:07:21 2009
From: brueffer at FreeBSD.org (Christian Brueffer)
Date: Wed May 20 10:07:32 2009
Subject: svn commit: r192436 - stable/7/share/man/man9
Message-ID: <200905201007.n4KA7KiJ026768@svn.freebsd.org>
Author: brueffer
Date: Wed May 20 10:07:20 2009
New Revision: 192436
URL: http://svn.freebsd.org/changeset/base/192436
Log:
MFC: r192265
Document sbuf_new_auto().
While here, add a missing `-' in phk's name.
Modified:
stable/7/share/man/man9/ (props changed)
stable/7/share/man/man9/sbuf.9
Modified: stable/7/share/man/man9/sbuf.9
==============================================================================
--- stable/7/share/man/man9/sbuf.9 Wed May 20 10:05:44 2009 (r192435)
+++ stable/7/share/man/man9/sbuf.9 Wed May 20 10:07:20 2009 (r192436)
@@ -1,5 +1,5 @@
.\"-
-.\" Copyright (c) 2000 Poul Henning Kamp and Dag-Erling Coïdan Smørgrav
+.\" Copyright (c) 2000 Poul-Henning Kamp and Dag-Erling Coïdan Smørgrav
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -25,12 +25,13 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 9, 2004
+.Dd May 17, 2009
.Dt SBUF 9
.Os
.Sh NAME
.Nm sbuf ,
.Nm sbuf_new ,
+.Nm sbuf_new_auto ,
.Nm sbuf_clear ,
.Nm sbuf_setpos ,
.Nm sbuf_bcat ,
@@ -55,6 +56,8 @@
.In sys/sbuf.h
.Ft struct sbuf *
.Fn sbuf_new "struct sbuf *s" "char *buf" "int length" "int flags"
+.Ft struct sbuf *
+.Fn sbuf_new_auto
.Ft void
.Fn sbuf_clear "struct sbuf *s"
.Ft int
@@ -148,6 +151,19 @@ The result of accessing that array direc
sbuf is undefined.
.Pp
The
+.Fn sbuf_new_auto
+function is a shortcut for creating a completely dynamic
+.Nm .
+It is the equivalent of calling
+.Fn sbuf_new
+with values
+.Dv NULL ,
+.Dv NULL ,
+.Dv 0 ,
+and
+.Dv SBUF_AUTOEXTEND .
+.Pp
+The
.Fn sbuf_delete
function clears the
.Fa sbuf
From kmacy at FreeBSD.org Wed May 20 20:02:42 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 20:02:59 2009
Subject: svn commit: r192469 - stable/7/sys/amd64/include
Message-ID: <200905202002.n4KK2fQE042177@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 20:02:40 2009
New Revision: 192469
URL: http://svn.freebsd.org/changeset/base/192469
Log:
increase kmem map to 512GB
discussed with: alc
Modified:
stable/7/sys/amd64/include/vmparam.h
Modified: stable/7/sys/amd64/include/vmparam.h
==============================================================================
--- stable/7/sys/amd64/include/vmparam.h Wed May 20 20:00:40 2009 (r192468)
+++ stable/7/sys/amd64/include/vmparam.h Wed May 20 20:02:40 2009 (r192469)
@@ -154,8 +154,7 @@
* 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot)
* 0xffff804020101000 - 0xfffffeffffffffff unused
* 0xffffff0000000000 - 0xffffff7fffffffff 512GB direct map mappings
- * 0xffffff8000000000 - 0xfffffffe7fffffff unused (506GB)
- * 0xfffffffe80000000 - 0xffffffffffffffff 6GB kernel map
+ * 0xffffff8000000000 - 0xffffffffffffffff 512GB kernel map
*
* Within the kernel map:
*
@@ -163,7 +162,7 @@
*/
#define VM_MAX_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-1, NPDEPG-1, NPTEPG-1)
-#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-6, 0, 0)
+#define VM_MIN_KERNEL_ADDRESS KVADDR(KPML4I, NPDPEPG-512, 0, 0)
#define DMAP_MIN_ADDRESS KVADDR(DMPML4I, 0, 0, 0)
#define DMAP_MAX_ADDRESS KVADDR(DMPML4I+1, 0, 0, 0)
From kmacy at FreeBSD.org Wed May 20 20:08:52 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 20:08:58 2009
Subject: svn commit: r192471 - stable/7/sys/sys
Message-ID: <200905202008.n4KK8p2E042355@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 20:08:51 2009
New Revision: 192471
URL: http://svn.freebsd.org/changeset/base/192471
Log:
MFC NDINIT macros without changing the size of nameidata
Modified:
stable/7/sys/sys/fcntl.h
stable/7/sys/sys/namei.h
Modified: stable/7/sys/sys/fcntl.h
==============================================================================
--- stable/7/sys/sys/fcntl.h Wed May 20 20:05:56 2009 (r192470)
+++ stable/7/sys/sys/fcntl.h Wed May 20 20:08:51 2009 (r192471)
@@ -105,6 +105,12 @@ typedef __pid_t pid_t;
#ifdef _KERNEL
#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
#endif
+/*
+ * Magic value that specify the use of the current working directory
+ * to determine the target of relative file paths in the openat() and
+ * similar syscalls.
+ */
+#define AT_FDCWD -100
/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
#define O_NOCTTY 0x8000 /* don't assign controlling terminal */
Modified: stable/7/sys/sys/namei.h
==============================================================================
--- stable/7/sys/sys/namei.h Wed May 20 20:05:56 2009 (r192470)
+++ stable/7/sys/sys/namei.h Wed May 20 20:08:51 2009 (r192471)
@@ -86,6 +86,9 @@ struct nameidata {
* through the VOP interface.
*/
struct componentname ni_cnd;
+#ifdef notyet
+ int ni_dirfd; /* starting directory for *at functions */
+#endif
};
#ifdef _KERNEL
@@ -148,20 +151,31 @@ struct nameidata {
/*
* Initialization of a nameidata structure.
*/
-static void NDINIT(struct nameidata *, u_long, u_long, enum uio_seg,
- const char *, struct thread *);
+#define NDINIT(ndp, op, flags, segflg, namep, td) \
+ NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, NULL, td)
+#define NDINIT_AT(ndp, op, flags, segflg, namep, dirfd, td) \
+ NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, NULL, td)
+#define NDINIT_ATVP(ndp, op, flags, segflg, namep, vp, td) \
+ NDINIT_ALL(ndp, op, flags, segflg, namep, AT_FDCWD, vp, td)
+
static __inline void
-NDINIT(struct nameidata *ndp,
+NDINIT_ALL(struct nameidata *ndp,
u_long op, u_long flags,
enum uio_seg segflg,
const char *namep,
+ int dirfd,
+ struct vnode *startdir,
struct thread *td)
{
ndp->ni_cnd.cn_nameiop = op;
ndp->ni_cnd.cn_flags = flags;
ndp->ni_segflg = segflg;
ndp->ni_dirp = namep;
+ ndp->ni_startdir = startdir;
ndp->ni_cnd.cn_thread = td;
+#ifdef notyet
+ ndp->ni_dirfd = dirfd;
+#endif
}
#define NDF_NO_DVP_RELE 0x00000001
From kmacy at FreeBSD.org Wed May 20 20:57:41 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 20:57:58 2009
Subject: svn commit: r192474 - stable/7/sys/sys
Message-ID: <200905202057.n4KKvex0043466@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 20:57:40 2009
New Revision: 192474
URL: http://svn.freebsd.org/changeset/base/192474
Log:
include fcntl.h to define AT_FDCWD
Modified:
stable/7/sys/sys/namei.h
Modified: stable/7/sys/sys/namei.h
==============================================================================
--- stable/7/sys/sys/namei.h Wed May 20 20:18:01 2009 (r192473)
+++ stable/7/sys/sys/namei.h Wed May 20 20:57:40 2009 (r192474)
@@ -92,6 +92,8 @@ struct nameidata {
};
#ifdef _KERNEL
+#include
+
/*
* namei operations
*/
From kmacy at FreeBSD.org Wed May 20 21:04:42 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 21:04:50 2009
Subject: svn commit: r192475 - in stable/7/sys: conf kern sys
Message-ID: <200905202104.n4KL4fOc043655@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 21:04:41 2009
New Revision: 192475
URL: http://svn.freebsd.org/changeset/base/192475
Log:
- MFC "object specific data" support with rmlocks replaced with rwlocks
- ZFS MFC dependency
Added:
stable/7/sys/kern/kern_osd.c (contents, props changed)
stable/7/sys/sys/osd.h (contents, props changed)
Modified:
stable/7/sys/conf/files
stable/7/sys/kern/kern_proc.c
stable/7/sys/kern/kern_thread.c
stable/7/sys/sys/jail.h
stable/7/sys/sys/proc.h
Modified: stable/7/sys/conf/files
==============================================================================
--- stable/7/sys/conf/files Wed May 20 20:57:40 2009 (r192474)
+++ stable/7/sys/conf/files Wed May 20 21:04:41 2009 (r192475)
@@ -1620,6 +1620,7 @@ kern/kern_module.c standard
kern/kern_mtxpool.c standard
kern/kern_mutex.c standard
kern/kern_ntptime.c standard
+kern/kern_osd.c standard
kern/kern_physio.c standard
kern/kern_pmc.c standard
kern/kern_poll.c optional device_polling
Added: stable/7/sys/kern/kern_osd.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/7/sys/kern/kern_osd.c Wed May 20 21:04:41 2009 (r192475)
@@ -0,0 +1,406 @@
+/*-
+ * Copyright (c) 2007 Pawel Jakub Dawidek
+ * 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 AUTHORS 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 AUTHORS 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.
+ */
+
+#include
+__FBSDID("$FreeBSD$");
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* OSD (Object Specific Data) */
+
+static MALLOC_DEFINE(M_OSD, "osd", "Object Specific Data");
+
+static int osd_debug = 0;
+TUNABLE_INT("debug.osd", &osd_debug);
+SYSCTL_INT(_debug, OID_AUTO, osd, CTLFLAG_RW, &osd_debug, 0, "OSD debug level");
+
+#define OSD_DEBUG(...) do { \
+ if (osd_debug) { \
+ printf("OSD (%s:%u): ", __func__, __LINE__); \
+ printf(__VA_ARGS__); \
+ printf("\n"); \
+ } \
+} while (0)
+
+static void do_osd_del(u_int type, struct osd *osd, u_int slot);
+static void do_osd_del_locked(u_int type, struct osd *osd, u_int slot);
+
+/*
+ * Lists of objects with OSD.
+ *
+ * Lock key:
+ * (m) osd_module_lock
+ * (o) osd_object_lock
+ * (l) osd_list_lock
+ */
+static LIST_HEAD(, osd) osd_list[OSD_LAST + 1]; /* (m) */
+static osd_method_t *osd_methods[OSD_LAST + 1]; /* (m) */
+static u_int osd_nslots[OSD_LAST + 1]; /* (m) */
+static osd_destructor_t *osd_destructors[OSD_LAST + 1]; /* (o) */
+static const u_int osd_nmethods[OSD_LAST + 1] = {
+ [OSD_JAIL] = PR_MAXMETHOD,
+};
+
+static struct sx osd_module_lock[OSD_LAST + 1];
+static struct rwlock osd_object_lock[OSD_LAST + 1];
+static struct mtx osd_list_lock[OSD_LAST + 1];
+
+static void
+osd_default_destructor(void *value __unused)
+{
+ /* Do nothing. */
+}
+
+int
+osd_register(u_int type, osd_destructor_t destructor, osd_method_t *methods)
+{
+ void *newptr;
+ u_int i, m;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+
+ /*
+ * If no destructor is given, use default one. We need to use some
+ * destructor, because NULL destructor means unused slot.
+ */
+ if (destructor == NULL)
+ destructor = osd_default_destructor;
+
+ sx_xlock(&osd_module_lock[type]);
+ /*
+ * First, we try to find unused slot.
+ */
+ for (i = 0; i < osd_nslots[type]; i++) {
+ if (osd_destructors[type][i] == NULL) {
+ OSD_DEBUG("Unused slot found (type=%u, slot=%u).",
+ type, i);
+ break;
+ }
+ }
+ /*
+ * If no unused slot was found, allocate one.
+ */
+ if (i == osd_nslots[type]) {
+ osd_nslots[type]++;
+ if (osd_nmethods[type] != 0)
+ osd_methods[type] = realloc(osd_methods[type],
+ sizeof(osd_method_t) * osd_nslots[type] *
+ osd_nmethods[type], M_OSD, M_WAITOK);
+ newptr = malloc(sizeof(osd_destructor_t) * osd_nslots[type],
+ M_OSD, M_WAITOK);
+ rw_wlock(&osd_object_lock[type]);
+ bcopy(osd_destructors[type], newptr,
+ sizeof(osd_destructor_t) * i);
+ free(osd_destructors[type], M_OSD);
+ osd_destructors[type] = newptr;
+ rw_wunlock(&osd_object_lock[type]);
+ OSD_DEBUG("New slot allocated (type=%u, slot=%u).",
+ type, i + 1);
+ }
+
+ osd_destructors[type][i] = destructor;
+ if (osd_nmethods[type] != 0) {
+ for (m = 0; m < osd_nmethods[type]; m++)
+ osd_methods[type][i * osd_nmethods[type] + m] =
+ methods != NULL ? methods[m] : NULL;
+ }
+ sx_xunlock(&osd_module_lock[type]);
+ return (i + 1);
+}
+
+void
+osd_deregister(u_int type, u_int slot)
+{
+ struct osd *osd, *tosd;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+ KASSERT(slot > 0, ("Invalid slot."));
+ KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot."));
+
+ sx_xlock(&osd_module_lock[type]);
+ rw_wlock(&osd_object_lock[type]);
+ /*
+ * Free all OSD for the given slot.
+ */
+ mtx_lock(&osd_list_lock[type]);
+ LIST_FOREACH_SAFE(osd, &osd_list[type], osd_next, tosd)
+ do_osd_del_locked(type, osd, slot);
+ mtx_unlock(&osd_list_lock[type]);
+ /*
+ * Set destructor to NULL to free the slot.
+ */
+ osd_destructors[type][slot - 1] = NULL;
+ if (slot == osd_nslots[type]) {
+ osd_nslots[type]--;
+ osd_destructors[type] = realloc(osd_destructors[type],
+ sizeof(osd_destructor_t) * osd_nslots[type], M_OSD,
+ M_NOWAIT | M_ZERO);
+ if (osd_nmethods[type] != 0)
+ osd_methods[type] = realloc(osd_methods[type],
+ sizeof(osd_method_t) * osd_nslots[type] *
+ osd_nmethods[type], M_OSD, M_NOWAIT | M_ZERO);
+ /*
+ * We always reallocate to smaller size, so we assume it will
+ * always succeed.
+ */
+ KASSERT(osd_destructors[type] != NULL &&
+ (osd_nmethods[type] == 0 || osd_methods[type] != NULL),
+ ("realloc() failed"));
+ OSD_DEBUG("Deregistration of the last slot (type=%u, slot=%u).",
+ type, slot);
+ } else {
+ OSD_DEBUG("Slot deregistration (type=%u, slot=%u).",
+ type, slot);
+ }
+ rw_wunlock(&osd_object_lock[type]);
+ sx_xunlock(&osd_module_lock[type]);
+}
+
+int
+osd_set(u_int type, struct osd *osd, u_int slot, void *value)
+{
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+ KASSERT(slot > 0, ("Invalid slot."));
+ KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot."));
+
+ rw_rlock(&osd_object_lock[type]);
+ if (slot > osd->osd_nslots) {
+ if (value == NULL) {
+ OSD_DEBUG(
+ "Not allocating null slot (type=%u, slot=%u).",
+ type, slot);
+ rw_runlock(&osd_object_lock[type]);
+ return (0);
+ } else if (osd->osd_nslots == 0) {
+ /*
+ * First OSD for this object, so we need to allocate
+ * space and put it onto the list.
+ */
+ osd->osd_slots = malloc(sizeof(void *) * slot, M_OSD,
+ M_NOWAIT | M_ZERO);
+ if (osd->osd_slots == NULL) {
+ rw_runlock(&osd_object_lock[type]);
+ return (ENOMEM);
+ }
+ osd->osd_nslots = slot;
+ mtx_lock(&osd_list_lock[type]);
+ LIST_INSERT_HEAD(&osd_list[type], osd, osd_next);
+ mtx_unlock(&osd_list_lock[type]);
+ OSD_DEBUG("Setting first slot (type=%u).", type);
+ } else {
+ void *newptr;
+
+ /*
+ * Too few slots allocated here, needs to extend
+ * the array.
+ */
+ newptr = realloc(osd->osd_slots, sizeof(void *) * slot,
+ M_OSD, M_NOWAIT | M_ZERO);
+ if (newptr == NULL) {
+ rw_runlock(&osd_object_lock[type]);
+ return (ENOMEM);
+ }
+ osd->osd_slots = newptr;
+ osd->osd_nslots = slot;
+ OSD_DEBUG("Growing slots array (type=%u).", type);
+ }
+ }
+ OSD_DEBUG("Setting slot value (type=%u, slot=%u, value=%p).", type,
+ slot, value);
+ osd->osd_slots[slot - 1] = value;
+ rw_runlock(&osd_object_lock[type]);
+ return (0);
+}
+
+void *
+osd_get(u_int type, struct osd *osd, u_int slot)
+{
+ void *value;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+ KASSERT(slot > 0, ("Invalid slot."));
+ KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot."));
+
+ rw_rlock(&osd_object_lock[type]);
+ if (slot > osd->osd_nslots) {
+ value = NULL;
+ OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
+ } else {
+ value = osd->osd_slots[slot - 1];
+ OSD_DEBUG("Returning slot value (type=%u, slot=%u, value=%p).",
+ type, slot, value);
+ }
+ rw_runlock(&osd_object_lock[type]);
+ return (value);
+}
+
+static void
+do_osd_del_locked(u_int type, struct osd *osd, u_int slot)
+{
+ int i;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+ KASSERT(slot > 0, ("Invalid slot."));
+ KASSERT(osd_destructors[type][slot - 1] != NULL, ("Unused slot."));
+ mtx_assert(&osd_list_lock[type], MA_OWNED);
+
+ OSD_DEBUG("Deleting slot (type=%u, slot=%u).", type, slot);
+
+ if (slot > osd->osd_nslots) {
+ OSD_DEBUG("Slot doesn't exist (type=%u, slot=%u).", type, slot);
+ return;
+ }
+ if (osd->osd_slots[slot - 1] != NULL) {
+ osd_destructors[type][slot - 1](osd->osd_slots[slot - 1]);
+ osd->osd_slots[slot - 1] = NULL;
+ }
+ for (i = osd->osd_nslots - 1; i >= 0; i--) {
+ if (osd->osd_slots[i] != NULL) {
+ OSD_DEBUG("Slot still has a value (type=%u, slot=%u).",
+ type, i + 1);
+ break;
+ }
+ }
+ if (i == -1) {
+ /* No values left for this object. */
+ OSD_DEBUG("No more slots left (type=%u).", type);
+ LIST_REMOVE(osd, osd_next);
+ free(osd->osd_slots, M_OSD);
+ osd->osd_slots = NULL;
+ osd->osd_nslots = 0;
+ } else if (slot == osd->osd_nslots) {
+ /* This was the last slot. */
+ osd->osd_slots = realloc(osd->osd_slots,
+ sizeof(void *) * (i + 1), M_OSD, M_NOWAIT | M_ZERO);
+ /*
+ * We always reallocate to smaller size, so we assume it will
+ * always succeed.
+ */
+ KASSERT(osd->osd_slots != NULL, ("realloc() failed"));
+ osd->osd_nslots = i + 1;
+ OSD_DEBUG("Reducing slots array to %u (type=%u).",
+ osd->osd_nslots, type);
+ }
+}
+
+static void
+do_osd_del(u_int type, struct osd *osd, u_int slot)
+{
+ mtx_lock(&osd_list_lock[type]);
+ do_osd_del_locked(type, osd, slot);
+ mtx_unlock(&osd_list_lock[type]);
+}
+
+void
+osd_del(u_int type, struct osd *osd, u_int slot)
+{
+
+ rw_rlock(&osd_object_lock[type]);
+ do_osd_del(type, osd, slot);
+ rw_runlock(&osd_object_lock[type]);
+}
+
+
+
+int
+osd_call(u_int type, u_int method, void *obj, void *data)
+{
+ osd_method_t methodfun;
+ int error, i;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+ KASSERT(method < osd_nmethods[type], ("Invalid method."));
+
+ /*
+ * Call this method for every slot that defines it, stopping if an
+ * error is encountered.
+ */
+ error = 0;
+ sx_slock(&osd_module_lock[type]);
+ for (i = 0; i < osd_nslots[type]; i++) {
+ methodfun =
+ osd_methods[type][i * osd_nmethods[type] + method];
+ if (methodfun != NULL && (error = methodfun(obj, data)) != 0)
+ break;
+ }
+ sx_sunlock(&osd_module_lock[type]);
+ return (error);
+}
+
+void
+osd_exit(u_int type, struct osd *osd)
+{
+ u_int i;
+
+ KASSERT(type >= OSD_FIRST && type <= OSD_LAST, ("Invalid type."));
+
+ if (osd->osd_nslots == 0) {
+ KASSERT(osd->osd_slots == NULL, ("Non-null osd_slots."));
+ /* No OSD attached, just leave. */
+ return;
+ }
+
+ rw_rlock(&osd_object_lock[type]);
+ for (i = 1; i <= osd->osd_nslots; i++) {
+ if (osd_destructors[type][i - 1] != NULL)
+ do_osd_del(type, osd, i);
+ else
+ OSD_DEBUG("Unused slot (type=%u, slot=%u).", type, i);
+ }
+ rw_runlock(&osd_object_lock[type]);
+ OSD_DEBUG("Object exit (type=%u).", type);
+}
+
+static void
+osd_init(void *arg __unused)
+{
+ u_int i;
+
+ for (i = OSD_FIRST; i <= OSD_LAST; i++) {
+ osd_nslots[i] = 0;
+ LIST_INIT(&osd_list[i]);
+ sx_init(&osd_module_lock[i], "osd_module");
+ rw_init(&osd_object_lock[i], "osd_object");
+ mtx_init(&osd_list_lock[i], "osd_list", NULL, MTX_DEF);
+ osd_destructors[i] = NULL;
+ osd_methods[i] = NULL;
+ }
+}
+SYSINIT(osd, SI_SUB_LOCK, SI_ORDER_ANY, osd_init, NULL);
Modified: stable/7/sys/kern/kern_proc.c
==============================================================================
--- stable/7/sys/kern/kern_proc.c Wed May 20 20:57:40 2009 (r192474)
+++ stable/7/sys/kern/kern_proc.c Wed May 20 21:04:41 2009 (r192475)
@@ -200,6 +200,8 @@ proc_dtor(void *mem, int size, void *arg
("bad number of threads in exiting process"));
KASSERT(STAILQ_EMPTY(&p->p_ktr), ("proc_dtor: non-empty p_ktr"));
#endif
+ /* Free all OSD associated to this thread. */
+ osd_thread_exit(td);
/* Dispose of an alternate kstack, if it exists.
* XXX What if there are more than one thread in the proc?
Modified: stable/7/sys/kern/kern_thread.c
==============================================================================
--- stable/7/sys/kern/kern_thread.c Wed May 20 20:57:40 2009 (r192474)
+++ stable/7/sys/kern/kern_thread.c Wed May 20 21:04:41 2009 (r192475)
@@ -133,6 +133,9 @@ thread_ctor(void *mem, int size, void *a
#ifdef AUDIT
audit_thread_alloc(td);
#endif
+ /* Free all OSD associated to this thread. */
+ osd_thread_exit(td);
+
umtx_thread_alloc(td);
return (0);
}
Modified: stable/7/sys/sys/jail.h
==============================================================================
--- stable/7/sys/sys/jail.h Wed May 20 20:57:40 2009 (r192474)
+++ stable/7/sys/sys/jail.h Wed May 20 21:04:41 2009 (r192475)
@@ -14,6 +14,8 @@
#define _SYS_JAIL_H_
#ifdef _KERNEL
+#include
+
struct jail_v0 {
u_int32_t version;
char *path;
@@ -136,11 +138,28 @@ struct prison {
struct in_addr *pr_ip4; /* (c) v4 IPs of jail */
int pr_ip6s; /* (c) number of v6 IPs */
struct in6_addr *pr_ip6; /* (c) v6 IPs of jail */
+ struct osd pr_osd;
};
#endif /* _KERNEL || _WANT_PRISON */
#ifdef _KERNEL
/*
+ * Flag bits set via options or internally
+ */
+#define PR_PERSIST 0x00000001 /* Can exist without processes */
+#define PR_REMOVE 0x01000000 /* In process of being removed */
+
+/*
+ * OSD methods
+ */
+#define PR_METHOD_CREATE 0
+#define PR_METHOD_GET 1
+#define PR_METHOD_SET 2
+#define PR_METHOD_CHECK 3
+#define PR_METHOD_ATTACH 4
+#define PR_MAXMETHOD 5
+
+/*
* Sysctl-set variables that determine global jail policy
*
* XXX MIB entries will need to be protected by a mutex.
Added: stable/7/sys/sys/osd.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/7/sys/sys/osd.h Wed May 20 21:04:41 2009 (r192475)
@@ -0,0 +1,101 @@
+/*-
+ * Copyright (c) 2007 Pawel Jakub Dawidek
+ * 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 AUTHORS 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 AUTHORS 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$
+ */
+
+#ifndef _SYS_OSD_H_
+#define _SYS_OSD_H_
+
+#include
+
+/*
+ * Lock key:
+ * (c) container lock (e.g. jail's pr_mtx) and/or osd_object_lock
+ * (l) osd_list_lock
+ */
+struct osd {
+ u_int osd_nslots; /* (c) */
+ void **osd_slots; /* (c) */
+ LIST_ENTRY(osd) osd_next; /* (l) */
+};
+
+#ifdef _KERNEL
+
+#define OSD_THREAD 0
+#define OSD_JAIL 1
+
+#define OSD_FIRST OSD_THREAD
+#define OSD_LAST OSD_JAIL
+
+typedef void (*osd_destructor_t)(void *value);
+typedef int (*osd_method_t)(void *obj, void *data);
+
+int osd_register(u_int type, osd_destructor_t destructor,
+ osd_method_t *methods);
+void osd_deregister(u_int type, u_int slot);
+
+int osd_set(u_int type, struct osd *osd, u_int slot, void *value);
+void *osd_get(u_int type, struct osd *osd, u_int slot);
+void osd_del(u_int type, struct osd *osd, u_int slot);
+int osd_call(u_int type, u_int method, void *obj, void *data);
+
+void osd_exit(u_int type, struct osd *osd);
+
+#define osd_thread_register(destructor) \
+ osd_register(OSD_THREAD, (destructor), NULL)
+#define osd_thread_deregister(slot) \
+ osd_deregister(OSD_THREAD, (slot))
+#define osd_thread_set(td, slot, value) \
+ osd_set(OSD_THREAD, &(td)->td_osd, (slot), (value))
+#define osd_thread_get(td, slot) \
+ osd_get(OSD_THREAD, &(td)->td_osd, (slot))
+#define osd_thread_del(td, slot) do { \
+ KASSERT((td) == curthread, ("Not curthread.")); \
+ osd_del(OSD_THREAD, &(td)->td_osd, (slot)); \
+} while (0)
+#define osd_thread_call(td, method, data) \
+ osd_call(OSD_THREAD, (method), (td), (data))
+#define osd_thread_exit(td) \
+ osd_exit(OSD_THREAD, &(td)->td_osd)
+
+#define osd_jail_register(destructor, methods) \
+ osd_register(OSD_JAIL, (destructor), (methods))
+#define osd_jail_deregister(slot) \
+ osd_deregister(OSD_JAIL, (slot))
+#define osd_jail_set(pr, slot, value) \
+ osd_set(OSD_JAIL, &(pr)->pr_osd, (slot), (value))
+#define osd_jail_get(pr, slot) \
+ osd_get(OSD_JAIL, &(pr)->pr_osd, (slot))
+#define osd_jail_del(pr, slot) \
+ osd_del(OSD_JAIL, &(pr)->pr_osd, (slot))
+#define osd_jail_call(pr, method, data) \
+ osd_call(OSD_JAIL, (method), (pr), (data))
+#define osd_jail_exit(pr) \
+ osd_exit(OSD_JAIL, &(pr)->pr_osd)
+
+#endif /* _KERNEL */
+
+#endif /* !_SYS_OSD_H_ */
Modified: stable/7/sys/sys/proc.h
==============================================================================
--- stable/7/sys/sys/proc.h Wed May 20 20:57:40 2009 (r192474)
+++ stable/7/sys/sys/proc.h Wed May 20 21:04:41 2009 (r192475)
@@ -46,6 +46,7 @@
#include
#include
#include
+#include
#include
#include /* XXX. */
#include
@@ -305,6 +306,7 @@ struct thread {
struct file *td_fpop; /* (k) file referencing cdev under op */
struct kdtrace_thread *td_dtrace; /* (*) DTrace-specific data. */
int td_errno; /* Error returned by last syscall. */
+ struct osd td_osd; /* (k) Object specific data. */
};
struct mtx *thread_lock_block(struct thread *);
From delphij at FreeBSD.org Wed May 20 21:13:50 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed May 20 21:14:07 2009
Subject: svn commit: r192477 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
dev/bce dev/cxgb
Message-ID: <200905202113.n4KLDnBT043958@svn.freebsd.org>
Author: delphij
Date: Wed May 20 21:13:49 2009
New Revision: 192477
URL: http://svn.freebsd.org/changeset/base/192477
Log:
MFC r191923 (davidch):
- Fixed incorrect packet length problem caused be earlier change to
support ZERO_COPY_SOCKETS.
- Created #define for context initialization retry count.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/dev/bce/if_bce.c
stable/7/sys/dev/bce/if_bcereg.h
stable/7/sys/dev/cxgb/ (props changed)
Modified: stable/7/sys/dev/bce/if_bce.c
==============================================================================
--- stable/7/sys/dev/bce/if_bce.c Wed May 20 21:07:15 2009 (r192476)
+++ stable/7/sys/dev/bce/if_bce.c Wed May 20 21:13:49 2009 (r192477)
@@ -4204,8 +4204,7 @@ bce_init_ctx(struct bce_softc *sc)
if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
(BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
- /* DRC: Replace this constant value with a #define. */
- int i, retry_cnt = 10;
+ int i, retry_cnt = CTX_INIT_RETRY_COUNT;
u32 val;
DBPRINT(sc, BCE_INFO_CTX, "Initializing 5709 context.\n");
@@ -5895,6 +5894,9 @@ bce_rx_intr(struct bce_softc *sc)
/* Set the total packet length. */
m0->m_pkthdr.len = m0->m_len = pkt_len;
}
+#else
+ /* Set the total packet length. */
+ m0->m_pkthdr.len = m0->m_len = pkt_len;
#endif
/* Remove the trailing Ethernet FCS. */
Modified: stable/7/sys/dev/bce/if_bcereg.h
==============================================================================
--- stable/7/sys/dev/bce/if_bcereg.h Wed May 20 21:07:15 2009 (r192476)
+++ stable/7/sys/dev/bce/if_bcereg.h Wed May 20 21:13:49 2009 (r192477)
@@ -6229,6 +6229,8 @@ struct l2_fhdr {
#endif /* ZERO_COPY_SOCKETS */
+#define CTX_INIT_RETRY_COUNT 10
+
/* Context size. */
#define CTX_SHIFT 7
#define CTX_SIZE (1 << CTX_SHIFT)
From delphij at FreeBSD.org Wed May 20 21:17:11 2009
From: delphij at FreeBSD.org (Xin LI)
Date: Wed May 20 21:17:22 2009
Subject: svn commit: r192478 - in stable/7/sys: . dev/bge
Message-ID: <200905202117.n4KLHA2o044080@svn.freebsd.org>
Author: delphij
Date: Wed May 20 21:17:10 2009
New Revision: 192478
URL: http://svn.freebsd.org/changeset/base/192478
Log:
MFC r192127:
Try to workaround a race where bge_stop() may sneak in when bge_rxeof()
drops and re-grabs the softc mutex in the middle, resulting in kernel
trap 12. This may happen when a lot of traffic is being hammered on
one bge(4) interface while the system is shutting down.
Reported by: Alexander Sack
PR: kern/134548
Modified:
stable/7/sys/ (props changed)
stable/7/sys/dev/bge/if_bge.c
Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c Wed May 20 21:13:49 2009 (r192477)
+++ stable/7/sys/dev/bge/if_bge.c Wed May 20 21:17:10 2009 (r192478)
@@ -3193,6 +3193,9 @@ bge_rxeof(struct bge_softc *sc)
BGE_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
BGE_LOCK(sc);
+
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
+ return;
}
if (stdcnt > 0)
@@ -3301,6 +3304,10 @@ bge_poll(struct ifnet *ifp, enum poll_cm
sc->rxcycles = count;
bge_rxeof(sc);
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+ BGE_UNLOCK(sc);
+ return;
+ }
bge_txeof(sc);
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
bge_start_locked(ifp);
@@ -3370,7 +3377,9 @@ bge_intr(void *xsc)
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
/* Check RX return ring producer/consumer. */
bge_rxeof(sc);
+ }
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
/* Check TX ring producer/consumer. */
bge_txeof(sc);
}
From kmacy at FreeBSD.org Wed May 20 22:09:50 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:10:02 2009
Subject: svn commit: r192483 - stable/7/sys/sys
Message-ID: <200905202209.n4KM9nVq045424@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:09:49 2009
New Revision: 192483
URL: http://svn.freebsd.org/changeset/base/192483
Log:
- make vfsoptlist globally visible
- ZFS MFC dependency
Modified:
stable/7/sys/sys/mount.h
Modified: stable/7/sys/sys/mount.h
==============================================================================
--- stable/7/sys/sys/mount.h Wed May 20 22:01:43 2009 (r192482)
+++ stable/7/sys/sys/mount.h Wed May 20 22:09:49 2009 (r192483)
@@ -131,8 +131,16 @@ struct ostatfs {
TAILQ_HEAD(vnodelst, vnode);
-struct vfsoptlist;
-struct vfsopt;
+/* Mount options list */
+TAILQ_HEAD(vfsoptlist, vfsopt);
+struct vfsopt {
+ TAILQ_ENTRY(vfsopt) link;
+ char *name;
+ void *value;
+ int len;
+ int pos;
+ int seen;
+};
/*
* Structure per mounted filesystem. Each mounted filesystem has an
From kmacy at FreeBSD.org Wed May 20 22:10:35 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:11:59 2009
Subject: svn commit: r192484 - stable/7/sys/sys
Message-ID: <200905202210.n4KMAYOt045541@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:10:34 2009
New Revision: 192484
URL: http://svn.freebsd.org/changeset/base/192484
Log:
MFC accmode_t
ZFS MFC dependency
Modified:
stable/7/sys/sys/_types.h
stable/7/sys/sys/types.h
Modified: stable/7/sys/sys/_types.h
==============================================================================
--- stable/7/sys/sys/_types.h Wed May 20 22:09:49 2009 (r192483)
+++ stable/7/sys/sys/_types.h Wed May 20 22:10:34 2009 (r192484)
@@ -47,6 +47,7 @@ typedef __uint32_t __ino_t; /* inode num
typedef long __key_t; /* IPC key (for Sys V IPC) */
typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */
typedef __uint16_t __mode_t; /* permissions */
+typedef int __accmode_t; /* access permissions */
typedef int __nl_item;
typedef __uint16_t __nlink_t; /* link count */
typedef __int64_t __off_t; /* file offset */
Modified: stable/7/sys/sys/types.h
==============================================================================
--- stable/7/sys/sys/types.h Wed May 20 22:09:49 2009 (r192483)
+++ stable/7/sys/sys/types.h Wed May 20 22:10:34 2009 (r192484)
@@ -210,6 +210,11 @@ typedef __nlink_t nlink_t; /* link count
#define _NLINK_T_DECLARED
#endif
+#ifndef _ACCMODE_T_DECLARED
+typedef __accmode_t accmode_t; /* access permissions */
+#define _ACCMODE_T_DECLARED
+#endif
+
#ifndef _OFF_T_DECLARED
typedef __off_t off_t; /* file offset */
#define _OFF_T_DECLARED
From kmacy at FreeBSD.org Wed May 20 22:13:22 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:13:53 2009
Subject: svn commit: r192485 - in stable/7/sys: conf libkern sys
Message-ID: <200905202213.n4KMDLcm045650@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:13:21 2009
New Revision: 192485
URL: http://svn.freebsd.org/changeset/base/192485
Log:
MFC memmove support
ZFS MFC dependency
Added:
stable/7/sys/libkern/memmove.c (contents, props changed)
Modified:
stable/7/sys/conf/files
stable/7/sys/sys/systm.h
Modified: stable/7/sys/conf/files
==============================================================================
--- stable/7/sys/conf/files Wed May 20 22:10:34 2009 (r192484)
+++ stable/7/sys/conf/files Wed May 20 22:13:21 2009 (r192485)
@@ -1755,6 +1755,7 @@ libkern/iconv_xlat16.c optional libicon
libkern/index.c standard
libkern/inet_ntoa.c standard
libkern/mcount.c optional profiling-routine
+libkern/memmove.c standard
libkern/qsort.c standard
libkern/qsort_r.c standard
libkern/random.c standard
Added: stable/7/sys/libkern/memmove.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/7/sys/libkern/memmove.c Wed May 20 22:13:21 2009 (r192485)
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2009 Roman Divacky
+ * 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.
+*/
+
+#include
+__FBSDID("$FreeBSD$");
+
+#include
+
+void *
+memmove(void *dest, const void *src, size_t n)
+{
+
+ bcopy(src, dest, n);
+ return (dest);
+}
Modified: stable/7/sys/sys/systm.h
==============================================================================
--- stable/7/sys/sys/systm.h Wed May 20 22:10:34 2009 (r192484)
+++ stable/7/sys/sys/systm.h Wed May 20 22:13:21 2009 (r192485)
@@ -191,6 +191,7 @@ void bcopy(const void *from, void *to, s
void bzero(void *buf, size_t len) __nonnull(1);
void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2);
+void *memmove(void *dest, const void *src, size_t len) __nonnull(1) __nonnull(2);
int copystr(const void * __restrict kfaddr, void * __restrict kdaddr,
size_t len, size_t * __restrict lencopied)
From kmacy at FreeBSD.org Wed May 20 22:19:50 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:20:06 2009
Subject: svn commit: r192487 - stable/7/sys/sys
Message-ID: <200905202219.n4KMJn6Y045844@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:19:48 2009
New Revision: 192487
URL: http://svn.freebsd.org/changeset/base/192487
Log:
add UID_NOBODY
Modified:
stable/7/sys/sys/conf.h
Modified: stable/7/sys/sys/conf.h
==============================================================================
--- stable/7/sys/sys/conf.h Wed May 20 22:19:22 2009 (r192486)
+++ stable/7/sys/sys/conf.h Wed May 20 22:19:48 2009 (r192487)
@@ -290,6 +290,7 @@ void devfs_fpdrop(struct file *fp); /* X
#define UID_ROOT 0
#define UID_BIN 3
#define UID_UUCP 66
+#define UID_NOBODY 65534
#define GID_WHEEL 0
#define GID_KMEM 2
From kmacy at FreeBSD.org Wed May 20 22:24:32 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:24:48 2009
Subject: svn commit: r192488 - stable/7/sys/kern
Message-ID: <200905202224.n4KMOVSv046005@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:24:31 2009
New Revision: 192488
URL: http://svn.freebsd.org/changeset/base/192488
Log:
make vfsopt globally visible for ZFS
Modified:
stable/7/sys/kern/vfs_mount.c
Modified: stable/7/sys/kern/vfs_mount.c
==============================================================================
--- stable/7/sys/kern/vfs_mount.c Wed May 20 22:19:48 2009 (r192487)
+++ stable/7/sys/kern/vfs_mount.c Wed May 20 22:24:31 2009 (r192488)
@@ -100,14 +100,6 @@ struct mntlist mountlist = TAILQ_HEAD_IN
struct mtx mountlist_mtx;
MTX_SYSINIT(mountlist, &mountlist_mtx, "mountlist", MTX_DEF);
-TAILQ_HEAD(vfsoptlist, vfsopt);
-struct vfsopt {
- TAILQ_ENTRY(vfsopt) link;
- char *name;
- void *value;
- int len;
-};
-
/*
* The vnode of the system's root (/ in the filesystem, without chroot
* active.)
From kmacy at FreeBSD.org Wed May 20 22:26:04 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:26:15 2009
Subject: svn commit: r192489 - stable/7/sys/kern
Message-ID: <200905202226.n4KMQ3CG046084@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:26:03 2009
New Revision: 192489
URL: http://svn.freebsd.org/changeset/base/192489
Log:
make vdestroy globally visible for ZFS
Modified:
stable/7/sys/kern/vfs_subr.c
Modified: stable/7/sys/kern/vfs_subr.c
==============================================================================
--- stable/7/sys/kern/vfs_subr.c Wed May 20 22:24:31 2009 (r192488)
+++ stable/7/sys/kern/vfs_subr.c Wed May 20 22:26:03 2009 (r192489)
@@ -104,7 +104,6 @@ static void v_decr_useonly(struct vnode
static void v_upgrade_usecount(struct vnode *);
static void vfree(struct vnode *);
static void vnlru_free(int);
-static void vdestroy(struct vnode *);
static void vgonel(struct vnode *);
static void vfs_knllock(void *arg);
static void vfs_knlunlock(void *arg);
@@ -777,7 +776,7 @@ SYSINIT(vnlru, SI_SUB_KTHREAD_UPDATE, SI
* Routines having to do with the management of the vnode table.
*/
-static void
+void
vdestroy(struct vnode *vp)
{
struct bufobj *bo;
From kmacy at FreeBSD.org Wed May 20 22:27:19 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:27:36 2009
Subject: svn commit: r192490 - stable/7/sys/sys
Message-ID: <200905202227.n4KMRIjW046143@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:27:18 2009
New Revision: 192490
URL: http://svn.freebsd.org/changeset/base/192490
Log:
add vdestroy declaration now that it is no longer static
- needed by ZFS
Modified:
stable/7/sys/sys/vnode.h
Modified: stable/7/sys/sys/vnode.h
==============================================================================
--- stable/7/sys/sys/vnode.h Wed May 20 22:26:03 2009 (r192489)
+++ stable/7/sys/sys/vnode.h Wed May 20 22:27:18 2009 (r192490)
@@ -717,6 +717,7 @@ void vrele(struct vnode *vp);
void vref(struct vnode *vp);
int vrefcnt(struct vnode *vp);
void v_addpollinfo(struct vnode *vp);
+void vdestroy(struct vnode *vp);
int vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td);
void vnode_destroy_vobject(struct vnode *vp);
From kmacy at FreeBSD.org Wed May 20 22:28:40 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:28:48 2009
Subject: svn commit: r192491 - in stable/7/sys: kern sys
Message-ID: <200905202228.n4KMSdsE046212@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:28:39 2009
New Revision: 192491
URL: http://svn.freebsd.org/changeset/base/192491
Log:
MFC quad tunables and sysctls for setting ZFS arc cache size
Modified:
stable/7/sys/kern/kern_environment.c
stable/7/sys/sys/kernel.h
stable/7/sys/sys/sysctl.h
Modified: stable/7/sys/kern/kern_environment.c
==============================================================================
--- stable/7/sys/kern/kern_environment.c Wed May 20 22:27:18 2009 (r192490)
+++ stable/7/sys/kern/kern_environment.c Wed May 20 22:28:39 2009 (r192491)
@@ -553,6 +553,14 @@ tunable_ulong_init(void *data)
}
void
+tunable_quad_init(void *data)
+{
+ struct tunable_quad *d = (struct tunable_quad *)data;
+
+ TUNABLE_QUAD_FETCH(d->path, d->var);
+}
+
+void
tunable_str_init(void *data)
{
struct tunable_str *d = (struct tunable_str *)data;
Modified: stable/7/sys/sys/kernel.h
==============================================================================
--- stable/7/sys/sys/kernel.h Wed May 20 22:27:18 2009 (r192490)
+++ stable/7/sys/sys/kernel.h Wed May 20 22:28:39 2009 (r192491)
@@ -329,6 +329,25 @@ struct tunable_ulong {
#define TUNABLE_ULONG_FETCH(path, var) getenv_ulong((path), (var))
+/*
+ * quad
+ */
+extern void tunable_quad_init(void *);
+struct tunable_quad {
+ const char *path;
+ quad_t *var;
+};
+#define TUNABLE_QUAD(path, var) \
+ static struct tunable_quad __CONCAT(__tunable_quad_, __LINE__) = { \
+ (path), \
+ (var), \
+ }; \
+ SYSINIT(__CONCAT(__Tunable_init_, __LINE__), \
+ SI_SUB_TUNABLES, SI_ORDER_MIDDLE, tunable_quad_init, \
+ &__CONCAT(__tunable_quad_, __LINE__))
+
+#define TUNABLE_QUAD_FETCH(path, var) getenv_quad((path), (var))
+
extern void tunable_str_init(void *);
struct tunable_str {
const char *path;
Modified: stable/7/sys/sys/sysctl.h
==============================================================================
--- stable/7/sys/sys/sysctl.h Wed May 20 22:27:18 2009 (r192490)
+++ stable/7/sys/sys/sysctl.h Wed May 20 22:28:39 2009 (r192491)
@@ -295,6 +295,15 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_ULONG|CTLFLAG_MPSAFE|(access), \
ptr, 0, sysctl_handle_long, "LX", __DESCR(descr))
+/* Oid for a quad. The pointer must be non NULL. */
+#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \
+ SYSCTL_OID(parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \
+ ptr, val, sysctl_handle_quad, "Q", __DESCR(descr))
+
+#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \
+ sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_QUAD|CTLFLAG_MPSAFE|(access), \
+ ptr, 0, sysctl_handle_quad, "Q", __DESCR(descr))
+
/* Oid for an opaque object. Specified by a pointer and a length. */
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
From kmacy at FreeBSD.org Wed May 20 22:30:59 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:31:10 2009
Subject: svn commit: r192493 - stable/7/sys/kern
Message-ID: <200905202230.n4KMUwhg046344@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:30:57 2009
New Revision: 192493
URL: http://svn.freebsd.org/changeset/base/192493
Log:
td_osd is at the end of struct thread to avoid breaking the ABI
as a side effect it is outside of the td_startzero-td_endzero range,
requiring it to be separately zeroed
Modified:
stable/7/sys/kern/kern_fork.c
stable/7/sys/kern/kern_kse.c
stable/7/sys/kern/kern_thr.c
Modified: stable/7/sys/kern/kern_fork.c
==============================================================================
--- stable/7/sys/kern/kern_fork.c Wed May 20 22:28:55 2009 (r192492)
+++ stable/7/sys/kern/kern_fork.c Wed May 20 22:30:57 2009 (r192493)
@@ -507,6 +507,7 @@ again:
bcopy(&td->td_startcopy, &td2->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
+ bzero(&td2->td_osd, sizeof(struct osd));
td2->td_sigstk = td->td_sigstk;
td2->td_sigmask = td->td_sigmask;
Modified: stable/7/sys/kern/kern_kse.c
==============================================================================
--- stable/7/sys/kern/kern_kse.c Wed May 20 22:28:55 2009 (r192492)
+++ stable/7/sys/kern/kern_kse.c Wed May 20 22:30:57 2009 (r192493)
@@ -1014,6 +1014,7 @@ thread_alloc_spare(struct thread *td)
td->td_standin = spare;
bzero(&spare->td_startzero,
__rangeof(struct thread, td_startzero, td_endzero));
+ bzero(&spare->td_osd, sizeof(struct osd));
spare->td_proc = td->td_proc;
spare->td_ucred = crhold(td->td_ucred);
spare->td_flags = TDF_INMEM;
Modified: stable/7/sys/kern/kern_thr.c
==============================================================================
--- stable/7/sys/kern/kern_thr.c Wed May 20 22:28:55 2009 (r192492)
+++ stable/7/sys/kern/kern_thr.c Wed May 20 22:30:57 2009 (r192493)
@@ -199,6 +199,7 @@ create_thread(struct thread *td, mcontex
__rangeof(struct thread, td_startzero, td_endzero));
bcopy(&td->td_startcopy, &newtd->td_startcopy,
__rangeof(struct thread, td_startcopy, td_endcopy));
+ bzero(&newtd->td_osd, sizeof(struct osd));
newtd->td_proc = td->td_proc;
newtd->td_ucred = crhold(td->td_ucred);
From kmacy at FreeBSD.org Wed May 20 22:32:26 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 22:32:32 2009
Subject: svn commit: r192494 - stable/7/sys/kern
Message-ID: <200905202232.n4KMWPJU046415@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 22:32:25 2009
New Revision: 192494
URL: http://svn.freebsd.org/changeset/base/192494
Log:
MFC minimal zfs lock ordering for WITNESS
(dnode -> dirty record -> dbuf)
Modified:
stable/7/sys/kern/subr_witness.c
Modified: stable/7/sys/kern/subr_witness.c
==============================================================================
--- stable/7/sys/kern/subr_witness.c Wed May 20 22:30:57 2009 (r192493)
+++ stable/7/sys/kern/subr_witness.c Wed May 20 22:32:25 2009 (r192494)
@@ -397,6 +397,13 @@ static struct witness_order_list_entry o
{ "vnode interlock", &lock_class_mtx_sleep },
{ NULL, NULL },
/*
+ * ZFS locking
+ */
+ { "dn->dn_mtx", &lock_class_sx },
+ { "dr->dt.di.dr_mtx", &lock_class_sx },
+ { "db->db_mtx", &lock_class_sx },
+ { NULL, NULL },
+ /*
* spin locks
*/
#ifdef SMP
From kmacy at FreeBSD.org Wed May 20 23:35:01 2009
From: kmacy at FreeBSD.org (Kip Macy)
Date: Wed May 20 23:35:16 2009
Subject: svn commit: r192498 - in stable/7: . cddl
cddl/compat/opensolaris/include cddl/compat/opensolaris/misc
cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs
cddl/contrib/opensolaris/cmd...
Message-ID: <200905202335.n4KNZ0ng047789@svn.freebsd.org>
Author: kmacy
Date: Wed May 20 23:34:59 2009
New Revision: 192498
URL: http://svn.freebsd.org/changeset/base/192498
Log:
MFC ZFS version 13. This includes the changes by pjd (see original message
below) as well as the following:
- the recurring deadlock was fixed by deferring vinactive to a dedicated thread
- zfs boot for all pool types now works
Submitted by: dfr
- kmem now goes up to 512GB so arc is now limited by physmem
- the arc now experiences backpressure from the vm (which can be too
much - but this allows ZFS to work without any tunables on amd64)
- frequently recurring LOR in the ARC fixed
- zfs send coredump fix
- fixes for various PRs
Supported by: Barrett Lyon, BitGravity
Revision 185029 - (view) (annotate) - [select for diffs]
Modified Mon Nov 17 20:49:29 2008 UTC (6 months ago) by pjd
File length: 38244 byte(s)
Diff to previous 177698
Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes.
This bring huge amount of changes, I'll enumerate only user-visible changes:
- Delegated Administration
Allows regular users to perform ZFS operations, like file system
creation, snapshot creation, etc.
- L2ARC
Level 2 cache for ZFS - allows to use additional disks for cache.
Huge performance improvements mostly for random read of mostly
static content.
- slog
Allow to use additional disks for ZFS Intent Log to speed up
operations like fsync(2).
- vfs.zfs.super_owner
Allows regular users to perform privileged operations on files stored
on ZFS file systems owned by him. Very careful with this one.
- chflags(2)
Not all the flags are supported. This still needs work.
- ZFSBoot
Support to boot off of ZFS pool. Not finished, AFAIK.
Submitted by: dfr
- Snapshot properties
- New failure modes
Before if write requested failed, system paniced. Now one
can select from one of three failure modes:
Before if write requested failed, system paniced. Now one
can select from one of three failure modes:
- panic - panic on write error
- wait - wait for disk to reappear
- continue - serve read requests if possible, block write requests
- Refquota, refreservation properties
Just quota and reservation properties, but don't count space consumed
by children file systems, clones and snapshots.
- Sparse volumes
ZVOLs that don't reserve space in the pool.
- External attributes
Compatible with extattr(2).
- NFSv4-ACLs
Not sure about the status, might not be complete yet.
Submitted by: trasz
- Creation-time properties
- Regression tests for zpool(8) command.
Obtained from: OpenSolaris
Added:
stable/7/cddl/compat/opensolaris/include/libshare.h (contents, props changed)
stable/7/cddl/contrib/opensolaris/cmd/zinject/
stable/7/cddl/contrib/opensolaris/cmd/zinject/translate.c
stable/7/cddl/contrib/opensolaris/cmd/zinject/zinject.c
stable/7/cddl/contrib/opensolaris/cmd/zinject/zinject.h
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
stable/7/cddl/usr.bin/zinject/
stable/7/cddl/usr.bin/zinject/Makefile (contents, props changed)
stable/7/sys/boot/i386/zfsboot/
stable/7/sys/boot/i386/zfsboot/zfsboot.c (contents, props changed)
stable/7/sys/boot/zfs/
stable/7/sys/boot/zfs/zfsimpl.c (contents, props changed)
stable/7/sys/cddl/boot/
stable/7/sys/cddl/boot/zfs/
stable/7/sys/cddl/boot/zfs/README (contents, props changed)
stable/7/sys/cddl/boot/zfs/fletcher.c (contents, props changed)
stable/7/sys/cddl/boot/zfs/lzjb.c (contents, props changed)
stable/7/sys/cddl/boot/zfs/sha256.c (contents, props changed)
stable/7/sys/cddl/boot/zfs/zfsimpl.h (contents, props changed)
stable/7/sys/cddl/boot/zfs/zfssubr.c (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/sys/file.h (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/sys/kidmap.h (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/sys/pathname.h (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/sys/refstr.h (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/sys/sid.h (contents, props changed)
stable/7/sys/cddl/compat/opensolaris/sys/sig.h (contents, props changed)
stable/7/sys/cddl/contrib/opensolaris/common/atomic/amd64/opensolaris_atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/atomic/ia64/opensolaris_atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/atomic/sparc64/opensolaris_atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/unicode/
stable/7/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg2.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub2.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_fuid.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid2.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_array.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/opensolaris_xdr_mem.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/extdirent.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/idmap.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep_data.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/zmod/opensolaris_crc32.c
Deleted:
stable/7/sys/cddl/compat/opensolaris/sys/acl.h
stable/7/sys/cddl/contrib/opensolaris/common/atomic/amd64/atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/atomic/i386/atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/atomic/ia64/atomic.S
stable/7/sys/cddl/contrib/opensolaris/common/atomic/sparc64/atomic.S
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_mem.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/vfs.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/zmod/crc32.c
Modified:
stable/7/UPDATING
stable/7/cddl/Makefile.inc
stable/7/cddl/compat/opensolaris/include/mnttab.h
stable/7/cddl/compat/opensolaris/misc/deviceid.c
stable/7/cddl/compat/opensolaris/misc/mnttab.c
stable/7/cddl/compat/opensolaris/misc/zmount.c
stable/7/cddl/compat/opensolaris/misc/zone.c
stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.8
stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.c
stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c
stable/7/cddl/contrib/opensolaris/cmd/zfs/zfs.8
stable/7/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c
stable/7/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h
stable/7/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
stable/7/cddl/contrib/opensolaris/cmd/zpool/zpool.8
stable/7/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c
stable/7/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
stable/7/cddl/contrib/opensolaris/cmd/zpool/zpool_util.c
stable/7/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h
stable/7/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
stable/7/cddl/contrib/opensolaris/cmd/ztest/ztest.c
stable/7/cddl/contrib/opensolaris/head/assert.h
stable/7/cddl/contrib/opensolaris/head/libintl.h
stable/7/cddl/contrib/opensolaris/head/synch.h
stable/7/cddl/contrib/opensolaris/head/thread.h
stable/7/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c
stable/7/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h
stable/7/cddl/contrib/opensolaris/lib/libuutil/common/libuutil.h
stable/7/cddl/contrib/opensolaris/lib/libuutil/common/libuutil_common.h
stable/7/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c
stable/7/cddl/contrib/opensolaris/lib/libuutil/common/uu_avl.c
stable/7/cddl/contrib/opensolaris/lib/libuutil/common/uu_dprintf.c
stable/7/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_graph.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c
stable/7/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
stable/7/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
stable/7/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h
stable/7/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
stable/7/cddl/contrib/opensolaris/lib/libzpool/common/util.c
stable/7/cddl/lib/Makefile
stable/7/cddl/lib/libnvpair/Makefile
stable/7/cddl/lib/libzfs/Makefile
stable/7/cddl/lib/libzpool/Makefile
stable/7/cddl/sbin/zpool/Makefile
stable/7/cddl/usr.bin/Makefile
stable/7/cddl/usr.bin/ztest/Makefile
stable/7/cddl/usr.sbin/Makefile
stable/7/cddl/usr.sbin/zdb/Makefile
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris.c
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c
stable/7/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c
stable/7/sys/cddl/compat/opensolaris/rpc/xdr.h
stable/7/sys/cddl/compat/opensolaris/sys/atomic.h
stable/7/sys/cddl/compat/opensolaris/sys/cpuvar.h
stable/7/sys/cddl/compat/opensolaris/sys/cred.h
stable/7/sys/cddl/compat/opensolaris/sys/dnlc.h
stable/7/sys/cddl/compat/opensolaris/sys/kmem.h
stable/7/sys/cddl/compat/opensolaris/sys/lock.h
stable/7/sys/cddl/compat/opensolaris/sys/misc.h
stable/7/sys/cddl/compat/opensolaris/sys/mntent.h
stable/7/sys/cddl/compat/opensolaris/sys/mutex.h
stable/7/sys/cddl/compat/opensolaris/sys/param.h
stable/7/sys/cddl/compat/opensolaris/sys/policy.h
stable/7/sys/cddl/compat/opensolaris/sys/proc.h
stable/7/sys/cddl/compat/opensolaris/sys/rwlock.h
stable/7/sys/cddl/compat/opensolaris/sys/sunddi.h
stable/7/sys/cddl/compat/opensolaris/sys/sysmacros.h
stable/7/sys/cddl/compat/opensolaris/sys/time.h
stable/7/sys/cddl/compat/opensolaris/sys/types.h
stable/7/sys/cddl/compat/opensolaris/sys/uio.h
stable/7/sys/cddl/compat/opensolaris/sys/vfs.h
stable/7/sys/cddl/compat/opensolaris/sys/vnode.h
stable/7/sys/cddl/compat/opensolaris/sys/zone.h
stable/7/sys/cddl/contrib/opensolaris/common/acl/acl_common.c
stable/7/sys/cddl/contrib/opensolaris/common/acl/acl_common.h
stable/7/sys/cddl/contrib/opensolaris/common/avl/avl.c
stable/7/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
stable/7/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bplist.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/os/callb.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/os/list.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/os/taskq.c
stable/7/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/byteorder.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/cred.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/dkio.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/dklabel.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/fm/protocol.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/list.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/synch.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
stable/7/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c
stable/7/sys/compat/linprocfs/linprocfs.c
stable/7/sys/compat/pecoff/imgact_pecoff.c
stable/7/sys/fs/coda/coda_vfsops.c
stable/7/sys/fs/msdosfs/msdosfs_vfsops.c
stable/7/sys/fs/nullfs/null_vfsops.c
stable/7/sys/fs/unionfs/union_vfsops.c
stable/7/sys/modules/opensolaris/Makefile
stable/7/sys/modules/zfs/Makefile
stable/7/sys/ufs/ffs/ffs_snapshot.c
stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_fs_tbl.c
Modified: stable/7/UPDATING
==============================================================================
--- stable/7/UPDATING Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/UPDATING Wed May 20 23:34:59 2009 (r192498)
@@ -7,7 +7,12 @@ done items, please see the COMMON ITEMS:
Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before running
portupgrade.
-
+20090520
+ Update ZFS to version 13. ZFS users will need to re-build
+ kernel and world. Existing pools will continue to work
+ without upgrade. If a pool is upgraded it will no longer be
+ usable by older kernel revs. ZFS send / recv between
+ pool version 6 and pool version 13 is not supported.
20090504:
FreeBSD 7.2-RELEASE
Modified: stable/7/cddl/Makefile.inc
==============================================================================
--- stable/7/cddl/Makefile.inc Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/Makefile.inc Wed May 20 23:34:59 2009 (r192498)
@@ -6,3 +6,5 @@ OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../.
IGNORE_PRAGMA= YES
CFLAGS+= -DNEED_SOLARIS_BOOLEAN
+
+CSTD?= gnu89
Added: stable/7/cddl/compat/opensolaris/include/libshare.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/7/cddl/compat/opensolaris/include/libshare.h Wed May 20 23:34:59 2009 (r192498)
@@ -0,0 +1,144 @@
+/*-
+ * Copyright (c) 2007 Pawel Jakub Dawidek
+ * 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 AUTHORS 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 AUTHORS 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$
+ */
+
+#ifndef _OPENSOLARIS_LIBSHARE_H_
+#define _OPENSOLARIS_LIBSHARE_H_
+
+#define SA_OK 0
+
+#define SA_INIT_CONTROL_API 0
+
+#endif /* !_OPENSOLARIS_LIBSHARE_H_ */
+/*-
+ * Copyright (c) 2007 Pawel Jakub Dawidek
+ * 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 AUTHORS 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 AUTHORS 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$
+ */
+
+#ifndef _OPENSOLARIS_LIBSHARE_H_
+#define _OPENSOLARIS_LIBSHARE_H_
+
+#define SA_OK 0
+
+#define SA_INIT_CONTROL_API 0
+
+#endif /* !_OPENSOLARIS_LIBSHARE_H_ */
+/*-
+ * Copyright (c) 2007 Pawel Jakub Dawidek
+ * 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 AUTHORS 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 AUTHORS 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$
+ */
+
+#ifndef _OPENSOLARIS_LIBSHARE_H_
+#define _OPENSOLARIS_LIBSHARE_H_
+
+#define SA_OK 0
+
+#define SA_INIT_CONTROL_API 0
+
+#endif /* !_OPENSOLARIS_LIBSHARE_H_ */
+/*-
+ * Copyright (c) 2007 Pawel Jakub Dawidek
+ * 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 AUTHORS 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 AUTHORS 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$
+ */
+
+#ifndef _OPENSOLARIS_LIBSHARE_H_
+#define _OPENSOLARIS_LIBSHARE_H_
+
+#define SA_OK 0
+
+#define SA_INIT_CONTROL_API 0
+
+#endif /* !_OPENSOLARIS_LIBSHARE_H_ */
Modified: stable/7/cddl/compat/opensolaris/include/mnttab.h
==============================================================================
--- stable/7/cddl/compat/opensolaris/include/mnttab.h Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/compat/opensolaris/include/mnttab.h Wed May 20 23:34:59 2009 (r192498)
@@ -9,6 +9,8 @@
#define MNTTAB _PATH_DEVNULL
#define MNT_LINE_MAX 1024
+#define umount2(p, f) unmount(p, f)
+
struct mnttab {
char *mnt_special;
char *mnt_mountp;
Modified: stable/7/cddl/compat/opensolaris/misc/deviceid.c
==============================================================================
--- stable/7/cddl/compat/opensolaris/misc/deviceid.c Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/compat/opensolaris/misc/deviceid.c Wed May 20 23:34:59 2009 (r192498)
@@ -94,11 +94,7 @@ int
devid_get(int fd, ddi_devid_t *retdevid)
{
- if (ioctl(fd, DIOCGIDENT, retdevid->devid) == -1)
- return (errno);
- if (retdevid->devid[0] == '\0')
- return (ENOENT);
- return (0);
+ return (ENOENT);
}
int
Modified: stable/7/cddl/compat/opensolaris/misc/mnttab.c
==============================================================================
--- stable/7/cddl/compat/opensolaris/misc/mnttab.c Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/compat/opensolaris/misc/mnttab.c Wed May 20 23:34:59 2009 (r192498)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
+#include
static char *
mntopt(char **p)
Modified: stable/7/cddl/compat/opensolaris/misc/zmount.c
==============================================================================
--- stable/7/cddl/compat/opensolaris/misc/zmount.c Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/compat/opensolaris/misc/zmount.c Wed May 20 23:34:59 2009 (r192498)
@@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$");
#include
#include
#include
+#include
#include
#include
-#include
+#include
static void
build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val,
@@ -86,7 +87,7 @@ zmount(const char *spec, const char *dir
assert(optlen > 0);
optstr = strdup(optptr);
- assert(optptr != NULL);
+ assert(optstr != NULL);
iov = NULL;
iovlen = 0;
Modified: stable/7/cddl/compat/opensolaris/misc/zone.c
==============================================================================
--- stable/7/cddl/compat/opensolaris/misc/zone.c Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/compat/opensolaris/misc/zone.c Wed May 20 23:34:59 2009 (r192498)
@@ -32,7 +32,7 @@
#include
#include
-int
+zoneid_t
getzoneid(void)
{
size_t size;
@@ -42,5 +42,5 @@ getzoneid(void)
size = sizeof(jailid);
if (sysctlbyname("security.jail.jailed", &jailid, &size, NULL, 0) == -1)
assert(!"No security.jail.jailed sysctl!");
- return (jailid);
+ return ((zoneid_t)jailid);
}
Modified: stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.8
==============================================================================
--- stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Wed May 20 23:34:59 2009 (r192498)
@@ -28,13 +28,18 @@ zdb \- ZFS debugger
.fi
.SH DESCRIPTION
+.sp
.LP
The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer.
+.sp
.LP
If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected.
+.sp
.LP
Any options supported by this command are internal to Sun and subject to change at any time.
.SH EXIT STATUS
+
+.sp
.LP
The following exit values are returned:
.sp
@@ -71,6 +76,9 @@ Invalid command line options were specif
.RE
.SH ATTRIBUTES
+
+.sp
+
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -89,5 +97,6 @@ Interface StabilityUnstable
.TE
.SH SEE ALSO
+.sp
.LP
\fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5)
Modified: stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed May 20 23:33:40 2009 (r192497)
+++ stable/7/cddl/contrib/opensolaris/cmd/zdb/zdb.c Wed May 20 23:34:59 2009 (r192498)
@@ -19,12 +19,10 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include
#include
#include
@@ -51,6 +49,10 @@
#include
#include
#include
+#include
+#undef ZFS_MAXNAMELEN
+#undef verify
+#include
const char cmdname[] = "zdb";
uint8_t dump_opt[256];
@@ -62,6 +64,9 @@ uint64_t *zopt_object = NULL;
int zopt_objects = 0;
int zdb_advance = ADVANCE_PRE;
zbookmark_t zdb_noread = { 0, 0, ZB_NO_LEVEL, 0 };
+libzfs_handle_t *g_zfs;
+boolean_t zdb_sig_user_data = B_TRUE;
+int zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256;
/*
* These libumem hooks provide a reasonable set of defaults for the allocator's
@@ -83,12 +88,15 @@ static void
usage(void)
{
(void) fprintf(stderr,
- "Usage: %s [-udibcsvLU] [-O order] [-B os:obj:level:blkid] "
+ "Usage: %s [-udibcsvL] [-U cachefile_path] [-O order] "
+ "[-B os:obj:level:blkid] [-S user:cksumalg] "
"dataset [object...]\n"
" %s -C [pool]\n"
" %s -l dev\n"
- " %s -R vdev:offset:size:flags\n",
- cmdname, cmdname, cmdname, cmdname);
+ " %s -R pool:vdev:offset:size:flags\n"
+ " %s [-p path_to_vdev_dir]\n"
+ " %s -e pool | GUID | devid ...\n",
+ cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
(void) fprintf(stderr, " -u uberblock\n");
(void) fprintf(stderr, " -d datasets\n");
@@ -97,16 +105,22 @@ usage(void)
(void) fprintf(stderr, " -b block statistics\n");
(void) fprintf(stderr, " -c checksum all data blocks\n");
(void) fprintf(stderr, " -s report stats on zdb's I/O\n");
+ (void) fprintf(stderr, " -S :