From: Paolo Bonzini <pbonzini@redhat.com>
To: Richard Henderson <rth@twiddle.net>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v5] cutils: Rewrite x86 buffer zero checking
Date: Wed, 14 Sep 2016 10:56:56 +0200 [thread overview]
Message-ID: <6c0a2f11-1799-830e-b947-16878781e667@redhat.com> (raw)
In-Reply-To: <1f1996f1-1e91-6b2d-2c76-34a592066d76@twiddle.net>
On 14/09/2016 03:11, Richard Henderson wrote:
> On 09/13/2016 04:21 PM, Paolo Bonzini wrote:
>>
>>
>> On 13/09/2016 22:57, Richard Henderson wrote:
>>> -#if defined(CONFIG_AVX2_OPT) || (defined(CONFIG_CPUID_H) &&
>>> defined(__SSE2__))
>>> -#include <cpuid.h>
>>> -
>>> +#if (defined(CONFIG_AVX2_OPT) && defined(CONFIG_CPUID_H)) ||
>>> defined(__SSE2__)
>>
>> Your __SSE2__ version is better than mine which required cpuid.h just to
>> simplify the logic a bit. On the other hand, CONFIG_CPUID_H is not
>> needed in CONFIG_AVX2_OPT, because the test already requires cpuid.h.
>
> Hmm, it does, although it needn't -- the test case would compile without
> it.
>
> Although I bet there's no situation in which the pragmas are supported
> and cpuid.h isn't, I think it's cleaner not to infer stuff like this.
Yeah, I agree. But we can change the test to not look at cpuid.h
separately.
>>> +#ifdef CONFIG_CPUID_H
>>> +# define INIT_CACHE
>>> +# define INIT_ACCEL
>>> +#else
>>> +# ifndef __SSE2__
>>> +# error "ISA selection confusion"
>>> +# endif
>>> +# define INIT_CACHE = CACHE_SSE2
>>> +# define INIT_ACCEL = buffer_zero_sse2
>>> #endif
>>
>> This is ugly, any reason not to initialize INIT_CACHE/INIT_ACCEL to
>> respectively 0 and NULL, or 0 and buffer_zero_int in the #ifdef
>> CONFIG_CPUID_H case?
>
> I was hoping to avoid an extra RELATIVE relocation in the (normal) PIE
> case.
There would be no relocation for 0 and NULL, right? GCC would actually
put them in bss, IIRC.
Paolo
>>> +#undef INIT_CACHE
>>> +#undef INIT_ACCEL
>>
>> The #undef is not really necessary since this file hardly has anything
>> after the toplevel #endif.
>
> Fair enough.
>
>
> r~
>
>>
>> Just tell me which changes you agree with, I can make them locally.
>>
>> Paolo
>
>
>
next prev parent reply other threads:[~2016-09-14 8:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-13 20:57 [Qemu-devel] [PATCH v5] cutils: Rewrite x86 buffer zero checking Richard Henderson
2016-09-13 23:21 ` Paolo Bonzini
2016-09-14 1:11 ` Richard Henderson
2016-09-14 8:56 ` Paolo Bonzini [this message]
2016-09-14 15:53 ` Richard Henderson
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=6c0a2f11-1799-830e-b947-16878781e667@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 NNTP newsgroup(s).