Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp874633pxb; Tue, 1 Feb 2022 12:12:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwcoPSFqGPFnsvtZFHUPbgC3D9mrSCFJOoftq6b6cdFEepaaZ/2SEU4kNJANM47a4GJLBR X-Received: by 2002:a17:902:a418:: with SMTP id p24mr1507052plq.171.1643746342089; Tue, 01 Feb 2022 12:12:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643746342; cv=none; d=google.com; s=arc-20160816; b=Fv/3HsuyZ0AoaGyRPALTx7qVqvhi0dTG7G8PlwRTsTHxHDF8Twh3jj+8Dck1ux5ffk T//Up99qQrAw0LO7ZN5je90folc29UXGUGByHTSzy43JERd4npsVGYTAN9nyKoQCHGNI s1M0rwXMxnvaSte/0PT6voBZUtAlGpsII4hAFqBLDOyxJd8PQUNJX250ma31/uOBe+Ik iaLV2uNkgN8XLU02x0zrbnE1fcBjLkPCDdtsNb7elGsoQwaWQr7AHCLQOHWIqVFXAUaB y1vUrLlBiHQYMHzjLnPks9HcZhDq2GlWYGL7avHldEn0+SVcIQw21tRecnEh1zwT0/i/ xQKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/T8lK+3HoAPb24Tle/dUQbYJJyY5bfMbmb8kiJg+yxk=; b=c5oce2vUhJDuD3tL6SCjQ4CiEyueSCqW/kkzAUlnlUTH9aOFOB+F1zJ0gzpbBoQTyY VrIfDgFDMCs1iXLeTf+aILRZr3omd1PWIocW3Fu0yYHPxRB+O7nOG+bn4XqZUFr8p64e WDT4ke7/wcb/TkIy0GM5WGPa/2pc6R+wI5HF944kK77JHH+9pHo+9FCU7HtGvm9H0KbU 8/gPu7n/iPQ4myXYKkmv331wSyjHnVMOoIXxYNi9qDXa5VAGyg/B7CxxJrUrzSEeWck5 HT8tZSTpbbLWiw6IK/pEngMKwiZZkrTMEmCz9P1Jk/T/sIcGNlWjBxIPkiuyBoany6Gr 7J2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cvoGvZ12; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pf3si3672338pjb.32.2022.02.01.12.12.10; Tue, 01 Feb 2022 12:12:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cvoGvZ12; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378567AbiAaLmu (ORCPT + 99 others); Mon, 31 Jan 2022 06:42:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379125AbiAaL3u (ORCPT ); Mon, 31 Jan 2022 06:29:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819E1C0617AA; Mon, 31 Jan 2022 03:20:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3CB5AB82A5F; Mon, 31 Jan 2022 11:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47144C340E8; Mon, 31 Jan 2022 11:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627999; bh=MoQMBgxEJWUXQ7oCFxZt/uAgqFPZTohGcRMNCzkJWQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvoGvZ12QvM6dDlbdxZ5E2LLNyDwOgFlXKpiGwrQUQgw+CAvk7JkXsQmZl3Hn6BQ/ AB2B2Vg23zIPJTNDLjWaQ20kC7ztNphtqn70Q/WU7/IoQ+uB9SXFk0/Jhh5o5F1y/R +kGCi2CT9DfJcWtO9t9lUxaXij0JJ2jVltCPGNGg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yazen Ghannam , Borislav Petkov Subject: [PATCH 5.16 091/200] x86/MCE/AMD: Allow thresholding interface updates after init Date: Mon, 31 Jan 2022 11:55:54 +0100 Message-Id: <20220131105236.675046425@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105233.561926043@linuxfoundation.org> References: <20220131105233.561926043@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yazen Ghannam commit 1f52b0aba6fd37653416375cb8a1ca673acf8d5f upstream. Changes to the AMD Thresholding sysfs code prevents sysfs writes from updating the underlying registers once CPU init is completed, i.e. "threshold_banks" is set. Allow the registers to be updated if the thresholding interface is already initialized or if in the init path. Use the "set_lvt_off" value to indicate if running in the init path, since this value is only set during init. Fixes: a037f3ca0ea0 ("x86/mce/amd: Make threshold bank setting hotplug robust") Signed-off-by: Yazen Ghannam Signed-off-by: Borislav Petkov Cc: Link: https://lore.kernel.org/r/20220117161328.19148-1-yazen.ghannam@amd.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/mce/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/cpu/mce/amd.c +++ b/arch/x86/kernel/cpu/mce/amd.c @@ -401,7 +401,7 @@ static void threshold_restart_bank(void u32 hi, lo; /* sysfs write might race against an offline operation */ - if (this_cpu_read(threshold_banks)) + if (!this_cpu_read(threshold_banks) && !tr->set_lvt_off) return; rdmsr(tr->b->address, lo, hi);