Nick Alcock [Fri, 7 Sep 2012 19:26:17 +0000 (20:26 +0100)]
ctf: write the CTF files for standalone modules to a subdir of the module dir
Writing all ctf to the .ctf subdirectory of the kernel directory is problematic
when building standalone modules, when the kernel directory may be unwritable.
So write it to the .ctf subdirectory of the module directory in this case
as well. (The old .ctf relative path was hardwired into dwarf2ctf, so this
too is changed to accept the path to write the CTF files to as the first
parameter, in both non-standalone and standalone mode.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Wed, 29 Aug 2012 13:18:57 +0000 (14:18 +0100)]
ctf: unnamed structure/union support
Since neither CTF nor DTrace userspace have support for unnamed structure/union
members, we have to cheat a bit. We can model an unnamed structure member as
being precisely equivalent to simply naming the structure members in the
enclosing structure, with their offsets biased by the offset of the unnamed
member in its enclosing structure. An unnamed union is the same, excepting the
overlapping offsets, which we don't need to pay any attention to since we
already get all our offset information directly from the debugging information
anyway.
So we handle this by detecting an anonymous member after offset computation,
skipping to its type DIE's first child (if any), and calling die_to_ctf()
directly with that child, so that die_to_ctf() works over the anonymous member's
members as if they were members of the enclosing structure, skipping all the
usual addition of that structure as a CTF entity in its own right. We handle
the offset biasing by adding a parent_bias to die_to_ctf() and all CTF
construction functions, and adding that bias to all structure member offsets.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Wed, 29 Aug 2012 11:27:06 +0000 (12:27 +0100)]
ctf: recurse_ctf() -> die_to_ctf()
This function is badly named: sure, it's recursive, but so are half a dozen
other functions in dwarf2ctf. Its callers do not care that it is recursive:
they care that its function is to translate a DWARF DIE to CTF.
So rename it accordingly.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Fri, 10 Aug 2012 22:52:19 +0000 (23:52 +0100)]
ctf: fix the signed-modules case
The code in Makefile.modpost's module-ctf-flags variable which computes the name
of the CTF file, given the name of the kernel module being linked, was torpedoed
by the name of the unsigned module that is linked when module signing is in use.
So introduce a new ctf-module-name variable that substitutes the name
appropriately given the state of module signing.
Also, fix up some related places where I used spaces instead of tabs by mistake.
(3.6: most signed-modules code omitted, but a bit of supporting code remains
in readiness for signed modules in 3.7.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Thu, 9 Aug 2012 23:54:55 +0000 (00:54 +0100)]
ctf: correctly propagate IDs for array types
We were constructing things of array type wrongly, for a rather interesting
reason.
DWARF describes an array by putting its base type in the parent DIE, then
describing its bounds in the child DIE. Unfortunately, this puts us in an
unfortunate position: we always visit the parent before its children (so we can
build things like structures before filling their members in) -- but you can't
build a CTF array without knowing what its bounds are ('flexible' is not the
same as 'we don't know yet') -- and we *do* need the base type to be constructed
anyway. So we constructed the base type when working over the parent DIE, then
wrapped an array around it when we visited the children where the dimensions
were described (possibly more than one for a multidimensional array: though GCC
happens not to emit those for C, it is permitted to, and handling it is easy, so
we do). Unfortunately, recurse_ctf() throws away the type ID returned from
child DIEs, so the CTF ID that gets stashed for assignment to things of that
array type (when they are looked up via lookup_ctf_type()) turns out not to be
an array type at all, but the base type!
So we add an optional override parameter to recurse_ctf() and to all the
construction functions: it is passed only by recursive recurse_ctf() calls (when
processing child DIEs): it is set nonzero by construction functions that wrap
and replace the ID from their parent DIE, and when it is set, the type ID
returned by the construction function replaces the type ID that recurse_ctf()
passes back to its parent. Now assemble_ctf_array_dimension() just needs to
set this override parameter, and all is well.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Thu, 9 Aug 2012 23:33:14 +0000 (00:33 +0100)]
ctf: fix off-by-one in emitted array bounds
We were treating arrays described by DW_AT_count and DW_AT_upper_bound
identically, but in a language like C with zero-based arrays they are not:
DW_AT_upper_bound does not give the number of members unless you add one
to it.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Tue, 7 Aug 2012 08:46:38 +0000 (09:46 +0100)]
ctf: blacklist certain modules from deduplication
sound/pci/ens1371.c #includes another file, ens1370.c, with a #define
that changes the definition, but not name, of a single structure.
While this grotesquerie is permitted in C, there's no way that translation units
that engage in it can be permitted to share types with other translation units.
More specifically, types defined in such TUs must not be permitted to transform
a non-shared type to shared by virtue of their being detected in such TUs.
I'd like to detect the redefined structures themselves, but since the
preprocessor trickery leaves no mark in the DWARF another pass would be
necessary just to detect this. It's easier -- and faster -- to introduce a
blacklist of modules that do things like this and simply turn deduplication
scanning off for these modules. (Because they are still allowed to reuse
duplicates found in other modules, this does not increase their size
appreciably.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Mon, 6 Aug 2012 18:06:38 +0000 (19:06 +0100)]
ctf: include enumeration types inside functions
Like structures and unions, enumerations are a named type in their own
namespace: like structures and unions, arrays and other types based on such
types are represented by a DWARF DIE outside all functions. So the duplicate
detector must treat them like structures and unions, and include them even
if they are inside functions.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
(Note that the preempt probe currently passes a debugging argument that
will be removed in the future to match the argument-less version in the
documentation.)
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Nick Alcock [Tue, 31 Jul 2012 17:35:57 +0000 (18:35 +0100)]
dtrace: require assembler symbol stripping and debug info
The former is needed because dt_module.c doesn't know how to ignore assembler
labels when reading module symbol data: the latter because dwarf2ctf reads the
types out of debug info.
Use select rather than require because both of these requirements are distinctly
non-obvious and we don't want to force people to hunt about for them.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Tue, 31 Jul 2012 17:33:58 +0000 (18:33 +0100)]
ctf: fix array dimensions
Due to a premature optimization (in, admittedly, speed-critical code) and
mistakenly forgetting that dwarf_formudata() does not return its result like
dwarf_whatform(), all arrays were considered to be flexible arrays of unknown
dimension.
Also, the type ID representation for arrays was uniquely ugly in that it lacked
a trailing space after the close ].
(Both fixed.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Mon, 30 Jul 2012 21:33:44 +0000 (22:33 +0100)]
ctf: change the name of the CTF section in kernel modules
Since we have broken backward-compatibility with Solaris libctf and changed the
magic number in CTF files, we should change the name of the section they are
written to. .dtrace_ctf seems like a good idea (which means that shared types
will now be found in the .dtrace_ctf.dtrace_ctf section, rather than, as
before, .SUNW_ctf.dtrace_ctf).
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
dtrace: fix a bug in the SDT probe location generator
The generator could accidentally add the address of a non-function
identifier to the SDT list (e.g. watchdog occurs both in the
uninitialised data section (BSS) and the text section).
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Nick Alcock [Mon, 30 Jul 2012 18:21:15 +0000 (19:21 +0100)]
ctf: major duplicate detection fixes
The duplicate detector had numerous faults. Among the situations it couldn't
handle:
- a shared structure 'struct foo' visible in both opaque and non-opaque form,
with an identically-sized array, pointer, or other entity referring to that
type in both modules where the type was visible only as an opaque type and
types where it was visible non-opaquely.
- any situation in which a member of a shared structure points to a structure
which would not be shared but for that (and so on, for as many repeated
points-tos as one wishes)
- situations in which structures had anonymous structures contained within
themselves that were used as types for members within the outermost
structure, whether or not either was shared, e.g.
struct foo {
struct {
int womble;
} *baz;
};
In this situation, the innermost struct would not be noted by the duplicate
detector, which would lead to a failure to assemble the type later on, as CTF
assembly can't tell what CTF file it belongs in.
A large-scale rewrite was needed for this, transforming the duplicate detector
from a three-pass scheme with one sharer-of-all-obviously-duplicated-types
running first and last and one detector of transparent/opaque struct/union
aliasing running in the middle, into a scheme where the sharer-of-all runs once,
then the alias detector runs repeatedly, sharing opaque types for which the
corresponding transparent types are already shared, and recursively sharing
transparent types for which the opaque ones are already shared: in the latter
case, it triggers another rerun of the alias detector, in case that recursive
sharing run marks more structures as shared (opaque or transparent).
Worse yet, when we mark a type 'struct foo' as shared, this may not be enough --
there may be types which use that type as a base type which should also be
shared. So the alias detector now runs over not just all structures and unions
but all types which have structures and unions as an ultimate base type,
checking at each level of descent towards the structure whether sharing is
required, and recursively sharing everything from that level down if such is
needed. (This is done with a type_id() callback, like everything that
involves descending DWARF type use/def chains.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Mon, 30 Jul 2012 18:08:49 +0000 (19:08 +0100)]
ctf: optimize type_id() and fix array dimension lookup
type_id() is the single hottest hot spot in dwarf2ctf, and had a number of
more or less severe performance problems:
- we were calling str_append() where str_appendn() would do, incurring more
realloc()s and strlen()s than necessary.
- when calling type_id() for types such as structure members that have the same
type-id representation as their reffed type, we were calling the hook
function even though it's already been called with that ID by our recursive
call on the reffed type. Some hook functions are quite expensive, so this
is probably a bad idea.
- we were calling realpath() once per call, although a very limited number of
input arguments are expected (one per translation unit) and the mapping from
input to output never changes. This is a perfect candidate for caching.
The latter in particular has a vast impact on dwarf2ctf performance, reducing it
by around 80% in my tests.
str_append() and str_appendn() themselves were suboptimal, taking the length of
their arguments more times than necessary and calling realloc() more often than
required (once per argument after the first in the case of str_appendn().)
Now that we are using str_appendn() more heavily, this becomes a significant
contributor to runtime, so this is fixed too.
Further, array dimension lookup (both in type_id() and in
assemble_ctf_array_dimension()) was broken due to looping past the first array
dimension without looking at it. This tended to cause false sharing of
actually-distinct types (all one-dimensional arrays were treated as the same
type regardless of dimension, and since C only has one-dimensional arrays...)
We also add some comments noting that the format of type_id() and the
by-hand-constructed type IDs in the alias fixup code must be kept aligned, since
the breakage when this is not so is quite obscure and hard to figure out.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Sat, 28 Jul 2012 11:50:44 +0000 (12:50 +0100)]
ctf: store away the types and names of non-static global variables
The critical part of this change is assemble_ctf_variable(), which calls the new
ctf_add_variable() function to add a variable and its type information to the
appropriate CTF file (as determined by the deduplication pass).
Because we scan all scopes to detect non-opaque definitions of structures,
unions and enums used opaquely at global scope, and the functions called for
each DIE we understand tend to be quite expensive, we also introduce an
additional filtration mechanism (the 'assembly filter') to prevent DWARF tree
walks from calling an assembly function for DIEs we are not interested in.
We don't provide as much information to the assembly filter as to the assembly
function itself -- just the DIE and its parent DIE -- but that is enough to
prevent the assembly function from being called not only for variables but also
for base types, arrays, crv-qualified types, and pointer types at non-global
scope -- none of which we are interested in, since we care only about named
structures/unions/enums at non-global scope, and e.g.
typedef struct foo {
...
} *bar;
is represented as *three* DWARF nodes at the same level, one for 'struct foo',
one for a pointer to it, and one for a typedef of that. So there is no danger
that avoiding processing for such types will miss the structures we are
interested in.
For variables, we filter out all 'uninteresting' types using a new filter
function which rules out not only 'variables' with no name, static variables,
and variables at non-global scope, but also a large number of specifically-
named global variables introduced by macros to cover facilities as diverse as
tracepoints and the kernel symbol table. There is no chance that DTrace users
would want to look at these variables, so we don't need to store them in the
CTF. (We don't need to consider points-to relationships for variables, unlike
types, so that consideration does not apply.)
DTrace userspace contains a similar list to avoid reading in uninteresting lines
from /proc/kallmodsyms, but the two need not be synchronized: CTF for variables
that DTrace is filtering out will simply never be consulted, and variables that
DTrace does not filter out but that have been filtered out by dwarf2ctf will
have no CTF and will simply be rejected at parsing time.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Fri, 20 Jul 2012 22:00:07 +0000 (23:00 +0100)]
ctf: force dtrace_ctf.ko to be loaded whenever dtrace.ko is
DTrace userspace makes the simplifying assumption that dtrace_ctf.ko (containing
the CTF for the kernel, for built-in modules, and for shared types, but no code)
is always loaded whenever DTrace is usable. (The CTF itself is in a non-loaded
section, but having dtrace_ctf.ko in the list of loaded modules means that we
can eliminate an annoying set of dtrace_ctf-related special case.)
We do this by introducing a dummy function dtrace_ctf_forceload() into the
dtrace_ctf module, which DTrace then calls: depmod will then arrange for
dtrace_ctf to be loaded when we need it.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Fri, 11 May 2012 15:59:13 +0000 (16:59 +0100)]
ctf: generate CTF information for the kernel
This introdues a new tool, dwarf2ctf, which runs at modpost time whenever any
module or any part of the core kernel is changed, extracting the debugging
information from the kernel build tree, deduplicating it, and emitting it in
Sun's Compact Type Format into gzipped files in a new .ctf directory. These
files are then linked into the kernel modules as new sections named .SUNW_ctf.
One file is emitted per kernel module, whether builtin or no, as well as one
file for types that are used by no modules, and one file for types shared
between more than one of the other files. As the built-in modules and shared
types have no module of their own to go into, they are placed in a new
dtrace_ctf.ko module (which serves no other purpose: loading it is useless).
DTrace userspace will no longer start if this module is not present.
Due to the extensive sharing of types, dwarf2ctf must run whenever any object
files at all are changed, and may trigger relinks of modules that you would not
otherwise think had changed.
Standalone modules also have CTF generated for them, but never share types with
any other modules.
Because dwarf2ctf is slow enough to be annoying when running frequent kernel
builds to debug some unrelated problem, a new CONFIG_DT_DISABLE_CTF debugging
configuraton option is added, which suppresses CTF generation entirely.
This commit introduces new kernel build-time dependencies on elfutils and the
new libdtrace-ctf package (shared with dtrace userspace). No new runtime
dependencies are introduced.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Fri, 29 Jun 2012 20:06:28 +0000 (21:06 +0100)]
kallsyms: provide symbol sizes in /proc/kallmodsyms
For modules, we can simply extract these sizes from the module symtab; for core
kernel symbols, we must do subtraction as get_symbol_pos() did: this is now
abstracted into a new get_symbol_size().
Because /proc/kallmodsyms contains *all* symbols, where get_symbol_pos() was
normally only called for a small subset of symbols, this exercises this code
like never before, and has revealed a bug: the size of __per_cpu_end was being
returned as a ludicrously vast value, because the next symbol after
__per_cpu_end is far up the address space, in the kernel proper. Fixing this by
forcing a size of zero for __per_cpu_end is easy enough.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Mon, 18 Jun 2012 15:57:59 +0000 (16:57 +0100)]
kallsyms: fix /proc/kallmodsyms population bugs
scripts/kallsyms was failing to identify variables local to modules as being in
those modules, which is unfortunate because a large number of DTrace module
references are to data symbols.
This is easily enough fixed by recording variable references as well as function
references, which was all we were tracking before this. Alas, this breaks our
heuristic that symbols whose names are seen more than once must be outside all
modules, because external variable references can be seen multiple times inside
a single module even when the thing they are a reference to is also inside that
module. The fix to this is to differentiate between 'names seen in this module'
and 'names seen in prior modules', recording newly-seen names in the former list
and moving them en masse to the latter when we switch from scanning one module
to scanning another. We can then define a symbol as being 'not in any module'
iff it is seen while present in the names-seen-in-prior-modules list: a symbol
that is seen repeatedly but only inside a single module's object file is still
considered to be part of that module under this scheme.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Fri, 11 May 2012 20:21:33 +0000 (21:21 +0100)]
kallsyms: add /proc/kallmodsyms
This procfile (controlled by CONFIG_KALLSYMS), introduces a new
/proc/kallmodsyms whose contents are the same as /proc/kallsyms, except that the
module name is provided even for built-in modules, as long as they could
potentially have been built as separate kernel modules. DTrace will use it in
future to allow users to use the same module names in their D scripts regardless
of whether the modules are built-in or not in the kernel they happen to be
running.
This is done by scanning the object files named in the builtin.modules file
using libelf, extracting their function symbols, pruning out any symbols which
appear in more than one builtin module (since these are probably out-of-line
copies of inline functions in common kernel header files), then emitting the
names of all the modules in a new kallsyms_modules symbol and pointing at the
appropriate modules in a kallsyms_symbol_modules symbol which maps 1:1 to the
contents of kallsyms_addresses (thus, one kallsyms_symbol entry per kernel
symbol in /proc/kallsyms). Always-built-in functions have a corresponding
kallsyms_symbol_modules index of zero.
This is not terribly space-efficient: the kallsyms_symbol_modules symbol is
quite large (~250K, mostly zeroes, four bytes per kernel symbol), but reducing
this requires some other way to signal that a symbol is not present in a module.
It is much smaller than even the compressed representation of the symbol names.
Possible future enhancements, low priority:
- use a home-cooked hashtable rather than glib (pointless unless dwarf2ctf is
similarly rejigged)
- use nm rather than elfutils (liable to be quite a lot slower)
- find a more robust way of detecting inlined functions, not fooled by
out-of-line copies of inlined functions which happen to be used by
only one module
- shrink the kernel symbol space consumption, perhaps by using shorts rather
than longs for the module offsets (65536Kb of module names should be enough
for anybody)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Kris Van Hees [Tue, 7 Feb 2012 09:31:48 +0000 (04:31 -0500)]
dtrace: use new mutex_owned(), not mutex_is_locked()
This is used in our implementation of the Solaris MUTEX_HELD() macro.
The former was merely testing whether the mutex was locked, whereas
the real test needed here is whether the mutex is held by the current thread.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Kris Van Hees [Mon, 5 Dec 2011 20:01:27 +0000 (15:01 -0500)]
dtrace: SDT implementation
This adds core kernel support for providing a list of static probe
points for the kernel pseudo-module, dtrace SDT meta-provider support, ...
Also a new script (dtrace_sdt.sh) to extract locations of SDT probe points in
the core kernel.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Kris Van Hees [Mon, 14 Nov 2011 15:17:45 +0000 (10:17 -0500)]
dtrace: process the SDT probe point info early in boot
If DTrace SDT support has been enabled (built-in or as module),
process the SDT probe point info early at boot time (before SMP is actually
enabled). For now, provide some verbose info on the probe points getting
resolved.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Kris Van Hees [Fri, 11 Nov 2011 07:34:04 +0000 (02:34 -0500)]
dtrace: fix resolving addresses of relocation records for SDT probe points
The addresses were being calculated based on the wrong starting point (_stext
whereas it ought to be _text), and the base was not taken into account.
Fixed the writing of NOPs in the location of the probe point calls, since
the existing case was causing kernel paging faults. Made the add_nops()
function in alternative.c non-static so it can be used in sdt_register.
Use add_nops() to select the most appropriate NOP sequence for replacing the
probe point call, and write the NOPs using text_poke().
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Kris Van Hees [Thu, 3 Nov 2011 17:59:00 +0000 (13:59 -0400)]
dtrace: fix cyclic allocation
Fixed the allocation of cyclics that was the cause of some obscure crashes
during the testsuite execution. Problem was that cyclics were being allocated
in chunks, with a new array being allocated as (prev-size + chink-size), and
then the old entries being copied over. However, because the hrtimer struct is
embedded in the cyclic struct, this meant that hrtimer structs were being moved
outside the hrtimer code.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Kris Van Hees [Thu, 27 Oct 2011 14:39:19 +0000 (10:39 -0400)]
dtrace: stub-based syscall tracing
Due to the need for specialized code handling (mainly passing in a pt_regs
structure as one of the arguments), some syscalls are called through a stub
in assembly code.
We duplicate the stub cdode in dtrace_stubs_x86_64.S, but instead of calling
the actual syscall implementation code call our own syscall-specific handler,
which ensures that entry and return probes are called as enabled, and then
call the underlying implementation directly for handling the syscall.
Also removed debugging output that is no longer relevant (code cleanup).
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Stacktrace dumping has been moved to the GPL-licensed dtrace_os.c because it
depends on a symbol that is exported as GPL-only. Functionality in dtrace_isa
that requires stacktrace dumping can now use dtrace_stacktrace().
The GPL-licensed dtrace_os.h C header file is now made available through the
/include/linux hierarchy, and it is included in dtrace.h.
Fixed a bug in dtrace_relocs.c where section names where copied into a memory
area that was 1 byte short, causing various unpleasant forms of behaviour.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Nick Alcock [Mon, 3 Oct 2011 16:20:15 +0000 (17:20 +0100)]
dtrace: finish GPL/CDDL splitting work
kernel/dtrace and all that it #includes is now GPLv2, with the aid of a new
systrace_os.h header containing the subset of systrace.h needed by the GPL shim.
Conversely, dtrace/ is entirely CDDL.
dtrace_ioctl.h is now an exported, header in include/linux/, to ease future
sharing by the userspace side. It is probably not copyrightable (as is essential
for interoperability and contains no creative elements), but if it has any license
at all it is GPLv2 like the other headers in that directory (many of which are
include them.)
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Nick Alcock [Fri, 30 Sep 2011 17:55:09 +0000 (18:55 +0100)]
dtrace: Migrate to a standalone module, situated at the top level of the tree
Built via a simple 'make' if you're already running this kernel, or via 'make
KERNELDIR=/path/to/kernel/top/level' otherwise. Installed via 'make install'.
A specfile creating a standalone source rpm (which depends on the kernel source
RPM) will be added soon.
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
dtrace: changes in how we collect the names of system calls
We used to use the ftrace syscall meta info and the nr-to-meta functionality.
Now we populate the systrace info structure statically at kernel compile time.
This means that the DTrace code no longer depends on ftrace.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
dtrace: add dtrace_gethrtime() and fix walltimestamp.
The walltimestamp is required to be the time in nanoseconds since the epoch,
not the time in nanoseconds since boot or since dtrace invocation.
So we no longer need dtrace_mstate.dtms_walltimestamp, nor the flag used to
track its updating: but we *do* need a new way to get the time that is safe
for non-GPL use.
This fixes test/act/time.d (which is the only test that checks if walltimestamp
not only exists but returns the right value).
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Acked-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
Kris Van Hees [Wed, 31 Aug 2011 03:28:03 +0000 (23:28 -0400)]
dtrace: syscall entry/return probes.
Makes the sys call table writable, and replaces the function pointer
for select syscalls with the address of a wrapper function to enable
entry and return probe firing.
Fix for address range checking for copyin(str) operations and relatives.
It was using an incorrect boundary address, causing problems for some cases.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
This option enables printing all locations where a mutex is locked
and unlocked.
Implemented aggregations using the idr mechanism rather than the
Solaris-based 1-byte allocation technique to get unique IDs.
Various cleanup and small changes.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Randy Dunlap [Tue, 28 Jun 2011 00:17:17 +0000 (17:17 -0700)]
dtrace: convert relative probepoint relocation addresses to absolute
This should have been done by the top-level Makefile, but it must
have a dependency problem since the generated vmlinux_info.S has
the correct info in it but the vmlinux_info.o file does not AND
the .S file was created AFTER the .o file.
Also convert calls to dtrace stub RETs to NOPs.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Kris Van Hees [Mon, 13 Jun 2011 18:53:27 +0000 (14:53 -0400)]
dtrace: minimal cyclic implementation and debug code.
Adding debug code to track probe processing through BEGIN probe enabling.
Adding minimal implementation of cyclic functionality (based on hrtimer) as an
additional to the core kernel, linked in when dtrace is enabled (be it as
module, or compiled in). Exports cyclic_add() and cyclic_remove().
Removed former cyclic stub implementation (cyclic.c).
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Kris Van Hees [Tue, 24 May 2011 01:42:48 +0000 (21:42 -0400)]
dtrace: DT_SYSTRACE should not depend on FTRACE_SYSCALLS.
The systrace provider depends on the FTRACE_SYSCALLS kernel feature.
The systrace provider is actually called syscall on Solaris, so it has been
renamed on the Linux side (i.e. it registers itself as syscall).
Added some debug statements to track probe searches better.
The probes/probematch ioctl handling should return -ESRCH when the last hit
has been returned already.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Randy Dunlap [Fri, 10 Jun 2011 20:33:24 +0000 (13:33 -0700)]
dtrace: fix off-by-one reading relocation info.
Reading the dtrace relocation info table could fail on a
boundary condition. Fix by counting the string terminator (null)
byte. Now works for my 4 test cases.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Randy Dunlap [Tue, 7 Jun 2011 16:46:30 +0000 (09:46 -0700)]
dtrace: use _stext in dtrace_relocs.
Read and use the _stext value for adding to relative relocation
info to make it absolute.
This works for my 4 test cases. It was derived by examination
and discovery. There could be cases where it does not work,
e.g. in other text sections.
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Kris Van Hees [Fri, 20 May 2011 00:36:06 +0000 (20:36 -0400)]
dtrace: Fix compilation when modular.
Removed || CONFIG_DT_SDT_MODULE from conditional surrounding call to
dtrace_register_builtins() because that function does not exist in the
kernel proper when DTrace is compiled as kernel modules.
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Linus Torvalds [Sat, 20 Jun 2015 20:54:22 +0000 (13:54 -0700)]
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie:
"A smattering of fixes,
mgag200:
don't accept modes that aren't aligned properly as hw can't do it
i915:
two regression fixes
radeon:
one query to allow userspace fixes
one oops fixer for older hw with new options enabled"
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm/radeon: don't probe MST on hw we don't support it on
drm/radeon: Add RADEON_INFO_VA_UNMAP_WORKING query
drm/mgag200: Reject non-character-cell-aligned mode widths
Revert "drm/i915: Don't skip request retirement if the active list is empty"
drm/i915: Always reset vma->ggtt_view.pages cache on unbinding
Linus Torvalds [Fri, 19 Jun 2015 17:34:14 +0000 (07:34 -1000)]
Merge tag 'sound-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"Nothing looks scary, just a few usual HD-audio regression fixes and
fixup, in addition to a minor Kconfig dependency fix for the old MIPS
drivers"
* tag 'sound-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: hda - Fix unused label skip_i915
ALSA: hda - Fix noisy outputs on Dell XPS13 (2015 model)
ALSA: mips: let SND_SGI_O2 select SND_PCM
ALSA: hda - Fix audio crackles on Dell Latitude E7x40
ALSA: hda - adding a DAC/pin preference map for a HP Envy TS machine
Boris Brezillon [Fri, 27 Mar 2015 22:53:15 +0000 (23:53 +0100)]
clk: at91: pll: fix input range validity check
The PLL impose a certain input range to work correctly, but it appears that
this input range does not apply on the input clock (or parent clock) but
on the input clock after it has passed the PLL divisor.
Fix the implementation accordingly.
Cc: <stable@vger.kernel.org> # v3.14+ Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Reported-by: Jonas Andersson <jonas@microbit.se>
Linus Torvalds [Fri, 19 Jun 2015 03:02:27 +0000 (17:02 -1000)]
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c documentation fix from Wolfram Sang:
"Here is a small documentation fix for I2C.
We already had a user who unsuccessfully tried to get the new slave
framework running with the currently broken example. So, before this
happens again, I'd like to have this how-to-use section fixed for 4.1
already. So that no more hacking time is wasted"
* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: slave: fix the example how to instantiate from userspace
Dave Airlie [Fri, 19 Jun 2015 01:58:39 +0000 (11:58 +1000)]
Merge tag 'drm-intel-fixes-2015-06-18' of git://anongit.freedesktop.org/drm-intel into drm-fixes
one fix, one revert
* tag 'drm-intel-fixes-2015-06-18' of git://anongit.freedesktop.org/drm-intel:
Revert "drm/i915: Don't skip request retirement if the active list is empty"
drm/i915: Always reset vma->ggtt_view.pages cache on unbinding
Dave Airlie [Fri, 19 Jun 2015 01:55:29 +0000 (11:55 +1000)]
Merge branch 'drm-fixes-4.1' of git://people.freedesktop.org/~deathsimple/linux into drm-fixes
two radeon fixes
one MST fix,
one query addition, destined for stable, and to fix a regression
* 'drm-fixes-4.1' of git://people.freedesktop.org/~deathsimple/linux:
drm/radeon: don't probe MST on hw we don't support it on
drm/radeon: Add RADEON_INFO_VA_UNMAP_WORKING query
Linus Torvalds [Thu, 18 Jun 2015 06:56:57 +0000 (20:56 -1000)]
Merge tag 'trace-fix-filter-4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing filter fix from Steven Rostedt:
"Vince Weaver reported a warning when he added perf event filters into
his fuzzer tests. There's a missing check of balanced operations when
parenthesis are used, and this triggers a WARN_ON() and when reading
the failure, the filter reports no failure occurred.
The operands were not being checked if they match, this adds that"
* tag 'trace-fix-filter-4.1-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Have filter check for balanced ops
Since when we start discussions about the usage Media Controller for
complex hardware, one thing become clear: the way it is, MC fails to
map anything different than capture/output/m2m video-only streaming.
The point is that MC has entities named as devnodes, but the only
devnode used (before the DVB patches) is MEDIA_ENT_T_DEVNODE_V4L.
Due to the way MC got implemented, however, this entity actually
doesn't represent the devnode, but the hardware I/O engine that
receives data via DMA.
By coincidence, such DMA is associated with the V4L device node
on webcam hardware, but this is not true even for other V4L2
devices. For example, on USB hardware, the DMA is done via the
USB controller. The data passes though a in-kernel filter that
strips off the URB headers. Other V4L2 devices like radio may not
even have DMA. When it have, the DMA is done via ALSA, and not
via the V4L devnode.
In other words, MC is broken as a whole, but tagging it as BROKEN
right now would do more harm than good.
So, instead, let's mark, for now, the DVB part as broken and
block all new changes to MC while we fix this mess, whith
we hopefully will do for the next Kernel version.
Hugh Dickins [Sun, 14 Jun 2015 16:48:09 +0000 (09:48 -0700)]
mm: shmem_zero_setup skip security check and lockdep conflict with XFS
It appears that, at some point last year, XFS made directory handling
changes which bring it into lockdep conflict with shmem_zero_setup():
it is surprising that mmap() can clone an inode while holding mmap_sem,
but that has been so for many years.
Since those few lockdep traces that I've seen all implicated selinux,
I'm hoping that we can use the __shmem_file_setup(,,,S_PRIVATE) which
v3.13's commit c7277090927a ("security: shmem: implement kernel private
shmem inodes") introduced to avoid LSM checks on kernel-internal inodes:
the mmap("/dev/zero") cloned inode is indeed a kernel-internal detail.
This also covers the !CONFIG_SHMEM use of ramfs to support /dev/zero
(and MAP_SHARED|MAP_ANONYMOUS). I thought there were also drivers
which cloned inode in mmap(), but if so, I cannot locate them now.
Wolfram Sang [Mon, 15 Jun 2015 17:51:46 +0000 (19:51 +0200)]
i2c: slave: fix the example how to instantiate from userspace
I copied the wrong shell code into the documentation. Sorry to all who
tried to get sense out of this current example :/ Slight rewording while
we are here.
Reported-by: Tim Bakker <bakkert@mymail.vcu.edu> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
Worse yet, reading the error message (the filter again) it says that
there was no error, when there clearly was. The issue is that the
code that checks the input does not check for balanced ops. That is,
having an op between a closed parenthesis and the next token.
This would only cause a warning, and fail out before doing any real
harm, but it should still not caues a warning, and the error reported
should work:
Takashi Iwai [Tue, 16 Jun 2015 10:23:36 +0000 (12:23 +0200)]
ALSA: hda - Fix unused label skip_i915
When CONFIG_SND_HDA_I915=n, we get a compile warning:
sound/pci/hda/hda_intel.c: In function ‘azx_probe_continue’:
sound/pci/hda/hda_intel.c:1882:2: warning: label ‘skip_i915’ defined but not used [-Wunused-label]
Fix it by putting again ifdef to it. Sigh.
Fixes: bf06848bdbe5 ('ALSA: hda - Continue probing even if i915 binding fails') Reported-by: Borislav Petkov <bp@suse.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Steve Cornelius [Mon, 15 Jun 2015 23:52:59 +0000 (16:52 -0700)]
crypto: caam - fix RNG buffer cache alignment
The hwrng output buffers (2) are cast inside of a a struct (caam_rng_ctx)
allocated in one DMA-tagged region. While the kernel's heap allocator
should place the overall struct on a cacheline aligned boundary, the 2
buffers contained within may not necessarily align. Consenquently, the ends
of unaligned buffers may not fully flush, and if so, stale data will be left
behind, resulting in small repeating patterns.
This fix aligns the buffers inside the struct.
Note that not all of the data inside caam_rng_ctx necessarily needs to be
DMA-tagged, only the buffers themselves require this. However, a fix would
incur the expense of error-handling bloat in the case of allocation failure.
Cc: stable@vger.kernel.org Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Steve Cornelius [Mon, 15 Jun 2015 23:52:56 +0000 (16:52 -0700)]
crypto: caam - improve initalization for context state saves
Multiple function in asynchronous hashing use a saved-state block,
a.k.a. struct caam_hash_state, which holds a stash of information
between requests (init/update/final). Certain values in this state
block are loaded for processing using an inline-if, and when this
is done, the potential for uninitialized data can pose conflicts.
Therefore, this patch improves initialization of state data to
prevent false assignments using uninitialized data in the state block.
This patch addresses the following traceback, originating in
ahash_final_ctx(), although a problem like this could certainly
exhibit other symptoms:
Cc: stable@vger.kernel.org Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Radim Krčmář [Fri, 5 Jun 2015 18:57:41 +0000 (20:57 +0200)]
KVM: x86: fix lapic.timer_mode on restore
lapic.timer_mode was not properly initialized after migration, which
broke few useful things, like login, by making every sleep eternal.
Fix this by calling apic_update_lvtt in kvm_apic_post_state_restore.
There are other slowpaths that update lvtt, so this patch makes sure
something similar doesn't happen again by calling apic_update_lvtt
after every modification.
Cc: stable@vger.kernel.org Fixes: f30ebc312ca9 ("KVM: x86: optimize some accesses to LVTT and SPIV") Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>