qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v5 05/31] sysemu: Introduce AccelOpsClass::has_work()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v5 05/31] sysemu: Introduce AccelOpsClass::has_work()
Date: Thu, 23 Sep 2021 19:17:36 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 9/20/21 23:58, Richard Henderson wrote:
On 9/20/21 2:44 PM, Philippe Mathieu-Daudé wrote:
-    g_assert(cc->has_work);
-    return cc->has_work(cpu);
+    if (cc->has_work) {
+        return cc->has_work(cpu);
+    }
+    if (cpus_accel->has_work) {
+        return cpus_accel->has_work(cpu);
+    }
+    g_assert_not_reached();

This might be close to the end result, but it isn't what we begin with in cpu_thread_is_idle.

You'd want

     if (cc->has_work && cc->has_work(cpu)) {
         return true;
     }
     if (cpus_accel->has_work && cpus_accel->has_work(cpu)) {
         return true;
     }
     return false;

to start.  After the cpus_accel hook is filled in you can assert and return from cpus_accel->has_work.  And of course after cc->has_work is removed, that clause is gone.

Much cleaner, thank you for the hints :)



reply via email to

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