Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-04 Thread Sebastian Huber
On 03/03/2021 23:08, Gedare Bloom wrote: I think it is just invalid to shrink the stack size smaller than it is requested. If I call pthread_attr_setstacksize(), then "The stacksize attribute shall define the minimum stack size (in bytes) allocated for the created threads stack." I should not g

Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Gedare Bloom
On Wed, Mar 3, 2021 at 12:38 PM Sebastian Huber wrote: > > On 03/03/2021 19:31, Gedare Bloom wrote: > > >> Is there no guarantee that stack_size == config->stack_size? > >> > > Suppose an application requests a stack size with > > config->stack_area = m*CPU_STACK_ALIGNMENT > > config->stack_size =

RE: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Kinsey Moore
-Original Message- From: devel On Behalf Of Sebastian Huber Sent: Wednesday, March 3, 2021 02:40 To: devel@rtems.org Subject: [PATCH 4/4] score: Ensure stack alignment requirement > diff --git a/cpukit/score/src/tlsallocsize.c b/cpukit/score/src/tlsallocsize.c > index e785

Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Sebastian Huber
On 03/03/2021 19:31, Gedare Bloom wrote: Is there no guarantee that stack_size == config->stack_size? Suppose an application requests a stack size with config->stack_area = m*CPU_STACK_ALIGNMENT config->stack_size = (n*CPU_STACK_ALIGNMENT - 1) Then, you will get stack_begin = config->stac

Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Gedare Bloom
On Wed, Mar 3, 2021 at 11:20 AM Gedare Bloom wrote: > > On Wed, Mar 3, 2021 at 10:56 AM Sebastian Huber > wrote: > > > > > > On 03/03/2021 17:04, Gedare Bloom wrote: > > >> +#if CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT > > >> + stack_align = CPU_STACK_ALIGNMENT; > > >> + stack_begin = (char *)

Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Gedare Bloom
On Wed, Mar 3, 2021 at 10:56 AM Sebastian Huber wrote: > > > On 03/03/2021 17:04, Gedare Bloom wrote: > >> +#if CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT > >> + stack_align = CPU_STACK_ALIGNMENT; > >> + stack_begin = (char *) RTEMS_ALIGN_UP( (uintptr_t) stack_begin, > >> stack_align ); > >> + s

Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Sebastian Huber
On 03/03/2021 17:04, Gedare Bloom wrote: +#if CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT + stack_align = CPU_STACK_ALIGNMENT; + stack_begin = (char *) RTEMS_ALIGN_UP( (uintptr_t) stack_begin, stack_align ); + stack_end = (char *) RTEMS_ALIGN_DOWN( (uintptr_t) stack_end, stack_align ); Why ali

Re: [PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Gedare Bloom
On Wed, Mar 3, 2021 at 1:40 AM Sebastian Huber wrote: > > Make sure we meet the stack aligment requirement also for CPU ports with > CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT. > --- > cpukit/include/rtems/score/context.h | 3 +-- > cpukit/include/rtems/score/stackimpl.h | 9 + > cpukit

[PATCH 4/4] score: Ensure stack alignment requirement

2021-03-03 Thread Sebastian Huber
Make sure we meet the stack aligment requirement also for CPU ports with CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT. --- cpukit/include/rtems/score/context.h | 3 +-- cpukit/include/rtems/score/stackimpl.h | 9 + cpukit/score/src/threadinitialize.c| 9 + cpukit/score/src/tls