Re: [PATCH 4/4] SPARC: optimize IRQ enable disable

2014-11-21 Thread Sebastian Huber


On 20/11/14 15:23, Daniel Hellstrom wrote:

On 11/20/2014 03:09 PM, Sebastian Huber wrote:

[...]

The image is a boxplot of all the MaxThreadDispatchDisabledTime samples.


I think this is a nice utility and you seem to be able to update the 
results quickly too. Thanks. Since it is the test-suite you run how 
can we be sure that a test is not badly written, I mean disabling 
interrupts for too long time since the test itself is not testing 
interrupt latencies etc.? Perhaps the mean is most interesting, or 
that some of the max cases should be ignored? Have you analysed the 
worst tests to see where the effects comes from?


Is is very easy to use the XMP reports produced by the test suite.

1. Run the test suite with --enable-profiling and gather all the output 
in one big file.


2. Filter the big file with the filter-test-xml.py which deletes 
everything that doesn't look like XML.


3. Use the XML X Path language to get what you want, for example boxplot.py.

The mean values are not that interesting since the main goal for a 
real-time operating system is to provide a reasonable worst case thread 
dispatch latency.  Attached are the outliers for the two test runs.  I 
didn't analyse every outlier in detail, but most can be explained with 
interrupt processing of the clock tick and some inherent problems of the 
SMP support.


--
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.

#!/usr/bin/python
#
# Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
#
# 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.
#

import sys
import re

print ProfilingCollection

while True:
	line = sys.stdin.readline()
	if not line:
		break
	m = re.match('^\s*pause.*\s*$', line)
	if m:
		continue
	m = re.match('^\s*assocnamebad.*\s*$', line)
	if m:
		continue
	m = re.match('^\s*.*throw this exception.*\s*$', line)
	if m:
		continue
	m = re.match('^(\s*.*)\s*$', line)
	if m:
		print m.group(1)

print /ProfilingCollection
#!/usr/bin/python
#
# Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
#
# 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.
#

import libxml2
from libxml2 import xmlNode
import matplotlib.pyplot as plt

def m(n):
	return [int(n.getContent()), n.get_parent().get_parent().prop(name)]

def getData(name):
	doc = libxml2.parseFile(name)
	ctx = doc.xpathNewContext()
	return map(m, ctx.xpathEval('/ProfilingCollection/ProfilingReport/PerCPUProfilingReport/MaxThreadDispatchDisabledTime'))

def getDataUni(name):
	return [x[0] for x in getData(name) if x[0] != 0 and x[1].find('SMP') == -1]

def getDataSMP(name):
	return [x[0] for x in getData(name) if x[0] != 0 and x[1].find('SMP') != -1]

data = [ \
	getDataUni('tests-ngmp-gr-cpci-xc4v-2014-10-24-d412e2f02596e834dbd5aa8b830dc303e91532c3/tests.xml'), \
	getDataUni('tests-ngmp-gr-cpci-xc4v-next/tests.xml'), \
	getDataSMP('tests-ngmp-gr-cpci-xc4v-2014-10-24-d412e2f02596e834dbd5aa8b830dc303e91532c3/tests.xml'), \
	getDataSMP('tests-ngmp-gr-cpci-xc4v-next/tests.xml'), \
]

labels = ( \
	'45MHz\nNGMP\nStd\nNon-SMP', \
	'45MHz\nNGMP\nOpt\nNon-SMP', \
	'45MHz\nNGMP\nStd\nSMP', \
	'45MHz\nNGMP\nOpt\nSMP', \
)

cmPerInch = 2.54
plt.figure(figsize = (18.0 / cmPerInch, 18.0 / 1.618 / cmPerInch))
plt.boxplot(data, 0, 'rs');
plt.xticks(range(1, len(labels) + 1), labels, fontsize = 5)
plt.ylabel('max thread dispatch disabled time [ns]')
plt.yscale('log')
plt.savefig('max-thread-dispatch-disabled-times-log.png')
plt.savefig('max-thread-dispatch-disabled-times-log.eps')
.Tests with a maximum thread dispatch disabled time greater than 65921ns 
(outliers).
[cols=,,frame=topbot,options=header]
|==
| Test | Maximum thread dispatch disable time [ns]
| SPTLS 2  | 66133
| SMPLOAD 1| 67155
| PSXMSGQ 1| 67377
| SPINTRCRITICAL 8 | 68555
| SMPSCHEDAFFINITY 5   | 69311
| BLOCK 5  | 69866
| FSDOSFSFORMAT 1  | 70644
| CPUUSE   | 73400
| SPINTRCRITICAL 15| 73511
| SMPWAKEAFTER 1   | 73822
| SMPWAKEAFTER 1   | 74133
| SPINTRCRITICAL 7 | 75911
| SP 11| 77933
| SP 4 | 79066
| SPINTRCRITICAL 6 | 8
| SPINTRCRITICAL 10| 81333
| SMPWAKEAFTER 1   | 83977
| SP 69| 84200
| SMPMIGRATION 

Re: [PATCH 2/4] sys/mman.h: New file. Clean up and add supporting stubs

2014-11-21 Thread Thomas Kim
Dear Joel,

