qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux-user/main: Allow setting tb-size
@ 2024-07-30 21:54 Ilya Leoshkevich
  2024-07-30 23:04 ` Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2024-07-30 21:54 UTC (permalink / raw)
  To: Laurent Vivier, Richard Henderson; +Cc: qemu-devel, Ilya Leoshkevich

While qemu-system can set tb-size using -accel tcg,tb-size=n, there
is no similar knob for qemu-user. Add one in a way similar to how
one-insn-per-tb is already handled.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 linux-user/main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index d502945222b..6c5123aac57 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -72,6 +72,7 @@ char *exec_path;
 char real_exec_path[PATH_MAX];
 
 static bool opt_one_insn_per_tb;
+static unsigned long opt_tb_size;
 static const char *argv0;
 static const char *gdbstub;
 static envlist_t *envlist;
@@ -418,6 +419,13 @@ static void handle_arg_one_insn_per_tb(const char *arg)
     opt_one_insn_per_tb = true;
 }
 
+static void handle_arg_tb_size(const char *arg)
+{
+    if (qemu_strtoul(arg, NULL, 0, &opt_tb_size)) {
+        usage(EXIT_FAILURE);
+    }
+}
+
 static void handle_arg_strace(const char *arg)
 {
     enable_strace = true;
@@ -507,6 +515,8 @@ static const struct qemu_argument arg_table[] = {
     {"one-insn-per-tb",
                    "QEMU_ONE_INSN_PER_TB",  false, handle_arg_one_insn_per_tb,
      "",           "run with one guest instruction per emulated TB"},
+    {"tb-size",    "QEMU_TB_SIZE",     true,  handle_arg_tb_size,
+     "size",       "TCG translation block cache size"},
     {"strace",     "QEMU_STRACE",      false, handle_arg_strace,
      "",           "log system calls"},
     {"seed",       "QEMU_RAND_SEED",   true,  handle_arg_seed,
@@ -803,6 +813,8 @@ int main(int argc, char **argv, char **envp)
         accel_init_interfaces(ac);
         object_property_set_bool(OBJECT(accel), "one-insn-per-tb",
                                  opt_one_insn_per_tb, &error_abort);
+        object_property_set_int(OBJECT(accel), "tb-size",
+                                opt_tb_size, &error_abort);
         ac->init_machine(NULL);
     }
 
-- 
2.45.2



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

* Re: [PATCH] linux-user/main: Allow setting tb-size
  2024-07-30 21:54 [PATCH] linux-user/main: Allow setting tb-size Ilya Leoshkevich
@ 2024-07-30 23:04 ` Richard Henderson
  2024-07-31 12:21 ` Philippe Mathieu-Daudé
  2025-03-05 16:33 ` Moritz Volz
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Henderson @ 2024-07-30 23:04 UTC (permalink / raw)
  To: Ilya Leoshkevich, Laurent Vivier; +Cc: qemu-devel

On 7/31/24 07:54, Ilya Leoshkevich wrote:
> While qemu-system can set tb-size using -accel tcg,tb-size=n, there
> is no similar knob for qemu-user. Add one in a way similar to how
> one-insn-per-tb is already handled.
> 
> Signed-off-by: Ilya Leoshkevich<iii@linux.ibm.com>
> ---
>   linux-user/main.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH] linux-user/main: Allow setting tb-size
  2024-07-30 21:54 [PATCH] linux-user/main: Allow setting tb-size Ilya Leoshkevich
  2024-07-30 23:04 ` Richard Henderson
@ 2024-07-31 12:21 ` Philippe Mathieu-Daudé
  2025-03-05 16:33 ` Moritz Volz
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-07-31 12:21 UTC (permalink / raw)
  To: Ilya Leoshkevich, Laurent Vivier, Richard Henderson; +Cc: qemu-devel

On 30/7/24 23:54, Ilya Leoshkevich wrote:
> While qemu-system can set tb-size using -accel tcg,tb-size=n, there
> is no similar knob for qemu-user. Add one in a way similar to how
> one-insn-per-tb is already handled.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>   linux-user/main.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)

Missing similar change in bsd-user/main.c, otherwise:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH] linux-user/main: Allow setting tb-size
  2024-07-30 21:54 [PATCH] linux-user/main: Allow setting tb-size Ilya Leoshkevich
  2024-07-30 23:04 ` Richard Henderson
  2024-07-31 12:21 ` Philippe Mathieu-Daudé
@ 2025-03-05 16:33 ` Moritz Volz
  2 siblings, 0 replies; 4+ messages in thread
From: Moritz Volz @ 2025-03-05 16:33 UTC (permalink / raw)
  To: Ilya Leoshkevich, Laurent Vivier, Richard Henderson; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

On 30.07.2024 23:54 Ilya Leoshkevich wrote:
> While qemu-system can set tb-size using -accel tcg,tb-size=n, there
> is no similar knob for qemu-user. Add one in a way similar to how
> one-insn-per-tb is already handled.
>
> Signed-off-by: Ilya Leoshkevich<iii@linux.ibm.com>
> ---
>   linux-user/main.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
Right now (commit 661c2e1a) it looks like this change never made it to 
linux-user/main.c in the master branch.

Interestingly enough the changes for bsd-user/main.c were merged in 
early November.

Did this patch just get lost, or is there a reason it was appied to 
bsd-user but not linux-user (despite the initial effort to maintain 
feature parity)? It looks like a useful feature to have and compiling 
from source for a 12 line patch is not very convenient.

[-- Attachment #2: Type: text/html, Size: 1666 bytes --]

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

end of thread, other threads:[~2025-03-05 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 21:54 [PATCH] linux-user/main: Allow setting tb-size Ilya Leoshkevich
2024-07-30 23:04 ` Richard Henderson
2024-07-31 12:21 ` Philippe Mathieu-Daudé
2025-03-05 16:33 ` Moritz Volz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).