From 8743f4df738de13271877bec83f7c184e14af041 Mon Sep 17 00:00:00 2001 From: Bhupinder Thakur Date: Sun, 17 Sep 2017 14:05:27 +0530 Subject: [PATCH] Debug prints added. Signed-off-by: Bhupinder Thakur --- arch/arm/xen/enlighten.c | 7 ++++++- drivers/xen/manage.c | 29 +++++++++++++++++++++++++++++ kernel/stop_machine.c | 1 + 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index fe4dd622f45b..4c636c6c51d4 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c @@ -158,6 +158,7 @@ static int xen_starting_cpu(unsigned int cpu) struct vcpu_register_vcpu_info info; struct vcpu_info *vcpup; int err; + int rc; #if 0 /* @@ -169,6 +170,7 @@ static int xen_starting_cpu(unsigned int cpu) goto after_register_vcpu_info; #endif + rc = HYPERVISOR_console_io(CONSOLEIO_write, 21, "\n"); pr_info("Xen: initializing cpu%d\n", cpu); vcpup = per_cpu_ptr(xen_vcpu_info, cpu); @@ -183,6 +185,7 @@ static int xen_starting_cpu(unsigned int cpu) after_register_vcpu_info: xen_setup_runstate_info(cpu); enable_percpu_irq(xen_events_irq, 0); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 21, "\n"); return 0; } @@ -319,7 +322,9 @@ int xen_register_shared_info(void) void xen_vcpu_restore(void) { - xen_percpu_init(); + unsigned int cpu = get_cpu(); + + xen_starting_cpu(cpu); /* XXX TODO: xen_setup_runstate_info(cpu); */ } diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 1a53e035f576..1482b7d14178 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -62,18 +62,25 @@ static int xen_suspend(void *data) { struct suspend_info *si = data; int err; + int rc; + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); BUG_ON(!irqs_disabled()); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); err = syscore_suspend(); if (err) { + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); pr_err("%s: system core suspend failed: %d\n", __func__, err); return err; } + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); gnttab_suspend(); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); xen_arch_pre_suspend(); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); /* * This hypercall returns 1 if suspend was cancelled * or the domain was merely checkpointed, and 0 if it @@ -82,17 +89,23 @@ static int xen_suspend(void *data) si->cancelled = HYPERVISOR_suspend(xen_pv_domain() ? virt_to_gfn(xen_start_info) : 0); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); xen_arch_post_suspend(si->cancelled); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); gnttab_resume(); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); if (!si->cancelled) { + rc = HYPERVISOR_console_io(CONSOLEIO_write, 17, "\n"); xen_irq_resume(); xen_timer_resume(); } + rc = HYPERVISOR_console_io(CONSOLEIO_write, 17, "\n"); syscore_resume(); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 17, "\n"); return 0; } @@ -100,6 +113,7 @@ static void do_suspend(void) { int err; struct suspend_info si; + int rc; shutting_down = SHUTDOWN_SUSPEND; @@ -109,12 +123,14 @@ static void do_suspend(void) goto out; } + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); err = freeze_kernel_threads(); if (err) { pr_err("%s: freeze kernel threads failed %d\n", __func__, err); goto out_thaw; } + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); err = dpm_suspend_start(PMSG_FREEZE); if (err) { pr_err("%s: dpm_suspend_start %d\n", __func__, err); @@ -122,6 +138,7 @@ static void do_suspend(void) } printk(KERN_DEBUG "suspending xenstore...\n"); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); xs_suspend(); err = dpm_suspend_end(PMSG_FREEZE); @@ -131,26 +148,32 @@ static void do_suspend(void) goto out_resume; } + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); xen_arch_suspend(); si.cancelled = 1; err = stop_machine(xen_suspend, &si, cpumask_of(0)); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); /* Resume console as early as possible. */ if (!si.cancelled) xen_console_resume(); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); raw_notifier_call_chain(&xen_resume_notifier, 0, NULL); dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); if (err) { pr_err("failed to start xen_suspend: %d\n", err); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); si.cancelled = 1; } xen_arch_resume(si.cancelled); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 15, "\n"); out_resume: if (!si.cancelled) @@ -158,11 +181,17 @@ out_resume: else xs_suspend_cancel(); + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); + dpm_resume_end(si.cancelled ? PMSG_THAW : PMSG_RESTORE); out_thaw: + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); + thaw_processes(); out: + rc = HYPERVISOR_console_io(CONSOLEIO_write, 16, "\n"); + shutting_down = SHUTDOWN_INVALID; } #endif /* CONFIG_HIBERNATE_CALLBACKS */ diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index b7591261652d..72b3686a254e 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -195,6 +195,7 @@ static int multi_cpu_stop(void *data) do { /* Chill out and ensure we re-read multi_stop_state. */ cpu_relax_yield(); + if (msdata->state != curstate) { curstate = msdata->state; switch (curstate) { -- 2.39.5