Re: doubt about 'bool is_executing'

2021-07-28 Thread Sebastian Huber
On 28/07/2021 21:54, Gedare Bloom wrote: Hello all, In most (all?) the SMP ports, we have in the CPU Context Control: bool is_executing; Yes, all SMP ports need this. It is used to implement a TTAS lock in the context switch: https://docs.rtems.org/branches/master/c-user/symmetric_multip

Re: [PATCH rtems-libbsd v2 2/5] usb_template: Configure template driver only for CDC Ethernet

2021-07-28 Thread Christian MAUDERER
Hello Chris, Am 29.07.21 um 02:07 schrieb Chris Johns: On 29/7/21 1:10 am, Ahamed Husni wrote: On Wed, 28 Jul 2021, 17:27 Husni Faiz, mailto:ahamedhusn...@gmail.com>> wrote: Add the conditional macro to prevent the driver from referencing the templates which are not imported yet.

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Sebastian Huber
On 28/07/2021 09:58, Chris Johns wrote: +static void +assert_lockmgr(const struct lock_object *lock, int what) +{ +  panic("lockmgr locks do not support assertions"); +} This is neither the RTEMS style nor the FreeBSD style. At some point in time it would be really nice to have a clang-format fo

Re: [PATCH 4/4] score: Move per-CPU jobs support

2021-07-28 Thread Chris Johns
On 28/7/21 9:18 pm, Sebastian Huber wrote: > Add percpujobs.c to contain the per-CPU jobs implementation. > --- > cpukit/Makefile.am| 1 + > cpukit/score/src/percpujobs.c | 124 ++ > cpukit/score/src/smpmulticastaction.c | 89 +-

[PATCH v2] Test needed for timer_create with CLOCK_MONOTONIC

2021-07-28 Thread Zacchaeus Leung
the timer_create() method can use CLOCK_MONOTONIC but there was no test for this Closes #3888 --- cpukit/include/rtems/posix/timer.h| 1 + cpukit/posix/src/psxtimercreate.c | 3 +- cpukit/posix/src/timergettime.c | 52 ++- testsuites/psxtests/psxt

Re: [PATCH rtems-libbsd v2 5/5] create-kernel-namespace for USB Template driver

2021-07-28 Thread Chris Johns
On 28/7/21 9:56 pm, Husni Faiz wrote: > Signed-off-by: Husni Faiz > --- > rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h > b/rtemsbsd/include/machine/rtems-bsd-kernel-names

Re: [PATCH rtems-libbsd v2 4/5] libbsd.py: add usb template files

2021-07-28 Thread Chris Johns
On 28/7/21 9:56 pm, Husni Faiz wrote: > add the imported template files for CDC Ethernet > register the dev_usb_template module > enable usb template in default buildset > > Signed-off-by: Husni Faiz > --- > buildset/default.ini | 1 + > buildset/minimal.ini | 3 ++- > libbsd.py| 2

Re: [PATCH rtems-libbsd v2 2/5] usb_template: Configure template driver only for CDC Ethernet

2021-07-28 Thread Chris Johns
On 29/7/21 1:10 am, Ahamed Husni wrote: > > > On Wed, 28 Jul 2021, 17:27 Husni Faiz, > wrote: > > Add the conditional macro to prevent the driver from referencing > the templates which are not imported yet. > > Include functions which adds the hw.usb

Re: [PATCH rtems-libbsd v3 1/4] Implement portable kernel symbol namespace tool

