mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: shuah@kernel.org, fenghua.yu@intel.com,
	Reinette Chatre <reinette.chatre@intel.com>,
	usama.anjum@collabora.com, linux-kselftest@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftests:resctrl: Fix build failure on archs without __cpuid_count()
Date: Fri, 6 Sep 2024 08:14:14 -0600	[thread overview]
Message-ID: <cff1553c-d342-44e3-a685-9b074af87858@linuxfoundation.org> (raw)
In-Reply-To: <21267ef6-6fcf-2eed-a3da-2782d1e7013a@linux.intel.com>

On 9/6/24 04:12, Ilpo Järvinen wrote:
> On Thu, 5 Sep 2024, Shuah Khan wrote:
> 
>> When resctrl is built on architectures without __cpuid_count()
>> support, build fails. resctrl uses __cpuid_count() defined in
>> kselftest.h.
>>
>> Even though the problem is seen while building resctrl on aarch64,
>> this error can be seen on any platform that doesn't support CPUID.
>>
>> CPUID is a x86/x86-64 feature and code paths with CPUID asm commands
>> will fail to build on all other architectures.
>>
>> All others tests call __cpuid_count() do so from x86/x86_64 code paths
>> when _i386__ or __x86_64__ are defined. resctrl is an exception.
>>
>> Fix the problem by defining __cpuid_count() only when __i386__ or
>> __x86_64__ are defined in kselftest.h and changing resctrl to call
>> __cpuid_count() only when __i386__ or __x86_64__ are defined.
>>
>> In file included from resctrl.h:24,
>>                   from cat_test.c:11:
>> In function ‘arch_supports_noncont_cat’,
>>      inlined from ‘noncont_cat_run_test’ at cat_test.c:326:6:
>> ../kselftest.h:74:9: error: impossible constraint in ‘asm’
>>     74 |         __asm__ __volatile__ ("cpuid\n\t"                               \
>>        |         ^~~~~~~
>> cat_test.c:304:17: note: in expansion of macro ‘__cpuid_count’
>>    304 |                 __cpuid_count(0x10, 1, eax, ebx, ecx, edx);
>>        |                 ^~~~~~~~~~~~~
>> ../kselftest.h:74:9: error: impossible constraint in ‘asm’
>>     74 |         __asm__ __volatile__ ("cpuid\n\t"                               \
>>        |         ^~~~~~~
>> cat_test.c:306:17: note: in expansion of macro ‘__cpuid_count’
>>    306 |                 __cpuid_count(0x10, 2, eax, ebx, ecx, edx);
>>
>> Reported-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> Reported-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> When the small things from Muhammad and Reinette addressed, this seems
> okay.
> 
> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> 

Will do. Thank you for the review.

> Thanks for the solution.
> 
> 
> I'm still left to wonder if the x86 selftest is supposed to clobber
> CFLAGS? It seems that problem is orthogonal to this cpuid/resctrl problem.
> I mean this question from the perspective of coherency in the entire
> kselftest framework, lib.mk seems to want to adjust CFLAGS but those
> changes will get clobbered in the case of x86 selftest.
> 

This isn't the case x86 clobbering the CFLAGS. This falls into the case
of x86 customizing the flags for the test and the ones set by the common
lib.mk might interfere with the flags it needs.

There isn't anything here to fix based on the history of this test and
lib.mk.

thanks,
-- Shuah

      reply	other threads:[~2024-09-06 14:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 18:02 Shuah Khan
2024-09-05 20:45 ` Reinette Chatre
2024-09-05 20:50   ` Shuah Khan
2024-09-06  7:35 ` Muhammad Usama Anjum
2024-09-06 14:15   ` Shuah Khan
2024-09-06 10:12 ` Ilpo Järvinen
2024-09-06 14:14   ` Shuah Khan [this message]

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=cff1553c-d342-44e3-a685-9b074af87858@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --cc=fenghua.yu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    --cc=usama.anjum@collabora.com \
    /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

all inboxes | Powered by JetHome®