Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1414112ybg; Wed, 29 Jul 2020 13:38:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAUwzC6+jIsUAMSLeNORnXCpa+d2QESI1vIM+Xn+pAP/hF2tHQg9AbdBiwiQQYwmoSS2Vw X-Received: by 2002:aa7:d3d9:: with SMTP id o25mr120771edr.362.1596055131464; Wed, 29 Jul 2020 13:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596055131; cv=none; d=google.com; s=arc-20160816; b=KXqYox/TcEmLPvC9fgbKshTbc/p7BkOuR1rdTNOMBJof4CGnl2MHMRMn+ZK08Kx4JY g4gHbsK2lH6Fj+dlyYg8x2W5JJBU959vu8RZhVht98OV4vLsbjR2z90bkeQVsryE21IQ jS4mhDIV/z4U6uyDvwmA6laUvCHNb9UxT4jU7ISw+PCWj3QYAyQu1Q5TakbrLnN1j2JR e6XEs/Jue7lUhzaMSgQ6+KdaoppU0ShG96RTkASLv2EE5p/oAmSKJu4fgKvPv8qLDShf ISyeX1aezK5MoCmIWOtrvy9vRKyEvvfR9bsVL3ZCZDu9w3+8FS3y9oa85cqO9MP74bYm yF/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=s+SEy54AIwdn5FZ4T0AT1cHZReQqYQnnjA135FHLQok=; b=LXvp4QqbthIRA/lszsq50obh7OuLADtZxoJu0oh7T/d1aShl2cZqC8kWmHKuxrOojP OGmYeurdZUkRBcDNslGGeMUEKcEZdpDpKG+b41O5YfAfY2wUUY8ZTpqgilSrGAEe2YcM MDh/2KAtDuik/gXbGCLHjIX/DKV4UbX11hjUcmKwKkb6ejfgoU1EcHycomr3o+E2csc3 MFhJISAaBOvu7wIO8o2VD+laC5s9X8ENq3MaQQizSvTiVOjx4pDPJh8uWPK6TjOtaMnj DjFOrgdc2Z4lv0IW6Ey5LbHknB0wMIyn7sG5O1432YU1iCjByZEkwCxibK8hU/wHYngX 4Ejg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k19si1744786eja.413.2020.07.29.13.38.29; Wed, 29 Jul 2020 13:38:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726615AbgG2UgB (ORCPT + 99 others); Wed, 29 Jul 2020 16:36:01 -0400 Received: from mga14.intel.com ([192.55.52.115]:6113 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726365AbgG2UgB (ORCPT ); Wed, 29 Jul 2020 16:36:01 -0400 IronPort-SDR: wcBGI4d037GG7fgAAUh79+DxRxegNzVhp6NY16IMqh47lKNoXFTDzF+skZQOKC0nOZS+LgB9QR beXbj93rLKzA== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="150667373" X-IronPort-AV: E=Sophos;i="5.75,411,1589266800"; d="scan'208";a="150667373" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 13:35:57 -0700 IronPort-SDR: 83oOGSBPSz3itEV+umgLccoWbvJ9zGv82wsY+5G6/hrhkXOXtCV1HLb9KChduu3MiIn7D4wk0k HAZpL+eIIknA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,411,1589266800"; d="scan'208";a="490410820" Received: from otcwcpicx6.sc.intel.com ([172.25.55.29]) by fmsmga006.fm.intel.com with ESMTP; 29 Jul 2020 13:35:57 -0700 Date: Wed, 29 Jul 2020 20:35:57 +0000 From: Fenghua Yu To: Sean Christopherson Cc: Fenghua Yu , Thomas Gleixner , Borislav Petkov , Ingo Molnar , Peter Zijlstra , "Shanbhogue, Vedvyas" , "Luck, Tony" , H Peter Anvin , Andy Lutomirski , "Shankar, Ravi V" , "Li, Xiaoyao" , x86 , linux-kernel Subject: Re: [PATCH RFC] x86/bus_lock: Enable bus lock detection Message-ID: <20200729203557.GA318595@otcwcpicx6.sc.intel.com> References: <1595021700-68460-1-git-send-email-fenghua.yu@intel.com> <20200729030232.GE5583@linux.intel.com> <20200729184614.GI27751@linux.intel.com> <20200729194259.GA318576@otcwcpicx6.sc.intel.com> <20200729200033.GJ27751@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200729200033.GJ27751@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Sean, On Wed, Jul 29, 2020 at 01:00:33PM -0700, Sean Christopherson wrote: > On Wed, Jul 29, 2020 at 07:42:59PM +0000, Fenghua Yu wrote: > > > Smushing the two into a single option is confusing, e.g. from the table > > > below it's not at all clear what will happen if sld=fatal, both features > > > are supported, and the kernel generates a split lock. > > > > > > Given that both SLD (per-core, not architectural) and BLD (#DB recursion and > > > inverted DR6 flag) have warts, it would be very nice to enable/disable them > > > independently. The lock to non-WB behavior for BLD may also be problematic, > > > e.g. maybe it turns out that fixing drivers to avoid locks to non-WB isn't > > > as straightforward as avoiding split locks. > > > > But the two features are related if both of them are enabled in hardware: > > If a split lock happens, SLD will generate #AC before instruction execution > > and BLD will generate #DB after instruction execution. > > > > The software needs to make them exclusive. The same kernel option reflects > > the relationship and make them exclusive, e.g. "fatal" enables SLD and > > disables BLD, "warn" does the other way. > > Why do they need to be exclusive? We've already established that BLD catches > things that SLD does not. What's wrong with running sld=fatal and bld=ratelimit > so that split locks never happen and kill applications, and non-WB locks are > are ratelimited? Sorry if I didn't explain bus lock and split lock detections clearly before. There are two causes of bus locks: 1. a locked access across cache line boundary: this is split lock. 2. a locked access to non-WB memory. BLD detects both causes and SLD only detects the first one, i.e. BLD can detect both split lock AND lock to non-WB memory. If sld=fatal and bld=ratelimit (both sld and bld are enabled in hw), a split lock always generates #AC and kills the app and bld will never have a chance to trigger #DB for split lock. So effectively the combination makes the kernel to take two different actions after detecting a bus lock: if the bus lock comes from a split lock, fatal (sld); if the bus lock comes from lock to non-WB memory, ratelimit (bld). Seems this is not a useful combination and is not what the user really wants to do because the user wants ratelimit for BLD, right? > > If using two different kernel options, the user needs to give right options > > to make both work, e.g. can the user give this combination > > "split_lock_detect=fatal bus_lock_detect=warn"? What does the combination > > mean? > > Split locks are fatal, non-WB locks are logged but not fatal. Similar here: bus lock from a split lock is fatal (sld triggers #AC) and bus lock from lock to non-WB mem is warn (bld triggers #DB). Seems not what the user really wants, right? Thanks. -Fenghua