All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 0/9] Trivial branch for 6.1 patches
@ 2021-07-09 20:28 Laurent Vivier
  2021-07-09 20:28 ` [PULL 1/9] qemu-option: Drop dead assertion Laurent Vivier
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Michael Tokarev, Laurent Vivier

The following changes since commit 05de778b5b8ab0b402996769117b88c7ea5c7c61:

  Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-07-09 14:30:01 +0100)

are available in the Git repository at:

  git://github.com/vivier/qemu.git tags/trivial-branch-for-6.1-pull-request

for you to fetch changes up to e28ffe90fde5702aa8716ac2fa1b4116cdcc9e61:

  util/guest-random: Fix size arg to tail memcpy (2021-07-09 18:42:46 +0200)

----------------------------------------------------------------
Trivial patches pull request 20210709

----------------------------------------------------------------

Hubert Jasudowicz (1):
  virtiofsd: Add missing newline in error message

Li Zhijian (1):
  misc: Remove redundant new line in perror()

Mark Nelson (1):
  util/guest-random: Fix size arg to tail memcpy

Markus Armbruster (1):
  qemu-option: Drop dead assertion

Olaf Hering (1):
  migration: fix typo in mig_throttle_guest_down comment

Philippe Mathieu-Daudé (3):
  memory: Display MemoryRegion name in read/write ops trace events
  misc: Fix "havn't" typo
  hw/virtio: Document *_should_notify() are called within
    rcu_read_lock()

Thomas Huth (1):
  target/xtensa/xtensa-semi: Fix compilation problem on Haiku

 hw/usb/desc-msos.c            |  2 +-
 hw/virtio/virtio.c            |  2 +
 migration/ram.c               |  2 +-
 migration/rdma.c              |  2 +-
 softmmu/cpus.c                |  2 +-
 softmmu/memory.c              | 12 +++--
 softmmu/trace-events          |  4 +-
 target/s390x/translate.c      |  6 ++-
 target/xtensa/xtensa-semi.c   | 84 ++++++++++++++++-------------------
 tcg/arm/tcg-target.c.inc      |  6 ++-
 tcg/sparc/tcg-target.c.inc    |  6 ++-
 tcg/tcg-op.c                  |  2 +-
 tools/virtiofsd/fuse_virtio.c |  2 +-
 util/guest-random.c           |  2 +-
 util/qemu-option.c            |  2 -
 15 files changed, 70 insertions(+), 66 deletions(-)

-- 
2.31.1



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

* [PULL 1/9] qemu-option: Drop dead assertion
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 2/9] memory: Display MemoryRegion name in read/write ops trace events Laurent Vivier
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Thomas Huth, Michael Tokarev, Laurent Vivier,
	Markus Armbruster

From: Markus Armbruster <armbru@redhat.com>

Commit c6ecec43b2 "qemu-option: Check return value instead of @err
where convenient" simplified

    opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1,
                            &local_err);
    if (local_err) {
        error_propagate(errp, local_err);
        return NULL;
    }

to

    opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1, errp);
    if (!opts) {
        return NULL;
    }

but neglected to delete

    assert(opts != NULL);

Do that now.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210610085026.436081-1-armbru@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 util/qemu-option.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/util/qemu-option.c b/util/qemu-option.c
index ee78e42216cc..61cb4a97bdb6 100644
--- a/util/qemu-option.c
+++ b/util/qemu-option.c
@@ -997,8 +997,6 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
         return NULL;
     }
 
-    assert(opts != NULL);
-
     for (entry = qdict_first(qdict);
          entry;
          entry = qdict_next(qdict, entry)) {
-- 
2.31.1



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

* [PULL 2/9] memory: Display MemoryRegion name in read/write ops trace events
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
  2021-07-09 20:28 ` [PULL 1/9] qemu-option: Drop dead assertion Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 3/9] misc: Fix "havn't" typo Laurent Vivier
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

MemoryRegion names is cached on first call to memory_region_name(),
so displaying the name is trace events is cheap. Add it for read /
write ops.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210307074833.143106-1-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 softmmu/memory.c     | 12 ++++++++----
 softmmu/trace-events |  4 ++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/softmmu/memory.c b/softmmu/memory.c
index f0161515e96d..24a97c8b1f9a 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -442,7 +442,8 @@ static MemTxResult  memory_region_read_accessor(MemoryRegion *mr,
         trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);
     } else if (trace_event_get_state_backends(TRACE_MEMORY_REGION_OPS_READ)) {
         hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
-        trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size);
+        trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size,
+                                     memory_region_name(mr));
     }
     memory_region_shift_read_access(value, shift, mask, tmp);
     return MEMTX_OK;
@@ -464,7 +465,8 @@ static MemTxResult memory_region_read_with_attrs_accessor(MemoryRegion *mr,
         trace_memory_region_subpage_read(get_cpu_index(), mr, addr, tmp, size);
     } else if (trace_event_get_state_backends(TRACE_MEMORY_REGION_OPS_READ)) {
         hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
-        trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size);
+        trace_memory_region_ops_read(get_cpu_index(), mr, abs_addr, tmp, size,
+                                     memory_region_name(mr));
     }
     memory_region_shift_read_access(value, shift, mask, tmp);
     return r;
@@ -484,7 +486,8 @@ static MemTxResult memory_region_write_accessor(MemoryRegion *mr,
         trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);
     } else if (trace_event_get_state_backends(TRACE_MEMORY_REGION_OPS_WRITE)) {
         hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
-        trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);
+        trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size,
+                                      memory_region_name(mr));
     }
     mr->ops->write(mr->opaque, addr, tmp, size);
     return MEMTX_OK;
@@ -504,7 +507,8 @@ static MemTxResult memory_region_write_with_attrs_accessor(MemoryRegion *mr,
         trace_memory_region_subpage_write(get_cpu_index(), mr, addr, tmp, size);
     } else if (trace_event_get_state_backends(TRACE_MEMORY_REGION_OPS_WRITE)) {
         hwaddr abs_addr = memory_region_to_absolute_addr(mr, addr);
-        trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size);
+        trace_memory_region_ops_write(get_cpu_index(), mr, abs_addr, tmp, size,
+                                      memory_region_name(mr));
     }
     return mr->ops->write_with_attrs(mr->opaque, addr, tmp, size, attrs);
 }
diff --git a/softmmu/trace-events b/softmmu/trace-events
index d18ac41e4e34..7b278590a0e2 100644
--- a/softmmu/trace-events
+++ b/softmmu/trace-events
@@ -9,8 +9,8 @@ cpu_in(unsigned int addr, char size, unsigned int val) "addr 0x%x(%c) value %u"
 cpu_out(unsigned int addr, char size, unsigned int val) "addr 0x%x(%c) value %u"
 
 # memory.c
-memory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
-memory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
+memory_region_ops_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size, const char *name) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u name '%s'"
+memory_region_ops_write(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size, const char *name) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u name '%s'"
 memory_region_subpage_read(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u"
 memory_region_subpage_write(int cpu_index, void *mr, uint64_t offset, uint64_t value, unsigned size) "cpu %d mr %p offset 0x%"PRIx64" value 0x%"PRIx64" size %u"
 memory_region_ram_device_read(int cpu_index, void *mr, uint64_t addr, uint64_t value, unsigned size) "cpu %d mr %p addr 0x%"PRIx64" value 0x%"PRIx64" size %u"
-- 
2.31.1



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

* [PULL 3/9] misc: Fix "havn't" typo
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
  2021-07-09 20:28 ` [PULL 1/9] qemu-option: Drop dead assertion Laurent Vivier
  2021-07-09 20:28 ` [PULL 2/9] memory: Display MemoryRegion name in read/write ops trace events Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 4/9] virtiofsd: Add missing newline in error message Laurent Vivier
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, qemu-trivial, Michael Tokarev, Laurent Vivier,
	Philippe Mathieu-Daudé,
	Luis Pires

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Fix "havn't (make)" -> "haven't (made)" typo.

Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20210629051400.2573253-1-f4bug@amsat.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/usb/desc-msos.c         | 2 +-
 target/s390x/translate.c   | 6 ++++--
 tcg/arm/tcg-target.c.inc   | 6 ++++--
 tcg/sparc/tcg-target.c.inc | 6 ++++--
 tcg/tcg-op.c               | 2 +-
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/hw/usb/desc-msos.c b/hw/usb/desc-msos.c
index 3a5ad7c8d0f8..836e38c67e1e 100644
--- a/hw/usb/desc-msos.c
+++ b/hw/usb/desc-msos.c
@@ -181,7 +181,7 @@ static int usb_desc_msos_prop(const USBDesc *desc, uint8_t *dest)
 
     if (desc->msos->Label) {
         /*
-         * Given as example in the specs.  Havn't figured yet where
+         * Given as example in the specs.  Haven't figured yet where
          * this label shows up in the windows gui.
          */
         length += usb_desc_msos_prop_str(dest+length, MSOS_REG_SZ,
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
index 03dab9f3507a..8822603a6e7d 100644
--- a/target/s390x/translate.c
+++ b/target/s390x/translate.c
@@ -6270,8 +6270,10 @@ static void extract_field(DisasFields *o, const DisasField *f, uint64_t insn)
         abort();
     }
 
-    /* Validate that the "compressed" encoding we selected above is valid.
-       I.e. we havn't make two different original fields overlap.  */
+    /*
+     * Validate that the "compressed" encoding we selected above is valid.
+     * I.e. we haven't made two different original fields overlap.
+     */
     assert(((o->presentC >> f->indexC) & 1) == 0);
     o->presentC |= 1 << f->indexC;
     o->presentO |= 1 << f->indexO;
diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc
index 7a761a602e2c..007ceee68e23 100644
--- a/tcg/arm/tcg-target.c.inc
+++ b/tcg/arm/tcg-target.c.inc
@@ -2407,8 +2407,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
 
 static void tcg_target_init(TCGContext *s)
 {
-    /* Only probe for the platform and capabilities if we havn't already
-       determined maximum values at compile time.  */
+    /*
+     * Only probe for the platform and capabilities if we haven't already
+     * determined maximum values at compile time.
+     */
 #if !defined(use_idiv_instructions) || !defined(use_neon_instructions)
     {
         unsigned long hwcap = qemu_getauxval(AT_HWCAP);
diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc
index a6ec94a094fa..688827968b02 100644
--- a/tcg/sparc/tcg-target.c.inc
+++ b/tcg/sparc/tcg-target.c.inc
@@ -1690,8 +1690,10 @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
 
 static void tcg_target_init(TCGContext *s)
 {
-    /* Only probe for the platform and capabilities if we havn't already
-       determined maximum values at compile time.  */
+    /*
+     * Only probe for the platform and capabilities if we haven't already
+     * determined maximum values at compile time.
+     */
 #ifndef use_vis3_instructions
     {
         unsigned long hwcap = qemu_getauxval(AT_HWCAP);
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
index 44d711c0fc4a..58a34b5147b5 100644
--- a/tcg/tcg-op.c
+++ b/tcg/tcg-op.c
@@ -2741,7 +2741,7 @@ void tcg_gen_goto_tb(unsigned idx)
     /* We only support two chained exits.  */
     tcg_debug_assert(idx <= TB_EXIT_IDXMAX);
 #ifdef CONFIG_DEBUG_TCG
-    /* Verify that we havn't seen this numbered exit before.  */
+    /* Verify that we haven't seen this numbered exit before.  */
     tcg_debug_assert((tcg_ctx->goto_tb_issue_mask & (1 << idx)) == 0);
     tcg_ctx->goto_tb_issue_mask |= 1 << idx;
 #endif
-- 
2.31.1



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

* [PULL 4/9] virtiofsd: Add missing newline in error message
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (2 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 3/9] misc: Fix "havn't" typo Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 5/9] misc: Remove redundant new line in perror() Laurent Vivier
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Hubert Jasudowicz, qemu-trivial, Michael Tokarev, Laurent Vivier,
	Stefan Hajnoczi, Philippe Mathieu-Daudé

From: Hubert Jasudowicz <hubert.jasudowicz@gmail.com>

Signed-off-by: Hubert Jasudowicz <hubert.jasudowicz@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <e5914ad202a13e9c1bc2a5efa267ff3bd4f48db6.1625173475.git.hubert.jasudowicz@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 tools/virtiofsd/fuse_virtio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
index fa4aff9b0ee8..fc2564a6033d 100644
--- a/tools/virtiofsd/fuse_virtio.c
+++ b/tools/virtiofsd/fuse_virtio.c
@@ -917,7 +917,7 @@ static bool fv_socket_lock(struct fuse_session *se)
     dir = qemu_get_local_state_pathname("run/virtiofsd");
 
     if (g_mkdir_with_parents(dir, S_IRWXU) < 0) {
-        fuse_log(FUSE_LOG_ERR, "%s: Failed to create directory %s: %s",
+        fuse_log(FUSE_LOG_ERR, "%s: Failed to create directory %s: %s\n",
                  __func__, dir, strerror(errno));
         return false;
     }
-- 
2.31.1



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

* [PULL 5/9] misc: Remove redundant new line in perror()
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (3 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 4/9] virtiofsd: Add missing newline in error message Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 6/9] hw/virtio: Document *_should_notify() are called within rcu_read_lock() Laurent Vivier
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Michael Tokarev, Laurent Vivier, Li Zhijian

From: Li Zhijian <lizhijian@cn.fujitsu.com>

Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210706094433.1766952-1-lizhijian@cn.fujitsu.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 migration/rdma.c | 2 +-
 softmmu/cpus.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index b6cc4bef4a8e..38a099f7eec0 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1131,7 +1131,7 @@ static int qemu_rdma_reg_whole_ram_blocks(RDMAContext *rdma)
                     IBV_ACCESS_REMOTE_WRITE
                     );
         if (!local->block[i].mr) {
-            perror("Failed to register local dest ram block!\n");
+            perror("Failed to register local dest ram block!");
             break;
         }
         rdma->total_registrations++;
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index c3caaeb26ec1..071085f840b0 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -325,7 +325,7 @@ static void sigbus_reraise(void)
         sigaddset(&set, SIGBUS);
         pthread_sigmask(SIG_UNBLOCK, &set, NULL);
     }
-    perror("Failed to re-raise SIGBUS!\n");
+    perror("Failed to re-raise SIGBUS!");
     abort();
 }
 
-- 
2.31.1



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

* [PULL 6/9] hw/virtio: Document *_should_notify() are called within rcu_read_lock()
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (4 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 5/9] misc: Remove redundant new line in perror() Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 7/9] target/xtensa/xtensa-semi: Fix compilation problem on Haiku Laurent Vivier
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-trivial, Philippe Mathieu-Daudé,
	Michael Tokarev, Laurent Vivier

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Such comments make reviewing this file somehow easier.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210523094040.3516968-1-philmd@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 hw/virtio/virtio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 6dcf3baf56b7..874377f37a70 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2447,6 +2447,7 @@ static void virtio_set_isr(VirtIODevice *vdev, int value)
     }
 }
 
