diff mbox series

[v10,8/8] apic: disable reentrancy detection for apic-msi

Message ID 20230427211013.2994127-9-alxndr@bu.edu (mailing list archive)
State New, archived
Headers show
Series memory: prevent dma-reentracy issues | expand

Commit Message

Alexander Bulekov April 27, 2023, 9:10 p.m. UTC
As the code is designed for re-entrant calls to apic-msi, mark apic-msi
as reentrancy-safe.

Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
---
 hw/intc/apic.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Michael S. Tsirkin May 18, 2023, 8:22 p.m. UTC | #1
On Thu, Apr 27, 2023 at 05:10:13PM -0400, Alexander Bulekov wrote:
> As the code is designed for re-entrant calls to apic-msi, mark apic-msi
> as reentrancy-safe.
> 
> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
> Reviewed-by: Darren Kenny <darren.kenny@oracle.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>


feel free to merge with rest of patchset - who's going to
merge it btw?

> ---
>  hw/intc/apic.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/hw/intc/apic.c b/hw/intc/apic.c
> index 20b5a94073..ac3d47d231 100644
> --- a/hw/intc/apic.c
> +++ b/hw/intc/apic.c
> @@ -885,6 +885,13 @@ static void apic_realize(DeviceState *dev, Error **errp)
>      memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
>                            APIC_SPACE_SIZE);
>  
> +    /*
> +     * apic-msi's apic_mem_write can call into ioapic_eoi_broadcast, which can
> +     * write back to apic-msi. As such mark the apic-msi region re-entrancy
> +     * safe.
> +     */
> +    s->io_memory.disable_reentrancy_guard = true;
> +
>      s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
>      local_apics[s->id] = s;
>  
> -- 
> 2.39.0
Michael Tokarev May 18, 2023, 8:33 p.m. UTC | #2
18.05.2023 23:22, Michael S. Tsirkin пишет:
> On Thu, Apr 27, 2023 at 05:10:13PM -0400, Alexander Bulekov wrote:
>> As the code is designed for re-entrant calls to apic-msi, mark apic-msi
>> as reentrancy-safe.
>>
>> Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
>> Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> 
> 
> feel free to merge with rest of patchset - who's going to
> merge it btw?
>

https://gitlab.com/qemu-project/qemu/-/commit/50795ee051a342c681a9b45671c552fbd6274db8

Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:13 2023 -0400
Commit:     Thomas Huth <thuth@redhat.com>
CommitDate: Fri Apr 28 11:31:54 2023 +0200

FWIW

/mjt
diff mbox series

Patch

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 20b5a94073..ac3d47d231 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -885,6 +885,13 @@  static void apic_realize(DeviceState *dev, Error **errp)
     memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
                           APIC_SPACE_SIZE);
 
+    /*
+     * apic-msi's apic_mem_write can call into ioapic_eoi_broadcast, which can
+     * write back to apic-msi. As such mark the apic-msi region re-entrancy
+     * safe.
+     */
+    s->io_memory.disable_reentrancy_guard = true;
+
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
     local_apics[s->id] = s;