2021-07-28 Thread Chris Johns
On 29/7/21 12:27 am, Gedare Bloom wrote: > On Wed, Jul 28, 2021 at 12:50 AM Chris Johns wrote: >> >> On 28/7/21 4:38 pm, Sebastian Huber wrote: >>> On 28/07/2021 04:53, chr...@rtems.org wrote: +for sym in self.output['symbols']: +out += ['#define %s_bsd_%s' % (sym, sy

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Chris Johns
On 29/7/21 9:42 am, Gedare Bloom wrote: > On Wed, Jul 28, 2021 at 5:05 PM Chris Johns wrote: >> On 29/7/21 12:03 am, Gedare Bloom wrote: >>> On Tue, Jul 27, 2021 at 2:59 AM wrote: From: Chris Johns +static int +lockmgr_upgrade(struct lock *lk, u_int flags, struct lock_object *ilk,

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Gedare Bloom
On Wed, Jul 28, 2021 at 5:05 PM Chris Johns wrote: > > On 29/7/21 12:03 am, Gedare Bloom wrote: > > On Tue, Jul 27, 2021 at 2:59 AM wrote: > >> From: Chris Johns > >> > >> struct lock_object { > >> -#ifndef __rtems__ > >> const char *lo_name; /* Individual lock name. */ > >>

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Chris Johns
On 29/7/21 12:03 am, Gedare Bloom wrote: > On Tue, Jul 27, 2021 at 2:59 AM wrote: >> From: Chris Johns >> >> struct lock_object { >> -#ifndef __rtems__ >> const char *lo_name; /* Individual lock name. */ >> u_int lo_flags; >> u_int lo_data;/

Re: [PATCH rtems-libbsd 1/7] rtemsbsd: Catch timeout overflows

2021-07-28 Thread Chris Johns
On 28/7/21 4:44 pm, Sebastian Huber wrote: > On 28/07/2021 08:43, Chris Johns wrote: >>> Why don't we use the FreeBSD implementation one-to-one: >>> >>> freebsd-org/sys/kern/kern_clock.c >>> >> I am fixing the code that exists. I have no idea why kern_clock.c was not >> ported >> in the first plac

Re: [PATCH rtems-libbsd 5/7] kern: Add a proc0

2021-07-28 Thread Chris Johns
On 29/7/21 12:22 am, Gedare Bloom wrote: > On Tue, Jul 27, 2021 at 2:59 AM wrote: >> From: Chris Johns >> @@ -135,6 +171,8 @@ rtems_bsd_initialize(void) >> sbt_tickthreshold = bttosbt(bt_tickthreshold); >> maxid_maxcpus = (int) rtems_scheduler_get_processor_maximum(); >> >> +

doubt about 'bool is_executing'

2021-07-28 Thread Gedare Bloom
Hello all, In most (all?) the SMP ports, we have in the CPU Context Control: bool is_executing; This variable often is accessed through assembly language (i.e., during the context switch), using something like ARCH_CONTEXT_CONTROL_IS_EXECUTING_OFFSET. Unfortunately, the 'bool' type is not stand

Re: [PATCH 2/4] score: Simplify SMP processor state handling

2021-07-28 Thread Sebastian Huber
On 28/07/2021 18:17, Gedare Bloom wrote: +/** + * @brief SMP message to force the message processing in + * _SMP_Try_to_process_message(). + */ +#define SMP_MESSAGE_FORCE_PROCESSING 0x1UL + This is overlapping with SMP_MESSAGE_SHUTDOWN is that purposeful and safe to do? Any non-zero value wo

Re: [PATCH] libcsupport: Fix TOCTOU in getchark()

2021-07-28 Thread Sebastian Huber
On 28/07/2021 18:27, Joel Sherrill wrote: The commit message should explain that. I will try to improve the commit message. I don't see a CID for this one in the reports but someone should check that. I don't like their web interface and might have missed something. I noticed this while re

Re: [PATCH] libcsupport: Fix TOCTOU in getchark()

2021-07-28 Thread Joel Sherrill
On Wed, Jul 28, 2021 at 11:23 AM Gedare Bloom wrote: > > On Wed, Jul 28, 2021 at 9:13 AM Joel Sherrill wrote: > > > > Is this a Coverity issue? Does it have a CID? > > > > I remembered TOCTOU as an acronym analysis reports used > > but had to look up the meaning. I don't know what to do so someon

Re: [PATCH] libcsupport: Fix TOCTOU in getchark()

2021-07-28 Thread Gedare Bloom
On Wed, Jul 28, 2021 at 9:13 AM Joel Sherrill wrote: > > Is this a Coverity issue? Does it have a CID? > > I remembered TOCTOU as an acronym analysis reports used > but had to look up the meaning. I don't know what to do so someone > else would not have to look it up beyond explaining it in the lo

Re: [PATCH 4/4] score: Move per-CPU jobs support

2021-07-28 Thread Gedare Bloom
ok, other than notes I made on 2/4. Address the overlap with SMP_MESSAGE_SHUTDOWN, rest can be checked in without review. On Wed, Jul 28, 2021 at 5:18 AM Sebastian Huber wrote: > > Add percpujobs.c to contain the per-CPU jobs implementation. > --- > cpukit/Makefile.am| 1 +

Re: [PATCH 2/4] score: Simplify SMP processor state handling

2021-07-28 Thread Gedare Bloom
On Wed, Jul 28, 2021 at 5:18 AM Sebastian Huber wrote: > > The per-CPU states which control the SMP system initialization were added > quite > early during the SMP support development. Replace this initial implementation > with a simplified one. There is no longer a global SMP lock required whi

Re: [PATCH] libcsupport: Fix TOCTOU in getchark()

2021-07-28 Thread Joel Sherrill
Is this a Coverity issue? Does it have a CID? I remembered TOCTOU as an acronym analysis reports used but had to look up the meaning. I don't know what to do so someone else would not have to look it up beyond explaining it in the long comment. It is missing what was checked and used that flagged

Re: [PATCH rtems-libbsd v2 2/5] usb_template: Configure template driver only for CDC Ethernet

2021-07-28 Thread Ahamed Husni
On Wed, 28 Jul 2021, 17:27 Husni Faiz, wrote: > Add the conditional macro to prevent the driver from referencing > the templates which are not imported yet. > > Include functions which adds the hw.usb.template sysctl variable. > > Signed-off-by: Husni Faiz > --- > freebsd/sys/dev/usb/template/u

[PATCH] libcsupport: Fix TOCTOU in getchark()

2021-07-28 Thread Sebastian Huber
Fix format, add Doxygen comments, and reduce includes. --- cpukit/libcsupport/src/getchark.c | 21 + 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/cpukit/libcsupport/src/getchark.c b/cpukit/libcsupport/src/getchark.c index 5a9afbda7a..cfe9c022d6 100644 --- a/c

Re: [PATCH] closes #3889

2021-07-28 Thread Gedare Bloom
Please work on fixing the commit message for your patch locally as discussed before, and use git-format-patch to look at how your commit looks like in a file before you send it to the mailing list. Use -v2 with git-format-patch to prepare the patch for submission, to provide the email subject line

Re: [PATCH rtems-libbsd v3 1/4] Implement portable kernel symbol namespace tool

2021-07-28 Thread Gedare Bloom
On Wed, Jul 28, 2021 at 12:50 AM Chris Johns wrote: > > On 28/7/21 4:38 pm, Sebastian Huber wrote: > > On 28/07/2021 04:53, chr...@rtems.org wrote: > >> +for sym in self.output['symbols']: > >> +out += ['#define %s_bsd_%s' % (sym, sym)] > > > > If you add a tab after the #defin

Re: [PATCH rtems-libbsd 5/7] kern: Add a proc0

2021-07-28 Thread Gedare Bloom
On Tue, Jul 27, 2021 at 2:59 AM wrote: > > From: Chris Johns > > - Provides the thread's proc pointer and with that access to creds > > Update #4475 > --- > freebsd/sys/kern/init_main.c | 4 +++ > freebsd/sys/kern/kern_prot.c | 45 ++-- > freebsd/sys/kern/ker

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Gedare Bloom
On Wed, Jul 28, 2021 at 8:03 AM Gedare Bloom wrote: > > On Tue, Jul 27, 2021 at 2:59 AM wrote: > > > > From: Chris Johns > > > > - See `man lockmgr` > > > > - Implement the lock_object and move the RTEMS mutex to that object > > > > - Add debug support to track the locks with gdb > > > > Update

Re: [PATCH] score: Canonicalize _CPU_Fatal_halt()

2021-07-28 Thread Joel Sherrill
On Wed, Jul 28, 2021 at 8:45 AM Sebastian Huber wrote: > > On 28/07/2021 15:42, Joel Sherrill wrote: > > In reviewing horizontally, I see one implementation that calls > > printk(). Is that necessary and of value now? > > I was a bit unsure about this one. The default implementation is: > > void _

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Gedare Bloom
On Tue, Jul 27, 2021 at 2:59 AM wrote: > > From: Chris Johns > > - See `man lockmgr` > > - Implement the lock_object and move the RTEMS mutex to that object > > - Add debug support to track the locks with gdb > > Update #4475 > --- > freebsd/sys/sys/_lock.h | 10 +- > free

Re: [PATCH] score: Canonicalize _CPU_Fatal_halt()

2021-07-28 Thread Sebastian Huber
On 28/07/2021 15:42, Joel Sherrill wrote: In reviewing horizontally, I see one implementation that calls printk(). Is that necessary and of value now? I was a bit unsure about this one. The default implementation is: void _CPU_Fatal_halt( uint32_t source, CPU_Uint32ptr error ) { ISR_Level le

Re: [PATCH] score: Canonicalize _CPU_Fatal_halt()

2021-07-28 Thread Joel Sherrill
This looks pretty mechanical and OK. In reviewing horizontally, I see one implementation that calls printk(). Is that necessary and of value now? Also do we have a preference for while forever loops? I see at least two ways they are implemented. This change appears to faithfully move inline code

[PATCH] score: Canonicalize _CPU_Fatal_halt()

2021-07-28 Thread Sebastian Huber
Move _CPU_Fatal_halt() declaration to and make sure it is a proper declaration of a function which does not return. Fix the type of the error code. If necessary, add the implementation to cpu.c. Implementing _CPU_Fatal_halt() makes it possible to wrap this function for example to fully test _Te

Re: [PATCH rtems-libbsd 2/4] usb_template: Configure template driver only for CDC Ethernet

2021-07-28 Thread Ahamed Husni
Hello Christian, On Fri, Jul 16, 2021 at 1:18 AM Christian Mauderer wrote: > Hello Husni, > > On 06/07/2021 19:00, Husni Faiz wrote: > > Add the conditional macro to prevent the driver from referencing > > the templates which are not imported yet. > > > > Include functions which adds the hw.usb.

[PATCH rtems-libbsd v2 5/5] create-kernel-namespace for USB Template driver

2021-07-28 Thread Husni Faiz
Signed-off-by: Husni Faiz --- rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h | 5 + 1 file changed, 5 insertions(+) diff --git a/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h b/rtemsbsd/include/machine/rtems-bsd-kernel-namespace.h index 97cdb625..ae56ad9c 100644 --- a/rtemsbs

[PATCH rtems-libbsd v2 4/5] libbsd.py: add usb template files

2021-07-28 Thread Husni Faiz
add the imported template files for CDC Ethernet register the dev_usb_template module enable usb template in default buildset Signed-off-by: Husni Faiz --- buildset/default.ini | 1 + buildset/minimal.ini | 3 ++- libbsd.py| 25 + 3 files changed, 28 inserti

[PATCH rtems-libbsd v2 3/5] nexus-devices: Include CDC Ethernet for Beagle

2021-07-28 Thread Husni Faiz
Configure bus for CDC Ethernet Include CDC Ethernet in Beagle BSP Signed-off-by: Husni Faiz --- rtemsbsd/include/bsp/nexus-devices.h | 5 + .../include/machine/rtems-bsd-nexus-bus.h | 19 +++ 2 files changed, 24 insertions(+) diff --git a/rtemsbsd/include/bsp/n

[PATCH rtems-libbsd v2 2/5] usb_template: Configure template driver only for CDC Ethernet

2021-07-28 Thread Husni Faiz
Add the conditional macro to prevent the driver from referencing the templates which are not imported yet. Include functions which adds the hw.usb.template sysctl variable. Signed-off-by: Husni Faiz --- freebsd/sys/dev/usb/template/usb_template.c | 4 freebsd/sys/dev/usb/usb_device.c

[PATCH rtems-libbsd v2 1/5] usb_template:Import CDC Ethernet

2021-07-28 Thread Husni Faiz
Signed-off-by: Husni Faiz --- freebsd/sys/dev/usb/template/usb_template.c | 1489 + freebsd/sys/dev/usb/template/usb_template.h | 130 ++ .../sys/dev/usb/template/usb_template_cdce.c | 355 3 files changed, 1974 insertions(+) create mode 100644 freebsd/sys/dev/usb/tem

[PATCH rtems-libbsd v2 0/5] Beagle BSP: USB Template Driver for CDC Ethernet

2021-07-28 Thread Husni Faiz
This set of patches import the drivers from freebsd and configures it for the beagle bsp. Github Branch for the commits https://github.com/drac98/rtems-libbsd/commits/usb-cdce Patch for 6-freebsd-12 branch https://github.com/drac98/rtems-libbsd/commits/usb-cdce12 Husni Faiz (5): usb_template:

[PATCH 2/4] score: Simplify SMP processor state handling

2021-07-28 Thread Sebastian Huber
The per-CPU states which control the SMP system initialization were added quite early during the SMP support development. Replace this initial implementation with a simplified one. There is no longer a global SMP lock required which serialized the state changes of all processors. The new impleme

[PATCH 1/4] score: Remove processor event broadcast/receive

2021-07-28 Thread Sebastian Huber
Remove _CPU_SMP_Processor_event_broadcast() and _CPU_SMP_Processor_event_receive(). These functions are hard to use since they are subject to the lost wake up problem. --- cpukit/include/rtems/score/percpu.h | 35 ++- .../cpu/aarch64/include/rtems/score/cpu.h | 12 --

[PATCH 4/4] score: Move per-CPU jobs support

2021-07-28 Thread Sebastian Huber
Add percpujobs.c to contain the per-CPU jobs implementation. --- cpukit/Makefile.am| 1 + cpukit/score/src/percpujobs.c | 124 ++ cpukit/score/src/smpmulticastaction.c | 89 +- spec/build/cpukit/objsmp.yml | 4 +- 4

[PATCH 3/4] score: Remove SMP message multicast/broadcast

2021-07-28 Thread Sebastian Huber
Remove the unused _SMP_Send_message_multicast() and _SMP_Send_message_broadcast(). --- cpukit/include/rtems/score/smpimpl.h | 22 --- cpukit/score/src/smp.c | 40 +--- 2 files changed, 1 insertion(+), 61 deletions(-) diff --git a/cpukit/include/rt

[PATCH 0/4] Simplify SMP system initialization

2021-07-28 Thread Sebastian Huber
This patch set simplifies the per-CPU state handling during SMP system initialization and shutdown. Sebastian Huber (4): score: Remove processor event broadcast/receive score: Simplify SMP processor state handling score: Remove SMP message multicast/broadcast score: Move per-CPU jobs suppo

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Sebastian Huber
On 28/07/2021 09:58, Chris Johns wrote: Why do we need the lo_name? I suspect this could be conditional. It is useful when debugging the locks so being able to get the name in the trace is a good thing. The thread queues have already a name. Does this mean referencing the internals of the RTE

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Sebastian Huber
On 28/07/2021 09:58, Chris Johns wrote: For what do we need lo_data? This field is used in various places for different type of locks so it needs to stay. It seems this is only used to indicate if a lock recursed: sys/sys/_lock.h:u_int lo_data;/* General class spec

Re: [PATCH rtems-libbsd 3/7] sys/kern: Add lockmgr support

2021-07-28 Thread Chris Johns
On 28/7/21 4:23 pm, Sebastian Huber wrote: > On 27/07/2021 10:58, chr...@rtems.org wrote: >> From: Chris Johns >> >> - See `man lockmgr` >> >> - Implement the lock_object and move the RTEMS mutex to that object >> >> - Add debug support to track the locks with gdb >> >> Update #4475 >> --- >>   fr

Re: [PATCH rtems-libbsd 7/7] kern: Add kernel trace support (KTR)

2021-07-28 Thread Sebastian Huber
On 28/07/2021 09:40, Chris Johns wrote: On 28/7/21 4:57 pm, Sebastian Huber wrote: On 28/07/2021 08:53, Chris Johns wrote: On 28/7/21 4:27 pm, Sebastian Huber wrote: On 27/07/2021 10:58,chr...@rtems.org   wrote: diff --git a/rtemsbsd/rtems/rtems-kernel-thread.c b/rtemsbsd/rtems/rtems-kernel-t

Re: [PATCH rtems-libbsd 7/7] kern: Add kernel trace support (KTR)

2021-07-28 Thread Chris Johns
On 28/7/21 4:57 pm, Sebastian Huber wrote: > On 28/07/2021 08:53, Chris Johns wrote: >> On 28/7/21 4:27 pm, Sebastian Huber wrote: >>> On 27/07/2021 10:58,chr...@rtems.org  wrote: diff --git a/rtemsbsd/rtems/rtems-kernel-thread.c b/rtemsbsd/rtems/rtems-kernel-thread.c index 3e1e44b9.