Re: Integrating the Formal Methods part of Qualification

2022-09-13 Thread Kuan-Hsun Chen
Dear Andrew,

It's great to see a move toward formal verification for RTEMS.

>From our side (TU Dortmund in Germany and the University of Twente in the
Netherlands), we recently adopted Frama-C to verify ICPP and MrsP. A
potential deadlock is successfully identified, and a remedy is provided.
The result will be presented in EMSOFT this year (
https://ieeexplore.ieee.org/document/9852753/), and the verification
framework is publicly released here:
https://github.com/tu-dortmund-ls12-rt/Resource-Synchronization-Protocols-Verification-RTEMS

Due to the double-blind review process, I cannot chime in earlier in this
thread. Today earlier I have seen your patches regarding the chapter you
proposed. I wonder if you could take our contribution into account when you
organize the chapter?
A preprint can be found here
.
(The corresponding ticket will be prepared, and the patch together with a
test case will be submitted)

Best,
Kuan-Hsun

On Fri, Jul 22, 2022 at 12:37 PM andrew.butterfi...@scss.tcd.ie <
andrew.butterfi...@scss.tcd.ie> wrote:

> Dear RTEMS developers,
>
>
>
> thanks for the feedback below - I want to wrap this up and move to the
> next step.
>
>
>
> I propose to produce a complete draft of a formal methods section for the
> Software Engineering manual in rtems-docs
>
> This will add a "Formal Verification" section just after the existing
> "Test Framework" section.
>
>
>
> This will allow developers to get a much better idea of what is proposed,
> and for me to get feedback.
>
>
>
> For now, the section will state clearly at the start that this is a
> proposal and that the tooling and resources it describes
>
> won't yet be available in RTEMS proper.
>
>
>
> Files likely to be modified in rtems-docs:
>
> eng/index.rst
>
> common/refs.bib
>
>
>
> I'll add in  eng/formal-verification.rst
>
>
>
> I'll then submit patches for review in the usual way.
>
>
>
> Regards,
>
>   Andrew
>
>
>
>
>
> 
> Andrew Butterfield Tel: +353-1-896-2517 Fax: +353-1-677-2204
> Lero@TCD, Head of Software Foundations & Verification Research Group
> School of Computer Science and Statistics,
> Room G.39, O'Reilly Institute, Trinity College, University of Dublin
>  http://www.scss.tcd.ie/Andrew.Butterfield/
> 
>
>
>
>
>
> On 11/07/2022, 12:43, "devel on behalf of andrew.butterfi...@scss.tcd.ie"
> 
> wrote:
>
>
>
> On 6 Jul 2022, at 20:07, Gedare Bloom  wrote:
>
>
>
> On Sun, Jul 3, 2022 at 7:49 PM Chris Johns  wrote:
>
>
> On 2/7/2022 12:59 am, Andrew Butterfield wrote:
>
> On 1 Jul 2022, at 00:59, Chris Johns  > wrote:
>
>
> On 28/6/2022 11:09 pm, andrew.butterfi...@scss.tcd.ie
>  wrote:
>
> Dear RTEMS Developers,
>
> While the validation tests from the RTEMS pre-qualification activity are
> now merged into the RTEMS master, the work done in investigating and
> deploying formal methods techniques is not yet merged.
>
> The activity had two main phases: a planning phase (Nov 2018-Oct 2019)
> that explored various formal techniques, followed by an execution phase
> (Oct 2019-Nov 2021) that then applied selected techniques to selected
> parts of RTEMS. Some discussions occurred with the RTEMS community
> via the mailings lists over this time. A short third phase (Nov 2021 - Dec
> 2021)
> then reported on the outcomes. Each phase resulted in a technical report.
>
> The key decision made was to use Promela/SPIN for test generation, and
> to apply it to the Chains API, the Event Manager, and the SMP scheduler
> thread queues. This involved developing models in the Promela language
> and using the SPIN model-checker tool to both check their correctness
> and to generate execution scenarios that could be used to generate tests.
> Tools were developed using Python 3.8 to support this. Initial
> documentation
> about tools and how to use them was put into the 2nd phase report.
>
>
> Congratulations for the work and results you and others have managed to
> achieve.
> It is exciting to see this happening with RTEMS and being made public.
>
> We now come to the part where we explore the best way to integrate this
> into RTEMS. I am proposing to do this under the guidance of Sebastian
> Huber.
>
> The first suggested step is adding in new documentation to the RTEMS
> Software Engineering manual, as a new Formal Methods chapter. This would
> provide some motivation, as well as a "howto".
>
> I assume that I would initially describe the proposed changes using the
> patch
> review process described in the section on Preparing and Sending Patches in
> the User Manual.
>
> How do you feel I should best proceed?
>
>
> It is hard for me to answer until I understand what is 

Re: [PATCH] icpp remedy

2022-09-13 Thread Kuan-Hsun Chen
Thanks for the prompt reply. Yes, I will guide Junjie to make a ticket and
go through the issue.

>Is there a test case for this?
Yes, a test case is also ready to be reviewed and can be part of the
testsuite to test out ICPP (MrsP should also pass).

> If it applies to 5 or 4.11, there needs to be another ticket to get the
fix back ported.
So each release version with one ticket? We only check 5.1 in this work. My
intuitive guess is that if the functionality does not change over the
versions, the remedy should be similar.
Let us figure it out.

On Tue, Sep 13, 2022 at 8:21 PM Joel Sherrill  wrote:

>
>
> On Tue, Sep 13, 2022, 1:14 PM Kuan-Hsun Chen  wrote:
>
>> (Oh, I just noticed that the patch was submitted faster than my mail to
>> share this patch :P).
>>
>
> No problem. That's why I asked what the issue was.
>
> It needs at least a much better log message. It needs a ticket given the
> gravity of the issue. That ticket can explain the situation and include
> links. Probably needs a comment above the change explaining what's going on.
>
> Is there a test case for this?
>
> If it applies to 5 or 4.11, there needs to be another ticket to get the
> fix back ported.
>
> Great catch. Just need to do a good job on the log, test, ticket(s), etc
>
> --joel
>
>
>> Hi Joel,
>>
>> Let me clarify what happened here. In our recent study, we adopt Frama-C
>> to formally verify the implementation of ICPP (also MrsP) and note that the
>> current flow may lead to a deadlock. The patch is a simple remedy to fix
>> the issue.
>>
>> The resource’s ceiling is not checked against the thread’s base priority,
>> but against its current dynamic priority derived from the task’s
>> priority aggregation. However, a resource’s ceiling is required to be
>> set as the highest base priority of all tasks that are requesting it. This
>> mismatch may lead to a deadlock by denying legitimate nested resource
>> access if resources are requested in descending order of priority. So this
>> adaption is needed to resolve the issue. A similar issue can also be found
>> in MrsP due to the usage of this function. A detailed explanation can be
>> found at the end of Section V in the attached preprint, and a toy example
>> is provided there to reveal the issue.
>>
>> The verification framework will be presented in EMSOFT this year, which
>> is publicly available here:
>> https://github.com/tu-dortmund-ls12-rt/Resource-Synchronization-Protocols-Verification-RTEMS
>> *I notice that Andrew today also sent a patch for a chapter on formal
>> verification. Since our result is relevant, I plan to respond to the
>> previous thread (
>> https://lists.rtems.org/pipermail/devel/2022-July/072167.html).
>>
>> Best regards,
>> Kuan-Hsun
>>
>> On Tue, Sep 13, 2022 at 3:35 PM Joel Sherrill  wrote:
>>
>>> What is this a remedy for?
>>>
>>> Why isn't the helper method OK to use?
>>>
>>> --joel
>>>
>>> On Tue, Sep 13, 2022 at 7:41 AM Strange369 
>>> wrote:
>>>
>>>> ---
>>>>  cpukit/include/rtems/score/coremuteximpl.h | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/cpukit/include/rtems/score/coremuteximpl.h
>>>> b/cpukit/include/rtems/score/coremuteximpl.h
>>>> index d489a0d946..72d32f8030 100644
>>>> --- a/cpukit/include/rtems/score/coremuteximpl.h
>>>> +++ b/cpukit/include/rtems/score/coremuteximpl.h
>>>> @@ -445,7 +445,7 @@ RTEMS_INLINE_ROUTINE Status_Control
>>>> _CORE_ceiling_mutex_Set_owner(
>>>>scheduler_node = _Thread_Scheduler_get_home_node( owner );
>>>>
>>>>if (
>>>> -_Priority_Get_priority( _node->Wait.Priority )
>>>> +owner->Real_priority.priority
>>>>< the_mutex->Priority_ceiling.priority
>>>>) {
>>>>  _Thread_Wait_release_default_critical( owner, _context );
>>>> --
>>>> 2.25.1
>>>>
>>>> ___
>>>> 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
>>
>>
>>
>> --
>> Diese Mail wurde mobil geschrieben. Etwaige Rechtschreibfehler sind volle
>> Absicht und als großzügiges Geschenk zu verstehen.
>>
>

-- 
Diese Mail wurde mobil geschrieben. Etwaige Rechtschreibfehler sind volle
Absicht und als großzügiges Geschenk zu verstehen.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: GSoC - Code Formatting and Style Checking for RTEMS score

2021-07-12 Thread Kuan-Hsun Chen
Hello Ida,

It would be great if you make a README.md at
https://github.com/Idadelveloper/rtems/tree/master/hooks to guide potential
users how to use your pre-commit hook and provide some examples.

I tried to find the information from your blog, but the update stopped at
the second week (https://idadelveloper.github.io/blog/2021/05/21/gsoc-week2).
I don't know if the post has been updated by taking the suggestion from
Gedare, e.g., I read that some possible options to pass arguments are
listed, but I see that you have considered Joel's comments for the ignoring
paths. Please make a new post in your blog to summarize the latest status.

Best regards,
Kuan-Hsun


On Mon, Jul 12, 2021 at 9:22 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Hello Ida,
>
> On 10/07/2021 01:08, Ida Delphine wrote:
> > I added the functionality for my script to ignore certain directories
> > like /bsps/, /testsuites/, '/cpukit/zlib', '/cpukit/mghttpd'.
> > https://github.com/Idadelveloper/rtems/blob/master/hooks/pre-commit
> > 
> > Are there any extra directories I should exclude?
> >
> > Also open to more suggestions and feedback to make my code better :)
>
> what do I have to do to test this pre-commit hook?
>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



-- 
Diese Mail wurde mobil geschrieben. Etwaige Rechtschreibfehler sind volle
Absicht und als großzügiges Geschenk zu verstehen.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: build error in testsuites libtests

2020-07-01 Thread Kuan-Hsun Chen
Hello all,

I answer myself... my path was polluted unintendedly by 4.11 toolchains :/
With the latest RSB and the latest RTEMS 6 source code, everything goes
well for realview_pbx_a9_qemu_smp.

Best,
Kuan-Hsun

On Wed, Jul 1, 2020 at 3:24 PM Kuan-Hsun Chen  wrote:

> Hello all,
>
> I tried to build RTEMS 5 and RTEMS 6 via RSB on Debian. It seems to me
> that libtests in testsuites use rtems-bin2c with option "-N" which is not
> supported anymore:
> rtems-bin2c -N dl06_tar -C dl06-pre.tar dl06-pre-tar.c
> usage: bin2c [-csvzCH]  
>is the binary file to convert
>should not have a .c or .h extension
>
> The bsp target I use is realview_pbx_a9_qemu and I use the following flags:
> ../rtems/configure --target=arm-rtems5
> --enable-rtemsbsp=realview_pbx_a9_qemu_smp --enable-smp --enable-tests=yes
>
> Is there a remedy for this already?
>
> Best,
> Kuan-Hsun
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

build error in testsuites libtests

2020-07-01 Thread Kuan-Hsun Chen
Hello all,

I tried to build RTEMS 5 and RTEMS 6 via RSB on Debian. It seems to me that
libtests in testsuites use rtems-bin2c with option "-N" which is not
supported anymore:
rtems-bin2c -N dl06_tar -C dl06-pre.tar dl06-pre-tar.c
usage: bin2c [-csvzCH]  
   is the binary file to convert
   should not have a .c or .h extension

The bsp target I use is realview_pbx_a9_qemu and I use the following flags:
../rtems/configure --target=arm-rtems5
--enable-rtemsbsp=realview_pbx_a9_qemu_smp --enable-smp --enable-tests=yes

Is there a remedy for this already?

Best,
Kuan-Hsun
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: RSB create report error

2020-07-01 Thread Kuan-Hsun Chen
Hi,

I missed the focus of GCC 10 in the previous mail. I thought it was related
to the target.
My host gcc is 8.3 in Debian. I might report later with GCC 10.

Best,
Kuan-Hsun


On Wed, Jul 1, 2020 at 12:28 PM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 01/07/2020 12:24, Kuan-Hsun Chen wrote:
>
> >
> > Just a relevant comment. I don't have this problem with arm-rtems
> > during the build.
> With a GCC 10 host compiler?
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: RSB create report error

2020-07-01 Thread Kuan-Hsun Chen
Hello,

Just a relevant comment. I don't have this problem with arm-rtems during
the build.

Best,
Kuan-Hsun


On Wed, Jul 1, 2020 at 11:30 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Hello,
>
> the GDB error is:
>
> https://sourceware.org/pipermail/gdb/2020-July/048772.html
>
> This -fno-common default in GCC 10 can be also an issue for some RTEMS
> BSPs.
>
> ___
> 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: Need help with configuring and using user defined scheduler

2020-06-08 Thread Kuan-Hsun Chen
Hi Richi,

If you just want to build the testsuites in sptest, you have to add an
option like "-enable-tests=yes" when you call ./configure.

Please have a look at git/rtems/testsuites/configure.ac, you should see
Line 48 has this condition.
(Just dig out my patch here:
https://lists.rtems.org/pipermail/devel/2016-December/016600.html, and I
did something similar as you)

Best,
Kuan-Hsun


On Mon, Jun 8, 2020 at 4:55 PM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Hello,
>
> I am not really motivated to explain the old build system. I hope we can
> create the RTEMS 5 branch soon and merge in the new build system.
>
> For experiments you can just modify the existing scheduler
> implementation. This avoids changing anything in the build system.
>
> ___
> 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

Missing link on the RTEMS website

2020-04-15 Thread Kuan-Hsun Chen
Hello all,

I just notice that https://www.rtems.org/ page has a link point to, which
is missing:
https://devel.rtems.org/wiki/TBR/Website/Mission_Statement

I am writing some descriptions regarding RTEMS at meanwhile, should I just
report here or directly update the website somehow?

Best,
Kuan-Hsun
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: RTEMS Documentation

2020-03-06 Thread Kuan-Hsun Chen
Hi Joel and Sebastian,

I can do both. The provided patch was essentially for all users of RTEMS,
so both are fine to me.

Best,
Kuan-Hsun

On Fri, Mar 6, 2020 at 3:02 PM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 06/03/2020 14:50, Joel Sherrill wrote:
>
> > Awesome and thank you!
> >
> > As a matter of record keeping, we are asking everyone to add their
> > permission grant statement to the ticket tracking this. Please add
> > your paragraph as a comment to https://devel.rtems.org/ticket/3053
>
> My request was related to the documentation. I added a new ticket for this:
>
> https://devel.rtems.org/ticket/3899
>
> Having permission for the RTEMS sources would be also great.
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

RTEMS Documentation

2020-03-06 Thread Kuan-Hsun Chen
Hello all,

As asked by Sebastian, I hereby claim to give the permission to add the
BSD-2-Clause license as an alternative license to my contributions to the
RTEMS documentation (See
https://docs.rtems.org/branches/master/c-user/index.html) for further reuse.

*I apologize if you get the repeated mail regarding this mail.

Cheers,
Kuan-Hsun
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH 3/3] c-user/rate_monotonic_manager.rst: Use Latex math for utilization formulas

2017-03-10 Thread Kuan Hsun Chen
Hi,

The formulas both are correct.
More formally, we can explicitly define "n" as the maximum number of tasks
and "i" as the index of task.
Then the formulas will become more clear like this:

Utilization = \sum_{i=1}^{n} Time_i/Period_i
maximumUtilization = n * (2^{\frac{1}{n}} - 1)

Best,
Kuan-Hsun

2017-03-10 15:10 GMT-07:00 Joel Sherrill <j...@rtems.org>:

> I would appreciate someone double-checking that I translated the formulas
> correctly.
>
> Thanks.
>
> --joel
>
> On Fri, Mar 10, 2017 at 3:29 PM, Joel Sherrill <j...@rtems.org> wrote:
>
>> ---
>>  c-user/rate_monotonic_manager.rst | 14 ++
>>  1 file changed, 6 insertions(+), 8 deletions(-)
>>
>> diff --git a/c-user/rate_monotonic_manager.rst
>> b/c-user/rate_monotonic_manager.rst
>> index 05eb59f..1309a88 100644
>> --- a/c-user/rate_monotonic_manager.rst
>> +++ b/c-user/rate_monotonic_manager.rst
>> @@ -267,21 +267,19 @@ Processor Utilization Rule
>>
>>  The Processor Utilization Rule requires that processor utilization be
>>  calculated based upon the period and execution time of each task.  The
>> fraction
>> -of processor time spent executing task index is ``Time(index) /
>> -Period(index)``.  The processor utilization can be calculated as follows:
>> +of processor time spent executing task index is ``Time(i) / Period(i)``.
>> +The processor utilization can be calculated as follows:
>>
>> -.. code-block:: c
>> +.. math::
>>
>> -Utilization = 0
>> -for index = 1 to maximum_tasks
>> -Utilization = Utilization + (Time(index)/Period(index))
>> +Utilization = \sum_{i=1}^{maximumTasks} Time_i/Period_i
>>
>>  To ensure schedulability even under transient overload, the processor
>>  utilization must adhere to the following rule:
>>
>> -.. code-block:: c
>> +.. math::
>>
>> -Utilization = maximum_tasks * (2**(1/maximum_tasks) - 1)
>> +maximumUtilization = maximumTasks * (2^{\frac{1}{maximumTasks}} - 1)
>>
>>  As the number of tasks increases, the above formula approaches ln(2) for
>> a
>>  worst-case utilization factor of approximately 0.693.  Many tasks sets
>> can be
>> --
>> 1.8.3.1
>>
>>
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124 <+49%20231%207556124>*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Regarding running one test

2017-02-04 Thread Kuan Hsun Chen
Or alternatively you can prepare simulator like qemu to executed each of it
after compiling the source tree.
Like this in testsuites/hello/:

   1. qemu-system-arm -no-reboot -nographic -M realview-pbx-a9 -m 256M -kernel
   \
   2. hello.exe -smp 4


Best,
Kuan-Hsun

2017-02-04 14:12 GMT+01:00 Kirspel, Kevin <kevin-kirs...@idexx.com>:

> I use the rtems tester.  ftp://ftp.rtems.org/pub/rtems/
> people/chrisj/rtems-tester/rtems-tester.html
>
> Kevin Kirspel
> Electrical Engineer - Sr. Staff
> Idexx Roswell
> 235 Hembree Park Drive
> Roswell GA 30076
> Tel: (770)-510- ext. 81642
> Direct: (770)-688-1642
> Fax: (770)-510-4445
>
> -Original Message-
> From: devel [mailto:devel-boun...@rtems.org] On Behalf Of Tanu Hari Dixit
> Sent: Saturday, February 04, 2017 12:23 AM
> To: rtems-de...@rtems.org <devel@rtems.org>
> Subject: Regarding running one test
>
> Hello all,
>
> How do I run a single test from the testsuites? I want to run one test
> from the rtems/testsuites/fstests. How do I go about doing that?
>
> Regards,
> Tanu Hari Dixit.
> ___
> devel mailing list
> devel@rtems.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.
> rtems.org_mailman_listinfo_devel=DwICAg=2do6VJGs3LvEOe4OFFM1bA=
> HDiJ93ANMEQ32G5JGdpyUxbdebuwKHBbeiHMr3RbR74=zH4W9XS8-
> wD5iyDXdo5SEtjZwr3gbIp9TJjx8-z2cS8=mU8IyO6GG8v94eNhQoI76FuuhiadOC
> FEoiJ3HdxyrrQ=
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: GSoC Mentors / Projects of Interest

2017-02-01 Thread Kuan Hsun Chen
B004LBXO2A
> >>>
> >>> Other folks in the community may have alternatives. It is a pretty
> generic
> >>> piece of hardware. But there was that issue with the FTDI driver
> refusing
> >>> to work with cloned FTDI chips. So I would bet there are some out there
> >>> you don't want.
> >>>
> >>>>
> >>>> > edit is needed and whether I should follow this pattern.
> Furthermore,
> >>>> > please indicate whether this project is of interest. Also which
> other
> >>>> > open projects should be converted to tickets?
> >>>> >
> >>>> We should convert all of the open projects to tickets eventually. And
> >>>> then generate a report in the Open Projects page based on the tickets.
> >>>> I have done this for the BSP ones and found the following changes
> >>>> should be made in the workflow:
> >>>> * Use only one keyword. I prefer "SoC" so it is generic to other
> >>>> 'summer of code' style projects.
> >>>> * Use the components field to further categorize. We have some obvious
> >>>> ones for the subheadings now, such as 'bsps', 'libbsd', 'testing'.
> >>>> Others should be identified or else we can create new components if
> >>>> necessary. I'd like to stick with the current subheadings for this
> >>>> year's GSoC, but we can revise later.
> >>>>
> >>>> > Probably the community is interested in the idea to create simple
> >>>> > examples or sanity tests for all RTEMS directives so that they can
> be
> >>>> > included in the documentation (something that is user friendly).
> Also,
> >>>> > there was a thread titled 'Desirable Application Stacks (Add-On
> >>>> > Library Collections)' . Which ideas can be derived from there?
> >>>> >
> >>>> > Regards,
> >>>> > Tanu Hari Dixit.
> >>>> >
> >>>> > On Tue, Jan 31, 2017 at 4:52 AM, Joel Sherrill <j...@rtems.org>
> wrote:
> >>>> >>
> >>>> >>
> >>>> >> On Mon, Jan 30, 2017 at 5:13 PM, Gedare Bloom <ged...@rtems.org>
> wrote:
> >>>> >>>
> >>>> >>> On Mon, Jan 30, 2017 at 12:25 PM, Tanu Hari Dixit
> >>>> >>> <tokencol...@gmail.com>
> >>>> >>> wrote:
> >>>> >>> > I'll be glad to do it. Please guide me as to how to proceed.
> >>>> >>> >
> >>>> >>> We will need to import each existing Open Project description
> into a
> >>>> >>> new ticket. It would be best to start with one to "try it out".
> The
> >>>> >>> project title should be the Summary of the ticket, the text of the
> >>>> >>> project page should be converted into the Description of the
> ticket,
> >>>> >>> type should be Enhancement, Milestone "Indefinite", and put GSoC
> into
> >>>> >>> the keywords, and we might want to use some other keywords e.g. to
> >>>> >>> define the project type (e.g. one of: testing, ecosystem, kernel,
> >>>> >>> statistics, BSP, API, libbsd, languages, libraries). The owner
> should
> >>>> >>> be assigned to one of the mentors if indicated, with others in CC
> if
> >>>> >>> any, or else set blank.
> >>>> >>>
> >>>> >>
> >>>> >> I agree it would be nice to get all the Open Project ideas as
> tickets
> >>>> >> and
> >>>> >> off the Wiki. Some of the ideas are likely no longer
> interesting/valid
> >>>> >> at
> >>>> >> this point and could just be deleted.
> >>>> >>
> >>>> >> FWIW I also want to move some of the Wiki content into Sphinx
> >>>> >> documents.
> >>>> >> I think being able to release them with RTEMS branches and use git
> >>>> >> for revision control.
> >>>> >>
> >>>> >> --joel
> >>>> >>
> >>>> >>>
> >>>> >>> > On Mon, Jan 30, 2017 at 9:38 PM, Gedare Bloom <ged...@rtems.org
> >
> >>>> >>> > wrote:
> >>>> >>> >>
> >>>> >>> >> Yes that would be much nicer. Maybe we can get potential GSoC
> >>>> >>> >> Students
> >>>> >>> >> to do the work ;)
> >>>> >>> >>
> >>>> >>> >> On Mon, Jan 30, 2017 at 1:40 AM, Sebastian Huber
> >>>> >>> >> <sebastian.hu...@embedded-brains.de> wrote:
> >>>> >>> >> > Maybe we should move all this open projects wiki stuff into
> >>>> >>> >> > tickets
> >>>> >>> >> > with
> >>>> >>> >> > some sort of "GSoC" tag.
> >>>> >>> >> >
> >>>> >>> >> > --
> >>>> >>> >> > 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
> >>>> >>> >
> >>>> >>> >
> >>>> >>> ___
> >>>> >>> 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
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124 <+49%20231%207556124>*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Regarding a beginner friendly bug

2017-01-31 Thread Kuan Hsun Chen
Hi,

You can search by yourself on this website: https://devel.rtems.org/query
After you fix a bug and test your revision comprehensively, you can
send-out the patch to this mailing list.

Best,
Kuan-Hsun

2017-01-31 19:15 GMT+01:00 Tanu Hari Dixit <tokencol...@gmail.com>:

> Hello all,
> Is there a beginner friendly bug that I can be assigned? I would like
> to get involved and learn more about RTEMS.
> Thank you.
> Regards,
> Tanu Hari Dixit
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124 <+49%20231%207556124>*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] rtems: Revise tests: sprmsched01 and spedfsched04

2017-01-30 Thread Kuan Hsun Chen
By taking Sebastian's suggestions, I revise both tests.
Now the tests are independent to the target time and console driver.

Before I use time unit as second and the results rely on the absolute time.
Now I use rtems_test_spin_for_ticks() and downscale the timeunit from
second to 100ms.
Both tests only check if the overrun handling is correct or not by
using rtems_rate_monotonic_get_status() to check the count of postponed
jobs.
If they are correct, all the assertions are passed.

2017-01-31 0:15 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> Does this fix a deficiency in the current tests?
>
> On Mon, Jan 30, 2017 at 1:34 PM, Kuan-Hsun Chen <c00...@gmail.com> wrote:
> > Instead of using the target time and console driver,
> > both tests now use assertions and rtems_rate_monotonic_get_status() to
> verify the count of postponed jobs.
> > The setting of spedfsched04 is slightly changed.
> >
> > Update #2795
> > ---
> >  testsuites/sptests/spedfsched04/Makefile.am  |  2 +-
> >  testsuites/sptests/spedfsched04/init.c   | 89
> 
> >  testsuites/sptests/spedfsched04/spedfsched04.scn | 27 ++-
> >  testsuites/sptests/sprmsched01/Makefile.am   |  4 +-
> >  testsuites/sptests/sprmsched01/init.c| 74
> ++--
> >  testsuites/sptests/sprmsched01/sprmsched01.scn   | 55 ++-
> >  6 files changed, 97 insertions(+), 154 deletions(-)
> >
> > diff --git a/testsuites/sptests/spedfsched04/Makefile.am
> b/testsuites/sptests/spedfsched04/Makefile.am
> > index 39f8210..a39519a 100644
> > --- a/testsuites/sptests/spedfsched04/Makefile.am
> > +++ b/testsuites/sptests/spedfsched04/Makefile.am
> > @@ -1,6 +1,6 @@
> >
> >  rtems_tests_PROGRAMS = spedfsched04
> > -spedfsched04_SOURCES = init.c
> > +spedfsched04_SOURCES = init.c ../../support/src/spin.c
> >
> >  dist_rtems_tests_DATA = spedfsched04.scn
> >  dist_rtems_tests_DATA += spedfsched04.doc
> > diff --git a/testsuites/sptests/spedfsched04/init.c
> b/testsuites/sptests/spedfsched04/init.c
> > index f80883d..8dd93db 100644
> > --- a/testsuites/sptests/spedfsched04/init.c
> > +++ b/testsuites/sptests/spedfsched04/init.c
> > @@ -1,24 +1,25 @@
> >  /**
> > - * @brief A heuristic example to demonstrate how the postponed jobs are
> handled.
> > + * @brief A heuristic example to demonstrate how the postponed jobs are
> handled in EDF.
> >   *
> >   * Given two tasks with implicit deadline under EDF policy.
> > - * Task 1 has (4, 5) and task 2 has (4, 6), where (execution time,
> period/deadline).
> > - * For the simplicity, we only execute the first task twice.
> > + * Task 1 has (400, 500) and task 2 has (450, 550), where (required
> ticks, period/deadline).
> > + * For the simplicity, we only execute the first task three times.
> >   * In the original implementation in v4.11, no matter how many periods
> are
> >   * expired, only one job will be released with a shifted deadline
> assignment.
> >   *
> > - * In this example, the first job of task 2 will be blocked by the
> second job
> > - * of task 1, so that there at least one following job is postponed.
> > - * Due to overhead/delay, the second following job will be postponed as
> well.
> > + * In this example, task 2 will be blocked by the second and third jobs
> > + * of task 1, so that there are two jobs are postponed.
> > + * Due to the domino effects, the following jobs of task 2 will be
> postponed until Job 9.
> >   *
> >   * If the overrun handling is correct, the period of task 2 changes
> back to
> > - * normal status at time 22.
> > - * Otherwise, the release time of job 3 is no longer periodic.
> > + * normal status at Job 9.
> > + * Otherwise, the release time of job 3 is no longer periodic
> > + * and there is no more postponed jobs.
> >   *
> >   */
> >
> >  /*
> > - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> > + *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
> >   *
> >   *  The license and distribution terms for this file may be
> >   *  found in the file LICENSE in this distribution or at
> > @@ -30,23 +31,19 @@
> >  #endif
> >
> >  #include 
> > -#include 
> > -
> > -#include 
> > -#include 
> > -
> > -#include "tmacros.h"
> > +#include 
> > +#include "test_support.h"
> >
> >  const char rtems_test_name[] = "SPEDFSCHED 4";
> >
> > -static const uint32_t Periods[] = { 5000, 6000 };
> > -static const uint32_t Iterations[] = { 4000, 4000 };
> > +static const u

[PATCH] rtems: Revise tests: sprmsched01 and spedfsched04

2017-01-30 Thread Kuan-Hsun Chen
Instead of using the target time and console driver,
both tests now use assertions and rtems_rate_monotonic_get_status() to verify 
the count of postponed jobs.
The setting of spedfsched04 is slightly changed.

Update #2795
---
 testsuites/sptests/spedfsched04/Makefile.am  |  2 +-
 testsuites/sptests/spedfsched04/init.c   | 89 
 testsuites/sptests/spedfsched04/spedfsched04.scn | 27 ++-
 testsuites/sptests/sprmsched01/Makefile.am   |  4 +-
 testsuites/sptests/sprmsched01/init.c| 74 ++--
 testsuites/sptests/sprmsched01/sprmsched01.scn   | 55 ++-
 6 files changed, 97 insertions(+), 154 deletions(-)

diff --git a/testsuites/sptests/spedfsched04/Makefile.am 
b/testsuites/sptests/spedfsched04/Makefile.am
index 39f8210..a39519a 100644
--- a/testsuites/sptests/spedfsched04/Makefile.am
+++ b/testsuites/sptests/spedfsched04/Makefile.am
@@ -1,6 +1,6 @@
 
 rtems_tests_PROGRAMS = spedfsched04
-spedfsched04_SOURCES = init.c
+spedfsched04_SOURCES = init.c ../../support/src/spin.c

 dist_rtems_tests_DATA = spedfsched04.scn
 dist_rtems_tests_DATA += spedfsched04.doc
diff --git a/testsuites/sptests/spedfsched04/init.c 
b/testsuites/sptests/spedfsched04/init.c
index f80883d..8dd93db 100644
--- a/testsuites/sptests/spedfsched04/init.c
+++ b/testsuites/sptests/spedfsched04/init.c
@@ -1,24 +1,25 @@
 /**
- * @brief A heuristic example to demonstrate how the postponed jobs are 
handled.
+ * @brief A heuristic example to demonstrate how the postponed jobs are 
handled in EDF.
  *
  * Given two tasks with implicit deadline under EDF policy.
- * Task 1 has (4, 5) and task 2 has (4, 6), where (execution time, 
period/deadline).
- * For the simplicity, we only execute the first task twice.
+ * Task 1 has (400, 500) and task 2 has (450, 550), where (required ticks, 
period/deadline).
+ * For the simplicity, we only execute the first task three times.
  * In the original implementation in v4.11, no matter how many periods are
  * expired, only one job will be released with a shifted deadline assignment.
  *
- * In this example, the first job of task 2 will be blocked by the second job
- * of task 1, so that there at least one following job is postponed.
- * Due to overhead/delay, the second following job will be postponed as well.
+ * In this example, task 2 will be blocked by the second and third jobs
+ * of task 1, so that there are two jobs are postponed.
+ * Due to the domino effects, the following jobs of task 2 will be postponed 
until Job 9.
  *
  * If the overrun handling is correct, the period of task 2 changes back to
- * normal status at time 22.
- * Otherwise, the release time of job 3 is no longer periodic.
+ * normal status at Job 9.
+ * Otherwise, the release time of job 3 is no longer periodic 
+ * and there is no more postponed jobs.
  *
  */
 
 /*
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -30,23 +31,19 @@
 #endif
 
 #include 
-#include 
-
-#include 
-#include 
-
-#include "tmacros.h"
+#include 
+#include "test_support.h"
 
 const char rtems_test_name[] = "SPEDFSCHED 4";
 
-static const uint32_t Periods[] = { 5000, 6000 };
-static const uint32_t Iterations[] = { 4000, 4000 };
+static const uint32_t Periods[] = { 500, 550 };
+static const uint32_t Iterations[] = { 400, 450 };
 static const rtems_name Task_name[] = {
   rtems_build_name( 'T', 'A', '1', ' ' ),
   rtems_build_name( 'T', 'A', '2', ' ' )
 };
 static const rtems_task_priority Prio[3] = { 2, 5 };
-static const uint32_t testnumber = 11; /* stop condition */
+static const uint32_t testnumber = 9; /* stop condition */
 
 static uint32_t tsk_counter[] = { 0, 0 };
 static rtems_id   Task_id[ 2 ];
@@ -58,35 +55,42 @@ static rtems_task Task(
   rtems_task_argument argument
 )
 {
-  rtems_status_code status;
-  rtems_idRM_period;
-  rtems_idselfid=rtems_task_self();
-  uint32_tstart, end, flag=0, index;
-  rtems_counter_ticks t0;
+  rtems_status_code status;
+  rtems_id  RM_period;
+  rtems_id  selfid=rtems_task_self();
+  rtems_rate_monotonic_period_statusperiod_status;
+  uint32_t  flag=0;
 
-  t0 = rtems_counter_nanoseconds_to_ticks( 100 ); //1ms ticks counter
-  /*create period*/
+  /* create period */
   status = rtems_rate_monotonic_create( Task_name[ argument ], _period );
   directive_failed( status, "rtems_rate_monotonic_create" );
 
   while ( FOREVER ) {
 status = rtems_rate_monotonic_period( RM_period, Periods[ argument ] );
-if( flag == 0 && status == RTEMS_TIMEOUT ){
-  flag = 1;
-  printf( "RTEMS_TIMEOUT\n" );
-} else if ( flag == 1 && status == RTEMS_

Re: [PATCH v3] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-27 Thread Kuan Hsun Chen
Aha, now v4 should be fine. I remove a typo.

2017-01-27 22:27 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> The acinclude came back
>
> On Fri, Jan 27, 2017 at 3:03 PM, Kuan-Hsun Chen <c00...@gmail.com> wrote:
> > Prepare a precondition to prevent the potential integer overflow.
> >
> > Remove one redundant parameter in _Rate_monotonic_Renew_deadline().
> >
> > sptests/sp78: Create
> > A test case for checking the overflow condition of postponed_jobs
> > in rtems_rate_monotonic_period_status.
> >
> > Close #2885.
> > ---
> >  c/src/lib/libbsp/powerpc/acinclude.m4 |   4 +-
> >  cpukit/rtems/src/ratemontimeout.c |  11 ++--
> >  testsuites/sptests/Makefile.am|   2 +-
> >  testsuites/sptests/configure.ac   |   1 +
> >  testsuites/sptests/sp78/Makefile.am   |  22 +++
> >  testsuites/sptests/sp78/init.c| 120
> ++
> >  testsuites/sptests/sp78/sp78.doc  |  18 +
> >  testsuites/sptests/sp78/sp78.scn  |   9 +++
> >  8 files changed, 180 insertions(+), 7 deletions(-)
> >  create mode 100644 testsuites/sptests/sp78/Makefile.am
> >  create mode 100644 testsuites/sptests/sp78/init.c
> >  create mode 100644 testsuites/sptests/sp78/sp78.doc
> >  create mode 100644 testsuites/sptests/sp78/sp78.scn
> >
> > diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4
> b/c/src/lib/libbsp/powerpc/acinclude.m4
> > index 4c83475..edc67b5 100644
> > --- a/c/src/lib/libbsp/powerpc/acinclude.m4
> > +++ b/c/src/lib/libbsp/powerpc/acinclude.m4
> > @@ -32,12 +32,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
> >  AC_CONFIG_SUBDIRS([t32mppc]);;
> >tqm8xx )
> >  AC_CONFIG_SUBDIRS([tqm8xx]);;
> > -  virtex )
> > -AC_CONFIG_SUBDIRS([virtex]);;
> >virtex4 )
> >  AC_CONFIG_SUBDIRS([virtex4]);;
> >virtex5 )
> >  AC_CONFIG_SUBDIRS([virtex5]);;
> > +  virtex )
> > +AC_CONFIG_SUBDIRS([virtex]);;
> >*)
> >  AC_MSG_ERROR([Invalid BSP]);;
> >esac
> > diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/
> ratemontimeout.c
> > index bcc4ccf..5a838fd 100644
> > --- a/cpukit/rtems/src/ratemontimeout.c
> > +++ b/cpukit/rtems/src/ratemontimeout.c
> > @@ -9,7 +9,7 @@
> >   *  COPYRIGHT (c) 1989-2009.
> >   *  On-Line Applications Research Corporation (OAR).
> >   *
> > - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> > + *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
> >   *
> >   *  The license and distribution terms for this file may be
> >   *  found in the file LICENSE in this distribution or at
> > @@ -24,13 +24,16 @@
> >
> >  static void _Rate_monotonic_Renew_deadline(
> >Rate_monotonic_Control *the_period,
> > -  Thread_Control *owner,
> >ISR_lock_Context   *lock_context
> >  )
> >  {
> >uint64_t deadline;
> >
> > -  ++the_period->postponed_jobs;
> > +  /* stay at 0x if postponed_jobs is going to overflow */
> > +  if ( the_period->postponed_jobs != UINT32_MAX ) {
> > +++the_period->postponed_jobs;
> > +  }
> > +
> >the_period->state = RATE_MONOTONIC_EXPIRED;
> >
> >deadline = _Watchdog_Per_CPU_insert_relative(
> > @@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control
> *the_watchdog )
> >_Thread_Unblock( owner );
> >  }
> >} else {
> > -_Rate_monotonic_Renew_deadline( the_period, owner, _context );
> > +_Rate_monotonic_Renew_deadline( the_period, _context );
> >}
> >  }
> > diff --git a/testsuites/sptests/Makefile.am
> b/testsuites/sptests/Makefile.am
> > index 5ef87a0..11e9bcd 100644
> > --- a/testsuites/sptests/Makefile.am
> > +++ b/testsuites/sptests/Makefile.am
> > @@ -10,7 +10,7 @@ _SUBDIRS = \
> >  sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
> >  sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
> >  sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
> > -sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
> > +sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
> >  spassoc01 spchain spcoverage spobjgetnext \
> >  spprintk spprivenv01 sprbtree01 spsize spstkalloc \
> >  spstkalloc02 spthreadq01 spwatchdog spwkspace \
> > diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/
> configure.ac
> > index 77ec512..a2af200 100644
> > --- a/testsuites/sptests/configure.ac
> > +++ b/testsuites/sptests/configure.ac
> > @@ -144,6 +144,7 @@ sp74/Makefile
> 

