Re: [PATCH 8/8] score: Replace watchdog handler implementation

2016-03-03 Thread Sebastian Huber



On 03/03/16 23:44, Joel Sherrill wrote:


>
> "be placed on Red-Black Trees for set management." copy-pasted
comment
> should be Chains?

Thanks, for spotting this.

>
> "watchdog is scheduled and a black node". ditto, black should be red
> for the second one.

Oh, yes.

>
> _Watchdog_Ticks_from_seconds(): why is ticks = seconds<<30 the right
> thing to do? Same for _Watchdog_Ticks_from_timespec(). I am missing
> some assumption here, I guess. It might improve readability to
provide
> a helper function for this.

Ok, sorry for the magic numbers.  2**30 == 1073741824 enough to
cope with 1e9 nanoseconds.  So, we have 2**34 seconds available,
leading to a year 2514 problem.


That's pretty close to the 2^64 nanosecond limit as I recall. So 
reasonable but

I suppose that should be very explicit somewhere in a comment.

Funny, before there was a wiki, we had a FAQ document which had a 
section on
date/time overflow issues. We probably need a section in the users 
manual with

the current truth on this:

https://docs.rtems.org/releases/rtemsdocs-4.6.4/share/rtems/html/FAQ/FAQ00100.html

We have multiple date/time and interval representations in the score, 
classic and

POSIX APIs. It would be good to capture them again.


Yes, this is on my TODO list along with the year 2038 problem.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

error in building RTEMS Source Builder

2016-03-03 Thread Abhinav Jain
So I am trying to build the RTEMS Source Builder on my Ubuntu machine
and this is the report file that gets generated!
RTEMS Tools Project - Source Builder Error Report
 Build: error: building rtems-tools-HEAD-1
 Command Line: ../source-builder/sb-set-builder --log=l-i386.txt 
--prefix=/home/abhinav/development/rtems/4.12 4.12/rtems-i386
 Python: 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]
 
git://git.rtems.org/rtems-source-builder.git/origin/b537e5536459e207fc8e56a1df3774c1700606d5-modified
 Linux cr33p 3.19.0-49-generic #55~14.04.1-Ubuntu SMP Fri Jan 22 11:24:31 UTC 
2016 x86_64
Tail of the build log:
script: 69: 
script: 70: 
script: 71: export PATH
script: 72: # Default environment set up.
script: 73: LANG=C
script: 74: export LANG
script: 75: unset DISPLAY || :
script: 76: umask 022
script: 77: cd 
"/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1"
script: 78: echo "=> rtems-tools-HEAD-1:"
script: 79: echo "==> %prep:"
script: 80: build_top=$(pwd)
script: 81: rtems_tools_source="rtems-tools.git"
script: 82: source_dir_rtems_tools=${rtems_tools_source}
source setup: rtems-tools-HEAD-1: source rtems-tools -q -n ${rtems_tools_source}
Creating source directory: sources/git
making dir: 
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/sources/git
git: clone: git://git.rtems.org/rtems-tools.git -> sources/git/rtems-tools.git
git: reset: git://git.rtems.org/rtems-tools.git
git: fetch: git://git.rtems.org/rtems-tools.git -> sources/git/rtems-tools.git
git: checkout: git://git.rtems.org/rtems-tools.git => HEAD
git: pull: git://git.rtems.org/rtems-tools.git
script: 83: cd 
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1
script: 84: /bin/rm -rf ${rtems_tools_source}
script: 85: ln -s 
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/sources/git/rtems-tools.git
 ${source_dir_rtems_tools}
script: 86: cd ${rtems_tools_source}
script: 87: /bin/chmod -R a+rX,g-w,o-w .
script: 88: cd ${build_top}
script: 89: SB_CXC="no"
script: 90: echo "==> clean %{buildroot}: ${SB_BUILD_ROOT}"
script: 91: /bin/rm -rf ${SB_BUILD_ROOT}
script: 92: /bin/mkdir -p ${SB_BUILD_ROOT}
script: 93: echo "==> %build:"
script: 94: build_top=$(pwd)
script: 95: if test "x86_64-linux-gnu" != "x86_64-linux-gnu" ; then
script: 96: RT_HOST="-host=x86_64-linux-gnu"
script: 97: else
script: 98: RT_HOST=
script: 99: fi
script:100: cd ${source_dir_rtems_tools}
script:101: ./waf configure ${RT_HOST} 
--prefix=/home/abhinav/development/rtems/4.12
script:102: ./waf
script:103: cd ${build_top}
script:104: echo "==> %install:"
script:105: build_top=$(pwd)
script:106: /bin/rm -rf $SB_BUILD_ROOT
script:107: SB_BUILD_ROOT_WAF=$SB_BUILD_ROOT
script:108: cd ${source_dir_rtems_tools}
script:109: ./waf --destdir=$SB_BUILD_ROOT_WAF install
script:110: cd ${build_top}
script:111: echo "==> %clean:"
removing: 
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1
making dir: 
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1
write script: 
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1/doit
building: rtems-tools-HEAD-1
run: /bin/sh -ex  
/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1/doit
+ export 
SB_ORIG_PATH=/home/abhinav/development/rtems/4.12/bin:/home/abhinav/development/rtems/4.11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
+ SB_PREFIX=/home/abhinav/development/rtems/4.12
+ echo /home/abhinav/development/rtems/4.12
+ /usr/bin/sed -e s/^\///
+ SB_PREFIX_CLEAN=home/abhinav/development/rtems/4.12
+ 
SB_SOURCE_DIR=/home/abhinav/development/rtems/src/rtems-source-builder/rtems/sources
+ 
SB_BUILD_DIR=/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/rtems-tools-HEAD-1
+ SB_HOST_CFLAGS=-O2 -pipe 
+ SB_HOST_CXXFLAGS=-O2 -pipe 
+ 
SB_HOST_LDFLAGS=-L/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/tmp/sb-abhinav/4.12/rtems-i386/home/abhinav/development/rtems/4.12/lib
+ SB_BUILD_CFLAGS=-O2 -pipe 
-I/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/tmp/sb-abhinav/4.12/rtems-i386/home/abhinav/development/rtems/4.12/include
=> rtems-tools-HEAD-1:
==> %prep:
+ SB_BUILD_CXXFLAGS=-O2 -pipe 
-I/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/tmp/sb-abhinav/4.12/rtems-i386/home/abhinav/development/rtems/4.12/include
+ 
SB_BUILD_LDFLAGS=-L/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/tmp/sb-abhinav/4.12/rtems-i386/home/abhinav/development/rtems/4.12/lib
+ SB_CFLAGS=-O2 -pipe 
-I/home/abhinav/development/rtems/src/rtems-source-builder/rtems/build/tmp/sb-abhinav/4.12/rtems-i386/home/abhinav/development/rtems/4.12/include
 
+ SB_CXXFLAGS=-O2 -pipe 

Building RTEMS hello world image using CMake

2016-03-03 Thread Sambeet Panigrahi
I wanted to build a hello world image of RTEMS using cmake. Can someone
provide me steps for doing so or point me to the right resources ?
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 8/8] score: Replace watchdog handler implementation

2016-03-03 Thread Sebastian Huber
Thanks a lot for your review.

- Gedare Bloom  schrieb:
> I scanned through most of it. I just have a few minor issues/questions:
>
> There is an _Assert(0) followed by a TODO. This _Assert() is likely
> dead/untested code block. It may be worth fabricating a fatal test for
> it, if possible?

This one:

> +  if ( pthread_kill ( ptimer->thread_id, ptimer->inf.sigev_signo ) ) {
> +_Assert( FALSE );
> +/*
> + * TODO: What if an error happens at run-time? This should never
> + *   occur because the timer should be canceled if the thread
> + *   is deleted. This method is being invoked from the Clock
> + *   Tick ISR so even if we decide to take action on an error,
> + *   we don't have many options. We shouldn't shut the system
> down.
> + */

Its a code move from one file to another, so nothing new.

>
> "be placed on Red-Black Trees for set management." copy-pasted comment
> should be Chains?

Thanks, for spotting this.

>
> "watchdog is scheduled and a black node". ditto, black should be red
> for the second one.

Oh, yes.

>
> _Watchdog_Ticks_from_seconds(): why is ticks = seconds<<30 the right
> thing to do? Same for _Watchdog_Ticks_from_timespec(). I am missing
> some assumption here, I guess. It might improve readability to provide
> a helper function for this.

Ok, sorry for the magic numbers.  2**30 == 1073741824 enough to cope with 1e9 
nanoseconds.  So, we have 2**34 seconds available, leading to a year 2514 
problem.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: GSoC 2016 Interested in Tracing was Re:

2016-03-03 Thread Isaac Gutekunst

Hi Vivek,

Chris is definitely the person most knowledgeable in this area.





On 03/03/2016 11:45 AM, Joel Sherrill wrote:



On Thu, Mar 3, 2016 at 10:25 AM, Vivek Kukreja > wrote:

Hi everyone


I am Vivek Kukreja, currently pursuing Masters from India. I'm
interested in applying for GSOC this year. I am a skilled C
Programmer and have strong understanding of OS concepts. I'm
interested in system programming and kernel development.


I am interested to work on topics under Tracing. I am intrigued by
the topic. I think this will be a good place to start for me.


That's a good area that needs work. Chris Johns is the core person in
this area. He is in
Sydney and will likely comment once he is awake. :)

