Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp262165ybl; Mon, 2 Dec 2019 10:22:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxVgbL0V9soxqcy17WzSnUoCVeumBf9sJ08p3NAs1MjMhOMHUoh6s5XA8znb927Gl6ifvls X-Received: by 2002:a17:906:3052:: with SMTP id d18mr600919ejd.86.1575310957936; Mon, 02 Dec 2019 10:22:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575310957; cv=none; d=google.com; s=arc-20160816; b=z/9y3zUik07QEpZIrkcBrddxdqPUhN+6w6j1TMxZDzk8xABDlIEQDEm9qO4YMhQfrC c/byqXos7eMNLtLfLrZqHr2VLEgHmlSSd4/hWsjzkIjeGAQs4BBylVFGOxXBaZOc3t9u kyaG1of23mUII86XvihtLIxTf42/J2C8vIdee8TeuWwdKVdY3MhmPmwI9X++fqynwXKo 51GUYOHbo7TtX/THBix8TZjxdYSuQACmpCt2o4xJ2cSZOCGEGcZsWHz8tmnwnMLyAVrQ CwZxa+wnBLcV52FUEwJTQRF0g3E0/ADeuTyHr6/ZNLVGp3Ty/8ASILhioBAyxs7YmrAe 6/5g== 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; bh=7tqKqLjYq+CXeCec0i52m0eMxeiltbRlw9KlJTF8wKE=; b=N5ZIAsfSaNGH6uCGvi7Lkr+dEFpEBTzEkqvTSDyC3j9XaGdi1/3ZJE7zC1iI7+VmWy RR6iZHNGlrb5VFI0KA99oEGYFEniwtoN8eevF8EfImVX6skY7Rpc/fh8GWAEY/cmG/48 +LMDdrGXQW30TceZC1dnGM/7utHUO5ZOk/8yx84Ruc0haexBx+pHXE3ruhWx2i4frSpe cQ6tu6/yUix8OtY7nQ0jm8L8l0jgX6vuf89ceVkX3lN/uJrvGfgP4MeZL6XlmmrMRI7K acfaObhT3B4FcEfm9OhPlHIv7vG7CUru5fnHdS0IdEsUxWEGydzNFRGK9QHhWr+POD1G njcw== 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 cb5si137986edb.252.2019.12.02.10.22.13; Mon, 02 Dec 2019 10:22:37 -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 S1727910AbfLBSUe (ORCPT + 99 others); Mon, 2 Dec 2019 13:20:34 -0500 Received: from mga03.intel.com ([134.134.136.65]:49673 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727671AbfLBSUd (ORCPT ); Mon, 2 Dec 2019 13:20:33 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Dec 2019 10:20:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,270,1571727600"; d="scan'208";a="208178708" Received: from agluck-desk2.sc.intel.com (HELO agluck-desk2.amr.corp.intel.com) ([10.3.52.68]) by fmsmga008.fm.intel.com with ESMTP; 02 Dec 2019 10:20:32 -0800 Date: Mon, 2 Dec 2019 10:20:32 -0800 From: "Luck, Tony" To: Sean Christopherson Cc: Peter Zijlstra , Ingo Molnar , Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Ashok Raj , Ravi V Shankar , linux-kernel , x86 Subject: Re: [PATCH v10 6/6] x86/split_lock: Enable split lock detection by kernel parameter Message-ID: <20191202182032.GA22528@agluck-desk2.amr.corp.intel.com> References: <1574297603-198156-1-git-send-email-fenghua.yu@intel.com> <1574297603-198156-7-git-send-email-fenghua.yu@intel.com> <20191121060444.GA55272@gmail.com> <20191121130153.GS4097@hirez.programming.kicks-ass.net> <20191121171214.GD12042@gmail.com> <20191121173444.GA5581@agluck-desk2.amr.corp.intel.com> <20191122105141.GY4114@hirez.programming.kicks-ass.net> <20191122152715.GA1909@hirez.programming.kicks-ass.net> <20191123003056.GA28761@agluck-desk2.amr.corp.intel.com> <20191125161348.GA12178@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191125161348.GA12178@linux.intel.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 25, 2019 at 08:13:48AM -0800, Sean Christopherson wrote: > On Fri, Nov 22, 2019 at 04:30:56PM -0800, Luck, Tony wrote: > > Don't you have some horrible races between the two logical > > processors on the same core as they both try to set/clear the > > MSR that is shared at the core level? > > Yes and no. Yes, there will be races, but they won't be fatal in any way. > > - Only the split-lock bit is supported by the kernel, so there isn't a > risk of corrupting other bits as both threads will rewrite the current > hardware value. > > - Toggling of split-lock is only done in "warn" mode. Worst case > scenario of a race is that a misbehaving task will generate multiple > #AC exceptions on the same instruction. And this race will only occur > if both siblings are running tasks that generate split-lock #ACs, e.g. > a race where sibling threads are writing different values will only > occur if CPUx is disabling split-lock after an #AC and CPUy is > re-enabling split-lock after *its* previous task generated an #AC. > > - Transitioning between modes at runtime isn't supported and disabling > is tracked per task, so hardware will always reach a steady state that > matches the configured mode. I.e. split-lock is guaranteed to be > enabled in hardware once all _TIF_SLD threads have been scheduled out. We should probably include this analysis in the commit comment. Maybe a comment or two in the code too to note that the races are mostly harmless and guaranteed to end quickly. -Tony