All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Philippe Gerum <rpm@xenomai.org>, xenomai@xenomai.org
Subject: Re: [PATCH Dovetail 01/13] cobalt/thread: pipeline: abstract threadinfo accessor
Date: Fri, 8 Jan 2021 10:02:40 +0100	[thread overview]
Message-ID: <b4a996ff-c5d9-a08b-639f-191ac1ef8b35@siemens.com> (raw)
In-Reply-To: <20210102093353.3195090-2-rpm@xenomai.org>

On 02.01.21 10:33, Philippe Gerum wrote:
> From: Philippe Gerum <rpm@xenomai.org>
> 
> The I-pipe and Dovetail access the per-thread information block
> differently. Abstract this kernel interface.
> 
> No functional change is introduced.
> 
> Signed-off-by: Philippe Gerum <rpm@xenomai.org>
> ---
>  include/cobalt/kernel/ipipe/pipeline/thread.h | 26 +++++++++++++++++++
>  include/cobalt/kernel/thread.h                |  5 ++--
>  kernel/cobalt/ipipe/kevents.c                 |  6 ++---
>  kernel/cobalt/posix/process.c                 |  4 +--
>  kernel/cobalt/posix/process.h                 |  5 ++--
>  kernel/cobalt/thread.c                        |  4 +--
>  6 files changed, 39 insertions(+), 11 deletions(-)
>  create mode 100644 include/cobalt/kernel/ipipe/pipeline/thread.h
> 
> diff --git a/include/cobalt/kernel/ipipe/pipeline/thread.h b/include/cobalt/kernel/ipipe/pipeline/thread.h
> new file mode 100644
> index 000000000..a62e622c4
> --- /dev/null
> +++ b/include/cobalt/kernel/ipipe/pipeline/thread.h
> @@ -0,0 +1,26 @@
> +/*
> + * SPDX-License-Identifier: GPL-2.0
> + *
> + * Copyright (C) 2019 Philippe Gerum  <rpm@xenomai.org>
> + */
> +
> +#ifndef _COBALT_KERNEL_IPIPE_THREAD_H
> +#define _COBALT_KERNEL_IPIPE_THREAD_H
> +
> +#include <linux/ipipe.h>

We also need linux/sched.h for older kernels (<= 4.14). Fixing up on merge.

Jan

> +
> +struct xnthread;
> +
> +#define cobalt_threadinfo ipipe_threadinfo
> +
> +static inline struct cobalt_threadinfo *pipeline_current(void)
> +{
> +	return ipipe_current_threadinfo();
> +}
> +
> +static inline struct xnthread *pipeline_thread_from_task(struct task_struct *p)
> +{
> +	return ipipe_task_threadinfo(p)->thread;
> +}
> +
> +#endif /* !_COBALT_KERNEL_IPIPE_THREAD_H */
> diff --git a/include/cobalt/kernel/thread.h b/include/cobalt/kernel/thread.h
> index 21a8603b4..2d57b8398 100644
> --- a/include/cobalt/kernel/thread.h
> +++ b/include/cobalt/kernel/thread.h
> @@ -22,6 +22,7 @@
>  #include <linux/wait.h>
>  #include <linux/sched.h>
>  #include <linux/sched/rt.h>
> +#include <pipeline/thread.h>
>  #include <cobalt/kernel/list.h>
>  #include <cobalt/kernel/stat.h>
>  #include <cobalt/kernel/timer.h>
> @@ -372,7 +373,7 @@ void __xnthread_discard(struct xnthread *thread);
>   */
>  static inline struct xnthread *xnthread_current(void)
>  {
> -	return ipipe_current_threadinfo()->thread;
> +	return pipeline_current()->thread;
>  }
>  
>  /**
> @@ -388,7 +389,7 @@ static inline struct xnthread *xnthread_current(void)
>   */
>  static inline struct xnthread *xnthread_from_task(struct task_struct *p)
>  {
> -	return ipipe_task_threadinfo(p)->thread;
> +	return pipeline_thread_from_task(p);
>  }
>  
>  /**
> diff --git a/kernel/cobalt/ipipe/kevents.c b/kernel/cobalt/ipipe/kevents.c
> index ba584677c..e0d4a1288 100644
> --- a/kernel/cobalt/ipipe/kevents.c
> +++ b/kernel/cobalt/ipipe/kevents.c
> @@ -831,16 +831,16 @@ static inline int get_mayday_prot(void)
>  
>  void pipeline_attach_current(struct xnthread *thread)
>  {
> -	struct ipipe_threadinfo *p;
> +	struct cobalt_threadinfo *p;
>  
> -	p = ipipe_current_threadinfo();
> +	p = pipeline_current();
>  	p->thread = thread;
>  	p->process = cobalt_search_process(current->mm);
>  }
>  
>  static void detach_current(void)
>  {
> -	struct ipipe_threadinfo *p = ipipe_current_threadinfo();
> +	struct cobalt_threadinfo *p = pipeline_current();
>  	p->thread = NULL;
>  	p->process = NULL;
>  }
> diff --git a/kernel/cobalt/posix/process.c b/kernel/cobalt/posix/process.c
> index 9bc6082d0..accd989ca 100644
> --- a/kernel/cobalt/posix/process.c
> +++ b/kernel/cobalt/posix/process.c
> @@ -463,7 +463,7 @@ EXPORT_SYMBOL_GPL(cobalt_unregister_personality);
>  struct xnthread_personality *
>  cobalt_push_personality(int xid)
>  {
> -	struct ipipe_threadinfo *p = ipipe_current_threadinfo();
> +	struct cobalt_threadinfo *p = pipeline_current();
>  	struct xnthread_personality *prev, *next;
>  	struct xnthread *thread = p->thread;
>  
> @@ -504,7 +504,7 @@ EXPORT_SYMBOL_GPL(cobalt_push_personality);
>   */
>  void cobalt_pop_personality(struct xnthread_personality *prev)
>  {
> -	struct ipipe_threadinfo *p = ipipe_current_threadinfo();
> +	struct cobalt_threadinfo *p = pipeline_current();
>  	struct xnthread *thread = p->thread;
>  
>  	secondary_mode_only();
> diff --git a/kernel/cobalt/posix/process.h b/kernel/cobalt/posix/process.h
> index 3a38ae639..a2f4ec591 100644
> --- a/kernel/cobalt/posix/process.h
> +++ b/kernel/cobalt/posix/process.h
> @@ -20,6 +20,7 @@
>  
>  #include <linux/list.h>
>  #include <linux/bitmap.h>
> +#include <pipeline/thread.h>
>  #include <cobalt/kernel/ppd.h>
>  
>  #define KEVENT_PROPAGATE   0
> @@ -94,13 +95,13 @@ extern struct cobalt_resources cobalt_global_resources;
>  
>  static inline struct cobalt_process *cobalt_current_process(void)
>  {
> -	return ipipe_current_threadinfo()->process;
> +	return pipeline_current()->process;
>  }
>  
>  static inline struct cobalt_process *
>  cobalt_set_process(struct cobalt_process *process)
>  {
> -	struct ipipe_threadinfo *p = ipipe_current_threadinfo();
> +	struct cobalt_threadinfo *p = pipeline_current();
>  	struct cobalt_process *old;
>  
>  	old = p->process;
> diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
> index a882bcc45..b871e6069 100644
> --- a/kernel/cobalt/thread.c
> +++ b/kernel/cobalt/thread.c
> @@ -2452,9 +2452,9 @@ static inline void wakeup_parent(struct completion *done)
>  
>  static inline void init_kthread_info(struct xnthread *thread)
>  {
> -	struct ipipe_threadinfo *p;
> +	struct cobalt_threadinfo *p;
>  
> -	p = ipipe_current_threadinfo();
> +	p = pipeline_current();
>  	p->thread = thread;
>  	p->process = NULL;
>  }
> 

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


  reply	other threads:[~2021-01-08  9:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-02  9:33 [PATCH Dovetail 00/13] Keep on abstracting the pipeline interface Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 01/13] cobalt/thread: pipeline: abstract threadinfo accessor Philippe Gerum
2021-01-08  9:02   ` Jan Kiszka [this message]
2021-01-02  9:33 ` [PATCH Dovetail 02/13] cobalt/apc: pipeline: abstract interface for deferred routine calls Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 03/13] cobalt/trace: pipeline: abstract trace calls Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 04/13] cobalt/lock: pipeline: abstract hard lock API Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 05/13] cobalt/kernel: pipeline: abstract execution stage predicates Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 06/13] cobalt/sched, clock: pipeline: abstract IPI management Philippe Gerum
2021-01-08  9:40   ` Jan Kiszka
2021-01-02  9:33 ` [PATCH Dovetail 07/13] cobalt/clock: pipeline: make HOSTRT depend on IPIPE Philippe Gerum
2021-01-07 13:52   ` Jan Kiszka
2021-01-09 10:45     ` Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 08/13] cobalt/build: pipeline: select IPIPE layer only if present Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 09/13] cobalt/clock: pipeline: abstract clock, timer access services Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 10/13] cobalt/wrappers: pipeline: abstract pipeline-related bits Philippe Gerum
2021-01-07 13:56   ` Jan Kiszka
2021-01-11 12:59   ` Jan Kiszka
2021-01-02  9:33 ` [PATCH Dovetail 11/13] cobalt/timer: pipeline: abstract tick management Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 12/13] cobalt/debug: pipeline: abstract panic prep call Philippe Gerum
2021-01-02  9:33 ` [PATCH Dovetail 13/13] cobalt/syscall: pipeline: abstract syscall entry points Philippe Gerum
2021-01-07 14:08   ` Jan Kiszka
2021-01-09 10:58     ` Philippe Gerum
2021-01-11 12:11       ` Jan Kiszka

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=b4a996ff-c5d9-a08b-639f-191ac1ef8b35@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.