From: Florian Weimer <fweimer@redhat.com>
To: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH 2/2] x86: Add generic CPUID data dumper to ld.so --list-diagnostics
Date: Mon, 11 Sep 2023 18:19:32 +0200 [thread overview]
Message-ID: <87o7i8ptrf.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <c0c498e7-03f5-0f29-c8ef-8e13894b1bdf@linaro.org> (Adhemerval Zanella Netto's message of "Mon, 11 Sep 2023 13:08:54 -0300")
* Adhemerval Zanella Netto:
>> +void
>> +_dl_diagnostics_cpu_kernel (void)
>> +{
>> +#if !HAS_CPUID
>> + /* CPUID is not supported, so there is nothing to dump. */
>> + if (__get_cpuid_max (0, 0) == 0)
>> + return;
>> +#endif
>
> I think we don't support __i486__ anymore, so we can just assume HAS_CPUID
> at sysdeps/x86/include/cpu-features.h.
We still build an i486 variant in build-many-glibcs.py.
> Why not use the interfaces to work on cpuset?
>
> if (length_reference > 0)
> {
> int cpu_count = CPU_COUNT_S (length_reference, mask_reference);
> for (int i = 0; i < cpu_count; i++)
> {
> if (CPU_ISSET_S (i, length_reference, mask_reference)
> {
> CPU_SET_S (i, length_reference, mask_request);
> if (INTERNAL_SYSCALL_CALL (sched_setaffinity, 0,
> length_reference, mask_request) == 0)
> {
> _dl_diagnostics_cpuid_collect (&ccd[i & 1]);
> _dl_diagnostics_cpuid_report (processor_index, i,
> &ccd[processor_index & 1],
> &ccd[!(processor_index & 1)]);
> ++processor_index;
> }
> CPU_CLR_S (i, length_reference, mask_request);
> }
> }
> }
>
> I will iterate over the list twice, but I don't think this would really matter
> here.
I think the macros are somewhat incompatible with direct system calls.
CPU_COUNT_S requires that the tail is zeroed, which the system call
doesn't do. Maybe we can memset the whole thing before the sched_getcpu
system call. I haven't tried if we can directly rebuild
__sched_cpucount for ld.so, either.
Thanks,
Florian
next prev parent reply other threads:[~2023-09-11 16:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 20:09 [PATCH 1/2] elf: Wire up _dl_diagnostics_cpu_kernel Florian Weimer
2023-09-08 20:10 ` [PATCH 2/2] x86: Add generic CPUID data dumper to ld.so --list-diagnostics Florian Weimer
2023-09-10 19:56 ` Noah Goldstein
2023-09-11 4:24 ` Florian Weimer
2023-09-11 16:16 ` Noah Goldstein
2023-09-11 16:25 ` Florian Weimer
2023-09-11 16:28 ` Noah Goldstein
2023-09-11 16:31 ` Noah Goldstein
2023-09-11 17:48 ` Florian Weimer
2023-09-11 18:35 ` Noah Goldstein
2023-09-11 16:08 ` Adhemerval Zanella Netto
2023-09-11 16:19 ` Florian Weimer [this message]
2023-09-11 16:41 ` Adhemerval Zanella Netto
2024-02-09 19:08 [PATCH 0/2] Enhanced x86 CPU diagnostics Florian Weimer
2024-02-09 19:08 ` [PATCH 2/2] x86: Add generic CPUID data dumper to ld.so --list-diagnostics Florian Weimer
2024-02-09 19:34 ` H.J. Lu
2024-02-10 0:44 ` H.J. Lu
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=87o7i8ptrf.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=adhemerval.zanella@linaro.org \
--cc=libc-alpha@sourceware.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).