[Qemu-commits] [qemu/qemu] 196685: accel/tcg: Adjust parameters and locking with do_{...

2023-08-06 Thread Richard Henderson via Qemu-commits
lls brk() to
shrink the heap only when there is a room more than 128 KiB. It is
rare to have a page size larger than 128 KiB if it happens.

Let's remove the optimization to fix the bugs and make the code simpler.

Fixes: 86f04735ac ("linux-user: Fix brk() to release pages")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1616
Signed-off-by: Akihiko Odaki 
Message-Id: <20230802071754.14876-7-akihiko.od...@daynix.com>
Reviewed-by: Richard Henderson 
Signed-off-by: Richard Henderson 


  Commit: 0662a626a712dde5f8a91e1b078644332336e9fa
  
https://github.com/qemu/qemu/commit/0662a626a712dde5f8a91e1b078644332336e9fa
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/flatload.c
M linux-user/main.c
M linux-user/qemu.h

  Log Message:
  ---
  linux-user: Properly set image_info.brk in flatload

The heap starts at "brk" not "start_brk".  With this fixed,
image_info.start_brk is unused and may be removed.

Tested-by: Helge Deller 
Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: 62cbf0815005f0ba91b0c36fbcabd479c6e3a2f2
  
https://github.com/qemu/qemu/commit/62cbf0815005f0ba91b0c36fbcabd479c6e3a2f2
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/mmap.c
M linux-user/user-mmap.h

  Log Message:
  ---
  linux-user: Remove last_brk

This variable is unused.

Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: 3c4a8a8fdae95611ca48e7c40e56fbf60c3267f4
  
https://github.com/qemu/qemu/commit/3c4a8a8fdae95611ca48e7c40e56fbf60c3267f4
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M bsd-user/mmap.c
M bsd-user/qemu.h

  Log Message:
  ---
  bsd-user: Remove last_brk

This variable is unused.

Signed-off-by: Richard Henderson 


  Commit: 9400601a689a128c25fa9c21e932562e0eeb7a26
  
https://github.com/qemu/qemu/commit/9400601a689a128c25fa9c21e932562e0eeb7a26
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M accel/tcg/cputlb.c
M bsd-user/mmap.c
M bsd-user/qemu.h
M configure
M gdbstub/gdbstub.c
M linux-user/elfload.c
M linux-user/flatload.c
M linux-user/main.c
M linux-user/mmap.c
M linux-user/qemu.h
M linux-user/syscall.c
M linux-user/user-mmap.h

  Log Message:
  ---
  Merge tag 'pull-tcg-20230806-3' of https://gitlab.com/rth7680/qemu into 
staging

accel/tcg: Do not issue misaligned i/o
accel/tcg: Call save_iotlb_data from io_readx
gdbstub: use 0 ("any process") on packets with no PID
linux-user: Fixes for MAP_FIXED_NOREPLACE
linux-user: Fixes for brk
linux-user: Set V in ELF_HWCAP for RISC-V
*-user: Remove last_brk as unused

# -BEGIN PGP SIGNATURE-
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTQMPsdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV/rmQf/az6d6X4iom0Hch19
# U4BkoNP7NQB2Rue/avjP6Vy6yATDEPgIA5vcPcub+jYsCyEasRRCD1d4odxZp7Cr
# MLoeX6dC+iGg0N7i3S1DSpZBqsRv/4+YE5ibPjYnZlv0F7re1L89yw4doj5OPN1w
# 1p8bpTxA2+s/FOxgfKLSyZR4yMJ4jWKeH+em6qjEBXEAMSiE6u0S+Kt3bAO8amdo
# 86e5d16F4sjs4kXMTEp9myNoXN/aRsWd1stzebQK+uV6qQQsdkIkMLZmZ8+o158A
# QEuWpV8yoMxhXUsnjkNGbL5S3r2WDJpM6WbWxtjs1xOAaygYCOicXh+sqRefgyH/
# 0NQQRw==
# =4I5/
# -END PGP SIGNATURE-
# gpg: Signature made Sun 06 Aug 2023 04:47:07 PM PDT
# gpg:using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:issuer "richard.hender...@linaro.org"
# gpg: Good signature from "Richard Henderson " 
[ultimate]

* tag 'pull-tcg-20230806-3' of https://gitlab.com/rth7680/qemu:
  bsd-user: Remove last_brk
  linux-user: Remove last_brk
  linux-user: Properly set image_info.brk in flatload
  linux-user: Do not align brk with host page size
  linux-user: Do nothing if too small brk is specified
  linux-user: Use MAP_FIXED_NOREPLACE for do_brk()
  linux-user: Do not call get_errno() in do_brk()
  linux-user: Fix MAP_FIXED_NOREPLACE on old kernels
  linux-user: Unset MAP_FIXED_NOREPLACE for host
  linux-user/elfload: Set V in ELF_HWCAP for RISC-V
  configure: Fix linux-user host detection for riscv64
  gdbstub: use 0 ("any process") on packets with no PID
  accel/tcg: Call save_iotlb_data from io_readx as well
  accel/tcg: Do not issue misaligned i/o
  accel/tcg: Issue wider aligned i/o in do_{ld,st}_mmio_*
  accel/tcg: Adjust parameters and locking with do_{ld,st}_mmio_*

Signed-off-by: Richard Henderson 


Compare: https://github.com/qemu/qemu/compare/6db03ccc7f4c...9400601a689a



[Qemu-commits] [qemu/qemu] 5c2b00: linux-user: Properly set image_info.brk in flatload

2023-08-06 Thread Richard Henderson via Qemu-commits
  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 5c2b0099ffa061ad1141c57a7b4ff902381f07a3
  
https://github.com/qemu/qemu/commit/5c2b0099ffa061ad1141c57a7b4ff902381f07a3
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/flatload.c
M linux-user/main.c
M linux-user/qemu.h

  Log Message:
  ---
  linux-user: Properly set image_info.brk in flatload

The heap starts at "brk" not "start_brk".  With this fixed,
image_info.start_brk is unused and may be removed.

Tested-by: Helge Deller 
Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: 3252f22cfd6b0059cc5de9a5a3d424722931d4a0
  
https://github.com/qemu/qemu/commit/3252f22cfd6b0059cc5de9a5a3d424722931d4a0
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/mmap.c
M linux-user/user-mmap.h

  Log Message:
  ---
  linux-user: Remove last_brk

This variable is unused.

Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: f0ef27225118c9284119199d7341802ca15e2834
  
https://github.com/qemu/qemu/commit/f0ef27225118c9284119199d7341802ca15e2834
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M bsd-user/mmap.c
M bsd-user/qemu.h

  Log Message:
  ---
  bsd-user: Remove last_brk

This variable is unused.

Signed-off-by: Richard Henderson 


  Commit: d7ebbfc5dbdadaab389ef2817dcea35467923384
  
https://github.com/qemu/qemu/commit/d7ebbfc5dbdadaab389ef2817dcea35467923384
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M accel/tcg/cputlb.c
M bsd-user/mmap.c
M bsd-user/qemu.h
M configure
M gdbstub/gdbstub.c
M linux-user/elfload.c
M linux-user/flatload.c
M linux-user/main.c
M linux-user/mmap.c
M linux-user/qemu.h
M linux-user/syscall.c
M linux-user/user-mmap.h

  Log Message:
  ---
  Merge tag 'pull-tcg-20230806' of https://gitlab.com/rth7680/qemu into staging

accel/tcg: Do not issue misaligned i/o
accel/tcg: Call save_iotlb_data from io_readx
gdbstub: use 0 ("any process") on packets with no PID
linux-user: Fixes for MAP_FIXED_NOREPLACE
linux-user: Fixes for brk
linux-user: Set V in ELF_HWCAP for RISC-V
*-user: Remove last_brk as unused

# -BEGIN PGP SIGNATURE-
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTP/ygdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV+YIAf+OGaSuBJgVIT12VIX
# ZRVOAUMNnHBPYFiOgv8m7oS3ZgbCXMga0rLyumLaXnI4/bp8ifbLCE7rcZOMUb2G
# aRRllcppYku0Qp19kiPJoYl5iWCaNq7S5kO/8ysh4sC7+/t98YLYBDtZBKcR21mv
# bYtJ7qrhmlXPpv2LEOTPbWh0NKO+zkwZArnqrBUWM+tCxOcjHzXx6MVpp8PaZTal
# iXU5L20YcjqdRxpDHPT+rshf8yFPbQpmuNpj1JdRQ/LxXWgsY/jNVeJXbLbQ+zvx
# nFE94GWeKg/KhqzoXiqmmFgmDsQUzeoUM8OTubJlvBNIrabDZp2RGMgABLAciGKM
# 5Uj7xQ==
# =+mjA
# -END PGP SIGNATURE-
# gpg: Signature made Sun 06 Aug 2023 01:14:32 PM PDT
# gpg:using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:issuer "richard.hender...@linaro.org"
# gpg: Good signature from "Richard Henderson " 
[ultimate]

* tag 'pull-tcg-20230806' of https://gitlab.com/rth7680/qemu:
  bsd-user: Remove last_brk
  linux-user: Remove last_brk
  linux-user: Properly set image_info.brk in flatload
  linux-user: Do not align brk with host page size
  linux-user: Do nothing if too small brk is specified
  linux-user: Use MAP_FIXED_NOREPLACE for do_brk()
  linux-user: Do not call get_errno() in do_brk()
  linux-user: Fix MAP_FIXED_NOREPLACE on old kernels
  linux-user: Unset MAP_FIXED_NOREPLACE for host
  linux-user/elfload: Set V in ELF_HWCAP for RISC-V
  configure: Fix linux-user host detection for riscv64
  gdbstub: use 0 ("any process") on packets with no PID
  accel/tcg: Call save_iotlb_data from io_readx as well
  accel/tcg: Do not issue misaligned i/o
  accel/tcg: Issue wider aligned i/o in do_{ld,st}_mmio_*
  accel/tcg: Adjust parameters and locking with do_{ld,st}_mmio_*

Signed-off-by: Richard Henderson 


Compare: https://github.com/qemu/qemu/compare/82c7e7d6eb19...d7ebbfc5dbda



[Qemu-commits] [qemu/qemu] c30d0b: accel/tcg: Call save_iotlb_data from io_readx as well

2023-08-06 Thread Richard Henderson via Qemu-commits
://github.com/qemu/qemu/commit/01ebfa6e5c34719b3ac55059e9eaab9b77bb2f5c
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/elfload.c

  Log Message:
  ---
  linux-user: Do not adjust image mapping for host page size

Remove TARGET_ELF_EXEC_PAGESIZE, and 3 other TARGET_ELF_PAGE* macros
based off of that.  Rely on target_mmap to handle guest vs host page
size mismatch.

Tested-by: Helge Deller 
Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: c5e393d25433fdefb5074147971a9dd48b6099a8
  
https://github.com/qemu/qemu/commit/c5e393d25433fdefb5074147971a9dd48b6099a8
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/elfload.c

  Log Message:
  ---
  linux-user: Do not adjust zero_bss for host page size

Rely on target_mmap to handle guest vs host page size mismatch.

Tested-by: Helge Deller 
Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: 810dcb4ee013ac0eb5c393b809f200463f4d3177
  
https://github.com/qemu/qemu/commit/810dcb4ee013ac0eb5c393b809f200463f4d3177
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M linux-user/elfload.c

  Log Message:
  ---
  linux-user: Use zero_bss for PT_LOAD with no file contents too

If p_filesz == 0, then vaddr_ef == vaddr.  We can reuse the
code in zero_bss rather than incompletely duplicating it in
load_elf_image.

Tested-by: Helge Deller 
Reviewed-by: Helge Deller 
Reviewed-by: Akihiko Odaki 
Signed-off-by: Richard Henderson 


  Commit: 82c7e7d6eb19716b4f80839aec4f72d551417a93
  
https://github.com/qemu/qemu/commit/82c7e7d6eb19716b4f80839aec4f72d551417a93
  Author: Richard Henderson 
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
M accel/tcg/cputlb.c
M bsd-user/mmap.c
M bsd-user/qemu.h
M configure
M gdbstub/gdbstub.c
M linux-user/aarch64/target_mman.h
M linux-user/alpha/target_mman.h
M linux-user/arm/target_mman.h
M linux-user/cris/target_mman.h
M linux-user/elfload.c
M linux-user/flatload.c
M linux-user/hexagon/target_mman.h
M linux-user/hppa/target_mman.h
M linux-user/i386/target_mman.h
M linux-user/loongarch64/target_mman.h
M linux-user/m68k/target_mman.h
M linux-user/main.c
M linux-user/microblaze/target_mman.h
M linux-user/mips/target_mman.h
M linux-user/mmap.c
M linux-user/nios2/target_mman.h
M linux-user/openrisc/target_mman.h
M linux-user/ppc/target_mman.h
M linux-user/qemu.h
M linux-user/riscv/target_mman.h
M linux-user/s390x/target_mman.h
M linux-user/sh4/target_mman.h
M linux-user/sparc/target_mman.h
M linux-user/syscall.c
M linux-user/user-mmap.h
M linux-user/x86_64/target_mman.h
M linux-user/xtensa/target_mman.h

  Log Message:
  ---
  Merge tag 'pull-tcg-20230806' of https://gitlab.com/rth7680/qemu into staging

accel/tcg: Do not issue misaligned i/o
accel/tcg: Call save_iotlb_data from io_readx
gdbstub: use 0 ("any process") on packets with no PID
linux-user: Fixes for MAP_FIXED_NOREPLACE
linux-user: Fixes for brk
linux-user: Adjust task_unmapped_base for reserved_va
linux-user: Use ELF_ET_DYN_BASE for ET_DYN with interpreter
linux-user: Remove host != guest page size workarounds in brk and image load
linux-user: Set V in ELF_HWCAP for RISC-V
*-user: Remove last_brk as unused

# -BEGIN PGP SIGNATURE-
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmTP8dsdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV9YjwgAoCWGJ/b0s4nLbkWr
# DOPd7X2tL8gzHqTaZEK0+JdTxAW7OB79Xd5hUBN5tb2HgniCLJQ7x8uXKKCTxY54
# nH9E3fxx8tDYHEceg3tvvAtM5Gz9YBF8nXt/wYeg+EejvybLl1PKO5AaZxsfrJI1
# NPTHbHiMqXIfS2fChcfd8xlQoinkGPQ+R0udKvjD8ePW8FndiUsgTL2QyNmKi0+G
# JWPLhdpG4fN0YxpQLkdmWXDK/bflk7bdN9kPaV329poLu/Z6KQMQXZy41AvvJMaZ
# V8Vlazpbb+Cb9TSYGxlAV1zkcvaxj66id0hMe+VPdPHg0AZobcu/zAtAFH/kL4+r
# cPlUdA==
# =CMRa
# -END PGP SIGNATURE-
# gpg: Signature made Sun 06 Aug 2023 12:17:47 PM PDT
# gpg:using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:issuer "richard.hender...@linaro.org"
# gpg: Good signature from "Richard Henderson " 
[ultimate]

* tag 'pull-tcg-20230806' of https://gitlab.com/rth7680/qemu: (24 commits)
  linux-user: Use zero_bss for PT_LOAD with no file contents too
  linux-user: Do not adjust zero_bss for host page size
  linux-user: Do not adjust image mapping for host page size
  linux-user: Adjust initial brk when interpreter is close to executable
  linux-user: Use elf_et_dyn_base for ET_DYN with interpreter
  linux-user: Define ELF_ET_DYN_BASE in $guest/target_mman.h
  linux-user: Define TASK_UNMAPPED_BASE in $guest/target_mman.h
  linux-user: Adjust task_unmapped_base for reserved_va
  linux-user: Properly set image_info.brk in flatload
  bsd-user: Remove l