[Qemu-commits] [qemu/qemu] d0180f: hw/mem/nvdimm: fix error message for 'unarmed' flag

2022-10-31 Thread Paolo Bonzini via Qemu-commits
  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: d0180f0acb142ca78e30857b8d8511ee9f3bd764
  
https://github.com/qemu/qemu/commit/d0180f0acb142ca78e30857b8d8511ee9f3bd764
  Author: Julia Suvorova 
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
M hw/mem/nvdimm.c

  Log Message:
  ---
  hw/mem/nvdimm: fix error message for 'unarmed' flag

In the ACPI specification [1], the 'unarmed' bit is set when a device
cannot accept a persistent write. This means that when a memdev is
read-only, the 'unarmed' flag must be turned on. The logic is correct,
just changing the error message.

[1] ACPI NFIT NVDIMM Region Mapping Structure "NVDIMM State Flags" Bit 3

Fixes: dbd730e859 ("nvdimm: check -object memory-backend-file, readonly=on 
option")
Signed-off-by: Julia Suvorova 
Reviewed-by: Stefan Hajnoczi 
Reviewed-by: Pankaj Gupta 
Reviewed-by: Philippe Mathieu-Daudé 
Acked-by: David Hildenbrand 
Message-Id: <20221023195812.15523-1-jus...@redhat.com>
Signed-off-by: David Hildenbrand 


  Commit: bf98afc75efedf10965a3f2d98aa43c234cf69ed
  
https://github.com/qemu/qemu/commit/bf98afc75efedf10965a3f2d98aa43c234cf69ed
  Author: Jungmin Park 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M crypto/pbkdf.c

  Log Message:
  ---
  crypto/luks: Support creating LUKS image on Darwin

When the user creates a LUKS-encrypted qcow2 image using the qemu-img
program, the passphrase is hashed using PBKDF2 with a dynamic
number of iterations. The number of iterations is determined by
measuring thread cpu time usage, such that it takes approximately
2 seconds to compute the hash.

Because Darwin doesn't implement getrusage(RUSAGE_THREAD), we get an
error message:
> qemu-img: test.qcow2: Unable to calculate thread CPU usage on this platform
for this command:
> qemu-img create --object secret,id=key,data=1234 -f qcow2 -o 
> 'encrypt.format=luks,encrypt.key-secret=key' test.qcow2 100M

This patch implements qcrypto_pbkdf2_get_thread_cpu() for Darwin so that
the above command works.

Signed-off-by: Jungmin Park 
Signed-off-by: Daniel P. Berrangé 


  Commit: 926a895c2cfcd621373eb86288dd83d08cb53f15
  
https://github.com/qemu/qemu/commit/926a895c2cfcd621373eb86288dd83d08cb53f15
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M util/qemu-sockets.c

  Log Message:
  ---
  util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary 
files

Replace the existing logic to get the directory for temporary files
with g_get_tmp_dir(), which works for win32 too.

Signed-off-by: Bin Meng 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 


  Commit: 985be62d4481e11830485a25a47a932e5829d223
  
https://github.com/qemu/qemu/commit/985be62d4481e11830485a25a47a932e5829d223
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M io/channel-watch.c

  Log Message:
  ---
  io/channel-watch: Drop a superfluous '#ifdef WIN32'

In the win32 version qio_channel_create_socket_watch() body there is
no need to do a '#ifdef WIN32'.

Signed-off-by: Bin Meng 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 


  Commit: 6c822a031b9e87fea8303373d6501f6d6a3c1e31
  
https://github.com/qemu/qemu/commit/6c822a031b9e87fea8303373d6501f6d6a3c1e31
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M io/channel-watch.c

  Log Message:
  ---
  io/channel-watch: Drop the unnecessary cast

There is no need to do a type cast on ssource->socket as it is
already declared as a SOCKET.

Suggested-by: Marc-André Lureau 
Signed-off-by: Bin Meng 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 


  Commit: 23f77f05f2faa8ff3028fef388322f7b4f09533e
  
https://github.com/qemu/qemu/commit/23f77f05f2faa8ff3028fef388322f7b4f09533e
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M io/channel-watch.c

  Log Message:
  ---
  io/channel-watch: Fix socket watch on Windows

Random failure was observed when running qtests on Windows due to
"Broken pipe" detected by qmp_fd_receive(). What happened is that
the qtest executable sends testing data over a socket to the QEMU
under test but no response is received. The errno of the recv()
call from the qtest executable indicates ETIMEOUT, due to the qmp
chardev's tcp_chr_read() is never called to receive testing data
hence no response is sent to the other side.

tcp_chr_read() is registered as the callback of the socket watch
GSource. The reason of the callback not being called by glib, is
that the source check fails to indicate the source is ready. There
are two socket watch sources created to monitor the same socket
event object from the char-socket backend in update_ioc_handlers().
During the source check phase, qio_channel_socket_source_check()
calls WSAEnumNetworkEvents() to discover occurrences of network
events for the indicated socket, clea

[Qemu-commits] [qemu/qemu] d0180f: hw/mem/nvdimm: fix error message for 'unarmed' flag

2022-10-30 Thread Paolo Bonzini via Qemu-commits
  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: d0180f0acb142ca78e30857b8d8511ee9f3bd764
  
https://github.com/qemu/qemu/commit/d0180f0acb142ca78e30857b8d8511ee9f3bd764
  Author: Julia Suvorova 
  Date:   2022-10-24 (Mon, 24 Oct 2022)

  Changed paths:
M hw/mem/nvdimm.c

  Log Message:
  ---
  hw/mem/nvdimm: fix error message for 'unarmed' flag

In the ACPI specification [1], the 'unarmed' bit is set when a device
cannot accept a persistent write. This means that when a memdev is
read-only, the 'unarmed' flag must be turned on. The logic is correct,
just changing the error message.

[1] ACPI NFIT NVDIMM Region Mapping Structure "NVDIMM State Flags" Bit 3

Fixes: dbd730e859 ("nvdimm: check -object memory-backend-file, readonly=on 
option")
Signed-off-by: Julia Suvorova 
Reviewed-by: Stefan Hajnoczi 
Reviewed-by: Pankaj Gupta 
Reviewed-by: Philippe Mathieu-Daudé 
Acked-by: David Hildenbrand 
Message-Id: <20221023195812.15523-1-jus...@redhat.com>
Signed-off-by: David Hildenbrand 


  Commit: bf98afc75efedf10965a3f2d98aa43c234cf69ed
  
https://github.com/qemu/qemu/commit/bf98afc75efedf10965a3f2d98aa43c234cf69ed
  Author: Jungmin Park 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M crypto/pbkdf.c

  Log Message:
  ---
  crypto/luks: Support creating LUKS image on Darwin

When the user creates a LUKS-encrypted qcow2 image using the qemu-img
program, the passphrase is hashed using PBKDF2 with a dynamic
number of iterations. The number of iterations is determined by
measuring thread cpu time usage, such that it takes approximately
2 seconds to compute the hash.

Because Darwin doesn't implement getrusage(RUSAGE_THREAD), we get an
error message:
> qemu-img: test.qcow2: Unable to calculate thread CPU usage on this platform
for this command:
> qemu-img create --object secret,id=key,data=1234 -f qcow2 -o 
> 'encrypt.format=luks,encrypt.key-secret=key' test.qcow2 100M

This patch implements qcrypto_pbkdf2_get_thread_cpu() for Darwin so that
the above command works.

Signed-off-by: Jungmin Park 
Signed-off-by: Daniel P. Berrangé 


  Commit: 926a895c2cfcd621373eb86288dd83d08cb53f15
  
https://github.com/qemu/qemu/commit/926a895c2cfcd621373eb86288dd83d08cb53f15
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M util/qemu-sockets.c

  Log Message:
  ---
  util/qemu-sockets: Use g_get_tmp_dir() to get the directory for temporary 
files

Replace the existing logic to get the directory for temporary files
with g_get_tmp_dir(), which works for win32 too.

Signed-off-by: Bin Meng 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 


  Commit: 985be62d4481e11830485a25a47a932e5829d223
  
https://github.com/qemu/qemu/commit/985be62d4481e11830485a25a47a932e5829d223
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M io/channel-watch.c

  Log Message:
  ---
  io/channel-watch: Drop a superfluous '#ifdef WIN32'

In the win32 version qio_channel_create_socket_watch() body there is
no need to do a '#ifdef WIN32'.

Signed-off-by: Bin Meng 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 


  Commit: 6c822a031b9e87fea8303373d6501f6d6a3c1e31
  
https://github.com/qemu/qemu/commit/6c822a031b9e87fea8303373d6501f6d6a3c1e31
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M io/channel-watch.c

  Log Message:
  ---
  io/channel-watch: Drop the unnecessary cast

There is no need to do a type cast on ssource->socket as it is
already declared as a SOCKET.

Suggested-by: Marc-André Lureau 
Signed-off-by: Bin Meng 
Reviewed-by: Marc-André Lureau 
Signed-off-by: Daniel P. Berrangé 


  Commit: 23f77f05f2faa8ff3028fef388322f7b4f09533e
  
https://github.com/qemu/qemu/commit/23f77f05f2faa8ff3028fef388322f7b4f09533e
  Author: Bin Meng 
  Date:   2022-10-26 (Wed, 26 Oct 2022)

  Changed paths:
M io/channel-watch.c

  Log Message:
  ---
  io/channel-watch: Fix socket watch on Windows

Random failure was observed when running qtests on Windows due to
"Broken pipe" detected by qmp_fd_receive(). What happened is that
the qtest executable sends testing data over a socket to the QEMU
under test but no response is received. The errno of the recv()
call from the qtest executable indicates ETIMEOUT, due to the qmp
chardev's tcp_chr_read() is never called to receive testing data
hence no response is sent to the other side.

tcp_chr_read() is registered as the callback of the socket watch
GSource. The reason of the callback not being called by glib, is
that the source check fails to indicate the source is ready. There
are two socket watch sources created to monitor the same socket
event object from the char-socket backend in update_ioc_handlers().
During the source check phase, qio_channel_socket_source_check()
calls WSAEnumNetworkEvents() to discover occurrences of network
events for the indicated socket, cle