Re: Introduction of Priority_node structure (priority.h)

2020-05-11 Thread Sebastian Huber

Hello Heinz,

On 11/05/2020 10:54, Heinz Junkes wrote:

The Priority_node structure was committed to the 4.10 branch of RTEMS in 
December
2017 (78b867e26d score: replace current and real priority with priority node).

Do I have a possibility to know at  compile time (in our case  EPICS) if it is 
present or not.


unfortunately the RTEMS 10 release branch reports the same revision 
number (__RTEMS_REVISION__) as the 4.10.2 release. Do you want to use 
the branch? With a 4.10.3 release, the __RTEMS_REVISION__ would change to 3.


Independent of this, accessing internal data of the score always can 
case problems. If a certain information is important for you, then it 
would be better in the long run to add an API for this to RTEMS which is 
documented and tested.


For example, pthread_getschedparam() returns the real priority.

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


Re: Introduction of Priority_node structure (priority.h)

2020-05-11 Thread Gedare Bloom
On Mon, May 11, 2020 at 9:27 AM Gedare Bloom  wrote:
>
> On Mon, May 11, 2020 at 2:54 AM Heinz Junkes  wrote:
> >
> > The Priority_node structure was committed to the 4.10 branch of RTEMS in 
> > December
> > 2017 (78b867e26d score: replace current and real priority with priority 
> > node).
> >
> > Do I have a possibility to know at  compile time (in our case  EPICS) if it 
> > is present or not.
> >
> > Background:
> > We had received the following bug report:
> >
> > > On 1/16/19 2:51 PM, Michael Westfall via Tech-talk wrote:
> > >> When compiling base R3.14.12.7 for RTEMS 4.10.2, I get the following 
> > >> error:
> > >>
> > >> /gem_swdev1/targetOS/RTEMS/rtems-4.10/bin/powerpc-rtems4.10-gcc --pipe 
> > >> -B/gem_swdev1/targetOS/RTEMS/rtems-4.10/powerpc-rtems4.10/beatnik/lib/ 
> > >> -specs bsp_specs -qrtems   -fasm -c   -mcpu=7400 -D__ppc_generic 
> > >>   -DUNIX  -O2 -g -g   -Wall   -DMY_DO_BOOTP=NULL 
> > >> -DHAVE_MOTLOAD -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048 
> > >> -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120 -MMD -I. -I../O.Common -I. 
> > >> -I../../../src/libCom/osi/os/RTEMS -I../../../src/libCom/osi/os/posix 
> > >> -I../../../src/libCom/osi/os/default -I.. 
> > >> -I../../../src/libCom/bucketLib -I../../../src/libCom/ring 
> > >> -I../../../src/libCom/calc -I../../../src/libCom/cvtFast 
> > >> -I../../../src/libCom/cppStd -I../../../src/libCom/cxxTemplates 
> > >> -I../../../src/libCom/dbmf -I../../../src/libCom/ellLib 
> > >> -I../../../src/libCom/env -I../../../src/libCom/error 
> > >> -I../../../src/libCom/fdmgr -I../../../src/libCom/freeList 
> > >> -I../../../src/libCom/gpHash -I../../../src/libCom/iocsh 
> > >> -I../../../src/libCom/logClient -I../../../src/libCom/macLib -I../
 ../../src/libCom/misc -I../../../src/libCom/osi -I../../../src/libCom/taskwd 
