The changes include:
1. modify the outparam only in successful cases.
2. return -1 instead of a errno-style value if error happens.
3. check return value of strrchr.
Tracked-On: #971
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This patch changes vm resuming condition from VM_STARTED to VM_PAUSED
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yuhong Tao <yuhong.tao@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
This patch resolves vm state mismatch between vm and acrnd
which causes vm resuming failure
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yuhong Tao <yuhong.tao@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
This patch resolves acrnd does not notify vm stop state(suspend/shutdown) to
cbc_lifecycle after SOS enters suspend/shutdown, that causes cbc_lifecycle
cannot trigger SOS suspend/shutdown flow.
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
The issue is "acrnctl list" command always returns error with "no vmname
provided" information.
The rootcause is that vmname is an invalid parameter, which does not contain
any vm information.
Signed-off-by: Yuan Liu <yuan1.liu@intel.com>
Reviewed-by: Yuhong Tao <yuhong.tao@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
As first step to separate misc folder into github/intel/ioc-cbc-tools we
need let acrn create devel package. This package will let ioc-cbc-tools
use acrn manager interface API to control lifecycle.
The Clear Linux autospec script will *detect* /usr/include/acrn/*.h and
thus help us create the devel package. This devel pacakge will be in the
build_req for ioc-cbc-tools autospec.
Signed-off-by: Alek Du <alek.du@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Like Yan <like.yan@intel.com>
This patch is to fix the build warning with gcc8.1.1. Most of them are
warnings for buffer overflow from snprintf and strncpy.
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: xiaojin2 <xiaojing.liu@intel.com>
Two packages are needed in compiling environment with replacing commands
fdisk and debugfs.
On clear linux, they belong to os-core-dev.
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
Acked-by: Yang Ailin <ailin.yang@intel.com>
Replace debugfs with api in loop.c.
There is no functional change.
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
Use api in loop.c to replace fdisk and losetup.
There is no functional change.
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This patch impletement apis with libext2fs, which are for dumping and
reading files or dirs in extfs.
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
This patch adds new apis to replace commands losetup and fdisk.
Main changes include:
1. impletement apis to operate loop devices directly.
2. impletement apis to get partition information from image file.
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
Current implementation save trace data files on tmpfs by default, acrntrace
would use up all the physical mem, which can affect system functioning.
This commit changes default location for trace data file to current dir, and
removes the codes for space reservation, which is not necessary.
Signed-off-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Eddie Dong <eddie.dong@intel.com>
Reviewed-by: Li, Fei1 <fei1.li@intel.com>
Made the titles consistent across the tools (some had capital letters).
Fixed heading levels in acrnctl/acrnd doc (had two H1 headings).
Changed a text-based drawing to use graphviz.
Some general grammar tweaks as well.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
acrn-manager message structure has a flexible member
payload[0], that risks to out-of-boundary memory access,
and usage of uninitialized variable.
And the req/ack message pairs has various types, which
extend mngr_msg. mngr_send_msg() requires programmer cast
the type of input messages to struct mngr_msg, that is
inconvenient.
We replace payload[0] with an union, which contains all
payload data. So that type cast for mngr_send_msg() is no
longer needed. And we can avoid potential out-of-boundary
memory accessing and using of uninitialized variable
Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
$(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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
-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>
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>
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>
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>
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>