I gave a presentation at the Flight Software Workshop in 2014 on the
RTEMS ecosystem.
Tracing was included in that presentation and Chris helped with the
slides. The slides are
here:

http://flightsoftware.jhuapl.edu/files/2014/Presentations/Day-2/Session-3/2-RTEMSProjectEcosystem.pdf

There is a video of my presentation if you want to see it. But this
presentation covers the
background and status.

I have gone through Getting Started documentation and setup RTEMS on
my machine. I have tried running the provided examples. I tried to
run the tracing example, but am facing some problem during
compilation (wrapper compilation error). I will continue looking
into it, and report if I can't solve the problem on my own.


Focus first on doing the GSoC Hello World and adding yourself to the
list of students.
Then ask specific questions about those examples.

Please tell me about the open projects under the Tracing Tool. I
request you to please give me some pointers to get started.


Chris is the person to make sure the task list is current and in priority.

But I know there is work to be done on generation of method trace wrappers,
getting trace data off target (tcp/ip, etc), and producing Common Trace
Format
and integrating with the Linux Trace Toolkit.

My understanding is that the Linux Trace Toolkit can also dynamically
interact (bidirectionally) with the target system. I don't know what that
entails but it is desirable. But it requires having basic integration solved
first.


I have done some work on the side trying to understand the lttng-live 
trace protocol


The Linux Trace Toolkit has one component that runs on a potentially 
remote system, and captures trace information.


A different system can connect to the system being traced using the 
lttng-live protocol.


See 
https://github.com/lttng/lttng-tools/blob/master/doc/live-reading-protocol.txt


It is a fairly straightforward binary protocol with a handshake, and a 
few interactions before raw CTF is sent back in a request/response manner.



The lttng-live relay daemon is what provides this service.

The code for that can be seen here:

https://github.com/lttng/lttng-tools/tree/master/src/common/relayd


I've done some work to implement the lttng-live protocol as a proof of 
concept as part of some development here.


I'd be interested in providing some help to make RTEMS Trace Capture 
Engine support storing logs in CTF format, and making them available via 
lttng-live.



Hope this helps as well,

Isaac







I hope that helps.

--joel

Regards,

Vivek



___
devel mailing list
devel@rtems.org 
http://lists.rtems.org/mailman/listinfo/devel




___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: Porting Rock on RTEMS

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 10:06 AM, Sambeet Panigrahi 
wrote:

> Hi,
> I am interested in working on porting Rock to RTEMS for GSoC-2016.I have
> been trying to understand the Rock libraries and previous work undertaken
> regarding this project. I just wanted to know if this can be taken up as a
> GSoC project for this year? I have been getting mixed opinions about this
> in IRC and emails.Can you please provide some clarity to this?
>

There is no reason it can't be if there is someone from Rock who will
co-mentor. None of
the RTEMS core developers have experience with Rock.

There is also ROS which does not have an RTEMS port yet. That is desirable
also and
I am pretty sure we can get a ROS mentor.

I am assuming you want to work in robotics. :)

--joel


> Regards
> Sambeet
>
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Interested to work on Tracing Tool(GSOC)

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 10:47 AM, Vivek Kukreja 
wrote:

> Hi everyone
>
> I'm sorry i did not add subject to the previous mail.
>
>
> I fixed this in my reply. I hope it made it out and you saw it.

--joel


> I am Vivek Kukreja, currently pursuing Masters from India. I'm interested
> in applying for GSOC this year. I am a skilled C Programmer and have strong
> understanding of OS concepts. I'm interested in system programming
> and kernel development.
>
>
> I am interested to work on topics under Tracing. I am intrigued by the
> topic. I think this will be a good place to start for me.
>
>
> I have gone through Getting Started documentation and setup RTEMS on my
> machine. I have tried running the provided examples. I tried to run the
> tracing example, but am facing some problem during compilation (wrapper
> compilation error). I will continue looking into it, and report if I can't
> solve the problem on my own.
>
>
> Please tell me about the open projects under the Tracing Tool. I request
> you to please give me some pointers to get started.
>
>
> Regards,
>
> Vivek
>
>
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Interested to work on Tracing Tool(GSOC)

2016-03-03 Thread Vivek Kukreja
Hi everyone

I'm sorry i did not add subject to the previous mail.


I am Vivek Kukreja, currently pursuing Masters from India. I'm interested in 
applying for GSOC this year. I am a skilled C Programmer and have strong 
understanding of OS concepts. I'm interested in system programming and kernel 
development.


I am interested to work on topics under Tracing. I am intrigued by the topic. I 
think this will be a good place to start for me.


I have gone through Getting Started documentation and setup RTEMS on my 
machine. I have tried running the provided examples. I tried to run the tracing 
example, but am facing some problem during compilation (wrapper compilation 
error). I will continue looking into it, and report if I can't solve the 
problem on my own.


Please tell me about the open projects under the Tracing Tool. I request you to 
please give me some pointers to get started.


Regards,

Vivek


___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

GSoC 2016 Interested in Tracing was Re:

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 10:25 AM, Vivek Kukreja 
wrote:

> Hi everyone
>
>
> I am Vivek Kukreja, currently pursuing Masters from India. I'm interested
> in applying for GSOC this year. I am a skilled C Programmer and have strong
> understanding of OS concepts. I'm interested in system programming
> and kernel development.
>
>
> I am interested to work on topics under Tracing. I am intrigued by the
> topic. I think this will be a good place to start for me.
>
>
> That's a good area that needs work. Chris Johns is the core person in this
area. He is in
Sydney and will likely comment once he is awake. :)

I gave a presentation at the Flight Software Workshop in 2014 on the RTEMS
ecosystem.
Tracing was included in that presentation and Chris helped with the slides.
The slides are
here:

http://flightsoftware.jhuapl.edu/files/2014/Presentations/Day-2/Session-3/2-RTEMSProjectEcosystem.pdf

There is a video of my presentation if you want to see it. But this
presentation covers the
background and status.


> I have gone through Getting Started documentation and setup RTEMS on my
> machine. I have tried running the provided examples. I tried to run the
> tracing example, but am facing some problem during compilation (wrapper
> compilation error). I will continue looking into it, and report if I can't
> solve the problem on my own.
>
>
> Focus first on doing the GSoC Hello World and adding yourself to the list
of students.
Then ask specific questions about those examples.


> Please tell me about the open projects under the Tracing Tool. I request
> you to please give me some pointers to get started.
>
>
> Chris is the person to make sure the task list is current and in priority.

But I know there is work to be done on generation of method trace wrappers,
getting trace data off target (tcp/ip, etc), and producing Common Trace
Format
and integrating with the Linux Trace Toolkit.

My understanding is that the Linux Trace Toolkit can also dynamically
interact (bidirectionally) with the target system. I don't know what that
entails but it is desirable. But it requires having basic integration solved
first.

I hope that helps.

--joel


> Regards,
>
> Vivek
>
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[no subject]

2016-03-03 Thread Vivek Kukreja
Hi everyone


I am Vivek Kukreja, currently pursuing Masters from India. I'm interested in 
applying for GSOC this year. I am a skilled C Programmer and have strong 
understanding of OS concepts. I'm interested in system programming and kernel 
development.


I am interested to work on topics under Tracing. I am intrigued by the topic. I 
think this will be a good place to start for me.


I have gone through Getting Started documentation and setup RTEMS on my 
machine. I have tried running the provided examples. I tried to run the tracing 
example, but am facing some problem during compilation (wrapper compilation 
error). I will continue looking into it, and report if I can't solve the 
problem on my own.


Please tell me about the open projects under the Tracing Tool. I request you to 
please give me some pointers to get started.


Regards,

Vivek

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 6/6] Remove AVR Architectural Port

2016-03-03 Thread Joel Sherrill
This was committed weeks ago. Must have been held back due to size.

--joel
On Sun, Jan 3, 2016 at 3:27 PM, Joel Sherrill  wrote:

> From: Joel Sherrill 
>
> Updates #2443.
> ---
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 2/8] score: Add Processor_mask, etc.

