From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F9B7C001DF for ; Thu, 13 Jul 2023 08:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233398AbjGMIrS (ORCPT ); Thu, 13 Jul 2023 04:47:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234272AbjGMIqy (ORCPT ); Thu, 13 Jul 2023 04:46:54 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B254DE4D; Thu, 13 Jul 2023 01:46:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=0iE4oWpU34GZzmhlu1waBjlWtnlO5JVQSNcDSOmRsIg=; b=ecaen0Dzkg0jUwk8kFciiVMftL lt/rrfffKIkKOckxgnWejkdB5+MDIpm7M6xbud7JVed+lhnoVdf036fS2GSlvpxGiBHfg8XW4wEdg zz2rff7hK/aXHkwb5VK2KndXVJANoZ5ve/aqiQFEHmzbLlUaAu7CsXfmQcEI+ZF2Yv0oDJAIMHFuK Gz0vTSwAz5KGYFoDkdYEE4rh0x9UrYkKFFG41YCqdT16QjkUcKftvOmMSipXhjmdB6o6dTQNbW22D 4USso2k62rfkr5eiCb3tfd6bO0g35LCyTedKO/BE18othXXu8UWkqlFkrq1+gNlS0XF9rfr2pAEkM QFAKhE1w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qJryD-004Zb3-1G; Thu, 13 Jul 2023 08:46:41 +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 09ECD30007E; Thu, 13 Jul 2023 10:46:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E7689245CA116; Thu, 13 Jul 2023 10:46:40 +0200 (CEST) Date: Thu, 13 Jul 2023 10:46:40 +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: <20230713084640.GB3138667@hirez.programming.kicks-ass.net> References: <20230712165336.GA3115257@hirez.programming.kicks-ass.net> <6489a835da0d21c7637d071b7ef40ae1cda87237.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6489a835da0d21c7637d071b7ef40ae1cda87237.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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...