Commit ef867c12 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull additional power management updates from Rafael Wysocki:
 "These fix an ACPI EC driver bug exposed by the recent rework of the
  suspend-to-idle code flow, reintroduce frequency constraints into
  device PM QoS (in preparation for adding QoS support to devfreq), drop
  a redundant field from struct cpuidle_state and clean up Kconfig in
  some places.

  Specifics:

   - Avoid a race condition in the ACPI EC driver that may cause systems
     to be unable to leave suspend-to-idle (Rafael Wysocki)

   - Drop the "disabled" field, which is redundant, from struct
     cpuidle_state (Rafael Wysocki)

   - Reintroduce device PM QoS frequency constraints (temporarily
     introduced and than dropped during the 5.4 cycle) in preparation
     for adding QoS support to devfreq (Leonard Crestez)

   - Clean up indentation (in multiple places) and the cpuidle drivers
     help text in Kconfig (Krzysztof Kozlowski, Randy Dunlap)"

* tag 'pm-5.5-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: PM: s2idle: Rework ACPI events synchronization
  ACPI: EC: Rework flushing of pending work
  PM / devfreq: Add missing locking while setting suspend_freq
  PM / QoS: Restore DEV_PM_QOS_MIN/MAX_FREQUENCY
  PM / QoS: Reorder pm_qos/freq_qos/dev_pm_qos structs
  PM / QoS: Initial kunit test
  PM / QoS: Redefine FREQ_QOS_MAX_DEFAULT_VALUE to S32_MAX
  power: avs: Fix Kconfig indentation
  cpufreq: Fix Kconfig indentation
  cpuidle: minor Kconfig help text fixes
  cpuidle: Drop disabled field from struct cpuidle_state
  cpuidle: Fix Kconfig indentation
parents 63de3747 1e4230f5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static struct cpuidle_driver cpuidle_driver = {
			.enter = cpuidle_sleep_enter,
			.name = "C2",
			.desc = "SuperH Sleep Mode [SF]",
			.disabled = true,
			.flags = CPUIDLE_FLAG_UNUSABLE,
		},
		{
			.exit_latency = 2300,
@@ -76,7 +76,7 @@ static struct cpuidle_driver cpuidle_driver = {
			.enter = cpuidle_sleep_enter,
			.name = "C3",
			.desc = "SuperH Mobile Standby Mode [SF]",
			.disabled = true,
			.flags = CPUIDLE_FLAG_UNUSABLE,
		},
	},
	.safe_state_index = 0,
@@ -86,10 +86,10 @@ static struct cpuidle_driver cpuidle_driver = {
int __init sh_mobile_setup_cpuidle(void)
{
	if (sh_mobile_sleep_supported & SUSP_SH_SF)
		cpuidle_driver.states[1].disabled = false;
		cpuidle_driver.states[1].flags = CPUIDLE_FLAG_NONE;

	if (sh_mobile_sleep_supported & SUSP_SH_STANDBY)
		cpuidle_driver.states[2].disabled = false;
		cpuidle_driver.states[2].flags = CPUIDLE_FLAG_NONE;

	return cpuidle_register(&cpuidle_driver, NULL);
}
+13 −23
Original line number Diff line number Diff line
@@ -533,26 +533,10 @@ static void acpi_ec_enable_event(struct acpi_ec *ec)
}

#ifdef CONFIG_PM_SLEEP
static bool acpi_ec_query_flushed(struct acpi_ec *ec)
static void __acpi_ec_flush_work(void)
{
	bool flushed;
	unsigned long flags;

	spin_lock_irqsave(&ec->lock, flags);
	flushed = !ec->nr_pending_queries;
	spin_unlock_irqrestore(&ec->lock, flags);
	return flushed;
}

static void __acpi_ec_flush_event(struct acpi_ec *ec)
{
	/*
	 * When ec_freeze_events is true, we need to flush events in
	 * the proper position before entering the noirq stage.
	 */
	wait_event(ec->wait, acpi_ec_query_flushed(ec));
	if (ec_query_wq)
		flush_workqueue(ec_query_wq);
	flush_scheduled_work(); /* flush ec->work */
	flush_workqueue(ec_query_wq); /* flush queries */
}

static void acpi_ec_disable_event(struct acpi_ec *ec)
@@ -562,15 +546,21 @@ static void acpi_ec_disable_event(struct acpi_ec *ec)
	spin_lock_irqsave(&ec->lock, flags);
	__acpi_ec_disable_event(ec);
	spin_unlock_irqrestore(&ec->lock, flags);
	__acpi_ec_flush_event(ec);

	/*
	 * When ec_freeze_events is true, we need to flush events in
	 * the proper position before entering the noirq stage.
	 */
	__acpi_ec_flush_work();
}

void acpi_ec_flush_work(void)
{
	if (first_ec)
		__acpi_ec_flush_event(first_ec);
	/* Without ec_query_wq there is nothing to flush. */
	if (!ec_query_wq)
		return;

	flush_scheduled_work();
	__acpi_ec_flush_work();
}
#endif /* CONFIG_PM_SLEEP */

+19 −7
Original line number Diff line number Diff line
@@ -977,6 +977,16 @@ static int acpi_s2idle_prepare_late(void)
	return 0;
}

static void acpi_s2idle_sync(void)
{
	/*
	 * The EC driver uses the system workqueue and an additional special
	 * one, so those need to be flushed too.
	 */
	acpi_ec_flush_work();
	acpi_os_wait_events_complete(); /* synchronize Notify handling */
}

static void acpi_s2idle_wake(void)
{
	/*
@@ -1001,13 +1011,8 @@ static void acpi_s2idle_wake(void)
		 * should be missed by canceling the wakeup here.
		 */
		pm_system_cancel_wakeup();
		/*
		 * The EC driver uses the system workqueue and an additional
		 * special one, so those need to be flushed too.
		 */
		acpi_os_wait_events_complete(); /* synchronize EC GPE processing */
		acpi_ec_flush_work();
		acpi_os_wait_events_complete(); /* synchronize Notify handling */

		acpi_s2idle_sync();

		rearm_wake_irq(acpi_sci_irq);
	}
@@ -1024,6 +1029,13 @@ static void acpi_s2idle_restore_early(void)

static void acpi_s2idle_restore(void)
{
	/*
	 * Drain pending events before restoring the working-state configuration
	 * of GPEs.
	 */
	acpi_os_wait_events_complete(); /* synchronize GPE processing */
	acpi_s2idle_sync();

	s2idle_wakeup = false;

	acpi_enable_all_runtime_gpes();
+4 −0
Original line number Diff line number Diff line
@@ -148,6 +148,10 @@ config DEBUG_TEST_DRIVER_REMOVE
	  unusable. You should say N here unless you are explicitly looking to
	  test this functionality.

config PM_QOS_KUNIT_TEST
	bool "KUnit Test for PM QoS features"
	depends on KUNIT

config HMEM_REPORTING
	bool
	default n
+1 −0
Original line number Diff line number Diff line
@@ -4,5 +4,6 @@ obj-$(CONFIG_PM_SLEEP) += main.o wakeup.o wakeup_stats.o
obj-$(CONFIG_PM_TRACE_RTC)	+= trace.o
obj-$(CONFIG_PM_GENERIC_DOMAINS)	+=  domain.o domain_governor.o
obj-$(CONFIG_HAVE_CLK)	+= clock_ops.o
obj-$(CONFIG_PM_QOS_KUNIT_TEST) += qos-test.o

ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
Loading