Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp141726ybp; Wed, 16 Oct 2019 15:22:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzzmX0aYMv27FL4FRpETlQ574M9l6HrLn7hylg2tLbpGHUvr8zJdVeBrp03/H8WGHHLCzd/ X-Received: by 2002:a17:906:f0d2:: with SMTP id dk18mr581338ejb.281.1571264553871; Wed, 16 Oct 2019 15:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571264553; cv=none; d=google.com; s=arc-20160816; b=Xitt58tY1rEnj2TVWu2qc1Mv4qCTK/kCqblJNcwx7aVykCF9cbXtJj/zZ1JXFucTQH zkW4hxjXJWkP7SsEFBONd3vF5WnkjiHMbYt5FyN40kZIF99Z0e6ZCEN4er6SOUlgI71M gA31MTfO6UO+I87xHkjAJy36rnKA73roA7G3FcNtj0hIME9DjupujBsuadHUbsINN/Zo OFXb+sQSNPFsXWPiVKw2KNNBeXSvq3b7ydd6tNxr3pd9k0qEOCXPhckEF9WSqa4pS9aV crB8zp3l/c8OesjO4cLFd6rIih5mKGpQBNniiiwi94dIdhK5D+q/9nXzH0bahsh5E3X2 uPcQ== 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=kzEiEG1IzDkxWpnyRYM4/VJ1cg9l5RUs37X9o+QxUZk=; b=z5RcZ+X1BBLs8miFXRA6k51wLWpLto/SLQyPYv/qnlVlO93dIi2DiqCQZYtlXrisqm c5dHZuFs4UeL9luJMGJJwzerIwnpF2+hdvY1CzNKALSkDOVsaZnV7Utk1YywYAZHvn/M oU2JfS8eFsUqz+nG/SI0SRQ9I2+cX1BrIVuRLhAMP2OSHDJ7ust+fgjdX1Q8u8fGzHob NcCfbcAY7NVtlv8U9k8y98LtWEOF+l7wxy88eWVLDa2JZGbS4Cg46UlFUtrhfnkH/Jkx WBF3LopHkoBAlt3nuA8yvWbjDc/FURfOYl66hcPM6xWXAGVXt0mCX/9m+gMpO3QXPgbc nGbQ== 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 p20si221081eju.109.2019.10.16.15.22.10; Wed, 16 Oct 2019 15:22:33 -0700 (PDT) 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 S2393070AbfJPP7n (ORCPT + 99 others); Wed, 16 Oct 2019 11:59:43 -0400 Received: from mga02.intel.com ([134.134.136.20]:36652 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729646AbfJPP7n (ORCPT ); Wed, 16 Oct 2019 11:59:43 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 08:59:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,304,1566889200"; d="scan'208";a="198994082" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by orsmga003.jf.intel.com with ESMTP; 16 Oct 2019 08:59:42 -0700 Date: Wed, 16 Oct 2019 08:59:42 -0700 From: Sean Christopherson To: Thomas Gleixner Cc: Fenghua Yu , Ingo Molnar , Borislav Petkov , H Peter Anvin , Peter Zijlstra , Andrew Morton , Dave Hansen , Paolo Bonzini , Radim Krcmar , Ashok Raj , Tony Luck , Dan Williams , Xiaoyao Li , Sai Praneeth Prakhya , Ravi V Shankar , linux-kernel , x86 , kvm@vger.kernel.org Subject: Re: [PATCH v9 09/17] x86/split_lock: Handle #AC exception for split lock Message-ID: <20191016155942.GB5866@linux.intel.com> References: <1560897679-228028-1-git-send-email-fenghua.yu@intel.com> <1560897679-228028-10-git-send-email-fenghua.yu@intel.com> <20190626203637.GC245468@romley-ivt3.sc.intel.com> <20190925180931.GG31852@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Oct 16, 2019 at 11:29:00AM +0200, Thomas Gleixner wrote: > > - Modify the #AC handler to test/set the same atomic variable as the > > sysfs knob. This is the "disabled by kernel" flow. > > That's the #AC in kernel handler, right? Yes. > > - Modify the debugfs/sysfs knob to only allow disabling split-lock > > detection. This is the "disabled globally" path, i.e. sends IPIs to > > clear MSR_TEST_CTRL.split_lock on all online CPUs. > > Why only disable? What's wrong with reenabling it? The shiny new driver you > are working on is triggering #AC. So in order to test the fix, you need to > reboot the machine instead of just unloading the module, reenabling #AC and > then loading the fixed one? A re-enabling path adds complexity (though not much) and is undesirable for a production environment as a split-lock issue in the kernel isn't going to magically disappear. And I thought that disable-only was also your preferred implementation based on a previous comment[*], but that comment may have been purely in the scope of userspace applications. Anyways, my personal preference would be to keep things simple and not support a re-enabling path. But then again, I do 99.9% of my development in VMs so my vote probably shouldn't count regarding the module issue. [*] https://lkml.kernel.org/r/alpine.DEB.2.21.1904180832290.3174@nanos.tec.linutronix.de > > - Modify the resume/init flow to clear MSR_TEST_CTRL.split_lock if it's > > been disabled on *any* CPU via #AC or via the knob. > > Fine. > > > - Remove KVM loading of MSR_TEST_CTRL, i.e. KVM *never* writes the CPU's > > actual MSR_TEST_CTRL. KVM still emulates MSR_TEST_CTRL so that the > > guest can do WRMSR and handle its own #AC faults, but KVM doesn't > > change the value in hardware. > > > > * Allowing guest to enable split-lock detection can induce #AC on > > the host after it has been explicitly turned off, e.g. the sibling > > hyperthread hits an #AC in the host kernel, or worse, causes a > > different process in the host to SIGBUS. > > > > * Allowing guest to disable split-lock detection opens up the host > > to DoS attacks. > > Wasn't this discussed before and agreed on that if the host has AC enabled > that the guest should not be able to force disable it? I surely lost track > of this completely so my memory might trick me. Yes, I was restating that point, or at least attempting to. > The real question is what you do when the host has #AC enabled and the > guest 'disabled' it and triggers #AC. Is that going to be silently ignored > or is the intention to kill the guest in the same way as we kill userspace? > > The latter would be the right thing, but given the fact that the current > kernels easily trigger #AC today, that would cause a major wreckage in > hosting scenarios. So I fear we need to bite the bullet and have a knob > which defaults to 'handle silently' and allows to enable the kill mechanics > on purpose. 'Handle silently' needs some logging of course, at least a per > guest counter which can be queried and a tracepoint.