From: Boris Ostrovsky Date: Wed, 2 Dec 2015 17:10:48 +0000 (-0500) Subject: xen: Resume PMU from non-atomic context X-Git-Tag: v4.1.12-92~172^2~5^2~16 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2e871f17157e5c608e4a66b4647ad778dd4d5f8a;p=users%2Fjedix%2Flinux-maple.git xen: Resume PMU from non-atomic context Resuming PMU currently triggers a warning from ___might_sleep() (assuming CONFIG_DEBUG_ATOMIC_SLEEP is set) when xen_pmu_init() allocates GFP_KERNEL page because we are in state resembling atomic context. Move resuming PMU to xen_arch_resume() which is called in regular context. For symmetry move suspending PMU to xen_arch_suspend() as well. Signed-off-by: Boris Ostrovsky Reported-by: Konrad Rzeszutek Wilk Cc: # 4.3 Signed-off-by: David Vrabel (cherry picked from commit de0afc9bdeeadaa998797d2333c754bf9f4d5dcf) Signed-off-by: Joao Martins --- diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 3c0d968c8c67..7ed65d0db4d4 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c @@ -63,26 +63,16 @@ static void xen_pv_post_suspend(int suspend_cancelled) void xen_arch_pre_suspend(void) { - int cpu; - - for_each_online_cpu(cpu) - xen_pmu_finish(cpu); - if (xen_pv_domain()) xen_pv_pre_suspend(); } void xen_arch_post_suspend(int cancelled) { - int cpu; - if (xen_pv_domain()) xen_pv_post_suspend(cancelled); else xen_hvm_post_suspend(cancelled); - - for_each_online_cpu(cpu) - xen_pmu_init(cpu); } static void xen_vcpu_notify_restore(void *data) @@ -101,10 +91,20 @@ static void xen_vcpu_notify_suspend(void *data) void xen_arch_resume(void) { + int cpu; + on_each_cpu(xen_vcpu_notify_restore, NULL, 1); + + for_each_online_cpu(cpu) + xen_pmu_init(cpu); } void xen_arch_suspend(void) { + int cpu; + + for_each_online_cpu(cpu) + xen_pmu_finish(cpu); + on_each_cpu(xen_vcpu_notify_suspend, NULL, 1); }