Commit Graph

212 Commits

Author SHA1 Message Date
yuhong.tao@intel.com ec860097d1 tools: acrn-manager: code cleanup
remove test code in acrn_mngr.h

Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-19 11:08:18 +08:00
yuhong.tao@intel.com be80086706 tools: Makefile: fix lack of dependence for acrm_mngr.h
$(OUT_DIR)/acrm_mngr.h miss dependence of ./acrm_mngr.h, that can
cause build problems.
DM & SOS-LCS are built with $(OUT_DIR)/acrm_mngr.h, which is a
copy of tools/acrn-manager/acrm_mngr.h. So when
tools/acrn-manager/acrm_mngr.h is modified, $(OUT_DIR)/acrm_mngr.h
should be updated too.

Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-19 11:08:18 +08:00
David B. Kinder 988a3fe0d6 doc: use code-block:: none for command examples
The ``.. code-block::`` directive can specify a highlight language for
the body of the directive.  Previously the languages "none" and
"console" were the same, but we're now using "console" for creating
terminal-looking output (rather than doing images of terminal windows)
with a black background and white text.

This PR replaces unintended uses of the "console" highlighting language
with "none".

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-07-18 09:31:29 -07:00
yuhong.tao@intel.com dc6d7755e4 tools: acrnd: update README.rst
Reviewed-by: Yan Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-18 09:20:13 -07:00
yuhong.tao@intel.com 7706e5cef4 tools: acrnd: store/load timer list
When system is going to shutdown, or someone kills Acrnd, and
Acrnd still hold some UOS works in its timer list. Thus Acrnd need
to store UOS timer works to file, so that Acrnd can load and
continue these uncompleted works as it is restarted.

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
yuhong.tao@intel.com e435f03eda tools: acrnd: handle timer request from UOS
DM can send ACRND_TIMER to Acrnd, then acrnd will setup a timer
for it. When this time is expired, acrnd will try to make this
UOS run again.

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
yuhong.tao@intel.com ee9ec9d3bf tools: acrnd: the acrnd work list
Acrnd can and put delayed work functions in a work list.

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
yuhong.tao@intel.com f5e9c768e3 tools: acrnd: handle resume request from SOS-LCS
SOS-Life-Cycle-Service can send ACRND_RESUME to Acrnd. Acrnd first
check If there is a timer list to be load. Then check wakeup reason,
just wait timer works to expire when wakeup reason is RTC, or acrnd
will start/resume all VMs.

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
yuhong.tao@intel.com 04ed916f26 tools: acrnd: handle stop request from SOS-LCS
SOS-Life-Cycle-Service can ask acrnd to stop UOSs, by sending
ACRND_STOP to Acrnd. Acrnd handles this request by:
1. Try stop all running VMs, and return the result to SOS-LCS.
2. Store pending works of restarting/resuming VMs to file

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
yuhong.tao@intel.com bcb101f4f0 tools: acrnd: the deamon for acrn-manager
There will be a daemon running on SOS: to forward wakeup_reason to
acrn-dm; to co-ordinate the lifecycle of VMs and SOS; to handle
ioc-timed wakeup/poweron.

1.to forward wakeup_reason to acrn-dm
acrnd is responsible to retrive wakeup_reason from SOS lifecycle
service and attach the wakeup_reason to acrn-dm parameter for ioc-dm;

2.co-ordinate the lifecycle of VMs and SOS
When SOS is about to suspend/shutdown, SOS lifecycle service will
send a request to acrnd to guarantee all guest VMs are suspended
or shutdown before SOS suspending/shutdown process continue. On
receiver the request, acrnd starts polling the guest VMs state, and
notify SOS lifecycle service when all guest VMs are put in proper
state gracefully.

3.handle ioc-timed wakeup/poweron
For vechile specific mode like garage mode, guest UOS may need to
wakeup/poweron in a future time for tasks such as map updating etc.
To setup a timed wakeup/poweron, ioc-dm will send request to acrnd,
acrnd maintains a list of timed requests from guest VMs, and acrnd
selects the nearest request and send it to SOS lifecycle service
who will setup the physical IOC.

