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 <[email protected]> > --- > 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 <[email protected]> I'll fix the comment on check-in. -George _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
