Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp309871ybh; Wed, 15 Jul 2020 02:33:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1IWzBz7P86JTxbQNWc3t6PVfXC2xH8KCHEss2ttmCYOPrr/Hn0VCSY4cyHDQEuoSqWCW0 X-Received: by 2002:aa7:d802:: with SMTP id v2mr8545596edq.77.1594805584574; Wed, 15 Jul 2020 02:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594805584; cv=none; d=google.com; s=arc-20160816; b=pl2wYp4A1XQ5sUdHRweN/Hy55nGOXGTuXkK2iLvrfGfVmozOm8baHtiz+b7RBlxNVh wiYBPxJeJqWWUrMHnrK8gZCRK/DAMSETCl8NV5URHfCjwxyuR39THlMtT852Zo8Aeyah URp/fdfxX3JBc+MHkYn4cpGaLUVUXcpNsyX+VA4PdcDzoparGecyyRCi2OxTBwv8f87v QDgVLwx78nJS94oSGHEghbgMQyDnTNjbbg0KdbQNbY7dBlyPgssbDt34cfTMZLX8ZXrO vValN9eDaIjke6epkk6pIkPK9M8K4RnKADqCnOgUTv3n2tHLtKH2EyYfk7Z3WimAJ8gv 2Hag== 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=3CaAQhc45DkVQekAz3Z+Zzcjr7SNnQQRUOMvPHYLGs4=; b=CPyTumJoTOuOM58F61aFyG18XaJgarIDF42m8FyfWksRSz6YLoNzadJ7Qo+D0ew9lh p1xu4uvK0vJQRMeYrUY64hMyvqlnOgOxmj9JxuF4eHlgC34e/lbiY++ZNY8+Demh0iqX HSSezRgz1H5gFmw8yJdGFDYPy28AfOFUn5Uokfb2IsW0Y+NPCosoiI6v5R3GSQBncTXt rx78vYNKy9+hoJFMVbVlH9qRmodMTDvOyAszq4r5LylbW4qzUT5CkZ53+qq7Ma3PkITU 284NGld0KM4RXky5VHiVKmS/NVMG8ptmmbg7U13uZmFFyxKYOpGpMrNOjsLz/+EIp8y6 IZpA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by7si877734edb.303.2020.07.15.02.32.41; Wed, 15 Jul 2020 02:33:04 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730333AbgGOJNm (ORCPT + 99 others); Wed, 15 Jul 2020 05:13:42 -0400 Received: from [195.135.220.15] ([195.135.220.15]:55238 "EHLO mx2.suse.de" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1728672AbgGOJNl (ORCPT ); Wed, 15 Jul 2020 05:13:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1D30FAF69; Wed, 15 Jul 2020 09:13:43 +0000 (UTC) Date: Wed, 15 Jul 2020 11:13:37 +0200 From: Joerg Roedel To: Peter Zijlstra 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: <20200715091337.GI16200@suse.de> References: <20200714120917.11253-1-joro@8bytes.org> <20200714120917.11253-64-joro@8bytes.org> <20200715084752.GD10769@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200715084752.GD10769@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) 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 10:47:52AM +0200, Peter Zijlstra wrote: > On Tue, Jul 14, 2020 at 02:09:05PM +0200, Joerg Roedel wrote: > > > @@ -1028,6 +1036,16 @@ DEFINE_IDTENTRY_VC_SAFE_STACK(exc_vmm_communication) > > struct ghcb *ghcb; > > > > lockdep_assert_irqs_disabled(); > > + > > + /* > > + * #DB is special and needs to be handled outside of the intrumentation_begin()/end(). > > + * Otherwise the #VC handler could be raised recursivly. > > + */ > > + if (error_code == SVM_EXIT_EXCP_BASE + X86_TRAP_DB) { > > + vc_handle_trap_db(regs); > > + return; > > + } > > + > > instrumentation_begin(); > > Wait what?! That makes no sense what so ever. 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? Regards, Joerg