mav [Tue, 29 Jan 2013 17:45:05 +0000 (17:45 +0000)]
MFC r245444:
Alike to r242314 for GRAID make GRAID3 more aggressive in marking volumes
as clean on shutdown and move that action from shutdown_pre_sync stage to
shutdown_post_sync to avoid extra flapping.
ZFS tends to not close devices on shutdown, that doesn't allow GEOM RAID3
to shutdown gracefully. To handle that, mark volume as clean just when
shutdown time comes and there are no active writes.
mav [Tue, 29 Jan 2013 17:20:49 +0000 (17:20 +0000)]
MFC r245443:
Alike to r242314 for GRAID make GMIRROR more aggressive in marking volumes
as clean on shutdown and move that action from shutdown_pre_sync stage to
shutdown_post_sync to avoid extra flapping.
ZFS tends to not close devices on shutdown, that doesn't allow GEOM MIRROR
to shutdown gracefully. To handle that, mark volume as clean just when
shutdown time comes and there are no active writes.
pfg [Tue, 29 Jan 2013 01:44:13 +0000 (01:44 +0000)]
MFC r245820, r245844, r245950:
ext2fs: make some inode fields match the ext2 spec.
Ext2fs uses unsigned fields in its dinode struct.
FreeBSD can have negative values in some of those
fields and the inode is meant to interact with the
system so we have never respected the unsigned
nature of most of those fields.
Block numbers and the generation number do
not need to be signed so redefine them as
unsigned to better match the on-disk information.
Include some fixes proposed by bde@.
While here add a lot of svn mergeinfo that was missing
in /sys:
imp [Mon, 28 Jan 2013 23:16:47 +0000 (23:16 +0000)]
MFC: r245314 and r245315:
r245315 | imp | 2013-01-11 14:42:23 -0700 (Fri, 11 Jan 2013) | 4 lines
Pass the device_t into atkbd_{probe,attach}_unit and get the
controller unit and keyboard unit from there. It will be needed
for other things in the future as well...
imp [Mon, 28 Jan 2013 22:50:54 +0000 (22:50 +0000)]
Add notes for breakage points for traditional building of the kernel
as a guide to others. buildkernel, etc was not broken at these points,
so document that as well.
marius [Mon, 28 Jan 2013 00:31:32 +0000 (00:31 +0000)]
MFC: r245923
- Check the return value of taskqueue_start_threads().
- At least the Saturn chips of 501-6738 cards need a delay after freezing
the external GMII pins before the internal PHY is accessible again. So
wait a bit after (un)freezing these. Also don't touch the other bits of
that configuration register. [1]
- Take advantage of nitems().
marius [Sun, 27 Jan 2013 23:21:47 +0000 (23:21 +0000)]
MFC: r245850
Revert the part of r239864 (MFC'ed to stable/9 in r241681) which removed
obtaining the SMP mutex around reading registers from other CPUs. As it
turns out, the hardware doesn't really like concurrent IPI'ing causing
adverse effects. Also the thought deadlock when using this spin lock here
and the targeted CPU(s) are also holding or in case of nested locks can't
actually happen. This is due to the fact that on sparc64, spinlock_enter()
only raises the PIL but doesn't disable interrupts completely. Thus direct
cross calls as used for the register reading (and all other MD IPI needs)
still will be executed by the targeted CPU(s) in that case.
marius [Sun, 27 Jan 2013 23:02:33 +0000 (23:02 +0000)]
MFC: r244991
- Replace partially incorrect function names in panic(9) strings with
__func__ and add some missing ones.
- Remove a stale comment.
- Remove unused NUM_ELEMENTS macro.
- Remove extra empty lines.
- Use DEVMETHOD_END.
- Use NULL rather than 0 for pointers.
marius [Sun, 27 Jan 2013 22:59:59 +0000 (22:59 +0000)]
MFC: r244990
- Fix !SMP build.
- Replace incorrect function names in printf(9) strings with __func__.
- Make xctrl_shutdown_reasons table const.
- Use nitems() rather than rolling an own version.
- Use DEVMETHOD_END.
- Use NULL rather than 0 for pointers.
marius [Sun, 27 Jan 2013 17:38:29 +0000 (17:38 +0000)]
Revert r237842 (MFC'ed to stable/9 in r238012) and switch back to
SCHED_ULE. All problems I encountered with the latter have been
fixed with r241780 (MFC'ed to stable/9 in r245981).
marius [Sun, 27 Jan 2013 16:49:11 +0000 (16:49 +0000)]
MFC: 241780
- Give PIL_PREEMPT the lowest priority just above low/stray interrupts.
The reason for this is that the SPARC v9 architecture allows nested
interrupts of higher priority/level than that of the current interrupt
to occur (and we can't just entirely bypass this model, also, at least
for tick interrupts, this also wouldn't be wise). However, when a
preemption interrupt interrupts another interrupt of lower priority,
f.e. PIL_ITHREAD, and that one in turn is nested by a third interrupt,
f.e. PIL_TICK, with SCHED_ULE the execution of interrupts higher than
PIL_PREEMPT may be migrated to another CPU. In particular, tl1_ret(),
which is responsible for restoring the state of the CPU prior to entry
to the interrupt based on the (also migrated) trap frame, then is run
on a CPU which actually didn't receive the interrupt in question,
causing an inappropriate processor interrupt level to be "restored".
In turn, this causes interrupts of the first level, i.e. PIL_ITHREAD
in the above scenario, to be blocked on the target of the migration
until the correct PIL happens to be restored again on that CPU again.
Making PIL_PREEMPT the lowest real priority, this effectively prevents
this scenario from happening, as preemption interrupts no longer can
interrupt any other interrupt besides stray ones (which is no issue).
Thanks to attilio@ and especially mav@ for helping me to understand
this problem at the 201208DevSummit.
- Give PIL_STOP (which is also used for IPI_STOP_HARD, given that there's
no real equivalent to NMIs on SPARC v9) the highest possible priority
just below the hardwired PIL_TICK, so it has a chance to interrupt
more things.
delphij [Sat, 26 Jan 2013 05:20:09 +0000 (05:20 +0000)]
MFC r245768:
- Don't include date and time the driver is built, this is useful for
generating binary diffs.
- Constify a few strings used in the driver.
- Style changes to make the driver compile with default clang settings.
yongari [Thu, 24 Jan 2013 02:19:38 +0000 (02:19 +0000)]
MFC r244482:
Recognize 5720S PHY and treat it as 5708S PHY.
Unfortunately 5720S uses 5709S PHY id so add a hack to detect 5720S
PHY by checking parent device name. 5720S PHY does not support 2500SX.
gjb [Thu, 24 Jan 2013 01:40:47 +0000 (01:40 +0000)]
MFC r240252, r241541, r241543, r245756:
r240252: (eadler)
- Remove documentation and www cvsup files as they are no longer
useful with the switch to subversion.
r241541: (joel)
- Minor mdoc improvements. Also remove unnecessary csup reference.
r241543: (eadler)
- Bump .Dd
r245756:
- Mark SUP_UPDATE as deprecated in make.conf(5), providing
instructions to use SVN_UPDATE or freebsd-update(8).
- While here, remove bogus NO_WWWUPDATE.
mav [Tue, 22 Jan 2013 17:06:42 +0000 (17:06 +0000)]
MFC r244146:
Add IDs for SATA controllers on AMD Hudson-2 series chipsets.
I am not exactly sure about the naming due to lack of specs on AMD site,
but it is better to have some identification then none at all.
mav [Tue, 22 Jan 2013 17:05:26 +0000 (17:05 +0000)]
MFC r241402:
Add checks for ata_sata_scr_read() return statuses. It is mostly to silence
Clang Static Analyzer warnings as errors there are usually unlikely.
scottl [Tue, 22 Jan 2013 07:40:38 +0000 (07:40 +0000)]
MFC r243018:
- Fix a truncation bug with softdep journaling that could leak blocks on
crash. When truncating a file that never made it to disk we use the
canceled allocation dependencies to hold the journal records until
the truncation completes. Previously allocdirect dependencies on
the id_bufwait list were not considered and their journal space
could expire before the bitmaps were written. Cancel them and attach
them to the freeblks as we do for other allocdirects.
- Add KTR traces that were used to debug this problem.
- When adding jsegdeps, always use jwork_insert() so we don't have more
than one segdep on a given jwork list.
scottl [Tue, 22 Jan 2013 07:38:43 +0000 (07:38 +0000)]
MFC r243017:
- blk_equals() is too strict. If the journal entry defines more frags
than we're claiming it should still be considered an exact match. This
would previously leak frags that had been extended.
- If there is a sequence number problem in the journal print the sequence
numbers we've seen so far for debugging.
- Clean up the block mask related debuging printfs. Some are redundant.
scottl [Tue, 22 Jan 2013 07:22:58 +0000 (07:22 +0000)]
MFC r242924:
- Fix a bug that has existed since the original softdep implementation.
When a background copy of a cg is written we complete any work associated
with that bmsafemap. If new work has been added to the non-background
copy of the buffer it will be completed before the next write happens.
The solution is to do the rollbacks when we make the copy so only those
dependencies that were present at the time of writing will be completed
when the background write completes. This would've resulted in various
bitmap related corruptions and panics. It also would've expired journal
entries early causing journal replay to miss some records.
scottl [Tue, 22 Jan 2013 07:18:33 +0000 (07:18 +0000)]
MFC r242734, 242815:
- Implement BIO_FLUSH support around journal entries. This will not 100%
solve power loss problems with dishonest write caches. However, it
should improve the situation and force a full fsck when it is unable
to resolve with the journal.
- Resolve a case where the journal could wrap in an unsafe way causing
us to prematurely lose journal entries in very specific scenarios.
- Correct rev 242734, segments can sometimes get stuck. Be a bit more
defensive with segment state.
scottl [Tue, 22 Jan 2013 07:10:26 +0000 (07:10 +0000)]
MFC r242492:
- In cancel_mkdir_dotdot don't panic if the inodedep is not available. If
the previous diradd had already finished it could have been reclaimed
already. This would only happen under heavy dependency pressure.
hselasky [Mon, 21 Jan 2013 07:28:46 +0000 (07:28 +0000)]
MFC r245248:
Fix detection of Razer Copperhead as a USB mouse.
Factor out USB mouse and keyboard detection logic.
Reject USB keyboards which have mouse alike HID items
in their HID descriptors.
hselasky [Mon, 21 Jan 2013 07:25:38 +0000 (07:25 +0000)]
MFC r245132 and r245175:
Optimise the XHCI interrupt handling.
This patch will save CPU time when the XHCI interrupt is
shared with other devices.
Only check event rings when interrupt bits are set.
Otherwise would indicate hiding possible hardware fault(s).
hselasky [Mon, 21 Jan 2013 07:22:45 +0000 (07:22 +0000)]
MFC r243780:
- Add support for Etron EJ168 USB 3.0 Host Controllers.
This brand of controllers expects that the number of
contexts specified in the input slot context points
to an active endpoint context, else it refuses to
operate.
kib [Sat, 19 Jan 2013 06:17:27 +0000 (06:17 +0000)]
MFC r245072:
Do not round up the size of the UFS filesystem to the fragment size
when comparing its size with the size of the media, to determine if
the last disk block is unused.
pluknet [Fri, 18 Jan 2013 08:27:12 +0000 (08:27 +0000)]
MFC r245268:
The Giant lock is no longer used in the vm_map(9) part of the VM.
While here, document that the process lock is acquired in vm_map_stack, too.
ume [Thu, 17 Jan 2013 16:39:21 +0000 (16:39 +0000)]
MFC r245230: Add no_prefer_iface option.
It stops treating the address on the interface as special by source
address selection rule even when the interface is outgoing interface.
This is desired in some situation.
brooks [Tue, 15 Jan 2013 16:41:52 +0000 (16:41 +0000)]
MFC r244557:
Add libnetbsd, a thin compatibility layer intended to allow a limited
set of NetBSD software to compile as part of the FreeBSD build with
little or no modification. It is built as a static library and not
installed for general use. Likewise, its header files are not
installed.
bapt [Tue, 15 Jan 2013 09:14:18 +0000 (09:14 +0000)]
MFC r244553,244594,244608,244639
In preparation for making 'pkg -N' the one true method of determining
whether a system has been configured to use pkgng, cause /usr/sbin/pkg
recognise a -n option and exit with a failure code when the pkg port
is not installed
dim [Tue, 15 Jan 2013 07:41:50 +0000 (07:41 +0000)]
Revert the MFC to sys/dev/ath/ath_hal/ar9002/ar9285_attach.c again,
since it does not compile on stable/9. During testing, I had a
different local fix, so I failed to notice this did not work. Apologies
for the breakage.
brooks [Mon, 14 Jan 2013 22:00:43 +0000 (22:00 +0000)]
MFC r244401,245305,245308:
Replace our implementation of the vis(3) and unvis(3) APIs with
NetBSD's. This output size limited versions of vis and unvis functions
as well as a set of vis variants that allow arbitrary characters to be
specified for encoding.
Finally, MIME Quoted-Printable encoding as described in RFC 2045 is
supported.
dim [Mon, 14 Jan 2013 20:26:50 +0000 (20:26 +0000)]
Use a direct commit to fix a minor mistake in r245431, before it spreads
too far: use the correct FreeBSD version in clang's target triple. That
is, $ARCH-unknown-freebsd9.1 instead of $ARCH-unknown-freebsd9.2.
This will be bumped again for the 9.2 release, when it branches off.
zont [Mon, 14 Jan 2013 10:58:55 +0000 (10:58 +0000)]
MFC r244384:
- Fix locked memory accounting for maps with MAP_WIREFUTURE flag.
- Add sysctl vm.old_mlock which may turn such accounting off.
MFC r244385:
- Add sysctl to allow unprivileged users to call mlock(2)-family system
calls and turn it off for compatibility.
- Do not allow to call them inside jail.
zont [Mon, 14 Jan 2013 10:58:20 +0000 (10:58 +0000)]
MFC r244383:
- Set memorylocked limit to 64Kb for default login class.
This prevents unprivileged users to lock too much memory.
- Set memorylocked limit to 64Mb for daemon login class.
Some daemons such as amd(8) and watchdogd(8) calls mlockall(2) on
startup, they are run from init(8) which uses daemon login class.
- Set memorylocked limit to unlimited for root login class.
bapt [Sun, 13 Jan 2013 22:37:45 +0000 (22:37 +0000)]
MFC: r243883
if PACKAGESITE url scheme is not 'file://', always try to revolv SRV records and
use them if any. It allows the bootstrap to use directly pkg.FreeBSD.org instead
of pkgbeta.FreeBSD.org
dim [Sun, 13 Jan 2013 20:35:08 +0000 (20:35 +0000)]
MFC r245272:
Add an ugly hack to libgcc's unwind code, to make it behave properly at
runtime on amd64, when it is compiled by clang. Some versions of clang
don't save and restore all callee registers, if a __builtin_eh_return()
intrinsic is used in a function. This is particularly bad on amd64.
Until the problem gets fixed by upstream, use an asm statement to force
clang to assume the registers in question are clobbered, when invoking
__builtin_eh_return(), so it will emit code to save and restore them.
This should fix the crashes reported on -current with some C++ programs,
particularly those that throw exceptions over multiple function
boundaries.
markj [Sun, 13 Jan 2013 04:14:46 +0000 (04:14 +0000)]
MFC r244995 r244996 r244997.
MFC r244995:
Fix a typo in an error message.
MFC r244996:
Have -n imply -r, since dry-run mode obviously doesn't require root
privileges.
MFC r244997:
Make sure to update the mtime of a logfile after archiving it. This
ensures that the next rotation happens at the correct time when using
interval-based rotations.