Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1394513ybg; Wed, 29 Jul 2020 13:03:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwcqiXyhEuzA2R9pP8fmAnexP3ePfnSDbjft6pLgSXDXFMi+cJlb43hn47PZ3u9emoZC/W X-Received: by 2002:a17:906:fcdb:: with SMTP id qx27mr19498ejb.421.1596053038820; Wed, 29 Jul 2020 13:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596053038; cv=none; d=google.com; s=arc-20160816; b=CqzY1l2fqGZGWR4Q/+xYnYZ2JdHyfhZzmiyAFGfH6Ci+X0mXj6s3Wx026WfxqLtsLh 3IrF6EU/JVZwa622hQ2x0J5bPqXRWUHFYENxNsmnEOTv56lNwrZwN83nDx33NWiUVoPb nAhfMPdk+dMySdKKGD9l8W2kqMHAQ0dkva3yeWShaIMGUIl1wzXu2RCgt1G3PyeZP3AQ CfzsJgXqLoMn8Mbluo9T4/IhyIJ07zFPu8KL+3cWb920e0e+Il55ygrEe3+72msmwUOL ZqNp95XFpKTasFfrCoIGh4ets86L98N0LQYW5tH/IEY9/LJrWdd7g4GlwsqvurXIj21s ApfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=ke+ogDjfF8ivWxagzYIRPT8FQitRzroalWf4Ps4krVI=; b=ER0qTMT/VP5a5ZZBb/8ksJBpxaHFLtOFWEKXrvGVpYEU8pHaWjJI38SNZAe4K9DTRb 5Qn3CYoaIJD4MKRzdmRzzJ0ChPJ2CTUaLnesRBd+8wwQ8BlppCumTiTUTx1oRhD240t6 LK6uEKLByhBTWnynfFlSRYeiVglLBskifJGux3Ds1isYXjeKnoyIeCc3l8EYuqyRzFZ6 Itq/ddbl+s+g298dtEfuPgUR39uI/WZ2gB2oy+7412nPOxZalV0V4OX2espK8IhgP7Gx 9YSnCpcfDm2obQBJnqbFi8YMa33UItMLnSoj2s/49KdEPKB+LBv02EbBBEIsxwz7YP2O vtcA== 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 qc16si1688208ejb.746.2020.07.29.13.03.34; Wed, 29 Jul 2020 13:03:58 -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 S1726800AbgG2UAf (ORCPT + 99 others); Wed, 29 Jul 2020 16:00:35 -0400 Received: from mga05.intel.com ([192.55.52.43]:11104 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726496AbgG2UAe (ORCPT ); Wed, 29 Jul 2020 16:00:34 -0400 IronPort-SDR: HSyCi0ApK43FaJoyEu4DyFhi4qP7cvQYh0kuMm5wlsPI1ioGyNLZLIeUZNq426YPInjHLZ2gh2 yLSFZ1RqF5Xg== X-IronPort-AV: E=McAfee;i="6000,8403,9697"; a="236355402" X-IronPort-AV: E=Sophos;i="5.75,411,1589266800"; d="scan'208";a="236355402" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jul 2020 13:00:34 -0700 IronPort-SDR: c5pCVcZ5j2g/cSL1l/HYgX8CAz4uicvS1sIoXCU5M0cDOny4XTNMkLskYbfy/bB5rWb2zSE9qt sIN/HCk5R20A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,411,1589266800"; d="scan'208";a="322663584" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga002.fm.intel.com with ESMTP; 29 Jul 2020 13:00:33 -0700 Date: Wed, 29 Jul 2020 13:00:33 -0700 From: Sean Christopherson To: Fenghua Yu Cc: 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: <20200729200033.GJ27751@linux.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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200729194259.GA318576@otcwcpicx6.sc.intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Sure, sld==warn with bld!=off is a bit silly, but the kernel can easily handle that particular case. > 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. > There could be many combinations of the two options, some of them > are meaningful and some of them aren't. Maintaining the combinations is > unnecessary complex, right? Honestly, it seems less complex than deciphering the resulting behavior from that table. sld=off|warn|fatal bld=off|warn|ratelimit As above, sld then could become if (sld == warn && bld != off) { pr_warn("disabling SLD in favor of BLD\n"); sld = off; } Everything else should simply work. The necessary refactoring for SLD should be minimial as well.