#3482 closed enhancement (fixed)

Relax the buffer alignment required by rtems_partition_create()

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: rtems Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Buffer alignment required by rtems_partition_create() is too strict since it is checked via _Addresses_Is_aligned() which is

RTEMS_INLINE_ROUTINE bool _Addresses_Is_aligned (
  const void *address
)
{
#if (CPU_ALIGNMENT == 0)
    return true;
#else
    return (((uintptr_t)address % CPU_ALIGNMENT) == 0);
#endif
}

The CPU_ALIGNMENT must take long double and vector data type alignment requirements into account. For the partition maintenance only pointer alignment is required. The user should ensure that its buffer is suitable for the items it wants to manage. The user should not be burdened to provide buffers with the maximum architecture alignment, e.g. why need a 16 byte aligned buffer if you want to manage items with 4 byte integers only?

Change History (3)

comment:1 Changed on Aug 3, 2018 at 11:04:28 AM by Sebastian Huber <sebastian.huber@…>

In 27bbc05/rtems:

score: Remove CPU_PARTITION_ALIGNMENT

Use the CPU_SIZEOF_POINTER alignment instead. The internal alignment
requirement is defined by the use of Chain_Node (consisting of two
pointers) to manage the free chain of partitions.

It seems that previously the condition

CPU_PARTITION_ALIGNMENT >= sizeof(Chain_Node)

was true on all CPU ports. Now, we need an additional check.

Update #3482.

comment:2 Changed on Aug 3, 2018 at 11:04:38 AM by Sebastian Huber <sebastian.huber@…>

In 83ca9f0a/rtems:

rtems: Relax partition buffer area alignment

The partition buffer area alignment required by rtems_partition_create()
was too strict since it was checked via _Addresses_Is_aligned() which
uses CPU_ALIGNMENT. The CPU_ALIGNMENT must take long double and vector
data type alignment requirements into account. For the partition
maintenance only pointer alignment is required (Chain_Node, which
consists of two pointers). The user should ensure that its partition
buffer area is suitable for the items it wants to manage. The user
should not be burdened to provide buffers with the maximum architecture
alignment, e.g. why need a 16 byte aligned buffer if you want to manage
items with 4 byte integers only?

Update #3482.

comment:3 Changed on Aug 6, 2018 at 6:04:50 AM by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In a0e6488/rtems-docs:

c-user: Update partition create documentation

Add an example.

Close #3482.

Note: See TracTickets for help on using tickets.