-I../../../src/libCom/timer -I../../../src/libCom/tsDefs 
-I/gem_swdev1/epics/R3.14.12.7/base/include/os/RTEMS 
-I/gem_swdev1/epics/R3.14.12.7/base/include 
../../../src/libCom/osi/os/RTEMS/osdThread.c
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c: In function 
> > >> 'showInternalTaskInfo':
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:617: error: 
> > >> 'Thread_Control' has no member named 'real_priority'
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:624: error: 
> > >> 'Thread_Control' has no member named 'current_priority'
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:624: error: 
> > >> 'Thread_Control' has no member named 'real_priority'
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:625: error: 
> > >> 'Thread_Control' has no member named 'current_priority'
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:627: error: 
> > >> 'Thread_Control' has no member named 'real_priority'
> > >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:627: error: 
> > >> 'Thread_Control' has no member named 'current_priority'
> > >> make[3]: *** [osdThread.o] Error 1
> > >> make[3]: Leaving directory 
> > >> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src/libCom/O.RTEMS-beatnik'
> > >> make[2]: *** [install.RTEMS-beatnik] Error 2
> > >> make[2]: Leaving directory 
> > >> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src/libCom'
> > >> make[1]: *** [libCom.install] Error 2
> > >> make[1]: Leaving directory 
> > >> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src'
> > >> make: *** [src.install] Error 2
> >
> > I fixed it with this patch:
> > > diff --git a/modules/libcom/src/osi/os/RTEMS/osdThread.c 
> > > b/modules/libcom/src/osi/os/RTEMS/osdThread.c
> > > index 769e958..2db1ca5 100644
> > > --- a/modules/libcom/src/osi/os/RTEMS/osdThread.c
> > > +++ b/modules/libcom/src/osi/os/RTEMS/osdThread.c
> > > @@ -640,17 +640,17 @@ showInternalTaskInfo (rtems_id tid)
> > >   * that priority should be displayed, not the value truncated to
> > >   * the EPICS range.
> > >   */
> > > -epicsPri = 199-thread.real_priority;
> > > +epicsPri = 199-thread.Priority_node.real_priority;
> > >  if (epicsPri < 0)
> > >  fprintf(epicsGetStdout(),"   <0");
> > >  else if (epicsPri > 99)
> > >  fprintf(epicsGetStdout(),"  >99");
> > >  else
> > >  fprintf(epicsGetStdout()," %4d", epicsPri);
> > > -if (thread.current_priority == thread.real_priority)
> > > -fprintf(epicsGetStdout(),"%4d", 
> > > (int)thread.current_priority);
> > > +if (thread.Priority_node.current_priority == 
> > > thread.Priority_node.real_priority)
> > > +fprintf(epicsGetStdout(),"%4d", 
> > > (int)thread.Priority_node.current_priority);
> > >  else
> > > -fprintf(epicsGetStdout(),"%4d/%-3d", (int)thread.real_priority, 
> > > (int)thread.current_priority);
> > > +fprintf(epicsGetStdout(),"%4d/%-3d", 
> > > (int)thread.Priority_node.real_priority, 
> > > (int)thread.Priority_node.current_priority);
> > >  showBitmap (bitbuf, thread.current_state, taskState);
> > >  fprintf(epicsGetStdout(),"%8.8s", bitbuf);
> 

Re: Introduction of Priority_node structure (priority.h)

2020-05-11 Thread Gedare Bloom
On Mon, May 11, 2020 at 2:54 AM Heinz Junkes  wrote:
>
> The Priority_node structure was committed to the 4.10 branch of RTEMS in 
> December
> 2017 (78b867e26d score: replace current and real priority with priority node).
>
> Do I have a possibility to know at  compile time (in our case  EPICS) if it 
> is present or not.
>
> Background:
> We had received the following bug report:
>
> > On 1/16/19 2:51 PM, Michael Westfall via Tech-talk wrote:
> >> When compiling base R3.14.12.7 for RTEMS 4.10.2, I get the following error:
> >>
> >> /gem_swdev1/targetOS/RTEMS/rtems-4.10/bin/powerpc-rtems4.10-gcc --pipe 
> >> -B/gem_swdev1/targetOS/RTEMS/rtems-4.10/powerpc-rtems4.10/beatnik/lib/ 
> >> -specs bsp_specs -qrtems   -fasm -c   -mcpu=7400 -D__ppc_generic   
> >> -DUNIX  -O2 -g -g   -Wall   -DMY_DO_BOOTP=NULL 
> >> -DHAVE_MOTLOAD -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048 
> >> -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120 -MMD -I. -I../O.Common -I. 
> >> -I../../../src/libCom/osi/os/RTEMS -I../../../src/libCom/osi/os/posix 
> >> -I../../../src/libCom/osi/os/default -I.. -I../../../src/libCom/bucketLib 
> >> -I../../../src/libCom/ring -I../../../src/libCom/calc 
> >> -I../../../src/libCom/cvtFast -I../../../src/libCom/cppStd 
> >> -I../../../src/libCom/cxxTemplates -I../../../src/libCom/dbmf 
> >> -I../../../src/libCom/ellLib -I../../../src/libCom/env 
> >> -I../../../src/libCom/error -I../../../src/libCom/fdmgr 
> >> -I../../../src/libCom/freeList -I../../../src/libCom/gpHash 
> >> -I../../../src/libCom/iocsh -I../../../src/libCom/logClient 
> >> -I../../../src/libCom/macLib -I../..
 /../src/libCom/misc -I../../../src/libCom/osi -I../../../src/libCom/taskwd 