[PATCH v4] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-27 Thread Kuan-Hsun Chen
Prepare a precondition to prevent the potential integer overflow.

Remove one redundant parameter in _Rate_monotonic_Renew_deadline().

sptests/sp78: Create
A test case for checking the overflow condition of postponed_jobs
in rtems_rate_monotonic_period_status.

Close #2885.
---
 cpukit/rtems/src/ratemontimeout.c   |  11 ++--
 testsuites/sptests/Makefile.am  |   2 +-
 testsuites/sptests/configure.ac |   1 +
 testsuites/sptests/sp78/Makefile.am |  22 +++
 testsuites/sptests/sp78/init.c  | 120 
 testsuites/sptests/sp78/sp78.doc|  18 ++
 testsuites/sptests/sp78/sp78.scn|   9 +++
 7 files changed, 178 insertions(+), 5 deletions(-)
 create mode 100644 testsuites/sptests/sp78/Makefile.am
 create mode 100644 testsuites/sptests/sp78/init.c
 create mode 100644 testsuites/sptests/sp78/sp78.doc
 create mode 100644 testsuites/sptests/sp78/sp78.scn

diff --git a/cpukit/rtems/src/ratemontimeout.c 
b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..5a838fd 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,13 +24,16 @@
 
 static void _Rate_monotonic_Renew_deadline(
   Rate_monotonic_Control *the_period,
-  Thread_Control *owner,
   ISR_lock_Context   *lock_context
 )
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /* stay at 0x if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT32_MAX ) {
+++the_period->postponed_jobs;
+  }
+
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
@@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
   _Thread_Unblock( owner );
 }
   } else {
-_Rate_monotonic_Renew_deadline( the_period, owner, _context );
+_Rate_monotonic_Renew_deadline( the_period, _context );
   }
 }
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 5ef87a0..11e9bcd 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -10,7 +10,7 @@ _SUBDIRS = \
 sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
 sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
 sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
-sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
+sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
 spassoc01 spchain spcoverage spobjgetnext \
 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
 spstkalloc02 spthreadq01 spwatchdog spwkspace \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 77ec512..a2af200 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -144,6 +144,7 @@ sp74/Makefile
 sp75/Makefile
 sp76/Makefile
 sp77/Makefile
+sp78/Makefile
 sp2038/Makefile
 spassoc01/Makefile
 spcbssched01/Makefile
diff --git a/testsuites/sptests/sp78/Makefile.am 
b/testsuites/sptests/sp78/Makefile.am
new file mode 100644
index 000..e814104
--- /dev/null
+++ b/testsuites/sptests/sp78/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = sp78
+sp78_SOURCES = init.c ../../support/src/spin.c
+
+dist_rtems_tests_DATA = sp78.scn
+dist_rtems_tests_DATA += sp78.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp78_OBJECTS)
+LINK_LIBS = $(sp78_LDLIBS)
+
+sp78$(EXEEXT): $(sp78_OBJECTS) $(sp78_DEPENDENCIES)
+   @rm -f sp78$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp78/init.c b/testsuites/sptests/sp78/init.c
new file mode 100644
index 000..4d3f534
--- /dev/null
+++ b/testsuites/sptests/sp78/init.c
@@ -0,0 +1,120 @@
+/*
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
+ *
+ *  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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include "test_support.h"
+
+const char rtems_test_name[] = "SP 78";
+
+/* forward declarations to avoid warnings */
+rtems_task Init( rtems_task_argument argument );
+static void modify_count( rtems_id id );
+
+static void modify_count(
+  rtems_idid
+)
+{
+  Rate_monotonic_Control  *the_period;
+  ISR_lock_Contextlock_context;
+
+  the_period = _Rate_monotonic_Get( id, _context );
+  _Rate_monotonic_Acquire_critical( the_period, _context );

[PATCH v3] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-27 Thread Kuan-Hsun Chen
Prepare a precondition to prevent the potential integer overflow.

Remove one redundant parameter in _Rate_monotonic_Renew_deadline().

sptests/sp78: Create
A test case for checking the overflow condition of postponed_jobs
in rtems_rate_monotonic_period_status.

Close #2885.
---
 c/src/lib/libbsp/powerpc/acinclude.m4 |   4 +-
 cpukit/rtems/src/ratemontimeout.c |  11 ++--
 testsuites/sptests/Makefile.am|   2 +-
 testsuites/sptests/configure.ac   |   1 +
 testsuites/sptests/sp78/Makefile.am   |  22 +++
 testsuites/sptests/sp78/init.c| 120 ++
 testsuites/sptests/sp78/sp78.doc  |  18 +
 testsuites/sptests/sp78/sp78.scn  |   9 +++
 8 files changed, 180 insertions(+), 7 deletions(-)
 create mode 100644 testsuites/sptests/sp78/Makefile.am
 create mode 100644 testsuites/sptests/sp78/init.c
 create mode 100644 testsuites/sptests/sp78/sp78.doc
 create mode 100644 testsuites/sptests/sp78/sp78.scn

diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4 
b/c/src/lib/libbsp/powerpc/acinclude.m4
index 4c83475..edc67b5 100644
--- a/c/src/lib/libbsp/powerpc/acinclude.m4
+++ b/c/src/lib/libbsp/powerpc/acinclude.m4
@@ -32,12 +32,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
 AC_CONFIG_SUBDIRS([t32mppc]);;
   tqm8xx )
 AC_CONFIG_SUBDIRS([tqm8xx]);;
