On 08/18/2016 02:39 AM, Paolo Bonzini wrote:
On 18/08/2016 11:01, Vijay Kilari wrote:
On Thu, Aug 18, 2016 at 2:20 PM, Paolo Bonzini <pbonz...@redhat.com> wrote:
On 18/08/2016 09:56, Vijay Kilari wrote:
The get_aarch_cpu_id() has check " if (unlikely(!cpu_info_read)) ".
If we call get_aarch_cpu_id() from is_thunderx_pass2_cpu() which is
called from inside the loop, we will be adding one additional check.
On the other hand, you are making an assumption that the caller of
is_thunderx_pass2_cpu() calls get_aarch64_cpu_id() first, and not
documenting it anywhere.
And given that you shouldn't call _any_ function from inside such a hot
loop, your solution is inferior on both counts.
Yes, but I could not think of better way to get rid of this check.
bool need_aa64_prefetch = is_thunderx_pass2();
for (...) {
if (need_aa64_prefetch) {
...
}
}
The check on cpu_info_read is done just once.
Supposing a check is required at all, this is still inferior to either
(1) If completely outside the loop,
if (is_thunderx_pass2()) {
for (...)
...
} else {
for (...)
}
or (2) ifunc, so that we only check once, not every invocation.
r~