Commit 7a8d5783 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'pm-cpuidle'

Merge cpuidle updates for 6.9-rc1:

 - Prevent the haltpoll cpuidle governor from shrinking guest
   poll_limit_ns below grow_start (Parshuram Sangle).

 - Avoid potential overflow in integer multiplication when computing
   cpuidle state parameters (C Cheng).

 - Adjust MWAIT hint target C-state computation in the ACPI cpuidle
   driver and in intel_idle to return a correct value for C0 (He
   Rongguang).

* pm-cpuidle:
  cpuidle: ACPI/intel: fix MWAIT hint target C-state computation
  cpuidle: Avoid potential overflow in integer multiplication
  cpuidle: haltpoll: do not shrink guest poll_limit_ns below grow_start
parents 32b88f59 6b8e288f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -131,8 +131,8 @@ static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
	cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);

	/* Check whether this particular cx_type (in CST) is supported or not */
	cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
			MWAIT_CSTATE_MASK) + 1;
	cstate_type = (((cx->address >> MWAIT_SUBSTATE_SIZE) &
			MWAIT_CSTATE_MASK) + 1) & MWAIT_CSTATE_MASK;
	edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
	num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;

+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/cpumask.h>
#include <linux/tick.h>
#include <linux/cpu.h>
#include <linux/math64.h>

#include "cpuidle.h"

@@ -187,7 +188,7 @@ static void __cpuidle_driver_init(struct cpuidle_driver *drv)
			s->target_residency = div_u64(s->target_residency_ns, NSEC_PER_USEC);

		if (s->exit_latency > 0)
			s->exit_latency_ns = s->exit_latency * NSEC_PER_USEC;
			s->exit_latency_ns = mul_u32_u32(s->exit_latency, NSEC_PER_USEC);
		else if (s->exit_latency_ns < 0)
			s->exit_latency_ns =  0;
		else
+7 −2
Original line number Diff line number Diff line
@@ -98,10 +98,15 @@ static void adjust_poll_limit(struct cpuidle_device *dev, u64 block_ns)
		unsigned int shrink = guest_halt_poll_shrink;

		val = dev->poll_limit_ns;
		if (shrink == 0)
		if (shrink == 0) {
			val = 0;
		else
		} else {
			val /= shrink;
			/* Reset value to 0 if shrunk below grow_start */
			if (val < guest_halt_poll_grow_start)
				val = 0;
		}

		trace_guest_halt_poll_ns_shrink(val, dev->poll_limit_ns);
		dev->poll_limit_ns = val;
	}
+2 −1
Original line number Diff line number Diff line
@@ -1934,7 +1934,8 @@ static void __init spr_idle_state_table_update(void)

static bool __init intel_idle_verify_cstate(unsigned int mwait_hint)
{
	unsigned int mwait_cstate = MWAIT_HINT2CSTATE(mwait_hint) + 1;
	unsigned int mwait_cstate = (MWAIT_HINT2CSTATE(mwait_hint) + 1) &
					MWAIT_CSTATE_MASK;
	unsigned int num_substates = (mwait_substates >> mwait_cstate * 4) &
					MWAIT_SUBSTATE_MASK;