void scaling_governor_func(int argc, char *argv[]) { int cpuid = -1; char *name; if ( argc >= 2 ) { parse_cpuid(argv[0], &cpuid); name = argv[1]; } else if ( argc > 0 ) name = argv[0]; else { fprintf(stderr, "Missing argument(s)\n"); exit(EINVAL); } if ( cpuid < 0 ) { int i; for ( i = 0; i < max_cpu_nr; i++ ) if ( xc_set_cpufreq_gov(xc_handle, i, name) ) fprintf(stderr, "[CPU%d] failed to set governor name (%d - %s)\n", i, errno, strerror(errno)); } else { if ( xc_set_cpufreq_gov(xc_handle, cpuid, name) ) fprintf(stderr, "failed to set governor name (%d - %s)\n", errno, strerror(errno)); } }
static void parse_cpuid_and_int(int argc, char *argv[], int *cpuid, int *val, const char *what) { if ( argc > 1 ) parse_cpuid(argv[0], cpuid); if ( argc == 0 || sscanf(argv[argc > 1], "%d", val) != 1 ) { fprintf(stderr, argc ? "Invalid %s '%s'\n" : "Missing %s\n", what, argv[argc > 1]); exit(EINVAL); } }
void cpufreq_para_func(int argc, char *argv[]) { int cpuid = -1; if ( argc > 0 ) parse_cpuid(argv[0], &cpuid); if ( cpuid < 0 ) { /* show cpu freqency information on all cpus */ int i; for ( i = 0; i < max_cpu_nr; i++ ) if ( show_cpufreq_para_by_cpuid(xc_handle, i) == -ENODEV ) break; } else show_cpufreq_para_by_cpuid(xc_handle, cpuid); }
void pxstat_func(int argc, char *argv[]) { int cpuid = -1; if ( argc > 0 ) parse_cpuid(argv[0], &cpuid); if ( cpuid < 0 ) { /* show pxstates on all cpus */ int i; for ( i = 0; i < max_cpu_nr; i++ ) if ( show_pxstat_by_cpuid(xc_handle, i) == -ENODEV ) break; } else show_pxstat_by_cpuid(xc_handle, cpuid); }
void disable_turbo_mode(int argc, char *argv[]) { int cpuid = -1; if ( argc > 0 ) parse_cpuid(argv[0], &cpuid); if ( cpuid < 0 ) { /* disable turbo modes on all cpus, * only make effects on dbs governor */ int i; for ( i = 0; i < max_cpu_nr; i++ ) if ( xc_disable_turbo(xc_handle, i) ) fprintf(stderr, "[CPU%d] failed to disable turbo mode (%d - %s)\n", i, errno, strerror(errno)); } else if ( xc_disable_turbo(xc_handle, cpuid) ) fprintf(stderr, "failed to disable turbo mode (%d - %s)\n", errno, strerror(errno)); }
void arch_cpu_processor_init_1(void) { #if _DBOS_KERNEL_HAVE_CPU_SMP primary_cpu = &cpu_array[0]; primary_cpu->knum = 0; spinlock_create(&ipi_lock); memset(cpu_array, 0, sizeof(struct cpu) * MAX_CPUS); cpu_array_num = 1; load_tables_ap(primary_cpu); #else primary_cpu = &primary_cpu_data; memset(primary_cpu, 0, sizeof(struct cpu) * MAX_CPUS); load_tables_ap(primary_cpu); #endif ASSERT(primary_cpu); cpu_interrupt_set(0); primary_cpu->flags = CPU_UP; printk(KERN_MSG, "Initializing CPU...\n"); parse_cpuid(primary_cpu); x86_cpu_init_fpu(primary_cpu); x86_cpu_init_sse(primary_cpu); printk(KERN_EVERY, "Done\n"); }