* [PATCH] cpus: Move CPU code from exec.c to cpus.c
@ 2020-07-01 17:54 Philippe Mathieu-Daudé
2020-07-02 4:06 ` Richard Henderson
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-01 17:54 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Philippe Mathieu-Daudé, Richard Henderson
This code was introduced with SMP support in commit 6a00d60127,
later commit 296af7c952 moved CPU parts to cpus.c but forgot this
code. Move now and simplify ifdef'ry.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
cpus.c | 18 ++++++++++++++++++
exec.c | 22 ----------------------
2 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/cpus.c b/cpus.c
index 41d1c5099f..472686cbbc 100644
--- a/cpus.c
+++ b/cpus.c
@@ -92,6 +92,11 @@ static unsigned int throttle_percentage;
#define CPU_THROTTLE_PCT_MAX 99
#define CPU_THROTTLE_TIMESLICE_NS 10000000
+CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
+
+/* current CPU in the current thread. It is only valid inside cpu_exec() */
+__thread CPUState *current_cpu;
+
bool cpu_is_stopped(CPUState *cpu)
{
return cpu->stopped || !runstate_is_running();
@@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)
return true;
}
+CPUState *qemu_get_cpu(int index)
+{
+ CPUState *cpu;
+
+ CPU_FOREACH(cpu) {
+ if (cpu->cpu_index == index) {
+ return cpu;
+ }
+ }
+
+ return NULL;
+}
+
/***********************************************************/
/* guest cycle counter */
diff --git a/exec.c b/exec.c
index 21926dc9c7..997b7db15f 100644
--- a/exec.c
+++ b/exec.c
@@ -98,12 +98,6 @@ AddressSpace address_space_memory;
static MemoryRegion io_mem_unassigned;
#endif
-CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
-
-/* current CPU in the current thread. It is only valid inside
- cpu_exec() */
-__thread CPUState *current_cpu;
-
uintptr_t qemu_host_page_size;
intptr_t qemu_host_page_mask;
@@ -832,22 +826,6 @@ const VMStateDescription vmstate_cpu_common = {
}
};
-#endif
-
-CPUState *qemu_get_cpu(int index)
-{
- CPUState *cpu;
-
- CPU_FOREACH(cpu) {
- if (cpu->cpu_index == index) {
- return cpu;
- }
- }
-
- return NULL;
-}
-
-#if !defined(CONFIG_USER_ONLY)
void cpu_address_space_init(CPUState *cpu, int asidx,
const char *prefix, MemoryRegion *mr)
{
--
2.21.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] cpus: Move CPU code from exec.c to cpus.c
2020-07-01 17:54 [PATCH] cpus: Move CPU code from exec.c to cpus.c Philippe Mathieu-Daudé
@ 2020-07-02 4:06 ` Richard Henderson
2020-07-02 9:38 ` Paolo Bonzini
2020-07-02 10:26 ` Alex Bennée
2 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2020-07-02 4:06 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Paolo Bonzini, Richard Henderson
On 7/1/20 10:54 AM, Philippe Mathieu-Daudé wrote:
> This code was introduced with SMP support in commit 6a00d60127,
> later commit 296af7c952 moved CPU parts to cpus.c but forgot this
> code. Move now and simplify ifdef'ry.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> cpus.c | 18 ++++++++++++++++++
> exec.c | 22 ----------------------
> 2 files changed, 18 insertions(+), 22 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpus: Move CPU code from exec.c to cpus.c
2020-07-01 17:54 [PATCH] cpus: Move CPU code from exec.c to cpus.c Philippe Mathieu-Daudé
2020-07-02 4:06 ` Richard Henderson
@ 2020-07-02 9:38 ` Paolo Bonzini
2020-07-02 10:21 ` Paolo Bonzini
2020-07-02 10:26 ` Alex Bennée
2 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2020-07-02 9:38 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Richard Henderson
On 01/07/20 19:54, Philippe Mathieu-Daudé wrote:
> This code was introduced with SMP support in commit 6a00d60127,
> later commit 296af7c952 moved CPU parts to cpus.c but forgot this
> code. Move now and simplify ifdef'ry.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> cpus.c | 18 ++++++++++++++++++
> exec.c | 22 ----------------------
> 2 files changed, 18 insertions(+), 22 deletions(-)
>
> diff --git a/cpus.c b/cpus.c
> index 41d1c5099f..472686cbbc 100644
> --- a/cpus.c
> +++ b/cpus.c
> @@ -92,6 +92,11 @@ static unsigned int throttle_percentage;
> #define CPU_THROTTLE_PCT_MAX 99
> #define CPU_THROTTLE_TIMESLICE_NS 10000000
>
> +CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
> +
> +/* current CPU in the current thread. It is only valid inside cpu_exec() */
> +__thread CPUState *current_cpu;
> +
> bool cpu_is_stopped(CPUState *cpu)
> {
> return cpu->stopped || !runstate_is_running();
> @@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)
> return true;
> }
>
> +CPUState *qemu_get_cpu(int index)
> +{
> + CPUState *cpu;
> +
> + CPU_FOREACH(cpu) {
> + if (cpu->cpu_index == index) {
> + return cpu;
> + }
> + }
> +
> + return NULL;
> +}
> +
> /***********************************************************/
> /* guest cycle counter */
>
> diff --git a/exec.c b/exec.c
> index 21926dc9c7..997b7db15f 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -98,12 +98,6 @@ AddressSpace address_space_memory;
> static MemoryRegion io_mem_unassigned;
> #endif
>
> -CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
> -
> -/* current CPU in the current thread. It is only valid inside
> - cpu_exec() */
> -__thread CPUState *current_cpu;
> -
> uintptr_t qemu_host_page_size;
> intptr_t qemu_host_page_mask;
>
> @@ -832,22 +826,6 @@ const VMStateDescription vmstate_cpu_common = {
> }
> };
>
> -#endif
> -
> -CPUState *qemu_get_cpu(int index)
> -{
> - CPUState *cpu;
> -
> - CPU_FOREACH(cpu) {
> - if (cpu->cpu_index == index) {
> - return cpu;
> - }
> - }
> -
> - return NULL;
> -}
> -
> -#if !defined(CONFIG_USER_ONLY)
> void cpu_address_space_init(CPUState *cpu, int asidx,
> const char *prefix, MemoryRegion *mr)
> {
>
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpus: Move CPU code from exec.c to cpus.c
2020-07-02 9:38 ` Paolo Bonzini
@ 2020-07-02 10:21 ` Paolo Bonzini
2020-07-02 10:31 ` Philippe Mathieu-Daudé
2020-07-02 10:33 ` Alex Bennée
0 siblings, 2 replies; 7+ messages in thread
From: Paolo Bonzini @ 2020-07-02 10:21 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Richard Henderson
On 02/07/20 11:38, Paolo Bonzini wrote:
> On 01/07/20 19:54, Philippe Mathieu-Daudé wrote:
>> This code was introduced with SMP support in commit 6a00d60127,
>> later commit 296af7c952 moved CPU parts to cpus.c but forgot this
>> code. Move now and simplify ifdef'ry.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> cpus.c | 18 ++++++++++++++++++
>> exec.c | 22 ----------------------
>> 2 files changed, 18 insertions(+), 22 deletions(-)
>>
>> diff --git a/cpus.c b/cpus.c
>> index 41d1c5099f..472686cbbc 100644
>> --- a/cpus.c
>> +++ b/cpus.c
>> @@ -92,6 +92,11 @@ static unsigned int throttle_percentage;
>> #define CPU_THROTTLE_PCT_MAX 99
>> #define CPU_THROTTLE_TIMESLICE_NS 10000000
>>
>> +CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
>> +
>> +/* current CPU in the current thread. It is only valid inside cpu_exec() */
>> +__thread CPUState *current_cpu;
>> +
>> bool cpu_is_stopped(CPUState *cpu)
>> {
>> return cpu->stopped || !runstate_is_running();
>> @@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)
>> return true;
>> }
>>
>> +CPUState *qemu_get_cpu(int index)
>> +{
>> + CPUState *cpu;
>> +
>> + CPU_FOREACH(cpu) {
>> + if (cpu->cpu_index == index) {
>> + return cpu;
>> + }
>> + }
>> +
>> + return NULL;
>> +}
>> +
>> /***********************************************************/
>> /* guest cycle counter */
>>
>> diff --git a/exec.c b/exec.c
>> index 21926dc9c7..997b7db15f 100644
>> --- a/exec.c
>> +++ b/exec.c
>> @@ -98,12 +98,6 @@ AddressSpace address_space_memory;
>> static MemoryRegion io_mem_unassigned;
>> #endif
>>
>> -CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
>> -
>> -/* current CPU in the current thread. It is only valid inside
>> - cpu_exec() */
>> -__thread CPUState *current_cpu;
>> -
>> uintptr_t qemu_host_page_size;
>> intptr_t qemu_host_page_mask;
>>
>> @@ -832,22 +826,6 @@ const VMStateDescription vmstate_cpu_common = {
>> }
>> };
>>
>> -#endif
>> -
>> -CPUState *qemu_get_cpu(int index)
>> -{
>> - CPUState *cpu;
>> -
>> - CPU_FOREACH(cpu) {
>> - if (cpu->cpu_index == index) {
>> - return cpu;
>> - }
>> - }
>> -
>> - return NULL;
>> -}
>> -
>> -#if !defined(CONFIG_USER_ONLY)
>> void cpu_address_space_init(CPUState *cpu, int asidx,
>> const char *prefix, MemoryRegion *mr)
>> {
>>
>
> Queued, thanks.
>
> Paolo
>
>
Wait... this is in exec.c because cpus.c is not linked into user-mode
emulators.
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpus: Move CPU code from exec.c to cpus.c
2020-07-01 17:54 [PATCH] cpus: Move CPU code from exec.c to cpus.c Philippe Mathieu-Daudé
2020-07-02 4:06 ` Richard Henderson
2020-07-02 9:38 ` Paolo Bonzini
@ 2020-07-02 10:26 ` Alex Bennée
2 siblings, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2020-07-02 10:26 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: Paolo Bonzini, qemu-devel, Richard Henderson
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> This code was introduced with SMP support in commit 6a00d60127,
> later commit 296af7c952 moved CPU parts to cpus.c but forgot this
> code. Move now and simplify ifdef'ry.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpus: Move CPU code from exec.c to cpus.c
2020-07-02 10:21 ` Paolo Bonzini
@ 2020-07-02 10:31 ` Philippe Mathieu-Daudé
2020-07-02 10:33 ` Alex Bennée
1 sibling, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-02 10:31 UTC (permalink / raw)
To: Paolo Bonzini, qemu-devel; +Cc: Richard Henderson
On 7/2/20 12:21 PM, Paolo Bonzini wrote:
> On 02/07/20 11:38, Paolo Bonzini wrote:
>> On 01/07/20 19:54, Philippe Mathieu-Daudé wrote:
>>> This code was introduced with SMP support in commit 6a00d60127,
>>> later commit 296af7c952 moved CPU parts to cpus.c but forgot this
>>> code. Move now and simplify ifdef'ry.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>> cpus.c | 18 ++++++++++++++++++
>>> exec.c | 22 ----------------------
>>> 2 files changed, 18 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/cpus.c b/cpus.c
>>> index 41d1c5099f..472686cbbc 100644
>>> --- a/cpus.c
>>> +++ b/cpus.c
>>> @@ -92,6 +92,11 @@ static unsigned int throttle_percentage;
>>> #define CPU_THROTTLE_PCT_MAX 99
>>> #define CPU_THROTTLE_TIMESLICE_NS 10000000
>>>
>>> +CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
>>> +
>>> +/* current CPU in the current thread. It is only valid inside cpu_exec() */
>>> +__thread CPUState *current_cpu;
>>> +
>>> bool cpu_is_stopped(CPUState *cpu)
>>> {
>>> return cpu->stopped || !runstate_is_running();
>>> @@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)
>>> return true;
>>> }
>>>
>>> +CPUState *qemu_get_cpu(int index)
>>> +{
>>> + CPUState *cpu;
>>> +
>>> + CPU_FOREACH(cpu) {
>>> + if (cpu->cpu_index == index) {
>>> + return cpu;
>>> + }
>>> + }
>>> +
>>> + return NULL;
>>> +}
>>> +
>>> /***********************************************************/
>>> /* guest cycle counter */
>>>
>>> diff --git a/exec.c b/exec.c
>>> index 21926dc9c7..997b7db15f 100644
>>> --- a/exec.c
>>> +++ b/exec.c
>>> @@ -98,12 +98,6 @@ AddressSpace address_space_memory;
>>> static MemoryRegion io_mem_unassigned;
>>> #endif
>>>
>>> -CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
>>> -
>>> -/* current CPU in the current thread. It is only valid inside
>>> - cpu_exec() */
>>> -__thread CPUState *current_cpu;
>>> -
>>> uintptr_t qemu_host_page_size;
>>> intptr_t qemu_host_page_mask;
>>>
>>> @@ -832,22 +826,6 @@ const VMStateDescription vmstate_cpu_common = {
>>> }
>>> };
>>>
>>> -#endif
>>> -
>>> -CPUState *qemu_get_cpu(int index)
>>> -{
>>> - CPUState *cpu;
>>> -
>>> - CPU_FOREACH(cpu) {
>>> - if (cpu->cpu_index == index) {
>>> - return cpu;
>>> - }
>>> - }
>>> -
>>> - return NULL;
>>> -}
>>> -
>>> -#if !defined(CONFIG_USER_ONLY)
>>> void cpu_address_space_init(CPUState *cpu, int asidx,
>>> const char *prefix, MemoryRegion *mr)
>>> {
>>>
>>
>> Queued, thanks.
>>
>> Paolo
>>
>>
>
> Wait... this is in exec.c because cpus.c is not linked into user-mode
> emulators.
Oops sorry. This should be moved to cpus-common.c then. Will respin.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpus: Move CPU code from exec.c to cpus.c
2020-07-02 10:21 ` Paolo Bonzini
2020-07-02 10:31 ` Philippe Mathieu-Daudé
@ 2020-07-02 10:33 ` Alex Bennée
1 sibling, 0 replies; 7+ messages in thread
From: Alex Bennée @ 2020-07-02 10:33 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: Philippe Mathieu-Daudé, qemu-devel, Richard Henderson
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 02/07/20 11:38, Paolo Bonzini wrote:
>> On 01/07/20 19:54, Philippe Mathieu-Daudé wrote:
>>> This code was introduced with SMP support in commit 6a00d60127,
>>> later commit 296af7c952 moved CPU parts to cpus.c but forgot this
>>> code. Move now and simplify ifdef'ry.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>> cpus.c | 18 ++++++++++++++++++
>>> exec.c | 22 ----------------------
>>> 2 files changed, 18 insertions(+), 22 deletions(-)
>>>
>>> diff --git a/cpus.c b/cpus.c
>>> index 41d1c5099f..472686cbbc 100644
>>> --- a/cpus.c
>>> +++ b/cpus.c
>>> @@ -92,6 +92,11 @@ static unsigned int throttle_percentage;
>>> #define CPU_THROTTLE_PCT_MAX 99
>>> #define CPU_THROTTLE_TIMESLICE_NS 10000000
>>>
>>> +CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
>>> +
>>> +/* current CPU in the current thread. It is only valid inside cpu_exec() */
>>> +__thread CPUState *current_cpu;
>>> +
>>> bool cpu_is_stopped(CPUState *cpu)
>>> {
>>> return cpu->stopped || !runstate_is_running();
>>> @@ -134,6 +139,19 @@ static bool all_cpu_threads_idle(void)
>>> return true;
>>> }
>>>
>>> +CPUState *qemu_get_cpu(int index)
>>> +{
>>> + CPUState *cpu;
>>> +
>>> + CPU_FOREACH(cpu) {
>>> + if (cpu->cpu_index == index) {
>>> + return cpu;
>>> + }
>>> + }
>>> +
>>> + return NULL;
>>> +}
>>> +
>>> /***********************************************************/
>>> /* guest cycle counter */
>>>
>>> diff --git a/exec.c b/exec.c
>>> index 21926dc9c7..997b7db15f 100644
>>> --- a/exec.c
>>> +++ b/exec.c
>>> @@ -98,12 +98,6 @@ AddressSpace address_space_memory;
>>> static MemoryRegion io_mem_unassigned;
>>> #endif
>>>
>>> -CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
>>> -
>>> -/* current CPU in the current thread. It is only valid inside
>>> - cpu_exec() */
>>> -__thread CPUState *current_cpu;
>>> -
>>> uintptr_t qemu_host_page_size;
>>> intptr_t qemu_host_page_mask;
>>>
>>> @@ -832,22 +826,6 @@ const VMStateDescription vmstate_cpu_common = {
>>> }
>>> };
>>>
>>> -#endif
>>> -
>>> -CPUState *qemu_get_cpu(int index)
>>> -{
>>> - CPUState *cpu;
>>> -
>>> - CPU_FOREACH(cpu) {
>>> - if (cpu->cpu_index == index) {
>>> - return cpu;
>>> - }
>>> - }
>>> -
>>> - return NULL;
>>> -}
>>> -
>>> -#if !defined(CONFIG_USER_ONLY)
>>> void cpu_address_space_init(CPUState *cpu, int asidx,
>>> const char *prefix, MemoryRegion *mr)
>>> {
>>>
>>
>> Queued, thanks.
>>
>> Paolo
>>
>>
>
> Wait... this is in exec.c because cpus.c is not linked into user-mode
> emulators.
cpus-common then?
--
Alex Bennée
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-07-02 10:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 17:54 [PATCH] cpus: Move CPU code from exec.c to cpus.c Philippe Mathieu-Daudé
2020-07-02 4:06 ` Richard Henderson
2020-07-02 9:38 ` Paolo Bonzini
2020-07-02 10:21 ` Paolo Bonzini
2020-07-02 10:31 ` Philippe Mathieu-Daudé
2020-07-02 10:33 ` Alex Bennée
2020-07-02 10:26 ` Alex Bennée
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.