Linux Kernel Selftest development
 help / color / mirror / Atom feed
* Re: [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'?
       [not found] <202301170348.7WLKH1pl-lkp@intel.com>
@ 2023-01-16 20:18 ` Mathieu Desnoyers
  2023-01-16 23:38   ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Desnoyers @ 2023-01-16 20:18 UTC (permalink / raw)
  To: kernel test robot, Shuah Khan
  Cc: oe-kbuild-all, linux-kernel, x86, Peter Zijlstra, linux-kselftest

On 2023-01-16 14:40, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> head:   79ba1e607d68178db7d3fe4f6a4aa38f06805e7b
> commit: 03f5c0272d1b59343144e199becc911dae52c37e [7/28] selftests/rseq: Use ELF auxiliary vector for extensible rseq
> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> reproduce:
>          # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=03f5c0272d1b59343144e199becc911dae52c37e
>          git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>          git fetch --no-tags tip sched/core
>          git checkout 03f5c0272d1b59343144e199becc911dae52c37e
>          make O=/tmp/kselftest headers
>          make O=/tmp/kselftest -C tools/testing/selftests
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>

In order to fix this, I need to change -I../../../../usr/include/ for 
$(KHDR_INCLUDES) in tools/testing/selftests/rseq/Makefile

I can find 25 odd uses of the same pattern in the kernel selftests. 
Should I fix them all in one go ?

grep -r "../../../../usr/include/" tools/testing/selftests/ | wc -l
25

AFAIU it typically works just because the build system happens to have 
recent enough kernel headers installed in the root environment.

Thanks,

Mathieu


> 
> All errors (new ones prefixed by >>):
> 
>     rseq.c: In function 'get_rseq_feature_size':
>>> rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared (first use in this function); did you mean 'R_SH_ALIGN'?
>       139 |         auxv_rseq_align = getauxval(AT_RSEQ_ALIGN);
>           |                                     ^~~~~~~~~~~~~
>           |                                     R_SH_ALIGN
>     rseq.c:139:37: note: each undeclared identifier is reported only once for each function it appears in
>>> rseq.c:142:44: error: 'AT_RSEQ_FEATURE_SIZE' undeclared (first use in this function); did you mean 'ORIG_RSEQ_FEATURE_SIZE'?
>       142 |         auxv_rseq_feature_size = getauxval(AT_RSEQ_FEATURE_SIZE);
>           |                                            ^~~~~~~~~~~~~~~~~~~~
>           |                                            ORIG_RSEQ_FEATURE_SIZE
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'?
  2023-01-16 20:18 ` [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'? Mathieu Desnoyers
@ 2023-01-16 23:38   ` Shuah Khan
  2023-01-17  9:06     ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2023-01-16 23:38 UTC (permalink / raw)
  To: Mathieu Desnoyers, kernel test robot, Shuah Khan
  Cc: oe-kbuild-all, linux-kernel, x86, Peter Zijlstra, linux-kselftest,
	Shuah Khan

On 1/16/23 13:18, Mathieu Desnoyers wrote:
> On 2023-01-16 14:40, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
>> head:   79ba1e607d68178db7d3fe4f6a4aa38f06805e7b
>> commit: 03f5c0272d1b59343144e199becc911dae52c37e [7/28] selftests/rseq: Use ELF auxiliary vector for extensible rseq
>> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
>> reproduce:
>>          # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=03f5c0272d1b59343144e199becc911dae52c37e
>>          git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>>          git fetch --no-tags tip sched/core
>>          git checkout 03f5c0272d1b59343144e199becc911dae52c37e
>>          make O=/tmp/kselftest headers
>>          make O=/tmp/kselftest -C tools/testing/selftests
>>
>> If you fix the issue, kindly add following tag where applicable
>> | Reported-by: kernel test robot <lkp@intel.com>
> 
> In order to fix this, I need to change -I../../../../usr/include/ for $(KHDR_INCLUDES) in tools/testing/selftests/rseq/Makefile
> 
> I can find 25 odd uses of the same pattern in the kernel selftests. Should I fix them all in one go ?

kselftest build depends on headers installed in the root directory.
The main makefile enforces this dependency. If this test is being
built without installing headers by itself, I think the scripts that
build individual tests have to makes sure headers are installed first.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'?
  2023-01-16 23:38   ` Shuah Khan
@ 2023-01-17  9:06     ` Ingo Molnar
  2023-01-17 17:44       ` Mathieu Desnoyers
  0 siblings, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2023-01-17  9:06 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Mathieu Desnoyers, kernel test robot, Shuah Khan, oe-kbuild-all,
	linux-kernel, x86, Peter Zijlstra, linux-kselftest


* Shuah Khan <skhan@linuxfoundation.org> wrote:

> On 1/16/23 13:18, Mathieu Desnoyers wrote:
> > On 2023-01-16 14:40, kernel test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
> > > head:   79ba1e607d68178db7d3fe4f6a4aa38f06805e7b
> > > commit: 03f5c0272d1b59343144e199becc911dae52c37e [7/28] selftests/rseq: Use ELF auxiliary vector for extensible rseq
> > > compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
> > > reproduce:
> > >          # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=03f5c0272d1b59343144e199becc911dae52c37e
> > >          git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
> > >          git fetch --no-tags tip sched/core
> > >          git checkout 03f5c0272d1b59343144e199becc911dae52c37e
> > >          make O=/tmp/kselftest headers
> > >          make O=/tmp/kselftest -C tools/testing/selftests
> > > 
> > > If you fix the issue, kindly add following tag where applicable
> > > | Reported-by: kernel test robot <lkp@intel.com>
> > 
> > In order to fix this, I need to change -I../../../../usr/include/ for $(KHDR_INCLUDES) in tools/testing/selftests/rseq/Makefile
> > 
> > I can find 25 odd uses of the same pattern in the kernel selftests. Should I fix them all in one go ?
> 
> kselftest build depends on headers installed in the root directory.
> The main makefile enforces this dependency. If this test is being
> built without installing headers by itself, I think the scripts that
> build individual tests have to makes sure headers are installed first.

Why isn't the Makefile saying anything about it & enforcing it? self-tests 
are usually self-sufficient to build in the individual directories.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'?
  2023-01-17  9:06     ` Ingo Molnar
@ 2023-01-17 17:44       ` Mathieu Desnoyers
  2023-01-17 19:11         ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Mathieu Desnoyers @ 2023-01-17 17:44 UTC (permalink / raw)
  To: Ingo Molnar, Shuah Khan
  Cc: kernel test robot, Shuah Khan, oe-kbuild-all, linux-kernel, x86,
	Peter Zijlstra, linux-kselftest

On 2023-01-17 04:06, Ingo Molnar wrote:
> 
> * Shuah Khan <skhan@linuxfoundation.org> wrote:
> 
>> On 1/16/23 13:18, Mathieu Desnoyers wrote:
>>> On 2023-01-16 14:40, kernel test robot wrote:
>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
>>>> head:   79ba1e607d68178db7d3fe4f6a4aa38f06805e7b
>>>> commit: 03f5c0272d1b59343144e199becc911dae52c37e [7/28] selftests/rseq: Use ELF auxiliary vector for extensible rseq
>>>> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
>>>> reproduce:
>>>>           # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=03f5c0272d1b59343144e199becc911dae52c37e
>>>>           git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>>>>           git fetch --no-tags tip sched/core
>>>>           git checkout 03f5c0272d1b59343144e199becc911dae52c37e
>>>>           make O=/tmp/kselftest headers
>>>>           make O=/tmp/kselftest -C tools/testing/selftests
>>>>
>>>> If you fix the issue, kindly add following tag where applicable
>>>> | Reported-by: kernel test robot <lkp@intel.com>
>>>
>>> In order to fix this, I need to change -I../../../../usr/include/ for $(KHDR_INCLUDES) in tools/testing/selftests/rseq/Makefile
>>>
>>> I can find 25 odd uses of the same pattern in the kernel selftests. Should I fix them all in one go ?
>>
>> kselftest build depends on headers installed in the root directory.

By "root directory", do you mean kernel sources root directory or build 
output root directory ?

>> The main makefile enforces this dependency.

How ? I figure that tools/testing/selftests/lib.mk overrides 
KHDR_INCLUDES if it is not defined yet:

ifeq ($(KHDR_INCLUDES),)
KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
endif

and selftests makefiles include ../lib.mk.

This KHDR_INCLUDES can be modified by O=... when built from the kernel 
top level, thus using tools/testing/selftests/Makefile:

ifneq ($(KBUILD_OUTPUT),)
[...]
   KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
else
[...]
   KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
endif

But it's up to the individual selftests to actually use 
$(KHDR_INCLUDES). In many cases, they hardcode 
-I../../../../usr/include/ which is bogus when the build root (O=...) 
differs from the source root.

  If this test is being
>> built without installing headers by itself, I think the scripts that
>> build individual tests have to makes sure headers are installed first.

The headers were previously built by "make O=/tmp/kselftest headers", as 
it should, it's just that the selftest makefile uses a hardcoded path 
that is relative to the source directory, and it appears that this 
pattern is repeated all across the selftests.

> 
> Why isn't the Makefile saying anything about it & enforcing it? self-tests
> are usually self-sufficient to build in the individual directories.

In an ideal world, we'd have a way to _remove_ the build environment 
kernel headers from the include search paths, because this is a problem 
for reproducibility of the tests.

Thanks,

Mathieu

> 
> Thanks,
> 
> 	Ingo

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'?
  2023-01-17 17:44       ` Mathieu Desnoyers
@ 2023-01-17 19:11         ` Shuah Khan
  2023-01-17 20:14           ` Mathieu Desnoyers
  0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2023-01-17 19:11 UTC (permalink / raw)
  To: Mathieu Desnoyers, Ingo Molnar
  Cc: kernel test robot, Shuah Khan, oe-kbuild-all, linux-kernel, x86,
	Peter Zijlstra, linux-kselftest, Shuah Khan

On 1/17/23 10:44, Mathieu Desnoyers wrote:
> On 2023-01-17 04:06, Ingo Molnar wrote:
>>
>> * Shuah Khan <skhan@linuxfoundation.org> wrote:
>>
>>> On 1/16/23 13:18, Mathieu Desnoyers wrote:
>>>> On 2023-01-16 14:40, kernel test robot wrote:
>>>>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched/core
>>>>> head:   79ba1e607d68178db7d3fe4f6a4aa38f06805e7b
>>>>> commit: 03f5c0272d1b59343144e199becc911dae52c37e [7/28] selftests/rseq: Use ELF auxiliary vector for extensible rseq
>>>>> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
>>>>> reproduce:
>>>>>           # https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=03f5c0272d1b59343144e199becc911dae52c37e
>>>>>           git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>>>>>           git fetch --no-tags tip sched/core
>>>>>           git checkout 03f5c0272d1b59343144e199becc911dae52c37e
>>>>>           make O=/tmp/kselftest headers
>>>>>           make O=/tmp/kselftest -C tools/testing/selftests
>>>>>
>>>>> If you fix the issue, kindly add following tag where applicable
>>>>> | Reported-by: kernel test robot <lkp@intel.com>
>>>>
>>>> In order to fix this, I need to change -I../../../../usr/include/ for $(KHDR_INCLUDES) in tools/testing/selftests/rseq/Makefile
>>>>
>>>> I can find 25 odd uses of the same pattern in the kernel selftests. Should I fix them all in one go ?
>>>
>>> kselftest build depends on headers installed in the root directory.
> 
> By "root directory", do you mean kernel sources root directory or build output root directory ?
> 
>>> The main makefile enforces this dependency.
> 
> How ? I figure that tools/testing/selftests/lib.mk overrides KHDR_INCLUDES if it is not defined yet:
> 
> ifeq ($(KHDR_INCLUDES),)
> KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
> endif
> 
> and selftests makefiles include ../lib.mk.
> 
> This KHDR_INCLUDES can be modified by O=... when built from the kernel top level, thus using tools/testing/selftests/Makefile:
> 
> ifneq ($(KBUILD_OUTPUT),)
> [...]
>    KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
> else
> [...]
>    KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
> endif
> 
> But it's up to the individual selftests to actually use $(KHDR_INCLUDES). In many cases, they hardcode -I../../../../usr/include/ which is bogus when the build root (O=...) differs from the source root.
> 
>   If this test is being
>>> built without installing headers by itself, I think the scripts that
>>> build individual tests have to makes sure headers are installed first.
> 
> The headers were previously built by "make O=/tmp/kselftest headers", as it should, it's just that the selftest makefile uses a hardcoded path that is relative to the source directory, and it appears that this pattern is repeated all across the selftests.
> 

selftests Makefile used to install headers and there has been a recent
change to have mani Makefile (root) to install it. As a result individual
test builds (running make in the test directory) requires header install
now.

I think the hard-coded includes are a problem and we have to fix them for
all cases i.e make O=, individual test builds.

If you are still up for it, please send patch.

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'?
  2023-01-17 19:11         ` Shuah Khan
@ 2023-01-17 20:14           ` Mathieu Desnoyers
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Desnoyers @ 2023-01-17 20:14 UTC (permalink / raw)
  To: Shuah Khan, Ingo Molnar
  Cc: kernel test robot, Shuah Khan, oe-kbuild-all, linux-kernel, x86,
	Peter Zijlstra, linux-kselftest

On 2023-01-17 14:11, Shuah Khan wrote:
> On 1/17/23 10:44, Mathieu Desnoyers wrote:
>> On 2023-01-17 04:06, Ingo Molnar wrote:
>>>
>>> * Shuah Khan <skhan@linuxfoundation.org> wrote:
>>>
>>>> On 1/16/23 13:18, Mathieu Desnoyers wrote:
>>>>> On 2023-01-16 14:40, kernel test robot wrote:
>>>>>> tree:   
>>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
>>>>>> sched/core
>>>>>> head:   79ba1e607d68178db7d3fe4f6a4aa38f06805e7b
>>>>>> commit: 03f5c0272d1b59343144e199becc911dae52c37e [7/28] 
>>>>>> selftests/rseq: Use ELF auxiliary vector for extensible rseq
>>>>>> compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
>>>>>> reproduce:
>>>>>>           # 
>>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=03f5c0272d1b59343144e199becc911dae52c37e
>>>>>>           git remote add tip 
>>>>>> https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
>>>>>>           git fetch --no-tags tip sched/core
>>>>>>           git checkout 03f5c0272d1b59343144e199becc911dae52c37e
>>>>>>           make O=/tmp/kselftest headers
>>>>>>           make O=/tmp/kselftest -C tools/testing/selftests
>>>>>>
>>>>>> If you fix the issue, kindly add following tag where applicable
>>>>>> | Reported-by: kernel test robot <lkp@intel.com>
>>>>>
>>>>> In order to fix this, I need to change -I../../../../usr/include/ 
>>>>> for $(KHDR_INCLUDES) in tools/testing/selftests/rseq/Makefile
>>>>>
>>>>> I can find 25 odd uses of the same pattern in the kernel selftests. 
>>>>> Should I fix them all in one go ?
>>>>
>>>> kselftest build depends on headers installed in the root directory.
>>
>> By "root directory", do you mean kernel sources root directory or 
>> build output root directory ?
>>
>>>> The main makefile enforces this dependency.
>>
>> How ? I figure that tools/testing/selftests/lib.mk overrides 
>> KHDR_INCLUDES if it is not defined yet:
>>
>> ifeq ($(KHDR_INCLUDES),)
>> KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
>> endif
>>
>> and selftests makefiles include ../lib.mk.
>>
>> This KHDR_INCLUDES can be modified by O=... when built from the kernel 
>> top level, thus using tools/testing/selftests/Makefile:
>>
>> ifneq ($(KBUILD_OUTPUT),)
>> [...]
>>    KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
>> else
>> [...]
>>    KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
>> endif
>>
>> But it's up to the individual selftests to actually use 
>> $(KHDR_INCLUDES). In many cases, they hardcode 
>> -I../../../../usr/include/ which is bogus when the build root (O=...) 
>> differs from the source root.
>>
>>   If this test is being
>>>> built without installing headers by itself, I think the scripts that
>>>> build individual tests have to makes sure headers are installed first.
>>
>> The headers were previously built by "make O=/tmp/kselftest headers", 
>> as it should, it's just that the selftest makefile uses a hardcoded 
>> path that is relative to the source directory, and it appears that 
>> this pattern is repeated all across the selftests.
>>
> 
> selftests Makefile used to install headers and there has been a recent
> change to have mani Makefile (root) to install it. As a result individual
> test builds (running make in the test directory) requires header install
> now.
> 
> I think the hard-coded includes are a problem and we have to fix them for
> all cases i.e make O=, individual test builds.
> 
> If you are still up for it, please send patch.

Sure.

Now that I dig a bit more, we could try using "-nostdinc" to tell the 
compiler not to search the standard system directories, but I've noticed 
that a few selftests depend on userspace library header files found in 
the build environment.

I'm not sure how we should approach this.

Thoughts ?

Thanks,

Mathieu

> 
> thanks,
> -- Shuah
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-17 22:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <202301170348.7WLKH1pl-lkp@intel.com>
2023-01-16 20:18 ` [tip:sched/core 7/28] rseq.c:139:37: error: 'AT_RSEQ_ALIGN' undeclared; did you mean 'R_SH_ALIGN'? Mathieu Desnoyers
2023-01-16 23:38   ` Shuah Khan
2023-01-17  9:06     ` Ingo Molnar
2023-01-17 17:44       ` Mathieu Desnoyers
2023-01-17 19:11         ` Shuah Khan
2023-01-17 20:14           ` Mathieu Desnoyers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox