diff mbox

[v3,06/10] monitor: fix crash for platforms without a CPU 0

Message ID 1473943560-14846-7-git-send-email-clg@kaod.org
State New
Headers show

Commit Message

Cédric Le Goater Sept. 15, 2016, 12:45 p.m. UTC
On PowerNV, CPU ids start at 0x8 or 0x20, we don't have a CPU 0
anymore. So let's use the first_cpu index to initialize the monitor.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Gibson Sept. 21, 2016, 5:30 a.m. UTC | #1
On Thu, Sep 15, 2016 at 02:45:56PM +0200, Cédric Le Goater wrote:
> On PowerNV, CPU ids start at 0x8 or 0x20, we don't have a CPU 0
> anymore. So let's use the first_cpu index to initialize the monitor.
> 
> Signed-off-by: Cédric Le Goater <clg@kaod.org>

I've rewritten the commit message to make the case for this without
the context of pnv and posted upstream.

> ---
>  monitor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/monitor.c b/monitor.c
> index 5c003731e288..0192209a7915 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -1023,7 +1023,7 @@ int monitor_set_cpu(int cpu_index)
>  CPUState *mon_get_cpu(void)
>  {
>      if (!cur_mon->mon_cpu) {
> -        monitor_set_cpu(0);
> +        monitor_set_cpu(first_cpu->cpu_index);
>      }
>      cpu_synchronize_state(cur_mon->mon_cpu);
>      return cur_mon->mon_cpu;
Cédric Le Goater Sept. 21, 2016, 8:06 a.m. UTC | #2
On 09/21/2016 07:30 AM, David Gibson wrote:
> On Thu, Sep 15, 2016 at 02:45:56PM +0200, Cédric Le Goater wrote:
>> On PowerNV, CPU ids start at 0x8 or 0x20, we don't have a CPU 0
>> anymore. So let's use the first_cpu index to initialize the monitor.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> 
> I've rewritten the commit message to make the case for this without
> the context of pnv and posted upstream.

Yes this is better. Thanks.

C.
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 5c003731e288..0192209a7915 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1023,7 +1023,7 @@  int monitor_set_cpu(int cpu_index)
 CPUState *mon_get_cpu(void)
 {
     if (!cur_mon->mon_cpu) {
-        monitor_set_cpu(0);
+        monitor_set_cpu(first_cpu->cpu_index);
     }
     cpu_synchronize_state(cur_mon->mon_cpu);
     return cur_mon->mon_cpu;