qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/3] sysemu/xen: Remove unreachable xen_ram_alloc() code


From: Michael Tokarev
Subject: Re: [PATCH 2/3] sysemu/xen: Remove unreachable xen_ram_alloc() code
Date: Wed, 4 Oct 2023 15:16:23 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

05.09.2023 15:21, Philippe Mathieu-Daudé wrote:
The xen_ram_alloc() call in softmmu/physmem.c is guarded
by checking for xen_enabled(), which evaluate to 'false'
when XEN is not built in. The compiler elide the function
call, and thus the inlined function is not used. Remove it.

I still don't think it is a good way to just eliminate the
function (stub) in a hope compiler will elide the call.  It's
definitely not guaranteed by any standard, and compiler itself
can produce varying results (eg building with -O0 to make gdb
debugging easier).

static inline function costs nothing but keeps whole thing
manageable. IMHO anyway.

/mjt

Inspired-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
  include/sysemu/xen.h | 10 +++-------
  1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h
index 9b2d0b21ff..1f797a9abe 100644
--- a/include/sysemu/xen.h
+++ b/include/sysemu/xen.h
@@ -27,8 +27,6 @@ extern bool xen_allowed;
  #define xen_enabled()           (xen_allowed)
void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length);
-void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
-                   struct MemoryRegion *mr, Error **errp);
#else /* !CONFIG_XEN_IS_POSSIBLE */ @@ -38,12 +36,10 @@ static inline void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
  {
      /* nothing */
  }
-static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
-                                 MemoryRegion *mr, Error **errp)
-{
-    g_assert_not_reached();
-}
#endif /* CONFIG_XEN_IS_POSSIBLE */ +void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
+                   struct MemoryRegion *mr, Error **errp);
+
  #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]