-I../../../src/libCom/timer -I../../../src/libCom/tsDefs 
-I/gem_swdev1/epics/R3.14.12.7/base/include/os/RTEMS 
-I/gem_swdev1/epics/R3.14.12.7/base/include 
../../../src/libCom/osi/os/RTEMS/osdThread.c
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c: In function 
> >> 'showInternalTaskInfo':
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:617: error: 'Thread_Control' 
> >> has no member named 'real_priority'
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:624: error: 'Thread_Control' 
> >> has no member named 'current_priority'
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:624: error: 'Thread_Control' 
> >> has no member named 'real_priority'
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:625: error: 'Thread_Control' 
> >> has no member named 'current_priority'
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:627: error: 'Thread_Control' 
> >> has no member named 'real_priority'
> >> ../../../src/libCom/osi/os/RTEMS/osdThread.c:627: error: 'Thread_Control' 
> >> has no member named 'current_priority'
> >> make[3]: *** [osdThread.o] Error 1
> >> make[3]: Leaving directory 
> >> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src/libCom/O.RTEMS-beatnik'
> >> make[2]: *** [install.RTEMS-beatnik] Error 2
> >> make[2]: Leaving directory 
> >> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src/libCom'
> >> make[1]: *** [libCom.install] Error 2
> >> make[1]: Leaving directory 
> >> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src'
> >> make: *** [src.install] Error 2
>
> I fixed it with this patch:
> > diff --git a/modules/libcom/src/osi/os/RTEMS/osdThread.c 
> > b/modules/libcom/src/osi/os/RTEMS/osdThread.c
> > index 769e958..2db1ca5 100644
> > --- a/modules/libcom/src/osi/os/RTEMS/osdThread.c
> > +++ b/modules/libcom/src/osi/os/RTEMS/osdThread.c
> > @@ -640,17 +640,17 @@ showInternalTaskInfo (rtems_id tid)
> >   * that priority should be displayed, not the value truncated to
> >   * the EPICS range.
> >   */
> > -epicsPri = 199-thread.real_priority;
> > +epicsPri = 199-thread.Priority_node.real_priority;
> >  if (epicsPri < 0)
> >  fprintf(epicsGetStdout(),"   <0");
> >  else if (epicsPri > 99)
> >  fprintf(epicsGetStdout(),"  >99");
> >  else
> >  fprintf(epicsGetStdout()," %4d", epicsPri);
> > -if (thread.current_priority == thread.real_priority)
> > -fprintf(epicsGetStdout(),"%4d", (int)thread.current_priority);
> > +if (thread.Priority_node.current_priority == 
> > thread.Priority_node.real_priority)
> > +fprintf(epicsGetStdout(),"%4d", 
> > (int)thread.Priority_node.current_priority);
> >  else
> > -fprintf(epicsGetStdout(),"%4d/%-3d", (int)thread.real_priority, 
> > (int)thread.current_priority);
> > +fprintf(epicsGetStdout(),"%4d/%-3d", 
> > (int)thread.Priority_node.real_priority, 
> > (int)thread.Priority_node.current_priority);
> >  showBitmap (bitbuf, thread.current_state, taskState);
> >  fprintf(epicsGetStdout(),"%8.8s", bitbuf);
> >  if (thread.current_state & (STATES_WAITING_FOR_SEMAPHORE |
> >
>
> But now it turned out that there was also a 4.10.2  variant in which the 
> priority_node structure did not yet exist:
>
> Andrew Johnson wrote
> | finally took a proper look at 

Introduction of Priority_node structure (priority.h)

2020-05-11 Thread Heinz Junkes
The Priority_node structure was committed to the 4.10 branch of RTEMS in 
December
2017 (78b867e26d score: replace current and real priority with priority node).

Do I have a possibility to know at  compile time (in our case  EPICS) if it is 
present or not. 

Background:
We had received the following bug report:

> On 1/16/19 2:51 PM, Michael Westfall via Tech-talk wrote:
>> When compiling base R3.14.12.7 for RTEMS 4.10.2, I get the following error:
>> 
>> /gem_swdev1/targetOS/RTEMS/rtems-4.10/bin/powerpc-rtems4.10-gcc --pipe 
>> -B/gem_swdev1/targetOS/RTEMS/rtems-4.10/powerpc-rtems4.10/beatnik/lib/ 
>> -specs bsp_specs -qrtems   -fasm -c   -mcpu=7400 -D__ppc_generic 
>>   -DUNIX  -O2 -g -g   -Wall   -DMY_DO_BOOTP=NULL -DHAVE_MOTLOAD 
>> -DRTEMS_NETWORK_CONFIG_MBUF_SPACE=2048 
>> -DRTEMS_NETWORK_CONFIG_CLUSTER_SPACE=5120 -MMD -I. -I../O.Common -I. 
>> -I../../../src/libCom/osi/os/RTEMS -I../../../src/libCom/osi/os/posix 
>> -I../../../src/libCom/osi/os/default -I.. -I../../../src/libCom/bucketLib 
>> -I../../../src/libCom/ring -I../../../src/libCom/calc 
>> -I../../../src/libCom/cvtFast -I../../../src/libCom/cppStd 
>> -I../../../src/libCom/cxxTemplates -I../../../src/libCom/dbmf 
>> -I../../../src/libCom/ellLib -I../../../src/libCom/env 
>> -I../../../src/libCom/error -I../../../src/libCom/fdmgr 
>> -I../../../src/libCom/freeList -I../../../src/libCom/gpHash 
>> -I../../../src/libCom/iocsh -I../../../src/libCom/logClient 
>> -I../../../src/libCom/macLib -I../../../src/libCom/misc 
>> -I../../../src/libCom/osi -I../../../src/libCom/taskwd 
>> -I../../../src/libCom/timer -I../../../src/libCom/tsDefs 
>> -I/gem_swdev1/epics/R3.14.12.7/base/include/os/RTEMS 
>> -I/gem_swdev1/epics/R3.14.12.7/base/include 
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c 
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c: In function 
>> 'showInternalTaskInfo':
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c:617: error: 'Thread_Control' 
>> has no member named 'real_priority'
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c:624: error: 'Thread_Control' 
>> has no member named 'current_priority'
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c:624: error: 'Thread_Control' 
>> has no member named 'real_priority'
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c:625: error: 'Thread_Control' 
>> has no member named 'current_priority'
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c:627: error: 'Thread_Control' 
>> has no member named 'real_priority'
>> ../../../src/libCom/osi/os/RTEMS/osdThread.c:627: error: 'Thread_Control' 
>> has no member named 'current_priority'
>> make[3]: *** [osdThread.o] Error 1
>> make[3]: Leaving directory 
>> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src/libCom/O.RTEMS-beatnik'
>> make[2]: *** [install.RTEMS-beatnik] Error 2
>> make[2]: Leaving directory 
>> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src/libCom'
>> make[1]: *** [libCom.install] Error 2
>> make[1]: Leaving directory 
>> `/gem_swdev1/epics/R3.14.12.7/epics-base-R3.14.12.7/src'
>> make: *** [src.install] Error 2

I fixed it with this patch:
> diff --git a/modules/libcom/src/osi/os/RTEMS/osdThread.c 
> b/modules/libcom/src/osi/os/RTEMS/osdThread.c
> index 769e958..2db1ca5 100644
> --- a/modules/libcom/src/osi/os/RTEMS/osdThread.c
> +++ b/modules/libcom/src/osi/os/RTEMS/osdThread.c
> @@ -640,17 +640,17 @@ showInternalTaskInfo (rtems_id tid)
>   * that priority should be displayed, not the value truncated to
>   * the EPICS range.
>   */
> -epicsPri = 199-thread.real_priority;
> +epicsPri = 199-thread.Priority_node.real_priority;
>  if (epicsPri < 0)
>  fprintf(epicsGetStdout(),"   <0");
>  else if (epicsPri > 99)
>  fprintf(epicsGetStdout(),"  >99");
>  else
>  fprintf(epicsGetStdout()," %4d", epicsPri);
> -if (thread.current_priority == thread.real_priority)
> -fprintf(epicsGetStdout(),"%4d", (int)thread.current_priority);
> +if (thread.Priority_node.current_priority == 
> thread.Priority_node.real_priority)
> +fprintf(epicsGetStdout(),"%4d", 
> (int)thread.Priority_node.current_priority);
>  else
> -fprintf(epicsGetStdout(),"%4d/%-3d", (int)thread.real_priority, 
> (int)thread.current_priority);
> +fprintf(epicsGetStdout(),"%4d/%-3d", 
> (int)thread.Priority_node.real_priority, 
> (int)thread.Priority_node.current_priority);
>  showBitmap (bitbuf, thread.current_state, taskState);
>  fprintf(epicsGetStdout(),"%8.8s", bitbuf);
>  if (thread.current_state & (STATES_WAITING_FOR_SEMAPHORE |
> 

But now it turned out that there was also a 4.10.2  variant in which the 
priority_node structure did not yet exist:

Andrew Johnson wrote 
| finally took a proper look at this bug report.

The APS has been using RTEMS 4.10.2 since 2013 (4.10.2 was tagged on
2011-12-13, I built it in December 2012) and our headers do *not* have
this change, which was committed to the 4.10 branch of