Age | Commit message (Collapse) | Author |
|
Calls to erlang:set_trace_pattern/3 will no longer block all
other schedulers.
We will still go to single-scheduler mode when new code is loaded
for a module that is traced, or when loading code when there is a
default trace pattern set. That is not impossible to fix, but that
requires much closer cooperation between tracing BIFs and the loader
BIFs.
|
|
* maint:
Remove stale code for hybrid heap and incremental GC
Remove the hipe_bifs:show_message_area/0 BIF
Remove support for erlang:system_info(global_heaps_size)
Remove the erlang:garbage_collect_message_area/0 BIF
Remove workarounds for hybrid and shared heaps in test suites
Conflicts:
erts/doc/src/erlang.xml
erts/emulator/beam/erl_message.c
erts/emulator/beam/erl_process.c
erts/emulator/beam/erl_process.h
erts/emulator/hipe/hipe_bif2.tab
lib/hipe/cerl/erl_bif_types.erl
|
|
The hybrid heap emulator was last working in the non-SMP R11B
run-time system. When the constant pools were introduced in R12B,
the hybrid heap emulator was not updated to handle them.
At this point, the harm from reduced readability of the code is
greater than any potential usefulness of keeping the code.
|
|
* rickard/proc-sched/OTP-9892:
Teach etp-commands to understand new emulator internal data structures
Optimize process state changes
Optimize process table access
Implement possibility to use ordinary mutexes as process locks
Conflicts:
erts/emulator/beam/erl_alloc.types
|
|
|
|
Conflicts:
lib/hipe/cerl/erl_bif_types.erl
|
|
This reverts commit d4667d383964c1550e0a91d64b674e84f6d07e3b.
This commit was included by mistake, the correct patch will
be merged from maint.
|
|
|
|
When spawning OS (unix) processes with erlang:open_port, store the
resulting unix pid so that it can be queried later on using
erlang:port_info/1,2.
|
|
|
|
|
|
|
|
Conflicts:
erts/emulator/beam/beam_emu.c
erts/emulator/beam/bif.tab
erts/preloaded/ebin/prim_file.beam
lib/hipe/cerl/erl_bif_types.erl
|
|
The fun names may look ugly, but if we clean them up we can't
distinguish calls to the function defining the fun and to the
fun itself.
|
|
|
|
Since it's been quite a while since I've written C code, *and* I
haven't done any significant hacking on the VM itself in years, it's
quite likely that I haven't done things in 100% proper style. Or
my co-collaborators Dustin Sallings (CouchBase) or Michal Ptaszek
(Erlang Solutions). My intent for this patch is to start discussion
and review of DTrace support for consideration for the R15 release.
For additional background on the motivation for this work, please
see the slides for the presentation at the Erlang User Conference 2011
in Stockholm:
https://www.erlang-factory.com/upload/presentations/462/euc2011-draft2.pdf
Changes relative to dtrace-review2 branch:
* Fix errors in OTP test suite 'kernel' file_SUITE
* Fix errors in OTP test suite 'kernel' prim_file_SUITE
* Fix bad pointer bug in efile_drv.c flush_write()
* Move the DTrace material from the top of `README.md` into a
new file, `README.dtrace.md`
Changes since last push to GitHub (relative to commit 5828a4fb28, which
was the former `dtrace-review1` branch):
* Rebased onto 14 Nov 2011's "master" branch
* Recent changes to the async task queuing mechanism means that
the async worker queue length is not available. A bogus value
of -1 is hard-coded until there's a good way to peek into the
new queue structure and find the queue length.
* Small fixes based on review comments by Mikael Pettersson,
Andrew Thompson, and Andreas Schultz.
Add autoconf support: use "./configure --enable-dtrace" on all supported
platforms:
* OS X Snow Leopard or later
* Solaris 10 or OpenSolaris
* Linux, via SystemTap's DTrace compatibility packages
* FreeBSD 9.0RC1. FreeBSD 8 and earlier do not have support
for USDT, DTrace's User-land Statically Defined Tracing.
See the file `erts/emulator/beam/erlang_dtrace.d` for the definition
of all DTrace probes in the virtual machine so far.
Example D scripts can be found in `lib/dtrace/examples`. Note that if
you see the error message `{name of probe} does not match any probes`,
then there is no Erlang VM process + DTrace probes running. To fix,
start a DTrace-enabled VM or remove `-q` from the `dtrace` command line.
The `lib/dtrace` directory contains a small code-only OTP application
that contains code that allows Erlang code to trigger a DTrace probe.
Dynamic creation & deletion of DTrace probes is not currently
supported, so the `dtrace:p()` function is hacked to allow a variable
number of arguments (up to four integers and up to four strings) to be
used. See the comments at the top of `lib/dtrace/src/dtrace.c` for
more detail.
One feature that may be controversial is the notion I've introduced
of a special process dictionary key that can be used by Erlang code to
tag I/O operations for an application-specific purpose. Right now,
that tag's name is `dtrace_utag`. The dictionary keys used by `sys`
and other modules start with a dollar sign. Perhaps there is some
convention (but not a dollar sign?) that this tag should use?
The purpose of the process dictionary key is to allow the tag to
be included in trace messages, e.g. for file I/O, without changing the
API of the `file.erl` module's functions. For example, here's a use
of the tag when calling the `file:rename/2` function:
(bar@sbb2)1> put(dtrace_utag, "GGOOOAAALL!!!!!").
undefined
(bar@sbb2)2> dtrace:init().
ok
%% Now start both the `user-probe.d` and `efile_drv.d` D scripts
%% found in the `lib/dtrace/examples` directory.
(bar@sbb2)3> dtrace:p(7, 8, 9, "one", "four").
true
%% The output from the `user-probe.d` script:
<0.40.0> GGOOOAAALL!!!!! 7 8 9 0 'one' 'four' '' ''
(bar@sbb2)4> file:rename("old-name", "new-name").
{error,enoent}
%% The output from the `efile_drv.d` script:
async I/O pool port #Port<0.59> queue len 1
async I/O pool port #Port<0.59> queue len 0
efile_drv enter tag={1,110} user tag GGOOOAAALL!!!!! | RENAME (12) | args: old-name new-name , 0 0 (port #Port<0.59>)
async I/O worker tag={1,110} | RENAME (12) | efile_drv-int_entry
async I/O worker tag={1,110} | RENAME (12) | efile_drv-int_return
efile_drv return tag={1,110} user tag GGOOOAAALL!!!!! | RENAME (12) | errno 2
I'm not exactly happy with this choice of tagging, namely using
`put(dtrace_utag, Tag::list())`. But this is an experiment, so
we'll see how it goes. I can't imagine changing the API for
all file.erl functions in order pass the tag explicitly.
Some modules have some extensive (ab)use of the C preprocessor to
reduce the amount of #ifdefs that clutter the code. In several places,
I have not #ifdef'ed automatic variables because of clutter. For the
same reason, there are a handful of cases where I added DTrace-related
members to a struct definition without an #ifdef. I feel that the
result is easier to read than earlier drafts where I did use many more
`https://github.com/slfritchie/otp/tree/dtrace-experiment+michal2` if
you're curious.) I expect there may be some debate about whether the
bloat of the affected structs is worthwhile. I erred on adding stuff
to structs, especially in the efile_drv.c driver, not having a full
grasp on what was thread-safe and what was not ... so I erred on the
side of caution.
The efile_drv.c has a work-around for a crazy GCC optimization bug.
Thank goodness for Google, I dunno how I would've found a work-around
for this silly thing. Many thanks to Trond Norbye for writing clearly
about the problem in a membase Git repo commit message.
/*
* A note on probe naming: if "__" appears in a provider probe
* definition, then two things happen during compilation:
*
* 1. The "__" will turn into a hypen, "-", for the probe name.
* 2. The "__" will turn into a single underscore, "_", for the
* macro names and function definitions that the compiler and
* C developers will see.
*
* We'll try to use the following naming convention. We're a bit
* limited because, as a USDT probe, we can only specify the 4th part
* of the probe name, e.g. erlang*:::mumble. The 2nd part of the
* probe name is always going to be "beam" or "beam.smp", and the 3rd
* part of the probe name will always be the name of the function
* that's calling the probe.
*
* So, all probes will be have names defined in this file using the
* convention category__name or category__sub_category__name. This
* will translate to probe names of category-name or
* category-sub_category-name.
*
* Each of "category", "sub_category", and "name" may have underscores
* but may not have hyphens.
*/
Add tentative support for sequential tracing sending, queueing, and
receiving a message. I don't believe I've fully covered all the major
places where it would be useful to have the sequential trace token info
in a probe -- guidance from the OTP team would be helpful, if there's
time to do that kind of review.
Add global variable `erts_this_node_sysname`.
|
|
Conflicts:
erts/doc/src/erlang.xml
erts/emulator/beam/erl_process.c
erts/emulator/beam/erl_process.h
erts/emulator/test/bif_SUITE.erl
erts/preloaded/ebin/erlang.beam
erts/preloaded/src/erlang.erl
lib/hipe/cerl/erl_bif_types.erl
|
|
|
|
|
|
When spawning OS (unix) processes with erlang:open_port, store the
resulting unix pid so that it can be queried later on using
erlang:port_info/1,2.
|
|
|
|
Introduce two new BIFs, erlang:prepare_loading/2 and
erlang:finish_loading/1, and re-implement erlang:load_module/2 in
Erlang code.
We have two reasons for doing this:
* To facilitate suspending a process if another process
is already doing code loading.
* In the future, we can implement parallel and atomic loading
of several modules. Atomic loading works except for modules with
on_load handlers. Because of that issue, erlang:finish_loading/2
will currently only accept a list with a single magic binary.
|
|
|
|
Made on_load-tracing always set after commit on active
code_ix when system is still blocked.
Bug caused cprof_SUITE:on_load to fail.
|
|
|
|
Staging is a better and more general name as does not necessary need
to involve code loading (can be deletion, tracing, etc).
|
|
As it can only be used at initialization for preloading
|
|
|
|
Having the entire implementation of range handling (address table)
in one source file will help when we'll need to update the ranges
without stopping all schedulers in the next commit.
|
|
Still blocking code loading
|
|
Code loading still blocking
|
|
|
|
|
|
|
|
|
|
|
|
Almost all uses of the 'long' datatype is removed from VM and tests
Emulator test now runs w/o drivers crashing
Nasty abs bug fixed in VM as well as type errors in allocator debug functions
Still one allocator test that fails, domain knowledge is needed to fix that.
Fix type inconsistency in beam_load causing crashes
|
|
|
|
* rickard/rm-common-runq/OTP-9727:
Remove common run-queue in SMP case
Fix scheduler suspend bug
Conflicts:
erts/emulator/beam/erl_init.c
|
|
The common run-queue implementation is removed since it is unused,
untested, undocumented, unsupported, and only complicates the code.
A spinlock used by the run-queue management sometimes got heavily
contended. This code has now been rewritten, and the spinlock
has been removed.
|
|
To simplify the implementation of literal pools (constant pools)
for the R12 release, a shortcut was taken regarding binaries --
all binaries would be stored as heap binaries regardless of size.
To allow a module containing literals to be unloaded, literal
terms are copied when sent to another process. That means that
huge literal binaries will also be copied if they are sent to
another process, which could be surprising.
Another problem is that the arity field in the header for the heap
object may not be wide enough to handle big binaries.
Therefore, bite the bullet and allow refc binaries to be stored
in literal pools. In short, the following need to be changed:
* Each loaded module needs a MSO list, linking all refc binaries
in the literal pool.
* When check_process_code/2 copies literals to a process heap,
it must link each referenced binary into the MSO list for the
process and increment the reference counter for the binary.
* purge_module/1 must decrement the reference counter for each
refc binary in the literal pool.
|
|
Break apart code loading into the three functions:
erts_alloc_loader_state()
erts_prepare_loading()
erts_finish_loading()
The erts_alloc_loader_state() and erts_prepare_loading() can be
executed with all schedulers running. Only erts_finish_loading()
needs to be run in a single-scheduling system.
|
|
There is no reason to have erts_load_module() return integer values,
only to have the caller convert the values to atoms. Return the
appropriate atom directly from the place where the error is generated
instead. Return NIL if the module was successfully loaded.
|
|
The -l option used to print information about modules being loaded,
but now it prints very little information.
|
|
* rickard/generic-thr-queue/OTP-9632:
Use generic lock-free queue for async threads
Use generic lock-free queue for misc aux work
Implement generic lock-free queue
|
|
* rickard/alloc-opt/OTP-7775:
Optimize memory allocation
Conflicts:
erts/aclocal.m4
erts/emulator/hipe/hipe_bif_list.m4
erts/preloaded/ebin/erl_prim_loader.beam
erts/preloaded/ebin/erlang.beam
erts/preloaded/ebin/init.beam
erts/preloaded/ebin/otp_ring0.beam
erts/preloaded/ebin/prim_file.beam
erts/preloaded/ebin/prim_inet.beam
erts/preloaded/ebin/prim_zip.beam
erts/preloaded/ebin/zlib.beam
|
|
Queues used for communication between async threads and scheduler threads
have been replaced with lock-free queues.
Drivers using the driver_async functionality are not automatically locked
to the system anymore, and can be unloaded as any dynamically linked in
driver.
Scheduling of ready async jobs is now also interleaved in between other
jobs. Previously all ready async jobs was performed at once.
|
|
A number of memory allocation optimizations have been implemented. Most
optimizations reduce contention caused by synchronization between
threads during allocation and deallocation of memory. Most notably:
* Synchronization of memory management in scheduler specific allocator
instances has been rewritten to use lock-free synchronization.
* Synchronization of memory management in scheduler specific
pre-allocators has been rewritten to use lock-free synchronization.
* The 'mseg_alloc' memory segment allocator now use scheduler specific
instances instead of one instance. Apart from reducing contention
this also ensures that memory allocators always create memory
segments on the local NUMA node on a NUMA system.
|
|
The current calling convention for BIFs makes it necessary to
handle each arity specially, since each argument for the BIF
also becomes an argument for the C function implementing the BIF,
which makes it hard to allow BIFs with any number of arguments.
Change the calling convention for BIFs, so that BIF arguments are
passed in an array to the C function implementing the BIF.
|
|
As a preparation for changing the calling convention for
BIFs, make sure that all BIFs use the macros. Also, eliminate
all calls from one BIF to another, since that also breaks
the calling convention abstraction.
|