Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5265319rwb; Mon, 14 Nov 2022 01:45:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf5S/dhxVH9fuDhztuI50d2QmrUrbQ8cbn/caHgw9jgqDunyOTxmSMr1BiJvU/euiJtsW6// X-Received: by 2002:a17:906:a106:b0:78d:b371:16d4 with SMTP id t6-20020a170906a10600b0078db37116d4mr9274680ejy.434.1668419142244; Mon, 14 Nov 2022 01:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668419142; cv=none; d=google.com; s=arc-20160816; b=r+HVfreiJBle9Lzl2NJVgJv8aDlLn4P+N2yhTmcRNCvlxMEeq2MNisp8tmJ3GnuI7U 5qMiMAXQGE+jFIAcZgHKPO0wvS6caicV2sCjNDjFoBQwx4kK5sNSwDE1KUpHVr1tAjTN 7uCJRiB4y4LMDa9OaeMBfglMcadtx9AdRBRi3Zvr6txpCdgYyMIJj3cfVOhqGIncsaoU biLtyyQdjFeU46zInEXBSZy4RvZkRDd9WbsmKim4V4zhnId6pxPryNWa2Q8A7gdRAUy2 sjZbagukBD2b+TwQheKQM7rM2nQ9lemRguK6W4kUnDdnS2uM1EcvchwNDHpS6t4b/s3t unCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CmCkVP6XVasiawMWAc2MfoRTytUQFHnWEyNdl8YOQ2s=; b=fvHGz0T+tOwesPNgXG1zdKxJCqPpu15DWR+MrbNDZusK/RInF61kUuOgiQMVCfjMuI PGWZmnY8dMNQ/NyprOGvoulI/KpLr+YbM4AZqjuVzk3vWysLiZem9TUH6OYVtOB7FXp3 Mj4DzidOiYBeGLkJqNgOtNuI1QvHLq6iCy5DBpJXK4adcKOn2gLO9QOdb8oRXV7oUX9i oedk+aUZzaeBxpNPsOu3Vgl7PKfAN1O63H8wySsXEFGH8Na+nnyvzK6fJ69NFz/Gpeoy SUsWM+n9dCXG32vLnebrzSUI1Q7lAEG7nRfUgNLsp0DPxLNC3zLwoLmxr/NQuMC7Prpd q4Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sJPpFzwZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc29-20020a1709078a1d00b007a7d37e467csi8314093ejc.763.2022.11.14.01.45.20; Mon, 14 Nov 2022 01:45:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sJPpFzwZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236444AbiKNJJh (ORCPT + 88 others); Mon, 14 Nov 2022 04:09:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235826AbiKNJJQ (ORCPT ); Mon, 14 Nov 2022 04:09:16 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D865330A; Mon, 14 Nov 2022 01:09:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=CmCkVP6XVasiawMWAc2MfoRTytUQFHnWEyNdl8YOQ2s=; b=sJPpFzwZM45thglm1Lcdyxo+hB /kqvQJXKkVETWLF3wT7rXwfO8CE/lwpxaayg0f9hTslmteCjyVriq71W1GMQrgyWKxT9p1tjrfzlX h8aN9mrCczTIN1mqdShxKbMeaJ3uPsgFeQliRvSUvmPeZwh4j32mfhRHIl98JloUN4FcvsTs6nL7Q yy6zxw1NnYlE93wllagjvtdqocPe+2BrzVqXwF/O+yr/xCpZHq8Y2fgQPqcPbrEXvrF1fRvsaJNr0 8alPAyIVFlxo9FTNHezy+JCEeN5Ln2onNVxA6C/vukjgqFqk5CLClrecLboV9ogydeVMV0oyYTywu 0ExVDnwg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouVSd-00FNEY-ER; Mon, 14 Nov 2022 09:08:59 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B08F2300282; Mon, 14 Nov 2022 10:08:51 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7BF392C8037C6; Mon, 14 Nov 2022 10:08:51 +0100 (CET) Date: Mon, 14 Nov 2022 10:08:51 +0100 From: Peter Zijlstra To: "Li, Xin3" Cc: Paolo Bonzini , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "kvm@vger.kernel.org" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "Christopherson,, Sean" , "Tian, Kevin" Subject: Re: [RESEND PATCH 5/6] KVM: x86/VMX: add kvm_vmx_reinject_nmi_irq() for NMI/IRQ reinjection Message-ID: References: <6097036e-063f-5175-72b2-8935b12af853@redhat.com> <6fd26a70-3774-6ae7-73ea-4653aee106f0@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 14, 2022 at 04:39:40AM +0000, Li, Xin3 wrote: > > But what about NMIs, afaict this is all horribly broken for NMIs. > > > > So the whole VMX thing latches the NMI (which stops NMI recursion), right? > > > > But then you drop out of noinstr code, which means any random exception can > > happen (kprobes #BP, hw_breakpoint #DB, or even #PF due to random > > nonsense like *SAN). This exception will do IRET and clear the NMI latch, all > > before you get to run any of the NMI code. > > What you said here implies that we have this problem in the existing code. > Because a fake iret stack is created to call the NMI handler in the IDT NMI > descriptor, which lastly executes the IRET instruction. I can't follow; of course the IDT handler terminates with IRET, it has to no? And yes, the current code appears to suffer the same defect.