Skip to contentSkip to conversation

qemu-accel: unbreak non-default accelerators

PATCH In review Dmitry Baryshkov 3 participants 6 messages Sep 9, 2008 – Sep 10, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 qemu-accel: unbreak non-default accelerators

Make noaccel accelerator "registered" early so that kqemu has a change to be enabled (it's registered via __constructor__ feature, so called before main()).

---
 vl.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
vl.c +5 -4
index 16c1e15..bf9d83c 100644
@@ -243,7 +243,6 @@ static CPUState *next_cpu;
 static int event_pending = 1;
 
 QEMUAccel *current_accel;
-QEMUCont *head = NULL;
 char qemu_app_name[20] = "QEMU";
 
 void decorate_app_name(void)
@@ -290,6 +289,11 @@ QEMUAccel noaccel = {
     .break_loop = accel_nop,
 };
 
+QEMUCont *head = &(QEMUCont){
+	.acc = &noaccel,
+	.active = 0,
+};
+
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /***********************************************************/
@@ -7766,9 +7770,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    /* Basic handler for the noaccel case */
-    register_qemu_accel(&noaccel);
-
     register_machines();
     machine = first_machine;
     cpu_model = NULL;
Signature · 1 line
1.5.6.5
#1 lore raw
Quoted 3 lines · Dmitry Baryshkov

Make noaccel accelerator "registered" early so that kqemu has a change to be enabled (it's registered via __constructor__ feature, so called before main()).

fyi: we're probably changing that. There has been a lot of mail exchange this days about the general acceptability of this feature, and the overall feeling is that it's a negative construct. So if the problem you hit happens because the constructor itself, it's probably worthy to drop it altogether, and invest time in a new method for registering the accelerators.

Quoted 20 lines
---
 vl.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
vl.c +0 -1
index 16c1e15..bf9d83c 100644
@@ -243,7 +243,6 @@ static CPUState *next_cpu;
 static int event_pending = 1;
 
 QEMUAccel *current_accel;
-QEMUCont *head = NULL;
 char qemu_app_name[20] = "QEMU";
 
 void decorate_app_name(void)

vl.c QEMUAccel noaccel = { · line 295

Quoted 7 lines
vl.c +4 -0
@@ -290,6 +289,11 @@ QEMUAccel noaccel = {
     .break_loop = accel_nop,
 };
 
+QEMUCont *head = &(QEMUCont){
+	.acc = &noaccel,
+	.active = 0,
+};

don't we want to register it as active = 1, for the case we're not using kqemu at all?

Quoted 17 lines
vl.c +1 -3
+
 #define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
 
 /***********************************************************/
@@ -7766,9 +7770,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    /* Basic handler for the noaccel case */
-    register_qemu_accel(&noaccel);
-
     register_machines();
     machine = first_machine;
     cpu_model = NULL;
Signature · 1 line
1.5.6.5
#2 lore raw
Quoted 6 lines · Glauber Costa
Quoted 3 lines · Dmitry Baryshkov

Make noaccel accelerator "registered" early so that kqemu has a change to be enabled (it's registered via __constructor__ feature, so called before main()).

fyi: we're probably changing that. There has been a lot of mail exchange this days about the general acceptability of this feature, and the overall

[ That was a private discussion, I guess. ]

Quoted 3 lines

feeling is that it's a negative construct. So if the problem you hit happens because the constructor itself, it's probably worthy to drop it altogether, and invest time in a new method for registering the accelerators.

Do you plan to update/rebase QEMUAccel in the near future? Or what is the short-term roadmap of this approach?

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#3 lore raw
Quoted 9 lines · Jan Kiszka
Quoted 6 lines · Glauber Costa
Quoted 3 lines · Dmitry Baryshkov

Make noaccel accelerator "registered" early so that kqemu has a change to be enabled (it's registered via __constructor__ feature, so called before main()).

fyi: we're probably changing that. There has been a lot of mail exchange this days about the general acceptability of this feature, and the overall

[ That was a private discussion, I guess. ]

No. That was on list, triggered by Gerd. But right now I can't remember how it started.

Quoted 7 lines
Quoted 4 lines

feeling is that it's a negative construct. So if the problem you hit happens because the constructor itself, it's probably worthy to drop it altogether, and invest time in a new method for registering the accelerators.

Do you plan to update/rebase QEMUAccel in the near future? Or what is the short-term roadmap of this approach?

I plan to update it as soon as I finish the memory rework I'm doing, with a somewhat broad definition of "finish" (they don't need to be accepted, just be in a more definitive shape). I expect it to happen somewhere next week.

#4 lore raw
Quoted 11 lines · Glauber Costa
Quoted 8 lines · Jan Kiszka
Quoted 6 lines · Glauber Costa
Quoted 3 lines · Dmitry Baryshkov

Make noaccel accelerator "registered" early so that kqemu has a change to be enabled (it's registered via __constructor__ feature, so called before main()).

fyi: we're probably changing that. There has been a lot of mail exchange this days about the general acceptability of this feature, and the overall

[ That was a private discussion, I guess. ]

No. That was on list, triggered by Gerd. But right now I can't remember how it started.

Now I got what you are referring to:
http://comments.gmane.org/gmane.comp.emulators.qemu/28138

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux
#5 lore raw

PATCH 2/2 qemu-accel: unbreak kqemu

In reply to Dmitry Baryshkov

commit 1884dcadd64e1c4535a2b3e88008be9070aeb25b broke accelerators (at least kqemu) because it's initialised too early. Move accel_start() later (as it was before) so that it has all necessary data.

---
 vl.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
vl.c +3 -2
index bf9d83c..bc0fc3f 100644
@@ -8508,13 +8508,14 @@ int main(int argc, char **argv)
         exit(1);
     }
 
+    /* init the dynamic translator */
+    cpu_exec_init_all(tb_size * 1024 * 1024);
+
     if (accel_start()) {
 	    fprintf(stderr, "qemu: error, no suitable accelerator found\n");
 	    exit(1);
     }
 
-    /* init the dynamic translator */
-    cpu_exec_init_all(tb_size * 1024 * 1024);
 
     bdrv_init();
 
Signature · 1 line
1.5.6.5