-  virtex )
-AC_CONFIG_SUBDIRS([virtex]);;
   virtex4 )
 AC_CONFIG_SUBDIRS([virtex4]);;
   virtex5 )
 AC_CONFIG_SUBDIRS([virtex5]);;
+  virtex )
+AC_CONFIG_SUBDIRS([virtex]);;
   *)
 AC_MSG_ERROR([Invalid BSP]);;
   esac
diff --git a/cpukit/rtems/src/ratemontimeout.c 
b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..5a838fd 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,13 +24,16 @@
 
 static void _Rate_monotonic_Renew_deadline(
   Rate_monotonic_Control *the_period,
-  Thread_Control *owner,
   ISR_lock_Context   *lock_context
 )
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /* stay at 0x if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT32_MAX ) {
+++the_period->postponed_jobs;
+  }
+
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
@@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
   _Thread_Unblock( owner );
 }
   } else {
-_Rate_monotonic_Renew_deadline( the_period, owner, _context );
+_Rate_monotonic_Renew_deadline( the_period, _context );
   }
 }
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 5ef87a0..11e9bcd 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -10,7 +10,7 @@ _SUBDIRS = \
 sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
 sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
 sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
-sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
+sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
 spassoc01 spchain spcoverage spobjgetnext \
 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
 spstkalloc02 spthreadq01 spwatchdog spwkspace \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 77ec512..a2af200 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -144,6 +144,7 @@ sp74/Makefile
 sp75/Makefile
 sp76/Makefile
 sp77/Makefile
+sp78/Makefile
 sp2038/Makefile
 spassoc01/Makefile
 spcbssched01/Makefile
diff --git a/testsuites/sptests/sp78/Makefile.am 
b/testsuites/sptests/sp78/Makefile.am
new file mode 100644
index 000..e814104
--- /dev/null
+++ b/testsuites/sptests/sp78/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = sp78
+sp78_SOURCES = init.c ../../support/src/spin.c
+
+dist_rtems_tests_DATA = sp78.scn
+dist_rtems_tests_DATA += sp78.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp78_OBJECTS)
+LINK_LIBS = $(sp78_LDLIBS)
+
+sp78$(EXEEXT): $(sp78_OBJECTS) $(sp78_DEPENDENCIES)
+   @rm -f sp78$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp78/init.c b/testsuites/sptests/sp78/init.c
new file mode 100644
index 000..4d3f534
--- /dev/null
+++ b/testsuites/sptests/sp78/init.c
@@ -0,0 +1,120 @@
+/*
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/lic

[PATCH v2] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-26 Thread Kuan-Hsun Chen
Prepare a precondition to prevent the potential integer overflow.

Remove one redundant parameter in _Rate_monotonic_Renew_deadline().

sptests/sp78: Create
A test case for checking the overflow condition of postponed_jobs
in rtems_rate_monotonic_period_status.

Close #2885.
---
 cpukit/rtems/src/ratemontimeout.c   |  11 ++--
 testsuites/sptests/Makefile.am  |   2 +-
 testsuites/sptests/configure.ac |   1 +
 testsuites/sptests/sp78/Makefile.am |  22 +++
 testsuites/sptests/sp78/init.c  | 120 
 testsuites/sptests/sp78/sp78.doc|  18 ++
 testsuites/sptests/sp78/sp78.scn|   9 +++
 7 files changed, 178 insertions(+), 5 deletions(-)
 create mode 100644 testsuites/sptests/sp78/Makefile.am
 create mode 100644 testsuites/sptests/sp78/init.c
 create mode 100644 testsuites/sptests/sp78/sp78.doc
 create mode 100644 testsuites/sptests/sp78/sp78.scn

diff --git a/cpukit/rtems/src/ratemontimeout.c 
b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..5a838fd 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,13 +24,16 @@
 
 static void _Rate_monotonic_Renew_deadline(
   Rate_monotonic_Control *the_period,
-  Thread_Control *owner,
   ISR_lock_Context   *lock_context
 )
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /* stay at 0x if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT32_MAX ) {
+++the_period->postponed_jobs;
+  }
+
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
@@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
   _Thread_Unblock( owner );
 }
   } else {
-_Rate_monotonic_Renew_deadline( the_period, owner, _context );
+_Rate_monotonic_Renew_deadline( the_period, _context );
   }
 }
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 5ef87a0..11e9bcd 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -10,7 +10,7 @@ _SUBDIRS = \
 sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
 sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
 sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
-sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
+sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
 spassoc01 spchain spcoverage spobjgetnext \
 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
 spstkalloc02 spthreadq01 spwatchdog spwkspace \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 77ec512..a2af200 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -144,6 +144,7 @@ sp74/Makefile
 sp75/Makefile
 sp76/Makefile
 sp77/Makefile
+sp78/Makefile
 sp2038/Makefile
 spassoc01/Makefile
 spcbssched01/Makefile
diff --git a/testsuites/sptests/sp78/Makefile.am 
b/testsuites/sptests/sp78/Makefile.am
new file mode 100644
index 000..3e59f3d
--- /dev/null
+++ b/testsuites/sptests/sp78/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = sp78
+sp78_SOURCES = init.c ../../support/src/spin.c
+
+dist_rtems_tests_DATA = sp78.scn
+dist_rtems_tests_DATA += sp78.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp78_OBJECTS)
+LINK_LIBS = $(sp78_LDLIBS)
+
+sp78$(EXEEXT): $(sp78_OBJECTS) $(sp78_DEPENDENCIES)
+   @rm -f sp69$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp78/init.c b/testsuites/sptests/sp78/init.c
new file mode 100644
index 000..4d3f534
--- /dev/null
+++ b/testsuites/sptests/sp78/init.c
@@ -0,0 +1,120 @@
+/*
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
+ *
+ *  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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+#include "test_support.h"
+
+const char rtems_test_name[] = "SP 78";
+
+/* forward declarations to avoid warnings */
+rtems_task Init( rtems_task_argument argument );
+static void modify_count( rtems_id id );
+
+static void modify_count(
+  rtems_idid
+)
+{
+  Rate_monotonic_Control  *the_period;
+  ISR_lock_Contextlock_context;
+
+  the_period = _Rate_monotonic_Get( id, _context );
+  _Rate_monotonic_Acquire_critical( the_period, _context );

[PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-26 Thread Kuan-Hsun Chen
Prepare a precondition to prevent the potential integer overflow.

Remove one redundant parameter in _Rate_monotonic_Renew_deadline().

sptests/sp78: Create
A test case for checking the overflow condition of postponed_jobs
in rtems_rate_monotonic_period_status.

Close #2885.
---
 c/src/lib/libbsp/powerpc/acinclude.m4 |   4 +-
 cpukit/rtems/src/ratemontimeout.c |  11 ++--
 testsuites/sptests/Makefile.am|   2 +-
 testsuites/sptests/configure.ac   |   1 +
 testsuites/sptests/sp78/Makefile.am   |  22 +++
 testsuites/sptests/sp78/init.c| 120 ++
 testsuites/sptests/sp78/sp78.doc  |  18 +
 testsuites/sptests/sp78/sp78.scn  |   9 +++
 8 files changed, 180 insertions(+), 7 deletions(-)
 create mode 100644 testsuites/sptests/sp78/Makefile.am
 create mode 100644 testsuites/sptests/sp78/init.c
 create mode 100644 testsuites/sptests/sp78/sp78.doc
 create mode 100644 testsuites/sptests/sp78/sp78.scn

diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4 
b/c/src/lib/libbsp/powerpc/acinclude.m4
index 4c83475..edc67b5 100644
--- a/c/src/lib/libbsp/powerpc/acinclude.m4
+++ b/c/src/lib/libbsp/powerpc/acinclude.m4
@@ -32,12 +32,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
 AC_CONFIG_SUBDIRS([t32mppc]);;
   tqm8xx )
 AC_CONFIG_SUBDIRS([tqm8xx]);;
-  virtex )
-AC_CONFIG_SUBDIRS([virtex]);;
   virtex4 )
 AC_CONFIG_SUBDIRS([virtex4]);;
   virtex5 )
 AC_CONFIG_SUBDIRS([virtex5]);;
+  virtex )
+AC_CONFIG_SUBDIRS([virtex]);;
   *)
 AC_MSG_ERROR([Invalid BSP]);;
   esac
diff --git a/cpukit/rtems/src/ratemontimeout.c 
b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..5a838fd 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,13 +24,16 @@
 
 static void _Rate_monotonic_Renew_deadline(
   Rate_monotonic_Control *the_period,
-  Thread_Control *owner,
   ISR_lock_Context   *lock_context
 )
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /* stay at 0x if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT32_MAX ) {
+++the_period->postponed_jobs;
+  }
+
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
@@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
   _Thread_Unblock( owner );
 }
   } else {
-_Rate_monotonic_Renew_deadline( the_period, owner, _context );
+_Rate_monotonic_Renew_deadline( the_period, _context );
   }
 }
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 5ef87a0..11e9bcd 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -10,7 +10,7 @@ _SUBDIRS = \
 sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
 sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
 sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
-sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
+sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
 spassoc01 spchain spcoverage spobjgetnext \
 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
 spstkalloc02 spthreadq01 spwatchdog spwkspace \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 77ec512..a2af200 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -144,6 +144,7 @@ sp74/Makefile
 sp75/Makefile
 sp76/Makefile
 sp77/Makefile
+sp78/Makefile
 sp2038/Makefile
 spassoc01/Makefile
 spcbssched01/Makefile
diff --git a/testsuites/sptests/sp78/Makefile.am 
b/testsuites/sptests/sp78/Makefile.am
new file mode 100644
index 000..3e59f3d
--- /dev/null
+++ b/testsuites/sptests/sp78/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = sp78
+sp78_SOURCES = init.c ../../support/src/spin.c
+
+dist_rtems_tests_DATA = sp78.scn
+dist_rtems_tests_DATA += sp78.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp78_OBJECTS)
+LINK_LIBS = $(sp78_LDLIBS)
+
+sp78$(EXEEXT): $(sp78_OBJECTS) $(sp78_DEPENDENCIES)
+   @rm -f sp69$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp78/init.c b/testsuites/sptests/sp78/init.c
new file mode 100644
index 000..99eec27
--- /dev/null
+++ b/testsuites/sptests/sp78/init.c
@@ -0,0 +1,120 @@
+/*
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/lic

Re: GSoC Mentors / Projects of Interest

2017-01-26 Thread Kuan Hsun Chen
Hello,

Could we invoke a project for https://git.rtems.org/rtems-schedsim/ again?
It could be useful to develop/verify scheduling algorithms.

Quote from Joel:
"I honestly think the best approach is to build a native gcc/newlib toolset
and use that so that the C Library differences should be handled without
too much effort."

Kuan-Hsun

2017-01-26 16:50 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> Hello Folks,
>
> We have submitted our application to participate as an Org in GSoC
> 2017. So it is once again time to "Freshen up" our projects page [1]
> with any projects that you might think are of interest and you may be
> willing to mentor. If you add a new project please use the Open
> Project Template and link to the new page from a bullet under an
> existing topical sub-heading.
>
> Relatedly, anyone who is keenly interested in mentoring please reach
> out to me so I remember to invite you!
>
> Gedare
>
> [1] https://devel.rtems.org/wiki/Developer/OpenProjects
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124 <+49%20231%207556124>*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-26 Thread Kuan Hsun Chen
I accidentally add c/src/lib/libbsp/powerpc/acinclude.m4 into the comment.
Now ticket 2885 should be close. The previous patch has a typo in the
comment I hotfix in this patch.

2017-01-26 18:02 GMT+01:00 Kuan-Hsun Chen <c00...@gmail.com>:

> Prepare a precondition to prevent the potential integer overflow.
>
> Remove one redundant parameter in _Rate_monotonic_Renew_deadline().
>
> sptests/sp78: Create
> A test case for checking the overflow condition of postponed_jobs
> in rtems_rate_monotonic_period_status.
>
> Close #2885.
> ---
>  c/src/lib/libbsp/powerpc/acinclude.m4 |   4 +-
>  cpukit/rtems/src/ratemontimeout.c |  11 ++--
>  testsuites/sptests/Makefile.am|   2 +-
>  testsuites/sptests/configure.ac   |   1 +
>  testsuites/sptests/sp78/Makefile.am   |  22 +++
>  testsuites/sptests/sp78/init.c| 120 ++
> 
>  testsuites/sptests/sp78/sp78.doc  |  18 +
>  testsuites/sptests/sp78/sp78.scn  |   9 +++
>  8 files changed, 180 insertions(+), 7 deletions(-)
>  create mode 100644 testsuites/sptests/sp78/Makefile.am
>  create mode 100644 testsuites/sptests/sp78/init.c
>  create mode 100644 testsuites/sptests/sp78/sp78.doc
>  create mode 100644 testsuites/sptests/sp78/sp78.scn
>
> diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4
> b/c/src/lib/libbsp/powerpc/acinclude.m4
> index 4c83475..edc67b5 100644
> --- a/c/src/lib/libbsp/powerpc/acinclude.m4
> +++ b/c/src/lib/libbsp/powerpc/acinclude.m4
> @@ -32,12 +32,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
>  AC_CONFIG_SUBDIRS([t32mppc]);;
>tqm8xx )
>  AC_CONFIG_SUBDIRS([tqm8xx]);;
> -  virtex )
> -AC_CONFIG_SUBDIRS([virtex]);;
>virtex4 )
>  AC_CONFIG_SUBDIRS([virtex4]);;
>virtex5 )
>  AC_CONFIG_SUBDIRS([virtex5]);;
> +  virtex )
> +AC_CONFIG_SUBDIRS([virtex]);;
>*)
>  AC_MSG_ERROR([Invalid BSP]);;
>esac
> diff --git a/cpukit/rtems/src/ratemontimeout.c b/cpukit/rtems/src/
> ratemontimeout.c
> index bcc4ccf..5a838fd 100644
> --- a/cpukit/rtems/src/ratemontimeout.c
> +++ b/cpukit/rtems/src/ratemontimeout.c
> @@ -9,7 +9,7 @@
>   *  COPYRIGHT (c) 1989-2009.
>   *  On-Line Applications Research Corporation (OAR).
>   *
> - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> + *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
>   *
>   *  The license and distribution terms for this file may be
>   *  found in the file LICENSE in this distribution or at
> @@ -24,13 +24,16 @@
>
>  static void _Rate_monotonic_Renew_deadline(
>Rate_monotonic_Control *the_period,
> -  Thread_Control *owner,
>ISR_lock_Context   *lock_context
>  )
>  {
>uint64_t deadline;
>
> -  ++the_period->postponed_jobs;
> +  /* stay at 0x if postponed_jobs is going to overflow */
> +  if ( the_period->postponed_jobs != UINT32_MAX ) {
> +++the_period->postponed_jobs;
> +  }
> +
>the_period->state = RATE_MONOTONIC_EXPIRED;
>
>deadline = _Watchdog_Per_CPU_insert_relative(
> @@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control
> *the_watchdog )
>_Thread_Unblock( owner );
>  }
>} else {
> -_Rate_monotonic_Renew_deadline( the_period, owner, _context );
> +_Rate_monotonic_Renew_deadline( the_period, _context );
>}
>  }
> diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.
> am
> index 5ef87a0..11e9bcd 100644
> --- a/testsuites/sptests/Makefile.am
> +++ b/testsuites/sptests/Makefile.am
> @@ -10,7 +10,7 @@ _SUBDIRS = \
>  sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
>  sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
>  sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
> -sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
> +sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
>  spassoc01 spchain spcoverage spobjgetnext \
>  spprintk spprivenv01 sprbtree01 spsize spstkalloc \
>  spstkalloc02 spthreadq01 spwatchdog spwkspace \
> diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/
> configure.ac
> index 77ec512..a2af200 100644
> --- a/testsuites/sptests/configure.ac
> +++ b/testsuites/sptests/configure.ac
> @@ -144,6 +144,7 @@ sp74/Makefile
>  sp75/Makefile
>  sp76/Makefile
>  sp77/Makefile
> +sp78/Makefile
>  sp2038/Makefile
>  spassoc01/Makefile
>  spcbssched01/Makefile
> diff --git a/testsuites/sptests/sp78/Makefile.am
> b/testsuites/sptests/sp78/Makefile.am
> new file mode 100644
> index 000..3e59f3d
> --- /dev/null
> +++ b/testsuites/sptests/sp78/Makefile.am
> @@ -0,0 +1,22 @@
> +
> +rtems_tests_PROGRAMS = sp78
> +sp78_SOURCES = init.c ../../support/src/spin.c

[PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-26 Thread Kuan-Hsun Chen
Prepare a precondition to prevent the potential integer overflow.

Remove one redundant parameter in _Rate_monotonic_Renew_deadline().

sptests/sp78: Create
A test case for checking the overflow condition of postponed_jobs
in rtems_rate_monotonic_period_status.

Close #2885.
---
 c/src/lib/libbsp/powerpc/acinclude.m4 |   4 +-
 cpukit/rtems/src/ratemontimeout.c |  11 ++--
 testsuites/sptests/Makefile.am|   2 +-
 testsuites/sptests/configure.ac   |   1 +
 testsuites/sptests/sp78/Makefile.am   |  22 +++
 testsuites/sptests/sp78/init.c| 120 ++
 testsuites/sptests/sp78/sp78.doc  |  18 +
 testsuites/sptests/sp78/sp78.scn  |   9 +++
 8 files changed, 180 insertions(+), 7 deletions(-)
 create mode 100644 testsuites/sptests/sp78/Makefile.am
 create mode 100644 testsuites/sptests/sp78/init.c
 create mode 100644 testsuites/sptests/sp78/sp78.doc
 create mode 100644 testsuites/sptests/sp78/sp78.scn

diff --git a/c/src/lib/libbsp/powerpc/acinclude.m4 
b/c/src/lib/libbsp/powerpc/acinclude.m4
index 4c83475..edc67b5 100644
--- a/c/src/lib/libbsp/powerpc/acinclude.m4
+++ b/c/src/lib/libbsp/powerpc/acinclude.m4
@@ -32,12 +32,12 @@ AC_DEFUN([RTEMS_CHECK_BSPDIR],
 AC_CONFIG_SUBDIRS([t32mppc]);;
   tqm8xx )
 AC_CONFIG_SUBDIRS([tqm8xx]);;
-  virtex )
-AC_CONFIG_SUBDIRS([virtex]);;
   virtex4 )
 AC_CONFIG_SUBDIRS([virtex4]);;
   virtex5 )
 AC_CONFIG_SUBDIRS([virtex5]);;
+  virtex )
+AC_CONFIG_SUBDIRS([virtex]);;
   *)
 AC_MSG_ERROR([Invalid BSP]);;
   esac
