Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp3951527pjo; Tue, 3 Mar 2020 10:00:21 -0800 (PST) X-Google-Smtp-Source: ADFU+vtAD1bX7tyqQ/5A9uGFznSmORbOMIC4ELKlolLcoVBOx4Z6XD74WU3NWn+Cjh0kMYVhVKl2 X-Received: by 2002:a05:6808:902:: with SMTP id w2mr3324476oih.170.1583258420854; Tue, 03 Mar 2020 10:00:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583258420; cv=none; d=google.com; s=arc-20160816; b=cha8KXAb8Pc3OfDsCoqFvt4hdN+Y3kwWpgBT7RxveXQru/rCn++rem+e1oIGaovqcG 0UNj5MTYX4AlfYEsfEf6jyqm6JoTn6wfzeGGt7B9fhupzruwDuVChy7lkff4EbIbtVGE TC2Ch2Yfh1Re4qVcSNN5YncAC5ojRy/4V6qYU39mUGedPWQgk6O0orvfoPusz2DebWXq 2XnY7k2W4s8pWcEYewICno3WwMWaTn71d5fwyvNBm3RfXm2iZSHLojfDyUD9oVudmw+k SK+RA3bo2Ci2gIHjSx5FMZa5m2SLDacxSAWNORBAy+FqnCRQwzoH8SF8MlR/ecwAB9Qs +UsQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OyzA8DsfMDjHHEM8gJB5ruo0Nqwl5fgF4PqcT+Eazpg=; b=pfeSz/hz5E3q7J8/AicOPZGV7ajRrPBwjLyzPXznZzAI79D7MGUWlU4exYlnZUIYtA WpCuVC3jwqbQ9maPp2VdpOATHX7cC8hVRYuDyBFBwxf3K5hOta7Us/nnuk1sXBFGe0jO T5/gRv0IPzTpN1lIZbpsJQ8c0opUHCOdz9wJvBVLYtfw9cTS9jWfgJXPwDj8XTJuEoXD kx8rG2Pyj2yVZ74zO4Ntfozre3wR8W8pSqpqkMdEW2bBlnmd3jd5r+DqQq/JQnA+iQOI 5ufv/IVhsUTbIGxZnI6siLEK3ThSrXV5w58sIq8FQS9XeNjpm+k6cpTFcchjGehgQ6Ns e/zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DkQk+5pH; 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 r12si7972660oij.113.2020.03.03.10.00.08; Tue, 03 Mar 2020 10:00:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=DkQk+5pH; 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 S2387430AbgCCR6h (ORCPT + 99 others); Tue, 3 Mar 2020 12:58:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:41476 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387427AbgCCR6g (ORCPT ); Tue, 3 Mar 2020 12:58:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E0769206D5; Tue, 3 Mar 2020 17:58:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583258316; bh=ID/GXQTXuDAQaPABtNm17V4BJtPBQdU0jqhKUuDlYp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DkQk+5pH5AuPO9X6O9Zn5utPE4BYYldpNs/IXJJZdaj/g+b0IKC6+aeEBDLlIF91T ZAE/jVuabYs7L8QtOAWsiabQVJqyiuy4hkMKvtm4Wo0kpbnwdCDvlAeCbpnaTepKsc 1gfp99k+SD7YneyoUoAAErsgR1mnJ9ZFG0wZm82g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaochen Shen , Borislav Petkov Subject: [PATCH 5.4 134/152] x86/resctrl: Check monitoring static key in the MBM overflow handler Date: Tue, 3 Mar 2020 18:43:52 +0100 Message-Id: <20200303174318.046809835@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174302.523080016@linuxfoundation.org> References: <20200303174302.523080016@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiaochen Shen commit 536a0d8e79fb928f2735db37dda95682b6754f9a upstream. Currently, there are three static keys in the resctrl file system: rdt_mon_enable_key and rdt_alloc_enable_key indicate if the monitoring feature and the allocation feature are enabled, respectively. The rdt_enable_key is enabled when either the monitoring feature or the allocation feature is enabled. If no monitoring feature is present (either hardware doesn't support a monitoring feature or the feature is disabled by the kernel command line option "rdt="), rdt_enable_key is still enabled but rdt_mon_enable_key is disabled. MBM is a monitoring feature. The MBM overflow handler intends to check if the monitoring feature is not enabled for fast return. So check the rdt_mon_enable_key in it instead of the rdt_enable_key as former is the more accurate check. [ bp: Massage commit message. ] Fixes: e33026831bdb ("x86/intel_rdt/mbm: Handle counter overflow") Signed-off-by: Xiaochen Shen Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/1576094705-13660-1-git-send-email-xiaochen.shen@intel.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -57,6 +57,7 @@ static inline struct rdt_fs_context *rdt } DECLARE_STATIC_KEY_FALSE(rdt_enable_key); +DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key); /** * struct mon_evt - Entry in the event list of a resource --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -514,7 +514,7 @@ void mbm_handle_overflow(struct work_str mutex_lock(&rdtgroup_mutex); - if (!static_branch_likely(&rdt_enable_key)) + if (!static_branch_likely(&rdt_mon_enable_key)) goto out_unlock; d = get_domain_from_cpu(cpu, &rdt_resources_all[RDT_RESOURCE_L3]); @@ -543,7 +543,7 @@ void mbm_setup_overflow_handler(struct r unsigned long delay = msecs_to_jiffies(delay_ms); int cpu; - if (!static_branch_likely(&rdt_enable_key)) + if (!static_branch_likely(&rdt_mon_enable_key)) return; cpu = cpumask_any(&dom->cpu_mask); dom->mbm_work_cpu = cpu;