qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 196685: accel/tcg: Adjust parameters and lock


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 196685: accel/tcg: Adjust parameters and locking with do_{...
Date: Sun, 06 Aug 2023 18:17:08 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 1966855e567686e6547b058d8664aefd0e969a0f
      
https://github.com/qemu/qemu/commit/1966855e567686e6547b058d8664aefd0e969a0f
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-08-05 (Sat, 05 Aug 2023)

  Changed paths:
    M accel/tcg/cputlb.c

  Log Message:
  -----------
  accel/tcg: Adjust parameters and locking with do_{ld,st}_mmio_*

Replace MMULookupPageData* with CPUTLBEntryFull, addr, size.
Move QEMU_IOTHREAD_LOCK_GUARD to the caller.

This simplifies the usage from do_ld16_beN and do_st16_leN, where
we weren't locking the entire operation, and required hoop jumping
for passing addr and size.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 190aba803fbcac30b29bdab25f454b1284a96201
      
https://github.com/qemu/qemu/commit/190aba803fbcac30b29bdab25f454b1284a96201
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-08-05 (Sat, 05 Aug 2023)

  Changed paths:
    M accel/tcg/cputlb.c

  Log Message:
  -----------
  accel/tcg: Issue wider aligned i/o in do_{ld,st}_mmio_*

If the address and size are aligned, send larger chunks
to the memory subsystem.  This will be required to make
more use of these helpers.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: f7eaf9d702efdd02481d5f1c25f7d8e0ffb64c6e
      
https://github.com/qemu/qemu/commit/f7eaf9d702efdd02481d5f1c25f7d8e0ffb64c6e
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-08-05 (Sat, 05 Aug 2023)

  Changed paths:
    M accel/tcg/cputlb.c

  Log Message:
  -----------
  accel/tcg: Do not issue misaligned i/o

In the single-page case we were issuing misaligned i/o to
the memory subsystem, which does not handle it properly.
Split such accesses via do_{ld,st}_mmio_*.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1800
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: c30d0b861cea8539ee0acb55a1a949ed4b5ec82a
      
https://github.com/qemu/qemu/commit/c30d0b861cea8539ee0acb55a1a949ed4b5ec82a
  Author: Mikhail Tyutin <m.tyutin@yadro.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M accel/tcg/cputlb.c

  Log Message:
  -----------
  accel/tcg: Call save_iotlb_data from io_readx as well

Apply save_iotlb_data() to io_readx() as well as to io_writex().
This fixes SEGFAULT on qemu_plugin_hwaddr_phys_addr() call plugins
for addresses inside of MMIO region.

Signed-off-by: Dmitriy Solovev <d.solovev@yadro.com>
Signed-off-by: Mikhail Tyutin <m.tyutin@yadro.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230804110903.19968-1-m.tyutin@yadro.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 6c78de6eb6f986b2e06e95fabad62731a44aaafd
      
https://github.com/qemu/qemu/commit/6c78de6eb6f986b2e06e95fabad62731a44aaafd
  Author: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M gdbstub/gdbstub.c

  Log Message:
  -----------
  gdbstub: use 0 ("any process") on packets with no PID

Previously, qemu-user would always report PID 1 to GDB. This was changed
at dc14a7a6e9 (gdbstub: Report the actual qemu-user pid, 2023-06-30),
but read_thread_id() still considers GDB packets with "no PID" as "PID
1", which is not the qemu-user PID. Fix that by parsing "no PID" as "0",
which the GDB Remote Protocol defines as "any process".

Note that this should have no effect for system emulation as, in this
case, gdb_create_default_process() will assign PID 1 for the first
process and that is what the gdbstub uses for GDB requests with no PID,
or PID 0.

This issue was found with hexagon-lldb, which sends a "Hg" packet with
only the thread-id, but no process-id, leading to the invalid usage of
"PID 1" by qemu-hexagon and a subsequent "E22" reply.

Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com>
Acked-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: 
<78a3b06f6ab90a7ff8e73ae14a996eb27ec76c85.1690904195.git.quic_mathbern@quicinc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 89e5b7935e92af6f3b4e4cdb19dfddef4e9dde36
      
https://github.com/qemu/qemu/commit/89e5b7935e92af6f3b4e4cdb19dfddef4e9dde36
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M configure

  Log Message:
  -----------
  configure: Fix linux-user host detection for riscv64

Mirror the host_arch variable from meson.build, so that we
probe for the correct linux-user/include/host/ directory.

Fixes: e3e477c3bca0 ("configure: Fix cross-building for RISCV host")
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 4333f0924c2f2ca8efaebaed8c24f55f77d8b013
      
https://github.com/qemu/qemu/commit/4333f0924c2f2ca8efaebaed8c24f55f77d8b013
  Author: Nathan Egge <negge@xiph.org>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/elfload.c

  Log Message:
  -----------
  linux-user/elfload: Set V in ELF_HWCAP for RISC-V

Set V bit for hwcap if misa is set.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
Signed-off-by: Nathan Egge <negge@xiph.org>
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Message-Id: <20230803131424.40744-1-negge@xiph.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: c3dd50da0f4d00fffe8ea5e211c2c189fe6ad4fb
      
https://github.com/qemu/qemu/commit/c3dd50da0f4d00fffe8ea5e211c2c189fe6ad4fb
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/mmap.c

  Log Message:
  -----------
  linux-user: Unset MAP_FIXED_NOREPLACE for host

Passing MAP_FIXED_NOREPLACE to host will fail for reserved_va because
the address space is reserved with mmap.  Replace it with MAP_FIXED
in that case.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-2-akihiko.odaki@daynix.com>
[rth: Expand inline commentary.]
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: ddcdd8c48fc48b2d528756fc98f1ce0ec3d7b617
      
https://github.com/qemu/qemu/commit/ddcdd8c48fc48b2d528756fc98f1ce0ec3d7b617
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/mmap.c

  Log Message:
  -----------
  linux-user: Fix MAP_FIXED_NOREPLACE on old kernels

The man page states:
> Note that older kernels which do not recognize the MAP_FIXED_NOREPLACE
> flag will typically (upon detecting a collision with a preexisting
> mapping) fall back to a “non-MAP_FIXED” type of behavior: they will
> return an address that is different from the requested address.
> Therefore, backward-compatible software should check the returned
> address against the requested address.
https://man7.org/linux/man-pages/man2/mmap.2.html

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-3-akihiko.odaki@daynix.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: c6cc059eca18d9f6e4e26bb8b6d1135ddb35d81a
      
https://github.com/qemu/qemu/commit/c6cc059eca18d9f6e4e26bb8b6d1135ddb35d81a
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Do not call get_errno() in do_brk()

Later the returned value is compared with -1, and negated errno is not
expected.

Fixes: 00faf08c95 ("linux-user: Don't use MAP_FIXED in do_brk()")
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-4-akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: e69e032d1a8ee8d754ca119009a3c2c997f8bb30
      
https://github.com/qemu/qemu/commit/e69e032d1a8ee8d754ca119009a3c2c997f8bb30
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Use MAP_FIXED_NOREPLACE for do_brk()

MAP_FIXED_NOREPLACE can ensure the mapped address is fixed without
concerning that the new mapping overwrites something else.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-5-akihiko.odaki@daynix.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: cb9d5d1fda0bc2312fc0c779b4ea1d7bf826f31f
      
https://github.com/qemu/qemu/commit/cb9d5d1fda0bc2312fc0c779b4ea1d7bf826f31f
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Do nothing if too small brk is specified

Linux 6.4.7 does nothing when a value smaller than the initial brk is
specified.

Fixes: 86f04735ac ("linux-user: Fix brk() to release pages")
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-6-akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 2aea137a425a87b930a33590177b04368fd7cc12
      
https://github.com/qemu/qemu/commit/2aea137a425a87b930a33590177b04368fd7cc12
  Author: Akihiko Odaki <akihiko.odaki@daynix.com>
  Date:   2023-08-06 (Sun, 06 Aug 2023)

  Changed paths:
    M linux-user/elfload.c
    M linux-user/syscall.c

  Log Message:
  -----------
  linux-user: Do not align brk with host page size

do_brk() minimizes calls into target_mmap() by aligning the address
with host page size, which is potentially larger than the target page
size. However, the current implementation of this optimization has two
bugs:

- The start of brk is rounded up with the host page size while brk
  advertises an address aligned with the target page size as the
  beginning of brk. This makes the beginning of brk unmapped.
- Content clearing after mapping is flawed. The size to clear is
  specified as HOST_PAGE_ALIGN(brk_page) - brk_page, but brk_page is
  aligned with the host page size so it is always zero.

This optimization actually has no practical benefit. It makes difference
when brk() is called multiple times with values in a range of the host
page size. However, sophisticated memory allocators try to avoid to
make such frequent brk() calls. For example, glibc 2.37 calls 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 <akihiko.odaki@daynix.com>
Message-Id: <20230802071754.14876-7-akihiko.odaki@daynix.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 0662a626a712dde5f8a91e1b078644332336e9fa
      
https://github.com/qemu/qemu/commit/0662a626a712dde5f8a91e1b078644332336e9fa
  Author: Richard Henderson <richard.henderson@linaro.org>
  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 <deller@gmx.de>
Reviewed-by: Helge Deller <deller@gmx.de>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 62cbf0815005f0ba91b0c36fbcabd479c6e3a2f2
      
https://github.com/qemu/qemu/commit/62cbf0815005f0ba91b0c36fbcabd479c6e3a2f2
  Author: Richard Henderson <richard.henderson@linaro.org>
  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 <deller@gmx.de>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


  Commit: 3c4a8a8fdae95611ca48e7c40e56fbf60c3267f4
      
https://github.com/qemu/qemu/commit/3c4a8a8fdae95611ca48e7c40e56fbf60c3267f4
  Author: Richard Henderson <richard.henderson@linaro.org>
  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 <richard.henderson@linaro.org>


  Commit: 9400601a689a128c25fa9c21e932562e0eeb7a26
      
https://github.com/qemu/qemu/commit/9400601a689a128c25fa9c21e932562e0eeb7a26
  Author: Richard Henderson <richard.henderson@linaro.org>
  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.henderson@linaro.org"
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" 
[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 <richard.henderson@linaro.org>


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



reply via email to

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