ihk_os_getrusage(): Compile LWK-specific results in mcctrl

1. User asks mcctrl for the result via ihk_os_getrusage() with passing void *
2. mcctrl compiles the results and passes them to the user
3. User interprets it by using the type defined in the LWK-specific header
This commit is contained in:
Masamichi Takagi
2017-08-17 22:06:49 +09:00
parent 5664125e57
commit aa7cb970c4
28 changed files with 567 additions and 386 deletions

View File

@@ -31,7 +31,8 @@
#include <cls.h>
#include <syscall.h>
#include <sysfs.h>
#include <rusage.h>
#include <rusage_private.h>
#include <ihk/monitor.h>
//#define IOCTL_FUNC_EXTENSION
#ifdef IOCTL_FUNC_EXTENSION
@@ -55,6 +56,7 @@ extern unsigned long ihk_mc_get_ns_per_tsc(void);
extern long syscall(int, ihk_mc_user_context_t *);
struct ihk_os_monitor *monitor;
struct rusage_global *rusage;
static void handler_init(void)
{
@@ -279,13 +281,27 @@ static void monitor_init()
monitor = ihk_mc_alloc_pages(z, IHK_MC_AP_CRITICAL);
memset(monitor, 0, z * PAGE_SIZE);
monitor->num_processors = num_processors;
monitor->ns_per_tsc = ihk_mc_get_ns_per_tsc();
phys = virt_to_phys(monitor);
ihk_set_monitor(phys, sizeof(struct ihk_os_monitor) +
sizeof(struct ihk_os_cpu_monitor) * num_processors);
#endif /* POSTK_DEBUG_TEMP_FIX_73 */
}
static void rusage_init()
{
int npages;
unsigned long phys;
npages = (sizeof(struct rusage_global) + PAGE_SIZE -1) >> PAGE_SHIFT;
rusage = ihk_mc_alloc_pages(npages, IHK_MC_AP_CRITICAL);
memset(rusage, 0, npages * PAGE_SIZE);
rusage->num_processors = num_processors;
rusage->num_numa_nodes = ihk_mc_get_nr_numa_nodes();
rusage->ns_per_tsc = ihk_mc_get_ns_per_tsc();
phys = virt_to_phys(rusage);
ihk_set_rusage(phys, sizeof(struct rusage_global));
}
int nmi_mode;
static void nmi_init()
@@ -310,6 +326,7 @@ static void rest_init(void)
#ifndef POSTK_DEBUG_TEMP_FIX_73 /* NULL access for *monitor fix */
monitor_init();
#endif /* !POSTK_DEBUG_TEMP_FIX_73 */
rusage_init();
cpu_local_var_init();
nmi_init();
time_init();