Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3786989ybv; Tue, 25 Feb 2020 07:17:51 -0800 (PST) X-Google-Smtp-Source: APXvYqyXEOVJGvgwR/ScLrDCRBkHOpS3QSqlxHVkMd6YjPZMhF/pgcySQ3IYMIcxY8XpxCgaru7V X-Received: by 2002:aca:330b:: with SMTP id z11mr3842072oiz.96.1582643871809; Tue, 25 Feb 2020 07:17:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582643871; cv=none; d=google.com; s=arc-20160816; b=GvW2xn0zO8vr8hIub5wq50qrq2oelq3s5s1g8dXeDxlqAb6gtzdnb2ggJkKMojqQUU s2MHx+03LxytQTILhpkeeVPNSlNHvGoDVNUWTBDmhKRVorHnvVc96+JASoHjC4u1xqRp I9VYCewsU4mBTqhWRi0z+xql4ASnKOpPC2lewqlROT7M+4wK4au9vAA0xF6apens49ly cx5JeXAdy6zjMEU6NwKlJKpd2R4WpJckbFf5SZC8DchZzrSENjvMgULscBKtVLc5DM84 /pBFT9Y/IZz607/F0omiSqPc7UNutFbCOJs0mh5euV5Ub54whRBPb3ipyGgboeRCAFV3 wBzA== 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=V9XjnbgqrmJ1vqSQPuTMo9kWUv0PtxJxtTzrWuas5qQ=; b=pMa7yOKBwz6VIli0wivJ5SPaNE7Gm6cVRSuAUwouyXbcMUcmnOXWkqO9e5twfLmvOm UYLECFMiggK2Q+Kvj0qQlpPwcI7vdp3YITfkMM1AirCqw3QJPOtj/MIJiOj5SSTKyWAn esZSVxozzdTwISjiNHGSp81mOQ0zBs5lmvvSBo+jO3odLm5/VPK7dxeMxOb6dzf1wHDJ 8LbeOicU9WZBS1uy2HL5U32PHkUNRiEb7SicQOtftlyUzQo8+QXY3TuBbmeM5XlPQ6TM pHtyg/DxsedP1XvQ7zqrw12tXv/A49IJQpXapxMfOOcyNs4pAWwZPYylwPQsxwb9TW5Z qLdw== 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 k19si8095281otr.52.2020.02.25.07.17.33; Tue, 25 Feb 2020 07:17:51 -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 S1730994AbgBYPQu (ORCPT + 99 others); Tue, 25 Feb 2020 10:16:50 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:53768 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730172AbgBYPQu (ORCPT ); Tue, 25 Feb 2020 10:16:50 -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 1j6bwx-0006BL-Cq; Tue, 25 Feb 2020 16:16:43 +0100 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id DF4A01C2032; Tue, 25 Feb 2020 16:16:42 +0100 (CET) Date: Tue, 25 Feb 2020 15:16: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: <158264380248.28353.10359759226402874808.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: bf69bac4d3ef188ee8cf536a31ecbb230a8ba91a Gitweb: https://git.kernel.org/tip/bf69bac4d3ef188ee8cf536a31ecbb230a8ba91a Author: Thomas Gleixner AuthorDate: Tue, 25 Feb 2020 14:55:15 +01:00 Committer: Borislav Petkov CommitterDate: Tue, 25 Feb 2020 15:05:56 +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 | 8 ++++++-- 1 file changed, 6 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..5d8971c 100644 --- a/arch/x86/kernel/cpu/mce/therm_throt.c +++ b/arch/x86/kernel/cpu/mce/therm_throt.c @@ -487,8 +487,12 @@ static int thermal_throttle_offline(unsigned int cpu) struct thermal_state *state = &per_cpu(thermal_state, cpu); struct device *dev = get_cpu_device(cpu); - cancel_delayed_work(&state->package_throttle.therm_work); - cancel_delayed_work(&state->core_throttle.therm_work); + /* 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_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;