diff --git a/cpukit/rtems/src/ratemontimeout.c 
b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..5a838fd 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -24,13 +24,16 @@
 
 static void _Rate_monotonic_Renew_deadline(
   Rate_monotonic_Control *the_period,
-  Thread_Control *owner,
   ISR_lock_Context   *lock_context
 )
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /* stay at 0x if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT32_MAX ) {
+++the_period->postponed_jobs;
+  }
+
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
@@ -85,6 +88,6 @@ void _Rate_monotonic_Timeout( Watchdog_Control *the_watchdog )
   _Thread_Unblock( owner );
 }
   } else {
-_Rate_monotonic_Renew_deadline( the_period, owner, _context );
+_Rate_monotonic_Renew_deadline( the_period, _context );
   }
 }
diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 5ef87a0..11e9bcd 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -10,7 +10,7 @@ _SUBDIRS = \
 sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
 sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
 sp60  sp62 sp63 sp64 sp65 sp66 sp67 sp68 sp69 \
-sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp2038 \
+sp70 sp71 sp72 sp73 sp74 sp75 sp76 sp77 sp78 sp2038 \
 spassoc01 spchain spcoverage spobjgetnext \
 spprintk spprivenv01 sprbtree01 spsize spstkalloc \
 spstkalloc02 spthreadq01 spwatchdog spwkspace \
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 77ec512..a2af200 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -144,6 +144,7 @@ sp74/Makefile
 sp75/Makefile
 sp76/Makefile
 sp77/Makefile
+sp78/Makefile
 sp2038/Makefile
 spassoc01/Makefile
 spcbssched01/Makefile
diff --git a/testsuites/sptests/sp78/Makefile.am 
b/testsuites/sptests/sp78/Makefile.am
new file mode 100644
index 000..3e59f3d
--- /dev/null
+++ b/testsuites/sptests/sp78/Makefile.am
@@ -0,0 +1,22 @@
+
+rtems_tests_PROGRAMS = sp78
+sp78_SOURCES = init.c ../../support/src/spin.c
+
+dist_rtems_tests_DATA = sp78.scn
+dist_rtems_tests_DATA += sp78.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sp78_OBJECTS)
+LINK_LIBS = $(sp78_LDLIBS)
+
+sp78$(EXEEXT): $(sp78_OBJECTS) $(sp78_DEPENDENCIES)
+   @rm -f sp69$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sp78/init.c b/testsuites/sptests/sp78/init.c
new file mode 100644
index 000..99eec27
--- /dev/null
+++ b/testsuites/sptests/sp78/init.c
@@ -0,0 +1,120 @@
+/*
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/lic

Re: [PATCH] c-user: Update overrun handling related functions and structure

2017-01-26 Thread Kuan Hsun Chen
Some references for arbitrary deadline model are not included in C-user,
since there is no explicit concept about arbitrary and soft real-time yet.

2017-01-26 14:48 GMT+01:00 Kuan-Hsun Chen <c00...@gmail.com>:

> State the limited count of postponed_jobs.
> Update _rtems_rate_monotonic_get_status() and related structure.
> Move "Further Reading" in c-user to references.
> Add mentioned papers in ticket #2795 to references.
>
> Update #2795.
> ---
>  c-user/rate_monotonic_manager.rst | 62 ++
> -
>  common/refs.bib   | 68 ++
> -
>  2 files changed, 92 insertions(+), 38 deletions(-)
>
> diff --git a/c-user/rate_monotonic_manager.rst
> b/c-user/rate_monotonic_manager.rst
> index de1de75..213dbca 100644
> --- a/c-user/rate_monotonic_manager.rst
> +++ b/c-user/rate_monotonic_manager.rst
> @@ -2,6 +2,7 @@
>
>  .. COMMENT: COPYRIGHT (c) 1988-2008.
>  .. COMMENT: On-Line Applications Research Corporation (OAR).
> +.. COMMENT: COPYRIGHT (c) 2017 Kuan-Hsun Chen.
>  .. COMMENT: All rights reserved.
>
>  Rate Monotonic Manager
> @@ -169,10 +170,12 @@ Rate Monotonic Scheduling Algorithm
>  .. index:: Rate Monotonic Scheduling Algorithm, definition
>  .. index:: RMS Algorithm, definition
>
> -The Rate Monotonic Scheduling Algorithm (RMS) is important to real-time
> systems
> -designers because it allows one to sufficiently guarantee that a set of
> tasks is
> -schedulable.  A set of tasks is said to be schedulable if all of the
> tasks can
> -meet their deadlines.  RMS provides a set of rules which can be used to
> perform
> +The Rate Monotonic Scheduling Algorithm (RMS) is important to real-time
> systems
> +designers because it allows one to sufficiently guarantee that a set of
> tasks
> +is schedulable (see :cite:`Liu:1973:Scheduling`,
> :cite:`Lehoczky:1989:RM`, :cite:`Lui:1990:Ada`, :cite:`Burns:1991:Review`).
> +
> +A set of tasks is said to be schedulable if all of the tasks can meet
> their
> +deadlines.  RMS provides a set of rules which can be used to perform
>  a guaranteed schedulability analysis for a task set.  This analysis
> determines
>  whether a task set is schedulable under worst-case conditions and
> emphasizes
>  the predictability of the system's behavior.  It has been proven that:
> @@ -283,6 +286,7 @@ As the number of tasks increases, the above formula
> approaches ln(2) for a
>  worst-case utilization factor of approximately 0.693.  Many tasks sets
> can be
>  scheduled with a greater utilization factor.  In fact, the average
> processor
>  utilization threshold for a randomly generated task set is approximately
> 0.88.
> +See more detail in :cite:`Liu:1973:Scheduling`.
>
>  Processor Utilization Rule Example
>  ^^
> @@ -306,7 +310,7 @@ task:
>  The total processor utilization for this task set is 0.73 which is below
> the
>  upper bound of 3 * (2**(1/3) - 1), or 0.779, imposed by the Processor
>  Utilization Rule.  Therefore, this task set is guaranteed to be
> schedulable
> -using RMS.
> +using RMS.
>
>  First Deadline Rule
>  ^^^
> @@ -328,6 +332,7 @@ initialization task, all application tasks, regardless
> of priority, can be
>  created and started before the initialization deletes itself.  This
> technique
>  ensures that all tasks begin to compete for execution time at the same
> instant
>  - when the user initialization task deletes itself.
> +See more detail in :cite:`Lehoczky:1989:RM`.
>
>  First Deadline Rule Example
>  ^^^
> @@ -382,7 +387,7 @@ deadline.  As a result, of the first 200 time units,
> task 1 uses (2 * 25) = 50
>  and task 2 uses 50, leaving (200 - 100) time units for task 3.  Task 3
> requires
>  100 time units to execute, thus it will have completed execution at time
> 200.
>  Thus, all of the tasks have met their first deadlines at time 200, and
> the task
> -set is schedulable using the First Deadline Rule.
> +set is schedulable using the First Deadline Rule.
>
>  Relaxation of Assumptions
>  ^
> @@ -417,26 +422,6 @@ and its run-time behavior when performing
> schedulability analysis for a system
>  using RMS.  Every hardware and software factor which impacts the
> execution time
>  of each task must be accounted for in the schedulability analysis.
>
> -Further Reading
> -^^^
> -
> -For more information on Rate Monotonic Scheduling and its schedulability
> -analysis, the reader is referred to the following:
> -
> -- C. L. Liu and J. W. Layland. "Scheduling Algorithms for
> Multiprogramming in a
> -  Hard Real Time En

[PATCH] c-user: Update overrun handling related functions and structure

2017-01-26 Thread Kuan-Hsun Chen
State the limited count of postponed_jobs.
Update _rtems_rate_monotonic_get_status() and related structure.
Move "Further Reading" in c-user to references.
Add mentioned papers in ticket #2795 to references.

Update #2795.
---
 c-user/rate_monotonic_manager.rst | 62 ++-
 common/refs.bib   | 68 ++-
 2 files changed, 92 insertions(+), 38 deletions(-)

diff --git a/c-user/rate_monotonic_manager.rst 
b/c-user/rate_monotonic_manager.rst
index de1de75..213dbca 100644
--- a/c-user/rate_monotonic_manager.rst
+++ b/c-user/rate_monotonic_manager.rst
@@ -2,6 +2,7 @@
 
 .. COMMENT: COPYRIGHT (c) 1988-2008.
 .. COMMENT: On-Line Applications Research Corporation (OAR).
+.. COMMENT: COPYRIGHT (c) 2017 Kuan-Hsun Chen.
 .. COMMENT: All rights reserved.
 
 Rate Monotonic Manager
@@ -169,10 +170,12 @@ Rate Monotonic Scheduling Algorithm
 .. index:: Rate Monotonic Scheduling Algorithm, definition
 .. index:: RMS Algorithm, definition
 
-The Rate Monotonic Scheduling Algorithm (RMS) is important to real-time systems
-designers because it allows one to sufficiently guarantee that a set of tasks 
is
-schedulable.  A set of tasks is said to be schedulable if all of the tasks can
-meet their deadlines.  RMS provides a set of rules which can be used to perform
+The Rate Monotonic Scheduling Algorithm (RMS) is important to real-time 
systems 
+designers because it allows one to sufficiently guarantee that a set of tasks 
+is schedulable (see :cite:`Liu:1973:Scheduling`, :cite:`Lehoczky:1989:RM`, 
:cite:`Lui:1990:Ada`, :cite:`Burns:1991:Review`).
+  
+A set of tasks is said to be schedulable if all of the tasks can meet their 
+deadlines.  RMS provides a set of rules which can be used to perform
 a guaranteed schedulability analysis for a task set.  This analysis determines
 whether a task set is schedulable under worst-case conditions and emphasizes
 the predictability of the system's behavior.  It has been proven that:
@@ -283,6 +286,7 @@ As the number of tasks increases, the above formula 
approaches ln(2) for a
 worst-case utilization factor of approximately 0.693.  Many tasks sets can be
 scheduled with a greater utilization factor.  In fact, the average processor
 utilization threshold for a randomly generated task set is approximately 0.88.
+See more detail in :cite:`Liu:1973:Scheduling`.
 
 Processor Utilization Rule Example
 ^^
@@ -306,7 +310,7 @@ task:
 The total processor utilization for this task set is 0.73 which is below the
 upper bound of 3 * (2**(1/3) - 1), or 0.779, imposed by the Processor
 Utilization Rule.  Therefore, this task set is guaranteed to be schedulable
-using RMS.
+using RMS. 
 
 First Deadline Rule
 ^^^
@@ -328,6 +332,7 @@ initialization task, all application tasks, regardless of 
priority, can be
 created and started before the initialization deletes itself.  This technique
 ensures that all tasks begin to compete for execution time at the same instant
 - when the user initialization task deletes itself.
+See more detail in :cite:`Lehoczky:1989:RM`.
 
 First Deadline Rule Example
 ^^^
@@ -382,7 +387,7 @@ deadline.  As a result, of the first 200 time units, task 1 
uses (2 * 25) = 50
 and task 2 uses 50, leaving (200 - 100) time units for task 3.  Task 3 requires
 100 time units to execute, thus it will have completed execution at time 200.
 Thus, all of the tasks have met their first deadlines at time 200, and the task
-set is schedulable using the First Deadline Rule.
+set is schedulable using the First Deadline Rule. 
 
 Relaxation of Assumptions
 ^
@@ -417,26 +422,6 @@ and its run-time behavior when performing schedulability 
analysis for a system
 using RMS.  Every hardware and software factor which impacts the execution time
 of each task must be accounted for in the schedulability analysis.
 
-Further Reading
-^^^
-
-For more information on Rate Monotonic Scheduling and its schedulability
-analysis, the reader is referred to the following:
-
-- C. L. Liu and J. W. Layland. "Scheduling Algorithms for Multiprogramming in a
-  Hard Real Time Environment." *Journal of the Association of Computing
-  Machinery*. January 1973. pp. 46-61.
-
-- John Lehoczky, Lui Sha, and Ye Ding. "The Rate Monotonic Scheduling
-  Algorithm: Exact Characterization and Average Case Behavior."  *IEEE
-  Real-Time Systems Symposium*. 1989. pp. 166-171.
-
-- Lui Sha and John Goodenough. "Real-Time Scheduling theory and Ada."  *IEEE
-  Computer*. April 1990. pp. 53-62.
-
-- Alan Burns. "Scheduling hard real-time systems: a review."  *Software
-  Engineering Journal*. May 1991. pp. 116-128.
-
 Operations
 ==
 
@@ -471,7 +456,8 @@ monotonic period results in one of the following scenarios:
   ``rtems_rate_monotonic_period`` directive, the postponed job will be released
   until

Re: [PATCH] rtems: Remove rtems_rate_monotonic_postponed_job_count()

2017-01-26 Thread Kuan Hsun Chen
Got it! I am doing the documentation now.

About #2885 ticket:
Is there any formal way to modify "the_period->postponed_jobs" by hand in
user-space?
Besides this step to avoid extremely long test run times, the overflow test
(sp78) is almost done.




2017-01-26 10:01 GMT+01:00 Sebastian Huber :

> Thanks, committed.
>
> You can use git format-patch -v2 to indicate the second version of a patch.
>
> --
> 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

[PATCH] rtems: Remove rtems_rate_monotonic_postponed_job_count()

2017-01-25 Thread Kuan-Hsun Chen
Add a variable named "count" in rtems_rate_monotonic_period_status structure.
Revise rtems_rate_monotonic_get_status() for the postponed job count.

sptests/sp69: Revise
Add in the verification of the postponed job count for 
rtems_rate_monotonic_get_status().

Update #2795.
---
 cpukit/rtems/include/rtems/rtems/ratemon.h | 24 
 cpukit/rtems/src/ratemongetstatus.c|  2 ++
 cpukit/rtems/src/ratemonperiod.c   | 16 +---
 testsuites/sptests/sp69/init.c |  8 
 testsuites/sptests/sp69/sp69.doc   |  2 ++
 testsuites/sptests/sp69/sp69.scn   |  5 +++--
 6 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 54ddd05..5616ee9 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -23,7 +23,7 @@
 
 /* COPYRIGHT (c) 1989-2009, 2016.
  * On-Line Applications Research Corporation (OAR).
- * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -182,6 +182,9 @@ typedef struct {
*  then this field has no meaning.
*/
   rtems_thread_cpu_usage_t executed_since_last_period;
+  
+  /** This is the count of postponed jobs of this period. */
+  uint32_t postponed_jobs_count;
 }  rtems_rate_monotonic_period_status;
 
 /**
@@ -417,25 +420,6 @@ rtems_status_code rtems_rate_monotonic_period(
   rtems_interval  length
 );
 
-/**
- * @brief Return the number of postponed jobs
- *
- * This is a helper function for runtime monitoring to return
- * the number of postponed jobs in this given period. This number
- * is only increased by the corresponding watchdog,
- * and is decreased by RMS manager with the postponed job releasing.
- *
- * @param[in] id is the period id
- *
- * @retval This helper function returns the number of postponed
- * jobs with a given period_id.
- *
- */
-uint32_t rtems_rate_monotonic_postponed_job_count(
-  rtems_idperiod_id
-);
-
-
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/rtems/src/ratemongetstatus.c 
b/cpukit/rtems/src/ratemongetstatus.c
index 403c6ed..4e6b964 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -9,6 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
+ *  Copyright (c) 2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
 
   period_status->owner = the_period->owner->Object.id;
   period_status->state = the_period->state;
+  period_status->postponed_jobs_count = the_period->postponed_jobs;
 
   if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
 /*
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 97547e2..5b5d1dc 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -302,20 +302,6 @@ static rtems_status_code 
_Rate_monotonic_Block_while_expired(
   return RTEMS_TIMEOUT;
 }
 
-uint32_t rtems_rate_monotonic_postponed_job_count( rtems_id period_id )
-{
-  Rate_monotonic_Control *the_period;
-  ISR_lock_Contextlock_context;
-  uint32_tjobs;
-
-  the_period = _Rate_monotonic_Get( period_id, _context );
-  _Assert( the_period != NULL );
-
-  jobs = the_period->postponed_jobs;
-  _Rate_monotonic_Release( the_period, _context );
-  return jobs;
-}
-
 rtems_status_code rtems_rate_monotonic_period(
   rtems_id   id,
   rtems_interval length
diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/init.c
index ac6f58c..c38beb8 100644
--- a/testsuites/sptests/sp69/init.c
+++ b/testsuites/sptests/sp69/init.c
@@ -162,6 +162,14 @@ rtems_task Init(

 rtems_test_assert( statistics.missed_count == i );
   }
+ 
+  /* Check the status */
+  status = rtems_rate_monotonic_get_status( period_id, _status );
+  directive_failed( status, "rate_monotonic_get_status" ); 
+  puts(
+"rtems_rate_monotonic_get_status - verify value of a postponed jobs count"
+  );
+  rtems_test_assert( period_status.postponed_jobs_count == 3 );
   
   TEST_END();
 
diff --git a/testsuites/sptests/sp69/sp69.doc b/testsuites/sptests/sp69/sp69.doc
index fbf0e4e..60aacb8 10064

Re: [PATCH] rtems: Remove rtems_rate_monotonic_postponed_job_count()

2017-01-25 Thread Kuan Hsun Chen
Hi,

I will update the document for this ticket together with #2795 ticket.

   1. Further reading will be changed to references.
   2. The description of rtems_rate_monotonic_get_status() and related
   structure will be updated.
   3. The potential overflow problem of #2795 will be mentioned.
   4. Test sp78 will be prepared for testing the potential overflow.
   5. The mentioned papers in #2795 will be added into references as well.

Please let me know if I miss anything for these two tickets.

Best,
Kuan-Hsun

2017-01-25 17:56 GMT+01:00 Kuan Hsun Chen <c00...@gmail.com>:

