Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp123846lqe; Tue, 9 Apr 2024 17:23:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXS1yDbfUII8DJ64q81zsQPuQOLak0z34PsN8cNawrzAFjnuXb4mZFIIUrAKBkVnMjfdeBGIXddrtmlJ2Titx0RGWQqaJKPBsJ2xN1YlA== X-Google-Smtp-Source: AGHT+IGdNlEMIM7S2grtsu1oFnWhrEaiBQBTeMOz7xMdXMZsqS7+KMOF7B9IVRm6RonnDq/jhw9f X-Received: by 2002:ac8:7f12:0:b0:434:72bd:511e with SMTP id f18-20020ac87f12000000b0043472bd511emr7276921qtk.11.1712708614223; Tue, 09 Apr 2024 17:23:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712708614; cv=pass; d=google.com; s=arc-20160816; b=G0BuVqjzjQ0j7QVs36l6ldjMBC9r+0dQoWUr5SMxmRmcPQInuDsuaCumZGC5MbfLVl +mEOHrASFKTeIAe+XiaNsxPzSxRSjDyIvYIZ8ZBWjEgCGWKX+mZFt+OMSbhxQ7ErArkV PF9SJdE4hpo0COz0OFfR0Jtm3AnVfa/6jD2ypB2gRkDeLrBSjfM9Bf0w+N0YcUOHw54v DTvx59hdZpE3jptPA8qr0AAvCtb3MCei8QJTtXRj4sHAUyhPbFcpnnmuUysLqRR8zUD8 mbaDTqQmE13wFJjyshJRD7ig7lxPHV4uEttqNFiOZZqJiUEc9yBfl5GVkgiV2WaymyN9 m02g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=htUF4GcjxNHIR81oJrQq7Z2RdLusi7qpjkhr5S8yjTs=; fh=zFyVwI1Eor50dz//7NY3bzsQZ0V3Z0vFw/acZXnK0L4=; b=JE4FYjBM/daXg5UgO5Y03M7npOPyjAN5XcnQwOLE97PO7Nm1eq3hRSfZr5n+LlxSaD sxkMABgHPAfaAQ7S9udY2JLDnPsdW9JUg4tMBfOzGLNvaPRrJuQcE9OX9gRA2ki/uWGO vJdjx9FY34/JmEJ0o0jvuS/Df2RSWcy4pr14Rv9dkqVTbxegC4wykjqtzCNzIP6aGhS8 mE4i7dKhs9D3ouwQaS3sxeuWh9JPAqbWWxogQ2bsBaDeiVrazQiX2s1sCqsiaVWcfj9W qSe7ntdfzvMkAYFD1XeIH0PfEgiMs1bcVRthFxr3/GtuRLQLaJTvWZI0ZmiyUaOIA/gJ BqDg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GnGoxJFm; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-137758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h9-20020ac87d49000000b00434b359d5e7si4487342qtb.671.2024.04.09.17.23.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 17:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GnGoxJFm; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-137758-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137758-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EE3691C20FF8 for ; Wed, 10 Apr 2024 00:23:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 789B73C39; Wed, 10 Apr 2024 00:23:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GnGoxJFm" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 219564A12 for ; Wed, 10 Apr 2024 00:23:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712708589; cv=none; b=E3OrNrHYHa4MSdpKkvLhEYrBYAxzPfg9aPFPUEd+95NwLRxOi3QSvmvsEKNC7sGuZOMThljncG4RXDmnbfIJwigBZ7h1cRVLIubYLl3tseQ1th8W+hA6iWyl7hVIhHoZb8dxmYTCQJeWSvJ7ylpD1mFTSiwwI8ewdBsqs71rYRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712708589; c=relaxed/simple; bh=pHlM0XVx9NTNUAXMuclPrj40otYkCLtMYRlJXvi7cpo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tCPV6VMLAaSR6BPTUTGbgKYHvVIn7XBp0El+eWAhC+6UhqD3Tl6rUpaUnSml0HGcSYY3Pt6jSDPEKKyGadwcA+gxL8PGPzA9ENHYqdaPgjWOqKhiFRp2/oC9B6XrSdYSPW2Enu99geu3rX/PTQsVLVPdvm8BtPJeHWSDjfh7D78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GnGoxJFm; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dd8e82dd47eso8682624276.2 for ; Tue, 09 Apr 2024 17:23:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712708587; x=1713313387; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=htUF4GcjxNHIR81oJrQq7Z2RdLusi7qpjkhr5S8yjTs=; b=GnGoxJFm51a7/q2qOZCl7rA7tDgBCZeUt9IgIfwAaOJLvNz95q5/0kf7D88sUbhKI2 W8RGMLh1Q6r9dv/VUUnzetN81qX0ytodDZBgUVy2iXHSAguOgcghzCGPzSmI/yCs2Xae PsdL58EebcaBWuSCMNXP/w02FlNNennVaQXSWLvbzLRMe0zSVQmjOcQfC8VUeZvEZvvU O2kLGpDMybR5LM6mL/KgRAsRZTNXDsPAMPPvLY3vo69riN+gTbJwYEApmyaHjkq0LQaB snJrzn4rLlq1Q/+MIZrtn335+aFkUzlLq6jtWJ1jih9IpxS5mf5za9FSlw0PdWWnCfPo aVBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712708587; x=1713313387; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=htUF4GcjxNHIR81oJrQq7Z2RdLusi7qpjkhr5S8yjTs=; b=rlLZcWROIftobc/PYCESMp9CwtOQmbNPF2H0z1NuYjNIOgf1QbI93ILpG3WnBVCfek yyYoY8V266LkprURaIn4RGYE7+IVAhE/XFoMF8219P7niq7VvPM7Y7nIVu7O6rFwNJHx 29/+HLoUOuCothvpr+6YfziY1ryLOPWwuZnZrvQnp41GLYDaAaTYsb6KxSuQAIcndK9E 6LlwH951L47rCN7N0DoTBlF03aJbVUJufxICgE5hPg4uah1PpkMBZP6goreE3gCtpn2W SoTeWdTFcOy92kS/ZlFtbRLvtY+dZQdAUO8bxNGgTwML/Mg34pVeOyIyskC2OiQSt6U5 FXLw== X-Forwarded-Encrypted: i=1; AJvYcCVGXbWgnYPiOdIcH6GBS2uOS4JnJyS0AE/s2etGQXrS9gMLPIu/3bO9SoniT5mYG/SiuO+WIokeHiEc76V6TUIWj90mUa95NsBk0ZI+ X-Gm-Message-State: AOJu0YyrtF054TkYMFca8O+eJ4Lpqmc6LTQnCZIRdKNxQdWKTtgZbJNN MJX7PD9Wt4DTvd2qW9+kkKepkMuaJ/oYTzhDq/1/+xq+heJqebNMbzg27aO+S+bnIghJJldpcr/ I+w== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:1505:b0:dbe:387d:a8ef with SMTP id q5-20020a056902150500b00dbe387da8efmr132273ybu.1.1712708587172; Tue, 09 Apr 2024 17:23:07 -0700 (PDT) Date: Tue, 9 Apr 2024 17:19:59 -0700 In-Reply-To: <20240223204233.3337324-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240223204233.3337324-1-seanjc@google.com> X-Mailer: git-send-email 2.44.0.478.gd926399ef9-goog Message-ID: <171270505394.1590014.8020716629474398619.b4-ty@google.com> Subject: Re: [PATCH 0/8] KVM: SVM: Clean up VMRUN=>#VMEXIT assembly From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Tom Lendacky , Michael Roth , Alexey Kardashevskiy Content-Type: text/plain; charset="utf-8" On Fri, 23 Feb 2024 12:42:25 -0800, Sean Christopherson wrote: > Clean up SVM's enter/exit assembly code so that it can be compiled > without OBJECT_FILES_NON_STANDARD. The "standard" __svm_vcpu_run() can't > be made 100% bulletproof, as RBP isn't restored on #VMEXIT, but that's > also the case for __vmx_vcpu_run(), and getting "close enough" is better > than not even trying. > > As for SEV-ES, after yet another refresher on swap types, I realized KVM > can simply let the hardware restore registers after #VMEXIT, all that's > missing is storing the current values to the host save area (I learned the > hard way that they are swap Type B, *sigh*). Unless I'm missing something, > this provides 100% accuracy when using stack frames for unwinding, and > requires less assembly (though probably not fewer code bytes; I didn't check). > > [...] Applied to kvm-x86 svm, thanks! [1/8] KVM: SVM: Create a stack frame in __svm_vcpu_run() for unwinding https://github.com/kvm-x86/linux/commit/19597a71a0c8 [2/8] KVM: SVM: Wrap __svm_sev_es_vcpu_run() with #ifdef CONFIG_KVM_AMD_SEV https://github.com/kvm-x86/linux/commit/7774c8f32e99 [3/8] KVM: SVM: Drop 32-bit "support" from __svm_sev_es_vcpu_run() https://github.com/kvm-x86/linux/commit/331282fdb15e [4/8] KVM: SVM: Clobber RAX instead of RBX when discarding spec_ctrl_intercepted https://github.com/kvm-x86/linux/commit/87e8e360a05f [5/8] KVM: SVM: Save/restore non-volatile GPRs in SEV-ES VMRUN via host save area https://github.com/kvm-x86/linux/commit/c92be2fd8edf [6/8] KVM: SVM: Save/restore args across SEV-ES VMRUN via host save area https://github.com/kvm-x86/linux/commit/adac42bf42c1 [7/8] KVM: SVM: Create a stack frame in __svm_sev_es_vcpu_run() https://github.com/kvm-x86/linux/commit/4367a75887ec [8/8] KVM: x86: Stop compiling vmenter.S with OBJECT_FILES_NON_STANDARD https://github.com/kvm-x86/linux/commit/27ca867042af -- https://github.com/kvm-x86/linux/tree/next