Reviewed-by: Yan Like <like.yan@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
yuhong.tao@intel.com c4f9a2fd70 tools: rework on vm ops
There are some problems to use VM operations in a deamon process,
such as Acrnd.  the list_vm() does not return VM informations, it
just print VM information to stdio, so we have get_vm_list()
to get VM list head vmngr_head; get_vm_list() always creates a
new fresh vm list every time, and must use put_vm_list() to delete
old list. So Acrnd need to create and destroy vm list frequently.
In fact we just need the vmngr_head to be an extern variable. And
to make it refreshable.We can insert new VMs, remove dead ones,
and update their state.

Reviewed-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-07-16 16:04:34 +08:00
Liu, Xinwu b30ba3db15 tools:acrn-crashlog: Detect and classify the crash in ACRN and kernel
Since ACRN has the capability to reboot and reboot reason is available
in SOS, acrnprobe could detect the crash of acrn and SOS kernel.

List of added crash types:

1. ACRNCRASH            - crashed in hypervisor, this detection depends on
                          files in /tmp/acrnlog_last(provided by acrnlog).
2. IPANIC               - crashed in SOS kernel, this detection depends on
                          pstore.
3. SWWDT_IPANIC         - crashed in SOS kernel and reboot reason is wdt.
4. HWWDT_UNHANDLE       - only recognize reboot reason is global, there is no
                          further clues that it's a SOS kernel crash or a
                          hypervisor crash.
5. SWWDT_UNHANDLE       - only recognize reboot reason is wdt, there is no
                          further clues that it's a SOS kernel crash or a
                          hypervisor crash.
6. UNKNOWN              - only recognize reboot reason is warm, there is no
                          further clues that it's a SOS kernel crash or a
                          hypervisor crash.

Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-07-12 17:29:51 +08:00
Liu, Xinwu a5853d6d8a tools:acrn-crashlog: Improve the process of crash reclassify
1. Reload the trigger file(s) of subcrash while doing crash reclassify.
2. Support simple format for trigger file.

Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-07-12 17:29:51 +08:00
Liu, Xinwu 0683b16573 tools:acrn-crashlog: Get reboot reason in acrnprobe
Get system reboot reason from kernel commandline.

Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-07-12 17:29:51 +08:00
Kaige Fu b52be90a2f tools: acrntrace: Fix wrong event id in vmexit_analyze.py
Value of VMEXIT_XXX must have the same as TRACE_VMEXIT_XXX defined in
./hypervisor/include/debug/trace.h. This patch fix the events with wrong event id.

Fixes: 8a233ee (tools: acrntrace: Refactor vmexit_analyzer based on new trace format)

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-11 09:24:44 +08:00
Kaige Fu 636515aac2 tools: acrntrace: Remove use of binary "mkdir"
The tools currently rely on the availability of binary "mkdir" to be available
in the $PATH on the Service OS. This creates an obscure dependency. The patch
changes the code to use standard C APIs to perform the same functionality which
makes the code more self-contained.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-11 09:24:07 +08:00
Kaige Fu e699462161 tools: acrntrace: Remove use of binary "ls"
The tools currently rely on the availability of binary "ls" to be available in
the $PATH on the Service OS. This create an obscure dependency. The patch changes
the code to use standard C APIs to perform the same functionality which makes
the code more self-contained.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-11 09:24:07 +08:00
Kaige Fu a2a412244c tools: acrntrace: Remove unused function get_cpu_freq
Function get_cpu_freq is not used anymore. This patch remove it.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-11 09:24:07 +08:00
Kaige Fu c7f26ba962 tools: acrntrace: Add support for TRACE_6C/16STR
We have TRACE_6C and TRACE_16STR API in hypervisor now. It's time to add support
for parsing data traced by both APIs.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-10 12:51:59 +08:00
Kaige Fu 3195bc481b tools: acrnlog: Deprecate binary "rm" and "mkdir" with GPLv3+
The tools currently rely on the availability of binary "rm" and "mkdir" to be
available in the $PATH on the Service OS. This create an obscure dependency.
The patch changes the code to use standard C APIs to perform the same functionality
which makes the code more self-contained.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-10 12:51:59 +08:00
Kaige Fu 8869c862d6 tools: acrnlog: Deprecate binary "ls" with GPLv3+
The tools currently rely on the availability of binary "ls" to be available in
the $PATH on the Service OS. This create an obscure dependency. The patch changes
the code to use standard C APIs to perform the same functionality which makes
the code more self-contained.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
2018-07-10 12:51:59 +08:00
Miguel Bernal Marin 1d24a045a8 acrn-bridge: improve systemd network units
To be sorted in lexical order let's add a 50- prefix to the systemd
network units files.

