Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4080216ybv; Tue, 25 Feb 2020 12:48:07 -0800 (PST) X-Google-Smtp-Source: APXvYqyQkwgSDsWI3s9vumLsJLsjiiqsSKUdfXRqr66xVUEiX7ZgLR0FoSKwCxQ6h5n6ZyJlpf1w X-Received: by 2002:a05:6808:24e:: with SMTP id m14mr610953oie.168.1582663687243; Tue, 25 Feb 2020 12:48:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582663687; cv=none; d=google.com; s=arc-20160816; b=uAWK0mmzKRms5+kYea2JY15Dw1gYbdor9LlLXwdDtq9hsbgg830SiOoCziKU7UrN/V WAEFtjFFialLLybmHIwa7hkO/mGd4ve314pov0A+kAoBwpadXpi9Ce05ZhptYRgcPIvJ mjFcr/ZLHoziW50v52ugPbYO1zaH236Q5ZYLuu4IPdIq3HjVQfIhTawOH1f4o5SFLyMn W1ouUtqBoTlYeAtTsrfspk8MgpZVpqRx8vBMmb8h7VMNa/G8aLDJCkDROUj70Lu/sLaV NRC7N3mOFN6/KtjtzP7sevs2vGctGPWCk+QCb2/0Bkf8/cBknX3fhlaHXKfwLvhhffEZ a/Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=Qwzvkc0P0/6BAZ1AJRPhwQ6JVsDKGomoOjcTOk9H0uA=; b=D6U/vZNYzLVK1H5t3OQz7kVH3tTkBvdGE8Z55NJZRvlyy4AQjhGcAfCO4JGRzBjnHJ P2RZ/T8I7Kds25QOKs8bSbQ2KFAb5JnTL1xxxQYZhNmQKEccVwqDNHbQAMgQbsmJYvgl geSQHc5BNW/Zf+hKU+navJFFUP7cTR0Vy/YhkU9niueSmx3lx1+lbB85B7HYh93VMjX1 M2j8JbCCVTAFnb2fgVhmFJgvBqyK+CA773ulXX1w+Y/kZqnzIQnvM04VSoZCXM/l4OgD aBA0jH4cS6H7BzCZc/Wo9AUgpV3pHSKS5ffVMewchXomIAxRQpjxlZ591mPzDhtfAaoq 2N2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13si165087oiw.106.2020.02.25.12.47.53; Tue, 25 Feb 2020 12:48:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731459AbgBYUgw (ORCPT + 99 others); Tue, 25 Feb 2020 15:36:52 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:54474 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731354AbgBYUgv (ORCPT ); Tue, 25 Feb 2020 15:36:51 -0500 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j6gwd-0002P5-Bw; Tue, 25 Feb 2020 21:36:43 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id C56181C2153; Tue, 25 Feb 2020 21:36:42 +0100 (CET) Date: Tue, 25 Feb 2020 20:36:42 -0000 From: "tip-bot2 for Thomas Gleixner" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: ras/urgent] x86/mce/therm_throt: Undo thermal polling properly on CPU offline Cc: Chris Wilson , "Pandruvada, Srinivas" , Thomas Gleixner , Borislav Petkov , x86 , LKML In-Reply-To: <158120068234.18291.7938335950259651295@skylake-alporthouse-com> References: <158120068234.18291.7938335950259651295@skylake-alporthouse-com> MIME-Version: 1.0 Message-ID: <158266300251.28353.3340868799140664997.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the ras/urgent branch of tip: Commit-ID: d364847eed890211444ad74496bb549f838c6018 Gitweb: https://git.kernel.org/tip/d364847eed890211444ad74496bb549f838c6018 Author: Thomas Gleixner AuthorDate: Tue, 25 Feb 2020 14:55:15 +01:00 Committer: Borislav Petkov CommitterDate: Tue, 25 Feb 2020 21:21:44 +01:00 x86/mce/therm_throt: Undo thermal polling properly on CPU offline Chris Wilson reported splats from running the thermal throttling workqueue callback on offlined CPUs. The problem is that that callback should not even run on offlined CPUs but it happens nevertheless because the offlining callback thermal_throttle_offline() does not symmetrically undo the setup work done in its onlining counterpart. IOW, 1. The thermal interrupt vector should be masked out before ... 2. ... cancelling any pending work synchronously so that no new work is enqueued anymore. Do those things and fix the issue properly. [ bp: Write commit message. ] Fixes: f6656208f04e ("x86/mce/therm_throt: Optimize notifications of thermal throttle") Reported-by: Chris Wilson Tested-by: Pandruvada, Srinivas Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/158120068234.18291.7938335950259651295@skylake-alporthouse-com --- arch/x86/kernel/cpu/mce/therm_throt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/therm_throt.c b/arch/x86/kernel/cpu/mce/therm_throt.c index 58b4ee3..f36dc07 100644 --- a/arch/x86/kernel/cpu/mce/therm_throt.c +++ b/arch/x86/kernel/cpu/mce/therm_throt.c @@ -486,9 +486,14 @@ static int thermal_throttle_offline(unsigned int cpu) { struct thermal_state *state = &per_cpu(thermal_state, cpu); struct device *dev = get_cpu_device(cpu); + u32 l; + + /* Mask the thermal vector before draining evtl. pending work */ + l = apic_read(APIC_LVTTHMR); + apic_write(APIC_LVTTHMR, l | APIC_LVT_MASKED); - cancel_delayed_work(&state->package_throttle.therm_work); - cancel_delayed_work(&state->core_throttle.therm_work); + cancel_delayed_work_sync(&state->package_throttle.therm_work); + cancel_delayed_work_sync(&state->core_throttle.therm_work); state->package_throttle.rate_control_active = false; state->core_throttle.rate_control_active = false;