Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp634007ybr; Fri, 22 May 2020 15:24:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWt8Nhe7pWL7uEPxfErz/rHQCwwy6Ae94uGHJZqDsBKbz2zM6F8tnqt9RC208fRQaS5Ksk X-Received: by 2002:a50:e04c:: with SMTP id g12mr4931025edl.74.1590186294078; Fri, 22 May 2020 15:24:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590186294; cv=none; d=google.com; s=arc-20160816; b=cIL6K42bPHKe5//pDpq+QtLTv+g+J+daBNOFbn60UgJS/yz3PnEJuQH2hVkuCO51zo YEZV4n5t5Ibx/oIPv9+3PJO/eFFsvGZwZyH22P0wMDla4BbFhwgnImCZ4Sj61MzovRoA 4n4Tq39uuB+qwFBEZnjHmrQTIwTjfBdiZxDTwirAQK8xZW6xlYboikCcJWPI7B8YH2VF aJqf3db/DWXyM4zbvYZPEgMxvS33+QMV+cgkxvLJeXoy/xRNzHoVTkCqxiu8fUwvon7e cPvVIBdTdMVRTX0wM3G/4pkKJXQiAdXUyTgWQBkIJBpT1V4G0GF+vXNJZhh7UJ2hYx65 4HGw== 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:ironport-sdr:ironport-sdr; bh=VLEQ1rztEqrj/I3e2cQv7HEjAAqtzYlE/ty6akmE8i0=; b=KmwXYGxs4uahSW9hY+yMYSXK7KdYbtd7oyCTWL2TGxNYaWTm7d/6Wo/dcZstADsoxA ZSpWpiLUHKnr/tsiQTeXCnS8f8PjDSbrufZS264nU6+ced7y++Cc/JqMxATOmwOBtqrh y6qsBlMLO7d0mcN2WmdhHzUGmXAYWAvXKwAaEhtcYDoOi7DTEvDg0yN1xzVrkmjNyhb8 9sQssIz4hbjBbTxiOgTCZXuE4Q5lteIKuialV/Io/x+fyknxPgbR3dIuFz08yM+hkqSp 2+Uxx5B7sUqJhjIQtKNW51lO0qjNoR1SeN/cE8T+KZ5VQE/15mXCsPK1ve1kBK4t4W6Y oU5Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x7si5664653eje.542.2020.05.22.15.24.31; Fri, 22 May 2020 15:24:54 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731140AbgEVWU4 (ORCPT + 99 others); Fri, 22 May 2020 18:20:56 -0400 Received: from mga07.intel.com ([134.134.136.100]:10343 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731117AbgEVWU4 (ORCPT ); Fri, 22 May 2020 18:20:56 -0400 IronPort-SDR: JT1EjmXoZX7i3KQr4AMz3khO5nf8k48sKOuJCqsiVkZP6pjmO7D1PRaKi8+13Hv/xiKi6YE+96 WIxQ5XL3TClA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2020 15:20:55 -0700 IronPort-SDR: z63+64e3RqoyP/cB1ZU63XoHj3mn7H9ffeDUndTqcCXJkjxXi42qTdysLI/kBuObKpUHpHXYU/ d8F/I/Ytuo3g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,423,1583222400"; d="scan'208";a="300801599" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by fmsmga002.fm.intel.com with ESMTP; 22 May 2020 15:20:55 -0700 Date: Fri, 22 May 2020 15:20:55 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Peter Zijlstra , Thomas Gleixner , LKML , X86 ML Subject: Re: [RFC][PATCH 0/4] x86/entry: disallow #DB more Message-ID: <20200522222055.GE25128@linux.intel.com> References: <20200522204738.645043059@infradead.org> 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 Fri, May 22, 2020 at 03:13:57PM -0700, Andy Lutomirski wrote: > On Fri, May 22, 2020 at 1:49 PM Peter Zijlstra wrote: > > > > Hai, this kills #DB during NMI/#MC and with that allows removing all the nasty > > IST rewrite crud. > > > > This is great, except that the unconditional DR7 write is going to > seriously hurt perf performance. Fortunately, no one cares about > perf, right? :) Even just reading first won't help enough because DR7 > reads are likely to be VM exits. Can we have a percpu dr7 shadow > (with careful ordering) or even just a percpu count of dr7 users so we > can skip this if there are no breakpoints? Hmm, I believe hw_breakpoint_active() is what you're looking for, KVM uses it to avoid unnecessary restoration of host DR7 after VM-Exit. Amusingly, checking that in the NMI handler could give a false positive if an NMI occurs in guest as DR7 is cleared on exit and KVM invokes the NMI handler prior to restoring host DR7. I doubt that's common enough to care about though.