From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 086EF34DCD2 for ; Thu, 18 Jun 2026 22:45:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781822745; cv=none; b=P5XxkkoJAv5J+8taXOGGt0mD70F69YIJEj1qpRbdnxiJx0iByR2nw9qCD96wBUmnK9YLtCvSpxHklzKHFAG5BTFeQNIYxQzZxFuc36wohlys2OchGb4kXglF1F8WENFGLr/8cgzeuviorrTrXDqTDn+l/kCCZoUpfkPpGiwRG3o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781822745; c=relaxed/simple; bh=H+cAxBHJd4fZaA9Qkzfp9V6DYmmmJCJHfF1TvznEyVk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=r8w3nRkURF7x1fNju+hParW9PYZf/Zju41sovIBt/gCzATM3QYF+0hJAHfDTb0yL5v+Iv7qxiB7NtdKzw3qd7LLMtANf82bJoiA2p1e5B08pKx/B/6oboRBy34fjuzzxeWuzuTVsilBO5/z3m7D8vQq4NxIezmKxRw1rPcuTk7s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jmattson.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kG+s1mEv; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jmattson.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kG+s1mEv" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-8453e61d6f0so1086250b3a.0 for ; Thu, 18 Jun 2026 15:45:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781822743; x=1782427543; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=u1jvwhNjvq2Is/V87dzOQZ0MYgc6uXTrarn3nSsMDgc=; b=kG+s1mEvr5s3JHPth8hhh1jU40br79RWuJ6ogiVYnVVOaX14kWhDBDljqzk7VrGFlg 7ParWVt02doQZ0GUcJ9VGQJALc5VdsPUFrH/GuLP1S5NzPYOeKT7V1AbvLDBUFlJDu5c DE3be4QeY6sJTS7T9eS0+DVHmokm2BV5UcLZS/scs8EEReT1V3cCt4+Jt0tNyg+en2zX N64/sX7NyBD1T9TrGPA4hXC0JbYkrlR+aS0oeLsKTRlZb8DzrZJbq/ajUufRG4JasT0K H+cza1TqBx2A4FAX2D7qhr7X85LAbKwp7o0b/PLzkU5bnW3r3OTE+kBbm9VORwIyIxK4 285g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781822743; x=1782427543; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u1jvwhNjvq2Is/V87dzOQZ0MYgc6uXTrarn3nSsMDgc=; b=CzkW81H7ebQXDXadw0eWYc7aq73af56YbAdoSfyVZoNqJ1ryG1FLenaU967erSvKQE EPd573DKeX3WqUnX2nIECMJXNPAm69cS3NwMcZ1hZVTeEPvFaUECu9lpghtzk1yAY7Ey wqQji6L7XbCWp9ieeKjlnZB9/Q36tmzrMa21UcdhjPUPkM8nIxPPND1Fk5auPJblyT/a OakM2/tBMXu4A+Z5YxXuVbG0Zbp8BMfo3UpfMfj+fccAMPK2GCMRSvq6XZl7ahlYU1GL C4nlT6xkPhg7SGEDry0ckhFvldo3ZNWcq5vNXeAtAe1sWub3r0XkOE+7SZBQCd61ilkD vnFQ== X-Gm-Message-State: AOJu0Yxsi1iDgK6AWGP3XNTYTFKKqcL4r19rgimqmRwWW2xrcQ41rYpN 95GXglsNZzHo6CAVM6woQAQjw6CxXtEsRyewcNk3iMgou8kUxmie5pW0ZBvKhrbdVpu+zZBhJFP ZnTsPEvipK6zboQ== X-Received: from pgcv2.prod.google.com ([2002:a05:6a02:5302:b0:c89:a67b:d71f]) (user=jmattson job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:cf86:b0:3b3:bdf5:117e with SMTP id adf61e73a8af0-3bb33952b8amr1171897637.27.1781822743201; Thu, 18 Jun 2026 15:45:43 -0700 (PDT) Date: Thu, 18 Jun 2026 15:45:26 -0700 In-Reply-To: <20260618224527.1506419-1-jmattson@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260618224527.1506419-1-jmattson@google.com> X-Mailer: git-send-email 2.55.0.rc0.799.gd6f94ed593-goog Message-ID: <20260618224527.1506419-4-jmattson@google.com> Subject: [PATCH v3 3/4] cpufreq: ACPI: Use IPI to update boost MSR in cpufreq_boost_down_prep() From: Jim Mattson To: bp@alien8.de, tglx@kernel.org, x86@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, yosry@kernel.org, andrew.cooper3@citrix.com, ludloff@gmail.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Jim Mattson , Sashiko Content-Type: text/plain; charset="UTF-8" During driver exit or CPU hotplug, acpi_cpufreq_cpu_exit() calls cpufreq_boost_down_prep() to re-enable boost on the target CPU. However, cpufreq_boost_down_prep() ignores the target CPU parameter and calls boost_set_msr(1) locally. Since this runs in an unbound process context, it updates the local CPU's MSR while leaving the target CPU's boost state unchanged. On Intel platforms, the open-coded read-modify-write of MSR_IA32_MISC_ENABLE in boost_set_msr() is vulnerable to preemption and thread migration if executed in process context. Fix both issues by routing the MSR update through smp_call_function_single() to execute boost_set_msr() synchronously on the target CPU. This ensures the correct CPU is updated and that the RMW sequence on Intel executes safely in IPI context with interrupts disabled. Fixes: a3605c46e0c0 ("cpufreq: acpi-cpufreq: drop rdmsr_on_cpus() usage") Reported-by: Sashiko Closes: https://sashiko.dev/#/patchset/20260612215729.1532175-1-jmattson%40google.com Assisted-by: Gemini:gemini-3.5-pro Signed-off-by: Jim Mattson --- drivers/cpufreq/acpi-cpufreq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index 21639d9ac753..48d678812fd6 100644 --- a/drivers/cpufreq/acpi-cpufreq.c +++ b/drivers/cpufreq/acpi-cpufreq.c @@ -528,10 +528,11 @@ static void free_acpi_perf_data(void) static int cpufreq_boost_down_prep(unsigned int cpu) { /* - * Clear the boost-disable bit on the CPU_DOWN path so that - * this cpu cannot block the remaining ones from boosting. + * Clear the boost-disable bit on the target CPU so that + * it cannot block the remaining ones from boosting. */ - return boost_set_msr(1); + return smp_call_function_single(cpu, boost_set_msr_each, + (void *)1L, 1); } /* -- 2.55.0.rc0.799.gd6f94ed593-goog