Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1472579ybj; Fri, 8 May 2020 02:04:12 -0700 (PDT) X-Google-Smtp-Source: APiQypLjTXAMmNESLjflBB/Gc/jLtCciVnlQXR2z3oXt8gcWlvZVn/jefcaD2bYUg4RxK3Nf92o8 X-Received: by 2002:a17:906:b28a:: with SMTP id q10mr1055700ejz.273.1588928651813; Fri, 08 May 2020 02:04:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588928651; cv=none; d=google.com; s=arc-20160816; b=P+DB/JNcWmvmfszgYsrPhfvKQf86/rpYXO+F/BscQDAOM0/88VUttKYF6N9+QyQvNX ozNpInkwsvDVajcBUg5fi5/RMp5r0TTGZQ4GO8Iol2J4R1J0vRqjAcXfldFrVIayjquS gyGzhXa/HlVyglozoHo393tUe0bKZcnCC5g0NwYVUhNKT2mLnx7NFFgayAyzAXpf/Wr5 8nZHtgkd/vhYhakpEqseBBGTES575EoIQ4Qj+4AS/hcR6ychLfNga+kayRF3ag/vE/Ji qFSaWujJ9p0dik5Uax+ZdBg5ehRmz9lD5OyOzhOoSFF0eVHs2EFSzsAQJlLeWdvtRWVF joVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=UfGx38+9SPoHmQP8CC+ox/bYJfMTGqebo8LnVqZgVDM=; b=Up+bmVJPtWnq9DDgsQmHDhZ9YkMIBLK+pyyuu4KTMJ0DiRBFtwzeohlP5SLb/Fr82i ZJ28zcmO0setdkfdAKjT+b2cH8HIV9uGzGGC2TNECohj7+pjK3a0e8NC7KhPWlQggv7s 7ELcImiPYYysgRMokopfwoaEQxFkgVYF6gEfehsW9T1OcZIJ1SJ3AQrXoPZFFdebBidZ mIWXRVTAl8i6vHHbSoHooFMY2EiaBlYwImzQxISVrIU5vgnq3kFH2UyLu4N64oVbDuE8 3tXZu6VTw5o5RVRQrHmtd62FaAbdj8fnLE2sV/zmeEo84Sj4b1r/nWuXTQHc7c69acRO MEpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=eJR2hVqu; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qh13si585506ejb.438.2020.05.08.02.03.45; Fri, 08 May 2020 02:04:11 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=eJR2hVqu; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726712AbgEHI7q (ORCPT + 99 others); Fri, 8 May 2020 04:59:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgEHI7q (ORCPT ); Fri, 8 May 2020 04:59:46 -0400 Received: from merlin.infradead.org (unknown [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9C13C05BD43 for ; Fri, 8 May 2020 01:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=UfGx38+9SPoHmQP8CC+ox/bYJfMTGqebo8LnVqZgVDM=; b=eJR2hVquXIeQmSloH7/BYjJIyL zCo2BBfDa/pTVRdt6/rlMB36uR8FqUGXJrjwKk6ASbvHTiMhwWVYf6B5gvGcE7PEusj/0XCDUDslN wabpLFEQNhIwd14QhOo1aYWb/C+/p6vKoTtGSSmsIpfJWRBGPyNt2FpwbGFMCRIMi5XqL/1MVf2Th X21rCSyVMEz8CJ8fzvqRAba4eafy+1aoh8FikoKFB0soAS8JlPj+fvuX3nKGbqm0QD6Dx8I3QuR/E GlGeavif47GWl+U7tUAeUy+2cGoih9Gc0kq5JkUijSImRkSKAVyrO8m+gjM9IFi0zw1CxEktk9kSl cfXWiiDA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWyqd-0004k3-9U; Fri, 08 May 2020 08:59:11 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A785030018B; Fri, 8 May 2020 10:59:09 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7B9702B93BDC1; Fri, 8 May 2020 10:59:09 +0200 (CEST) Date: Fri, 8 May 2020 10:59:09 +0200 From: Peter Zijlstra To: Alexandre Chartre Cc: Thomas Gleixner , LKML , x86@kernel.org, "Paul E. McKenney" , Andy Lutomirski , Frederic Weisbecker , Paolo Bonzini , Sean Christopherson , Masami Hiramatsu , Petr Mladek , Steven Rostedt , Joel Fernandes , Boris Ostrovsky , Juergen Gross , Brian Gerst , Mathieu Desnoyers , Josh Poimboeuf , Will Deacon Subject: Re: [patch V4 part 4 15/24] x86/db: Split out dr6/7 handling Message-ID: <20200508085909.GU5298@hirez.programming.kicks-ass.net> References: <20200505134926.578885807@linutronix.de> <20200505135314.808628211@linutronix.de> <16c57a7e-8d39-d77e-915d-41b7f5e042fd@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16c57a7e-8d39-d77e-915d-41b7f5e042fd@oracle.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 07, 2020 at 07:18:45PM +0200, Alexandre Chartre wrote: > > On 5/5/20 3:49 PM, Thomas Gleixner wrote: > > From: Peter Zijlstra > > > > DR6/7 should be handled before nmi_enter() is invoked and restore after > > nmi_exit() to minimize the exposure. > > > > Split it out into helper inlines and bring it into the correct order. > > > > Signed-off-by: Peter Zijlstra > > Signed-off-by: Thomas Gleixner > > --- > > arch/x86/kernel/hw_breakpoint.c | 6 --- > > arch/x86/kernel/traps.c | 62 +++++++++++++++++++++++++++------------- > > 2 files changed, 44 insertions(+), 24 deletions(-) > > > ... > > --- a/arch/x86/kernel/traps.c > > +++ b/arch/x86/kernel/traps.c > > @@ -691,6 +691,44 @@ static bool is_sysenter_singlestep(struc > > #endif > > } > > +static __always_inline void debug_enter(unsigned long *dr6, unsigned long *dr7) > > +{ > > + /* > > + * Disable breakpoints during exception handling; recursive exceptions > > + * are exceedingly 'fun'. > > + * > > + * Since this function is NOKPROBE, and that also applies to > > + * HW_BREAKPOINT_X, we can't hit a breakpoint before this (XXX except a > > + * HW_BREAKPOINT_W on our stack) > > + * > > + * Entry text is excluded for HW_BP_X and cpu_entry_area, which > > + * includes the entry stack is excluded for everything. > > + */ > > + get_debugreg(*dr7, 6); > > Do you mean get_debugreg(*dr7, 7); ? Shees, I have to go buy a new stack of brown paper bags at this rate, don't I :/