From: Shuah Khan <skhan@linuxfoundation.org>
To: "Maciej W. Rozycki" <macro@orcam.me.uk>,
"Dmitry V. Levin" <ldv@strace.io>
Cc: Shuah Khan <shuah@kernel.org>, Oleg Nesterov <oleg@redhat.com>,
strace-devel@lists.strace.io, linux-kselftest@vger.kernel.org,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH v2] selftests/ptrace/get_syscall_info: fix for MIPS n32
Date: Tue, 8 Apr 2025 17:54:40 -0600 [thread overview]
Message-ID: <dae94ac2-63d7-419c-9bec-bea0840ea534@linuxfoundation.org> (raw)
In-Reply-To: <alpine.DEB.2.21.2503291345580.47733@angie.orcam.me.uk>
On 3/29/25 08:02, Maciej W. Rozycki wrote:
> On Sat, 29 Mar 2025, Dmitry V. Levin wrote:
>
>>>> +#if defined(_MIPS_SIM) && _MIPS_SIM == _MIPS_SIM_NABI32
>>>> +/*
>>>> + * MIPS N32 is the only architecture where __kernel_ulong_t
>>>> + * does not match the bitness of syscall arguments.
>>>> + */
>>>> +typedef unsigned long long kernel_ulong_t;
>>>> +#else
>>>> +typedef __kernel_ulong_t kernel_ulong_t;
>>>> +#endif
>>>> +
>>>
>>> What's the reason for adding these typedefs? checkpatch should
>>> have warned you about adding new typedefs.
>>>
>>> Also this introduces kernel_ulong_t in user-space test code.
>>> Something to avoid.
>>
>> There has to be a new type for this test, and the natural way to do this
>> is to use typedef. The alternative would be to #define kernel_ulong_t
>> which is ugly. By the way, there are quite a few typedefs in selftests,
>> and there seems to be given no rationale why adding new types in selftests
>> is a bad idea.
>
It causes problems down the road for maintenance. I would rather not
see these types of kernel typedefs added to user-space.
> FWIW I agree, and I fail to see a reason why this would be a problem in a
> standalone test program where the typedef does not propagate anywhere.
>
> The only potential issue I can identify would be a namespace clash, so
> perhaps the new type could have a name prefix specific to the test, but it
> doesn't appear to me a widespread practice across our selftests and then
> `kernel_' ought to be pretty safe against ISO C or POSIX, so perhaps let's
> leave the things alone?
>
Can't this be solved with ifdef?
thanks,
-- Shuah
next prev parent reply other threads:[~2025-04-08 23:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 23:37 Dmitry V. Levin
2025-03-26 9:06 ` Dmitry V. Levin
2025-03-28 23:04 ` Shuah Khan
2025-03-29 12:48 ` Dmitry V. Levin
2025-03-29 14:02 ` Maciej W. Rozycki
2025-04-08 23:54 ` Shuah Khan [this message]
2025-06-02 11:59 ` Dmitry V. Levin
2025-06-02 22:21 ` 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=dae94ac2-63d7-419c-9bec-bea0840ea534@linuxfoundation.org \
--to=skhan@linuxfoundation.org \
--cc=ldv@strace.io \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=macro@orcam.me.uk \
--cc=oleg@redhat.com \
--cc=shuah@kernel.org \
--cc=strace-devel@lists.strace.io \
/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
Powered by JetHome