Acrnctl commands return 0,even if when it fails to execute the commands.
In this patch,fix this issue.It return none-zero when acrnctl commands
failed in command executed.
Tracked-On: #1262
Signed-off-by:liuyonggang <yonggangx.liu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
the commands.
acrnctl commands can manage multiple vms with a single
command launched, which is not useful actually.
To make the logic simple, this patch makes it to manage
only a single vm by each command.
Tracked-On: #1262
Signed-off-by:liuyonggang <yonggangx.liu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
ACRNLog tries to open acrn_hvlog_last_* without check the presence of the device nodes at startup, which results a confusing message reporting "bad file descriptor" when there is no last device nodes exist. This commit fix the issue by checking the number of last devices before trying to open them.
Tracked-On: #2787
Signed-off-by: Jiang Mao <maox.jiang@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
'acrnctl start vmname' use a cmd buffer with a sizeof 128 bytes,
cmd[128] buffer will be truncated, when vmnane size is bigger than
29 bytes. In that situation, vmnane size still smaller than
MAX_VM_OS_NAME_LEN, so it should be fixed.
Macro PATH_LEN is useful to determine the cmd[] buffer length, so move
it from acrn_mngr.c into acrn_mngr.h
Tracked-On: #2851
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yan Like <like.yan@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
When run 'acrnctl add launch_script.sh', vmname will be detected from
the launch script and stored in vmmngr_struct.name[MAX_VM_OS_NAME_LEN],
so vmname should not be longer than MAX_VM_OS_NAME_LEN.
Tracked-On: #2851
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
The boards without IOC don't need to call get_sos_wakeup_reason function.
The HW IOC can be detected in runtime,via checking "/dev/cbc-early-signals" node.
Tracked-On:#1996
Signed-off-by: liuyonggang <yonggangx.liu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yuan Liu <yuan1.liu@intel.com>
Fix some stray UTF-8 punctuation and symbol characters, unnecessary
trademark symbols, and some misspellings missed during regular reviews.
Tracked-On: #2712
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
When run 'acrnctl add', acrnctl dryruns launch script to get
vmname. Acrnctl assumes there are no more than 64 words in each
line of the script, and creates a buffer to hold 64 pointers to these
words. But we didn't check if the number of words exceed 64 limitation,
which can lead to buffer overflow. This commit fixed this potential
overflow problem.
And also refine some confusing error messages in 'acrnctl add'
Tracked-On: #2734
Acked-by: Yan Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
When acrnd_vm_timer_func() launch UOS, it need fork() and run, so
that do not block the main process.
Tracked-On: #2716
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
For a running or suspended VM, its state is updated in 2 steps.
It is first set to VM_CREATED, then set to VM_STARTED/VM_PAUSED. IF
one thread check a running/suspend VM, it may get wrong state VM_CREATED,
while another thread is updating the VMs state.
Tracked-On: #2716
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
pdebug just provide information about function name and source code line number.
From debug point of view, it is better to give developer more detailed err msg.
Tracked-On: #2716
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Print more information at acrnd_add_work(), query_state()
try_do_works() and handle_acrnd_resume()
Tracked-On: #2716
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Since "history_event" file records limited events (5000 lines by default),
a new file named "all events" to count all kind of events.
Tracked-On: #1024
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>
Crashlog would drop all events after the storaged log size exceeds the
configured parameter "foldersize" previously, that basically means all
activities are stopped.
This patch brings other activities back (e.g. the records in the file
"history_event" will be updated continually), and restricts the "foldersize" by
stopping log collection.
Tracked-On: #1024
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>
Currently, we are enforcing the _FORTIFY_SOURCE=2 without any
previous detection if the macro has been already defined, e.g.
by environment, or is just enabled by compiler by default on
some distributions (e.g. Gentoo).
This could result in the error like this:
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition
Tracked-On: #2344
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
The patch adds logic to delete runC configuration in acrnctl del command.
After launch the VM in container there will have configuration files in user
directory. When delete the VM by "acrnctl del" command the command will delete
the runC configuration files at same time.
Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
This patch adds the "-C" parameter handing in acrnctl. The "-C"
parameter be introduced for acrn-dm QoS feature. By current acrnctl
implementation, it will dry run the launch_uos.sh script to obtain the
VM name which defined during script execution.
The patch will strip "-C" parameter during the script dry run to avoid
create unexpected container, and add the "-C" parameter to the arguments
file after the script dry run.
Tracked-On: #2020
Signed-off-by: Long Liu <long.liu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
The build environment might want to pass extra CFLAGS or LDFLAGS to the build of
the acrn tools. With conventional build systems like automake, Meson, etc this
is possible by just setting CFLAGS and LDFLAGS in the environment.
However as the tools are built using bare Makefiles, these environment variables
are overwritten. Respect them by renaming the variables in the Makefiles to
e.g. LOG_CFLAGS and adding CFLAGS to that.
Tracked-On: #2316
Signed-off-by: Ross Burton <ross.burton@intel.com>
Using 'make' directly means that the jobserver environment variables don't get
passed down, so sub-builds for example don't use -j.
This is documented as the wrong thing to do:
https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html#MAKE-Variable
Use $(MAKE) instead, and compile times drastically improve:
acrn-devicemodel do_compile -13.5s -89.6% 15.0s -> 1.6s
Tracked-On: #2370
Signed-off-by: Ross Burton <ross.burton@intel.com>
Dmesg collects too much log when kernel meets log storm.
This patch reads kernel log from "/dev/kmsg" intead of dmesg and limits
the generated log size.
Tracked-On: #1024
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>
After panic, kernel will do warm boot to reserve memory for log collecting.
Need to cold reboot system as the original behaviour.
Tracked-On:#1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
When issue happen, we could identify which thread is impacted.
This could help stability issue debugging.
Tracked-On: #2037
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
The path of vm conf files changed from "/opt/acrn/conf" to "/usr/share/acrn/conf",
since "/opt" is not generally used on clearlinux.
Tracked-On: #2040
Signed-off-by: Yan, Like <like.yan@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
Sphinx transforms ``--`` into an en-dash within a paragraph (not within
a code, pre, or kbd block though). This presents a problem documenting
command parameters such as ``--name`` where the ``--`` is transformed
into a single en-dash. Rather than disabling all smartquote
transformations in the Sphinx conf.py (setting ``smartquotes = False``),
we fixes cases where ``--`` should not be transformed by using a block
that is ignored by the smartquote transformation.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
The 'acrnctl reset' is implemented by a stop/start sequence. Reset failure was
observed since UOS is not able to shutdown within default 10s timeout.
This commit increased the default timeout to be 30s, and added an explicit error
message if 'acrnctl reset' due to UOS shutdown timeout.
Tracked-On: #2016
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
There is a bug to run 'acrnctl add /[path]/script.sh', when the
launch script has an absolute path. Acrnctl will generate wrong path
for temp files and fail to add VM.
And message '/opt/acrn/conf: No such file or directory' always comes
out, until user once successfully run 'acrnctl add' cmd. That is reported
by _scan_added_vm(), because 'opt/acrn' is missing, only 'acrnctl add'
can create it, we should also check it in _scan_added_vm().
Tracked-On: #2013
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
If module acrn_hvlog is configured as "m" and we don't insert it before
launching acrnlog tool, acrnlog will run normally instead of throw
out an error in current implementation. And no log files are generated.
It will cause confusing here.
So, this patch throw out an error massage to user about the absence of acrn
hvlog devices.
BTW, this patch replaces cpuid/num related concept to devid/cnt which is more
suitable for /dev/acrn_hvlog_xxx.
Tracked-On: #1975
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
If module acrn_trace is configured as "m" and we don't insert it before
launching acrntrace tool, acrntrace will run normally instead of throw
out an error in current implementation. And no trace files are generated.
It will cause confusing here.
So, this patch throw out an error massage to user about the absence of acrn
trace devices.
BTW, this patch replaces cpuid/num related concept to devid/cnt which is more
suitable for /dev/acrn_trace_xxx.
Tracked-On: #1975
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Add a basic README.rst file to the tools/ folder to give a very brief
introduction and redirect the reader to the online documentation for more
details.
Tracked-On: #1896
Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
When UOS is sleeping, 'acrnctl list' command show it is 'paused', not
'suspended'. That is not correct. Because pausing an UOS means to block
its VCPUs immediately, otherwise suspending an UOS means to put it to
sleep.
Tracked-On: #1910
Acked-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
1. remove watching TOMBSTONE in AaaG.
2. add a configurable parameter "foldersize" in MB, sender will drop
all events when the storaged log size exceeds this parameter.
Tracked-On:#1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Chen Gang <gang.c.chen@intel.com>
Acked-by: Zhang Di <di.zhang@intel.com>
I am currently using Yocto build and deploy UOS images, it would be
much more convenient to let the VMs to have the same names with when
they are being built. For instance, a typical image name in Yocto is
like: uos-image-weston, but it can not show the name completely with
'acrnctl list', since the length limit is 16.
Increasing the limit to 32 would fix this problem.
Tracked-On: #1837
Signed-off-by: Ming Liu <liu.ming50@gmail.com>
this patch fix potential issue of initialization
about local variable in fsutils.c
Tracked-On: #1024
Signed-off-by: Zhonghua <zhonghua.sun@intel.com>
Reviewed-by: Huang, Yonghua <yonghua.huang@intel.com>
Acked-by: Chen, Gang <gang.c.chen@intel.com>
It's for AaaG boot time measurement only.
Tracked-On: #1759
Signed-off-by: Yan, Like <like.yan@intel.com>
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
function sscanf is banned according to the security
requirements. So remove sscanf api.
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Tao, Yuhong <yuhong.tao@intel.com>
1, remove unsafe function sscanf
2, replace strlen with strnlen
3, replace atoll with strtoll and replace aoti with strtol
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Tao, Yuhong <yuhong.tao@intel.com>
1, replace strlen with strnlen
2, Return value check for strncpy function
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
Return value check for snprintf function
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
Return value check for snprintf function
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
1, Return value check for snprintf function
2, Replace 'atoi' with 'strtol'
Tracked-On: #1254
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Kaige Fu <kaige.fu@intel.com>
This patch updates the documents according to the latest implementation
of crashlogctl.
Tracked-On: #1024
Signed-off-by: CHEN Gang <gang.c.chen@intel.com>
Reviewed-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
Reviewed-by: Zhi Jin <zhi.jin@intel.com>
Since strlen/vsnprintf/ato* api are not safe, so use strnlen instead of
strlen, use vasprintf instead of vsnprintf and use strtol instead of
atoi.
Tracked-On: #1254
Signed-off-by: xiaojin2 <xiaojing.liu@intel.com>
Reviewed-by: Huang Yonghua <yonghua.huang@intel.com>
Reviewed-by: Liu, Xinwu <xinwu.liu@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>
When SOS shutdown/reboot, systemd will send SIGTERM to acrnd. We should catch up
this signal and stop all vms gracefully.
BTW, this path also fix the following error when stop acrnd service by removing
ExecStop config. Systemd will send SIGTERM signal to process by default.
systemd[9378]: acrnd.service: Failed to execute command: No such file or directory
systemd[9378]: acrnd.service: Failed at step EXEC spawning /usr/bin/killall: No such file or directory
-- Subject: Process /usr/bin/killall could not be executed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- The process /usr/bin/killall could not be executed and failed.
--
-- The error number returned by this process is 2.
Tracked-On: #1563
Signed-off-by: Kaige Fu <kaige.fu@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
UOS requires an wakeup reason when resumed from S3 suspend. If user
use "acrnctl resume [VMNAME]" without an reason, 0x0 will be used
as default reason, and this is not work. We can use CBC_WK_RSN_BTN
instead.
Tracked-On: #1550
Signed-off-by: Tao, Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
get_sender_from_name would return NULL if the name of sender is not
configured in acrnprobe.xml.
This patch check the return value of it.
Tracked-On: #1024
Signed-off-by: Liu, Xinwu <xinwu.liu@intel.com>
Reviewed-by: Huang Yonghua <yonghua.huang@intel.com>
Acked-by: Chen Gang <gang.c.chen@intel.com>