> This is the patch for #2885 ticket.
>
> 2017-01-25 16:18 GMT+01:00 Kuan-Hsun Chen <c00...@gmail.com>:
>
>> Add a variable named "count" in rtems_rate_monotonic_period_status
>> structure
>> Revise rtems_rate_monotonic_get_status() for the postponed job count.
>>
>> sptests/sp69: Revise
>> Add in the verification of the postponed job count for
>> rtems_rate_monotonic_get_status().
>> ---
>>  cpukit/rtems/include/rtems/rtems/ratemon.h | 24 
>>  cpukit/rtems/src/ratemongetstatus.c|  2 ++
>>  cpukit/rtems/src/ratemonperiod.c   | 16 +---
>>  testsuites/sptests/sp69/init.c |  8 
>>  testsuites/sptests/sp69/sp69.doc   |  2 ++
>>  testsuites/sptests/sp69/sp69.scn   |  5 +++--
>>  6 files changed, 20 insertions(+), 37 deletions(-)
>>
>> diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h
>> b/cpukit/rtems/include/rtems/rtems/ratemon.h
>> index 54ddd05..5616ee9 100644
>> --- a/cpukit/rtems/include/rtems/rtems/ratemon.h
>> +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
>> @@ -23,7 +23,7 @@
>>
>>  /* COPYRIGHT (c) 1989-2009, 2016.
>>   * On-Line Applications Research Corporation (OAR).
>> - * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
>> + * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
>>   *
>>   * The license and distribution terms for this file may be
>>   * found in the file LICENSE in this distribution or at
>> @@ -182,6 +182,9 @@ typedef struct {
>> *  then this field has no meaning.
>> */
>>rtems_thread_cpu_usage_t executed_since_last_period;
>> +
>> +  /** This is the count of postponed jobs of this period. */
>> +  uint32_t postponed_jobs_count;
>>  }  rtems_rate_monotonic_period_status;
>>
>>  /**
>> @@ -417,25 +420,6 @@ rtems_status_code rtems_rate_monotonic_period(
>>rtems_interval  length
>>  );
>>
>> -/**
>> - * @brief Return the number of postponed jobs
>> - *
>> - * This is a helper function for runtime monitoring to return
>> - * the number of postponed jobs in this given period. This number
>> - * is only increased by the corresponding watchdog,
>> - * and is decreased by RMS manager with the postponed job releasing.
>> - *
>> - * @param[in] id is the period id
>> - *
>> - * @retval This helper function returns the number of postponed
>> - * jobs with a given period_id.
>> - *
>> - */
>> -uint32_t rtems_rate_monotonic_postponed_job_count(
>> -  rtems_idperiod_id
>> -);
>> -
>> -
>>  /**@}*/
>>
>>  #ifdef __cplusplus
>> diff --git a/cpukit/rtems/src/ratemongetstatus.c
>> b/cpukit/rtems/src/ratemongetstatus.c
>> index 403c6ed..4e6b964 100644
>> --- a/cpukit/rtems/src/ratemongetstatus.c
>> +++ b/cpukit/rtems/src/ratemongetstatus.c
>> @@ -9,6 +9,7 @@
>>   *  COPYRIGHT (c) 1989-2009.
>>   *  On-Line Applications Research Corporation (OAR).
>>   *  Copyright (c) 2016 embedded brains GmbH.
>> + *  Copyright (c) 2017 Kuan-Hsun Chen.
>>   *
>>   *  The license and distribution terms for this file may be
>>   *  found in the file LICENSE in this distribution or at
>> @@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
>>
>>period_status->owner = the_period->owner->Object.id;
>>period_status->state = the_period->state;
>> +  period_status->postponed_jobs_count = the_period->postponed_jobs;
>>
>>if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
>>  /*
>> diff --git a/cpukit/rtems/src/ratemonperiod.c
>> b/cpukit/rtems/src/ratemonperiod.c
>> index 97547e2..5b5d1dc 100644
>> --- a/cpukit/rtems/src/ratemonperiod.c
>> +++ b/cpukit/rtems/src/ratemonperiod.c
>> @@ -9,7 +9,7 @@
>>   *  COPYRIGHT (c) 1989-2010.
>>   *  On-Line Applications Research Corporation (OAR).
>>   *  Copyright (c) 2016 embedded brains GmbH.
>> - *  COPYRI

Re: [PATCH] rtems: Remove rtems_rate_monotonic_postponed_job_count()

2017-01-25 Thread Kuan Hsun Chen
This is the patch for #2885 ticket.

2017-01-25 16:18 GMT+01:00 Kuan-Hsun Chen <c00...@gmail.com>:

> Add a variable named "count" in rtems_rate_monotonic_period_status
> structure
> Revise rtems_rate_monotonic_get_status() for the postponed job count.
>
> sptests/sp69: Revise
> Add in the verification of the postponed job count for
> rtems_rate_monotonic_get_status().
> ---
>  cpukit/rtems/include/rtems/rtems/ratemon.h | 24 
>  cpukit/rtems/src/ratemongetstatus.c|  2 ++
>  cpukit/rtems/src/ratemonperiod.c   | 16 +---
>  testsuites/sptests/sp69/init.c |  8 
>  testsuites/sptests/sp69/sp69.doc   |  2 ++
>  testsuites/sptests/sp69/sp69.scn   |  5 +++--
>  6 files changed, 20 insertions(+), 37 deletions(-)
>
> diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h
> b/cpukit/rtems/include/rtems/rtems/ratemon.h
> index 54ddd05..5616ee9 100644
> --- a/cpukit/rtems/include/rtems/rtems/ratemon.h
> +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
> @@ -23,7 +23,7 @@
>
>  /* COPYRIGHT (c) 1989-2009, 2016.
>   * On-Line Applications Research Corporation (OAR).
> - * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> + * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
>   *
>   * The license and distribution terms for this file may be
>   * found in the file LICENSE in this distribution or at
> @@ -182,6 +182,9 @@ typedef struct {
> *  then this field has no meaning.
> */
>rtems_thread_cpu_usage_t executed_since_last_period;
> +
> +  /** This is the count of postponed jobs of this period. */
> +  uint32_t postponed_jobs_count;
>  }  rtems_rate_monotonic_period_status;
>
>  /**
> @@ -417,25 +420,6 @@ rtems_status_code rtems_rate_monotonic_period(
>rtems_interval  length
>  );
>
> -/**
> - * @brief Return the number of postponed jobs
> - *
> - * This is a helper function for runtime monitoring to return
> - * the number of postponed jobs in this given period. This number
> - * is only increased by the corresponding watchdog,
> - * and is decreased by RMS manager with the postponed job releasing.
> - *
> - * @param[in] id is the period id
> - *
> - * @retval This helper function returns the number of postponed
> - * jobs with a given period_id.
> - *
> - */
> -uint32_t rtems_rate_monotonic_postponed_job_count(
> -  rtems_idperiod_id
> -);
> -
> -
>  /**@}*/
>
>  #ifdef __cplusplus
> diff --git a/cpukit/rtems/src/ratemongetstatus.c b/cpukit/rtems/src/
> ratemongetstatus.c
> index 403c6ed..4e6b964 100644
> --- a/cpukit/rtems/src/ratemongetstatus.c
> +++ b/cpukit/rtems/src/ratemongetstatus.c
> @@ -9,6 +9,7 @@
>   *  COPYRIGHT (c) 1989-2009.
>   *  On-Line Applications Research Corporation (OAR).
>   *  Copyright (c) 2016 embedded brains GmbH.
> + *  Copyright (c) 2017 Kuan-Hsun Chen.
>   *
>   *  The license and distribution terms for this file may be
>   *  found in the file LICENSE in this distribution or at
> @@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
>
>period_status->owner = the_period->owner->Object.id;
>period_status->state = the_period->state;
> +  period_status->postponed_jobs_count = the_period->postponed_jobs;
>
>if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
>  /*
> diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/
> ratemonperiod.c
> index 97547e2..5b5d1dc 100644
> --- a/cpukit/rtems/src/ratemonperiod.c
> +++ b/cpukit/rtems/src/ratemonperiod.c
> @@ -9,7 +9,7 @@
>   *  COPYRIGHT (c) 1989-2010.
>   *  On-Line Applications Research Corporation (OAR).
>   *  Copyright (c) 2016 embedded brains GmbH.
> - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
> + *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
>   *
>   *  The license and distribution terms for this file may be
>   *  found in the file LICENSE in this distribution or at
> @@ -302,20 +302,6 @@ static rtems_status_code _Rate_monotonic_Block_while_
> expired(
>return RTEMS_TIMEOUT;
>  }
>
> -uint32_t rtems_rate_monotonic_postponed_job_count( rtems_id period_id )
> -{
> -  Rate_monotonic_Control *the_period;
> -  ISR_lock_Contextlock_context;
> -  uint32_tjobs;
> -
> -  the_period = _Rate_monotonic_Get( period_id, _context );
> -  _Assert( the_period != NULL );
> -
> -  jobs = the_period->postponed_jobs;
> -  _Rate_monotonic_Release( the_period, _context );
> -  return jobs;
> -}
> -
>  rtems_status_code rtems_rate_monotonic_period(
>rtems_id   id,
>rtems_interval length
> diff --git a/testsuites/sptests/sp69/init.c b/testsuit

Re: [PATCH] Remove rtems_rate_monotonic_postponed_job_count() Add a variable named "count" in rtems_rate_monotonic_period_status structure Revise rtems_rate_monotonic_get_status() for the postponed jo

2017-01-25 Thread Kuan Hsun Chen
Hi Gedare,

Thanks a lot.
I should read all the documents again...

Best,
Kuan-Hsun

2017-01-25 17:16 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> On Wed, Jan 25, 2017 at 9:16 AM, Kuan Hsun Chen <c00...@gmail.com> wrote:
> > Hi Sebastian,
> >
> > Okay. I will clarify it.
> >
> > I used git format-patch -1 to generate the patch and git send-email --to
> > devel@rtems.org *.patch to send out the mail.
> > Could you tell me what I have missed?
> >
> https://devel.rtems.org/wiki/Developer/Git#GitCommits
>
> This should likely be linked to / added in the
> https://devel.rtems.org/wiki/Developer/Coding/Conventions
>
> > Aha, it is 2017...
> >
> > Best,
> > Kuan-hsun
> >
> > 2017-01-25 15:10 GMT+01:00 Sebastian Huber
> > <sebastian.hu...@embedded-brains.de>:
> >>
> >> Please use the standard Git commit message format.
> >>
> >>
> >> On 25/01/17 15:04, Kuan-Hsun Chen wrote:
> >>>
> >>> sptests/sp69: Revise
> >>> Add in the verification of the postponed job count for
> >>> rtems_rate_monotonic_get_status().
> >>> ---
> >>>   cpukit/rtems/include/rtems/rtems/ratemon.h | 24
> >>> +---
> >>>   cpukit/rtems/src/ratemongetstatus.c|  2 ++
> >>>   cpukit/rtems/src/ratemonperiod.c   | 14 --
> >>>   testsuites/sptests/sp69/init.c |  8 
> >>>   testsuites/sptests/sp69/sp69.doc   |  2 ++
> >>>   testsuites/sptests/sp69/sp69.scn   |  5 +++--
> >>>   6 files changed, 20 insertions(+), 35 deletions(-)
> >>>
> >>> diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h
> >>> b/cpukit/rtems/include/rtems/rtems/ratemon.h
> >>> index 54ddd05..59512c5 100644
> >>> --- a/cpukit/rtems/include/rtems/rtems/ratemon.h
> >>> +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
> >>> @@ -182,6 +182,11 @@ typedef struct {
> >>>  *  then this field has no meaning.
> >>>  */
> >>> rtems_thread_cpu_usage_t executed_since_last_period;
> >>> +
> >>> +  /** This is the number of postponed jobs. This number
> >>> +   * is only increased by the corresponding watchdog,
> >>> +   * and is decreased by RMS manager with the postponed job releasing.
> >>> */
> >>> +  uint32_t postponed_jobs_count;
> >>>   }  rtems_rate_monotonic_period_status;
> >>
> >>
> >> Number in comment vs. count in member. I prefer count. Please clarify
> this
> >> a bit and avoid the watchdog. The watchdog is an implementation detail.
> The
> >> mentioning of RMS manager is redundant.
> >>
> >>
> >>>   /**
> >>> @@ -417,25 +422,6 @@ rtems_status_code rtems_rate_monotonic_period(
> >>> rtems_interval  length
> >>>   );
> >>>   -/**
> >>> - * @brief Return the number of postponed jobs
> >>> - *
> >>> - * This is a helper function for runtime monitoring to return
> >>> - * the number of postponed jobs in this given period. This number
> >>> - * is only increased by the corresponding watchdog,
> >>> - * and is decreased by RMS manager with the postponed job releasing.
> >>> - *
> >>> - * @param[in] id is the period id
> >>> - *
> >>> - * @retval This helper function returns the number of postponed
> >>> - * jobs with a given period_id.
> >>> - *
> >>> - */
> >>> -uint32_t rtems_rate_monotonic_postponed_job_count(
> >>> -  rtems_idperiod_id
> >>> -);
> >>> -
> >>> -
> >>>   /**@}*/
> >>> #ifdef __cplusplus
> >>> diff --git a/cpukit/rtems/src/ratemongetstatus.c
> >>> b/cpukit/rtems/src/ratemongetstatus.c
> >>> index 403c6ed..8bd3613 100644
> >>> --- a/cpukit/rtems/src/ratemongetstatus.c
> >>> +++ b/cpukit/rtems/src/ratemongetstatus.c
> >>> @@ -9,6 +9,7 @@
> >>>*  COPYRIGHT (c) 1989-2009.
> >>>*  On-Line Applications Research Corporation (OAR).
> >>>*  Copyright (c) 2016 embedded brains GmbH.
> >>> + *  Copyright (c) 2016 Kuan-Hsun Chen.
> >>
> >>
> >> We have 2017.
> >>
> >>
> >>>*
> >>>*  The license and distribution terms for this file may be

