From: Olaf Hering <olaf@aepfle.de>
To: Jan Beulich <jbeulich@suse.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: xentrace buffer size, maxcpus and online cpus
Date: Tue, 30 May 2023 22:06:13 +0200 [thread overview]
Message-ID: <20230530220613.4c4da5cc.olaf@aepfle.de> (raw)
In-Reply-To: <578d341d-0c54-de64-73e7-1dfc7e5d7584@suse.com>
[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]
Tue, 30 May 2023 10:41:07 +0200 Jan Beulich <jbeulich@suse.com>:
> Using this N would be correct afaict, but that N isn't num_online_cpus().
> CPUs may have been offlined by the time trace buffers are initialized, so
> without looking too closely I think it would be num_present_cpus() that
> you're after.
In my testing num_online_cpus returns N, while num_present_cpus returns
all available pcpus. There is also num_possible_cpus, but this appears to
be an ARM thing.
If Xen is booted with maxcpus=, is there a way to use the remaining cpus?
In case this is possible, the code needs adjustment to reinitialize the
trace buffers. This is not an easy change. But if the remaining cpus
will remain offline, then something like this may work:
+++ b/xen/common/trace.c
@@ -110,7 +110,8 @@ 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 = nr_cpu_ids;
+ unsigned int nr_cpus = num_online_cpus();
+ unsigned int max_cpus = nr_cpus;
unsigned int t_info_words;
/* force maximum value for an unsigned type */
@@ -148,11 +149,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
*/
- t_info_words = nr_cpu_ids * pages + t_info_first_offset;
+ t_info_words = nr_cpus * pages + t_info_first_offset;
t_info_pages = PFN_UP(t_info_words * sizeof(uint32_t));
printk(XENLOG_INFO "xentrace: requesting %u t_info pages "
"for %u trace pages on %u cpus\n",
- t_info_pages, pages, nr_cpu_ids);
+ t_info_pages, pages, nr_cpus);
return pages;
}
Olaf
[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-05-30 20:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 7:58 xentrace buffer size, maxcpus and online cpus Olaf Hering
2023-05-30 8:41 ` Jan Beulich
2023-05-30 20:06 ` Olaf Hering [this message]
2023-05-31 9:05 ` Jan Beulich
2023-06-16 11:47 ` Olaf Hering
2023-06-16 11:52 ` Jan Beulich
2023-06-16 14:22 ` George Dunlap
2023-06-16 15:37 ` Olaf Hering
2023-06-16 16:08 ` Andrew Cooper
2023-06-19 10:16 ` Olaf Hering
2023-06-19 11:14 ` Andrew Cooper
2023-06-19 10:13 ` Olaf Hering
2023-06-19 10:22 ` Jan Beulich
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=20230530220613.4c4da5cc.olaf@aepfle.de \
--to=olaf@aepfle.de \
--cc=jbeulich@suse.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.