Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp90424ybl; Wed, 22 Jan 2020 16:48:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyeuzPwege6ruc1XA83dMfAZbJnaWLspIFVUsyvhWVlGYSc7V1szG41fej6iHcXSwE5UW7P X-Received: by 2002:a05:6830:231d:: with SMTP id u29mr9728412ote.185.1579740483463; Wed, 22 Jan 2020 16:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579740483; cv=none; d=google.com; s=arc-20160816; b=cbYTXz09UqARxRnfZ76Q3J7XsIgn3OROkmIg88tqdFjFSO+nG/K4cestbtkntgcX95 1beh+M1Tt/r4p7WZL9iqmRyPw+oDaYm0FxbxD52pKyVmoEnrCbFYRRinIzjPzgo/BXMW 9UiIAQqH5IxqCCotorsEZ729xnKRJhIV92bc7hogaJdD/+kJAeor8E2ECqoZG37YIrnC vZptmH3A8kXE5kag5gavnz084UZXG+vywHPR8ISUPe3VXGjhgD2n6W7PIKydTLkiyPrX dN4R2tTrF+Ipe9GQI1EQIv3IFlbMgR8Bj59fOTU+mxaHPfkRDwc6CVpfSk/zjmBdOkLk NtDg== 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:date:from:dkim-signature; bh=SjT/+iv4Oysvj1Adxey1awc4Ekn9woQQ3e5HKZBrgj0=; b=mAxXyjCoS5hNAjh/mrYz62JX4x5rE09nBujSJQ5ce8Qmm8sKkxvJehE3phkDuFVo6p Z+C7GAantvXU4j9yNaknrh4qLUFzeDUooxsJOltgIw0El1w6ZIlJ12RJoz/T42HR5kqM 3Uvva2YAaH7SUttghiPNwTxTdsn0u7SBpCRtNu1amo8cptbjwP7zxGWcVZO/FWB66/PD TKXWDQ5rT9B6dtuG1IROcS/MUpGaXBvWlYie/cASBLpUPSW5r3iM7vHVKEs2zlkiIGj4 3Mn9YFMJOiDJkJc3NwJR6IQWbG1iYEDxUHbpPaBVI4Ztf4tzvw7cFwKssIyBheKxkInr Daxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nJX9Th+e; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m17si248429otr.17.2020.01.22.16.47.51; Wed, 22 Jan 2020 16:48:03 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=nJX9Th+e; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728668AbgAWApM (ORCPT + 99 others); Wed, 22 Jan 2020 19:45:12 -0500 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45595 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgAWApL (ORCPT ); Wed, 22 Jan 2020 19:45:11 -0500 Received: by mail-qk1-f194.google.com with SMTP id x1so1715373qkl.12 for ; Wed, 22 Jan 2020 16:45:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=SjT/+iv4Oysvj1Adxey1awc4Ekn9woQQ3e5HKZBrgj0=; b=nJX9Th+eJgumVzdvIu09OaEmqZomQv5Zr6PPZSnv6rtRKI3O8lIYw3DnBBOOKVGjRq lZ6deD0Zq6sczErH2zxSU3Zt2LsSeReOnEBJtx9UwJaBuSvWpTa4MfHGqIHcEzA0Uzqz lsh/HnzXc7eSeYKiFr9kkr3ww/PMVCoHy7RvhXgb4xkMvtOvQwToZQ6rXXHj5/vyW/0Y uemCg5mBnN9OxPJ4ZgONWM8fWNbOP83coykbmPvksDyRzqdI7iSGL2M+wDkeTwgB9gSH TUYdI+0oaYXvAzjRu2S0b0P4AI+pz0mnnUFrYFSxATl14iAjn6K8HlxlhuPOao7ZppMK FgZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=SjT/+iv4Oysvj1Adxey1awc4Ekn9woQQ3e5HKZBrgj0=; b=SoLxVqu9UmUWH6NP5P8Lc7MIIMuYUUhs8AOY19hi0WjdZcRoBqO8n4XrVD4eeMmAre jkS8OZWwSKbNVgpSox8bCFiBnKHBh1/IxhtNeJkpRh64PrZDjhDIW1/KFw3OfwJ/elUo EJt9QrCdhTT2v1SLi3bUu1NKfGmMf6+HyPZSLpYEkVA4XzNjhG4JxmhPvt1ywMGxGldl CqLIXQXPEoxmja/rPu/aJoTwOIwaYPp0zeJPJoBpMg08HHFpRAq/DAVrkTYFCE32meHE x7eQ7jaIlF75MNj+FDnrXziw/24t1JcXmPG91hsYPURpZRjwBOjVqSnxJMETo175qmQk bG8g== X-Gm-Message-State: APjAAAXyKDX1V8P6GYAghKj8YXkjPpj78ghpf0/5rqTWGaziJrXbvt/t iWiWB3vcRLwYt61rr8pv8VJEnwMouLY= X-Received: by 2002:a37:7b84:: with SMTP id w126mr13282740qkc.280.1579740310952; Wed, 22 Jan 2020 16:45:10 -0800 (PST) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id c16sm155456qka.18.2020.01.22.16.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2020 16:45:10 -0800 (PST) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Wed, 22 Jan 2020 19:45:08 -0500 To: "Luck, Tony" Cc: Arvind Sankar , Thomas Gleixner , "Christopherson, Sean J" , Peter Zijlstra , Ingo Molnar , "Yu, Fenghua" , Ingo Molnar , Borislav Petkov , H Peter Anvin , "Raj, Ashok" , "Shankar, Ravi V" , linux-kernel , x86 Subject: Re: [PATCH v12] x86/split_lock: Enable split lock detection by kernel Message-ID: <20200123004507.GA2403906@rani.riverdale.lan> References: <20191123003056.GA28761@agluck-desk2.amr.corp.intel.com> <20191125161348.GA12178@linux.intel.com> <20191212085948.GS2827@hirez.programming.kicks-ass.net> <20200110192409.GA23315@agluck-desk2.amr.corp.intel.com> <20200114055521.GI14928@linux.intel.com> <20200115222754.GA13804@agluck-desk2.amr.corp.intel.com> <20200115225724.GA18268@linux.intel.com> <20200122185514.GA16010@agluck-desk2.amr.corp.intel.com> <20200122224245.GA2331824@rani.riverdale.lan> <3908561D78D1C84285E8C5FCA982C28F7F54887A@ORSMSX114.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F7F54887A@ORSMSX114.amr.corp.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 22, 2020 at 11:24:34PM +0000, Luck, Tony wrote: > >> +static enum split_lock_detect_state sld_state = sld_warn; > >> + > > > > This sets sld_state to sld_warn even on CPUs that don't support > > split-lock detection. split_lock_init will then try to read/write the > > MSR to turn it on. Would it be better to initialize it to sld_off and > > set it to sld_warn in split_lock_setup instead, which is only called if > > the CPU supports the feature? > > I've lost some bits of this patch series somewhere along the way :-( There > was once code to decide whether the feature was supported (either with > x86_match_cpu() for a couple of models, or using the architectural test > based on some MSR bits. I need to dig that out and put it back in. Then > stuff can check X86_FEATURE_SPLIT_LOCK before wandering into code > that messes with MSRs That code is still there (cpu_set_core_cap_bits). The issue is that with the initialization here, nothing ever sets sld_state to sld_off if the feature isn't supported. v10 had a corresponding split_lock_detect_enabled that was 0-initialized, but Peter's patch as he sent out had the flag initialized to sld_warn. > > >> + if (!split_lock_detect_enabled()) > >> + return; > > > > This misses one comment from Sean [1] that this check should be dropped, > > otherwise user-space alignment check via EFLAGS.AC will get ignored when > > split lock detection is disabled. > > Ah yes. Good catch. Will fix. > > Thanks for the review. > > -Tony