Re: [PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-25 Thread Kuan Hsun Chen
Hi all,

Like sp71 and sp77. I will prepare sp78 for this overflow testing.

Best,
Kuan-Hsun

2017-01-25 16:10 GMT+01:00 Kuan Hsun Chen <kuan-hsun.c...@tu-dortmund.de>:

> Hi Sebastian,
>
> Should I test the overflow condition together with sp69 or prepare a new
> test for this matter?
>
> Best,
> Kuan-Hsun
>
> 2017-01-25 15:53 GMT+01:00 Sebastian Huber <sebastian.huber@embedded-
> brains.de>:
>
>>
>>
>> On 25/01/17 15:48, Kuan-Hsun Chen wrote:
>>
>>> ---
>>>   cpukit/rtems/src/ratemontimeout.c | 7 +--
>>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/cpukit/rtems/src/ratemontimeout.c
>>> b/cpukit/rtems/src/ratemontimeout.c
>>> index bcc4ccf..079ad41 100644
>>> --- a/cpukit/rtems/src/ratemontimeout.c
>>> +++ b/cpukit/rtems/src/ratemontimeout.c
>>> @@ -9,7 +9,7 @@
>>>*  COPYRIGHT (c) 1989-2009.
>>>*  On-Line Applications Research Corporation (OAR).
>>>*
>>> - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
>>> + *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
>>>
>>
>> This should be 2016, 2017 or 2016-2017.
>>
>>*
>>>*  The license and distribution terms for this file may be
>>>*  found in the file LICENSE in this distribution or at
>>> @@ -30,7 +30,10 @@ static void _Rate_monotonic_Renew_deadline(
>>>   {
>>> uint64_t deadline;
>>>
>>> -  ++the_period->postponed_jobs;
>>> +  /** stay at 0x if postponed_jobs is going to overflow */
>>>
>>
>> /** is a Doxygen comment.
>>
>> +  if ( the_period->postponed_jobs != UINT_MAX ) {
>>> +++the_period->postponed_jobs;
>>> +  }
>>>
>>
>> Type is uint32_t, not unsigned int. So, use UINT32_MAX. Maybe
>>
>>  Empty lines between blocks.
>>
>> the_period->state = RATE_MONOTONIC_EXPIRED;
>>>
>>> deadline = _Watchdog_Per_CPU_insert_relative(
>>>
>>
>> We need a test case for this overflow condition. You probably have to
>> modify the_period->postponed_jobs by hand in the test case to avoid
>> extremely long test run times.
>>
>> --
>> 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
>>
>
>
>
> --
> M.Sc. Kuan-Hsun Chen
>
> TU Dortmund
> Department of Computer Science 12
> Design Automation of Embedded Systems
> Otto-Hahn-Strasse 16, Room 102
>
> 44227 Dortmund
> Germany
>
> Phone:  *+49 231 755 6124 <+49%20231%207556124>*
> Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] rtems: Remove rtems_rate_monotonic_postponed_job_count()

2017-01-25 Thread Kuan-Hsun Chen
Add a variable named "count" in rtems_rate_monotonic_period_status structure
Revise rtems_rate_monotonic_get_status() for the postponed job count.

sptests/sp69: Revise
Add in the verification of the postponed job count for 
rtems_rate_monotonic_get_status().
---
 cpukit/rtems/include/rtems/rtems/ratemon.h | 24 
 cpukit/rtems/src/ratemongetstatus.c|  2 ++
 cpukit/rtems/src/ratemonperiod.c   | 16 +---
 testsuites/sptests/sp69/init.c |  8 
 testsuites/sptests/sp69/sp69.doc   |  2 ++
 testsuites/sptests/sp69/sp69.scn   |  5 +++--
 6 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 54ddd05..5616ee9 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -23,7 +23,7 @@
 
 /* COPYRIGHT (c) 1989-2009, 2016.
  * On-Line Applications Research Corporation (OAR).
- * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ * COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -182,6 +182,9 @@ typedef struct {
*  then this field has no meaning.
*/
   rtems_thread_cpu_usage_t executed_since_last_period;
+  
+  /** This is the count of postponed jobs of this period. */
+  uint32_t postponed_jobs_count;
 }  rtems_rate_monotonic_period_status;
 
 /**
@@ -417,25 +420,6 @@ rtems_status_code rtems_rate_monotonic_period(
   rtems_interval  length
 );
 
-/**
- * @brief Return the number of postponed jobs
- *
- * This is a helper function for runtime monitoring to return
- * the number of postponed jobs in this given period. This number
- * is only increased by the corresponding watchdog,
- * and is decreased by RMS manager with the postponed job releasing.
- *
- * @param[in] id is the period id
- *
- * @retval This helper function returns the number of postponed
- * jobs with a given period_id.
- *
- */
-uint32_t rtems_rate_monotonic_postponed_job_count(
-  rtems_idperiod_id
-);
-
-
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/rtems/src/ratemongetstatus.c 
b/cpukit/rtems/src/ratemongetstatus.c
index 403c6ed..4e6b964 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -9,6 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
+ *  Copyright (c) 2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
 
   period_status->owner = the_period->owner->Object.id;
   period_status->state = the_period->state;
+  period_status->postponed_jobs_count = the_period->postponed_jobs;
 
   if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
 /*
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 97547e2..5b5d1dc 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2016-2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -302,20 +302,6 @@ static rtems_status_code 
_Rate_monotonic_Block_while_expired(
   return RTEMS_TIMEOUT;
 }
 
-uint32_t rtems_rate_monotonic_postponed_job_count( rtems_id period_id )
-{
-  Rate_monotonic_Control *the_period;
-  ISR_lock_Contextlock_context;
-  uint32_tjobs;
-
-  the_period = _Rate_monotonic_Get( period_id, _context );
-  _Assert( the_period != NULL );
-
-  jobs = the_period->postponed_jobs;
-  _Rate_monotonic_Release( the_period, _context );
-  return jobs;
-}
-
 rtems_status_code rtems_rate_monotonic_period(
   rtems_id   id,
   rtems_interval length
diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/init.c
index ac6f58c..c38beb8 100644
--- a/testsuites/sptests/sp69/init.c
+++ b/testsuites/sptests/sp69/init.c
@@ -162,6 +162,14 @@ rtems_task Init(

 rtems_test_assert( statistics.missed_count == i );
   }
+ 
+  /* Check the status */
+  status = rtems_rate_monotonic_get_status( period_id, _status );
+  directive_failed( status, "rate_monotonic_get_status" ); 
+  puts(
+"rtems_rate_monotonic_get_status - verify value of a postponed jobs count"
+  );
+  rtems_test_assert( period_status.postponed_jobs_count == 3 );
   
   TEST_END();
 
diff --git a/testsuites/sptests/sp69/sp69.doc b/testsuites/sptests/sp69/sp69.doc
index fbf0e4e..60aacb8 100644
--- a/testsuites

Re: [PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-25 Thread Kuan Hsun Chen
Hi Sebastian,

Should I test the overflow condition together with sp69 or prepare a new
test for this matter?

Best,
Kuan-Hsun

2017-01-25 15:53 GMT+01:00 Sebastian Huber <
sebastian.hu...@embedded-brains.de>:

>
>
> On 25/01/17 15:48, Kuan-Hsun Chen wrote:
>
>> ---
>>   cpukit/rtems/src/ratemontimeout.c | 7 +--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/cpukit/rtems/src/ratemontimeout.c
>> b/cpukit/rtems/src/ratemontimeout.c
>> index bcc4ccf..079ad41 100644
>> --- a/cpukit/rtems/src/ratemontimeout.c
>> +++ b/cpukit/rtems/src/ratemontimeout.c
>> @@ -9,7 +9,7 @@
>>*  COPYRIGHT (c) 1989-2009.
>>    *  On-Line Applications Research Corporation (OAR).
>>*
>> - *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
>> + *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
>>
>
> This should be 2016, 2017 or 2016-2017.
>
>*
>>*  The license and distribution terms for this file may be
>>*  found in the file LICENSE in this distribution or at
>> @@ -30,7 +30,10 @@ static void _Rate_monotonic_Renew_deadline(
>>   {
>> uint64_t deadline;
>>
>> -  ++the_period->postponed_jobs;
>> +  /** stay at 0x if postponed_jobs is going to overflow */
>>
>
> /** is a Doxygen comment.
>
> +  if ( the_period->postponed_jobs != UINT_MAX ) {
>> +++the_period->postponed_jobs;
>> +  }
>>
>
> Type is uint32_t, not unsigned int. So, use UINT32_MAX. Maybe
>
>  Empty lines between blocks.
>
> the_period->state = RATE_MONOTONIC_EXPIRED;
>>
>> deadline = _Watchdog_Per_CPU_insert_relative(
>>
>
> We need a test case for this overflow condition. You probably have to
> modify the_period->postponed_jobs by hand in the test case to avoid
> extremely long test run times.
>
> --
> 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
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] rtems: Fix _Rate_monotonic_Renew_deadline()

2017-01-25 Thread Kuan-Hsun Chen
---
 cpukit/rtems/src/ratemontimeout.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/ratemontimeout.c 
b/cpukit/rtems/src/ratemontimeout.c
index bcc4ccf..079ad41 100644
--- a/cpukit/rtems/src/ratemontimeout.c
+++ b/cpukit/rtems/src/ratemontimeout.c
@@ -9,7 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *
- *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *  COPYRIGHT (c) 2017 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -30,7 +30,10 @@ static void _Rate_monotonic_Renew_deadline(
 {
   uint64_t deadline;
 
-  ++the_period->postponed_jobs;
+  /** stay at 0x if postponed_jobs is going to overflow */
+  if ( the_period->postponed_jobs != UINT_MAX ) {
+++the_period->postponed_jobs;
+  }
   the_period->state = RATE_MONOTONIC_EXPIRED;
 
   deadline = _Watchdog_Per_CPU_insert_relative(
-- 
1.9.1

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


Re: [PATCH] Remove rtems_rate_monotonic_postponed_job_count() Add a variable named "count" in rtems_rate_monotonic_period_status structure Revise rtems_rate_monotonic_get_status() for the postponed jo

2017-01-25 Thread Kuan Hsun Chen
Hi Sebastian,

Okay. I will clarify it.

I used git format-patch -1 to generate the patch and git send-email --to
devel@rtems.org *.patch to send out the mail.
Could you tell me what I have missed?

Aha, it is 2017...

Best,
Kuan-hsun

2017-01-25 15:10 GMT+01:00 Sebastian Huber <
sebastian.hu...@embedded-brains.de>:

> Please use the standard Git commit message format.
>
>
> On 25/01/17 15:04, Kuan-Hsun Chen wrote:
>
>> sptests/sp69: Revise
>> Add in the verification of the postponed job count for
>> rtems_rate_monotonic_get_status().
>> ---
>>   cpukit/rtems/include/rtems/rtems/ratemon.h | 24
>> +---
>>   cpukit/rtems/src/ratemongetstatus.c|  2 ++
>>   cpukit/rtems/src/ratemonperiod.c   | 14 --
>>   testsuites/sptests/sp69/init.c |  8 
>>   testsuites/sptests/sp69/sp69.doc   |  2 ++
>>   testsuites/sptests/sp69/sp69.scn   |  5 +++--
>>   6 files changed, 20 insertions(+), 35 deletions(-)
>>
>> diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h
>> b/cpukit/rtems/include/rtems/rtems/ratemon.h
>> index 54ddd05..59512c5 100644
>> --- a/cpukit/rtems/include/rtems/rtems/ratemon.h
>> +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
>> @@ -182,6 +182,11 @@ typedef struct {
>>  *  then this field has no meaning.
>>  */
>> rtems_thread_cpu_usage_t executed_since_last_period;
>> +
>> +  /** This is the number of postponed jobs. This number
>> +   * is only increased by the corresponding watchdog,
>> +   * and is decreased by RMS manager with the postponed job releasing. */
>> +  uint32_t postponed_jobs_count;
>>   }  rtems_rate_monotonic_period_status;
>>
>
> Number in comment vs. count in member. I prefer count. Please clarify this
> a bit and avoid the watchdog. The watchdog is an implementation detail. The
> mentioning of RMS manager is redundant.
>
>
>   /**
>> @@ -417,25 +422,6 @@ rtems_status_code rtems_rate_monotonic_period(
>> rtems_interval  length
>>   );
>>   -/**
>> - * @brief Return the number of postponed jobs
>> - *
>> - * This is a helper function for runtime monitoring to return
>> - * the number of postponed jobs in this given period. This number
>> - * is only increased by the corresponding watchdog,
>> - * and is decreased by RMS manager with the postponed job releasing.
>> - *
>> - * @param[in] id is the period id
>> - *
>> - * @retval This helper function returns the number of postponed
>> - * jobs with a given period_id.
>> - *
>> - */
>> -uint32_t rtems_rate_monotonic_postponed_job_count(
>> -  rtems_idperiod_id
>> -);
>> -
>> -
>>   /**@}*/
>> #ifdef __cplusplus
>> diff --git a/cpukit/rtems/src/ratemongetstatus.c
>> b/cpukit/rtems/src/ratemongetstatus.c
>> index 403c6ed..8bd3613 100644
>> --- a/cpukit/rtems/src/ratemongetstatus.c
>> +++ b/cpukit/rtems/src/ratemongetstatus.c
>> @@ -9,6 +9,7 @@
>>*  COPYRIGHT (c) 1989-2009.
>>*  On-Line Applications Research Corporation (OAR).
>>*  Copyright (c) 2016 embedded brains GmbH.
>> + *  Copyright (c) 2016 Kuan-Hsun Chen.
>>
>
> We have 2017.
>
>
>*
>>*  The license and distribution terms for this file may be
>>*  found in the file LICENSE in this distribution or at
>> @@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
>>   period_status->owner = the_period->owner->Object.id;
>> period_status->state = the_period->state;
>> +  period_status->postponed_jobs_count = the_period->postponed_jobs;
>>   if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
>>   /*
>> diff --git a/cpukit/rtems/src/ratemonperiod.c
>> b/cpukit/rtems/src/ratemonperiod.c
>> index 97547e2..efcd121 100644
>> --- a/cpukit/rtems/src/ratemonperiod.c
>> +++ b/cpukit/rtems/src/ratemonperiod.c
>> @@ -302,20 +302,6 @@ static rtems_status_code
>> _Rate_monotonic_Block_while_expired(
>> return RTEMS_TIMEOUT;
>>   }
>>   -uint32_t rtems_rate_monotonic_postponed_job_count( rtems_id period_id
>> )
>> -{
>> -  Rate_monotonic_Control *the_period;
>> -  ISR_lock_Contextlock_context;
>> -  uint32_tjobs;
>> -
>> -  the_period = _Rate_monotonic_Get( period_id, _context );
>> -  _Assert( the_period != NULL );
>> -
>> -  jobs = the_period->postponed_jobs;
>> -  _Rate_monotonic_Release( the_period, _context );
>> -

[PATCH] Remove rtems_rate_monotonic_postponed_job_count() Add a variable named "count" in rtems_rate_monotonic_period_status structure Revise rtems_rate_monotonic_get_status() for the postponed job co

2017-01-25 Thread Kuan-Hsun Chen
sptests/sp69: Revise
Add in the verification of the postponed job count for 
rtems_rate_monotonic_get_status().
---
 cpukit/rtems/include/rtems/rtems/ratemon.h | 24 +---
 cpukit/rtems/src/ratemongetstatus.c|  2 ++
 cpukit/rtems/src/ratemonperiod.c   | 14 --
 testsuites/sptests/sp69/init.c |  8 
 testsuites/sptests/sp69/sp69.doc   |  2 ++
 testsuites/sptests/sp69/sp69.scn   |  5 +++--
 6 files changed, 20 insertions(+), 35 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 54ddd05..59512c5 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -182,6 +182,11 @@ typedef struct {
*  then this field has no meaning.
*/
   rtems_thread_cpu_usage_t executed_since_last_period;
+  
+  /** This is the number of postponed jobs. This number
+   * is only increased by the corresponding watchdog,
+   * and is decreased by RMS manager with the postponed job releasing. */
+  uint32_t postponed_jobs_count;
 }  rtems_rate_monotonic_period_status;
 
 /**
@@ -417,25 +422,6 @@ rtems_status_code rtems_rate_monotonic_period(
   rtems_interval  length
 );
 
-/**
- * @brief Return the number of postponed jobs
- *
- * This is a helper function for runtime monitoring to return
- * the number of postponed jobs in this given period. This number
- * is only increased by the corresponding watchdog,
- * and is decreased by RMS manager with the postponed job releasing.
- *
- * @param[in] id is the period id
- *
- * @retval This helper function returns the number of postponed
- * jobs with a given period_id.
- *
- */
-uint32_t rtems_rate_monotonic_postponed_job_count(
-  rtems_idperiod_id
-);
-
-
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/rtems/src/ratemongetstatus.c 
b/cpukit/rtems/src/ratemongetstatus.c
index 403c6ed..8bd3613 100644
--- a/cpukit/rtems/src/ratemongetstatus.c
+++ b/cpukit/rtems/src/ratemongetstatus.c
@@ -9,6 +9,7 @@
  *  COPYRIGHT (c) 1989-2009.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
+ *  Copyright (c) 2016 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -43,6 +44,7 @@ rtems_status_code rtems_rate_monotonic_get_status(
 
   period_status->owner = the_period->owner->Object.id;
   period_status->state = the_period->state;
+  period_status->postponed_jobs_count = the_period->postponed_jobs;
 
   if ( the_period->state == RATE_MONOTONIC_INACTIVE ) {
 /*
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 97547e2..efcd121 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -302,20 +302,6 @@ static rtems_status_code 
_Rate_monotonic_Block_while_expired(
   return RTEMS_TIMEOUT;
 }
 
-uint32_t rtems_rate_monotonic_postponed_job_count( rtems_id period_id )
-{
-  Rate_monotonic_Control *the_period;
-  ISR_lock_Contextlock_context;
-  uint32_tjobs;
-
-  the_period = _Rate_monotonic_Get( period_id, _context );
-  _Assert( the_period != NULL );
-
-  jobs = the_period->postponed_jobs;
-  _Rate_monotonic_Release( the_period, _context );
-  return jobs;
-}
-
 rtems_status_code rtems_rate_monotonic_period(
   rtems_id   id,
   rtems_interval length
diff --git a/testsuites/sptests/sp69/init.c b/testsuites/sptests/sp69/init.c
index ac6f58c..c38beb8 100644
--- a/testsuites/sptests/sp69/init.c
+++ b/testsuites/sptests/sp69/init.c
@@ -162,6 +162,14 @@ rtems_task Init(

 rtems_test_assert( statistics.missed_count == i );
   }
+ 
+  /* Check the status */
+  status = rtems_rate_monotonic_get_status( period_id, _status );
+  directive_failed( status, "rate_monotonic_get_status" ); 
+  puts(
+"rtems_rate_monotonic_get_status - verify value of a postponed jobs count"
+  );
+  rtems_test_assert( period_status.postponed_jobs_count == 3 );
   
   TEST_END();
 
diff --git a/testsuites/sptests/sp69/sp69.doc b/testsuites/sptests/sp69/sp69.doc
index fbf0e4e..e881a19 100644
--- a/testsuites/sptests/sp69/sp69.doc
+++ b/testsuites/sptests/sp69/sp69.doc
@@ -1,5 +1,6 @@
 #  COPYRIGHT (c) 1989-2009.
 #  On-Line Applications Research Corporation (OAR).
+#  COPYRIGHT (c) Kuan-Hsun Chen.
 #
 #  The license and distribution terms for this file may be
 #  found in the file LICENSE in this distribution or at
@@ -21,3 +22,4 @@ concepts:
   a period is initiated.
 + Verify the correctness of the status values returned on an active period.
 + Ensure the missed period count is properly maintained.
++ Verify the correctness of the postponed job count.
diff --git a/testsuites/sptests/sp69/sp69.scn b/testsuites/sptests/sp69/sp69.scn
index 654eea0..e102d22 100644
--- a/testsuites/sptests/sp69/

Re: RTEMS master LEON test status

2017-01-24 Thread Kuan Hsun Chen
Hello Sebastian,

I shouldn't do those ISR lock and _Thread_Dispatch_disable, right?
Does this patch solve some of the original test fails?
I'm trying the latest version now.

Best,
Kuan-Hsun

2017-01-24 14:46 GMT+01:00 Sebastian Huber <
sebastian.hu...@embedded-brains.de>:

> Hello Kuan-Hsun,
>
> thanks for your prompt feedback. I checked in a patch that fixes one issue:
>
> https://devel.rtems.org/changeset/1240aade5a35c4e8c43d5409e2
> 329eeb6a173299/rtems
>
> On 24/01/17 14:27, Kuan Hsun Chen wrote:
>
>> Hi Sebastian,
>>
>> I will check again the test on SMP target, though I only have QEMU-SMP to
>> simulate at the moment.
>> Is it okay to only test on QEMU?
>> Interestingly, why only sprmsched01 fails? How about spedfsched04?
>> I will start from this observation and see why SMP fails.
>>
>> Best,
>> Kuan-Hsun
>>
>> 2017-01-24 13:51 GMT+01:00 Sebastian Huber <sebastian.huber@embedded-brai
>> ns.de <mailto:sebastian.hu...@embedded-brains.de>>:
>>
>>
>> Hello Daniel,
>>
>> for RTEMS 4.12 GCC 6.3 will be used (most likely). I did test runs
>> with
>>
>> https://git.rtems.org/rtems/commit/?id=b07e642a2b1249cd64048
>> c5e9f5e45254df7ae65
>> <https://git.rtems.org/rtems/commit/?id=b07e642a2b1249cd6404
>> 8c5e9f5e45254df7ae65>
>>
>> on the GR740 with no unexpected test failures.
>>
>> On 24/01/17 13:25, Daniel Hellstrom wrote:
>>
>> Hi,
>>
>> We started some time ago to work with the RTEMS master again.
>> Daniel C has updated the toolchain to use GCC-7 which now
>> seems to be working fine. I just want to share the current
>> status of the RTEMS test-suite on the GR712RC with you. Please
>> let me know if you expect something or a particular tests to
>> be failing before we go too deep into them.
>>
>> In the SMP configuration there were a couple of tests hanging
>> and GRMON interrupted them after 4 minutes. sp20 for example
>> resulted in a hang while acquiring a SMP lock from the Clock
>> interrupt handler:
>>
>>
>> A change in the rate-monotonic manager did break several tests:
>>
>> https://devel.rtems.org/ticket/2795
>> <https://devel.rtems.org/ticket/2795>
>>
>> [...]
>>
>>
>> GR712RC, RTEMS Single-core configuration results:
>>
>>   ###
>>   # RTEMS TESTSUITE FAILURE SUMMARY
>>   #
>>   # Result Test ExecRes ConsoleRes ExitCode1 ExitCode2
>>   # FAIL: ./fstests/fsdosfsname01 OK FAIL 5 0
>>   # FAIL: ./psxtests/psxsem01 OK FAIL 5 11
>>   # FAIL: ./sptests/spinternalerror01 OK N/A -559038737 1611526157
>>   # FAIL: ./sptests/sptimecounter01 OK N/A 5 0
>>   #
>>   # SUMMARY
>>   #  Tests failing:4
>>   #  Tests successful: 528
>>   #
>>   ###
>>
>>
>> It would be good to investigate these issues.
>>
>> -- Sebastian Huber, embedded brains GmbH
>>
>> Address : Dornierstr. 4, D-82178 Puchheim, Germany
>> Phone   : +49 89 189 47 41-16 <tel:%2B49%2089%20189%2047%2041-16>
>> Fax : +49 89 189 47 41-09 <tel:%2B49%2089%20189%2047%2041-09>
>> E-Mail  : sebastian.hu...@embedded-brains.de
>> <mailto: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 <mailto:devel@rtems.org>
>> http://lists.rtems.org/mailman/listinfo/devel
>> <http://lists.rtems.org/mailman/listinfo/devel>
>>
>>
>>
>>
>> --
>> M.Sc. Kuan-Hsun Chen
>>
>> TU Dortmund
>> Department of Computer Science 12
>> Design Automation of Embedded Systems
>> Otto-Hahn-Strasse 16, Room 102
>>
>> 44227 Dortmund
>> Germany
>>
>> Phone: _+49 231 755 6124 <tel:+49%20231%207556124>_
>> Mail: kuan-hsun.c...@tu-dortmund.de <mailto:kuan-hsun.c...@tu-dortmund.de
>> >
>>
>
> --
> 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.
>
>


-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: RTEMS master LEON test status

2017-01-24 Thread Kuan Hsun Chen
Hi Sebastian,

I will check again the test on SMP target, though I only have QEMU-SMP to
simulate at the moment.
Is it okay to only test on QEMU?
Interestingly, why only sprmsched01 fails? How about spedfsched04?
I will start from this observation and see why SMP fails.

Best,
Kuan-Hsun

2017-01-24 13:51 GMT+01:00 Sebastian Huber <sebastian.huber@embedded-
brains.de>:

> Hello Daniel,
>
> for RTEMS 4.12 GCC 6.3 will be used (most likely). I did test runs with
>
> https://git.rtems.org/rtems/commit/?id=b07e642a2b1249cd64048
> c5e9f5e45254df7ae65
>
> on the GR740 with no unexpected test failures.
>
> On 24/01/17 13:25, Daniel Hellstrom wrote:
>
>> Hi,
>>
>> We started some time ago to work with the RTEMS master again. Daniel C
>> has updated the toolchain to use GCC-7 which now seems to be working fine.
>> I just want to share the current status of the RTEMS test-suite on the
>> GR712RC with you. Please let me know if you expect something or a
>> particular tests to be failing before we go too deep into them.
>>
>> In the SMP configuration there were a couple of tests hanging and GRMON
>> interrupted them after 4 minutes. sp20 for example resulted in a hang while
>> acquiring a SMP lock from the Clock interrupt handler:
>>
>
> A change in the rate-monotonic manager did break several tests:
>
> https://devel.rtems.org/ticket/2795
>
> [...]
>
>>
>> GR712RC, RTEMS Single-core configuration results:
>>
>>   ###
>>   # RTEMS TESTSUITE FAILURE SUMMARY
>>   #
>>   # Result Test ExecRes ConsoleRes ExitCode1 ExitCode2
>>   # FAIL: ./fstests/fsdosfsname01 OK FAIL 5 0
>>   # FAIL: ./psxtests/psxsem01 OK FAIL 5 11
>>   # FAIL: ./sptests/spinternalerror01 OK N/A -559038737 1611526157
>>   # FAIL: ./sptests/sptimecounter01 OK N/A 5 0
>>   #
>>   # SUMMARY
>>   #  Tests failing:4
>>   #  Tests successful: 528
>>   #
>>   ###
>>
>
> It would be good to investigate these issues.
>
> --
> 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
>



-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124 <+49%20231%207556124>*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Enhancement of the RMS manager for the overrun handling.

2016-12-21 Thread Kuan Hsun Chen
Hello Gedare,

I take the latest version of RTEMS eae4541d7b8001aa18c6fc2d62b32385b0310125
to integrate my patch this time.
All you mentioned coding-convention issues are solved accordingly I think.
I will hold the copyright by myself.

rtems_rate_monotonic_postponed_num() this function is prepared for run-time
monitoring.
The user can call this function to check the number of postponed jobs in
run-time.
Therefore I name it with rtems prefix as the feature for users.
Should I add the description of this function in the documentation?

Best,
Kuan-Hsun

2016-12-20 23:10 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> On Fri, Dec 9, 2016 at 11:21 AM, Kuan-Hsun Chen <c00...@gmail.com> wrote:
> > Three additional functions:
> > RM_Postponed_num, RM_Renew_deadline, and RM_Release_postponedjob.
> >
> > Four refined functions:
> > RM_Activate, RM_Block_while_expired, rtems_rate_monotonic_period,
> RM_Timeout.
> >
> > Rate_monotonic_Control contains one counter for counting the postponed
> jobs and one for recording the recent deadline.
> > ---
> >  cpukit/rtems/include/rtems/rtems/ratemon.h |  42 ++--
> >  cpukit/rtems/include/rtems/rtems/ratemonimpl.h |  25 +++--
> >  cpukit/rtems/src/ratemonperiod.c   | 144
> +
> >  cpukit/rtems/src/ratemontimeout.c  |  13 ++-
> >  4 files changed, 183 insertions(+), 41 deletions(-)
> >
> > diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h
> b/cpukit/rtems/include/rtems/rtems/ratemon.h
> > index 50b8478..71a99dc 100644
> > --- a/cpukit/rtems/include/rtems/rtems/ratemon.h
> > +++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
> > @@ -22,6 +22,7 @@
> >
> >  /* COPYRIGHT (c) 1989-2009, 2016.
> >   * On-Line Applications Research Corporation (OAR).
> > + * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
> >   *
> >   * The license and distribution terms for this file may be
> >   * found in the file LICENSE in this distribution or at
> > @@ -194,11 +195,6 @@ typedef struct {
> >/** This field is the object management portion of a Period instance.
> */
> >Objects_Control Object;
> >
> > -  /**
> > -   * @brief Protects the rate monotonic period state.
> > -   */
> > -  ISR_LOCK_MEMBER(Lock )
> > -
> Why are these removed?
>
> >/** This is the timer used to provide the unblocking mechanism. */
> >Watchdog_ControlTimer;
> >
> > @@ -206,12 +202,6 @@ typedef struct {
> >rtems_rate_monotonic_period_states  state;
> >
> >/**
> > -   * @brief A priority node for use by the scheduler job release and
> cancel
> > -   * operations.
> > -   */
> > -  Priority_Node   Priority;
> > -
> > -  /**
> Ditto.
>
> > * This field contains the length of the next period to be
> > * executed.
> > */
> > @@ -240,6 +230,19 @@ typedef struct {
> > * This field contains the statistics maintained for the period.
> > */
> >Rate_monotonic_Statistics   Statistics;
> > +
> > +  /**
> > +   * This field contains the number of postponed jobs. When the
> watchdog timeout,
> > +   * this variable will be increased immediately.
> > +   */
> > +  uint32_tpostponed_jobs;
> > +
> > +  /**
> > +   *  This field contains the tick of the latest deadline decided by
> the period
> > +   *  watchdog.
> > +   */
> > +  uint64_tlatest_deadline;
> > +
> >  }   Rate_monotonic_Control;
> >
> >  /**
> > @@ -386,6 +389,23 @@ void rtems_rate_monotonic_report_
> statistics_with_plugin(
> >  void rtems_rate_monotonic_report_statistics( void );
> >
> >  /**
> > + * @brief RTEMS Return the number of postponed jobs
> remove "RTEMS".
>
> > + *
> > + * This is a helper function to return the number of postponed jobs by
> this
> by -> in
>
> > + * given period. This number is only increased by the corresponding
> watchdog,
> Is it only in a given period, or is it postponed jobs generally, i.e.
> you could miss multiple periods hence jobs in multiple periods would
> be counted here?
>
> > + * and is decreased by RMS manager with the postponed job releasing.
> > + *
> > + * @param[in] id is the period id
> > + *
> > + * @retval This helper function returns the number of postponed
> > + * jobs with given period_id.
> > + *
> > + */
> > 

[PATCH] Update RMS documentation for overrun handling

2016-12-21 Thread Kuan-Hsun Chen
---
 c-user/rate_monotonic_manager.rst | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/c-user/rate_monotonic_manager.rst 
b/c-user/rate_monotonic_manager.rst
index 8ad74e5..9ba22a5 100644
--- a/c-user/rate_monotonic_manager.rst
+++ b/c-user/rate_monotonic_manager.rst
@@ -132,7 +132,7 @@ milliseconds every 100 (10 percent of the CPU).  As a 
general rule of thumb,
 the higher frequency at which a task executes, the more important it is to
 optimize that task.
 
-Rate Monotonic Manager Definitions
+Periodicity Definitions
 --
 .. index:: periodic task, definition
 
@@ -170,7 +170,7 @@ Rate Monotonic Scheduling Algorithm
 .. index:: RMS Algorithm, definition
 
 The Rate Monotonic Scheduling Algorithm (RMS) is important to real-time systems
-designers because it allows one to guarantee that a set of tasks is
+designers because it allows one to sufficiently guarantee that a set of tasks 
is
 schedulable.  A set of tasks is said to be schedulable if all of the tasks can
 meet their deadlines.  RMS provides a set of rules which can be used to perform
 a guaranteed schedulability analysis for a task set.  This analysis determines
@@ -179,11 +179,11 @@ the predictability of the system's behavior.  It has been 
proven that:
 
 .. sidebar:: *RMS*
 
-  RMS is an optimal static priority algorithm for scheduling independent,
+  RMS is an optimal fixed-priority algorithm for scheduling independent,
   preemptible, periodic tasks on a single processor.
 
 RMS is optimal in the sense that if a set of tasks can be scheduled by any
-static priority algorithm, then RMS will be able to schedule that task set.
+fixed-priority algorithm, then RMS will be able to schedule that task set.
 RMS bases it schedulability analysis on the processor utilization level below
 which all deadlines can be met.
 
@@ -230,7 +230,7 @@ Schedulability Analysis
 
 .. index:: RMS schedulability analysis
 
-RMS allows application designers to ensure that tasks can meet all deadlines,
+RMS allows application designers to ensure that tasks can meet all deadlines 
under fixed-priority assignment,
 even under transient overload, without knowing exactly when any given task will
 execute by applying proven schedulability analysis rules.
 
@@ -468,9 +468,10 @@ monotonic period results in one of the following scenarios:
   immediately.
 
 - If the rate monotonic period has expired before the task invokes the
-  ``rtems_rate_monotonic_period`` directive, the period will be initiated with
-  a length of period ticks and the calling task returns immediately with a
-  timeout error status.
+  ``rtems_rate_monotonic_period`` directive, the postponed job will be 
released 
+  until there is no more postponed jobs. The calling task returns immediately 
+  with a timeout error status. In the watchdog routine, the period will still 
+  be updated periodically and track the number of the postponed periods.
 
 Obtaining the Status of a Period
 
@@ -560,8 +561,8 @@ Subsequent invocations of the 
``rtems_rate_monotonic_period`` directive will
 result in the task blocking for the remainder of the 100 tick period.  If, for
 any reason, the body of the loop takes more than 100 ticks to execute, the
 ``rtems_rate_monotonic_period`` directive will return the ``RTEMS_TIMEOUT``
-status.  If the above task misses its deadline, it will delete the rate
-monotonic period and itself.
+status and the postponed job will be released.  If the above task misses 
+its deadline, it will delete the rate monotonic period and itself.
 
 Task with Multiple Periods
 --
@@ -629,8 +630,8 @@ will not block.
 
 If, for any reason, the task misses any deadline, the
 ``rtems_rate_monotonic_period`` directive will return the ``RTEMS_TIMEOUT``
-directive status.  If the above task misses its deadline, it will delete the
-rate monotonic periods and itself.
+directive status and the postponed job will be released. If the above task 
misses 
+its deadline, it will delete the rate monotonic periods and itself.
 
 Directives
 ==
@@ -839,7 +840,10 @@ DESCRIPTION:
 period ticks.  If id is running, then the calling task will block for the
 remainder of the period before reinitiating the period with the specified
 period.  If id was not running (either expired or never initiated), the
-period is immediately initiated and the directive returns immediately.
+period is immediately initiated and the directive returns immediately. 
+   If id has expired its period, the postponed job will be released 
immediately 
+   and the following calls of this directive will release postponed 
+   jobs until there is no more deadline miss.
 
 If invoked with a period of ``RTEMS_PERIOD_STATUS`` ticks, the current
 state of id will be returned.  The directive status indicates the current
-- 
1.9.1


[PATCH 1/3] Enhancement of the RMS manager for the overrun handling.

2016-12-21 Thread Kuan-Hsun Chen
Three additional functions:
RM_Postponed_num, RM_Renew_deadline, and RM_Release_postponedjob.

Four refined functions:
RM_Activate, RM_Block_while_expired, rtems_rate_monotonic_period, RM_Timeout.

Rate_monotonic_Control contains one counter for counting the postponed jobs and 
one for recording the recent deadline.
---
 cpukit/rtems/include/rtems/rtems/ratemon.h |  33 +++
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h |  13 +++
 cpukit/rtems/src/ratemonperiod.c   | 128 +++--
 cpukit/rtems/src/ratemontimeout.c  |  11 ++-
 4 files changed, 176 insertions(+), 9 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 50b8478..17b2ebf 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -18,10 +18,12 @@
  * - delete a rate monotonic timer
  * - conclude current and start the next period
  * - obtain status information on a period
+ * - obtain the number of postponed jobs
  */
 
 /* COPYRIGHT (c) 1989-2009, 2016.
  * On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (c) 2016 Kuan-Hsun Chen.
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -240,6 +242,18 @@ typedef struct {
* This field contains the statistics maintained for the period.
*/
   Rate_monotonic_Statistics   Statistics;
+
+  /**
+   * This field contains the number of postponed jobs. 
+   * When the watchdog timeout, this variable will be increased immediately.
+   */
+  uint32_tpostponed_jobs;
+
+  /**
+   *  This field contains the tick of the latest deadline decided by the period
+   *  watchdog.
+  */
+  uint64_tlatest_deadline;
 }   Rate_monotonic_Control;
 
 /**
@@ -403,6 +417,25 @@ rtems_status_code rtems_rate_monotonic_period(
   rtems_interval  length
 );
 
+/**
+ * @brief RTEMS Return the number of postponed jobs
+ * 
+ * This is a helper function for runtime monitoring to return 
+ * the number of postponed jobs in this given period. This number 
+ * is only increased by the corresponding watchdog, 
+ * and is decreased by RMS manager with the postponed job releasing.
+ *
+ * @param[in] id is the period id
+ *
+ * @retval This helper function returns the number of postponed 
+ * jobs with a given period_id.
+ *
+ */
+uint32_t rtems_rate_monotonic_postponed_num(
+  rtems_idperiod_id
+);
+
+
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h 
b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index b6b3ffd..c67586b 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -9,6 +9,7 @@
 /*  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -116,6 +117,18 @@ bool _Rate_monotonic_Get_status(
   Timestamp_Control*cpu_since_last_period
 );
 
+/**
+ * @brief Renew the watchdog deadline
+ *
+ * This routine is prepared for the watchdog timeout to renew its deadline
+ * without releasing jobs. 
+ */
+void _Rate_monotonic_Renew_deadline(
+  Rate_monotonic_Control *the_period,
+  Thread_Control *owner,
+  ISR_lock_Context   *lock_context
+);
+
 void _Rate_monotonic_Restart(
   Rate_monotonic_Control *the_period,
   Thread_Control *owner,
diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c
index 77bd996..28ac810 100644
--- a/cpukit/rtems/src/ratemonperiod.c
+++ b/cpukit/rtems/src/ratemonperiod.c
@@ -9,6 +9,7 @@
  *  COPYRIGHT (c) 1989-2010.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -63,6 +64,32 @@ bool _Rate_monotonic_Get_status(
   return true;
 }
 
+static void _Rate_monotonic_Release_postponedjob(
+  Rate_monotonic_Control *the_period,
+  Thread_Control *owner,
+  rtems_interval  next_length,
+  ISR_lock_Context   *lock_context
+)
+{
+  /* This function only releases the postponed jobs. */
+  Per_CPU_Control *cpu_self;
+  Thread_queue_Context  queue_context;
+  cpu_self = _Thread_Dispatch_disable_critical( lock_context );
+  _Rate_monotonic_Release( owner, lock_context );
+  
+  the_period->postponed_jobs -=1;
+  _Scheduler_Release_job(
+owner,
+_period->Priority,
+the_period->latest_deadline,
+_context
+  );
+  
+  _Rate_monotonic_Release( the_period, lock_context );
+  _Thread_Priority_update( _context );
+  _Thread_Dispatch_enable(

[PATCH 3/3] EDF scheduler overrun handling example

2016-12-21 Thread Kuan-Hsun Chen
---
 testsuites/sptests/Makefile.am   |   2 +-
 testsuites/sptests/configure.ac  |   1 +
 testsuites/sptests/spedfsched04/Makefile.am  |  21 +
 testsuites/sptests/spedfsched04/init.c   |  70 +++
 testsuites/sptests/spedfsched04/spedfsched04.doc |  34 
 testsuites/sptests/spedfsched04/spedfsched04.scn |  24 ++
 testsuites/sptests/spedfsched04/system.h |  62 ++
 testsuites/sptests/spedfsched04/tasks.c  | 103 +++
 8 files changed, 316 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/sptests/spedfsched04/Makefile.am
 create mode 100644 testsuites/sptests/spedfsched04/init.c
 create mode 100644 testsuites/sptests/spedfsched04/spedfsched04.doc
 create mode 100644 testsuites/sptests/spedfsched04/spedfsched04.scn
 create mode 100644 testsuites/sptests/spedfsched04/system.h
 create mode 100644 testsuites/sptests/spedfsched04/tasks.c

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 4379a2b..9718139 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -37,7 +37,7 @@ _SUBDIRS += spfatal29
 _SUBDIRS += spmutex01
 _SUBDIRS += spextensions01
 _SUBDIRS += spsysinit01
-_SUBDIRS += sprmsched01
+_SUBDIRS += sprmsched01 spedfsched04
 if HAS_SMP
 else
 _SUBDIRS += sp29
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 8a55aef..6713754 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -166,6 +166,7 @@ spcoverage/Makefile
 spedfsched01/Makefile
 spedfsched02/Makefile
 spedfsched03/Makefile
+spedfsched04/Makefile
 sperror01/Makefile
 sperror02/Makefile
 sperror03/Makefile
diff --git a/testsuites/sptests/spedfsched04/Makefile.am 
b/testsuites/sptests/spedfsched04/Makefile.am
new file mode 100644
index 000..21293de
--- /dev/null
+++ b/testsuites/sptests/spedfsched04/Makefile.am
@@ -0,0 +1,21 @@
+
+rtems_tests_PROGRAMS = spedfsched04
+spedfsched04_SOURCES = init.c tasks.c system.h
+   
+dist_rtems_tests_DATA = spedfsched04.scn 
+dist_rtems_tests_DATA += spedfsched04.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spedfsched04_OBJECTS)
+LINK_LIBS = $(spedfsched04_LDLIBS)
+
+spedfsched04$(EXEEXT): $(spedfsched04_OBJECTS) $(spedfsched04_DEPENDENCIES)
+   @rm -f spedfsched04$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/spedfsched04/init.c 
b/testsuites/sptests/spedfsched04/init.c
new file mode 100644
index 000..b1401e6
--- /dev/null
+++ b/testsuites/sptests/spedfsched04/init.c
@@ -0,0 +1,70 @@
+/**
+ * @file spedfsched04/init.c
+ *
+ * @brief A init task body for spedfsched04 example.
+ *
+ */
+
+/*
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include 
+#include 
+#include 
+
+const char rtems_test_name[] = "SPEDFSCHED 4 - Overrun Test";
+
+/* Global variables */
+rtems_id   Task_id[ 2 ]; /* array of task ids */
+rtems_name Task_name[ 2 ];   /* array of task names */
+uint32_t tick_per_second;/* time reference */
+int testnumber = 5;  /* stop condition */
+
+rtems_task_priority Prio[ 3 ] = { 0, 2, 5 };
+
+rtems_task Init(
+   rtems_task_argument argument
+)
+{
+  uint32_tindex;
+  TEST_BEGIN();
+  rtems_status_code status;
+
+
+  tick_per_second = rtems_clock_get_ticks_per_second();
+  printf( "\nTicks per second in your system: %" PRIu32 "\n", tick_per_second 
);
+
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+  /* Create two tasks */
+  for ( index = 1; index <= 2; index++ ){
+status = rtems_task_create(
+  Task_name[ index ], Prio[ index ], RTEMS_MINIMUM_STACK_SIZE, 
RTEMS_DEFAULT_MODES,
+  RTEMS_DEFAULT_ATTRIBUTES, _id[ index ]
+);
+directive_failed( status, "rtems_task_create loop" );
+  }
+
+  /* After creating the periods for tasks, start to run them sequencially. */
+  for ( index = 1; index <= 2; index++ ){
+status = rtems_task_start( Task_id[ index ], Task, index);
+directive_failed( status, "rtems_task_start loop" );
+  }
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
diff --git a/testsuites/sptests/spedfsched04/spedfsched04.doc 
b/testsuites/sptests/spedfsched04/spedfsched04.doc
new file mode 100644
index 000..a2e90ee
--- /dev/null
+++ b/testsuites/

[PATCH 2/3] RMS scheduler overrun handling example

2016-12-21 Thread Kuan-Hsun Chen
---
 testsuites/sptests/Makefile.am |   1 +
 testsuites/sptests/configure.ac|   1 +
 testsuites/sptests/sprmsched01/Makefile.am |  21 +
 testsuites/sptests/sprmsched01/init.c  |  70 
 testsuites/sptests/sprmsched01/sprmsched01.doc |  33 
 testsuites/sptests/sprmsched01/sprmsched01.scn |  50 +++
 testsuites/sptests/sprmsched01/system.h|  61 ++
 testsuites/sptests/sprmsched01/tasks.c | 112 +
 8 files changed, 349 insertions(+)
 create mode 100644 testsuites/sptests/sprmsched01/Makefile.am
 create mode 100644 testsuites/sptests/sprmsched01/init.c
 create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.doc
 create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.scn
 create mode 100644 testsuites/sptests/sprmsched01/system.h
 create mode 100644 testsuites/sptests/sprmsched01/tasks.c

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 54a4de7..4379a2b 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -37,6 +37,7 @@ _SUBDIRS += spfatal29
 _SUBDIRS += spmutex01
 _SUBDIRS += spextensions01
 _SUBDIRS += spsysinit01
+_SUBDIRS += sprmsched01
 if HAS_SMP
 else
 _SUBDIRS += sp29
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 76d60e3..8a55aef 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -255,5 +255,6 @@ sptimer_err02/Makefile
 spcpuset01/Makefile
 spregion_err01/Makefile
 sppartition_err01/Makefile
+sprmsched01/Makefile
 ])
 AC_OUTPUT
diff --git a/testsuites/sptests/sprmsched01/Makefile.am 
b/testsuites/sptests/sprmsched01/Makefile.am
new file mode 100644
index 000..f837b52
--- /dev/null
+++ b/testsuites/sptests/sprmsched01/Makefile.am
@@ -0,0 +1,21 @@
+
+rtems_tests_PROGRAMS = sprmsched01
+sprmsched01_SOURCES = init.c tasks.c system.h
+   
+dist_rtems_tests_DATA = sprmsched01.scn 
+dist_rtems_tests_DATA += sprmsched01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sprmsched01_OBJECTS)
+LINK_LIBS = $(sprmsched01_LDLIBS)
+
+sprmsched01$(EXEEXT): $(sprmsched01_OBJECTS) $(sprmsched01_DEPENDENCIES)
+   @rm -f sprmsched01$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sprmsched01/init.c 
b/testsuites/sptests/sprmsched01/init.c
new file mode 100644
index 000..f353191
--- /dev/null
+++ b/testsuites/sptests/sprmsched01/init.c
@@ -0,0 +1,70 @@
+/**
+ * @file sprmsched01/init.c
+ *
+ * @brief A init task body for sprmsched01 example.
+ *
+ */
+
+/*
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include 
+#include 
+#include 
+
+const char rtems_test_name[] = "Rate Monotonic 01 - Overrun Test";
+
+/* Global variables */
+rtems_id   Task_id[ 2 ]; /* array of task ids */
+rtems_name Task_name[ 2 ];   /* array of task names */
+uint32_t tick_per_second;/* time reference */
+int testnumber = 11;  /* stop condition */
+
+rtems_task_priority Prio[3] = { 0, 2, 5 };
+
+rtems_task Init(
+   rtems_task_argument argument
+)
+{
+  uint32_t index;
+  rtems_status_code status;
+
+  TEST_BEGIN();
+
+  tick_per_second = rtems_clock_get_ticks_per_second();
+  printf( "\nTicks per second in your system: %" PRIu32 "\n", tick_per_second 
);
+
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+  /* Create two tasks */
+  for ( index = 1; index <= 2; index++ ){
+status = rtems_task_create(
+  Task_name[ index ], Prio[index], RTEMS_MINIMUM_STACK_SIZE, 
RTEMS_DEFAULT_MODES,
+  RTEMS_DEFAULT_ATTRIBUTES, _id[ index ]
+);
+directive_failed( status, "rtems_task_create loop" );
+  }
+
+
+  /* After creating the periods for tasks, start to run them sequencially. */
+  for ( index = 1; index <= 2; index++ ){
+status = rtems_task_start( Task_id[ index ], Task, index);
+directive_failed( status, "rtems_task_start loop");
+  }
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
diff --git a/testsuites/sptests/sprmsched01/sprmsched01.doc 
b/testsuites/sptests/sprmsched01/sprmsched01.doc
new file mode 100644
index 000..6052e44
--- /dev/null
+++ b/testsuites/sptests/sprmsched01/sprmsched01.doc
@@ -0,0 +1,33 @@
+#
+#   COPYRIGHT (c) 2016 Kuan-Hsun Chen.
+# 
+#   The license and distr

Re: [PATCH] RMS scheduler overrun handling example

2016-12-20 Thread Kuan Hsun Chen
Hello Gedare,

Thanks, I will check the content of the patches again.

Best,
Kuan-Hsun

2016-12-20 22:57 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> On Tue, Dec 20, 2016 at 4:53 PM, Kuan Hsun Chen <c00...@gmail.com> wrote:
> > Hi Gedare,
> >
> > I want to hold copyright. How should I do?
> >
> This depends on the policy of your employer/university. You should ask
> your supervisor/advisor about the issue, and look for relevant
> policies regarding copyright and/or open-source software.
>
> Then, you should just list yourself in the copyright line if you are
> allowed to hold the copyright, or you need to list your employer.
>
> > Best,
> > Kuan-Hsun
> >
> > 2016-12-20 22:51 GMT+01:00 Gedare Bloom <ged...@rtems.org>:
> >>
> >> On Fri, Dec 9, 2016 at 11:40 AM, Kuan-Hsun Chen <c00...@gmail.com>
> wrote:
> >> > ---
> >> >  testsuites/sptests/Makefile.am |   2 +
> >> >  testsuites/sptests/configure.ac|   1 +
> >> >  testsuites/sptests/sprmsched01/Makefile.am |  21 +
> >> >  testsuites/sptests/sprmsched01/init.c  |  69
> 
> >> >  testsuites/sptests/sprmsched01/sprmsched01.doc |  33 
> >> >  testsuites/sptests/sprmsched01/sprmsched01.scn |  48 
> >> >  testsuites/sptests/sprmsched01/system.h|  64 +++
> >> >  testsuites/sptests/sprmsched01/tasks.c | 104
> >> > +
> >> >  8 files changed, 342 insertions(+)
> >> >  create mode 100644 testsuites/sptests/sprmsched01/Makefile.am
> >> >  create mode 100644 testsuites/sptests/sprmsched01/init.c
> >> >  create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.doc
> >> >  create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.scn
> >> >  create mode 100644 testsuites/sptests/sprmsched01/system.h
> >> >  create mode 100644 testsuites/sptests/sprmsched01/tasks.c
> >> >
> >> > diff --git a/testsuites/sptests/Makefile.am
> >> > b/testsuites/sptests/Makefile.am
> >> > index 54a4de7..4281abb 100644
> >> > --- a/testsuites/sptests/Makefile.am
> >> > +++ b/testsuites/sptests/Makefile.am
> >> > @@ -37,6 +37,7 @@ _SUBDIRS += spfatal29
> >> >  _SUBDIRS += spmutex01
> >> >  _SUBDIRS += spextensions01
> >> >  _SUBDIRS += spsysinit01
> >> > +_SUBDIRS += sprmsched01
> >> >  if HAS_SMP
> >> >  else
> >> >  _SUBDIRS += sp29
> >> > @@ -56,6 +57,7 @@ _SUBDIRS += sptimecounter03
> >> >  _SUBDIRS += spatomic01
> >> >  _SUBDIRS += spintrcritical22
> >> >  _SUBDIRS += spsem03
> >> > +_SUBDIRS += spresource01
> >> >  _SUBDIRS += spmrsp01
> >> >  _SUBDIRS += spscheduler01
> >> >  _SUBDIRS += spprofiling01
> >> > diff --git a/testsuites/sptests/configure.ac
> >> > b/testsuites/sptests/configure.ac
> >> > index 76d60e3..8a55aef 100644
> >> > --- a/testsuites/sptests/configure.ac
> >> > +++ b/testsuites/sptests/configure.ac
> >> > @@ -255,5 +255,6 @@ sptimer_err02/Makefile
> >> >  spcpuset01/Makefile
> >> >  spregion_err01/Makefile
> >> >  sppartition_err01/Makefile
> >> > +sprmsched01/Makefile
> >> >  ])
> >> >  AC_OUTPUT
> >> > diff --git a/testsuites/sptests/sprmsched01/Makefile.am
> >> > b/testsuites/sptests/sprmsched01/Makefile.am
> >> > new file mode 100644
> >> > index 000..f837b52
> >> > --- /dev/null
> >> > +++ b/testsuites/sptests/sprmsched01/Makefile.am
> >> > @@ -0,0 +1,21 @@
> >> > +
> >> > +rtems_tests_PROGRAMS = sprmsched01
> >> > +sprmsched01_SOURCES = init.c tasks.c system.h
> >> > +
> >> > +dist_rtems_tests_DATA = sprmsched01.scn
> >> > +dist_rtems_tests_DATA += sprmsched01.doc
> >> > +
> >> > +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
> >> > +include $(top_srcdir)/../automake/compile.am
> >> > +include $(top_srcdir)/../automake/leaf.am
> >> > +
> >> > +AM_CPPFLAGS += -I$(top_srcdir)/../support/include
> >> > +
> >> > +LINK_OBJS = $(sprmsched01_OBJECTS)
> >> > +LINK_LIBS = $(sprmsched01_LDLIBS)
> >> > +
> >> > +sprmsched01$(EXEEXT): $(sprmsched01_OBJECTS)
> >> > $(sprmsched01_DEPENDENCIES)
> >> > + 

Re: [PATCH] RMS scheduler overrun handling example

2016-12-20 Thread Kuan Hsun Chen
Hi Gedare,

I want to hold copyright. How should I do?

Best,
Kuan-Hsun

2016-12-20 22:51 GMT+01:00 Gedare Bloom <ged...@rtems.org>:

> On Fri, Dec 9, 2016 at 11:40 AM, Kuan-Hsun Chen <c00...@gmail.com> wrote:
> > ---
> >  testsuites/sptests/Makefile.am |   2 +
> >  testsuites/sptests/configure.ac|   1 +
> >  testsuites/sptests/sprmsched01/Makefile.am |  21 +
> >  testsuites/sptests/sprmsched01/init.c  |  69 
> >  testsuites/sptests/sprmsched01/sprmsched01.doc |  33 
> >  testsuites/sptests/sprmsched01/sprmsched01.scn |  48 
> >  testsuites/sptests/sprmsched01/system.h|  64 +++
> >  testsuites/sptests/sprmsched01/tasks.c | 104
> +
> >  8 files changed, 342 insertions(+)
> >  create mode 100644 testsuites/sptests/sprmsched01/Makefile.am
> >  create mode 100644 testsuites/sptests/sprmsched01/init.c
> >  create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.doc
> >  create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.scn
> >  create mode 100644 testsuites/sptests/sprmsched01/system.h
> >  create mode 100644 testsuites/sptests/sprmsched01/tasks.c
> >
> > diff --git a/testsuites/sptests/Makefile.am
> b/testsuites/sptests/Makefile.am
> > index 54a4de7..4281abb 100644
> > --- a/testsuites/sptests/Makefile.am
> > +++ b/testsuites/sptests/Makefile.am
> > @@ -37,6 +37,7 @@ _SUBDIRS += spfatal29
> >  _SUBDIRS += spmutex01
> >  _SUBDIRS += spextensions01
> >  _SUBDIRS += spsysinit01
> > +_SUBDIRS += sprmsched01
> >  if HAS_SMP
> >  else
> >  _SUBDIRS += sp29
> > @@ -56,6 +57,7 @@ _SUBDIRS += sptimecounter03
> >  _SUBDIRS += spatomic01
> >  _SUBDIRS += spintrcritical22
> >  _SUBDIRS += spsem03
> > +_SUBDIRS += spresource01
> >  _SUBDIRS += spmrsp01
> >  _SUBDIRS += spscheduler01
> >  _SUBDIRS += spprofiling01
> > diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/
> configure.ac
> > index 76d60e3..8a55aef 100644
> > --- a/testsuites/sptests/configure.ac
> > +++ b/testsuites/sptests/configure.ac
> > @@ -255,5 +255,6 @@ sptimer_err02/Makefile
> >  spcpuset01/Makefile
> >  spregion_err01/Makefile
> >  sppartition_err01/Makefile
> > +sprmsched01/Makefile
> >  ])
> >  AC_OUTPUT
> > diff --git a/testsuites/sptests/sprmsched01/Makefile.am
> b/testsuites/sptests/sprmsched01/Makefile.am
> > new file mode 100644
> > index 000..f837b52
> > --- /dev/null
> > +++ b/testsuites/sptests/sprmsched01/Makefile.am
> > @@ -0,0 +1,21 @@
> > +
> > +rtems_tests_PROGRAMS = sprmsched01
> > +sprmsched01_SOURCES = init.c tasks.c system.h
> > +
> > +dist_rtems_tests_DATA = sprmsched01.scn
> > +dist_rtems_tests_DATA += sprmsched01.doc
> > +
> > +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
> > +include $(top_srcdir)/../automake/compile.am
> > +include $(top_srcdir)/../automake/leaf.am
> > +
> > +AM_CPPFLAGS += -I$(top_srcdir)/../support/include
> > +
> > +LINK_OBJS = $(sprmsched01_OBJECTS)
> > +LINK_LIBS = $(sprmsched01_LDLIBS)
> > +
> > +sprmsched01$(EXEEXT): $(sprmsched01_OBJECTS) $(sprmsched01_DEPENDENCIES)
> > +   @rm -f sprmsched01$(EXEEXT)
> > +   $(make-exe)
> > +
> > +include $(top_srcdir)/../automake/local.am
> > diff --git a/testsuites/sptests/sprmsched01/init.c b/testsuites/sptests/
> sprmsched01/init.c
> > new file mode 100644
> > index 000..7fd3e87
> > --- /dev/null
> > +++ b/testsuites/sptests/sprmsched01/init.c
> > @@ -0,0 +1,69 @@
> > +/**
> > + * @file sprmsched01/init.c
> > + *
> > + * @brief A init task body for sprmsched01 example.
> > + *
> > + */
> > +
> > +/*
> > + *  COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
> Please determine whether you hold copyright or your employer
>
> > + *
> > + *  The license and distribution terms for this file may be
> > + *  found in the file LICENSE in this distribution or at
> > + *  http://www.rtems.com/license/LICENSE.
> > + */
> > +
> > +#ifdef HAVE_CONFIG_H
> > +#include "config.h"
> > +#endif
> > +
> > +#define CONFIGURE_INIT
> > +#include "system.h"
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +const char rtems_test_name[] = "Rate Monotonic 01";
> > +
> > +/* Global variables */
> > +rtems_id   Task_id[ 2 ]; /* array of task ids */

[PATCH] EDF scheduler overrun handling example

2016-12-09 Thread Kuan-Hsun Chen
---
 testsuites/sptests/Makefile.am   |   2 +-
 testsuites/sptests/configure.ac  |   1 +
 testsuites/sptests/spedfsched04/Makefile.am  |  21 +
 testsuites/sptests/spedfsched04/init.c   |  70 
 testsuites/sptests/spedfsched04/spedfsched04.doc |  34 
 testsuites/sptests/spedfsched04/spedfsched04.scn |  24 ++
 testsuites/sptests/spedfsched04/system.h |  66 +++
 testsuites/sptests/spedfsched04/tasks.c  | 101 +++
 8 files changed, 318 insertions(+), 1 deletion(-)
 create mode 100644 testsuites/sptests/spedfsched04/Makefile.am
 create mode 100644 testsuites/sptests/spedfsched04/init.c
 create mode 100644 testsuites/sptests/spedfsched04/spedfsched04.doc
 create mode 100644 testsuites/sptests/spedfsched04/spedfsched04.scn
 create mode 100644 testsuites/sptests/spedfsched04/system.h
 create mode 100644 testsuites/sptests/spedfsched04/tasks.c

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 4281abb..c62cbef 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -37,7 +37,7 @@ _SUBDIRS += spfatal29
 _SUBDIRS += spmutex01
 _SUBDIRS += spextensions01
 _SUBDIRS += spsysinit01
-_SUBDIRS += sprmsched01
+_SUBDIRS += sprmsched01 spedfsched04
 if HAS_SMP
 else
 _SUBDIRS += sp29
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 8a55aef..6713754 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -166,6 +166,7 @@ spcoverage/Makefile
 spedfsched01/Makefile
 spedfsched02/Makefile
 spedfsched03/Makefile
+spedfsched04/Makefile
 sperror01/Makefile
 sperror02/Makefile
 sperror03/Makefile
diff --git a/testsuites/sptests/spedfsched04/Makefile.am 
b/testsuites/sptests/spedfsched04/Makefile.am
new file mode 100644
index 000..21293de
--- /dev/null
+++ b/testsuites/sptests/spedfsched04/Makefile.am
@@ -0,0 +1,21 @@
+
+rtems_tests_PROGRAMS = spedfsched04
+spedfsched04_SOURCES = init.c tasks.c system.h
+   
+dist_rtems_tests_DATA = spedfsched04.scn 
+dist_rtems_tests_DATA += spedfsched04.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spedfsched04_OBJECTS)
+LINK_LIBS = $(spedfsched04_LDLIBS)
+
+spedfsched04$(EXEEXT): $(spedfsched04_OBJECTS) $(spedfsched04_DEPENDENCIES)
+   @rm -f spedfsched04$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/spedfsched04/init.c 
b/testsuites/sptests/spedfsched04/init.c
new file mode 100644
index 000..e0847db
--- /dev/null
+++ b/testsuites/sptests/spedfsched04/init.c
@@ -0,0 +1,70 @@
+/**
+ * @file spedfsched04/init.c
+ *
+ * @brief A init task body for spedfsched04 example.
+ *
+ */
+
+/*
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include 
+#include 
+#include 
+
+const char rtems_test_name[] = "SPEDFSCHED 4";
+
+/* Global variables */
+rtems_id   Task_id[ 2 ]; /* array of task ids */
+rtems_name Task_name[ 2 ];   /* array of task names */
+uint32_t tick_per_second;/* time reference */
+int testnumber = 5;  /* stop condition */
+
+rtems_task_priority Prio[3] = {0, 2, 5};
+
+rtems_task Init(
+   rtems_task_argument argument
+)
+{
+  uint32_tindex;
+  TEST_BEGIN();
+  rtems_status_code status;
+
+
+  tick_per_second = rtems_clock_get_ticks_per_second();
+  printf("\nTicks per second in your system: %" PRIu32 "\n", tick_per_second);
+
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+  /* Create two tasks */
+  for ( index = 1; index <= 2; index++ ){
+status = rtems_task_create(
+  Task_name[ index ], Prio[ index ], RTEMS_MINIMUM_STACK_SIZE, 
RTEMS_DEFAULT_MODES,
+  RTEMS_DEFAULT_ATTRIBUTES, _id[ index ]
+);
+directive_failed( status, "rtems_task_create loop" );
+  }
+
+  /* After creating the periods for tasks, start to run them sequencially. */
+  for ( index = 1; index <=2; index++ ){
+status = rtems_task_start( Task_id[ index ], Task_1, index);
+directive_failed( status, "rtems_task_start loop" );
+  }
+
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
diff --git a/testsuites/sptests/spedfsched04/spedfsched04.doc 
b/testsuites/sptests/spedfsched04/spedfsched04.doc
new file mode 100644
index 000..6c34b31
--- /dev/null
+++ b/

[PATCH] RMS scheduler overrun handling example

2016-12-09 Thread Kuan-Hsun Chen
---
 testsuites/sptests/Makefile.am |   2 +
 testsuites/sptests/configure.ac|   1 +
 testsuites/sptests/sprmsched01/Makefile.am |  21 +
 testsuites/sptests/sprmsched01/init.c  |  69 
 testsuites/sptests/sprmsched01/sprmsched01.doc |  33 
 testsuites/sptests/sprmsched01/sprmsched01.scn |  48 
 testsuites/sptests/sprmsched01/system.h|  64 +++
 testsuites/sptests/sprmsched01/tasks.c | 104 +
 8 files changed, 342 insertions(+)
 create mode 100644 testsuites/sptests/sprmsched01/Makefile.am
 create mode 100644 testsuites/sptests/sprmsched01/init.c
 create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.doc
 create mode 100644 testsuites/sptests/sprmsched01/sprmsched01.scn
 create mode 100644 testsuites/sptests/sprmsched01/system.h
 create mode 100644 testsuites/sptests/sprmsched01/tasks.c

diff --git a/testsuites/sptests/Makefile.am b/testsuites/sptests/Makefile.am
index 54a4de7..4281abb 100644
--- a/testsuites/sptests/Makefile.am
+++ b/testsuites/sptests/Makefile.am
@@ -37,6 +37,7 @@ _SUBDIRS += spfatal29
 _SUBDIRS += spmutex01
 _SUBDIRS += spextensions01
 _SUBDIRS += spsysinit01
+_SUBDIRS += sprmsched01
 if HAS_SMP
 else
 _SUBDIRS += sp29
@@ -56,6 +57,7 @@ _SUBDIRS += sptimecounter03
 _SUBDIRS += spatomic01
 _SUBDIRS += spintrcritical22
 _SUBDIRS += spsem03
+_SUBDIRS += spresource01
 _SUBDIRS += spmrsp01
 _SUBDIRS += spscheduler01
 _SUBDIRS += spprofiling01
diff --git a/testsuites/sptests/configure.ac b/testsuites/sptests/configure.ac
index 76d60e3..8a55aef 100644
--- a/testsuites/sptests/configure.ac
+++ b/testsuites/sptests/configure.ac
@@ -255,5 +255,6 @@ sptimer_err02/Makefile
 spcpuset01/Makefile
 spregion_err01/Makefile
 sppartition_err01/Makefile
+sprmsched01/Makefile
 ])
 AC_OUTPUT
diff --git a/testsuites/sptests/sprmsched01/Makefile.am 
b/testsuites/sptests/sprmsched01/Makefile.am
new file mode 100644
index 000..f837b52
--- /dev/null
+++ b/testsuites/sptests/sprmsched01/Makefile.am
@@ -0,0 +1,21 @@
+
+rtems_tests_PROGRAMS = sprmsched01
+sprmsched01_SOURCES = init.c tasks.c system.h
+   
+dist_rtems_tests_DATA = sprmsched01.scn 
+dist_rtems_tests_DATA += sprmsched01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(sprmsched01_OBJECTS)
+LINK_LIBS = $(sprmsched01_LDLIBS)
+
+sprmsched01$(EXEEXT): $(sprmsched01_OBJECTS) $(sprmsched01_DEPENDENCIES)
+   @rm -f sprmsched01$(EXEEXT)
+   $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/sptests/sprmsched01/init.c 
b/testsuites/sptests/sprmsched01/init.c
new file mode 100644
index 000..7fd3e87
--- /dev/null
+++ b/testsuites/sptests/sprmsched01/init.c
@@ -0,0 +1,69 @@
+/**
+ * @file sprmsched01/init.c
+ *
+ * @brief A init task body for sprmsched01 example.
+ *
+ */
+
+/*
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#define CONFIGURE_INIT
+#include "system.h"
+
+#include 
+#include 
+#include 
+
+const char rtems_test_name[] = "Rate Monotonic 01";
+
+/* Global variables */
+rtems_id   Task_id[ 2 ]; /* array of task ids */
+rtems_name Task_name[ 2 ];   /* array of task names */
+uint32_t tick_per_second;/* time reference */
+int testnumber = 11;  /* stop condition */
+
+rtems_task_priority Prio[3] = {0, 2, 5};
+
+rtems_task Init(
+   rtems_task_argument argument
+)
+{
+  rtems_status_code status;
+  TEST_BEGIN();
+
+
+  tick_per_second = rtems_clock_get_ticks_per_second();
+  printf("\nTicks per second in your system: %" PRIu32 "\n", tick_per_second);
+
+  Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
+  Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
+
+  /* Create two tasks */
+  for ( int index = 1; index <= 2; index++){
+status = rtems_task_create(
+  Task_name[ index ], Prio[index], RTEMS_MINIMUM_STACK_SIZE, 
RTEMS_DEFAULT_MODES,
+  RTEMS_DEFAULT_ATTRIBUTES, _id[ index ]
+);
+directive_failed( status, "rtems_task_create loop");
+  }
+
+
+  /* After creating the periods for tasks, start to run them sequencially. */
+  for ( int index = 1; index <= 2; index++){
+status = rtems_task_start( Task_id[ index ], Task_1, index);
+directive_failed( status, "rtems_task_start loop");
+  }
+  status = rtems_task_delete( RTEMS_SELF );
+  directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
+}
+
diff --git a/testsuites/sptests/sprmsched01/sprmsched01.doc 
b/testsuites/sptests/sprms

[PATCH] Update RMS documentation

2016-12-09 Thread Kuan-Hsun Chen
---
 c-user/rate_monotonic_manager.rst | 30 +-
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/c-user/rate_monotonic_manager.rst 
b/c-user/rate_monotonic_manager.rst
index 8ad74e5..292e4bc 100644
--- a/c-user/rate_monotonic_manager.rst
+++ b/c-user/rate_monotonic_manager.rst
@@ -132,7 +132,7 @@ milliseconds every 100 (10 percent of the CPU).  As a 
general rule of thumb,
 the higher frequency at which a task executes, the more important it is to
 optimize that task.
 
-Rate Monotonic Manager Definitions
+Periodicity Definitions
 --
 .. index:: periodic task, definition
 
@@ -170,7 +170,7 @@ Rate Monotonic Scheduling Algorithm
 .. index:: RMS Algorithm, definition
 
 The Rate Monotonic Scheduling Algorithm (RMS) is important to real-time systems
-designers because it allows one to guarantee that a set of tasks is
+designers because it allows one to sufficiently guarantee that a set of tasks 
is
 schedulable.  A set of tasks is said to be schedulable if all of the tasks can
 meet their deadlines.  RMS provides a set of rules which can be used to perform
 a guaranteed schedulability analysis for a task set.  This analysis determines
@@ -179,11 +179,11 @@ the predictability of the system's behavior.  It has been 
proven that:
 
 .. sidebar:: *RMS*
 
-  RMS is an optimal static priority algorithm for scheduling independent,
+  RMS is an optimal fixed-priority algorithm for scheduling independent,
   preemptible, periodic tasks on a single processor.
 
 RMS is optimal in the sense that if a set of tasks can be scheduled by any
-static priority algorithm, then RMS will be able to schedule that task set.
+fixed-priority algorithm, then RMS will be able to schedule that task set.
 RMS bases it schedulability analysis on the processor utilization level below
 which all deadlines can be met.
 
@@ -230,7 +230,7 @@ Schedulability Analysis
 
 .. index:: RMS schedulability analysis
 
-RMS allows application designers to ensure that tasks can meet all deadlines,
+RMS allows application designers to ensure that tasks can meet all deadlines 
under fixed-priority assignment,
 even under transient overload, without knowing exactly when any given task will
 execute by applying proven schedulability analysis rules.
 
@@ -468,9 +468,10 @@ monotonic period results in one of the following scenarios:
   immediately.
 
 - If the rate monotonic period has expired before the task invokes the
-  ``rtems_rate_monotonic_period`` directive, the period will be initiated with
-  a length of period ticks and the calling task returns immediately with a
-  timeout error status.
+  ``rtems_rate_monotonic_period`` directive, the postponed job will be 
released 
+  until there is no more postponed jobs. The calling task returns immediately 
+  with a timeout error status. In the watchdog routine, the period will still 
+  be updated periodically and track the number of the postponed periods.
 
 Obtaining the Status of a Period
 
@@ -560,8 +561,8 @@ Subsequent invocations of the 
``rtems_rate_monotonic_period`` directive will
 result in the task blocking for the remainder of the 100 tick period.  If, for
 any reason, the body of the loop takes more than 100 ticks to execute, the
 ``rtems_rate_monotonic_period`` directive will return the ``RTEMS_TIMEOUT``
-status.  If the above task misses its deadline, it will delete the rate
-monotonic period and itself.
+status and the postponed job will be released.  If the above task misses 
+its deadline, it will delete the rate monotonic period and itself.
 
 Task with Multiple Periods
 --
@@ -629,8 +630,8 @@ will not block.
 
 If, for any reason, the task misses any deadline, the
 ``rtems_rate_monotonic_period`` directive will return the ``RTEMS_TIMEOUT``
-directive status.  If the above task misses its deadline, it will delete the
-rate monotonic periods and itself.
+directive status and the postponed job will be released. If the above task 
misses 
+its deadline, it will delete the rate monotonic periods and itself.
 
 Directives
 ==
@@ -839,7 +840,10 @@ DESCRIPTION:
 period ticks.  If id is running, then the calling task will block for the
 remainder of the period before reinitiating the period with the specified
 period.  If id was not running (either expired or never initiated), the
-period is immediately initiated and the directive returns immediately.
+period is immediately initiated and the directive returns immediately. 
+   If id has expired its period, the postponed job will be released 
immediately 
+   and the following calls of this directive will keep release those 
postponed 
+   jobs until there is no more deadline miss.
 
 If invoked with a period of ``RTEMS_PERIOD_STATUS`` ticks, the current
 state of id will be returned.  The directive status indicates the current
-- 
1.9.1


[PATCH] Enhancement of the RMS manager for the overrun handling.

2016-12-09 Thread Kuan-Hsun Chen
Three additional functions:
RM_Postponed_num, RM_Renew_deadline, and RM_Release_postponedjob.

Four refined functions:
RM_Activate, RM_Block_while_expired, rtems_rate_monotonic_period, RM_Timeout.

Rate_monotonic_Control contains one counter for counting the postponed jobs and 
one for recording the recent deadline.
---
 cpukit/rtems/include/rtems/rtems/ratemon.h |  42 ++--
 cpukit/rtems/include/rtems/rtems/ratemonimpl.h |  25 +++--
 cpukit/rtems/src/ratemonperiod.c   | 144 +
 cpukit/rtems/src/ratemontimeout.c  |  13 ++-
 4 files changed, 183 insertions(+), 41 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/ratemon.h 
b/cpukit/rtems/include/rtems/rtems/ratemon.h
index 50b8478..71a99dc 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemon.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemon.h
@@ -22,6 +22,7 @@
 
 /* COPYRIGHT (c) 1989-2009, 2016.
  * On-Line Applications Research Corporation (OAR).
+ * COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
  *
  * The license and distribution terms for this file may be
  * found in the file LICENSE in this distribution or at
@@ -194,11 +195,6 @@ typedef struct {
   /** This field is the object management portion of a Period instance. */
   Objects_Control Object;
 
-  /**
-   * @brief Protects the rate monotonic period state.
-   */
-  ISR_LOCK_MEMBER(Lock )
-
   /** This is the timer used to provide the unblocking mechanism. */
   Watchdog_ControlTimer;
 
@@ -206,12 +202,6 @@ typedef struct {
   rtems_rate_monotonic_period_states  state;
 
   /**
-   * @brief A priority node for use by the scheduler job release and cancel
-   * operations.
-   */
-  Priority_Node   Priority;
-
-  /**
* This field contains the length of the next period to be
* executed.
*/
@@ -240,6 +230,19 @@ typedef struct {
* This field contains the statistics maintained for the period.
*/
   Rate_monotonic_Statistics   Statistics;
+
+  /**
+   * This field contains the number of postponed jobs. When the watchdog 
timeout, 
+   * this variable will be increased immediately.
+   */
+  uint32_tpostponed_jobs;
+
+  /**
+   *  This field contains the tick of the latest deadline decided by the period
+   *  watchdog. 
+   */
+  uint64_tlatest_deadline;
+
 }   Rate_monotonic_Control;
 
 /**
@@ -386,6 +389,23 @@ void rtems_rate_monotonic_report_statistics_with_plugin(
 void rtems_rate_monotonic_report_statistics( void );
 
 /**
+ * @brief RTEMS Return the number of postponed jobs
+ * 
+ * This is a helper function to return the number of postponed jobs by this
+ * given period. This number is only increased by the corresponding watchdog,
+ * and is decreased by RMS manager with the postponed job releasing.
+ *
+ * @param[in] id is the period id
+ *
+ * @retval This helper function returns the number of postponed 
+ * jobs with given period_id.
+ *
+ */
+uint32_t rtems_rate_monotonic_Postponed_num(
+  rtems_idperiod_id
+);
+
+/**
  * @brief RTEMS Rate Monotonic Period
  *
  * This routine implements the rtems_rate_monotonic_period directive. When
diff --git a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h 
b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
index b6b3ffd..6cdaaeb 100644
--- a/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
+++ b/cpukit/rtems/include/rtems/rtems/ratemonimpl.h
@@ -9,6 +9,7 @@
 /*  COPYRIGHT (c) 1989-2008.
  *  On-Line Applications Research Corporation (OAR).
  *  Copyright (c) 2016 embedded brains GmbH.
+ *  COPYRIGHT (c) 2016 Kuan-Hsun Chen, TU Dortmund University (TUDo).
  *
  *  The license and distribution terms for this file may be
  *  found in the file LICENSE in this distribution or at
@@ -69,19 +70,19 @@ RTEMS_INLINE_ROUTINE Rate_monotonic_Control 
*_Rate_monotonic_Allocate( void )
 }
 
 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Acquire_critical(
-  Rate_monotonic_Control *the_period,
-  ISR_lock_Context   *lock_context
+  Thread_Control   *the_thread,
+  ISR_lock_Context *lock_context
 )
 {
-  _ISR_lock_Acquire( _period->Lock, lock_context );
+  _Thread_Wait_acquire_default_critical( the_thread, lock_context );
 }
 
 RTEMS_INLINE_ROUTINE void _Rate_monotonic_Release(
-  Rate_monotonic_Control *the_period,
-  ISR_lock_Context   *lock_context
+  Thread_Control   *the_thread,
+  ISR_lock_Context *lock_context
 )
 {
-  _ISR_lock_Release_and_ISR_enable( _period->Lock, lock_context );
+  _Thread_Wait_release_default( the_thread, lock_context );
 }
 
 RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get(
@@ -116,6 +117,18 @@ bool _Rate_monotonic_Get_status(
   Timestamp_Control*cpu_since_last_period
 );
 
+/**
+ * @brief Renew the watchdog deadline
+ *
+ * This routine is prepared for the watchdog timeout to renew its deadline
+ * without releasin

Overrun Handling in ticket #2795

2016-10-08 Thread Kuan Hsun Chen
Hello all,

Maybe you have read my mail in us...@rtems.org mailing list.
I make a new ticket in #2795 to replace #2722 with more detail information.
(https://devel.rtems.org/ticket/2795)

This enhancement ticket aims at the overrun issue: When there are deadline
misses, the postponed jobs that should be released are never released to
the system. Moreover, the deadline of postponed jobs is shifted violating
the strictly periodic release pattern.

I believe this ticket could enhance RTEMS to adapt more general task models
for now and build up a basis for the future usage, e.g, soft real-time
task, arbitrary deadline task model, mixed-criticality systems.

I have reviewed FreeRTOS and Litmus-RT to check their implementation as the
references.
Litmus-RT has this feature and FreeRTOS only has the part of the release
pattern alignment.

The detail of the work [1] will be presented in Workshop mixed-criticality
2016 along with RTSS'16 this year.

Please kindly consider my enhancement and let me know what I can do further.

Cheers,
Kuan-Hsun

[1] Chen et al, Overrun Handling for Mixed-Criticality Support in RTEMS,
WMC'16, accepted.

-- 
M.Sc. Kuan-Hsun Chen

TU Dortmund
Department of Computer Science 12
Design Automation of Embedded Systems
Otto-Hahn-Strasse 16, Room 102

44227 Dortmund
Germany

Phone:  *+49 231 755 6124*
Mail:   kuan-hsun.c...@tu-dortmund.de <kuan-hsun.c...@tu-dortmund.de>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel