Skip to content

Commit

Permalink
xen/acpi-processor: fix enabling interrupts on syscore_resume
Browse files Browse the repository at this point in the history
syscore->resume() callback is expected to do not enable interrupts,
it generates warning like below otherwise:

[ 9386.365390] WARNING: CPU: 0 PID: 6733 at drivers/base/syscore.c:104 syscore_resume+0x9a/0xe0()
[ 9386.365403] Interrupts enabled after xen_acpi_processor_resume+0x0/0x34 [xen_acpi_processor]
...
[ 9386.365429] Call Trace:
[ 9386.365434]  [<ffffffff81667a8b>] dump_stack+0x45/0x56
[ 9386.365437]  [<ffffffff8106921d>] warn_slowpath_common+0x7d/0xa0
[ 9386.365439]  [<ffffffff8106928c>] warn_slowpath_fmt+0x4c/0x50
[ 9386.365442]  [<ffffffffa0261bb0>] ? xen_upload_processor_pm_data+0x300/0x300 [xen_acpi_processor]
[ 9386.365443]  [<ffffffff814055fa>] syscore_resume+0x9a/0xe0
[ 9386.365445]  [<ffffffff810aef42>] suspend_devices_and_enter+0x402/0x470
[ 9386.365447]  [<ffffffff810af128>] pm_suspend+0x178/0x260

On xen_acpi_processor_resume() we call various procedures, which are
non atomic and can enable interrupts. To prevent the issue introduce
separate resume notify called after we enable interrupts on resume
and before we call other drivers resume callbacks.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
  • Loading branch information
Stanislaw Gruszka authored and David Vrabel committed Mar 18, 2014
1 parent 1429d46 commit cd97988
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
16 changes: 16 additions & 0 deletions drivers/xen/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@ struct suspend_info {
void (*post)(int cancelled);
};

static RAW_NOTIFIER_HEAD(xen_resume_notifier);

void xen_resume_notifier_register(struct notifier_block *nb)
{
raw_notifier_chain_register(&xen_resume_notifier, nb);
}
EXPORT_SYMBOL_GPL(xen_resume_notifier_register);

void xen_resume_notifier_unregister(struct notifier_block *nb)
{
raw_notifier_chain_unregister(&xen_resume_notifier, nb);
}
EXPORT_SYMBOL_GPL(xen_resume_notifier_unregister);

#ifdef CONFIG_HIBERNATE_CALLBACKS
static void xen_hvm_post_suspend(int cancelled)
{
Expand Down Expand Up @@ -152,6 +166,8 @@ static void do_suspend(void)

err = stop_machine(xen_suspend, &si, cpumask_of(0));

raw_notifier_call_chain(&xen_resume_notifier, 0, NULL);

dpm_resume_start(si.cancelled ? PMSG_THAW : PMSG_RESTORE);

if (err) {
Expand Down
15 changes: 8 additions & 7 deletions drivers/xen/xen-acpi-processor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/syscore_ops.h>
#include <linux/acpi.h>
#include <acpi/processor.h>
#include <xen/xen.h>
#include <xen/xen-ops.h>
#include <xen/interface/platform.h>
#include <asm/xen/hypercall.h>

Expand Down Expand Up @@ -495,14 +495,15 @@ static int xen_upload_processor_pm_data(void)
return rc;
}

static void xen_acpi_processor_resume(void)
static int xen_acpi_processor_resume(struct notifier_block *nb,
unsigned long action, void *data)
{
bitmap_zero(acpi_ids_done, nr_acpi_bits);
xen_upload_processor_pm_data();
return xen_upload_processor_pm_data();
}

static struct syscore_ops xap_syscore_ops = {
.resume = xen_acpi_processor_resume,
struct notifier_block xen_acpi_processor_resume_nb = {
.notifier_call = xen_acpi_processor_resume,
};

static int __init xen_acpi_processor_init(void)
Expand Down Expand Up @@ -555,7 +556,7 @@ static int __init xen_acpi_processor_init(void)
if (rc)
goto err_unregister;

register_syscore_ops(&xap_syscore_ops);
xen_resume_notifier_register(&xen_acpi_processor_resume_nb);

return 0;
err_unregister:
Expand All @@ -574,7 +575,7 @@ static void __exit xen_acpi_processor_exit(void)
{
int i;

unregister_syscore_ops(&xap_syscore_ops);
xen_resume_notifier_unregister(&xen_acpi_processor_resume_nb);
kfree(acpi_ids_done);
kfree(acpi_id_present);
kfree(acpi_id_cst_present);
Expand Down
4 changes: 4 additions & 0 deletions include/xen/xen-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define INCLUDE_XEN_OPS_H

#include <linux/percpu.h>
#include <linux/notifier.h>
#include <asm/xen/interface.h>

DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu);
Expand All @@ -16,6 +17,9 @@ void xen_mm_unpin_all(void);
void xen_timer_resume(void);
void xen_arch_resume(void);

void xen_resume_notifier_register(struct notifier_block *nb);
void xen_resume_notifier_unregister(struct notifier_block *nb);

int xen_setup_shutdown_event(void);

extern unsigned long *xen_contiguous_bitmap;
Expand Down

0 comments on commit cd97988

Please sign in to comment.