2016-03-03 Thread Joel Sherrill
OK. Makes sense based on what appears to be coming.

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> ---
>  cpukit/score/Makefile.am |  1 +
>  cpukit/score/include/rtems/score/processormask.h | 90
> 
>  cpukit/score/preinstall.am   |  4 ++
>  3 files changed, 95 insertions(+)
>  create mode 100644 cpukit/score/include/rtems/score/processormask.h
>
> diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
> index 8506f22..3d3f1c1 100644
> --- a/cpukit/score/Makefile.am
> +++ b/cpukit/score/Makefile.am
> @@ -61,6 +61,7 @@ include_rtems_score_HEADERS +=
> include/rtems/score/priority.h
>  include_rtems_score_HEADERS += include/rtems/score/prioritybitmap.h
>  include_rtems_score_HEADERS += include/rtems/score/prioritybitmapimpl.h
>  include_rtems_score_HEADERS += include/rtems/score/profiling.h
> +include_rtems_score_HEADERS += include/rtems/score/processormask.h
>  include_rtems_score_HEADERS += include/rtems/score/rbtree.h
>  include_rtems_score_HEADERS += include/rtems/score/rbtreeimpl.h
>  include_rtems_score_HEADERS += include/rtems/score/resource.h
> diff --git a/cpukit/score/include/rtems/score/processormask.h
> b/cpukit/score/include/rtems/score/processormask.h
> new file mode 100644
> index 000..5a78dd3
> --- /dev/null
> +++ b/cpukit/score/include/rtems/score/processormask.h
> @@ -0,0 +1,90 @@
> +/**
> + * @file
> + *
> + * @brief Processor Mask API
> + *
> + * @ingroup ScoreProcessorMask
> + */
> +
> +/*
> + * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
> + *
> + *  embedded brains GmbH
> + *  Dornierstr. 4
> + *  82178 Puchheim
> + *  Germany
> + *  
> + *
> + * The license and distribution terms for this file may be
> + * found in the file LICENSE in this distribution or at
> + * http://www.rtems.org/license/LICENSE.
> + */
> +
> +#ifndef _RTEMS_SCORE_PROCESSORMASK_H
> +#define _RTEMS_SCORE_PROCESSORMASK_H
> +
> +#include 
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif /* __cplusplus */
> +
> +/**
> + * @defgroup ScoreProcessorMask Processor Mask
> + *
> + * @ingroup Score
> + *
> + * The processor mask provides a bit map large enough to provide one bit
> for
> + * each processor in the system.  It is a fixed size internal data type
> + * provided for efficiency in addition to the API level cpu_set_t.
> + *
> + * @{
> + */
> +
> +#define PROCESSOR_MASK_BITS_PER_FIELD 32
> +
> +#define PROCESSOR_MASK_FIELD_COUNT \
> +  ( ( CPU_MAXIMUM_PROCESSORS + PROCESSOR_MASK_BITS_PER_FIELD - 1 ) \
> +/ PROCESSOR_MASK_BITS_PER_FIELD )
> +
> +#define PROCESSOR_MASK_BIT( index ) \
> +  (1UL << ( ( index ) % PROCESSOR_MASK_BITS_PER_FIELD ) )
> +
> +#define PROCESSOR_MASK_FIELD( index ) \
> +  ( ( index ) / PROCESSOR_MASK_BITS_PER_FIELD )
> +
> +/**
> + * @brief A bit map consisting of 32-bit integer fields which is large
> enough
> + * to provide one bit for each processor in the system.
> + *
> + * Processor 0 corresponds to the bit 0 (least-significant) of the field
> 0 in
> + * the array, and so on.
> + */
> +typedef uint32_t Processor_mask[ PROCESSOR_MASK_FIELD_COUNT ];
> +
> +RTEMS_INLINE_ROUTINE void _Processor_mask_Set( Processor_mask mask,
> uint32_t index )
> +{
> +  mask[ PROCESSOR_MASK_FIELD( index ) ] |= PROCESSOR_MASK_BIT( index );
> +}
> +
> +RTEMS_INLINE_ROUTINE void _Processor_mask_Clear( Processor_mask mask,
> uint32_t index )
> +{
> +  mask[ PROCESSOR_MASK_FIELD( index ) ] &= ~PROCESSOR_MASK_BIT( index );
> +}
> +
> +RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_set(
> +  const Processor_mask mask,
> +  uint32_t index
> +)
> +{
> +  return ( mask[ PROCESSOR_MASK_FIELD( index ) ]
> +& PROCESSOR_MASK_BIT( index ) ) != 0;
> +}
> +
> +/** @} */
> +
> +#ifdef __cplusplus
> +}
> +#endif /* __cplusplus */
> +
> +#endif /* _RTEMS_SCORE_PROCESSORMASK_H */
> diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
> index 0d9cade..3a70bfa 100644
> --- a/cpukit/score/preinstall.am
> +++ b/cpukit/score/preinstall.am
> @@ -212,6 +212,10 @@ $(PROJECT_INCLUDE)/rtems/score/profiling.h:
> include/rtems/score/profiling.h $(PR
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/profiling.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/profiling.h
>
> +$(PROJECT_INCLUDE)/rtems/score/processormask.h:
> include/rtems/score/processormask.h
> $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
> +   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/processormask.h
> +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/processormask.h
> +
>  $(PROJECT_INCLUDE)/rtems/score/rbtree.h: include/rtems/score/rbtree.h
> $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/rbtree.h
>  PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/rbtree.h
> --
> 1.8.4.5
>
> ___
> devel mailing list
> devel@rtems.org
> 

Re: [PATCH 5/8] score: Add _Per_CPU_Is_boot_processor()

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 9:14 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

>
>
> On 03/03/16 16:12, Joel Sherrill wrote:
>
>> Other than bookkeeping, what is this going to be used for?
>>
>
> Its used later in the watchdog tick. The boot processor manages the wall
> clock time.
>
>
>> How is it configured? The _SMP_Fatal() call at the end of the patch hints
>> that there is some related configuration.
>>
>
> The boot processor is the processor that performs the sequential system
> initialization. This name is used in several other places.
>
>
And it is configured currently? Just checking.

I didn't have a problem with the name.


> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/8] score: Add CPU_MAXIMUM_PROCESSORS

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 9:12 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

>
>
> On 03/03/16 16:10, Joel Sherrill wrote:
>
>> How does this interact with the pthread affinity and cpuset size?
>>
>
> Its unrelated to the high level API.
>
>
>> If we end up with a port that can support more than 32, then do we
>> increase the cpuset size or make applications more to variable cpuset's?
>>
>
> No, the high level API is a different issue.
>
>
>> What's the intended use?
>>
>
> The high level API cpu_set_t is to inefficient for internal use. Linux
> uses something similar internally.


So the affinity data structure internally is going to change?

This constant was added for some purpose. What is it?

>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 7/8] score: Distribute clock tick to all online CPUs

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 9:15 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

>
>
> On 03/03/16 16:14, Joel Sherrill wrote:
>
>> I don't necessarily see anything wrong but I don't see the overall design
>> and execution flow from the code. Is there some documentation?
>>
>
> I will update the clock driver documentation once the new documentation
> repository is ready for contribution.
>
> OK. File a ticket on it please. I am going to have to do the same for the
POSIX APIs I am adding.


> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 7/8] score: Distribute clock tick to all online CPUs

2016-03-03 Thread Joel Sherrill
I don't necessarily see anything wrong but I don't see the overall design
and execution flow from the code. Is there some documentation?

