diff mbox

[RFC,V6,01/18] cpu: make cpu_thread_is_idle public.

Message ID 1435330053-18733-2-git-send-email-fred.konrad@greensocs.com
State New
Headers show

Commit Message

fred.konrad@greensocs.com June 26, 2015, 2:47 p.m. UTC
From: KONRAD Frederic <fred.konrad@greensocs.com>

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
---
 cpus.c            |  2 +-
 include/qom/cpu.h | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Alex Bennée July 7, 2015, 9:47 a.m. UTC | #1
fred.konrad@greensocs.com writes:

> From: KONRAD Frederic <fred.konrad@greensocs.com>

Why are we making this visible? Looking at the tree I can't see it being
used outside the cpus.c. I see the function is modified later for async
work. Is this something we are planing to use later?

>
> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
> ---
>  cpus.c            |  2 +-
>  include/qom/cpu.h | 11 +++++++++++
>  2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/cpus.c b/cpus.c
> index 4f0e54d..2d62a35 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -74,7 +74,7 @@ bool cpu_is_stopped(CPUState *cpu)
>      return cpu->stopped || !runstate_is_running();
>  }
>  
> -static bool cpu_thread_is_idle(CPUState *cpu)
> +bool cpu_thread_is_idle(CPUState *cpu)
>  {
>      if (cpu->stop || cpu->queued_work_first) {
>          return false;
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index 39f0f19..af3c9e4 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -514,6 +514,17 @@ void qemu_cpu_kick(CPUState *cpu);
>  bool cpu_is_stopped(CPUState *cpu);
>  
>  /**
> + * cpu_thread_is_idle:
> + * @cpu: The CPU to check.
> + *
> + * Checks whether the CPU thread is idle.
> + *
> + * Returns: %true if the thread is idle;
> + * %false otherwise.
> + */
> +bool cpu_thread_is_idle(CPUState *cpu);
> +
> +/**
>   * run_on_cpu:
>   * @cpu: The vCPU to run on.
>   * @func: The function to be executed.
fred.konrad@greensocs.com July 7, 2015, 11:43 a.m. UTC | #2
On 07/07/2015 11:47, Alex Bennée wrote:
> fred.konrad@greensocs.com writes:
>
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
> Why are we making this visible? Looking at the tree I can't see it being
> used outside the cpus.c. I see the function is modified later for async
> work. Is this something we are planing to use later?

Thanks for spoting this..
It is probably something we used before I put async_safe_work.

Fred
>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>> ---
>>   cpus.c            |  2 +-
>>   include/qom/cpu.h | 11 +++++++++++
>>   2 files changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index 4f0e54d..2d62a35 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -74,7 +74,7 @@ bool cpu_is_stopped(CPUState *cpu)
>>       return cpu->stopped || !runstate_is_running();
>>   }
>>   
>> -static bool cpu_thread_is_idle(CPUState *cpu)
>> +bool cpu_thread_is_idle(CPUState *cpu)
>>   {
>>       if (cpu->stop || cpu->queued_work_first) {
>>           return false;
>> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
>> index 39f0f19..af3c9e4 100644
>> --- a/include/qom/cpu.h
>> +++ b/include/qom/cpu.h
>> @@ -514,6 +514,17 @@ void qemu_cpu_kick(CPUState *cpu);
>>   bool cpu_is_stopped(CPUState *cpu);
>>   
>>   /**
>> + * cpu_thread_is_idle:
>> + * @cpu: The CPU to check.
>> + *
>> + * Checks whether the CPU thread is idle.
>> + *
>> + * Returns: %true if the thread is idle;
>> + * %false otherwise.
>> + */
>> +bool cpu_thread_is_idle(CPUState *cpu);
>> +
>> +/**
>>    * run_on_cpu:
>>    * @cpu: The vCPU to run on.
>>    * @func: The function to be executed.
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index 4f0e54d..2d62a35 100644
--- a/cpus.c
+++ b/cpus.c
@@ -74,7 +74,7 @@  bool cpu_is_stopped(CPUState *cpu)
     return cpu->stopped || !runstate_is_running();
 }
 
-static bool cpu_thread_is_idle(CPUState *cpu)
+bool cpu_thread_is_idle(CPUState *cpu)
 {
     if (cpu->stop || cpu->queued_work_first) {
         return false;
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index 39f0f19..af3c9e4 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -514,6 +514,17 @@  void qemu_cpu_kick(CPUState *cpu);
 bool cpu_is_stopped(CPUState *cpu);
 
 /**
+ * cpu_thread_is_idle:
+ * @cpu: The CPU to check.
+ *
+ * Checks whether the CPU thread is idle.
+ *
+ * Returns: %true if the thread is idle;
+ * %false otherwise.
+ */
+bool cpu_thread_is_idle(CPUState *cpu);
+
+/**
  * run_on_cpu:
  * @cpu: The vCPU to run on.
  * @func: The function to be executed.