diff mbox series

um: Fix naming clash between UML and scheduler

Message ID 20230921143444.264668-1-anton.ivanov@cambridgegreys.com
State Accepted
Headers show
Series um: Fix naming clash between UML and scheduler | expand

Commit Message

Anton Ivanov Sept. 21, 2023, 2:34 p.m. UTC
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>

__cant_sleep was already used and exported by the scheduler.
The name had to be changed to a UML specific one.

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 arch/um/include/shared/kern_util.h | 2 +-
 arch/um/kernel/process.c           | 2 +-
 arch/um/os-Linux/helper.c          | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

Comments

Peter Lafreniere Sept. 21, 2023, 3:33 p.m. UTC | #1
On Thu, Sep 21, 2023 at 10:34, anton.ivanov@cambridgegreys.com wrote:
> 
> From: Anton Ivanov anton.ivanov@cambridgegreys.com
> 
> 
> __cant_sleep was already used and exported by the scheduler.
> The name had to be changed to a UML specific one.
> 
> Signed-off-by: Anton Ivanov anton.ivanov@cambridgegreys.com
> 
> ---
> arch/um/include/shared/kern_util.h | 2 +-
> arch/um/kernel/process.c | 2 +-
> arch/um/os-Linux/helper.c | 6 +++---
> 3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
> index d8b8b4f07e42..444bae755b16 100644
> --- a/arch/um/include/shared/kern_util.h
> +++ b/arch/um/include/shared/kern_util.h
> @@ -50,7 +50,7 @@ extern void do_uml_exitcalls(void);
> * Are we disallowed to sleep? Used to choose between GFP_KERNEL and
> * GFP_ATOMIC.
> */
> -extern int __cant_sleep(void);
> +extern int __uml_cant_sleep(void);
> extern int get_current_pid(void);
> extern int copy_from_user_proc(void *to, void *from, int size);
> extern char *uml_strdup(const char string);
> diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
> index 106b7da2f8d6..6daffb9d8a8d 100644
> --- a/arch/um/kernel/process.c
> +++ b/arch/um/kernel/process.c
> @@ -220,7 +220,7 @@ void arch_cpu_idle(void)
> um_idle_sleep();
> }
> 
> -int __cant_sleep(void) {
> +int __uml_cant_sleep(void) {
> return in_atomic() || irqs_disabled() || in_interrupt();
> / Is in_interrupt() really needed? */
> }
> diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
> index b459745f52e2..3cb8ac63be6e 100644
> --- a/arch/um/os-Linux/helper.c
> +++ b/arch/um/os-Linux/helper.c
> @@ -46,7 +46,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
> unsigned long stack, sp;
> int pid, fds[2], ret, n;
> 
> - stack = alloc_stack(0, __cant_sleep());
> + stack = alloc_stack(0, __uml_cant_sleep());
> if (stack == 0)
> return -ENOMEM;
> 
> @@ -70,7 +70,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
> data.pre_data = pre_data;
> data.argv = argv;
> data.fd = fds[1];
> - data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
> + data.buf = __uml_cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
> uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
> pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
> if (pid < 0) {
> @@ -121,7 +121,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
> unsigned long stack, sp;
> int pid, status, err;
> 
> - stack = alloc_stack(0, __cant_sleep());
> + stack = alloc_stack(0, __uml_cant_sleep());
> if (stack == 0)
> return -ENOMEM;
> 
> --
> 2.30.2

LGTM. Now we get to deal with the errors coming from config.debug

Reviewed-by: Peter Lafreniere <peter@n8pjl.ca>

Cheers,
diff mbox series

Patch

diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
index d8b8b4f07e42..444bae755b16 100644
--- a/arch/um/include/shared/kern_util.h
+++ b/arch/um/include/shared/kern_util.h
@@ -50,7 +50,7 @@  extern void do_uml_exitcalls(void);
  * Are we disallowed to sleep? Used to choose between GFP_KERNEL and
  * GFP_ATOMIC.
  */
-extern int __cant_sleep(void);
+extern int __uml_cant_sleep(void);
 extern int get_current_pid(void);
 extern int copy_from_user_proc(void *to, void *from, int size);
 extern char *uml_strdup(const char *string);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 106b7da2f8d6..6daffb9d8a8d 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -220,7 +220,7 @@  void arch_cpu_idle(void)
 	um_idle_sleep();
 }
 
-int __cant_sleep(void) {
+int __uml_cant_sleep(void) {
 	return in_atomic() || irqs_disabled() || in_interrupt();
 	/* Is in_interrupt() really needed? */
 }
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index b459745f52e2..3cb8ac63be6e 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -46,7 +46,7 @@  int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
 	unsigned long stack, sp;
 	int pid, fds[2], ret, n;
 
-	stack = alloc_stack(0, __cant_sleep());
+	stack = alloc_stack(0, __uml_cant_sleep());
 	if (stack == 0)
 		return -ENOMEM;
 
@@ -70,7 +70,7 @@  int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv)
 	data.pre_data = pre_data;
 	data.argv = argv;
 	data.fd = fds[1];
-	data.buf = __cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
+	data.buf = __uml_cant_sleep() ? uml_kmalloc(PATH_MAX, UM_GFP_ATOMIC) :
 					uml_kmalloc(PATH_MAX, UM_GFP_KERNEL);
 	pid = clone(helper_child, (void *) sp, CLONE_VM, &data);
 	if (pid < 0) {
@@ -121,7 +121,7 @@  int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
 	unsigned long stack, sp;
 	int pid, status, err;
 
-	stack = alloc_stack(0, __cant_sleep());
+	stack = alloc_stack(0, __uml_cant_sleep());
 	if (stack == 0)
 		return -ENOMEM;