Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp393645pxb; Fri, 3 Sep 2021 04:45:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7NWsQ77TXBKI+y29SdHL2jmUlTVWvUO3X1F4Nqu0WBqTajw9RpFlUveGLuU9ZHxdlX4/d X-Received: by 2002:aa7:c60e:: with SMTP id h14mr3532326edq.43.1630669501673; Fri, 03 Sep 2021 04:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630669501; cv=none; d=google.com; s=arc-20160816; b=Up+yNL5/jXQcRr5mMoSOQOuMTyvzJ4gf+GohtXGn4zCCMquwhbfzeM0Z6dmxQ7n+X5 fRRWYTPn4iIrBTIpkTGv0+D4LGHb6p5gpGcZKhyyv4cw+n/WgvY5txTZZ1dA4+kdeIfa aaGusHY6I/YCK+LLlWKIqH8xgAMRrvEfarDSlljjqmPnGE4HY7/tK/ZUQKd1j/hhiWpG NXqggMDOMp28yguffJCt2dle41WBIB1zVQbA08i3I2hcXP29M8V/wNymre88ykTQOPbc lZYmKQXAdbKQunslBcy56ZDQCYIq4+G/hHePMKFngVbkFY1Hk86S4r2nRXfYpanBACQg Q2hw== 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=RxubfiXbH774+lNGmFrxRDAKoJxNFAxMcUOpI4XGr4c=; b=tfja0tA+/+sHsZY9hLNCEFbcrQE/x9AS8UTE4TF3IEkkM5P6QThH3UTkassu9MHjBD ueMxxOPLZk9ltZyg1OvHJTEOlpEzZKrHMUG03E18VEFM1dPk79O4SspeOlocaFJ9Z+TY A4RzamAaIz/6nlz/fk2YoOewYXPcJuEVXuXPItilva+1367IsItVBu0T1GgZol1vuF+1 Vb++NxQFl5AZ3su8wAoGKrh30kkD5Uo+NKju8KmvNgt1FLvn+Jtp7mxp/GGvVL/KmcYh jxWPYizB+1z7gT0tOMXPSiQj5idCD6bPL7Hz53HvO32YbfPONmk5SvxcBOiIlZCT6b8u NlNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=F0i6Xft5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dr5si4331993ejc.33.2021.09.03.04.44.32; Fri, 03 Sep 2021 04:45:01 -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=pass header.i=@alien8.de header.s=dkim header.b=F0i6Xft5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348993AbhICKSd (ORCPT + 99 others); Fri, 3 Sep 2021 06:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234262AbhICKSa (ORCPT ); Fri, 3 Sep 2021 06:18:30 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD20C061575 for ; Fri, 3 Sep 2021 03:17:31 -0700 (PDT) Received: from zn.tnic (p200300ec2f0d5800e0c92975d32b0bec.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:5800:e0c9:2975:d32b:bec]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 8E6A81EC05A0; Fri, 3 Sep 2021 12:17:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1630664245; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=RxubfiXbH774+lNGmFrxRDAKoJxNFAxMcUOpI4XGr4c=; b=F0i6Xft5KGZzhD8UikmT/I6yfhKqRSX3d8Xp3j21YbMxiW746xT3pJAsJN+bJbQh2lqRRR cg3gZiLWkrnWBv2sb9g3cUgNV2/Pg6uR8u6wz5T9vy+fqe166YAsmTwU5fJt/YJNFXzWEx DD2GY30gRWOxx68saCq9TaTxsFZjhTc= Date: Fri, 3 Sep 2021 12:17:54 +0200 From: Borislav Petkov To: "Kuppuswamy, Sathyanarayanan" Cc: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Andy Lutomirski , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 07/12] x86/traps: Add #VE support for TDX guest Message-ID: References: <20210804181329.2899708-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210804181329.2899708-8-sathyanarayanan.kuppuswamy@linux.intel.com> <99c5f6e9-a747-1a4a-d0f4-95b8b28e0d02@linux.intel.com> <42201ef7-6552-3fbc-23ef-013cb3e93649@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <42201ef7-6552-3fbc-23ef-013cb3e93649@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 02, 2021 at 08:24:53AM -0700, Kuppuswamy, Sathyanarayanan wrote: > If MSR read/write failed in tdx_handle_virtualization_exception(), it will > return non zero return value which in turn will trigger ve_raise_fault(). > > If we don't call fixup_exception() for such case, it will trigger oops > and eventually panic in TDX. For MSR read/write failures we don't want > to panic. > > #VE MSR read/write > -> exc_virtualization_exception() > -> tdx_handle_virtualization_exception() > ->tdx_write_msr_safe() > -> ve_raise_fault > -> fixup_exception() Lemme see if I understand this correctly: you're relying on the kernel exception handling fixup to end up in ex_handler_{rd,wr}msr_unsafe() which would warn but succeed so that you return from ve_raise_fault() before die()ing? If so, I could use a comment in ve_raise_fault() in case we touch the fixup exception machinery, like we're currently doing. > Reason for calling die_addr() is to trigger oops for failed #VE handling, which > is desirable for TDX. Also sending die notification may be useful for debuggers. > > This sequence of calls are similar to exc_general_protection(). Ok. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette