Re: [PULL v2 0/2] NBD patches for 2024-05-30

2024-06-04 Thread Richard Henderson

On 6/3/24 09:21, Eric Blake wrote:

The following changes since commit 3b2fe44bb7f605f179e5e7feb2c13c2eb3abbb80:

   Merge tag 'pull-request-2024-05-29' ofhttps://gitlab.com/thuth/qemu  into 
staging (2024-05-29 08:38:20 -0700)

are available in the Git repository at:

   https://repo.or.cz/qemu/ericb.git  tags/pull-nbd-2024-05-30-v2

for you to fetch changes up to a73c99378022ebb785481e84cfe1e81097546268:

   iotests: test NBD+TLS+iothread (2024-06-03 09:17:11 -0500)


NBD patches for 2024-05-30

- Fix AioContext assertion with NBD+TLS


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as 
appropriate.


r~




Re: [PULL v2 0/2] ufs queue

2024-06-03 Thread Richard Henderson

On 6/3/24 03:37, Jeuk Kim wrote:

From: Jeuk Kim

The following changes since commit 74abb45dac6979e7ff76172b7f0a24e869405184:

   Merge tag 'pull-target-arm-20240531' 
ofhttps://git.linaro.org/people/pmaydell/qemu-arm  into staging (2024-05-31 
11:10:10 -0700)

are available in the Git repository at:

   https://gitlab.com/jeuk20.kim/qemu.git  tags/pull-ufs-20240603

for you to fetch changes up to 5c079578d2e46df626d13eeb629c7d761a5c4e44:

   hw/ufs: Add support MCQ of UFSHCI 4.0 (2024-06-03 16:20:42 +0900)


hw/ufs patches
- Add support MCQ of UFSHCI 4.0


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as 
appropriate.


r~




Re: [PULL v2 0/7] Block jobs patches for 2024-04-29

2024-05-28 Thread Richard Henderson

On 5/28/24 06:57, Vladimir Sementsov-Ogievskiy wrote:

The following changes since commit ad10b4badc1dd5b28305f9b9f1168cf0aa3ae946:

   Merge tag 'pull-error-2024-05-27' ofhttps://repo.or.cz/qemu/armbru  into 
staging (2024-05-27 06:40:42 -0700)

are available in the Git repository at:

   https://gitlab.com/vsementsov/qemu.git  tags/pull-block-jobs-2024-04-29-v2

for you to fetch changes up to a149401048481247bcbaf6035a7a1308974fb464:

   iotests/pylintrc: allow up to 10 similar lines (2024-05-28 15:52:15 +0300)


Block jobs patches for 2024-04-29

v2: add "iotests/pylintrc: allow up to 10 similar lines" to fix
 check-python-minreqs

- backup: discard-source parameter
- blockcommit: Reopen base image as RO after abort


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as 
appropriate.


r~




Re: [PULL 2/2] hw/ufs: Add support MCQ of UFSHCI 4.0

2024-05-28 Thread Richard Henderson

On 5/27/24 23:12, Jeuk Kim wrote:

From: Minwoo Im 

This patch adds support for MCQ defined in UFSHCI 4.0.  This patch
utilized the legacy I/O codes as much as possible to support MCQ.

MCQ operation & runtime register is placed at 0x1000 offset of UFSHCI
register statically with no spare space among four registers (48B):

UfsMcqSqReg, UfsMcqSqIntReg, UfsMcqCqReg, UfsMcqCqIntReg

The maxinum number of queue is 32 as per spec, and the default
MAC(Multiple Active Commands) are 32 in the device.

Example:
-device ufs,serial=foo,id=ufs0,mcq=true,mcq-maxq=8

Signed-off-by: Minwoo Im 
Reviewed-by: Jeuk Kim 
Message-Id: <20240528023106.856777-3-minwoo...@samsung.com>
Signed-off-by: Jeuk Kim 
---
  hw/ufs/trace-events |  17 ++
  hw/ufs/ufs.c| 475 ++--
  hw/ufs/ufs.h|  98 -
  include/block/ufs.h |  23 ++-
  4 files changed, 593 insertions(+), 20 deletions(-)


Fails build:

https://gitlab.com/qemu-project/qemu/-/jobs/6960270722

In file included from trace/trace-hw_ufs.c:5:
../hw/ufs/trace-events:28:24: error: format specifies type 'unsigned char' but the 
argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]

 , cqid, addr);
   ^~~~
../hw/ufs/trace-events:25:112: error: format specifies type 'unsigned char' but the 
argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
qemu_log("ufs_err_dma_write_cq " "failed to write cq entry. cqid %"PRIu8", 
hwaddr %"PRIu64"" "\n", cqid, addr);
 ~~~ 
 ^~~~

2 errors generated.



r~



Re: [PATCH] misc: Use QEMU header path relative to include/ directory

2024-05-07 Thread Richard Henderson

On 5/7/24 07:27, Philippe Mathieu-Daudé wrote:

QEMU headers are relative to the include/ directory,
not to the project root directory. Remove "include/".

See also:
https://www.qemu.org/docs/master/devel/style.html#include-directives

Signed-off-by: Philippe Mathieu-Daudé
---
  hw/audio/virtio-snd.c   | 2 +-
  hw/rtc/ls7a_rtc.c   | 2 +-
  target/i386/gdbstub.c   | 2 +-
  tests/qtest/nvme-test.c | 2 +-
  tests/qtest/ufs-test.c  | 2 +-
  5 files changed, 5 insertions(+), 5 deletions(-)


Reviewed-by: Richard Henderson 




Re: [PULL 0/1] ufs queue

2024-05-01 Thread Richard Henderson

On 4/28/24 20:25, Jeuk Kim wrote:

From: Jeuk Kim

The following changes since commit fd87be1dada5672f877e03c2ca8504458292c479:

   Merge tag 'accel-20240426' ofhttps://github.com/philmd/qemu  into staging 
(2024-04-26 15:28:13 -0700)

are available in the Git repository at:

   https://gitlab.com/jeuk20.kim/qemu.git  tags/pull-ufs-20240429

for you to fetch changes up to f2c8aeb1afefcda92054c448b21fc59cdd99db30:

   hw/ufs: Fix buffer overflow bug (2024-04-29 12:13:35 +0900)


ufs queue

- Fix ufs sanitizer vulnerability


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as 
appropriate.


r~




Re: [PULL 1/1] hw/ufs: Fix buffer overflow bug

2024-04-29 Thread Richard Henderson

On 4/28/24 20:25, Jeuk Kim wrote:

From: Jeuk Kim 

It fixes the buffer overflow vulnerability in the ufs device.
The bug was detected by sanitizers.

You can reproduce it by:

cat << EOF |\
qemu-system-x86_64 \
-display none -machine accel=qtest -m 512M -M q35 -nodefaults -drive \
file=null-co://,if=none,id=disk0 -device ufs,id=ufs_bus -device \
ufs-lu,drive=disk0,bus=ufs_bus -qtest stdio
outl 0xcf8 0x8810
outl 0xcfc 0xe000
outl 0xcf8 0x8804
outw 0xcfc 0x06
write 0xe058 0x1 0xa7
write 0xa 0x1 0x50
EOF

Resolves: #2299
Fixes: 329f16624499 ("hw/ufs: Support for Query Transfer Requests")
Reported-by: Zheyu Ma 
Signed-off-by: Jeuk Kim 
---
  hw/ufs/ufs.c | 8 
  1 file changed, 8 insertions(+)


For some reason this appears to cause failures on s390x:

  https://gitlab.com/qemu-project/qemu/-/jobs/6740883283

All of the timeouts are new with this patch alone applied,
and go away when reverted.

I wasn't aware that these tests used ufs, but I have no
other explanation...


r~



Re: [PULL 6/6] iotests: add backup-discard-source

2024-04-29 Thread Richard Henderson

On 4/29/24 04:51, Vladimir Sementsov-Ogievskiy wrote:

Add test for a new backup option: discard-source.

Signed-off-by: Vladimir Sementsov-Ogievskiy 
Reviewed-by: Fiona Ebner 
Tested-by: Fiona Ebner 
Message-Id: <20240313152822.626493-6-vsement...@yandex-team.ru>
Signed-off-by: Vladimir Sementsov-Ogievskiy 
---
  .../qemu-iotests/tests/backup-discard-source  | 152 ++
  .../tests/backup-discard-source.out   |   5 +
  2 files changed, 157 insertions(+)
  create mode 100755 tests/qemu-iotests/tests/backup-discard-source
  create mode 100644 tests/qemu-iotests/tests/backup-discard-source.out


This fails check-python-minreqs

  https://gitlab.com/qemu-project/qemu/-/jobs/6739551782

It appears to be a pylint issue.


r~



Re: [PULL 0/1] ufs queue

2024-04-29 Thread Richard Henderson

On 4/29/24 06:41, Stefan Hajnoczi wrote:

On Mon, Apr 29, 2024 at 12:25:37PM +0900, Jeuk Kim wrote:

From: Jeuk Kim 

The following changes since commit fd87be1dada5672f877e03c2ca8504458292c479:

   Merge tag 'accel-20240426' of https://github.com/philmd/qemu into staging 
(2024-04-26 15:28:13 -0700)

are available in the Git repository at:

   https://gitlab.com/jeuk20.kim/qemu.git tags/pull-ufs-20240429

for you to fetch changes up to f2c8aeb1afefcda92054c448b21fc59cdd99db30:

   hw/ufs: Fix buffer overflow bug (2024-04-29 12:13:35 +0900)


ufs queue

- Fix ufs sanitizer vulnerability


Jeuk Kim (1):
   hw/ufs: Fix buffer overflow bug

  hw/ufs/ufs.c | 8 
  1 file changed, 8 insertions(+)



Thanks, applied to my block tree:
https://gitlab.com/stefanha/qemu/commits/block

It will be included in my next block pull request.

You are welcome to send pull requests directly to the qemu.git/master
maintainer (Richard Henderson is on duty for this release cycle). If you
do that, make sure to GPG sign your pull request.


He did. I have

Merge tag 'pull-ufs-20240429' of https://gitlab.com/jeuk20.kim/qemu into 
staging

ufs queue

# -BEGIN PGP SIGNATURE-
#
# iQIzBAABCgAdFiEEUBfYMVl8eKPZB+73EuIgTA5dtgIFAmYvEScACgkQEuIgTA5d
# tgL3Qg//R3IcISQqqDaJ/ySzKGmkyohJSc6ySLYvla4Aki7PV+um2Dx/XNS7uG2b
# d3Qz4m6QaOKsocLfldRTn2FxVK238Rp5HNny5vc0kGRdwpR514B7aU0FhpT7qObS
# wbbgRdDddIBIiCFLhtXtg5/TK2h32VxGrVI6llX4gmd2VzqM0e4xeG1Oj8rZseOY
# SAgvDv68s1YwlO1p1vPvst/H+mUKYkqtPN1mjfCIn5tM6ss8kCLUnKjqGAg1BnSN
# xwaGrqqOlzQK2+aV02eiItiow8evU/h+c9eiTnBo/EvBwjoBn6flNXABWXFENnmP
# JjVIFeiNzSFhBPDzO23GXviuEt96j5lrcGYR48HYMZfEbJNpblXzWvEGMZWnXNgx
# Q3cpcarZ4vSWIflR9OnCSQaGLA0Ny6YqLbmrM/oD+v67EITafKKc+flmiF7DBASB
# fUoEsdffdA37LDtygJb7hfUhvPQWWAujmGzZ1cDP8Oa0MhT7aiD0Z/WqhhjVQbM0
# iLiCDDD0cc0pmT3vw3EnEjKjnSkY3H62Q7pnYHiQgij4Ls/Rdd/P7OkSd0aI82t0
# TooWGZJnyf8rjAzY2cEB1Twrhmhuyt9NnGxip9W8JsQBZMLabD2CahOm83zsk7jZ
# 3fOONz6XrW2ttFkLZcRd4x4YjKONjEXsSX2ZrXTZ5t3USz/VNvY=
# =Vwyi
# -END PGP SIGNATURE-
# gpg: Signature made Sun 28 Apr 2024 08:16:55 PM PDT
# gpg:using RSA key 5017D831597C78A3D907EEF712E2204C0E5DB602
# gpg: Good signature from "Jeuk Kim " [unknown]
# gpg: aka "Jeuk Kim " [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:  There is no indication that the signature belongs to the 
owner.
# Primary key fingerprint: 5017 D831 597C 78A3 D907  EEF7 12E2 204C 0E5D 
B602

queued for the next merge.


r~



Re: [PULL 0/2] NBD patches for 2024-04-25

2024-04-26 Thread Richard Henderson

On 4/25/24 14:43, Eric Blake wrote:

The following changes since commit 5da72194df36535d773c8bdc951529ecd5e31707:

   Merge tag 'pull-tcg-20240424' ofhttps://gitlab.com/rth7680/qemu  into 
staging (2024-04-24 15:51:49 -0700)

are available in the Git repository at:

   https://repo.or.cz/qemu/ericb.git  tags/pull-nbd-2024-04-25

for you to fetch changes up to 4fa333e08dd96395a99ea8dd9e4c73a29dd23344:

   nbd/server: Mark negotiation functions as coroutine_fn (2024-04-25 12:59:19 
-0500)


NBD patches for 2024-04-25

- Avoid calling poll() within coroutine


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as 
appropriate.


r~




Re: [PULL 0/5] Housekeeping patches for 2024-04-24

2024-04-24 Thread Richard Henderson

On 4/24/24 07:14, Philippe Mathieu-Daudé wrote:

The following changes since commit 1a6f53953df65f31e922f8a1763dac9f10adc81b:

   Open 9.1 development tree (2024-04-23 17:33:36 -0700)

are available in the Git repository at:

   https://github.com/philmd/qemu.git  tags/housekeeping-20240424

for you to fetch changes up to 2d9cbbea64e67d90c3c22d7e2d5ab530d830eb33:

   block/gluster: Remove deprecated RDMA protocol handling (2024-04-24 16:03:38 
+0200)


Removal of deprecated code

- Remove the Nios II target and hardware
- Remove pvrdma device and rdmacm-mux helper
- Remove GlusterFS RDMA protocol handling
- Update Sriram Yagnaraman mail address


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/9.1 as 
appropriate.


r~




Re: [PATCH] tests/unit: Remove debug statements in test-nested-aio-poll.c

2024-04-20 Thread Richard Henderson

On 4/19/24 01:58, Philippe Mathieu-Daudé wrote:

We are running this test since almost a year; it is
safe to remove its debug statements, which clutter
CI jobs output:

   ▶  88/100 /nested-aio-poll  OK
   io_read 0x16bb26158
   io_poll_true 0x16bb26158
   > io_poll_ready
   io_read 0x16bb26164
   < io_poll_ready
   io_poll_true 0x16bb26158
   io_poll_false 0x16bb26164
   > io_poll_ready
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_poll_false 0x16bb26164
   io_read 0x16bb26164
   < io_poll_ready
   88/100 qemu:unit / test-nested-aio-pollOK

Signed-off-by: Philippe Mathieu-Daudé
---
  tests/unit/test-nested-aio-poll.c | 7 ---
  1 file changed, 7 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 10/13] hw/scsi/scsi-disk: Use qemu_hexdump_line() to avoid sprintf()

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience.

Use qemu_hexdump_line() to avoid sprintf() calls, silencing:

   [105/169] Compiling C object libcommon.fa.p/hw_scsi_scsi-disk.c.o
   hw/scsi/scsi-disk.c:2659:14: warning: 'sprintf' is deprecated:
 This function is provided for compatibility reasons only.
 Due to security concerns inherent in the design of sprintf(3),
 it is highly recommended that you use snprintf(3) instead.
 [-Wdeprecated-declarations]
 p += sprintf(p, " 0x%02x", buf[i]);
  ^

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/scsi/scsi-disk.c | 8 ++--
  1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 4bd7af9d0c..4f914df5c2 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -2648,16 +2648,12 @@ static const SCSIReqOps *const 
scsi_disk_reqops_dispatch[256] = {
  
  static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf)

  {
-int i;
  int len = scsi_cdb_length(buf);
-char *line_buffer, *p;
+char *line_buffer;
  
  assert(len > 0 && len <= 16);

-line_buffer = g_malloc(len * 5 + 1);
  
-for (i = 0, p = line_buffer; i < len; i++) {

-p += sprintf(p, " 0x%02x", buf[i]);
-}
+line_buffer = qemu_hexdump_line(buf, 0, len, false);


This is adding ": " as an unnecessary prefix, because it's added by 
qemu_hexdump_line.
I think having qemu_hexdump_line as a primitive is good, but probably the offset argument 
should be dropped and printed by the two callers that need it (mostly qemu_hexdump).



r~



Re: [PATCH v2 09/13] util/hexdump: Replace sprintf() by g_string_append_printf()

2024-04-11 Thread Richard Henderson

On 4/11/24 13:43, Philippe Mathieu-Daudé wrote:

On 11/4/24 12:15, Philippe Mathieu-Daudé wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience.

Replace sprintf() by GString API in order to avoid:

   [426/1310] Compiling C object libqemuutil.a.p/util_hexdump.c.o
   util/hexdump.c:35:21: warning: 'sprintf' is deprecated:
 This function is provided for compatibility reasons only.
 Due to security concerns inherent in the design of sprintf(3),
 it is highly recommended that you use snprintf(3) instead.
 [-Wdeprecated-declarations]
 line += sprintf(line, " %02x", (unsigned char)buf[b + i]);
 ^
   util/hexdump.c:37:21: warning: 'sprintf' is deprecated:
 line += sprintf(line, "   ");
 ^
   2 warnings generated.

Signed-off-by: Philippe Mathieu-Daudé 
---
  util/hexdump.c | 17 -
  1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/util/hexdump.c b/util/hexdump.c
index b6f70e93bb..2ec1171de3 100644
--- a/util/hexdump.c
+++ b/util/hexdump.c
@@ -19,7 +19,7 @@
  char *qemu_hexdump_line(const void *bufptr, unsigned offset,
  unsigned int len, bool ascii)
  {
-    char linebuf[QEMU_HEXDUMP_LINE_BYTES], *line = linebuf;
+    g_autoptr(GString) gs = g_string_sized_new(QEMU_HEXDUMP_LINE_BYTES);
  const char *buf = bufptr;
  int i, c;
@@ -27,30 +27,29 @@ char *qemu_hexdump_line(const void *bufptr, unsigned offset,
  len = QEMU_HEXDUMP_LINE_BYTES;
  }
-    line += snprintf(line, 6, "%04x:", offset);
+    g_string_append_printf(gs, "%04x:", offset);
  for (i = 0; i < QEMU_HEXDUMP_LINE_BYTES; i++) {
  if ((i % 4) == 0) {
-    *line++ = ' ';
+    g_string_append_c(gs, ' ');
  }
  if (i < len) {
-    line += sprintf(line, " %02x", (unsigned char)buf[offset + i]);
+    g_string_append_printf(gs, " %02x", (unsigned char)buf[offset + 
i]);


I find using g_string_append_printf() simpler than checking snprintf()
return value, and don't expect this function to be in hot path, but if
preferred I can try to not use the GString API.


GString api is pretty good.

Reviewed-by: Richard Henderson 


r~



Re: [PATCH v2 08/13] util/hexdump: Have qemu_hexdump_line() return heap allocated buffer

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/qemu/cutils.h  | 10 +++---
  hw/virtio/vhost-vdpa.c |  5 +++--
  util/hexdump.c | 12 
  3 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h
index 70ca4b876b..e8d6b86098 100644
--- a/include/qemu/cutils.h
+++ b/include/qemu/cutils.h
@@ -254,18 +254,22 @@ int parse_debug_env(const char *name, int max, int 
initial);
  
  /**

   * qemu_hexdump_line:
- * @line: Buffer to be filled by the hexadecimal/ASCII dump
   * @bufptr: Buffer to dump
   * @offset: Offset within @bufptr to start the dump
   * @len: Length of the bytes do dump
   * @ascii: Replace non-ASCII characters by the dot symbol
   *
   * Hexdump a line of a byte buffer into a hexadecimal/ASCII buffer
+ *
+ * The caller must use g_free() to free the returned data when it is
+ * no longer required.
+ *
+ * Returns: Hexadecimal/ASCII dump
   */
  #define QEMU_HEXDUMP_LINE_BYTES 16 /* Number of bytes to dump */
  #define QEMU_HEXDUMP_LINE_LEN 75   /* Number of characters in line */
-void qemu_hexdump_line(char *line, const void *bufptr, unsigned offset,
-   unsigned int len, bool ascii);
+char *qemu_hexdump_line(const void *bufptr, unsigned offset,
+unsigned int len, bool ascii);
  
  /*

   * Hexdump a buffer to a file. An optional string prefix is added to every 
line
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index cf7cfa3f16..e61af86d9d 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -942,12 +942,13 @@ static void vhost_vdpa_dump_config(struct vhost_dev *dev, 
const uint8_t *config,
 uint32_t config_len)
  {
  int ofs, len;
-char line[QEMU_HEXDUMP_LINE_LEN];
+char *line;
  
  for (ofs = 0; ofs < config_len; ofs += 16) {

  len = config_len - ofs;
-qemu_hexdump_line(line, config, ofs, len, false);
+line = qemu_hexdump_line(config, ofs, len, false);
  trace_vhost_vdpa_dump_config(dev, line);
+g_free(line);
  }
  }
  
diff --git a/util/hexdump.c b/util/hexdump.c

index 469083d8c0..b6f70e93bb 100644
--- a/util/hexdump.c
+++ b/util/hexdump.c
@@ -16,9 +16,10 @@
  #include "qemu/osdep.h"
  #include "qemu/cutils.h"
  
-void qemu_hexdump_line(char *line, const void *bufptr, unsigned offset,

-   unsigned int len, bool ascii)
+char *qemu_hexdump_line(const void *bufptr, unsigned offset,
+unsigned int len, bool ascii)
  {
+char linebuf[QEMU_HEXDUMP_LINE_BYTES], *line = linebuf;
  const char *buf = bufptr;
  int i, c;
  
@@ -48,18 +49,21 @@ void qemu_hexdump_line(char *line, const void *bufptr, unsigned offset,

  }
  }
  *line = '\0';
+
+return g_strdup(linebuf);
  }
  
  void qemu_hexdump(FILE *fp, const char *prefix,

const void *bufptr, size_t size)
  {
  unsigned int ofs, len;
-char line[QEMU_HEXDUMP_LINE_LEN];
+char *line;
  
  for (ofs = 0; ofs < size; ofs += QEMU_HEXDUMP_LINE_BYTES) {

  len = size - ofs;
-qemu_hexdump_line(line, bufptr, ofs, len, true);
+line = qemu_hexdump_line(bufptr, ofs, len, true);
  fprintf(fp, "%s: %s\n", prefix, line);
+g_free(line);
  }
  
  }


Not especially efficient, re-allocating for each line.

How about

GString *qemu_hexdump_line(GString *str, buf, offset, len, ascii)
{
if (str) {
g_string_truncate(str, 0);
} else {
str = g_string_sized_new(QEMU_HEXDUMP_LINE_LEN);
}
...
return str;
}

void qemu_hexdump(FILE *fp, ...)
{
g_autoptr(GString) str = g_string_sized_new(QEMU_HEXDUMP_LINE_LEN);

for (...) {
qemu_hexdump_line(str, ...);
fprintf(fp, "%s: %s\n", prefix, str->str);
}
}

So that we reuse the one allocation across the whole loop.

r~



Re: [PATCH v2 07/13] util/hexdump: Rename @offset argument in qemu_hexdump_line()

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

@offset argument is more descriptive than @b.

Inverse @bufptr <-> @offset arguments order.

Document qemu_hexdump_line().

Signed-off-by: Philippe Mathieu-Daudé
---
  include/qemu/cutils.h  | 11 +--
  hw/virtio/vhost-vdpa.c |  8 
  util/hexdump.c | 16 
  3 files changed, 21 insertions(+), 14 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 04/13] hw/mips/malta: Add re-usable rng_seed_hex_new() method

2024-04-11 Thread Richard Henderson

On 4/11/24 13:07, Richard Henderson wrote:

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

Extract common code from reinitialize_rng_seed() and
load_kernel() to rng_seed_hex_new().

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/mips/malta.c | 20 
  1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index af74008c82..9fc6a7d313 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -850,15 +850,24 @@ static void G_GNUC_PRINTF(3, 4) prom_set(uint32_t *prom_buf, int 
index,

  va_end(ap);
  }
-static void reinitialize_rng_seed(void *opaque)
+static char *rng_seed_hex_new(void)
  {
-    char *rng_seed_hex = opaque;
  uint8_t rng_seed[32];
+    char rng_seed_hex[sizeof(rng_seed) * 2 + 1];
  qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
  for (size_t i = 0; i < sizeof(rng_seed); ++i) {
  sprintf(rng_seed_hex + i * 2, "%02x", rng_seed[i]);
  }
+
+    return g_strdup(rng_seed_hex);
+}
+
+static void reinitialize_rng_seed(void *opaque)
+{
+    g_autofree char *rng_seed_hex = rng_seed_hex_new();
+
+    strcpy(opaque, rng_seed_hex);
  }


Though it isn't deprecated, strcpy isn't really any safer than sprintf.
We don't need to be copying text around quite as much as this.

How about:

#define RNG_SEED_SIZE 32

static void rng_seed_hex_new(char buf[2 * RNG_SEED_SIZE + 1])
{
     static const char hex = "0123456789abcdef";
     uint8_t rng_seed[RNG_SEED_SIZE];

     qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
     for (int i = 0; i < RNG_SEED_SIZE; ++i) {
     buf[i * 2 + 0] = hex[rng_seed[i] / 16];
     buf[i * 2 + 1] = hex[rng_seed[i] % 16];


Hmm.  Maybe a

static inline char hexdump_nibble(unsigned val)
{
return (val < 10 ? '0' : 'a') + val;
}

static inline void hexdump_byte(char *out, uint8_t byte)
{
out[0] = hexdump_nibble(byte >> 4);
out[1] = hexdump_nibble(byte & 15);
}

in "qemu/cutils.h", for use elsewhere including util/hexdump.c.


r~



Re: [PATCH v2 06/13] system/qtest: Replace sprintf() by g_string_append_printf()

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience.

Replace sprintf() by GString API uses in order to avoid:

   [120/169] Compiling C object libcommon.fa.p/system_qtest.c.o
   system/qtest.c:623:13: warning: 'sprintf' is deprecated:
 This function is provided for compatibility reasons only.
 Due to security concerns inherent in the design of sprintf(3),
 it is highly recommended that you use snprintf(3) instead.
 [-Wdeprecated-declarations]
 sprintf([i * 2], "%02x", data[i]);
 ^
   1 warning generated.

Signed-off-by: Philippe Mathieu-Daudé
Reviewed-by: Thomas Huth
---
  system/qtest.c | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 04/13] hw/mips/malta: Add re-usable rng_seed_hex_new() method

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

Extract common code from reinitialize_rng_seed() and
load_kernel() to rng_seed_hex_new().

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/mips/malta.c | 20 
  1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index af74008c82..9fc6a7d313 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -850,15 +850,24 @@ static void G_GNUC_PRINTF(3, 4) prom_set(uint32_t 
*prom_buf, int index,
  va_end(ap);
  }
  
-static void reinitialize_rng_seed(void *opaque)

+static char *rng_seed_hex_new(void)
  {
-char *rng_seed_hex = opaque;
  uint8_t rng_seed[32];
+char rng_seed_hex[sizeof(rng_seed) * 2 + 1];
  
  qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));

  for (size_t i = 0; i < sizeof(rng_seed); ++i) {
  sprintf(rng_seed_hex + i * 2, "%02x", rng_seed[i]);
  }
+
+return g_strdup(rng_seed_hex);
+}
+
+static void reinitialize_rng_seed(void *opaque)
+{
+g_autofree char *rng_seed_hex = rng_seed_hex_new();
+
+strcpy(opaque, rng_seed_hex);
  }


Though it isn't deprecated, strcpy isn't really any safer than sprintf.
We don't need to be copying text around quite as much as this.

How about:

#define RNG_SEED_SIZE 32

static void rng_seed_hex_new(char buf[2 * RNG_SEED_SIZE + 1])
{
static const char hex = "0123456789abcdef";
uint8_t rng_seed[RNG_SEED_SIZE];

qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
for (int i = 0; i < RNG_SEED_SIZE; ++i) {
buf[i * 2 + 0] = hex[rng_seed[i] / 16];
buf[i * 2 + 1] = hex[rng_seed[i] % 16];
}
buf[RNG_SEED_SIZE * 2] = '\0';
}

static void reinitialize_rng_seed(void *opaque)
{
rng_seed_hex_new(opaque);
}

with little change in load_kernel.


r~



Re: [PATCH v2 03/13] hw/ppc/spapr: Replace sprintf() by snprintf()

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience.

Replace sprintf() by snprintf() in order to avoid:

   hw/ppc/spapr.c:385:5: warning: 'sprintf' is deprecated:
 This function is provided for compatibility reasons only.
 Due to security concerns inherent in the design of sprintf(3),
 it is highly recommended that you use snprintf(3) instead.
 [-Wdeprecated-declarations]
   sprintf(mem_name, "memory@%" HWADDR_PRIx, start);
   ^
   1 warning generated.

Signed-off-by: Philippe Mathieu-Daudé
---
  hw/ppc/spapr.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 02/13] hw/vfio/pci: Replace sprintf() by snprintf()

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience. Use snprintf() instead.

Signed-off-by: Philippe Mathieu-Daudé
---
  hw/vfio/pci.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 01/13] ui/console-vc: Replace sprintf() by snprintf()

2024-04-11 Thread Richard Henderson

On 4/11/24 03:15, Philippe Mathieu-Daudé wrote:

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience.

Replace sprintf() by snprintf() in order to avoid:

   [702/1310] Compiling C object libcommon.fa.p/ui_console-vc.c.o
   ui/console-vc.c:824:21: warning: 'sprintf' is deprecated:
 This function is provided for compatibility reasons only.
 Due to security concerns inherent in the design of sprintf(3),
 it is highly recommended that you use snprintf(3) instead.
 [-Wdeprecated-declarations]
 sprintf(response, "\033[%d;%dR",
 ^
   1 warning generated.

Signed-off-by: Philippe Mathieu-Daudé
---
  ui/console-vc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH 00/12] misc: Remove sprintf() due to macOS deprecation

2024-04-10 Thread Richard Henderson

On 4/10/24 06:06, Philippe Mathieu-Daudé wrote:

Hi,

sprintf() is deprecated on Darwin since macOS 13.0 / XCode 14.1,
resulting in painful developper experience.


Is snprintf also deprecated?
It might be easier to convert some of these fixed buffer cases that way, if 
allowed.


r~



Re: [PATCH-for-9.0? 3/3] hw/block/nand: Fix out-of-bound access in NAND block buffer

2024-04-08 Thread Richard Henderson

On 4/7/24 22:36, Philippe Mathieu-Daudé wrote:

nand_command() and nand_getio() don't check @offset points
into the block, nor the available data length (s->iolen) is
not negative.

In order to fix:

- check the offset is in range in nand_blk_load_NAND_PAGE_SIZE(),
- do not set @iolen if blk_load() failed.


Do not set, or do not set to non-zero?  I had been wondering if the final assignment to 
s->iolen should go into nand_load_block as well...



diff --git a/hw/block/nand.c b/hw/block/nand.c
index 3627c799b5..d90dc965a1 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -255,7 +255,9 @@ static int nand_load_block(NANDFlashState *s, int offset)
  {
  int iolen;
  
-s->blk_load(s, s->addr, offset);

+if (!s->blk_load(s, s->addr, offset)) {
+return 0;
+}
  
  iolen = (1 << s->page_shift) - offset;

  if (s->gnd) {
@@ -780,6 +782,10 @@ static bool glue(nand_blk_load_, 
NAND_PAGE_SIZE)(NANDFlashState *s,
  return false;
  }
  
+if (offset > NAND_PAGE_SIZE + OOB_SIZE) {

+return false;
+}
+


Reviewed-by: Richard Henderson 


r~




Re: [PATCH-for-9.0? 2/3] hw/block/nand: Have blk_load() return boolean indicating success

2024-04-08 Thread Richard Henderson

On 4/7/24 22:36, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé
---
  hw/block/nand.c | 12 +---
  1 file changed, 9 insertions(+), 3 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH-for-9.0? 1/3] hw/block/nand: Factor nand_load_iolen() method out

2024-04-08 Thread Richard Henderson

On 4/7/24 22:36, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé
---
  hw/block/nand.c | 32 +++-
  1 file changed, 19 insertions(+), 13 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH-for-9.0 4/4] meson: Enable -Wstatic-in-inline

2024-03-13 Thread Richard Henderson

On 3/13/24 08:49, Philippe Mathieu-Daudé wrote:

Compilers are clever enough to inline code when necessary.

The only case we accept an inline function is static in
header (we use C, not C++).

Add the -Wstatic-in-inline CPPFLAG to prevent public and
inline function to be added in the code base.

Signed-off-by: Philippe Mathieu-Daudé
---
  meson.build | 1 +
  1 file changed, 1 insertion(+)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH-for-9.0 2/4] accel/hvf: Un-inline hvf_arch_supports_guest_debug()

2024-03-13 Thread Richard Henderson

On 3/13/24 08:49, Philippe Mathieu-Daudé wrote:

See previous commit and commit 9de9fa5cf2 ("Avoid using inlined
functions with external linkage") for rationale.

Signed-off-by: Philippe Mathieu-Daudé
---
  target/arm/hvf/hvf.c  | 2 +-
  target/i386/hvf/hvf.c | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH 4/9] hw/ide/ahci: Inline ahci_get_num_ports()

2024-02-13 Thread Richard Henderson

On 2/12/24 22:11, Philippe Mathieu-Daudé wrote:

Introduce the 'ich9' variable and inline ahci_get_num_ports().

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/ide/ahci.h | 1 -
  hw/i386/pc_q35.c  | 6 --
  hw/ide/ahci.c | 8 
  hw/mips/boston.c  | 6 --
  4 files changed, 8 insertions(+), 13 deletions(-)


Reviewed-by: Richard Henderson 

As far as it goes.  But it certainly highlights that


+g_assert(MAX_SATA_PORTS == ich9->ahci.ports);
+ide_drive_get(hd, ich9->ahci.ports);



+g_assert(ARRAY_SIZE(hd) == ich9->ahci.ports);
+ide_drive_get(hd, ich9->ahci.ports);


ports is always a constant.  Or perhaps that's only from this PCI usage?


r~




Re: [PATCH 1/9] hw/i386/q35: Use DEVICE() cast macro with PCIDevice object

2024-02-13 Thread Richard Henderson

On 2/12/24 22:11, Philippe Mathieu-Daudé wrote:

QDev API provides the DEVICE() macro to access the
'qdev' parent field of the PCIDevice structure.

Signed-off-by: Philippe Mathieu-Daudé
---
  hw/i386/pc_q35.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 0/4] util/uri: Simplify the code, remove unused functions

2024-01-23 Thread Richard Henderson

On 1/24/24 04:22, Thomas Huth wrote:

Thomas Huth (4):
   util/uri: Remove uri_string_unescape()
   util/uri: Remove unused functions uri_resolve() and
 uri_resolve_relative()
   util/uri: Remove the uri_string_escape() function
   util/uri: Remove unused macros ISA_RESERVED() and ISA_GEN_DELIM()


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 2/2] hw/pflash: implement update buffer for block writes

2024-01-09 Thread Richard Henderson

On 1/8/24 23:53, Philippe Mathieu-Daudé wrote:

@@ -818,6 +867,9 @@ static void pflash_cfi01_realize(DeviceState *dev, Error 
**errp)
  pfl->cmd = 0x00;
  pfl->status = 0x80; /* WSM ready */
  pflash_cfi01_fill_cfi_table(pfl);
+
+pfl->blk_bytes = g_malloc(pfl->writeblock_size);


Do you need an unrealize to free?


r~



Re: [PATCH v3 6/6] sysemu/replay: Restrict icount to system emulation

2023-12-08 Thread Richard Henderson

On 12/8/23 03:35, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé
---
  include/sysemu/cpu-timers.h |  2 +-
  include/sysemu/replay.h | 11 ---
  stubs/icount.c  | 19 ---
  3 files changed, 9 insertions(+), 23 deletions(-)


Reviewed-by: Richard Henderson 


r~



Re: [PATCH v3 5/6] util/async: Only call icount_notify_exit() if icount is enabled

2023-12-08 Thread Richard Henderson

On 12/8/23 03:35, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé
---
  accel/tcg/icount-common.c |  4 +++-
  stubs/icount.c|  2 +-
  util/async.c  | 16 +---
  3 files changed, 13 insertions(+), 9 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v3 4/6] target/arm: Ensure icount is enabled when emulating INST_RETIRED

2023-12-08 Thread Richard Henderson

On 12/8/23 03:35, Philippe Mathieu-Daudé wrote:

pmu_init() register its event checking the pm_event::supported()
handler. For INST_RETIRED, the event is only registered and the
bit enabled in the PMU Common Event Identification register when
icount is enabled as ICOUNT_PRECISE.

PMU events are TCG-only, hardware accelerators handle them
directly. Unfortunately we register the events in non-TCG builds,
leading to linking error such:

   ld: Undefined symbols:
 _icount_to_ns, referenced from:
   _instructions_ns_per in target_arm_helper.c.o
   clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

As a kludge, give a hint to the compiler by asserting the
pm_event::get_count() and pm_event::ns_per_count() handler will
only be called under this icount mode.

Signed-off-by: Philippe Mathieu-Daudé 
---
As discussed in
https://lore.kernel.org/qemu-devel/cafeaca-hvf8vwlzmdsteo2nrskqdzv612rbjiaj-glw4vxy...@mail.gmail.com/
better would be to restrict the PMU events to TCG, but this is
out of the scope of this series.



Reviewed-by: Richard Henderson 


r~



Re: [PATCH v3 2/6] system/vl: Evaluate icount after accelerator options are parsed

2023-12-08 Thread Richard Henderson

On 12/8/23 03:35, Philippe Mathieu-Daudé wrote:

We need to parse the accelerators first, to be able
to check whether TCG is enabled or not. Then we can
parse the -icount option.

This allows removing the icount_configure() stub.

Fixes: 7f8b6126e7 ("vl: move icount configuration earlier")
Reported-by: Richard Henderson 
Signed-off-by: Philippe Mathieu-Daudé 
---
  stubs/icount.c |  8 
  system/vl.c| 16 +---
  2 files changed, 9 insertions(+), 15 deletions(-)


Reviewed-by: Richard Henderson 


r~



Re: [PATCH v3 1/6] sysemu/cpu-timers: Have icount_configure() return a boolean

2023-12-08 Thread Richard Henderson

On 12/8/23 03:35, Philippe Mathieu-Daudé wrote:

Following the example documented since commit e3fe3988d7 ("error:
Document Error API usage rules"), have icount_configure()
return a boolean indicating whether an error is set or not.

Signed-off-by: Philippe Mathieu-Daudé
---
  include/sysemu/cpu-timers.h | 10 --
  accel/tcg/icount-common.c   | 16 +---
  stubs/icount.c  |  4 +++-
  system/vl.c |  3 +--
  4 files changed, 21 insertions(+), 12 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v2 4/5] system/vl: Restrict icount to TCG emulation

2023-12-07 Thread Richard Henderson

On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 
---
  stubs/icount.c | 6 --
  system/vl.c| 6 +-
  2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/stubs/icount.c b/stubs/icount.c
index a5202e2dd9..b060b03a73 100644
--- a/stubs/icount.c
+++ b/stubs/icount.c
@@ -1,5 +1,4 @@
  #include "qemu/osdep.h"
-#include "qapi/error.h"
  #include "sysemu/cpu-timers.h"
  
  /* icount - Instruction Counter API */

@@ -10,11 +9,6 @@ void icount_update(CPUState *cpu)
  {
  abort();
  }
-void icount_configure(QemuOpts *opts, Error **errp)
-{
-/* signal error */
-error_setg(errp, "cannot configure icount, TCG support not available");
-}
  int64_t icount_get_raw(void)
  {
  abort();
diff --git a/system/vl.c b/system/vl.c
index 2bcd9efb9a..8c99c5f681 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2270,7 +2270,11 @@ static void user_register_global_props(void)
  
  static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)

  {
-icount_configure(opts, errp);
+if (tcg_enabled()) {
+icount_configure(opts, errp);
+} else {
+error_setg(errp, "cannot configure icount, TCG support not available");
+}
  return 0;
  }


This is called before the accelerator is chosen -- even before the set of available 
accelerators is even found.  Indeed, that's the very next thing that 
configure_accelerators does.


OTOH, I don't see why icount_configure is being called so early.


r~

  





Re: [PATCH v2 3/5] util/async: Only call icount_notify_exit() if icount is enabled

2023-12-07 Thread Richard Henderson

On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:

Signed-off-by: Philippe Mathieu-Daudé 
---
  stubs/icount.c |  2 +-
  util/async.c   | 16 +---
  2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/stubs/icount.c b/stubs/icount.c
index f8e6a014b8..a5202e2dd9 100644
--- a/stubs/icount.c
+++ b/stubs/icount.c
@@ -43,7 +43,7 @@ void icount_account_warp_timer(void)
  {
  abort();
  }
-
  void icount_notify_exit(void)
  {
+abort();
  }
diff --git a/util/async.c b/util/async.c
index 8f90ddc304..9007642c27 100644
--- a/util/async.c
+++ b/util/async.c
@@ -94,13 +94,15 @@ static void aio_bh_enqueue(QEMUBH *bh, unsigned new_flags)
  }
  
  aio_notify(ctx);

-/*
- * Workaround for record/replay.
- * vCPU execution should be suspended when new BH is set.
- * This is needed to avoid guest timeouts caused
- * by the long cycles of the execution.
- */
-icount_notify_exit();
+if (unlikely(icount_enabled())) {
+/*
+ * Workaround for record/replay.
+ * vCPU execution should be suspended when new BH is set.
+ * This is needed to avoid guest timeouts caused
+ * by the long cycles of the execution.
+ */
+icount_notify_exit();
+}


If you're going to do this, remove the test in the non-stub icount_notify_exit.


r~



Re: [PATCH v2 2/5] target/arm: Ensure icount is enabled when emulating INST_RETIRED

2023-12-07 Thread Richard Henderson

On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:

pmu_init() register its event checking the pm_event::supported()
handler. For INST_RETIRED, the event is only registered and the
bit enabled in the PMU Common Event Identification register when
icount is enabled as ICOUNT_PRECISE.

Assert the pm_event::get_count() and pm_event::ns_per_count()
handler will only be called under this icount mode.

Signed-off-by: Philippe Mathieu-Daudé 
---
  target/arm/helper.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index adb0960bba..333fd5f4bf 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -940,11 +940,13 @@ static bool instructions_supported(CPUARMState *env)
  
  static uint64_t instructions_get_count(CPUARMState *env)

  {
+assert(icount_enabled() == ICOUNT_PRECISE);
  return (uint64_t)icount_get_raw();
  }
  
  static int64_t instructions_ns_per(uint64_t icount)

  {
+assert(icount_enabled() == ICOUNT_PRECISE);
  return icount_to_ns((int64_t)icount);
  }
  #endif


I don't think an assert is required -- that's exactly what the .supported field is for. 
If you think this needs additional clarification, a comment is sufficient.



r~



Re: [PATCH v2 1/5] sysemu/cpu-timers: Introduce ICountMode enumerator

2023-12-07 Thread Richard Henderson

On 12/7/23 07:45, Philippe Mathieu-Daudé wrote:

Rather than having to lookup for what the 0, 1, 2, ...
icount values are, use a enum definition.

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/sysemu/cpu-timers.h | 20 +---
  accel/tcg/icount-common.c   | 16 +++-
  stubs/icount.c  |  2 +-
  system/cpu-timers.c |  2 +-
  target/arm/helper.c |  3 ++-
  5 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/include/sysemu/cpu-timers.h b/include/sysemu/cpu-timers.h
index 2e786fe7fb..e909ffae47 100644
--- a/include/sysemu/cpu-timers.h
+++ b/include/sysemu/cpu-timers.h
@@ -17,18 +17,24 @@ void cpu_timers_init(void);
  
  /* icount - Instruction Counter API */
  
-/*

- * icount enablement state:
+/**
+ * ICountMode: icount enablement state:
   *
- * 0 = Disabled - Do not count executed instructions.
- * 1 = Enabled - Fixed conversion of insn to ns via "shift" option
- * 2 = Enabled - Runtime adaptive algorithm to compute shift
+ * @ICOUNT_DISABLED: Disabled - Do not count executed instructions.
+ * @ICOUNT_PRECISE: Enabled - Fixed conversion of insn to ns via "shift" option
+ * @ICOUNT_ADAPTATIVE: Enabled - Runtime adaptive algorithm to compute shift
   */
+typedef enum {
+ICOUNT_DISABLED = 0,
+ICOUNT_PRECISE = 1,
+ICOUNT_ADAPTATIVE = 2,


No need for the assignments.  Otherwise,
Reviewed-by: Richard Henderson 


r~



Re: [PATCH-for-9.0 06/10] hw/xen: Reduce inclusion of 'cpu.h' to target-specific sources

2023-11-13 Thread Richard Henderson

On 11/13/23 07:21, Philippe Mathieu-Daudé wrote:

We rarely need to include "cpu.h" in headers. Including it
'taint' headers to be target-specific. Here only the i386/arm
implementations requires "cpu.h", so include it there and
remove from the "hw/xen/xen-hvm-common.h" *common* header.

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/xen/xen-hvm-common.h | 1 -
  hw/arm/xen_arm.c| 1 +
  hw/i386/xen/xen-hvm.c   | 1 +
  3 files changed, 2 insertions(+), 1 deletion(-)


Reviewed-by: Richard Henderson 


r~



Re: [PATCH-for-9.0 05/10] hw/xen: Use target-agnostic qemu_target_page_bits()

2023-11-13 Thread Richard Henderson

On 11/13/23 07:21, Philippe Mathieu-Daudé wrote:

Instead of the target-specific TARGET_PAGE_BITS definition,
use qemu_target_page_bits() which is target agnostic.

Signed-off-by: Philippe Mathieu-Daudé 
---
  hw/xen/xen-hvm-common.c | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)


Reviewed-by: Richard Henderson 


r~



Re: [PATCH-for-9.0 04/10] hw/xen: Factor xen_arch_align_ioreq_data() out of handle_ioreq()

2023-11-13 Thread Richard Henderson

On 11/13/23 07:21, Philippe Mathieu-Daudé wrote:

diff --git a/hw/xen/xen-hvm-common.c b/hw/xen/xen-hvm-common.c
index c028c1b541..03f9417e7e 100644
--- a/hw/xen/xen-hvm-common.c
+++ b/hw/xen/xen-hvm-common.c
@@ -426,10 +426,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req)
  trace_handle_ioreq(req, req->type, req->dir, req->df, req->data_is_ptr,
 req->addr, req->data, req->count, req->size);
  
-if (!req->data_is_ptr && (req->dir == IOREQ_WRITE) &&

-(req->size < sizeof (target_ulong))) {
-req->data &= ((target_ulong) 1 << (8 * req->size)) - 1;
-}



I suspect this should never have been using target_ulong at all: req->data is 
uint64_t.


r~



Re: [PATCH-for-9.0 03/10] hw/xen: Merge 'hw/xen/arch_hvm.h' in 'hw/xen/xen-hvm-common.h'

2023-11-13 Thread Richard Henderson

On 11/13/23 07:21, Philippe Mathieu-Daudé wrote:

We don't need a target-specific header for common target-specific
prototypes. Declare xen_arch_handle_ioreq() and xen_arch_set_memory()
in "hw/xen/xen-hvm-common.h".

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/arm/xen_arch_hvm.h   |  9 -
  include/hw/i386/xen_arch_hvm.h  | 11 ---
  include/hw/xen/arch_hvm.h   |  5 -
  include/hw/xen/xen-hvm-common.h |  6 ++
  hw/arm/xen_arm.c|  1 -
  hw/i386/xen/xen-hvm.c   |  1 -
  hw/xen/xen-hvm-common.c |  1 -
  7 files changed, 6 insertions(+), 28 deletions(-)
  delete mode 100644 include/hw/arm/xen_arch_hvm.h
  delete mode 100644 include/hw/i386/xen_arch_hvm.h
  delete mode 100644 include/hw/xen/arch_hvm.h



Reviewed-by: Richard Henderson 


r~



Re: [PATCH-for-9.0 02/10] hw/xen/xen_arch_hvm: Rename prototypes using 'xen_arch_' prefix

2023-11-13 Thread Richard Henderson

On 11/13/23 07:21, Philippe Mathieu-Daudé wrote:

Use a common 'xen_arch_' prefix for architecture-specific functions.
Rename xen_arch_set_memory() and xen_arch_handle_ioreq().

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/hw/arm/xen_arch_hvm.h  | 4 ++--
  include/hw/i386/xen_arch_hvm.h | 4 ++--
  hw/arm/xen_arm.c   | 4 ++--
  hw/i386/xen/xen-hvm.c  | 6 +++---
  hw/xen/xen-hvm-common.c| 4 ++--
  5 files changed, 11 insertions(+), 11 deletions(-)


Reviewed-by: Richard Henderson 


r~



Re: [PATCH-for-9.0 01/10] sysemu/xen: Forbid using Xen headers in user emulation

2023-11-13 Thread Richard Henderson

On 11/13/23 07:21, Philippe Mathieu-Daudé wrote:

Xen is a system specific accelerator, it makes no sense
to include its headers in user emulation.

Signed-off-by: Philippe Mathieu-Daudé 
---
  include/sysemu/xen.h | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)


Reviewed-by: Richard Henderson 


r~



Re: [PATCH v3 00/16] (few more) Steps towards enabling -Wshadow

2023-10-04 Thread Richard Henderson

On 10/4/23 05:00, Philippe Mathieu-Daudé wrote:

Philippe Mathieu-Daudé (16):
   hw/audio/soundhw: Clean up global variable shadowing
   hw/ide/ahci: Clean up local variable shadowing
   net/net: Clean up global variable shadowing
   os-posix: Clean up global variable shadowing
   plugins/loader: Clean up global variable shadowing
   qemu-img: Clean up global variable shadowing
   qemu-io: Clean up global variable shadowing
   qom/object_interfaces: Clean up global variable shadowing
   semihosting: Clean up global variable shadowing
   ui/cocoa: Clean up global variable shadowing
   util/cutils: Clean up global variable shadowing in
 get_relocated_path()
   util/guest-random: Clean up global variable shadowing
   semihosting/arm-compat: Clean up local variable shadowing
   softmmu/vl: Clean up global variable shadowing
   sysemu/tpm: Clean up global variable shadowing
   trace/control: Clean up global variable shadowing


Series:
Reviewed-by: Richard Henderson 


r~



Re: [PATCH 01/11] tcg: Clean up local variable shadowing

2023-08-31 Thread Richard Henderson

On 8/31/23 15:55, Philippe Mathieu-Daudé wrote:

-MemOp op = get_memop(oi);
+MemOp o = get_memop(oi);


mop would be a more descriptive replacement.

Otherwise,
Reviewed-by: Richard Henderson 


r~



Re: [PATCH 7/7] qobject atomics osdep: Make a few macros more hygienic

2023-08-31 Thread Richard Henderson

On 8/31/23 06:25, Markus Armbruster wrote:

+#define PASTE(a, b) a##b


We already have glue() in qemu/compiler.h.

The rest of it looks quite sensible.


r~



Re: [PULL 0/2] hw/nvme: more fixes

2023-08-09 Thread Richard Henderson

On 8/9/23 06:39, Klaus Jensen wrote:

From: Klaus Jensen

Hi,

The following changes since commit a8fc5165aab02f328ccd148aafec1e59fd1426eb:

   Merge tag 'nvme-next-pull-request' ofhttps://gitlab.com/birkelund/qemu  into 
staging (2023-08-08 16:39:20 -0700)

are available in the Git repository at:

   https://gitlab.com/birkelund/qemu.git  tags/nvme-fixes-pull-request

for you to fetch changes up to 3439ba9c5da943d96f7a3c86e0a7eb2ff48de41c:

   hw/nvme: fix null pointer access in ruh update (2023-08-09 15:32:32 +0200)


hw/nvme: fixes


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL v2] hw/nvme fixes

2023-08-08 Thread Richard Henderson

On 8/8/23 06:35, Klaus Jensen wrote:

From: Klaus Jensen

Hi,

There was a small typo in the last pull. This replaces it.

The following changes since commit 0450cf08976f9036feaded438031b4cba94f6452:

   Merge tag 'fixes-pull-request' ofhttps://gitlab.com/marcandre.lureau/qemu  
into staging (2023-08-07 13:55:00 -0700)

are available in the Git repository at:

   https://gitlab.com/birkelund/qemu.git  tags/nvme-next-pull-request

for you to fetch changes up to ec5a138ce63ce460575a44cf9ec3172c33eb0fd6:

   docs: update hw/nvme documentation for protection information (2023-08-08 
15:28:05 +0200)


hw/nvme fixes


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 0/2] hw/nvme fixes

2023-08-07 Thread Richard Henderson

On 8/7/23 04:54, Klaus Jensen wrote:

From: Klaus Jensen

Hi,

The following changes since commit 9400601a689a128c25fa9c21e932562e0eeb7a26:

   Merge tag 'pull-tcg-20230806-3' ofhttps://gitlab.com/rth7680/qemu  into 
staging (2023-08-06 16:47:48 -0700)

are available in the Git repository at:

   https://gitlab.com/birkelund/qemu.git  tags/nvme-next-pull-request

for you to fetch changes up to 6a33f2e920ec0b489a77200888e3692664077f2d:

   hw/nvme: fix compliance issue wrt. iosqes/iocqes (2023-08-07 12:27:24 +0200)


hw/nvme fixes


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL for-8.1 0/2] Block patches

2023-08-03 Thread Richard Henderson

On 8/3/23 08:55, Stefan Hajnoczi wrote:

The following changes since commit 9ba37026fcf6b7f3f096c0cca3e1e7307802486b:

   Update version for v8.1.0-rc2 release (2023-08-02 08:22:45 -0700)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git  tags/block-pull-request

for you to fetch changes up to 9b06d0d076271d76e5384d767ef94a676f0a9efd:

   block/blkio: add more comments on the fd passing handling (2023-08-03 
11:28:43 -0400)


Pull request

Fix for an fd leak in the blkio block driver.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/10] Misc fixes for 2023-08-01

2023-08-02 Thread Richard Henderson

On 8/1/23 14:54, Philippe Mathieu-Daudé wrote:

The following changes since commit 802341823f1720511dd5cf53ae40285f7978c61b:

   Merge tag 'pull-tcg-20230731' ofhttps://gitlab.com/rth7680/qemu  into 
staging (2023-07-31 14:02:51 -0700)

are available in the Git repository at:

   https://github.com/philmd/qemu.git  tags/misc-fixes-20230801

for you to fetch changes up to 8caaae7319a5f7ca449900c0e6bfcaed78fa3ae2:

   target/m68k: Fix semihost lseek offset computation (2023-08-01 23:52:23 
+0200)


Misc patches queue

xen: Fix issues reported by fuzzer / Coverity
misc: Fix some typos in documentation and comments
ui/dbus: Build fixes for Clang/win32/!opengl
linux-user: Semihosting fixes on m68k/nios2
tests/migration: Disable stack protector when linking without stdlib


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 0/1] hw/nvme fixes

2023-07-31 Thread Richard Henderson

On 7/30/23 12:29, Klaus Jensen wrote:

From: Klaus Jensen

Hi,

This should also fix coverity cid 1518067 and 1518066.

The following changes since commit ccb86f079a9e4d94918086a9df18c1844347aff8:

   Merge tag 'pull-nbd-2023-07-28' ofhttps://repo.or.cz/qemu/ericb  into 
staging (2023-07-28 09:56:57 -0700)

are available in the Git repository at:

   https://gitlab.com/birkelund/qemu.git  tags/nvme-next-pull-request

for you to fetch changes up to c1e244b6552efdff5612a33c6630aaf95964eaf5:

   hw/nvme: use stl/ldl pci dma api (2023-07-30 20:09:54 +0200)


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL for-8.1 0/8] Block patches

2023-07-28 Thread Richard Henderson

On 7/27/23 13:00, Stefan Hajnoczi wrote:

The following changes since commit 66547f416a61e0cb711dc76821890242432ba193:

   block/nvme: invoke blk_io_plug_call() outside q->lock (2023-07-17 09:17:41 
-0400)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 1c38fe69e2b8a05c1762b122292fa7e3662f06fd:

   block/blkio: use blkio_set_int("fd") to check fd support (2023-07-27 
15:51:46 -0400)


Pull request

Please include these bug fixes in QEMU 8.1. Thanks!


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~






Hanna Czenczek (1):
   block: Fix pad_request's request restriction

Sam Li (1):
   block/file-posix: fix g_file_get_contents return path

Stefano Garzarella (6):
   block/blkio: enable the completion eventfd
   block/blkio: do not use open flags in qemu_open()
   block/blkio: move blkio_connect() in the drivers functions
   block/blkio: retry blkio_connect() if it fails using `fd`
   block/blkio: fall back on using `path` when `fd` setting fails
   block/blkio: use blkio_set_int("fd") to check fd support

  block/blkio.c  | 132 ++---
  block/file-posix.c |   6 +--
  block/io.c |   8 ++-
  3 files changed, 97 insertions(+), 49 deletions(-)






Re: [PULL for-8.1 0/1] Block patches

2023-07-17 Thread Richard Henderson

On 7/17/23 15:37, Stefan Hajnoczi wrote:

The following changes since commit ed8ad9728a9c0eec34db9dff61dfa2f1dd625637:

   Merge tag 'pull-tpm-2023-07-14-1' ofhttps://github.com/stefanberger/qemu-tpm 
 into staging (2023-07-15 14:54:04 +0100)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git  tags/block-pull-request

for you to fetch changes up to 66547f416a61e0cb711dc76821890242432ba193:

   block/nvme: invoke blk_io_plug_call() outside q->lock (2023-07-17 09:17:41 
-0400)


Pull request

Fix the hang in the nvme:// block driver during startup.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 0/1] Block patches

2023-07-14 Thread Richard Henderson

On 7/12/23 20:36, Stefan Hajnoczi wrote:

The following changes since commit 887cba855bb6ff4775256f7968409281350b568c:

   configure: Fix cross-building for RISCV host (v5) (2023-07-11 17:56:09 +0100)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 75dcb4d790bbe5327169fd72b185960ca58e2fa6:

   virtio-blk: fix host notifier issues during dataplane start/stop (2023-07-12 
15:20:32 -0400)


Pull request



Stefan Hajnoczi (1):
   virtio-blk: fix host notifier issues during dataplane start/stop

  hw/block/dataplane/virtio-blk.c | 67 +++--
  1 file changed, 38 insertions(+), 29 deletions(-)



Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 0/1] Block patches

2023-07-06 Thread Richard Henderson

On 7/4/23 16:29, Stefan Hajnoczi wrote:

The following changes since commit d145c0da22cde391d8c6672d33146ce306e8bf75:

   Merge tag 'pull-tcg-20230701' ofhttps://gitlab.com/rth7680/qemu  into 
staging (2023-07-01 08:55:37 +0200)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git  tags/block-pull-request

for you to fetch changes up to c21eae1ccc782440f320accb6f90c66cb8f45ee9:

   block/blkio: fix module_block.py parsing (2023-07-04 17:28:25 +0200)


Pull request

Fix --enable-modules with the blkio block driver.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/23] Block layer patches

2023-06-29 Thread Richard Henderson

On 6/28/23 16:15, Kevin Wolf wrote:

The following changes since commit 52ed34cbddde1cb89b2ac263e758e349a77f21e1:

   Merge tag 'pull-request-2023-06-26' ofhttps://gitlab.com/thuth/qemu  into 
staging (2023-06-26 10:38:41 +0200)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git  tags/for-upstream

for you to fetch changes up to 17362398ee1a7f04e8006a46333145d8b707fd35:

   block: use bdrv_co_debug_event in coroutine context (2023-06-28 09:46:34 
+0200)


Block layer patches

- Re-enable the graph lock
- More fixes to coroutine_fn marking


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~





Re: [PULL 0/7] hw/nvme updates

2023-06-28 Thread Richard Henderson

On 6/28/23 11:24, Klaus Jensen wrote:

From: Klaus Jensen

Hi,

The following changes since commit 4329d049d5b8d4af71c6b399d64a6d1b98856318:

   Merge tag 'pull-tcg-20230626' ofhttps://gitlab.com/rth7680/qemu  into 
staging (2023-06-26 17:40:38 +0200)

are available in the Git repository at:

   https://gitlab.com/birkelund/qemu.git  tags/nvme-next-pull-request

for you to fetch changes up to e409c9057b55e890a6e5f70386a36932a5137bcf:

   docs: update hw/nvme documentation for TP4146 (2023-06-28 11:22:49 +0200)


hw/nvme updates

Small set of fixes and some updates for the FDP support.
-BEGIN PGP SIGNATURE-


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/30] Next patches

2023-06-26 Thread Richard Henderson

On 6/26/23 15:05, Juan Quintela wrote:

The "full logs" are

https://gitlab.com/qemu-project/qemu/-/jobs/4527202764/artifacts/download?file_type=trace


Not useful.  I was hoping that there is something like when one runs
./tests/qtest/migration-test


I thought I saw some patch today that to save more artifacts.

But the bottom line is that we don't emit enough stuff from any of our tests to debug them 
from logs -- we're too used to using other methods.



   And I don't understand what CFI is (and I don't rule out that
   posibility) or I can't understand how checking indirect functions call
   can make migration-test die without a single CFI error message?


CFI (control flow inspection/validation/somesuch) adds checking along call paths, which 
may affect timing.


This is almost certainly some sort of race condition.


Do we have a way to run on that image:

./tests/qtest/migration-test

in a loop until it fails, and at least see what test is failing?


Not as is, no.  You'd have to create a new CI job, and for that you'll need advice beyond 
myself.



r~




Re: [PULL 00/30] Next patches

2023-06-26 Thread Richard Henderson

On 6/26/23 00:01, Juan Quintela wrote:

Richard Henderson  wrote:

On 6/22/23 18:54, Juan Quintela wrote:

The following changes since commit b455ce4c2f300c8ba47cba7232dd03261368a4cb:
Merge tag 'q800-for-8.1-pull-request'
ofhttps://github.com/vivier/qemu-m68k  into staging (2023-06-22
10:18:32 +0200)
are available in the Git repository at:
https://gitlab.com/juan.quintela/qemu.git  tags/next-pull-request
for you to fetch changes up to
23e4307eadc1497bd0a11ca91041768f15963b68:
migration/rdma: Split qemu_fopen_rdma() into input/output
functions (2023-06-22 18:11:58 +0200)

Migration Pull request (20230621) take 2
In this pull request the only change is fixing 32 bits complitaion
issue.
Please apply.
[take 1]
- fix for multifd thread creation (fabiano)
- dirtylimity (hyman)
* migration-test will go on next PULL request, as it has failures.
- Improve error description (tejus)
- improve -incoming and set parameters before calling incoming (wei)
- migration atomic counters reviewed patches (quintela)
- migration-test refacttoring reviewed (quintela)


New failure with check-cfi-x86_64:

https://gitlab.com/qemu-project/qemu/-/jobs/4527202764#L188


First of all, is there a way to get to the test log?  In particular, I
am interested in knowing at least what test has failed (yes,
migration-test don't tell you much more).

After a bit more wrestling, I have been able to get things compiling
with this command:

$ /mnt/code/qemu/full/configure --enable-cfi
--target-list=x86_64-softmmu --enable-cfi-debug --cc=clang --cxx=clang++
--disable-docs --enable-safe-stack --disable-slirp

It should basically be the one that check-cfi-x86_64 is using if I
understand the build recipes correctly (that is a BIG IF).

And it passes for me with flying colors.
Here I have Fedora38, builder has F37.


/builds/qemu-project/qemu/build/pyvenv/bin/meson test  --no-rebuild -t
0  --num-processes 1 --print-errorlogs
   1/350 qemu:qtest+qtest-x86_64 / qtest-x86_64/qom-test
   OK 6.55s   8 subtests passed
▶   2/350 ERROR:../tests/qtest/migration-test.c:320:check_guests_ram:
assertion failed: (bad == 0) ERROR
   2/350 qemu:qtest+qtest-x86_64 / qtest-x86_64/migration-test
   ERROR 151.99s   killed by signal 6 SIGABRT



 G_TEST_DBUS_DAEMON=/builds/qemu-project/qemu/tests/dbus-vmstate-daemon.sh
 MALLOC_PERTURB_=3 QTEST_QEMU_IMG=./qemu-img
 QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon
 QTEST_QEMU_BINARY=./qemu-system-x86_64
 /builds/qemu-project/qemu/build/tests/qtest/migration-test --tap
-k
― ✀  ―
stderr:
qemu-system-x86_64: Unable to read from socket: Connection reset by peer


This is the interesting bit, why is the conection closed.


Memory content inconsistency at 4f65000 first_byte = 30 last_byte = 2f
current = 88 hit_edge = 1
**
ERROR:../tests/qtest/migration-test.c:320:check_guests_ram: assertion failed: 
(bad == 0)

(test program exited with status code -6)


This makes zero sense, except if we haven't migrated all the guest
state, that it is what it has happened.

Is there a place on the web interface to see the full logs?  Or that is
the only thing that the CI system stores?


The "full logs" are

https://gitlab.com/qemu-project/qemu/-/jobs/4527202764/artifacts/download?file_type=trace


r~



Re: [PULL 00/30] Next patches

2023-06-22 Thread Richard Henderson

On 6/22/23 18:54, Juan Quintela wrote:

The following changes since commit b455ce4c2f300c8ba47cba7232dd03261368a4cb:

   Merge tag 'q800-for-8.1-pull-request' ofhttps://github.com/vivier/qemu-m68k  
into staging (2023-06-22 10:18:32 +0200)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git  tags/next-pull-request

for you to fetch changes up to 23e4307eadc1497bd0a11ca91041768f15963b68:

   migration/rdma: Split qemu_fopen_rdma() into input/output functions 
(2023-06-22 18:11:58 +0200)


Migration Pull request (20230621) take 2

In this pull request the only change is fixing 32 bits complitaion issue.

Please apply.

[take 1]
- fix for multifd thread creation (fabiano)
- dirtylimity (hyman)
   * migration-test will go on next PULL request, as it has failures.
- Improve error description (tejus)
- improve -incoming and set parameters before calling incoming (wei)
- migration atomic counters reviewed patches (quintela)
- migration-test refacttoring reviewed (quintela)


New failure with check-cfi-x86_64:

https://gitlab.com/qemu-project/qemu/-/jobs/4527202764#L188

/builds/qemu-project/qemu/build/pyvenv/bin/meson test  --no-rebuild -t 0  --num-processes 
1 --print-errorlogs
  1/350 qemu:qtest+qtest-x86_64 / qtest-x86_64/qom-test   OK 
6.55s   8 subtests passed
▶   2/350 ERROR:../tests/qtest/migration-test.c:320:check_guests_ram: assertion failed: 
(bad == 0) ERROR
  2/350 qemu:qtest+qtest-x86_64 / qtest-x86_64/migration-test ERROR 
151.99s   killed by signal 6 SIGABRT
>>> G_TEST_DBUS_DAEMON=/builds/qemu-project/qemu/tests/dbus-vmstate-daemon.sh 
MALLOC_PERTURB_=3 QTEST_QEMU_IMG=./qemu-img 
QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon 
QTEST_QEMU_BINARY=./qemu-system-x86_64 
/builds/qemu-project/qemu/build/tests/qtest/migration-test --tap -k

― ✀  ―
stderr:
qemu-system-x86_64: Unable to read from socket: Connection reset by peer
Memory content inconsistency at 4f65000 first_byte = 30 last_byte = 2f current = 88 
hit_edge = 1

**
ERROR:../tests/qtest/migration-test.c:320:check_guests_ram: assertion failed: 
(bad == 0)

(test program exited with status code -6)
――


r~



Re: [PULL 00/30] Next patches

2023-06-21 Thread Richard Henderson

On 6/22/23 04:12, Juan Quintela wrote:

The following changes since commit 67fe6ae41da64368bc4936b196fee2bf61f8c720:

   Merge tag 'pull-tricore-20230621-1' ofhttps://github.com/bkoppelmann/qemu  
into staging (2023-06-21 20:08:48 +0200)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git  tags/next-pull-request

for you to fetch changes up to c53dc569d0a0fb76eaa83f353253a897914948f9:

   migration/rdma: Split qemu_fopen_rdma() into input/output functions 
(2023-06-22 02:45:30 +0200)


Migration Pull request (20230621)

In this pull request:

- fix for multifd thread creation (fabiano)
- dirtylimity (hyman)
   * migration-test will go on next PULL request, as it has failures.
- Improve error description (tejus)
- improve -incoming and set parameters before calling incoming (wei)
- migration atomic counters reviewed patches (quintela)
- migration-test refacttoring reviewed (quintela)

Please apply.


You really need to test at least one 32-bit host regularly.
It should be trivial for you to do an i686 build somewhere.

https://gitlab.com/qemu-project/qemu/-/jobs/4518975360#L4817
https://gitlab.com/qemu-project/qemu/-/jobs/4518975263#L3486
https://gitlab.com/qemu-project/qemu/-/jobs/4518975261#L3145
https://gitlab.com/qemu-project/qemu/-/jobs/4518975298#L3372
https://gitlab.com/qemu-project/qemu/-/jobs/4518975301#L3221

../softmmu/dirtylimit.c:558:58: error: format specifies type 'long' but the argument has 
type 'int64_t' (aka 'long long') [-Werror,-Wformat]

error_setg(, "invalid dirty page limit %ld", dirty_rate);
   ~~~   ^~
   %lld


r~



Re: [PATCH v3 8/9] meson: Replace CONFIG_SOFTMMU -> CONFIG_SYSTEM_ONLY

2023-06-13 Thread Richard Henderson

On 6/13/23 15:33, Philippe Mathieu-Daudé wrote:

Since we*might*  have user emulation with softmmu,
use the clearer 'CONFIG_SYSTEM_ONLY' key to check
for system emulation.

Signed-off-by: Philippe Mathieu-Daudé
---
  meson.build| 4 ++--
  accel/qtest/meson.build| 2 +-
  accel/stubs/meson.build| 2 +-
  accel/tcg/meson.build  | 6 +++---
  dump/meson.build   | 2 +-
  hw/i386/kvm/meson.build| 2 +-
  migration/meson.build  | 2 +-
  monitor/meson.build| 2 +-
  qapi/meson.build   | 2 +-
  semihosting/meson.build| 2 +-
  softmmu/meson.build| 4 ++--
  target/i386/tcg/sysemu/meson.build | 2 +-
  ui/meson.build | 4 ++--
  13 files changed, 18 insertions(+), 18 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v3 7/9] meson: Alias CONFIG_SOFTMMU -> CONFIG_SYSTEM_ONLY

2023-06-13 Thread Richard Henderson

On 6/13/23 15:33, Philippe Mathieu-Daudé wrote:

We use the CONFIG_USER_ONLY key to describe user emulation,
and the CONFIG_SOFTMMU key to describe system emulation. Alias
it as 'CONFIG_SYSTEM_ONLY' for parity with user emulation.

Signed-off-by: Philippe Mathieu-Daudé
---
  meson.build | 1 +
  1 file changed, 1 insertion(+)


Reviewed-by: Richard Henderson 

r~



Re: [PATCH v3 1/9] target/i386: Simplify i386_tr_init_disas_context()

2023-06-13 Thread Richard Henderson

On 6/13/23 15:33, Philippe Mathieu-Daudé wrote:

Since cpu_mmu_index() is well-defined for user-only,
we can remove the surrounding #ifdef'ry entirely.

Suggested-by: Richard Henderson
Signed-off-by: Philippe Mathieu-Daudé
---
  target/i386/tcg/translate.c | 3 ---
  1 file changed, 3 deletions(-)


Reviewed-by: Richard Henderson 

r~



Re: [PULL 00/17] Misc patches for 2023-06-13

2023-06-13 Thread Richard Henderson

On 6/13/23 11:38, Philippe Mathieu-Daudé wrote:

Misc patches, some accumulated since too long.

The following changes since commit fdd0df5340a8ebc8de88078387ebc85c5af7b40f:

   Merge tag 'pull-ppc-20230610' ofhttps://gitlab.com/danielhb/qemu  into 
staging (2023-06-10 07:25:00 -0700)

are available in the Git repository at:

   https://github.com/philmd/qemu.git  tags/misc-20230613

for you to fetch changes up to b0182e537e5aba38031a5009cb16d5e924342458:

   exec/memory: Introduce RAM_NAMED_FILE flag (2023-06-13 11:28:58 +0200)


Misc patches queue

- user emulation: Preserve environment variable order
- macos/darwin/hvf: Fix build warnings, slighly optimize DCache flush
- target/i386: Minor cleanups, rename  template headers with '.inc' suffix
- target/hppa: Avoid building int_helper.o on user emulation
- hw: Add 'name' property to pca954x, export ISAParallelState, silent warnings
- hw/vfio: Trace number of bitmap dirty pages
- exec/memory: Introduce RAM_NAMED_FILE to distinct block without named backing 
store


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PATCH] iotests: fix 194: filter out racy postcopy-active event

2023-06-07 Thread Richard Henderson

On 6/7/23 07:36, Vladimir Sementsov-Ogievskiy wrote:

The event is racy: it will not appear in the output if bitmap is
migrated during downtime period of migration and postcopy phase is not
started.

Fixes: ae00aa239847 "iotests: 194: test also migration of dirty bitmap"
Reported-by: Richard Henderson 
Signed-off-by: Vladimir Sementsov-Ogievskiy 


Queued and applied.


r~



Re: [PATCH v2 5/5] bulk: Replace __attribute__((noreturn)) -> G_NORETURN

2023-06-05 Thread Richard Henderson

On 6/5/23 10:56, Philippe Mathieu-Daudé wrote:

-static __attribute__((noreturn)) void exit_failure(void)
+static G_NORETURN void exit_failure(void)


I think attr-spec-seq ('[[noreturn]]') has to come before specifiers-and-qualifiers (i.e. 
'static').


To me this means that G_NORETURN being redefined from __attribute__((noreturn)) to 
[[noreturn]] was a glib bug, since it has a different syntax.


Therefore we should simply avoid G_NORETURN entirely.  At some point we should be able to 
update -to --std=c23, at which point we use [[noreturn]] directly and not G_NORETURN anyway.



r~



Re: [PATCH v2 2/5] tcg/tcg-op-vec: Remove left over _link_error() definitions

2023-06-05 Thread Richard Henderson

On 6/5/23 10:56, Philippe Mathieu-Daudé wrote:

In commit d56fea79f9 ("tcg: Move TCG_{LOW,HIGH} to tcg-internal.h")
we replaced the "_link_error" definitions with modern QEMU_ERROR()
attribute markup. We covered tcg-op.c but forgot to completely
clean tcg-op-vec.c. Do it now.

Signed-off-by: Philippe Mathieu-Daudé
---
  tcg/tcg-op-vec.c | 11 ---
  1 file changed, 11 deletions(-)


Reviewed-by: Richard Henderson 

and applied to tcg-next.


r~



Re: [PATCH v2 1/5] util/cacheflush: Use declarations from on Darwin

2023-06-05 Thread Richard Henderson

On 6/5/23 10:56, Philippe Mathieu-Daudé wrote:

Per the cache(3) man page, sys_icache_invalidate() and
sys_dcache_flush() are declared in .

Signed-off-by: Philippe Mathieu-Daudé
---
  util/cacheflush.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


Reviewed-by: Richard Henderson 

I'll note that a comment in OSCacheControl.h says that sys_icache_invalidate performs both 
dcache and icache flush, and so we don't need to call sys_dcache_flush.



r~



Re: [PULL 00/17] Block patches

2023-06-05 Thread Richard Henderson

On 6/5/23 08:45, Hanna Czenczek wrote:

The following changes since commit 848a6caa88b9f082c89c9b41afa975761262981d:

   Merge tag 'migration-20230602-pull-request' 
ofhttps://gitlab.com/juan.quintela/qemu  into staging (2023-06-02 17:33:29 
-0700)