Now these systemd network units will be processed before the other units
prefixed by 80-. And the first (in lexical order) of the network files
that matches a given device is applied, all later files are ignored,
even if they match as well.

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-09 11:49:30 +08:00
Miguel Bernal Marin eff7353e11 acrn-bridge: Do not overwrite system files
We can not overwrite system files, there are others ways to overwrite
configuration.

Fixes: b7ad7052bd ("convert bridge creation to service")
Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-09 11:49:30 +08:00
CHEN Gang 6494708f2f tools: acrn-crashlog: fix potential buffer overflow issues
This patch is to fix the potential buffer overflow issues.

Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: xiaojin2 <xiaojing.liu@intel.com>
2018-07-09 09:25:15 +08:00
David B. Kinder 8d3847d216 doc: fix acrntrace parameter documentation
Fix missing parameter documentation, and a misspelling

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-07-06 00:35:23 -07:00
Kaige Fu d7f071200d tools: acrntrace: Add option -t for max capture time
If option -t is configured, a timer will be set with configured timeout when
launching acrntrace. When timer fired, acrntrace will exit.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-06 11:54:02 +08:00
Kaige Fu 5042ba6009 tools: acrntrace: Change option -t to -i
Option -i is more suitable for interval. Meanwhile, we will use option -t for
timeout in later patch.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-06 11:54:02 +08:00
Kaige Fu b04e799b31 tools :acrntrace: Reserved configurable space on the disk
acrntrace writes trace data to /tmp with unlimited size and will cause tmpfs
100% occupied. Consequently, some problem will raise up on SOS, like failing to
exec cmd.

This patch introduce an option -r to let user configre minimal space left on the
disk which ensures that acrntrace will exit when free storage space is less than
the reserved space. By default, we reserve 512M on the disk. Users can configure
reserved space through '-r'.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-06 11:54:02 +08:00
Kaige Fu 85a5668b90 tools: acrntrace: Updata README.rst
-Add acrntrace_format.py usage to README.rst
-Add acrntrace usage to README.rst
-Add acrnanalyze.py to README.rst

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-04 17:23:09 -07:00
CHEN Gang 31ebd98797 tools: acrn-crashlog: replace ldconfig with pkg-config in Makefile
This patch is to fix the dependency issue with autospec.

Using ldconfig in the autospec build environment is not
going to work as the packages do not have the cache
generate after a rpm install. This patch replaces ldconfig
with pkg-config to check the existance of the libraries.

Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Jin Zhi <zhi.jin@intel.com>
Reviewed-by: Liu Xinwu <xinwu.liu@intel.com>
Acked-by: Zhang Di <di.zhang@intel.com>
2018-07-03 16:44:58 +08:00
Kaige Fu 5907400182 tools: acrntrace: Remove unused pre_process.sh
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-03 10:19:31 +08:00
Kaige Fu ad89a22011 tools: acrntrace: Make all python scripts python3 module
The trend is to focus on Python3 and deprecate Python2. This patch make all the
acrntrace related scripts as Python3 module.

  - Add parentheses to all the print as Python3 required.

  - Remove suffix L and long() Python3 has deprecated. Python3 will treat all
    intergers as long.

  - Replace has_key() with "key in .keys()" because has_key() has been deprecated.

  - Other minor fixes.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-07-03 10:19:31 +08:00
Liu, Xinwu 41b39c5e1f tools: acrn-crashlog: Defer the vm events processing when failed
In the original design, acrnprobe marked all handled VMs'events as "synced"
in file vmrecordid(this patch changes the name to VM_eventsID.log).
Currently, the Android log events are not logged if the first attempt at
reading collecting them from the VM fails. This patch changes the logic
so that the acrn-crashlog tool will retry continuously.

