Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp370750ybh; Wed, 15 Jul 2020 04:19:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYRkr09ErBF9yrLg4TAyPKjodHZQ8QxMBXCTKTCL4IINMaSq6WiG2jNcFSd94E2/xoB8L3 X-Received: by 2002:a17:906:3c42:: with SMTP id i2mr9384077ejg.14.1594811967329; Wed, 15 Jul 2020 04:19:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594811967; cv=none; d=google.com; s=arc-20160816; b=msUk2yMMkskkWdIOYcxI6QBmkicU3YqUXa6wFFcV7dbEL2IutZ3Ny0h9iKQQbTS5WI /LVBDRiAnQ3FKAYJHSLWIzBcOln6MOt2Dq2FtOlRBuYkhYDnmR7yEktxnemCaV2NDbTm yXxC5dIDTCYMkpxngyS2YGhtuYulzRDjap6I9OJpdC5J4O4jdBD0ICNaUb0ktU3ZaOUc 59Q0s+HupsR0mOlRYcf0/385tK3phVEj/x/HWE2Id4hHpUPCLUPdhw/QrxmvTuePpeqV HHD7ksqPNbZIG0outwpJC72EmyDxDWRfu4mh0j6HLO1wXBvUQMwY9w9pgpuEn1fUUBfw oQJA== 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=NxRs2Pm10c75mSdn1nbWIbzhX1JLNphOAFM5Lj4SR3I=; b=a2YYy9NvqnePlAtVOUhzUL1Lw9Cudr0taYlUpQii6R5oM81vpULOKldJkulTJouevm pLqyACEihLYuZvbExBlw3aonjWTS2IGNV/qjht4g6WRaQFk7aMgJjHO7PA8yrghv4HE1 BbnGQHyDKdYpyOmB4GkJicHz64gDKnjoGtRk1K/WOyPPr7b94IsqkRoLbrWADw1thr1H wgjc74kApofTdCZT6laTrltU+cHxMuB0rjDK0+N34G51X092C6jyhUskxkHyHjGzpVv9 ld+V9webZqYz4OzQwMVyj6MHP01m39Fe4ot+e1zyc/a17rENY7cCQOVht5A3c+LdsvHQ tGdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=GROMyPHH; 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 c2si1126081edf.278.2020.07.15.04.19.04; Wed, 15 Jul 2020 04:19:27 -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=GROMyPHH; 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 S1731042AbgGOKN0 (ORCPT + 99 others); Wed, 15 Jul 2020 06:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725811AbgGOKN0 (ORCPT ); Wed, 15 Jul 2020 06:13:26 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D9C4C061755; Wed, 15 Jul 2020 03:13:26 -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=NxRs2Pm10c75mSdn1nbWIbzhX1JLNphOAFM5Lj4SR3I=; b=GROMyPHHWeTIOf3KDPDXNwa4WK R6jB4NQoMOAmc/Ypqc5rNl5Pduyjwh6S6W5xtWeB1GvVcDG7gBVHNrsHI07Fy10HjeGU1EqyxF+zI Z7L8hPzKZoU1b0QWe8WkKpAy6ZfvYtqAf3DyUQwQPZqm0uv9A1SGMWyXDeF+QNrUhxAIsFPw2Nh+o twcqqDM+ZmirX0VPrZzGJTUIikrkFR5aXJhLf+TIO5WLrmwYLK9BYjp6ehD9m9nQYLbJ7fVTwaBPo LRP06aNFPZzCjjGDsXB3PxXSBpJlBf7zUkc1XFb/bPNX44372SwUAz23oKL7tU2iPuwqYL2T/e7xC 6T8FRkrA==; 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 1jvePY-0005R7-KE; Wed, 15 Jul 2020 10:13:12 +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 E910B300130; Wed, 15 Jul 2020 12:13:10 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D474020D27C63; Wed, 15 Jul 2020 12:13:10 +0200 (CEST) Date: Wed, 15 Jul 2020 12:13:10 +0200 From: Peter Zijlstra To: Joerg Roedel Cc: Joerg Roedel , x86@kernel.org, hpa@zytor.com, Andy Lutomirski , Dave Hansen , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , David Rientjes , Cfir Cohen , Erdem Aktas , Masami Hiramatsu , Mike Stunes , Sean Christopherson , Martin Radev , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v4 63/75] x86/sev-es: Handle #DB Events Message-ID: <20200715101310.GJ10769@hirez.programming.kicks-ass.net> References: <20200714120917.11253-1-joro@8bytes.org> <20200714120917.11253-64-joro@8bytes.org> <20200715084752.GD10769@hirez.programming.kicks-ass.net> <20200715091337.GI16200@suse.de> <20200715095136.GG10769@hirez.programming.kicks-ass.net> <20200715100808.GL16200@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200715100808.GL16200@suse.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 12:08:08PM +0200, Joerg Roedel wrote: > On Wed, Jul 15, 2020 at 11:51:36AM +0200, Peter Zijlstra wrote: > > On Wed, Jul 15, 2020 at 11:13:37AM +0200, Joerg Roedel wrote: > > > Then my understanding of intrumentation_begin/end() is wrong, I thought > > > that the kernel will forbid setting breakpoints before > > > instrumentation_begin(), which is necessary here because a break-point > > > in the #VC handler might cause recursive #VC-exceptions when #DB is > > > intercepted. > > > Maybe you can elaborate on why this makes no sense? > > > > Kernel avoids breakpoints in any noinstr text, irrespective of > > instrumentation_begin(). > > > > instrumentation_begin() merely allows one to call !noinstr functions. > > Right, but the handler calls into various other functions. I actually > started to annotate them all with noinstr, but that was a can of worms > when calling into generic kernel functions. And the only problem with > intrumentation in the #VC handler is the #VC-for-#DB exit-code, so I > decided to only handle this one with instrumentation forbidden and allow > it for the rest of the handler. OK, then maybe change the comment to something like: /* * Handle #DB before calling any !noinstr code to avoid * recursive #DB. */ ?