are available in the Git repository at:

   https://gitlab.com/hreitz/qemu.git  tags/pull-block-2023-06-05

for you to fetch changes up to 42a2890a76f4783cd1c212f27856edcf2b5e8a75:

   qcow2: add discard-no-unref option (2023-06-05 13:15:42 +0200)


Block patches

- Fix padding of unaligned vectored requests to match the host alignment
   for vectors with 1023 or 1024 buffers
- Refactor and fix bugs in parallels's image check functionality
- Add an option to the qcow2 driver to retain (qcow2-level) allocations
   on discard requests from the guest (while still forwarding the discard
   to the lower level and marking the range as zero)


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PATCH 0/2] bulk: Remove pointless QOM casts

2023-06-01 Thread Richard Henderson

On 6/1/23 02:34, Philippe Mathieu-Daudé wrote:

As per Markus suggestion in [*], use Coccinelle to remove
pointless QOM cast macro uses. Since we have more than 1000
QOM types, add a script to generate the semantic patch.

[*]https://lore.kernel.org/qemu-devel/87mt1jafjt@pond.sub.org/

Philippe Mathieu-Daudé (2):
   scripts: Add qom-cast-macro-clean-cocci-gen.py
   bulk: Remove pointless QOM casts


Cool!

Reviewed-by: Richard Henderson 


r~



Re: [PULL 0/5] Python patches

2023-05-31 Thread Richard Henderson

On 5/31/23 13:43, John Snow wrote:

The following changes since commit ab7252279727da51c01cdaf41c5fe563bbded3a6:

   gitlab: switch from 'stable' to 'latest' docker container tags (2023-05-31 
10:29:14 -0700)

are available in the Git repository at:

   https://gitlab.com/jsnow/qemu.git  tags/python-pull-request

for you to fetch changes up to c76e7652c786683edcc846ee0a7a65b587787792:

   Revert "python/qmp/protocol: add open_with_socket()" (2023-05-31 16:25:35 
-0400)


Python: synchronize python-qemu-qmp


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/32] Block layer patches

2023-05-30 Thread Richard Henderson

On 5/30/23 09:32, Kevin Wolf wrote:

The following changes since commit aa9bbd865502ed517624ab6fe7d4b5d89ca95e43:

   Merge tag 'pull-ppc-20230528' ofhttps://gitlab.com/danielhb/qemu  into 
staging (2023-05-29 14:31:52 -0700)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git  tags/for-upstream

for you to fetch changes up to 60f782b6b78211c125970768be726c9f380dbd61:

   aio: remove aio_disable_external() API (2023-05-30 17:37:26 +0200)


Block layer patches

- Fix blockdev-create with iothreads
- Remove aio_disable_external() API


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files

2023-05-30 Thread Richard Henderson

On 5/30/23 10:06, Juan Quintela wrote:

Richard Henderson  wrote:

On 5/30/23 05:28, Juan Quintela wrote:

This was the only caller for read only files.  So change the test for
an assert in qemu_fflush().



Not a fan, as fflush(stdin) is well-defined.


I guess you mean this:

For input streams associated with seekable files (e.g., disk files, but
not pipes or terminals), fflush() discards any buffered data  that  has
been fetched from the underlying file, but has not been consumed by the
application.


Yes, in that, importantly, it does not assert.



Two things:
- Current code just do nothing for imput streams
- We only call it from qemu_fclose()


Pardon?  There are nearly 30 calls to qemu_fflush.


- If we drop anything from the input stream, migration get broken.


I'm not talking about dropping anything.  Obviously QEMUFile works different from stdio, 
and therefore resetting the file state to that of the unbuffered data is not relevant.




r~



Re: [PATCH 04/16] qemu-file: Don't call qemu_fflush() for read only files

2023-05-30 Thread Richard Henderson

On 5/30/23 05:28, Juan Quintela wrote:

This was the only caller for read only files.  So change the test for
an assert in qemu_fflush().



Not a fan, as fflush(stdin) is well-defined.


r~



Re: io-qcow2 failures on zfs

2023-05-26 Thread Richard Henderson

On 5/26/23 01:02, Thomas Huth wrote:

What output do you get when running the tests directly? i.e.:

cd tests/qemu-iotests/
./check -qcow2 150


 === Mapping non-sparse conversion ===

 Offset  Length  File
-0   0x10TEST_DIR/t.IMGFMT
+0   0x1 TEST_DIR/t.IMGFMT



./check -qcow2 copy-before-write


+==
+FAIL: test_timeout_break_guest (__main__.TestCbwError)
+--
+Traceback (most recent call last):
+  File "/home/richard.henderson/qemu/src/tests/qemu-iotests/tests/copy-before-write", 
line 200, in test_timeout_break_guest

