public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH edk2-firmware] add patch to work around older guest kernel bug
@ 2023-06-05  7:43 Fiona Ebner
  2023-06-06 14:26 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 5+ messages in thread
From: Fiona Ebner @ 2023-06-05  7:43 UTC (permalink / raw)
  To: pve-devel

by limiting the phys-bits to 46 instead of 47. On Ubuntu 18.04 with
kernel 4.15, using 47 leads to a strange issue where initialization of
VirtIO devices would fail.

Reported in the community forum:
https://forum.proxmox.com/threads/127410/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 ...latformInitLib-limit-phys-bits-to-46.patch | 46 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch

diff --git a/debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch b/debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
new file mode 100644
index 0000000..7f49a14
--- /dev/null
+++ b/debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
@@ -0,0 +1,46 @@
+From 89a12f2a42b989e7925b4a71e503209971eaa271 Mon Sep 17 00:00:00 2001
+From: Gerd Hoffmann <kraxel@redhat.com>
+Date: Thu, 1 Jun 2023 09:57:31 +0200
+Subject: [PATCH] OvmfPkg/PlatformInitLib: limit phys-bits to 46.
+
+Older linux kernels have problems with phys-bits larger than 46,
+ubuntu 18.04 (kernel 4.15) has been reported to be affected.
+
+Reduce phys-bits limit from 47 to 46.
+
+Reported-by: Fiona Ebner <f.ebner@proxmox.com>
+Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
+---
+ OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+index 38cece9173..4d0522ce22 100644
+--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
++++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+@@ -657,16 +657,19 @@ PlatformAddressWidthFromCpuid (
+     ));
+ 
+   if (Valid) {
+-    if (PhysBits > 47) {
++    if (PhysBits > 46) {
+       /*
+        * Avoid 5-level paging altogether for now, which limits
+        * PhysBits to 48.  Also avoid using address bit 48, due to sign
+        * extension we can't identity-map these addresses (and lots of
+        * places in edk2 assume we have everything identity-mapped).
+        * So the actual limit is 47.
++       *
++       * Also some older linux kernels apparently have problems handling
++       * phys-bits > 46 correctly, so use that as limit.
+        */
+-      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__));
+-      PhysBits = 47;
++      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__));
++      PhysBits = 46;
+     }
+ 
+     if (!Page1GSupport && (PhysBits > 40)) {
+-- 
+2.39.2
+
diff --git a/debian/patches/series b/debian/patches/series
index f1ec614..a9ee2be 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ no-stack-protector-all-archs.diff
 brotlicompress-disable.diff
 x64-baseline-abi.patch
 Revert-ArmVirtPkg-make-EFI_LOADER_DATA-non-executabl.patch
+0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
-- 
2.39.2





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [pve-devel] applied: [PATCH edk2-firmware] add patch to work around older guest kernel bug
  2023-06-05  7:43 [pve-devel] [PATCH edk2-firmware] add patch to work around older guest kernel bug Fiona Ebner
@ 2023-06-06 14:26 ` Thomas Lamprecht
  2023-06-07  9:04   ` Fiona Ebner
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Lamprecht @ 2023-06-06 14:26 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner


nit: a slightly more telling subject could have been something like:

backport limiting the phys-bits to 46 for bug in old guest kernel

Am 05/06/2023 um 09:43 schrieb Fiona Ebner:
> by limiting the phys-bits to 46 instead of 47. On Ubuntu 18.04 with
> kernel 4.15, using 47 leads to a strange issue where initialization of
> VirtIO devices would fail.
> 
> Reported in the community forum:
> https://forum.proxmox.com/threads/127410/
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  ...latformInitLib-limit-phys-bits-to-46.patch | 46 +++++++++++++++++++
>  debian/patches/series                         |  1 +
>  2 files changed, 47 insertions(+)
>  create mode 100644 debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
> 
>

applied, but fixed line endings of patch, edk2 (sadly) uses Windows-Style \r\n,
but the patch only got \n, so failed building a DSC:

cd pve-edk2-firmware-3.20230228; dpkg-buildpackage -S -uc -us -d
# ...
patching file OvmfPkg/Library/PlatformInitLib/MemDetect.c
Hunk #1 FAILED at 657 (different line endings).
1 out of 1 hunk FAILED
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch '0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-source: info: if the file is present in the unpacked source, make sure it is also present in the orig tarball
dpkg-source: info: restoring quilt backup files for 0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch/ --reject-file=- < pve-edk2-firmware-3.20230228/debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch subprocess returned exit status 1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] applied: [PATCH edk2-firmware] add patch to work around older guest kernel bug
  2023-06-06 14:26 ` [pve-devel] applied: " Thomas Lamprecht
@ 2023-06-07  9:04   ` Fiona Ebner
  2023-06-07 10:12     ` Fiona Ebner
  0 siblings, 1 reply; 5+ messages in thread
From: Fiona Ebner @ 2023-06-07  9:04 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion

Am 06.06.23 um 16:26 schrieb Thomas Lamprecht:
> 
> nit: a slightly more telling subject could have been something like:
> 
> backport limiting the phys-bits to 46 for bug in old guest kernel

Yes, sorry. My commit title was too generic.

> Am 05/06/2023 um 09:43 schrieb Fiona Ebner:
>> by limiting the phys-bits to 46 instead of 47. On Ubuntu 18.04 with
>> kernel 4.15, using 47 leads to a strange issue where initialization of
>> VirtIO devices would fail.
>>
>> Reported in the community forum:
>> https://forum.proxmox.com/threads/127410/
>>
>> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
>> ---
>>  ...latformInitLib-limit-phys-bits-to-46.patch | 46 +++++++++++++++++++
>>  debian/patches/series                         |  1 +
>>  2 files changed, 47 insertions(+)
>>  create mode 100644 debian/patches/0001-OvmfPkg-PlatformInitLib-limit-phys-bits-to-46.patch
>>
>>
> 
> applied, but fixed line endings of patch, edk2 (sadly) uses Windows-Style \r\n,
> but the patch only got \n, so failed building a DSC:
> 

Hmm, it's correct in my repository and in the formatted patch, but not
here in the mail anymore. Do I need to specify something special with
git send-email?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] applied: [PATCH edk2-firmware] add patch to work around older guest kernel bug
  2023-06-07  9:04   ` Fiona Ebner