Sorry.. used the wrong reply to email address and it didn't hit the list.

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Update #2554.
> ---
>  .../libbsp/arm/shared/arm-a9mpcore-clock-config.c  | 68
> +++---
>  c/src/lib/libbsp/arm/shared/arm-gic-irq.c  | 18 ++
>  c/src/lib/libbsp/arm/shared/include/arm-gic-irq.h  |  5 ++
>  c/src/lib/libbsp/i386/pc386/clock/ckinit.c | 15 +++--
>  c/src/lib/libbsp/i386/shared/smp/smp-imps.c| 11 +++-
>  .../lib/libbsp/powerpc/qoriq/clock/clock-config.c  |  9 ++-
>  c/src/lib/libbsp/powerpc/qoriq/include/irq.h   |  5 ++
>  c/src/lib/libbsp/powerpc/qoriq/irq/irq.c   | 20 ---
>  c/src/lib/libbsp/shared/clockdrv_shell.h   | 12 
>  c/src/lib/libbsp/shared/include/fatal.h|  1 +
>  c/src/lib/libbsp/sparc/erc32/clock/ckinit.c|  5 ++
>  c/src/lib/libbsp/sparc/leon3/clock/ckinit.c| 11 
>  cpukit/score/include/rtems/score/smpimpl.h | 34 +++
>  cpukit/score/include/rtems/score/watchdogimpl.h|  7 ++-
>  cpukit/score/src/kern_tc.c |  9 ++-
>  cpukit/score/src/smp.c |  5 +-
>  cpukit/score/src/watchdogtick.c| 10 ++--
>  17 files changed, 199 insertions(+), 46 deletions(-)
>
> diff --git a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
> b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
> index 8e2e153..3dcf708 100644
> --- a/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
> +++ b/c/src/lib/libbsp/arm/shared/arm-a9mpcore-clock-config.c
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2013-2015 embedded brains GmbH.  All rights reserved.
> + * Copyright (c) 2013, 2016 embedded brains GmbH.  All rights reserved.
>   *
>   *  embedded brains GmbH
>   *  Dornierstr. 4
> @@ -15,9 +15,11 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #define A9MPCORE_GT ((volatile a9mpcore_gt *) BSP_ARM_A9MPCORE_GT_BASE)
>
> @@ -77,6 +79,60 @@ static uint32_t a9mpcore_clock_get_timecount(struct
> timecounter *tc)
>return gt->cntrlower;
>  }
>
> +static void a9mpcore_clock_gt_init(
> +  volatile a9mpcore_gt *gt,
> +  uint64_t cmpval,
> +  uint32_t interval
> +)
> +{
> +  gt->cmpvallower = (uint32_t) cmpval;
> +  gt->cmpvalupper = (uint32_t) (cmpval >> 32);
> +  gt->autoinc = interval;
> +  gt->ctrl = A9MPCORE_GT_CTRL_AUTOINC_EN
> +| A9MPCORE_GT_CTRL_IRQ_EN
> +| A9MPCORE_GT_CTRL_COMP_EN
> +| A9MPCORE_GT_CTRL_TMR_EN;
> +}
> +
> +#ifdef RTEMS_SMP
> +typedef struct {
> +  uint64_t cmpval;
> +  uint32_t interval;
> +} a9mpcore_clock_init_data;
> +
> +static void a9mpcore_clock_secondary_action(void *arg)
> +{
> +  volatile a9mpcore_gt *gt = A9MPCORE_GT;
> +  a9mpcore_clock_init_data *init_data = arg;
> +
> +  a9mpcore_clock_gt_init(gt, init_data->cmpval, init_data->interval);
> +  bsp_interrupt_vector_enable(A9MPCORE_IRQ_GT);
> +}
> +#endif
> +
> +static void a9mpcore_clock_secondary_initialization(
> +  volatile a9mpcore_gt *gt,
> +  uint64_t cmpval,
> +  uint32_t interval
> +)
> +{
> +#ifdef RTEMS_SMP
> +  a9mpcore_clock_init_data init_data = {
> +.cmpval = cmpval,
> +.interval = interval
> +  };
> +
> +  _SMP_Before_multitasking_action_broadcast(
> +a9mpcore_clock_secondary_action,
> +_data
> +  );
> +
> +  if (cmpval - a9mpcore_clock_get_counter(gt) >= interval) {
> +bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_SMP_INIT);
> +  }
> +#endif
> +}
> +
>  static void a9mpcore_clock_initialize(void)
>  {
>volatile a9mpcore_gt *gt = A9MPCORE_GT;
> @@ -91,14 +147,8 @@ static void a9mpcore_clock_initialize(void)
>cmpval = a9mpcore_clock_get_counter(gt);
>cmpval += interval;
>
> -  gt->cmpvallower = (uint32_t) cmpval;
> -  gt->cmpvalupper = (uint32_t) (cmpval >> 32);
> -  gt->autoinc = interval;
> -
> -  gt->ctrl = A9MPCORE_GT_CTRL_AUTOINC_EN
> -| A9MPCORE_GT_CTRL_IRQ_EN
> -| A9MPCORE_GT_CTRL_COMP_EN
> -| A9MPCORE_GT_CTRL_TMR_EN;
> +  a9mpcore_clock_gt_init(gt, cmpval, interval);
> +  a9mpcore_clock_secondary_initialization(gt, cmpval, interval);
>
>a9mpcore_tc.tc_get_timecount = a9mpcore_clock_get_timecount;
>a9mpcore_tc.tc_counter_mask = 0x;
> diff --git a/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
> b/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
> index 7623489..487ee16 100644
> --- a/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
> +++ b/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
> @@ -164,3 +164,21 @@ rtems_status_code arm_gic_irq_get_priority(
>
>return sc;
>  }
> +
> +rtems_status_code arm_gic_irq_set_affinity(
> +  rtems_vector_number vector,
> +  uint8_t targets
> +)
> +{
> +  rtems_status_code sc = RTEMS_SUCCESSFUL;
> +
> +  if (bsp_interrupt_is_valid_vector(vector)) {
> +volatile 

Re: [PATCH 6/8] score: Add _SMP_Before_multitasking_action()

2016-03-03 Thread Joel Sherrill
On Thu, Mar 3, 2016 at 9:11 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

>
>
> On 03/03/16 16:08, Joel Sherrill wrote:
>
>> The git log message needs more but it looks good otherwise.
>>
>
> Ok, I had to add this for the Cortex-A9 MPCore which has per-processor
> registers for the global timer used by the clock driver. This might be
> useful for other drivers as well.
>
> Thanks. Just add some details to the git log message and some
comments on what it might be used to do.

--joel


> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail  : sebastian.hu...@embedded-brains.de
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 7/8] score: Distribute clock tick to all online CPUs

2016-03-03 Thread Sebastian Huber



On 03/03/16 16:14, Joel Sherrill wrote:

I don't necessarily see anything wrong but I don't see the overall design
and execution flow from the code. Is there some documentation?


I will update the clock driver documentation once the new documentation 
repository is ready for contribution.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 5/8] score: Add _Per_CPU_Is_boot_processor()

2016-03-03 Thread Sebastian Huber



On 03/03/16 16:12, Joel Sherrill wrote:

Other than bookkeeping, what is this going to be used for?


Its used later in the watchdog tick. The boot processor manages the wall 
clock time.




How is it configured? The _SMP_Fatal() call at the end of the patch hints
that there is some related configuration.


The boot processor is the processor that performs the sequential system 
initialization. This name is used in several other places.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Testing the rock port

2016-03-03 Thread Gedare Bloom
You will need to find out how you can run Rock. Ideally, Qemu will
work for it, from what I can tell they used the i386-rtems/pc486 BSP.



On Thu, Mar 3, 2016 at 8:11 AM, Sambeet Panigrahi
 wrote:
>
> -- Forwarded message --
> From: Sambeet Panigrahi 
> Date: Thu, Mar 3, 2016 at 2:11 PM
> Subject: Testing the rock port
> To: devel-requ...@rtems.org
>
>
> Hi,
> I am interested in working on porting Rock on RTEMS for GSOC-2016 . I have
> gone through all the libraries of Rock.But I have this buidconf which is the
> existing port of Rock on RTEMS.
>
> https://github.com/rock-core/buildconf/tree/rtems
>
> How do I test that buildconf actually works? In general how do we know the
> port is successful?
>
> Regards
> Sambeet
>
>
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH 6/8] score: Add _SMP_Before_multitasking_action()

2016-03-03 Thread Sebastian Huber



On 03/03/16 16:08, Joel Sherrill wrote:

The git log message needs more but it looks good otherwise.


Ok, I had to add this for the Cortex-A9 MPCore which has per-processor 
registers for the global timer used by the clock driver. This might be 
useful for other drivers as well.


--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 4/8] score: Add _SMP_Online_processors

