Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1047927ybl; Wed, 11 Dec 2019 11:36:04 -0800 (PST) X-Google-Smtp-Source: APXvYqy9rXJdLLT1szqMoRHKbXTUqevpq7tOApCtwB70VyCecHxFAE/nF5PpctzNzCvwGaE3c9bX X-Received: by 2002:a05:6830:204a:: with SMTP id f10mr3618732otp.29.1576092964070; Wed, 11 Dec 2019 11:36:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576092964; cv=none; d=google.com; s=arc-20160816; b=ZKJPU0Lt0dyghiOf6hQopFOyrZYeyyheQ2aq/vf9hXLjI2fZn1kZcG9yDVOl9jr3y4 eG7ST2Ap6Xqy1/MXxCf3LbJ2NJLA5rU+mx8lr42hk+jWZEitjMTJZ4EQwSiLVFsw5shi G624rimEhAg4tXod7ixsbDWgeFoxISNuL5YJCSxrdqQkEYkPswOsgmglYOR2Al2VuSDX UFWjB9os7mQfM214mlB2Zaw47ZSljBp901DW+7VuGpxHnSJ77ODvwUUsj1f202/8nHdw 3Nfop9VTadD0RjfcwOBQzhb8ruhypOgR1ilf9PosKoL6sNv9IMyBCocc31WbnDJP9PX3 Uh/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=saGGCW6TCnCD1QhHwqXp1OJwgME1Ns6U3sZHdaYmcUQ=; b=tV7g9mBBhpeaHj/QoLIXoW4fzlNOIN8rzYARIBh6RAOqKw8L3a1u0fnbDp8vApFOC+ hR9IsfSjZo1Ba6jzhBDnG+GWmEJFaP86X+FmqEGQWvWyrmkyPFkeiMoXQ5TzzuIxsJO7 pJnINo8/TlEYs72FjBxXFpERbjMf4PtQC8QoNitbX9G9tUgqVaWnuruM20P80xuFMM4x gAOe6iDgqvfLtdyubyviA9LSdTxMofikZ9jzm1zX/YcOY17GyIrY8CiaEklanwjuc5ko Pp3fCnnB2gkxv4nKl0VW+nFicOFLt6udtkYTmOCPIrDN+0s/ITgZlrUIujpRRcBd6kh7 96Yg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si1823920otq.28.2019.12.11.11.35.50; Wed, 11 Dec 2019 11:36:04 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbfLKTeq (ORCPT + 99 others); Wed, 11 Dec 2019 14:34:46 -0500 Received: from mga07.intel.com ([134.134.136.100]:13650 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfLKTep (ORCPT ); Wed, 11 Dec 2019 14:34:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2019 11:34:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,303,1571727600"; d="scan'208";a="245403889" Received: from xshen14-linux.bj.intel.com ([10.238.155.105]) by fmsmga002.fm.intel.com with ESMTP; 11 Dec 2019 11:34:41 -0800 From: Xiaochen Shen To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, tony.luck@intel.com, fenghua.yu@intel.com, reinette.chatre@intel.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, pei.p.jia@intel.com, xiaochen.shen@intel.com Subject: [PATCH RESEND] x86/resctrl: Check monitoring static key in MBM overflow handler Date: Thu, 12 Dec 2019 04:05:05 +0800 Message-Id: <1576094705-13660-1-git-send-email-xiaochen.shen@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1576086103-11640-1-git-send-email-xiaochen.shen@intel.com> References: <1576086103-11640-1-git-send-email-xiaochen.shen@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, there are three static keys in resctrl file system: rdt_mon_enable_key and rdt_alloc_enable_key indicate if monitoring feature and allocation feature is enabled respectively. rdt_enable_key is enabled when either monitoring feature or allocation feature is enabled. If no monitoring feature is supported (either hardware doesn't support monitoring feature or the feature is disabled by kernel command line option "rdt="), rdt_enable_key is still enabled but rdt_mon_enable_key is disabled. MBM is a monitoring feature. MBM overflow handler intends to check if monitoring feature is not enabled for fast return. So the accurate check here is to check rdt_mon_enable_key instead of rdt_enable_key. Fixes: e33026831bdb ("x86/intel_rdt/mbm: Handle counter overflow") Signed-off-by: Xiaochen Shen --- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/monitor.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index e49b77283924..181c992f448c 100644 --- 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_fc2context(struct fs_context *fc) } 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 diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c index 397206f23d14..773124b0e18a 100644 --- 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_struct *work) 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 rdt_domain *dom, unsigned long delay_ms) 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; -- 1.8.3.1