I am sorry. please let me know how to download these patch codes(source
code, makefile.am, pre-install.am, etc) for mmap implementation.

At this time, I am modified makefile.am for integrating mmp source code in
 gsoc2011-rtems-mmu-support-project. but, I was failed in building process.


Please advise me.

Best Regards.
Thomas Kim


2014-11-20 11:37 GMT+09:00 Joel Sherrill joel.sherr...@oarcorp.com:



 On November 19, 2014 8:31:46 PM CST, Gedare Bloom ged...@rtems.org
 wrote:
 OK great

 I have an updated version of the patch. Something wasn't right with the
 mskefile that showed up later. Not sure how it built before. :(


 On Wed, Nov 19, 2014 at 5:04 PM, Joel Sherrill
 joel.sherr...@oarcorp.com wrote:
 
  On 11/19/2014 2:55 PM, Gedare Bloom wrote:
  Is this the same one that Chris has had in use before? (I think that
  is who had one in use..)
  Yes. You wanted it in rtems to avoid me having to add a prototype to
 a file
  to avoid a warning.
 
  I didn't integrate his implementation but only his .h file and stubs.
 His
  implementation will need the addition of tests and code in
 confdefs.h.
 
  --joel
 
  -Gedare
 
  On Wed, Nov 19, 2014 at 2:59 PM, Joel Sherrill
  joel.sherr...@oarcorp.com wrote:
  * Makefile.am updated and preinstall.am regenerated.
  * mprotect.c had a prototype removed now that we have
 mman.h
  * mmap.c, munmap.c: New stub files.
  ---
   cpukit/posix/Makefile.am|   5 ++
   cpukit/posix/include/sys/mman.h | 189
 
   cpukit/posix/preinstall.am  |   9 ++
   cpukit/posix/src/mmap.c |  26 ++
   cpukit/posix/src/mprotect.c |  10 +--
   cpukit/posix/src/munmap.c   |  30 +++
   6 files changed, 261 insertions(+), 8 deletions(-)
   create mode 100644 cpukit/posix/include/sys/mman.h
   create mode 100644 cpukit/posix/src/mmap.c
   create mode 100644 cpukit/posix/src/munmap.c
 
  diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
  index 346b65a..b3be07c 100644
  --- a/cpukit/posix/Makefile.am
  +++ b/cpukit/posix/Makefile.am
  @@ -21,6 +21,9 @@ include_rtems_posix_HEADERS +=
 include/rtems/posix/keyimpl.h
   include_rtems_posix_HEADERS += include/rtems/posix/config.h
   include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
 
  +include_sysdir = $(includedir)/sys
  +include_sys_HEADERS = include/sys/mman.h
  +
   if HAS_PTHREADS
   # include
   include_HEADERS = include/aio.h
  @@ -91,7 +94,9 @@ libposix_a_SOURCES += src/cond.c
 src/condattrdestroy.c \
   src/condtimedwait.c src/condwait.c src/condwaitsupp.c
 src/condget.c
 
   ## MEMORY_C_FILES
  +libposix_a_SOURCES += src/mmap.c
   libposix_a_SOURCES += src/mprotect.c
  +libposix_a_SOURCES += src/munmap.c
 
   ## MESSAGE_QUEUE_C_FILES
   libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
  diff --git a/cpukit/posix/include/sys/mman.h
 b/cpukit/posix/include/sys/mman.h
  new file mode 100644
  index 000..ddf34cc
  --- /dev/null
  +++ b/cpukit/posix/include/sys/mman.h
  @@ -0,0 +1,189 @@
  +/* $NetBSD: mman.h,v 1.36 2005/09/13 01:42:51 christos Exp $
 */
  +
  +/*-
  + * Copyright (c) 1982, 1986, 1993
  + * The Regents of the University of California.  All rights
 reserved.
  + *
  + * Redistribution and use in source and binary forms, with or
 without
  + * modification, are permitted provided that the following
 conditions
  + * are met:
  + * 1. Redistributions of source code must retain the above
 copyright
  + *notice, this list of conditions and the following
 disclaimer.
  + * 2. Redistributions in binary form must reproduce the above
 copyright
  + *notice, this list of conditions and the following disclaimer
 in the
  + *documentation and/or other materials provided with the
 distribution.
  + * 3. Neither the name of the University nor the names of its
 contributors
  + *may be used to endorse or promote products derived from this
 software
  + *without specific prior written permission.
  + *
  + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS
 IS'' AND
  + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 TO, THE
  + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 PARTICULAR PURPOSE
  + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS
 BE LIABLE
  + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 CONSEQUENTIAL
  + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 SUBSTITUTE GOODS
  + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 INTERRUPTION)
  + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 CONTRACT, STRICT
  + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 IN ANY WAY
  + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 POSSIBILITY OF
  + * SUCH DAMAGE.
  + *
  + * @(#)mman.h  8.2 (Berkeley) 1/9/95
  + */
  +
  +#ifndef _SYS_MMAN_H_
  +#define _SYS_MMAN_H_
  +
  +#ifdef __rtems__
  +
  +#include 

Re: [PATCH 04/22] dosfs: Avoid MIN() re-definition

2014-11-21 Thread Peter Dufault
I don't like these kind of ifndef tests before defining something because how 
do you know it was defined compatibly?  Granted MIN is well-known so that's 
less likely than other uses of this pattern.

Can the definition be made identical to the other definition to eliminate a 
warning or does GCC still warn about a redefinition?

 On Nov 18, 2014, at 09:37 , Sebastian Huber 
 sebastian.hu...@embedded-brains.de wrote:
 
 ---
 cpukit/libfs/src/dosfs/fat.h | 2 ++
 1 file changed, 2 insertions(+)
 
 diff --git a/cpukit/libfs/src/dosfs/fat.h b/cpukit/libfs/src/dosfs/fat.h
 index 2f0f75f..26f0699 100644
 --- a/cpukit/libfs/src/dosfs/fat.h
 +++ b/cpukit/libfs/src/dosfs/fat.h
 @@ -68,7 +68,9 @@ extern C {
 #define CT_LE_L(v) (v)
 #endif
 
 +#ifndef MIN
 #define MIN(a, b)  (((a)  (b)) ? (a) : (b))
 +#endif
 
 #define FAT_HASH_SIZE   2
 #define FAT_HASH_MODULE FAT_HASH_SIZE
 -- 
 1.8.4.5
 
 ___
 devel mailing list
 devel@rtems.org
 http://lists.rtems.org/mailman/listinfo/devel

Peter
-
Peter Dufault
HD Associates, Inc.  Software and System Engineering

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


Re: [PATCH 04/22] dosfs: Avoid MIN() re-definition

2014-11-21 Thread Sebastian Huber

On 21/11/14 11:26, Peter Dufault wrote:

I don't like these kind of ifndef tests before defining something because how 
do you know it was defined compatibly?  Granted MIN is well-known so that's less likely 
than other uses of this pattern.

Can the definition be made identical to the other definition to eliminate a 
warning or does GCC still warn about a redefinition?


I fixed it this way:

http://git.rtems.org/rtems/commit/?id=11925eef789566a226d8eaacbceb4d89df787ebc

--
Sebastian Huber, embedded brains GmbH

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

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

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


Re: /etc/issue vs /etc/issue.net in shell.c

2014-11-21 Thread Joel Sherrill

On 11/21/2014 1:38 AM, Sebastian Huber wrote:
 On 20/11/14 22:08, Joel Sherrill wrote:
 Hi

 We have different code to process these two files on login.
 Can someone point me to a standard source which says
 what is supposed to be handled in each one?

 Should we really have both paths?

 One is for telnet:

 http://linux.die.net/man/5/issue.net

 One for the normal login:

 http://linux.die.net/man/5/issue

I got that from the code. What standard/RFC/etc. requires that
they be divergent?

-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

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


mmap implementation was Re: [PATCH 2/4] sys/mman.h: New file. Clean up and add supporting stubs

2014-11-21 Thread Joel Sherrill
Chris, Gedate.. please fill in gaps.


On 11/21/2014 4:06 AM, Thomas Kim wrote:
 Dear Joel,

 I am sorry. please let me know how to download these patch
 codes(source code, makefile.am http://makefile.am, pre-install.am
 http://pre-install.am, etc) for mmap implementation.

 At this time, I am modified makefile.am http://makefile.am for
 integrating mmp source code in  gsoc2011-rtems-mmu-support-project.
 but, I was failed in building process.

Gedare should really comment since he mentored that. I took
the sys/mman.h from one of Chris' projects. But I can't
find it this morning.

I recall the GSoC project ended up working on MMU framework
and some target support. There was a lot of infrastructure work
to begin to think about mmap().

Chris has an implementation of some of the capabilities but I don't
recall which git repo. I thought about merging that code but it
doesn't have tests, documentation or confdefs.h support so just
brought over the header and added stubs.

 Please advise me.

 Best Regards.
 Thomas Kim


 2014-11-20 11:37 GMT+09:00 Joel Sherrill joel.sherr...@oarcorp.com
 mailto:joel.sherr...@oarcorp.com:



 On November 19, 2014 8:31:46 PM CST, Gedare Bloom
 ged...@rtems.org mailto:ged...@rtems.org wrote:
 OK great

 I have an updated version of the patch. Something wasn't right
 with the mskefile that showed up later. Not sure how it built
 before. :(


 On Wed, Nov 19, 2014 at 5:04 PM, Joel Sherrill
 joel.sherr...@oarcorp.com mailto:joel.sherr...@oarcorp.com wrote:
 
  On 11/19/2014 2:55 PM, Gedare Bloom wrote:
  Is this the same one that Chris has had in use before? (I
 think that
  is who had one in use..)
  Yes. You wanted it in rtems to avoid me having to add a
 prototype to
 a file
  to avoid a warning.
 
  I didn't integrate his implementation but only his .h file and
 stubs.
 His
  implementation will need the addition of tests and code in
 confdefs.h.
 
  --joel
 
  -Gedare
 
  On Wed, Nov 19, 2014 at 2:59 PM, Joel Sherrill
  joel.sherr...@oarcorp.com mailto:joel.sherr...@oarcorp.com
 wrote:
  * Makefile.am updated and preinstall.am
 http://preinstall.am regenerated.
  * mprotect.c had a prototype removed now that we have
 mman.h
  * mmap.c, munmap.c: New stub files.
  ---
   cpukit/posix/Makefile.am|   5 ++
   cpukit/posix/include/sys/mman.h | 189
 
   cpukit/posix/preinstall.am http://preinstall.am  |   9 ++
   cpukit/posix/src/mmap.c |  26 ++
   cpukit/posix/src/mprotect.c |  10 +--
   cpukit/posix/src/munmap.c   |  30 +++
   6 files changed, 261 insertions(+), 8 deletions(-)
   create mode 100644 cpukit/posix/include/sys/mman.h
   create mode 100644 cpukit/posix/src/mmap.c
   create mode 100644 cpukit/posix/src/munmap.c
 
  diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am
  index 346b65a..b3be07c 100644
  --- a/cpukit/posix/Makefile.am
  +++ b/cpukit/posix/Makefile.am
  @@ -21,6 +21,9 @@ include_rtems_posix_HEADERS +=
 include/rtems/posix/keyimpl.h
   include_rtems_posix_HEADERS += include/rtems/posix/config.h
   include_rtems_posix_HEADERS += include/rtems/posix/posixapi.h
 
  +include_sysdir = $(includedir)/sys
  +include_sys_HEADERS = include/sys/mman.h
  +
   if HAS_PTHREADS
   # include
   include_HEADERS = include/aio.h
  @@ -91,7 +94,9 @@ libposix_a_SOURCES += src/cond.c
 src/condattrdestroy.c \
   src/condtimedwait.c src/condwait.c src/condwaitsupp.c
 src/condget.c
 
   ## MEMORY_C_FILES
  +libposix_a_SOURCES += src/mmap.c
   libposix_a_SOURCES += src/mprotect.c
  +libposix_a_SOURCES += src/munmap.c
 
   ## MESSAGE_QUEUE_C_FILES
   libposix_a_SOURCES += src/mqueue.c src/mqueueclose.c \
  diff --git a/cpukit/posix/include/sys/mman.h
 b/cpukit/posix/include/sys/mman.h
  new file mode 100644
  index 000..ddf34cc
  --- /dev/null
  +++ b/cpukit/posix/include/sys/mman.h
  @@ -0,0 +1,189 @@
  +/* $NetBSD: mman.h,v 1.36 2005/09/13 01:42:51 christos Exp $
 */
  +
  +/*-
  + * Copyright (c) 1982, 1986, 1993
  + * The Regents of the University of California.  All rights
 reserved.
  + *
  + * Redistribution and use in source and binary forms, with or
 without
  + * modification, are permitted provided that the following
 conditions
  + * are met:
  + * 1. Redistributions of source code must retain the above
 copyright
  + *notice, this list of conditions and the following
 disclaimer.
  + * 2. Redistributions in binary form must reproduce the above
 copyright
  + *notice, this list of conditions and the following
 disclaimer
 in 

[PATCH] smp: Fix scheduler helping protocol

2014-11-21 Thread Sebastian Huber
From: Luca Bonato loha...@gmail.com

New test case for smptests/smpmrsp01.

It possible that a state change from SCHEDULER_SMP_NODE_READY to
SCHEDULER_SMP_NODE_READY can happen.
---
 cpukit/score/include/rtems/score/schedulerimpl.h   |  28 ++--
 .../score/include/rtems/score/schedulersmpimpl.h   |  25 ++-
 testsuites/smptests/smpmrsp01/init.c   | 174 +
 testsuites/smptests/smpmrsp01/smpmrsp01.scn|   1 +
 4 files changed, 210 insertions(+), 18 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h 
b/cpukit/score/include/rtems/score/schedulerimpl.h
index 45a2f8d..b262b91 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -1081,6 +1081,7 @@ RTEMS_INLINE_ROUTINE Thread_Control 
*_Scheduler_Release_idle_thread(
  */
 RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node(
   Scheduler_Context *context,
+  Thread_Control*thread,
   Scheduler_Node*node,
   bool   is_scheduled,
   Scheduler_Get_idle_thread  get_idle_thread
@@ -1088,25 +1089,24 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node(
 {
   bool block;
   Thread_Control *old_user = _Scheduler_Node_get_user( node );
-  Thread_Control *new_user;
+  Thread_Control *new_user = NULL;
 
   _Scheduler_Thread_change_state( old_user, THREAD_SCHEDULER_BLOCKED );
 
-  if ( node-help_state == SCHEDULER_HELP_ACTIVE_RIVAL ) {
-new_user = _Scheduler_Node_get_owner( node );
-
-_Assert( new_user != old_user );
-_Scheduler_Node_set_user( node, new_user );
-  } else if (
-node-help_state == SCHEDULER_HELP_ACTIVE_OWNER
-   is_scheduled
-  ) {
-new_user = _Scheduler_Use_idle_thread( context, node, get_idle_thread );
-  } else {
-new_user = NULL;
+  if ( is_scheduled ) {
+if ( node-help_state == SCHEDULER_HELP_ACTIVE_OWNER ) {
+  new_user = _Scheduler_Use_idle_thread( context, node, get_idle_thread );
+} else if ( node-help_state == SCHEDULER_HELP_ACTIVE_RIVAL ) {
+  Thread_Control *owner = _Scheduler_Node_get_owner( node );
+
+  if ( thread == old_user  owner != old_user ) {
+new_user = owner;
+_Scheduler_Node_set_user( node, new_user );
+  }
+}
   }
 
-  if ( new_user != NULL  is_scheduled ) {
+  if ( new_user != NULL ) {
 Per_CPU_Control *cpu = _Thread_Get_CPU( old_user );
 
 _Scheduler_Thread_change_state( new_user, THREAD_SCHEDULER_SCHEDULED );
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h 
b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 156307d..0ddfce0 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -793,13 +793,17 @@ static inline void _Scheduler_SMP_Block(
 {
   Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread );
   bool is_scheduled = node-state == SCHEDULER_SMP_NODE_SCHEDULED;
-  bool block = _Scheduler_Block_node(
+  bool block;
+
+  _Assert( is_scheduled || node-state == SCHEDULER_SMP_NODE_READY );
+
+  block = _Scheduler_Block_node(
 context,
+thread,
 node-Base,
 is_scheduled,
 _Scheduler_SMP_Get_idle_thread
   );
-
   if ( block ) {
 _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
 
@@ -838,9 +842,22 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
   Thread_Control *needs_help;
 
   if ( unblock ) {
-_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
+if ( node-state != SCHEDULER_SMP_NODE_READY ) {
+  _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
+
+  needs_help = ( *enqueue_fifo )( context, node-Base, thread );
+} else {
+  _Assert( node-state == SCHEDULER_SMP_NODE_READY );
+  _Assert( node-Base.idle == NULL );
 
-needs_help = ( *enqueue_fifo )( context, node-Base, thread );
+  if ( node-Base.accepts_help == thread ) {
+_Assert( node-Base.help_state == SCHEDULER_HELP_ACTIVE_OWNER );
+needs_help = thread;
+  } else {
+_Assert( node-Base.help_state == SCHEDULER_HELP_ACTIVE_RIVAL );
+needs_help = NULL;
+  }
+}
   } else {
 needs_help = NULL;
   }
diff --git a/testsuites/smptests/smpmrsp01/init.c 
b/testsuites/smptests/smpmrsp01/init.c
index bfa5d98..f6a98e2 100644
--- a/testsuites/smptests/smpmrsp01/init.c
+++ b/testsuites/smptests/smpmrsp01/init.c
@@ -54,6 +54,7 @@ typedef struct {
 typedef struct {
   rtems_id main_task_id;
   rtems_id migration_task_id;
+  rtems_id high_task_id;
   rtems_id counting_sem_id;
   rtems_id mrsp_ids[MRSP_COUNT];
   rtems_id scheduler_ids[CPU_COUNT];
@@ -66,6 +67,7 @@ typedef struct {
   SMP_lock_Control switch_lock;
   size_t switch_index;
   switch_event switch_events[32];
+  volatile bool run;
 } test_context;
 
 static test_context test_instance = {
@@ -728,6 +730,177 @@ static void run_task(rtems_task_argument arg)
   }
 }
 
+static void ready_unlock_worker(rtems_task_argument 

Re: [PATCH] smp: Fix scheduler helping protocol

2014-11-21 Thread Joel Sherrill

On 11/21/2014 10:07 AM, Sebastian Huber wrote:
 From: Luca Bonato loha...@gmail.com

 New test case for smptests/smpmrsp01.

 It possible that a state change from SCHEDULER_SMP_NODE_READY to
 SCHEDULER_SMP_NODE_READY can happen.
Fix English.

How about a short description of the scenario this is addressing?
 ---
  cpukit/score/include/rtems/score/schedulerimpl.h   |  28 ++--
  .../score/include/rtems/score/schedulersmpimpl.h   |  25 ++-
  testsuites/smptests/smpmrsp01/init.c   | 174 
 +
  testsuites/smptests/smpmrsp01/smpmrsp01.scn|   1 +
  4 files changed, 210 insertions(+), 18 deletions(-)

 diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h 
 b/cpukit/score/include/rtems/score/schedulerimpl.h
 index 45a2f8d..b262b91 100644
 --- a/cpukit/score/include/rtems/score/schedulerimpl.h
 +++ b/cpukit/score/include/rtems/score/schedulerimpl.h
 @@ -1081,6 +1081,7 @@ RTEMS_INLINE_ROUTINE Thread_Control 
 *_Scheduler_Release_idle_thread(
   */
  RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node(
Scheduler_Context *context,
 +  Thread_Control*thread,
Scheduler_Node*node,
bool   is_scheduled,
Scheduler_Get_idle_thread  get_idle_thread
 @@ -1088,25 +1089,24 @@ RTEMS_INLINE_ROUTINE bool _Scheduler_Block_node(
  {
bool block;
Thread_Control *old_user = _Scheduler_Node_get_user( node );
 -  Thread_Control *new_user;
 +  Thread_Control *new_user = NULL;
  
_Scheduler_Thread_change_state( old_user, THREAD_SCHEDULER_BLOCKED );
  
 -  if ( node-help_state == SCHEDULER_HELP_ACTIVE_RIVAL ) {
 -new_user = _Scheduler_Node_get_owner( node );
 -
 -_Assert( new_user != old_user );
 -_Scheduler_Node_set_user( node, new_user );
 -  } else if (
 -node-help_state == SCHEDULER_HELP_ACTIVE_OWNER
 -   is_scheduled
 -  ) {
 -new_user = _Scheduler_Use_idle_thread( context, node, get_idle_thread );
 -  } else {
 -new_user = NULL;
 +  if ( is_scheduled ) {
 +if ( node-help_state == SCHEDULER_HELP_ACTIVE_OWNER ) {
 +  new_user = _Scheduler_Use_idle_thread( context, node, get_idle_thread 
 );
 +} else if ( node-help_state == SCHEDULER_HELP_ACTIVE_RIVAL ) {
 +  Thread_Control *owner = _Scheduler_Node_get_owner( node );
 +
 +  if ( thread == old_user  owner != old_user ) {
 +new_user = owner;
 +_Scheduler_Node_set_user( node, new_user );
 +  }
 +}
}
  
 -  if ( new_user != NULL  is_scheduled ) {
 +  if ( new_user != NULL ) {
  Per_CPU_Control *cpu = _Thread_Get_CPU( old_user );
  
  _Scheduler_Thread_change_state( new_user, THREAD_SCHEDULER_SCHEDULED );
 diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h 
 b/cpukit/score/include/rtems/score/schedulersmpimpl.h
 index 156307d..0ddfce0 100644
 --- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
 +++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
 @@ -793,13 +793,17 @@ static inline void _Scheduler_SMP_Block(
  {
Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread );
bool is_scheduled = node-state == SCHEDULER_SMP_NODE_SCHEDULED;
 -  bool block = _Scheduler_Block_node(
 +  bool block;
 +
 +  _Assert( is_scheduled || node-state == SCHEDULER_SMP_NODE_READY );
 +
 +  block = _Scheduler_Block_node(
  context,
 +thread,
  node-Base,
  is_scheduled,
  _Scheduler_SMP_Get_idle_thread
);
 -
if ( block ) {
  _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
  
 @@ -838,9 +842,22 @@ static inline Thread_Control *_Scheduler_SMP_Unblock(
Thread_Control *needs_help;
  
if ( unblock ) {
 -_Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
 +if ( node-state != SCHEDULER_SMP_NODE_READY ) {
 +  _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
 +
 +  needs_help = ( *enqueue_fifo )( context, node-Base, thread );
 +} else {
 +  _Assert( node-state == SCHEDULER_SMP_NODE_READY );
 +  _Assert( node-Base.idle == NULL );
  
 -needs_help = ( *enqueue_fifo )( context, node-Base, thread );
 +  if ( node-Base.accepts_help == thread ) {
 +_Assert( node-Base.help_state == SCHEDULER_HELP_ACTIVE_OWNER );
 +needs_help = thread;
 +  } else {
 +_Assert( node-Base.help_state == SCHEDULER_HELP_ACTIVE_RIVAL );
 +needs_help = NULL;
 +  }
 +}
} else {
  needs_help = NULL;
}
 diff --git a/testsuites/smptests/smpmrsp01/init.c 
 b/testsuites/smptests/smpmrsp01/init.c
 index bfa5d98..f6a98e2 100644
 --- a/testsuites/smptests/smpmrsp01/init.c
 +++ b/testsuites/smptests/smpmrsp01/init.c
 @@ -54,6 +54,7 @@ typedef struct {
  typedef struct {
rtems_id main_task_id;
rtems_id migration_task_id;
 +  rtems_id high_task_id;
rtems_id counting_sem_id;
rtems_id mrsp_ids[MRSP_COUNT];
rtems_id scheduler_ids[CPU_COUNT];
 @@ -66,6 +67,7 @@ typedef struct {
SMP_lock_Control switch_lock;

nios tools build failure

2014-11-21 Thread Joel Sherrill
Hi

Patch doesn't apply. I am guessing it isn't needed with 4.9.2 anymore.

 cd gcc-4.9.2
+ /bin/chmod -R a+rX,g-w,o-w .
+ /bin/cat
/users/joel/rtems-4.11-work/rtems-source-builder/rtems/patches/RTEMS-Add-Nios-2-support.patch
+ /usr/bin/patch -p1
patching file gcc/config.gcc
Hunk #1 succeeded at 2165 with fuzz 2 (offset 9 lines).
The next patch would create the file gcc/config/nios2/rtems.h,
which already exists!  Assume -R? [n]
Apply anyway? [n]
Skipping patch.
1 out of 1 hunk ignored
The next patch would create the file gcc/config/nios2/t-rtems,
which already exists!  Assume -R? [n]
Apply anyway? [n]

-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

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


RTEMS Open Classes in 2015

2014-11-21 Thread Joel Sherrill
Hi

The currently scheduled training sessions are:

  * January 25 - 30, 2015 in Huntsville Alabama.
  o For further information, visit the OAR RTEMS Training page
http://www.rtems.com/trainingschedule.
  o Kick Start - Janurary 25, 2015 (Monday) in Huntsville Alabama:
For information and the registration form, visit the Kick Start
Training page http://www.rtems.com/kickstart.
  o Open Class - Janurary 26 - 30, 2015 (Tuesday - Friday) in
Huntsville Alabama. For information and the registration form,
visit the Open Class Training page http://www.rtems.com/openclass.
  o To express interest in dates in Huntsville or to host a class at
your company, please submit an inquiry on the Contact Page
http://www.rtems.com/contact.
  * (tentative) April 21 - 24, 2015 in Munich Germany.
  o For information and registration, visit the embedded Brains
RTEMS Training page

http://www.embedded-brains.de/en/rtems-real-time-operating-system/rtems-training-courses/.

If you are interested in other dates in 2015, feel free to ask me.

-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

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

[PATCH] 4.11/rtems-nios2.bset: Drop patch adding RTEMS target

2014-11-21 Thread Joel Sherrill
---
 rtems/config/4.11/rtems-nios2.bset | 8 
 1 file changed, 8 deletions(-)

diff --git a/rtems/config/4.11/rtems-nios2.bset 
b/rtems/config/4.11/rtems-nios2.bset
index 41e6a12..ed76eac 100644
--- a/rtems/config/4.11/rtems-nios2.bset
+++ b/rtems/config/4.11/rtems-nios2.bset
@@ -1,8 +1,6 @@
 #
 # Tools Set for RTEMS NIOS 4.11 Stable
 #
-# The NIOS source is a special version released by Altera.
-#
 
 %define release 1
 
@@ -14,12 +12,6 @@
 %include rtems-4.11-base.bset
 
 #
-# Add support for Cortex-M4 and Cortex-R based chips
-#
-%patch add gcc 
pw://patchwork.ozlabs.org/patch/364504/raw/RTEMS-Add-Nios-2-support.patch
-%hash  md5 RTEMS-Add-Nios-2-support.patch fd9bbc8482e69623214e2a4289e38d8f
-
-#
 # Tools configuration.
 #
 4.11/rtems-autotools
-- 
1.9.3

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


anyone else see sparc-rtems4.11 not building with RSB

2014-11-21 Thread Joel Sherrill
Hi

RSB report has:

make[1]: Leaving directory
`/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build'
make: *** [all] Error 2
shell cmd failed: /bin/sh -ex 
/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/doit
error: building sparc-rtems4.11-gdb-7.7-1

Make ends with this:

config.status: creating gdb.xml/Makefile
make[2]: Entering directory
`/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim'
make[3]: Entering directory
`/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim/erc32'
make[3]: *** No targets specified and no makefile found.  Stop.
make[3]: Leaving directory
`/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim/erc32'
make[2]: *** [all] Error 1
make[2]: Leaving directory
`/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim'
make[1]: *** [all-sim] Error 2
make[1]: Leaving directory
`/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build'


-- 
Joel Sherrill, Ph.D. Director of Research  Development
joel.sherr...@oarcorp.comOn-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available(256) 722-9985

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


Re: anyone else see sparc-rtems4.11 not building with RSB

2014-11-21 Thread Gedare Bloom
I built a toolchain yesterday for sparc32. Check the build-log for the
error message, the tail of the make is insufficient information.

On Fri, Nov 21, 2014 at 1:53 PM, Joel Sherrill
joel.sherr...@oarcorp.com wrote:
 Hi

 RSB report has:

 make[1]: Leaving directory
 `/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build'
 make: *** [all] Error 2
 shell cmd failed: /bin/sh -ex
 /users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/doit
 error: building sparc-rtems4.11-gdb-7.7-1

 Make ends with this:

 config.status: creating gdb.xml/Makefile
 make[2]: Entering directory
 `/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim'
 make[3]: Entering directory
 `/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim/erc32'
 make[3]: *** No targets specified and no makefile found.  Stop.
 make[3]: Leaving directory
 `/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim/erc32'
 make[2]: *** [all] Error 1
 make[2]: Leaving directory
 `/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build/sim'
 make[1]: *** [all-sim] Error 2
 make[1]: Leaving directory
 `/users/joel/rtems-4.11-work/rtems-source-builder/rtems/build/sparc-rtems4.11-gdb-7.7-1/build'


 --
 Joel Sherrill, Ph.D. Director of Research  Development
 joel.sherr...@oarcorp.comOn-Line Applications Research
 Ask me about RTEMS: a free RTOS  Huntsville AL 35805
 Support Available(256) 722-9985

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


Re: [PATCH] 4.11/rtems-nios2.bset: Drop patch adding RTEMS target

2014-11-21 Thread Chris Johns

On 22/11/2014 5:49 am, Joel Sherrill wrote:

---
  rtems/config/4.11/rtems-nios2.bset | 8 
  1 file changed, 8 deletions(-)



Ok to push.

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


Re: moxie tools fails - dtc not available

2014-11-21 Thread Chris Johns

On 22/11/2014 3:32 am, Joel Sherrill wrote:


On 11/21/2014 10:17 AM, Joel Sherrill wrote:

http://www.jdl.com/software/dtc-v1.2.0.tgz is no longer available
and the download fails. The site appears to be dead.

Any ideas where to fetch it from?


http://www.devicetree.org/Device_Tree_Compiler points you to
https://git.kernel.org/cgit/utils/dtc/dtc.git and they have bumped
the version up to 1.4.1.

Should the RSB be changed?



Sure.

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


Re: mmap implementation was Re: [PATCH 2/4] sys/mman.h: New file. Clean up and add supporting stubs

2014-11-21 Thread Chris Johns

On 22/11/2014 2:09 am, Joel Sherrill wrote:

Chris has an implementation of some of the capabilities but I don't
recall which git repo. I thought about merging that code but it
doesn't have tests, documentation or confdefs.h support so just
brought over the header and added stubs.


The repo is http://git.rtems.org/chrisj/rtl.git/tree/.

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


Re: [rtems commit] bsps/arm: Enable L2C for Cortex-A9 MPCore BSPs

2014-11-21 Thread Chris Johns

On 21/11/2014 6:31 pm, Sebastian Huber wrote:


On 21/11/14 06:10, Chris Johns wrote:

On 21/11/2014 12:53 am, Sebastian Huber wrote:

Module:rtems
Branch:master
Commit:50440c065e247899ee739d56cb1392c259289031
Changeset:
http://git.rtems.org/rtems/commit/?id=50440c065e247899ee739d56cb1392c259289031


Author:Sebastian Huber sebastian.hu...@embedded-brains.de
Date:  Wed Nov 19 15:30:24 2014 +0100

bsps/arm: Enable L2C for Cortex-A9 MPCore BSPs

---

+RTEMS_BSPOPTS_SET([BSP_DATA_CACHE_ENABLED],[*],[1])
+RTEMS_BSPOPTS_HELP([BSP_DATA_CACHE_ENABLED],[enable data cache])
+
+RTEMS_BSPOPTS_SET([BSP_INSTRUCTION_CACHE_ENABLED],[*],[1])
+RTEMS_BSPOPTS_HELP([BSP_INSTRUCTION_CACHE_ENABLED],[enable
instruction cache])
+


To disable I provide configure with:

 BSP_DATA_CACHE_ENABLED=0 BSP_INSTRUCTION_CACHE_ENABLED=0

however this:


+#if defined(BSP_DATA_CACHE_ENABLED) ||
defined(BSP_INSTRUCTION_CACHE_ENABLED)
+/* Enable unified L2 cache */
+rtems_cache_enable_data();
+#endif


and this:


+#if !defined(RTEMS_SMP) \
+   (defined(BSP_DATA_CACHE_ENABLED) \
+|| defined(BSP_INSTRUCTION_CACHE_ENABLED))
+  /* Enable unified L2 cache */
+  rtems_cache_enable_data();
+#endif


only check for defined and it is always defined. These should check
for the value only ie:

#if BSP_DATA_CACHE_ENABLED || BSP_INSTRUCTION_CACHE_ENABLED

?


You should use

BSP_DATA_CACHE_ENABLED= BSP_INSTRUCTION_CACHE_ENABLED=

for the configure.



Urrr bletch sure if I have to. This is the first I have ever heard of 
doing this and it is confusing because the configure.ac code uses the 
value '1' and for me that implied a value of '0' had the opposite 
effect. I seem to remember other opts such as the reset one in the PC 
BSP taking 1 or 0.


My preference these days is not to rely on 'defined()' tests. It avoids 
this type of error and the code reads much better.




This is not the only case of BSPOPTS'less'ness we have in RTEMS but
this one is an issue for me. Have I told you recently how much I
dislike the BSPOPTS support.


Yes, I know, but what is the alternative?  These defines are already
used for a lot of PowerPC BSPs and I don't think it is good to invent
yet another solution for the same problem on ARM.


I am not suggesting we change anything with this build system. I am 
suggesting we need to address this issue in 5.0 and a new build system 
and my concern is the mixed use of defined() and/or value testing in the 
code base. We need one consistent method and BSPOPTS has no structure 
and so the code has no formal approach and it is confusing to users 
because you need to check all references to see what it actually means. 
It is ok if you wrote the code but if you have not it is a slog to 
figure it all out.


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


Re: mmap implementation was Re: [PATCH 2/4] sys/mman.h: New file. Clean up and add supporting stubs

2014-11-21 Thread Gedare Bloom
On Fri, Nov 21, 2014 at 10:09 AM, Joel Sherrill
joel.sherr...@oarcorp.com wrote:
 Chris, Gedate.. please fill in gaps.


 On 11/21/2014 4:06 AM, Thomas Kim wrote:

 Dear Joel,

 I am sorry. please let me know how to download these patch codes(source
 code, makefile.am, pre-install.am, etc) for mmap implementation.

 At this time, I am modified makefile.am for integrating mmp source code in
 gsoc2011-rtems-mmu-support-project. but, I was failed in building process.

 Gedare should really comment since he mentored that. I took
 the sys/mman.h from one of Chris' projects. But I can't
 find it this morning.

 I recall the GSoC project ended up working on MMU framework
 and some target support. There was a lot of infrastructure work
 to begin to think about mmap().

Yes, that GSoC wound up unmergeable due to insufficient framework,
thus the effort to focus on BSP-layers first. Thomas Kim, if you are
interested in working on the mmu-support, it might help to give us
some idea about your goals or purpose.

I made some changes in the gsoc-mmu repo to try to add initial support
for sparc64, but I gave up at some point.
(https://code.google.com/p/gsoc2011-rtems-mmu-support-project/source/list)

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