From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A20AC388F2 for ; Sun, 8 Nov 2020 04:29:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 296AA2220B for ; Sun, 8 Nov 2020 04:29:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727782AbgKHE3k (ORCPT ); Sat, 7 Nov 2020 23:29:40 -0500 Received: from mga14.intel.com ([192.55.52.115]:27415 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbgKHE3j (ORCPT ); Sat, 7 Nov 2020 23:29:39 -0500 IronPort-SDR: iAt0x9yPTD3ADjwSexlqyW+BhENTm3GBzCD83GLntsMwbDF9fW+aH1f4phF/9k3qvEZQ3WRy39 Dh9TuoLSNjBg== X-IronPort-AV: E=McAfee;i="6000,8403,9798"; a="168900973" X-IronPort-AV: E=Sophos;i="5.77,460,1596524400"; d="scan'208";a="168900973" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Nov 2020 20:29:38 -0800 IronPort-SDR: OzdbD3x1yiWwouJKZFYF6hs6Mp/eEbOhuGu2tQr8KSqJ/NUweXO0fFTYEfd3f2how+ziBbbprw XRSbVY7uVmMQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,460,1596524400"; d="scan'208";a="307244981" Received: from otcwcpicx6.sc.intel.com ([172.25.55.29]) by fmsmga008.fm.intel.com with ESMTP; 07 Nov 2020 20:29:38 -0800 From: Fenghua Yu To: "Borislav Petkov" , "Thomas Gleixner" , "Ingo Molnar" , "Peter Zijlstra" , "Tony Luck" , "Randy Dunlap" , "Xiaoyao Li " , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , Fenghua Yu Subject: [PATCH 1/4] x86/cpufeatures: Enumerate #DB for bus lock detection Date: Sun, 8 Nov 2020 04:29:15 +0000 Message-Id: <20201108042918.1011889-2-fenghua.yu@intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201108042918.1011889-1-fenghua.yu@intel.com> References: <20201108042918.1011889-1-fenghua.yu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A bus lock is acquired either through split locked access to writeback (WB) memory or by using locks to uncacheable (UC) memory (e.g. direct device assignment). This is typically >1000 cycles slower than an atomic operation within a cache line. It also disrupts performance on other cores. Some CPUs have ability to notify the kernel by an #DB trap after a user instruction acquires a bus lock and is executed. This allows the kernel to enforce user application throttling or mitigations. The CPU feature flag to be shown in /proc/cpuinfo will be "bus_lock_detect". Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- arch/x86/include/asm/cpufeatures.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h index dad350d42ecf..f375d9cb8123 100644 --- a/arch/x86/include/asm/cpufeatures.h +++ b/arch/x86/include/asm/cpufeatures.h @@ -352,6 +352,7 @@ #define X86_FEATURE_AVX512_VPOPCNTDQ (16*32+14) /* POPCNT for vectors of DW/QW */ #define X86_FEATURE_LA57 (16*32+16) /* 5-level page tables */ #define X86_FEATURE_RDPID (16*32+22) /* RDPID instruction */ +#define X86_FEATURE_BUS_LOCK_DETECT (16*32+24) /* Bus Lock detect */ #define X86_FEATURE_CLDEMOTE (16*32+25) /* CLDEMOTE instruction */ #define X86_FEATURE_MOVDIRI (16*32+27) /* MOVDIRI instruction */ #define X86_FEATURE_MOVDIR64B (16*32+28) /* MOVDIR64B instruction */ -- 2.29.2