This patch defines different tags for handled VMs'events, and only marks
VMs'events "synced" after it returns successfully.

Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Jin Zhi <zhi.jin@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Chen gang <gang.c.chen@intel.com>
2018-06-29 15:23:18 +08:00
Kaige Fu 136d5c30fb tools: acrntrace: Add irq related analyzer
This analyzer is implemented in vmexit_analyze. This patch make it as independent
analyzer with an option "--irq"

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 13:05:27 +08:00
Kaige Fu 8a233eec63 tools: acrntrace: Refactor vmexit_analyzer based on new trace format
- Refactor vmexit_analyzer based on new trace format (raw data). We can get
    the same output like original implementation.

  - Remove irq related analysis. Will add it back with an option "--irq".

  - Remove unused VMEXIT_EPT_VIOLATION_GVT

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 13:05:27 +08:00
Kaige Fu 2bdd8112bd tools: acrntrace: Using array for saving all analyzer
As we may analyze multi-cases at the same time. It's better to store all the
analyzer in an array. Then we can traverse the array and exec all analyzer one
by one.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 13:05:27 +08:00
Kaige Fu 2aa0d4074f tools: acrntrace: Make TSC frequency configurable
Originally, acrntrace stores cpu frequency in output file and use it for time-based
analysis. Actually, we should use TSC frequency instead of cpu frequency.

This patch change to using TSC frequency for time-based analysis and introduce
an option "-f --frequency" to let user configure TSC frequency.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 13:05:27 +08:00
Kaige Fu 0d9b163875 tools: acrntrace: Add new tool acrntrace_format
acrntrace_format.py is used for parsing raw trace data to human-readable file on
given format. A sample format file for acrntrace predefined trace events is available
in tools/acrntrace/scripts/formats in acrn source tree.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 13:05:27 +08:00
Kaige Fu a35a650f5f tools: acrntrace: output trace data as raw data
Benefits of outputing trace data as raw data:
  - Smaller trace data size
  - More convenient to add new trace entry. There is no need to change acrntrace
    when we add new trace entry to HV. All we need do is to update the analysis
    scripts to deal with this situation.

Trace data size(with 1 UOS):
~57M   -- with patch
~137M  -- without patch

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 13:05:27 +08:00
Shuo Liu 1c605a4f50 build: Using id tool to get builder username
Some build environment might has no USER pre-defined. So use id tool to
get builder username instead of USER environemnt.

Also add a version cleanup for tools to keep them updated.

Signed-off-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-29 11:55:03 +08:00
xiaojin2 cb39badf82 tools: acrn-crashlog: fix potential issues under common and usercrash
This patch is to fix buffer overflow, return value not unified and
variable type not matched issues. And add some judge logic to improve
code quality.

Changes:
1. Handle the fd properly in the failing case.
2. Fix buffer overflow issues and null pointer access issues.
3. Fix the format issue in log_sys.c.
4. Remove the useless branch and adjust the function logic.
5. Add some checks for the string length before using strcpy/strcat/memcpy.
6. Fix strncpy null-terminated issues.
7. Change the return value to unify the return type.

Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Liu Xinwu <xinwu.liu@intel.com>
Acked-by: Zhang Di <di.zhang@intel.com>
2018-06-21 11:29:20 +08:00
Kaige Fu 6137ccd6d6 tools: acrn-crashlog: fix format-security warning
We will get the following warning when build acrn. This patch fix it.
No functional change.

In file included from log_sys.c:8:0:
log_sys.c: In function ‘do_log’:
log_sys.c:44:26: warning: format not a string literal and no format arguments [-Wformat-security]
  sd_journal_print(level, log);
                          ^

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
2018-06-20 12:27:58 +08:00
David B. Kinder 685d82cdcc doc: fix formatting in acrnlog doc
A merged change had problems with the formatting of acrnlog options.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-20 11:28:36 +08:00
xiaojin2 3e8e607d5b tools: acrn-crashlog: Fix potential issues under acrnprobe
This patch is to fix potential issues, which are reported by static
analysis tool, for acrnprobe.

Changes:
1. Check the return value of sender_id() and get_sender_by_name(),
   since it could be -1 or NULL.
2. Remove the parameter len from create_event, take parameter path
   as a NULL-terminated string as default.
3. Modify for_each_* functions to avoid overflow.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-06-20 11:27:55 +08:00
xiaojin2 0c39b9cddc tools: acrn-crashlog: Fix potential issues for load_conf module of acrnprobe
This patch is to fix potential issues, which are reported by static
analysis tool, for load_conf module of acrnprobe.

Changes:
1. Check the range of id while loading configuration, to avoid
   memory corruption.
2. Use strncpy instead of strcpy to avoid buf overflow.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-06-20 11:27:55 +08:00
Tan Shen Joon b3ca8f43ff add acrnbridge-install to Makefile install target
This was missed out. Added
to fix the makefile install target.

