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.
alc [Fri, 15 Oct 2010 05:42:35 +0000 (05:42 +0000)]
MFC r209605
Improve bufdone_finish()'s handling of the bogus page. Specifically, if
one or more mappings to the bogus page must be replaced, call pmap_qenter()
just once. Previously, pmap_qenter() was called for each mapping to the
bogus page.
MFC r209902
Change the implementation of vm_hold_free_pages() so that it performs at
most one call to pmap_qremove(), and thus one TLB shootdown, instead of one
call and TLB shootdown per page.
edwin [Fri, 15 Oct 2010 05:17:48 +0000 (05:17 +0000)]
MFC of r204697 r204706 r204849 r204908 r205071 r205427 r212032
r212032:
Use basename(3) to determine the name of the program.
Submitted by: Alexander Best <arundel@>
r205427:
Replace -b with -C and -B (as proposed by Alexander).
Add -3, -A and -B to the usage.
Update regression test for the new parameters.
r205071:
- With the introduction of -A, -B and -3, not all combinations of
arguments makes sense anymore. For example, what would a combination
of -3 (show three months) and -y (show the whole year) do?
We will abort on these cases.
- Move the debug option -d to -H (from highlight), while -d is now
used for setting the day of "today" so that -y and friends can
be tested.
r204908:
- Fix the highlighting for non-terminals when the last week is not
7 days long.
- "-m <N> <YYYY>" now prints only the month, not the whole year.
r204849:
- document the -3, -A and -B properly in Synopsis.
- add highlight of current date for non-terminals.
- fix -J option.
- code cleanup.
- Implement -3 option (show previous, this and next month) option.
- Add -A option (months after this month).
- Add -B option (months before this month).
- Fix highlighting of today in year overview.
- Fix aligning of "foreign" characters.
alc [Fri, 15 Oct 2010 03:23:53 +0000 (03:23 +0000)]
MFC r209789
Correctly maintain the per-cpu field "curpmap" on amd64 just like we
do on i386. The consequences of not doing so on amd64 became apparent
with the introduction of the COUNT_IPIS and COUNT_XINVLTLB_HITS
options. Specifically, single-threaded applications were generating
unnecessary IPIs to shoot-down the TLB on other processors.
MFC r209887
Reduce the number of global TLB shootdowns generated by pmap_qenter().
Specifically, teach pmap_qenter() to recognize the case when it is being
asked to replace a mapping with the very same mapping and not generate
a shootdown.
alc [Fri, 15 Oct 2010 02:58:49 +0000 (02:58 +0000)]
MFC r212873
Allow a POSIX shared memory object that is opened for read but not for
write to nonetheless be mapped PROT_WRITE and MAP_PRIVATE, i.e.,
copy-on-write.
nwhitehorn [Thu, 14 Oct 2010 13:56:26 +0000 (13:56 +0000)]
MFC r213406:
Fix two subtle problems in PPC32 RTLD. The first is a concurrency issue
where long PLT calls in multi-threaded environments could end up with
incorrect jmptab values. The second is that, after the addition of extended
PLT support, I forgot to update the PLT icache synchronization code to cover
the extended PLT instead of just the basic PLT.
obrien [Thu, 14 Oct 2010 01:21:44 +0000 (01:21 +0000)]
MFC r212770 & r212832:
+ Add the SCRIPT environmental variable to the sub-shell.
+ Add the 'command' argument (if supplied on the command line)
to the typescript file.
emaste [Thu, 14 Oct 2010 00:46:33 +0000 (00:46 +0000)]
MFC r212594:
Avoid repeatedly spamming the console while a timed out command is waiting
to complete. Instead, print one message after the timeout period expires,
and one more when (if) the command eventually completes.
gnn [Tue, 12 Oct 2010 22:10:07 +0000 (22:10 +0000)]
MFC 213691:
Add code to print the number and type of the CPU that is present in
the system as well has how many PMCs there are per CPU. In this code
CPU and core are equivalent.
jhb [Tue, 12 Oct 2010 19:28:20 +0000 (19:28 +0000)]
MFC 213226:
Rewrite the i386 memory probe:
- Check for SMAP data from the loader first. If it exists, don't bother
doing any VM86 calls at all. This will be more friendly for non-BIOS
boot environments such as EFI, etc.
- Move the base memory setup into a new basemem_setup() routine instead
of duplicating it.
- Simplify the XEN case by removing all of the VM86/SMAP parsing code rather
than just jumping over it.
- Adjust some comments to better explain the code flow.
gnn [Tue, 12 Oct 2010 19:07:36 +0000 (19:07 +0000)]
MFC 204310:
Moved mcgrab(1) into a separate directory -- our .mk infrastructure
doesn't currently have support for building multiple programs in a
single makefile.
While here, fixed manpages and makefiles (missing dependencies).
jhb [Tue, 12 Oct 2010 17:12:13 +0000 (17:12 +0000)]
MFC 213300:
If an RCS file is truncated, rcsfile_getdelta() will return NULL. Instead
of faulting, check for NULL. However, returning an error would cause csup
to just abort the entire update. Instead, break out of the loop and
return ok. The attempts to update the file will trigger a MD5 failure which
will cause csup to download the entire file as a fixup.
jhb [Tue, 12 Oct 2010 16:08:20 +0000 (16:08 +0000)]
MFC 213028,213328:
- Expand scope of tun/tap softc locks to cover more softc fields and
driver-maintained ifnet fields (such as if_drv_flags).
- Use soft locks as the mutex that protects each interface's knote list
rather than using the global knote list lock. Also, use the softc
for kn_hook instead of the cdev.
- Use mtx_sleep() instead of tsleep() when blocking in the read routines.
This fixes a lost wakeup race.
- Remove D_NEEDGIANT now that the cdevsw routines use the softc lock
where locking is needed.
- Lock IFQ when calculating the result for FIONREAD in tap(4). tun(4)
already did this.
- Remove remaining spl calls.
jhb [Tue, 12 Oct 2010 13:13:20 +0000 (13:13 +0000)]
MFC 205021:
- Use an initializer macro to initialize fields in 'fake' FILE objects used
by *sprintf(), etc.
- Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE
objects. This is currently a nop on FreeBSD, but is import for other
platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply
zero.
avg [Mon, 11 Oct 2010 22:46:15 +0000 (22:46 +0000)]
MFC r210977:
When EC burst mode is activated and multiple bytes are accessed, do not
disable and enable repeatedly, just do it once per call. It also reduces
code duplication. Check all parameters early and fail immediately.
delphij [Mon, 11 Oct 2010 11:25:37 +0000 (11:25 +0000)]
MFC r213225:
Add a bandaid for a long-standing race condition during route entry
un-expiring.
The previous version of code have no locking when testing rt_refcnt.
The result of the lack of locking may result in a condition where
a routing entry have a reference count but at the same time have
RTPRF_OURS bit set and an expiration timer. These would eventually
lead to a panic:
panic: rtqkill route really not free
When the system have ICMP redirects accepted from local gateway
in a moderate frequency, for instance.
Commit this workaround for now until we have some better solution.
PR: kern/149804
Reviewed by: bz
Tested by: Zhao Xin, Pete French
ae [Mon, 11 Oct 2010 09:39:32 +0000 (09:39 +0000)]
GPART's control interface between kernel and user space has been
changed in r212614. Perform partial MFC of r213097 adapted to the
stable ABI:
Implement "force" (-F) option for gpart destroy verb.
This option doesn't passed to kernel and handled in user-space.
With -F option gpart creates new "delete" request for each
partition in table. Each request has flags="X" that disables
auto-commit feature. Last request is the original "destroy" request.
It has own flags and can have disabled or enabled auto-commit feature.
If error is occurred when deleting partitions, then new "undo" request
is created and all changes will be rolled back.
kaiw [Sun, 10 Oct 2010 12:20:04 +0000 (12:20 +0000)]
MFC r212373:
libelf is overly strict about the type and alignment of Elf_Data
objects inside one ELF section, which prevents the creation of a ELF
section with mixed data types. For example, gcc LTO use libelf to
create a .gnu_lto_XXX section that contains integers and a string
table, which doesn't work with our libelf implementation.
The changes made in this commit include:
* Allow Elf_Data type to be different than section type.
* Relax Elf_Data alignment check.
* Align each Elf_Data by their own alignment instead of section alignment.
mm [Sun, 10 Oct 2010 08:41:08 +0000 (08:41 +0000)]
- Add liblzma support to libarchive and usr.bin/tar
- Do not link usr.bin/ar to liblzma if building bootstrap-tools and
the local system doesn't include liblzma (fixes world build on FreeBSD 7.x)
MFC r212608 (by pjd):
All gpart(8) subcommands apart from the 'bootcode' subcommand handle
given geom/provider names with and without /dev/ prefix. Teach the
'bootcode' subcommand to handle /dev/<foo> names as well.
gavin [Sat, 9 Oct 2010 13:03:32 +0000 (13:03 +0000)]
Merge r213061 from head:
Various changes from various sources:
- Add "children" [1]
- Add "acknowledgement", "acknowledgment", "Austria" and "haunted" [2]
- Add "near", "antidisestablishmentarianism" and "Persephone" [2]
- "Transvaal" should be capitalized [2]
- Correct spelling of "structurelessness" and "Athena" [2]
- Add missing atomic elements [3]
- Add various words from "word of the day" lists [3]
PR: conf/149756 [1]
Submitted by: Nick Johnson <freebsd spatula.net> [1]
Obtained from: NetBSD [2], OpenBSD [3]
jilles [Sat, 9 Oct 2010 13:01:25 +0000 (13:01 +0000)]
MFC r211980: Correct value for _POSIX_AIO_LISTIO_MAX in <limits.h>.
All the "Minimum Values" (POSIX.1-2008 XBD 13 Headers <limits.h>) are now
correct. These should all be exactly as they are in the specification; the
possibly higher values we support are announced differently.
yongari [Fri, 8 Oct 2010 20:51:33 +0000 (20:51 +0000)]
MFC r212157:
Unlike most other controllers, NS DP83815/DP83816 controllers seem
to pad with 0xFF when it encounter short frames. According to RFC
1042 the pad bytes should be 0x00.
Because manual padding consumes extra CPU cycles, introduce a new
tunable which controls the padding behavior. Turning this tunable
on will have driver pad manually but it's disabled by default. Users
can enable software padding by setting the following tunable to
non-zero value.
yongari [Fri, 8 Oct 2010 20:48:09 +0000 (20:48 +0000)]
MFC r212121,212156:
r212121:
Move sis_reset() to sis_initl(). This ensures driver starts with
known good state of controller.
r212156:
Fix the last endianness issue on handling station address which
prevented driver from working on big-endian machines. Also rewrite
station address programming to make it work on strict-alignment
architectures. With this change, sis(4) now works on sparc64 and
performance number looks good even though sis(4) have to apply
fixup code to align received frames on 2 bytes boundary on sparc64.