All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	Igor Mammedov <imammedo@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-arm] [Qemu-devel] [PATCH v3] numa: improve cpu hotplug error message with a wrong node-id
Date: Fri, 24 May 2019 17:14:32 -0300	[thread overview]
Message-ID: <20190524201432.GP10764@habkost.net> (raw)
In-Reply-To: <c1c017f2-84ed-bddf-abb9-7154d9edb372@redhat.com>

On Fri, May 24, 2019 at 04:39:12PM +0200, Laurent Vivier wrote:
> On 24/05/2019 16:10, Igor Mammedov wrote:
> > On Fri, 24 May 2019 12:35:21 +0200
> > Laurent Vivier <lvivier@redhat.com> wrote:
> > 
> > > On pseries, core-ids are strongly binded to a node-id by the command
> > > line option. If an user tries to add a CPU to the wrong node, he has
> > > an error but it is not really helpful:
> > > 
> > >    qemu-system-ppc64 ... -smp 1,maxcpus=64,cores=1,threads=1,sockets=1 \
> > >                          -numa node,nodeid=0 -numa node,nodeid=1 ...
> > > 
> > >    (qemu) device_add power9_v2.0-spapr-cpu-core,core-id=30,node-id=1
> > >    Error: node-id=1 must match numa node specified with -numa option
> > > 
> > > This patch improves this error message by giving to the user the good
> > > topology information (node-id, socket-id and thread-id if they are
> > > available) to use with the core-id he's providing:
> > > 
> > >    Error: node-id=1 must match numa node specified with -numa option 'node-id 0'
> > > 
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > > ---
> > > 
> > > Notes:
> > >      v3: only add the topology to the existing message
> > >          As suggested by Igor replace
> > >            Error: core-id 30 can only be plugged into node-id 0
> > >          by
> > >            Error: node-id=1 must match numa node specified with -numa option 'node-id 0'
> > >      v2: display full topology in the error message
> > > > > >   numa.c | 25 ++++++++++++++++++++++++-
> > >   1 file changed, 24 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/numa.c b/numa.c
> > > index 3875e1efda3a..7882ec294be4 100644
> > > --- a/numa.c
> > > +++ b/numa.c
> > > @@ -458,6 +458,27 @@ void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
> > >       set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
> > >   }
> > > +static char *cpu_topology_to_string(const CPUArchId *cpu)
> > > +{
> > > +    GString *s = g_string_new(NULL);
> > > +    if (cpu->props.has_socket_id) {
> > > +        g_string_append_printf(s, "socket-id %"PRId64, cpu->props.socket_id);
> > > +    }
> > > +    if (cpu->props.has_node_id) {
> > > +        if (s->len) {
> > > +            g_string_append_printf(s, ", ");
> > > +        }
> > > +        g_string_append_printf(s, "node-id %"PRId64, cpu->props.node_id);
> > > +    }
> > > +    if (cpu->props.has_thread_id) {
> > > +        if (s->len) {
> > > +            g_string_append_printf(s, ", ");
> > > +        }
> > > +        g_string_append_printf(s, "thread-id %"PRId64, cpu->props.thread_id);
> > > +    }
> > > +    return g_string_free(s, false);
> > > +}
> > 
> > turns out we already have such helper: cpu_slot_to_string()
> 
> It doesn't display the node-id but the core-id. And node-id is what we need
> to know.

I'm confused about what you are trying to do here.

On v1, the message looked like:
  Error: core-id 30 can only be plugged into node-id 0

which is probably good for spapr.


Then I suggested you added the other cpu->props fields.  e.g. on
PC the message would look like:
  Error: socket-id 20, core-id 30, thread-id 40 can only be plugged into node-id 0


But you sent a v2 patch that would print this on PC:
  Error: core-id 30 can only be plugged into socket-id 20, node-id 0, thread-id 40

which doesn't make sense to me.


Then in a reply to v2, Igor suggested:

 error_setg(errp, "node-id=%d must match numa node specified "
                   "with -numa option '%s'", node_id, topology);


Igor suggest would address the problem above.  I expected it to become:
  node-id=0 must match numa node specified with -numa option core-id=30
and on PC:
  node-id=0 must match numa node specified with -numa option socket-id=20,core-id=30,thread-id=40

Or maybe it could include the input node-id too:
  node-id=0 must match numa node specified with -numa option node-id=1,core-id=30
and on PC:
  node-id=0 must match numa node specified with -numa option node-id=1,socket-id=20,core-id=30,thread-id=40

Both options would work.


But you implemented code that would print:
  Error: node-id=0 must match numa node specified with -numa option 'node-id 1'
and on PC it would print:
  Error: node-id=0 must match numa node specified with -numa option 'socket-id 20 node-id 1 thread-id=40'

which doesn't make sense to me.


I was expecting something like:
  Error: CPU slot core-id=30 is bound to node-id 0, but node-id 1 was specified
and on PC:
  Error: CPU slot socket-id=20,core-id=30,thread-id=40 is bound to node-id 0, but node-id 1 was specified


-- 
Eduardo

WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Habkost <ehabkost@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
	Igor Mammedov <imammedo@redhat.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [Qemu-devel] [PATCH v3] numa: improve cpu hotplug error message with a wrong node-id
Date: Fri, 24 May 2019 17:14:32 -0300	[thread overview]
Message-ID: <20190524201432.GP10764@habkost.net> (raw)
In-Reply-To: <c1c017f2-84ed-bddf-abb9-7154d9edb372@redhat.com>

On Fri, May 24, 2019 at 04:39:12PM +0200, Laurent Vivier wrote:
> On 24/05/2019 16:10, Igor Mammedov wrote:
> > On Fri, 24 May 2019 12:35:21 +0200
> > Laurent Vivier <lvivier@redhat.com> wrote:
> > 
> > > On pseries, core-ids are strongly binded to a node-id by the command
> > > line option. If an user tries to add a CPU to the wrong node, he has
> > > an error but it is not really helpful:
> > > 
> > >    qemu-system-ppc64 ... -smp 1,maxcpus=64,cores=1,threads=1,sockets=1 \
> > >                          -numa node,nodeid=0 -numa node,nodeid=1 ...
> > > 
> > >    (qemu) device_add power9_v2.0-spapr-cpu-core,core-id=30,node-id=1
> > >    Error: node-id=1 must match numa node specified with -numa option
> > > 
> > > This patch improves this error message by giving to the user the good
> > > topology information (node-id, socket-id and thread-id if they are
> > > available) to use with the core-id he's providing:
> > > 
> > >    Error: node-id=1 must match numa node specified with -numa option 'node-id 0'
> > > 
> > > Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> > > ---
> > > 
> > > Notes:
> > >      v3: only add the topology to the existing message
> > >          As suggested by Igor replace
> > >            Error: core-id 30 can only be plugged into node-id 0
> > >          by
> > >            Error: node-id=1 must match numa node specified with -numa option 'node-id 0'
> > >      v2: display full topology in the error message
> > > > > >   numa.c | 25 ++++++++++++++++++++++++-
> > >   1 file changed, 24 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/numa.c b/numa.c
> > > index 3875e1efda3a..7882ec294be4 100644
> > > --- a/numa.c
> > > +++ b/numa.c
> > > @@ -458,6 +458,27 @@ void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
> > >       set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
> > >   }
> > > +static char *cpu_topology_to_string(const CPUArchId *cpu)
> > > +{
> > > +    GString *s = g_string_new(NULL);
> > > +    if (cpu->props.has_socket_id) {
> > > +        g_string_append_printf(s, "socket-id %"PRId64, cpu->props.socket_id);
> > > +    }
> > > +    if (cpu->props.has_node_id) {
> > > +        if (s->len) {
> > > +            g_string_append_printf(s, ", ");
> > > +        }
> > > +        g_string_append_printf(s, "node-id %"PRId64, cpu->props.node_id);
> > > +    }
> > > +    if (cpu->props.has_thread_id) {
> > > +        if (s->len) {
> > > +            g_string_append_printf(s, ", ");
> > > +        }
> > > +        g_string_append_printf(s, "thread-id %"PRId64, cpu->props.thread_id);
> > > +    }
> > > +    return g_string_free(s, false);
> > > +}
> > 
> > turns out we already have such helper: cpu_slot_to_string()
> 
> It doesn't display the node-id but the core-id. And node-id is what we need
> to know.

I'm confused about what you are trying to do here.

On v1, the message looked like:
  Error: core-id 30 can only be plugged into node-id 0

which is probably good for spapr.


Then I suggested you added the other cpu->props fields.  e.g. on
PC the message would look like:
  Error: socket-id 20, core-id 30, thread-id 40 can only be plugged into node-id 0


But you sent a v2 patch that would print this on PC:
  Error: core-id 30 can only be plugged into socket-id 20, node-id 0, thread-id 40

which doesn't make sense to me.


Then in a reply to v2, Igor suggested:

 error_setg(errp, "node-id=%d must match numa node specified "
                   "with -numa option '%s'", node_id, topology);


Igor suggest would address the problem above.  I expected it to become:
  node-id=0 must match numa node specified with -numa option core-id=30
and on PC:
  node-id=0 must match numa node specified with -numa option socket-id=20,core-id=30,thread-id=40

Or maybe it could include the input node-id too:
  node-id=0 must match numa node specified with -numa option node-id=1,core-id=30
and on PC:
  node-id=0 must match numa node specified with -numa option node-id=1,socket-id=20,core-id=30,thread-id=40

Both options would work.


But you implemented code that would print:
  Error: node-id=0 must match numa node specified with -numa option 'node-id 1'
and on PC it would print:
  Error: node-id=0 must match numa node specified with -numa option 'socket-id 20 node-id 1 thread-id=40'

which doesn't make sense to me.


I was expecting something like:
  Error: CPU slot core-id=30 is bound to node-id 0, but node-id 1 was specified
and on PC:
  Error: CPU slot socket-id=20,core-id=30,thread-id=40 is bound to node-id 0, but node-id 1 was specified


-- 
Eduardo


  reply	other threads:[~2019-05-24 20:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24 10:35 [Qemu-devel] [PATCH v3] numa: improve cpu hotplug error message with a wrong node-id Laurent Vivier
2019-05-24 14:10 ` Igor Mammedov
2019-05-24 14:39   ` [Qemu-arm] " Laurent Vivier
2019-05-24 14:39     ` Laurent Vivier
2019-05-24 20:14     ` Eduardo Habkost [this message]
2019-05-24 20:14       ` Eduardo Habkost
2019-05-27  6:55       ` [Qemu-arm] " Laurent Vivier
2019-05-27  6:55         ` Laurent Vivier
2019-05-27 12:50         ` [Qemu-arm] " Igor Mammedov
2019-05-27 12:50           ` Igor Mammedov
2019-05-27 13:52           ` [Qemu-arm] " Laurent Vivier
2019-05-27 13:52             ` Laurent Vivier
2019-05-28 13:44             ` [Qemu-arm] " Eduardo Habkost
2019-05-28 13:44               ` Eduardo Habkost
2019-05-28 13:57               ` Laurent Vivier
2019-05-28 13:59             ` [Qemu-arm] " Igor Mammedov
2019-05-28 13:59               ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190524201432.GP10764@habkost.net \
    --to=ehabkost@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=imammedo@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.