Signed-off-by: Tan Shen Joon <shen.joon.tan@intel.com>
2018-06-20 11:27:24 +08:00
Liu, Xinwu fa5229052c tools: acrn-crashlog: Improve the efficiency of do_log
Get the header size by receiving return value of snprintf instead
of initialize log buffer and strlen.

Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
2018-06-20 11:26:24 +08:00
Yan, Like b8bdf171eb tools: acrnlog: improve for log incompleteness problem
1. add warning when log incompleteness observed;
2. decrease default polling interval to reduce chance of log incompleteness;
3. add option "-t" to allow user to specify the polling interval;
4. modified README.rst to reflect the options.

Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-06-19 16:20:31 +08:00
Yan, Like 57d6a933f6 tools: correct several Makefile problems
1. mkdir ./tools/build if it does not exist;
2. correct static lib path for acrn-manager;
3. do not remove acrnlog.service if build under source code dir by default.

Reviewed-by: Geoffroy VanCutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-06-19 15:33:31 +08:00
CHEN Gang 2e3af9e062 tools: acrn-crashlog: fix typo in Makefile
This patch is to fix libtelemetry.so typo in Makefile.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Acked-by: Zhang Di <di.zhang@intel.com>
2018-06-14 15:45:00 +08:00
yuhong.tao@intel.com 24ccdf2807 Tools:acrn-manager: use RELEASE in Makefile
The debug macro -DMNGR_DEBUG is selected by RELEASE value.
E.g., run 'make RELEASE=1' at the root of source code.

Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-06-14 13:40:44 +08:00
Geoffroy Van Cutsem 35f06b8382 Documentation: fix incorrect link in acrn-probe documentation
There is a mismatch in the 'telemetrics-clients' reference which
causes a warning (and a dead link).

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-12 14:08:26 -07:00
CHEN Gang 7d13e5be1b tools: acrn-crashlog: add documents for acrn-crashlog
This patch adds the documents for acrn-crashlog:
README.rst: General introduction for acrn-crashlog.
acrnprobe/README.rst: Introduction for acrnprobe in detail.
usercrash/README.rst: Introduction for usercrash in detail.

Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-11 21:46:56 -07:00
yuhong.tao@intel.com 64515cfe58 Tools:acrn-manager Fix wrong descrition of mngr_send_msg()
There is a mistake on description for mngr_send_msg() in acrn_mngr.h
We mistake the ack_len to req_len

Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-06-11 16:45:24 +08:00
Tan Shen Joon b7ad7052bd convert bridge creation to service
update to systemd config files so that the bridge will be up
when systemd-networkd is started.

Signed-off-by: Tan Shen Joon <shen.joon.tan@intel.com>
Reviewed-by: Jack Ren <jack.ren@intel.com>
2018-06-11 16:36:43 +08:00
Tan Shen Joon 2dfa5f6c40 fix spelling errors for acrn-manager
Signed-off-by: Tan Shen Joon <shen.joon.tan@intel.com>
2018-06-11 09:19:42 +08:00
Kaige Fu 83791190d6 tools: acrnctl: Fix wrong descrition of mngr
There are some inappropriate descrition related to mngr, like "vmm msg".
Replace all "vmm" with "mngr".

No functional change.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-08 13:46:19 +08:00
Kaige Fu 2dd4e8f81a tools: acrnctl: Add support for reseting vm
Add command reset to stop and then start vm.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 7a0e8ddeec tools: acrnctl: Add support for resuming vm
Add command resume to resume vm from suspend state.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu d6eb39daf4 tools: acrnctl: Add support for suspending vm
Add command suspend to switch vm to suspend state.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 665c2ee93f tools: acrnctl: Add support for continuing vm
Add command continue to start vm from pause state.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 1933d60c29 tools: acrnctl: Add support for pausing vm
Add command pasue to pause vm.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 3000edc6ad tools: acrnctl: Free vmmngr list after vm ops done
vmmngr_struct entry is allocated in get_vm_list. we should free it after vm ops done.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 2da5e7c16a tools: acrnctl: Use new IPC lib to connect acrn-dm
this patch aim at
    1. Use new IPC lib to connect acrn-dm.
    2. Export list_vm, start_vm and stop_vm and acrnd will use them later.
    3. Rename vmm releated struct and function

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Kaige Fu 143c49b0d2 tools: acrnctl: Refactor help info
Add unified function .valid_args to check validation of args.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-07 14:36:18 +08:00
Yan, Like c84766a869 Tools: add Makefile for all tools
Add a Makefile under ./tools to avoid changing top-level Makefile frequently

