Received: by 2002:a17:90a:9307:0:0:0:0 with SMTP id p7csp3945022pjo; Tue, 3 Mar 2020 09:52:49 -0800 (PST) X-Google-Smtp-Source: ADFU+vuJyOG+9bCqLwHp6QwgAmqiNjxqdR+t1stSpGs5dGL2g6iFca80Sy794WE8fzCP6pPAf8ZA X-Received: by 2002:a05:6830:1481:: with SMTP id s1mr2649141otq.44.1583257969365; Tue, 03 Mar 2020 09:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583257969; cv=none; d=google.com; s=arc-20160816; b=ObrYggGGGL5+sS4rCQitYqCjzh6obwKFqmI9YJOaPMfGTuTcFgifJa0pcJjnAslhsM pw07t5w3PxIv8kOm9v4kwMIFJYOOHMhYuap0joyi4WVMmZLD8kKP8p9stqFokGYpDr9o d1O+1dwVS6wx6LMC5fiLeoq8UDLb0RXTW+YrCtjIzkIL4kAk09V9s5AVUSX8+I7lD5qQ GPiLaGemPmrCbD9+ChOswtSkkUXIlbrS+JX1vjAZ9pLwxnp3JnZef98gVmymzdhP/vR2 dSH3YNJfJIVIiHAhuhW/M0FGUozx8X4e4R/IElvYQN+9FL5IgQF+BYfxBkTUEm2p/vF/ D2ww== 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=o+pXJ3fxhxsHZFxvdyESIyMI51jLw9Yabtk4RRmAV9yaGno1kQuh2hFiuzpIJXtCpB U07WTPSZU3y+WLr05oaK3lWK45bCBNIBJSPSOgG7ZxMkG2IADNFvxpsU7CBAfFOjjkLN 1Judwg8diSiJtNMXSm+uaKKxB3okDUbMTFXTssi7em60gMq30/fmFXqfhiG6ewQ5ggCG N7I7XTHpKAJTq6+z8M4ads30A+jp9H9GdwV5YlP0PPhhnKJbFsvQBrha7t0pTkaoSOEj COhODsd2C51HZy6q25hXWMGKinyLgAD6tzsz/Rwir/NBphtukKEQg5Tm88UdA/n0E/s1 mrNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FHvn8ryF; 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 j9si8377221oiw.133.2020.03.03.09.52.37; Tue, 03 Mar 2020 09:52:49 -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=FHvn8ryF; 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 S1731683AbgCCRvF (ORCPT + 99 others); Tue, 3 Mar 2020 12:51:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:58954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731183AbgCCRvB (ORCPT ); Tue, 3 Mar 2020 12:51:01 -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 296B1206E6; Tue, 3 Mar 2020 17:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583257860; bh=ID/GXQTXuDAQaPABtNm17V4BJtPBQdU0jqhKUuDlYp4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHvn8ryF03v+17vSuBuh9DPhoYTUVKtk6FThG+gk/+3fAbP3LuUmX+cmnuzn9MLoc PI9dB7aqgXgO3MGIITrRTQxKBhck3kn1ZJHf8lk1s5ioFVG1orZeh+GkVXZlyRMgbT tBg44dkIDtvP1XdL1lIr3ZC7pJolxb4e/PzljGfg= 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.5 156/176] x86/resctrl: Check monitoring static key in the MBM overflow handler Date: Tue, 3 Mar 2020 18:43:40 +0100 Message-Id: <20200303174322.523561222@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200303174304.593872177@linuxfoundation.org> References: <20200303174304.593872177@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;