+self.assertEqual(log, """\
+AssertionError: 'write failed: Connection timed out\nwrite f[121 chars]c)\n' != 'wrote 
524288/524288 bytes at offset 0\n512 [182 chars]c)\n'




./check -qcow2 244


-[{ "start": 0, "length": 2097152, "depth": 0, "present": true, "zero": false, "data": 
true, "offset": 0},
+[{ "start": 0, "length": 1048576, "depth": 0, "present": true, "zero": true, "data": 
true, "offset": 0},
+{ "start": 1048576, "length": 1048576, "depth": 0, "present": true, "zero": false, 
"data": true, "offset": 1048576},
 { "start": 2097152, "length": 2097152, "depth": 0, "present": true, "zero": true, 
"data": false},
 { "start": 4194304, "length": 2097152, "depth": 0, "present": true, "zero": true, 
"data": false, "offset": 4194304},
-{ "start": 6291456, "length": 60817408, "depth": 0, "present": true, "zero": false, 
"data": true, "offset": 6291456}]
+{ "start": 6291456, "length": 60817408, "depth": 0, "present": true, "zero": true, 
"data": true, "offset": 6291456}]



r~



Re: [PATCH 09/11] hw/virtio: Remove unnecessary 'virtio-access.h' header

2023-05-23 Thread Richard Henderson

On 5/23/23 09:35, Philippe Mathieu-Daudé wrote:

None of these files use the VirtIO Load/Store API declared
by "hw/virtio/virtio-access.h". This header probably crept
in via copy/pasting, remove it.

Note, "virtio-access.h" is target-specific, so any file
including it also become tainted as target-specific.

Signed-off-by: Philippe Mathieu-Daudé
---


Acked-by: Richard Henderson 

r~



Re: [PATCH 01/11] softmmu: Introduce qemu_target_page_mask/qemu_target_page_align helpers

2023-05-23 Thread Richard Henderson

On 5/23/23 09:35, Philippe Mathieu-Daudé wrote:

+unsigned qemu_target_page_mask(void);


Should be signed int, so that it sign-extends to whatever needed width.

r~



Re: [PULL v3 00/21] Block layer patches

2023-05-22 Thread Richard Henderson

On 5/22/23 00:45, Kevin Wolf wrote:

Am 19.05.2023 um 21:11 hat Richard Henderson geschrieben:

On 5/19/23 10:18, Kevin Wolf wrote:

The following changes since commit d009607d08d22f91ca399b72828c6693855e7325:

Revert "arm/kvm: add support for MTE" (2023-05-19 08:01:15 -0700)

are available in the Git repository at:

https://repo.or.cz/qemu/kevin.git  tags/for-upstream

for you to fetch changes up to 95fdd8db61848d31fde1d9b32da7f3f76babfa25:

iotests: Test commit with iothreads and ongoing I/O (2023-05-19 19:16:53 
+0200)


Block layer patches

- qcow2 spec: Rename "zlib" compression to "deflate"
- Honour graph read lock even in the main thread + prerequisite fixes
- aio-posix: do not nest poll handlers (fixes infinite recursion)
- Refactor QMP blockdev transactions
- graph-lock: Disable locking for now
- iotests/245: Check if 'compress' driver is available


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as
appropriate.


Hm, I just pulled, and it doesn't seem to be actually there in master?


I dunno what happened.  Applied for real this time.


r~




Re: [PULL v3 00/21] Block layer patches

2023-05-19 Thread Richard Henderson

On 5/19/23 10:18, Kevin Wolf wrote:

The following changes since commit d009607d08d22f91ca399b72828c6693855e7325:

   Revert "arm/kvm: add support for MTE" (2023-05-19 08:01:15 -0700)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git  tags/for-upstream

for you to fetch changes up to 95fdd8db61848d31fde1d9b32da7f3f76babfa25:

   iotests: Test commit with iothreads and ongoing I/O (2023-05-19 19:16:53 
+0200)


Block layer patches

- qcow2 spec: Rename "zlib" compression to "deflate"
- Honour graph read lock even in the main thread + prerequisite fixes
- aio-posix: do not nest poll handlers (fixes infinite recursion)
- Refactor QMP blockdev transactions
- graph-lock: Disable locking for now
- iotests/245: Check if 'compress' driver is available


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.

Though there seem to be existing io errors in several different environments, they don't 
seem to be caused by this patch set.



r~




Re: [PULL v3 00/21] Block layer patches

2023-05-19 Thread Richard Henderson

On 5/19/23 10:18, Kevin Wolf wrote:

The following changes since commit d009607d08d22f91ca399b72828c6693855e7325:

   Revert "arm/kvm: add support for MTE" (2023-05-19 08:01:15 -0700)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 95fdd8db61848d31fde1d9b32da7f3f76babfa25:

   iotests: Test commit with iothreads and ongoing I/O (2023-05-19 19:16:53 
+0200)


Block layer patches

- qcow2 spec: Rename "zlib" compression to "deflate"
- Honour graph read lock even in the main thread + prerequisite fixes
- aio-posix: do not nest poll handlers (fixes infinite recursion)
- Refactor QMP blockdev transactions
- graph-lock: Disable locking for now
- iotests/245: Check if 'compress' driver is available


Akihiro Suda (1):
   docs/interop/qcow2.txt: fix description about "zlib" clusters

Kevin Wolf (12):
   block: Call .bdrv_co_create(_opts) unlocked
   block/export: Fix null pointer dereference in error path
   qcow2: Unlock the graph in qcow2_do_open() where necessary
   qemu-img: Take graph lock more selectively
   test-bdrv-drain: Take graph lock more selectively
   test-bdrv-drain: Call bdrv_co_unref() in coroutine context
   blockjob: Adhere to rate limit even when reentered early
   graph-lock: Honour read locks even in the main thread
   iotests/245: Check if 'compress' driver is available
   graph-lock: Disable locking for now
   nbd/server: Fix drained_poll to wake coroutine in right AioContext
   iotests: Test commit with iothreads and ongoing I/O

Stefan Hajnoczi (2):
   aio-posix: do not nest poll handlers
   tested: add test for nested aio_poll() in poll handlers

Vladimir Sementsov-Ogievskiy (6):
   blockdev: refactor transaction to use Transaction API
   blockdev: transactions: rename some things
   blockdev: qmp_transaction: refactor loop to classic for
   blockdev: transaction: refactor handling transaction properties
   blockdev: use state.bitmap in block-dirty-bitmap-add action
   blockdev: qmp_transaction: drop extra generic layer


Test failure:

https://gitlab.com/qemu-project/qemu/-/jobs/4317480370#L3347

194  fail   [18:42:03] [18:42:05]   1.2s output mismatch 
(see /builds/qemu-project/qemu/build/tests/qemu-iotests/scratch/raw-file-194/194.out.bad)

--- /builds/qemu-project/qemu/tests/qemu-iotests/194.out
+++ 
/builds/qemu-project/qemu/build/tests/qemu-iotests/scratch/raw-file-194/194.out.bad
@@ -14,7 +14,6 @@
 {"return": {}}
 {"data": {"status": "setup"}, "event": "MIGRATION", "timestamp": {"microseconds": 
"USECS", "seconds": "SECS"}}
 {"data": {"status": "active"}, "event": "MIGRATION", "timestamp": {"microseconds": 
"USECS", "seconds": "SECS"}}
-{"data": {"status": "postcopy-active"}, "event": "MIGRATION", "timestamp": 
{"microseconds": "USECS", "seconds": "SECS"}}
 {"data": {"status": "completed"}, "event": "MIGRATION", "timestamp": {"microseconds": 
"USECS", "seconds": "SECS"}}

 Gracefully ending the `drive-mirror` job on source...


r~



Re: [PULL v2 00/21] Block layer patches

2023-05-19 Thread Richard Henderson

On 5/19/23 03:50, Kevin Wolf wrote:

The following changes since commit 6972ef1440a9d685482d78672620a7482f2bd09a:

   Merge tag 'pull-tcg-20230516-3' of https://gitlab.com/rth7680/qemu into 
staging (2023-05-16 21:30:27 -0700)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to c1bc2467c25ae2b846eeb5d338d1c697c6f83833:

   iotests: Test commit with iothreads and ongoing I/O (2023-05-19 11:32:19 
+0200)


Block layer patches

- qcow2 spec: Rename "zlib" compression to "deflate"
- Honour graph read lock even in the main thread + prerequisite fixes
- aio-posix: do not nest poll handlers (fixes infinite recursion)
- Refactor QMP blockdev transactions
- graph-lock: Disable locking for now
- iotests/245: Check if 'compress' driver is available


Build failure:

https://gitlab.com/qemu-project/qemu/-/jobs/4316574356#L3199


../block/graph-lock.c: In function ‘assert_bdrv_graph_readable’:
../block/graph-lock.c:278:37: error: implicit declaration of function ‘reader_count’ 
[-Werror=implicit-function-declaration]

  278 | assert(qemu_in_main_thread() || reader_count());
  | ^~~~
../block/graph-lock.c:278:37: error: nested extern declaration of ‘reader_count’ 
[-Werror=nested-externs]



r~




Re: [PULL 18/18] tested: add test for nested aio_poll() in poll handlers

2023-05-17 Thread Richard Henderson

On 5/17/23 09:51, Kevin Wolf wrote:

From: Stefan Hajnoczi 

Signed-off-by: Stefan Hajnoczi 
Message-Id: <20230502184134.534703-3-stefa...@redhat.com>
Tested-by: Kevin Wolf 
Signed-off-by: Kevin Wolf 
---
  tests/unit/test-nested-aio-poll.c | 130 ++
  tests/unit/meson.build|   1 +
  2 files changed, 131 insertions(+)
  create mode 100644 tests/unit/test-nested-aio-poll.c


This new test fails on windows:

https://gitlab.com/qemu-project/qemu/-/jobs/4304413315#L3375
https://gitlab.com/qemu-project/qemu/-/jobs/4304413313#L3357


r~



Re: [PULL v2 00/16] Block patches

2023-05-15 Thread Richard Henderson

On 5/15/23 09:04, Stefan Hajnoczi wrote:

The following changes since commit 8844bb8d896595ee1d25d21c770e6e6f29803097:

   Merge tag 'or1k-pull-request-20230513' ofhttps://github.com/stffrdhrn/qemu  
into staging (2023-05-13 11:23:14 +0100)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git  tags/block-pull-request

for you to fetch changes up to 01562fee5f3ad4506d57dbcf4b1903b565eceec7:

   docs/zoned-storage:add zoned emulation use case (2023-05-15 08:19:04 -0400)


Pull request

This pull request contain's Sam Li's zoned storage support in the QEMU block
layer and virtio-blk emulation.

v2:
- Sam fixed the CI failures. CI passes for me now. [Richard]


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/11] Migration 20230515 patches

2023-05-15 Thread Richard Henderson

On 5/15/23 05:33, Juan Quintela wrote:

The following changes since commit 8844bb8d896595ee1d25d21c770e6e6f29803097:

   Merge tag 'or1k-pull-request-20230513' ofhttps://github.com/stffrdhrn/qemu  
into staging (2023-05-13 11:23:14 +0100)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git  
tags/migration-20230515-pull-request

for you to fetch changes up to 6da835d42a2163b43578ae745bc613b06dd5d23c:

   qemu-file: Remove total from qemu_file_total_transferred_*() (2023-05-15 
13:46:14 +0200)


Migration Pull request 20230515

Hi

On this PULL:
- use xxHash for calculate dirty_rate (andrei)
- Create qemu_target_pages_to_MiB() and use them (quintela)
- make dirtyrate target independent (quintela)
- Merge 5 patches from atomic counters series (quintela)

Please apply.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/10] Migration 20230509 patches

2023-05-11 Thread Richard Henderson

On 5/10/23 19:09, Juan Quintela wrote:

The following changes since commit caa9cbd566877b34e9abcc04d936116fc5e0ab28:

   Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging 
(2023-05-10 14:52:03 +0100)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git 
tags/migration-20230509-pull-request

for you to fetch changes up to 121ccedc2bf0c124e93991275336415d12d2e3df:

   migration: block incoming colo when capability is disabled (2023-05-10 
18:48:12 +0200)


Migration Pull request (20230509 vintage) take 2

Hi

In this take 2:
- Change uint -> uint32_t to fix mingw32 compilation.

Please apply.
[take 1]
In this PULL request:
- 1st part of colo support for multifd (lukas)
- 1st part of disabling colo option (vladimir)

Please, apply.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/28] Block layer patches

2023-05-10 Thread Richard Henderson

On 5/10/23 13:20, Kevin Wolf wrote:

The following changes since commit b2896c1b09878fd1c4b485b3662f8beecbe0fef4:

   Merge tag 'vfio-updates-20230509.0' of 
https://gitlab.com/alex.williamson/qemu into staging (2023-05-10 11:20:35 +0100)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git tags/for-upstream

for you to fetch changes up to 58a2e3f5c37be02dac3086b81bdda9414b931edf:

   block: compile out assert_bdrv_graph_readable() by default (2023-05-10 
14:16:54 +0200)


Block layer patches

- Graph locking, part 3 (more block drivers)
- Compile out assert_bdrv_graph_readable() by default
- Add configure options for vmdk, vhdx and vpc
- Fix use after free in blockdev_mark_auto_del()
- migration: Attempt disk reactivation in more failure scenarios
- Coroutine correctness fixes


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~





Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Richard Henderson

On 5/10/23 15:08, Juan Quintela wrote:

grep " uint;" on my system includes.  I know that there are more
creative ways to define it.

/usr/include/ffi-x86_64.h\0278:  ffi_arg   uint;


Thankfully only a structure member.  :-)


/usr/include/sys/types.h\0150:typedef unsigned int uint;


Oof.


/usr/include/nspr4/obsolete/protypes.h\052:typedef PRUintn uint;
/usr/include/mysql/server/my_global.h\0465:typedef unsigned int uint;
/usr/include/boost/iostreams/filter/zlib.hpp\047:typedef uint32_t uint;
/usr/include/qt5/QtCore/qglobal.h\0275:typedef unsigned int uint;

in qt it is defined for everything.


Ok.


../../../../mnt/code/qemu/full/linux-user/syscall.c:317:32: error: unknown type 
name ‘uint’; did you mean ‘guint’?
   317 | _syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, 
dirp, uint, count);
   |^~~~


Fixable.


I will post an RFC with my findings.


Thanks.


r~




Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Richard Henderson

On 5/10/23 13:20, Juan Quintela wrote:

Richard Henderson  wrote:

On 5/9/23 20:17, Juan Quintela wrote:

The following changes since commit 271477b59e723250f17a7e20f139262057921b6a:
Merge tag 'compression-code-pull-request' of
https://gitlab.com/juan.quintela/qemu into staging (2023-05-08
20:38:05 +0100)
are available in the Git repository at:
https://gitlab.com/juan.quintela/qemu.git
tags/migration-20230509-pull-request
for you to fetch changes up to
5f43d297bc2b9530805ad8602c6e2ea284b08628:
migration: block incoming colo when capability is disabled
(2023-05-09 20:52:21 +0200)

Migration Pull request (20230509 vintage)
Hi
In this PULL request:
- 1st part of colo support for multifd (lukas)
- 1st part of disabling colo option (vladimir)
Please, apply.


Build failures.

https://gitlab.com/qemu-project/qemu/-/jobs/4257605099#L2241

85 | void colo_record_bitmap(RAMBlock *block, ram_addr_t *normal, uint 
normal_num);
   |  ^~~~
   |  u_int



Grrr

And the worst thing is that hate those types, tried to get then out
long, long ago for a similar problem.


Where do these types come from, and can we poison them on the qemu side?


r~




Re: [PULL 00/10] Migration 20230509 patches

2023-05-10 Thread Richard Henderson

On 5/9/23 20:17, Juan Quintela wrote:

The following changes since commit 271477b59e723250f17a7e20f139262057921b6a:

   Merge tag 'compression-code-pull-request' of 
https://gitlab.com/juan.quintela/qemu into staging (2023-05-08 20:38:05 +0100)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git 
tags/migration-20230509-pull-request

for you to fetch changes up to 5f43d297bc2b9530805ad8602c6e2ea284b08628:

   migration: block incoming colo when capability is disabled (2023-05-09 
20:52:21 +0200)


Migration Pull request (20230509 vintage)

Hi
In this PULL request:
- 1st part of colo support for multifd (lukas)
- 1st part of disabling colo option (vladimir)

Please, apply.


Build failures.

https://gitlab.com/qemu-project/qemu/-/jobs/4257605099#L2241

   85 | void colo_record_bitmap(RAMBlock *block, ram_addr_t *normal, uint 
normal_num);
  |  ^~~~
  |  u_int


r~




Re: [PULL 00/16] Migration 20230505 patches

2023-05-05 Thread Richard Henderson

On 5/5/23 01:47, Juan Quintela wrote:

The following changes since commit f6b761bdbd8ba63cee7428d52fb6b46e4224ddab:

   Merge tag 'qga-pull-2023-05-04' ofhttps://github.com/kostyanf14/qemu  into 
staging (2023-05-04 12:08:00 +0100)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git  
tags/migration-20230505-pull-request

for you to fetch changes up to fae4009fb51b12927165667a9c9d6af93d31b1df:

   qemu-file: Make ram_control_save_page() use accessors for rate_limit 
(2023-05-05 02:01:59 +0200)


Migration Pull request (20230505 edition)

In this series:
- fix block_bitmap_mapping (juan)
- RDMA cleanup (juan)
- qemu file cleanup (juan)

Please apply.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/18] Migration 20230427 patches

2023-04-28 Thread Richard Henderson

On 4/27/23 16:22, Juan Quintela wrote:

The following changes since commit 1eb95e1baef852d0971a1dd62a3293cd68f1ec35:

   Merge tag 'migration-20230426-pull-request' 
ofhttps://gitlab.com/juan.quintela/qemu  into staging (2023-04-27 10:47:14 
+0100)

are available in the Git repository at:

   https://gitlab.com/juan.quintela/qemu.git  
tags/migration-20230427-pull-request

for you to fetch changes up to 73208a336e249bc8e3bdd76a78d0af7ecaee9178:

   migration: Make dirty_bytes_last_sync atomic (2023-04-27 16:39:54 +0200)


Migration Pull request (20230427 edition)

Hi

Everything that has been reviewed:
- stat64_set() by paolo
- atomic_counters series fully reviewed (juan)
- move capabilities to options.c fully reviewed (juan)
- fix the channels_ready semaphore (juan)
- multifd flush optimization reviewed (juan)

Please, apply.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 00/25] Block layer patches

2023-04-26 Thread Richard Henderson

On 4/25/23 14:13, Kevin Wolf wrote:

The following changes since commit ac5f7bf8e208cd7893dbb1a9520559e569a4677c:

   Merge tag 'migration-20230424-pull-request' 
ofhttps://gitlab.com/juan.quintela/qemu  into staging (2023-04-24 15:00:39 
+0100)

are available in the Git repository at:

   https://repo.or.cz/qemu/kevin.git  tags/for-upstream

for you to fetch changes up to 8c1e8fb2e7fc2cbeb57703e143965a4cd3ad301a:

   block/monitor: Fix crash when executing HMP commit (2023-04-25 15:11:57 
+0200)


Block layer patches

- Protect BlockBackend.queued_requests with its own lock
- Switch to AIO_WAIT_WHILE_UNLOCKED() where possible
- AioContext removal: LinuxAioState/LuringState/ThreadPool
- Add more coroutine_fn annotations, use bdrv/blk_co_*
- Fix crash when execute hmp_commit


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PULL 0/2] Block patches

2023-04-25 Thread Richard Henderson

On 4/24/23 18:55, Stefan Hajnoczi wrote:

The following changes since commit ac5f7bf8e208cd7893dbb1a9520559e569a4677c:

   Merge tag 'migration-20230424-pull-request' 
ofhttps://gitlab.com/juan.quintela/qemu  into staging (2023-04-24 15:00:39 
+0100)

are available in the Git repository at:

   https://gitlab.com/stefanha/qemu.git  tags/block-pull-request

for you to fetch changes up to 9d672e290475001fcecdcc9dc79ad088ff89d17f:

   tracetool: use relative paths for '#line' preprocessor directives 
(2023-04-24 13:53:44 -0400)


Pull request (v2)

I dropped the zoned storage patches that had CI failures. This pull request
only contains fixes now.


Applied, thanks.  Please update https://wiki.qemu.org/ChangeLog/8.1 as 
appropriate.


r~




Re: [PATCH 0/2] block/qcow2: QAPI'fy Qcow2DiscardType

2023-02-24 Thread Richard Henderson

On 2/24/23 05:20, Philippe Mathieu-Daudé wrote:

QAPI seems designed to maintain such enums,
so convert Qcow2DiscardType to be QAPI generated.
Besides, this is how Qcow2CompressionType is maintained.

Philippe Mathieu-Daudé (2):
   block/qcow2: Rename QCOW2_DISCARD_TYPE enum definitions
   block/qcow2: QAPI'fy Qcow2DiscardType


Reviewed-by: Richard Henderson 

r~



  1   2   3   4   5   >