Acked-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-06-07 09:56:33 +08:00
CHEN Gang de4b596e3a tools: acrn-crashlog: change source of config file
This patch is to change the source of config file according
to the doc of telemetrics-client:

There is a config file installed at
``/usr/share/defaults/telemetrics/telemetrics.conf``
To make modifications, copy that file to
``/etc/telemetrics/telemetrics.conf``
and modify the /etc version.

Otherwise, the modification may be lost after ``swupd update``.

Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Di <di.zhang@intel.com>
Reviewed-by: Jin Zhi <Zhi.jin@intel.com>
Reviewed-by: Liu Xinwu <xinwu.liu@intel.com>
2018-06-07 09:55:58 +08:00
Geoffroy Van Cutsem 7f2a7d47dd Tools Makefiles: enhancement to keep source code tree clean
Running 'make' will leave 3 files in the source code tree that
are not cleaned by a subsequent 'make clean'. These are:
* tools/acrn-crashlog/acrnprobe/include/version.h
* tools/acrn-crashlog/usercrash/include/version.h
* tools/acrn-manager/acrn_mngr.o
(as reported by 'git status' after 'make')

This patch changes the location of these files so they are
created in the target build directory and hence properly
cleaned when running 'make clean'

Other minor changes to the Makefiles include:
* Remove BASEDIR by the built-in CURDIR variable
* Add .PHONY targets

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-06-05 10:22:24 +08:00
Yan, Like 476f39e032 Tools:acrnlog: install acrnlog.service
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Yan, Like <like.yan@intel.com>
2018-06-01 17:11:45 +08:00
David B. Kinder f4122d99c5 license: Replace license text with SPDX tag
Replace the BSD-3-Clause boiler plate license text with an SPDX tag.

Fixes: #189

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-01 10:43:06 +08:00
Kaige Fu e32a5cadf2 tools: acrnctl: Fix regression of acrnctl list
commit(4d274a5 Tools: acrn-manager-interface) change location and naming scheme
to the follow.
    /run/acrn/mngr/vmname.monitor.pid.socket

This patch adapt parse vmname according new naming scheme.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-06-01 10:26:27 +08:00
Geoffroy Van Cutsem 11f4b014cb Documentation: small addition to the 'acrnlog' tool documentation
Make it clear that some commands mentionned in the 'acrnlog' tool
documentation are meant to be run in the hypervisor shell and *not*
the Service OS shell (as are the other commands throughout the rest
of that document).

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-05-31 11:46:03 -07:00
yuhong.tao@intel.com eada59c934 DM: adapt dm-monitor and acrnctl to use the helpers
Adapt dm-monitor and acrnctl to use the helper functions and new message
definitions in acrn_mngr.h.
These jobs must be done in one commit to avoid build problems:
1. message transmission and callback registration code are moved
 to libacrn-mngr.a, so old functions in dm-monitor could be removed to
 make code clean;
2. remove unnecessary monior_msg.h;
3. minor changes to acrnctl accordingly.

Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Wang, Yu <yu1.wang@intel.com>
signed-off-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-05-31 11:25:47 +08:00
yuhong.tao@intel.com 53ecd932ad Tools: acrn-manager: add definitions of message sturcts
We define messages into three types, accroding to which component is
responsible to handle it:
1. message handled by sos lifecycle service, from vm manager;
2. message handled by vm manager, from sos lifecycle service&dm;
3. message handled by dm, from vm manager.

Reviewed-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Wang, Yu <yu1.wang@intel.com>
signed-off-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-05-31 11:25:47 +08:00
yuhong.tao@intel.com 7d7cf309eb Tools: acrn-manager: add lib with IPC helpers
Add lib to help IPC between components, including SOS lifecycle service,
acrn manager and devicemodule.
Following helper functions are included:
  int mngr_open_un() - create a descripter for vm management IPC
  void mngr_close() - close descripter and release the resouces
  int mngr_add_handler() - add a handler for message specified by msg
  int mngr_send_msg() - send a message and wait for ack

Reviewed-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Wang, Yu <yu1.wang@intel.com>
Sigbed-off-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
2018-05-31 11:25:47 +08:00
David B. Kinder 50324e5876 doc: fix tools docs formatting and clarity
This continues the editing from PR #276 with formatting and clarity
edits to have these tool documents blend in with the rest of the ACRN
documentation.  It also builds on PR #307 that set up the doc build
infrastructure to allow leaving these tool docs within the tools/
folder.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-05-30 10:36:31 -07:00
Taimoor f4b9412013 fix acrntrace README
fix acrnlog README

Fix acrn-manager README

Signed-off-by: T <shrmrf@users.noreply.github.com>
2018-05-29 14:24:17 -07:00
Kaige Fu 26b089932c tools: acrnctl: Properly null-terminate cmd_out and buf
Library function strtok_r and printf accept a string with the constraint that
the string they receive is properly null-terminated.

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-29 14:13:20 +08:00
Kaige Fu 11abe6e81e tools: acrnctl: fix possibility of buffer overflow
Replace strcpy with strncpy to avoid possibility of buffer overflow

Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
2018-05-29 14:13:20 +08:00
Liu, Xinwu 05927b1592 tools: acrn-crashlog: compile without telemetrics client
Define a macro HAVE_TELEMETRICS_CLIENT to distinguish the compiling
environment which is not include telemetrics client.

Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Jack Ren <jack.ren@intel.com>
2018-05-23 21:21:51 +08:00
CHEN Gang a9e36bdb4e tools: acrn-crashlog: add service/config files and scripts
This patch adds the service files, config files and script
to run automatically at boot. And it adds install/uninstall
part in Makefile. Compatiblity code for libsystemd.so and
libsystemd-journal.so is added in Makefile also.

Signed-off-by: Jin Zhi <zhi.jin@intel.com>
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
CHEN Gang d4b4c03cde tools: acrn-crashlog: version control patch for binaries
This patch is the version control patch for the binaries
of acrn-crashlog.

Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 047ffc3f92 tools: acrn-crashlog: configuration file of acrnprobe
The configuration file of acrnprobe.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu c1f2ba31b6 tools: acrn-crashlog: crash reclassify operations for acrnprobe
Reclassify an event according to its trigger file's content.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 168d3ead00 tools: acrn-crashlog: add sender telemd for acrnprobe
Sender telemd is responsible for sending log records to the
telemetrics client.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu f83bd81645 tools: acrn-crashlog: sender module for acrnprobe
The sender corresponds to an exit of event.
Crashlog is responsible for collecting logs and save them locally.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu f4b2c24380 tools: acrn-crashlog: android events module for acrnprobe
Sync events detected by android crashlog.
In android system, android crashlog is a log collection mechanism,
it will generate a history_event file to record android system events.
Acrnprobe will detect these events by scanning android history_event file.

This module mainly contains two functions:
1. setup loop device for android.img.
2. detect new event occursing in android.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 2cea6129eb tools: acrn-crashlog: interfaces to control history_event in acrnprobe
"history_event" is the file to manage all evebts collected by
acrnprobe. This patch provides the operation APIs for this file in a
fixed format.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 384c195faa tools: acrn-crashlog: event handler thread for acrnprobe
Event handler is the thread to handle events detected by channel.
It's awakened by a enqueued event.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 9caa5d72cf tools: acrn-crashlog: channel module for acrnprobe
The channel represents a way of detecting the system's events.
So far, there are 3 channels:
1. oneshot, detect once while acrnprobe startup.
2. polling, run a detecting job with fixed time interval.
3. inotify, watch the change of file or dir.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 95d6a57358 tools: acrn-crashlog: probe utils for acrnprobe
This patch provides some utils for acrnprobe.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 50e62d900f tools: acrn-crashlog: system properties for acrnprobe
Acrnprobe needs to know some HW/SW properties, such as board version,
build version. These properties APIs are provided in this file.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu f1a557aeaa tools: acrn-crashlog: get startup reason of system for acrnprobe
This file provides the functions to get system reboot reason from
kernel command line.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu bc18f1d65f tools: acrn-crashlog: event queue operations for acrnprobe
There is a global queue to receive all events detected. Genarally,
events are enqueued in channel, and dequeued in event handler.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu a35ef1aa90 tools: acrn-crashlog: configuration module of acrnprobe
To show the relationship between configuration items more clearly,
acrnprobe chose xml as its configuration file format.
This file provides functions to parse configuration and load them
into global variable conf.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu e86da09974 tools: acrn-crashlog: main thread of acrn-crashlog/acrnprobe
This patch implements the main thread of acrnprobe.

