|
| From: | Richard Henderson |
| Subject: | Re: [PATCH v5 05/31] sysemu: Introduce AccelOpsClass::has_work() |
| Date: | Mon, 20 Sep 2021 14:58:07 -0700 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
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.
r~
| [Prev in Thread] | Current Thread | [Next in Thread] |