rmacklem [Mon, 25 Oct 2010 17:05:14 +0000 (17:05 +0000)]
MFC: r213712
Try and make the nfsrv_localunlock() function in the experimental
NFSv4 server more readable. Mostly changes to comments, but a
case of >= is changed to >, since == can never happen. Also, I've
added a couple of KASSERT()s and a slight optimization, since
once the "else if" case happens, subsequent locks in the list can't
have any effect. None of these changes fixes a known bug.
avg [Mon, 25 Oct 2010 07:58:37 +0000 (07:58 +0000)]
stable/8: add options KDB and KDB_TRACE to GENERIC kernels
Now that we have code for printing a stack trace on panic using stack(9)
facility without any debugger backend configured, use this ability
in GENERIC kernels to slightly increase amount of debugging information
available in default installations.
This change should not break anything for those who include GENERIC into
a custom kernel config file and have the above options already enabled.
They should only get a warning about duplicate options.
This commit should not change behavior of GENERIC kernels for panics and
traps with respect to core dumping and automatic reset.
As no debugger backend is configured, enter-to-debugger key combination
should still be ignored.
With this commit the sizes of GENERIC kernels increase by one to two KB.
yongari [Sun, 24 Oct 2010 21:28:58 +0000 (21:28 +0000)]
MFC r213696:
Do not setup interrupt endpoint for axe(4).
It seems axe(4) controllers support interrupt endpoint such that
enabling interrupt endpoint generates about 1000 interrupts/sec.
Controllers transfer 8 bytes data through interrupt endpoint and
the data include link UP/DOWN state as well as some PHY related
information. Previously axe(4) didn't use the transferred data and
didn't even try to read the data. Because axe(4) counts on mii(4)
to detect link state changes there is no need to use interrupt
endpoint here.
This change fixes generation of unnecessary interrupts which was
seen when interface is brought to UP.
yongari [Sun, 24 Oct 2010 21:26:41 +0000 (21:26 +0000)]
MFC r213438:
RX buffer allocation failure is not an input error. Controller
successfully received a frame but we failed to pass it to upper
stack due to lack of resources. So update if_iqdrops counter
instead of updating if_ierrors counter.
yongari [Sun, 24 Oct 2010 21:22:00 +0000 (21:22 +0000)]
MFC r213423:
Move updating TX packet counter to the inside of send loop. axe(4)
controllers combine multiple TX requests into single one if there
is room in TX buffer of controller. Updating TX packet counter at
the end of TX completion resulted in incorrect TX packet counter as
axe(4) thought it sent 1 packet. There is no easy way to know how
many combined TX were completed in the callback.
Because this change updates TX packet counter before actual
transmission, it may not be ideal one. But I believe it's better
than showing fake 8kpps under high TX load. With this change, TX
shows 221kpps on Linksus USB200M.
yongari [Sun, 24 Oct 2010 21:14:01 +0000 (21:14 +0000)]
MFC r213844:
Make sure to not use stale ip/tcp header pointers. The ip/tcp
header parser uses m_pullup(9) to get access to mbuf chain.
m_pullup(9) can allocate new mbuf chain and free old one if the
space left in the mbuf chain is not enough to hold requested
contiguous bytes. Previously drivers can use stale ip/tcp header
pointer if m_pullup(9) returned new mbuf chain.
Reported by: Andrew Boyer (aboyer <> averesystems dot com)
marius [Sun, 24 Oct 2010 13:39:19 +0000 (13:39 +0000)]
MFC: r213364
- In the spirit of previous simplifications factor out the checks for a
different PHY instance being selected and isolation out into the wrappers
around the service methods rather than duplicating them over and over
again (besides, a PHY driver shouldn't need to care about which instance
it actually is).
- Centralize the check for the need to isolate a non-zero PHY instance not
supporting isolation in mii_mediachg() and just ignore it rather than
panicing, which should sufficient given that a) things are likely to
just work anyway if one doesn't plug in more than one port at a time and
b) refusing to attach in this case just leaves us in a unknown but most
likely also not exactly correct configuration (besides several drivers
setting MIIF_NOISOLATE didn't care about these anyway, probably due to
setting this flag for no real reason).
- Minor fixes like removing unnecessary setting of sc->mii_anegticks,
using sc->mii_anegticks instead of hardcoded values etc.
pjd [Sat, 23 Oct 2010 21:56:50 +0000 (21:56 +0000)]
Implement G_TYPE_MULTI and G_VAL_OPTIONAL for stable/8.
This should have been MFC, but I've no green light from marcel to remove
G_TYPE_ASCNUM and gc_argname and to modify geom_part in stable/8, so this is
reimplementation that doesn't touch gpart and hopefully doesn't break anything.
jilles [Sat, 23 Oct 2010 13:36:09 +0000 (13:36 +0000)]
MFC r213926: sh(1): Clarify subshells/processes for pipelines.
For multi-command pipelines,
1. all commands are direct children of the shell (unlike the original
Bourne shell)
2. all commands are executed in a subshell (unlike the real Korn shell)
yongari [Sat, 23 Oct 2010 00:41:26 +0000 (00:41 +0000)]
MFC r214089:
Correct handling of shared interrupt in sis_intr(). r212116 incorrectly
released a drver lock for shared interrupt case such that it caused
panic. While I'm here check whether driver is still running before
serving TX/RX handler.
Reported by: Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au >
Tested by: Jerahmy Pocott < QUAKENET1 <> optusnet dot com dot au >
obrien [Thu, 21 Oct 2010 23:45:57 +0000 (23:45 +0000)]
MFC r213814: Do not assume in growstackstr() that a "precious" character
will be immediately written into the stack after the call. Instead let
the caller manage the "space left".
delphij [Wed, 20 Oct 2010 17:42:10 +0000 (17:42 +0000)]
MFC r212100 (emaste),213632,214066:
Add a new syslog knob, net.link.lagg.failover_rx_all, to control
whether to accept input packets on any link in a failover lagg,
and add the corresponding documentation.
maxim [Wed, 20 Oct 2010 12:38:05 +0000 (12:38 +0000)]
MFC r211992: some programs could send broadcast/multicast traffic to
ipfw pseudo-interface. This leads to a panic due to uninitialized
if_broadcastaddr address. Initialize it and implement ip_output()
method to prevent mbuf leak later.
obrien [Wed, 20 Oct 2010 07:54:43 +0000 (07:54 +0000)]
MFC:
r213774: DEBUG_FLAGS should be used to enable extra debugging rather than
frobbing CFLAGS directly.
r213798: do not inline static functions if debugging
bz [Wed, 20 Oct 2010 01:22:04 +0000 (01:22 +0000)]
MFC r213929:
lltable_drain() has never been used so far, thus #if 0 it for now.
While touching it add the missing locking to the now disabled code
for the time when we'll resurrect it.
jilles [Tue, 19 Oct 2010 22:11:50 +0000 (22:11 +0000)]
MFC r213326: libc: Remove the i386 assembler version of strlen(3).
On anything modern, the C version, which processes a word at a time, is much
faster. The Intel optimization manual explicitly warns against using REP
prefixes with SCAS or CMPS, which is exactly what the assembler version
does.
A simple test on a Phenom II showed the C version, compiled with -O2, to be
about twice as fast determining the length of 100000 strings between 0 and
255 bytes long.
edwin [Tue, 19 Oct 2010 21:04:45 +0000 (21:04 +0000)]
MFC of r207830
strptime(3) confused July with June with the fr_FR locale.
When parsing the month "juillet" (abbr "jul"), %B recognized it as
"juin" (abbr "jui") because the full name of the month names is
checked at the same time as the abbrevation.
The new behaviour checks the full names first before checking the
abbrevation names.
pluknet [Tue, 19 Oct 2010 14:09:17 +0000 (14:09 +0000)]
MFC r213574:
- tcpconnect incorrectly uses err() in usage() with errx() semantics [1]
- 64-bit aware fixes in printf() usage [2]
o netrate/juggle: time_t has arch-dependent size
o netrate/tcpconnect: don't assume %ll has always 64bit.
obrien [Mon, 18 Oct 2010 23:10:32 +0000 (23:10 +0000)]
MFC:
r199955: disable job control when running 'sh -i' in the testsuite
r204801: make sure to popredir() even if a special builtin caused an error
r204802: make sure to popredir() even if a function caused an error
r211399: get rid of unnecessary non-standard empty lists.
r211609: add a test for breaking from a loop outside the current function
r211622: test that all bytes from 128 to 255 can be used in IFS
r211973: weaken builtins/command4 test to only require a non-0 exit status
pjd [Mon, 18 Oct 2010 09:26:39 +0000 (09:26 +0000)]
MFC r212382,r212383,r212384,r212387:
r212382:
Remove duplicated code.
r212383:
Allow to boot from a pool within which replacing is in progress.
Before the change it wasn't possible and the following error was printed:
ZFS: can only boot from disk, mirror or raidz vdevs
Now if the original vdev (the one we are replacing) is still present we will
read from it, but if it is not present we won't read from the new vdev, as it
might not have enough valid data yet.
mm [Mon, 18 Oct 2010 08:54:33 +0000 (08:54 +0000)]
MFC r213197, r213198:
MFC r213197:
Enable offlining of log devices.
OpenSolaris revision and Bug IDs:
9701:cc5b64682e64 6803605 should be able to offline log devices 6726045 vdev_deflate_ratio is not set when offlining a log device 6599442 zpool import has faults in the display
MFC r213198:
Properly handle IO with B_FAILFAST
Retry IO once with ZIO_FLAG_TRYHARD before declaring a pool faulted
As FreeBSD does not support B_FAILFAST and we don't use vdev_disk.c,
MFC of r213198 is a no-op with the purpose of diff reduction against
latest ZFS code and making future updates easier.
pjd [Sun, 17 Oct 2010 20:10:00 +0000 (20:10 +0000)]
MFC r213133,r213135,r213136,r213137,r213245:
r213133:
Add three GPT attributes:
GPT_ENT_ATTR_BOOTME - this is bootable partition
GPT_ENT_ATTR_BOOTONCE - try to boot only once from this partition
GPT_ENT_ATTR_BOOTFAILED - set this flag if we cannot boot from partition
containing GPT_ENT_ATTR_BOOTONCE flag; note that if we cannot
boot from partition that contains only GPT_ENT_ATTR_BOOTME flag,
the GPT_ENT_ATTR_BOOTFAILED flag won't be set
According to wikipedia Microsoft TechNet says that attributes are divided into
two halves: the lower 4 bytes representing partition independent attributes,
and the upper 4 bytes are partition type dependent. Microsoft is already using
bits 60 (read-only), 62 (hidden) and 63 (do not automount) and I'd like to not
collide with those, so we are using bit 59 (bootme), 58 (bootonce) and 57
(bootfailed).
Allow to configure GPT attributes. It shouldn't be allowed to set bootfailed
attribute (it should be allowed only to unset it), but for test purposes it
might be useful, so the current code allows it.
- Teach gptboot and gptzfsboot about new files. I haven't touched the
rest, but there is still a lot of code duplication to be removed.
- Implement full GPT support. Currently we just read primary header and
partition table and don't care about checksums, etc. After this change we
verify checksums of primary header and primary partition table and if
there is a problem we fall back to backup header and backup partition
table.
- Clean up most messages to use prefix of boot program, so in case of an
error we know where the error comes from, eg.:
gptboot: unable to read primary GPT header
- If we can't boot, print boot prompt only once and not every five
seconds.
- Honour newly added GPT attributes:
bootme - this is bootable partition
bootonce - try to boot from this partition only once
bootfailed - we failed to boot from this partition
- Change boot order of gptboot to the following:
1. Try to boot from all the partitions that have both 'bootme'
and 'bootonce' attributes one by one.
2. Try to boot from all the partitions that have only 'bootme'
attribute one by one.
3. If there are no partitions with 'bootme' attribute, boot from
the first UFS partition.
- The 'bootonce' functionality is implemented in the following way:
1. Walk through all the partitions and when 'bootonce'
attribute is found without 'bootme' attribute, remove
'bootonce' attribute and set 'bootfailed' attribute.
'bootonce' attribute alone means that we tried to boot from
this partition, but boot failed after leaving gptboot and
machine was restarted.
2. Find partition with both 'bootme' and 'bootonce' attributes.
3. Remove 'bootme' attribute.
4. Try to execute /boot/loader or /boot/kernel/kernel from that
partition. If succeeded we stop here.
5. If execution failed, remove 'bootonce' and set 'bootfailed'.
6. Go to 2.
If whole boot succeeded there is new /etc/rc.d/gptboot script coming
that will log all partitions that we failed to boot from (the ones with
'bootfailed' attribute) and will remove this attribute. It will also
find partition with 'bootonce' attribute - this is the partition we
booted from successfully. The script will log success and remove the
attribute.
All the GPT updates we do here goes to both primary and backup GPT if
they are valid. We don't touch headers or partition tables when
checksum doesn't match.
Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
r213137:
Add gptboot script that is responsible for:
- looking for partition with 'bootonce' attribute alone (without 'bootme'
attribute), removing it and logging that we successfully booted from this
partition.
- looking for partitions with 'bootfailed' attribute, removing it and
logging that we failed to boot from this partition.
Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>)
Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com
r213245:
Document recently added GPT attributes (bootme, bootonce, bootfailed) and
list other schemes attributes.
glebius [Sun, 17 Oct 2010 17:39:54 +0000 (17:39 +0000)]
Merge from head 213480,213481,213717:
Add support to Alcatel/TCTMobile X080S USB 3G modem. The device needs
special eject command to reappear as modem. It also requires DIR_IN flag
in the command message, so we supply some dummy data along with the command.
hook_check() is now only used to report about long-running hooks, so the
argument is redundant, remove it.
r213430:
Decrease report interval to 5 seconds, as this also means we will check for
signals every 5 seconds and not every 10 seconds as before.
r213529:
Don't close local component on exit as we can hang waiting on g_waitidle.
I'm unable to reproduce the race described in comment anymore and also the
comment is incorrect - localfd represents local component from configuration
file, eg. /dev/da0 and not HAST provider.
Log error message when we fail to destroy ggate provider.
r213533:
Clear ggate structures before using them. We don't initialize all the field
and there can be some garbage from the stack.
r213579:
We close the event socketpair early in the mainloop to prevent spaming with
error messages, so when we clean up after child process, we have to check if
the event socketpair is still there.
glebius [Sun, 17 Oct 2010 15:25:33 +0000 (15:25 +0000)]
Merge 213831:
Enable the shared memory reference clock driver. The GPS devices are
getting more and more popular, as source of precise time, and the gpsd
daemon from ports is using the shared memory to synchronize with ntpd.
nwhitehorn [Sun, 17 Oct 2010 15:22:59 +0000 (15:22 +0000)]
MFC r213307,213335:
Add support for memory attributes (pmap_mapdev_attr() and friends) on
PowerPC/AIM. This is currently stubbed out on Book-E, since I have no
idea how to implement it there.
marius [Sun, 17 Oct 2010 14:25:55 +0000 (14:25 +0000)]
MFC: r213868
- In the spirit of r212559 add a comment describing what will eventually
lower the PIL.
- Just as with the AP ensure that the (S)TICK timer(s) are in a known
state when starting BSPs.
marius [Sun, 17 Oct 2010 13:41:09 +0000 (13:41 +0000)]
MFC: r213578
In the replacement text of the __bswapN_const() macros cast the argument
to the expected type so they work like the corresponding __bswapN_var()
functions and the compiler doesn't complain when arguments of different
width are passed.
marius [Sun, 17 Oct 2010 11:51:55 +0000 (11:51 +0000)]
MFC: r213873
Explicitly lower the PIL to 0 as part of enabling interrupts, similar to
what is done on other platforms. Unlike as with the sched_throw(NULL)
called on BSPs during their startup apparently there's nothing which will
reliably lower it on APs. I'm unsure why this only came up on V215 though,
breaking these with r207248. My best guess is that these are the only
supported ones so far fast enough to lose some race.
kib [Sat, 16 Oct 2010 08:43:23 +0000 (08:43 +0000)]
MFC r213359:
Release the vnode lock and close the linker file vnode earlier in the
linker_load_file methods. This prevents the LOR between kernel linker sx
xlock and vnode lock.
kib [Fri, 15 Oct 2010 17:56:51 +0000 (17:56 +0000)]
MFC r209862:
For both i386 and amd64 pmap,
- change the type of pm_active to cpumask_t, which it is;
- in pmap_remove_pages(), compare with PCPU(curpmap), instead of
dereferencing the long chain of pointers [1].
For amd64 pmap, remove the unneeded checks for validity of curpmap
in pmap_activate(), since curpmap should be always valid after
r209789.