2016-03-03 Thread Joel Sherrill
Looks OK. I assume this is infrastructure for something that is coming.

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> ---
>  cpukit/score/include/rtems/score/smpimpl.h | 11 +++
>  cpukit/score/src/smp.c |  5 -
>  testsuites/smptests/smpipi01/init.c| 10 ++
>  3 files changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/cpukit/score/include/rtems/score/smpimpl.h
> b/cpukit/score/include/rtems/score/smpimpl.h
> index 09c47ec..386216f 100644
> --- a/cpukit/score/include/rtems/score/smpimpl.h
> +++ b/cpukit/score/include/rtems/score/smpimpl.h
> @@ -20,6 +20,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -91,6 +92,16 @@ static inline void _SMP_Fatal( SMP_Fatal_code code )
>  #if defined( RTEMS_SMP )
>
>  /**
> + * @brief Set of online processors.
> + *
> + * A processor is online if was started during system initialization.  In
> this
> + * case its corresponding bit in the mask is set.
> + *
> + * @see _SMP_Handler_initialize().
> + */
> +extern Processor_mask _SMP_Online_processors;
> +
> +/**
>   * @brief Performs high-level initialization of a secondary processor and
> runs
>   * the application threads.
>   *
> diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
> index b2713f1..68a55ff 100644
> --- a/cpukit/score/src/smp.c
> +++ b/cpukit/score/src/smp.c
> @@ -29,6 +29,8 @@
>#error "deferred FP switch not implemented for SMP"
>  #endif
>
> +Processor_mask _SMP_Online_processors;
> +
>  uint32_t _SMP_Processor_count;
>
>  static void _SMP_Start_processors( uint32_t cpu_count )
> @@ -36,7 +38,6 @@ static void _SMP_Start_processors( uint32_t cpu_count )
>uint32_t cpu_index_self = _SMP_Get_current_processor();
>uint32_t cpu_index;
>
> -
>for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) {
>  const Scheduler_Assignment *assignment =
>_Scheduler_Get_assignment( cpu_index );
> @@ -69,6 +70,8 @@ static void _SMP_Start_processors( uint32_t cpu_count )
>
>++context->processor_count;
>cpu->scheduler_context = context;
> +
> +  _Processor_mask_Set( _SMP_Online_processors, cpu_index );
>  }
>}
>  }
> diff --git a/testsuites/smptests/smpipi01/init.c
> b/testsuites/smptests/smpipi01/init.c
> index db0688c..8c39d18 100644
> --- a/testsuites/smptests/smpipi01/init.c
> +++ b/testsuites/smptests/smpipi01/init.c
> @@ -161,6 +161,10 @@ static void test_send_message_flood(
>}
>
>for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
> +rtems_test_assert(
> +  _Processor_mask_Is_set(_SMP_Online_processors, cpu_index)
> +);
> +
>  printf(
>"inter-processor interrupts for processor %"
>  PRIu32 "%s: %" PRIu32 "\n",
> @@ -169,6 +173,12 @@ static void test_send_message_flood(
>ctx->counters[cpu_index].value
>  );
>}
> +
> +  for (; cpu_index < CPU_COUNT; ++cpu_index) {
> +rtems_test_assert(
> +  !_Processor_mask_Is_set(_SMP_Online_processors, cpu_index)
> +);
> +  }
>  }
>
>  static void test(void)
> --
> 1.8.4.5
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 1/8] score: Add CPU_MAXIMUM_PROCESSORS

2016-03-03 Thread Joel Sherrill
How does this interact with the pthread affinity and cpuset size?

If we end up with a port that can support more than 32, then do we
increase the cpuset size or make applications more to variable cpuset's?

What's the intended use?

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Maximum number of processors of all systems supported by this CPU port.
> ---
>  cpukit/score/cpu/arm/rtems/score/cpu.h  | 2 ++
>  cpukit/score/cpu/bfin/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/epiphany/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/i386/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/lm32/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/m32c/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/m68k/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/mips/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/moxie/rtems/score/cpu.h| 2 ++
>  cpukit/score/cpu/nios2/rtems/score/cpu.h| 2 ++
>  cpukit/score/cpu/no_cpu/rtems/score/cpu.h   | 6 ++
>  cpukit/score/cpu/or1k/rtems/score/cpu.h | 2 ++
>  cpukit/score/cpu/powerpc/rtems/score/cpu.h  | 2 ++
>  cpukit/score/cpu/sh/rtems/score/cpu.h   | 2 ++
>  cpukit/score/cpu/sparc/rtems/score/cpu.h| 2 ++
>  cpukit/score/cpu/sparc64/rtems/score/cpu.h  | 2 ++
>  cpukit/score/cpu/v850/rtems/score/cpu.h | 2 ++
>  17 files changed, 38 insertions(+)
>
> diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h
> b/cpukit/score/cpu/arm/rtems/score/cpu.h
> index 89b7609..4380590 100644
> --- a/cpukit/score/cpu/arm/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
> @@ -204,6 +204,8 @@
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  /** @} */
>
>  #ifdef ARM_MULTILIB_HAS_THREAD_ID_REGISTER
> diff --git a/cpukit/score/cpu/bfin/rtems/score/cpu.h
> b/cpukit/score/cpu/bfin/rtems/score/cpu.h
> index 3302f47..e4ad87f 100644
> --- a/cpukit/score/cpu/bfin/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/bfin/rtems/score/cpu.h
> @@ -354,6 +354,8 @@ extern "C" {
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  /*
>   *  Processor defined structures required for cpukit/score.
>   *
> diff --git a/cpukit/score/cpu/epiphany/rtems/score/cpu.h
> b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
> index 896af12..e433e19 100644
> --- a/cpukit/score/cpu/epiphany/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
> @@ -795,6 +795,8 @@ typedef struct {
>  #define CPU_EXCEPTION_FRAME_SIZE 260
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  #ifndef ASM
>  typedef uint16_t Priority_bit_map_Word;
>
> diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h
> b/cpukit/score/cpu/i386/rtems/score/cpu.h
> index d6828dc..9ad9cf2 100644
> --- a/cpukit/score/cpu/i386/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
> @@ -129,6 +129,8 @@ extern "C" {
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  #define I386_CONTEXT_CONTROL_EFLAGS_OFFSET 0
>  #define I386_CONTEXT_CONTROL_ESP_OFFSET 4
>  #define I386_CONTEXT_CONTROL_EBP_OFFSET 8
> diff --git a/cpukit/score/cpu/lm32/rtems/score/cpu.h
> b/cpukit/score/cpu/lm32/rtems/score/cpu.h
> index 3ddae7c..1a22da8 100644
> --- a/cpukit/score/cpu/lm32/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h
> @@ -348,6 +348,8 @@ extern "C" {
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  /*
>   *  Processor defined structures required for cpukit/score.
>   *
> diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h
> b/cpukit/score/cpu/m32c/rtems/score/cpu.h
> index 59e9b4e..de0ead5 100644
> --- a/cpukit/score/cpu/m32c/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h
> @@ -371,6 +371,8 @@ extern "C" {
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  /*
>   *  Processor defined structures required for cpukit/score.
>   *
> diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h
> b/cpukit/score/cpu/m68k/rtems/score/cpu.h
> index 06d711a..470391a 100644
> --- a/cpukit/score/cpu/m68k/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h
> @@ -115,6 +115,8 @@ extern "C" {
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  #if ( CPU_HARDWARE_FP == TRUE ) && !defined( __mcoldfire__ )
>#if defined( __mc68060__ )
>  #define M68K_FP_STATE_SIZE 16
> diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h
> b/cpukit/score/cpu/mips/rtems/score/cpu.h
> index cb66b89..67a9ea6 100644
> --- a/cpukit/score/cpu/mips/rtems/score/cpu.h
> +++ b/cpukit/score/cpu/mips/rtems/score/cpu.h
> @@ -313,6 +313,8 @@ extern "C" {
>
>  #define CPU_PER_CPU_CONTROL_SIZE 0
>
> +#define CPU_MAXIMUM_PROCESSORS 32
> +
>  /*
>   *  Processor defined structures
>   *
> diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h
> b/cpukit/score/cpu/moxie/rtems/score/cpu.h
> index 9f0b9b4..ad40ff4 100644
> --- 

Re: [PATCH 6/8] score: Add _SMP_Before_multitasking_action()

2016-03-03 Thread Joel Sherrill
The git log message needs more but it looks good otherwise.

--joel

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Update #2554.
> ---
>  cpukit/score/include/rtems/score/percpu.h  |  8 +++
>  cpukit/score/include/rtems/score/smpimpl.h | 48 +++-
>  cpukit/score/src/percpu.c  | 92
> +++---
>  cpukit/score/src/smp.c | 23 
>  cpukit/score/src/smpmulticastaction.c  |  4 +-
>  5 files changed, 164 insertions(+), 11 deletions(-)
>
> diff --git a/cpukit/score/include/rtems/score/percpu.h
> b/cpukit/score/include/rtems/score/percpu.h
> index 19f46d2..39be1e3 100644
> --- a/cpukit/score/include/rtems/score/percpu.h
> +++ b/cpukit/score/include/rtems/score/percpu.h
> @@ -361,6 +361,14 @@ typedef struct Per_CPU_Control {
>  Per_CPU_State state;
>
>  /**
> + * @brief Action to be executed by this processor in the
> + * SYSTEM_STATE_BEFORE_MULTITASKING state on behalf of the boot
> processor.
> + *
> + * @see _SMP_Before_multitasking_action().
> + */
> +Atomic_Uintptr before_multitasking_action;
> +
> +/**
>   * @brief Indicates if the processor has been successfully started via
>   * _CPU_SMP_Start_processor().
>   */
> diff --git a/cpukit/score/include/rtems/score/smpimpl.h
> b/cpukit/score/include/rtems/score/smpimpl.h
> index 386216f..59a99ec 100644
> --- a/cpukit/score/include/rtems/score/smpimpl.h
> +++ b/cpukit/score/include/rtems/score/smpimpl.h
> @@ -235,7 +235,7 @@ void _SMP_Send_message_multicast(
>unsigned long message
>  );
>
> -typedef void ( *SMP_Multicast_action_handler )( void *arg );
> +typedef void ( *SMP_Action_handler )( void *arg );
>
>  /**
>   *  @brief Initiates a SMP multicast action to a set of processors.
> @@ -250,10 +250,54 @@ typedef void ( *SMP_Multicast_action_handler )( void
> *arg );
>  void _SMP_Multicast_action(
>const size_t setsize,
>const cpu_set_t *cpus,
> -  SMP_Multicast_action_handler handler,
> +  SMP_Action_handler handler,
>void *arg
>  );
>
> +/**
> + * @brief Executes a handler with argument on the specified processor on
> behalf
> + * of the boot processor.
> + *
> + * The calling processor must be the boot processor.  In case the
> specified
> + * processor is not online or not in the
> + * PER_CPU_STATE_READY_TO_START_MULTITASKING state, then no action is
> + * performed.
> + *
> + * @param cpu The processor to execute the action.
> + * @param handler The handler of the action.
> + * @param arg The argument of the action.
> + *
> + * @retval true The handler executed on the specified processor.
> + * @retval false Otherwise.
> + *
> + * @see _SMP_Before_multitasking_action_broadcast().
> + */
> +bool _SMP_Before_multitasking_action(
> +  Per_CPU_Control*cpu,
> +  SMP_Action_handler  handler,
> +  void   *arg
> +);
> +
> +/**
> + * @brief Executes a handler with argument on all online processors
> except the
> + * boot processor on behalf of the boot processor.
> + *
> + * The calling processor must be the boot processor.
> + *
> + * @param handler The handler of the action.
> + * @param arg The argument of the action.
> + *
> + * @retval true The handler executed on all online processors except the
> boot
> + * processor.
> + * @retval false Otherwise.
> + *
> + * @see _SMP_Before_multitasking_action().
> + */
> +bool _SMP_Before_multitasking_action_broadcast(
> +  SMP_Action_handler  handler,
> +  void   *arg
> +);
> +
>  #endif /* defined( RTEMS_SMP ) */
>
>  /**
> diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c
> index 730528a..0e4c067 100644
> --- a/cpukit/score/src/percpu.c
> +++ b/cpukit/score/src/percpu.c
> @@ -20,6 +20,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>
> @@ -35,11 +36,48 @@ RTEMS_STATIC_ASSERT(
>
>  #if defined(RTEMS_SMP)
>
> -static SMP_lock_Control _Per_CPU_State_lock =
> -  SMP_LOCK_INITIALIZER("per-CPU state");
> +typedef struct {
> +  SMP_Action_handler handler;
> +  void *arg;
> +} SMP_Before_multicast_action;
> +
> +ISR_LOCK_DEFINE( static, _Per_CPU_State_lock, "Per-CPU State" )
> +
> +static void _Per_CPU_State_acquire( ISR_lock_Context *lock_context )
> +{
> +  _ISR_lock_ISR_disable_and_acquire( &_Per_CPU_State_lock, lock_context );
> +}
> +
> +static void _Per_CPU_State_release( ISR_lock_Context *lock_context )
> +{
> +  _ISR_lock_Release_and_ISR_enable( &_Per_CPU_State_lock, lock_context );
> +}
> +
> +static void _Per_CPU_State_before_multitasking_action( Per_CPU_Control
> *cpu )
> +{
> +  uintptr_t action_value;
> +
> +  action_value = _Atomic_Load_uintptr(
> +>before_multitasking_action,
> +ATOMIC_ORDER_ACQUIRE
> +  );
> +
> +  if ( action_value != 0 ) {
> +SMP_Before_multicast_action *action =
> +  (SMP_Before_multicast_action *) action_value;
> +
> +( *action->handler )( action->arg );
> +
> +_Atomic_Store_uintptr(
> +  

Re: [PATCH 3/8] score: Rename Per_CPU_Control::started

2016-03-03 Thread Joel Sherrill
Looks good.

On Thu, Mar 3, 2016 at 8:47 AM, Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Rename Per_CPU_Control::started into Per_CPU_Control::online to match
> standard nomenclature.
> ---
>  cpukit/score/include/rtems/score/percpu.h | 6 +++---
>  cpukit/score/src/smp.c| 4 ++--
>  cpukit/score/src/threadcreateidle.c   | 2 +-
>  3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/cpukit/score/include/rtems/score/percpu.h
> b/cpukit/score/include/rtems/score/percpu.h
> index 4ad530f..2b05b78 100644
> --- a/cpukit/score/include/rtems/score/percpu.h
> +++ b/cpukit/score/include/rtems/score/percpu.h
> @@ -364,7 +364,7 @@ typedef struct Per_CPU_Control {
>   * @brief Indicates if the processor has been successfully started via
>   * _CPU_SMP_Start_processor().
>   */
> -bool started;
> +bool online;
>#endif
>
>Per_CPU_Stats Stats;
> @@ -523,12 +523,12 @@ static inline struct _Thread_Control
> *_Per_CPU_Get_executing(
>return cpu->executing;
>  }
>
> -static inline bool _Per_CPU_Is_processor_started(
> +static inline bool _Per_CPU_Is_processor_online(
>const Per_CPU_Control *cpu
>  )
>  {
>  #if defined( RTEMS_SMP )
> -  return cpu->started;
> +  return cpu->online;
>  #else
>(void) cpu;
>
> diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
> index a5562eb..b2713f1 100644
> --- a/cpukit/score/src/smp.c
> +++ b/cpukit/score/src/smp.c
> @@ -61,7 +61,7 @@ static void _SMP_Start_processors( uint32_t cpu_count )
>}
>  }
>
> -cpu->started = started;
> +cpu->online = started;
>
>  if ( started ) {
>Scheduler_Context *context =
> @@ -119,7 +119,7 @@ void _SMP_Request_start_multitasking( void )
>for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
>  Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
>
> -if ( _Per_CPU_Is_processor_started( cpu ) ) {
> +if ( _Per_CPU_Is_processor_online( cpu ) ) {
>_Per_CPU_State_change( cpu,
> PER_CPU_STATE_REQUEST_START_MULTITASKING );
>  }
>}
> diff --git a/cpukit/score/src/threadcreateidle.c
> b/cpukit/score/src/threadcreateidle.c
> index a07e238..5608040 100644
> --- a/cpukit/score/src/threadcreateidle.c
> +++ b/cpukit/score/src/threadcreateidle.c
> @@ -90,7 +90,7 @@ void _Thread_Create_idle( void )
>for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
>  Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
>
> -if ( _Per_CPU_Is_processor_started( cpu ) ) {
> +if ( _Per_CPU_Is_processor_online( cpu ) ) {
>_Thread_Create_idle_for_cpu( cpu );
>  }
>}
> --
> 1.8.4.5
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH 5/8] score: Add _Per_CPU_Is_boot_processor()

2016-03-03 Thread Sebastian Huber
---
 cpukit/score/include/rtems/score/percpu.h | 19 +++
 cpukit/score/src/smp.c|  2 ++
 2 files changed, 21 insertions(+)

diff --git a/cpukit/score/include/rtems/score/percpu.h 
b/cpukit/score/include/rtems/score/percpu.h
index 2b05b78..19f46d2 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -365,6 +365,12 @@ typedef struct Per_CPU_Control {
  * _CPU_SMP_Start_processor().
  */
 bool online;
+
+/**
+ * @brief Indicates if the processor is the one that performed the initial
+ * system initialization.
+ */
+bool boot;
   #endif
 
   Per_CPU_Stats Stats;
@@ -536,6 +542,19 @@ static inline bool _Per_CPU_Is_processor_online(
 #endif
 }
 
+static inline bool _Per_CPU_Is_boot_processor(
+  const Per_CPU_Control *cpu
+)
+{
+#if defined( RTEMS_SMP )
+  return cpu->boot;
+#else
+  (void) cpu;
+
+  return true;
+#endif
+}
+
 #if defined( RTEMS_SMP )
 
 static inline void _Per_CPU_Send_interrupt( const Per_CPU_Control *cpu )
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 68a55ff..8049643 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -57,6 +57,8 @@ static void _SMP_Start_processors( uint32_t cpu_count )
 } else {
   started = true;
 
+  cpu->boot = true;
+
   if ( !_Scheduler_Should_start_processor( assignment ) ) {
 _SMP_Fatal( SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER );
   }
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Use red-black tree for Watchdog Handler

2016-03-03 Thread Sebastian Huber
This patch set replaces the Watchdog Handler implementation based on delta
chains with a red-black tree.  The existing red-black tree infrastructure is
reused.  Performance results are quite good.

See also:

https://devel.rtems.org/ticket/2554
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/8] score: Add Processor_mask, etc.

2016-03-03 Thread Sebastian Huber
---
 cpukit/score/Makefile.am |  1 +
 cpukit/score/include/rtems/score/processormask.h | 90 
 cpukit/score/preinstall.am   |  4 ++
 3 files changed, 95 insertions(+)
 create mode 100644 cpukit/score/include/rtems/score/processormask.h

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 8506f22..3d3f1c1 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -61,6 +61,7 @@ include_rtems_score_HEADERS += include/rtems/score/priority.h
 include_rtems_score_HEADERS += include/rtems/score/prioritybitmap.h
 include_rtems_score_HEADERS += include/rtems/score/prioritybitmapimpl.h
 include_rtems_score_HEADERS += include/rtems/score/profiling.h
+include_rtems_score_HEADERS += include/rtems/score/processormask.h
 include_rtems_score_HEADERS += include/rtems/score/rbtree.h
 include_rtems_score_HEADERS += include/rtems/score/rbtreeimpl.h
 include_rtems_score_HEADERS += include/rtems/score/resource.h
diff --git a/cpukit/score/include/rtems/score/processormask.h 
b/cpukit/score/include/rtems/score/processormask.h
new file mode 100644
index 000..5a78dd3
--- /dev/null
+++ b/cpukit/score/include/rtems/score/processormask.h
@@ -0,0 +1,90 @@
+/**
+ * @file
+ *
+ * @brief Processor Mask API
+ *
+ * @ingroup ScoreProcessorMask
+ */
+
+/*
+ * Copyright (c) 2016 embedded brains GmbH.  All rights reserved.
+ *
+ *  embedded brains GmbH
+ *  Dornierstr. 4
+ *  82178 Puchheim
+ *  Germany
+ *  
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_SCORE_PROCESSORMASK_H
+#define _RTEMS_SCORE_PROCESSORMASK_H
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @defgroup ScoreProcessorMask Processor Mask
+ *
+ * @ingroup Score
+ *
+ * The processor mask provides a bit map large enough to provide one bit for
+ * each processor in the system.  It is a fixed size internal data type
+ * provided for efficiency in addition to the API level cpu_set_t.
+ *
+ * @{
+ */
+
+#define PROCESSOR_MASK_BITS_PER_FIELD 32
+
+#define PROCESSOR_MASK_FIELD_COUNT \
+  ( ( CPU_MAXIMUM_PROCESSORS + PROCESSOR_MASK_BITS_PER_FIELD - 1 ) \
+/ PROCESSOR_MASK_BITS_PER_FIELD )
+
+#define PROCESSOR_MASK_BIT( index ) \
+  (1UL << ( ( index ) % PROCESSOR_MASK_BITS_PER_FIELD ) )
+
+#define PROCESSOR_MASK_FIELD( index ) \
+  ( ( index ) / PROCESSOR_MASK_BITS_PER_FIELD )
+
+/**
+ * @brief A bit map consisting of 32-bit integer fields which is large enough
+ * to provide one bit for each processor in the system.
+ *
+ * Processor 0 corresponds to the bit 0 (least-significant) of the field 0 in
+ * the array, and so on.
+ */
+typedef uint32_t Processor_mask[ PROCESSOR_MASK_FIELD_COUNT ];
+
+RTEMS_INLINE_ROUTINE void _Processor_mask_Set( Processor_mask mask, uint32_t 
index )
+{
+  mask[ PROCESSOR_MASK_FIELD( index ) ] |= PROCESSOR_MASK_BIT( index );
+}
+
+RTEMS_INLINE_ROUTINE void _Processor_mask_Clear( Processor_mask mask, uint32_t 
index )
+{
+  mask[ PROCESSOR_MASK_FIELD( index ) ] &= ~PROCESSOR_MASK_BIT( index );
+}
+
+RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_set(
+  const Processor_mask mask,
+  uint32_t index
+)
+{
+  return ( mask[ PROCESSOR_MASK_FIELD( index ) ]
+& PROCESSOR_MASK_BIT( index ) ) != 0;
+}
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _RTEMS_SCORE_PROCESSORMASK_H */
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 0d9cade..3a70bfa 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -212,6 +212,10 @@ $(PROJECT_INCLUDE)/rtems/score/profiling.h: 
include/rtems/score/profiling.h $(PR
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/profiling.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/profiling.h
 
+$(PROJECT_INCLUDE)/rtems/score/processormask.h: 
include/rtems/score/processormask.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/processormask.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/processormask.h
+
 $(PROJECT_INCLUDE)/rtems/score/rbtree.h: include/rtems/score/rbtree.h 
$(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/rbtree.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/rbtree.h
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4/8] score: Add _SMP_Online_processors

2016-03-03 Thread Sebastian Huber
---
 cpukit/score/include/rtems/score/smpimpl.h | 11 +++
 cpukit/score/src/smp.c |  5 -
 testsuites/smptests/smpipi01/init.c| 10 ++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/cpukit/score/include/rtems/score/smpimpl.h 
b/cpukit/score/include/rtems/score/smpimpl.h
index 09c47ec..386216f 100644
--- a/cpukit/score/include/rtems/score/smpimpl.h
+++ b/cpukit/score/include/rtems/score/smpimpl.h
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -91,6 +92,16 @@ static inline void _SMP_Fatal( SMP_Fatal_code code )
 #if defined( RTEMS_SMP )
 
 /**
+ * @brief Set of online processors.
+ *
+ * A processor is online if was started during system initialization.  In this
+ * case its corresponding bit in the mask is set.
+ *
+ * @see _SMP_Handler_initialize().
+ */
+extern Processor_mask _SMP_Online_processors;
+
+/**
  * @brief Performs high-level initialization of a secondary processor and runs
  * the application threads.
  *
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index b2713f1..68a55ff 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -29,6 +29,8 @@
   #error "deferred FP switch not implemented for SMP"
 #endif
 
+Processor_mask _SMP_Online_processors;
+
 uint32_t _SMP_Processor_count;
 
 static void _SMP_Start_processors( uint32_t cpu_count )
@@ -36,7 +38,6 @@ static void _SMP_Start_processors( uint32_t cpu_count )
   uint32_t cpu_index_self = _SMP_Get_current_processor();
   uint32_t cpu_index;
 
-
   for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) {
 const Scheduler_Assignment *assignment =
   _Scheduler_Get_assignment( cpu_index );
@@ -69,6 +70,8 @@ static void _SMP_Start_processors( uint32_t cpu_count )
 
   ++context->processor_count;
   cpu->scheduler_context = context;
+
+  _Processor_mask_Set( _SMP_Online_processors, cpu_index );
 }
   }
 }
diff --git a/testsuites/smptests/smpipi01/init.c 
b/testsuites/smptests/smpipi01/init.c
index db0688c..8c39d18 100644
--- a/testsuites/smptests/smpipi01/init.c
+++ b/testsuites/smptests/smpipi01/init.c
@@ -161,6 +161,10 @@ static void test_send_message_flood(
   }
 
   for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
+rtems_test_assert(
+  _Processor_mask_Is_set(_SMP_Online_processors, cpu_index)
+);
+
 printf(
   "inter-processor interrupts for processor %"
 PRIu32 "%s: %" PRIu32 "\n",
@@ -169,6 +173,12 @@ static void test_send_message_flood(
   ctx->counters[cpu_index].value
 );
   }
+
+  for (; cpu_index < CPU_COUNT; ++cpu_index) {
+rtems_test_assert(
+  !_Processor_mask_Is_set(_SMP_Online_processors, cpu_index)
+);
+  }
 }
 
 static void test(void)
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/8] score: Add CPU_MAXIMUM_PROCESSORS

2016-03-03 Thread Sebastian Huber
Maximum number of processors of all systems supported by this CPU port.
---
 cpukit/score/cpu/arm/rtems/score/cpu.h  | 2 ++
 cpukit/score/cpu/bfin/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/epiphany/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/i386/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/lm32/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/m32c/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/m68k/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/mips/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/moxie/rtems/score/cpu.h| 2 ++
 cpukit/score/cpu/nios2/rtems/score/cpu.h| 2 ++
 cpukit/score/cpu/no_cpu/rtems/score/cpu.h   | 6 ++
 cpukit/score/cpu/or1k/rtems/score/cpu.h | 2 ++
 cpukit/score/cpu/powerpc/rtems/score/cpu.h  | 2 ++
 cpukit/score/cpu/sh/rtems/score/cpu.h   | 2 ++
 cpukit/score/cpu/sparc/rtems/score/cpu.h| 2 ++
 cpukit/score/cpu/sparc64/rtems/score/cpu.h  | 2 ++
 cpukit/score/cpu/v850/rtems/score/cpu.h | 2 ++
 17 files changed, 38 insertions(+)

diff --git a/cpukit/score/cpu/arm/rtems/score/cpu.h 
b/cpukit/score/cpu/arm/rtems/score/cpu.h
index 89b7609..4380590 100644
--- a/cpukit/score/cpu/arm/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/rtems/score/cpu.h
@@ -204,6 +204,8 @@
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 /** @} */
 
 #ifdef ARM_MULTILIB_HAS_THREAD_ID_REGISTER
diff --git a/cpukit/score/cpu/bfin/rtems/score/cpu.h 
b/cpukit/score/cpu/bfin/rtems/score/cpu.h
index 3302f47..e4ad87f 100644
--- a/cpukit/score/cpu/bfin/rtems/score/cpu.h
+++ b/cpukit/score/cpu/bfin/rtems/score/cpu.h
@@ -354,6 +354,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 /*
  *  Processor defined structures required for cpukit/score.
  *
diff --git a/cpukit/score/cpu/epiphany/rtems/score/cpu.h 
b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
index 896af12..e433e19 100644
--- a/cpukit/score/cpu/epiphany/rtems/score/cpu.h
+++ b/cpukit/score/cpu/epiphany/rtems/score/cpu.h
@@ -795,6 +795,8 @@ typedef struct {
 #define CPU_EXCEPTION_FRAME_SIZE 260
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 #ifndef ASM
 typedef uint16_t Priority_bit_map_Word;
 
diff --git a/cpukit/score/cpu/i386/rtems/score/cpu.h 
b/cpukit/score/cpu/i386/rtems/score/cpu.h
index d6828dc..9ad9cf2 100644
--- a/cpukit/score/cpu/i386/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/rtems/score/cpu.h
@@ -129,6 +129,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 #define I386_CONTEXT_CONTROL_EFLAGS_OFFSET 0
 #define I386_CONTEXT_CONTROL_ESP_OFFSET 4
 #define I386_CONTEXT_CONTROL_EBP_OFFSET 8
diff --git a/cpukit/score/cpu/lm32/rtems/score/cpu.h 
b/cpukit/score/cpu/lm32/rtems/score/cpu.h
index 3ddae7c..1a22da8 100644
--- a/cpukit/score/cpu/lm32/rtems/score/cpu.h
+++ b/cpukit/score/cpu/lm32/rtems/score/cpu.h
@@ -348,6 +348,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 /*
  *  Processor defined structures required for cpukit/score.
  *
diff --git a/cpukit/score/cpu/m32c/rtems/score/cpu.h 
b/cpukit/score/cpu/m32c/rtems/score/cpu.h
index 59e9b4e..de0ead5 100644
--- a/cpukit/score/cpu/m32c/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m32c/rtems/score/cpu.h
@@ -371,6 +371,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 /*
  *  Processor defined structures required for cpukit/score.
  *
diff --git a/cpukit/score/cpu/m68k/rtems/score/cpu.h 
b/cpukit/score/cpu/m68k/rtems/score/cpu.h
index 06d711a..470391a 100644
--- a/cpukit/score/cpu/m68k/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m68k/rtems/score/cpu.h
@@ -115,6 +115,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 #if ( CPU_HARDWARE_FP == TRUE ) && !defined( __mcoldfire__ )
   #if defined( __mc68060__ )
 #define M68K_FP_STATE_SIZE 16
diff --git a/cpukit/score/cpu/mips/rtems/score/cpu.h 
b/cpukit/score/cpu/mips/rtems/score/cpu.h
index cb66b89..67a9ea6 100644
--- a/cpukit/score/cpu/mips/rtems/score/cpu.h
+++ b/cpukit/score/cpu/mips/rtems/score/cpu.h
@@ -313,6 +313,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 /*
  *  Processor defined structures
  *
diff --git a/cpukit/score/cpu/moxie/rtems/score/cpu.h 
b/cpukit/score/cpu/moxie/rtems/score/cpu.h
index 9f0b9b4..ad40ff4 100644
--- a/cpukit/score/cpu/moxie/rtems/score/cpu.h
+++ b/cpukit/score/cpu/moxie/rtems/score/cpu.h
@@ -285,6 +285,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define CPU_MAXIMUM_PROCESSORS 32
+
 /*
  *  Processor defined structures required for cpukit/score.
  *
diff --git a/cpukit/score/cpu/nios2/rtems/score/cpu.h 
b/cpukit/score/cpu/nios2/rtems/score/cpu.h
index 1008865..0dd7ed4 100644
--- a/cpukit/score/cpu/nios2/rtems/score/cpu.h
+++ b/cpukit/score/cpu/nios2/rtems/score/cpu.h
@@ -111,6 +111,8 @@ extern "C" {
 
 #define CPU_PER_CPU_CONTROL_SIZE 0
 
+#define 

[PATCH 6/8] score: Add _SMP_Before_multitasking_action()

2016-03-03 Thread Sebastian Huber
Update #2554.
---
 cpukit/score/include/rtems/score/percpu.h  |  8 +++
 cpukit/score/include/rtems/score/smpimpl.h | 48 +++-
 cpukit/score/src/percpu.c  | 92 +++---
 cpukit/score/src/smp.c | 23 
 cpukit/score/src/smpmulticastaction.c  |  4 +-
 5 files changed, 164 insertions(+), 11 deletions(-)

diff --git a/cpukit/score/include/rtems/score/percpu.h 
b/cpukit/score/include/rtems/score/percpu.h
index 19f46d2..39be1e3 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -361,6 +361,14 @@ typedef struct Per_CPU_Control {
 Per_CPU_State state;
 
 /**
+ * @brief Action to be executed by this processor in the
+ * SYSTEM_STATE_BEFORE_MULTITASKING state on behalf of the boot processor.
+ *
+ * @see _SMP_Before_multitasking_action().
+ */
+Atomic_Uintptr before_multitasking_action;
+
+/**
  * @brief Indicates if the processor has been successfully started via
  * _CPU_SMP_Start_processor().
  */
diff --git a/cpukit/score/include/rtems/score/smpimpl.h 
b/cpukit/score/include/rtems/score/smpimpl.h
index 386216f..59a99ec 100644
--- a/cpukit/score/include/rtems/score/smpimpl.h
+++ b/cpukit/score/include/rtems/score/smpimpl.h
@@ -235,7 +235,7 @@ void _SMP_Send_message_multicast(
   unsigned long message
 );
 
-typedef void ( *SMP_Multicast_action_handler )( void *arg );
+typedef void ( *SMP_Action_handler )( void *arg );
 
 /**
  *  @brief Initiates a SMP multicast action to a set of processors.
@@ -250,10 +250,54 @@ typedef void ( *SMP_Multicast_action_handler )( void *arg 
);
 void _SMP_Multicast_action(
   const size_t setsize,
   const cpu_set_t *cpus,
-  SMP_Multicast_action_handler handler,
+  SMP_Action_handler handler,
   void *arg
 );
 
+/**
+ * @brief Executes a handler with argument on the specified processor on behalf
+ * of the boot processor.
+ *
+ * The calling processor must be the boot processor.  In case the specified
+ * processor is not online or not in the
+ * PER_CPU_STATE_READY_TO_START_MULTITASKING state, then no action is
+ * performed.
+ *
+ * @param cpu The processor to execute the action.
+ * @param handler The handler of the action.
+ * @param arg The argument of the action.
+ *
+ * @retval true The handler executed on the specified processor.
+ * @retval false Otherwise.
+ *
+ * @see _SMP_Before_multitasking_action_broadcast().
+ */
+bool _SMP_Before_multitasking_action(
+  Per_CPU_Control*cpu,
+  SMP_Action_handler  handler,
+  void   *arg
+);
+
+/**
+ * @brief Executes a handler with argument on all online processors except the
+ * boot processor on behalf of the boot processor.
+ *
+ * The calling processor must be the boot processor.
+ *
+ * @param handler The handler of the action.
+ * @param arg The argument of the action.
+ *
+ * @retval true The handler executed on all online processors except the boot
+ * processor.
+ * @retval false Otherwise.
+ *
+ * @see _SMP_Before_multitasking_action().
+ */
+bool _SMP_Before_multitasking_action_broadcast(
+  SMP_Action_handler  handler,
+  void   *arg
+);
+
 #endif /* defined( RTEMS_SMP ) */
 
 /**
diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c
index 730528a..0e4c067 100644
--- a/cpukit/score/src/percpu.c
+++ b/cpukit/score/src/percpu.c
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -35,11 +36,48 @@ RTEMS_STATIC_ASSERT(
 
 #if defined(RTEMS_SMP)
 
-static SMP_lock_Control _Per_CPU_State_lock =
-  SMP_LOCK_INITIALIZER("per-CPU state");
+typedef struct {
+  SMP_Action_handler handler;
+  void *arg;
+} SMP_Before_multicast_action;
+
+ISR_LOCK_DEFINE( static, _Per_CPU_State_lock, "Per-CPU State" )
+
+static void _Per_CPU_State_acquire( ISR_lock_Context *lock_context )
+{
+  _ISR_lock_ISR_disable_and_acquire( &_Per_CPU_State_lock, lock_context );
+}
+
+static void _Per_CPU_State_release( ISR_lock_Context *lock_context )
+{
+  _ISR_lock_Release_and_ISR_enable( &_Per_CPU_State_lock, lock_context );
+}
+
+static void _Per_CPU_State_before_multitasking_action( Per_CPU_Control *cpu )
+{
+  uintptr_t action_value;
+
+  action_value = _Atomic_Load_uintptr(
+>before_multitasking_action,
+ATOMIC_ORDER_ACQUIRE
+  );
+
+  if ( action_value != 0 ) {
+SMP_Before_multicast_action *action =
+  (SMP_Before_multicast_action *) action_value;
+
+( *action->handler )( action->arg );
+
+_Atomic_Store_uintptr(
+  >before_multitasking_action,
+  0,
+  ATOMIC_ORDER_RELEASE
+);
+  }
+}
 
 static void _Per_CPU_State_busy_wait(
-  const Per_CPU_Control *cpu,
+  Per_CPU_Control *cpu,
   Per_CPU_State new_state
 )
 {
@@ -60,6 +98,7 @@ static void _Per_CPU_State_busy_wait(
 state != PER_CPU_STATE_REQUEST_START_MULTITASKING
   && state != PER_CPU_STATE_SHUTDOWN
   ) {
+_Per_CPU_State_before_multitasking_action( cpu );
 

[PATCH 3/8] score: Rename Per_CPU_Control::started

2016-03-03 Thread Sebastian Huber
Rename Per_CPU_Control::started into Per_CPU_Control::online to match
standard nomenclature.
---
 cpukit/score/include/rtems/score/percpu.h | 6 +++---
 cpukit/score/src/smp.c| 4 ++--
 cpukit/score/src/threadcreateidle.c   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/cpukit/score/include/rtems/score/percpu.h 
b/cpukit/score/include/rtems/score/percpu.h
index 4ad530f..2b05b78 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -364,7 +364,7 @@ typedef struct Per_CPU_Control {
  * @brief Indicates if the processor has been successfully started via
  * _CPU_SMP_Start_processor().
  */
-bool started;
+bool online;
   #endif
 
   Per_CPU_Stats Stats;
@@ -523,12 +523,12 @@ static inline struct _Thread_Control 
*_Per_CPU_Get_executing(
   return cpu->executing;
 }
 
-static inline bool _Per_CPU_Is_processor_started(
+static inline bool _Per_CPU_Is_processor_online(
   const Per_CPU_Control *cpu
 )
 {
 #if defined( RTEMS_SMP )
-  return cpu->started;
+  return cpu->online;
 #else
   (void) cpu;
 
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index a5562eb..b2713f1 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -61,7 +61,7 @@ static void _SMP_Start_processors( uint32_t cpu_count )
   }
 }
 
-cpu->started = started;
+cpu->online = started;
 
 if ( started ) {
   Scheduler_Context *context =
@@ -119,7 +119,7 @@ void _SMP_Request_start_multitasking( void )
   for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
 Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
 
-if ( _Per_CPU_Is_processor_started( cpu ) ) {
+if ( _Per_CPU_Is_processor_online( cpu ) ) {
   _Per_CPU_State_change( cpu, PER_CPU_STATE_REQUEST_START_MULTITASKING );
 }
   }
diff --git a/cpukit/score/src/threadcreateidle.c 
b/cpukit/score/src/threadcreateidle.c
index a07e238..5608040 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -90,7 +90,7 @@ void _Thread_Create_idle( void )
   for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
 Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
 
-if ( _Per_CPU_Is_processor_started( cpu ) ) {
+if ( _Per_CPU_Is_processor_online( cpu ) ) {
   _Thread_Create_idle_for_cpu( cpu );
 }
   }
-- 
1.8.4.5

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Definition of RTEMS IoT Projects

2016-03-03 Thread Joel Sherrill
Hi

I added an Open Project page for Internet of Things support. This is a very
broad category of buzzword bingo and covers everything from Bluetooth and
6LoWPAN to messaging protocols. It can be done on boards like the the Pi or
BBB or smaller devices.

https://devel.rtems.org/wiki/Developer/Projects/Open/InternetOfThings

I do not want to focus this as another "Tiny RTEMS" effort but instead on
providing the capabilities and packages that make a great IoT software
infrastructure. Sure having PicoTCP or other packages targeted at small
platforms helps in this regard but not all IoT devices are simple gadgets.
The XMPP.org IoT messaging infrastructure should work on top of regular
TCP/IP stacks and plug in to existing frameworks.

The page is just a collection of ideas at this point. Help from the
community is needed to identify some "typical application profiles" and
what would be needed to implement those.

Thanks.

--joel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Fwd: Testing the rock port

2016-03-03 Thread Sambeet Panigrahi
-- Forwarded message --
From: Sambeet Panigrahi 
Date: Thu, Mar 3, 2016 at 2:11 PM
Subject: Testing the rock port
To: devel-requ...@rtems.org


Hi,
I am interested in working on porting Rock on RTEMS for GSOC-2016 . I have
gone through all the libraries of Rock.But I have this buidconf which is
the existing port of Rock on RTEMS.

https://github.com/rock-core/buildconf/tree/rtems

How do I test that buildconf actually works? In general how do we know the
port is successful?

Regards
Sambeet
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel