Re: Pressing the power button causes the device to freeze completely
From: Evgeny Sagatov
Date: Mon Apr 27 2026 - 16:15:07 EST
dmesg | grep "frequency scaling"
[ 8.552380] acpi_cpufreq: CPU0: Using I/O space for frequency scaling
[ 8.552386] acpi_cpufreq: CPU0: frequency scaling I/O port number: 2176
[ 8.552478] acpi_cpufreq: CPU1: Using I/O space for frequency scaling
[ 8.552480] acpi_cpufreq: CPU1: frequency scaling I/O port number: 2176
[ 8.552584] acpi_cpufreq: CPU2: Using I/O space for frequency scaling
[ 8.552586] acpi_cpufreq: CPU2: frequency scaling I/O port number: 2176
[ 8.552668] acpi_cpufreq: CPU3: Using I/O space for frequency scaling
[ 8.552670] acpi_cpufreq: CPU3: frequency scaling I/O port number: 2176
Messages that appear when I press the power button:
apr 27 23:07:33 srv kernel: ACPI power button event
apr 27 23:07:33 srv kernel: ACPI event status register ID: 3
пн, 27 апр. 2026 г. в 21:48, Rafael J. Wysocki <rafael@xxxxxxxxxx>:
>
> On Sunday, April 26, 2026 10:45:03 PM CEST Evgeny Sagatov wrote:
> > dmesg | grep "frequency s"
> > [ 8.622778] acpi_cpufreq: CPU0: Using I/O space for frequency scaling
> > [ 8.622806] cpufreq: CPU0: Fast frequency switching enabled
> > [ 8.622869] acpi_cpufreq: CPU1: Using I/O space for frequency scaling
> > [ 8.622888] cpufreq: CPU1: Fast frequency switching enabled
> > [ 8.622938] acpi_cpufreq: CPU2: Using I/O space for frequency scaling
> > [ 8.622955] cpufreq: CPU2: Fast frequency switching enabled
> > [ 8.623006] acpi_cpufreq: CPU3: Using I/O space for frequency scaling
> > [ 8.623026] cpufreq: CPU3: Fast frequency switching enabled
> >
> > When I press the power button, a message is displayed:
> > apr 26 23:40:36 srv kernel: ACPI power button event
> >
> > The PC does not freeze.
>
> Good.
>
> > The single core performance benchmark shows good values.
>
> That most likely is a coincidence.
>
> The above means that the issue is related to HW accesses in the I/O space.
>
> I don't actually think that the writes to the I/O space outright clash with
> each other, but the timing between them may be somewhat overly aggressive.
>
> Let's first check what I/O ports come into play though.
>
> Please apply the patch below (which is a replacement for the previous one),
> run
>
> $ dmesg | grep "frequency scaling"
>
> after a fresh boot of the new kernel and let me know the output of it.
>
> Then, press the power button and send the messages printed after that.
>
> ---
> drivers/acpi/acpica/evevent.c | 12 ++++++++++++
> drivers/cpufreq/acpi-cpufreq.c | 8 ++++++--
> drivers/cpufreq/cpufreq.c | 1 +
> 3 files changed, 19 insertions(+), 2 deletions(-)
>
> --- a/drivers/acpi/acpica/evevent.c
> +++ b/drivers/acpi/acpica/evevent.c
> @@ -243,6 +243,18 @@ static u32 acpi_ev_fixed_event_dispatch(
> (void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
> status_register_id, ACPI_CLEAR_STATUS);
>
> + if (event == ACPI_EVENT_POWER_BUTTON) {
> + pr_info("ACPI power button event\n");
> + if (acpi_gbl_fixed_event_info[event].status_register_id == 0)
> + pr_info("ACPI event status I/O port number: %llu\n",
> + acpi_gbl_xpm1a_status.address);
> + else
> + pr_info("ACPI event status register ID: %u\n",
> + acpi_gbl_fixed_event_info[event].status_register_id);
> +
> + return (ACPI_INTERRUPT_HANDLED);
> + }
> +
> /*
> * Make sure that a handler exists. If not, report an error
> * and disable the event to prevent further interrupts.
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -479,8 +479,8 @@ static unsigned int acpi_cpufreq_fast_sw
> return next_freq;
> }
>
> - data->cpu_freq_write(&perf->control_register,
> - perf->states[next_perf_state].control);
> + /*data->cpu_freq_write(&perf->control_register,
> + perf->states[next_perf_state].control);*/
> perf->state = next_perf_state;
> return next_freq;
> }
> @@ -887,9 +887,13 @@ static int acpi_cpufreq_cpu_init(struct
> * unknown and not detectable via IO ports.
> */
> policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
> + pr_info("CPU%u: Using I/O space for frequency scaling\n", cpu);
> + pr_info("CPU%u: frequency scaling I/O port number: %llu\n", cpu,
> + perf->control_register.address);
> break;
> case ACPI_ADR_SPACE_FIXED_HARDWARE:
> acpi_cpufreq_driver.get = get_cur_freq_on_cpu;
> + pr_info("CPU%u: Using FFH for frequency scaling\n", cpu);
> break;
> default:
> break;
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -473,6 +473,7 @@ void cpufreq_enable_fast_switch(struct c
> if (cpufreq_fast_switch_count >= 0) {
> cpufreq_fast_switch_count++;
> policy->fast_switch_enabled = true;
> + pr_info("CPU%u: Fast frequency switching enabled\n", policy->cpu);
> } else {
> pr_warn("CPU%u: Fast frequency switching not enabled\n",
> policy->cpu);
>
>
>