@ 2023-06-07 10:12     ` Fiona Ebner
  2023-06-07 10:25       ` Thomas Lamprecht
  0 siblings, 1 reply; 5+ messages in thread
From: Fiona Ebner @ 2023-06-07 10:12 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion

Am 07.06.23 um 11:04 schrieb Fiona Ebner:
> Am 06.06.23 um 16:26 schrieb Thomas Lamprecht:
>> applied, but fixed line endings of patch, edk2 (sadly) uses Windows-Style \r\n,
>> but the patch only got \n, so failed building a DSC:
>>
> 
> Hmm, it's correct in my repository and in the formatted patch, but not
> here in the mail anymore. Do I need to specify something special with
> git send-email?
> 

I asked Stoiko and sending the mail to him or myself directly works as
intended, so it might be an issue with mailman.

If anybody wants to send an edk2-firmware patch until there is time to
look at the issue more closely, he said that the
--transfer-encoding=base64 option for git send-email might be worth a shot.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [pve-devel] applied: [PATCH edk2-firmware] add patch to work around older guest kernel bug
  2023-06-07 10:12     ` Fiona Ebner
@ 2023-06-07 10:25       ` Thomas Lamprecht
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Lamprecht @ 2023-06-07 10:25 UTC (permalink / raw)
  To: Proxmox VE development discussion

Am 07/06/2023 um 12:12 schrieb Fiona Ebner:
>> Hmm, it's correct in my repository and in the formatted patch, but not
>> here in the mail anymore. Do I need to specify something special with
>> git send-email?
>>
> I asked Stoiko and sending the mail to him or myself directly works as
> intended, so it might be an issue with mailman.
> 
> If anybody wants to send an edk2-firmware patch until there is time to
> look at the issue more closely, he said that the
> --transfer-encoding=base64 option for git send-email might be worth a shot.


And possibly the `--keep-cr` option of `git am`




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-07 10:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-05  7:43 [pve-devel] [PATCH edk2-firmware] add patch to work around older guest kernel bug Fiona Ebner
2023-06-06 14:26 ` [pve-devel] applied: " Thomas Lamprecht
2023-06-07  9:04   ` Fiona Ebner
2023-06-07 10:12     ` Fiona Ebner
2023-06-07 10:25       ` Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal