Sascha Wildner [Thu, 10 Sep 2015 21:27:58 +0000 (23:27 +0200)]
kernel/bus: Change function definitions to static (to match declaration).
Sascha Wildner [Thu, 10 Sep 2015 21:27:35 +0000 (23:27 +0200)]
kernel/net: Change function definitions to static (to match declaration).
Sascha Wildner [Thu, 10 Sep 2015 20:43:41 +0000 (22:43 +0200)]
i386 removal, part 39/x: Remove est(4) driver.
Of the 36 CPUs it supports, only one supports Intel 64 (aka AMD64),
namely the Intel Core 2 Duo T7500, released in May 2007. The rest,
Intel Pentium Ms and two Intel Core CPUs, were 32 bit only.
If someone is still using a T7500 with DragonFly and our regular
ACPI P-state support doesn't work with it, we'd be interested in
hearing about it. As a last resort, there's always cpucontrol(8)
to set the MSRs manually. :)
Also, estd isn't in ports or dports.
Sepherosa Ziehau [Thu, 10 Sep 2015 15:10:05 +0000 (23:10 +0800)]
taskqueue: Fix taskqueue locking issues
- wakeup/wakeup_one should be called w/o spinlock (taskqueue lock).
- Callout needs to lock taskqueue before calling taskqueue_enqueue_locked.
John Marino [Thu, 10 Sep 2015 13:10:52 +0000 (15:10 +0200)]
rtld.1: Improve _rtld_functrace example
The man page was written at a time that gcc was "leaking" headers.
Now <unistd.h> is required for this example to compile.
John Marino [Wed, 9 Sep 2015 22:04:34 +0000 (00:04 +0200)]
sys/param.h: Fix typo in comment
John Marino [Wed, 9 Sep 2015 21:46:54 +0000 (23:46 +0200)]
bump __DragonFly_version for environ, __progname change
The "environ" and "__progname" symbols no longer appear in libc.
Certain linker flags can result in a link failure on these symbols. This
has been seen in llvm (likely requiring a patch for all versions to treat
DragonFly like FreeBD). Since this is a behavior change, I think it is
worth a version bump in case makefiles have to check the version to
adjust.
Sascha Wildner [Wed, 9 Sep 2015 18:39:10 +0000 (20:39 +0200)]
Simplify redundant __*_VISIBLE checks in various header files.
* __BSD_VISIBLE implies __XSI_VISIBLE and __POSIX_VISIBLE.
* __XSI_VISIBLE implies __POSIX_VISIBLE.
None of these functions/defines are actually XSI. No functional change
expected.
Sascha Wildner [Wed, 9 Sep 2015 16:07:57 +0000 (18:07 +0200)]
kernel: Remove pci_pir.c, which was not built.
According to sephe, this is no longer relevant these days.
Sascha Wildner [Wed, 9 Sep 2015 16:07:42 +0000 (18:07 +0200)]
i386 removal, part 38/x: Un-document no longer existing functions in bios.9.
John Marino [Wed, 9 Sep 2015 10:49:38 +0000 (12:49 +0200)]
libc: fix environ symbol by syncing getenv.c with FreeBSD
The environ symbol can't be found by rtld with libc symbol versioning.
On Release 4.2, readelf produces this output, indicating "environ" is
classified as an object:
> readelf -a /lib/libc.so.8 | grep environ
00000032af20 01ed00000006 R_X86_64_GLOB_DAT
0000000000351380 environ + 0
493:
0000000000351380 8 OBJECT GLOBAL DEFAULT 24 environ
1636:
0000000000351380 8 OBJECT GLOBAL DEFAULT 24 environ
After this commit:
> readelf -a /lib/libc.so.8 | grep environ
000000330c78 000700000006 R_X86_64_GLOB_DAT
0000000000000000 environ + 0
7:
0000000000000000 0 NOTYPE GLOBAL DEFAULT UND environ
1660:
0000000000000000 0 NOTYPE GLOBAL DEFAULT UND environ
The above is the desired output.
John Marino [Wed, 9 Sep 2015 10:39:12 +0000 (12:39 +0200)]
lib/dlfcn: whitespace cleanup, remove unnecessary prototype
John Marino [Wed, 9 Sep 2015 09:54:17 +0000 (11:54 +0200)]
libc: Complete conversion to _getprogname from __progname
The initial work to eliminate direct use of __progname was done years ago,
but two items were missed: an extern keyword and libc_r conversion. As a
result, the symbol was classified as an object. Before commit (R4.2):
> readelf -a /lib/libc.so.8 | grep __progname
00000032ac80 077600000006 R_X86_64_GLOB_DAT
00000000003506d0 __progname+0
1910:
00000000003506d0 8 OBJECT GLOBAL DEFAULT 24 __progname
537:
00000000003506d0 8 OBJECT GLOBAL DEFAULT 24 __progname
After commit:
> readelf -a /lib/libc.so.8 | grep __progname
0000003309c0 000400000006 R_X86_64_GLOB_DAT
0000000000000000 __progname+0
4:
0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __progname
545:
0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __progname
The issue was reveal with libc symbol version testing, which also revealed
the "environ" symbol has a similar issue. The change matches how the
FreeBSD analog works.
Matthew Dillon [Wed, 9 Sep 2015 03:11:00 +0000 (20:11 -0700)]
kernel - Fix multi-threaded coredump
* Recent commits to freeze threads on a coredump introduced a bug
where threads entering a wait state could stall the coredump
indefinitely.
* Fix by counting such threads as being stopped before entering the
wait state, allowing the coredump to proceed. Do not try to issue
an early signal which could disrupt the state the coredump is trying
to save.
Reported-by: Justin C. Sherrill <justin@shiningsilence.com>
John Marino [Tue, 8 Sep 2015 23:19:14 +0000 (01:19 +0200)]
Add missing dummy _rtld_thread_init (weak symbol)
The thread library uses it, but apparently has been getting it from rtld,
so this addition is basically future capability. FreeBSD has it too.
John Marino [Tue, 8 Sep 2015 23:04:15 +0000 (01:04 +0200)]
libc symbols bound to rtld must have matching version numbers
Reset the version of symbols bound to rtld back to DF306.0 version.
While here, remove definition for __progname and environ which cannot
be versioned.
Imre Vadász [Tue, 8 Sep 2015 21:51:38 +0000 (23:51 +0200)]
corepower(4): Fix units -> microwatt conversion on Valleyview Atom CPUs
Add cpu model 0x4d (C2000 Atom CPUs), which might also show correct
values with this fix.
This Valleyview Atom specific encoding of the MSR_RAPL_POWER_UNIT
MSR is described in tables 35-7 and 35-9 (for regular silvermont
Atom and C2000 Atom CPUs respectively).
Tested-by: swildner
Sascha Wildner [Tue, 8 Sep 2015 17:35:16 +0000 (19:35 +0200)]
<dirent.h>: Move fdopendir() under __POSIX_VISIBLE >= 200809.
It is new in Issue 7 of the standard. It is of course still visible in
our default environment.
Sascha Wildner [Tue, 8 Sep 2015 16:37:53 +0000 (18:37 +0200)]
<dirent.h>/<string.h>: Remove redundant __XSI_VISIBLE checks.
__XSI_VISIBLE implies __POSIX_VISIBLE, and none of these functions is
XSI.
No functional changes (expected).
Sascha Wildner [Tue, 8 Sep 2015 16:29:43 +0000 (18:29 +0200)]
<string.h>: memccpy() is XSI.
Sascha Wildner [Tue, 8 Sep 2015 16:14:04 +0000 (18:14 +0200)]
<stdio.h>: Sort some prototypes.
John Marino [Tue, 8 Sep 2015 18:26:51 +0000 (20:26 +0200)]
libc/gen Symbol map - rtld tweaks
The libc symbol versioning is preventing rtld from binding weak symbols,
or something like that. I haven't discovered the actual problem yet but
here are issues I fixed on the way.
John Marino [Tue, 8 Sep 2015 07:14:12 +0000 (09:14 +0200)]
libc/gen symbol map: Remove exposure to dummy tls functions
These libc tls functions are just dummies meant to be overridden by their
weak reference definitions (by rtld).
John Marino [Sun, 6 Sep 2015 18:06:42 +0000 (20:06 +0200)]
Fix libc symbol maps after build test
The following modifications (typos, bugs, missing symbols,
extra symbols) allows buildworld to complete with libc versioning
turned on (a first). After performance verification via dports
bulk build, the versioning will be activated.
John Marino [Sun, 6 Sep 2015 15:47:17 +0000 (17:47 +0200)]
Finished thorough pass of libc symbol maps
Before versioning of libc can be turned on, it requires through testing.
1) It's got to complete a full buildworld, of course
2) It's got to complete a dports bulk build without significant fallout
John Marino [Sun, 6 Sep 2015 10:17:14 +0000 (12:17 +0200)]
libc: For first time, loads in non-executable stack
I missed one assembly file from libc/x86_64 yesterday (I am not sure how),
and adding a GNU-stack note to it enables the GNU-stack ELF program
header to be set to "RW" instead of "RWE" for the first time ever. After
the syscall file generation fix, exect.S was the last assembly file
holding this back.
John Marino [Sun, 6 Sep 2015 10:04:16 +0000 (12:04 +0200)]
libc/syscalls: Add GNU-stack ELF note to generated assembly files
This fixes 282x2 objects files for libc and libc_rtld that were preventing
libc from loading on non-executable stack. It appears there is only one
more object file to fix after this commit. Similar code exists on the
libc/sys Makefile on FreeBSD.
John Marino [Sun, 6 Sep 2015 08:58:37 +0000 (10:58 +0200)]
libcrypto: Enable library to be loaded in non-executable stack
I scanned my system for libraries that were loading on executable sections
of the stack and found two: libc and libcrypto. After adding a GNU-stack
ELF note to each assembly file, the result is the crypto library now loads
in a non-executable stack.
Sascha Wildner [Sun, 6 Sep 2015 08:00:32 +0000 (10:00 +0200)]
Fix sys/conf/files to unbreak LINT64 for the recent drm changes.
Sepherosa Ziehau [Thu, 3 Sep 2015 12:55:20 +0000 (20:55 +0800)]
uipc: Simplify unp_ino generation
John Marino [Sat, 5 Sep 2015 21:39:43 +0000 (23:39 +0200)]
libc/x86-64: Add GNU-stack ELF notes to many assembly files
Most of the assembly files in libc/x86-64 were missing GNU-stack ELF
notes (they never had them) which means libc and every program that
links with it has required an executable stack. I need to determine
a way to check which object files are missing this section and make
sure every single libc object file is covered.
John Marino [Sat, 5 Sep 2015 21:37:28 +0000 (23:37 +0200)]
More libc Symbol map refinements (nearing completion now)
Sascha Wildner [Sat, 5 Sep 2015 18:48:49 +0000 (20:48 +0200)]
libc: Sync open_memstream(3) with FreeBSD. Also add open_wmemstream(3).
Their open_memstream(3) implementation is more compliant than ours was.
Taken-from: FreeBSD
John Marino [Sat, 5 Sep 2015 18:33:58 +0000 (20:33 +0200)]
Reworked (significantly) symbol map for locales
John Marino [Sat, 5 Sep 2015 16:25:05 +0000 (18:25 +0200)]
libc/locale: Remove unused source files
Only the "iconv" versions are built. Unlike FreeBSD, it is not possible to
build a version of libc without iconv support.
Sascha Wildner [Sat, 5 Sep 2015 17:14:36 +0000 (19:14 +0200)]
/usr/Makefile: Fix typo in a message about the pkg bootstrap.
John Marino [Sat, 5 Sep 2015 14:10:48 +0000 (16:10 +0200)]
Continue working on libc symbol maps
John Marino [Sat, 5 Sep 2015 14:09:13 +0000 (16:09 +0200)]
Add static keyword to four functions to match prototype (libc)
François Tigeot [Sat, 5 Sep 2015 07:25:11 +0000 (09:25 +0200)]
drm: drm_fb_cma_helper.c has a restrictive license, remove it
Tomohiro Kusumi [Thu, 3 Sep 2015 17:15:17 +0000 (02:15 +0900)]
sys/vfs/hammer: Rename btree_set_parent() to btree_set_parent_of_child()
This commit renames btree_set_parent() to btree_set_parent_of_child()
since btree_set_parent() is counter-intuitive.
1. btree_get_parent(node)
returns node's parent, but
2. btree_set_parent(node, elm)
sets its child's parent to node instead of setting node's parent
to something, which isn't quite expected behavior from the way
these two functions are named.
Tomohiro Kusumi [Wed, 2 Sep 2015 17:38:45 +0000 (02:38 +0900)]
sys/vfs/hammer: #if0 cursor_exclreq_count of inode and node
hammer code that refers to 'cursor_exclreq_count' is #if0'd,
so #if0 this field from struct definitions as well.
Since #if0'd code aren't logically obsolete but just disabled,
it's probably better not to remove them at this point.
The change does not affect abi as these structs and fields
are not size/position/ondisk-layout sensitive.
Tomohiro Kusumi [Tue, 1 Sep 2015 11:27:37 +0000 (20:27 +0900)]
sys/vfs/hammer: Cleanup incore record tree lookup
Tomohiro Kusumi [Tue, 1 Sep 2015 11:27:09 +0000 (20:27 +0900)]
sys/vfs/hammer: Cleanup parent inode dereferenced by record
Tomohiro Kusumi [Sun, 30 Aug 2015 14:00:36 +0000 (23:00 +0900)]
sbin/hammer: Add some assertions
Tomohiro Kusumi [Sun, 30 Aug 2015 09:25:12 +0000 (18:25 +0900)]
sbin/hammer: Fix boundary test on hammer show [3/3]
Separate child node test info RBN and non-RBN. hammer must
have set subtree_offset=0 for RBN and is considered error
if !=0.
Tomohiro Kusumi [Sun, 30 Aug 2015 07:50:18 +0000 (16:50 +0900)]
sbin/hammer: Fix boundary test on hammer show [2/3]
get_elm_flags() using HAMMER_BTREE_TYPE_INTERNAL for btype
of RBN of an internal node is not correct because btype of
RBN is actually not specified. It could be internal or leaf
or possibly 0, while RBN has no child regardless of the btype
value.
This results in get_elm_flags() having incorrect (but does
not fail with 'B' mark) condition for left/right elm test
for internal node. The correct way is to separate RBN case
from non-RBN case. RBN logically has no child node (hammer
erases child node offset with 0 on node split, if not zero
clears the whole elm), so it can't be handled in the same
switch(btype) cases like others are.
Separating RBN from non-RBN (normal ELM) makes possible for
each elm in an internal node to have correct left/right test.
* non-RBN is the same as leaf node, so add test_lr() and
use this in both internal and leaf node.
* RBN needs to be handled differently, so add test_rbn_lr()
and use this for RBN. The difference is that in RBN
hammer_btree_cmp(&elm->base, right_bound) == 0
could happen, so test_rbn_lr() can not set FLAG_TOOFARRIGHT
when it's ==0. Below is some details on how this happens
on RBN but not on non-RBN.
==========
(A)
This is what happens on internal split.
before split
I
0 1 2 3 ... n
E E E E E E E E E R
/
/
I 62
0 1 2 s ... 61|
E E E E E E E E E E R
after split
I n+1
0 1 2 3 ... p |
E E E E E E E E E E R
/ \
/ \
I I 62-s-1
0 1 2 s 0 1 2 ... |
E E E R=E E E E E E E R
From the way hammer_split_internal() is implemented,
E[p].base which points to the new child node is a copy of
E[0].base in the new child node. Given that this E[0] is
a copy of R(RBN) in the original child node (that was E[s]
before internal split and was src of bcopy()), E[p].base
also equals this R.base.
Therefore
hammer_btree_cmp(&elm->base, right_bound) == 0
does happen for a right boundary elm where elm is R(RBN)
and right_bound is &E[p].base. For non-RBN elms this is
considered error for the same reason as leaf split case
explained below.
==========
(B)
This is what happens on leaf split which is similar to above
but not the same.
before split
I
0 1 2 3 ... n
E E E E E E E E E R
/
/
L
0 1 2 s ... 62
E E E E E E E E E E E
after split
I n+1
0 1 2 3 ... p |
E E E E E E E E E E R
/ \
/ \
L L 62-s-1
0 1 2 s 0 1 2 ... |
E E E E E E E E E E E
hammer_leaf_split() basically does the same as internal,
but the difference is that E[s] in the original child node
does not become a boundary, nor does it point to a child.
E[s] is just a junk space just like all the rest of the
elms in the original child node.
(Also leaf split tries to make E[p].base <= E[0].base of
the new child node, instead of just copying E[0].base to
E[p].base and make them equal like internal split does.
See hammer_make_separator() for details.)
This makes
hammer_btree_cmp(&elm->base, right_bound) == 0
not happen and considered error if it happens, where elm
is either of E[0]..E[s-1] in the original child node and
right_bound is &E[p].base.
Tomohiro Kusumi [Sun, 30 Aug 2015 07:07:20 +0000 (16:07 +0900)]
sbin/hammer: Fix boundary test on hammer show [1/3]
This commit actually doesn't fix anything, but just to make
get_elm_flags() take elm index instead of btype.
get_elm_flags() needs elm index to correctly test boundary
and non-boundary elements. btype can be retrieved from elm
itself, so it doesn't need to be passed as an argument.
XXX part is where it needs to be fixed.
Tomohiro Kusumi [Sat, 29 Aug 2015 16:03:18 +0000 (01:03 +0900)]
sbin/hammer: Make hammer show test node count
Tomohiro Kusumi [Sat, 29 Aug 2015 11:40:34 +0000 (20:40 +0900)]
sbin/hammer: Make hammer blockmap|checkmap|show print # of 'B' on -v
similar to the way hammer checkmap prints # of errors,
and some refactoring around that part.
(otherwise one has to search for "^B" to see if there
is any error in some 100M bytes hammer show result for
large fs)
Tomohiro Kusumi [Fri, 28 Aug 2015 18:35:30 +0000 (03:35 +0900)]
sbin/hammer: Add hammer stats command (= bstats + iostats)
It's simply good to have a command that combines these two.
One often runs these two concurrently and tries to see both
at the same time anyway.
Tomohiro Kusumi [Fri, 28 Aug 2015 10:33:07 +0000 (19:33 +0900)]
hammer: Remove cluster topology related comments
that were written in the early stage of hammer devel
but do not reflect the actual implementation today,
such as super-cluster, etc.
Tomohiro Kusumi [Fri, 28 Aug 2015 15:01:28 +0000 (00:01 +0900)]
sbin/hammer: Remove obsolete variable UsingSuperClusters
This variable is no longer used and not necessary.
This was added in the early stage of hammer devel
when the real clustering code was being written, but
never removed when the clustering part was removed.
Tomohiro Kusumi [Sat, 29 Aug 2015 08:08:50 +0000 (17:08 +0900)]
sys/vfs/hammer: Remove redundant elm type check [2/2]
The following code(A) in hammer_cursor_down() is redundant.
It works the same with or without if/else conditional.
hammer_is_internal_node_elm(elm) == 1
and
node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL
are essentially the same thing from the way hammer's ondisk
data structure is designed.
If above is not true, then it ends up calling panic().
Then (A) can be written like (B), and (B) can be written
like (C) since it's either panic or not panic anyway.
Also the way (C) looks is natural given that the purpose
of this function is to move the cursor downward to one of
its children. It must be an internal (non-leaf) to be able
to go down.
=====(A)
if (hammer_is_internal_node_elm(elm)) {
/* below never fails if above is true, and */
/* above would have never failed if below is true */
KKASSERT(node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL);
go_down();
} else {
panic();
}
=====
=====(B)
if (node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL) {
go_down();
} else {
panic();
}
=====
=====(C)
KKASSERT(node->ondisk->type == HAMMER_BTREE_TYPE_INTERNAL);
go_down();
=====
Tomohiro Kusumi [Thu, 27 Aug 2015 21:04:55 +0000 (06:04 +0900)]
sys/vfs/hammer: Remove redundant elm type check [1/2]
hammer_btree_lock_children() assumes the node is internal,
but not leaf or anything else. Also given that all elms[]
within a node has the same elm type (i.e. all elms[] use
the same union member of hammer_btree_elm_t), this function
doesn't need to check if each elms[i] is a node element
of an internal node.
If elms[] are not elements of an internal node, then the
caller is not using this function right rather than this
function missing sanity checks.
In fact this is (only)used by hammer_split_internal() and
reblock/rebalance code where they deal with internal nodes.
They all do pass an internal node.
Tomohiro Kusumi [Mon, 31 Aug 2015 10:20:09 +0000 (19:20 +0900)]
sys/vfs/hammer: Remove prototype of not existing fucntion
This function no longer exists.
Also fix wrong name in kprintf().
Tomohiro Kusumi [Tue, 25 Aug 2015 15:30:37 +0000 (00:30 +0900)]
sys/vfs/hammer: Cleanup debug kprintfs for cursor/elm
Most of the kprintfs in sys/vfs/hammer/hammer_btree.c
that are used only when vfs.hammer.debug_btree is set
do the same thing (with slightly different format),
so integrate them into two inline functions.
Tomohiro Kusumi [Wed, 26 Aug 2015 15:21:27 +0000 (00:21 +0900)]
sys/vfs/hammer: Add and fix comments
on
* inode's node cache
* btree node split
* volume header
Tomohiro Kusumi [Fri, 28 Aug 2015 15:20:41 +0000 (00:20 +0900)]
sys/vfs/hammer: Remove obsolete macro HAMMER_CLUSTER_BUFS
This macro is no longer used and not necessary.
HAMMER_CLUSTER_BUFS was once used by cluster_read()
but not anymore.
Tomohiro Kusumi [Thu, 27 Aug 2015 15:17:00 +0000 (00:17 +0900)]
sys/vfs/hammer: Remove obsolete macro HAMMER_LOCALIZE_PSEUDOFS_INC
This macro is no longer used and not necessary.
There used to be a code where hammer iterates PFS id
from min to max and HAMMER_LOCALIZE_PSEUDOFS_INC was
used to += the counter, but there is no such code now.
Tomohiro Kusumi [Tue, 25 Aug 2015 15:03:16 +0000 (00:03 +0900)]
sys/vfs/hammer: Remove obsolete macro HAMMER_RECTYPE_MOVED
This macro is no longer used and not necessary.
HAMMER_RECTYPE_MOVED was once used by reblock when
reblock was first implemented, but no longer used.
Tomohiro Kusumi [Mon, 24 Aug 2015 20:01:42 +0000 (05:01 +0900)]
sys/vfs/hammer: Remove obsolete macro HAMMER_BLOCKMAP_FREE
This macro is no longer used and not necessary.
HAMMER_BLOCKMAP_FREE was once used to initialize layer1
phys_offset and some other fields, but no longer used
or those fields no longer exist.
Tomohiro Kusumi [Mon, 24 Aug 2015 19:24:24 +0000 (04:24 +0900)]
sys/vfs/hammer: Don't return 0 on invalid elm.leaf.base.btype
A leaf node only has records without any boundary elm,
so btype is always RECORD, anything else is invalid.
(There used to be several other types that no longer
exist that could be set to elm.leaf.base.btype)
Tomohiro Kusumi [Sat, 29 Aug 2015 07:11:12 +0000 (16:11 +0900)]
sys/vfs/hammer: Properly kprintf 32bits localization value
It should be %08x to fully show pfs# and type.
Tomohiro Kusumi [Mon, 24 Aug 2015 18:50:49 +0000 (03:50 +0900)]
sys/vfs/hammer: Add hammer_elm_btype()
Considered useful to get rid of (cond ? ascii : '?')
that exists only to print '?' for non-ascii error cases.
Also note that btype==0 isn't necessary an unknown type
since root_btree_beg|end use 0.
Tomohiro Kusumi [Mon, 24 Aug 2015 16:53:41 +0000 (01:53 +0900)]
sys/vfs/hammer: Properly access node element base
elm should dereference leaf.base instead of internal.base
since the node that contains node elm here is a leaf node.
These two refer to the same address, but the leaf.base is
the right one in terms of code.
Also print elm->leaf.base.btype which is always expected
to be 'R'.
Tomohiro Kusumi [Sun, 23 Aug 2015 16:52:30 +0000 (01:52 +0900)]
sys/vfs/hammer: Simplify hammer_print_btree_elm()
Given that the purpose of hammer_print_btree_elm()
is to print a node elm info that points to a node
(but not a node info that contains the node elm),
it's better not to have any external info such as
node type and elm index as a part of arguments.
Tomohiro Kusumi [Mon, 24 Aug 2015 14:11:44 +0000 (23:11 +0900)]
sys/vfs/hammer: Add hammer_is_internal|leaf_node_elm()
The data structure of each elm of node::elms[63] (elms[62]
for internal node excluding boundary) is simply determined
by the type of node that contains node::elms[63].
This makes code like (A) very clear and straight forward,
but makes code like (B) not clear because what elms point
to can not be simply determined by the node type.
Adding inline functions hammer_is_internal|leaf_elm() as
shown in (C), which essentialy do the same thing, makes
code look as straight forward as (A).
There are several situations where hammer wants to find
out if the given elm is an element within an internal node,
and hammer_is_internal_elm() can make such code more clear
than using switch(elm.base.btype). These functions are only
used in btree search/iteration related code. Using these
inline functions doesn't affect performance.
Also see the next commit which is related to this and the
previous commit.
===== (A)
elm = &node->elms[i];
switch (node->type) {
case HAMMER_BTREE_TYPE_INTERNAL: /* case matches union member */
elm->internal.subtree_offset...
break;
case HAMMER_BTREE_TYPE_LEAF: /* case matches union member */
elm->leaf.data_offset...
break;
}
=====
===== (B)
elm = &node->elms[i];
switch (elm->base.btype) {
case HAMMER_BTREE_TYPE_INTERNAL:
case HAMMER_BTREE_TYPE_LEAF: /* this is right but not obvious */
elm->internal.subtree_offset...
break;
case HAMMER_BTREE_TYPE_RECORD: /* this is right but not obvious */
elm->leaf.data_offset...
break;
}
=====
===== (C)
elm = &node->elms[i];
if (hammer_is_internal_node_elm(elm)) {
elm->internal.subtree_offset...
} else {
/* or else if (hammer_is_leaf_node_elm(elm)) { */
elm->leaf.data_offset...
}
=====
Tomohiro Kusumi [Sun, 23 Aug 2015 17:04:00 +0000 (02:04 +0900)]
sys/vfs/hammer: Fix wrong node type in switch/case
A node type is either internal or leaf (or deleted which
is originally internal or leaf), but not record.
A node element's btype could be internal, leaf or record,
but hammer_print_btree_node() is passing a node type to
this function, so cases must be either internal or leaf.
hammer_print_btree_node() and hammer_print_btree_elm()
are not used so nothing changes anyway.
Tomohiro Kusumi [Thu, 27 Aug 2015 15:16:02 +0000 (00:16 +0900)]
sbin/hammer: Avoid volume# inconsistency in blkdevs arg
hammer commands that take blkdevs format arg (e.g. blockmap,
checkmap, show, etc) should check if # of volumes in blkdevs
format arg != vol_count in volume header, and fail if they
don't match.
Without checking this, these commands can proceed with invalid
number of volumes and results in either failure or wrong result.
It should be checked here just like hammer itself now checks
inconsistency on mount since
c302e844.
Note that fsid check is done by setup_volume(), so no need
to do it here.
Tomohiro Kusumi [Mon, 24 Aug 2015 13:31:41 +0000 (22:31 +0900)]
sbin/hammer: Cleanup localization initialization on reblock
and also adds a missing pattern (DATA | DIRS)
although there isn't a hammer reblock-data-dirs command.
Tomohiro Kusumi [Mon, 24 Aug 2015 10:49:34 +0000 (19:49 +0900)]
sbin/hammer: Use HAMMER_IOC_DO_FLAGS
rather than -1 since it's defined.
Tomohiro Kusumi [Mon, 24 Aug 2015 10:36:10 +0000 (19:36 +0900)]
sbin/hammer: Print bad btype on hammer show
A leaf node can only have records for its children.
Tomohiro Kusumi [Sun, 23 Aug 2015 18:37:30 +0000 (03:37 +0900)]
sys/vfs/hammer: Fold too long lines
Tomohiro Kusumi [Sun, 23 Aug 2015 14:22:57 +0000 (23:22 +0900)]
sys/vfs/hammer: Remove unused (and never used) macro
842e7a7 added HAMMER_PFSM_DELETED but no one has ever used it.
(HAMMER_PFSD_DELETED also exists and this one is used)
Imre Vadász [Thu, 3 Sep 2015 19:20:30 +0000 (21:20 +0200)]
sio: Add pci-ids for Haswell and Broadwell vPro CPUs' SoL support.
Matthew Dillon [Thu, 3 Sep 2015 04:11:08 +0000 (21:11 -0700)]
hammer2 - refactor some chain bits, stabilization
* Refactor the hammer2_chain_t MODIFIED and UPDATE flags to not
reference the chain.
* Automatically flag DESTROY on a chain on last-drop if chain->parent is
NULL, and automatically clear UPDATE and try to clear MODIFY. Add the
chain to the delayed-flush queue if MODIFIED cannot be cleared.
* Fix a flags bug in hammer2_chain_hardlink_find() which could deadlock
competing threads.
* The collect code now aggregates errors and the cluster check code now
also aggregates errors. This allows feeders to feed an error code to
the collector.
* Fix rmdir and rename to disallow removal of non-empty directories.
* hammer2_inode_xop_flush() now proceeds with a flush if hmp->flushq
is not empty, even if the chain is not marked for flushing. This
still needs some work.
* Add a sideq for dirty inodes that might have to be flushed. Used for
unlinked dirty inodes which might still be open.
* Call hammer2_inode_modify() whenever possible instead of setting the
HAMMER2_INODE_MODIFIED flag manually.
* Test for chain leaks against blogbench, fsx, and fsstress.
John Marino [Wed, 2 Sep 2015 23:52:19 +0000 (01:52 +0200)]
Update some more symbols maps for libc
This continues the work towards versioning libc. I found that a wchar
function, open_wmemstream(), had a prototype but was not implemented on
DragonFly (but it is on FreeBSD) so I filtered it out with #if 0 block.
John Marino [Wed, 2 Sep 2015 20:24:54 +0000 (22:24 +0200)]
lib/libc/stdlib/merge.c: add "static" to match setup prototype
Matthew Dillon [Wed, 2 Sep 2015 00:50:01 +0000 (17:50 -0700)]
hammer2 - stabilization - blogbench, others
* Fix some (but not all) issues with lost chains on unmount that show
up in a kmalloc pool warning.
* Fix a bug in hammer2_chain_create_indirect() which retained a stale
{ base, count } across possible parent chain modifications, resulting
in corruption and/or a panic.
* Track chain lock counts on a per-thread basis and add some helpful
assertions in the XOP processing loop. Also add
hammer2_chain_push_shared_lock() and hammer2_chain_pull_shared_lock()
to helpfully transfer ownership of (shared locks only) between threads.
* Add missing cpu_lfence() after fifo read index test. Ensures that
the memory load of the chain occurs after the write index change has
been detected.
* Change the XOP ABI a bit. hammer2_xop_feed() now replicates the
shared lock, giving one to the collector and allowing the caller
to retain its own. This way the locking state of the chain passed
to it does not change from the point of view of the caller.
This also fixes one or two lost chain locks in the XOPs.
Matthew Dillon [Wed, 2 Sep 2015 00:49:13 +0000 (17:49 -0700)]
kernel - Use unused thread_t field for lock tracker.
* Repurpose an unused struct thread field to add td_tracker. Structure
size does not change. Used for debugging only.
François Tigeot [Tue, 1 Sep 2015 20:07:59 +0000 (22:07 +0200)]
drm: Bring back a KNOTE() call, unbreak vblank handling
* Userland programs were no longer properly notified of vblank events
* We can't use the drm_poll() function present in Linux and its
explicit poll_wait() call on file_priv->event_wait without introducing
a completely new kernel infrastructure. Add back the KNOTE() call.
Noticed-by: ivadasz, many
John Marino [Tue, 1 Sep 2015 19:53:00 +0000 (21:53 +0200)]
libc: Remove stack_protector.c from build
Both gcc47 and gcc50 use libssp for stack protection, so the stack
protector code appears to be obsolete. On the direction of dillon,
just delist the source file in the makefile, and after a month with
some dports run experience, permanently remove stack-protector.c
from lib/libc/sys directory.
John Marino [Tue, 1 Sep 2015 18:24:04 +0000 (20:24 +0200)]
Take II at unbreaking world
Sascha Wildner [Tue, 1 Sep 2015 16:21:15 +0000 (18:21 +0200)]
acpicall(8): Add -U option for passing UUIDs as buffers.
Great for _DSM's.
Tested-by: tollens
John Marino [Tue, 1 Sep 2015 17:30:52 +0000 (19:30 +0200)]
Add bootstrap workaround needed by ctype.h addition for localedef
Sascha Wildner [Tue, 1 Sep 2015 17:14:17 +0000 (19:14 +0200)]
localedef.1: Clean up a bit.
Sascha Wildner [Tue, 1 Sep 2015 16:39:56 +0000 (18:39 +0200)]
Add a small vmm(2) manual page for the related system calls.
Namely, vmm_guest_ctl(2) and vmm_guest_sync_addr(2).
It is based on a manual page which Mihai Carabas submitted to me a
rather long time ago (apologies, Mihai).
John Marino [Tue, 1 Sep 2015 12:42:39 +0000 (14:42 +0200)]
UTF8: fix a couple of number ctype definitions
During testing of new number ctype, I found a typo one of the CJK number
definitions and two Roman Numeral characters that were set as numbers but
should not be (according to equivalent python check).
John Marino [Tue, 1 Sep 2015 11:39:38 +0000 (13:39 +0200)]
libc: Redefine "number" ctype - no longer alias of "digit"
FreeBSD extended ctypes to include numbers (e.g. isnumber()) but never
actually implemented it. The isnumber() function was equivalent to the
isdigit() function in every case.
Now that DragonFly's ctype source files have number definitions, the
number ctype can finally be implemented. It's given a new flag _CTYPE_N.
The isalnum() and iswalnum() functions have been changed to use this
flag rather than the _CTYPE_D digit flag.
While isalnum(), isnumber(), and their wide equivalents now return
different values in locale cases, the ishexnumber() and iswhexnumber()
functions are unchanged. They are still aliases for isxdigit() and
iswxdigit().
Also change ctype.h for isdigit and isxdigit to use sbistype like the
other functions.
The "isnumber()" will not work until a full world build is made. The
reason is that localedef is modified, but it's a bootstrap tool, so the
earlier version that does not support number ctype is still used in a
quickworld build.
John Marino [Tue, 1 Sep 2015 10:41:21 +0000 (12:41 +0200)]
UTF8 locales: Fully consider "CIRCLED_" set as alphabet
This means defining the "A"-"Z" and "a"-"z" circled versions of the
Enclosed Alphanumerics block (0x2460-24FF) as hexidecimal digits and
defining the to-upper and to-lower conversions between the upper case
and lower case circled alphabets.
John Marino [Tue, 1 Sep 2015 09:11:41 +0000 (11:11 +0200)]
UTF-8: Multiple improvements (and detection of possible issue)
This commit started out intending to fix "digit" definition on unicode,
which it mostly does, but a lot more happened in the end, namely:
* digits apparently are not part of CLDR definition. I added a section
in the manual portion of UTF-8 source file that defines digit classes
for generated sections.
* Add numbers classification for entire UTF-8. Currently DragonFly and
all BSDs do not support "number" type. However, localedef understands
it (its supported on Illumos), but currently the number flag value is
zero, so it's a no-op. A short term goal is to have DragonFly be the
first BSD with proper number ctype handling.
* Redefine "special" ctype once and for all. There is no definitive
agreement on what "special" characters are. According to wiki which
got it from unicode, it starts with 33 characters (0x20 - 0x2F, 0x3A -
0x40, 0x5B - 0x60, 0x7B - 0x7E). However, localedef objects to <space>
because it sets "graph" and "print" flags, and <space> can't be graph.
As a result, the <space> is not considered "special" here. Moreover,
the punctuation in Latin-1 supplement is "special". The division and
multiplication signs are ambiguous, so I set them to special (since
plus and minus signs are special). Finally, with the most doubt, the
punctuation of "general punctuation" block is also considered special
although I couldn't find convincing evidence either way. Given the
lack of definition, I don't think "special" classification is really
used, especially not in unicode.
* Fix NON-BREAK_SPACE classification (set as graph and space on previous
commit)
* the MICRO character was also warning due to being classified as both
lower (in Greek section) and punctuation, so remove the punct. class.
* When possible, don't define graph if digit is defined, and similarly
with graph and punct. Both digit and punct also set graph flag so
having both is redundant.
* add several new block definitions:
- Syloti Nagri
- Common Indic Number Forms
- Phags-pa
- Saurashra
- Kayah Li
- Rejang
- Javanese
- Cham
- Tal Viet
- Meetei Mayek & extension
* Detection of possible bug in localedef
The Tai Tham definition are producing the wrong code but there's
nothing wrong with the definitions. The 6 unused characters between
the two digit definitions should not be graphable, but as soon as
one "digit" is defined after the first digit range is defined, all
the characters between are marked as graphable and digits. There
are similar "fill-ins" but so far only with Thai Tam. It was
detected while outputting all "digit" types against a python program
that does the same and this error was reveal. It requires further
investigation about exactly what is causing it (and thus where the
bug is) but right now it's either a bad definition elsewhere that
affects Thai Tam or localedef has a bug somewhere (avl lookup?)
Sascha Wildner [Tue, 1 Sep 2015 08:06:26 +0000 (10:06 +0200)]
hammer2.8/newfs_hammer2.8: Some small fixes.
Matthew Dillon [Tue, 1 Sep 2015 07:28:18 +0000 (00:28 -0700)]
hammer2 - stabilization - Fix bugs found by blogbench
* Make sure that any inode without an associated vnode gets put on
the sideq if it is dirtied, otherwise it might not ever get flushed.
* Fix a SMP race in hammer2_xop_start_except(). For asynchronous completions,
the xop can become invalid the instant we release our spinlock if another
thread manages to process, retire, and free it.
Matthew Dillon [Tue, 1 Sep 2015 03:28:50 +0000 (20:28 -0700)]
kernel - Improve namecache generation handling
* Reduce mount->mnt_namecache_gen from 64 to 32 bits and add a dummy
field so the structure size does not change.
* Reduce namecache->nc_namecache_gen from 64 to 32 bits and add a
second generation number to detect cache_unlink() and cache_rename()
calls. Bump the counter in cache_rename() and _cache_unlink().
Structure size did not change.
* Refactor kern_rename() to use namecache->nc_generation to detect
a larger subset of changes to the namecache entries which can leak
in due to the temporary unlock of fromnd->nl_nch.ncp.
Matthew Dillon [Tue, 1 Sep 2015 03:20:22 +0000 (20:20 -0700)]
hammer2 - stabilization - Fix a number of bugs revealed by fsx and fsstress.
* Fix block rewriting against deduped data (dedup_off != 0 in call to
hammer2_chain_resize()). It was hitting an assertion due to chain->bytes
not being properly updated.
* A coarse lock is required on the pfs around any link() or rename() which
needs to mess with hardlink targets.
* Fix an inode meta.nlinks race between the frontend and the backend. The
frontend tracks a master copy of the inode. The backend must also adjust
meta.nlinks during link and unlink operations because it reads the field
to determine if the hardlink target should be removed or not.
This required fixes in hammer2_xop_nlink() and hammer2_xop_nremove() and
some functional augmentation to hammer2_xop_nlink().
* Leave the target inode locked through the whole rename sequence, the
hardlink target shifts are just too complex (for now) to be able to rely
on inode locks.
* Fix an incorrect shared lock in hammer2_xop_nrename() which could result
in a parent modification being made while held shared instead of exclusive.
* Add debug output for an issue in hammer2_xop_nrename() that has not yet
been fixed (kprintf... ENOENT).
Sepherosa Ziehau [Mon, 31 Aug 2015 13:08:44 +0000 (21:08 +0800)]
uipc: Assert 0->1 reference count transition; it must not happen.
Sepherosa Ziehau [Mon, 31 Aug 2015 13:08:11 +0000 (21:08 +0800)]
uipc: Check unp_conn again after unp_connect().
Since the current unp's token could be released after unp_conn
assignment, we need to check unp_conn again even if unp_connect()
returns no error.
Sascha Wildner [Mon, 31 Aug 2015 21:32:54 +0000 (23:32 +0200)]
acpicall(8): Style fixes.
François Tigeot [Mon, 31 Aug 2015 19:35:34 +0000 (21:35 +0200)]
drm: Update drm_irq.c...
... to commit
56cc279b29c7b204fe7d0943509ae209b8b128db from Linux 3.18
drm: Fix deadlock between event_lock and vbl_lock/vblank_time_lock
Imre Vadász noticed a deadlock in the drm code handling vblank irqs.
Fortunately, this was also noticed by the Linux drm developers and fixing
the issue was just a matter of updating drm_irq.c
Reviewed-by: ivadasz
Sascha Wildner [Mon, 31 Aug 2015 18:14:16 +0000 (20:14 +0200)]
acpicall.8: Fix backslashes in method paths.