+/* Called within rcu_read_lock(). */
 static bool virtio_split_should_notify(VirtIODevice *vdev, VirtQueue *vq)
 {
     uint16_t old, new;
@@ -2483,6 +2484,7 @@ static bool vring_packed_need_event(VirtQueue *vq, bool wrap,
     return vring_need_event(off, new, old);
 }
 
+/* Called within rcu_read_lock(). */
 static bool virtio_packed_should_notify(VirtIODevice *vdev, VirtQueue *vq)
 {
     VRingPackedDescEvent e;
-- 
2.31.1



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

* [PULL 7/9] target/xtensa/xtensa-semi: Fix compilation problem on Haiku
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (5 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 6/9] hw/virtio: Document *_should_notify() are called within rcu_read_lock() Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 8/9] migration: fix typo in mig_throttle_guest_down comment Laurent Vivier
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Max Filippov, qemu-trivial, Richard Henderson,
	Michael Tokarev, Laurent Vivier, Philippe Mathieu-Daudé,
	Richard Zak

From: Thomas Huth <thuth@redhat.com>

The errno numbers are very large on Haiku, so the linking currently
fails there with a "final link failed: memory exhausted" error
message. We should not use the errno number as array indexes here,
thus convert the code to a switch-case statement instead. A clever
compiler should be able to optimize this code in a similar way
anway.

Reported-by: Richard Zak <richard.j.zak@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20210706081822.1316551-1-thuth@redhat.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 target/xtensa/xtensa-semi.c | 84 +++++++++++++++++--------------------
 1 file changed, 39 insertions(+), 45 deletions(-)

diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c
index 79f2b043f233..fa21b7e11fc2 100644
--- a/target/xtensa/xtensa-semi.c
+++ b/target/xtensa/xtensa-semi.c
@@ -95,59 +95,53 @@ enum {
 
 static uint32_t errno_h2g(int host_errno)
 {
-    static const uint32_t guest_errno[] = {
-        [EPERM]         = TARGET_EPERM,
-        [ENOENT]        = TARGET_ENOENT,
-        [ESRCH]         = TARGET_ESRCH,
-        [EINTR]         = TARGET_EINTR,
-        [EIO]           = TARGET_EIO,
-        [ENXIO]         = TARGET_ENXIO,
-        [E2BIG]         = TARGET_E2BIG,
-        [ENOEXEC]       = TARGET_ENOEXEC,
-        [EBADF]         = TARGET_EBADF,
-        [ECHILD]        = TARGET_ECHILD,
-        [EAGAIN]        = TARGET_EAGAIN,
-        [ENOMEM]        = TARGET_ENOMEM,
-        [EACCES]        = TARGET_EACCES,
-        [EFAULT]        = TARGET_EFAULT,
+    switch (host_errno) {
+    case 0:         return 0;
+    case EPERM:     return TARGET_EPERM;
+    case ENOENT:    return TARGET_ENOENT;
+    case ESRCH:     return TARGET_ESRCH;
+    case EINTR:     return TARGET_EINTR;
+    case EIO:       return TARGET_EIO;
+    case ENXIO:     return TARGET_ENXIO;
+    case E2BIG:     return TARGET_E2BIG;
+    case ENOEXEC:   return TARGET_ENOEXEC;
+    case EBADF:     return TARGET_EBADF;
+    case ECHILD:    return TARGET_ECHILD;
+    case EAGAIN:    return TARGET_EAGAIN;
+    case ENOMEM:    return TARGET_ENOMEM;
+    case EACCES:    return TARGET_EACCES;
+    case EFAULT:    return TARGET_EFAULT;
 #ifdef ENOTBLK
-        [ENOTBLK]       = TARGET_ENOTBLK,
+    case ENOTBLK:   return TARGET_ENOTBLK;
 #endif
-        [EBUSY]         = TARGET_EBUSY,
-        [EEXIST]        = TARGET_EEXIST,
-        [EXDEV]         = TARGET_EXDEV,
-        [ENODEV]        = TARGET_ENODEV,
-        [ENOTDIR]       = TARGET_ENOTDIR,
-        [EISDIR]        = TARGET_EISDIR,
-        [EINVAL]        = TARGET_EINVAL,
-        [ENFILE]        = TARGET_ENFILE,
-        [EMFILE]        = TARGET_EMFILE,
-        [ENOTTY]        = TARGET_ENOTTY,
+    case EBUSY:     return TARGET_EBUSY;
+    case EEXIST:    return TARGET_EEXIST;
+    case EXDEV:     return TARGET_EXDEV;
+    case ENODEV:    return TARGET_ENODEV;
+    case ENOTDIR:   return TARGET_ENOTDIR;
+    case EISDIR:    return TARGET_EISDIR;
+    case EINVAL:    return TARGET_EINVAL;
+    case ENFILE:    return TARGET_ENFILE;
+    case EMFILE:    return TARGET_EMFILE;
+    case ENOTTY:    return TARGET_ENOTTY;
 #ifdef ETXTBSY
-        [ETXTBSY]       = TARGET_ETXTBSY,
+    case ETXTBSY:   return TARGET_ETXTBSY;
 #endif
-        [EFBIG]         = TARGET_EFBIG,
-        [ENOSPC]        = TARGET_ENOSPC,
-        [ESPIPE]        = TARGET_ESPIPE,
-        [EROFS]         = TARGET_EROFS,
-        [EMLINK]        = TARGET_EMLINK,
-        [EPIPE]         = TARGET_EPIPE,
-        [EDOM]          = TARGET_EDOM,
-        [ERANGE]        = TARGET_ERANGE,
-        [ENOSYS]        = TARGET_ENOSYS,
+    case EFBIG:     return TARGET_EFBIG;
+    case ENOSPC:    return TARGET_ENOSPC;
+    case ESPIPE:    return TARGET_ESPIPE;
+    case EROFS:     return TARGET_EROFS;
+    case EMLINK:    return TARGET_EMLINK;
+    case EPIPE:     return TARGET_EPIPE;
+    case EDOM:      return TARGET_EDOM;
+    case ERANGE:    return TARGET_ERANGE;
+    case ENOSYS:    return TARGET_ENOSYS;
 #ifdef ELOOP
-        [ELOOP]         = TARGET_ELOOP,
+    case ELOOP:     return TARGET_ELOOP;
 #endif
     };
 
-    if (host_errno == 0) {
-        return 0;
-    } else if (host_errno > 0 && host_errno < ARRAY_SIZE(guest_errno) &&
-            guest_errno[host_errno]) {
-        return guest_errno[host_errno];
-    } else {
-        return TARGET_EINVAL;
-    }
+    return TARGET_EINVAL;
 }
 
 typedef struct XtensaSimConsole {
-- 
2.31.1



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

* [PULL 8/9] migration: fix typo in mig_throttle_guest_down comment
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (6 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 7/9] target/xtensa/xtensa-semi: Fix compilation problem on Haiku Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-09 20:28 ` [PULL 9/9] util/guest-random: Fix size arg to tail memcpy Laurent Vivier
  2021-07-11 21:20 ` [PULL 0/9] Trivial branch for 6.1 patches Peter Maydell
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Olaf Hering, qemu-trivial, Michael Tokarev, Laurent Vivier,
	Dr . David Alan Gilbert, Philippe Mathieu-Daudé

From: Olaf Hering <olaf@aepfle.de>

Fixes commit 3d0684b2ad82a5dde68e3f08b0d7786dccaf619c ("ram: Update
all functions comments")

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210708162159.18045-1-olaf@aepfle.de>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 migration/ram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/migration/ram.c b/migration/ram.c
index 723af67c2e91..88ff34f57424 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -600,7 +600,7 @@ static size_t save_page_header(RAMState *rs, QEMUFile *f,  RAMBlock *block,
 }
 
 /**
- * mig_throttle_guest_down: throotle down the guest
+ * mig_throttle_guest_down: throttle down the guest
  *
  * Reduce amount of guest cpu execution to hopefully slow down memory
  * writes. If guest dirty memory rate is reduced below the rate at
-- 
2.31.1



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

* [PULL 9/9] util/guest-random: Fix size arg to tail memcpy
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (7 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 8/9] migration: fix typo in mig_throttle_guest_down comment Laurent Vivier
@ 2021-07-09 20:28 ` Laurent Vivier
  2021-07-11 21:20 ` [PULL 0/9] Trivial branch for 6.1 patches Peter Maydell
  9 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-07-09 20:28 UTC (permalink / raw)
  To: qemu-devel
  Cc: Mark Nelson, qemu-trivial, Michael Tokarev, Richard Henderson,
	Laurent Vivier, Philippe Mathieu-Daudé

From: Mark Nelson <mdnelson8@gmail.com>

We know that in the body of this if statement i is less than len, so
we really should be copying len - i bytes not i - len bytes.

Fix this typo.

Fixes: 8d8404f1564 ("util: Add qemu_guest_getrandom and associated routines")
Signed-off-by: Mark Nelson <mdnelson8@gmail.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210709120600.11080-1-mdnelson8@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 util/guest-random.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/guest-random.c b/util/guest-random.c
index 086115bd6702..23643f86cc60 100644
--- a/util/guest-random.c
+++ b/util/guest-random.c
@@ -38,7 +38,7 @@ static int glib_random_bytes(void *buf, size_t len)
     }
     if (i < len) {
         x = g_rand_int(rand);
-        __builtin_memcpy(buf + i, &x, i - len);
+        __builtin_memcpy(buf + i, &x, len - i);
     }
     return 0;
 }
-- 
2.31.1



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

* Re: [PULL 0/9] Trivial branch for 6.1 patches
  2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
                   ` (8 preceding siblings ...)
  2021-07-09 20:28 ` [PULL 9/9] util/guest-random: Fix size arg to tail memcpy Laurent Vivier
@ 2021-07-11 21:20 ` Peter Maydell
  9 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2021-07-11 21:20 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: QEMU Trivial, Michael Tokarev, QEMU Developers

On Fri, 9 Jul 2021 at 21:32, Laurent Vivier <laurent@vivier.eu> wrote:
>
> The following changes since commit 05de778b5b8ab0b402996769117b88c7ea5c7c61:
>
>   Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-07-09 14:30:01 +0100)
>
> are available in the Git repository at:
>
>   git://github.com/vivier/qemu.git tags/trivial-branch-for-6.1-pull-request
>
> for you to fetch changes up to e28ffe90fde5702aa8716ac2fa1b4116cdcc9e61:
>
>   util/guest-random: Fix size arg to tail memcpy (2021-07-09 18:42:46 +0200)
>
> ----------------------------------------------------------------
> Trivial patches pull request 20210709
>
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2021-07-11 21:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-09 20:28 [PULL 0/9] Trivial branch for 6.1 patches Laurent Vivier
2021-07-09 20:28 ` [PULL 1/9] qemu-option: Drop dead assertion Laurent Vivier
2021-07-09 20:28 ` [PULL 2/9] memory: Display MemoryRegion name in read/write ops trace events Laurent Vivier
2021-07-09 20:28 ` [PULL 3/9] misc: Fix "havn't" typo Laurent Vivier
2021-07-09 20:28 ` [PULL 4/9] virtiofsd: Add missing newline in error message Laurent Vivier
2021-07-09 20:28 ` [PULL 5/9] misc: Remove redundant new line in perror() Laurent Vivier
2021-07-09 20:28 ` [PULL 6/9] hw/virtio: Document *_should_notify() are called within rcu_read_lock() Laurent Vivier
2021-07-09 20:28 ` [PULL 7/9] target/xtensa/xtensa-semi: Fix compilation problem on Haiku Laurent Vivier
2021-07-09 20:28 ` [PULL 8/9] migration: fix typo in mig_throttle_guest_down comment Laurent Vivier
2021-07-09 20:28 ` [PULL 9/9] util/guest-random: Fix size arg to tail memcpy Laurent Vivier
2021-07-11 21:20 ` [PULL 0/9] Trivial branch for 6.1 patches Peter Maydell

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.