All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: "florian.bezdeka@siemens.com" <florian.bezdeka@siemens.com>,
	"xenomai@xenomai.org" <xenomai@xenomai.org>,
	song <chensong@tj.kylinos.cn>
Subject: Re: [PATCH v2 2/3] lib/cobalt: Introduce generic feature initialization and check API
Date: Tue, 17 Nov 2020 15:28:19 +0100	[thread overview]
Message-ID: <65f7445b-c7bc-8726-f3ad-fb5ff827135c@siemens.com> (raw)
In-Reply-To: <20201116140641.72027-3-florian.bezdeka@siemens.com>

On 16.11.20 15:07, florian.bezdeka--- via Xenomai wrote:
> From: Florian Bezdeka <florian.bezdeka@siemens.com>
> 
> The feature initialization was arch specific up to now and the
> available features (= features offered by the currently running kernel)
> were no longer accessible once the bind syscall finished.
> 
> This patch introduces a simple API for fetching the offered features
> during runtime.
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
>  lib/cobalt/init.c     |  2 +-
>  lib/cobalt/internal.c | 10 ++++++++++
>  lib/cobalt/internal.h | 39 +++++++++++++++++++++++++++++++++++----
>  3 files changed, 46 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
> index 6907ace36..20e28ccb0 100644
> --- a/lib/cobalt/init.c
> +++ b/lib/cobalt/init.c
> @@ -177,7 +177,7 @@ static void low_init(void)
>  		early_panic("mlockall: %s", strerror(errno));
>  
>  	trace_me("memory locked");
> -	cobalt_arch_check_features(f);
> +	cobalt_features_init(f);
>  	cobalt_init_umm(f->vdso_offset);
>  	trace_me("memory heaps mapped");
>  	cobalt_init_current_keys();
> diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
> index 43330060a..303d86f99 100644
> --- a/lib/cobalt/internal.c
> +++ b/lib/cobalt/internal.c
> @@ -565,3 +565,13 @@ void cobalt_assert_nrt(void)
>  	if (cobalt_should_warn())
>  		pthread_kill(pthread_self(), SIGDEBUG);
>  }
> +
> +unsigned int cobalt_features;
> +
> +void cobalt_features_init(struct cobalt_featinfo *f)
> +{
> +	cobalt_features = f->feat_all;
> +
> +	/* Trigger arch specific feature initialization */
> +	cobalt_arch_check_features(f);
> +}
> \ No newline at end of file
> diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
> index 4ca99d927..a0dff30cd 100644
> --- a/lib/cobalt/internal.h
> +++ b/lib/cobalt/internal.h
> @@ -19,6 +19,7 @@
>  #define _LIB_COBALT_INTERNAL_H
>  
>  #include <limits.h>
> +#include <stdbool.h>
>  #include <boilerplate/ancillaries.h>
>  #include <cobalt/sys/cobalt.h>
>  #include "current.h"
> @@ -86,10 +87,6 @@ int cobalt_xlate_schedparam(int policy,
>  			    struct sched_param *param);
>  int cobalt_init(void);
>  
> -struct cobalt_featinfo;
> -
> -void cobalt_arch_check_features(struct cobalt_featinfo *finfo);
> -
>  extern struct sigaction __cobalt_orig_sigdebug;
>  
>  extern int __cobalt_std_fifo_minpri,
> @@ -98,4 +95,38 @@ extern int __cobalt_std_fifo_minpri,
>  extern int __cobalt_std_rr_minpri,
>  	   __cobalt_std_rr_maxpri;
>  
> +extern unsigned int cobalt_features;
> +
> +struct cobalt_featinfo;
> +
> +/**
> + * Arch specific feature initialization
> + *
> + * @param finfo
> + */
> +void cobalt_arch_check_features(struct cobalt_featinfo *finfo);
> +
> +/**
> + * Initialize the feature handling.
> + *
> + * @param f Feature info that will be cached for future feature checks
> + */
> +void cobalt_features_init(struct cobalt_featinfo *f);
> +
> +/**
> + * Check if a given set of features is available / provided by the kernel
> + *
> + * @param feat_mask A bit mask of features to check availability for. See
> + * __xn_feat_* macros for a list of defined features
> + *
> + * @return true if all features are available, false otherwise
> + */
> +static inline bool cobalt_features_available(unsigned int feat_mask)
> +{
> +	if ((cobalt_features & feat_mask) == feat_mask)
> +		return true;
> +
> +	return false;

Collapsed to

return (cobalt_features & feat_mask) == feat_mask;

> +}
> +
>  #endif /* _LIB_COBALT_INTERNAL_H */
> 

All 3 merged, thanks.

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



  parent reply	other threads:[~2020-11-17 14:28 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-03  3:05 [PATCH 5/5] lib/cobalt/clock.c:dispatch clock_settime chensong
2020-11-10 10:24 ` Jan Kiszka
2020-11-11  3:55   ` chensong
2020-11-11  7:29     ` Jan Kiszka
2020-11-11  9:23       ` chensong
2020-11-11  9:43         ` Jan Kiszka
2020-11-11 10:13           ` chensong
2020-11-13 11:47             ` Florian Bezdeka
2020-11-13 11:56               ` Jan Kiszka
2020-11-13 11:59                 ` [PATCH 0/3] Make offered kernel features accessible during florian.bezdeka
2020-11-13 12:00                   ` [PATCH 1/3] cobalt uapi: Introducing new feature flag for settime64 availability florian.bezdeka
2020-11-13 13:25                     ` Jan Kiszka
2020-11-13 16:18                       ` florian.bezdeka
2020-11-14  7:33                         ` Jan Kiszka
2020-11-14  6:57                     ` song
2020-11-14  7:32                       ` Jan Kiszka
2020-11-14  7:50                         ` song
2020-11-16 14:07                           ` [PATCH v2 0/3] Make offered kernel features accessible during florian.bezdeka
2020-11-16 14:07                             ` [PATCH v2 1/3] lib/cobalt: Rename cobalt_check_features to cobalt_arch_check_features florian.bezdeka
2020-11-16 14:07                             ` [PATCH v2 3/3] cobalt uapi: Introducing new feature flag for time64 availability florian.bezdeka
2020-12-11  6:41                               ` Jan Kiszka
2020-11-16 14:07                             ` [PATCH v2 2/3] lib/cobalt: Introduce generic feature initialization and check API florian.bezdeka
2020-11-17  4:31                               ` song
2020-11-17  8:29                                 ` florian.bezdeka
2020-11-17  8:43                                   ` song
2020-11-17 14:28                               ` Jan Kiszka [this message]
2020-11-13 12:00                   ` [PATCH 2/3] lib/cobalt: Rename cobalt_check_features to cobalt_arch_check_features florian.bezdeka
2020-11-13 12:00                   ` [PATCH 3/3] lib/cobalt: Introduce generic feature initialization and check API florian.bezdeka
2020-11-13 13:25                     ` Jan Kiszka
2020-11-13 16:10                       ` florian.bezdeka
2020-11-14  7:04               ` [PATCH 5/5] lib/cobalt/clock.c:dispatch clock_settime song

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=65f7445b-c7bc-8726-f3ad-fb5ff827135c@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=chensong@tj.kylinos.cn \
    --cc=florian.bezdeka@siemens.com \
    --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.