From: Dario Faggioli Subject: [PATCH 4/7] xen: print online pCPUs and free pCPUs when dumping scheduler info Date: Mon, 16 Mar 2015 18:05:17 +0100 Message-ID: <20150316170517.10279.43661.stgit@Solace.station> References: <20150316165642.10279.86684.stgit@Solace.station> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150316165642.10279.86684.stgit@Solace.station> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Juergen Gross , George Dunlap , Keir Fraser , Jan Beulich List-Id: xen-devel@lists.xenproject.org e.g., with `xl debug-key r'. This change adds something like the following lines to the dump output: (XEN) Num online Cpus: 16, cpu_online_map: 0-15 (XEN) Num free Cpus: 8, cpupool_free_cpus: 8-15 Meaning there are 16 pCPUs online, and they are pCPUs 0-15, and that 8 of them, more specifically 8-15, are not part of any cpupool. Signed-off-by: Dario Faggioli Cc: Juergen Gross Cc: George Dunlap Cc: Jan Beulich Cc: Keir Fraser --- xen/common/cpupool.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xen/common/cpupool.c b/xen/common/cpupool.c index cd6aab9..3bf0174 100644 --- a/xen/common/cpupool.c +++ b/xen/common/cpupool.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #define for_each_cpupool(ptr) \ @@ -658,6 +659,12 @@ int cpupool_do_sysctl(struct xen_sysctl_cpupool_op *op) return ret; } +static void _print_cpumap(const char *str, const cpumask_t *map) +{ + cpulist_scnprintf(keyhandler_scratch, sizeof(keyhandler_scratch), map); + printk("%s: %s\n", str, keyhandler_scratch); +} + void dump_runq(unsigned char key) { unsigned long flags; @@ -671,12 +678,18 @@ void dump_runq(unsigned char key) sched_smt_power_savings? "enabled":"disabled"); printk("NOW=0x%08X%08X\n", (u32)(now>>32), (u32)now); + printk("Num online Cpus: %d, ", cpumask_weight(&cpu_online_map)); + _print_cpumap("cpu_online_map", &cpu_online_map); + printk("Num free Cpus: %d, ", cpumask_weight(&cpupool_free_cpus)); + _print_cpumap("cpupool_free_cpus", &cpupool_free_cpus); + printk("Idle cpupool:\n"); schedule_dump(NULL); for_each_cpupool(c) { printk("Cpupool %d:\n", (*c)->cpupool_id); + _print_cpumap("Cpus", (*c)->cpu_valid); schedule_dump(*c); }