all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu] add patches to fix regression with LSI SCSI controller
@ 2023-03-13 11:43 Fiona Ebner
  2023-03-13 16:53 ` [pve-devel] applied-series: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2023-03-13 11:43 UTC (permalink / raw)
  To: pve-devel

The patch 0008-memory-prevent-dma-reentracy-issues.patch introduced a
regression for the LSI SCSI controller leading to boot failures [0],
because, in its current form, it relies on reentrancy for a particular
ram_io region.

[0]: https://forum.proxmox.com/threads/123843

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Needs these two patches first (for the numbering in the series file):
https://lists.proxmox.com/pipermail/pve-devel/2023-March/056110.html

 ...isabling-re-entrancy-checking-per-MR.patch | 38 +++++++++++++++++++
 ...le-reentrancy-detection-for-script-R.patch | 33 ++++++++++++++++
 debian/patches/series                         |  2 +
 3 files changed, 73 insertions(+)
 create mode 100644 debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
 create mode 100644 debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch

diff --git a/debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch b/debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
new file mode 100644
index 0000000..3d5c267
--- /dev/null
+++ b/debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Alexander Bulekov <alxndr@bu.edu>
+Date: Mon, 13 Mar 2023 04:24:16 -0400
+Subject: [PATCH] memory: Allow disabling re-entrancy checking per-MR
+
+Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
+---
+ include/exec/memory.h | 3 +++
+ softmmu/memory.c      | 2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/include/exec/memory.h b/include/exec/memory.h
+index 91f8a2395a..d7268d9f39 100644
+--- a/include/exec/memory.h
++++ b/include/exec/memory.h
+@@ -765,6 +765,9 @@ struct MemoryRegion {
+     unsigned ioeventfd_nb;
+     MemoryRegionIoeventfd *ioeventfds;
+     RamDiscardManager *rdm; /* Only for RAM */
++
++    /* For devices designed to perform re-entrant IO into their own IO MRs */
++    bool disable_reentrancy_guard;
+ };
+ 
+ struct IOMMUMemoryRegion {
+diff --git a/softmmu/memory.c b/softmmu/memory.c
+index 7dcb3347aa..2b46714191 100644
+--- a/softmmu/memory.c
++++ b/softmmu/memory.c
+@@ -544,7 +544,7 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
+     }
+ 
+     /* Do not allow more than one simultanous access to a device's IO Regions */
+-    if (mr->owner &&
++    if (mr->owner && !mr->disable_reentrancy_guard &&
+         !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
+         dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
+         if (dev) {
diff --git a/debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch b/debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch
new file mode 100644
index 0000000..a4ed0ee
--- /dev/null
+++ b/debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch
@@ -0,0 +1,33 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Alexander Bulekov <alxndr@bu.edu>
+Date: Mon, 13 Mar 2023 04:24:17 -0400
+Subject: [PATCH] lsi53c895a: disable reentrancy detection for script RAM
+
+As the code is designed to use the memory APIs to access the script ram,
+disable reentrancy checks for the pseudo-RAM ram_io MemoryRegion.
+
+In the future, ram_io may be converted from an IO to a proper RAM MemoryRegion.
+
+Reported-by: Fiona Ebner <f.ebner@proxmox.com>
+Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
+---
+ hw/scsi/lsi53c895a.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
+index 50979640c3..894b9311ac 100644
+--- a/hw/scsi/lsi53c895a.c
++++ b/hw/scsi/lsi53c895a.c
+@@ -2302,6 +2302,12 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
+     memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
+                           "lsi-io", 256);
+ 
++    /*
++     * Since we use the address-space API to interact with ram_io, disable the
++     * re-entrancy guard.
++     */
++    s->ram_io.disable_reentrancy_guard = true;
++
+     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
+     qdev_init_gpio_out(d, &s->ext_irq, 1);
+ 
diff --git a/debian/patches/series b/debian/patches/series
index ba3279e..681b57d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -18,6 +18,8 @@ extra/0017-vhost-avoid-a-potential-use-of-an-uninitialized-vari.patch
 extra/0018-chardev-char-socket-set-s-listener-NULL-in-char_sock.patch
 extra/0019-intel-iommu-fail-MAP-notifier-without-caching-mode.patch
 extra/0020-intel-iommu-fail-DEVIOTLB_UNMAP-without-dt-mode.patch
+extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
+extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch
 bitmap-mirror/0001-drive-mirror-add-support-for-sync-bitmap-mode-never.patch
 bitmap-mirror/0002-drive-mirror-add-support-for-conditional-and-always-.patch
 bitmap-mirror/0003-mirror-add-check-for-bitmap-mode-without-bitmap.patch
-- 
2.30.2





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

* [pve-devel] applied-series: [PATCH qemu] add patches to fix regression with LSI SCSI controller
  2023-03-13 11:43 [pve-devel] [PATCH qemu] add patches to fix regression with LSI SCSI controller Fiona Ebner
@ 2023-03-13 16:53 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-03-13 16:53 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fiona Ebner

Am 13/03/2023 um 12:43 schrieb Fiona Ebner:
> The patch 0008-memory-prevent-dma-reentracy-issues.patch introduced a
> regression for the LSI SCSI controller leading to boot failures [0],
> because, in its current form, it relies on reentrancy for a particular
> ram_io region.
> 
> [0]: https://forum.proxmox.com/threads/123843
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
> 
> Needs these two patches first (for the numbering in the series file):
> https://lists.proxmox.com/pipermail/pve-devel/2023-March/056110.html
> 
>  ...isabling-re-entrancy-checking-per-MR.patch | 38 +++++++++++++++++++
>  ...le-reentrancy-detection-for-script-R.patch | 33 ++++++++++++++++
>  debian/patches/series                         |  2 +
>  3 files changed, 73 insertions(+)
>  create mode 100644 debian/patches/extra/0021-memory-Allow-disabling-re-entrancy-checking-per-MR.patch
>  create mode 100644 debian/patches/extra/0022-lsi53c895a-disable-reentrancy-detection-for-script-R.patch
> 
>

applied, thanks!




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

end of thread, other threads:[~2023-03-13 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13 11:43 [pve-devel] [PATCH qemu] add patches to fix regression with LSI SCSI controller Fiona Ebner
2023-03-13 16:53 ` [pve-devel] applied-series: " Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal