linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
	<dave.hansen@linux.intel.com>, <jarkko@kernel.org>,
	<linux-sgx@vger.kernel.org>, <shuah@kernel.org>
Cc: <linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH V2] selftests/sgx: Fix build error caused by missing dependency
Date: Tue, 14 Dec 2021 14:27:23 -0800	[thread overview]
Message-ID: <2269d5a5-f388-773f-c6ec-758003ae2e59@intel.com> (raw)
In-Reply-To: <b64a7830-d21a-fc61-b5ef-8938a97ce878@linuxfoundation.org>

Hi Shuah,

On 12/14/2021 1:55 PM, Shuah Khan wrote:
> On 12/14/21 2:28 PM, Reinette Chatre wrote:
>> Hi Shuah,
>>
>> On 12/14/2021 12:10 PM, Shuah Khan wrote:
>>
>>>
>>> Let's not add one more __cpuid() define to the individual tests.
>>> We so far have:
>>>
>>> tools/testing/selftests/vm/pkey-x86.h
>>> selftests/x86/corrupt_xstate_header.c
>>>
>>> Let's move the defines to kselftest.h and remove all these duplicate
>>> defines.
>>>
>>> For now you could include vm/pkey-x86.h just to fix the build error
>>> and do the proper cleanup.
>>
>> Thank you so much for taking a look. We actually do have an 
>> alternative fix that could be considered for the other users of 
>> __cpuid(). Instead of another clone of the kernel's __cpuid() the fix 
>> includes cpuid.h and uses the existing __cpuid_count() from it.
>>
>> Please see:
>> https://lore.kernel.org/linux-sgx/20211204202355.23005-1-jarkko@kernel.org/ 
>>
>>
> 
> This looks good to me.

Thank you very much for taking a look.

> 
>> We decided against the above fix using __cpuid_count() because we 
>> could not explain why all the existing users of __cpuid() implement 
>> their own and decided to follow the custom instead ...
>>
> 
> Most likely, copy and paste and taking the easy route. I looked at a 
> couple of
> defines and I dont't see a difference. If there are differences, that 
> would be
> a bigger concern. The whole idea of not having duplicates is that we 
> don't have
> bugs in these duplicates.
> 
>> Do you see any problem with including cpuid.h into a selftest? If not, 
>> then we can go back to our original fix of this issue and I could also 
>> submit a change to remove all the __cpuid() clones and replace them 
>> with the library's __cpuid_count().
>>
> 
> There are no problems including cpuid.h - where is this though. I 
> couldn't find
> it in my cscope search?

On my system it arrived via user space's libgcc-dev package. This does 
not seem to be the first time including files from this source - I did a 
quick check and from what I can tell existing includes like stdarg.h, 
stdbool.h, stdatomic.h, unwind.h, x86intrin.h ... arrive via libgcc-dev.

Do you still find that cpuid.h is ok to include?

Reinette

  reply	other threads:[~2021-12-14 22:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14 19:26 [PATCH V2] selftests/sgx: Fix build error caused by missing dependency Reinette Chatre
2021-12-14 20:10 ` Shuah Khan
2021-12-14 21:28   ` Reinette Chatre
2021-12-14 21:55     ` Shuah Khan
2021-12-14 22:27       ` Reinette Chatre [this message]
2021-12-14 22:59         ` Shuah Khan

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=2269d5a5-f388-773f-c6ec-758003ae2e59@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jarkko@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-sgx@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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 NNTP newsgroup(s).