Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp893156rwp; Thu, 13 Jul 2023 02:53:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlFKmJ6eydY0cT5DeYFMpoyHhjjkGtHBZCwSzEP/kTYLzfHz+w3LaXEjV72FRSpG41WgSN9G X-Received: by 2002:a05:6358:339a:b0:132:962d:b5c5 with SMTP id i26-20020a056358339a00b00132962db5c5mr1563902rwd.30.1689241991637; Thu, 13 Jul 2023 02:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689241991; cv=none; d=google.com; s=arc-20160816; b=f/ZcCLj78Q/Je6SG4eskTxum+wTF1F4t4EP2DOADaVnNgBp01g/ZmyULG1ks3ctC8N ZpK4Y6IR7Nb/4PPXFV6YNCVoD5mSPPhNn/AeX0jgv3VeoL6voXjdX1K09OMdt1//gs7y 1R8g/D96ScxuTv3wGJ8v7y8lYIohFNgXnxAr4JrCRis9MXuoZcr0N/rNdOnwZjr9uwNh 8Vj3qTaQnqePZZvfn2tLFRs5Mf0NRUA6MfCLeoo0EHvAhf1RTZMHEOuTuZVrAkflQ3PI msd7n750slgTS6Ed3gTiCyHzSmgQ5OUeE6SP5TNBcwkVHoYR/b8pEqfYM4ha9eeX4/CX RRlw== 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=kxEHiB4D3m9yY/2dDO7P2A7iGOSaPkpw/P8MmEhifuo=; fh=N+OK3Z4UlsoYtYFjfiw+LF5DCixo9u8YyFGQpJCZL3w=; b=y7iqObb8i9d6COdMm9Mzv6zFuy2WU1BoxkJeNGxbulxq2pIyPJ3ffq/8FDs+bxuuFv 0Rgv4FbQ419P3DhAZsrE6xqkwGAA2eYI97lvBq3N6RVwALke1YYFlcDJmI1nNzdPp/py MY92tZf9vwn05hqQ7y144wX9JKJPESq9zH+vYRhYGFCk4lKn8gqdrBBGrvPPoSSYe927 cQD2sv6tJ9wTpcWFKzZoOwY0TgsBXv764kE7lC4pdRwmzaVJZTg8UpjGPoK1RpbIBAsQ KULcS7l08W6fDOxi9x692O7MGGzxdt6RfMWAaRwPs4pUPvSvS46hF1qcAesBC3WHLPFu aGPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=lSisNuvY; 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 a62-20020a639041000000b0055c92ea1f29si382457pge.145.2023.07.13.02.53.00; Thu, 13 Jul 2023 02:53:11 -0700 (PDT) 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=lSisNuvY; 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 S234044AbjGMJk0 (ORCPT + 99 others); Thu, 13 Jul 2023 05:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231774AbjGMJkZ (ORCPT ); Thu, 13 Jul 2023 05:40:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E461FD7; Thu, 13 Jul 2023 02:40:24 -0700 (PDT) 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=kxEHiB4D3m9yY/2dDO7P2A7iGOSaPkpw/P8MmEhifuo=; b=lSisNuvY2Y6og/MU4fqubO5ZCZ o0KzISwWjmdnggSiCAUnk+jPi1PksKszWU9pCusCXpYuJyPWkreDmse7Kv2eiepI+jwnn6fyZM+wy xda8dv5rDApk0IOSAqGNjfJuVpxS6/dBkWUyeowaXAnXUiryry72KHG/g4a6i7Iaa7RyYi9OAcwrm Uk58a4HRX/Y+NjdP1dhDA+8Tsjs8WBXSegjYvvuBEWH/L14xE+Qmzw/Xg/WGTEnQiS+qi9PuykmSb v/Wwjg8LVKlAfcc8ECJA9VP5CMYQRJMZjEeUmDv/AOwrK7VPSAeAZyylvZClUFicci9hlNYCTFThN 3611ICNQ==; 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 1qJsnx-000140-6y; Thu, 13 Jul 2023 09:40:09 +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) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 25A5430007E; Thu, 13 Jul 2023 11:40:08 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0CA03245CA117; Thu, 13 Jul 2023 11:40:08 +0200 (CEST) Date: Thu, 13 Jul 2023 11:40:07 +0200 From: Peter Zijlstra To: "Huang, Kai" Cc: "Hansen, Dave" , "Christopherson,, Sean" , "bp@alien8.de" , "x86@kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "kirill.shutemov@linux.intel.com" , "tglx@linutronix.de" , "linux-kernel@vger.kernel.org" , "pbonzini@redhat.com" , "Yamahata, Isaku" , "kvm@vger.kernel.org" , "sathyanarayanan.kuppuswamy@linux.intel.com" Subject: Re: [PATCH 07/10] x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs Message-ID: <20230713094007.GG3138667@hirez.programming.kicks-ass.net> References: <20230712165336.GA3115257@hirez.programming.kicks-ass.net> <6489a835da0d21c7637d071b7ef40ae1cda87237.camel@intel.com> <20230713084640.GB3138667@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Thu, Jul 13, 2023 at 09:34:24AM +0000, Huang, Kai wrote: > On Thu, 2023-07-13 at 10:46 +0200, Peter Zijlstra wrote: > > On Thu, Jul 13, 2023 at 07:48:20AM +0000, Huang, Kai wrote: > > > > > I found below comment in KVM code: > > > > > > > + * See arch/x86/kvm/vmx/vmenter.S: > > > > + * > > > > + * In theory, a L1 cache miss when restoring register from stack > > > > + * could lead to speculative execution with guest's values. > > > > > > And KVM explicitly does XOR for the registers that gets "pop"ed almost > > > instantly, so I followed. > > > > > > But to be honest I don't quite understand this. :-) > > > > Urgh, I suppose that actually makes sense. Since pop is a load it might > > continue speculation with the previous value. Whereas the xor-clear > > idiom is impossible to speculate through. > > > > Oh well... > > Then should I keep those registers that are "pop"ed immediately afterwards? Yeah, I suppose so.