ACPI / processor: Make acpi_cpu_soft_notify() process CPU FROZEN events

CPU hotplug happens during S2RAM and CPU notify event will be CPU_XXX_FROZEN.
acpi_cpu_soft_notify() ignores to check these events. This also may make
acpi_cpu_soft_notify() fall into sleep during CPU_DYING/STARTING_FROZEN
events which don't allow callbacks to sleep. This patch is to fix it.

Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PM / hibernate: avoid unsafe pages in e820 reserved regions

When the machine doesn't well handle the e820 persistent when hibernate
resuming, then it may cause page fault when writing image to snapshot
buffer:

[   17.929495] BUG: unable to handle kernel paging request at ffff880069d4f000
[   17.933469] IP: [<ffffffff810a1cf0>] load_image_lzo+0x810/0xe40
[   17.933469] PGD 2194067 PUD 77ffff067 PMD 2197067 PTE 0
[   17.933469] Oops: 0002 [#1] SMP
...

The ffff880069d4f000 page is in e820 reserved region of resume boot
kernel:

[    0.000000] BIOS-e820: [mem 0x0000000069d4f000-0x0000000069e12fff] reserved
...
[    0.000000] PM: Registered nosave memory: [mem 0x69d4f000-0x69e12fff]

So snapshot.c mark the pfn to forbidden pages map. But, this
page is also in the memory bitmap in snapshot image because it's an
original page used by image kernel, so it will also mark as an
unsafe(free) page in prepare_image().

That means the page in e820 when resuming mark as "forbidden" and
"free", it causes get_buffer() treat it as an allocated unsafe page.
Then snapshot_write_next() return this page to load_image, load_image
writing content to this address, but this page didn't really allocated
. So, we got page fault.

Although the root cause is from BIOS, I think aggressive check and
significant message in kernel will better then a page fault for
issue tracking, especially when serial console unavailable.

This patch adds code in mark_unsafe_pages() for check does free pages in
nosave region. If so, then it print message and return fault to stop whole
S4 resume process:

[    8.166004] PM: Image loading progress:   0%
[    8.658717] PM: 0x6796c000 in e820 nosave region: [mem 0x6796c000-0x6796cfff]
[    8.918737] PM: Read 2511940 kbytes in 1.04 seconds (2415.32 MB/s)
[    8.926633] PM: Error -14 resuming
[    8.933534] PM: Failed to load hibernation image, recovering.

Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Lee, Chun-Yi <jlee@suse.com>
[rjw: Subject]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
PM / sleep: Rename symbols, functions and variables related to sleep

The names of several symbols, data types, functions and variables
related to system sleep states are confusing and don't reflect the
real behavior of those states correctly.

First of all, there generally are two sleep states that require
platform support and one sleep state that is platform-independent.
The first two of them are currently known as MEM and STANDBY,
although these names really only match what the states do on full
hardware ACPI compliant systems.  MEM in particular is supposed
to mean "suspend-to-RAM", but in fact it means "the deepest sleep
state available with platform support".  The definition of STANDBY
is even more arbitrary.

Moreover, the remaining sleep state that doesn't need platform support
is currently called FREEZE, which leads to double confusion with the
process freezer (used during transitions to all sleep states) and
with the freeze stage of processing devices during hibernation.

For these reasons, rename the PM_SUSPEND_MEM, PM_SUSPEND_STANDBY
and PM_SUSPEND_FREEZE symbols to PM_SUSPEND_DEEP, PM_SUSPEND_SHALLOW
and PM_IDLE_SLEEP, respectively, everywhere and rename data types,
functions and variables related to those states to match the new names
of the symbols.

This is a semi-mechanical replacement of names and it should not lead
to any functional differences.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Merge branch 'pm-cpufreq' into bleeding-edge

* pm-cpufreq:
  cpufreq: OPP: Avoid sleeping while atomic
  cpufreq: cpu0: Do not print error message when deferring
  cpufreq: integrator: Use set_cpus_allowed_ptr
  cpufreq: arm_big_little: fix module license declaration
Merge branch 'acpi-processor' into bleeding-edge

* acpi-processor:
  ACPI / processor: Make acpi_cpu_soft_notify() process CPU FROZEN events
Merge branch 'pm-sleep' into bleeding-edge

* pm-sleep:
  PM / sleep: Rename symbols, functions and variables related to sleep
  PM / hibernate: avoid unsafe pages in e820 reserved regions
Merge branch 'irq-pm' into bleeding-edge

* irq-pm:
  PCI / PM: Make PCIe PME interrupts wake up from suspend-to-idle
  x86 / PM: Set IRQCHIP_SKIP_SET_WAKE for IOAPIC IRQ chip objects
  irq / PM: Make wakeup interrupts wake up from suspend-to-idle
  irq / PM: Fix IRQF_NO_SUSPEND problem with shared interrupts
  PM / sleep: Mechanism for aborting system suspends unconditionally

Conflicts:
	kernel/power/suspend.c