From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-fw-6001.amazon.com (smtp-fw-6001.amazon.com [52.95.48.154]) by mx.groups.io with SMTP id smtpd.web09.212.1613679012878165907 for ; Thu, 18 Feb 2021 12:10:13 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=J7vj73Mr; spf=pass (domain: amazon.de, ip: 52.95.48.154, mailfrom: prvs=6763d3f84=graf@amazon.de) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1613679013; x=1645215013; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+sVwcKAdbaAOgLPJkZTFt0KVvzZBuW+OcKIBUsLkXVM=; b=J7vj73MrPCtuzvsh8BMmzLuh1Ah3IufBuTtVuNNSuDVXLhUNivgWe5Df N4RDlpQpJnRSrB7I1R+CxBa+O8CPHsSGhwnKbU/Rki8tzZqmEvTCBIJPl /AcFRlpZMU1T0BM3Mna2l15oNNk9cstp/3GLewvgZt1N90b1iIR/HMHIJ 8=; X-IronPort-AV: E=Sophos;i="5.81,187,1610409600"; d="scan'208";a="89216149" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1e-c7f73527.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 18 Feb 2021 20:10:05 +0000 Received: from EX13MTAUWC002.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1e-c7f73527.us-east-1.amazon.com (Postfix) with ESMTPS id 310C4C2AC9; Thu, 18 Feb 2021 20:10:02 +0000 (UTC) Received: from EX13D20UWC001.ant.amazon.com (10.43.162.244) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Feb 2021 20:10:02 +0000 Received: from u79c5a0a55de558.ant.amazon.com (10.43.162.213) by EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 18 Feb 2021 20:10:00 +0000 From: "Alexander Graf" To: CC: Leif Lindholm , Laszlo Ersek , "Ard Biesheuvel" , Jordan Justen , David Woodhouse , "Hendrik Borghorst" Subject: [PATCH 0/2] Improve hibernation safety Date: Thu, 18 Feb 2021 21:09:51 +0100 Message-ID: <20210218200953.20943-1-graf@amazon.com> X-Mailer: git-send-email 2.28.0.394.ge197136389 MIME-Version: 1.0 X-Originating-IP: [10.43.162.213] X-ClientProxiedBy: EX13D13UWB004.ant.amazon.com (10.43.161.218) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Operating Systems that get hibernated expect all non-boot-time allocations to be identical before and after hibernation. In edk2, we create pools and allocate pages starting from the highest allowed address for the allocation, usually 0xFFFFFFFF. Typically, that means we allocate a few pages of boot time data, then a few pages of runtime data, then another few pages of boot time data and again runtime data. Every allocation has direct impact on the following allocations. The problem with this scheme is that small code changes in boot time code already can have significant impact on runtime allocations, which then break hibernation. This patch set adds a mechanism to set an upper bound to dynamic memory allocations for different allocation types. This allows us to move data that has to stay at the same place across firmware changes at the same place. The patch set also enables this on OVMF by default. Alex Alexander Graf (2): MdeModulePkg/Core/Dxe: Allow to force runtime allocations at separate range OvmfPkg: Make hibernation critical allocations at own ranges MdeModulePkg/Core/Dxe/DxeMain.inf | 4 +++ MdeModulePkg/Core/Dxe/Mem/Page.c | 70 +++++++++++++++++++++++++++++++++++++++ MdeModulePkg/MdeModulePkg.dec | 16 +++++++++ MdeModulePkg/MdeModulePkg.uni | 12 +++++++ OvmfPkg/OvmfPkgIa32.dsc | 6 ++++ OvmfPkg/OvmfPkgIa32X64.dsc | 6 ++++ OvmfPkg/OvmfPkgX64.dsc | 6 ++++ 7 files changed, 120 insertions(+) -- 2.16.4 Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879