mckusick [Tue, 23 Nov 2010 01:24:27 +0000 (01:24 +0000)]
MFC of 213119
Reported problem:
Large (60GB) filesystems created using "newfs -U -O 1 -b 65536 -f 8192"
show incorrect results from "df" for free and used space when mounted
immediately after creation. fsck on the new filesystem (before ever
mounting it once) gives a "SUMMARY INFORMATION BAD" error in phase 5.
This error hasn't occurred in any runs of fsck immediately after
"newfs -U -b 65536 -f 8192" (leaving out the "-O 1" option).
Solution:
The default UFS1 superblock is located at offset 8K in the filesystem
partition; the default UFS2 superblock is located at offset 64K in
the filesystem partition. For UFS1 filesystems with a blocksize of
64K, the first alternate superblock resides at 64K which is the the
location used for the default UFS2 superblock. By default, the
system first checks for a valid superblock at the default location
for a UFS2 filoesystem. For a UFS1 filesystem with a blocksize of
64K, there is a valid UFS1 superblock at this location. Thus, even
though it is expected to be a backup superblock, the system will
use it as its default superblock. So, we have to ensure that all the
statistcs on usage are correct in this first alternate superblock
as it is the superblock that will actually be used.
While tracking down this problem, another limitation of UFS1 became
evident. For UFS1, the number of inodes per cylinder group is stored
in an int16_t. Thus the maximum number of inodes per cylinder group
is limited to 2^15 - 1. This limit can easily be exceeded for block
sizes of 32K and above. Thus when building UFS1 filesystems, newfs
must limit the number of inodes per cylinder group to 2^15 - 1.
Reported by: Guy Helmer<ghelmer@palisadesys.com>
Followup by: Bruce Cran <brucec@freebsd.org>
PR: 107692
des [Mon, 22 Nov 2010 19:02:30 +0000 (19:02 +0000)]
MFC r209052, r210702, r211095, r211182, r212149: Fix a memory leak and
some potential deadlocks, increase the target limit from 4 to 64, and
numerous other scalability and stability improvements, including.
Submitted by: Daniel Braniss <danny@cs.huji.ac.il>
Sponsored by: Dansk Scanning A/S, Data Robotics Inc.
nwhitehorn [Mon, 22 Nov 2010 17:39:18 +0000 (17:39 +0000)]
MFC r212054:
Restructure how reset and poweroff are handled on PowerPC systems, since
the existing code was very platform specific, and broken for SMP systems
trying to reboot from KDB.
- Add a new PLATFORM_RESET() method to the platform KOBJ interface, and
migrate existing reset functions into platform modules.
- Modify the OF_reboot() routine to submit the request by hand to avoid
the IPIs involved in the regular openfirmware() routine. This fixes
reboot from KDB on SMP machines.
- Move non-KDB reset and poweroff functions on the Powermac platform
into the relevant power control drivers (cuda, pmu, smu), instead of
using them through the Open Firmware backdoor.
- Rename platform_chrp to platform_powermac since it has become
increasingly Powermac specific. When we gain support for IBM systems,
we will grow a new platform_chrp.
nwhitehorn [Mon, 22 Nov 2010 17:13:04 +0000 (17:13 +0000)]
MFC r205506:
Get nexus(4) out of the RTC business. The interface used by nexus(4)
in Open Firmware was Apple-specific, and we have complete coverage of Apple
system controllers, so move RTC responsibilities into the system controller
drivers. This avoids interesting problems from manipulating these devices
through Open Firmware behind the backs of their drivers.
nwhitehorn [Mon, 22 Nov 2010 17:09:42 +0000 (17:09 +0000)]
MFC r215100:
Disabling CPU NAP modes during SMU commands is a hack needed only on U3
systems. Don't use it on non-U3 systems to allow cpu_idle() to work
correctly.
nwhitehorn [Mon, 22 Nov 2010 16:58:07 +0000 (16:58 +0000)]
MFC r213986:
Fix an XXX comment by answering 'no'. OS X does not set the day-of-week
counter on SMU-based systems, which causes FreeBSD to reject the RTC time
when used in a dual-boot environment. Since we don't use the day-of-week
counter anyway, solve this by just not checking that it matches.
kensmith [Mon, 22 Nov 2010 16:09:57 +0000 (16:09 +0000)]
We're a bit under a week from Code Freeze for the upcoming 8.2-RELEASE
cycle. Warn people tracking stable/8 that the branch may be more
active than usual.
brian [Mon, 22 Nov 2010 09:32:54 +0000 (09:32 +0000)]
MFC r212247 & r212724 from head:
Handle geli-encrypted root disk devices.
Add support for identifying a journaled root filesystem.
Fix support for identifying the given /dev/vinum/root example.
netchild [Mon, 22 Nov 2010 08:21:58 +0000 (08:21 +0000)]
MFC r215338:
- print out the PID and program name of the program trying to use an
unsupported futex operation
- for those futex operations which are known to be not supported,
print out which futex operation it is
- shortcut the error return of the unsupported FUTEX_CLOCK_REALTIME in
some cases:
FUTEX_CLOCK_REALTIME can be used to tell linux to use
CLOCK_REALTIME instead of CLOCK_MONOTONIC. FUTEX_CLOCK_REALTIME
however must only be set, if either FUTEX_WAIT_BITSET or
FUTEX_WAIT_REQUEUE_PI are set too. If that's not the case
we can die with ENOSYS right at the beginning.
Submitted by: arundel
Reviewed by: rdivacky (earlier iteration of the patch)
MFC after: 1 week
brucec [Sun, 21 Nov 2010 13:41:04 +0000 (13:41 +0000)]
MFC r215306:
libatm_p.a, libkeycap_p.a and libmytinfo_p.a are already in ObsoleteFiles.inc.
liblwres.so.10 has been replaced by liblwres.so.50.
usr/share/man/man8/nsupdate.8.gz was moved to usr/share/man/man1/nsupdate.1.gz
in bind 9.4.3.
simon [Sun, 21 Nov 2010 11:10:09 +0000 (11:10 +0000)]
MFC r210372:
Add support for creating the archived log filenames using a time-stamp
instead of the traditional simple counter.
Using the time-stamp based file-names, once a log file is archived, it
will not change name until it is deleted. This means that many backup
systems will only perform one backup of the archived log file, instead
for performing a new backup of the logfile upon each logfile rotation.
This implementation is separate from the patches in the mentioned PR,
as I wasn't aware of the existence of the PR until after I had
implemented the same functionality as the patches in the PR provide.
Unlike the PR, this new code does honor the 'log count' in
newsyslog.conf so old logfiles are deleted. This new code does not
currently support never deleting the archived logfiles.
tuexen [Sun, 21 Nov 2010 11:08:22 +0000 (11:08 +0000)]
MFC r215249:
Add for existing protocol entries the missing SCTP port allocations
and add protocol entries for protocols which have SCTP port allocations.
These entries are according to
http://www.iana.org/assignments/port-numbers
as of today. Also add SCTP port allocation entires for the
echo, daytime, and chargen service.
Discussed with rwatson@
bschmidt [Sun, 21 Nov 2010 10:58:18 +0000 (10:58 +0000)]
MFC r199076:
The isr_intval in ieee80211req_scan_result structure should be 16 bit.
This makes ifconfig list scan display the correct beacon interval
(previously it would int overflow). As a side effect, this makes the
ieee80211req_scan_result word aligned.
Submitted by: Paul B Mahol <onemda at gmail.com>
Committed by: rpaulo
marius [Sun, 21 Nov 2010 00:50:29 +0000 (00:50 +0000)]
MFC: r215295
Let cryptosoft(4) add its pseudo-device with a specific unit number and its
probe method return BUS_PROBE_NOWILDCARD so it doesn't get attached to real
devices hanging off of nexus(4) with no specific devclass set. Actually, the
more desirable fix for this would be to get rid of the newbus interface of
cryptosoft(4) altogether but apparently crypto(9) was written with support
for cryptographic hardware in mind so that approach would require some KPI
breaking changes which don't seem worth it.
marius [Sun, 21 Nov 2010 00:45:18 +0000 (00:45 +0000)]
MFC: r215093
Enable reservation-based physical memory allocation. Even without the
creation of large page mappings in the pmap, it can provide modest
performance benefits. In particular, for a "buildworld" on a 2x 1GHz
Ultrasparc IIIi it reduced the wall clock time by 2.2% and the system
time by 12.6%.
tuexen [Sat, 20 Nov 2010 19:37:00 +0000 (19:37 +0000)]
MFC r214939:
Do not have the MTU table twice in the code. Therefore move the
function from the timer code to util, rename it appropriately and
also fix a bug in sctp_get_prev_mtu(), where calling it with a
value existing in the MTU table did not return a smaller one.
attilio [Sat, 20 Nov 2010 18:24:09 +0000 (18:24 +0000)]
Add a second fix-up for the PC98 case.
PC98 cases might be explicit in presence of a difference with i386
because both are defined, leading to mishandling of code in
circumstances like this.
bschmidt [Sat, 20 Nov 2010 13:12:59 +0000 (13:12 +0000)]
MFC r212853-212855:
Rewrite parts of the calibration code which is run while bringing up
the device:
- Group functions used for initial calibration.
- Unobscure some of the code by moving it into its own functions.
- Get rid of some magic numbers.
- Create similar structure as the reference driver has, this should
make further syncs easier.
bschmidt [Sat, 20 Nov 2010 12:28:24 +0000 (12:28 +0000)]
MFC r215289:
The ni_rctls checks are used to verify that a ratectl algo has set up
its internal data. This has been used to bypass missing calls in drivers
which do not use the ratectl framework correctly. Issue is, not all algos
use that variable, or even have internal data, therefore valid calls are
not done. Fix this by removing the checks, all driver issues should be
resolved.
bschmidt [Sat, 20 Nov 2010 12:26:31 +0000 (12:26 +0000)]
MFC r215244:
Some device drivers calculate various timing related things based on
the currently selected rate. The calculations of course need a valid
rate. To make that possible before any call to node_rate() is done,
initialize ni_txrate on none_node_init() calls.
bschmidt [Sat, 20 Nov 2010 12:24:26 +0000 (12:24 +0000)]
MFC r214894:
Instead of using the AMRR ratectl algo as default for drivers which have
the IEEE80211_C_RATECTL flag set, default to NONE for all drivers. Only if
a driver calls ieee80211_ratectl_init() check if the NONE algo is still
selected and try to use AMRR in that case. Drivers are still free to use
any other algo by calling ieee80211_ratectl_set() prior to the
ieee80211_ratectl_init() call.
After this change it is now safe to assume that a ratectl algo is always
available and selected, which renders the IEEE80211_C_RATECTL flag pretty
much useless. Therefore revert r211314 and 211546.
bschmidt [Sat, 20 Nov 2010 12:22:02 +0000 (12:22 +0000)]
MFC r207323:
When in the RUN -> AUTH -> RUN FSM transition happens, we'll call the
ratectl_node_init() functions and since ni_rtctls was already malloc'ed()
we will panic. Fix this by using the already malloc'ed pointer.
rstone [Sat, 20 Nov 2010 04:54:58 +0000 (04:54 +0000)]
MFC r212281 and 212282
In munmap() downgrade the vm_map_lock to a read lock before taking a read
lock on the pmc-sx lock. This prevents a deadlock with
pmc_log_process_mappings, which has an exclusive lock on pmc-sx and tries
to get a read lock on a vm_map. Downgrading the vm_map_lock in munmap
allows pmc_log_process_mappings to continue, preventing the deadlock.
Without this change I could cause a deadlock on a multicore 8.1-RELEASE
system by having one thread constantly mmap'ing and then munmap'ing a
PROT_EXEC mapping in a loop while I repeatedly invoked and stopped pmcstat
in system-wide sampling mode.
thompsa [Fri, 19 Nov 2010 21:04:18 +0000 (21:04 +0000)]
MFC r213853
- Add missing LibUSB API functions:
* libusb_strerror()
* libusb_get_driver[_np]()
* libusb_detach_kernel_driver[_np]()
- Factor out setting of non-blocking flag inside libusb.
- Add missing NULL check after libusb_get_device() call.
- Correct some wrong error codes due to copy and paste error.
PR: usb/150546
Submitted by: Robert Jenssen, Alexander Leidinger
jhb [Fri, 19 Nov 2010 17:08:15 +0000 (17:08 +0000)]
MFC 204352, 208028, 209266, 209399, 210723, 213672, 215046:
- Fixed static linkage.
- Document that mptutil/mpt do not support RAID volumes in excess of 2TB.
- Report subcommand handler errors so that tools that invoke mptutil can
robustly report errors.
- Save errno values before calling warn(3) so that errors are correctly
reported.
- Check for malloc() failures.
jhb [Fri, 19 Nov 2010 16:52:18 +0000 (16:52 +0000)]
MFC 214782:
Update startup_alloc() to support multi-page allocations and allow internal
zones whose objects are larger than a page to use startup_alloc(). This
allows allocation of zone objects during early boot on machines with a large
number of CPUs since the resulting zone objects are larger than a page.
jhb [Fri, 19 Nov 2010 16:24:12 +0000 (16:24 +0000)]
MFC 215001:
Only dump the values of the PMC and CMCI local vector table entries on a
local APIC if those LVT entries are valid. This quiets spurious illegal
register local APIC errors during boot on a CPU that doesn't support those
vectors.
o-----------------------------------------------------------------------
r207344 | jkim | 2010-04-29 01:25:27 +0300 (Thu, 29 Apr 2010) | 2 lines
Merge ACPICA 20100428.
o-----------------------------------------------------------------------
r209065 | jkim | 2010-06-11 22:58:41 +0300 (Fri, 11 Jun 2010) | 2 lines
Simplify a function for getting brightness levels.
o-----------------------------------------------------------------------
r209746 | jkim | 2010-07-06 23:57:28 +0300 (Tue, 06 Jul 2010) | 2 lines
Merge ACPICA 20100702.
o-----------------------------------------------------------------------
r209747 | jkim | 2010-07-07 00:41:08 +0300 (Wed, 07 Jul 2010) | 2 lines
Fix mis-merges in the previous commit.
o-----------------------------------------------------------------------
r210150 | jkim | 2010-07-16 02:24:06 +0300 (Fri, 16 Jul 2010) | 3 lines
If there is any pending sleep request, disallow entering S5 state.
Otherwise, bad things may happen. ;-)
o-----------------------------------------------------------------------
r210976 | jkim | 2010-08-07 02:11:19 +0300 (Sat, 07 Aug 2010) | 2 lines
Merge ACPICA 20100806.
o-----------------------------------------------------------------------
r211763 | mav | 2010-08-24 21:07:59 +0300 (Tue, 24 Aug 2010) | 4 lines
When ACPI reports current battery consumption rate in mAmps, print it also
in mWatts. Values in mAmps are not always suitable, because they depend on
battery voltage, which depends on battery type and charge level.
o-----------------------------------------------------------------------
r212761 | jkim | 2010-09-16 23:08:00 +0300 (Thu, 16 Sep 2010) | 2 lines
Merge ACPICA 20100915.
o-----------------------------------------------------------------------
r213772 | rpaulo | 2010-10-13 14:38:24 +0300 (Wed, 13 Oct 2010) | 3 lines
Mark acpi_bus_number() as __unused. This allows clang to this file
without any warnings.
o-----------------------------------------------------------------------
r213783 | jkim | 2010-10-13 19:30:41 +0300 (Wed, 13 Oct 2010) | 4 lines
Remove acpi_bus_number() completely. It had to be removed in r212761.
Pointed out by: jhb
o-----------------------------------------------------------------------
r213787 | jkim | 2010-10-13 20:06:25 +0300 (Wed, 13 Oct 2010) | 2 lines
Clean up unused headers.
o-----------------------------------------------------------------------
r213806 | jkim | 2010-10-14 00:37:02 +0300 (Thu, 14 Oct 2010) | 2 lines
Merge ACPICA 20101013.
o-----------------------------------------------------------------------
r214390 | jkim | 2010-10-26 21:59:50 +0300 (Tue, 26 Oct 2010) | 18 lines
Add two new loader tunables 'hw.acpi.install_interface' and
'hw.acpi.remove_interface'. hw.acpi.install_interface lets you install new
interfaces. Conversely, hw.acpi.remove_interface lets you remove OS
interfaces from the pre-defined list in ACPICA. For example,
hw.acpi.install_interface="FreeBSD"
lets _OSI("FreeBSD") method to return 0xffffffff (or success) and
hw.acpi.remove_interface="Windows 2009"
lets _OSI("Windows 2009") method to return zero (or failure). Both are
comma-separated lists and leading white spaces are ignored. For example,
the following examples are valid:
hw.acpi.install_interface="Linux, FreeBSD"
hw.acpi.remove_interface="Windows 2006, Windows 2006.1"
o-----------------------------------------------------------------------
r214401 | jkim | 2010-10-27 00:22:55 +0300 (Wed, 27 Oct 2010) | 3 lines
Document newly added loader tunables "hw.acpi.install_interface" and
"hw.acpi.remove_interface".
o-----------------------------------------------------------------------
r214765 | jkim | 2010-11-04 01:16:35 +0200 (Thu, 04 Nov 2010) | 4 lines
Adjust a comment to clarify why \_SB_ and \_TZ_ are defined as device type
in ACPICA. Reshuffle the code a bit to make sure this kludge only applies
to these two specical cases and to make it cleaner.
o-----------------------------------------------------------------------
r214848 | jkim | 2010-11-05 21:50:09 +0200 (Fri, 05 Nov 2010) | 13 lines
Fix a use-after-free bug for extended IRQ resource[1]. When _PRS buffer is
copied as a template for _SRS, a string pointer for descriptor name is also
copied and it becomes stale as soon as it gets de-allocated[2]. Now _CRS is
used as a template for _SRS as ACPI specification suggests if it is usable.
The template from _PRS is still utilized but only when _CRS is not available
or broken. To avoid use-after-free the problem in this case, however, only
mandatory fields are copied, optional data is removed, and structure length
is adjusted accordingly.
Reported by: hps[1]
Analyzed by: avg[2]
Tested by: hps
o-----------------------------------------------------------------------
r214849 | jkim | 2010-11-05 22:24:26 +0200 (Fri, 05 Nov 2010) | 2 lines
Add a forgotten change from the previous commit.
o-----------------------------------------------------------------------
r214998 | jkim | 2010-11-08 21:52:14 +0200 (Mon, 08 Nov 2010) | 2 lines
Consistently use padding `_' in the comment.
o-----------------------------------------------------------------------
- Allocate memory for wakeup code after ACPI bus is attached. The early
memory allocation hack was inherited from i386 but amd64 does not need it.
- Exclude real mode IVT and BDA explicitly. Improve comments about memory
allocation and reason for the exclusions. It is a no-op in reality, though.
- Remove an unnecessary CLD from wakeup code and re-align.
Introduce the x86 kernel interfaces to allow kernel code to use
FPU/SSE hardware. Caller should provide a save area that is chained
into the stack of the areas; pcb save_area for usermode FPU state is
on top. The pcb now contains a pointer to the current FPU saved area,
used during FPUDNA handling and context switches. There is also a
facility to allow the kernel thread to use pcb save_area.
Change the dreaded warnings "npxdna in kernel mode!" into the panics
when FPU usage is not registered.
Use the fpu_kern_enter() interface to properly separate usermode FPU
context from in-kernel execution of padlock instructions and to handle
spurious FPUDNA exceptions that sometime are raised when doing padlock
calculations.
Remove unused i586 optimized bcopy/bzero/etc implementations that utilize
FPU registers for copying. Remove the switch table and jumps from
bcopy/bzero/... to the actual implementation.
As a side-effect, i486-optimized bzero is removed.
Remove the support for int13 FPU exception reporting on i386. It is
believed that all 486-class CPUs FreeBSD is capable to run on, either
have no FPU and cannot use external coprocessor, or have FPU on the
package and can use #MF.
After the FPU use requires #MF working due to INT13 FPU exception handling
removal, MFi386 r209198:
Use critical sections instead of disabling local interrupts to ensure
the consistency between PCPU fpcurthread and the state of FPU.
Re-implement FPU suspend/resume for amd64. This removes superfluous uses
of critical_enter(9) and critical_exit(9) by fpugetregs() and fpusetregs().
Also, we do not touch PCB flags any more.
Fix another fallout from r208833. savectx() is used to save CPU context
for crash dump (dumppcb) and kdb (stoppcbs). For both cases, there cannot
have a valid pointer in pcb_save. This should restore the previous
behaviour.
- Merge savectx2() with savectx() and struct xpcb with struct pcb. [1]
savectx() is only used for panic dump (dumppcb) and kdb (stoppcbs). Thus,
saving additional information does not hurt and it may be even beneficial.
Unfortunately, struct pcb has grown larger to accommodate more data.
Move 512-byte long pcb_user_save to the end of struct pcb while I am here.
- savectx() now saves FPU state unconditionally and copy it to the PCB of
FPU thread if necessary. This gives panic dump and kdb a chance to take
a look at the current FPU state even if the FPU is "supposedly" not used.
- Resuming CPU now unconditionally reinitializes FPU. If the saved FPU
state was irrelevant, it could be in an unknown state.
savectx() has not been used for fork(2) for about 15 years. [1]
Do not clobber FPU thread's PCB as it is more harmful. When we resume CPU,
unconditionally reload FPU state.
mav [Fri, 19 Nov 2010 09:25:12 +0000 (09:25 +0000)]
MFC r209683 by imp:
Add a safety-belt. If the identified disk has 0 blocks, don't attach
it. This can happen in some cases when plugging in SD/SmartCard PC
Cards with empty slots. It is better to detect this bogosity, and
refuse to attach rather than panic with a division by zero (in one of
many places) down stream.