All of lore.kernel.org
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@citrix.com>
To: Juergen Gross <jgross@suse.com>, xen-devel@lists.xenproject.org
Cc: George.Dunlap@eu.citrix.com, wei.liu2@citrix.com,
	ian.jackson@eu.citrix.com
Subject: Re: [PATCH v2 2/2] xentrace: handle sparse cpu ids correctly in xen trace buffer handling
Date: Thu, 4 Oct 2018 12:39:58 +0100	[thread overview]
Message-ID: <c1caf173-3484-f942-a351-b614f36afff2@citrix.com> (raw)
In-Reply-To: <20181004105150.27923-3-jgross@suse.com>

On 10/04/2018 11:51 AM, Juergen Gross wrote:
> The per-cpu buffers for Xentrace are addressed by cpu-id, but the info
> array for the buffers is sized only by number of online cpus. This
> might lead to crashes when using Xentrace with smt=0.
> 
> The t_info structure has to be sized based on nr_cpu_ids.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  tools/xentrace/xentrace.c | 2 +-
>  xen/common/trace.c        | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
> index 590a91e091..12497a16b4 100644
> --- a/tools/xentrace/xentrace.c
> +++ b/tools/xentrace/xentrace.c
> @@ -596,7 +596,7 @@ static unsigned int get_num_cpus(void)
>          exit(EXIT_FAILURE);
>      }
>  
> -    return physinfo.nr_cpus;
> +    return physinfo.max_cpu_id + 1;
>  }
>  
>  /**
> diff --git a/xen/common/trace.c b/xen/common/trace.c
> index 8cdc17b731..c079454c6a 100644
> --- a/xen/common/trace.c
> +++ b/xen/common/trace.c
> @@ -113,7 +113,7 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset)
>      struct t_info dummy_pages;
>      typeof(dummy_pages.tbuf_size) max_pages;
>      typeof(dummy_pages.mfn_offset[0]) max_mfn_offset;
> -    unsigned int max_cpus = num_online_cpus();
> +    unsigned int max_cpus = nr_cpu_ids;
>      unsigned int t_info_words;
>  
>      /* force maximum value for an unsigned type */
> @@ -151,11 +151,11 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset)
>       * NB this calculation is correct, because t_info_first_offset is
>       * in words, not bytes, not bytes
>       */

This sounds a bit like song lyrics.

But that's not your fault, not your fault:

Reviewed-by: George Dunlap <george.dunlap@citrix.com>

I'll fix the comment on check-in.

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

      reply	other threads:[~2018-10-04 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 10:51 [PATCH v2 0/2] xentrace: fix xentrace for smt=0 Juergen Gross
2018-10-04 10:51 ` [PATCH v2 1/2] xentrace: allow sparse cpu list Juergen Gross
2018-10-04 11:22   ` George Dunlap
2018-10-04 11:25     ` Juergen Gross
2018-10-04 10:51 ` [PATCH v2 2/2] xentrace: handle sparse cpu ids correctly in xen trace buffer handling Juergen Gross
2018-10-04 11:39   ` George Dunlap [this message]

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=c1caf173-3484-f942-a351-b614f36afff2@citrix.com \
    --to=george.dunlap@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jgross@suse.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.