Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1805863ybg; Thu, 30 Jul 2020 03:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq+TbiPwvQbQ6DpgWvzO6AsQXRhrmJ7uZOfbrbmk1dzX3arXPr5InNILOOr6xBTx/8l3Ft X-Received: by 2002:a17:907:36b:: with SMTP id rs11mr1941692ejb.544.1596103879068; Thu, 30 Jul 2020 03:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596103879; cv=none; d=google.com; s=arc-20160816; b=pyV7+DPlh6nDHeuVt2PNUo+1xCGQyrvPw9VuZm4yFOn5PowSNDngR7THZkNpXByCHJ skXfUyYGNVaAzQklQlJDmqe8AklSQkNJ5Tj1AkdtIEnTLYnn2RBYoDsBlstUKDqKvxyG m67qhzrPvuxZ8HXoUBySj+iCz8wiB6zLsgiyDK3YvLnn+vofrKCBAIriy6bkVXOrwlvm dy329pZo0wsj0NF0wv+5iud+UcMcFPzhRLe0CrrdIf6BhMy/8S4kwSDCNF8OeGPlIkIW fxdiag8I2/WICzYeZqY1emEElwVB3Otvq3EqoGIOueocCTwuTfmvkctYFcSliekAE5EJ Kx6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:dkim-signature:dkim-signature:from; bh=icuGs7gjwEzJJOhYixOZSnol7c85JJb/wOCOTTI7rqU=; b=NRVTsfYzJn2/YEQe8CpkruIxbCVeG3gHxw+uQAJmHrzPVL7+vG+CEpynIAbt4si+hg YejrWDx1BfS46XFhUZVCfBrJMY3BK/dblMzzKXbu4KSMIFY6R0y9u72Yz2A6TxU0M9En XZqoqC5yh5C668C5Fz83/ftCvg0+RhdO7faUWcZkdAVoSn9co15fxQLALRjOAQQj3St0 0EaVvoDchjY7N6FFJYsrakSH+VhGW1P3TMu3eBZOd1r62ZdXK0pAR7YaEJxkwmSnqJ+5 A9vRepauqgpGjbE7ujisn6/Fw+UM0sw3eV0txb7vRxYjxAsgwqOx9TRLkKaT+hRmzMqL DtMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=eO1Zpbim; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=uQUKCyF9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o3si2779815ejm.346.2020.07.30.03.10.57; Thu, 30 Jul 2020 03:11:19 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=eO1Zpbim; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=uQUKCyF9; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728924AbgG3KIb (ORCPT + 99 others); Thu, 30 Jul 2020 06:08:31 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:49462 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbgG3KI2 (ORCPT ); Thu, 30 Jul 2020 06:08:28 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596103706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=icuGs7gjwEzJJOhYixOZSnol7c85JJb/wOCOTTI7rqU=; b=eO1ZpbimFr4/VZU8Xu1Jm7BTN6rAZkCeMIFOqmYVNGjkxlrG/diOZF3bAOO/ImZgtjQOzz 8D8s1WFC04ITXjEhSjTXEz72UYGwPdPnixayykqXDGWkrEjx0cbnN8FQTRRXpZS0kl30mY aQEzLaEyxnNzXRpCp4wjEB8r3yppITClnLcI2OHderc1R+ig373JG4+Tv1mc5kdsCGZ7oT HGRJugykK9QNlO0fOVS1PV+bnPkQEWcUHGFbk4ic2ScPFesdmGCuQD4U/MExHZRnbBnSLR 5kQp8gIbrDWmp4my1T+kihxDQw/Z8ZmwQuZ0mtAZO5RsShevUsWredvuUUnSVw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596103706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to; bh=icuGs7gjwEzJJOhYixOZSnol7c85JJb/wOCOTTI7rqU=; b=uQUKCyF9Oe/6KX6UhyWkQD6yQX4GNL5ZsWnPYMWxA1+vs3CNTcslgY87M7qxDLIL9prarx OeE/FuDi/D8iHVCQ== To: peterz@infradead.org, Fenghua Yu Cc: Borislav Petkov , Ingo Molnar , Tony Luck , H Peter Anvin , Andy Lutomirski , Ravi V Shankar , Xiaoyao Li , x86 , linux-kernel Subject: Re: [PATCH RFC] x86/bus_lock: Enable bus lock detection In-Reply-To: <20200729210935.GE2655@hirez.programming.kicks-ass.net> Date: Thu, 30 Jul 2020 12:08:26 +0200 Message-ID: <87r1stmi1x.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org peterz@infradead.org writes: > On Wed, Jul 29, 2020 at 08:40:57PM +0000, Fenghua Yu wrote: >> Can we disable Bus Lock Detection before handle it and re-enable it >> after handle it? Will that resolve the recursion issue? > > Because WRMSR is cheap, right? > > You have to unconditionally {dis,en}able it on #DB entry/exit. Not only > when it's a DR_BUS_LOCK, _always_. Then maybe. I'm too tired to think > through the IST mess. > > IST's suck, they're horrible crap. > > Suppose we get a #DB, then we get an NMI right before it does WRMSR, so > BUS_LOCK is still on, then the NMI does a dodgy LOCK op, we die. > > So that means, you get to disable it on every NMI-like exception too, > but we happen to care about performance for those, you loose. > > Also, what happens if you have a hardware watchpoint on the instruction > that causes DR_BUS_LOCK? Does that work as expected? Q: Why on earth are Intel hardware folks cramming this into #DB? A: Just because there was a bit left in DR6 to indicate it, right? Q: Why can't hardware folks talk to us _before_ they make the x86 exception trainwreck even worse? A: Just because they know that we'd tell them to go back to the drawing board. Q: Is that going to be supported by the kernel? A: No, go back to the drawing board and talk to us _before_ coming back with the next half thought out tinkerware cast in silicon. I'm really tired of wasting time dealing with such misfeatures which create more problems than they solve. Thanks, Thomas