* [PATCH] kernel/entry: Remove unneeded header "common.h"
@ 2025-06-11 7:23 Khalid Ali
2025-06-13 16:12 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Khalid Ali @ 2025-06-11 7:23 UTC (permalink / raw)
To: tglx, peterz, luto; +Cc: linux-kernel, Khalid Ali
syscall_user_dispatch() is part syscall user dispatch and it has a
header already, so this patch moves that function to
include/linux/syscall_user_dispatch.h which fits well. In that case we don't need
common.h anymore. All functions related to syscall
user dispatch are on that header i mentioned, so this one shouldn't be
special. We need to access the function from that header.
Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
---
include/linux/syscall_user_dispatch.h | 2 ++
kernel/entry/common.c | 3 +--
kernel/entry/common.h | 7 -------
kernel/entry/syscall_user_dispatch.c | 2 --
4 files changed, 3 insertions(+), 11 deletions(-)
delete mode 100644 kernel/entry/common.h
diff --git a/include/linux/syscall_user_dispatch.h b/include/linux/syscall_user_dispatch.h
index 3858a6ffdd5c..6fffca47b136 100644
--- a/include/linux/syscall_user_dispatch.h
+++ b/include/linux/syscall_user_dispatch.h
@@ -48,4 +48,6 @@ static inline int syscall_user_dispatch_set_config(struct task_struct *task,
#endif /* CONFIG_GENERIC_ENTRY */
+bool syscall_user_dispatch(struct pt_regs *regs);
+
#endif /* _SYSCALL_USER_DISPATCH_H */
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index a8dd1f27417c..e774dc9e7eaf 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -9,8 +9,7 @@
#include <linux/livepatch.h>
#include <linux/audit.h>
#include <linux/tick.h>
-
-#include "common.h"
+#include <linux/syscall_user_dispatch.h>
#define CREATE_TRACE_POINTS
#include <trace/events/syscalls.h>
diff --git a/kernel/entry/common.h b/kernel/entry/common.h
deleted file mode 100644
index f6e6d02f07fe..000000000000
--- a/kernel/entry/common.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _COMMON_H
-#define _COMMON_H
-
-bool syscall_user_dispatch(struct pt_regs *regs);
-
-#endif
diff --git a/kernel/entry/syscall_user_dispatch.c b/kernel/entry/syscall_user_dispatch.c
index 5340c5aa89e7..b88a4b546d70 100644
--- a/kernel/entry/syscall_user_dispatch.c
+++ b/kernel/entry/syscall_user_dispatch.c
@@ -15,8 +15,6 @@
#include <asm/syscall.h>
-#include "common.h"
-
static void trigger_sigsys(struct pt_regs *regs)
{
struct kernel_siginfo info;
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/entry: Remove unneeded header "common.h"
2025-06-11 7:23 [PATCH] kernel/entry: Remove unneeded header "common.h" Khalid Ali
@ 2025-06-13 16:12 ` Thomas Gleixner
2025-06-14 19:47 ` Khalid Ali
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2025-06-13 16:12 UTC (permalink / raw)
To: Khalid Ali, peterz, luto; +Cc: linux-kernel, Khalid Ali
On Wed, Jun 11 2025 at 07:23, Khalid Ali wrote:
> syscall_user_dispatch() is part syscall user dispatch and it has a
> header already, so this patch moves that function to
> include/linux/syscall_user_dispatch.h which fits well. In that case we don't need
> common.h anymore. All functions related to syscall
> user dispatch are on that header i mentioned, so this one shouldn't be
> special. We need to access the function from that header.
This word salad does not qualify as a change log. Please read
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#changelog
including the documentation it links to.
The reason why common.h exists is that syscall_user_dispatch() is a
internal function, which is on purpose not exposed globally. There is no
reason to expose it globally, so it stays where it is.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/entry: Remove unneeded header "common.h"
2025-06-13 16:12 ` Thomas Gleixner
@ 2025-06-14 19:47 ` Khalid Ali
2025-06-16 7:01 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Khalid Ali @ 2025-06-14 19:47 UTC (permalink / raw)
To: tglx; +Cc: khaliidcaliy, linux-kernel, luto, peterz
> The reason why common.h exists is that syscall_user_dispatch() is a
> internal function, which is on purpose not exposed globally. There is no
> reason to expose it globally, so it stays where it is.
> Still there is no strong reason "common.h" could exist, there is no doc
> explicitly mentions that.
Why can't we just put the prototype into the source since currently it is the
only place used is common.c, so we should put it on top of the source. Again don't
see strong reason why entire header exist for single function, even on future if more local
definations come we should put on top of the source, if there is one single source file using
it. This makes consistent across the entire kernel codebase which mostly do what i mentioned.
The only exception for local headers is if the source file using it is too large and using many
structures, enums and prototypes, in that case it is acceptable. However the decision of creation
of that local header with no exception makes the header pointless.
I didn't find any kernel doc that describes the decision, so we should make it consistent with other
subsystems if there is no specific reason for that this makes the source file more organized.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kernel/entry: Remove unneeded header "common.h"
2025-06-14 19:47 ` Khalid Ali
@ 2025-06-16 7:01 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2025-06-16 7:01 UTC (permalink / raw)
To: Khalid Ali; +Cc: khaliidcaliy, linux-kernel, luto, peterz
On Sat, Jun 14 2025 at 19:47, Khalid Ali wrote:
>> The reason why common.h exists is that syscall_user_dispatch() is a
>> internal function, which is on purpose not exposed globally. There is no
>> reason to expose it globally, so it stays where it is.
>> Still there is no strong reason "common.h" could exist, there is no doc
>> explicitly mentions that.
>
> Why can't we just put the prototype into the source since currently it is the
> only place used is common.c, so we should put it on top of the source. Again don't
No. You need the prototype (aka. declaration) for both the usage site
_and_ the definition.
Do I really have to explain the basic C rules?
> see strong reason why entire header exist for single function, even on
> future if more local definations come we should put on top of the
> source, if there is one single source file using it. This makes
> consistent across the entire kernel codebase which mostly do what i
> mentioned.
>
> The only exception for local headers is if the source file using it is
> too large and using many structures, enums and prototypes, in that
> case it is acceptable.
So you define what's acceptable and not?
> However the decision of creation of that local header with no
> exception makes the header pointless.
>
> I didn't find any kernel doc that describes the decision, so we should
> make it consistent with other subsystems if there is no specific
> reason for that this makes the source file more organized.
I explained it to you already why this header exists and there is a
strong emphasis in some subsystems to not expose functions globaly so
that the internals of the subsystem are encapsulated. That's the only
way you can do that in C and it makes a lot of sense.
This _is_ consistent with the rest of the code and you can argue until
you're blue, this header with the declaration of that function stays.
Thanks,
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-16 7:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-11 7:23 [PATCH] kernel/entry: Remove unneeded header "common.h" Khalid Ali
2025-06-13 16:12 ` Thomas Gleixner
2025-06-14 19:47 ` Khalid Ali
2025-06-16 7:01 ` Thomas Gleixner
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).