summaryrefslogtreecommitdiff
path: root/examples/vm_power_manager
AgeCommit message (Collapse)Author
2014-12-18examples/vm_power: fix initialization of cmdline tokenOlivier Matz
Fix a typo: cmdline_parse_token_string_t was used in place of cmdline_parse_num_string_t. Seen with clang-3.5. Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2014-12-18examples/vm_power: fix split of compiler and linker optionsOlivier Matz
The argument -lvirt is a linker parameter, not a CFLAG. Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
2014-12-17examples/vm_power: fix check for nullBruce Richardson
The check for NULL is in the wrong position in the "if" error leg. The pointer should be checked for NULL before checking what the value of what the pointer points to is. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2014-12-17examples/vm_power: fix max length of unix socket pathBruce Richardson
The length of the path to a unix socket is not PATH_MAX but instead is UNIX_PATH_MAX which is generally just over 100 bytes in size. It's not actually defined in sys/un.h on linux - despite the man page referencing it, so calculate the size in the case where it's not defined. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2014-11-27add prefix to cache line macrosSergio Gonzalez Monroy
CACHE_LINE_SIZE is a macro defined in machine/param.h in FreeBSD and conflicts with DPDK macro version. Adding RTE_ prefix to avoid conflicts. CACHE_LINE_MASK and CACHE_LINE_ROUNDUP are also prefixed. Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> [Thomas: updated on HEAD, including PPC]
2014-11-27examples: no more bare metal environmentDavid Marchand
Signed-off-by: David Marchand <david.marchand@6wind.com> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
2014-11-26examples/vm_power: cli in guestAlan Carew
Provides a small sample application(guest_vm_power_mgr) to run on a VM. The application is run by providing a core mask(-c) and number of memory channels(-n). The core mask corresponds to the number of lcore channels to attempt to open. A maximum of 64 channels per VM is allowed. The channels must be monitored by the host. After successful initialisation a CPU frequency command can be sent to the host using: set_cpu_freq <lcore_num> <up|down|min|max>. Signed-off-by: Alan Carew <alan.carew@intel.com> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2014-11-26examples/vm_power: vm power management applicationAlan Carew
For launching CLI thread and Monitor thread and initialising resources. Requires a minimum of two lcores to run, additional cores specified by eal core mask are not used. Signed-off-by: Alan Carew <alan.carew@intel.com> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2014-11-26examples/vm_power: cpu frequency in hostAlan Carew
A wrapper around librte_power(using ACPI cpufreq), providing locking around the non-threadsafe library, allowing for frequency changes based on core masks and core numbers from both the CLI thread and epoll monitor thread. Signed-off-by: Alan Carew <alan.carew@intel.com> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2014-11-26examples/vm_power: cli in hostAlan Carew
The CLI is used for administrating the channel monitor and manager and manually setting the CPU frequency on the host. Supports the following commands: add_vm [Mul-choice STRING]: add_vm|rm_vm <name>, add a VM for subsequent operations with the CLI or remove a previously added VM from the VM Power Manager rm_vm [Mul-choice STRING]: add_vm|rm_vm <name>, add a VM for subsequent operations with the CLI or remove a previously added VM from the VM Power Manager add_channels [Fixed STRING]: add_channels <vm_name> <list>|all, add communication channels for the specified VM, the virtio channels must be enabled in the VM configuration(qemu/libvirt) and the associated VM must be active. <list> is a comma-separated list of channel numbers to add, using the keyword 'all' will attempt to add all channels for the VM set_channel_status [Fixed STRING]: set_channel_status <vm_name> <list>|all enabled|disabled, enable or disable the communication channels in list(comma-separated) for the specified VM, alternatively list can be replaced with keyword 'all'. Disabled channels will still receive packets on the host, however the commands they specify will be ignored. Set status to 'enabled' to begin processing requests again. show_vm [Fixed STRING]: show_vm <vm_name>, prints the information on the specified VM(s), the information lists the number of vCPUS, the pinning to pCPU(s) as a bit mask, along with any communication channels associated with each VM show_cpu_freq_mask [Fixed STRING]: show_cpu_freq_mask <mask>, Get the current frequency for each core specified in the mask set_cpu_freq_mask [Fixed STRING]: set_cpu_freq <core_mask> <up|down|min|max>, Set the current frequency for the cores specified in <core_mask> by scaling each up/down/min/max. show_cpu_freq [Fixed STRING]: Get the current frequency for the specified core set_cpu_freq [Fixed STRING]: set_cpu_freq <core_num> <up|down|min|max>, Set the current frequency for the specified core by scaling up/down/min/max quit [Fixed STRING]: close the application Signed-off-by: Alan Carew <alan.carew@intel.com> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2014-11-26examples/vm_power: channel manager and monitor in hostAlan Carew
The manager is responsible for adding communications channels to the Monitor thread, tracking and reporting VM state and employs the libvirt API for synchronization with the KVM Hypervisor. The manager interacts with the Hypervisor to discover the mapping of virtual CPUS(vCPUs) to the host physical CPUS(pCPUs) and to inspect the VM running state. The manager provides the following functionality to the CLI: 1) Connect to a libvirtd instance, default: qemu:///system 2) Add a VM to an internal list, each VM is identified by a "name" which must correspond a valid libvirt Domain Name. 3) Add communication channels associated with a VM to the epoll based Monitor thread. The channels must exist and be in the form of: /tmp/powermonitor/<vm_name>.<channel_number>. Each channel is a Virtio-Serial endpoint configured as an AF_UNIX file socket and opened in non-blocking mode. Each VM can have a maximum of 64 channels associated with it. 4) Disable or re-enable VM communication channels, channels once added to the Monitor thread remain in that threads control, however acting on channel requests can be disabled and renabled via CLI. The monitor is an epoll based infinite loop running in a separate thread that waits on channel events from VMs and calls the corresponding functions. Channel definitions from the manager are registered via the epoll event opaque pointer when calling epoll_ctl(EPOLL_CTL_ADD), this allows for obtaining the channels file descriptor for reading EPOLLIN events and mapping the vCPU to pCPU(s) associated with a request from a particular VM. Signed-off-by: Alan Carew <alan.carew@intel.com> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>