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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 0D35AC64E75 for ; Tue, 24 Nov 2020 20:53:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A947F2076E for ; Tue, 24 Nov 2020 20:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728599AbgKXUw4 (ORCPT ); Tue, 24 Nov 2020 15:52:56 -0500 Received: from mga01.intel.com ([192.55.52.88]:40532 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728521AbgKXUwz (ORCPT ); Tue, 24 Nov 2020 15:52:55 -0500 IronPort-SDR: tvriKuny3WkL42BEqmECxxAOExwYeeNX3lqpkA0eEdnlJ3acjugRMvQNMyCn8hBN8zOd86RdPJ b9atBGKRLYjw== X-IronPort-AV: E=McAfee;i="6000,8403,9815"; a="190147110" X-IronPort-AV: E=Sophos;i="5.78,367,1599548400"; d="scan'208";a="190147110" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2020 12:52:54 -0800 IronPort-SDR: q6nlRxxahgRyzTZ2g0KavGYKSH58m1DVjDUhHONSB7q8eJwUqzk/rW5iQ6Ag5ol9RZjUOPDipx wabntdIkX+lw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,367,1599548400"; d="scan'208";a="432729541" Received: from otcwcpicx6.sc.intel.com ([172.25.55.29]) by fmsmga001.fm.intel.com with ESMTP; 24 Nov 2020 12:52:54 -0800 From: Fenghua Yu To: "Thomas Gleixner" , "Borislav Petkov" , "Ingo Molnar" , "Peter Zijlstra" , "Tony Luck" , "Randy Dunlap" , "Xiaoyao Li " , "Ravi V Shankar" Cc: "linux-kernel" , "x86" , Fenghua Yu Subject: [PATCH v4 1/4] x86/cpufeatures: Enumerate #DB for bus lock detection Date: Tue, 24 Nov 2020 20:52:42 +0000 Message-Id: <20201124205245.4164633-2-fenghua.yu@intel.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201124205245.4164633-1-fenghua.yu@intel.com> References: <20201124205245.4164633-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 though either split locked access to writeback (WB) memory or any locked access to non-WB memory. 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