As a log collection mechanism to record critical events on the
platform, acrnprobe provides the following features:
1. detect event.
2. analyze event and determine the event type.
3. collect information for the detected events.
4. archive these information as logs, and generate records.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
xiaojin2 6e656dfd3c tools: acrn-crashlog: implementation for the server of usercrash
This patch is the implementation patch for the server of usercrash.

Usercrash works in C/S model: usercrash_s works as usercrash server,
which is to handle events from client in endless loop. Once server
receives dump request from client, it will create usercrash_0x file
under /var/log/usercrashes/ and send file fd to client.

Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
xiaojin2 14cf505a01 tools: acrn-crashlog: implementation for debugger
This patch is the implementation patch for debugger.

Debugger is the extra feature of usercrash tool. It could be run
without server in command line "debugger pid" to debug the running
process. It will dump the process info on the screen, and also the
info could be reloacted to a file.

Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
xiaojin2 6627fdf772 tools: acrn-crashlog: implementation for the client of usercrash
This patch is the implementation patch for the client of usercrash.

The usercrash_c works as the client of usercrash to collect crash logs
and information once crash event occurs in the userspace. For each
time, usercrash_c receives 3 params from core_dump and sends connect
request event to the server, then it receives file fd from server to
save crash info into the file. After this work is done, it will notify
server that the dump work is completed.

Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
xiaojin2 afe1a64948 tools: acrn-crashlog: add APIs for client and debugger
This patch is the initial patch for some APIs for client and debugger.

Usercrash works as C/S model. The usercrash_c runs as the client of
usercrash. File crash_dump.c provides the APIs for client and
debugger to dump some crash information.

Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
xiaojin2 2ccb5e3887 tools: acrn-crashlog: socket APIs for client/server
This patch is the initialization patch for socket protocol APIs.
It adds the socket APIs for client and server.

Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 543cdce6c6 tools: acrn-crashlog: add more functions to file system utils
More file system operations for acrn-crashlog.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 87b8968314 tools: acrn-crashlog: file system utils for acrn-crashlog
This file provides file system operations for acrn-crashlog.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 88ba420af1 tools: acrn-crashlog: command utils for acrn-crashlog
This file provides functions to call system commands.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 780fefcc20 tools: acrn-crashlog: string utils for acrn-crashlog
This file provides some string operations for acrn-crashlog.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Liu Xinwu 6f9dfa49bf tools: acrn-crashlog: framework of acrn-crashlog
This is the first patch of acrn-crashlog.

This patch initializes the framework of acrn-crashlog: acrnprobe,
common, data, and usercrash. And it initializes the Makefile for
each part.

Signed-off-by: Liu Xinwu <xinwu.liu@intel.com>
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhang Yanmin <yanmin.zhang@intel.com>
Reviewed-by: Liu Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
Acked-by: Eddie Dong <Eddie.dong@intel.com>
2018-05-23 17:10:51 +08:00
Tonny Tzeng 76cc3dd808 tools: invoke compiler with $(CC) instead of gcc for consistency
Signed-off-by: Tonny Tzeng tonny.tzeng@intel.com
2018-05-18 15:02:09 +08:00
Miguel Bernal Marin ace25dd3db Makefile: implement make install
The make install target was missing. This commits adds the intall target
which uses the install target from subprojects.

Also a make install target was created in each tool program.

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
2018-05-17 10:24:00 +08:00
Yan, Like a4c4d6077f tools: acrntrace: fix NULL pointer issue in create_trace_file_dir()
Fix NULL pointer dereference if 'localtime()' execution encountered an error,
in create_trace_file_dir().

Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 18:03:34 +08:00
Yan, Like 6f340f8564 tools: acrnlog: fix issues founded in static analysis
fixed two issues: 1) potential uninitiliazed usage of 'len' in
hvlog_read_dev(); 2) NULL dereference of 'last' if 'calloc' failure.

Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2018-05-15 18:03:34 +08:00
Minggui Cao fb19b296ea add a makefile under project root directory
it can be used as following:
  make ==> to make hypervisor & devicemodel & tools
also modify tools makefile to support out-dir setting.

Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Jack Ren <jack.ren@intel.com>
2018-05-15 18:03:34 +08:00
Yan, Like 867e56d04b Move ACRN tools code directory one level higher
The tools directory is moved out of ./devicemodle, to be in parallel with
hypervisor, devicemodel and doc.

Signed-off-by: Yan, Like <like.yan@intel.com>
2018-05-15 18:03:33 +08:00