Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9605153ybi; Wed, 10 Jul 2019 13:21:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkl9uhPlgjiqYOruP1bzmPxkR9dAzncMD+uGyc5e0JnW5dLnBg0adMfUdY0GxgEDopHIf3 X-Received: by 2002:a17:902:76c6:: with SMTP id j6mr136146plt.102.1562790065062; Wed, 10 Jul 2019 13:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562790065; cv=none; d=google.com; s=arc-20160816; b=ys4Tvhia7bXSBsNPnBBjT7hhnKlogk1UDzAWBeZFauv7DFE5gngDiLp6PdZ9M2kQ3q Jrw34Lp7NfURM5S9xmyxMzLejzVA87SlapQUMolj3mkY1PGDXvO1QsiOsgeS/P0/IYVn 5h1m/8Me5YPfkt4yfYKIUhXe9r2iYVJjxsiREFPQwE0s+w8J12Q48cvpvsfHdaHVw8Tk DgR5u++If+5YgFoi30Nxo//AcMxv6v2XfEgyZXT/MTBWqk+LL70TJcp7PRs7DdnjZ/wT l+iJbcJ5x7m7hGdxqLjCWrNQdkkup8w3Uzxnzj+eVsE1dEcrNzHFwDkmO8TgQllpUvxs eKBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date:dkim-signature; bh=xuwo4gvqE3MCOIjmfp65QB1d2BsETVoFBxxN7PO8YcI=; b=wRZYC8jB8AIC6b6oXdMhQNKi7/7Vn3Hl3sIr7k1ywrVkmeIzmnXwPw1c5NkfJuPAFi e2t3TdpdPXmMpLXX/CQydWe/BrBsM0VOP5hAKNT+50DxeRCjZWRAj+82J9L6IJt2SUod kP+pVr912zJlUPr0EFCbgOhHNi7AAaNizi0DAQVckm0QIjCNH4xD8PV/aYo0KFSmuY5k 5q/vufVHnbEZ3iVArhZ5bJ7///9Ag0n+fdJ3XA4heUZ74jeLvT+JVps+v5G8rBPBxbGu 84QeIi8xOLiSGoVC993HdCAn9DAxH+UClBd5NmDeoXRO2Pd7fimIuKE2KQ7Vnb3LNvg2 L6vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Tvbq54yj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j63si2865028pgc.185.2019.07.10.13.20.47; Wed, 10 Jul 2019 13:21:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Tvbq54yj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727780AbfGJUTi (ORCPT + 99 others); Wed, 10 Jul 2019 16:19:38 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42868 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbfGJUTi (ORCPT ); Wed, 10 Jul 2019 16:19:38 -0400 Received: by mail-pf1-f194.google.com with SMTP id q10so1598158pff.9 for ; Wed, 10 Jul 2019 13:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:user-agent:mime-version; bh=xuwo4gvqE3MCOIjmfp65QB1d2BsETVoFBxxN7PO8YcI=; b=Tvbq54yjRqp2I+DxgbkQIx4zGd6t7zDvvfx9lAy0Msq6znsJqpAYLEZqYqvbWJtdZz hffI0l+kfvKidecFMTHTCnifFRoJU0ZM5SqxC1WqlPWtTUwIRbeogRwx58V5oHbcd7f0 1BVE3PkzL2uQxTliRKV2sWjdOPJ0C4DFs82676AzcHqNPtuWtbHHatSjNHJWHOvQj8ZZ yK8vJWMC7jXZHOY6Yq32UMK8tTyG3ecoBIaOPTWdIgmZAP1dYnD5hAEzqYLx2r97ggzr JioIB340IzkpFQuIoohu9f/eCxLQp+G2pm3xaGB/HEBPi/ELXE3lp/N3gdvZGDUQvTWQ N52A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:user-agent :mime-version; bh=xuwo4gvqE3MCOIjmfp65QB1d2BsETVoFBxxN7PO8YcI=; b=HQzKesZZkDiypaa+PFVx+nBwiOtQzxXX1gOIGtreafc5FfbAR6TSx6Atnua9hSZKdJ h9b5kQ1NBfrXu8a052uk7wnGMUvSOVfMcjev/+g6qCWwb8yrUbWi68pqwEEtNWe5abYE pigXMU7ooylKRTh7jtCpUEjI4/MRJnJCNpeWxSdwY0qTgSsf+bHi4Hb+fM8KdIM3bbX3 7zpZkyjsg9VegKq1Xkl1FSawwCotQtGriKXY98pmBYVqlWAsRqOSF5qgSLPxkUH1tXXJ +8B0UnnJqWrHcbfdy81uHsXpR4LN05rLAxKJL5BfoLoRnXiPpve7SF39MuqD6nNSqvL9 ZIJg== X-Gm-Message-State: APjAAAWExqt7DsLAC/iZtiwEEmtrVZ1eD9wbw2Qr3xoMP3WPAYyligkX lFB4YFRGgD26cCC1d8d6qT988A== X-Received: by 2002:a17:90a:2706:: with SMTP id o6mr257907pje.62.1562789977015; Wed, 10 Jul 2019 13:19:37 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id c130sm2954552pfc.184.2019.07.10.13.19.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 10 Jul 2019 13:19:36 -0700 (PDT) Date: Wed, 10 Jul 2019 13:19:35 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Ingo Molnar , Thomas Gleixner , Borislav Petkov cc: Cfir Cohen , Thomas Lendacky , Dave Hansen , Andy Lutomirski , linux-kernel@vger.kernel.org, x86@kernel.org Subject: [patch] x86/mm: Free sme_early_buffer after init Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We want to be able to clear the contents of sme_early_buffer after __sme_early_enc_dec() because it is used to move encrypted and decrypted data, but since __sme_early_enc_dec() is __init we can simply free this buffer after init. This saves a page that is otherwise unreferenced after init. Reported-by: Cfir Cohen Signed-off-by: David Rientjes --- arch/x86/mm/mem_encrypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/mm/mem_encrypt.c b/arch/x86/mm/mem_encrypt.c --- a/arch/x86/mm/mem_encrypt.c +++ b/arch/x86/mm/mem_encrypt.c @@ -41,7 +41,7 @@ EXPORT_SYMBOL_GPL(sev_enable_key); bool sev_enabled __section(.data); /* Buffer used for early in-place encryption by BSP, no locking needed */ -static char sme_early_buffer[PAGE_SIZE] __aligned(PAGE_SIZE); +static char sme_early_buffer[PAGE_SIZE] __initdata __aligned(PAGE_SIZE); /* * This routine does not change the underlying encryption setting of the