Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1424060lqh; Mon, 6 May 2024 07:23:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOBnuvnyNXnAkqG9o63p/IhnFwuu2Q8MaoWLahhn29JGpuVSeV3CYqONlRaOCV/ZAgecEgUURnF6+eO0/IpquL1qlWox2EsTswCHa6dg== X-Google-Smtp-Source: AGHT+IFeOuEHEDHpYK2U/w7jfa6p6cMsyi7/UPIH9JQ+ewjeq/BWiP9SqWcer2QnWWeFjA7lX2iO X-Received: by 2002:a05:6808:30a0:b0:3c8:2981:f6e4 with SMTP id bl32-20020a05680830a000b003c82981f6e4mr14861566oib.11.1715005424081; Mon, 06 May 2024 07:23:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715005424; cv=pass; d=google.com; s=arc-20160816; b=R6KtY3QcoU2jXXSwJCmyACMSAXLe7IEqB+sOW8jRMIugBcLtZCw6njffZbEmutVNwJ VzGSJVTUL+Fq5z3m487k9uj3zb+t7MP7hSd+B0ppOJVI6jsIOMS07OrpehzFuct4ljft 9zpdMVY2+zEwvE/1LzGkajzy+0ZuMIZ4CmS2tAQe//nmScQRbveeoP2670QGtCCTRzSP iwZMRte/C5W8Z0/AX0USDfhLhPt/l6Jg5LkwSZDwyrblivDZ2NojC5VXd+BYRJ22q2fG 51tOpUcHJeYvngGVsIWKb4QFXPIfv2F5tlf6htaghqYRYWbe7CNI9JkYhzU3tK5jjg39 L2AA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b+K6cieeRgzZWM9C6IkS52nAd027DkJxG87ZipG8Sho=; fh=nW7rCO0ZG8q/q9d1C+0M+D1X5FVPt3uStLcSzRNZv5Q=; b=CD5SL4/C9P+SOwq/Vps9+5oMq0LrZWYKOTL296o/TPTuNT75SUV9fH1+6kNqVQp3N7 bGpef803wEmM2DFrNe66U43oKBfVy5J7lUwzCiuMtkD7jAfm25bgrJbxMfcZ4tpHbK1K w57vOBIgnDxIbW/wHY4Glk9pP+wA4SqakPrGlu6srX/3RDLLfshx3wftCZqcuDxIIY/v 9aSD1ltHRYX0nh9x6Bca106fDsBJXqSvZ1txtj6Q13QSdvXDMCDcQw6uXVuxqGzWDq3A EPS+awxjTzJ2KdQbcf8qcUXsqrTpHjnfRzvzc70sYVbJ7zLnEjN6si57dXso5OJq1S9f x1eg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alien8.de header.s=alien8 header.b=F4Y+fW3Q; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-169977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id et21-20020a05622a4b1500b0043b0a91857dsi8717982qtb.721.2024.05.06.07.23.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 07:23:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169977-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=@alien8.de header.s=alien8 header.b=F4Y+fW3Q; arc=pass (i=1 spf=pass spfdomain=alien8.de dkim=pass dkdomain=alien8.de dmarc=pass fromdomain=alien8.de); spf=pass (google.com: domain of linux-kernel+bounces-169977-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169977-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de 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 B9A421C20E12 for ; Mon, 6 May 2024 14:23:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9CFA713DDAD; Mon, 6 May 2024 14:21:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b="F4Y+fW3Q" Received: from mail.alien8.de (mail.alien8.de [65.109.113.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46B8413CF8F for ; Mon, 6 May 2024 14:21:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.109.113.108 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715005310; cv=none; b=YxhhFLGYSp5IS36a09PdprHQJ8tokVZx9gidcs8rR0o4rKxyhbNgMZwItpHe4GHl8imZN/20lOQRkHRK8P1bN3F5JBCXzJTD07cfD9ypzdq/THYRL0SL8EHD6LX9yI7THoKH4tr0ZpM86YxHu6LJNcUUKkEPHzzZycufQj8KY7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715005310; c=relaxed/simple; bh=ZRr6fPqYoTH0sclRmuJEZqEKQMy0r1Bck1MinrSVNpg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=kIMOGa+I0FMZtO/OkkpnbtJ6cZQJfFe7Gv1O7DFXgt7n3E83cIi1QJ2ij1fnaLUR9gB/mGQ92cateyv63omV3a5EPEIZV8TR9NtsoBnTV5Wh1FuAoqlsX5RdRpl6tZqGISj/MCfmXQPUS7bbPgVfggQejvRGow2MSBc29iwSSxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de; spf=pass smtp.mailfrom=alien8.de; dkim=pass (4096-bit key) header.d=alien8.de header.i=@alien8.de header.b=F4Y+fW3Q; arc=none smtp.client-ip=65.109.113.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=alien8.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alien8.de Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTP id BEB5C40E024D; Mon, 6 May 2024 14:21:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at mail.alien8.de Authentication-Results: mail.alien8.de (amavisd-new); dkim=pass (4096-bit key) header.d=alien8.de Received: from mail.alien8.de ([127.0.0.1]) by localhost (mail.alien8.de [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UryTxnO-LRmz; Mon, 6 May 2024 14:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=alien8; t=1715005303; bh=b+K6cieeRgzZWM9C6IkS52nAd027DkJxG87ZipG8Sho=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F4Y+fW3QTaJ9FV2dDcBUpEOnzrKcNwfhgwOdIB3xCvhdM4huoa4p2KYMwSN2wNmwD PurLG1CyOa67XmIA7Pxjr2Sq43TnxBriydtwUVv225ZGWLr8aRIerdFKLvNAEki9Ev QXnergGYbpM8+T3qhaX9/x58MrcWwD71J6vQsKEnlV8KncUGgWfSc0z0LVq8pAhSPA jhRvlK1uhx3ePYkx9TN9Pnrto+jT1IMuDnXrJB5nW+PpFqOIWkIya0hHmvBcQghQxV Qpcy4sW0eigQF2LhqQTtyg+uUpaA4mgngA8rRUjITTzYMxjhNPyMZTnIW07xurGum0 EFPpsRZXQJUtWe0+C/HGe/nc6XB0yAZPrv1Vs0Sxr+v1BKJWnv/5mnfPlMEOl9DXQZ WNWXaDv0Ykm6m+6/KKSSXAT4xuzr7YY8i3V3fOOhqtSIvR8d2wWumKRJLjDrYNUk2H wsEOEPFJWyHmHsADUmFJY/mHG2hpgpMdKtvSSnaDSQw/dzm+hSfRo6uzIZiqwrD1Y/ 1hYGDOpptHLNwXDiEYJSWcNV980028nBBUkVgrWNlt8tJcqln08J8EaS98VWRSAywf lyf/szhCvZVMfnyBCbRiPEu/QgL4G3rSTsUsaKzxv/5Ezg78hEYQ1docvNMEYS9P6J FpbHijWXXqLmCFJnbwN3lyRY= Received: from zn.tnic (pd953020b.dip0.t-ipconnect.de [217.83.2.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.alien8.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 5342240E0187; Mon, 6 May 2024 14:21:21 +0000 (UTC) Date: Mon, 6 May 2024 16:21:20 +0200 From: Borislav Petkov To: "Kirill A. Shutemov" Cc: adrian.hunter@intel.com, ashish.kalra@amd.com, bhe@redhat.com, dave.hansen@linux.intel.com, elena.reshetova@intel.com, jun.nakajima@intel.com, kai.huang@intel.com, kexec@lists.infradead.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, ltao@redhat.com, mingo@redhat.com, nik.borisov@suse.com, peterz@infradead.org, rafael@kernel.org, rick.p.edgecombe@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, seanjc@google.com, tglx@linutronix.de, thomas.lendacky@amd.com, x86@kernel.org Subject: Re: [PATCHv10.1 09/18] x86/mm: Adding callbacks to prepare encrypted memory for kexec Message-ID: <20240506142120.GKZjjnYGMcZkuTLlzG@fat_crate.local> References: <20240427164747.GCZi0sM6HBCBYtgWqF@fat_crate.local> <20240427170634.2397725-1-kirill.shutemov@linux.intel.com> <20240502134506.GDZjOY4guvlKH9-73J@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Mon, May 06, 2024 at 04:22:02PM +0300, Kirill A. Shutemov wrote: > I do. See comment just above enc_kexec_stop_conversion() call. If you mean this: /* * Call enc_kexec_stop_conversion() while all CPUs are still active and * interrupts are enabled. This will allow all in-flight memory * conversions to finish cleanly. */ if (kexec_in_progress) x86_platform.guest.enc_kexec_stop_conversion(false); then no, this is not enough. I mean this: /** * struct x86_guest - Functions used by misc guest incarnations like SEV, TDX, etc. * * @enc_status_change_prepare Notify HV before the encryption status of a range is changed * @enc_status_change_finish Notify HV after the encryption status of a range is changed * @enc_tlb_flush_required Returns true if a TLB flush is needed before changing page encryption status * @enc_cache_flush_required Returns true if a cache flush is needed before changing page encryption status * @enc_kexec_begin Begin the two-step process of stopping * page conversion... * @enc_kexec_finish ... */ struct x86_guest { int (*enc_status_change_prepare)(unsigned long vaddr, int npages, bool enc); int (*enc_status_change_finish)(unsigned long vaddr, int npages, bool enc); bool (*enc_tlb_flush_required)(bool enc); bool (*enc_cache_flush_required)(void); void (*enc_kexec_begin)(bool crash); void (*enc_kexec_finish)(void); And calling them a _begin and _finish makes a lot more sense to me: _begin starts the kexec process for encrypted guests and _finish finishes it. Just from the names you now know what needs to happen and in which order. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette